aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/.dir-locals.el2
-rw-r--r--gdb/MAINTAINERS17
-rw-r--r--gdb/Makefile.in489
-rw-r--r--gdb/NEWS256
-rw-r--r--gdb/README37
-rw-r--r--gdb/aarch32-linux-nat.c2
-rw-r--r--gdb/aarch32-linux-nat.h2
-rw-r--r--gdb/aarch32-tdep.c2
-rw-r--r--gdb/aarch32-tdep.h2
-rw-r--r--gdb/aarch64-fbsd-nat.c12
-rw-r--r--gdb/aarch64-fbsd-tdep.c9
-rw-r--r--gdb/aarch64-fbsd-tdep.h2
-rw-r--r--gdb/aarch64-linux-nat.c85
-rw-r--r--gdb/aarch64-linux-tdep.c275
-rw-r--r--gdb/aarch64-linux-tdep.h2
-rw-r--r--gdb/aarch64-nat.c2
-rw-r--r--gdb/aarch64-nat.h6
-rw-r--r--gdb/aarch64-newlib-tdep.c6
-rw-r--r--gdb/aarch64-ravenscar-thread.c2
-rw-r--r--gdb/aarch64-ravenscar-thread.h2
-rw-r--r--gdb/aarch64-tdep.c170
-rw-r--r--gdb/aarch64-tdep.h27
-rw-r--r--gdb/aclocal.m42
-rw-r--r--gdb/acx_configure_dir.m42
-rw-r--r--gdb/ada-casefold.h2
-rw-r--r--gdb/ada-exp.h52
-rw-r--r--gdb/ada-exp.y21
-rw-r--r--gdb/ada-lang.c799
-rw-r--r--gdb/ada-lang.h17
-rw-r--r--gdb/ada-lex.l25
-rw-r--r--gdb/ada-tasks.c6
-rw-r--r--gdb/ada-typeprint.c7
-rwxr-xr-xgdb/ada-unicode.py2
-rw-r--r--gdb/ada-valprint.c7
-rw-r--r--gdb/ada-varobj.c24
-rw-r--r--gdb/addrmap.c79
-rw-r--r--gdb/addrmap.h6
-rw-r--r--gdb/agent.c10
-rw-r--r--gdb/aix-thread.c16
-rw-r--r--gdb/alloc.c2
-rw-r--r--gdb/alpha-bsd-nat.c6
-rw-r--r--gdb/alpha-bsd-tdep.c2
-rw-r--r--gdb/alpha-bsd-tdep.h2
-rw-r--r--gdb/alpha-linux-nat.c6
-rw-r--r--gdb/alpha-linux-tdep.c11
-rw-r--r--gdb/alpha-mdebug-tdep.c2
-rw-r--r--gdb/alpha-netbsd-tdep.c11
-rw-r--r--gdb/alpha-obsd-tdep.c11
-rw-r--r--gdb/alpha-tdep.c98
-rw-r--r--gdb/alpha-tdep.h2
-rw-r--r--gdb/amd-dbgapi-target.c398
-rw-r--r--gdb/amd-dbgapi-target.h7
-rw-r--r--gdb/amd64-bsd-nat.c2
-rw-r--r--gdb/amd64-bsd-nat.h2
-rw-r--r--gdb/amd64-darwin-tdep.c8
-rw-r--r--gdb/amd64-darwin-tdep.h2
-rw-r--r--gdb/amd64-dicos-tdep.c6
-rw-r--r--gdb/amd64-fbsd-nat.c10
-rw-r--r--gdb/amd64-fbsd-tdep.c9
-rw-r--r--gdb/amd64-fbsd-tdep.h2
-rw-r--r--gdb/amd64-gnu-tdep.c9
-rw-r--r--gdb/amd64-linux-nat.c25
-rw-r--r--gdb/amd64-linux-tdep.c279
-rw-r--r--gdb/amd64-linux-tdep.h2
-rw-r--r--gdb/amd64-nat.c2
-rw-r--r--gdb/amd64-nat.h2
-rw-r--r--gdb/amd64-netbsd-nat.c6
-rw-r--r--gdb/amd64-netbsd-tdep.c9
-rw-r--r--gdb/amd64-obsd-nat.c6
-rw-r--r--gdb/amd64-obsd-tdep.c9
-rw-r--r--gdb/amd64-ravenscar-thread.c2
-rw-r--r--gdb/amd64-ravenscar-thread.h2
-rw-r--r--gdb/amd64-sol2-tdep.c9
-rwxr-xr-x[-rw-r--r--]gdb/amd64-tdep.c383
-rw-r--r--gdb/amd64-tdep.h11
-rw-r--r--gdb/amd64-windows-nat.c6
-rw-r--r--gdb/amd64-windows-tdep.c6
-rw-r--r--gdb/amdgpu-tdep.c7
-rw-r--r--gdb/amdgpu-tdep.h2
-rw-r--r--gdb/annotate.c6
-rw-r--r--gdb/annotate.h2
-rw-r--r--gdb/arc-linux-nat.c6
-rw-r--r--gdb/arc-linux-tdep.c14
-rw-r--r--gdb/arc-linux-tdep.h2
-rw-r--r--gdb/arc-newlib-tdep.c6
-rw-r--r--gdb/arc-tdep.c6
-rw-r--r--gdb/arc-tdep.h2
-rw-r--r--gdb/arch-utils.c20
-rw-r--r--gdb/arch-utils.h7
-rw-r--r--gdb/arch/aarch32.c2
-rw-r--r--gdb/arch/aarch32.h2
-rw-r--r--gdb/arch/aarch64-gcs-linux.h44
-rw-r--r--gdb/arch/aarch64-insn.c2
-rw-r--r--gdb/arch/aarch64-insn.h2
-rw-r--r--gdb/arch/aarch64-mte-linux.c2
-rw-r--r--gdb/arch/aarch64-mte-linux.h2
-rw-r--r--gdb/arch/aarch64-mte.c2
-rw-r--r--gdb/arch/aarch64-mte.h2
-rw-r--r--gdb/arch/aarch64-scalable-linux.c2
-rw-r--r--gdb/arch/aarch64-scalable-linux.h2
-rw-r--r--gdb/arch/aarch64.c10
-rw-r--r--gdb/arch/aarch64.h16
-rw-r--r--gdb/arch/amd64-linux-tdesc.c33
-rw-r--r--gdb/arch/amd64-linux-tdesc.h9
-rw-r--r--gdb/arch/amd64.c27
-rw-r--r--gdb/arch/amd64.h12
-rw-r--r--gdb/arch/arc.c3
-rw-r--r--gdb/arch/arc.h2
-rw-r--r--gdb/arch/arm-get-next-pcs.c143
-rw-r--r--gdb/arch/arm-get-next-pcs.h2
-rw-r--r--gdb/arch/arm-linux.c2
-rw-r--r--gdb/arch/arm-linux.h2
-rw-r--r--gdb/arch/arm.c4
-rw-r--r--gdb/arch/arm.h19
-rw-r--r--gdb/arch/csky.c2
-rw-r--r--gdb/arch/csky.h2
-rw-r--r--gdb/arch/i386-linux-tdesc.c31
-rw-r--r--gdb/arch/i386-linux-tdesc.h7
-rw-r--r--gdb/arch/i386.c21
-rw-r--r--gdb/arch/i386.h9
-rw-r--r--gdb/arch/loongarch-insn.h2
-rw-r--r--gdb/arch/loongarch-syscall.h2
-rw-r--r--gdb/arch/loongarch.c3
-rw-r--r--gdb/arch/loongarch.h2
-rw-r--r--gdb/arch/ppc-linux-common.c2
-rw-r--r--gdb/arch/ppc-linux-common.h2
-rw-r--r--gdb/arch/ppc-linux-tdesc.h2
-rw-r--r--gdb/arch/riscv.c3
-rw-r--r--gdb/arch/riscv.h2
-rw-r--r--gdb/arch/tic6x.c2
-rw-r--r--gdb/arch/tic6x.h2
-rw-r--r--gdb/arch/x86-linux-tdesc-features.c62
-rw-r--r--gdb/arch/x86-linux-tdesc-features.h29
-rw-r--r--gdb/arch/x86-linux-tdesc.h2
-rw-r--r--gdb/arch/xtensa.h2
-rw-r--r--gdb/arm-bsd-tdep.c2
-rw-r--r--gdb/arm-fbsd-nat.c6
-rw-r--r--gdb/arm-fbsd-tdep.c11
-rw-r--r--gdb/arm-fbsd-tdep.h2
-rw-r--r--gdb/arm-linux-nat.c18
-rw-r--r--gdb/arm-linux-tdep.c21
-rw-r--r--gdb/arm-linux-tdep.h2
-rw-r--r--gdb/arm-netbsd-nat.c6
-rw-r--r--gdb/arm-netbsd-tdep.c11
-rw-r--r--gdb/arm-netbsd-tdep.h2
-rw-r--r--gdb/arm-none-tdep.c6
-rw-r--r--gdb/arm-obsd-tdep.c11
-rw-r--r--gdb/arm-pikeos-tdep.c8
-rw-r--r--gdb/arm-tdep.c40
-rw-r--r--gdb/arm-tdep.h2
-rw-r--r--gdb/arm-wince-tdep.c8
-rw-r--r--gdb/async-event.c2
-rw-r--r--gdb/async-event.h2
-rw-r--r--gdb/auto-load.c89
-rw-r--r--gdb/auto-load.h2
-rw-r--r--gdb/auxv.c6
-rw-r--r--gdb/auxv.h2
-rw-r--r--gdb/avr-tdep.c6
-rw-r--r--gdb/ax-gdb.c11
-rw-r--r--gdb/ax-gdb.h2
-rw-r--r--gdb/ax-general.c2
-rw-r--r--gdb/ax.h2
-rw-r--r--gdb/ax_cxx_compile_stdcxx.m42
-rw-r--r--gdb/bcache.c4
-rw-r--r--gdb/bcache.h4
-rw-r--r--gdb/bfd-target.c2
-rw-r--r--gdb/bfd-target.h2
-rw-r--r--gdb/bfin-linux-tdep.c6
-rw-r--r--gdb/bfin-tdep.c8
-rw-r--r--gdb/bfin-tdep.h2
-rw-r--r--gdb/block.c78
-rw-r--r--gdb/block.h46
-rw-r--r--gdb/blockframe.c2
-rw-r--r--gdb/bpf-tdep.c8
-rw-r--r--gdb/break-catch-exec.c10
-rw-r--r--gdb/break-catch-fork.c8
-rw-r--r--gdb/break-catch-load.c11
-rw-r--r--gdb/break-catch-sig.c8
-rw-r--r--gdb/break-catch-syscall.c12
-rw-r--r--gdb/break-catch-throw.c13
-rw-r--r--gdb/break-cond-parse.c24
-rw-r--r--gdb/break-cond-parse.h2
-rw-r--r--gdb/breakpoint.c126
-rw-r--r--gdb/breakpoint.h8
-rw-r--r--gdb/bsd-kvm.c6
-rw-r--r--gdb/bsd-kvm.h2
-rw-r--r--gdb/bsd-uthread.c15
-rw-r--r--gdb/bsd-uthread.h2
-rw-r--r--gdb/bt-utils.c43
-rw-r--r--gdb/bt-utils.h7
-rw-r--r--gdb/btrace.c29
-rw-r--r--gdb/btrace.h2
-rw-r--r--gdb/build-id.c10
-rw-r--r--gdb/build-id.h2
-rw-r--r--gdb/buildsym-legacy.c2
-rw-r--r--gdb/buildsym-legacy.h2
-rw-r--r--gdb/buildsym.c10
-rw-r--r--gdb/buildsym.h11
-rw-r--r--gdb/c-exp.h2
-rw-r--r--gdb/c-exp.y474
-rw-r--r--gdb/c-lang.c39
-rw-r--r--gdb/c-lang.h2
-rw-r--r--gdb/c-support.h12
-rw-r--r--gdb/c-typeprint.c15
-rw-r--r--gdb/c-valprint.c2
-rw-r--r--gdb/c-varobj.c2
-rw-r--r--gdb/cgen-remap.h2
-rw-r--r--gdb/charset-list.h2
-rw-r--r--gdb/charset.c7
-rw-r--r--gdb/charset.h2
-rwxr-xr-xgdb/check-include-guards.py2
-rw-r--r--gdb/cli-out.c2
-rw-r--r--gdb/cli-out.h2
-rw-r--r--gdb/cli/cli-cmds.c74
-rw-r--r--gdb/cli/cli-cmds.h2
-rw-r--r--gdb/cli/cli-decode.c53
-rw-r--r--gdb/cli/cli-decode.h4
-rw-r--r--gdb/cli/cli-dump.c9
-rw-r--r--gdb/cli/cli-interp.c6
-rw-r--r--gdb/cli/cli-interp.h2
-rw-r--r--gdb/cli/cli-logging.c6
-rw-r--r--gdb/cli/cli-option.c6
-rw-r--r--gdb/cli/cli-option.h2
-rw-r--r--gdb/cli/cli-script.c13
-rw-r--r--gdb/cli/cli-script.h2
-rw-r--r--gdb/cli/cli-setshow.c17
-rw-r--r--gdb/cli/cli-setshow.h2
-rw-r--r--gdb/cli/cli-style.c114
-rw-r--r--gdb/cli/cli-style.h16
-rw-r--r--gdb/cli/cli-utils.c29
-rw-r--r--gdb/cli/cli-utils.h2
-rw-r--r--gdb/coff-pe-read.c9
-rw-r--r--gdb/coff-pe-read.h2
-rw-r--r--gdb/coffread.c43
-rw-r--r--gdb/command.h4
-rw-r--r--gdb/compile/compile-c-support.c10
-rw-r--r--gdb/compile/compile-c-symbols.c8
-rw-r--r--gdb/compile/compile-c-types.c2
-rw-r--r--gdb/compile/compile-c.h2
-rw-r--r--gdb/compile/compile-cplus-symbols.c6
-rw-r--r--gdb/compile/compile-cplus-types.c6
-rw-r--r--gdb/compile/compile-cplus.h2
-rw-r--r--gdb/compile/compile-internal.h2
-rw-r--r--gdb/compile/compile-loc2c.c2
-rw-r--r--gdb/compile/compile-object-load.c2
-rw-r--r--gdb/compile/compile-object-load.h2
-rw-r--r--gdb/compile/compile-object-run.c2
-rw-r--r--gdb/compile/compile-object-run.h2
-rw-r--r--gdb/compile/compile.c7
-rw-r--r--gdb/compile/compile.h2
-rw-r--r--gdb/compile/gcc-c-plugin.h2
-rw-r--r--gdb/compile/gcc-cp-plugin.h2
-rw-r--r--gdb/complaints.c22
-rw-r--r--gdb/complaints.h2
-rw-r--r--gdb/completer.c16
-rw-r--r--gdb/completer.h4
-rw-r--r--gdb/config.in18
-rw-r--r--gdb/config/djgpp/README2
-rw-r--r--gdb/config/djgpp/djcheck.sh2
-rw-r--r--gdb/config/djgpp/djconfig.sh4
-rw-r--r--gdb/config/djgpp/langinfo.h2
-rw-r--r--gdb/config/djgpp/nl_types.h2
-rw-r--r--gdb/config/i386/nm-x86-gnu.h2
-rw-r--r--gdb/config/nm-linux.h2
-rw-r--r--gdb/config/sparc/nm-sol2.h2
-rwxr-xr-xgdb/configure909
-rw-r--r--gdb/configure.ac158
-rw-r--r--gdb/configure.nat2
-rw-r--r--gdb/configure.tgt100
-rw-r--r--gdb/contrib/ari/create-web-ari-in-src.sh4
-rwxr-xr-xgdb/contrib/ari/gdb_ari.sh6
-rw-r--r--gdb/contrib/ari/gdb_find.sh2
-rw-r--r--gdb/contrib/ari/update-web-ari.sh8
-rwxr-xr-xgdb/contrib/cc-with-tweaks.sh7
-rw-r--r--gdb/contrib/codespell-dictionary.txt1
-rw-r--r--gdb/contrib/codespell-ignore-words.txt1
-rwxr-xr-xgdb/contrib/codespell-log.sh95
-rw-r--r--gdb/contrib/expect-read1.c2
-rwxr-xr-xgdb/contrib/expect-read1.sh2
-rwxr-xr-xgdb/contrib/gdb-add-index.sh2
-rwxr-xr-xgdb/contrib/license-check-new-files.sh149
-rw-r--r--gdb/contrib/setup.cfg13
-rw-r--r--gdb/contrib/test_pubnames_and_indexes.py2
-rwxr-xr-xgdb/contrib/words.sh2
-rw-r--r--gdb/copying.c4
-rwxr-xr-xgdb/copyright.py112
-rw-r--r--gdb/corefile.c17
-rw-r--r--gdb/corelow.c488
-rw-r--r--gdb/cp-abi.c6
-rw-r--r--gdb/cp-abi.h2
-rw-r--r--gdb/cp-name-parser.y44
-rw-r--r--gdb/cp-namespace.c8
-rw-r--r--gdb/cp-support.c69
-rw-r--r--gdb/cp-support.h6
-rw-r--r--gdb/cp-valprint.c8
-rw-r--r--gdb/cris-linux-tdep.c11
-rw-r--r--gdb/cris-tdep.c12
-rw-r--r--gdb/cris-tdep.h2
-rw-r--r--gdb/csky-linux-tdep.c10
-rw-r--r--gdb/csky-tdep.c10
-rw-r--r--gdb/csky-tdep.h2
-rw-r--r--gdb/ctfread.c570
-rw-r--r--gdb/ctfread.h2
-rw-r--r--gdb/d-exp.y36
-rw-r--r--gdb/d-lang.c2
-rw-r--r--gdb/d-lang.h2
-rw-r--r--gdb/d-namespace.c2
-rw-r--r--gdb/d-valprint.c2
-rw-r--r--gdb/darwin-nat-info.c6
-rw-r--r--gdb/darwin-nat.c11
-rw-r--r--gdb/darwin-nat.h2
-rw-r--r--gdb/data-directory/Makefile.in3
-rw-r--r--gdb/dbxread.c6
-rw-r--r--gdb/dcache.c6
-rw-r--r--gdb/dcache.h2
-rw-r--r--gdb/debug.c2
-rw-r--r--gdb/debuginfod-support.c7
-rw-r--r--gdb/debuginfod-support.h2
-rw-r--r--gdb/defs.h14
-rw-r--r--gdb/dicos-tdep.c4
-rw-r--r--gdb/dicos-tdep.h2
-rw-r--r--gdb/dictionary.c32
-rw-r--r--gdb/dictionary.h2
-rw-r--r--gdb/disable-implicit-rules.mk2
-rw-r--r--gdb/disasm-flags.h2
-rw-r--r--gdb/disasm-selftests.c93
-rw-r--r--gdb/disasm-selftests.h32
-rw-r--r--gdb/disasm.c23
-rw-r--r--gdb/disasm.h2
-rw-r--r--gdb/displaced-stepping.c6
-rw-r--r--gdb/displaced-stepping.h4
-rw-r--r--gdb/doc/Doxyfile-base.in2
-rw-r--r--gdb/doc/Doxyfile-gdb-api.in2
-rw-r--r--gdb/doc/Doxyfile-gdb-xref.in2
-rw-r--r--gdb/doc/Doxyfile-gdbserver.in2
-rw-r--r--gdb/doc/Makefile.in2
-rw-r--r--gdb/doc/agentexpr.texi2
-rw-r--r--gdb/doc/all-cfg.texi2
-rw-r--r--gdb/doc/annotate.texinfo2
-rw-r--r--gdb/doc/doxy-index.in2
-rw-r--r--gdb/doc/gdb.texinfo1286
-rw-r--r--gdb/doc/guile.texi27
-rw-r--r--gdb/doc/python.texi629
-rw-r--r--gdb/doc/refcard.tex6
-rw-r--r--gdb/doc/stabs.texinfo2
-rw-r--r--gdb/dtrace-probe.c8
-rw-r--r--gdb/dummy-frame.c6
-rw-r--r--gdb/dummy-frame.h2
-rw-r--r--gdb/dwarf2/abbrev-table-cache.c2
-rw-r--r--gdb/dwarf2/abbrev-table-cache.h2
-rw-r--r--gdb/dwarf2/abbrev.c11
-rw-r--r--gdb/dwarf2/abbrev.h10
-rw-r--r--gdb/dwarf2/ada-imported.c4
-rw-r--r--gdb/dwarf2/aranges.c12
-rw-r--r--gdb/dwarf2/aranges.h2
-rw-r--r--gdb/dwarf2/attribute.c58
-rw-r--r--gdb/dwarf2/attribute.h53
-rw-r--r--gdb/dwarf2/call-site.h4
-rw-r--r--gdb/dwarf2/cooked-index-entry.c16
-rw-r--r--gdb/dwarf2/cooked-index-entry.h2
-rw-r--r--gdb/dwarf2/cooked-index-shard.c20
-rw-r--r--gdb/dwarf2/cooked-index-shard.h9
-rw-r--r--gdb/dwarf2/cooked-index-worker.c26
-rw-r--r--gdb/dwarf2/cooked-index-worker.h64
-rw-r--r--gdb/dwarf2/cooked-index.c14
-rw-r--r--gdb/dwarf2/cooked-index.h16
-rw-r--r--gdb/dwarf2/cooked-indexer.c99
-rw-r--r--gdb/dwarf2/cooked-indexer.h4
-rw-r--r--gdb/dwarf2/cu.c2
-rw-r--r--gdb/dwarf2/cu.h22
-rw-r--r--gdb/dwarf2/die.c5
-rw-r--r--gdb/dwarf2/die.h6
-rw-r--r--gdb/dwarf2/dwz.c253
-rw-r--r--gdb/dwarf2/dwz.h27
-rw-r--r--gdb/dwarf2/error.h2
-rw-r--r--gdb/dwarf2/expr.c98
-rw-r--r--gdb/dwarf2/expr.h6
-rw-r--r--gdb/dwarf2/file-and-dir.h2
-rw-r--r--gdb/dwarf2/frame-tailcall.c6
-rw-r--r--gdb/dwarf2/frame-tailcall.h2
-rw-r--r--gdb/dwarf2/frame.c22
-rw-r--r--gdb/dwarf2/frame.h63
-rw-r--r--gdb/dwarf2/index-cache.c6
-rw-r--r--gdb/dwarf2/index-cache.h2
-rw-r--r--gdb/dwarf2/index-common.c12
-rw-r--r--gdb/dwarf2/index-common.h2
-rw-r--r--gdb/dwarf2/index-write.c258
-rw-r--r--gdb/dwarf2/index-write.h2
-rw-r--r--gdb/dwarf2/leb.c2
-rw-r--r--gdb/dwarf2/leb.h2
-rw-r--r--gdb/dwarf2/line-header.c15
-rw-r--r--gdb/dwarf2/line-header.h4
-rw-r--r--gdb/dwarf2/line-program.c720
-rw-r--r--gdb/dwarf2/line-program.h47
-rw-r--r--gdb/dwarf2/loc.c51
-rw-r--r--gdb/dwarf2/loc.h113
-rw-r--r--gdb/dwarf2/macro.c3
-rw-r--r--gdb/dwarf2/macro.h2
-rw-r--r--gdb/dwarf2/mapped-index.h2
-rw-r--r--gdb/dwarf2/parent-map.h2
-rw-r--r--gdb/dwarf2/public.h27
-rw-r--r--gdb/dwarf2/read-debug-names.c180
-rw-r--r--gdb/dwarf2/read-debug-names.h2
-rw-r--r--gdb/dwarf2/read-gdb-index.c1395
-rw-r--r--gdb/dwarf2/read-gdb-index.h16
-rw-r--r--gdb/dwarf2/read.c3399
-rw-r--r--gdb/dwarf2/read.h243
-rw-r--r--gdb/dwarf2/sect-names.h2
-rw-r--r--gdb/dwarf2/section.c2
-rw-r--r--gdb/dwarf2/section.h27
-rw-r--r--gdb/dwarf2/stringify.c8
-rw-r--r--gdb/dwarf2/stringify.h2
-rw-r--r--gdb/dwarf2/tag.h14
-rw-r--r--gdb/dwarf2/types.h2
-rw-r--r--gdb/dwarf2/unit-head.c (renamed from gdb/dwarf2/comp-unit-head.c)130
-rw-r--r--gdb/dwarf2/unit-head.h (renamed from gdb/dwarf2/comp-unit-head.h)71
-rw-r--r--gdb/elf-none-tdep.c8
-rw-r--r--gdb/elf-none-tdep.h2
-rw-r--r--gdb/elfread.c20
-rw-r--r--gdb/eval.c58
-rw-r--r--gdb/event-top.c22
-rw-r--r--gdb/event-top.h2
-rw-r--r--gdb/exceptions.c5
-rw-r--r--gdb/exceptions.h2
-rw-r--r--gdb/exec.c57
-rw-r--r--gdb/exec.h2
-rw-r--r--gdb/expop.h50
-rw-r--r--gdb/expprint.c3
-rw-r--r--gdb/expression.h2
-rw-r--r--gdb/extension-priv.h11
-rw-r--r--gdb/extension.c90
-rw-r--r--gdb/extension.h12
-rw-r--r--gdb/extract-store-integer.c6
-rw-r--r--gdb/extract-store-integer.h2
-rw-r--r--gdb/f-array-walker.h2
-rw-r--r--gdb/f-exp.h2
-rw-r--r--gdb/f-exp.y12
-rw-r--r--gdb/f-lang.c6
-rw-r--r--gdb/f-lang.h2
-rw-r--r--gdb/f-typeprint.c24
-rw-r--r--gdb/f-valprint.c8
-rw-r--r--gdb/fbsd-nat.c16
-rw-r--r--gdb/fbsd-nat.h6
-rw-r--r--gdb/fbsd-tdep.c93
-rw-r--r--gdb/fbsd-tdep.h2
-rw-r--r--gdb/features/Makefile7
-rw-r--r--gdb/features/aarch64-core.xml2
-rw-r--r--gdb/features/aarch64-fpu.xml2
-rw-r--r--gdb/features/aarch64-gcs-linux.c21
-rw-r--r--gdb/features/aarch64-gcs-linux.xml18
-rw-r--r--gdb/features/aarch64-gcs.c14
-rw-r--r--gdb/features/aarch64-gcs.xml11
-rw-r--r--gdb/features/aarch64-mte.xml2
-rw-r--r--gdb/features/aarch64-pauth.xml2
-rw-r--r--gdb/features/aarch64-sme.c2
-rw-r--r--gdb/features/aarch64-sme2.c2
-rw-r--r--gdb/features/aarch64-sve.c2
-rw-r--r--gdb/features/aarch64-tls.c2
-rw-r--r--gdb/features/alpha-core.xml136
-rw-r--r--gdb/features/alpha.c111
-rw-r--r--gdb/features/alpha.xml11
-rw-r--r--gdb/features/arc/v1-aux.xml2
-rw-r--r--gdb/features/arc/v1-core.xml2
-rw-r--r--gdb/features/arc/v2-aux.xml2
-rw-r--r--gdb/features/arc/v2-core.xml2
-rw-r--r--gdb/features/arm/arm-core.xml2
-rw-r--r--gdb/features/arm/arm-fpa.xml2
-rw-r--r--gdb/features/arm/arm-m-profile-mve.xml2
-rw-r--r--gdb/features/arm/arm-m-profile-with-fpa.xml2
-rw-r--r--gdb/features/arm/arm-m-profile.xml2
-rw-r--r--gdb/features/arm/arm-m-system.xml2
-rw-r--r--gdb/features/arm/arm-secext.xml2
-rw-r--r--gdb/features/arm/arm-tls.xml2
-rw-r--r--gdb/features/arm/arm-vfpv2.xml2
-rw-r--r--gdb/features/arm/arm-vfpv3.xml2
-rw-r--r--gdb/features/arm/xscale-iwmmxt.xml2
-rw-r--r--gdb/features/btrace-conf.dtd2
-rw-r--r--gdb/features/btrace.dtd2
-rw-r--r--gdb/features/cskyv2-linux.xml2
-rw-r--r--gdb/features/feature_to_c.awk2
-rwxr-xr-xgdb/features/feature_to_c.sh2
-rw-r--r--gdb/features/gdb-target.dtd2
-rw-r--r--gdb/features/i386/32bit-avx.xml2
-rw-r--r--gdb/features/i386/32bit-avx512.xml2
-rw-r--r--gdb/features/i386/32bit-core.xml2
-rw-r--r--gdb/features/i386/32bit-linux.xml2
-rw-r--r--gdb/features/i386/32bit-segments.xml2
-rw-r--r--gdb/features/i386/32bit-sse.xml2
-rw-r--r--gdb/features/i386/32bit-ssp.c14
-rw-r--r--gdb/features/i386/32bit-ssp.xml11
-rw-r--r--gdb/features/i386/64bit-avx.xml2
-rw-r--r--gdb/features/i386/64bit-avx512.xml2
-rw-r--r--gdb/features/i386/64bit-core.xml2
-rw-r--r--gdb/features/i386/64bit-linux.xml2
-rw-r--r--gdb/features/i386/64bit-segments.xml2
-rw-r--r--gdb/features/i386/64bit-sse.xml2
-rw-r--r--gdb/features/i386/64bit-ssp.c14
-rw-r--r--gdb/features/i386/64bit-ssp.xml11
-rw-r--r--gdb/features/i386/pkeys.xml2
-rw-r--r--gdb/features/i386/x32-core.xml2
-rw-r--r--gdb/features/library-list-aix.dtd2
-rw-r--r--gdb/features/library-list-svr4.dtd2
-rw-r--r--gdb/features/library-list.dtd2
-rw-r--r--gdb/features/loongarch/base32.xml2
-rw-r--r--gdb/features/loongarch/base64.xml2
-rw-r--r--gdb/features/loongarch/fpu.xml2
-rw-r--r--gdb/features/loongarch/lasx.xml2
-rw-r--r--gdb/features/loongarch/lbt.xml2
-rw-r--r--gdb/features/loongarch/lsx.xml2
-rw-r--r--gdb/features/microblaze-core.xml2
-rw-r--r--gdb/features/microblaze-linux.xml2
-rw-r--r--gdb/features/microblaze-stack-protect.xml2
-rw-r--r--gdb/features/microblaze-with-stack-protect.xml2
-rw-r--r--gdb/features/microblaze.xml2
-rw-r--r--gdb/features/mips-cp0.xml2
-rw-r--r--gdb/features/mips-cpu.xml2
-rw-r--r--gdb/features/mips-dsp-linux.xml2
-rw-r--r--gdb/features/mips-dsp.xml2
-rw-r--r--gdb/features/mips-fpu.xml2
-rw-r--r--gdb/features/mips-linux.xml2
-rw-r--r--gdb/features/mips64-cp0.xml2
-rw-r--r--gdb/features/mips64-cpu.xml2
-rw-r--r--gdb/features/mips64-dsp-linux.xml2
-rw-r--r--gdb/features/mips64-dsp.xml2
-rw-r--r--gdb/features/mips64-fpu.xml2
-rw-r--r--gdb/features/mips64-linux.xml2
-rw-r--r--gdb/features/nds32-core.xml2
-rw-r--r--gdb/features/nds32-fpu.xml2
-rw-r--r--gdb/features/nds32-system.xml2
-rw-r--r--gdb/features/nds32.xml2
-rw-r--r--gdb/features/or1k-core.xml2
-rw-r--r--gdb/features/or1k-linux.xml2
-rw-r--r--gdb/features/or1k.xml2
-rw-r--r--gdb/features/osdata.dtd2
-rw-r--r--gdb/features/print-osabi.xsl2
-rw-r--r--gdb/features/riscv/32bit-cpu.xml2
-rw-r--r--gdb/features/riscv/32bit-fpu.xml2
-rw-r--r--gdb/features/riscv/64bit-cpu.xml2
-rw-r--r--gdb/features/riscv/64bit-fpu.xml2
-rw-r--r--gdb/features/riscv/rv32e-xregs.xml2
-rw-r--r--gdb/features/rs6000/power-altivec.xml2
-rw-r--r--gdb/features/rs6000/power-core.xml2
-rw-r--r--gdb/features/rs6000/power-dscr.xml2
-rw-r--r--gdb/features/rs6000/power-ebb.xml2
-rw-r--r--gdb/features/rs6000/power-fpu-isa205.xml2
-rw-r--r--gdb/features/rs6000/power-fpu.xml2
-rw-r--r--gdb/features/rs6000/power-htm-altivec.xml2
-rw-r--r--gdb/features/rs6000/power-htm-core.xml2
-rw-r--r--gdb/features/rs6000/power-htm-dscr.xml2
-rw-r--r--gdb/features/rs6000/power-htm-fpu.xml2
-rw-r--r--gdb/features/rs6000/power-htm-ppr.xml2
-rw-r--r--gdb/features/rs6000/power-htm-spr.xml2
-rw-r--r--gdb/features/rs6000/power-htm-tar.xml2
-rw-r--r--gdb/features/rs6000/power-htm-vsx.xml2
-rw-r--r--gdb/features/rs6000/power-linux-pmu.xml2
-rw-r--r--gdb/features/rs6000/power-linux.xml2
-rw-r--r--gdb/features/rs6000/power-oea.xml2
-rw-r--r--gdb/features/rs6000/power-ppr.xml2
-rw-r--r--gdb/features/rs6000/power-spe.xml2
-rw-r--r--gdb/features/rs6000/power-tar.xml2
-rw-r--r--gdb/features/rs6000/power-vsx.xml2
-rw-r--r--gdb/features/rs6000/power64-core.xml2
-rw-r--r--gdb/features/rs6000/power64-htm-core.xml2
-rw-r--r--gdb/features/rs6000/power64-linux.xml2
-rw-r--r--gdb/features/rs6000/powerpc-32.xml2
-rw-r--r--gdb/features/rs6000/powerpc-32l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-403.xml2
-rw-r--r--gdb/features/rs6000/powerpc-403gc.xml2
-rw-r--r--gdb/features/rs6000/powerpc-405.xml2
-rw-r--r--gdb/features/rs6000/powerpc-505.xml2
-rw-r--r--gdb/features/rs6000/powerpc-601.xml2
-rw-r--r--gdb/features/rs6000/powerpc-602.xml2
-rw-r--r--gdb/features/rs6000/powerpc-603.xml2
-rw-r--r--gdb/features/rs6000/powerpc-604.xml2
-rw-r--r--gdb/features/rs6000/powerpc-64.xml2
-rw-r--r--gdb/features/rs6000/powerpc-64l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-7400.xml2
-rw-r--r--gdb/features/rs6000/powerpc-750.xml2
-rw-r--r--gdb/features/rs6000/powerpc-860.xml2
-rw-r--r--gdb/features/rs6000/powerpc-altivec32.xml2
-rw-r--r--gdb/features/rs6000/powerpc-altivec32l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-altivec64.xml2
-rw-r--r--gdb/features/rs6000/powerpc-altivec64l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-e500.xml2
-rw-r--r--gdb/features/rs6000/powerpc-e500l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-isa205-32l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-isa205-64l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-isa205-altivec32l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-isa205-altivec64l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-isa205-vsx32l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-isa205-vsx64l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-isa207-htm-vsx32l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-isa207-htm-vsx64l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-isa207-vsx32l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-isa207-vsx64l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-vsx32.xml2
-rw-r--r--gdb/features/rs6000/powerpc-vsx32l.xml2
-rw-r--r--gdb/features/rs6000/powerpc-vsx64.xml2
-rw-r--r--gdb/features/rs6000/powerpc-vsx64l.xml2
-rw-r--r--gdb/features/rs6000/rs6000.xml2
-rw-r--r--gdb/features/rx.xml2
-rw-r--r--gdb/features/s390-acr.xml2
-rw-r--r--gdb/features/s390-core32.xml2
-rw-r--r--gdb/features/s390-core64.xml2
-rw-r--r--gdb/features/s390-fpr.xml2
-rw-r--r--gdb/features/s390-gs-linux64.xml2
-rw-r--r--gdb/features/s390-gs.xml2
-rw-r--r--gdb/features/s390-gsbc.xml2
-rw-r--r--gdb/features/s390-linux32.xml2
-rw-r--r--gdb/features/s390-linux32v1.xml2
-rw-r--r--gdb/features/s390-linux32v2.xml2
-rw-r--r--gdb/features/s390-linux64.xml2
-rw-r--r--gdb/features/s390-linux64v1.xml2
-rw-r--r--gdb/features/s390-linux64v2.xml2
-rw-r--r--gdb/features/s390-tdb.xml2
-rw-r--r--gdb/features/s390-te-linux64.xml2
-rw-r--r--gdb/features/s390-tevx-linux64.xml2
-rw-r--r--gdb/features/s390-vx-linux64.xml2
-rw-r--r--gdb/features/s390-vx.xml2
-rw-r--r--gdb/features/s390x-core64.xml2
-rw-r--r--gdb/features/s390x-gs-linux64.xml2
-rw-r--r--gdb/features/s390x-linux64.xml2
-rw-r--r--gdb/features/s390x-linux64v1.xml2
-rw-r--r--gdb/features/s390x-linux64v2.xml2
-rw-r--r--gdb/features/s390x-te-linux64.xml2
-rw-r--r--gdb/features/s390x-tevx-linux64.xml2
-rw-r--r--gdb/features/s390x-vx-linux64.xml2
-rw-r--r--gdb/features/sparc/sparc32-cp0.xml2
-rw-r--r--gdb/features/sparc/sparc32-cpu.xml2
-rw-r--r--gdb/features/sparc/sparc32-fpu.xml2
-rw-r--r--gdb/features/sparc/sparc32-solaris.xml2
-rw-r--r--gdb/features/sparc/sparc64-cp0.xml2
-rw-r--r--gdb/features/sparc/sparc64-cpu.xml2
-rw-r--r--gdb/features/sparc/sparc64-fpu.xml2
-rw-r--r--gdb/features/sparc/sparc64-solaris.xml2
-rw-r--r--gdb/features/threads.dtd2
-rw-r--r--gdb/features/tic6x-c62x-linux.xml2
-rw-r--r--gdb/features/tic6x-c64x-linux.xml2
-rw-r--r--gdb/features/tic6x-c64xp-linux.xml2
-rw-r--r--gdb/features/tic6x-c6xp.xml2
-rw-r--r--gdb/features/tic6x-core.xml2
-rw-r--r--gdb/features/tic6x-gp.xml2
-rw-r--r--gdb/features/traceframe-info.dtd2
-rw-r--r--gdb/features/xinclude.dtd2
-rw-r--r--gdb/features/z80-cpu.xml2
-rw-r--r--gdb/features/z80.xml2
-rw-r--r--gdb/filename-seen-cache.h2
-rw-r--r--gdb/filesystem.c6
-rw-r--r--gdb/filesystem.h2
-rw-r--r--gdb/findcmd.c13
-rw-r--r--gdb/findvar.c21
-rw-r--r--gdb/fork-child.c6
-rw-r--r--gdb/frame-base.c2
-rw-r--r--gdb/frame-base.h4
-rw-r--r--gdb/frame-id.h2
-rw-r--r--gdb/frame-unwind.c18
-rw-r--r--gdb/frame-unwind.h2
-rw-r--r--gdb/frame.c40
-rw-r--r--gdb/frame.h7
-rw-r--r--gdb/frv-linux-tdep.c6
-rw-r--r--gdb/frv-tdep.c9
-rw-r--r--gdb/frv-tdep.h5
-rw-r--r--gdb/ft32-tdep.c8
-rw-r--r--gdb/ft32-tdep.h2
-rwxr-xr-x[-rw-r--r--]gdb/gcore-1.in44
-rw-r--r--gdb/gcore-elf.c2
-rw-r--r--gdb/gcore-elf.h2
-rw-r--r--gdb/gcore.c70
-rw-r--r--gdb/gcore.h2
-rw-r--r--gdb/gdb-code-style.el2
-rw-r--r--gdb/gdb-demangle.c6
-rw-r--r--gdb/gdb-demangle.h2
-rw-r--r--gdb/gdb-gdb.gdb.in6
-rw-r--r--gdb/gdb-gdb.py.in10
-rw-r--r--gdb/gdb-stabs.h6
-rw-r--r--gdb/gdb.c2
-rw-r--r--gdb/gdb_bfd.c53
-rw-r--r--gdb/gdb_bfd.h11
-rw-r--r--gdb/gdb_buildall.sh4
-rw-r--r--gdb/gdb_curses.h2
-rw-r--r--gdb/gdb_expat.h2
-rwxr-xr-xgdb/gdb_mbuild.sh2
-rw-r--r--gdb/gdb_proc_service.h2
-rw-r--r--gdb/gdb_vfork.h2
-rw-r--r--gdb/gdb_wchar.h6
-rw-r--r--gdb/gdbarch-gen.c156
-rw-r--r--gdb/gdbarch-gen.h92
-rw-r--r--gdb/gdbarch-selftests.c6
-rw-r--r--gdb/gdbarch.h11
-rwxr-xr-xgdb/gdbarch.py2
-rw-r--r--gdb/gdbarch_components.py111
-rw-r--r--gdb/gdbarch_types.py2
-rw-r--r--gdb/gdbcopyright.py2
-rw-r--r--gdb/gdbcore.h50
-rw-r--r--gdb/gdbthread.h21
-rw-r--r--gdb/gdbtypes.c351
-rw-r--r--gdb/gdbtypes.h111
-rw-r--r--gdb/glibc-tdep.c2
-rw-r--r--gdb/glibc-tdep.h2
-rw-r--r--gdb/gmp-utils.c7
-rw-r--r--gdb/gmp-utils.h2
-rw-r--r--gdb/gnu-nat-mig.h2
-rw-r--r--gdb/gnu-nat.c11
-rw-r--r--gdb/gnu-nat.h2
-rw-r--r--gdb/gnu-v2-abi.c19
-rw-r--r--gdb/gnu-v3-abi.c10
-rw-r--r--gdb/go-exp.y13
-rw-r--r--gdb/go-lang.c5
-rw-r--r--gdb/go-lang.h2
-rw-r--r--gdb/go-typeprint.c2
-rw-r--r--gdb/go-valprint.c2
-rw-r--r--gdb/go32-nat.c7
-rw-r--r--gdb/gregset.h2
-rwxr-xr-xgdb/gstack-1.in3
-rw-r--r--gdb/guile/guile-internal.h11
-rw-r--r--gdb/guile/guile.c6
-rw-r--r--gdb/guile/guile.h2
-rw-r--r--gdb/guile/lib/gdb.scm2
-rw-r--r--gdb/guile/lib/gdb/boot.scm2
-rw-r--r--gdb/guile/lib/gdb/experimental.scm2
-rw-r--r--gdb/guile/lib/gdb/init.scm2
-rw-r--r--gdb/guile/lib/gdb/iterator.scm2
-rw-r--r--gdb/guile/lib/gdb/printing.scm2
-rw-r--r--gdb/guile/lib/gdb/support.scm2
-rw-r--r--gdb/guile/lib/gdb/types.scm2
-rw-r--r--gdb/guile/scm-arch.c2
-rw-r--r--gdb/guile/scm-auto-load.c2
-rw-r--r--gdb/guile/scm-block.c2
-rw-r--r--gdb/guile/scm-breakpoint.c2
-rw-r--r--gdb/guile/scm-cmd.c86
-rw-r--r--gdb/guile/scm-color.c13
-rw-r--r--gdb/guile/scm-disasm.c2
-rw-r--r--gdb/guile/scm-exception.c2
-rw-r--r--gdb/guile/scm-frame.c2
-rw-r--r--gdb/guile/scm-gsmob.c2
-rw-r--r--gdb/guile/scm-iterator.c2
-rw-r--r--gdb/guile/scm-lazy-string.c2
-rw-r--r--gdb/guile/scm-math.c2
-rw-r--r--gdb/guile/scm-objfile.c6
-rw-r--r--gdb/guile/scm-param.c43
-rw-r--r--gdb/guile/scm-ports.c12
-rw-r--r--gdb/guile/scm-pretty-print.c6
-rw-r--r--gdb/guile/scm-progspace.c8
-rw-r--r--gdb/guile/scm-safe-call.c2
-rw-r--r--gdb/guile/scm-string.c2
-rw-r--r--gdb/guile/scm-symbol.c28
-rw-r--r--gdb/guile/scm-symtab.c2
-rw-r--r--gdb/guile/scm-type.c4
-rw-r--r--gdb/guile/scm-utils.c2
-rw-r--r--gdb/guile/scm-value.c4
-rw-r--r--gdb/h8300-tdep.c8
-rw-r--r--gdb/hppa-bsd-tdep.c15
-rw-r--r--gdb/hppa-bsd-tdep.h2
-rw-r--r--gdb/hppa-linux-nat.c6
-rw-r--r--gdb/hppa-linux-offsets.h2
-rw-r--r--gdb/hppa-linux-tdep.c20
-rw-r--r--gdb/hppa-netbsd-nat.c6
-rw-r--r--gdb/hppa-netbsd-tdep.c6
-rw-r--r--gdb/hppa-obsd-nat.c6
-rw-r--r--gdb/hppa-obsd-tdep.c6
-rw-r--r--gdb/hppa-tdep.c22
-rw-r--r--gdb/hppa-tdep.h2
-rw-r--r--gdb/i386-bsd-nat.c6
-rw-r--r--gdb/i386-bsd-nat.h2
-rw-r--r--gdb/i386-bsd-tdep.c2
-rw-r--r--gdb/i386-darwin-nat.c6
-rw-r--r--gdb/i386-darwin-tdep.c8
-rw-r--r--gdb/i386-darwin-tdep.h2
-rw-r--r--gdb/i386-dicos-tdep.c6
-rw-r--r--gdb/i386-fbsd-nat.c10
-rw-r--r--gdb/i386-fbsd-tdep.c14
-rw-r--r--gdb/i386-fbsd-tdep.h7
-rw-r--r--gdb/i386-gnu-tdep.c9
-rw-r--r--gdb/i386-go32-tdep.c6
-rw-r--r--gdb/i386-linux-nat.c6
-rw-r--r--gdb/i386-linux-tdep.c20
-rw-r--r--gdb/i386-linux-tdep.h34
-rw-r--r--gdb/i386-netbsd-nat.c6
-rw-r--r--gdb/i386-netbsd-tdep.c9
-rw-r--r--gdb/i386-obsd-nat.c6
-rw-r--r--gdb/i386-obsd-tdep.c9
-rw-r--r--gdb/i386-sol2-nat.c8
-rw-r--r--gdb/i386-sol2-tdep.c9
-rw-r--r--gdb/i386-tdep.c320
-rw-r--r--gdb/i386-tdep.h113
-rw-r--r--gdb/i386-windows-nat.c6
-rw-r--r--gdb/i386-windows-tdep.c6
-rw-r--r--gdb/i387-tdep.c2
-rw-r--r--gdb/i387-tdep.h2
-rw-r--r--gdb/ia64-libunwind-tdep.c6
-rw-r--r--gdb/ia64-libunwind-tdep.h2
-rw-r--r--gdb/ia64-linux-nat.c6
-rw-r--r--gdb/ia64-linux-tdep.c15
-rw-r--r--gdb/ia64-tdep.c38
-rw-r--r--gdb/ia64-tdep.h2
-rw-r--r--gdb/ia64-vms-tdep.c8
-rw-r--r--gdb/inf-child.c8
-rw-r--r--gdb/inf-child.h6
-rw-r--r--gdb/inf-loop.c4
-rw-r--r--gdb/inf-loop.h2
-rw-r--r--gdb/inf-ptrace.c2
-rw-r--r--gdb/inf-ptrace.h2
-rw-r--r--gdb/infcall.c34
-rw-r--r--gdb/infcall.h2
-rw-r--r--gdb/infcmd.c85
-rw-r--r--gdb/inferior-iter.h2
-rw-r--r--gdb/inferior.c29
-rw-r--r--gdb/inferior.h62
-rw-r--r--gdb/inflow.c39
-rw-r--r--gdb/infrun.c437
-rw-r--r--gdb/infrun.h15
-rw-r--r--gdb/inline-frame.c6
-rw-r--r--gdb/inline-frame.h2
-rw-r--r--gdb/interps.c6
-rw-r--r--gdb/interps.h10
-rw-r--r--gdb/iq2000-tdep.c8
-rw-r--r--gdb/jit-reader.in2
-rw-r--r--gdb/jit.c71
-rw-r--r--gdb/jit.h2
-rw-r--r--gdb/language.c9
-rw-r--r--gdb/language.h2
-rw-r--r--gdb/linespec.c203
-rw-r--r--gdb/linespec.h2
-rw-r--r--gdb/linux-fork.c11
-rw-r--r--gdb/linux-fork.h2
-rw-r--r--gdb/linux-nat-trad.c2
-rw-r--r--gdb/linux-nat-trad.h2
-rw-r--r--gdb/linux-nat.c94
-rw-r--r--gdb/linux-nat.h24
-rw-r--r--gdb/linux-record.c2
-rw-r--r--gdb/linux-record.h2
-rw-r--r--gdb/linux-tdep.c346
-rw-r--r--gdb/linux-tdep.h24
-rw-r--r--gdb/linux-thread-db.c36
-rw-r--r--gdb/lm32-tdep.c6
-rw-r--r--gdb/location.c19
-rw-r--r--gdb/location.h2
-rw-r--r--gdb/loongarch-linux-nat.c17
-rw-r--r--gdb/loongarch-linux-tdep.c16
-rw-r--r--gdb/loongarch-tdep.c407
-rw-r--r--gdb/loongarch-tdep.h2
-rw-r--r--gdb/m2-exp.h2
-rw-r--r--gdb/m2-exp.y8
-rw-r--r--gdb/m2-lang.c2
-rw-r--r--gdb/m2-lang.h2
-rw-r--r--gdb/m2-typeprint.c2
-rw-r--r--gdb/m2-valprint.c2
-rw-r--r--gdb/m32c-tdep.c6
-rw-r--r--gdb/m32r-linux-nat.c6
-rw-r--r--gdb/m32r-linux-tdep.c10
-rw-r--r--gdb/m32r-tdep.c6
-rw-r--r--gdb/m32r-tdep.h2
-rw-r--r--gdb/m68hc11-tdep.c6
-rw-r--r--gdb/m68k-bsd-nat.c6
-rw-r--r--gdb/m68k-bsd-tdep.c9
-rw-r--r--gdb/m68k-linux-nat.c6
-rw-r--r--gdb/m68k-linux-tdep.c10
-rw-r--r--gdb/m68k-tdep.c6
-rw-r--r--gdb/m68k-tdep.h2
-rw-r--r--gdb/machoread.c20
-rw-r--r--gdb/macrocmd.c43
-rw-r--r--gdb/macroexp.c2
-rw-r--r--gdb/macroexp.h2
-rw-r--r--gdb/macroscope.c47
-rw-r--r--gdb/macroscope.h22
-rw-r--r--gdb/macrotab.c2
-rw-r--r--gdb/macrotab.h2
-rw-r--r--gdb/main.c88
-rw-r--r--gdb/main.h5
-rw-r--r--gdb/maint-test-options.c6
-rw-r--r--gdb/maint-test-settings.c6
-rw-r--r--gdb/maint.c139
-rw-r--r--gdb/maint.h38
-rwxr-xr-xgdb/make-init-c27
-rwxr-xr-xgdb/make-target-delegates.py2
-rw-r--r--gdb/mdebugread.c96
-rw-r--r--gdb/mdebugread.h35
-rw-r--r--gdb/mem-break.c2
-rw-r--r--gdb/memattr.c6
-rw-r--r--gdb/memattr.h2
-rw-r--r--gdb/memory-map.c2
-rw-r--r--gdb/memory-map.h2
-rw-r--r--gdb/memrange.c2
-rw-r--r--gdb/memrange.h2
-rw-r--r--gdb/memtag.c2
-rw-r--r--gdb/memtag.h2
-rw-r--r--gdb/mep-tdep.c6
-rw-r--r--gdb/mi/mi-cmd-break.c5
-rw-r--r--gdb/mi/mi-cmd-break.h2
-rw-r--r--gdb/mi/mi-cmd-catch.c2
-rw-r--r--gdb/mi/mi-cmd-disas.c2
-rw-r--r--gdb/mi/mi-cmd-env.c6
-rw-r--r--gdb/mi/mi-cmd-file.c7
-rw-r--r--gdb/mi/mi-cmd-info.c2
-rw-r--r--gdb/mi/mi-cmd-stack.c6
-rw-r--r--gdb/mi/mi-cmd-target.c2
-rw-r--r--gdb/mi/mi-cmd-var.c5
-rw-r--r--gdb/mi/mi-cmds.c6
-rw-r--r--gdb/mi/mi-cmds.h2
-rw-r--r--gdb/mi/mi-common.c2
-rw-r--r--gdb/mi/mi-common.h2
-rw-r--r--gdb/mi/mi-console.c2
-rw-r--r--gdb/mi/mi-console.h2
-rw-r--r--gdb/mi/mi-getopt.c2
-rw-r--r--gdb/mi/mi-getopt.h2
-rw-r--r--gdb/mi/mi-interp.c18
-rw-r--r--gdb/mi/mi-interp.h2
-rw-r--r--gdb/mi/mi-main.c17
-rw-r--r--gdb/mi/mi-main.h2
-rw-r--r--gdb/mi/mi-out.c2
-rw-r--r--gdb/mi/mi-out.h2
-rw-r--r--gdb/mi/mi-parse.c13
-rw-r--r--gdb/mi/mi-parse.h2
-rw-r--r--gdb/mi/mi-symbol-cmds.c2
-rw-r--r--gdb/microblaze-linux-tdep.c13
-rw-r--r--gdb/microblaze-tdep.c100
-rw-r--r--gdb/microblaze-tdep.h4
-rw-r--r--gdb/mingw-hdep.c56
-rw-r--r--gdb/minidebug.c2
-rw-r--r--gdb/minsyms.c199
-rw-r--r--gdb/minsyms.h4
-rw-r--r--gdb/mips-fbsd-nat.c6
-rw-r--r--gdb/mips-fbsd-tdep.c69
-rw-r--r--gdb/mips-fbsd-tdep.h2
-rw-r--r--gdb/mips-linux-nat.c6
-rw-r--r--gdb/mips-linux-tdep.c82
-rw-r--r--gdb/mips-linux-tdep.h2
-rw-r--r--gdb/mips-netbsd-nat.c6
-rw-r--r--gdb/mips-netbsd-tdep.c66
-rw-r--r--gdb/mips-netbsd-tdep.h2
-rw-r--r--gdb/mips-sde-tdep.c6
-rw-r--r--gdb/mips-tdep.c10
-rw-r--r--gdb/mips-tdep.h2
-rw-r--r--gdb/mips64-obsd-nat.c6
-rw-r--r--gdb/mips64-obsd-tdep.c9
-rw-r--r--gdb/mipsread.c18
-rw-r--r--gdb/mn10300-linux-tdep.c10
-rw-r--r--gdb/mn10300-tdep.c6
-rw-r--r--gdb/mn10300-tdep.h2
-rw-r--r--gdb/moxie-tdep.c10
-rw-r--r--gdb/moxie-tdep.h2
-rw-r--r--gdb/msp430-tdep.c6
-rw-r--r--gdb/namespace.c2
-rw-r--r--gdb/namespace.h2
-rw-r--r--gdb/nat/aarch64-hw-point.c8
-rw-r--r--gdb/nat/aarch64-hw-point.h2
-rw-r--r--gdb/nat/aarch64-linux-hw-point.c2
-rw-r--r--gdb/nat/aarch64-linux-hw-point.h2
-rw-r--r--gdb/nat/aarch64-linux.c2
-rw-r--r--gdb/nat/aarch64-linux.h2
-rw-r--r--gdb/nat/aarch64-mte-linux-ptrace.c2
-rw-r--r--gdb/nat/aarch64-mte-linux-ptrace.h2
-rw-r--r--gdb/nat/aarch64-scalable-linux-ptrace.c2
-rw-r--r--gdb/nat/aarch64-scalable-linux-ptrace.h2
-rw-r--r--gdb/nat/aarch64-scalable-linux-sigcontext.h2
-rw-r--r--gdb/nat/amd64-linux-siginfo.c2
-rw-r--r--gdb/nat/amd64-linux-siginfo.h2
-rw-r--r--gdb/nat/fork-inferior.c2
-rw-r--r--gdb/nat/fork-inferior.h2
-rw-r--r--gdb/nat/gdb_ptrace.h2
-rw-r--r--gdb/nat/gdb_thread_db.h2
-rw-r--r--gdb/nat/i386-linux.c2
-rw-r--r--gdb/nat/i386-linux.h2
-rw-r--r--gdb/nat/linux-btrace.c2
-rw-r--r--gdb/nat/linux-btrace.h2
-rw-r--r--gdb/nat/linux-namespaces.c169
-rw-r--r--gdb/nat/linux-namespaces.h13
-rw-r--r--gdb/nat/linux-nat.h2
-rw-r--r--gdb/nat/linux-osdata.c17
-rw-r--r--gdb/nat/linux-osdata.h2
-rw-r--r--gdb/nat/linux-personality.c2
-rw-r--r--gdb/nat/linux-personality.h2
-rw-r--r--gdb/nat/linux-procfs.c32
-rw-r--r--gdb/nat/linux-procfs.h16
-rw-r--r--gdb/nat/linux-ptrace.c47
-rw-r--r--gdb/nat/linux-ptrace.h2
-rw-r--r--gdb/nat/linux-waitpid.c2
-rw-r--r--gdb/nat/linux-waitpid.h2
-rw-r--r--gdb/nat/loongarch-hw-point.c2
-rw-r--r--gdb/nat/loongarch-hw-point.h2
-rw-r--r--gdb/nat/loongarch-linux-hw-point.c2
-rw-r--r--gdb/nat/loongarch-linux-hw-point.h2
-rw-r--r--gdb/nat/loongarch-linux.c2
-rw-r--r--gdb/nat/loongarch-linux.h2
-rw-r--r--gdb/nat/mips-linux-watch.c2
-rw-r--r--gdb/nat/mips-linux-watch.h2
-rw-r--r--gdb/nat/netbsd-nat.c2
-rw-r--r--gdb/nat/netbsd-nat.h2
-rw-r--r--gdb/nat/ppc-linux.c2
-rw-r--r--gdb/nat/ppc-linux.h2
-rw-r--r--gdb/nat/riscv-linux-tdesc.c2
-rw-r--r--gdb/nat/riscv-linux-tdesc.h2
-rw-r--r--gdb/nat/windows-nat.c2
-rw-r--r--gdb/nat/windows-nat.h2
-rw-r--r--gdb/nat/x86-cpuid.h2
-rw-r--r--gdb/nat/x86-dregs.c2
-rw-r--r--gdb/nat/x86-dregs.h2
-rw-r--r--gdb/nat/x86-gcc-cpuid.h155
-rw-r--r--gdb/nat/x86-linux-dregs.c2
-rw-r--r--gdb/nat/x86-linux-dregs.h2
-rw-r--r--gdb/nat/x86-linux-tdesc.c22
-rw-r--r--gdb/nat/x86-linux-tdesc.h9
-rw-r--r--gdb/nat/x86-linux.c61
-rw-r--r--gdb/nat/x86-linux.h6
-rw-r--r--gdb/nat/x86-xstate.c2
-rw-r--r--gdb/nat/x86-xstate.h2
-rw-r--r--gdb/nds32-tdep.c8
-rw-r--r--gdb/nds32-tdep.h2
-rw-r--r--gdb/netbsd-nat.c14
-rw-r--r--gdb/netbsd-nat.h2
-rw-r--r--gdb/netbsd-tdep.c2
-rw-r--r--gdb/netbsd-tdep.h2
-rw-r--r--gdb/objc-lang.c43
-rw-r--r--gdb/objc-lang.h2
-rw-r--r--gdb/objfile-flags.h2
-rw-r--r--gdb/objfiles.c104
-rw-r--r--gdb/objfiles.h135
-rw-r--r--gdb/obsd-nat.c2
-rw-r--r--gdb/obsd-nat.h2
-rw-r--r--gdb/obsd-tdep.c2
-rw-r--r--gdb/obsd-tdep.h2
-rw-r--r--gdb/observable.c7
-rw-r--r--gdb/observable.h8
-rw-r--r--gdb/opencl-lang.c2
-rw-r--r--gdb/or1k-linux-nat.c6
-rw-r--r--gdb/or1k-linux-tdep.c12
-rw-r--r--gdb/or1k-linux-tdep.h2
-rw-r--r--gdb/or1k-tdep.c7
-rw-r--r--gdb/or1k-tdep.h2
-rw-r--r--gdb/osabi.c6
-rw-r--r--gdb/osabi.h2
-rw-r--r--gdb/osdata.c6
-rw-r--r--gdb/osdata.h2
-rw-r--r--gdb/p-exp.y27
-rw-r--r--gdb/p-lang.c3
-rw-r--r--gdb/p-lang.h2
-rw-r--r--gdb/p-typeprint.c7
-rw-r--r--gdb/p-valprint.c6
-rw-r--r--gdb/pager.h19
-rw-r--r--gdb/parse.c11
-rw-r--r--gdb/parser-defs.h5
-rw-r--r--gdb/posix-hdep.c2
-rw-r--r--gdb/ppc-fbsd-nat.c6
-rw-r--r--gdb/ppc-fbsd-tdep.c12
-rw-r--r--gdb/ppc-fbsd-tdep.h2
-rw-r--r--gdb/ppc-linux-nat.c6
-rw-r--r--gdb/ppc-linux-tdep.c143
-rw-r--r--gdb/ppc-linux-tdep.h2
-rw-r--r--gdb/ppc-netbsd-nat.c6
-rw-r--r--gdb/ppc-netbsd-tdep.c9
-rw-r--r--gdb/ppc-netbsd-tdep.h2
-rw-r--r--gdb/ppc-obsd-nat.c6
-rw-r--r--gdb/ppc-obsd-tdep.c9
-rw-r--r--gdb/ppc-obsd-tdep.h2
-rw-r--r--gdb/ppc-ravenscar-thread.c2
-rw-r--r--gdb/ppc-ravenscar-thread.h2
-rw-r--r--gdb/ppc-sysv-tdep.c9
-rw-r--r--gdb/ppc-tdep.h2
-rw-r--r--gdb/ppc64-tdep.c2
-rw-r--r--gdb/ppc64-tdep.h2
-rw-r--r--gdb/printcmd.c63
-rw-r--r--gdb/probe.c45
-rw-r--r--gdb/probe.h2
-rw-r--r--gdb/proc-api.c6
-rw-r--r--gdb/proc-events.c6
-rw-r--r--gdb/proc-flags.c2
-rw-r--r--gdb/proc-service.c6
-rw-r--r--gdb/proc-service.list2
-rw-r--r--gdb/proc-utils.h2
-rw-r--r--gdb/proc-why.c2
-rw-r--r--gdb/process-stratum-target.c2
-rw-r--r--gdb/process-stratum-target.h7
-rw-r--r--gdb/procfs.c27
-rw-r--r--gdb/procfs.h2
-rw-r--r--gdb/producer.c10
-rw-r--r--gdb/producer.h2
-rw-r--r--gdb/progspace-and-thread.c2
-rw-r--r--gdb/progspace-and-thread.h2
-rw-r--r--gdb/progspace.c53
-rw-r--r--gdb/progspace.h80
-rw-r--r--gdb/prologue-value.c2
-rw-r--r--gdb/prologue-value.h2
-rw-r--r--gdb/psymtab.c107
-rw-r--r--gdb/psymtab.h24
-rw-r--r--gdb/pyproject.toml3
-rw-r--r--gdb/python/lib/gdb/FrameDecorator.py2
-rw-r--r--gdb/python/lib/gdb/FrameIterator.py2
-rw-r--r--gdb/python/lib/gdb/__init__.py373
-rw-r--r--gdb/python/lib/gdb/command/__init__.py2
-rw-r--r--gdb/python/lib/gdb/command/explore.py2
-rw-r--r--gdb/python/lib/gdb/command/frame_filters.py25
-rw-r--r--gdb/python/lib/gdb/command/missing_files.py12
-rw-r--r--gdb/python/lib/gdb/command/pretty_printers.py12
-rw-r--r--gdb/python/lib/gdb/command/prompt.py2
-rw-r--r--gdb/python/lib/gdb/command/type_printers.py2
-rw-r--r--gdb/python/lib/gdb/command/unwinders.py2
-rw-r--r--gdb/python/lib/gdb/command/xmethods.py10
-rw-r--r--gdb/python/lib/gdb/dap/__init__.py3
-rw-r--r--gdb/python/lib/gdb/dap/breakpoint.py49
-rw-r--r--gdb/python/lib/gdb/dap/bt.py2
-rw-r--r--gdb/python/lib/gdb/dap/completions.py7
-rw-r--r--gdb/python/lib/gdb/dap/disassemble.py2
-rw-r--r--gdb/python/lib/gdb/dap/evaluate.py8
-rw-r--r--gdb/python/lib/gdb/dap/events.py13
-rw-r--r--gdb/python/lib/gdb/dap/frames.py8
-rw-r--r--gdb/python/lib/gdb/dap/globalvars.py3
-rw-r--r--gdb/python/lib/gdb/dap/io.py2
-rw-r--r--gdb/python/lib/gdb/dap/launch.py3
-rw-r--r--gdb/python/lib/gdb/dap/locations.py2
-rw-r--r--gdb/python/lib/gdb/dap/memory.py2
-rw-r--r--gdb/python/lib/gdb/dap/modules.py2
-rw-r--r--gdb/python/lib/gdb/dap/next.py29
-rw-r--r--gdb/python/lib/gdb/dap/pause.py2
-rw-r--r--gdb/python/lib/gdb/dap/scopes.py7
-rw-r--r--gdb/python/lib/gdb/dap/server.py130
-rw-r--r--gdb/python/lib/gdb/dap/sources.py11
-rw-r--r--gdb/python/lib/gdb/dap/startup.py12
-rw-r--r--gdb/python/lib/gdb/dap/state.py2
-rw-r--r--gdb/python/lib/gdb/dap/threads.py25
-rw-r--r--gdb/python/lib/gdb/dap/typecheck.py2
-rw-r--r--gdb/python/lib/gdb/dap/varref.py15
-rw-r--r--gdb/python/lib/gdb/disassembler.py20
-rw-r--r--gdb/python/lib/gdb/frames.py2
-rw-r--r--gdb/python/lib/gdb/function/__init__.py2
-rw-r--r--gdb/python/lib/gdb/function/as_string.py2
-rw-r--r--gdb/python/lib/gdb/function/caller_is.py2
-rw-r--r--gdb/python/lib/gdb/function/strfns.py2
-rw-r--r--gdb/python/lib/gdb/missing_debug.py2
-rw-r--r--gdb/python/lib/gdb/missing_files.py2
-rw-r--r--gdb/python/lib/gdb/missing_objfile.py2
-rw-r--r--gdb/python/lib/gdb/printer/__init__.py2
-rw-r--r--gdb/python/lib/gdb/printing.py21
-rw-r--r--gdb/python/lib/gdb/prompt.py2
-rw-r--r--gdb/python/lib/gdb/ptwrite.py2
-rw-r--r--gdb/python/lib/gdb/styling.py13
-rw-r--r--gdb/python/lib/gdb/types.py2
-rw-r--r--gdb/python/lib/gdb/unwinder.py2
-rw-r--r--gdb/python/lib/gdb/xmethod.py2
-rw-r--r--gdb/python/py-all-events.def2
-rw-r--r--gdb/python/py-auto-load.c2
-rw-r--r--gdb/python/py-block.c3
-rw-r--r--gdb/python/py-bpevent.c2
-rw-r--r--gdb/python/py-breakpoint.c8
-rw-r--r--gdb/python/py-cmd.c110
-rw-r--r--gdb/python/py-color.c79
-rw-r--r--gdb/python/py-color.h2
-rw-r--r--gdb/python/py-connection.c6
-rw-r--r--gdb/python/py-continueevent.c2
-rw-r--r--gdb/python/py-corefile.c684
-rw-r--r--gdb/python/py-dap.c6
-rw-r--r--gdb/python/py-disasm.c98
-rw-r--r--gdb/python/py-event-types.def4
-rw-r--r--gdb/python/py-event.c2
-rw-r--r--gdb/python/py-event.h2
-rw-r--r--gdb/python/py-events.h2
-rw-r--r--gdb/python/py-evtregistry.c2
-rw-r--r--gdb/python/py-evts.c2
-rw-r--r--gdb/python/py-exitedevent.c2
-rw-r--r--gdb/python/py-finishbreakpoint.c8
-rw-r--r--gdb/python/py-frame.c2
-rw-r--r--gdb/python/py-framefilter.c4
-rw-r--r--gdb/python/py-function.c2
-rw-r--r--gdb/python/py-gdb-readline.c6
-rw-r--r--gdb/python/py-inferior.c20
-rw-r--r--gdb/python/py-infevents.c4
-rw-r--r--gdb/python/py-infthread.c35
-rw-r--r--gdb/python/py-instruction.c2
-rw-r--r--gdb/python/py-instruction.h2
-rw-r--r--gdb/python/py-lazy-string.c2
-rw-r--r--gdb/python/py-linetable.c2
-rw-r--r--gdb/python/py-membuf.c2
-rw-r--r--gdb/python/py-mi.c8
-rw-r--r--gdb/python/py-micmd.c10
-rw-r--r--gdb/python/py-newobjfileevent.c2
-rw-r--r--gdb/python/py-objfile.c14
-rw-r--r--gdb/python/py-param.c20
-rw-r--r--gdb/python/py-prettyprint.c6
-rw-r--r--gdb/python/py-progspace.c6
-rw-r--r--gdb/python/py-record-btrace.c2
-rw-r--r--gdb/python/py-record-btrace.h2
-rw-r--r--gdb/python/py-record-full.c2
-rw-r--r--gdb/python/py-record-full.h2
-rw-r--r--gdb/python/py-record.c5
-rw-r--r--gdb/python/py-record.h2
-rw-r--r--gdb/python/py-ref.h2
-rw-r--r--gdb/python/py-registers.c5
-rw-r--r--gdb/python/py-signalevent.c2
-rw-r--r--gdb/python/py-stopevent.c2
-rw-r--r--gdb/python/py-stopevent.h2
-rw-r--r--gdb/python/py-style.c818
-rw-r--r--gdb/python/py-symbol.c46
-rw-r--r--gdb/python/py-symtab.c2
-rw-r--r--gdb/python/py-threadevent.c2
-rw-r--r--gdb/python/py-tui.c2
-rw-r--r--gdb/python/py-type.c25
-rw-r--r--gdb/python/py-uiout.h2
-rw-r--r--gdb/python/py-unwind.c14
-rw-r--r--gdb/python/py-utils.c2
-rw-r--r--gdb/python/py-value.c87
-rw-r--r--gdb/python/py-varobj.c2
-rw-r--r--gdb/python/py-xmethods.c6
-rw-r--r--gdb/python/python-internal.h47
-rw-r--r--gdb/python/python.c131
-rw-r--r--gdb/python/python.h2
-rw-r--r--gdb/quick-symbol.h68
-rw-r--r--gdb/ravenscar-thread.c8
-rw-r--r--gdb/ravenscar-thread.h2
-rw-r--r--gdb/record-btrace.c89
-rw-r--r--gdb/record-btrace.h2
-rw-r--r--gdb/record-full.c95
-rw-r--r--gdb/record-full.h2
-rw-r--r--gdb/record.c15
-rw-r--r--gdb/record.h2
-rw-r--r--gdb/regcache-dump.c6
-rw-r--r--gdb/regcache.c13
-rw-r--r--gdb/regcache.h2
-rwxr-xr-xgdb/regformats/regdat.sh2
-rw-r--r--gdb/regformats/regdef.h2
-rw-r--r--gdb/reggroups.c6
-rw-r--r--gdb/reggroups.h2
-rw-r--r--gdb/registry.h2
-rw-r--r--gdb/regset.h2
-rw-r--r--gdb/remote-fileio.c2
-rw-r--r--gdb/remote-fileio.h2
-rw-r--r--gdb/remote-notif.c6
-rw-r--r--gdb/remote-notif.h2
-rw-r--r--gdb/remote-sim.c7
-rw-r--r--gdb/remote.c750
-rw-r--r--gdb/remote.h2
-rw-r--r--gdb/reply_mig_hack.awk2
-rw-r--r--gdb/reverse.c6
-rw-r--r--gdb/riscv-fbsd-nat.c6
-rw-r--r--gdb/riscv-fbsd-tdep.c15
-rw-r--r--gdb/riscv-fbsd-tdep.h2
-rw-r--r--gdb/riscv-linux-canonicalize-syscall-gen.c361
-rw-r--r--gdb/riscv-linux-nat.c6
-rw-r--r--gdb/riscv-linux-tdep.c376
-rw-r--r--gdb/riscv-linux-tdep.h29
-rw-r--r--gdb/riscv-none-tdep.c6
-rw-r--r--gdb/riscv-ravenscar-thread.c2
-rw-r--r--gdb/riscv-ravenscar-thread.h2
-rw-r--r--gdb/riscv-tdep.c748
-rw-r--r--gdb/riscv-tdep.h18
-rw-r--r--gdb/rl78-tdep.c6
-rw-r--r--gdb/rs6000-aix-nat.c6
-rw-r--r--gdb/rs6000-aix-tdep.c17
-rw-r--r--gdb/rs6000-aix-tdep.h2
-rw-r--r--gdb/rs6000-lynx178-tdep.c6
-rw-r--r--gdb/rs6000-tdep.c12
-rw-r--r--gdb/run-on-main-thread.c47
-rw-r--r--gdb/run-on-main-thread.h2
-rw-r--r--gdb/rust-exp.h38
-rw-r--r--gdb/rust-lang.c65
-rw-r--r--gdb/rust-lang.h2
-rw-r--r--gdb/rust-parse.c12
-rw-r--r--gdb/rx-tdep.c6
-rw-r--r--gdb/s12z-tdep.c8
-rw-r--r--gdb/s390-linux-nat.c6
-rw-r--r--gdb/s390-linux-tdep.c57
-rw-r--r--gdb/s390-linux-tdep.h2
-rw-r--r--gdb/s390-tdep.c68
-rw-r--r--gdb/s390-tdep.h2
-rw-r--r--gdb/sanitize.m42
-rw-r--r--gdb/scoped-mock-context.h2
-rw-r--r--gdb/selftest-arch.c2
-rw-r--r--gdb/selftest-arch.h2
-rw-r--r--gdb/sentinel-frame.c2
-rw-r--r--gdb/sentinel-frame.h2
-rw-r--r--gdb/ser-base.c2
-rw-r--r--gdb/ser-base.h2
-rw-r--r--gdb/ser-event.c2
-rw-r--r--gdb/ser-event.h2
-rw-r--r--gdb/ser-go32.c6
-rw-r--r--gdb/ser-mingw.c10
-rw-r--r--gdb/ser-pipe.c6
-rw-r--r--gdb/ser-tcp.c6
-rw-r--r--gdb/ser-tcp.h2
-rw-r--r--gdb/ser-uds.c6
-rw-r--r--gdb/ser-unix.c168
-rw-r--r--gdb/ser-unix.h2
-rw-r--r--gdb/serial.c9
-rw-r--r--gdb/serial.h2
-rw-r--r--gdb/setup.cfg3
-rw-r--r--gdb/sh-linux-tdep.c10
-rw-r--r--gdb/sh-netbsd-nat.c6
-rw-r--r--gdb/sh-netbsd-tdep.c9
-rw-r--r--gdb/sh-tdep.c6
-rw-r--r--gdb/sh-tdep.h2
-rw-r--r--gdb/sim-regno.h2
-rw-r--r--gdb/skip.c6
-rw-r--r--gdb/skip.h2
-rw-r--r--gdb/sol-thread.c23
-rw-r--r--gdb/sol2-tdep.c2
-rw-r--r--gdb/sol2-tdep.h2
-rw-r--r--gdb/solib-aix.c102
-rw-r--r--gdb/solib-aix.h9
-rw-r--r--gdb/solib-darwin.c107
-rw-r--r--gdb/solib-darwin.h8
-rw-r--r--gdb/solib-dsbt.c111
-rw-r--r--gdb/solib-dsbt.h8
-rw-r--r--gdb/solib-frv.c123
-rw-r--r--gdb/solib-frv.h28
-rw-r--r--gdb/solib-rocm.c197
-rw-r--r--gdb/solib-svr4-linux.c98
-rw-r--r--gdb/solib-svr4-linux.h51
-rw-r--r--gdb/solib-svr4.c1104
-rw-r--r--gdb/solib-svr4.h164
-rw-r--r--gdb/solib-target.c121
-rw-r--r--gdb/solib-target.h20
-rw-r--r--gdb/solib.c563
-rw-r--r--gdb/solib.h291
-rw-r--r--gdb/solist.h207
-rw-r--r--gdb/source-cache.c9
-rw-r--r--gdb/source-cache.h2
-rw-r--r--gdb/source.c54
-rw-r--r--gdb/source.h2
-rw-r--r--gdb/sparc-linux-nat.c6
-rw-r--r--gdb/sparc-linux-tdep.c10
-rw-r--r--gdb/sparc-nat.c6
-rw-r--r--gdb/sparc-nat.h2
-rw-r--r--gdb/sparc-netbsd-nat.c6
-rw-r--r--gdb/sparc-netbsd-tdep.c9
-rw-r--r--gdb/sparc-obsd-tdep.c8
-rw-r--r--gdb/sparc-ravenscar-thread.c2
-rw-r--r--gdb/sparc-ravenscar-thread.h2
-rw-r--r--gdb/sparc-sol2-nat.c4
-rw-r--r--gdb/sparc-sol2-tdep.c11
-rw-r--r--gdb/sparc-tdep.c8
-rw-r--r--gdb/sparc-tdep.h2
-rw-r--r--gdb/sparc64-fbsd-nat.c6
-rw-r--r--gdb/sparc64-fbsd-tdep.c9
-rw-r--r--gdb/sparc64-linux-nat.c6
-rw-r--r--gdb/sparc64-linux-tdep.c10
-rw-r--r--gdb/sparc64-nat.c6
-rw-r--r--gdb/sparc64-netbsd-nat.c6
-rw-r--r--gdb/sparc64-netbsd-tdep.c9
-rw-r--r--gdb/sparc64-obsd-nat.c6
-rw-r--r--gdb/sparc64-obsd-tdep.c11
-rw-r--r--gdb/sparc64-sol2-tdep.c11
-rw-r--r--gdb/sparc64-tdep.c6
-rw-r--r--gdb/sparc64-tdep.h2
-rw-r--r--gdb/split-name.c2
-rw-r--r--gdb/split-name.h2
-rw-r--r--gdb/stabsread.c114
-rw-r--r--gdb/stabsread.h4
-rw-r--r--gdb/stack.c56
-rw-r--r--gdb/stack.h2
-rw-r--r--gdb/stap-probe.c31
-rw-r--r--gdb/stap-probe.h2
-rw-r--r--gdb/std-operator.def2
-rw-r--r--gdb/std-regs.c6
-rw-r--r--gdb/stub-termcap.c2
-rw-r--r--gdb/stubs/buildvms.com2
-rw-r--r--gdb/stubs/ia64vms-stub.c2
-rw-r--r--gdb/stubs/z80-stub.c2
-rw-r--r--gdb/svr4-tls-tdep.c254
-rw-r--r--gdb/svr4-tls-tdep.h59
-rw-r--r--gdb/sym-domains.def2
-rw-r--r--gdb/symfile-add-flags.h2
-rw-r--r--gdb/symfile-debug.c199
-rw-r--r--gdb/symfile-mem.c10
-rw-r--r--gdb/symfile.c320
-rw-r--r--gdb/symfile.h22
-rw-r--r--gdb/symmisc.c172
-rw-r--r--gdb/symtab.c609
-rw-r--r--gdb/symtab.h106
-rw-r--r--gdb/syscalls/Makefile2
-rw-r--r--gdb/syscalls/apply-defaults.xsl2
-rw-r--r--gdb/syscalls/freebsd.xml2
-rw-r--r--gdb/syscalls/gdb-syscalls.dtd2
-rw-r--r--gdb/syscalls/netbsd.xml2
-rwxr-xr-xgdb/syscalls/riscv-linux-canonicalize-syscall-gen.py153
-rw-r--r--gdb/syscalls/riscv-linux.xml340
-rw-r--r--gdb/syscalls/riscv-linux.xml.in344
-rwxr-xr-xgdb/syscalls/update-freebsd.sh2
-rwxr-xr-xgdb/syscalls/update-linux-defaults.sh2
-rwxr-xr-xgdb/syscalls/update-linux-from-src.sh7
-rwxr-xr-xgdb/syscalls/update-linux.sh5
-rwxr-xr-xgdb/syscalls/update-netbsd.sh4
-rw-r--r--gdb/system-gdbinit/elinos.py2
-rw-r--r--gdb/system-gdbinit/wrs-linux.py2
-rw-r--r--gdb/target-connection.c7
-rw-r--r--gdb/target-connection.h2
-rw-r--r--gdb/target-dcache.c6
-rw-r--r--gdb/target-dcache.h2
-rw-r--r--gdb/target-debug.h2
-rw-r--r--gdb/target-delegates-gen.c2
-rw-r--r--gdb/target-descriptions.c33
-rw-r--r--gdb/target-descriptions.h2
-rw-r--r--gdb/target-float.c2
-rw-r--r--gdb/target-float.h2
-rw-r--r--gdb/target-memory.c2
-rw-r--r--gdb/target-section.h2
-rw-r--r--gdb/target.c48
-rw-r--r--gdb/target.h35
-rw-r--r--gdb/target/resume.h2
-rw-r--r--gdb/target/target.c2
-rw-r--r--gdb/target/target.h2
-rw-r--r--gdb/target/wait.h2
-rw-r--r--gdb/target/waitstatus.c2
-rw-r--r--gdb/target/waitstatus.h2
-rw-r--r--gdb/tclint.toml63
-rw-r--r--gdb/terminal.h23
-rw-r--r--gdb/test-target.c2
-rw-r--r--gdb/test-target.h2
-rw-r--r--gdb/testsuite/ChangeLog-1993-20132
-rw-r--r--gdb/testsuite/ChangeLog-2014-20212
-rw-r--r--gdb/testsuite/Makefile.in19
-rwxr-xr-xgdb/testsuite/analyze-racy-logs.py5
-rw-r--r--gdb/testsuite/boards/cc-with-debug-names.exp2
-rw-r--r--gdb/testsuite/boards/cc-with-dwz-5.exp28
-rw-r--r--gdb/testsuite/boards/cc-with-dwz-m.exp2
-rw-r--r--gdb/testsuite/boards/cc-with-dwz.exp2
-rw-r--r--gdb/testsuite/boards/cc-with-gdb-index.exp2
-rw-r--r--gdb/testsuite/boards/cc-with-gnu-debuglink.exp2
-rw-r--r--gdb/testsuite/boards/cc-with-index-cache.exp2
-rw-r--r--gdb/testsuite/boards/cc-with-tweaks.exp2
-rw-r--r--gdb/testsuite/boards/debug-types.exp2
-rw-r--r--gdb/testsuite/boards/dwarf4-gdb-index.exp2
-rw-r--r--gdb/testsuite/boards/dwarf5-fission-debug-types.exp33
-rw-r--r--gdb/testsuite/boards/dwarf64.exp2
-rw-r--r--gdb/testsuite/boards/fission-dwp.exp2
-rw-r--r--gdb/testsuite/boards/fission.exp2
-rw-r--r--gdb/testsuite/boards/gdbserver-base.exp2
-rw-r--r--gdb/testsuite/boards/gold-gdb-index.exp2
-rw-r--r--gdb/testsuite/boards/gold.exp2
-rw-r--r--gdb/testsuite/boards/local-board.exp2
-rw-r--r--gdb/testsuite/boards/local-remote-host-native.exp2
-rw-r--r--gdb/testsuite/boards/local-remote-host-notty.exp2
-rw-r--r--gdb/testsuite/boards/local-remote-host.exp2
-rw-r--r--gdb/testsuite/boards/native-extended-gdbserver.exp4
-rw-r--r--gdb/testsuite/boards/native-gdbserver.exp2
-rw-r--r--gdb/testsuite/boards/native-stdio-gdbserver.exp2
-rw-r--r--gdb/testsuite/boards/readnow.exp2
-rw-r--r--gdb/testsuite/boards/remote-gdbserver-on-localhost.exp2
-rw-r--r--gdb/testsuite/boards/remote-stdio-gdbserver.exp2
-rw-r--r--gdb/testsuite/boards/simavr.exp2
-rw-r--r--gdb/testsuite/boards/stabs.exp2
-rw-r--r--gdb/testsuite/boards/stdio-gdbserver-base.exp2
-rw-r--r--gdb/testsuite/config/cfdbug.exp2
-rw-r--r--gdb/testsuite/config/d10v.exp2
-rw-r--r--gdb/testsuite/config/default.exp2
-rw-r--r--gdb/testsuite/config/dve.exp2
-rw-r--r--gdb/testsuite/config/extended-gdbserver.exp2
-rw-r--r--gdb/testsuite/config/gdbserver.exp2
-rw-r--r--gdb/testsuite/config/i960.exp2
-rw-r--r--gdb/testsuite/config/m32r.exp2
-rw-r--r--gdb/testsuite/config/mips-idt.exp2
-rw-r--r--gdb/testsuite/config/mips.exp2
-rw-r--r--gdb/testsuite/config/mn10300-eval.exp2
-rw-r--r--gdb/testsuite/config/monitor.exp2
-rw-r--r--gdb/testsuite/config/proelf.exp2
-rw-r--r--gdb/testsuite/config/rom68k.exp2
-rw-r--r--gdb/testsuite/config/sh.exp2
-rw-r--r--gdb/testsuite/config/sid.exp2
-rw-r--r--gdb/testsuite/config/sim.exp2
-rw-r--r--gdb/testsuite/config/slite.exp2
-rw-r--r--gdb/testsuite/config/unix.exp2
-rw-r--r--gdb/testsuite/config/vr4300.exp2
-rw-r--r--gdb/testsuite/config/vr5000.exp2
-rw-r--r--gdb/testsuite/configure.ac2
-rw-r--r--gdb/testsuite/gdb.ada/O2_float_param.exp4
-rw-r--r--gdb/testsuite/gdb.ada/O2_float_param/callee.adb2
-rw-r--r--gdb/testsuite/gdb.ada/O2_float_param/callee.ads2
-rw-r--r--gdb/testsuite/gdb.ada/O2_float_param/caller.adb2
-rw-r--r--gdb/testsuite/gdb.ada/O2_float_param/caller.ads2
-rw-r--r--gdb/testsuite/gdb.ada/O2_float_param/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/O2_float_param/io.adb2
-rw-r--r--gdb/testsuite/gdb.ada/O2_float_param/io.ads2
-rw-r--r--gdb/testsuite/gdb.ada/access_tagged_param.exp4
-rw-r--r--gdb/testsuite/gdb.ada/access_tagged_param/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/access_tagged_param/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/access_tagged_param/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/access_to_packed_array.exp4
-rw-r--r--gdb/testsuite/gdb.ada/access_to_packed_array/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/access_to_packed_array/pack.adb2
-rw-r--r--gdb/testsuite/gdb.ada/access_to_packed_array/pack.ads2
-rw-r--r--gdb/testsuite/gdb.ada/access_to_unbounded_array.exp4
-rw-r--r--gdb/testsuite/gdb.ada/access_to_unbounded_array/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/access_to_unbounded_array/pack.adb2
-rw-r--r--gdb/testsuite/gdb.ada/access_to_unbounded_array/pack.ads2
-rw-r--r--gdb/testsuite/gdb.ada/addr_arith.exp4
-rw-r--r--gdb/testsuite/gdb.ada/addr_arith/foo_na07_019.adb2
-rw-r--r--gdb/testsuite/gdb.ada/addr_arith/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/addr_arith/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/aliased_array.exp4
-rw-r--r--gdb/testsuite/gdb.ada/aliased_array/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/aliased_array/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/aliased_array/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp4
-rw-r--r--gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap.adb2
-rw-r--r--gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap.ads2
-rw-r--r--gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap_main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/arr_arr.exp4
-rw-r--r--gdb/testsuite/gdb.ada/arr_arr/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/arr_arr/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/arr_arr/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/arr_enum_idx_w_gap.exp4
-rw-r--r--gdb/testsuite/gdb.ada/arr_enum_idx_w_gap/foo_q418_043.adb2
-rw-r--r--gdb/testsuite/gdb.ada/array_bounds.exp6
-rw-r--r--gdb/testsuite/gdb.ada/array_bounds/bar.adb2
-rw-r--r--gdb/testsuite/gdb.ada/array_char_idx.exp4
-rw-r--r--gdb/testsuite/gdb.ada/array_char_idx/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/array_char_idx/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/array_char_idx/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/array_long_idx.exp36
-rw-r--r--gdb/testsuite/gdb.ada/array_long_idx/main.adb31
-rw-r--r--gdb/testsuite/gdb.ada/array_long_idx/pck.adb21
-rw-r--r--gdb/testsuite/gdb.ada/array_long_idx/pck.ads19
-rw-r--r--gdb/testsuite/gdb.ada/array_of_symbolic_length.exp4
-rw-r--r--gdb/testsuite/gdb.ada/array_of_symbolic_length/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/array_of_symbolic_length/gl.adb2
-rw-r--r--gdb/testsuite/gdb.ada/array_of_symbolic_length/gl.ads2
-rw-r--r--gdb/testsuite/gdb.ada/array_of_symbolic_length/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/array_of_symbolic_length/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/array_of_variable_length.exp4
-rw-r--r--gdb/testsuite/gdb.ada/array_of_variable_length/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/array_of_variable_length/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/array_of_variable_length/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/array_of_variant.exp8
-rw-r--r--gdb/testsuite/gdb.ada/array_of_variant/p.adb2
-rw-r--r--gdb/testsuite/gdb.ada/array_of_variant/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/array_of_variant/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/array_ptr_renaming.exp4
-rw-r--r--gdb/testsuite/gdb.ada/array_ptr_renaming/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/array_ptr_renaming/pack.ads2
-rw-r--r--gdb/testsuite/gdb.ada/array_return.exp6
-rw-r--r--gdb/testsuite/gdb.ada/array_return/p.adb2
-rw-r--r--gdb/testsuite/gdb.ada/array_return/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/array_return/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/array_subscript_addr.exp4
-rw-r--r--gdb/testsuite/gdb.ada/array_subscript_addr/p.adb7
-rw-r--r--gdb/testsuite/gdb.ada/arraydim.exp4
-rw-r--r--gdb/testsuite/gdb.ada/arraydim/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/arraydim/inc.c2
-rw-r--r--gdb/testsuite/gdb.ada/arraydim/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/arraydim/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/arrayidx.exp20
-rw-r--r--gdb/testsuite/gdb.ada/arrayidx/p.adb2
-rw-r--r--gdb/testsuite/gdb.ada/arrayparam.exp4
-rw-r--r--gdb/testsuite/gdb.ada/arrayparam/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/arrayparam/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/arrayparam/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/arrayptr.exp4
-rw-r--r--gdb/testsuite/gdb.ada/arrayptr/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/arrayptr/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/arrayptr/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/assign_1.exp2
-rw-r--r--gdb/testsuite/gdb.ada/assign_arr.exp4
-rw-r--r--gdb/testsuite/gdb.ada/assign_arr/main_p324_051.adb2
-rw-r--r--gdb/testsuite/gdb.ada/assign_arr/target_wrapper.adb2
-rw-r--r--gdb/testsuite/gdb.ada/assign_arr/target_wrapper.ads2
-rw-r--r--gdb/testsuite/gdb.ada/assoc.exp4
-rw-r--r--gdb/testsuite/gdb.ada/assoc/main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/assoc/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/assoc/xtra.adb2
-rw-r--r--gdb/testsuite/gdb.ada/assoc/xtra.ads2
-rw-r--r--gdb/testsuite/gdb.ada/atomic_enum.exp4
-rw-r--r--gdb/testsuite/gdb.ada/atomic_enum/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/atomic_enum/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/atomic_enum/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/attr_ref_and_charlit.exp4
-rw-r--r--gdb/testsuite/gdb.ada/attr_ref_and_charlit/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ax-ada.exp4
-rw-r--r--gdb/testsuite/gdb.ada/ax-ada/prog.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bad-task-bp-keyword.exp4
-rw-r--r--gdb/testsuite/gdb.ada/bad-task-bp-keyword/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bias.exp4
-rw-r--r--gdb/testsuite/gdb.ada/bias/bias.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bias/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bias/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/big_packed_array.exp6
-rw-r--r--gdb/testsuite/gdb.ada/big_packed_array/foo_ra24_010.adb2
-rw-r--r--gdb/testsuite/gdb.ada/big_packed_array/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/big_packed_array/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/boolean_expr.exp2
-rw-r--r--gdb/testsuite/gdb.ada/bp_c_mixed_case.exp4
-rw-r--r--gdb/testsuite/gdb.ada/bp_c_mixed_case/bar.c2
-rw-r--r--gdb/testsuite/gdb.ada/bp_c_mixed_case/foo_h731_021.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bp_c_mixed_case/qux.c2
-rw-r--r--gdb/testsuite/gdb.ada/bp_enum_homonym.exp4
-rw-r--r--gdb/testsuite/gdb.ada/bp_enum_homonym/p.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bp_enum_homonym/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bp_enum_homonym/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/bp_fun_addr.exp4
-rw-r--r--gdb/testsuite/gdb.ada/bp_fun_addr/bp_fun_addr.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bp_inlined_func.exp10
-rw-r--r--gdb/testsuite/gdb.ada/bp_inlined_func/b.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bp_inlined_func/b.ads2
-rw-r--r--gdb/testsuite/gdb.ada/bp_inlined_func/c.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bp_inlined_func/c.ads2
-rw-r--r--gdb/testsuite/gdb.ada/bp_inlined_func/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bp_on_var.exp4
-rw-r--r--gdb/testsuite/gdb.ada/bp_on_var/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bp_on_var/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bp_on_var/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/bp_range_type.exp4
-rw-r--r--gdb/testsuite/gdb.ada/bp_range_type/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bp_range_type/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bp_range_type/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/bp_reset.exp4
-rw-r--r--gdb/testsuite/gdb.ada/bp_reset/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bp_reset/io.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bp_reset/io.ads2
-rw-r--r--gdb/testsuite/gdb.ada/bp_reset/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/bp_reset/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/break-label.exp4
-rw-r--r--gdb/testsuite/gdb.ada/break-label/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/break-label/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/break-label/proc.adb2
-rw-r--r--gdb/testsuite/gdb.ada/byte_packed_arr.exp4
-rw-r--r--gdb/testsuite/gdb.ada/byte_packed_arr/array_list_g.ads2
-rw-r--r--gdb/testsuite/gdb.ada/byte_packed_arr/reprod.adb2
-rw-r--r--gdb/testsuite/gdb.ada/byte_packed_arr/reprod.ads2
-rw-r--r--gdb/testsuite/gdb.ada/byte_packed_arr/reprod_main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/call-no-debug.exp4
-rw-r--r--gdb/testsuite/gdb.ada/call-no-debug/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/call-no-debug/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/call-no-debug/prog.adb2
-rw-r--r--gdb/testsuite/gdb.ada/call_pn.exp6
-rw-r--r--gdb/testsuite/gdb.ada/call_pn/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/call_pn/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/call_pn/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/catch_assert_if.exp6
-rw-r--r--gdb/testsuite/gdb.ada/catch_assert_if/bla.adb2
-rw-r--r--gdb/testsuite/gdb.ada/catch_assert_if/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/catch_ex.exp10
-rw-r--r--gdb/testsuite/gdb.ada/catch_ex/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/catch_ex_std.exp8
-rw-r--r--gdb/testsuite/gdb.ada/catch_ex_std/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/catch_ex_std/some_package.adb2
-rw-r--r--gdb/testsuite/gdb.ada/catch_ex_std/some_package.ads2
-rw-r--r--gdb/testsuite/gdb.ada/char_enum.exp4
-rw-r--r--gdb/testsuite/gdb.ada/char_enum/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/char_enum/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/char_enum/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/char_enum_overload.exp4
-rw-r--r--gdb/testsuite/gdb.ada/char_enum_overload/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/char_enum_overload/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/char_enum_overload/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/char_enum_unicode.exp4
-rw-r--r--gdb/testsuite/gdb.ada/char_enum_unicode/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/char_enum_unicode/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/char_enum_unicode/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/char_param.exp4
-rw-r--r--gdb/testsuite/gdb.ada/char_param/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/char_param/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/char_param/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/complete.exp6
-rw-r--r--gdb/testsuite/gdb.ada/complete/aux_pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/complete/aux_pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/complete/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/complete/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/complete/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/cond_lang.exp4
-rw-r--r--gdb/testsuite/gdb.ada/cond_lang/a.adb2
-rw-r--r--gdb/testsuite/gdb.ada/cond_lang/foo.c2
-rw-r--r--gdb/testsuite/gdb.ada/cond_lang/mixed.adb2
-rw-r--r--gdb/testsuite/gdb.ada/cond_lang/mixed.ads2
-rw-r--r--gdb/testsuite/gdb.ada/cond_lang/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/cond_lang/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/convvar_comp.exp4
-rw-r--r--gdb/testsuite/gdb.ada/convvar_comp/pb16_063.adb2
-rw-r--r--gdb/testsuite/gdb.ada/convvar_comp/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/convvar_comp/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/data-sections.exp4
-rw-r--r--gdb/testsuite/gdb.ada/data-sections/main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/delta-assign.exp4
-rw-r--r--gdb/testsuite/gdb.ada/delta-assign/main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/delta-assign/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/delta-assign/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/dgopt.exp4
-rw-r--r--gdb/testsuite/gdb.ada/dgopt/x.adb2
-rw-r--r--gdb/testsuite/gdb.ada/disc_arr_bound.exp4
-rw-r--r--gdb/testsuite/gdb.ada/disc_arr_bound/foo_n612_026.adb2
-rw-r--r--gdb/testsuite/gdb.ada/disc_arr_bound/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/disc_arr_bound/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/discrete-char.exp4
-rw-r--r--gdb/testsuite/gdb.ada/discrete-char/main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/discrete-char/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/discrete-char/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/display_nested.exp4
-rw-r--r--gdb/testsuite/gdb.ada/display_nested/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/display_nested/pack.adb2
-rw-r--r--gdb/testsuite/gdb.ada/display_nested/pack.ads2
-rw-r--r--gdb/testsuite/gdb.ada/dot_all.exp4
-rw-r--r--gdb/testsuite/gdb.ada/dot_all/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/dot_all/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/dot_all/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/dyn-bit-offset.exp79
-rw-r--r--gdb/testsuite/gdb.ada/dyn-bit-offset/exam.adb45
-rw-r--r--gdb/testsuite/gdb.ada/dyn-range.exp6
-rw-r--r--gdb/testsuite/gdb.ada/dyn-range/dyn.adb2
-rw-r--r--gdb/testsuite/gdb.ada/dyn-range/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/dyn-range/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/dyn_arrayidx.exp4
-rw-r--r--gdb/testsuite/gdb.ada/dyn_arrayidx/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/dyn_loc.exp6
-rw-r--r--gdb/testsuite/gdb.ada/dyn_loc/p.adb2
-rw-r--r--gdb/testsuite/gdb.ada/dyn_loc/pack.adb2
-rw-r--r--gdb/testsuite/gdb.ada/dyn_loc/pack.ads2
-rw-r--r--gdb/testsuite/gdb.ada/dyn_stride.exp6
-rw-r--r--gdb/testsuite/gdb.ada/dyn_stride/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/dynamic-iface.exp4
-rw-r--r--gdb/testsuite/gdb.ada/dynamic-iface/concrete.adb2
-rw-r--r--gdb/testsuite/gdb.ada/dynamic-iface/concrete.ads2
-rw-r--r--gdb/testsuite/gdb.ada/dynamic-iface/main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/enum_idx_packed.exp4
-rw-r--r--gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/enum_idx_packed/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/enum_idx_packed/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/enum_qual.exp4
-rw-r--r--gdb/testsuite/gdb.ada/enum_qual/gener.ads2
-rw-r--r--gdb/testsuite/gdb.ada/enum_qual/qual.adb2
-rw-r--r--gdb/testsuite/gdb.ada/enums_overload.exp4
-rw-r--r--gdb/testsuite/gdb.ada/enums_overload/enums_overload.adb2
-rw-r--r--gdb/testsuite/gdb.ada/enums_overload/enums_overload.ads2
-rw-r--r--gdb/testsuite/gdb.ada/enums_overload/enums_overload_main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/excep_handle.exp6
-rw-r--r--gdb/testsuite/gdb.ada/excep_handle/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/excep_handle/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/exception-lto.c2
-rw-r--r--gdb/testsuite/gdb.ada/exception-lto.exp4
-rw-r--r--gdb/testsuite/gdb.ada/exec_changed.exp10
-rw-r--r--gdb/testsuite/gdb.ada/exec_changed/first.adb2
-rw-r--r--gdb/testsuite/gdb.ada/exec_changed/second.adb2
-rw-r--r--gdb/testsuite/gdb.ada/expr_delims.exp4
-rw-r--r--gdb/testsuite/gdb.ada/expr_delims/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/expr_delims/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/expr_delims/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/expr_with_funcall.exp4
-rw-r--r--gdb/testsuite/gdb.ada/expr_with_funcall/expr_r821_013.adb2
-rw-r--r--gdb/testsuite/gdb.ada/expr_with_funcall/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/expr_with_funcall/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/exprs.exp4
-rw-r--r--gdb/testsuite/gdb.ada/exprs/p.adb2
-rw-r--r--gdb/testsuite/gdb.ada/extended-access.c38
-rw-r--r--gdb/testsuite/gdb.ada/extended-access.exp29
-rw-r--r--gdb/testsuite/gdb.ada/file-then-restart.exp10
-rw-r--r--gdb/testsuite/gdb.ada/file-then-restart/first.adb2
-rw-r--r--gdb/testsuite/gdb.ada/file-then-restart/second.adb2
-rw-r--r--gdb/testsuite/gdb.ada/fin_fun_out.exp4
-rw-r--r--gdb/testsuite/gdb.ada/fin_fun_out/bar.adb2
-rw-r--r--gdb/testsuite/gdb.ada/fin_fun_out/bar.ads2
-rw-r--r--gdb/testsuite/gdb.ada/fin_fun_out/foo_o525_013.adb2
-rw-r--r--gdb/testsuite/gdb.ada/finish-large.exp4
-rw-r--r--gdb/testsuite/gdb.ada/finish-large/p.adb2
-rw-r--r--gdb/testsuite/gdb.ada/finish-large/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/finish-large/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/finish-var-size.exp14
-rw-r--r--gdb/testsuite/gdb.ada/finish-var-size/p.adb2
-rw-r--r--gdb/testsuite/gdb.ada/finish-var-size/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/finish-var-size/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/fixed_cmp.exp4
-rw-r--r--gdb/testsuite/gdb.ada/fixed_cmp/fixed.adb2
-rw-r--r--gdb/testsuite/gdb.ada/fixed_cmp/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/fixed_cmp/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/fixed_points.exp8
-rw-r--r--gdb/testsuite/gdb.ada/fixed_points/fixed_points.adb9
-rw-r--r--gdb/testsuite/gdb.ada/fixed_points/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/fixed_points/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/fixed_points_function.exp4
-rw-r--r--gdb/testsuite/gdb.ada/fixed_points_function/fixed_points_function.adb2
-rw-r--r--gdb/testsuite/gdb.ada/fixed_points_function/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/fixed_points_function/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/float-bits.exp4
-rw-r--r--gdb/testsuite/gdb.ada/float-bits/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/float-bits/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/float-bits/prog.adb2
-rw-r--r--gdb/testsuite/gdb.ada/float_param.exp4
-rw-r--r--gdb/testsuite/gdb.ada/float_param/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/float_param/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/float_param/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/formatted_ref.exp10
-rw-r--r--gdb/testsuite/gdb.ada/formatted_ref/defs.adb2
-rw-r--r--gdb/testsuite/gdb.ada/formatted_ref/defs.ads2
-rw-r--r--gdb/testsuite/gdb.ada/formatted_ref/formatted_ref.adb2
-rw-r--r--gdb/testsuite/gdb.ada/frame_arg_lang.exp4
-rw-r--r--gdb/testsuite/gdb.ada/frame_arg_lang/bla.adb2
-rw-r--r--gdb/testsuite/gdb.ada/frame_arg_lang/foo.c2
-rw-r--r--gdb/testsuite/gdb.ada/frame_arg_lang/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/frame_arg_lang/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/frame_args.exp6
-rw-r--r--gdb/testsuite/gdb.ada/frame_args/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/frame_args/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/frame_args/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/fullname_bp.exp4
-rw-r--r--gdb/testsuite/gdb.ada/fullname_bp/dn.adb2
-rw-r--r--gdb/testsuite/gdb.ada/fullname_bp/dn.ads2
-rw-r--r--gdb/testsuite/gdb.ada/fullname_bp/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/fullname_bp/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/fullname_bp/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/fun_addr.exp4
-rw-r--r--gdb/testsuite/gdb.ada/fun_addr/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/fun_in_declare.exp6
-rw-r--r--gdb/testsuite/gdb.ada/fun_in_declare/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/fun_in_declare/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/fun_in_declare/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/fun_overload_menu.exp4
-rw-r--r--gdb/testsuite/gdb.ada/fun_overload_menu/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/fun_renaming.exp4
-rw-r--r--gdb/testsuite/gdb.ada/fun_renaming/fun_renaming.adb2
-rw-r--r--gdb/testsuite/gdb.ada/fun_renaming/pack.adb2
-rw-r--r--gdb/testsuite/gdb.ada/fun_renaming/pack.ads2
-rw-r--r--gdb/testsuite/gdb.ada/funcall_char.exp4
-rw-r--r--gdb/testsuite/gdb.ada/funcall_char/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/funcall_param.exp4
-rw-r--r--gdb/testsuite/gdb.ada/funcall_param/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/funcall_param/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/funcall_param/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/funcall_ptr.exp4
-rw-r--r--gdb/testsuite/gdb.ada/funcall_ptr/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/funcall_ptr/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/funcall_ptr/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/funcall_ref.exp6
-rw-r--r--gdb/testsuite/gdb.ada/funcall_ref/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ghost.exp4
-rw-r--r--gdb/testsuite/gdb.ada/ghost/gpck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/ghost/main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ghost/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/homonym.exp4
-rw-r--r--gdb/testsuite/gdb.ada/homonym/homonym.adb2
-rw-r--r--gdb/testsuite/gdb.ada/homonym/homonym.ads2
-rw-r--r--gdb/testsuite/gdb.ada/homonym/homonym_main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/homonym/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/homonym/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/huge.exp6
-rw-r--r--gdb/testsuite/gdb.ada/huge/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/huge/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/huge/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/import.exp34
-rw-r--r--gdb/testsuite/gdb.ada/import/inc.c2
-rw-r--r--gdb/testsuite/gdb.ada/import/pkg.adb2
-rw-r--r--gdb/testsuite/gdb.ada/import/pkg.ads2
-rw-r--r--gdb/testsuite/gdb.ada/import/prog.adb2
-rw-r--r--gdb/testsuite/gdb.ada/info_addr_mixed_case.exp4
-rw-r--r--gdb/testsuite/gdb.ada/info_addr_mixed_case/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/info_addr_mixed_case/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/info_addr_mixed_case/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/info_auto_lang.exp6
-rw-r--r--gdb/testsuite/gdb.ada/info_auto_lang/global_pack.ads2
-rw-r--r--gdb/testsuite/gdb.ada/info_auto_lang/proc_in_ada.adb2
-rw-r--r--gdb/testsuite/gdb.ada/info_auto_lang/some_c.c2
-rw-r--r--gdb/testsuite/gdb.ada/info_exc.exp6
-rw-r--r--gdb/testsuite/gdb.ada/info_exc/const.ads2
-rw-r--r--gdb/testsuite/gdb.ada/info_exc/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/info_locals_renaming.exp4
-rw-r--r--gdb/testsuite/gdb.ada/info_locals_renaming/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/info_locals_renaming/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/info_locals_renaming/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/info_types.c2
-rw-r--r--gdb/testsuite/gdb.ada/info_types.exp4
-rw-r--r--gdb/testsuite/gdb.ada/inline-section-gc.exp4
-rw-r--r--gdb/testsuite/gdb.ada/inline-section-gc/callee.adb2
-rw-r--r--gdb/testsuite/gdb.ada/inline-section-gc/callee.ads2
-rw-r--r--gdb/testsuite/gdb.ada/inline-section-gc/caller.adb2
-rw-r--r--gdb/testsuite/gdb.ada/int_deref.exp4
-rw-r--r--gdb/testsuite/gdb.ada/int_deref/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/int_deref/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/interface.exp4
-rw-r--r--gdb/testsuite/gdb.ada/interface/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/interface/types.adb2
-rw-r--r--gdb/testsuite/gdb.ada/interface/types.ads2
-rw-r--r--gdb/testsuite/gdb.ada/iterated-assign.exp4
-rw-r--r--gdb/testsuite/gdb.ada/iterated-assign/main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/iterated-assign/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/iterated-assign/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/iwide.exp4
-rw-r--r--gdb/testsuite/gdb.ada/iwide/classes.adb2
-rw-r--r--gdb/testsuite/gdb.ada/iwide/classes.ads2
-rw-r--r--gdb/testsuite/gdb.ada/iwide/p.adb2
-rw-r--r--gdb/testsuite/gdb.ada/lang_switch.exp4
-rw-r--r--gdb/testsuite/gdb.ada/lang_switch/foo.c2
-rw-r--r--gdb/testsuite/gdb.ada/lang_switch/lang_switch.adb2
-rw-r--r--gdb/testsuite/gdb.ada/lazy-string.exp4
-rw-r--r--gdb/testsuite/gdb.ada/lazy-string/main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/length_cond.exp4
-rw-r--r--gdb/testsuite/gdb.ada/length_cond/length_cond.adb2
-rw-r--r--gdb/testsuite/gdb.ada/length_cond/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/length_cond/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/limited-length.exp6
-rw-r--r--gdb/testsuite/gdb.ada/limited-length/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/limited-length/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/limited-length/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/literals.exp2
-rw-r--r--gdb/testsuite/gdb.ada/local-enum.exp4
-rw-r--r--gdb/testsuite/gdb.ada/local-enum/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/local-enum/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/maint_with_ada.exp4
-rw-r--r--gdb/testsuite/gdb.ada/maint_with_ada/pack.adb2
-rw-r--r--gdb/testsuite/gdb.ada/maint_with_ada/pack.ads2
-rw-r--r--gdb/testsuite/gdb.ada/maint_with_ada/var_arr_typedef.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_catch_assert.exp8
-rw-r--r--gdb/testsuite/gdb.ada/mi_catch_assert/bla.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_catch_assert/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/mi_catch_ex.exp12
-rw-r--r--gdb/testsuite/gdb.ada/mi_catch_ex/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp10
-rw-r--r--gdb/testsuite/gdb.ada/mi_catch_ex_hand/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_dyn_arr.exp8
-rw-r--r--gdb/testsuite/gdb.ada/mi_dyn_arr/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_dyn_arr/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_dyn_arr/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/mi_ex_cond.exp6
-rw-r--r--gdb/testsuite/gdb.ada/mi_ex_cond/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_ex_cond/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/mi_exc_info.exp8
-rw-r--r--gdb/testsuite/gdb.ada/mi_exc_info/const.ads2
-rw-r--r--gdb/testsuite/gdb.ada/mi_exc_info/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_interface.exp8
-rw-r--r--gdb/testsuite/gdb.ada/mi_interface/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_interface/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_interface/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/mi_prot.exp8
-rw-r--r--gdb/testsuite/gdb.ada/mi_prot/pkg.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_prot/pkg.ads2
-rw-r--r--gdb/testsuite/gdb.ada/mi_prot/prot.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_ref_changeable.exp8
-rw-r--r--gdb/testsuite/gdb.ada/mi_ref_changeable/foo_rb20_056.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_ref_changeable/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_ref_changeable/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/mi_string_access.exp8
-rw-r--r--gdb/testsuite/gdb.ada/mi_string_access/bar.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_string_access/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_string_access/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/mi_task_arg.exp8
-rw-r--r--gdb/testsuite/gdb.ada/mi_task_arg/task_switch.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_task_info.exp8
-rw-r--r--gdb/testsuite/gdb.ada/mi_task_info/task_switch.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_var_access.exp8
-rw-r--r--gdb/testsuite/gdb.ada/mi_var_access/mi_access.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_var_access/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_var_access/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/mi_var_array.exp8
-rw-r--r--gdb/testsuite/gdb.ada/mi_var_array/bar.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_var_array/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_var_array/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/mi_var_union.exp8
-rw-r--r--gdb/testsuite/gdb.ada/mi_var_union/bar.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_var_union/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/mi_var_union/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/mi_variant.exp8
-rw-r--r--gdb/testsuite/gdb.ada/mi_variant/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/mi_variant/pkg.adb2
-rw-r--r--gdb/testsuite/gdb.ada/minsyms.exp4
-rw-r--r--gdb/testsuite/gdb.ada/minsyms/foo_qb07_057.adb2
-rw-r--r--gdb/testsuite/gdb.ada/minsyms/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/minsyms/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/mod_from_name.exp6
-rw-r--r--gdb/testsuite/gdb.ada/mod_from_name/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/multiarray.exp4
-rw-r--r--gdb/testsuite/gdb.ada/multiarray/p.adb2
-rw-r--r--gdb/testsuite/gdb.ada/multiarray/pack.adb2
-rw-r--r--gdb/testsuite/gdb.ada/multiarray/pack.ads2
-rw-r--r--gdb/testsuite/gdb.ada/n_arr_bound.exp4
-rw-r--r--gdb/testsuite/gdb.ada/n_arr_bound/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/n_arr_bound/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/n_arr_bound/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/negative-bit-offset.exp36
-rw-r--r--gdb/testsuite/gdb.ada/negative-bit-offset/prog.adb36
-rw-r--r--gdb/testsuite/gdb.ada/nested.exp4
-rw-r--r--gdb/testsuite/gdb.ada/nested/hello.adb2
-rw-r--r--gdb/testsuite/gdb.ada/non-ascii-latin-1.exp4
-rw-r--r--gdb/testsuite/gdb.ada/non-ascii-latin-1/pack.adb2
-rw-r--r--gdb/testsuite/gdb.ada/non-ascii-latin-1/pack.ads2
-rw-r--r--gdb/testsuite/gdb.ada/non-ascii-latin-1/prog.adb2
-rw-r--r--gdb/testsuite/gdb.ada/non-ascii-latin-3.exp4
-rw-r--r--gdb/testsuite/gdb.ada/non-ascii-latin-3/pack.adb2
-rw-r--r--gdb/testsuite/gdb.ada/non-ascii-latin-3/pack.ads2
-rw-r--r--gdb/testsuite/gdb.ada/non-ascii-latin-3/prog.adb2
-rw-r--r--gdb/testsuite/gdb.ada/non-ascii-utf-8.exp4
-rw-r--r--gdb/testsuite/gdb.ada/non-ascii-utf-8/pack.adb2
-rw-r--r--gdb/testsuite/gdb.ada/non-ascii-utf-8/pack.ads2
-rw-r--r--gdb/testsuite/gdb.ada/non-ascii-utf-8/prog.adb2
-rw-r--r--gdb/testsuite/gdb.ada/notcplusplus.exp4
-rw-r--r--gdb/testsuite/gdb.ada/notcplusplus/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/notcplusplus/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/notcplusplus/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/notcplusplus/ver.ads2
-rw-r--r--gdb/testsuite/gdb.ada/null_array.exp6
-rw-r--r--gdb/testsuite/gdb.ada/null_array/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/null_array/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/null_array/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/null_overload.exp4
-rw-r--r--gdb/testsuite/gdb.ada/null_overload/foo.adb6
-rw-r--r--gdb/testsuite/gdb.ada/null_overload/pck.adb23
-rw-r--r--gdb/testsuite/gdb.ada/null_overload/pck.ads22
-rw-r--r--gdb/testsuite/gdb.ada/null_record.exp4
-rw-r--r--gdb/testsuite/gdb.ada/null_record/bar.adb2
-rw-r--r--gdb/testsuite/gdb.ada/null_record/bar.ads2
-rw-r--r--gdb/testsuite/gdb.ada/null_record/null_record.adb2
-rw-r--r--gdb/testsuite/gdb.ada/operator_bp.exp4
-rw-r--r--gdb/testsuite/gdb.ada/operator_bp/ops.adb2
-rw-r--r--gdb/testsuite/gdb.ada/operator_bp/ops.ads2
-rw-r--r--gdb/testsuite/gdb.ada/operator_bp/ops_test.adb2
-rw-r--r--gdb/testsuite/gdb.ada/operator_call.exp10
-rw-r--r--gdb/testsuite/gdb.ada/operator_call/opcall.adb2
-rw-r--r--gdb/testsuite/gdb.ada/operator_call/twovecs.adb2
-rw-r--r--gdb/testsuite/gdb.ada/operator_call/twovecs.ads2
-rw-r--r--gdb/testsuite/gdb.ada/optim_drec.exp4
-rw-r--r--gdb/testsuite/gdb.ada/optim_drec/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp4
-rw-r--r--gdb/testsuite/gdb.ada/out_of_line_in_inlined/bar.adb2
-rw-r--r--gdb/testsuite/gdb.ada/out_of_line_in_inlined/bar.ads2
-rw-r--r--gdb/testsuite/gdb.ada/out_of_line_in_inlined/foo_o224_021.adb2
-rw-r--r--gdb/testsuite/gdb.ada/overload_menu_crash.exp4
-rw-r--r--gdb/testsuite/gdb.ada/overload_menu_crash/main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/overload_menu_crash/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/overload_menu_crash/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/overloads.exp4
-rw-r--r--gdb/testsuite/gdb.ada/overloads/overloads.adb2
-rw-r--r--gdb/testsuite/gdb.ada/p-bounds.exp2
-rw-r--r--gdb/testsuite/gdb.ada/p-bounds/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/p-bounds/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/packed_array.exp4
-rw-r--r--gdb/testsuite/gdb.ada/packed_array/pa.adb2
-rw-r--r--gdb/testsuite/gdb.ada/packed_array/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/packed_array/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/packed_array_assign.exp4
-rw-r--r--gdb/testsuite/gdb.ada/packed_array_assign/aggregates.adb2
-rw-r--r--gdb/testsuite/gdb.ada/packed_array_assign/aggregates.ads2
-rw-r--r--gdb/testsuite/gdb.ada/packed_array_assign/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/packed_array_assign/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/packed_array_assign/tester.adb2
-rw-r--r--gdb/testsuite/gdb.ada/packed_record.exp4
-rw-r--r--gdb/testsuite/gdb.ada/packed_record/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/packed_record/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/packed_record/pr.adb2
-rw-r--r--gdb/testsuite/gdb.ada/packed_record_2.exp61
-rw-r--r--gdb/testsuite/gdb.ada/packed_record_2/exam.adb51
-rw-r--r--gdb/testsuite/gdb.ada/packed_tagged.exp4
-rw-r--r--gdb/testsuite/gdb.ada/packed_tagged/comp_bug.adb2
-rw-r--r--gdb/testsuite/gdb.ada/pckd_arr_ren.exp4
-rw-r--r--gdb/testsuite/gdb.ada/pckd_arr_ren/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/pckd_arr_ren/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/pckd_arr_ren/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/pckd_neg.exp4
-rw-r--r--gdb/testsuite/gdb.ada/pckd_neg/foo_o508_021.adb2
-rw-r--r--gdb/testsuite/gdb.ada/pckd_neg/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/pckd_neg/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/pkd_arr_elem.exp4
-rw-r--r--gdb/testsuite/gdb.ada/pkd_arr_elem/failure.adb2
-rw-r--r--gdb/testsuite/gdb.ada/pkd_arr_elem/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/pkd_arr_elem/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/pp-rec-component.exp4
-rw-r--r--gdb/testsuite/gdb.ada/pp-rec-component.py2
-rw-r--r--gdb/testsuite/gdb.ada/pp-rec-component/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/pp-rec-component/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/pp-rec-component/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/print_chars.exp4
-rw-r--r--gdb/testsuite/gdb.ada/print_chars/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/print_chars/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/print_chars/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/print_pc.exp4
-rw-r--r--gdb/testsuite/gdb.ada/ptr_typedef.exp4
-rw-r--r--gdb/testsuite/gdb.ada/ptr_typedef/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ptr_typedef/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ptr_typedef/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/ptype-o.exp4
-rw-r--r--gdb/testsuite/gdb.ada/ptype-o/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/ptype-o/prog.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ptype_arith_binop.exp2
-rw-r--r--gdb/testsuite/gdb.ada/ptype_array.exp4
-rw-r--r--gdb/testsuite/gdb.ada/ptype_array/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ptype_array/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ptype_array/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/ptype_field.exp4
-rw-r--r--gdb/testsuite/gdb.ada/ptype_field/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ptype_field/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ptype_field/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/ptype_tagged_param.exp6
-rw-r--r--gdb/testsuite/gdb.ada/ptype_tagged_param/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ptype_tagged_param/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ptype_tagged_param/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/ptype_union.c2
-rw-r--r--gdb/testsuite/gdb.ada/ptype_union.exp4
-rw-r--r--gdb/testsuite/gdb.ada/py_range.exp4
-rw-r--r--gdb/testsuite/gdb.ada/py_range/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/py_range/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/py_range/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/py_taft.exp4
-rw-r--r--gdb/testsuite/gdb.ada/py_taft/main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/py_taft/pkg.adb2
-rw-r--r--gdb/testsuite/gdb.ada/py_taft/pkg.ads2
-rw-r--r--gdb/testsuite/gdb.ada/rdv_wait.exp4
-rw-r--r--gdb/testsuite/gdb.ada/rdv_wait/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/rdv_wait/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/rdv_wait/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/rec_comp.exp4
-rw-r--r--gdb/testsuite/gdb.ada/rec_comp/bar_o203_012.adb2
-rw-r--r--gdb/testsuite/gdb.ada/rec_comp/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/rec_comp/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/rec_ptype.exp4
-rw-r--r--gdb/testsuite/gdb.ada/rec_ptype/main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/rec_ptype/p.ads2
-rw-r--r--gdb/testsuite/gdb.ada/rec_return.exp4
-rw-r--r--gdb/testsuite/gdb.ada/rec_return/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/rec_return/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/rec_return/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/recursive-variant.exp4
-rw-r--r--gdb/testsuite/gdb.ada/recursive-variant/main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ref_param.exp6
-rw-r--r--gdb/testsuite/gdb.ada/ref_param/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ref_param/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ref_param/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/ref_tick_size.exp4
-rw-r--r--gdb/testsuite/gdb.ada/ref_tick_size/p.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ref_tick_size/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/ref_tick_size/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/rename_subscript_param.exp4
-rw-r--r--gdb/testsuite/gdb.ada/rename_subscript_param/pb30_012.adb2
-rw-r--r--gdb/testsuite/gdb.ada/rename_subscript_param/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/rename_subscript_param/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/rename_subscript_param/pkg.adb2
-rw-r--r--gdb/testsuite/gdb.ada/rename_subscript_param/pkg.ads2
-rw-r--r--gdb/testsuite/gdb.ada/repeat_dyn.exp4
-rw-r--r--gdb/testsuite/gdb.ada/repeat_dyn/foo_oc22_002.adb2
-rw-r--r--gdb/testsuite/gdb.ada/repeat_dyn/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/repeat_dyn/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/return-small-char-array.exp40
-rw-r--r--gdb/testsuite/gdb.ada/return-small-char-array/proc.adb22
-rw-r--r--gdb/testsuite/gdb.ada/return-small-char-array/value.adb21
-rw-r--r--gdb/testsuite/gdb.ada/return-small-char-array/value.ads20
-rw-r--r--gdb/testsuite/gdb.ada/same_component_name.exp4
-rw-r--r--gdb/testsuite/gdb.ada/same_component_name/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/same_component_name/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/same_component_name/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/same_enum.exp4
-rw-r--r--gdb/testsuite/gdb.ada/same_enum/a.adb2
-rw-r--r--gdb/testsuite/gdb.ada/same_enum/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/same_enum/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/scalar_storage.exp30
-rw-r--r--gdb/testsuite/gdb.ada/scalar_storage/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/scalar_storage/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/scalar_storage/storage.adb2
-rw-r--r--gdb/testsuite/gdb.ada/scoped_watch.exp4
-rw-r--r--gdb/testsuite/gdb.ada/scoped_watch/foo_p708_025.adb2
-rw-r--r--gdb/testsuite/gdb.ada/scoped_watch/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/scoped_watch/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/set_pckd_arr_elt.exp4
-rw-r--r--gdb/testsuite/gdb.ada/set_pckd_arr_elt/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/set_pckd_arr_elt/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/set_pckd_arr_elt/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/set_wstr.exp4
-rw-r--r--gdb/testsuite/gdb.ada/set_wstr/a.adb2
-rw-r--r--gdb/testsuite/gdb.ada/set_wstr/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/set_wstr/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/small_reg_param.exp4
-rw-r--r--gdb/testsuite/gdb.ada/small_reg_param/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/small_reg_param/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/small_reg_param/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/start.exp6
-rw-r--r--gdb/testsuite/gdb.ada/start/dummy.adb2
-rw-r--r--gdb/testsuite/gdb.ada/static-link.exp6
-rw-r--r--gdb/testsuite/gdb.ada/static-link/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/static-link/prog.adb2
-rw-r--r--gdb/testsuite/gdb.ada/str_binop_equal.exp4
-rw-r--r--gdb/testsuite/gdb.ada/str_binop_equal/foo_p211_061.adb2
-rw-r--r--gdb/testsuite/gdb.ada/str_binop_equal/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/str_binop_equal/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/str_chars.exp4
-rw-r--r--gdb/testsuite/gdb.ada/str_chars/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/str_ref_cmp.exp6
-rw-r--r--gdb/testsuite/gdb.ada/str_ref_cmp/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/str_ref_cmp/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/str_uninit.exp4
-rw-r--r--gdb/testsuite/gdb.ada/str_uninit/parse.adb2
-rw-r--r--gdb/testsuite/gdb.ada/str_uninit/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/str_uninit/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/sub_variant.exp4
-rw-r--r--gdb/testsuite/gdb.ada/sub_variant/subv.adb2
-rw-r--r--gdb/testsuite/gdb.ada/sym_print_name.exp4
-rw-r--r--gdb/testsuite/gdb.ada/sym_print_name/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/sym_print_name/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/sym_print_name/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/taft_type.exp6
-rw-r--r--gdb/testsuite/gdb.ada/taft_type/p.adb2
-rw-r--r--gdb/testsuite/gdb.ada/taft_type/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/taft_type/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/tagged-lookup.exp4
-rw-r--r--gdb/testsuite/gdb.ada/tagged-lookup/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/tagged-lookup/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/tagged-lookup/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/tagged-lookup/pck2.adb2
-rw-r--r--gdb/testsuite/gdb.ada/tagged-lookup/pck2.ads2
-rw-r--r--gdb/testsuite/gdb.ada/tagged.exp4
-rw-r--r--gdb/testsuite/gdb.ada/tagged/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/tagged/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/tagged/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/tagged_access.exp4
-rw-r--r--gdb/testsuite/gdb.ada/tagged_access/p.adb2
-rw-r--r--gdb/testsuite/gdb.ada/tagged_access/pack.adb2
-rw-r--r--gdb/testsuite/gdb.ada/tagged_access/pack.ads2
-rw-r--r--gdb/testsuite/gdb.ada/tagged_not_init.exp4
-rw-r--r--gdb/testsuite/gdb.ada/tagged_not_init/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/tagged_not_init/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/tagged_not_init/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/task_bp.exp4
-rw-r--r--gdb/testsuite/gdb.ada/task_bp/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/task_bp/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/task_bp/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/task_switch_in_core.exp10
-rw-r--r--gdb/testsuite/gdb.ada/task_switch_in_core/crash.adb2
-rw-r--r--gdb/testsuite/gdb.ada/task_watch.exp4
-rw-r--r--gdb/testsuite/gdb.ada/task_watch/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/tasks.exp4
-rw-r--r--gdb/testsuite/gdb.ada/tasks/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/tick_last_segv.exp4
-rw-r--r--gdb/testsuite/gdb.ada/tick_last_segv/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/tick_length_array_enum_idx.exp4
-rw-r--r--gdb/testsuite/gdb.ada/tick_length_array_enum_idx/foo_n207_004.adb2
-rw-r--r--gdb/testsuite/gdb.ada/tick_length_array_enum_idx/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/tick_length_array_enum_idx/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/type-tick-size.exp4
-rw-r--r--gdb/testsuite/gdb.ada/type-tick-size/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/type-tick-size/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/type-tick-size/prog.adb4
-rw-r--r--gdb/testsuite/gdb.ada/type-tick-size/support.adb2
-rw-r--r--gdb/testsuite/gdb.ada/type-tick-size/support.ads2
-rw-r--r--gdb/testsuite/gdb.ada/type_coercion.exp4
-rw-r--r--gdb/testsuite/gdb.ada/type_coercion/assign.adb2
-rw-r--r--gdb/testsuite/gdb.ada/type_coercion/ident.adb2
-rw-r--r--gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp4
-rw-r--r--gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/unchecked_union.exp6
-rw-r--r--gdb/testsuite/gdb.ada/unchecked_union/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/unchecked_union/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/unchecked_union/unchecked_union.adb2
-rw-r--r--gdb/testsuite/gdb.ada/uninitialized-variable-record.exp8
-rw-r--r--gdb/testsuite/gdb.ada/uninitialized-variable-record/parse.adb2
-rw-r--r--gdb/testsuite/gdb.ada/uninitialized_vars.exp4
-rw-r--r--gdb/testsuite/gdb.ada/uninitialized_vars/parse.adb2
-rw-r--r--gdb/testsuite/gdb.ada/uninitialized_vars/parse_controlled.ads2
-rw-r--r--gdb/testsuite/gdb.ada/unsigned_last.exp4
-rw-r--r--gdb/testsuite/gdb.ada/unsigned_last/main.adb2
-rw-r--r--gdb/testsuite/gdb.ada/unsigned_range.exp4
-rw-r--r--gdb/testsuite/gdb.ada/unsigned_range/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/unsigned_range/pack.adb2
-rw-r--r--gdb/testsuite/gdb.ada/unsigned_range/pack.ads2
-rw-r--r--gdb/testsuite/gdb.ada/var_arr_attrs.exp4
-rw-r--r--gdb/testsuite/gdb.ada/var_arr_attrs/foo_o115_002.adb2
-rw-r--r--gdb/testsuite/gdb.ada/var_arr_attrs/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/var_arr_attrs/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/var_arr_typedef.exp4
-rw-r--r--gdb/testsuite/gdb.ada/var_arr_typedef/pack.adb4
-rw-r--r--gdb/testsuite/gdb.ada/var_arr_typedef/pack.ads6
-rw-r--r--gdb/testsuite/gdb.ada/var_arr_typedef/var_arr_typedef.adb4
-rw-r--r--gdb/testsuite/gdb.ada/var_rec_arr.exp4
-rw-r--r--gdb/testsuite/gdb.ada/var_rec_arr/foo_na09_042.adb2
-rw-r--r--gdb/testsuite/gdb.ada/var_rec_arr/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/var_rec_arr/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/variant-record.exp4
-rw-r--r--gdb/testsuite/gdb.ada/variant-record/proc.adb2
-rw-r--r--gdb/testsuite/gdb.ada/variant-record/value.adb2
-rw-r--r--gdb/testsuite/gdb.ada/variant-record/value.ads2
-rw-r--r--gdb/testsuite/gdb.ada/variant.exp4
-rw-r--r--gdb/testsuite/gdb.ada/variant/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/variant/pkg.adb2
-rw-r--r--gdb/testsuite/gdb.ada/variant_record_field.exp4
-rw-r--r--gdb/testsuite/gdb.ada/variant_record_field/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/variant_record_packed_array.exp4
-rw-r--r--gdb/testsuite/gdb.ada/variant_record_packed_array/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/variant_record_packed_array/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/variant_record_packed_array/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/varsize_limit.exp4
-rw-r--r--gdb/testsuite/gdb.ada/varsize_limit/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/varsize_limit/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/varsize_limit/vsizelim.adb2
-rw-r--r--gdb/testsuite/gdb.ada/verylong.exp12
-rw-r--r--gdb/testsuite/gdb.ada/verylong/prog.adb2
-rw-r--r--gdb/testsuite/gdb.ada/vla.exp4
-rw-r--r--gdb/testsuite/gdb.ada/vla/vla.adb2
-rw-r--r--gdb/testsuite/gdb.ada/voidctx.exp4
-rw-r--r--gdb/testsuite/gdb.ada/voidctx/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/voidctx/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/voidctx/voidctx.adb2
-rw-r--r--gdb/testsuite/gdb.ada/watch_arg.exp4
-rw-r--r--gdb/testsuite/gdb.ada/watch_arg/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/watch_arg/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/watch_arg/watch.adb2
-rw-r--r--gdb/testsuite/gdb.ada/watch_minus_l.exp4
-rw-r--r--gdb/testsuite/gdb.ada/watch_minus_l/foo_ra10_006.adb2
-rw-r--r--gdb/testsuite/gdb.ada/watch_minus_l/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/watch_minus_l/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/whatis_array_val.exp6
-rw-r--r--gdb/testsuite/gdb.ada/whatis_array_val/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/whatis_array_val/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/whatis_array_val/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/widewide.exp4
-rw-r--r--gdb/testsuite/gdb.ada/widewide/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/widewide/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/widewide/pck.ads2
-rw-r--r--gdb/testsuite/gdb.ada/win_fu_syms.exp4
-rw-r--r--gdb/testsuite/gdb.ada/win_fu_syms/foo.adb2
-rw-r--r--gdb/testsuite/gdb.ada/win_fu_syms/pck.adb2
-rw-r--r--gdb/testsuite/gdb.ada/win_fu_syms/pck.ads2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-atomic-inst.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp4
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-brk-patterns.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-brk-patterns.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-dbreg-contents.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-fp.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-fp.exp4
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-frameptr-vecreg-unwind.c62
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-frameptr-vecreg-unwind.exp33
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-gcs-core.c123
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-gcs-core.exp116
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.c140
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.exp86
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-gcs-return.c105
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-gcs-return.exp132
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-gcs-tdesc-without-linux.xml65
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.c26
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.exp48
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-gcs.c180
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-gcs.exp99
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-mops-single-step.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-mops-single-step.exp4
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp4
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-mte-core.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-mte-core.exp14
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-mte.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-mte.exp32
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-non-address-bits.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-non-address-bits.exp4
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-pauth.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-pauth.exp4
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-prologue.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-prologue.exp4
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-pseudo-unwind-asm.S2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-pseudo-unwind.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-pseudo-unwind.exp4
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sighandler-regs.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp6
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-core-0.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-core-1.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-core-2.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-core-3.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-core-4.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-core.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-core.exp.tcl22
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-available-0.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-available-1.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-available-2.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-available-3.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-available-4.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-available-5.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-available-6.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-available-7.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-available-8.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-available-9.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-available.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-available.exp.tcl36
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-0.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-1.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-2.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-3.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-4.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.exp.tcl18
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-0.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-1.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-2.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-3.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-4.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-5.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-6.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-7.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-8.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-9.exp2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.exp.tcl32
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-sanity.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sme-sanity.exp6
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sve-sigunwind.c205
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sve-sigunwind.exp106
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sve.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-sve.exp6
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-tagged-pointer.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp4
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-unwind-pc.S2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp4
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-w-registers.c2
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-w-registers.exp4
-rw-r--r--gdb/testsuite/gdb.arch/aix-sighandle.c2
-rw-r--r--gdb/testsuite/gdb.arch/aix-sighandle.exp2
-rw-r--r--gdb/testsuite/gdb.arch/alpha-step.c2
-rw-r--r--gdb/testsuite/gdb.arch/alpha-step.exp33
-rw-r--r--gdb/testsuite/gdb.arch/altivec-abi.exp11
-rw-r--r--gdb/testsuite/gdb.arch/altivec-regs.exp12
-rw-r--r--gdb/testsuite/gdb.arch/amd64-break-on-asm-line.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp4
-rw-r--r--gdb/testsuite/gdb.arch/amd64-byte.exp10
-rw-r--r--gdb/testsuite/gdb.arch/amd64-disp-step-avx.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp3
-rw-r--r--gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c20
-rw-r--r--gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S25
-rw-r--r--gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp6
-rw-r--r--gdb/testsuite/gdb.arch/amd64-disp-step-signal.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-disp-step.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-disp-step.exp6
-rw-r--r--gdb/testsuite/gdb.arch/amd64-dword.exp4
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value-inline.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value-inline.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp8
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp8
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value-param.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value-param.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value-param.exp8
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value-paramref.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value-paramref.cc2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp6
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value.cc2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value.exp6
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value.s2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-eval.cc2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-eval.exp4
-rw-r--r--gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis-no-cfi.S117
-rw-r--r--gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis-offset.S112
-rw-r--r--gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.S143
-rw-r--r--gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.c56
-rw-r--r--gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.exp208
-rw-r--r--gdb/testsuite/gdb.arch/amd64-frameptr-vecreg-unwind.c63
-rw-r--r--gdb/testsuite/gdb.arch/amd64-frameptr-vecreg-unwind.exp40
-rw-r--r--gdb/testsuite/gdb.arch/amd64-gs_base.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-gs_base.exp4
-rw-r--r--gdb/testsuite/gdb.arch/amd64-i386-address.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-i386-address.exp4
-rw-r--r--gdb/testsuite/gdb.arch/amd64-init-x87-values.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-init-x87-values.exp10
-rw-r--r--gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp12
-rw-r--r--gdb/testsuite/gdb.arch/amd64-invalid-stack-top.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp12
-rwxr-xr-xgdb/testsuite/gdb.arch/amd64-lam.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-lam.exp2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-optimout-repeat.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-optimout-repeat.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp6
-rw-r--r--gdb/testsuite/gdb.arch/amd64-osabi.exp2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-prologue-skip.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-prologue-skip.exp7
-rw-r--r--gdb/testsuite/gdb.arch/amd64-prologue-xmm.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp8
-rw-r--r--gdb/testsuite/gdb.arch/amd64-prologue-xmm.s2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-pseudo-unwind-asm.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-pseudo-unwind.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-pseudo-unwind.exp4
-rw-r--r--gdb/testsuite/gdb.arch/amd64-pseudo.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-shadow-stack-cmds.exp143
-rw-r--r--gdb/testsuite/gdb.arch/amd64-shadow-stack-corefile.c46
-rw-r--r--gdb/testsuite/gdb.arch/amd64-shadow-stack-corefile.exp119
-rw-r--r--gdb/testsuite/gdb.arch/amd64-shadow-stack-disp-step.exp84
-rw-r--r--gdb/testsuite/gdb.arch/amd64-shadow-stack.c40
-rw-r--r--gdb/testsuite/gdb.arch/amd64-shadow-stack.exp71
-rw-r--r--gdb/testsuite/gdb.arch/amd64-stap-expressions.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-stap-expressions.exp2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.exp2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-stap-three-arg-disp.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-stap-triplet.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-stap-triplet.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.exp2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp6
-rw-r--r--gdb/testsuite/gdb.arch/amd64-tailcall-cxx1.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-tailcall-cxx1.cc2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-tailcall-cxx2.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-tailcall-cxx2.cc2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-tailcall-noret.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-tailcall-noret.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp6
-rw-r--r--gdb/testsuite/gdb.arch/amd64-tailcall-ret.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-tailcall-ret.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp8
-rw-r--r--gdb/testsuite/gdb.arch/amd64-tailcall-self.S2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-tailcall-self.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-tailcall-self.exp4
-rw-r--r--gdb/testsuite/gdb.arch/amd64-watchpoint-downgrade.c2
-rw-r--r--gdb/testsuite/gdb.arch/amd64-watchpoint-downgrade.exp4
-rw-r--r--gdb/testsuite/gdb.arch/amd64-word.exp4
-rw-r--r--gdb/testsuite/gdb.arch/arc-analyze-prologue.S2
-rw-r--r--gdb/testsuite/gdb.arch/arc-analyze-prologue.exp6
-rw-r--r--gdb/testsuite/gdb.arch/arc-dbnz.S2
-rw-r--r--gdb/testsuite/gdb.arch/arc-dbnz.exp4
-rw-r--r--gdb/testsuite/gdb.arch/arc-decode-insn.S2
-rw-r--r--gdb/testsuite/gdb.arch/arc-decode-insn.exp6
-rw-r--r--gdb/testsuite/gdb.arch/arc-disassembler-options.exp2
-rw-r--r--gdb/testsuite/gdb.arch/arc-disassembler-options.s2
-rw-r--r--gdb/testsuite/gdb.arch/arc-tdesc-cpu.exp2
-rw-r--r--gdb/testsuite/gdb.arch/arc-tdesc-cpu.xml2
-rw-r--r--gdb/testsuite/gdb.arch/arm-bl-branch-dest.c2
-rw-r--r--gdb/testsuite/gdb.arch/arm-bl-branch-dest.exp2
-rw-r--r--gdb/testsuite/gdb.arch/arm-cmse-sgstubs.c2
-rw-r--r--gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp4
-rw-r--r--gdb/testsuite/gdb.arch/arm-disassembler-options.exp2
-rw-r--r--gdb/testsuite/gdb.arch/arm-disp-step.S2
-rw-r--r--gdb/testsuite/gdb.arch/arm-disp-step.exp2
-rw-r--r--gdb/testsuite/gdb.arch/arm-neon.c2
-rw-r--r--gdb/testsuite/gdb.arch/arm-neon.exp4
-rw-r--r--gdb/testsuite/gdb.arch/arm-pseudo-unwind-asm.S2
-rw-r--r--gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy-asm.S2
-rw-r--r--gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.c2
-rw-r--r--gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.exp4
-rw-r--r--gdb/testsuite/gdb.arch/arm-pseudo-unwind.c2
-rw-r--r--gdb/testsuite/gdb.arch/arm-pseudo-unwind.exp4
-rw-r--r--gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.c2
-rw-r--r--gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp4
-rw-r--r--gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.c2
-rw-r--r--gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.exp2
-rw-r--r--gdb/testsuite/gdb.arch/avr-flash-qualifier.c2
-rw-r--r--gdb/testsuite/gdb.arch/avr-flash-qualifier.exp4
-rw-r--r--gdb/testsuite/gdb.arch/core-file-pid0.exp2
-rw-r--r--gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp8
-rw-r--r--gdb/testsuite/gdb.arch/e500-abi.exp2
-rw-r--r--gdb/testsuite/gdb.arch/e500-prologue.c2
-rw-r--r--gdb/testsuite/gdb.arch/e500-prologue.exp7
-rw-r--r--gdb/testsuite/gdb.arch/e500-regs.exp11
-rw-r--r--gdb/testsuite/gdb.arch/ftrace-insn-reloc.exp12
-rw-r--r--gdb/testsuite/gdb.arch/gdb1291.exp5
-rw-r--r--gdb/testsuite/gdb.arch/gdb1291.s2
-rw-r--r--gdb/testsuite/gdb.arch/gdb1431.exp5
-rw-r--r--gdb/testsuite/gdb.arch/gdb1431.s2
-rw-r--r--gdb/testsuite/gdb.arch/gdb1558.c2
-rw-r--r--gdb/testsuite/gdb.arch/gdb1558.exp5
-rw-r--r--gdb/testsuite/gdb.arch/i386-attach-see-vdso.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-attach-see-vdso.exp2
-rw-r--r--gdb/testsuite/gdb.arch/i386-avx.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-avx.exp10
-rw-r--r--gdb/testsuite/gdb.arch/i386-avx512.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-avx512.exp14
-rw-r--r--gdb/testsuite/gdb.arch/i386-biarch-core.exp4
-rw-r--r--gdb/testsuite/gdb.arch/i386-bp_permanent.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-bp_permanent.exp4
-rw-r--r--gdb/testsuite/gdb.arch/i386-byte.exp10
-rw-r--r--gdb/testsuite/gdb.arch/i386-cfi-notcurrent.S2
-rw-r--r--gdb/testsuite/gdb.arch/i386-cfi-notcurrent.exp6
-rw-r--r--gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c20
-rw-r--r--gdb/testsuite/gdb.arch/i386-disp-step-self-call.S25
-rw-r--r--gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp6
-rw-r--r--gdb/testsuite/gdb.arch/i386-disp-step.S2
-rw-r--r--gdb/testsuite/gdb.arch/i386-disp-step.exp2
-rw-r--r--gdb/testsuite/gdb.arch/i386-dr3-watch.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-dr3-watch.exp4
-rw-r--r--gdb/testsuite/gdb.arch/i386-float.S2
-rw-r--r--gdb/testsuite/gdb.arch/i386-float.exp2
-rw-r--r--gdb/testsuite/gdb.arch/i386-gnu-cfi-asm.S2
-rw-r--r--gdb/testsuite/gdb.arch/i386-gnu-cfi.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-gnu-cfi.exp4
-rw-r--r--gdb/testsuite/gdb.arch/i386-permbkpt.S2
-rw-r--r--gdb/testsuite/gdb.arch/i386-permbkpt.exp4
-rw-r--r--gdb/testsuite/gdb.arch/i386-pkru.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-pkru.exp8
-rw-r--r--gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection-stackalign.c27
-rw-r--r--gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp72
-rw-r--r--gdb/testsuite/gdb.arch/i386-prologue.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-prologue.exp4
-rw-r--r--gdb/testsuite/gdb.arch/i386-pseudo.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-signal.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-signal.exp4
-rw-r--r--gdb/testsuite/gdb.arch/i386-size-overlap.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-size-overlap.exp4
-rw-r--r--gdb/testsuite/gdb.arch/i386-size.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-size.exp4
-rw-r--r--gdb/testsuite/gdb.arch/i386-sse-stack-align.S2
-rw-r--r--gdb/testsuite/gdb.arch/i386-sse-stack-align.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-sse-stack-align.exp6
-rw-r--r--gdb/testsuite/gdb.arch/i386-sse.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-sse.exp8
-rw-r--r--gdb/testsuite/gdb.arch/i386-stap-eval-lang-ada.S2
-rw-r--r--gdb/testsuite/gdb.arch/i386-stap-eval-lang-ada.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-stap-eval-lang-ada.exp2
-rw-r--r--gdb/testsuite/gdb.arch/i386-unwind.c2
-rw-r--r--gdb/testsuite/gdb.arch/i386-unwind.exp4
-rw-r--r--gdb/testsuite/gdb.arch/i386-word.exp4
-rw-r--r--gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.S2
-rw-r--r--gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp11
-rw-r--r--gdb/testsuite/gdb.arch/insn-reloc.c2
-rw-r--r--gdb/testsuite/gdb.arch/iwmmxt-regs.c2
-rw-r--r--gdb/testsuite/gdb.arch/iwmmxt-regs.exp2
-rw-r--r--gdb/testsuite/gdb.arch/mips-disassembler-options.exp2
-rw-r--r--gdb/testsuite/gdb.arch/mips-disassembler-options.s2
-rw-r--r--gdb/testsuite/gdb.arch/mips-fcr.c2
-rw-r--r--gdb/testsuite/gdb.arch/mips-fcr.exp4
-rw-r--r--gdb/testsuite/gdb.arch/mips-fpregset-core.c2
-rw-r--r--gdb/testsuite/gdb.arch/mips-fpregset-core.exp8
-rw-r--r--gdb/testsuite/gdb.arch/mips-octeon-bbit.exp15
-rw-r--r--gdb/testsuite/gdb.arch/mips16-thunks-inmain.c2
-rw-r--r--gdb/testsuite/gdb.arch/mips16-thunks-main.c2
-rw-r--r--gdb/testsuite/gdb.arch/mips16-thunks-sin.c2
-rw-r--r--gdb/testsuite/gdb.arch/mips16-thunks-sinfrob.c2
-rw-r--r--gdb/testsuite/gdb.arch/mips16-thunks-sinfrob16.c2
-rw-r--r--gdb/testsuite/gdb.arch/mips16-thunks-sinmain.c2
-rw-r--r--gdb/testsuite/gdb.arch/mips16-thunks-sinmips16.c2
-rw-r--r--gdb/testsuite/gdb.arch/mips16-thunks.exp2
-rw-r--r--gdb/testsuite/gdb.arch/pa-nullify.exp15
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-addpcis.exp16
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-addpcis.s2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-aix-prologue.c2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp7
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-altivec.exp7
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-altivec.s2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-altivec2.exp7
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-altivec2.s2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-altivec3.exp7
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-altivec3.s2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-d128-regs.c2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-d128-regs.exp14
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-disassembler-options.exp2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-fpscr-gcore.exp4
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-htm-regs.c2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-htm-regs.exp15
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-lnia.exp14
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-lnia.s2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp10
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.s2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-power10.exp7
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-power10.s2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-power7.exp7
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-power7.s2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-power8.exp7
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-power8.s2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-power9.exp7
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-power9.s2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-ppr-dscr.c2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp10
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-prologue-frame.S2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-prologue-frame.c2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp6
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-prologue.c2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-prologue.exp4
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-stackless.S2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-stackless.exp2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-tar.c2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-tar.exp10
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-trap.exp2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-trap.s2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-vector-regs.c2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-vector-regs.exp6
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp4
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-vsx.exp7
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-vsx.s2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-vsx2.exp7
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-vsx2.s2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-vsx3.exp7
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-vsx3.s2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc64-prologue.c2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc64-prologue.exp2
-rw-r--r--gdb/testsuite/gdb.arch/powerpc64-trap.s2
-rw-r--r--gdb/testsuite/gdb.arch/ppc-dfp.c2
-rw-r--r--gdb/testsuite/gdb.arch/ppc-dfp.exp6
-rw-r--r--gdb/testsuite/gdb.arch/ppc-fp.c2
-rw-r--r--gdb/testsuite/gdb.arch/ppc-fp.exp6
-rw-r--r--gdb/testsuite/gdb.arch/ppc-longdouble.c2
-rw-r--r--gdb/testsuite/gdb.arch/ppc-longdouble.exp4
-rw-r--r--gdb/testsuite/gdb.arch/ppc64-atomic-inst.S2
-rw-r--r--gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp2
-rw-r--r--gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c2
-rw-r--r--gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c2
-rw-r--r--gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp4
-rw-r--r--gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s2
-rw-r--r--gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.S2
-rw-r--r--gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.c2
-rw-r--r--gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.exp2
-rw-r--r--gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp2
-rw-r--r--gdb/testsuite/gdb.arch/pr25124.S2
-rw-r--r--gdb/testsuite/gdb.arch/pr25124.exp4
-rw-r--r--gdb/testsuite/gdb.arch/riscv-bp-infcall.c2
-rw-r--r--gdb/testsuite/gdb.arch/riscv-bp-infcall.exp4
-rw-r--r--gdb/testsuite/gdb.arch/riscv-default-tdesc.exp2
-rw-r--r--gdb/testsuite/gdb.arch/riscv-info-fcsr.c2
-rw-r--r--gdb/testsuite/gdb.arch/riscv-info-fcsr.exp14
-rw-r--r--gdb/testsuite/gdb.arch/riscv-reg-aliases.c2
-rw-r--r--gdb/testsuite/gdb.arch/riscv-reg-aliases.exp2
-rw-r--r--gdb/testsuite/gdb.arch/riscv-tdesc-loading.exp2
-rw-r--r--gdb/testsuite/gdb.arch/riscv-tdesc-regs.c2
-rw-r--r--gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp2
-rw-r--r--gdb/testsuite/gdb.arch/riscv-unwind-long-insn.S2
-rw-r--r--gdb/testsuite/gdb.arch/riscv-unwind-long-insn.c2
-rw-r--r--gdb/testsuite/gdb.arch/riscv-unwind-long-insn.exp2
-rw-r--r--gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li-foo.s2
-rw-r--r--gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.c2
-rw-r--r--gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.exp2
-rw-r--r--gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw-foo.s2
-rw-r--r--gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw.c2
-rw-r--r--gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw.exp2
-rw-r--r--gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.c2
-rw-r--r--gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.exp2
-rw-r--r--gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.s2
-rw-r--r--gdb/testsuite/gdb.arch/s390-disassembler-options.exp2
-rw-r--r--gdb/testsuite/gdb.arch/s390-multiarch.c2
-rw-r--r--gdb/testsuite/gdb.arch/s390-multiarch.exp2
-rw-r--r--gdb/testsuite/gdb.arch/s390-stackless.S2
-rw-r--r--gdb/testsuite/gdb.arch/s390-stackless.exp2
-rw-r--r--gdb/testsuite/gdb.arch/s390-tdbregs.c2
-rw-r--r--gdb/testsuite/gdb.arch/s390-tdbregs.exp2
-rw-r--r--gdb/testsuite/gdb.arch/s390-vregs.S2
-rw-r--r--gdb/testsuite/gdb.arch/s390-vregs.exp30
-rw-r--r--gdb/testsuite/gdb.arch/skip-prologue.c2
-rw-r--r--gdb/testsuite/gdb.arch/skip-prologue.exp4
-rw-r--r--gdb/testsuite/gdb.arch/sparc-sysstep.c2
-rw-r--r--gdb/testsuite/gdb.arch/sparc-sysstep.exp6
-rw-r--r--gdb/testsuite/gdb.arch/sparc64-adi.c2
-rw-r--r--gdb/testsuite/gdb.arch/sparc64-adi.exp4
-rw-r--r--gdb/testsuite/gdb.arch/sparc64-regs.S2
-rw-r--r--gdb/testsuite/gdb.arch/sparc64-regs.exp2
-rw-r--r--gdb/testsuite/gdb.arch/thumb-bx-pc.S2
-rw-r--r--gdb/testsuite/gdb.arch/thumb-bx-pc.exp4
-rw-r--r--gdb/testsuite/gdb.arch/thumb-prologue.c2
-rw-r--r--gdb/testsuite/gdb.arch/thumb-prologue.exp4
-rw-r--r--gdb/testsuite/gdb.arch/thumb-singlestep.S2
-rw-r--r--gdb/testsuite/gdb.arch/thumb-singlestep.exp4
-rw-r--r--gdb/testsuite/gdb.arch/thumb2-it.S2
-rw-r--r--gdb/testsuite/gdb.arch/thumb2-it.exp4
-rw-r--r--gdb/testsuite/gdb.arch/vsx-regs.exp9
-rw-r--r--gdb/testsuite/gdb.arch/vsx-vsr-float28.c2
-rw-r--r--gdb/testsuite/gdb.arch/vsx-vsr-float28.exp6
-rw-r--r--gdb/testsuite/gdb.arch/x86-avx512bf16.c2
-rw-r--r--gdb/testsuite/gdb.arch/x86-avx512bf16.exp2
-rw-r--r--gdb/testsuite/gdb.arch/x86-avx512fp16-abi.c2
-rw-r--r--gdb/testsuite/gdb.arch/x86-avx512fp16-abi.exp2
-rw-r--r--gdb/testsuite/gdb.arch/x86-avx512fp16.c2
-rw-r--r--gdb/testsuite/gdb.arch/x86-avx512fp16.exp2
-rw-r--r--gdb/testsuite/gdb.arch/x86-set-solib-absolute-prefix.c (renamed from gdb/testsuite/gdb.base/set-solib-absolute-prefix.c)0
-rw-r--r--gdb/testsuite/gdb.arch/x86-set-solib-absolute-prefix.exp (renamed from gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp)0
-rw-r--r--gdb/testsuite/gdb.asm/asm-source.exp32
-rw-r--r--gdb/testsuite/gdb.base/a2-run.exp11
-rw-r--r--gdb/testsuite/gdb.base/access-mem-running.c2
-rw-r--r--gdb/testsuite/gdb.base/access-mem-running.exp9
-rw-r--r--gdb/testsuite/gdb.base/add-symbol-file-attach.c2
-rw-r--r--gdb/testsuite/gdb.base/add-symbol-file-attach.exp2
-rw-r--r--gdb/testsuite/gdb.base/address_space_qualifier.exp2
-rw-r--r--gdb/testsuite/gdb.base/advance-until-multiple-locations.cc2
-rw-r--r--gdb/testsuite/gdb.base/advance-until-multiple-locations.exp14
-rw-r--r--gdb/testsuite/gdb.base/advance.exp4
-rw-r--r--gdb/testsuite/gdb.base/alias.exp2
-rw-r--r--gdb/testsuite/gdb.base/align-c++.exp2
-rw-r--r--gdb/testsuite/gdb.base/align-c.exp2
-rw-r--r--gdb/testsuite/gdb.base/align.exp.tcl2
-rw-r--r--gdb/testsuite/gdb.base/all-architectures-0.exp2
-rw-r--r--gdb/testsuite/gdb.base/all-architectures-1.exp2
-rw-r--r--gdb/testsuite/gdb.base/all-architectures-2.exp2
-rw-r--r--gdb/testsuite/gdb.base/all-architectures-3.exp2
-rw-r--r--gdb/testsuite/gdb.base/all-architectures-4.exp2
-rw-r--r--gdb/testsuite/gdb.base/all-architectures-5.exp2
-rw-r--r--gdb/testsuite/gdb.base/all-architectures-6.exp2
-rw-r--r--gdb/testsuite/gdb.base/all-architectures-7.exp2
-rw-r--r--gdb/testsuite/gdb.base/all-architectures.exp.tcl10
-rw-r--r--gdb/testsuite/gdb.base/all-bin.exp4
-rw-r--r--gdb/testsuite/gdb.base/annota-input-while-running.c2
-rw-r--r--gdb/testsuite/gdb.base/annota-input-while-running.exp2
-rw-r--r--gdb/testsuite/gdb.base/annota1.exp17
-rw-r--r--gdb/testsuite/gdb.base/annota3.exp12
-rw-r--r--gdb/testsuite/gdb.base/annotate-symlink.exp4
-rw-r--r--gdb/testsuite/gdb.base/anon.exp2
-rw-r--r--gdb/testsuite/gdb.base/args.exp210
-rw-r--r--gdb/testsuite/gdb.base/argv0-symlink.c2
-rw-r--r--gdb/testsuite/gdb.base/argv0-symlink.exp8
-rw-r--r--gdb/testsuite/gdb.base/arithmet.exp6
-rw-r--r--gdb/testsuite/gdb.base/array-indices.exp2
-rw-r--r--gdb/testsuite/gdb.base/array-indices.exp.tcl2
-rw-r--r--gdb/testsuite/gdb.base/array-repeat.c2
-rw-r--r--gdb/testsuite/gdb.base/array-repeat.exp2
-rw-r--r--gdb/testsuite/gdb.base/array-repeat.exp.tcl2
-rw-r--r--gdb/testsuite/gdb.base/arrayidx.c2
-rw-r--r--gdb/testsuite/gdb.base/arrayidx.exp5
-rw-r--r--gdb/testsuite/gdb.base/asmlabel.c2
-rw-r--r--gdb/testsuite/gdb.base/asmlabel.exp4
-rw-r--r--gdb/testsuite/gdb.base/assign.exp7
-rw-r--r--gdb/testsuite/gdb.base/async-shell.c2
-rw-r--r--gdb/testsuite/gdb.base/async-shell.exp2
-rw-r--r--gdb/testsuite/gdb.base/async.exp4
-rw-r--r--gdb/testsuite/gdb.base/attach-deleted-exec.c2
-rw-r--r--gdb/testsuite/gdb.base/attach-deleted-exec.exp46
-rw-r--r--gdb/testsuite/gdb.base/attach-fail-twice.c2
-rw-r--r--gdb/testsuite/gdb.base/attach-fail-twice.exp5
-rw-r--r--gdb/testsuite/gdb.base/attach-non-pgrp-leader.c2
-rw-r--r--gdb/testsuite/gdb.base/attach-non-pgrp-leader.exp8
-rw-r--r--gdb/testsuite/gdb.base/attach-pie-misread.c2
-rw-r--r--gdb/testsuite/gdb.base/attach-pie-misread.exp20
-rw-r--r--gdb/testsuite/gdb.base/attach-pie-noexec.c2
-rw-r--r--gdb/testsuite/gdb.base/attach-pie-noexec.exp8
-rw-r--r--gdb/testsuite/gdb.base/attach-twice.c2
-rw-r--r--gdb/testsuite/gdb.base/attach-twice.exp4
-rw-r--r--gdb/testsuite/gdb.base/attach-wait-input.c2
-rw-r--r--gdb/testsuite/gdb.base/attach-wait-input.exp5
-rw-r--r--gdb/testsuite/gdb.base/attach.c4
-rw-r--r--gdb/testsuite/gdb.base/attach.exp47
-rw-r--r--gdb/testsuite/gdb.base/auto-connect-native-target.c2
-rw-r--r--gdb/testsuite/gdb.base/auto-connect-native-target.exp2
-rw-r--r--gdb/testsuite/gdb.base/auto-load-script2
-rw-r--r--gdb/testsuite/gdb.base/auto-load.c2
-rw-r--r--gdb/testsuite/gdb.base/auto-load.exp2
-rw-r--r--gdb/testsuite/gdb.base/auxv.c2
-rw-r--r--gdb/testsuite/gdb.base/auxv.exp7
-rw-r--r--gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp72
-rw-r--r--gdb/testsuite/gdb.base/backtrace.c2
-rw-r--r--gdb/testsuite/gdb.base/backtrace.exp8
-rw-r--r--gdb/testsuite/gdb.base/bad-file.exp2
-rw-r--r--gdb/testsuite/gdb.base/bang.exp2
-rw-r--r--gdb/testsuite/gdb.base/basic-edit-cmd.c2
-rw-r--r--gdb/testsuite/gdb.base/basic-edit-cmd.exp7
-rw-r--r--gdb/testsuite/gdb.base/batch-exit-status.exp4
-rw-r--r--gdb/testsuite/gdb.base/batch-preserve-term-settings.c2
-rw-r--r--gdb/testsuite/gdb.base/batch-preserve-term-settings.exp26
-rw-r--r--gdb/testsuite/gdb.base/bfd-errors-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/bfd-errors.exp30
-rw-r--r--gdb/testsuite/gdb.base/bfp-test.c2
-rw-r--r--gdb/testsuite/gdb.base/bfp-test.exp7
-rw-r--r--gdb/testsuite/gdb.base/bg-exec-sigint-bp-cond.c2
-rw-r--r--gdb/testsuite/gdb.base/bg-exec-sigint-bp-cond.exp5
-rw-r--r--gdb/testsuite/gdb.base/bg-execution-repeat.c4
-rw-r--r--gdb/testsuite/gdb.base/bg-execution-repeat.exp18
-rw-r--r--gdb/testsuite/gdb.base/bigcore.c2
-rw-r--r--gdb/testsuite/gdb.base/bigcore.exp9
-rw-r--r--gdb/testsuite/gdb.base/bitfields.exp4
-rw-r--r--gdb/testsuite/gdb.base/bitfields2.exp13
-rw-r--r--gdb/testsuite/gdb.base/bitops.exp4
-rw-r--r--gdb/testsuite/gdb.base/bitshift.exp3
-rw-r--r--gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.c2
-rw-r--r--gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.exp8
-rw-r--r--gdb/testsuite/gdb.base/bp-cmds-execution-x-script.c2
-rw-r--r--gdb/testsuite/gdb.base/bp-cmds-execution-x-script.exp2
-rw-r--r--gdb/testsuite/gdb.base/bp-cmds-execution-x-script.gdb2
-rw-r--r--gdb/testsuite/gdb.base/bp-cmds-run-with-ex.c2
-rw-r--r--gdb/testsuite/gdb.base/bp-cmds-run-with-ex.exp2
-rw-r--r--gdb/testsuite/gdb.base/bp-cmds-run-with-ex.gdb2
-rw-r--r--gdb/testsuite/gdb.base/bp-cmds-sourced-script.c2
-rw-r--r--gdb/testsuite/gdb.base/bp-cmds-sourced-script.exp2
-rw-r--r--gdb/testsuite/gdb.base/bp-cmds-sourced-script.gdb2
-rw-r--r--gdb/testsuite/gdb.base/bp-cond-failure.c2
-rw-r--r--gdb/testsuite/gdb.base/bp-cond-failure.exp11
-rw-r--r--gdb/testsuite/gdb.base/bp-disabled-by-cond.exp3
-rw-r--r--gdb/testsuite/gdb.base/bp-permanent.c4
-rw-r--r--gdb/testsuite/gdb.base/bp-permanent.exp15
-rw-r--r--gdb/testsuite/gdb.base/branch-to-self.c2
-rw-r--r--gdb/testsuite/gdb.base/branch-to-self.exp6
-rw-r--r--gdb/testsuite/gdb.base/break-always.c2
-rw-r--r--gdb/testsuite/gdb.base/break-always.exp2
-rw-r--r--gdb/testsuite/gdb.base/break-caller-line.c2
-rw-r--r--gdb/testsuite/gdb.base/break-caller-line.exp4
-rw-r--r--gdb/testsuite/gdb.base/break-dbg.cc31
-rw-r--r--gdb/testsuite/gdb.base/break-dbg.exp80
-rw-r--r--gdb/testsuite/gdb.base/break-entry.exp4
-rw-r--r--gdb/testsuite/gdb.base/break-fun-addr.exp5
-rw-r--r--gdb/testsuite/gdb.base/break-fun-addr1.c2
-rw-r--r--gdb/testsuite/gdb.base/break-fun-addr2.c2
-rw-r--r--gdb/testsuite/gdb.base/break-idempotent.c2
-rw-r--r--gdb/testsuite/gdb.base/break-idempotent.exp6
-rw-r--r--gdb/testsuite/gdb.base/break-include.c2
-rw-r--r--gdb/testsuite/gdb.base/break-include.exp2
-rw-r--r--gdb/testsuite/gdb.base/break-include.inc2
-rw-r--r--gdb/testsuite/gdb.base/break-inline.c2
-rw-r--r--gdb/testsuite/gdb.base/break-inline.exp2
-rw-r--r--gdb/testsuite/gdb.base/break-interp-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/break-interp-main.c2
-rw-r--r--gdb/testsuite/gdb.base/break-interp.exp48
-rw-r--r--gdb/testsuite/gdb.base/break-main-file-remove-fail.c2
-rw-r--r--gdb/testsuite/gdb.base/break-main-file-remove-fail.exp6
-rw-r--r--gdb/testsuite/gdb.base/break-on-linker-gcd-function.cc2
-rw-r--r--gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp2
-rw-r--r--gdb/testsuite/gdb.base/break-probes-solib.c2
-rw-r--r--gdb/testsuite/gdb.base/break-probes.c2
-rw-r--r--gdb/testsuite/gdb.base/break-probes.exp2
-rw-r--r--gdb/testsuite/gdb.base/break-unload-file.c2
-rw-r--r--gdb/testsuite/gdb.base/break-unload-file.exp2
-rw-r--r--gdb/testsuite/gdb.base/break.c2
-rw-r--r--gdb/testsuite/gdb.base/break.exp4
-rw-r--r--gdb/testsuite/gdb.base/break1.c10
-rw-r--r--gdb/testsuite/gdb.base/breakpoint-in-ro-region.c2
-rw-r--r--gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp6
-rw-r--r--gdb/testsuite/gdb.base/breakpoint-shadow.c2
-rw-r--r--gdb/testsuite/gdb.base/breakpoint-shadow.exp6
-rw-r--r--gdb/testsuite/gdb.base/bt-on-error-and-warning.exp2
-rw-r--r--gdb/testsuite/gdb.base/bt-on-fatal-signal.c2
-rw-r--r--gdb/testsuite/gdb.base/bt-on-fatal-signal.exp7
-rw-r--r--gdb/testsuite/gdb.base/bt-selected-frame.c2
-rw-r--r--gdb/testsuite/gdb.base/bt-selected-frame.exp5
-rw-r--r--gdb/testsuite/gdb.base/build-id-seqno.c2
-rw-r--r--gdb/testsuite/gdb.base/build-id-seqno.exp2
-rw-r--r--gdb/testsuite/gdb.base/c-linkage-name-2.c2
-rw-r--r--gdb/testsuite/gdb.base/c-linkage-name.c2
-rw-r--r--gdb/testsuite/gdb.base/c-linkage-name.exp2
-rw-r--r--gdb/testsuite/gdb.base/cached-source-file.c2
-rw-r--r--gdb/testsuite/gdb.base/cached-source-file.exp2
-rw-r--r--gdb/testsuite/gdb.base/call-ar-st.exp40
-rw-r--r--gdb/testsuite/gdb.base/call-rt-st.exp23
-rw-r--r--gdb/testsuite/gdb.base/call-sc.c2
-rw-r--r--gdb/testsuite/gdb.base/call-sc.exp22
-rw-r--r--gdb/testsuite/gdb.base/call-signal-resume.exp5
-rw-r--r--gdb/testsuite/gdb.base/call-signals.c2
-rw-r--r--gdb/testsuite/gdb.base/call-strs.exp22
-rw-r--r--gdb/testsuite/gdb.base/callexit.c2
-rw-r--r--gdb/testsuite/gdb.base/callexit.exp5
-rw-r--r--gdb/testsuite/gdb.base/callfuncs.c2
-rw-r--r--gdb/testsuite/gdb.base/callfuncs.exp38
-rw-r--r--gdb/testsuite/gdb.base/cast-call.c2
-rw-r--r--gdb/testsuite/gdb.base/cast-call.exp2
-rw-r--r--gdb/testsuite/gdb.base/cast-indirection.c2
-rw-r--r--gdb/testsuite/gdb.base/cast-indirection.exp4
-rw-r--r--gdb/testsuite/gdb.base/catch-follow-exec.c2
-rw-r--r--gdb/testsuite/gdb.base/catch-follow-exec.exp2
-rw-r--r--gdb/testsuite/gdb.base/catch-fork-kill.c2
-rw-r--r--gdb/testsuite/gdb.base/catch-fork-kill.exp6
-rw-r--r--gdb/testsuite/gdb.base/catch-fork-static.exp6
-rw-r--r--gdb/testsuite/gdb.base/catch-gdb-caused-signals.c2
-rw-r--r--gdb/testsuite/gdb.base/catch-gdb-caused-signals.exp6
-rw-r--r--gdb/testsuite/gdb.base/catch-load-so.c2
-rw-r--r--gdb/testsuite/gdb.base/catch-load.c2
-rw-r--r--gdb/testsuite/gdb.base/catch-load.exp2
-rw-r--r--gdb/testsuite/gdb.base/catch-signal-fork.c2
-rw-r--r--gdb/testsuite/gdb.base/catch-signal-fork.exp3
-rw-r--r--gdb/testsuite/gdb.base/catch-signal-siginfo-cond.c2
-rw-r--r--gdb/testsuite/gdb.base/catch-signal-siginfo-cond.exp2
-rw-r--r--gdb/testsuite/gdb.base/catch-signal.c2
-rw-r--r--gdb/testsuite/gdb.base/catch-signal.exp2
-rw-r--r--gdb/testsuite/gdb.base/catch-syscall.exp16
-rw-r--r--gdb/testsuite/gdb.base/charset-malloc.c2
-rw-r--r--gdb/testsuite/gdb.base/charset.c2
-rw-r--r--gdb/testsuite/gdb.base/charset.exp10
-rw-r--r--gdb/testsuite/gdb.base/check-psymtab.c2
-rw-r--r--gdb/testsuite/gdb.base/check-psymtab.exp2
-rw-r--r--gdb/testsuite/gdb.base/checkpoint-ns.exp2
-rw-r--r--gdb/testsuite/gdb.base/checkpoint.c2
-rw-r--r--gdb/testsuite/gdb.base/checkpoint.exp8
-rw-r--r--gdb/testsuite/gdb.base/chng-syms.exp21
-rw-r--r--gdb/testsuite/gdb.base/clear_non_user_bp.exp5
-rw-r--r--gdb/testsuite/gdb.base/cli-suppress-notification.c83
-rw-r--r--gdb/testsuite/gdb.base/cli-suppress-notification.exp55
-rw-r--r--gdb/testsuite/gdb.base/code-expr.exp7
-rw-r--r--gdb/testsuite/gdb.base/code_elim.exp2
-rw-r--r--gdb/testsuite/gdb.base/code_elim1.c2
-rw-r--r--gdb/testsuite/gdb.base/code_elim2.c2
-rw-r--r--gdb/testsuite/gdb.base/color-prompt.exp29
-rw-r--r--gdb/testsuite/gdb.base/command-line-input.exp62
-rw-r--r--gdb/testsuite/gdb.base/commands.exp12
-rw-r--r--gdb/testsuite/gdb.base/compare-sections.c2
-rw-r--r--gdb/testsuite/gdb.base/compare-sections.exp4
-rw-r--r--gdb/testsuite/gdb.base/complete-empty.exp2
-rw-r--r--gdb/testsuite/gdb.base/completion.exp6
-rw-r--r--gdb/testsuite/gdb.base/complex-parts.c2
-rw-r--r--gdb/testsuite/gdb.base/complex-parts.exp2
-rw-r--r--gdb/testsuite/gdb.base/complex.c2
-rw-r--r--gdb/testsuite/gdb.base/complex.exp2
-rw-r--r--gdb/testsuite/gdb.base/comprdebug.exp4
-rw-r--r--gdb/testsuite/gdb.base/cond-eval-mode.c2
-rw-r--r--gdb/testsuite/gdb.base/cond-eval-mode.exp4
-rw-r--r--gdb/testsuite/gdb.base/cond-expr.exp7
-rw-r--r--gdb/testsuite/gdb.base/condbreak-bad.c2
-rw-r--r--gdb/testsuite/gdb.base/condbreak-bad.exp6
-rw-r--r--gdb/testsuite/gdb.base/condbreak-call-false.c2
-rw-r--r--gdb/testsuite/gdb.base/condbreak-call-false.exp2
-rw-r--r--gdb/testsuite/gdb.base/condbreak-multi-context.cc2
-rw-r--r--gdb/testsuite/gdb.base/condbreak-multi-context.exp17
-rw-r--r--gdb/testsuite/gdb.base/condbreak.exp10
-rw-r--r--gdb/testsuite/gdb.base/consecutive-step-over.c2
-rw-r--r--gdb/testsuite/gdb.base/consecutive-step-over.exp4
-rw-r--r--gdb/testsuite/gdb.base/consecutive.exp6
-rw-r--r--gdb/testsuite/gdb.base/constvars.exp9
-rw-r--r--gdb/testsuite/gdb.base/continue-after-aborted-step-over.c2
-rw-r--r--gdb/testsuite/gdb.base/continue-after-aborted-step-over.exp9
-rw-r--r--gdb/testsuite/gdb.base/continue-all-already-running.c2
-rw-r--r--gdb/testsuite/gdb.base/continue-all-already-running.exp4
-rw-r--r--gdb/testsuite/gdb.base/coredump-filter-build-id.exp6
-rw-r--r--gdb/testsuite/gdb.base/coredump-filter.c2
-rw-r--r--gdb/testsuite/gdb.base/coredump-filter.exp2
-rw-r--r--gdb/testsuite/gdb.base/corefile-buildid-shlib-shr.c2
-rw-r--r--gdb/testsuite/gdb.base/corefile-buildid-shlib.c2
-rw-r--r--gdb/testsuite/gdb.base/corefile-buildid.c2
-rw-r--r--gdb/testsuite/gdb.base/corefile-buildid.exp4
-rw-r--r--gdb/testsuite/gdb.base/corefile-exec-context.c2
-rw-r--r--gdb/testsuite/gdb.base/corefile-exec-context.exp13
-rw-r--r--gdb/testsuite/gdb.base/corefile-find-exec.c2
-rw-r--r--gdb/testsuite/gdb.base/corefile-find-exec.exp2
-rw-r--r--gdb/testsuite/gdb.base/corefile-shmem-zero-id-lib.c522
-rw-r--r--gdb/testsuite/gdb.base/corefile-shmem-zero-id.c63
-rw-r--r--gdb/testsuite/gdb.base/corefile-shmem-zero-id.exp230
-rw-r--r--gdb/testsuite/gdb.base/corefile.exp31
-rw-r--r--gdb/testsuite/gdb.base/corefile2.exp9
-rw-r--r--gdb/testsuite/gdb.base/corefile3.c118
-rw-r--r--gdb/testsuite/gdb.base/corefile3.exp73
-rw-r--r--gdb/testsuite/gdb.base/coremaker.c2
-rw-r--r--gdb/testsuite/gdb.base/coremaker2.c2
-rw-r--r--gdb/testsuite/gdb.base/ctf-constvars.c2
-rw-r--r--gdb/testsuite/gdb.base/ctf-constvars.exp2
-rw-r--r--gdb/testsuite/gdb.base/ctf-ptype.c2
-rw-r--r--gdb/testsuite/gdb.base/ctf-ptype.exp9
-rw-r--r--gdb/testsuite/gdb.base/ctxobj-f.c2
-rw-r--r--gdb/testsuite/gdb.base/ctxobj-m.c2
-rw-r--r--gdb/testsuite/gdb.base/ctxobj-v.c2
-rw-r--r--gdb/testsuite/gdb.base/ctxobj.exp4
-rw-r--r--gdb/testsuite/gdb.base/cursal.c2
-rw-r--r--gdb/testsuite/gdb.base/cursal.exp2
-rw-r--r--gdb/testsuite/gdb.base/cvexpr.c2
-rw-r--r--gdb/testsuite/gdb.base/cvexpr.exp4
-rw-r--r--gdb/testsuite/gdb.base/dcache-flush.c2
-rw-r--r--gdb/testsuite/gdb.base/dcache-flush.exp4
-rw-r--r--gdb/testsuite/gdb.base/dcache-line-read-error.c2
-rw-r--r--gdb/testsuite/gdb.base/dcache-line-read-error.exp6
-rw-r--r--gdb/testsuite/gdb.base/debug-expr.exp4
-rw-r--r--gdb/testsuite/gdb.base/debug-frame-2.c2
-rw-r--r--gdb/testsuite/gdb.base/debug-frame.c2
-rw-r--r--gdb/testsuite/gdb.base/debug-frame.exp4
-rw-r--r--gdb/testsuite/gdb.base/decl-before-def-decl.c2
-rw-r--r--gdb/testsuite/gdb.base/decl-before-def-def.c2
-rw-r--r--gdb/testsuite/gdb.base/decl-before-def.exp2
-rw-r--r--gdb/testsuite/gdb.base/default-args.c2
-rw-r--r--gdb/testsuite/gdb.base/default-args.exp5
-rw-r--r--gdb/testsuite/gdb.base/default.exp318
-rw-r--r--gdb/testsuite/gdb.base/define-prefix.exp2
-rw-r--r--gdb/testsuite/gdb.base/define.exp2
-rw-r--r--gdb/testsuite/gdb.base/del.c2
-rw-r--r--gdb/testsuite/gdb.base/del.exp2
-rw-r--r--gdb/testsuite/gdb.base/detach-sysroot-target.c2
-rw-r--r--gdb/testsuite/gdb.base/detach-sysroot-target.exp6
-rw-r--r--gdb/testsuite/gdb.base/detach-while-running.c2
-rw-r--r--gdb/testsuite/gdb.base/detach-while-running.exp5
-rw-r--r--gdb/testsuite/gdb.base/detach.exp5
-rw-r--r--gdb/testsuite/gdb.base/dfp-exprs.exp2
-rw-r--r--gdb/testsuite/gdb.base/dfp-test.c2
-rw-r--r--gdb/testsuite/gdb.base/dfp-test.exp5
-rw-r--r--gdb/testsuite/gdb.base/disabled-location.c2
-rw-r--r--gdb/testsuite/gdb.base/disabled-location.exp2
-rw-r--r--gdb/testsuite/gdb.base/disasm-end-cu-1.c2
-rw-r--r--gdb/testsuite/gdb.base/disasm-end-cu-2.c2
-rw-r--r--gdb/testsuite/gdb.base/disasm-end-cu.exp4
-rw-r--r--gdb/testsuite/gdb.base/disasm-optim.S2
-rw-r--r--gdb/testsuite/gdb.base/disasm-optim.c2
-rw-r--r--gdb/testsuite/gdb.base/disasm-optim.exp4
-rw-r--r--gdb/testsuite/gdb.base/disasm-optim.h2
-rw-r--r--gdb/testsuite/gdb.base/displaced-step-closure.c2
-rw-r--r--gdb/testsuite/gdb.base/displaced-step-closure.exp4
-rw-r--r--gdb/testsuite/gdb.base/display.exp9
-rw-r--r--gdb/testsuite/gdb.base/dlmopen-lib-dep.c2
-rw-r--r--gdb/testsuite/gdb.base/dlmopen-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/dlmopen-main.c2
-rw-r--r--gdb/testsuite/gdb.base/dlmopen-ns-ids-lib.c28
-rw-r--r--gdb/testsuite/gdb.base/dlmopen-ns-ids-main.c60
-rw-r--r--gdb/testsuite/gdb.base/dlmopen-ns-ids.exp320
-rw-r--r--gdb/testsuite/gdb.base/dlmopen.exp58
-rw-r--r--gdb/testsuite/gdb.base/dmsym.c2
-rw-r--r--gdb/testsuite/gdb.base/dmsym.exp2
-rw-r--r--gdb/testsuite/gdb.base/dmsym_main.c2
-rw-r--r--gdb/testsuite/gdb.base/document.exp2
-rw-r--r--gdb/testsuite/gdb.base/dprintf-bp-same-addr.c2
-rw-r--r--gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp11
-rw-r--r--gdb/testsuite/gdb.base/dprintf-detach.c2
-rw-r--r--gdb/testsuite/gdb.base/dprintf-detach.exp14
-rw-r--r--gdb/testsuite/gdb.base/dprintf-execution-x-script.c2
-rw-r--r--gdb/testsuite/gdb.base/dprintf-execution-x-script.exp5
-rw-r--r--gdb/testsuite/gdb.base/dprintf-execution-x-script.gdb2
-rw-r--r--gdb/testsuite/gdb.base/dprintf-next.c2
-rw-r--r--gdb/testsuite/gdb.base/dprintf-next.exp8
-rw-r--r--gdb/testsuite/gdb.base/dprintf-non-stop.c2
-rw-r--r--gdb/testsuite/gdb.base/dprintf-non-stop.exp8
-rw-r--r--gdb/testsuite/gdb.base/dprintf-pending.c2
-rw-r--r--gdb/testsuite/gdb.base/dprintf-pending.exp5
-rw-r--r--gdb/testsuite/gdb.base/dprintf-pendshr.c2
-rw-r--r--gdb/testsuite/gdb.base/dprintf.c2
-rw-r--r--gdb/testsuite/gdb.base/dprintf.exp17
-rw-r--r--gdb/testsuite/gdb.base/dso2dso-dso1.c2
-rw-r--r--gdb/testsuite/gdb.base/dso2dso-dso1.h2
-rw-r--r--gdb/testsuite/gdb.base/dso2dso-dso2.c2
-rw-r--r--gdb/testsuite/gdb.base/dso2dso-dso2.h2
-rw-r--r--gdb/testsuite/gdb.base/dso2dso.c2
-rw-r--r--gdb/testsuite/gdb.base/dso2dso.exp5
-rw-r--r--gdb/testsuite/gdb.base/dtrace-probe.c2
-rw-r--r--gdb/testsuite/gdb.base/dtrace-probe.d2
-rw-r--r--gdb/testsuite/gdb.base/dtrace-probe.exp17
-rw-r--r--gdb/testsuite/gdb.base/dump.c2
-rw-r--r--gdb/testsuite/gdb.base/dump.exp30
-rw-r--r--gdb/testsuite/gdb.base/dup-sect.S2
-rw-r--r--gdb/testsuite/gdb.base/dup-sect.exp6
-rw-r--r--gdb/testsuite/gdb.base/duplicate-bp.c2
-rw-r--r--gdb/testsuite/gdb.base/duplicate-bp.exp5
-rw-r--r--gdb/testsuite/gdb.base/early-init-file.c2
-rw-r--r--gdb/testsuite/gdb.base/early-init-file.exp2
-rw-r--r--gdb/testsuite/gdb.base/echo.exp2
-rw-r--r--gdb/testsuite/gdb.base/eh_return.c2
-rw-r--r--gdb/testsuite/gdb.base/eh_return.exp5
-rw-r--r--gdb/testsuite/gdb.base/empty-host-env-vars.exp2
-rw-r--r--gdb/testsuite/gdb.base/empty_exe.exp2
-rw-r--r--gdb/testsuite/gdb.base/ena-dis-br.exp4
-rw-r--r--gdb/testsuite/gdb.base/endian.c2
-rw-r--r--gdb/testsuite/gdb.base/endian.exp2
-rw-r--r--gdb/testsuite/gdb.base/endianity.c2
-rw-r--r--gdb/testsuite/gdb.base/endianity.exp6
-rw-r--r--gdb/testsuite/gdb.base/ending-run.exp28
-rw-r--r--gdb/testsuite/gdb.base/enum_cond.c2
-rw-r--r--gdb/testsuite/gdb.base/enum_cond.exp2
-rw-r--r--gdb/testsuite/gdb.base/enumval.c2
-rw-r--r--gdb/testsuite/gdb.base/enumval.exp2
-rw-r--r--gdb/testsuite/gdb.base/environ.exp2
-rw-r--r--gdb/testsuite/gdb.base/eof-exit.exp2
-rw-r--r--gdb/testsuite/gdb.base/errno.c2
-rw-r--r--gdb/testsuite/gdb.base/errno.exp18
-rw-r--r--gdb/testsuite/gdb.base/eu-strip-infcall.c2
-rw-r--r--gdb/testsuite/gdb.base/eu-strip-infcall.exp4
-rw-r--r--gdb/testsuite/gdb.base/eval-avoid-side-effects.exp4
-rw-r--r--gdb/testsuite/gdb.base/eval-skip.exp7
-rw-r--r--gdb/testsuite/gdb.base/eval.exp2
-rw-r--r--gdb/testsuite/gdb.base/examine-backward.c2
-rw-r--r--gdb/testsuite/gdb.base/examine-backward.exp6
-rw-r--r--gdb/testsuite/gdb.base/exe-lock.exp5
-rw-r--r--gdb/testsuite/gdb.base/exec-invalid-sysroot.exp5
-rw-r--r--gdb/testsuite/gdb.base/execl-update-breakpoints.c2
-rw-r--r--gdb/testsuite/gdb.base/execl-update-breakpoints.exp11
-rw-r--r--gdb/testsuite/gdb.base/execution-termios.c2
-rw-r--r--gdb/testsuite/gdb.base/execution-termios.exp6
-rw-r--r--gdb/testsuite/gdb.base/exitsignal.exp2
-rw-r--r--gdb/testsuite/gdb.base/expand-psymtabs.c2
-rw-r--r--gdb/testsuite/gdb.base/expand-psymtabs.exp4
-rw-r--r--gdb/testsuite/gdb.base/exprs.exp36
-rw-r--r--gdb/testsuite/gdb.base/fileio.c4
-rw-r--r--gdb/testsuite/gdb.base/fileio.exp15
-rw-r--r--gdb/testsuite/gdb.base/filename-completion.exp35
-rw-r--r--gdb/testsuite/gdb.base/filesym.c2
-rw-r--r--gdb/testsuite/gdb.base/filesym.exp2
-rw-r--r--gdb/testsuite/gdb.base/find-unmapped.c2
-rw-r--r--gdb/testsuite/gdb.base/find-unmapped.exp4
-rw-r--r--gdb/testsuite/gdb.base/find.c2
-rw-r--r--gdb/testsuite/gdb.base/find.exp7
-rw-r--r--gdb/testsuite/gdb.base/finish-pretty.c2
-rw-r--r--gdb/testsuite/gdb.base/finish-pretty.exp4
-rw-r--r--gdb/testsuite/gdb.base/finish.exp2
-rw-r--r--gdb/testsuite/gdb.base/fission-macro-2.c2
-rw-r--r--gdb/testsuite/gdb.base/fission-macro.c2
-rw-r--r--gdb/testsuite/gdb.base/fission-macro.exp4
-rw-r--r--gdb/testsuite/gdb.base/fixsection.c2
-rw-r--r--gdb/testsuite/gdb.base/fixsection.exp5
-rw-r--r--gdb/testsuite/gdb.base/flexible-array-member.c2
-rw-r--r--gdb/testsuite/gdb.base/flexible-array-member.exp2
-rw-r--r--gdb/testsuite/gdb.base/float.c2
-rw-r--r--gdb/testsuite/gdb.base/float.exp2
-rw-r--r--gdb/testsuite/gdb.base/float128.c2
-rw-r--r--gdb/testsuite/gdb.base/float128.exp5
-rw-r--r--gdb/testsuite/gdb.base/floatn.c2
-rw-r--r--gdb/testsuite/gdb.base/floatn.exp5
-rw-r--r--gdb/testsuite/gdb.base/foll-exec-c++.exp24
-rw-r--r--gdb/testsuite/gdb.base/foll-exec-c.exp23
-rw-r--r--gdb/testsuite/gdb.base/foll-exec-mode.c2
-rw-r--r--gdb/testsuite/gdb.base/foll-exec-mode.exp2
-rw-r--r--gdb/testsuite/gdb.base/foll-exec.c35
-rw-r--r--gdb/testsuite/gdb.base/foll-exec.exp.tcl (renamed from gdb/testsuite/gdb.base/foll-exec.exp)98
-rw-r--r--gdb/testsuite/gdb.base/foll-fork-syscall.c35
-rw-r--r--gdb/testsuite/gdb.base/foll-fork-syscall.exp143
-rw-r--r--gdb/testsuite/gdb.base/foll-fork.exp8
-rw-r--r--gdb/testsuite/gdb.base/foll-vfork-exit.c2
-rw-r--r--gdb/testsuite/gdb.base/foll-vfork.c2
-rw-r--r--gdb/testsuite/gdb.base/foll-vfork.exp11
-rw-r--r--gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen-shlib.c2
-rw-r--r--gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.c2
-rw-r--r--gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.exp6
-rw-r--r--gdb/testsuite/gdb.base/fork-print-inferior-events.c2
-rw-r--r--gdb/testsuite/gdb.base/fork-print-inferior-events.exp9
-rw-r--r--gdb/testsuite/gdb.base/fork-running-state.c2
-rw-r--r--gdb/testsuite/gdb.base/fork-running-state.exp4
-rw-r--r--gdb/testsuite/gdb.base/fortran-sym-case.c2
-rw-r--r--gdb/testsuite/gdb.base/fortran-sym-case.exp4
-rw-r--r--gdb/testsuite/gdb.base/frame-args.c2
-rw-r--r--gdb/testsuite/gdb.base/frame-args.exp5
-rw-r--r--gdb/testsuite/gdb.base/frame-info-consistent.exp5
-rw-r--r--gdb/testsuite/gdb.base/frame-selection.c2
-rw-r--r--gdb/testsuite/gdb.base/frame-selection.exp4
-rw-r--r--gdb/testsuite/gdb.base/frame-view.c2
-rw-r--r--gdb/testsuite/gdb.base/frame-view.exp5
-rw-r--r--gdb/testsuite/gdb.base/frame-view.py2
-rw-r--r--gdb/testsuite/gdb.base/frameapply.c2
-rw-r--r--gdb/testsuite/gdb.base/frameapply.exp2
-rw-r--r--gdb/testsuite/gdb.base/freebpcmd.c2
-rw-r--r--gdb/testsuite/gdb.base/freebpcmd.exp2
-rw-r--r--gdb/testsuite/gdb.base/fullname.c2
-rw-r--r--gdb/testsuite/gdb.base/fullname.exp15
-rw-r--r--gdb/testsuite/gdb.base/fullpath-expand-func.c2
-rw-r--r--gdb/testsuite/gdb.base/fullpath-expand.c2
-rw-r--r--gdb/testsuite/gdb.base/fullpath-expand.exp4
-rw-r--r--gdb/testsuite/gdb.base/func-ptr.c2
-rw-r--r--gdb/testsuite/gdb.base/func-ptr.exp4
-rw-r--r--gdb/testsuite/gdb.base/func-ptrs.c2
-rw-r--r--gdb/testsuite/gdb.base/func-ptrs.exp2
-rw-r--r--gdb/testsuite/gdb.base/funcargs.exp16
-rw-r--r--gdb/testsuite/gdb.base/gcore-buffer-overflow.c2
-rw-r--r--gdb/testsuite/gdb.base/gcore-buffer-overflow.exp5
-rw-r--r--gdb/testsuite/gdb.base/gcore-memory-usage.exp29
-rw-r--r--gdb/testsuite/gdb.base/gcore-relro-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/gcore-relro-main.c2
-rw-r--r--gdb/testsuite/gdb.base/gcore-relro-pie.c2
-rw-r--r--gdb/testsuite/gdb.base/gcore-relro-pie.exp12
-rw-r--r--gdb/testsuite/gdb.base/gcore-relro.exp10
-rw-r--r--gdb/testsuite/gdb.base/gcore-tls-pie.c2
-rw-r--r--gdb/testsuite/gdb.base/gcore-tls-pie.exp12
-rw-r--r--gdb/testsuite/gdb.base/gcore.c2
-rw-r--r--gdb/testsuite/gdb.base/gcore.exp18
-rw-r--r--gdb/testsuite/gdb.base/gcorebg.c2
-rw-r--r--gdb/testsuite/gdb.base/gcorebg.exp6
-rw-r--r--gdb/testsuite/gdb.base/gdb-index-err.c2
-rw-r--r--gdb/testsuite/gdb.base/gdb-index-err.exp8
-rw-r--r--gdb/testsuite/gdb.base/gdb-sigterm-2.exp2
-rw-r--r--gdb/testsuite/gdb.base/gdb-sigterm.c2
-rw-r--r--gdb/testsuite/gdb.base/gdb-sigterm.exp6
-rw-r--r--gdb/testsuite/gdb.base/gdb1056.exp2
-rw-r--r--gdb/testsuite/gdb.base/gdb1090.c2
-rw-r--r--gdb/testsuite/gdb.base/gdb1090.exp2
-rw-r--r--gdb/testsuite/gdb.base/gdb11530.c2
-rw-r--r--gdb/testsuite/gdb.base/gdb11530.exp2
-rw-r--r--gdb/testsuite/gdb.base/gdb11531.c2
-rw-r--r--gdb/testsuite/gdb.base/gdb11531.exp2
-rw-r--r--gdb/testsuite/gdb.base/gdb1250.c2
-rw-r--r--gdb/testsuite/gdb.base/gdb1250.exp5
-rw-r--r--gdb/testsuite/gdb.base/gdb1555-main.c2
-rw-r--r--gdb/testsuite/gdb.base/gdb1555.c2
-rw-r--r--gdb/testsuite/gdb.base/gdb1555.exp13
-rw-r--r--gdb/testsuite/gdb.base/gdb1821.c2
-rw-r--r--gdb/testsuite/gdb.base/gdb1821.exp6
-rw-r--r--gdb/testsuite/gdb.base/gdbhistsize-history.exp2
-rw-r--r--gdb/testsuite/gdb.base/gdbindex-stabs-dwarf.c2
-rw-r--r--gdb/testsuite/gdb.base/gdbindex-stabs.c2
-rw-r--r--gdb/testsuite/gdb.base/gdbindex-stabs.exp5
-rw-r--r--gdb/testsuite/gdb.base/gdbinit-history.exp4
-rw-r--r--gdb/testsuite/gdb.base/gdbvars.exp2
-rw-r--r--gdb/testsuite/gdb.base/global-var-nested-by-dso-solib1.c2
-rw-r--r--gdb/testsuite/gdb.base/global-var-nested-by-dso-solib2.c2
-rw-r--r--gdb/testsuite/gdb.base/global-var-nested-by-dso.c2
-rw-r--r--gdb/testsuite/gdb.base/global-var-nested-by-dso.exp5
-rw-r--r--gdb/testsuite/gdb.base/gnu-debugdata.c2
-rw-r--r--gdb/testsuite/gdb.base/gnu-debugdata.exp4
-rw-r--r--gdb/testsuite/gdb.base/gnu-ifunc-final.c2
-rw-r--r--gdb/testsuite/gdb.base/gnu-ifunc-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/gnu-ifunc.c2
-rw-r--r--gdb/testsuite/gdb.base/gnu-ifunc.exp13
-rw-r--r--gdb/testsuite/gdb.base/gnu_vector.c2
-rw-r--r--gdb/testsuite/gdb.base/gnu_vector.exp5
-rw-r--r--gdb/testsuite/gdb.base/gold-gdb-index-2.c2
-rw-r--r--gdb/testsuite/gdb.base/gold-gdb-index.c2
-rw-r--r--gdb/testsuite/gdb.base/gold-gdb-index.exp2
-rw-r--r--gdb/testsuite/gdb.base/gold-gdb-index.h2
-rw-r--r--gdb/testsuite/gdb.base/gstack.c2
-rw-r--r--gdb/testsuite/gdb.base/hashline1.exp5
-rw-r--r--gdb/testsuite/gdb.base/hashline2.exp5
-rw-r--r--gdb/testsuite/gdb.base/hashline3.exp5
-rw-r--r--gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c2
-rw-r--r--gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.c2
-rw-r--r--gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp5
-rw-r--r--gdb/testsuite/gdb.base/hbreak-unmapped.c2
-rw-r--r--gdb/testsuite/gdb.base/hbreak-unmapped.exp4
-rw-r--r--gdb/testsuite/gdb.base/hbreak.c2
-rw-r--r--gdb/testsuite/gdb.base/hbreak.exp4
-rw-r--r--gdb/testsuite/gdb.base/hbreak2.exp4
-rw-r--r--gdb/testsuite/gdb.base/help.exp2
-rw-r--r--gdb/testsuite/gdb.base/history-duplicates.exp2
-rw-r--r--gdb/testsuite/gdb.base/hook-stop.c2
-rw-r--r--gdb/testsuite/gdb.base/hook-stop.exp5
-rw-r--r--gdb/testsuite/gdb.base/huge.exp13
-rw-r--r--gdb/testsuite/gdb.base/hw-sw-break-same-address.exp4
-rw-r--r--gdb/testsuite/gdb.base/ifelse.exp2
-rw-r--r--gdb/testsuite/gdb.base/include-main.c2
-rw-r--r--gdb/testsuite/gdb.base/include-main.exp2
-rw-r--r--gdb/testsuite/gdb.base/included.c2
-rw-r--r--gdb/testsuite/gdb.base/included.exp4
-rw-r--r--gdb/testsuite/gdb.base/included.h2
-rw-r--r--gdb/testsuite/gdb.base/index-cache-2.c2
-rw-r--r--gdb/testsuite/gdb.base/index-cache.c2
-rw-r--r--gdb/testsuite/gdb.base/index-cache.exp6
-rw-r--r--gdb/testsuite/gdb.base/infcall-exec.c2
-rw-r--r--gdb/testsuite/gdb.base/infcall-exec.exp5
-rw-r--r--gdb/testsuite/gdb.base/infcall-exec2.c2
-rw-r--r--gdb/testsuite/gdb.base/infcall-failure-2.exp37
-rw-r--r--gdb/testsuite/gdb.base/infcall-failure.c2
-rw-r--r--gdb/testsuite/gdb.base/infcall-failure.exp21
-rw-r--r--gdb/testsuite/gdb.base/infcall-input.c2
-rw-r--r--gdb/testsuite/gdb.base/infcall-input.exp2
-rw-r--r--gdb/testsuite/gdb.base/infcall-nested-structs-c++.exp2
-rw-r--r--gdb/testsuite/gdb.base/infcall-nested-structs-c.exp2
-rw-r--r--gdb/testsuite/gdb.base/infcall-nested-structs.c2
-rw-r--r--gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl13
-rw-r--r--gdb/testsuite/gdb.base/infcall-timeout.c2
-rw-r--r--gdb/testsuite/gdb.base/infcall-timeout.exp5
-rw-r--r--gdb/testsuite/gdb.base/inferior-args.c2
-rw-r--r--gdb/testsuite/gdb.base/inferior-args.exp44
-rw-r--r--gdb/testsuite/gdb.base/inferior-clone.exp2
-rw-r--r--gdb/testsuite/gdb.base/inferior-died.c2
-rw-r--r--gdb/testsuite/gdb.base/inferior-died.exp12
-rw-r--r--gdb/testsuite/gdb.base/inferior-noarg.c2
-rw-r--r--gdb/testsuite/gdb.base/inferior-noarg.exp2
-rw-r--r--gdb/testsuite/gdb.base/infnan.c2
-rw-r--r--gdb/testsuite/gdb.base/infnan.exp2
-rw-r--r--gdb/testsuite/gdb.base/info-fun-solib.c2
-rw-r--r--gdb/testsuite/gdb.base/info-fun.c2
-rw-r--r--gdb/testsuite/gdb.base/info-fun.exp2
-rw-r--r--gdb/testsuite/gdb.base/info-locals-unused-static-var.c2
-rw-r--r--gdb/testsuite/gdb.base/info-locals-unused-static-var.exp2
-rw-r--r--gdb/testsuite/gdb.base/info-macros.exp4
-rw-r--r--gdb/testsuite/gdb.base/info-os.c2
-rw-r--r--gdb/testsuite/gdb.base/info-os.exp4
-rw-r--r--gdb/testsuite/gdb.base/info-proc.exp5
-rw-r--r--gdb/testsuite/gdb.base/info-program.c2
-rw-r--r--gdb/testsuite/gdb.base/info-program.exp5
-rw-r--r--gdb/testsuite/gdb.base/info-shared-solib1.c2
-rw-r--r--gdb/testsuite/gdb.base/info-shared-solib2.c2
-rw-r--r--gdb/testsuite/gdb.base/info-shared.c2
-rw-r--r--gdb/testsuite/gdb.base/info-shared.exp7
-rw-r--r--gdb/testsuite/gdb.base/info-target.exp2
-rw-r--r--gdb/testsuite/gdb.base/info-types-c++.exp2
-rw-r--r--gdb/testsuite/gdb.base/info-types-c.exp2
-rw-r--r--gdb/testsuite/gdb.base/info-types.c2
-rw-r--r--gdb/testsuite/gdb.base/info-types.exp.tcl4
-rw-r--r--gdb/testsuite/gdb.base/info-var-f1.c2
-rw-r--r--gdb/testsuite/gdb.base/info-var-f2.c2
-rw-r--r--gdb/testsuite/gdb.base/info-var.exp2
-rw-r--r--gdb/testsuite/gdb.base/info-var.h2
-rw-r--r--gdb/testsuite/gdb.base/info_minsym.c2
-rw-r--r--gdb/testsuite/gdb.base/info_minsym.exp2
-rw-r--r--gdb/testsuite/gdb.base/info_qt.c2
-rw-r--r--gdb/testsuite/gdb.base/info_qt.exp2
-rw-r--r--gdb/testsuite/gdb.base/info_sources.c2
-rw-r--r--gdb/testsuite/gdb.base/info_sources.exp4
-rw-r--r--gdb/testsuite/gdb.base/info_sources_2-header.h2
-rw-r--r--gdb/testsuite/gdb.base/info_sources_2-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/info_sources_2-test.c2
-rw-r--r--gdb/testsuite/gdb.base/info_sources_2.exp44
-rw-r--r--gdb/testsuite/gdb.base/info_sources_base.c2
-rw-r--r--gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.c2
-rw-r--r--gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp4
-rw-r--r--gdb/testsuite/gdb.base/infoline.c2
-rw-r--r--gdb/testsuite/gdb.base/infoline.exp2
-rw-r--r--gdb/testsuite/gdb.base/inline-frame-cycle-unwind.c2
-rw-r--r--gdb/testsuite/gdb.base/inline-frame-cycle-unwind.exp2
-rw-r--r--gdb/testsuite/gdb.base/inline-frame-cycle-unwind.py6
-rw-r--r--gdb/testsuite/gdb.base/interact.exp2
-rw-r--r--gdb/testsuite/gdb.base/internal-functions-ptype.exp2
-rw-r--r--gdb/testsuite/gdb.base/internal-string-values.c2
-rw-r--r--gdb/testsuite/gdb.base/internal-string-values.exp5
-rw-r--r--gdb/testsuite/gdb.base/interp.c2
-rw-r--r--gdb/testsuite/gdb.base/interp.exp2
-rw-r--r--gdb/testsuite/gdb.base/interpreter-exec.gdb2
-rw-r--r--gdb/testsuite/gdb.base/interrupt-a.c2
-rw-r--r--gdb/testsuite/gdb.base/interrupt-a.exp2
-rw-r--r--gdb/testsuite/gdb.base/interrupt-daemon-attach.c2
-rw-r--r--gdb/testsuite/gdb.base/interrupt-daemon-attach.exp8
-rw-r--r--gdb/testsuite/gdb.base/interrupt-daemon.c2
-rw-r--r--gdb/testsuite/gdb.base/interrupt-daemon.exp9
-rw-r--r--gdb/testsuite/gdb.base/interrupt-noterm.c2
-rw-r--r--gdb/testsuite/gdb.base/interrupt-noterm.exp8
-rw-r--r--gdb/testsuite/gdb.base/interrupt.exp2
-rw-r--r--gdb/testsuite/gdb.base/jit-attach-pie.c2
-rw-r--r--gdb/testsuite/gdb.base/jit-attach-pie.exp2
-rw-r--r--gdb/testsuite/gdb.base/jit-bfd-name.exp19
-rw-r--r--gdb/testsuite/gdb.base/jit-elf-fork-main.c2
-rw-r--r--gdb/testsuite/gdb.base/jit-elf-fork-solib.c2
-rw-r--r--gdb/testsuite/gdb.base/jit-elf-fork.exp6
-rw-r--r--gdb/testsuite/gdb.base/jit-elf-main.c2
-rw-r--r--gdb/testsuite/gdb.base/jit-elf-so.exp9
-rw-r--r--gdb/testsuite/gdb.base/jit-elf-solib.c4
-rw-r--r--gdb/testsuite/gdb.base/jit-elf-util.h2
-rw-r--r--gdb/testsuite/gdb.base/jit-elf.exp10
-rw-r--r--gdb/testsuite/gdb.base/jit-protocol.h2
-rw-r--r--gdb/testsuite/gdb.base/jit-reader-exec.c2
-rw-r--r--gdb/testsuite/gdb.base/jit-reader-exec.exp5
-rw-r--r--gdb/testsuite/gdb.base/jit-reader-execd.c2
-rw-r--r--gdb/testsuite/gdb.base/jit-reader-host.c2
-rw-r--r--gdb/testsuite/gdb.base/jit-reader-host.h2
-rw-r--r--gdb/testsuite/gdb.base/jit-reader-simple-dl.c2
-rw-r--r--gdb/testsuite/gdb.base/jit-reader-simple-jit.c2
-rw-r--r--gdb/testsuite/gdb.base/jit-reader-simple.c2
-rw-r--r--gdb/testsuite/gdb.base/jit-reader-simple.exp17
-rw-r--r--gdb/testsuite/gdb.base/jit-reader.c2
-rw-r--r--gdb/testsuite/gdb.base/jit-reader.exp5
-rw-r--r--gdb/testsuite/gdb.base/jump-inline.c2
-rw-r--r--gdb/testsuite/gdb.base/jump-inline.exp2
-rw-r--r--gdb/testsuite/gdb.base/jump.exp2
-rwxr-xr-xgdb/testsuite/gdb.base/jump_multiple_objfiles-foo.c2
-rwxr-xr-xgdb/testsuite/gdb.base/jump_multiple_objfiles.c2
-rwxr-xr-xgdb/testsuite/gdb.base/jump_multiple_objfiles.exp2
-rwxr-xr-xgdb/testsuite/gdb.base/jump_multiple_objfiles.h2
-rw-r--r--gdb/testsuite/gdb.base/kill-after-signal.c2
-rw-r--r--gdb/testsuite/gdb.base/kill-after-signal.exp6
-rw-r--r--gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.c2
-rw-r--r--gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.exp5
-rw-r--r--gdb/testsuite/gdb.base/kill-during-detach.c2
-rw-r--r--gdb/testsuite/gdb.base/kill-during-detach.exp5
-rw-r--r--gdb/testsuite/gdb.base/killed-outside.c2
-rw-r--r--gdb/testsuite/gdb.base/killed-outside.exp7
-rw-r--r--gdb/testsuite/gdb.base/label-without-address.c2
-rw-r--r--gdb/testsuite/gdb.base/label-without-address.exp2
-rw-r--r--gdb/testsuite/gdb.base/label.exp2
-rw-r--r--gdb/testsuite/gdb.base/langs.exp11
-rw-r--r--gdb/testsuite/gdb.base/langs1.f2
-rw-r--r--gdb/testsuite/gdb.base/large-frame-1.c2
-rw-r--r--gdb/testsuite/gdb.base/large-frame-2.c2
-rw-r--r--gdb/testsuite/gdb.base/large-frame.exp6
-rw-r--r--gdb/testsuite/gdb.base/large-frame.h2
-rw-r--r--gdb/testsuite/gdb.base/ldbl_e308.c2
-rw-r--r--gdb/testsuite/gdb.base/ldbl_e308.exp4
-rw-r--r--gdb/testsuite/gdb.base/libsegfault.exp11
-rw-r--r--gdb/testsuite/gdb.base/limited-length.c2
-rw-r--r--gdb/testsuite/gdb.base/limited-length.exp4
-rw-r--r--gdb/testsuite/gdb.base/line-symtabs.c2
-rw-r--r--gdb/testsuite/gdb.base/line-symtabs.exp4
-rw-r--r--gdb/testsuite/gdb.base/line-symtabs.h2
-rw-r--r--gdb/testsuite/gdb.base/line65535.c2
-rw-r--r--gdb/testsuite/gdb.base/line65535.exp2
-rw-r--r--gdb/testsuite/gdb.base/lineinc.exp15
-rw-r--r--gdb/testsuite/gdb.base/list-ambiguous-readnow.exp2
-rw-r--r--gdb/testsuite/gdb.base/list-ambiguous.exp6
-rw-r--r--gdb/testsuite/gdb.base/list-ambiguous0.c2
-rw-r--r--gdb/testsuite/gdb.base/list-ambiguous1.c2
-rw-r--r--gdb/testsuite/gdb.base/list-before-start.exp2
-rw-r--r--gdb/testsuite/gdb.base/list-dot-nodebug-extra.c2
-rw-r--r--gdb/testsuite/gdb.base/list-dot-nodebug.c2
-rw-r--r--gdb/testsuite/gdb.base/list-dot-nodebug.exp2
-rw-r--r--gdb/testsuite/gdb.base/list-missing-source.exp5
-rw-r--r--gdb/testsuite/gdb.base/list-nodebug-2.c2
-rw-r--r--gdb/testsuite/gdb.base/list-nodebug.c2
-rw-r--r--gdb/testsuite/gdb.base/list-nodebug.exp2
-rw-r--r--gdb/testsuite/gdb.base/list.exp41
-rw-r--r--gdb/testsuite/gdb.base/load-command.c2
-rw-r--r--gdb/testsuite/gdb.base/load-command.exp8
-rw-r--r--gdb/testsuite/gdb.base/logical.exp7
-rw-r--r--gdb/testsuite/gdb.base/long-inferior-output.c2
-rw-r--r--gdb/testsuite/gdb.base/long-inferior-output.exp4
-rw-r--r--gdb/testsuite/gdb.base/long_long.c2
-rw-r--r--gdb/testsuite/gdb.base/long_long.exp9
-rw-r--r--gdb/testsuite/gdb.base/longest-types.c2
-rw-r--r--gdb/testsuite/gdb.base/longest-types.exp2
-rw-r--r--gdb/testsuite/gdb.base/longjmp-until-in-main.c2
-rw-r--r--gdb/testsuite/gdb.base/longjmp-until-in-main.exp2
-rw-r--r--gdb/testsuite/gdb.base/longjmp.c2
-rw-r--r--gdb/testsuite/gdb.base/longjmp.exp5
-rw-r--r--gdb/testsuite/gdb.base/macro-source-path.c2
-rw-r--r--gdb/testsuite/gdb.base/macro-source-path.exp7
-rw-r--r--gdb/testsuite/gdb.base/macscp.exp21
-rw-r--r--gdb/testsuite/gdb.base/main-c.exp2
-rw-r--r--gdb/testsuite/gdb.base/main-psymtab.exp2
-rw-r--r--gdb/testsuite/gdb.base/main.c2
-rw-r--r--gdb/testsuite/gdb.base/maint-expand-symbols-header-file.c2
-rw-r--r--gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp2
-rw-r--r--gdb/testsuite/gdb.base/maint-expand-symbols-header-file.h2
-rw-r--r--gdb/testsuite/gdb.base/maint-info-inline-frames-and-blocks.c2
-rw-r--r--gdb/testsuite/gdb.base/maint-info-inline-frames-and-blocks.exp5
-rw-r--r--gdb/testsuite/gdb.base/maint-info-sections.exp2
-rw-r--r--gdb/testsuite/gdb.base/maint-print-frame-id.c2
-rw-r--r--gdb/testsuite/gdb.base/maint-print-frame-id.exp2
-rw-r--r--gdb/testsuite/gdb.base/maint-target-async-off.c2
-rw-r--r--gdb/testsuite/gdb.base/maint-target-async-off.exp2
-rw-r--r--gdb/testsuite/gdb.base/maint-test-remote-args.exp40
-rw-r--r--gdb/testsuite/gdb.base/maint.exp64
-rw-r--r--gdb/testsuite/gdb.base/many-completions.exp2
-rw-r--r--gdb/testsuite/gdb.base/many-headers.c2
-rw-r--r--gdb/testsuite/gdb.base/many-headers.exp3
-rw-r--r--gdb/testsuite/gdb.base/max-depth-c++.exp2
-rw-r--r--gdb/testsuite/gdb.base/max-depth-c.exp2
-rw-r--r--gdb/testsuite/gdb.base/max-depth.c2
-rw-r--r--gdb/testsuite/gdb.base/max-depth.exp.tcl6
-rw-r--r--gdb/testsuite/gdb.base/max-value-size.c2
-rw-r--r--gdb/testsuite/gdb.base/max-value-size.exp2
-rw-r--r--gdb/testsuite/gdb.base/memattr.c2
-rw-r--r--gdb/testsuite/gdb.base/memattr.exp2
-rw-r--r--gdb/testsuite/gdb.base/memops-watchpoint.c2
-rw-r--r--gdb/testsuite/gdb.base/memops-watchpoint.exp157
-rw-r--r--gdb/testsuite/gdb.base/memtag.c2
-rw-r--r--gdb/testsuite/gdb.base/memtag.exp4
-rw-r--r--gdb/testsuite/gdb.base/mips_pro.exp2
-rw-r--r--gdb/testsuite/gdb.base/miscexprs.exp9
-rw-r--r--gdb/testsuite/gdb.base/morestack.c2
-rw-r--r--gdb/testsuite/gdb.base/morestack.exp4
-rw-r--r--gdb/testsuite/gdb.base/moribund-step.exp4
-rw-r--r--gdb/testsuite/gdb.base/msym-bp-2.c2
-rw-r--r--gdb/testsuite/gdb.base/msym-bp-shl-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/msym-bp-shl-main-2.c2
-rw-r--r--gdb/testsuite/gdb.base/msym-bp-shl-main.c2
-rw-r--r--gdb/testsuite/gdb.base/msym-bp-shl.exp7
-rw-r--r--gdb/testsuite/gdb.base/msym-bp.c2
-rw-r--r--gdb/testsuite/gdb.base/msym-bp.exp4
-rw-r--r--gdb/testsuite/gdb.base/msym-lang-main.c2
-rw-r--r--gdb/testsuite/gdb.base/msym-lang.c2
-rw-r--r--gdb/testsuite/gdb.base/msym-lang.exp2
-rw-r--r--gdb/testsuite/gdb.base/multi-forks.c2
-rw-r--r--gdb/testsuite/gdb.base/multi-forks.exp25
-rw-r--r--gdb/testsuite/gdb.base/multi-line-starts-subshell.exp2
-rw-r--r--gdb/testsuite/gdb.base/native-target-noproc-tdesc.exp2
-rw-r--r--gdb/testsuite/gdb.base/nested-addr.c2
-rw-r--r--gdb/testsuite/gdb.base/nested-addr.exp4
-rw-r--r--gdb/testsuite/gdb.base/nested-subp1.c2
-rw-r--r--gdb/testsuite/gdb.base/nested-subp1.exp6
-rw-r--r--gdb/testsuite/gdb.base/nested-subp2.c2
-rw-r--r--gdb/testsuite/gdb.base/nested-subp2.exp6
-rw-r--r--gdb/testsuite/gdb.base/nested-subp3.c2
-rw-r--r--gdb/testsuite/gdb.base/nested-subp3.exp6
-rw-r--r--gdb/testsuite/gdb.base/new-ui-echo.c2
-rw-r--r--gdb/testsuite/gdb.base/new-ui-echo.exp2
-rw-r--r--gdb/testsuite/gdb.base/new-ui-pending-input.c2
-rw-r--r--gdb/testsuite/gdb.base/new-ui-pending-input.exp2
-rw-r--r--gdb/testsuite/gdb.base/new-ui.c2
-rw-r--r--gdb/testsuite/gdb.base/new-ui.exp8
-rw-r--r--gdb/testsuite/gdb.base/nextoverexit.c2
-rw-r--r--gdb/testsuite/gdb.base/nextoverexit.exp2
-rw-r--r--gdb/testsuite/gdb.base/nodebug.exp25
-rw-r--r--gdb/testsuite/gdb.base/nofield.c2
-rw-r--r--gdb/testsuite/gdb.base/nofield.exp5
-rw-r--r--gdb/testsuite/gdb.base/non-executable.exp2
-rw-r--r--gdb/testsuite/gdb.base/non-lazy-array-index.c2
-rw-r--r--gdb/testsuite/gdb.base/non-lazy-array-index.exp2
-rw-r--r--gdb/testsuite/gdb.base/noreturn-finish.c2
-rw-r--r--gdb/testsuite/gdb.base/noreturn-finish.exp4
-rw-r--r--gdb/testsuite/gdb.base/noreturn-return.c2
-rw-r--r--gdb/testsuite/gdb.base/noreturn-return.exp4
-rw-r--r--gdb/testsuite/gdb.base/normal.c2
-rw-r--r--gdb/testsuite/gdb.base/nostdlib.c2
-rw-r--r--gdb/testsuite/gdb.base/nostdlib.exp9
-rw-r--r--gdb/testsuite/gdb.base/offsets.c2
-rw-r--r--gdb/testsuite/gdb.base/offsets.exp4
-rw-r--r--gdb/testsuite/gdb.base/opaque.exp6
-rw-r--r--gdb/testsuite/gdb.base/options.c2
-rw-r--r--gdb/testsuite/gdb.base/options.exp33
-rw-r--r--gdb/testsuite/gdb.base/osabi.exp2
-rw-r--r--gdb/testsuite/gdb.base/overlays.exp24
-rw-r--r--gdb/testsuite/gdb.base/page-logging.exp2
-rw-r--r--gdb/testsuite/gdb.base/page.exp2
-rw-r--r--gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.c2
-rw-r--r--gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp5
-rw-r--r--gdb/testsuite/gdb.base/paginate-bg-execution.c2
-rw-r--r--gdb/testsuite/gdb.base/paginate-bg-execution.exp5
-rw-r--r--gdb/testsuite/gdb.base/paginate-execution-startup.c2
-rw-r--r--gdb/testsuite/gdb.base/paginate-execution-startup.exp6
-rw-r--r--gdb/testsuite/gdb.base/paginate-inferior-exit.c2
-rw-r--r--gdb/testsuite/gdb.base/paginate-inferior-exit.exp5
-rw-r--r--gdb/testsuite/gdb.base/parse_number.exp20
-rw-r--r--gdb/testsuite/gdb.base/paste-newline.exp2
-rw-r--r--gdb/testsuite/gdb.base/patch.c2
-rw-r--r--gdb/testsuite/gdb.base/patch.exp8
-rw-r--r--gdb/testsuite/gdb.base/pc-fp.exp2
-rw-r--r--gdb/testsuite/gdb.base/pc-not-saved.c2
-rw-r--r--gdb/testsuite/gdb.base/pc-not-saved.exp5
-rw-r--r--gdb/testsuite/gdb.base/pc-not-saved.py2
-rw-r--r--gdb/testsuite/gdb.base/pending.c2
-rw-r--r--gdb/testsuite/gdb.base/pending.exp8
-rw-r--r--gdb/testsuite/gdb.base/pendshr.c2
-rw-r--r--gdb/testsuite/gdb.base/permissions.exp2
-rw-r--r--gdb/testsuite/gdb.base/persistent-lang.cc2
-rw-r--r--gdb/testsuite/gdb.base/persistent-lang.exp2
-rw-r--r--gdb/testsuite/gdb.base/pie-execl.c2
-rw-r--r--gdb/testsuite/gdb.base/pie-execl.exp6
-rw-r--r--gdb/testsuite/gdb.base/pie-fork.c2
-rw-r--r--gdb/testsuite/gdb.base/pie-fork.exp11
-rw-r--r--gdb/testsuite/gdb.base/pointers.exp25
-rw-r--r--gdb/testsuite/gdb.base/pr10179.exp4
-rw-r--r--gdb/testsuite/gdb.base/pr11022.c2
-rw-r--r--gdb/testsuite/gdb.base/pr11022.exp5
-rw-r--r--gdb/testsuite/gdb.base/prelink-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/prelink.c2
-rw-r--r--gdb/testsuite/gdb.base/prelink.exp12
-rw-r--r--gdb/testsuite/gdb.base/premature-dummy-frame-removal.c2
-rw-r--r--gdb/testsuite/gdb.base/premature-dummy-frame-removal.exp2
-rw-r--r--gdb/testsuite/gdb.base/premature-dummy-frame-removal.py2
-rw-r--r--gdb/testsuite/gdb.base/pretty-array.c2
-rw-r--r--gdb/testsuite/gdb.base/pretty-array.exp4
-rw-r--r--gdb/testsuite/gdb.base/pretty-print.c2
-rw-r--r--gdb/testsuite/gdb.base/pretty-print.exp4
-rw-r--r--gdb/testsuite/gdb.base/print-file-var-lib1.c2
-rw-r--r--gdb/testsuite/gdb.base/print-file-var-lib2.c2
-rw-r--r--gdb/testsuite/gdb.base/print-file-var-main.c2
-rw-r--r--gdb/testsuite/gdb.base/print-file-var.exp6
-rw-r--r--gdb/testsuite/gdb.base/print-file-var.h2
-rw-r--r--gdb/testsuite/gdb.base/print-internal-string.c2
-rw-r--r--gdb/testsuite/gdb.base/print-internal-string.exp4
-rw-r--r--gdb/testsuite/gdb.base/print-symbol-loading-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/print-symbol-loading-main.c2
-rw-r--r--gdb/testsuite/gdb.base/print-symbol-loading.exp14
-rw-r--r--gdb/testsuite/gdb.base/printcmds.exp33
-rw-r--r--gdb/testsuite/gdb.base/printf-wchar_t.c2
-rw-r--r--gdb/testsuite/gdb.base/printf-wchar_t.exp2
-rw-r--r--gdb/testsuite/gdb.base/prologue-include.c2
-rw-r--r--gdb/testsuite/gdb.base/prologue-include.exp2
-rw-r--r--gdb/testsuite/gdb.base/prologue-include.h2
-rw-r--r--gdb/testsuite/gdb.base/prologue.c2
-rw-r--r--gdb/testsuite/gdb.base/prologue.exp5
-rw-r--r--gdb/testsuite/gdb.base/psym-external-decl-2.c2
-rw-r--r--gdb/testsuite/gdb.base/psym-external-decl.c2
-rw-r--r--gdb/testsuite/gdb.base/psym-external-decl.exp2
-rw-r--r--gdb/testsuite/gdb.base/psymtab.exp2
-rw-r--r--gdb/testsuite/gdb.base/ptr-typedef.c2
-rw-r--r--gdb/testsuite/gdb.base/ptr-typedef.exp7
-rw-r--r--gdb/testsuite/gdb.base/ptype-offsets.cc2
-rw-r--r--gdb/testsuite/gdb.base/ptype-offsets.exp2
-rw-r--r--gdb/testsuite/gdb.base/ptype.exp47
-rw-r--r--gdb/testsuite/gdb.base/quit-live.c2
-rw-r--r--gdb/testsuite/gdb.base/quit-live.exp14
-rw-r--r--gdb/testsuite/gdb.base/quit.exp2
-rw-r--r--gdb/testsuite/gdb.base/radix.exp20
-rw-r--r--gdb/testsuite/gdb.base/random-signal.c2
-rw-r--r--gdb/testsuite/gdb.base/random-signal.exp8
-rw-r--r--gdb/testsuite/gdb.base/randomize.c2
-rw-r--r--gdb/testsuite/gdb.base/randomize.exp6
-rw-r--r--gdb/testsuite/gdb.base/range-stepping.c2
-rw-r--r--gdb/testsuite/gdb.base/range-stepping.exp8
-rw-r--r--gdb/testsuite/gdb.base/readline-ask.c2
-rw-r--r--gdb/testsuite/gdb.base/readline-ask.exp7
-rw-r--r--gdb/testsuite/gdb.base/readline-ask.inputrc2
-rw-r--r--gdb/testsuite/gdb.base/readline-commands-eof.c2
-rw-r--r--gdb/testsuite/gdb.base/readline-commands-eof.exp5
-rw-r--r--gdb/testsuite/gdb.base/readline.exp4
-rw-r--r--gdb/testsuite/gdb.base/readnever.c2
-rw-r--r--gdb/testsuite/gdb.base/readnever.exp4
-rw-r--r--gdb/testsuite/gdb.base/realname-expand-real.c2
-rw-r--r--gdb/testsuite/gdb.base/realname-expand.c2
-rw-r--r--gdb/testsuite/gdb.base/realname-expand.exp2
-rw-r--r--gdb/testsuite/gdb.base/record-full-error.exp2
-rw-r--r--gdb/testsuite/gdb.base/recpar.c2
-rw-r--r--gdb/testsuite/gdb.base/recpar.exp4
-rw-r--r--gdb/testsuite/gdb.base/recurse.exp10
-rw-r--r--gdb/testsuite/gdb.base/reggroups.c2
-rw-r--r--gdb/testsuite/gdb.base/reggroups.exp4
-rw-r--r--gdb/testsuite/gdb.base/relational.exp4
-rw-r--r--gdb/testsuite/gdb.base/relativedebug.c2
-rw-r--r--gdb/testsuite/gdb.base/relativedebug.exp5
-rw-r--r--gdb/testsuite/gdb.base/relocate.c2
-rw-r--r--gdb/testsuite/gdb.base/relocate.exp8
-rw-r--r--gdb/testsuite/gdb.base/remote-exec-file.exp9
-rw-r--r--gdb/testsuite/gdb.base/remote.exp7
-rw-r--r--gdb/testsuite/gdb.base/remotetimeout.exp2
-rw-r--r--gdb/testsuite/gdb.base/reread-readsym.c2
-rw-r--r--gdb/testsuite/gdb.base/reread-readsym.exp2
-rw-r--r--gdb/testsuite/gdb.base/reread.exp9
-rw-r--r--gdb/testsuite/gdb.base/reset-catchpoint-cond-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/reset-catchpoint-cond.c2
-rw-r--r--gdb/testsuite/gdb.base/reset-catchpoint-cond.exp5
-rw-r--r--gdb/testsuite/gdb.base/reset-catchpoint-cond.py2
-rw-r--r--gdb/testsuite/gdb.base/restore.c2
-rw-r--r--gdb/testsuite/gdb.base/restore.exp11
-rw-r--r--gdb/testsuite/gdb.base/return-nodebug.c2
-rw-r--r--gdb/testsuite/gdb.base/return-nodebug.exp2
-rw-r--r--gdb/testsuite/gdb.base/return-nodebug1.c2
-rw-r--r--gdb/testsuite/gdb.base/return.c2
-rw-r--r--gdb/testsuite/gdb.base/return.exp6
-rw-r--r--gdb/testsuite/gdb.base/return2.exp5
-rw-r--r--gdb/testsuite/gdb.base/retval-large-struct.c2
-rw-r--r--gdb/testsuite/gdb.base/retval-large-struct.exp2
-rw-r--r--gdb/testsuite/gdb.base/reverse-init-functions.exp2
-rw-r--r--gdb/testsuite/gdb.base/rtld-step-main.c2
-rw-r--r--gdb/testsuite/gdb.base/rtld-step-nodebugsym.c2
-rw-r--r--gdb/testsuite/gdb.base/rtld-step-nodebugsym.exp2
-rw-r--r--gdb/testsuite/gdb.base/rtld-step-rtld.c2
-rw-r--r--gdb/testsuite/gdb.base/rtld-step.exp7
-rw-r--r--gdb/testsuite/gdb.base/run-after-attach.c2
-rw-r--r--gdb/testsuite/gdb.base/run-after-attach.exp4
-rw-r--r--gdb/testsuite/gdb.base/run-attach-while-running.c2
-rw-r--r--gdb/testsuite/gdb.base/run-attach-while-running.exp5
-rw-r--r--gdb/testsuite/gdb.base/run-control-while-bg-execution.c2
-rw-r--r--gdb/testsuite/gdb.base/run-control-while-bg-execution.exp10
-rw-r--r--gdb/testsuite/gdb.base/run-fail-twice.c2
-rw-r--r--gdb/testsuite/gdb.base/run-fail-twice.exp5
-rw-r--r--gdb/testsuite/gdb.base/save-bp.c2
-rw-r--r--gdb/testsuite/gdb.base/save-bp.exp6
-rw-r--r--gdb/testsuite/gdb.base/savedregs.c2
-rw-r--r--gdb/testsuite/gdb.base/savedregs.exp9
-rw-r--r--gdb/testsuite/gdb.base/scope-hw-watch-disable.c2
-rw-r--r--gdb/testsuite/gdb.base/scope-hw-watch-disable.exp2
-rw-r--r--gdb/testsuite/gdb.base/scope.exp6
-rw-r--r--gdb/testsuite/gdb.base/sect-cmd.exp2
-rw-r--r--gdb/testsuite/gdb.base/segv.c2
-rw-r--r--gdb/testsuite/gdb.base/sep-proc.c2
-rw-r--r--gdb/testsuite/gdb.base/sep.c2
-rw-r--r--gdb/testsuite/gdb.base/sep.exp8
-rw-r--r--gdb/testsuite/gdb.base/sepdebug.c2
-rw-r--r--gdb/testsuite/gdb.base/sepdebug.exp12
-rw-r--r--gdb/testsuite/gdb.base/sepdebug2.c2
-rw-r--r--gdb/testsuite/gdb.base/sepsymtab.c2
-rw-r--r--gdb/testsuite/gdb.base/sepsymtab.exp7
-rw-r--r--gdb/testsuite/gdb.base/server-del-break.c2
-rw-r--r--gdb/testsuite/gdb.base/server-del-break.exp2
-rw-r--r--gdb/testsuite/gdb.base/set-cwd.c2
-rw-r--r--gdb/testsuite/gdb.base/set-cwd.exp8
-rw-r--r--gdb/testsuite/gdb.base/set-inferior-tty.c2
-rw-r--r--gdb/testsuite/gdb.base/set-inferior-tty.exp5
-rw-r--r--gdb/testsuite/gdb.base/set-lang-auto.exp2
-rw-r--r--gdb/testsuite/gdb.base/set-noassign.exp2
-rw-r--r--gdb/testsuite/gdb.base/setshow.exp75
-rw-r--r--gdb/testsuite/gdb.base/settings.c2
-rw-r--r--gdb/testsuite/gdb.base/settings.exp5
-rw-r--r--gdb/testsuite/gdb.base/setvar.exp198
-rw-r--r--gdb/testsuite/gdb.base/share-env-with-gdbserver.c2
-rw-r--r--gdb/testsuite/gdb.base/share-env-with-gdbserver.exp14
-rw-r--r--gdb/testsuite/gdb.base/share-psymtabs-bt-2.c2
-rw-r--r--gdb/testsuite/gdb.base/share-psymtabs-bt.c2
-rw-r--r--gdb/testsuite/gdb.base/share-psymtabs-bt.exp2
-rw-r--r--gdb/testsuite/gdb.base/shell.exp2
-rw-r--r--gdb/testsuite/gdb.base/shlib-call.exp16
-rw-r--r--gdb/testsuite/gdb.base/shlib-unload.exp14
-rw-r--r--gdb/testsuite/gdb.base/show-user-completion.exp2
-rw-r--r--gdb/testsuite/gdb.base/shreloc.exp17
-rw-r--r--gdb/testsuite/gdb.base/sigall.exp11
-rw-r--r--gdb/testsuite/gdb.base/sigaltstack.c2
-rw-r--r--gdb/testsuite/gdb.base/sigaltstack.exp5
-rw-r--r--gdb/testsuite/gdb.base/sigbpt.c2
-rw-r--r--gdb/testsuite/gdb.base/sigbpt.exp4
-rw-r--r--gdb/testsuite/gdb.base/sigchld.c2
-rw-r--r--gdb/testsuite/gdb.base/sigchld.exp5
-rw-r--r--gdb/testsuite/gdb.base/siginfo-addr.c2
-rw-r--r--gdb/testsuite/gdb.base/siginfo-addr.exp2
-rw-r--r--gdb/testsuite/gdb.base/siginfo-infcall.c2
-rw-r--r--gdb/testsuite/gdb.base/siginfo-infcall.exp4
-rw-r--r--gdb/testsuite/gdb.base/siginfo-obj.c2
-rw-r--r--gdb/testsuite/gdb.base/siginfo-obj.exp5
-rw-r--r--gdb/testsuite/gdb.base/siginfo-thread.c2
-rw-r--r--gdb/testsuite/gdb.base/siginfo-thread.exp8
-rw-r--r--gdb/testsuite/gdb.base/siginfo.c2
-rw-r--r--gdb/testsuite/gdb.base/siginfo.exp2
-rw-r--r--gdb/testsuite/gdb.base/signals-state-child.c2
-rw-r--r--gdb/testsuite/gdb.base/signals-state-child.exp7
-rw-r--r--gdb/testsuite/gdb.base/signals.exp9
-rw-r--r--gdb/testsuite/gdb.base/signed-builtin-types-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/signed-builtin-types.c2
-rw-r--r--gdb/testsuite/gdb.base/signed-builtin-types.exp2
-rw-r--r--gdb/testsuite/gdb.base/signest.c2
-rw-r--r--gdb/testsuite/gdb.base/signest.exp4
-rw-r--r--gdb/testsuite/gdb.base/signull.c2
-rw-r--r--gdb/testsuite/gdb.base/signull.exp5
-rw-r--r--gdb/testsuite/gdb.base/sigrepeat.c2
-rw-r--r--gdb/testsuite/gdb.base/sigrepeat.exp5
-rw-r--r--gdb/testsuite/gdb.base/sigstep.c2
-rw-r--r--gdb/testsuite/gdb.base/sigstep.exp5
-rw-r--r--gdb/testsuite/gdb.base/sigwinch-notty.exp2
-rw-r--r--gdb/testsuite/gdb.base/sizeof.exp4
-rw-r--r--gdb/testsuite/gdb.base/skip-inline.c2
-rw-r--r--gdb/testsuite/gdb.base/skip-inline.exp10
-rw-r--r--gdb/testsuite/gdb.base/skip-solib.exp6
-rw-r--r--gdb/testsuite/gdb.base/skip.c2
-rw-r--r--gdb/testsuite/gdb.base/skip.exp27
-rw-r--r--gdb/testsuite/gdb.base/skip1.c2
-rw-r--r--gdb/testsuite/gdb.base/skipcxx.cc2
-rw-r--r--gdb/testsuite/gdb.base/skipcxx.exp4
-rw-r--r--gdb/testsuite/gdb.base/so-disc-shr.c2
-rw-r--r--gdb/testsuite/gdb.base/so-impl-ld.exp5
-rw-r--r--gdb/testsuite/gdb.base/solib-abort-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-abort.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-abort.exp5
-rw-r--r--gdb/testsuite/gdb.base/solib-corrupted.exp4
-rw-r--r--gdb/testsuite/gdb.base/solib-disc.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-disc.exp5
-rw-r--r--gdb/testsuite/gdb.base/solib-display-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-display-main.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-display.exp2
-rw-r--r--gdb/testsuite/gdb.base/solib-nodir.exp4
-rw-r--r--gdb/testsuite/gdb.base/solib-overlap-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-overlap-main.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-overlap.exp8
-rw-r--r--gdb/testsuite/gdb.base/solib-probes-nosharedlibrary.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-probes-nosharedlibrary.exp2
-rw-r--r--gdb/testsuite/gdb.base/solib-search-lib1.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-search-lib2.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-search.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-search.exp4
-rw-r--r--gdb/testsuite/gdb.base/solib-search.h2
-rw-r--r--gdb/testsuite/gdb.base/solib-symbol-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-symbol-main.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-symbol.exp5
-rw-r--r--gdb/testsuite/gdb.base/solib-vanish-lib1.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-vanish-lib2.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-vanish-main.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-vanish.exp2
-rw-r--r--gdb/testsuite/gdb.base/solib-weak.c2
-rw-r--r--gdb/testsuite/gdb.base/solib-weak.exp7
-rw-r--r--gdb/testsuite/gdb.base/source-dir.c2
-rw-r--r--gdb/testsuite/gdb.base/source-dir.exp59
-rw-r--r--gdb/testsuite/gdb.base/source-error-1.gdb2
-rw-r--r--gdb/testsuite/gdb.base/source-error.gdb2
-rw-r--r--gdb/testsuite/gdb.base/source-execution.c2
-rw-r--r--gdb/testsuite/gdb.base/source-execution.exp2
-rw-r--r--gdb/testsuite/gdb.base/source-execution.gdb2
-rw-r--r--gdb/testsuite/gdb.base/source-nofile.gdb2
-rw-r--r--gdb/testsuite/gdb.base/source-open.c2
-rw-r--r--gdb/testsuite/gdb.base/source-open.exp2
-rw-r--r--gdb/testsuite/gdb.base/source-search.c127
-rw-r--r--gdb/testsuite/gdb.base/source-search.exp106
-rw-r--r--gdb/testsuite/gdb.base/source-test.gdb2
-rw-r--r--gdb/testsuite/gdb.base/source.exp2
-rw-r--r--gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.c2
-rw-r--r--gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp6
-rw-r--r--gdb/testsuite/gdb.base/sss-bp-on-user-bp.c2
-rw-r--r--gdb/testsuite/gdb.base/sss-bp-on-user-bp.exp2
-rw-r--r--gdb/testsuite/gdb.base/stack-checking.c2
-rw-r--r--gdb/testsuite/gdb.base/stack-checking.exp5
-rw-r--r--gdb/testsuite/gdb.base/stack-protector.c2
-rw-r--r--gdb/testsuite/gdb.base/stack-protector.exp2
-rw-r--r--gdb/testsuite/gdb.base/stale-infcall.c2
-rw-r--r--gdb/testsuite/gdb.base/stale-infcall.exp4
-rw-r--r--gdb/testsuite/gdb.base/stap-probe.c2
-rw-r--r--gdb/testsuite/gdb.base/stap-probe.exp18
-rw-r--r--gdb/testsuite/gdb.base/start-cpp.cc2
-rw-r--r--gdb/testsuite/gdb.base/start-cpp.exp2
-rw-r--r--gdb/testsuite/gdb.base/start.c2
-rw-r--r--gdb/testsuite/gdb.base/start.exp2
-rw-r--r--gdb/testsuite/gdb.base/starti.c2
-rw-r--r--gdb/testsuite/gdb.base/starti.exp2
-rw-r--r--gdb/testsuite/gdb.base/startup-with-shell.c2
-rw-r--r--gdb/testsuite/gdb.base/startup-with-shell.exp163
-rw-r--r--gdb/testsuite/gdb.base/statistics.exp2
-rw-r--r--gdb/testsuite/gdb.base/step-break.c2
-rw-r--r--gdb/testsuite/gdb.base/step-break.exp2
-rw-r--r--gdb/testsuite/gdb.base/step-bt.c2
-rw-r--r--gdb/testsuite/gdb.base/step-bt.exp2
-rw-r--r--gdb/testsuite/gdb.base/step-indirect-call-thunk.c2
-rw-r--r--gdb/testsuite/gdb.base/step-indirect-call-thunk.exp2
-rw-r--r--gdb/testsuite/gdb.base/step-into-other-file.c2
-rw-r--r--gdb/testsuite/gdb.base/step-into-other-file.exp4
-rw-r--r--gdb/testsuite/gdb.base/step-into-other-file.h2
-rw-r--r--gdb/testsuite/gdb.base/step-line.c2
-rw-r--r--gdb/testsuite/gdb.base/step-line.exp2
-rw-r--r--gdb/testsuite/gdb.base/step-line.inp2
-rw-r--r--gdb/testsuite/gdb.base/step-over-clone.c2
-rw-r--r--gdb/testsuite/gdb.base/step-over-exit.c2
-rw-r--r--gdb/testsuite/gdb.base/step-over-exit.exp11
-rw-r--r--gdb/testsuite/gdb.base/step-over-fork.c2
-rw-r--r--gdb/testsuite/gdb.base/step-over-no-symbols.exp7
-rw-r--r--gdb/testsuite/gdb.base/step-over-syscall.exp4
-rw-r--r--gdb/testsuite/gdb.base/step-over-vfork.c2
-rw-r--r--gdb/testsuite/gdb.base/step-resume-infcall.c2
-rw-r--r--gdb/testsuite/gdb.base/step-resume-infcall.exp6
-rw-r--r--gdb/testsuite/gdb.base/step-sw-breakpoint-adjust-pc.c2
-rw-r--r--gdb/testsuite/gdb.base/step-sw-breakpoint-adjust-pc.exp9
-rw-r--r--gdb/testsuite/gdb.base/step-symless.c2
-rw-r--r--gdb/testsuite/gdb.base/step-symless.exp6
-rw-r--r--gdb/testsuite/gdb.base/step-test.exp17
-rw-r--r--gdb/testsuite/gdb.base/step-through-epilogue.c2
-rw-r--r--gdb/testsuite/gdb.base/step-through-epilogue.exp2
-rw-r--r--gdb/testsuite/gdb.base/store.exp2
-rw-r--r--gdb/testsuite/gdb.base/structs.c2
-rw-r--r--gdb/testsuite/gdb.base/structs.exp20
-rw-r--r--gdb/testsuite/gdb.base/structs2.exp8
-rw-r--r--gdb/testsuite/gdb.base/structs3.c2
-rw-r--r--gdb/testsuite/gdb.base/structs3.exp4
-rw-r--r--gdb/testsuite/gdb.base/style-interp-exec-mi.c2
-rw-r--r--gdb/testsuite/gdb.base/style-interp-exec-mi.exp2
-rw-r--r--gdb/testsuite/gdb.base/style-logging.exp2
-rw-r--r--gdb/testsuite/gdb.base/style.c2
-rw-r--r--gdb/testsuite/gdb.base/style.exp318
-rw-r--r--gdb/testsuite/gdb.base/subst.exp2
-rw-r--r--gdb/testsuite/gdb.base/sym-file-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/sym-file-loader.c2
-rw-r--r--gdb/testsuite/gdb.base/sym-file-loader.h2
-rw-r--r--gdb/testsuite/gdb.base/sym-file-main.c2
-rw-r--r--gdb/testsuite/gdb.base/sym-file.exp8
-rw-r--r--gdb/testsuite/gdb.base/symbol-alias.c2
-rw-r--r--gdb/testsuite/gdb.base/symbol-alias.exp6
-rw-r--r--gdb/testsuite/gdb.base/symbol-alias2.c2
-rw-r--r--gdb/testsuite/gdb.base/symbol-without-target_section.c2
-rw-r--r--gdb/testsuite/gdb.base/symbol-without-target_section.exp2
-rw-r--r--gdb/testsuite/gdb.base/symfile-warn.c2
-rw-r--r--gdb/testsuite/gdb.base/symfile-warn.exp2
-rw-r--r--gdb/testsuite/gdb.base/symlink-sourcefile.c2
-rw-r--r--gdb/testsuite/gdb.base/symlink-sourcefile.exp2
-rw-r--r--gdb/testsuite/gdb.base/symtab-search-order-1.c2
-rw-r--r--gdb/testsuite/gdb.base/symtab-search-order-shlib-1.c2
-rw-r--r--gdb/testsuite/gdb.base/symtab-search-order.c2
-rw-r--r--gdb/testsuite/gdb.base/symtab-search-order.exp7
-rw-r--r--gdb/testsuite/gdb.base/sysroot-debug-lookup.exp2
-rw-r--r--gdb/testsuite/gdb.base/template.c2
-rw-r--r--gdb/testsuite/gdb.base/template.exp2
-rw-r--r--gdb/testsuite/gdb.base/term.c2
-rw-r--r--gdb/testsuite/gdb.base/term.exp2
-rw-r--r--gdb/testsuite/gdb.base/testenv.c2
-rw-r--r--gdb/testsuite/gdb.base/testenv.exp26
-rw-r--r--gdb/testsuite/gdb.base/thread-bp-multi-loc.c2
-rw-r--r--gdb/testsuite/gdb.base/thread-bp-multi-loc.exp2
-rw-r--r--gdb/testsuite/gdb.base/timestamp.exp2
-rw-r--r--gdb/testsuite/gdb.base/tls-common.exp.tcl50
-rw-r--r--gdb/testsuite/gdb.base/tls-dlobj-lib.c87
-rw-r--r--gdb/testsuite/gdb.base/tls-dlobj.c311
-rw-r--r--gdb/testsuite/gdb.base/tls-dlobj.exp380
-rw-r--r--gdb/testsuite/gdb.base/tls-multiobj.c89
-rw-r--r--gdb/testsuite/gdb.base/tls-multiobj.exp232
-rw-r--r--gdb/testsuite/gdb.base/tls-multiobj1.c26
-rw-r--r--gdb/testsuite/gdb.base/tls-multiobj2.c26
-rw-r--r--gdb/testsuite/gdb.base/tls-multiobj3.c26
-rw-r--r--gdb/testsuite/gdb.base/tls-nothreads.c57
-rw-r--r--gdb/testsuite/gdb.base/tls-nothreads.exp251
-rw-r--r--gdb/testsuite/gdb.base/trace-commands.exp2
-rw-r--r--gdb/testsuite/gdb.base/traced-thread.c2
-rw-r--r--gdb/testsuite/gdb.base/traced-thread.exp2
-rw-r--r--gdb/testsuite/gdb.base/twice.exp7
-rw-r--r--gdb/testsuite/gdb.base/type-opaque-lib.c2
-rw-r--r--gdb/testsuite/gdb.base/type-opaque-main.c2
-rw-r--r--gdb/testsuite/gdb.base/type-opaque.exp5
-rw-r--r--gdb/testsuite/gdb.base/ui-redirect.exp4
-rw-r--r--gdb/testsuite/gdb.base/unload.c2
-rw-r--r--gdb/testsuite/gdb.base/unload.exp5
-rw-r--r--gdb/testsuite/gdb.base/unloadshr.c2
-rw-r--r--gdb/testsuite/gdb.base/unloadshr2.c2
-rw-r--r--gdb/testsuite/gdb.base/until-nodebug.exp4
-rw-r--r--gdb/testsuite/gdb.base/until-trailing-insns.c2
-rw-r--r--gdb/testsuite/gdb.base/until-trailing-insns.exp20
-rw-r--r--gdb/testsuite/gdb.base/until.exp2
-rw-r--r--gdb/testsuite/gdb.base/unwind-on-each-insn-amd64-2.exp4
-rw-r--r--gdb/testsuite/gdb.base/unwind-on-each-insn-amd64.exp4
-rw-r--r--gdb/testsuite/gdb.base/unwind-on-each-insn-foo.c2
-rw-r--r--gdb/testsuite/gdb.base/unwind-on-each-insn-i386.exp4
-rw-r--r--gdb/testsuite/gdb.base/unwind-on-each-insn.c2
-rw-r--r--gdb/testsuite/gdb.base/unwind-on-each-insn.exp2
-rw-r--r--gdb/testsuite/gdb.base/unwind-on-each-insn.exp.tcl2
-rw-r--r--gdb/testsuite/gdb.base/unwindonsignal.c2
-rw-r--r--gdb/testsuite/gdb.base/unwindonsignal.exp2
-rw-r--r--gdb/testsuite/gdb.base/user-namespace-attach.c35
-rw-r--r--gdb/testsuite/gdb.base/user-namespace-attach.exp148
-rw-r--r--gdb/testsuite/gdb.base/utf8-identifiers.c2
-rw-r--r--gdb/testsuite/gdb.base/utf8-identifiers.exp6
-rw-r--r--gdb/testsuite/gdb.base/valgrind-bt.c2
-rw-r--r--gdb/testsuite/gdb.base/valgrind-bt.exp2
-rw-r--r--gdb/testsuite/gdb.base/valgrind-disp-step.c2
-rw-r--r--gdb/testsuite/gdb.base/valgrind-disp-step.exp2
-rw-r--r--gdb/testsuite/gdb.base/valgrind-infcall-2.c2
-rw-r--r--gdb/testsuite/gdb.base/valgrind-infcall-2.exp2
-rw-r--r--gdb/testsuite/gdb.base/valgrind-infcall.c2
-rw-r--r--gdb/testsuite/gdb.base/valgrind-infcall.exp4
-rw-r--r--gdb/testsuite/gdb.base/value-double-free.c2
-rw-r--r--gdb/testsuite/gdb.base/value-double-free.exp4
-rw-r--r--gdb/testsuite/gdb.base/value-history-unavailable.c2
-rw-r--r--gdb/testsuite/gdb.base/value-history-unavailable.exp6
-rw-r--r--gdb/testsuite/gdb.base/varargs.exp11
-rw-r--r--gdb/testsuite/gdb.base/vdso-warning.c2
-rw-r--r--gdb/testsuite/gdb.base/vdso-warning.exp2
-rw-r--r--gdb/testsuite/gdb.base/vfork-follow-parent.c2
-rw-r--r--gdb/testsuite/gdb.base/vfork-follow-parent.exp4
-rw-r--r--gdb/testsuite/gdb.base/vforked-prog.c2
-rw-r--r--gdb/testsuite/gdb.base/vla-datatypes.c2
-rw-r--r--gdb/testsuite/gdb.base/vla-datatypes.exp4
-rw-r--r--gdb/testsuite/gdb.base/vla-optimized-out.c2
-rw-r--r--gdb/testsuite/gdb.base/vla-optimized-out.exp4
-rw-r--r--gdb/testsuite/gdb.base/vla-ptr.c2
-rw-r--r--gdb/testsuite/gdb.base/vla-ptr.exp4
-rw-r--r--gdb/testsuite/gdb.base/vla-sideeffect.c2
-rw-r--r--gdb/testsuite/gdb.base/vla-sideeffect.exp7
-rw-r--r--gdb/testsuite/gdb.base/vla-struct-fields.c2
-rw-r--r--gdb/testsuite/gdb.base/vla-struct-fields.exp4
-rw-r--r--gdb/testsuite/gdb.base/vla-stub-define.c2
-rw-r--r--gdb/testsuite/gdb.base/vla-stub.c2
-rw-r--r--gdb/testsuite/gdb.base/vla-stub.exp2
-rw-r--r--gdb/testsuite/gdb.base/volatile.exp6
-rw-r--r--gdb/testsuite/gdb.base/warning.exp2
-rw-r--r--gdb/testsuite/gdb.base/watch-before-fork.c2
-rw-r--r--gdb/testsuite/gdb.base/watch-before-fork.exp4
-rw-r--r--gdb/testsuite/gdb.base/watch-bitfields.c2
-rw-r--r--gdb/testsuite/gdb.base/watch-bitfields.exp2
-rw-r--r--gdb/testsuite/gdb.base/watch-cond-infcall.c2
-rw-r--r--gdb/testsuite/gdb.base/watch-cond-infcall.exp2
-rw-r--r--gdb/testsuite/gdb.base/watch-cond.c2
-rw-r--r--gdb/testsuite/gdb.base/watch-cond.exp2
-rw-r--r--gdb/testsuite/gdb.base/watch-non-mem.c2
-rw-r--r--gdb/testsuite/gdb.base/watch-non-mem.exp2
-rw-r--r--gdb/testsuite/gdb.base/watch-read.c2
-rw-r--r--gdb/testsuite/gdb.base/watch-read.exp2
-rw-r--r--gdb/testsuite/gdb.base/watch-vfork.c2
-rw-r--r--gdb/testsuite/gdb.base/watch-vfork.exp4
-rw-r--r--gdb/testsuite/gdb.base/watch_thread_num.c2
-rw-r--r--gdb/testsuite/gdb.base/watch_thread_num.exp5
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-cond-gone-stripped.c2
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-cond-gone.c2
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-cond-gone.exp4
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-delete.c2
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-delete.exp4
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-hw-attach.c2
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-hw-attach.exp26
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-hw-hit-once.c2
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp4
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-hw.c2
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-hw.exp2
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-reuse-slot.c2
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp16
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-running.c2
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-running.exp11
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-solib-shr.c2
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-solib.c2
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-solib.exp5
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-stops-at-right-insn.c2
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-stops-at-right-insn.exp5
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-unaligned.c39
-rw-r--r--gdb/testsuite/gdb.base/watchpoint-unaligned.exp129
-rw-r--r--gdb/testsuite/gdb.base/watchpoint.exp76
-rw-r--r--gdb/testsuite/gdb.base/watchpoints.c2
-rw-r--r--gdb/testsuite/gdb.base/watchpoints.exp9
-rw-r--r--gdb/testsuite/gdb.base/wchar.c2
-rw-r--r--gdb/testsuite/gdb.base/wchar.exp6
-rw-r--r--gdb/testsuite/gdb.base/weaklib1.c2
-rw-r--r--gdb/testsuite/gdb.base/weaklib2.c2
-rw-r--r--gdb/testsuite/gdb.base/whatis-exp.exp4
-rw-r--r--gdb/testsuite/gdb.base/whatis-ptype-typedefs.c2
-rw-r--r--gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp4
-rw-r--r--gdb/testsuite/gdb.base/whatis.c2
-rw-r--r--gdb/testsuite/gdb.base/whatis.exp12
-rw-r--r--gdb/testsuite/gdb.base/with-mf-inc.c2
-rw-r--r--gdb/testsuite/gdb.base/with-mf-main.c2
-rw-r--r--gdb/testsuite/gdb.base/with-mf.exp5
-rw-r--r--gdb/testsuite/gdb.base/with.c2
-rw-r--r--gdb/testsuite/gdb.base/with.exp56
-rw-r--r--gdb/testsuite/gdb.base/wrap-line.exp8
-rw-r--r--gdb/testsuite/gdb.base/write_mem.c2
-rw-r--r--gdb/testsuite/gdb.base/write_mem.exp2
-rw-r--r--gdb/testsuite/gdb.base/wrong_frame_bt_full-main.c2
-rw-r--r--gdb/testsuite/gdb.base/wrong_frame_bt_full-opaque.c2
-rw-r--r--gdb/testsuite/gdb.base/wrong_frame_bt_full.exp4
-rw-r--r--gdb/testsuite/gdb.btrace/buffer-size.exp6
-rw-r--r--gdb/testsuite/gdb.btrace/cpu.exp2
-rw-r--r--gdb/testsuite/gdb.btrace/data.c2
-rw-r--r--gdb/testsuite/gdb.btrace/data.exp6
-rw-r--r--gdb/testsuite/gdb.btrace/delta.exp6
-rw-r--r--gdb/testsuite/gdb.btrace/dlopen-dso.c2
-rw-r--r--gdb/testsuite/gdb.btrace/dlopen.c2
-rw-r--r--gdb/testsuite/gdb.btrace/dlopen.exp4
-rw-r--r--gdb/testsuite/gdb.btrace/enable-new-thread.c2
-rw-r--r--gdb/testsuite/gdb.btrace/enable-new-thread.exp6
-rw-r--r--gdb/testsuite/gdb.btrace/enable-running.c2
-rw-r--r--gdb/testsuite/gdb.btrace/enable-running.exp4
-rw-r--r--gdb/testsuite/gdb.btrace/enable.c2
-rw-r--r--gdb/testsuite/gdb.btrace/enable.exp14
-rw-r--r--gdb/testsuite/gdb.btrace/event-tracing-gap.c2
-rw-r--r--gdb/testsuite/gdb.btrace/event-tracing-gap.exp2
-rw-r--r--gdb/testsuite/gdb.btrace/event-tracing.exp2
-rw-r--r--gdb/testsuite/gdb.btrace/exception.cc2
-rwxr-xr-xgdb/testsuite/gdb.btrace/exception.exp8
-rw-r--r--gdb/testsuite/gdb.btrace/function_call_history.c2
-rw-r--r--gdb/testsuite/gdb.btrace/function_call_history.exp8
-rw-r--r--gdb/testsuite/gdb.btrace/gcore.exp6
-rw-r--r--gdb/testsuite/gdb.btrace/i386-ptwrite.S2
-rw-r--r--gdb/testsuite/gdb.btrace/i686-record_goto.S2
-rw-r--r--gdb/testsuite/gdb.btrace/i686-tailcall-only.S2
-rw-r--r--gdb/testsuite/gdb.btrace/i686-tailcall.S2
-rw-r--r--gdb/testsuite/gdb.btrace/instruction_history.S2
-rw-r--r--gdb/testsuite/gdb.btrace/instruction_history.c2
-rw-r--r--gdb/testsuite/gdb.btrace/instruction_history.exp6
-rw-r--r--gdb/testsuite/gdb.btrace/multi-inferior.c2
-rw-r--r--gdb/testsuite/gdb.btrace/multi-inferior.exp12
-rw-r--r--gdb/testsuite/gdb.btrace/multi-thread-step.c2
-rw-r--r--gdb/testsuite/gdb.btrace/multi-thread-step.exp4
-rw-r--r--gdb/testsuite/gdb.btrace/nohist.exp6
-rw-r--r--gdb/testsuite/gdb.btrace/non-stop.c2
-rw-r--r--gdb/testsuite/gdb.btrace/non-stop.exp4
-rw-r--r--gdb/testsuite/gdb.btrace/null-deref.c2
-rw-r--r--gdb/testsuite/gdb.btrace/ptwrite.c2
-rw-r--r--gdb/testsuite/gdb.btrace/ptwrite.exp6
-rw-r--r--gdb/testsuite/gdb.btrace/reconnect.c2
-rw-r--r--gdb/testsuite/gdb.btrace/reconnect.exp4
-rw-r--r--gdb/testsuite/gdb.btrace/record_goto-step.exp6
-rw-r--r--gdb/testsuite/gdb.btrace/record_goto.c2
-rw-r--r--gdb/testsuite/gdb.btrace/record_goto.exp8
-rw-r--r--gdb/testsuite/gdb.btrace/rn-dl-bind.c2
-rw-r--r--gdb/testsuite/gdb.btrace/rn-dl-bind.exp8
-rw-r--r--gdb/testsuite/gdb.btrace/segv.c2
-rw-r--r--gdb/testsuite/gdb.btrace/segv.exp6
-rw-r--r--gdb/testsuite/gdb.btrace/step.exp6
-rw-r--r--gdb/testsuite/gdb.btrace/stepi.exp8
-rw-r--r--gdb/testsuite/gdb.btrace/tailcall-only.c2
-rw-r--r--gdb/testsuite/gdb.btrace/tailcall-only.exp8
-rw-r--r--gdb/testsuite/gdb.btrace/tailcall.c2
-rw-r--r--gdb/testsuite/gdb.btrace/tailcall.exp8
-rw-r--r--gdb/testsuite/gdb.btrace/tsx.c2
-rw-r--r--gdb/testsuite/gdb.btrace/tsx.exp6
-rw-r--r--gdb/testsuite/gdb.btrace/unknown_functions.c2
-rw-r--r--gdb/testsuite/gdb.btrace/unknown_functions.exp8
-rw-r--r--gdb/testsuite/gdb.btrace/vdso.c2
-rw-r--r--gdb/testsuite/gdb.btrace/vdso.exp8
-rw-r--r--gdb/testsuite/gdb.btrace/x86-tsx.S2
-rw-r--r--gdb/testsuite/gdb.btrace/x86_64-ptwrite.S2
-rw-r--r--gdb/testsuite/gdb.btrace/x86_64-record_goto.S2
-rw-r--r--gdb/testsuite/gdb.btrace/x86_64-tailcall-only.S2
-rw-r--r--gdb/testsuite/gdb.btrace/x86_64-tailcall.S2
-rw-r--r--gdb/testsuite/gdb.compile/compile-constvar.S2
-rw-r--r--gdb/testsuite/gdb.compile/compile-constvar.c2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-anonymous.cc2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-anonymous.exp2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-array-decay.cc2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-array-decay.exp2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-inherit.cc2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-inherit.exp2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-member.cc2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-member.exp2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-method.cc2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-method.exp2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-mod.c2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-namespace.cc2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-namespace.exp2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-nested.cc2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-nested.exp2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-print.c2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-print.exp9
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-virtual.cc2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus-virtual.exp2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus.c2
-rw-r--r--gdb/testsuite/gdb.compile/compile-cplus.exp8
-rw-r--r--gdb/testsuite/gdb.compile/compile-ifunc.c2
-rw-r--r--gdb/testsuite/gdb.compile/compile-ifunc.exp8
-rw-r--r--gdb/testsuite/gdb.compile/compile-mod.c2
-rw-r--r--gdb/testsuite/gdb.compile/compile-nodebug.c2
-rw-r--r--gdb/testsuite/gdb.compile/compile-ops.c2
-rw-r--r--gdb/testsuite/gdb.compile/compile-ops.exp624
-rw-r--r--gdb/testsuite/gdb.compile/compile-print.c2
-rw-r--r--gdb/testsuite/gdb.compile/compile-print.exp4
-rw-r--r--gdb/testsuite/gdb.compile/compile-setjmp-mod.c2
-rw-r--r--gdb/testsuite/gdb.compile/compile-setjmp.c2
-rw-r--r--gdb/testsuite/gdb.compile/compile-setjmp.exp4
-rw-r--r--gdb/testsuite/gdb.compile/compile-shlib.c2
-rw-r--r--gdb/testsuite/gdb.compile/compile-tls.c2
-rw-r--r--gdb/testsuite/gdb.compile/compile-tls.exp4
-rw-r--r--gdb/testsuite/gdb.compile/compile.c2
-rw-r--r--gdb/testsuite/gdb.compile/compile.exp16
-rw-r--r--gdb/testsuite/gdb.cp/abstract-origin.cc2
-rw-r--r--gdb/testsuite/gdb.cp/abstract-origin.exp4
-rw-r--r--gdb/testsuite/gdb.cp/align.exp2
-rw-r--r--gdb/testsuite/gdb.cp/ambiguous.exp2
-rw-r--r--gdb/testsuite/gdb.cp/annota2.exp18
-rw-r--r--gdb/testsuite/gdb.cp/annota3.exp18
-rw-r--r--gdb/testsuite/gdb.cp/anon-ns.cc2
-rw-r--r--gdb/testsuite/gdb.cp/anon-ns.exp2
-rw-r--r--gdb/testsuite/gdb.cp/anon-ns2.cc2
-rw-r--r--gdb/testsuite/gdb.cp/anon-struct.cc2
-rw-r--r--gdb/testsuite/gdb.cp/anon-struct.exp2
-rw-r--r--gdb/testsuite/gdb.cp/anon-union.exp12
-rw-r--r--gdb/testsuite/gdb.cp/arg-reference.cc2
-rw-r--r--gdb/testsuite/gdb.cp/arg-reference.exp2
-rw-r--r--gdb/testsuite/gdb.cp/array-indices.exp2
-rw-r--r--gdb/testsuite/gdb.cp/array-repeat.exp2
-rw-r--r--gdb/testsuite/gdb.cp/baseenum.cc2
-rw-r--r--gdb/testsuite/gdb.cp/baseenum.exp2
-rw-r--r--gdb/testsuite/gdb.cp/bool.cc2
-rw-r--r--gdb/testsuite/gdb.cp/bool.exp2
-rw-r--r--gdb/testsuite/gdb.cp/break-f-std-string.cc2
-rw-r--r--gdb/testsuite/gdb.cp/break-f-std-string.exp2
-rw-r--r--gdb/testsuite/gdb.cp/break-template-cast.cc2
-rw-r--r--gdb/testsuite/gdb.cp/break-template-cast.exp2
-rw-r--r--gdb/testsuite/gdb.cp/breakpoint-locs-2.cc2
-rw-r--r--gdb/testsuite/gdb.cp/breakpoint-locs.cc2
-rw-r--r--gdb/testsuite/gdb.cp/breakpoint-locs.exp2
-rw-r--r--gdb/testsuite/gdb.cp/breakpoint-locs.h2
-rw-r--r--gdb/testsuite/gdb.cp/breakpoint-shlib-func-lib.cc2
-rw-r--r--gdb/testsuite/gdb.cp/breakpoint-shlib-func.cc2
-rw-r--r--gdb/testsuite/gdb.cp/breakpoint-shlib-func.exp2
-rw-r--r--gdb/testsuite/gdb.cp/breakpoint.cc2
-rw-r--r--gdb/testsuite/gdb.cp/breakpoint.exp2
-rw-r--r--gdb/testsuite/gdb.cp/bs15503.cc2
-rw-r--r--gdb/testsuite/gdb.cp/bs15503.exp2
-rw-r--r--gdb/testsuite/gdb.cp/call-c-1.c2
-rw-r--r--gdb/testsuite/gdb.cp/call-c.cc2
-rw-r--r--gdb/testsuite/gdb.cp/call-c.exp4
-rw-r--r--gdb/testsuite/gdb.cp/call-method-register.cc2
-rw-r--r--gdb/testsuite/gdb.cp/call-method-register.exp56
-rw-r--r--gdb/testsuite/gdb.cp/casts.exp6
-rw-r--r--gdb/testsuite/gdb.cp/casts03.cc2
-rw-r--r--gdb/testsuite/gdb.cp/chained-calls.cc19
-rw-r--r--gdb/testsuite/gdb.cp/chained-calls.exp5
-rw-r--r--gdb/testsuite/gdb.cp/class2.cc2
-rw-r--r--gdb/testsuite/gdb.cp/class2.exp2
-rw-r--r--gdb/testsuite/gdb.cp/classes.cc2
-rw-r--r--gdb/testsuite/gdb.cp/classes.exp6
-rw-r--r--gdb/testsuite/gdb.cp/cmpd-minsyms.cc2
-rw-r--r--gdb/testsuite/gdb.cp/cmpd-minsyms.exp4
-rw-r--r--gdb/testsuite/gdb.cp/cold-clone.cc2
-rw-r--r--gdb/testsuite/gdb.cp/cold-clone.exp2
-rw-r--r--gdb/testsuite/gdb.cp/constexpr-field.cc2
-rw-r--r--gdb/testsuite/gdb.cp/constexpr-field.exp2
-rw-r--r--gdb/testsuite/gdb.cp/converts.exp2
-rw-r--r--gdb/testsuite/gdb.cp/cp-relocate.cc2
-rw-r--r--gdb/testsuite/gdb.cp/cp-relocate.exp2
-rw-r--r--gdb/testsuite/gdb.cp/cpcompletion.exp2
-rw-r--r--gdb/testsuite/gdb.cp/cpexprs-debug-types.exp2
-rw-r--r--gdb/testsuite/gdb.cp/cpexprs.cc2
-rw-r--r--gdb/testsuite/gdb.cp/cpexprs.exp2
-rw-r--r--gdb/testsuite/gdb.cp/cpexprs.exp.tcl40
-rw-r--r--gdb/testsuite/gdb.cp/cplabel.cc2
-rw-r--r--gdb/testsuite/gdb.cp/cplabel.exp2
-rw-r--r--gdb/testsuite/gdb.cp/cplusfuncs.exp9
-rw-r--r--gdb/testsuite/gdb.cp/cpsizeof.cc2
-rw-r--r--gdb/testsuite/gdb.cp/cpsizeof.exp2
-rw-r--r--gdb/testsuite/gdb.cp/ctti.exp2
-rw-r--r--gdb/testsuite/gdb.cp/cttiadd.cc2
-rw-r--r--gdb/testsuite/gdb.cp/cttiadd1.cc2
-rw-r--r--gdb/testsuite/gdb.cp/cttiadd2.cc2
-rw-r--r--gdb/testsuite/gdb.cp/cttiadd3.cc2
-rw-r--r--gdb/testsuite/gdb.cp/debug-expr.exp2
-rw-r--r--gdb/testsuite/gdb.cp/demangle.exp20
-rw-r--r--gdb/testsuite/gdb.cp/derivation.cc2
-rw-r--r--gdb/testsuite/gdb.cp/derivation.exp4
-rw-r--r--gdb/testsuite/gdb.cp/derivation2.cc2
-rw-r--r--gdb/testsuite/gdb.cp/destrprint.exp4
-rw-r--r--gdb/testsuite/gdb.cp/disasm-func-name.cc2
-rw-r--r--gdb/testsuite/gdb.cp/disasm-func-name.exp2
-rw-r--r--gdb/testsuite/gdb.cp/dispcxx.cc2
-rw-r--r--gdb/testsuite/gdb.cp/dispcxx.exp4
-rw-r--r--gdb/testsuite/gdb.cp/empty-enum.cc2
-rw-r--r--gdb/testsuite/gdb.cp/empty-enum.exp4
-rw-r--r--gdb/testsuite/gdb.cp/ena-dis-br-range.cc2
-rw-r--r--gdb/testsuite/gdb.cp/ena-dis-br-range.exp2
-rw-r--r--gdb/testsuite/gdb.cp/enum-class.cc2
-rw-r--r--gdb/testsuite/gdb.cp/enum-class.exp2
-rw-r--r--gdb/testsuite/gdb.cp/eval-reference-type.cc36
-rw-r--r--gdb/testsuite/gdb.cp/eval-reference-type.exp46
-rw-r--r--gdb/testsuite/gdb.cp/except-multi-location-lib.cc2
-rw-r--r--gdb/testsuite/gdb.cp/except-multi-location-main.cc2
-rw-r--r--gdb/testsuite/gdb.cp/except-multi-location.exp4
-rw-r--r--gdb/testsuite/gdb.cp/exception.cc2
-rw-r--r--gdb/testsuite/gdb.cp/exception.exp6
-rw-r--r--gdb/testsuite/gdb.cp/exceptprint.cc2
-rw-r--r--gdb/testsuite/gdb.cp/exceptprint.exp4
-rw-r--r--gdb/testsuite/gdb.cp/expand-psymtabs-cxx.cc2
-rw-r--r--gdb/testsuite/gdb.cp/expand-psymtabs-cxx.exp2
-rw-r--r--gdb/testsuite/gdb.cp/expand-sals.cc2
-rw-r--r--gdb/testsuite/gdb.cp/expand-sals.exp4
-rw-r--r--gdb/testsuite/gdb.cp/extern-c.cc2
-rw-r--r--gdb/testsuite/gdb.cp/extern-c.exp2
-rw-r--r--gdb/testsuite/gdb.cp/filename.cc2
-rw-r--r--gdb/testsuite/gdb.cp/filename.exp2
-rw-r--r--gdb/testsuite/gdb.cp/formatted-ref.cc2
-rw-r--r--gdb/testsuite/gdb.cp/formatted-ref.exp12
-rw-r--r--gdb/testsuite/gdb.cp/fpointer.exp2
-rw-r--r--gdb/testsuite/gdb.cp/gdb1355.exp4
-rw-r--r--gdb/testsuite/gdb.cp/gdb2384-base.cc2
-rw-r--r--gdb/testsuite/gdb.cp/gdb2384-base.h2
-rw-r--r--gdb/testsuite/gdb.cp/gdb2384.cc2
-rw-r--r--gdb/testsuite/gdb.cp/gdb2384.exp4
-rw-r--r--gdb/testsuite/gdb.cp/gdb2495.cc2
-rw-r--r--gdb/testsuite/gdb.cp/gdb2495.exp2
-rw-r--r--gdb/testsuite/gdb.cp/hang.exp2
-rw-r--r--gdb/testsuite/gdb.cp/impl-this.cc2
-rw-r--r--gdb/testsuite/gdb.cp/impl-this.exp2
-rw-r--r--gdb/testsuite/gdb.cp/includefile2
-rw-r--r--gdb/testsuite/gdb.cp/incomplete-type-overload.cc2
-rw-r--r--gdb/testsuite/gdb.cp/incomplete-type-overload.exp118
-rw-r--r--gdb/testsuite/gdb.cp/infcall-dlopen-lib.cc2
-rw-r--r--gdb/testsuite/gdb.cp/infcall-dlopen.cc2
-rw-r--r--gdb/testsuite/gdb.cp/infcall-dlopen.exp2
-rw-r--r--gdb/testsuite/gdb.cp/infcall-nodebug-c++-d0.exp2
-rw-r--r--gdb/testsuite/gdb.cp/infcall-nodebug-c++-d1.exp2
-rw-r--r--gdb/testsuite/gdb.cp/infcall-nodebug-c-d0.exp2
-rw-r--r--gdb/testsuite/gdb.cp/infcall-nodebug-c-d1.exp2
-rw-r--r--gdb/testsuite/gdb.cp/infcall-nodebug-lib.c2
-rw-r--r--gdb/testsuite/gdb.cp/infcall-nodebug-main.c2
-rw-r--r--gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl8
-rw-r--r--gdb/testsuite/gdb.cp/inherit.exp2
-rw-r--r--gdb/testsuite/gdb.cp/iostream.cc2
-rw-r--r--gdb/testsuite/gdb.cp/iostream.exp4
-rw-r--r--gdb/testsuite/gdb.cp/koenig.exp2
-rw-r--r--gdb/testsuite/gdb.cp/local-static.c2
-rw-r--r--gdb/testsuite/gdb.cp/local-static.exp2
-rw-r--r--gdb/testsuite/gdb.cp/local.exp6
-rw-r--r--gdb/testsuite/gdb.cp/m-data.exp2
-rw-r--r--gdb/testsuite/gdb.cp/m-static.exp4
-rw-r--r--gdb/testsuite/gdb.cp/main-cp.exp2
-rw-r--r--gdb/testsuite/gdb.cp/main.cc2
-rw-r--r--gdb/testsuite/gdb.cp/maint.exp2
-rw-r--r--gdb/testsuite/gdb.cp/many-args.cc2
-rw-r--r--gdb/testsuite/gdb.cp/many-args.exp4
-rw-r--r--gdb/testsuite/gdb.cp/mb-ctor.exp2
-rw-r--r--gdb/testsuite/gdb.cp/mb-inline.exp4
-rw-r--r--gdb/testsuite/gdb.cp/mb-inline.h2
-rw-r--r--gdb/testsuite/gdb.cp/mb-inline1.cc2
-rw-r--r--gdb/testsuite/gdb.cp/mb-inline2.cc2
-rw-r--r--gdb/testsuite/gdb.cp/mb-templates.exp4
-rw-r--r--gdb/testsuite/gdb.cp/member-name.cc2
-rw-r--r--gdb/testsuite/gdb.cp/member-name.exp2
-rw-r--r--gdb/testsuite/gdb.cp/member-ptr.cc2
-rw-r--r--gdb/testsuite/gdb.cp/member-ptr.exp2
-rw-r--r--gdb/testsuite/gdb.cp/meth-typedefs.cc2
-rw-r--r--gdb/testsuite/gdb.cp/meth-typedefs.exp2
-rw-r--r--gdb/testsuite/gdb.cp/method-call-in-c.cc2
-rw-r--r--gdb/testsuite/gdb.cp/method-call-in-c.exp4
-rw-r--r--gdb/testsuite/gdb.cp/method-ref-return.cc42
-rw-r--r--gdb/testsuite/gdb.cp/method-ref-return.exp70
-rw-r--r--gdb/testsuite/gdb.cp/method.exp10
-rw-r--r--gdb/testsuite/gdb.cp/method2.exp2
-rw-r--r--gdb/testsuite/gdb.cp/minsym-fallback-main.cc2
-rw-r--r--gdb/testsuite/gdb.cp/minsym-fallback.cc2
-rw-r--r--gdb/testsuite/gdb.cp/minsym-fallback.exp2
-rw-r--r--gdb/testsuite/gdb.cp/minsym-fallback.h2
-rw-r--r--gdb/testsuite/gdb.cp/misc.cc2
-rw-r--r--gdb/testsuite/gdb.cp/misc.exp10
-rw-r--r--gdb/testsuite/gdb.cp/namelessclass.S2
-rw-r--r--gdb/testsuite/gdb.cp/namelessclass.cc2
-rw-r--r--gdb/testsuite/gdb.cp/namelessclass.exp2
-rw-r--r--gdb/testsuite/gdb.cp/namespace-enum.exp2
-rw-r--r--gdb/testsuite/gdb.cp/namespace-nested-import.exp2
-rw-r--r--gdb/testsuite/gdb.cp/namespace.exp20
-rw-r--r--gdb/testsuite/gdb.cp/namespace1.cc2
-rw-r--r--gdb/testsuite/gdb.cp/nested-class-func-class.cc2
-rw-r--r--gdb/testsuite/gdb.cp/nested-class-func-class.exp2
-rw-r--r--gdb/testsuite/gdb.cp/nested-types.cc2
-rw-r--r--gdb/testsuite/gdb.cp/nested-types.exp6
-rw-r--r--gdb/testsuite/gdb.cp/nextoverthrow.cc2
-rw-r--r--gdb/testsuite/gdb.cp/nextoverthrow.exp4
-rw-r--r--gdb/testsuite/gdb.cp/no-libstdcxx-probe.exp2
-rw-r--r--gdb/testsuite/gdb.cp/non-trivial-retval.cc2
-rw-r--r--gdb/testsuite/gdb.cp/non-trivial-retval.exp2
-rw-r--r--gdb/testsuite/gdb.cp/noparam.cc2
-rw-r--r--gdb/testsuite/gdb.cp/noparam.exp2
-rw-r--r--gdb/testsuite/gdb.cp/nsalias.cc2
-rw-r--r--gdb/testsuite/gdb.cp/nsalias.exp122
-rw-r--r--gdb/testsuite/gdb.cp/nsdecl.exp2
-rw-r--r--gdb/testsuite/gdb.cp/nsimport.exp2
-rw-r--r--gdb/testsuite/gdb.cp/nsnested.exp2
-rw-r--r--gdb/testsuite/gdb.cp/nsnoimports.exp2
-rw-r--r--gdb/testsuite/gdb.cp/nsrecurs.exp2
-rw-r--r--gdb/testsuite/gdb.cp/nsstress.exp2
-rw-r--r--gdb/testsuite/gdb.cp/nsusing.exp4
-rw-r--r--gdb/testsuite/gdb.cp/operator.exp2
-rw-r--r--gdb/testsuite/gdb.cp/oranking.exp2
-rw-r--r--gdb/testsuite/gdb.cp/overload-const.cc2
-rw-r--r--gdb/testsuite/gdb.cp/overload-const.exp4
-rw-r--r--gdb/testsuite/gdb.cp/overload.exp6
-rw-r--r--gdb/testsuite/gdb.cp/ovldbreak.exp8
-rw-r--r--gdb/testsuite/gdb.cp/ovsrch.exp2
-rw-r--r--gdb/testsuite/gdb.cp/ovsrch.h2
-rw-r--r--gdb/testsuite/gdb.cp/ovsrch1.cc2
-rw-r--r--gdb/testsuite/gdb.cp/ovsrch2.cc2
-rw-r--r--gdb/testsuite/gdb.cp/ovsrch3.cc2
-rw-r--r--gdb/testsuite/gdb.cp/ovsrch4.cc2
-rw-r--r--gdb/testsuite/gdb.cp/paramless.cc2
-rw-r--r--gdb/testsuite/gdb.cp/paramless.exp2
-rw-r--r--gdb/testsuite/gdb.cp/paren-type.cc2
-rw-r--r--gdb/testsuite/gdb.cp/paren-type.exp2
-rw-r--r--gdb/testsuite/gdb.cp/parse-lang.cc2
-rw-r--r--gdb/testsuite/gdb.cp/parse-lang.exp2
-rw-r--r--gdb/testsuite/gdb.cp/pass-by-ref-2.cc2
-rw-r--r--gdb/testsuite/gdb.cp/pass-by-ref-2.exp2
-rw-r--r--gdb/testsuite/gdb.cp/pass-by-ref.exp8
-rw-r--r--gdb/testsuite/gdb.cp/pointer-to-member.cc2
-rw-r--r--gdb/testsuite/gdb.cp/pointer-to-member.exp2
-rw-r--r--gdb/testsuite/gdb.cp/pr-1023.exp2
-rw-r--r--gdb/testsuite/gdb.cp/pr-1210.exp2
-rw-r--r--gdb/testsuite/gdb.cp/pr-574.cc2
-rw-r--r--gdb/testsuite/gdb.cp/pr-574.exp2
-rw-r--r--gdb/testsuite/gdb.cp/pr10687.exp2
-rw-r--r--gdb/testsuite/gdb.cp/pr10728.exp4
-rw-r--r--gdb/testsuite/gdb.cp/pr12028.exp2
-rw-r--r--gdb/testsuite/gdb.cp/pr17132.cc2
-rw-r--r--gdb/testsuite/gdb.cp/pr17132.exp2
-rw-r--r--gdb/testsuite/gdb.cp/pr17494.cc2
-rw-r--r--gdb/testsuite/gdb.cp/pr17494.exp2
-rw-r--r--gdb/testsuite/gdb.cp/pr9067.exp2
-rw-r--r--gdb/testsuite/gdb.cp/pr9167.exp2
-rw-r--r--gdb/testsuite/gdb.cp/pr9631.cc2
-rw-r--r--gdb/testsuite/gdb.cp/pr9631.exp2
-rw-r--r--gdb/testsuite/gdb.cp/print-demangle.exp2
-rw-r--r--gdb/testsuite/gdb.cp/print-global-stub.cc2
-rw-r--r--gdb/testsuite/gdb.cp/print-global-stub.exp9
-rw-r--r--gdb/testsuite/gdb.cp/print-method-args.cc2
-rw-r--r--gdb/testsuite/gdb.cp/print-method-args.exp2
-rw-r--r--gdb/testsuite/gdb.cp/printmethod.cc2
-rw-r--r--gdb/testsuite/gdb.cp/printmethod.exp2
-rw-r--r--gdb/testsuite/gdb.cp/psmang.exp10
-rw-r--r--gdb/testsuite/gdb.cp/psmang1.cc2
-rw-r--r--gdb/testsuite/gdb.cp/psmang2.cc2
-rw-r--r--gdb/testsuite/gdb.cp/psymtab-parameter.cc2
-rw-r--r--gdb/testsuite/gdb.cp/psymtab-parameter.exp2
-rw-r--r--gdb/testsuite/gdb.cp/ptype-cv-cp.cc2
-rw-r--r--gdb/testsuite/gdb.cp/ptype-cv-cp.exp2
-rw-r--r--gdb/testsuite/gdb.cp/ptype-flags.cc2
-rw-r--r--gdb/testsuite/gdb.cp/ptype-flags.exp2
-rw-r--r--gdb/testsuite/gdb.cp/punctuator.exp2
-rw-r--r--gdb/testsuite/gdb.cp/re-set-overloaded.cc2
-rw-r--r--gdb/testsuite/gdb.cp/re-set-overloaded.exp2
-rw-r--r--gdb/testsuite/gdb.cp/readnow-language.cc2
-rw-r--r--gdb/testsuite/gdb.cp/readnow-language.exp2
-rw-r--r--gdb/testsuite/gdb.cp/ref-params.cc2
-rw-r--r--gdb/testsuite/gdb.cp/ref-params.exp4
-rw-r--r--gdb/testsuite/gdb.cp/ref-types.cc2
-rw-r--r--gdb/testsuite/gdb.cp/ref-types.exp2
-rw-r--r--gdb/testsuite/gdb.cp/rtti.exp2
-rw-r--r--gdb/testsuite/gdb.cp/rtti.h2
-rw-r--r--gdb/testsuite/gdb.cp/rtti1.cc2
-rw-r--r--gdb/testsuite/gdb.cp/rtti2.cc2
-rw-r--r--gdb/testsuite/gdb.cp/rvalue-ref-casts.cc2
-rw-r--r--gdb/testsuite/gdb.cp/rvalue-ref-casts.exp2
-rw-r--r--gdb/testsuite/gdb.cp/rvalue-ref-overload.cc2
-rw-r--r--gdb/testsuite/gdb.cp/rvalue-ref-overload.exp2
-rw-r--r--gdb/testsuite/gdb.cp/rvalue-ref-params.cc2
-rw-r--r--gdb/testsuite/gdb.cp/rvalue-ref-params.exp6
-rw-r--r--gdb/testsuite/gdb.cp/rvalue-ref-sizeof.cc2
-rw-r--r--gdb/testsuite/gdb.cp/rvalue-ref-sizeof.exp2
-rw-r--r--gdb/testsuite/gdb.cp/rvalue-ref-types.cc2
-rw-r--r--gdb/testsuite/gdb.cp/rvalue-ref-types.exp4
-rw-r--r--gdb/testsuite/gdb.cp/save-bp-qualified.cc2
-rw-r--r--gdb/testsuite/gdb.cp/save-bp-qualified.exp8
-rw-r--r--gdb/testsuite/gdb.cp/scope-err.cc2
-rw-r--r--gdb/testsuite/gdb.cp/scope-err.exp2
-rw-r--r--gdb/testsuite/gdb.cp/shadow.exp2
-rw-r--r--gdb/testsuite/gdb.cp/smartp.cc2
-rw-r--r--gdb/testsuite/gdb.cp/smartp.exp2
-rw-r--r--gdb/testsuite/gdb.cp/static-method.cc2
-rw-r--r--gdb/testsuite/gdb.cp/static-method.exp2
-rw-r--r--gdb/testsuite/gdb.cp/static-print-quit.cc2
-rw-r--r--gdb/testsuite/gdb.cp/static-print-quit.exp25
-rw-r--r--gdb/testsuite/gdb.cp/static-typedef-print.cc2
-rw-r--r--gdb/testsuite/gdb.cp/static-typedef-print.exp4
-rw-r--r--gdb/testsuite/gdb.cp/step-and-next-inline.cc2
-rw-r--r--gdb/testsuite/gdb.cp/step-and-next-inline.exp8
-rw-r--r--gdb/testsuite/gdb.cp/step-and-next-inline.h2
-rw-r--r--gdb/testsuite/gdb.cp/stub-array-size.cc2
-rw-r--r--gdb/testsuite/gdb.cp/stub-array-size.exp2
-rw-r--r--gdb/testsuite/gdb.cp/stub-array-size.h2
-rw-r--r--gdb/testsuite/gdb.cp/stub-array-size2.cc2
-rw-r--r--gdb/testsuite/gdb.cp/subtypes-2.cc2
-rw-r--r--gdb/testsuite/gdb.cp/subtypes.cc2
-rw-r--r--gdb/testsuite/gdb.cp/subtypes.exp4
-rw-r--r--gdb/testsuite/gdb.cp/subtypes.h2
-rw-r--r--gdb/testsuite/gdb.cp/temargs.cc2
-rw-r--r--gdb/testsuite/gdb.cp/temargs.exp36
-rw-r--r--gdb/testsuite/gdb.cp/templates.exp59
-rw-r--r--gdb/testsuite/gdb.cp/try_catch.cc2
-rw-r--r--gdb/testsuite/gdb.cp/try_catch.exp2
-rw-r--r--gdb/testsuite/gdb.cp/typed-enum.cc2
-rw-r--r--gdb/testsuite/gdb.cp/typed-enum.exp2
-rw-r--r--gdb/testsuite/gdb.cp/typedef-base.cc2
-rw-r--r--gdb/testsuite/gdb.cp/typedef-base.exp4
-rw-r--r--gdb/testsuite/gdb.cp/typedef-operator.cc2
-rw-r--r--gdb/testsuite/gdb.cp/typedef-operator.exp4
-rw-r--r--gdb/testsuite/gdb.cp/typeid.cc2
-rw-r--r--gdb/testsuite/gdb.cp/typeid.exp4
-rw-r--r--gdb/testsuite/gdb.cp/userdef.cc2
-rw-r--r--gdb/testsuite/gdb.cp/userdef.exp6
-rw-r--r--gdb/testsuite/gdb.cp/using-crash.cc2
-rw-r--r--gdb/testsuite/gdb.cp/using-crash.exp2
-rw-r--r--gdb/testsuite/gdb.cp/var-tag-2.cc2
-rw-r--r--gdb/testsuite/gdb.cp/var-tag-3.cc2
-rw-r--r--gdb/testsuite/gdb.cp/var-tag-4.cc2
-rw-r--r--gdb/testsuite/gdb.cp/var-tag.cc2
-rw-r--r--gdb/testsuite/gdb.cp/var-tag.exp2
-rw-r--r--gdb/testsuite/gdb.cp/virtbase.exp2
-rw-r--r--gdb/testsuite/gdb.cp/virtbase2.cc2
-rw-r--r--gdb/testsuite/gdb.cp/virtbase2.exp2
-rw-r--r--gdb/testsuite/gdb.cp/virtfunc.cc2
-rw-r--r--gdb/testsuite/gdb.cp/virtfunc.exp4
-rw-r--r--gdb/testsuite/gdb.cp/virtfunc2.cc2
-rw-r--r--gdb/testsuite/gdb.cp/virtfunc2.exp2
-rw-r--r--gdb/testsuite/gdb.cp/vla-cxx.cc2
-rw-r--r--gdb/testsuite/gdb.cp/vla-cxx.exp4
-rw-r--r--gdb/testsuite/gdb.cp/watch-cp.cc2
-rw-r--r--gdb/testsuite/gdb.cp/watch-cp.exp2
-rw-r--r--gdb/testsuite/gdb.cp/wide_char_types.c2
-rw-r--r--gdb/testsuite/gdb.cp/wide_char_types.exp2
-rw-r--r--gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp6
-rw-r--r--gdb/testsuite/gdb.ctf/ctf-a.c2
-rw-r--r--gdb/testsuite/gdb.ctf/ctf-a.h2
-rw-r--r--gdb/testsuite/gdb.ctf/ctf-b.c2
-rw-r--r--gdb/testsuite/gdb.ctf/ctf-b.h2
-rw-r--r--gdb/testsuite/gdb.ctf/ctf-c.c2
-rw-r--r--gdb/testsuite/gdb.ctf/ctf-c.h2
-rw-r--r--gdb/testsuite/gdb.ctf/dwarf2-and-ctf-2.c2
-rw-r--r--gdb/testsuite/gdb.ctf/dwarf2-and-ctf.c2
-rw-r--r--gdb/testsuite/gdb.ctf/dwarf2-and-ctf.exp2
-rw-r--r--gdb/testsuite/gdb.ctf/funcreturn.exp8
-rw-r--r--gdb/testsuite/gdb.ctf/multi.exp2
-rw-r--r--gdb/testsuite/gdb.ctf/whatis.c2
-rw-r--r--gdb/testsuite/gdb.dap/ada-arrays.exp2
-rw-r--r--gdb/testsuite/gdb.dap/ada-arrays/cstuff.c2
-rw-r--r--gdb/testsuite/gdb.dap/ada-arrays/main.adb2
-rw-r--r--gdb/testsuite/gdb.dap/ada-arrays/pck.adb2
-rw-r--r--gdb/testsuite/gdb.dap/ada-arrays/pck.ads2
-rw-r--r--gdb/testsuite/gdb.dap/ada-nested.exp2
-rw-r--r--gdb/testsuite/gdb.dap/ada-nested/prog.adb2
-rw-r--r--gdb/testsuite/gdb.dap/ada-scopes.exp2
-rw-r--r--gdb/testsuite/gdb.dap/ada-scopes/pack.adb2
-rw-r--r--gdb/testsuite/gdb.dap/ada-scopes/pack.ads2
-rw-r--r--gdb/testsuite/gdb.dap/ada-scopes/prog.adb2
-rw-r--r--gdb/testsuite/gdb.dap/args-env.c2
-rw-r--r--gdb/testsuite/gdb.dap/args-env.exp2
-rw-r--r--gdb/testsuite/gdb.dap/assign.c2
-rw-r--r--gdb/testsuite/gdb.dap/assign.exp2
-rw-r--r--gdb/testsuite/gdb.dap/assign.py2
-rw-r--r--gdb/testsuite/gdb.dap/attach-fail.exp32
-rw-r--r--gdb/testsuite/gdb.dap/attach.c2
-rw-r--r--gdb/testsuite/gdb.dap/attach.exp6
-rw-r--r--gdb/testsuite/gdb.dap/basic-dap.c2
-rw-r--r--gdb/testsuite/gdb.dap/basic-dap.exp2
-rw-r--r--gdb/testsuite/gdb.dap/bt-inner.c2
-rw-r--r--gdb/testsuite/gdb.dap/bt-main.c2
-rw-r--r--gdb/testsuite/gdb.dap/bt-nodebug.exp3
-rw-r--r--gdb/testsuite/gdb.dap/cancel-launch.exp2
-rw-r--r--gdb/testsuite/gdb.dap/catch-exception.exp18
-rw-r--r--gdb/testsuite/gdb.dap/catch-exception/pck.ads2
-rw-r--r--gdb/testsuite/gdb.dap/catch-exception/prog.adb7
-rw-r--r--gdb/testsuite/gdb.dap/children.exp2
-rw-r--r--gdb/testsuite/gdb.dap/children.py2
-rw-r--r--gdb/testsuite/gdb.dap/cond-bp.c2
-rw-r--r--gdb/testsuite/gdb.dap/cond-bp.exp2
-rw-r--r--gdb/testsuite/gdb.dap/cwd.exp2
-rw-r--r--gdb/testsuite/gdb.dap/cxx-exception.cc2
-rw-r--r--gdb/testsuite/gdb.dap/cxx-exception.exp2
-rw-r--r--gdb/testsuite/gdb.dap/disassem.c2
-rw-r--r--gdb/testsuite/gdb.dap/disassem.exp2
-rw-r--r--gdb/testsuite/gdb.dap/eof.exp8
-rw-r--r--gdb/testsuite/gdb.dap/frameless.c2
-rw-r--r--gdb/testsuite/gdb.dap/frameless.exp2
-rw-r--r--gdb/testsuite/gdb.dap/global.c2
-rw-r--r--gdb/testsuite/gdb.dap/global.exp2
-rw-r--r--gdb/testsuite/gdb.dap/hover.c2
-rw-r--r--gdb/testsuite/gdb.dap/hover.exp2
-rw-r--r--gdb/testsuite/gdb.dap/insn-bp.exp2
-rw-r--r--gdb/testsuite/gdb.dap/lazy-string.c2
-rw-r--r--gdb/testsuite/gdb.dap/lazy-string.exp2
-rw-r--r--gdb/testsuite/gdb.dap/lazy-string.py2
-rw-r--r--gdb/testsuite/gdb.dap/line-zero.exp2
-rw-r--r--gdb/testsuite/gdb.dap/log-message.c2
-rw-r--r--gdb/testsuite/gdb.dap/log-message.exp11
-rw-r--r--gdb/testsuite/gdb.dap/max-size.c2
-rw-r--r--gdb/testsuite/gdb.dap/max-size.exp2
-rw-r--r--gdb/testsuite/gdb.dap/memory.c2
-rw-r--r--gdb/testsuite/gdb.dap/memory.exp2
-rw-r--r--gdb/testsuite/gdb.dap/modules-solib.c2
-rw-r--r--gdb/testsuite/gdb.dap/modules.c2
-rw-r--r--gdb/testsuite/gdb.dap/modules.exp2
-rw-r--r--gdb/testsuite/gdb.dap/pause.c2
-rw-r--r--gdb/testsuite/gdb.dap/pause.exp2
-rw-r--r--gdb/testsuite/gdb.dap/ptrref.cc2
-rw-r--r--gdb/testsuite/gdb.dap/ptrref.exp2
-rw-r--r--gdb/testsuite/gdb.dap/remote-dap.exp2
-rw-r--r--gdb/testsuite/gdb.dap/rust-slices.exp2
-rw-r--r--gdb/testsuite/gdb.dap/rust-slices.rs2
-rw-r--r--gdb/testsuite/gdb.dap/scopes.c4
-rw-r--r--gdb/testsuite/gdb.dap/scopes.exp46
-rw-r--r--gdb/testsuite/gdb.dap/sources.c2
-rw-r--r--gdb/testsuite/gdb.dap/sources.exp2
-rw-r--r--gdb/testsuite/gdb.dap/stack-format.c2
-rw-r--r--gdb/testsuite/gdb.dap/stack-format.exp2
-rw-r--r--gdb/testsuite/gdb.dap/stack-format.py2
-rw-r--r--gdb/testsuite/gdb.dap/step-out.c2
-rw-r--r--gdb/testsuite/gdb.dap/step-out.exp2
-rw-r--r--gdb/testsuite/gdb.dap/stop-at-main.exp2
-rw-r--r--gdb/testsuite/gdb.dap/terminate.exp2
-rw-r--r--gdb/testsuite/gdb.dap/threads.c67
-rw-r--r--gdb/testsuite/gdb.dap/threads.exp81
-rw-r--r--gdb/testsuite/gdb.dap/type_check.exp2
-rw-r--r--gdb/testsuite/gdb.dap/type_check.py2
-rw-r--r--gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.c2
-rw-r--r--gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp4
-rw-r--r--gdb/testsuite/gdb.debuginfod/corefile-mapped-file-1.c2
-rw-r--r--gdb/testsuite/gdb.debuginfod/corefile-mapped-file-2.c2
-rw-r--r--gdb/testsuite/gdb.debuginfod/corefile-mapped-file-3.c2
-rw-r--r--gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp28
-rw-r--r--gdb/testsuite/gdb.debuginfod/crc_mismatch-2.c2
-rw-r--r--gdb/testsuite/gdb.debuginfod/crc_mismatch.c2
-rw-r--r--gdb/testsuite/gdb.debuginfod/crc_mismatch.exp2
-rw-r--r--gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.c2
-rw-r--r--gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp30
-rw-r--r--gdb/testsuite/gdb.debuginfod/solib-with-soname-1.c2
-rw-r--r--gdb/testsuite/gdb.debuginfod/solib-with-soname-2.c2
-rw-r--r--gdb/testsuite/gdb.debuginfod/solib-with-soname.exp10
-rw-r--r--gdb/testsuite/gdb.disasm/am33.exp4
-rw-r--r--gdb/testsuite/gdb.disasm/basics.c2
-rw-r--r--gdb/testsuite/gdb.disasm/basics.exp4
-rw-r--r--gdb/testsuite/gdb.disasm/disassembler-options.exp2
-rw-r--r--gdb/testsuite/gdb.disasm/h8300s.exp2
-rw-r--r--gdb/testsuite/gdb.disasm/hppa.exp16
-rw-r--r--gdb/testsuite/gdb.disasm/mn10300.exp4
-rw-r--r--gdb/testsuite/gdb.disasm/sh3.exp4
-rw-r--r--gdb/testsuite/gdb.disasm/t01_mov.exp2
-rw-r--r--gdb/testsuite/gdb.disasm/t02_mova.exp2
-rw-r--r--gdb/testsuite/gdb.disasm/t03_add.exp2
-rw-r--r--gdb/testsuite/gdb.disasm/t04_sub.exp2
-rw-r--r--gdb/testsuite/gdb.disasm/t05_cmp.exp2
-rw-r--r--gdb/testsuite/gdb.disasm/t06_ari2.exp2
-rw-r--r--gdb/testsuite/gdb.disasm/t07_ari3.exp2
-rw-r--r--gdb/testsuite/gdb.disasm/t08_or.exp2
-rw-r--r--gdb/testsuite/gdb.disasm/t09_xor.exp2
-rw-r--r--gdb/testsuite/gdb.disasm/t10_and.exp2
-rw-r--r--gdb/testsuite/gdb.disasm/t11_logs.exp2
-rw-r--r--gdb/testsuite/gdb.disasm/t12_bit.exp2
-rw-r--r--gdb/testsuite/gdb.disasm/t13_otr.exp2
-rw-r--r--gdb/testsuite/gdb.dlang/circular.c2
-rw-r--r--gdb/testsuite/gdb.dlang/circular.exp58
-rw-r--r--gdb/testsuite/gdb.dlang/debug-expr.exp2
-rw-r--r--gdb/testsuite/gdb.dlang/demangle.exp4
-rw-r--r--gdb/testsuite/gdb.dlang/dlang-start-2.exp26
-rw-r--r--gdb/testsuite/gdb.dlang/dlang-start.exp2
-rw-r--r--gdb/testsuite/gdb.dlang/dmain.c2
-rw-r--r--gdb/testsuite/gdb.dlang/expression.exp4
-rw-r--r--gdb/testsuite/gdb.dlang/primitive-types.exp4
-rw-r--r--gdb/testsuite/gdb.dlang/properties.exp4
-rw-r--r--gdb/testsuite/gdb.dlang/simple.d2
-rw-r--r--gdb/testsuite/gdb.dlang/watch-loc.c2
-rw-r--r--gdb/testsuite/gdb.dlang/watch-loc.exp26
-rw-r--r--gdb/testsuite/gdb.dwarf2/DW_OP_piece_with_DW_OP_GNU_uninit.exp30
-rw-r--r--gdb/testsuite/gdb.dwarf2/_start.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/ada-array-bound.c29
-rw-r--r--gdb/testsuite/gdb.dwarf2/ada-array-bound.exp90
-rw-r--r--gdb/testsuite/gdb.dwarf2/ada-artificial-field.c22
-rw-r--r--gdb/testsuite/gdb.dwarf2/ada-artificial-field.exp95
-rw-r--r--gdb/testsuite/gdb.dwarf2/ada-cold-name.exp26
-rw-r--r--gdb/testsuite/gdb.dwarf2/ada-linkage-name.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/ada-linkage-name.exp30
-rw-r--r--gdb/testsuite/gdb.dwarf2/ada-thick-pointer.exp46
-rw-r--r--gdb/testsuite/gdb.dwarf2/ada-valprint-error.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp54
-rw-r--r--gdb/testsuite/gdb.dwarf2/anon-ns-fn.cc2
-rw-r--r--gdb/testsuite/gdb.dwarf2/anon-ns-fn.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/arr-opt-out.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/arr-opt-out.exp46
-rw-r--r--gdb/testsuite/gdb.dwarf2/arr-stride.exp80
-rw-r--r--gdb/testsuite/gdb.dwarf2/arr-subrange.exp72
-rw-r--r--gdb/testsuite/gdb.dwarf2/assign-variable-value-to-register.exp30
-rw-r--r--gdb/testsuite/gdb.dwarf2/atomic-type.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/atomic-type.exp94
-rw-r--r--gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp32
-rw-r--r--gdb/testsuite/gdb.dwarf2/bad-regnum.exp36
-rw-r--r--gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp42
-rw-r--r--gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/break-inline-psymtab.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/callframecfa.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/callframecfa.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/calling-convention.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/calling-convention.exp22
-rw-r--r--gdb/testsuite/gdb.dwarf2/clang-cli-macro.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/clang-cli-macro.exp22
-rw-r--r--gdb/testsuite/gdb.dwarf2/clztest.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/clztest.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/comp-unit-lang.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp14
-rw-r--r--gdb/testsuite/gdb.dwarf2/corrupt.exp28
-rw-r--r--gdb/testsuite/gdb.dwarf2/count.exp89
-rw-r--r--gdb/testsuite/gdb.dwarf2/cpp-linkage-name.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/cpp-linkage-name.exp46
-rw-r--r--gdb/testsuite/gdb.dwarf2/cu-empty-name.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/cu-empty-name.exp10
-rw-r--r--gdb/testsuite/gdb.dwarf2/cu-no-addrs.exp12
-rw-r--r--gdb/testsuite/gdb.dwarf2/data-loc.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/data-loc.exp140
-rw-r--r--gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp22
-rw-r--r--gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp30
-rw-r--r--gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp24
-rw-r--r--gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp28
-rw-r--r--gdb/testsuite/gdb.dwarf2/debug-names-non-ascending-cu.exp81
-rw-r--r--gdb/testsuite/gdb.dwarf2/debug-names-tu-dwarf5.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/debug-names-tu.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl40
-rw-r--r--gdb/testsuite/gdb.dwarf2/debug-names.exp24
-rw-r--r--gdb/testsuite/gdb.dwarf2/dup-psym.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dup-psym.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw-form-ref-addr-with-type-units.exp109
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp41
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw-form-strx.exp25
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw-form-strx.exp.tcl64
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-align.exp54
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-aranges.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-aranges.exp9
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-bad-abstract-origin.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-bad-abstract-origin.exp80
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-bad-elf-other.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp66
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp33
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-bad-unresolved.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-bad-unresolved.exp20
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-basic.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-basic.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-bfloat16.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-bfloat16.exp44
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-common-block.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-common-block.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp96
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-compressed.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-compressed.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-const.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-const.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static-main.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-cu-size.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-cu-size.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp18
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-dos-drive.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-dummy-cu.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-dummy-cu.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-dup-frame.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-dup-frame.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-dup-frame.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-empty-file-name.exp12
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-entry-pc.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-entry-pc.exp164
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-entry-points.c19
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp165
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-entry-value-2.c32
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-entry-value-2.exp125
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-entry-value-main.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-entry-value.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-entry-value.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin-2.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.c.inc2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp.tcl48
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-error.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-error.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-error.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-filename.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-filename.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp174
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp96
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-icycle.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-icycle.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp34
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inheritance.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inheritance.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-break.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-break.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp38
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp38
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp38
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-header-lbls.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-header.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-header.h2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp146
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-param-main.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-param.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-small-func-lbls.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp38
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.h2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp44
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-with-lexical-scope.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inline-with-lexical-scope.exp64
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error-2.exp14
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error.exp18
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inter-cu-forth-and-back.exp22
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-inter-cu-symbol.exp36
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-intercu.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-intercu.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-intermix.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-intermix.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp22
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-is-stmt.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp28
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.exp24
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp24
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-lines.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-lines.exp32
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust-main.cc2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-main-no-line-number.exp12
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S8
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-multiple-debug-info.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-multiple-debug-info.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-namespaceless-anonymous.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-namespaceless-anonymous.exp24
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-no-code-cu.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-no-code-cu.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-noloc.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-noloc.exp192
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-inner.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-outer.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-op-call.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-op-call.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-op-out-param.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-op-out-param.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-op-stack-value.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-op-stack-value.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp118
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp18
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-param-error-main.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-param-error.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-param-error.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-producer.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-producer.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp24
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-prologue-end.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp22
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-2.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-3.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-base.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp26
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-func-hi-cold.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-func-lo-cold.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp74
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp14
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning-main.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning.exp42
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp42
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-func.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-main.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-regno-invalid.exp24
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-restore.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-restore.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-restrict.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-restrict.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-restrict.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.S8
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp12
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-skipped-line-entries.exp12
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.exp68
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.exp48
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp18
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-strp.S8
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-strp.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp16
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp8
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5-2.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-unexpected-entry-pc.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-unexpected-entry-pc.exp52
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-unresolved-main.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-unresolved.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-unresolved.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-unspecified-type-foo.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp38
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.exp50
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp54
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp8
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp14
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-weird-type-len.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-weird-type-len.exp52
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-wrong-mangled-name.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-wrong-mangled-name.exp24
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-zero-range-shlib.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-zero-range.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp25
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.cc2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.cc2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dwp-sepdebug.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dwp-sepdebug.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/dwp-symlink.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dwp-symlink.exp16
-rw-r--r--gdb/testsuite/gdb.dwarf2/dwz-unused-pu.exp20
-rw-r--r--gdb/testsuite/gdb.dwarf2/dwz.exp48
-rw-r--r--gdb/testsuite/gdb.dwarf2/dwzbuildid.exp161
-rw-r--r--gdb/testsuite/gdb.dwarf2/dwzbuildid.tcl188
-rw-r--r--gdb/testsuite/gdb.dwarf2/dwzbuildid5.exp (renamed from gdb/testsuite/gdb.testsuite/lmap.exp)11
-rw-r--r--gdb/testsuite/gdb.dwarf2/dwznolink.exp14
-rw-r--r--gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.exp68
-rw-r--r--gdb/testsuite/gdb.dwarf2/dynamic-bit-offset.exp96
-rw-r--r--gdb/testsuite/gdb.dwarf2/dynarr-ptr.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp140
-rw-r--r--gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp28
-rw-r--r--gdb/testsuite/gdb.dwarf2/entry-value-typedef-aarch64.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/entry-value-typedef-amd64.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/entry-value-typedef.cpp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/entry-value-typedef.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/enum-type-c++.cc2
-rw-r--r--gdb/testsuite/gdb.dwarf2/enum-type-c++.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/enum-type.exp72
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp68
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-base.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-base.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-base.exp14
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-dw-form-strx.exp88
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-loclists-pie.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp15
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-loclists.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-loclists.exp14
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-mix-2.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-mix.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-mix.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-mix.h2
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-multi-cu.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp98
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-relative-dwo.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp68
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-reread.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-reread.exp8
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-with-type-unit.c23
-rw-r--r--gdb/testsuite/gdb.dwarf2/fission-with-type-unit.exp109
-rw-r--r--gdb/testsuite/gdb.dwarf2/formdata16.exp34
-rw-r--r--gdb/testsuite/gdb.dwarf2/fortran-var-string.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/fortran-var-string.exp98
-rw-r--r--gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp32
-rw-r--r--gdb/testsuite/gdb.dwarf2/forward-spec.exp28
-rw-r--r--gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp52
-rw-r--r--gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp5
-rw-r--r--gdb/testsuite/gdb.dwarf2/gdb-add-index.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/gdb-index-tilde.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp8
-rw-r--r--gdb/testsuite/gdb.dwarf2/gdb-index.exp14
-rw-r--r--gdb/testsuite/gdb.dwarf2/implptr-64bit.exp78
-rw-r--r--gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp54
-rw-r--r--gdb/testsuite/gdb.dwarf2/implptr.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/implptr.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/implptrconst.exp52
-rw-r--r--gdb/testsuite/gdb.dwarf2/implptrpiece.exp78
-rw-r--r--gdb/testsuite/gdb.dwarf2/implref-array.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/implref-array.exp56
-rw-r--r--gdb/testsuite/gdb.dwarf2/implref-const.exp42
-rw-r--r--gdb/testsuite/gdb.dwarf2/implref-global.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/implref-global.exp44
-rw-r--r--gdb/testsuite/gdb.dwarf2/implref-struct.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/implref-struct.exp76
-rw-r--r--gdb/testsuite/gdb.dwarf2/imported-unit-abstract-const-value.exp36
-rw-r--r--gdb/testsuite/gdb.dwarf2/imported-unit-bp-alt.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/imported-unit-bp-c++.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/imported-unit-bp-c.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/imported-unit-bp-main.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl34
-rw-r--r--gdb/testsuite/gdb.dwarf2/imported-unit-c.exp60
-rw-r--r--gdb/testsuite/gdb.dwarf2/imported-unit-runto-main.exp30
-rw-r--r--gdb/testsuite/gdb.dwarf2/imported-unit.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/imported-unit.exp64
-rw-r--r--gdb/testsuite/gdb.dwarf2/index.cc2
-rw-r--r--gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp28
-rw-r--r--gdb/testsuite/gdb.dwarf2/inline.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/inline.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/inlined_subroutine-inheritance.exp124
-rw-r--r--gdb/testsuite/gdb.dwarf2/intbits.c5
-rw-r--r--gdb/testsuite/gdb.dwarf2/intbits.exp198
-rw-r--r--gdb/testsuite/gdb.dwarf2/loc-sec-offset.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/loc-sec-offset.exp26
-rw-r--r--gdb/testsuite/gdb.dwarf2/local-var.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/local-var.f902
-rw-r--r--gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp111
-rw-r--r--gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h2
-rw-r--r--gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp28
-rw-r--r--gdb/testsuite/gdb.dwarf2/loclists-sec-offset.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/loclists-sec-offset.exp76
-rw-r--r--gdb/testsuite/gdb.dwarf2/loclists-start-end.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/loclists-start-end.exp28
-rw-r--r--gdb/testsuite/gdb.dwarf2/mac-fileno.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/mac-fileno.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/macro-complaints.exp18
-rw-r--r--gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw4.exp75
-rw-r--r--gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw5.exp79
-rw-r--r--gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld234-dw5.exp74
-rw-r--r--gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw4.exp74
-rw-r--r--gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw5.exp85
-rw-r--r--gdb/testsuite/gdb.dwarf2/macro-source-path.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/macro-source-path.exp407
-rw-r--r--gdb/testsuite/gdb.dwarf2/macro-source-path.exp.tcl161
-rw-r--r--gdb/testsuite/gdb.dwarf2/main-foo.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/main-subprogram.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/main-subprogram.exp26
-rw-r--r--gdb/testsuite/gdb.dwarf2/main.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/mega-enum.exp22
-rw-r--r--gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/method-ptr.cc2
-rw-r--r--gdb/testsuite/gdb.dwarf2/method-ptr.exp40
-rw-r--r--gdb/testsuite/gdb.dwarf2/missing-line-table.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/missing-line-table.exp20
-rw-r--r--gdb/testsuite/gdb.dwarf2/missing-sig-type.exp12
-rw-r--r--gdb/testsuite/gdb.dwarf2/missing-type-name-for-templates.cc2
-rw-r--r--gdb/testsuite/gdb.dwarf2/missing-type-name-for-templates.exp92
-rw-r--r--gdb/testsuite/gdb.dwarf2/missing-type-name.exp56
-rw-r--r--gdb/testsuite/gdb.dwarf2/multidictionary.exp90
-rw-r--r--gdb/testsuite/gdb.dwarf2/nameless-enum.exp20
-rw-r--r--gdb/testsuite/gdb.dwarf2/negative-data-member-location.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/negative-data-member-location.exp32
-rw-r--r--gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/nonvar-access.exp188
-rw-r--r--gdb/testsuite/gdb.dwarf2/nostaticblock.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/nullptr_t.cc2
-rw-r--r--gdb/testsuite/gdb.dwarf2/nullptr_t.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/opaque-type-lookup-2.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/opaque-type-lookup.exp110
-rw-r--r--gdb/testsuite/gdb.dwarf2/opt-out-not-implptr.exp50
-rw-r--r--gdb/testsuite/gdb.dwarf2/per-bfd-sharing.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/pieces-optimized-out.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/pieces-optimized-out.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/pieces.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/pieces.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/pieces.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/pr10770.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/pr11465.S8
-rw-r--r--gdb/testsuite/gdb.dwarf2/pr11465.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/pr13961.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/pr13961.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/rnglists-multiple-cus.exp10
-rw-r--r--gdb/testsuite/gdb.dwarf2/rnglists-sec-offset.exp22
-rw-r--r--gdb/testsuite/gdb.dwarf2/rust-enum.exp66
-rw-r--r--gdb/testsuite/gdb.dwarf2/self-spec.exp18
-rw-r--r--gdb/testsuite/gdb.dwarf2/short-build-id.exp18
-rw-r--r--gdb/testsuite/gdb.dwarf2/shortpiece.exp76
-rw-r--r--gdb/testsuite/gdb.dwarf2/static-optimized-out.exp16
-rw-r--r--gdb/testsuite/gdb.dwarf2/staticvirtual.exp24
-rw-r--r--gdb/testsuite/gdb.dwarf2/struct-decl.exp24
-rw-r--r--gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp54
-rw-r--r--gdb/testsuite/gdb.dwarf2/struct-with-sig.exp56
-rw-r--r--gdb/testsuite/gdb.dwarf2/subrange-enum.exp44
-rw-r--r--gdb/testsuite/gdb.dwarf2/subrange.exp60
-rw-r--r--gdb/testsuite/gdb.dwarf2/symbol_needs_eval.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/symbol_needs_eval_fail.exp26
-rw-r--r--gdb/testsuite/gdb.dwarf2/symbol_needs_eval_timeout.exp42
-rw-r--r--gdb/testsuite/gdb.dwarf2/symtab-producer.exp44
-rw-r--r--gdb/testsuite/gdb.dwarf2/template-specification-full-name.exp22
-rw-r--r--gdb/testsuite/gdb.dwarf2/trace-crash.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/typeddwarf-amd64.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/typeddwarf.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/typeddwarf.exp6
-rw-r--r--gdb/testsuite/gdb.dwarf2/typedef-void-finish.exp30
-rw-r--r--gdb/testsuite/gdb.dwarf2/utf-rust.exp22
-rw-r--r--gdb/testsuite/gdb.dwarf2/valop.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/valop.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/var-access.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/var-access.exp218
-rw-r--r--gdb/testsuite/gdb.dwarf2/variant.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/variant.exp132
-rw-r--r--gdb/testsuite/gdb.dwarf2/varval.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/varval.exp254
-rw-r--r--gdb/testsuite/gdb.dwarf2/void-type.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/void-type.exp60
-rw-r--r--gdb/testsuite/gdb.dwarf2/watch-notconst.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/watch-notconst.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/watch-notconst2.S2
-rw-r--r--gdb/testsuite/gdb.dwarf2/watch-notconst2.c2
-rw-r--r--gdb/testsuite/gdb.fortran/allocated.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/allocated.f902
-rw-r--r--gdb/testsuite/gdb.fortran/array-bounds-high.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/array-bounds-high.f902
-rw-r--r--gdb/testsuite/gdb.fortran/array-bounds.exp6
-rw-r--r--gdb/testsuite/gdb.fortran/array-bounds.f902
-rw-r--r--gdb/testsuite/gdb.fortran/array-element.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/array-element.f2
-rw-r--r--gdb/testsuite/gdb.fortran/array-indices.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/array-no-bounds.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/array-no-bounds.f902
-rw-r--r--gdb/testsuite/gdb.fortran/array-repeat.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/array-repeat.f902
-rw-r--r--gdb/testsuite/gdb.fortran/array-slices-bad.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/array-slices-bad.f902
-rw-r--r--gdb/testsuite/gdb.fortran/array-slices-repeat.f902
-rw-r--r--gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp8
-rw-r--r--gdb/testsuite/gdb.fortran/array-slices-sub-slices.f902
-rw-r--r--gdb/testsuite/gdb.fortran/array-slices.exp8
-rw-r--r--gdb/testsuite/gdb.fortran/array-slices.f902
-rw-r--r--gdb/testsuite/gdb.fortran/associated.exp6
-rw-r--r--gdb/testsuite/gdb.fortran/associated.f902
-rw-r--r--gdb/testsuite/gdb.fortran/assumedrank.exp6
-rw-r--r--gdb/testsuite/gdb.fortran/assumedrank.f902
-rw-r--r--gdb/testsuite/gdb.fortran/backtrace.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/backtrace.f902
-rw-r--r--gdb/testsuite/gdb.fortran/block-data.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/block-data.f2
-rw-r--r--gdb/testsuite/gdb.fortran/call-no-debug-func.f902
-rw-r--r--gdb/testsuite/gdb.fortran/call-no-debug-prog.f902
-rw-r--r--gdb/testsuite/gdb.fortran/call-no-debug.exp6
-rw-r--r--gdb/testsuite/gdb.fortran/charset.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/class-allocatable-array.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/class-allocatable-array.f902
-rw-r--r--gdb/testsuite/gdb.fortran/common-block.exp6
-rw-r--r--gdb/testsuite/gdb.fortran/common-block.f902
-rw-r--r--gdb/testsuite/gdb.fortran/completion.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/completion.f902
-rw-r--r--gdb/testsuite/gdb.fortran/complex.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/complex.f902
-rw-r--r--gdb/testsuite/gdb.fortran/debug-expr.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/debug-expr.f902
-rw-r--r--gdb/testsuite/gdb.fortran/derived-type-function.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/derived-type-function.f902
-rw-r--r--gdb/testsuite/gdb.fortran/derived-type-striding.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/derived-type-striding.f902
-rw-r--r--gdb/testsuite/gdb.fortran/derived-type.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/derived-type.f902
-rw-r--r--gdb/testsuite/gdb.fortran/dot-ops.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/dynamic-ptype-whatis.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/dynamic-ptype-whatis.f902
-rw-r--r--gdb/testsuite/gdb.fortran/empty-string.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/empty-string.f902
-rw-r--r--gdb/testsuite/gdb.fortran/entry-point.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/entry-point.f902
-rw-r--r--gdb/testsuite/gdb.fortran/exprs.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/function-calls.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/function-calls.f902
-rw-r--r--gdb/testsuite/gdb.fortran/huge.F902
-rw-r--r--gdb/testsuite/gdb.fortran/huge.exp12
-rw-r--r--gdb/testsuite/gdb.fortran/info-main.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/info-main.f902
-rw-r--r--gdb/testsuite/gdb.fortran/info-modules.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/info-types-2.f902
-rw-r--r--gdb/testsuite/gdb.fortran/info-types.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/info-types.f902
-rw-r--r--gdb/testsuite/gdb.fortran/intrinsic-precedence.c2
-rw-r--r--gdb/testsuite/gdb.fortran/intrinsic-precedence.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/intrinsic-precedence.f902
-rw-r--r--gdb/testsuite/gdb.fortran/intrinsics.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/intrinsics.f902
-rw-r--r--gdb/testsuite/gdb.fortran/intvar-array.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/intvar-array.f902
-rw-r--r--gdb/testsuite/gdb.fortran/intvar-dynamic-types.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/intvar-dynamic-types.f902
-rw-r--r--gdb/testsuite/gdb.fortran/lbound-ubound.F902
-rw-r--r--gdb/testsuite/gdb.fortran/lbound-ubound.exp8
-rw-r--r--gdb/testsuite/gdb.fortran/library-module-lib.f902
-rw-r--r--gdb/testsuite/gdb.fortran/library-module-main.f902
-rw-r--r--gdb/testsuite/gdb.fortran/library-module.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/limited-length.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/limited-length.f902
-rw-r--r--gdb/testsuite/gdb.fortran/logical.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/logical.f902
-rw-r--r--gdb/testsuite/gdb.fortran/max-depth.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/max-depth.f902
-rw-r--r--gdb/testsuite/gdb.fortran/mixed-lang-stack.c2
-rw-r--r--gdb/testsuite/gdb.fortran/mixed-lang-stack.cpp2
-rw-r--r--gdb/testsuite/gdb.fortran/mixed-lang-stack.exp8
-rw-r--r--gdb/testsuite/gdb.fortran/mixed-lang-stack.f902
-rw-r--r--gdb/testsuite/gdb.fortran/module.exp6
-rw-r--r--gdb/testsuite/gdb.fortran/module.f902
-rw-r--r--gdb/testsuite/gdb.fortran/multi-dim.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/multi-dim.f902
-rw-r--r--gdb/testsuite/gdb.fortran/namelist.exp6
-rw-r--r--gdb/testsuite/gdb.fortran/namelist.f902
-rw-r--r--gdb/testsuite/gdb.fortran/nested-funcs-2.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/nested-funcs-2.f902
-rwxr-xr-xgdb/testsuite/gdb.fortran/nested-funcs.exp4
-rwxr-xr-xgdb/testsuite/gdb.fortran/nested-funcs.f902
-rwxr-xr-xgdb/testsuite/gdb.fortran/oop_extend_type.exp4
-rwxr-xr-xgdb/testsuite/gdb.fortran/oop_extend_type.f902
-rw-r--r--gdb/testsuite/gdb.fortran/pointer-to-pointer.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/pointer-to-pointer.f902
-rw-r--r--gdb/testsuite/gdb.fortran/pointers.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/pointers.f902
-rw-r--r--gdb/testsuite/gdb.fortran/print-formatted.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/print-formatted.f902
-rwxr-xr-xgdb/testsuite/gdb.fortran/print_type.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/printing-types.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/printing-types.f902
-rw-r--r--gdb/testsuite/gdb.fortran/ptr-indentation.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/ptr-indentation.f902
-rw-r--r--gdb/testsuite/gdb.fortran/ptype-on-functions.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/ptype-on-functions.f902
-rw-r--r--gdb/testsuite/gdb.fortran/rank.exp6
-rw-r--r--gdb/testsuite/gdb.fortran/rank.f902
-rw-r--r--gdb/testsuite/gdb.fortran/shape.exp6
-rw-r--r--gdb/testsuite/gdb.fortran/shape.f902
-rw-r--r--gdb/testsuite/gdb.fortran/short-circuit-argument-list.exp10
-rw-r--r--gdb/testsuite/gdb.fortran/short-circuit-argument-list.f902
-rw-r--r--gdb/testsuite/gdb.fortran/size.exp6
-rw-r--r--gdb/testsuite/gdb.fortran/size.f902
-rw-r--r--gdb/testsuite/gdb.fortran/sizeof.exp6
-rw-r--r--gdb/testsuite/gdb.fortran/sizeof.f902
-rw-r--r--gdb/testsuite/gdb.fortran/string-types.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/string-types.f902
-rw-r--r--gdb/testsuite/gdb.fortran/subarray.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/subarray.f2
-rw-r--r--gdb/testsuite/gdb.fortran/type-kinds.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/type.f902
-rw-r--r--gdb/testsuite/gdb.fortran/types.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/vla-array.exp8
-rw-r--r--gdb/testsuite/gdb.fortran/vla-array.f902
-rw-r--r--gdb/testsuite/gdb.fortran/vla-datatypes.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/vla-datatypes.f902
-rw-r--r--gdb/testsuite/gdb.fortran/vla-history.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/vla-ptr-info.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/vla-ptype-sub.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/vla-ptype.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/vla-sizeof.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/vla-sub.f902
-rwxr-xr-xgdb/testsuite/gdb.fortran/vla-type.exp2
-rwxr-xr-xgdb/testsuite/gdb.fortran/vla-type.f902
-rw-r--r--gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/vla-value-sub.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/vla-value.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/vla.f902
-rw-r--r--gdb/testsuite/gdb.fortran/whatis_type.exp4
-rw-r--r--gdb/testsuite/gdb.gdb/index-file.exp18
-rw-r--r--gdb/testsuite/gdb.gdb/python-helper.cc2
-rw-r--r--gdb/testsuite/gdb.gdb/python-helper.exp24
-rw-r--r--gdb/testsuite/gdb.gdb/selftest.exp10
-rw-r--r--gdb/testsuite/gdb.gdb/unittest.c2
-rw-r--r--gdb/testsuite/gdb.gdb/unittest.exp6
-rw-r--r--gdb/testsuite/gdb.go/basic-types.exp6
-rw-r--r--gdb/testsuite/gdb.go/chan.exp2
-rw-r--r--gdb/testsuite/gdb.go/global-local-var-shadow.exp2
-rw-r--r--gdb/testsuite/gdb.go/handcall.exp2
-rw-r--r--gdb/testsuite/gdb.go/hello.exp2
-rw-r--r--gdb/testsuite/gdb.go/integers.exp6
-rw-r--r--gdb/testsuite/gdb.go/max-depth.exp2
-rw-r--r--gdb/testsuite/gdb.go/max-depth.go2
-rw-r--r--gdb/testsuite/gdb.go/methods.exp2
-rw-r--r--gdb/testsuite/gdb.go/no-package.exp2
-rw-r--r--gdb/testsuite/gdb.go/package.exp4
-rw-r--r--gdb/testsuite/gdb.go/print.exp4
-rw-r--r--gdb/testsuite/gdb.go/strings.exp2
-rw-r--r--gdb/testsuite/gdb.go/types.exp2
-rw-r--r--gdb/testsuite/gdb.go/unsafe.exp2
-rw-r--r--gdb/testsuite/gdb.guile/guile.exp2
-rw-r--r--gdb/testsuite/gdb.guile/scm-arch.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-arch.exp4
-rw-r--r--gdb/testsuite/gdb.guile/scm-block.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-block.exp4
-rw-r--r--gdb/testsuite/gdb.guile/scm-breakpoint.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-breakpoint.exp30
-rw-r--r--gdb/testsuite/gdb.guile/scm-cmd.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-cmd.exp63
-rw-r--r--gdb/testsuite/gdb.guile/scm-color.exp13
-rw-r--r--gdb/testsuite/gdb.guile/scm-disasm.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-disasm.exp4
-rw-r--r--gdb/testsuite/gdb.guile/scm-equal.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-equal.exp4
-rw-r--r--gdb/testsuite/gdb.guile/scm-error-1.scm2
-rw-r--r--gdb/testsuite/gdb.guile/scm-error-2.scm2
-rw-r--r--gdb/testsuite/gdb.guile/scm-error.exp2
-rw-r--r--gdb/testsuite/gdb.guile/scm-frame-args.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-frame-args.exp4
-rw-r--r--gdb/testsuite/gdb.guile/scm-frame-args.scm2
-rw-r--r--gdb/testsuite/gdb.guile/scm-frame-inline.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-frame-inline.exp4
-rw-r--r--gdb/testsuite/gdb.guile/scm-frame.exp6
-rw-r--r--gdb/testsuite/gdb.guile/scm-gsmob.exp2
-rw-r--r--gdb/testsuite/gdb.guile/scm-iterator.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-iterator.exp4
-rw-r--r--gdb/testsuite/gdb.guile/scm-lazy-string.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-lazy-string.exp4
-rw-r--r--gdb/testsuite/gdb.guile/scm-math.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-math.exp12
-rw-r--r--gdb/testsuite/gdb.guile/scm-objfile-script-gdb.in2
-rw-r--r--gdb/testsuite/gdb.guile/scm-objfile-script.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-objfile-script.exp4
-rw-r--r--gdb/testsuite/gdb.guile/scm-objfile.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-objfile.exp4
-rw-r--r--gdb/testsuite/gdb.guile/scm-parameter.exp283
-rw-r--r--gdb/testsuite/gdb.guile/scm-ports.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-ports.exp8
-rw-r--r--gdb/testsuite/gdb.guile/scm-pretty-print.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-pretty-print.exp11
-rw-r--r--gdb/testsuite/gdb.guile/scm-pretty-print.scm2
-rw-r--r--gdb/testsuite/gdb.guile/scm-progspace.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-progspace.exp2
-rw-r--r--gdb/testsuite/gdb.guile/scm-section-script.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-section-script.exp4
-rw-r--r--gdb/testsuite/gdb.guile/scm-section-script.scm2
-rw-r--r--gdb/testsuite/gdb.guile/scm-symbol.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-symbol.exp10
-rw-r--r--gdb/testsuite/gdb.guile/scm-symtab-2.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-symtab.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-symtab.exp6
-rw-r--r--gdb/testsuite/gdb.guile/scm-type.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-type.exp11
-rw-r--r--gdb/testsuite/gdb.guile/scm-value-cc.cc2
-rw-r--r--gdb/testsuite/gdb.guile/scm-value-cc.exp4
-rw-r--r--gdb/testsuite/gdb.guile/scm-value.c2
-rw-r--r--gdb/testsuite/gdb.guile/scm-value.exp13
-rw-r--r--gdb/testsuite/gdb.guile/source2.scm2
-rw-r--r--gdb/testsuite/gdb.guile/types-module.cc2
-rw-r--r--gdb/testsuite/gdb.guile/types-module.exp4
-rw-r--r--gdb/testsuite/gdb.linespec/3explicit.c2
-rw-r--r--gdb/testsuite/gdb.linespec/base/one/header.h2
-rw-r--r--gdb/testsuite/gdb.linespec/base/two/header.h2
-rw-r--r--gdb/testsuite/gdb.linespec/break-ask.exp2
-rw-r--r--gdb/testsuite/gdb.linespec/break-asm-file.c2
-rw-r--r--gdb/testsuite/gdb.linespec/break-asm-file.exp2
-rw-r--r--gdb/testsuite/gdb.linespec/break-asm-file0.S2
-rw-r--r--gdb/testsuite/gdb.linespec/break-asm-file1.S2
-rw-r--r--gdb/testsuite/gdb.linespec/cp-completion-aliases.cc2
-rw-r--r--gdb/testsuite/gdb.linespec/cp-completion-aliases.exp2
-rw-r--r--gdb/testsuite/gdb.linespec/cp-replace-typedefs-ns-template.cc2
-rw-r--r--gdb/testsuite/gdb.linespec/cp-replace-typedefs-ns-template.exp6
-rw-r--r--gdb/testsuite/gdb.linespec/cpcompletion.cc2
-rw-r--r--gdb/testsuite/gdb.linespec/cpcompletion.exp8
-rw-r--r--gdb/testsuite/gdb.linespec/cpexplicit.cc2
-rw-r--r--gdb/testsuite/gdb.linespec/cpexplicit.exp2
-rw-r--r--gdb/testsuite/gdb.linespec/cpls-abi-tag.cc2
-rw-r--r--gdb/testsuite/gdb.linespec/cpls-abi-tag.exp4
-rw-r--r--gdb/testsuite/gdb.linespec/cpls-hyphen.cc2
-rw-r--r--gdb/testsuite/gdb.linespec/cpls-ops.cc2
-rw-r--r--gdb/testsuite/gdb.linespec/cpls-ops.exp2
-rw-r--r--gdb/testsuite/gdb.linespec/cpls.cc2
-rw-r--r--gdb/testsuite/gdb.linespec/cpls2.cc2
-rw-r--r--gdb/testsuite/gdb.linespec/errors.exp2
-rw-r--r--gdb/testsuite/gdb.linespec/explicit.c2
-rw-r--r--gdb/testsuite/gdb.linespec/explicit.exp4
-rw-r--r--gdb/testsuite/gdb.linespec/explicit2.c2
-rw-r--r--gdb/testsuite/gdb.linespec/keywords.c2
-rw-r--r--gdb/testsuite/gdb.linespec/keywords.exp4
-rw-r--r--gdb/testsuite/gdb.linespec/line-breakpoint-outside-function.c2
-rw-r--r--gdb/testsuite/gdb.linespec/line-breakpoint-outside-function.exp4
-rw-r--r--gdb/testsuite/gdb.linespec/linespec.exp8
-rw-r--r--gdb/testsuite/gdb.linespec/ls-dollar.cc2
-rw-r--r--gdb/testsuite/gdb.linespec/ls-dollar.exp2
-rw-r--r--gdb/testsuite/gdb.linespec/ls-errs.c2
-rw-r--r--gdb/testsuite/gdb.linespec/ls-errs.exp9
-rw-r--r--gdb/testsuite/gdb.linespec/lspec.cc2
-rw-r--r--gdb/testsuite/gdb.linespec/macro-relative.c2
-rw-r--r--gdb/testsuite/gdb.linespec/macro-relative.exp4
-rw-r--r--gdb/testsuite/gdb.linespec/skip-two.exp6
-rw-r--r--gdb/testsuite/gdb.linespec/thread.c2
-rw-r--r--gdb/testsuite/gdb.linespec/thread.exp4
-rw-r--r--gdb/testsuite/gdb.mi/array.f902
-rw-r--r--gdb/testsuite/gdb.mi/basics.c2
-rw-r--r--gdb/testsuite/gdb.mi/dw2-ref-missing-frame-func.c2
-rw-r--r--gdb/testsuite/gdb.mi/dw2-ref-missing-frame-main.c2
-rw-r--r--gdb/testsuite/gdb.mi/dw2-ref-missing-frame.S2
-rw-r--r--gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp10
-rw-r--r--gdb/testsuite/gdb.mi/gdb2549.exp4
-rw-r--r--gdb/testsuite/gdb.mi/gdb669.exp4
-rw-r--r--gdb/testsuite/gdb.mi/gdb680.exp4
-rw-r--r--gdb/testsuite/gdb.mi/gdb701.exp4
-rw-r--r--gdb/testsuite/gdb.mi/gdb792.exp6
-rw-r--r--gdb/testsuite/gdb.mi/interrupt-thread-group.c2
-rw-r--r--gdb/testsuite/gdb.mi/interrupt-thread-group.exp6
-rw-r--r--gdb/testsuite/gdb.mi/list-thread-groups-available.c2
-rw-r--r--gdb/testsuite/gdb.mi/list-thread-groups-available.exp4
-rw-r--r--gdb/testsuite/gdb.mi/list-thread-groups-no-inferior.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-add-inferior.exp44
-rw-r--r--gdb/testsuite/gdb.mi/mi-async-run.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-async-run.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-async.exp8
-rw-r--r--gdb/testsuite/gdb.mi/mi-basics.exp24
-rw-r--r--gdb/testsuite/gdb.mi/mi-break-qualified.cc2
-rw-r--r--gdb/testsuite/gdb.mi/mi-break-qualified.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-break.exp20
-rw-r--r--gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp8
-rw-r--r--gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.cc2
-rw-r--r--gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp8
-rw-r--r--gdb/testsuite/gdb.mi/mi-breakpoint-script.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-breakpoint-script.exp8
-rw-r--r--gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc2
-rw-r--r--gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp8
-rw-r--r--gdb/testsuite/gdb.mi/mi-catch-load-so.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-catch-load.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-catch-load.exp6
-rw-r--r--gdb/testsuite/gdb.mi/mi-cli.exp18
-rw-r--r--gdb/testsuite/gdb.mi/mi-cmd-error.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-cmd-user-context.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-cmd-user-context.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-complete.cc2
-rw-r--r--gdb/testsuite/gdb.mi/mi-complete.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state-mt.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state-st.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-condbreak-fail.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-condbreak-fail.exp6
-rw-r--r--gdb/testsuite/gdb.mi/mi-condbreak-throw.cc2
-rw-r--r--gdb/testsuite/gdb.mi/mi-condbreak-throw.exp8
-rw-r--r--gdb/testsuite/gdb.mi/mi-console.exp6
-rw-r--r--gdb/testsuite/gdb.mi/mi-corefile.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-corefile.exp5
-rw-r--r--gdb/testsuite/gdb.mi/mi-detach.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-disassemble.exp24
-rw-r--r--gdb/testsuite/gdb.mi/mi-dlmopen.exp20
-rw-r--r--gdb/testsuite/gdb.mi/mi-dprintf-modified.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-dprintf-pending.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-dprintf-pending.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-dprintf-pendshr.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-dprintf.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-dprintf.exp10
-rw-r--r--gdb/testsuite/gdb.mi/mi-editing.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-eval.exp8
-rw-r--r--gdb/testsuite/gdb.mi/mi-exec-run.exp9
-rw-r--r--gdb/testsuite/gdb.mi/mi-exit-code.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-exit-code.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-file-transfer.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-file.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-fill-memory.exp6
-rw-r--r--gdb/testsuite/gdb.mi/mi-fortran-modules-2.f902
-rw-r--r--gdb/testsuite/gdb.mi/mi-fortran-modules.exp8
-rw-r--r--gdb/testsuite/gdb.mi/mi-fortran-modules.f902
-rw-r--r--gdb/testsuite/gdb.mi/mi-frame-regs.exp10
-rw-r--r--gdb/testsuite/gdb.mi/mi-fullname-deleted.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-hack-cli.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-i-cmd.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-info-os.exp8
-rw-r--r--gdb/testsuite/gdb.mi/mi-info-sources-base.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-info-sources.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-info-sources.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-language.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-linespec-err-cp.cc2
-rw-r--r--gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-logging.exp10
-rw-r--r--gdb/testsuite/gdb.mi/mi-memory-changed.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-multi-commands.exp8
-rw-r--r--gdb/testsuite/gdb.mi/mi-nonstop-exit.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-nonstop.exp8
-rw-r--r--gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-nsintrall.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-nsmoribund.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-nsthrexec.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-pending.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-pending.exp6
-rw-r--r--gdb/testsuite/gdb.mi/mi-pendshr.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-pendshr2.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-pthreads.exp6
-rw-r--r--gdb/testsuite/gdb.mi/mi-py-modify-bp.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-py-modify-bp.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-py-modify-bp.py2
-rw-r--r--gdb/testsuite/gdb.mi/mi-read-memory.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-record-changed.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-reg-undefined.S2
-rw-r--r--gdb/testsuite/gdb.mi/mi-reg-undefined.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-reg-undefined.exp6
-rw-r--r--gdb/testsuite/gdb.mi/mi-regs.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-return.exp8
-rw-r--r--gdb/testsuite/gdb.mi/mi-reverse.exp30
-rw-r--r--gdb/testsuite/gdb.mi/mi-simplerun.exp26
-rw-r--r--gdb/testsuite/gdb.mi/mi-solib.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-stack.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-stack.exp6
-rw-r--r--gdb/testsuite/gdb.mi/mi-start.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-start.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-stepi.exp8
-rw-r--r--gdb/testsuite/gdb.mi/mi-stepn.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-stepn.exp6
-rw-r--r--gdb/testsuite/gdb.mi/mi-sym-info-1.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-sym-info-2.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-sym-info.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-syn-frame.exp6
-rw-r--r--gdb/testsuite/gdb.mi/mi-thread-bp-deleted.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp10
-rw-r--r--gdb/testsuite/gdb.mi/mi-thread-specific-bp.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp6
-rw-r--r--gdb/testsuite/gdb.mi/mi-threads-interrupt.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-threads-interrupt.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-undefined-cmd.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-until.exp6
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-block.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-child-f.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-child.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-child.exp40
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-cmd.exp30
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-cp.cc2
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-cp.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-create-rtti.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-create-rtti.exp6
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-display.exp12
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-invalidate-shlib-lib.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-invalidate-shlib.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-invalidate-shlib.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-invalidate.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-rtti.cc2
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-rtti.exp6
-rw-r--r--gdb/testsuite/gdb.mi/mi-vla-c99.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-vla-fortran.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-watch-nonstop.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-watch.exp14
-rw-r--r--gdb/testsuite/gdb.mi/mi2-amd64-entry-value.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp8
-rw-r--r--gdb/testsuite/gdb.mi/mi2-amd64-entry-value.s2
-rw-r--r--gdb/testsuite/gdb.mi/mi2-cli-display.c2
-rw-r--r--gdb/testsuite/gdb.mi/mi2-cli-display.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi2-prompt.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi2-var-child.exp34
-rw-r--r--gdb/testsuite/gdb.mi/new-ui-bp-deleted.c2
-rw-r--r--gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp4
-rw-r--r--gdb/testsuite/gdb.mi/new-ui-mi-sync.c2
-rw-r--r--gdb/testsuite/gdb.mi/new-ui-mi-sync.exp8
-rw-r--r--gdb/testsuite/gdb.mi/non-stop-exit.c2
-rw-r--r--gdb/testsuite/gdb.mi/non-stop.c2
-rw-r--r--gdb/testsuite/gdb.mi/ns-stale-regcache.c2
-rw-r--r--gdb/testsuite/gdb.mi/nsintrall.c2
-rw-r--r--gdb/testsuite/gdb.mi/nsmoribund.c2
-rw-r--r--gdb/testsuite/gdb.mi/nsthrexec.c2
-rw-r--r--gdb/testsuite/gdb.mi/pending.c2
-rw-r--r--gdb/testsuite/gdb.mi/pendshr1.c2
-rw-r--r--gdb/testsuite/gdb.mi/pendshr2.c2
-rw-r--r--gdb/testsuite/gdb.mi/pr11022.c2
-rw-r--r--gdb/testsuite/gdb.mi/pr11022.exp4
-rw-r--r--gdb/testsuite/gdb.mi/print-simple-values.cc2
-rw-r--r--gdb/testsuite/gdb.mi/print-simple-values.exp6
-rw-r--r--gdb/testsuite/gdb.mi/pthreads.c2
-rw-r--r--gdb/testsuite/gdb.mi/run-with-two-mi-uis.exp4
-rw-r--r--gdb/testsuite/gdb.mi/set-show.exp51
-rw-r--r--gdb/testsuite/gdb.mi/solib-lib.c2
-rw-r--r--gdb/testsuite/gdb.mi/solib-main.c2
-rw-r--r--gdb/testsuite/gdb.mi/user-selected-context-sync.c2
-rw-r--r--gdb/testsuite/gdb.mi/user-selected-context-sync.exp157
-rw-r--r--gdb/testsuite/gdb.mi/var-cmd.c2
-rw-r--r--gdb/testsuite/gdb.mi/vla.c2
-rw-r--r--gdb/testsuite/gdb.mi/vla.f902
-rw-r--r--gdb/testsuite/gdb.mi/watch-nonstop.c2
-rw-r--r--gdb/testsuite/gdb.modula2/builtin-procedure-adr.exp2
-rw-r--r--gdb/testsuite/gdb.modula2/max-depth.c2
-rw-r--r--gdb/testsuite/gdb.modula2/max-depth.exp2
-rw-r--r--gdb/testsuite/gdb.modula2/multidim.c2
-rw-r--r--gdb/testsuite/gdb.modula2/multidim.exp2
-rw-r--r--gdb/testsuite/gdb.modula2/unbounded-array.exp2
-rw-r--r--gdb/testsuite/gdb.modula2/unbounded1.c2
-rw-r--r--gdb/testsuite/gdb.multi/attach-no-multi-process.c2
-rw-r--r--gdb/testsuite/gdb.multi/attach-no-multi-process.exp9
-rw-r--r--gdb/testsuite/gdb.multi/attach-while-running.c2
-rw-r--r--gdb/testsuite/gdb.multi/attach-while-running.exp7
-rw-r--r--gdb/testsuite/gdb.multi/base.exp2
-rw-r--r--gdb/testsuite/gdb.multi/bkpt-multi-exec.exp2
-rw-r--r--gdb/testsuite/gdb.multi/bp-thread-specific.c2
-rw-r--r--gdb/testsuite/gdb.multi/bp-thread-specific.exp4
-rw-r--r--gdb/testsuite/gdb.multi/checkpoint-multi.exp6
-rw-r--r--gdb/testsuite/gdb.multi/dummy-frame-restore.c2
-rw-r--r--gdb/testsuite/gdb.multi/dummy-frame-restore.exp4
-rw-r--r--gdb/testsuite/gdb.multi/gdb-settings.c2
-rw-r--r--gdb/testsuite/gdb.multi/gdb-settings.exp17
-rw-r--r--gdb/testsuite/gdb.multi/goodbye.c2
-rw-r--r--gdb/testsuite/gdb.multi/hangout.c2
-rw-r--r--gdb/testsuite/gdb.multi/hello.c2
-rw-r--r--gdb/testsuite/gdb.multi/inferior-specific-bp-1.c2
-rw-r--r--gdb/testsuite/gdb.multi/inferior-specific-bp-2.c2
-rw-r--r--gdb/testsuite/gdb.multi/inferior-specific-bp.exp10
-rw-r--r--gdb/testsuite/gdb.multi/info-threads.exp2
-rw-r--r--gdb/testsuite/gdb.multi/interrupt-bg-exec.c47
-rw-r--r--gdb/testsuite/gdb.multi/interrupt-bg-exec.exp143
-rw-r--r--gdb/testsuite/gdb.multi/multi-arch-exec.c2
-rw-r--r--gdb/testsuite/gdb.multi/multi-arch-exec.exp8
-rw-r--r--gdb/testsuite/gdb.multi/multi-arch.exp14
-rw-r--r--gdb/testsuite/gdb.multi/multi-attach.c2
-rw-r--r--gdb/testsuite/gdb.multi/multi-attach.exp4
-rw-r--r--gdb/testsuite/gdb.multi/multi-core-files-1.c37
-rw-r--r--gdb/testsuite/gdb.multi/multi-core-files-2.c31
-rw-r--r--gdb/testsuite/gdb.multi/multi-core-files.exp171
-rw-r--r--gdb/testsuite/gdb.multi/multi-exit.c2
-rw-r--r--gdb/testsuite/gdb.multi/multi-exit.exp6
-rw-r--r--gdb/testsuite/gdb.multi/multi-kill.c2
-rw-r--r--gdb/testsuite/gdb.multi/multi-kill.exp6
-rw-r--r--gdb/testsuite/gdb.multi/multi-re-run-1.c2
-rw-r--r--gdb/testsuite/gdb.multi/multi-re-run-2.c2
-rw-r--r--gdb/testsuite/gdb.multi/multi-re-run.exp20
-rw-r--r--gdb/testsuite/gdb.multi/multi-remote-target.c71
-rw-r--r--gdb/testsuite/gdb.multi/multi-remote-target.exp89
-rw-r--r--gdb/testsuite/gdb.multi/multi-target-continue.exp2
-rw-r--r--gdb/testsuite/gdb.multi/multi-target-info-inferiors.exp8
-rw-r--r--gdb/testsuite/gdb.multi/multi-target-info-inferiors.py2
-rw-r--r--gdb/testsuite/gdb.multi/multi-target-interrupt.exp2
-rw-r--r--gdb/testsuite/gdb.multi/multi-target-no-resumed.exp2
-rw-r--r--gdb/testsuite/gdb.multi/multi-target-ping-pong-next.exp2
-rw-r--r--gdb/testsuite/gdb.multi/multi-target-thread-find.exp2
-rw-r--r--gdb/testsuite/gdb.multi/multi-target.c2
-rw-r--r--gdb/testsuite/gdb.multi/multi-target.exp.tcl20
-rw-r--r--gdb/testsuite/gdb.multi/multi-term-settings.c2
-rw-r--r--gdb/testsuite/gdb.multi/multi-term-settings.exp14
-rw-r--r--gdb/testsuite/gdb.multi/pending-bp-del-inferior.c2
-rw-r--r--gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp4
-rw-r--r--gdb/testsuite/gdb.multi/pending-bp-lib.c2
-rw-r--r--gdb/testsuite/gdb.multi/pending-bp.c2
-rw-r--r--gdb/testsuite/gdb.multi/pending-bp.exp10
-rw-r--r--gdb/testsuite/gdb.multi/remote-with-running-inferior.c38
-rw-r--r--gdb/testsuite/gdb.multi/remote-with-running-inferior.exp171
-rw-r--r--gdb/testsuite/gdb.multi/remove-inferiors.c2
-rw-r--r--gdb/testsuite/gdb.multi/remove-inferiors.exp4
-rw-r--r--gdb/testsuite/gdb.multi/run-only-second-inf.c2
-rw-r--r--gdb/testsuite/gdb.multi/run-only-second-inf.exp4
-rw-r--r--gdb/testsuite/gdb.multi/sched-multi-add-inferior.exp109
-rw-r--r--gdb/testsuite/gdb.multi/start-inferior-specific-other.c2
-rw-r--r--gdb/testsuite/gdb.multi/start-inferior-specific.c2
-rw-r--r--gdb/testsuite/gdb.multi/start-inferior-specific.exp9
-rw-r--r--gdb/testsuite/gdb.multi/stop-all-on-exit.c2
-rw-r--r--gdb/testsuite/gdb.multi/stop-all-on-exit.exp4
-rw-r--r--gdb/testsuite/gdb.multi/tids-gid-reset.c2
-rw-r--r--gdb/testsuite/gdb.multi/tids-gid-reset.exp4
-rw-r--r--gdb/testsuite/gdb.multi/tids.c2
-rw-r--r--gdb/testsuite/gdb.multi/tids.exp9
-rw-r--r--gdb/testsuite/gdb.multi/watchpoint-multi-exit.c2
-rw-r--r--gdb/testsuite/gdb.multi/watchpoint-multi-exit.exp8
-rw-r--r--gdb/testsuite/gdb.multi/watchpoint-multi.c2
-rw-r--r--gdb/testsuite/gdb.multi/watchpoint-multi.exp6
-rw-r--r--gdb/testsuite/gdb.objc/basicclass.exp4
-rw-r--r--gdb/testsuite/gdb.objc/nondebug.exp4
-rw-r--r--gdb/testsuite/gdb.objc/objcdecode.exp4
-rw-r--r--gdb/testsuite/gdb.objc/print.exp4
-rw-r--r--gdb/testsuite/gdb.opencl/callfuncs.cl2
-rw-r--r--gdb/testsuite/gdb.opencl/callfuncs.exp9
-rw-r--r--gdb/testsuite/gdb.opencl/convs_casts.cl2
-rw-r--r--gdb/testsuite/gdb.opencl/convs_casts.exp2
-rw-r--r--gdb/testsuite/gdb.opencl/datatypes.cl2
-rw-r--r--gdb/testsuite/gdb.opencl/datatypes.exp2
-rw-r--r--gdb/testsuite/gdb.opencl/operators.cl2
-rw-r--r--gdb/testsuite/gdb.opencl/operators.exp2
-rw-r--r--gdb/testsuite/gdb.opencl/vec_comps.cl2
-rw-r--r--gdb/testsuite/gdb.opencl/vec_comps.exp52
-rw-r--r--gdb/testsuite/gdb.opt/break-on-_exit.c2
-rw-r--r--gdb/testsuite/gdb.opt/break-on-_exit.exp4
-rw-r--r--gdb/testsuite/gdb.opt/clobbered-registers-O2-2.c2
-rw-r--r--gdb/testsuite/gdb.opt/clobbered-registers-O2-3.c2
-rw-r--r--gdb/testsuite/gdb.opt/clobbered-registers-O2.c2
-rw-r--r--gdb/testsuite/gdb.opt/clobbered-registers-O2.exp2
-rw-r--r--gdb/testsuite/gdb.opt/fortran-string.exp2
-rw-r--r--gdb/testsuite/gdb.opt/fortran-string.f902
-rw-r--r--gdb/testsuite/gdb.opt/inline-break.c2
-rw-r--r--gdb/testsuite/gdb.opt/inline-break.exp12
-rw-r--r--gdb/testsuite/gdb.opt/inline-bt.c2
-rw-r--r--gdb/testsuite/gdb.opt/inline-bt.exp2
-rw-r--r--gdb/testsuite/gdb.opt/inline-cmds.c2
-rw-r--r--gdb/testsuite/gdb.opt/inline-cmds.exp6
-rw-r--r--gdb/testsuite/gdb.opt/inline-entry.c2
-rw-r--r--gdb/testsuite/gdb.opt/inline-entry.exp8
-rw-r--r--gdb/testsuite/gdb.opt/inline-locals.c2
-rw-r--r--gdb/testsuite/gdb.opt/inline-locals.exp2
-rw-r--r--gdb/testsuite/gdb.opt/inline-markers.c2
-rw-r--r--gdb/testsuite/gdb.opt/inline-small-func.c2
-rw-r--r--gdb/testsuite/gdb.opt/inline-small-func.exp4
-rw-r--r--gdb/testsuite/gdb.opt/inline-small-func.h2
-rw-r--r--gdb/testsuite/gdb.opt/main.c2
-rw-r--r--gdb/testsuite/gdb.opt/solib-intra-step-lib.c2
-rw-r--r--gdb/testsuite/gdb.opt/solib-intra-step-main.c2
-rw-r--r--gdb/testsuite/gdb.opt/solib-intra-step.exp4
-rw-r--r--gdb/testsuite/gdb.opt/static-optimized-out.c2
-rw-r--r--gdb/testsuite/gdb.opt/static-optimized-out.exp2
-rw-r--r--gdb/testsuite/gdb.pascal/case-insensitive-symbols.exp2
-rw-r--r--gdb/testsuite/gdb.pascal/case-insensitive-symbols.pas2
-rw-r--r--gdb/testsuite/gdb.pascal/floats.exp8
-rw-r--r--gdb/testsuite/gdb.pascal/floats.pas2
-rw-r--r--gdb/testsuite/gdb.pascal/gdb11492.exp6
-rw-r--r--gdb/testsuite/gdb.pascal/gdb11492.pas2
-rw-r--r--gdb/testsuite/gdb.pascal/hello.exp4
-rw-r--r--gdb/testsuite/gdb.pascal/integers.exp8
-rw-r--r--gdb/testsuite/gdb.pascal/integers.pas2
-rw-r--r--gdb/testsuite/gdb.pascal/print.exp4
-rw-r--r--gdb/testsuite/gdb.pascal/str-chars.exp2
-rw-r--r--gdb/testsuite/gdb.pascal/str-chars.pas2
-rw-r--r--gdb/testsuite/gdb.pascal/stub-method.exp2
-rw-r--r--gdb/testsuite/gdb.pascal/stub-method.pas2
-rw-r--r--gdb/testsuite/gdb.pascal/types.exp4
-rw-r--r--gdb/testsuite/gdb.perf/backtrace.c2
-rw-r--r--gdb/testsuite/gdb.perf/backtrace.exp6
-rw-r--r--gdb/testsuite/gdb.perf/backtrace.py2
-rw-r--r--gdb/testsuite/gdb.perf/disassemble.exp2
-rw-r--r--gdb/testsuite/gdb.perf/disassemble.py2
-rw-r--r--gdb/testsuite/gdb.perf/gm-hello.cc2
-rw-r--r--gdb/testsuite/gdb.perf/gm-pervasive-typedef.cc2
-rw-r--r--gdb/testsuite/gdb.perf/gm-pervasive-typedef.h2
-rw-r--r--gdb/testsuite/gdb.perf/gm-std.cc2
-rw-r--r--gdb/testsuite/gdb.perf/gm-std.h2
-rw-r--r--gdb/testsuite/gdb.perf/gm-use-cerr.cc2
-rw-r--r--gdb/testsuite/gdb.perf/gm-utils.h2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster-null-lookup.py2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster-pervasive-typedef.py2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster-print-cerr.py2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster-ptype-string.py2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster-runto-main.py2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster-select-file.py2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster1-null-lookup.exp2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster1-pervasive-typedef.exp2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster1-print-cerr.exp2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster1-ptype-string.exp2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster1-runto-main.exp2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster1-select-file.exp2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster1.cc2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster1.exp4
-rw-r--r--gdb/testsuite/gdb.perf/gmonster2-null-lookup.exp2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster2-pervasive-typedef.exp2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster2-print-cerr.exp2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster2-ptype-string.exp2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster2-runto-main.exp2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster2-select-file.exp2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster2.cc2
-rw-r--r--gdb/testsuite/gdb.perf/gmonster2.exp4
-rw-r--r--gdb/testsuite/gdb.perf/lib/perftest/__init__.py2
-rw-r--r--gdb/testsuite/gdb.perf/lib/perftest/measure.py2
-rw-r--r--gdb/testsuite/gdb.perf/lib/perftest/perftest.py2
-rw-r--r--gdb/testsuite/gdb.perf/lib/perftest/reporter.py2
-rw-r--r--gdb/testsuite/gdb.perf/lib/perftest/testresult.py2
-rw-r--r--gdb/testsuite/gdb.perf/lib/perftest/utils.py2
-rw-r--r--gdb/testsuite/gdb.perf/single-step.c2
-rw-r--r--gdb/testsuite/gdb.perf/single-step.exp6
-rw-r--r--gdb/testsuite/gdb.perf/single-step.py2
-rw-r--r--gdb/testsuite/gdb.perf/skip-command.cc2
-rw-r--r--gdb/testsuite/gdb.perf/skip-command.exp12
-rw-r--r--gdb/testsuite/gdb.perf/skip-command.py2
-rw-r--r--gdb/testsuite/gdb.perf/skip-prologue.c2
-rw-r--r--gdb/testsuite/gdb.perf/skip-prologue.exp6
-rw-r--r--gdb/testsuite/gdb.perf/skip-prologue.py2
-rw-r--r--gdb/testsuite/gdb.perf/solib.c2
-rw-r--r--gdb/testsuite/gdb.perf/solib.exp6
-rw-r--r--gdb/testsuite/gdb.perf/solib.py2
-rw-r--r--gdb/testsuite/gdb.perf/template-breakpoints.cc2
-rw-r--r--gdb/testsuite/gdb.perf/template-breakpoints.exp6
-rw-r--r--gdb/testsuite/gdb.perf/template-breakpoints.py2
-rw-r--r--gdb/testsuite/gdb.python/amd64-py-framefilter-invalidarg.S2
-rw-r--r--gdb/testsuite/gdb.python/compare-enum-type-a.c2
-rw-r--r--gdb/testsuite/gdb.python/compare-enum-type-b.c2
-rw-r--r--gdb/testsuite/gdb.python/compare-enum-type.exp2
-rw-r--r--gdb/testsuite/gdb.python/compare-enum-type.h2
-rw-r--r--gdb/testsuite/gdb.python/flexible-array-member.c2
-rw-r--r--gdb/testsuite/gdb.python/flexible-array-member.exp2
-rw-r--r--gdb/testsuite/gdb.python/gdb_leak_detector.py121
-rw-r--r--gdb/testsuite/gdb.python/lib-types.cc2
-rw-r--r--gdb/testsuite/gdb.python/lib-types.exp2
-rw-r--r--gdb/testsuite/gdb.python/libpy-autoloaded-pretty-printers-in-newobjfile-event.so-gdb.py2
-rw-r--r--gdb/testsuite/gdb.python/lookup-type-block.exp68
-rw-r--r--gdb/testsuite/gdb.python/lookup1.c44
-rw-r--r--gdb/testsuite/gdb.python/lookup2.c46
-rw-r--r--gdb/testsuite/gdb.python/lotsa-lines.exp2
-rw-r--r--gdb/testsuite/gdb.python/make-visualizer.exp176
-rw-r--r--gdb/testsuite/gdb.python/pretty-print-call-by-hand.c2
-rw-r--r--gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp4
-rw-r--r--gdb/testsuite/gdb.python/pretty-print-call-by-hand.py2
-rw-r--r--gdb/testsuite/gdb.python/py-arch-reg-groups.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-arch-reg-names.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-arch.c2
-rw-r--r--gdb/testsuite/gdb.python/py-arch.exp6
-rw-r--r--gdb/testsuite/gdb.python/py-as-string.c2
-rw-r--r--gdb/testsuite/gdb.python/py-as-string.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-auto-load-chaining-f1.c2
-rw-r--r--gdb/testsuite/gdb.python/py-auto-load-chaining-f1.o-gdb.py2
-rw-r--r--gdb/testsuite/gdb.python/py-auto-load-chaining-f2.c2
-rw-r--r--gdb/testsuite/gdb.python/py-auto-load-chaining-f2.o-gdb.py2
-rw-r--r--gdb/testsuite/gdb.python/py-auto-load-chaining.c2
-rw-r--r--gdb/testsuite/gdb.python/py-auto-load-chaining.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-lib.cc2
-rw-r--r--gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-lib.h2
-rw-r--r--gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-main.cc2
-rw-r--r--gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.py2
-rw-r--r--gdb/testsuite/gdb.python/py-bad-printers.c2
-rw-r--r--gdb/testsuite/gdb.python/py-bad-printers.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-bad-printers.py2
-rw-r--r--gdb/testsuite/gdb.python/py-block.c2
-rw-r--r--gdb/testsuite/gdb.python/py-bp-locations.c2
-rw-r--r--gdb/testsuite/gdb.python/py-bp-locations.exp6
-rw-r--r--gdb/testsuite/gdb.python/py-breakpoint-create-fail.c2
-rw-r--r--gdb/testsuite/gdb.python/py-breakpoint-create-fail.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-breakpoint-create-fail.py2
-rw-r--r--gdb/testsuite/gdb.python/py-breakpoint.c2
-rw-r--r--gdb/testsuite/gdb.python/py-breakpoint.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-caller-is.c2
-rw-r--r--gdb/testsuite/gdb.python/py-caller-is.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-charset.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-cmd-exception.c2
-rw-r--r--gdb/testsuite/gdb.python/py-cmd-exception.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-cmd-exception.py2
-rw-r--r--gdb/testsuite/gdb.python/py-cmd-prompt.c2
-rw-r--r--gdb/testsuite/gdb.python/py-cmd-prompt.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-cmd-prompt.py2
-rw-r--r--gdb/testsuite/gdb.python/py-cmd.c2
-rw-r--r--gdb/testsuite/gdb.python/py-cmd.exp95
-rw-r--r--gdb/testsuite/gdb.python/py-color-leak.exp28
-rw-r--r--gdb/testsuite/gdb.python/py-color-leak.py37
-rw-r--r--gdb/testsuite/gdb.python/py-color-pagination.exp194
-rw-r--r--gdb/testsuite/gdb.python/py-color-pagination.py82
-rw-r--r--gdb/testsuite/gdb.python/py-color.exp78
-rw-r--r--gdb/testsuite/gdb.python/py-completion.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-completion.py2
-rw-r--r--gdb/testsuite/gdb.python/py-connection-removed.exp15
-rw-r--r--gdb/testsuite/gdb.python/py-connection.c2
-rw-r--r--gdb/testsuite/gdb.python/py-connection.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-corefile.c25
-rw-r--r--gdb/testsuite/gdb.python/py-corefile.exp281
-rw-r--r--gdb/testsuite/gdb.python/py-corefile.py186
-rw-r--r--gdb/testsuite/gdb.python/py-disasm-exec.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-disasm-obj.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-disasm.c2
-rw-r--r--gdb/testsuite/gdb.python/py-disasm.exp.tcl17
-rw-r--r--gdb/testsuite/gdb.python/py-disasm.py20
-rw-r--r--gdb/testsuite/gdb.python/py-doc-reformat.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-error.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-error.py2
-rw-r--r--gdb/testsuite/gdb.python/py-event-load.c2
-rw-r--r--gdb/testsuite/gdb.python/py-event-load.exp8
-rw-r--r--gdb/testsuite/gdb.python/py-event-load.py2
-rw-r--r--gdb/testsuite/gdb.python/py-events-shlib.c2
-rw-r--r--gdb/testsuite/gdb.python/py-events.c2
-rw-r--r--gdb/testsuite/gdb.python/py-events.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-events.py2
-rw-r--r--gdb/testsuite/gdb.python/py-evsignal.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-evthreads.c2
-rw-r--r--gdb/testsuite/gdb.python/py-evthreads.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-exec-file.c2
-rw-r--r--gdb/testsuite/gdb.python/py-exec-file.exp10
-rw-r--r--gdb/testsuite/gdb.python/py-exec-mi.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-explore-cc.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-explore.c2
-rw-r--r--gdb/testsuite/gdb.python/py-explore.cc2
-rw-r--r--gdb/testsuite/gdb.python/py-explore.exp8
-rw-r--r--gdb/testsuite/gdb.python/py-failed-init.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.c2
-rw-r--r--gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.py2
-rw-r--r--gdb/testsuite/gdb.python/py-finish-breakpoint.c2
-rw-r--r--gdb/testsuite/gdb.python/py-finish-breakpoint.exp10
-rw-r--r--gdb/testsuite/gdb.python/py-finish-breakpoint.py2
-rw-r--r--gdb/testsuite/gdb.python/py-finish-breakpoint2.cc2
-rw-r--r--gdb/testsuite/gdb.python/py-finish-breakpoint2.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-finish-breakpoint2.py2
-rw-r--r--gdb/testsuite/gdb.python/py-format-address.c2
-rw-r--r--gdb/testsuite/gdb.python/py-format-address.exp14
-rw-r--r--gdb/testsuite/gdb.python/py-format-string.c2
-rw-r--r--gdb/testsuite/gdb.python/py-format-string.exp11
-rw-r--r--gdb/testsuite/gdb.python/py-format-string.py2
-rw-r--r--gdb/testsuite/gdb.python/py-frame-args.c2
-rw-r--r--gdb/testsuite/gdb.python/py-frame-args.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-frame-args.py2
-rw-r--r--gdb/testsuite/gdb.python/py-frame-inline.c2
-rw-r--r--gdb/testsuite/gdb.python/py-frame-inline.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-frame.exp17
-rw-r--r--gdb/testsuite/gdb.python/py-framefilter-addr.c2
-rw-r--r--gdb/testsuite/gdb.python/py-framefilter-addr.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-framefilter-addr.py2
-rw-r--r--gdb/testsuite/gdb.python/py-framefilter-gdb.py2
-rw-r--r--gdb/testsuite/gdb.python/py-framefilter-invalidarg-gdb.py2
-rw-r--r--gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-framefilter-invalidarg.py2
-rw-r--r--gdb/testsuite/gdb.python/py-framefilter-mi.c2
-rw-r--r--gdb/testsuite/gdb.python/py-framefilter-mi.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-framefilter.c2
-rw-r--r--gdb/testsuite/gdb.python/py-framefilter.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-framefilter.py2
-rw-r--r--gdb/testsuite/gdb.python/py-function.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-inferior-leak.c2
-rw-r--r--gdb/testsuite/gdb.python/py-inferior-leak.exp16
-rw-r--r--gdb/testsuite/gdb.python/py-inferior-leak.py113
-rw-r--r--gdb/testsuite/gdb.python/py-inferior.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-infthread.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-label-symbol-value.c2
-rw-r--r--gdb/testsuite/gdb.python/py-label-symbol-value.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-lazy-string.c2
-rw-r--r--gdb/testsuite/gdb.python/py-lazy-string.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-linetable-empty.c2
-rw-r--r--gdb/testsuite/gdb.python/py-linetable-empty.exp10
-rw-r--r--gdb/testsuite/gdb.python/py-linetable.S2
-rw-r--r--gdb/testsuite/gdb.python/py-linetable.c2
-rw-r--r--gdb/testsuite/gdb.python/py-linetable.exp6
-rw-r--r--gdb/testsuite/gdb.python/py-lookup-type.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-mi-cmd.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-mi-cmd.py2
-rw-r--r--gdb/testsuite/gdb.python/py-mi-events-gdb.py2
-rw-r--r--gdb/testsuite/gdb.python/py-mi-events.c2
-rw-r--r--gdb/testsuite/gdb.python/py-mi-events.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-mi-notify.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-mi-objfile-gdb.py2
-rw-r--r--gdb/testsuite/gdb.python/py-mi-objfile.c2
-rw-r--r--gdb/testsuite/gdb.python/py-mi-objfile.exp6
-rw-r--r--gdb/testsuite/gdb.python/py-mi-var-info-path-expression.c2
-rw-r--r--gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-mi-var-info-path-expression.py2
-rw-r--r--gdb/testsuite/gdb.python/py-mi.exp6
-rw-r--r--gdb/testsuite/gdb.python/py-missing-debug.c2
-rw-r--r--gdb/testsuite/gdb.python/py-missing-debug.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-missing-debug.py2
-rw-r--r--gdb/testsuite/gdb.python/py-missing-objfile-lib.c2
-rw-r--r--gdb/testsuite/gdb.python/py-missing-objfile.c2
-rw-r--r--gdb/testsuite/gdb.python/py-missing-objfile.exp19
-rw-r--r--gdb/testsuite/gdb.python/py-missing-objfile.py2
-rw-r--r--gdb/testsuite/gdb.python/py-nested-maps.c2
-rw-r--r--gdb/testsuite/gdb.python/py-nested-maps.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-nested-maps.py2
-rw-r--r--gdb/testsuite/gdb.python/py-objfile-script-gdb.py2
-rw-r--r--gdb/testsuite/gdb.python/py-objfile-script.c2
-rw-r--r--gdb/testsuite/gdb.python/py-objfile-script.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-objfile.c4
-rw-r--r--gdb/testsuite/gdb.python/py-objfile.exp16
-rw-r--r--gdb/testsuite/gdb.python/py-parameter-prefix.exp382
-rw-r--r--gdb/testsuite/gdb.python/py-parameter.exp232
-rw-r--r--gdb/testsuite/gdb.python/py-pending-frame-level.c2
-rw-r--r--gdb/testsuite/gdb.python/py-pending-frame-level.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-pending-frame-level.py2
-rw-r--r--gdb/testsuite/gdb.python/py-pp-cast.c2
-rw-r--r--gdb/testsuite/gdb.python/py-pp-cast.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-pp-cast.py2
-rw-r--r--gdb/testsuite/gdb.python/py-pp-integral.c2
-rw-r--r--gdb/testsuite/gdb.python/py-pp-integral.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-pp-integral.py2
-rw-r--r--gdb/testsuite/gdb.python/py-pp-maint.c2
-rw-r--r--gdb/testsuite/gdb.python/py-pp-maint.exp10
-rw-r--r--gdb/testsuite/gdb.python/py-pp-maint.py2
-rw-r--r--gdb/testsuite/gdb.python/py-pp-re-notag.c2
-rw-r--r--gdb/testsuite/gdb.python/py-pp-re-notag.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-pp-re-notag.py2
-rw-r--r--gdb/testsuite/gdb.python/py-pp-registration.c2
-rw-r--r--gdb/testsuite/gdb.python/py-pp-registration.exp12
-rw-r--r--gdb/testsuite/gdb.python/py-pp-registration.py2
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint-stub-2.cc2
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint-stub.cc2
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint-stub.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint-stub.h2
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint-stub.py2
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint.c2
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint.exp11
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint.py2
-rw-r--r--gdb/testsuite/gdb.python/py-progspace-events.c2
-rw-r--r--gdb/testsuite/gdb.python/py-progspace-events.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-progspace-events.py2
-rw-r--r--gdb/testsuite/gdb.python/py-progspace.c2
-rw-r--r--gdb/testsuite/gdb.python/py-progspace.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-prompt.c2
-rw-r--r--gdb/testsuite/gdb.python/py-prompt.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-rbreak-func2.c2
-rw-r--r--gdb/testsuite/gdb.python/py-rbreak.c2
-rw-r--r--gdb/testsuite/gdb.python/py-rbreak.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-read-memory-leak.c2
-rw-r--r--gdb/testsuite/gdb.python/py-read-memory-leak.exp18
-rw-r--r--gdb/testsuite/gdb.python/py-read-memory-leak.py88
-rw-r--r--gdb/testsuite/gdb.python/py-record-btrace-threads.c2
-rw-r--r--gdb/testsuite/gdb.python/py-record-btrace-threads.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-record-btrace.c2
-rw-r--r--gdb/testsuite/gdb.python/py-record-btrace.exp8
-rw-r--r--gdb/testsuite/gdb.python/py-record-full.c2
-rw-r--r--gdb/testsuite/gdb.python/py-record-full.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-recurse-unwind.c2
-rw-r--r--gdb/testsuite/gdb.python/py-recurse-unwind.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-recurse-unwind.py2
-rw-r--r--gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.cc2
-rw-r--r--gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-section-script.c2
-rw-r--r--gdb/testsuite/gdb.python/py-section-script.exp10
-rw-r--r--gdb/testsuite/gdb.python/py-section-script.py2
-rw-r--r--gdb/testsuite/gdb.python/py-send-packet.c2
-rw-r--r--gdb/testsuite/gdb.python/py-send-packet.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-send-packet.py2
-rw-r--r--gdb/testsuite/gdb.python/py-shared-sl.c2
-rw-r--r--gdb/testsuite/gdb.python/py-shared.c2
-rw-r--r--gdb/testsuite/gdb.python/py-shared.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-source-styling-2.c26
-rw-r--r--gdb/testsuite/gdb.python/py-source-styling-2.exp55
-rw-r--r--gdb/testsuite/gdb.python/py-source-styling.c2
-rw-r--r--gdb/testsuite/gdb.python/py-source-styling.exp10
-rw-r--r--gdb/testsuite/gdb.python/py-startup-opt.exp3
-rw-r--r--gdb/testsuite/gdb.python/py-strfns.c2
-rw-r--r--gdb/testsuite/gdb.python/py-strfns.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-style-parameter-set.exp366
-rw-r--r--gdb/testsuite/gdb.python/py-style.exp371
-rw-r--r--gdb/testsuite/gdb.python/py-styled-execute.exp1
-rw-r--r--gdb/testsuite/gdb.python/py-sym-artificial.exp18
-rw-r--r--gdb/testsuite/gdb.python/py-symbol-2.c2
-rw-r--r--gdb/testsuite/gdb.python/py-symbol-3.c2
-rw-r--r--gdb/testsuite/gdb.python/py-symbol.c2
-rw-r--r--gdb/testsuite/gdb.python/py-symbol.exp11
-rw-r--r--gdb/testsuite/gdb.python/py-symtab.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-sync-interp.c2
-rw-r--r--gdb/testsuite/gdb.python/py-sync-interp.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-template.cc2
-rw-r--r--gdb/testsuite/gdb.python/py-template.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-thread-exited.c2
-rw-r--r--gdb/testsuite/gdb.python/py-thread-exited.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-thread-exited.py4
-rw-r--r--gdb/testsuite/gdb.python/py-thrhandle.c2
-rw-r--r--gdb/testsuite/gdb.python/py-thrhandle.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-type.c2
-rw-r--r--gdb/testsuite/gdb.python/py-type.exp13
-rw-r--r--gdb/testsuite/gdb.python/py-typeprint.cc2
-rw-r--r--gdb/testsuite/gdb.python/py-typeprint.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-typeprint.py2
-rw-r--r--gdb/testsuite/gdb.python/py-unwind-inline.c2
-rw-r--r--gdb/testsuite/gdb.python/py-unwind-inline.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-unwind-inline.py2
-rw-r--r--gdb/testsuite/gdb.python/py-unwind-maint.c2
-rw-r--r--gdb/testsuite/gdb.python/py-unwind-maint.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-unwind-maint.py2
-rw-r--r--gdb/testsuite/gdb.python/py-unwind-user-regs.c2
-rw-r--r--gdb/testsuite/gdb.python/py-unwind-user-regs.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-unwind-user-regs.py2
-rw-r--r--gdb/testsuite/gdb.python/py-unwind.c2
-rw-r--r--gdb/testsuite/gdb.python/py-unwind.exp9
-rw-r--r--gdb/testsuite/gdb.python/py-unwind.py22
-rw-r--r--gdb/testsuite/gdb.python/py-value-cc.cc2
-rw-r--r--gdb/testsuite/gdb.python/py-value-cc.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-value.c11
-rw-r--r--gdb/testsuite/gdb.python/py-value.exp63
-rw-r--r--gdb/testsuite/gdb.python/py-varobj.c2
-rw-r--r--gdb/testsuite/gdb.python/py-varobj.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-varobj.py2
-rw-r--r--gdb/testsuite/gdb.python/py-warning.exp63
-rw-r--r--gdb/testsuite/gdb.python/py-watchpoint.c2
-rw-r--r--gdb/testsuite/gdb.python/py-watchpoint.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-watchpoint.py2
-rw-r--r--gdb/testsuite/gdb.python/py-xmethods.cc2
-rw-r--r--gdb/testsuite/gdb.python/py-xmethods.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-xmethods.py2
-rw-r--r--gdb/testsuite/gdb.python/python-1.c2
-rw-r--r--gdb/testsuite/gdb.python/python.c2
-rw-r--r--gdb/testsuite/gdb.python/python.exp22
-rw-r--r--gdb/testsuite/gdb.python/source12
-rw-r--r--gdb/testsuite/gdb.python/source2.py2
-rw-r--r--gdb/testsuite/gdb.python/sys-exit.exp2
-rw-r--r--gdb/testsuite/gdb.python/tui-window-disabled.c2
-rw-r--r--gdb/testsuite/gdb.python/tui-window-disabled.exp2
-rw-r--r--gdb/testsuite/gdb.python/tui-window-disabled.py2
-rw-r--r--gdb/testsuite/gdb.python/tui-window-factory.exp2
-rw-r--r--gdb/testsuite/gdb.python/tui-window-factory.py2
-rw-r--r--gdb/testsuite/gdb.python/tui-window-names.exp2
-rw-r--r--gdb/testsuite/gdb.python/tui-window.exp2
-rw-r--r--gdb/testsuite/gdb.python/tui-window.py2
-rw-r--r--gdb/testsuite/gdb.replay/connect.exp10
-rw-r--r--gdb/testsuite/gdb.replay/fetch-exec-and-args.c34
-rw-r--r--gdb/testsuite/gdb.replay/fetch-exec-and-args.exp146
-rw-r--r--gdb/testsuite/gdb.replay/missing-thread.c61
-rw-r--r--gdb/testsuite/gdb.replay/missing-thread.exp237
-rw-r--r--gdb/testsuite/gdb.reverse/aarch64-mops.c2
-rw-r--r--gdb/testsuite/gdb.reverse/aarch64-mops.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.S2
-rw-r--r--gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.exp8
-rw-r--r--gdb/testsuite/gdb.reverse/break-precsave.exp2
-rw-r--r--gdb/testsuite/gdb.reverse/break-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/break-reverse.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/consecutive-precsave.exp8
-rw-r--r--gdb/testsuite/gdb.reverse/consecutive-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/consecutive-reverse.exp10
-rw-r--r--gdb/testsuite/gdb.reverse/finish-precsave.exp6
-rw-r--r--gdb/testsuite/gdb.reverse/finish-reverse-bkpt.c2
-rw-r--r--gdb/testsuite/gdb.reverse/finish-reverse-bkpt.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/finish-reverse-next.c2
-rw-r--r--gdb/testsuite/gdb.reverse/finish-reverse-next.exp6
-rw-r--r--gdb/testsuite/gdb.reverse/finish-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/finish-reverse.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/fstatat-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/fstatat-reverse.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/func-map-to-same-line.c2
-rw-r--r--gdb/testsuite/gdb.reverse/func-map-to-same-line.exp2
-rw-r--r--gdb/testsuite/gdb.reverse/getrandom.c2
-rw-r--r--gdb/testsuite/gdb.reverse/getrandom.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/getresuid-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/getresuid-reverse.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/i386-avx-reverse.c361
-rw-r--r--gdb/testsuite/gdb.reverse/i386-avx-reverse.exp575
-rw-r--r--gdb/testsuite/gdb.reverse/i386-precsave.exp2
-rw-r--r--gdb/testsuite/gdb.reverse/i386-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/i386-reverse.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/i386-sse-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/i386-sse-reverse.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/i387-env-reverse.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/i387-stack-reverse.exp2
-rw-r--r--gdb/testsuite/gdb.reverse/insn-reverse-aarch64.c2
-rw-r--r--gdb/testsuite/gdb.reverse/insn-reverse-arm.c2
-rw-r--r--gdb/testsuite/gdb.reverse/insn-reverse-x86.c2
-rw-r--r--gdb/testsuite/gdb.reverse/insn-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/insn-reverse.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/machinestate-precsave.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/machinestate.c2
-rw-r--r--gdb/testsuite/gdb.reverse/machinestate.exp6
-rw-r--r--gdb/testsuite/gdb.reverse/maint-print-instruction.c2
-rw-r--r--gdb/testsuite/gdb.reverse/maint-print-instruction.exp6
-rw-r--r--gdb/testsuite/gdb.reverse/map-to-same-line.c2
-rw-r--r--gdb/testsuite/gdb.reverse/map-to-same-line.exp18
-rw-r--r--gdb/testsuite/gdb.reverse/ms1.c2
-rw-r--r--gdb/testsuite/gdb.reverse/next-reverse-bkpt-over-sr.c2
-rw-r--r--gdb/testsuite/gdb.reverse/next-reverse-bkpt-over-sr.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/pipe-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/pipe-reverse.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.c2
-rw-r--r--gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.exp2
-rw-r--r--gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.c2
-rw-r--r--gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp2
-rw-r--r--gdb/testsuite/gdb.reverse/readv-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/readv-reverse.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/recursion.c2
-rw-r--r--gdb/testsuite/gdb.reverse/recursion.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/recvmsg-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/recvmsg-reverse.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/rerun-prec.c2
-rw-r--r--gdb/testsuite/gdb.reverse/rerun-prec.exp2
-rw-r--r--gdb/testsuite/gdb.reverse/s390-mvcle.c2
-rw-r--r--gdb/testsuite/gdb.reverse/s390-mvcle.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/shr.h2
-rw-r--r--gdb/testsuite/gdb.reverse/shr1.c2
-rw-r--r--gdb/testsuite/gdb.reverse/shr2.c2
-rw-r--r--gdb/testsuite/gdb.reverse/sigall-precsave.exp12
-rw-r--r--gdb/testsuite/gdb.reverse/sigall-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/sigall-reverse.exp8
-rw-r--r--gdb/testsuite/gdb.reverse/singlejmp-reverse-nodebug.S2
-rw-r--r--gdb/testsuite/gdb.reverse/singlejmp-reverse-nodebug.c2
-rw-r--r--gdb/testsuite/gdb.reverse/singlejmp-reverse.S2
-rw-r--r--gdb/testsuite/gdb.reverse/singlejmp-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/singlejmp-reverse.exp8
-rw-r--r--gdb/testsuite/gdb.reverse/solib-precsave.exp8
-rw-r--r--gdb/testsuite/gdb.reverse/solib-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/solib-reverse.exp10
-rw-r--r--gdb/testsuite/gdb.reverse/step-indirect-call-thunk.c2
-rw-r--r--gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp2
-rw-r--r--gdb/testsuite/gdb.reverse/step-precsave.exp6
-rw-r--r--gdb/testsuite/gdb.reverse/step-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/step-reverse.exp6
-rw-r--r--gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.c2
-rw-r--r--gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp2
-rw-r--r--gdb/testsuite/gdb.reverse/time-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/time-reverse.exp45
-rw-r--r--gdb/testsuite/gdb.reverse/until-precsave.exp6
-rw-r--r--gdb/testsuite/gdb.reverse/until-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/until-reverse.exp8
-rw-r--r--gdb/testsuite/gdb.reverse/ur1.c2
-rw-r--r--gdb/testsuite/gdb.reverse/waitpid-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/waitpid-reverse.exp4
-rw-r--r--gdb/testsuite/gdb.reverse/watch-precsave.exp2
-rw-r--r--gdb/testsuite/gdb.reverse/watch-reverse.c2
-rw-r--r--gdb/testsuite/gdb.reverse/watch-reverse.exp4
-rw-r--r--gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.cpp86
-rw-r--r--gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.exp69
-rw-r--r--gdb/testsuite/gdb.rocm/displaced-stepping.cpp2
-rw-r--r--gdb/testsuite/gdb.rocm/displaced-stepping.exp5
-rw-r--r--gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execee.cpp2
-rw-r--r--gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execer.cpp2
-rw-r--r--gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu.exp6
-rw-r--r--gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execee.cpp2
-rw-r--r--gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execer.cpp2
-rw-r--r--gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp6
-rw-r--r--gdb/testsuite/gdb.rocm/mi-attach.cpp4
-rw-r--r--gdb/testsuite/gdb.rocm/mi-attach.exp3
-rw-r--r--gdb/testsuite/gdb.rocm/multi-inferior-gpu.cpp2
-rw-r--r--gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp5
-rw-r--r--gdb/testsuite/gdb.rocm/precise-memory-exec.c2
-rw-r--r--gdb/testsuite/gdb.rocm/precise-memory-exec.exp7
-rw-r--r--gdb/testsuite/gdb.rocm/precise-memory-fork.c2
-rw-r--r--gdb/testsuite/gdb.rocm/precise-memory-fork.exp5
-rw-r--r--gdb/testsuite/gdb.rocm/precise-memory-multi-inferiors.exp8
-rw-r--r--gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.cpp2
-rw-r--r--gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp7
-rw-r--r--gdb/testsuite/gdb.rocm/precise-memory.cpp2
-rw-r--r--gdb/testsuite/gdb.rocm/precise-memory.exp9
-rw-r--r--gdb/testsuite/gdb.rocm/simple.cpp2
-rw-r--r--gdb/testsuite/gdb.rocm/simple.exp7
-rw-r--r--gdb/testsuite/gdb.rust/completion.exp2
-rw-r--r--gdb/testsuite/gdb.rust/completion.rs2
-rw-r--r--gdb/testsuite/gdb.rust/dwindex.exp2
-rw-r--r--gdb/testsuite/gdb.rust/dwindex.rs2
-rw-r--r--gdb/testsuite/gdb.rust/expr.exp2
-rw-r--r--gdb/testsuite/gdb.rust/finish.exp2
-rw-r--r--gdb/testsuite/gdb.rust/finish.rs2
-rw-r--r--gdb/testsuite/gdb.rust/fnfield.exp2
-rw-r--r--gdb/testsuite/gdb.rust/fnfield.rs2
-rw-r--r--gdb/testsuite/gdb.rust/generics.exp2
-rw-r--r--gdb/testsuite/gdb.rust/generics.rs2
-rw-r--r--gdb/testsuite/gdb.rust/main-crash.exp2
-rw-r--r--gdb/testsuite/gdb.rust/main.rs2
-rw-r--r--gdb/testsuite/gdb.rust/methods.exp2
-rw-r--r--gdb/testsuite/gdb.rust/methods.rs2
-rw-r--r--gdb/testsuite/gdb.rust/modules.exp4
-rw-r--r--gdb/testsuite/gdb.rust/modules.rs2
-rw-r--r--gdb/testsuite/gdb.rust/onetwoeight.exp2
-rw-r--r--gdb/testsuite/gdb.rust/onetwoeight.rs2
-rw-r--r--gdb/testsuite/gdb.rust/pp.exp2
-rw-r--r--gdb/testsuite/gdb.rust/pp.py2
-rw-r--r--gdb/testsuite/gdb.rust/pp.rs2
-rw-r--r--gdb/testsuite/gdb.rust/rawids.exp2
-rw-r--r--gdb/testsuite/gdb.rust/rawids.rs2
-rw-r--r--gdb/testsuite/gdb.rust/rust-start.exp2
-rw-r--r--gdb/testsuite/gdb.rust/rust-style.exp2
-rw-r--r--gdb/testsuite/gdb.rust/rust-style.rs2
-rw-r--r--gdb/testsuite/gdb.rust/simple.exp2
-rw-r--r--gdb/testsuite/gdb.rust/simple.rs2
-rw-r--r--gdb/testsuite/gdb.rust/traits.exp4
-rw-r--r--gdb/testsuite/gdb.rust/traits.rs2
-rw-r--r--gdb/testsuite/gdb.rust/unicode.exp2
-rw-r--r--gdb/testsuite/gdb.rust/unicode.rs2
-rw-r--r--gdb/testsuite/gdb.rust/union.exp2
-rw-r--r--gdb/testsuite/gdb.rust/union.rs2
-rw-r--r--gdb/testsuite/gdb.rust/unsized.exp2
-rw-r--r--gdb/testsuite/gdb.rust/unsized.rs2
-rw-r--r--gdb/testsuite/gdb.rust/unsized2.exp2
-rw-r--r--gdb/testsuite/gdb.rust/unsized2.rs2
-rw-r--r--gdb/testsuite/gdb.rust/watch.exp2
-rw-r--r--gdb/testsuite/gdb.rust/watch.rs2
-rw-r--r--gdb/testsuite/gdb.server/abspath.exp2
-rw-r--r--gdb/testsuite/gdb.server/argument-errors.exp81
-rw-r--r--gdb/testsuite/gdb.server/attach-flag.exp2
-rw-r--r--gdb/testsuite/gdb.server/bkpt-other-inferior.exp4
-rw-r--r--gdb/testsuite/gdb.server/build-id-seqno.c2
-rw-r--r--gdb/testsuite/gdb.server/build-id-seqno.exp8
-rw-r--r--gdb/testsuite/gdb.server/connect-stopped-target.c2
-rw-r--r--gdb/testsuite/gdb.server/connect-stopped-target.exp4
-rw-r--r--gdb/testsuite/gdb.server/connect-with-no-symbol-file.c2
-rw-r--r--gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp4
-rw-r--r--gdb/testsuite/gdb.server/connect-without-multi-process.c2
-rw-r--r--gdb/testsuite/gdb.server/connect-without-multi-process.exp4
-rw-r--r--gdb/testsuite/gdb.server/exit-multiple-threads.c2
-rw-r--r--gdb/testsuite/gdb.server/exit-multiple-threads.exp11
-rw-r--r--gdb/testsuite/gdb.server/ext-attach.c2
-rw-r--r--gdb/testsuite/gdb.server/ext-attach.exp4
-rw-r--r--gdb/testsuite/gdb.server/ext-restart.exp2
-rw-r--r--gdb/testsuite/gdb.server/ext-run.exp4
-rw-r--r--gdb/testsuite/gdb.server/ext-wrapper.exp2
-rw-r--r--gdb/testsuite/gdb.server/extended-remote-restart.c2
-rw-r--r--gdb/testsuite/gdb.server/extended-remote-restart.exp6
-rw-r--r--gdb/testsuite/gdb.server/fetch-exec-and-args.c34
-rw-r--r--gdb/testsuite/gdb.server/fetch-exec-and-args.exp307
-rw-r--r--gdb/testsuite/gdb.server/file-transfer.exp2
-rw-r--r--gdb/testsuite/gdb.server/fileio-packets.exp66
-rw-r--r--gdb/testsuite/gdb.server/fileio-packets.py208
-rw-r--r--gdb/testsuite/gdb.server/inferior-args.c27
-rw-r--r--gdb/testsuite/gdb.server/inferior-args.exp156
-rw-r--r--gdb/testsuite/gdb.server/monitor-exit-quit.exp6
-rw-r--r--gdb/testsuite/gdb.server/multi-ui-errors.c2
-rw-r--r--gdb/testsuite/gdb.server/multi-ui-errors.exp2
-rw-r--r--gdb/testsuite/gdb.server/no-thread-db.c2
-rw-r--r--gdb/testsuite/gdb.server/no-thread-db.exp6
-rw-r--r--gdb/testsuite/gdb.server/non-existing-program.exp6
-rw-r--r--gdb/testsuite/gdb.server/normal.c2
-rw-r--r--gdb/testsuite/gdb.server/pread-offset-size.S29
-rw-r--r--gdb/testsuite/gdb.server/pread-offset-size.exp49
-rw-r--r--gdb/testsuite/gdb.server/reconnect-ctrl-c.c2
-rw-r--r--gdb/testsuite/gdb.server/reconnect-ctrl-c.exp6
-rw-r--r--gdb/testsuite/gdb.server/remote-read-msgs.c2
-rw-r--r--gdb/testsuite/gdb.server/remote-read-msgs.exp2
-rw-r--r--gdb/testsuite/gdb.server/run-without-local-binary.exp2
-rw-r--r--gdb/testsuite/gdb.server/server-connect.exp2
-rw-r--r--gdb/testsuite/gdb.server/server-empty-exec-name.exp93
-rw-r--r--gdb/testsuite/gdb.server/server-exec-info.exp4
-rw-r--r--gdb/testsuite/gdb.server/server-kill-python.exp2
-rw-r--r--gdb/testsuite/gdb.server/server-kill.c2
-rw-r--r--gdb/testsuite/gdb.server/server-kill.exp15
-rw-r--r--gdb/testsuite/gdb.server/server-mon.exp2
-rw-r--r--gdb/testsuite/gdb.server/server-pipe.exp4
-rw-r--r--gdb/testsuite/gdb.server/server-run.exp4
-rw-r--r--gdb/testsuite/gdb.server/server.c2
-rw-r--r--gdb/testsuite/gdb.server/solib-list-lib.c2
-rw-r--r--gdb/testsuite/gdb.server/solib-list-main.c2
-rw-r--r--gdb/testsuite/gdb.server/solib-list.exp2
-rw-r--r--gdb/testsuite/gdb.server/stop-reply-no-thread-multi.c2
-rw-r--r--gdb/testsuite/gdb.server/stop-reply-no-thread-multi.exp6
-rw-r--r--gdb/testsuite/gdb.server/stop-reply-no-thread.c2
-rw-r--r--gdb/testsuite/gdb.server/stop-reply-no-thread.exp6
-rw-r--r--gdb/testsuite/gdb.server/sysroot.c2
-rw-r--r--gdb/testsuite/gdb.server/sysroot.exp2
-rw-r--r--gdb/testsuite/gdb.server/target-exec-file.c2
-rw-r--r--gdb/testsuite/gdb.server/target-exec-file.exp2
-rw-r--r--gdb/testsuite/gdb.server/twice-connect.c2
-rw-r--r--gdb/testsuite/gdb.server/twice-connect.exp2
-rw-r--r--gdb/testsuite/gdb.server/unittest.exp2
-rw-r--r--gdb/testsuite/gdb.server/wrapper.c2
-rw-r--r--gdb/testsuite/gdb.server/wrapper.exp2
-rw-r--r--gdb/testsuite/gdb.stabs/exclfwd.exp2
-rw-r--r--gdb/testsuite/gdb.stabs/exclfwd.h2
-rw-r--r--gdb/testsuite/gdb.stabs/exclfwd1.c2
-rw-r--r--gdb/testsuite/gdb.stabs/exclfwd2.c2
-rw-r--r--gdb/testsuite/gdb.stabs/gdb11479.c2
-rw-r--r--gdb/testsuite/gdb.stabs/gdb11479.exp2
-rw-r--r--gdb/testsuite/gdb.stabs/weird.def2
-rw-r--r--gdb/testsuite/gdb.stabs/weird.exp2
-rw-r--r--gdb/testsuite/gdb.testsuite/board-sanity.exp8
-rw-r--r--gdb/testsuite/gdb.testsuite/capture-command-output.exp2
-rw-r--r--gdb/testsuite/gdb.testsuite/cond-wrap.exp2
-rw-r--r--gdb/testsuite/gdb.testsuite/dump-system-info.exp2
-rw-r--r--gdb/testsuite/gdb.testsuite/foreach_with_prefix.exp2
-rw-r--r--gdb/testsuite/gdb.testsuite/gdb-caching-proc-consistency.exp11
-rw-r--r--gdb/testsuite/gdb.testsuite/gdb-caching-proc.exp23
-rw-r--r--gdb/testsuite/gdb.testsuite/gdb-test.exp2
-rw-r--r--gdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.exp84
-rwxr-xr-xgdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.gdb25
-rw-r--r--gdb/testsuite/gdb.testsuite/mount-point-map.exp49
-rw-r--r--gdb/testsuite/gdb.testsuite/parse_options_args.exp2
-rw-r--r--gdb/testsuite/gdb.testsuite/string-cat.exp2
-rw-r--r--gdb/testsuite/gdb.testsuite/string_to_regexp.exp2
-rw-r--r--gdb/testsuite/gdb.testsuite/version-compare.exp74
-rw-r--r--gdb/testsuite/gdb.testsuite/with-override.exp10
-rw-r--r--gdb/testsuite/gdb.threads/access-mem-running-thread-exit.c2
-rw-r--r--gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp97
-rw-r--r--gdb/testsuite/gdb.threads/async.c2
-rw-r--r--gdb/testsuite/gdb.threads/async.exp4
-rw-r--r--gdb/testsuite/gdb.threads/attach-into-signal.c2
-rw-r--r--gdb/testsuite/gdb.threads/attach-into-signal.exp8
-rw-r--r--gdb/testsuite/gdb.threads/attach-many-short-lived-threads.c2
-rw-r--r--gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp2
-rw-r--r--gdb/testsuite/gdb.threads/attach-non-stop.c2
-rw-r--r--gdb/testsuite/gdb.threads/attach-non-stop.exp4
-rw-r--r--gdb/testsuite/gdb.threads/attach-slow-waitpid.c2
-rw-r--r--gdb/testsuite/gdb.threads/attach-slow-waitpid.exp2
-rw-r--r--gdb/testsuite/gdb.threads/attach-stopped.c2
-rw-r--r--gdb/testsuite/gdb.threads/attach-stopped.exp8
-rw-r--r--gdb/testsuite/gdb.threads/bp_in_thread.c2
-rw-r--r--gdb/testsuite/gdb.threads/bp_in_thread.exp4
-rw-r--r--gdb/testsuite/gdb.threads/break-while-running.c2
-rw-r--r--gdb/testsuite/gdb.threads/break-while-running.exp10
-rw-r--r--gdb/testsuite/gdb.threads/check-libthread-db.c2
-rw-r--r--gdb/testsuite/gdb.threads/check-libthread-db.exp8
-rw-r--r--gdb/testsuite/gdb.threads/clone-attach-detach.c2
-rw-r--r--gdb/testsuite/gdb.threads/clone-attach-detach.exp8
-rw-r--r--gdb/testsuite/gdb.threads/clone-new-thread-event.c2
-rw-r--r--gdb/testsuite/gdb.threads/clone-new-thread-event.exp2
-rw-r--r--gdb/testsuite/gdb.threads/clone-thread_db.c2
-rw-r--r--gdb/testsuite/gdb.threads/clone-thread_db.exp8
-rw-r--r--gdb/testsuite/gdb.threads/continue-pending-after-query.c2
-rw-r--r--gdb/testsuite/gdb.threads/continue-pending-after-query.exp4
-rw-r--r--gdb/testsuite/gdb.threads/continue-pending-status.c2
-rw-r--r--gdb/testsuite/gdb.threads/continue-pending-status.exp6
-rw-r--r--gdb/testsuite/gdb.threads/corethreads.c2
-rw-r--r--gdb/testsuite/gdb.threads/corethreads.exp3
-rw-r--r--gdb/testsuite/gdb.threads/create-fail.c2
-rw-r--r--gdb/testsuite/gdb.threads/create-fail.exp4
-rw-r--r--gdb/testsuite/gdb.threads/current-lwp-dead.c2
-rw-r--r--gdb/testsuite/gdb.threads/current-lwp-dead.exp4
-rw-r--r--gdb/testsuite/gdb.threads/del-pending-thread-bp-lib.c2
-rw-r--r--gdb/testsuite/gdb.threads/del-pending-thread-bp.c2
-rw-r--r--gdb/testsuite/gdb.threads/del-pending-thread-bp.exp4
-rw-r--r--gdb/testsuite/gdb.threads/detach-step-over.c2
-rw-r--r--gdb/testsuite/gdb.threads/detach-step-over.exp10
-rw-r--r--gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c2
-rw-r--r--gdb/testsuite/gdb.threads/dlopen-libpthread.c2
-rw-r--r--gdb/testsuite/gdb.threads/dlopen-libpthread.exp2
-rw-r--r--gdb/testsuite/gdb.threads/execl.c2
-rw-r--r--gdb/testsuite/gdb.threads/execl.exp4
-rw-r--r--gdb/testsuite/gdb.threads/execl1.c2
-rw-r--r--gdb/testsuite/gdb.threads/foll-fork-other-thread.c2
-rw-r--r--gdb/testsuite/gdb.threads/foll-fork-other-thread.exp6
-rw-r--r--gdb/testsuite/gdb.threads/fork-child-threads.c2
-rw-r--r--gdb/testsuite/gdb.threads/fork-child-threads.exp9
-rw-r--r--gdb/testsuite/gdb.threads/fork-plus-threads.c2
-rw-r--r--gdb/testsuite/gdb.threads/fork-plus-threads.exp6
-rw-r--r--gdb/testsuite/gdb.threads/fork-thread-pending.c2
-rw-r--r--gdb/testsuite/gdb.threads/fork-thread-pending.exp12
-rw-r--r--gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.c2
-rw-r--r--gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.exp8
-rw-r--r--gdb/testsuite/gdb.threads/gcore-stale-thread.c2
-rw-r--r--gdb/testsuite/gdb.threads/gcore-stale-thread.exp2
-rw-r--r--gdb/testsuite/gdb.threads/gcore-thread.exp4
-rw-r--r--gdb/testsuite/gdb.threads/hand-call-in-threads.c2
-rw-r--r--gdb/testsuite/gdb.threads/hand-call-in-threads.exp6
-rw-r--r--gdb/testsuite/gdb.threads/hand-call-new-thread.c2
-rw-r--r--gdb/testsuite/gdb.threads/hand-call-new-thread.exp6
-rw-r--r--gdb/testsuite/gdb.threads/ia64-sigill.c2
-rw-r--r--gdb/testsuite/gdb.threads/ia64-sigill.exp4
-rw-r--r--gdb/testsuite/gdb.threads/inf-thr-count.c2
-rw-r--r--gdb/testsuite/gdb.threads/inf-thr-count.exp63
-rw-r--r--gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.c2
-rw-r--r--gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.exp4
-rw-r--r--gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c2
-rw-r--r--gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp12
-rw-r--r--gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.c2
-rw-r--r--gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.exp4
-rw-r--r--gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.c2
-rw-r--r--gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp4
-rw-r--r--gdb/testsuite/gdb.threads/infcall-thread-announce.c2
-rw-r--r--gdb/testsuite/gdb.threads/infcall-thread-announce.exp4
-rw-r--r--gdb/testsuite/gdb.threads/info-threads-cur-sal-2.c2
-rw-r--r--gdb/testsuite/gdb.threads/info-threads-cur-sal.c2
-rw-r--r--gdb/testsuite/gdb.threads/info-threads-cur-sal.exp4
-rw-r--r--gdb/testsuite/gdb.threads/info-threads-options.c77
-rw-r--r--gdb/testsuite/gdb.threads/info-threads-options.exp131
-rw-r--r--gdb/testsuite/gdb.threads/interrupt-while-step-over.c2
-rw-r--r--gdb/testsuite/gdb.threads/interrupt-while-step-over.exp12
-rw-r--r--gdb/testsuite/gdb.threads/interrupted-hand-call.c2
-rw-r--r--gdb/testsuite/gdb.threads/interrupted-hand-call.exp4
-rw-r--r--gdb/testsuite/gdb.threads/kill.c2
-rw-r--r--gdb/testsuite/gdb.threads/kill.exp4
-rw-r--r--gdb/testsuite/gdb.threads/killed-outside.c2
-rw-r--r--gdb/testsuite/gdb.threads/killed-outside.exp2
-rw-r--r--gdb/testsuite/gdb.threads/killed.c2
-rw-r--r--gdb/testsuite/gdb.threads/killed.exp16
-rw-r--r--gdb/testsuite/gdb.threads/leader-exit-attach.exp4
-rw-r--r--gdb/testsuite/gdb.threads/leader-exit.c2
-rw-r--r--gdb/testsuite/gdb.threads/leader-exit.exp4
-rw-r--r--gdb/testsuite/gdb.threads/linux-dp.exp12
-rw-r--r--gdb/testsuite/gdb.threads/local-watch-wrong-thread.c2
-rw-r--r--gdb/testsuite/gdb.threads/local-watch-wrong-thread.exp4
-rw-r--r--gdb/testsuite/gdb.threads/main-thread-exit-during-detach.c2
-rw-r--r--gdb/testsuite/gdb.threads/main-thread-exit-during-detach.exp4
-rw-r--r--gdb/testsuite/gdb.threads/manythreads.c2
-rw-r--r--gdb/testsuite/gdb.threads/manythreads.exp6
-rw-r--r--gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp4
-rw-r--r--gdb/testsuite/gdb.threads/multi-create.c2
-rw-r--r--gdb/testsuite/gdb.threads/multi-create.exp4
-rw-r--r--gdb/testsuite/gdb.threads/multiple-step-overs.c2
-rw-r--r--gdb/testsuite/gdb.threads/multiple-step-overs.exp4
-rw-r--r--gdb/testsuite/gdb.threads/multiple-successive-infcall.c2
-rw-r--r--gdb/testsuite/gdb.threads/multiple-successive-infcall.exp4
-rw-r--r--gdb/testsuite/gdb.threads/names.c2
-rw-r--r--gdb/testsuite/gdb.threads/names.exp6
-rw-r--r--gdb/testsuite/gdb.threads/next-bp-other-thread.c2
-rw-r--r--gdb/testsuite/gdb.threads/next-bp-other-thread.exp6
-rw-r--r--gdb/testsuite/gdb.threads/next-fork-exec-other-thread.c2
-rw-r--r--gdb/testsuite/gdb.threads/next-fork-exec-other-thread.exp6
-rw-r--r--gdb/testsuite/gdb.threads/next-fork-other-thread.c2
-rw-r--r--gdb/testsuite/gdb.threads/next-fork-other-thread.exp6
-rw-r--r--gdb/testsuite/gdb.threads/next-while-other-thread-longjmps.c2
-rw-r--r--gdb/testsuite/gdb.threads/next-while-other-thread-longjmps.exp2
-rw-r--r--gdb/testsuite/gdb.threads/no-unwaited-for-left.c2
-rw-r--r--gdb/testsuite/gdb.threads/no-unwaited-for-left.exp4
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exc-1.c2
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exc-1.exp4
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exc-2.c2
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exc-2.exp4
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exc-3.c2
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exc-3.exp4
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exc-4.c2
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exc-4.exp4
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exit.c2
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exit.exp4
-rw-r--r--gdb/testsuite/gdb.threads/non-stop-fair-events.c2
-rw-r--r--gdb/testsuite/gdb.threads/non-stop-fair-events.exp4
-rw-r--r--gdb/testsuite/gdb.threads/omp-par-scope.c2
-rw-r--r--gdb/testsuite/gdb.threads/omp-par-scope.exp6
-rw-r--r--gdb/testsuite/gdb.threads/omp-task.c2
-rw-r--r--gdb/testsuite/gdb.threads/omp-task.exp2
-rw-r--r--gdb/testsuite/gdb.threads/pending-fork-event-detach-ns.c2
-rw-r--r--gdb/testsuite/gdb.threads/pending-fork-event-detach-ns.exp6
-rw-r--r--gdb/testsuite/gdb.threads/pending-fork-event-detach-touch-file.c2
-rw-r--r--gdb/testsuite/gdb.threads/pending-fork-event-detach.c2
-rw-r--r--gdb/testsuite/gdb.threads/pending-fork-event-detach.exp7
-rw-r--r--gdb/testsuite/gdb.threads/pending-step.c2
-rw-r--r--gdb/testsuite/gdb.threads/pending-step.exp4
-rw-r--r--gdb/testsuite/gdb.threads/print-threads.exp12
-rw-r--r--gdb/testsuite/gdb.threads/process-dies-while-detaching.c2
-rw-r--r--gdb/testsuite/gdb.threads/process-dies-while-detaching.exp22
-rw-r--r--gdb/testsuite/gdb.threads/process-dies-while-handling-bp.c2
-rw-r--r--gdb/testsuite/gdb.threads/process-dies-while-handling-bp.exp4
-rw-r--r--gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.c2
-rw-r--r--gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.exp2
-rw-r--r--gdb/testsuite/gdb.threads/pthread_cond_wait.c2
-rw-r--r--gdb/testsuite/gdb.threads/pthread_cond_wait.exp8
-rw-r--r--gdb/testsuite/gdb.threads/pthreads.c2
-rw-r--r--gdb/testsuite/gdb.threads/pthreads.exp4
-rw-r--r--gdb/testsuite/gdb.threads/queue-signal.c2
-rw-r--r--gdb/testsuite/gdb.threads/queue-signal.exp6
-rw-r--r--gdb/testsuite/gdb.threads/reconnect-signal.c2
-rw-r--r--gdb/testsuite/gdb.threads/reconnect-signal.exp2
-rw-r--r--gdb/testsuite/gdb.threads/schedlock-new-thread.c2
-rw-r--r--gdb/testsuite/gdb.threads/schedlock-new-thread.exp8
-rw-r--r--gdb/testsuite/gdb.threads/schedlock-thread-exit.c2
-rw-r--r--gdb/testsuite/gdb.threads/schedlock-thread-exit.exp4
-rw-r--r--gdb/testsuite/gdb.threads/schedlock.c2
-rw-r--r--gdb/testsuite/gdb.threads/schedlock.exp12
-rw-r--r--gdb/testsuite/gdb.threads/siginfo-threads.c2
-rw-r--r--gdb/testsuite/gdb.threads/siginfo-threads.exp4
-rw-r--r--gdb/testsuite/gdb.threads/signal-command-handle-nopass.c2
-rw-r--r--gdb/testsuite/gdb.threads/signal-command-handle-nopass.exp4
-rw-r--r--gdb/testsuite/gdb.threads/signal-command-multiple-signals-pending.c2
-rw-r--r--gdb/testsuite/gdb.threads/signal-command-multiple-signals-pending.exp4
-rw-r--r--gdb/testsuite/gdb.threads/signal-delivered-right-thread.c2
-rw-r--r--gdb/testsuite/gdb.threads/signal-delivered-right-thread.exp4
-rw-r--r--gdb/testsuite/gdb.threads/signal-sigtrap.c2
-rw-r--r--gdb/testsuite/gdb.threads/signal-sigtrap.exp4
-rw-r--r--gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.c2
-rw-r--r--gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp4
-rw-r--r--gdb/testsuite/gdb.threads/sigstep-threads.c2
-rw-r--r--gdb/testsuite/gdb.threads/sigstep-threads.exp6
-rw-r--r--gdb/testsuite/gdb.threads/sigthread.exp4
-rw-r--r--gdb/testsuite/gdb.threads/slow-waitpid.c2
-rw-r--r--gdb/testsuite/gdb.threads/staticthreads.c2
-rw-r--r--gdb/testsuite/gdb.threads/staticthreads.exp12
-rw-r--r--gdb/testsuite/gdb.threads/step-N-all-progress.c2
-rw-r--r--gdb/testsuite/gdb.threads/step-N-all-progress.exp4
-rw-r--r--gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.c2
-rw-r--r--gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp6
-rw-r--r--gdb/testsuite/gdb.threads/step-over-exec-execd.c2
-rw-r--r--gdb/testsuite/gdb.threads/step-over-exec.c2
-rw-r--r--gdb/testsuite/gdb.threads/step-over-exec.exp7
-rw-r--r--gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.c2
-rw-r--r--gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp4
-rw-r--r--gdb/testsuite/gdb.threads/step-over-thread-exit-while-stop-all-threads.c2
-rw-r--r--gdb/testsuite/gdb.threads/step-over-thread-exit-while-stop-all-threads.exp4
-rw-r--r--gdb/testsuite/gdb.threads/step-over-thread-exit.c2
-rw-r--r--gdb/testsuite/gdb.threads/step-over-thread-exit.exp4
-rw-r--r--gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.c2
-rw-r--r--gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp8
-rw-r--r--gdb/testsuite/gdb.threads/stepi-over-clone.c2
-rw-r--r--gdb/testsuite/gdb.threads/stepi-over-clone.exp10
-rw-r--r--gdb/testsuite/gdb.threads/stepi-random-signal.c2
-rw-r--r--gdb/testsuite/gdb.threads/stepi-random-signal.exp4
-rw-r--r--gdb/testsuite/gdb.threads/stop-with-handle.c2
-rw-r--r--gdb/testsuite/gdb.threads/stop-with-handle.exp2
-rw-r--r--gdb/testsuite/gdb.threads/switch-threads.c2
-rw-r--r--gdb/testsuite/gdb.threads/switch-threads.exp4
-rw-r--r--gdb/testsuite/gdb.threads/thread-bp-deleted.c2
-rw-r--r--gdb/testsuite/gdb.threads/thread-bp-deleted.exp13
-rw-r--r--gdb/testsuite/gdb.threads/thread-execl.c12
-rw-r--r--gdb/testsuite/gdb.threads/thread-execl.exp6
-rw-r--r--gdb/testsuite/gdb.threads/thread-find.exp4
-rw-r--r--gdb/testsuite/gdb.threads/thread-specific-bp.c2
-rw-r--r--gdb/testsuite/gdb.threads/thread-specific-bp.exp4
-rw-r--r--gdb/testsuite/gdb.threads/thread-specific.c2
-rw-r--r--gdb/testsuite/gdb.threads/thread-specific.exp4
-rw-r--r--gdb/testsuite/gdb.threads/thread-unwindonsignal.exp4
-rw-r--r--gdb/testsuite/gdb.threads/thread_check.c2
-rw-r--r--gdb/testsuite/gdb.threads/thread_check.exp12
-rw-r--r--gdb/testsuite/gdb.threads/thread_events.c2
-rw-r--r--gdb/testsuite/gdb.threads/thread_events.exp2
-rw-r--r--gdb/testsuite/gdb.threads/threadapply.c2
-rw-r--r--gdb/testsuite/gdb.threads/threadapply.exp20
-rw-r--r--gdb/testsuite/gdb.threads/threadcrash.c2
-rw-r--r--gdb/testsuite/gdb.threads/threadcrash.exp15
-rw-r--r--gdb/testsuite/gdb.threads/threads-after-exec.c2
-rw-r--r--gdb/testsuite/gdb.threads/threads-after-exec.exp6
-rw-r--r--gdb/testsuite/gdb.threads/threxit-hop-specific.c2
-rw-r--r--gdb/testsuite/gdb.threads/threxit-hop-specific.exp4
-rw-r--r--gdb/testsuite/gdb.threads/tid-reuse.c2
-rw-r--r--gdb/testsuite/gdb.threads/tid-reuse.exp6
-rw-r--r--gdb/testsuite/gdb.threads/tls-core.c2
-rw-r--r--gdb/testsuite/gdb.threads/tls-core.exp6
-rw-r--r--gdb/testsuite/gdb.threads/tls-nodebug-pie.c2
-rw-r--r--gdb/testsuite/gdb.threads/tls-nodebug-pie.exp4
-rw-r--r--gdb/testsuite/gdb.threads/tls-nodebug.exp4
-rw-r--r--gdb/testsuite/gdb.threads/tls-sepdebug-main.c2
-rw-r--r--gdb/testsuite/gdb.threads/tls-sepdebug-shared.c2
-rw-r--r--gdb/testsuite/gdb.threads/tls-sepdebug.exp4
-rw-r--r--gdb/testsuite/gdb.threads/tls-shared.exp6
-rw-r--r--gdb/testsuite/gdb.threads/tls-so_extern.c2
-rw-r--r--gdb/testsuite/gdb.threads/tls-so_extern.exp4
-rw-r--r--gdb/testsuite/gdb.threads/tls-so_extern_main.c2
-rw-r--r--gdb/testsuite/gdb.threads/tls-var-main.c2
-rw-r--r--gdb/testsuite/gdb.threads/tls-var.c2
-rw-r--r--gdb/testsuite/gdb.threads/tls-var.exp4
-rw-r--r--gdb/testsuite/gdb.threads/tls.exp22
-rw-r--r--gdb/testsuite/gdb.threads/tls2.c2
-rw-r--r--gdb/testsuite/gdb.threads/vfork-follow-child-exec.c2
-rw-r--r--gdb/testsuite/gdb.threads/vfork-follow-child-exec.exp6
-rw-r--r--gdb/testsuite/gdb.threads/vfork-follow-child-exit.c2
-rw-r--r--gdb/testsuite/gdb.threads/vfork-follow-child-exit.exp6
-rw-r--r--gdb/testsuite/gdb.threads/vfork-multi-inferior-sleep.c2
-rw-r--r--gdb/testsuite/gdb.threads/vfork-multi-inferior.c2
-rw-r--r--gdb/testsuite/gdb.threads/vfork-multi-inferior.exp6
-rw-r--r--gdb/testsuite/gdb.threads/vfork-multi-thread.c2
-rw-r--r--gdb/testsuite/gdb.threads/vfork-multi-thread.exp6
-rw-r--r--gdb/testsuite/gdb.threads/watchpoint-fork-child.c2
-rw-r--r--gdb/testsuite/gdb.threads/watchpoint-fork-mt.c2
-rw-r--r--gdb/testsuite/gdb.threads/watchpoint-fork-parent.c2
-rw-r--r--gdb/testsuite/gdb.threads/watchpoint-fork-st.c2
-rw-r--r--gdb/testsuite/gdb.threads/watchpoint-fork.exp10
-rw-r--r--gdb/testsuite/gdb.threads/watchpoint-fork.h2
-rw-r--r--gdb/testsuite/gdb.threads/watchthreads-reorder.c2
-rw-r--r--gdb/testsuite/gdb.threads/watchthreads-reorder.exp6
-rw-r--r--gdb/testsuite/gdb.threads/watchthreads.c2
-rw-r--r--gdb/testsuite/gdb.threads/watchthreads.exp32
-rw-r--r--gdb/testsuite/gdb.threads/watchthreads2.c2
-rw-r--r--gdb/testsuite/gdb.threads/watchthreads2.exp8
-rw-r--r--gdb/testsuite/gdb.threads/wp-replication.c2
-rw-r--r--gdb/testsuite/gdb.threads/wp-replication.exp6
-rw-r--r--gdb/testsuite/gdb.trace/actions-changed.c2
-rw-r--r--gdb/testsuite/gdb.trace/actions-changed.exp6
-rw-r--r--gdb/testsuite/gdb.trace/actions.c2
-rw-r--r--gdb/testsuite/gdb.trace/actions.exp10
-rw-r--r--gdb/testsuite/gdb.trace/ax.exp4
-rw-r--r--gdb/testsuite/gdb.trace/backtrace.exp12
-rw-r--r--gdb/testsuite/gdb.trace/basic-libipa.c2
-rw-r--r--gdb/testsuite/gdb.trace/basic-libipa.exp4
-rw-r--r--gdb/testsuite/gdb.trace/change-loc-1.c2
-rw-r--r--gdb/testsuite/gdb.trace/change-loc-2.c2
-rw-r--r--gdb/testsuite/gdb.trace/change-loc.c2
-rw-r--r--gdb/testsuite/gdb.trace/change-loc.exp16
-rw-r--r--gdb/testsuite/gdb.trace/change-loc.h2
-rw-r--r--gdb/testsuite/gdb.trace/circ.c2
-rw-r--r--gdb/testsuite/gdb.trace/circ.exp4
-rw-r--r--gdb/testsuite/gdb.trace/collection.c2
-rw-r--r--gdb/testsuite/gdb.trace/collection.exp8
-rw-r--r--gdb/testsuite/gdb.trace/deltrace.exp10
-rw-r--r--gdb/testsuite/gdb.trace/disconnected-tracing.c2
-rw-r--r--gdb/testsuite/gdb.trace/disconnected-tracing.exp14
-rw-r--r--gdb/testsuite/gdb.trace/entry-values.c2
-rw-r--r--gdb/testsuite/gdb.trace/entry-values.exp76
-rw-r--r--gdb/testsuite/gdb.trace/ftrace-lock.c2
-rw-r--r--gdb/testsuite/gdb.trace/ftrace-lock.exp14
-rw-r--r--gdb/testsuite/gdb.trace/ftrace.c2
-rw-r--r--gdb/testsuite/gdb.trace/ftrace.exp16
-rw-r--r--gdb/testsuite/gdb.trace/infotrace.exp6
-rw-r--r--gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp8
-rw-r--r--gdb/testsuite/gdb.trace/mi-trace-save.exp2
-rw-r--r--gdb/testsuite/gdb.trace/mi-trace-unavailable.exp16
-rw-r--r--gdb/testsuite/gdb.trace/mi-traceframe-changed.exp18
-rw-r--r--gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp13
-rw-r--r--gdb/testsuite/gdb.trace/mi-tsv-changed.exp23
-rw-r--r--gdb/testsuite/gdb.trace/no-attach-trace.c2
-rw-r--r--gdb/testsuite/gdb.trace/no-attach-trace.exp4
-rw-r--r--gdb/testsuite/gdb.trace/packetlen.exp4
-rw-r--r--gdb/testsuite/gdb.trace/passc-dyn.exp14
-rw-r--r--gdb/testsuite/gdb.trace/passcount.exp8
-rw-r--r--gdb/testsuite/gdb.trace/pending.c2
-rw-r--r--gdb/testsuite/gdb.trace/pending.exp24
-rw-r--r--gdb/testsuite/gdb.trace/pendshr1.c2
-rw-r--r--gdb/testsuite/gdb.trace/pendshr2.c2
-rw-r--r--gdb/testsuite/gdb.trace/pr16508.exp10
-rw-r--r--gdb/testsuite/gdb.trace/qtro.c2
-rw-r--r--gdb/testsuite/gdb.trace/qtro.exp6
-rw-r--r--gdb/testsuite/gdb.trace/range-stepping.c2
-rw-r--r--gdb/testsuite/gdb.trace/range-stepping.exp14
-rw-r--r--gdb/testsuite/gdb.trace/read-memory.c2
-rw-r--r--gdb/testsuite/gdb.trace/read-memory.exp8
-rw-r--r--gdb/testsuite/gdb.trace/report.exp24
-rw-r--r--gdb/testsuite/gdb.trace/save-trace.exp16
-rw-r--r--gdb/testsuite/gdb.trace/signal.c2
-rw-r--r--gdb/testsuite/gdb.trace/signal.exp14
-rw-r--r--gdb/testsuite/gdb.trace/stap-trace.c2
-rw-r--r--gdb/testsuite/gdb.trace/stap-trace.exp2
-rw-r--r--gdb/testsuite/gdb.trace/status-stop.c2
-rw-r--r--gdb/testsuite/gdb.trace/status-stop.exp16
-rw-r--r--gdb/testsuite/gdb.trace/strace.c2
-rw-r--r--gdb/testsuite/gdb.trace/strace.exp20
-rw-r--r--gdb/testsuite/gdb.trace/tfile.c2
-rw-r--r--gdb/testsuite/gdb.trace/tfile.exp6
-rw-r--r--gdb/testsuite/gdb.trace/tfind.exp16
-rw-r--r--gdb/testsuite/gdb.trace/trace-break.c2
-rw-r--r--gdb/testsuite/gdb.trace/trace-break.exp30
-rw-r--r--gdb/testsuite/gdb.trace/trace-buffer-size.c2
-rw-r--r--gdb/testsuite/gdb.trace/trace-buffer-size.exp10
-rw-r--r--gdb/testsuite/gdb.trace/trace-common.h2
-rw-r--r--gdb/testsuite/gdb.trace/trace-condition.c2
-rw-r--r--gdb/testsuite/gdb.trace/trace-condition.exp14
-rw-r--r--gdb/testsuite/gdb.trace/trace-enable-disable.c2
-rw-r--r--gdb/testsuite/gdb.trace/trace-enable-disable.exp8
-rw-r--r--gdb/testsuite/gdb.trace/trace-mt.c2
-rw-r--r--gdb/testsuite/gdb.trace/trace-mt.exp34
-rw-r--r--gdb/testsuite/gdb.trace/trace-unavailable.c2
-rw-r--r--gdb/testsuite/gdb.trace/tracecmd.exp8
-rw-r--r--gdb/testsuite/gdb.trace/tracefile-pseudo-reg.c2
-rw-r--r--gdb/testsuite/gdb.trace/tracefile-pseudo-reg.exp6
-rw-r--r--gdb/testsuite/gdb.trace/tspeed.c2
-rw-r--r--gdb/testsuite/gdb.trace/tspeed.exp10
-rw-r--r--gdb/testsuite/gdb.trace/tstatus.exp10
-rw-r--r--gdb/testsuite/gdb.trace/tsv.exp8
-rw-r--r--gdb/testsuite/gdb.trace/unavailable-dwarf-piece.c2
-rw-r--r--gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp248
-rw-r--r--gdb/testsuite/gdb.trace/unavailable.cc2
-rw-r--r--gdb/testsuite/gdb.trace/unavailable.exp6
-rw-r--r--gdb/testsuite/gdb.trace/while-dyn.exp4
-rw-r--r--gdb/testsuite/gdb.trace/while-stepping.exp4
-rw-r--r--gdb/testsuite/gdb.tui/basic.exp8
-rw-r--r--gdb/testsuite/gdb.tui/break.exp2
-rw-r--r--gdb/testsuite/gdb.tui/color-prompt.exp12
-rw-r--r--gdb/testsuite/gdb.tui/color-prompt.exp.tcl80
-rw-r--r--gdb/testsuite/gdb.tui/compact-source.exp10
-rw-r--r--gdb/testsuite/gdb.tui/completion.exp2
-rw-r--r--gdb/testsuite/gdb.tui/corefile-run.exp4
-rw-r--r--gdb/testsuite/gdb.tui/empty.exp4
-rw-r--r--gdb/testsuite/gdb.tui/esc-match.exp48
-rw-r--r--gdb/testsuite/gdb.tui/esc-match.py26
-rwxr-xr-xgdb/testsuite/gdb.tui/gdb.sh20
-rw-r--r--gdb/testsuite/gdb.tui/info-win.exp2
-rw-r--r--gdb/testsuite/gdb.tui/list-before.exp2
-rw-r--r--gdb/testsuite/gdb.tui/list.exp2
-rw-r--r--gdb/testsuite/gdb.tui/long-prompt.exp2
-rw-r--r--gdb/testsuite/gdb.tui/main-2.exp8
-rw-r--r--gdb/testsuite/gdb.tui/main-one-line.c2
-rw-r--r--gdb/testsuite/gdb.tui/main.exp7
-rw-r--r--gdb/testsuite/gdb.tui/narrow.exp2
-rw-r--r--gdb/testsuite/gdb.tui/new-layout.exp22
-rw-r--r--gdb/testsuite/gdb.tui/pr30056.exp119
-rw-r--r--gdb/testsuite/gdb.tui/regs.exp2
-rw-r--r--gdb/testsuite/gdb.tui/reread.exp2
-rw-r--r--gdb/testsuite/gdb.tui/resize-2.exp2
-rw-r--r--gdb/testsuite/gdb.tui/resize-one-line.exp2
-rw-r--r--gdb/testsuite/gdb.tui/resize.exp2
-rw-r--r--gdb/testsuite/gdb.tui/scroll.exp2
-rw-r--r--gdb/testsuite/gdb.tui/secondary-prompt.exp2
-rw-r--r--gdb/testsuite/gdb.tui/single-key-2.exp2
-rw-r--r--gdb/testsuite/gdb.tui/single-key.exp2
-rw-r--r--gdb/testsuite/gdb.tui/small-term.exp2
-rw-r--r--gdb/testsuite/gdb.tui/source-search.c127
-rw-r--r--gdb/testsuite/gdb.tui/source-search.exp72
-rw-r--r--gdb/testsuite/gdb.tui/tui-disasm-long-lines.c2
-rw-r--r--gdb/testsuite/gdb.tui/tui-disasm-long-lines.exp4
-rw-r--r--gdb/testsuite/gdb.tui/tui-disasm-styling.exp5
-rw-r--r--gdb/testsuite/gdb.tui/tui-focus.c2
-rw-r--r--gdb/testsuite/gdb.tui/tui-focus.exp8
-rw-r--r--gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.S5
-rw-r--r--gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.exp16
-rw-r--r--gdb/testsuite/gdb.tui/tui-layout-asm.exp108
-rw-r--r--gdb/testsuite/gdb.tui/tui-layout.c2
-rw-r--r--gdb/testsuite/gdb.tui/tui-layout.exp8
-rw-r--r--gdb/testsuite/gdb.tui/tui-long-line.c24
-rw-r--r--gdb/testsuite/gdb.tui/tui-missing-src.exp9
-rw-r--r--gdb/testsuite/gdb.tui/tui-mode-switch.exp57
-rw-r--r--gdb/testsuite/gdb.tui/tui-nl-filtered-output.exp2
-rw-r--r--gdb/testsuite/gdb.tui/tuiterm-2.exp80
-rw-r--r--gdb/testsuite/gdb.tui/tuiterm.exp68
-rw-r--r--gdb/testsuite/gdb.tui/winheight.exp13
-rw-r--r--gdb/testsuite/gdb.tui/winwidth.exp2
-rw-r--r--gdb/testsuite/gdb.tui/wrap-line.exp32
-rw-r--r--gdb/testsuite/gdb.xml/bad-include.xml2
-rw-r--r--gdb/testsuite/gdb.xml/maint-xml-dump.exp2
-rw-r--r--gdb/testsuite/gdb.xml/maint_print_struct.exp2
-rw-r--r--gdb/testsuite/gdb.xml/maint_print_struct.xml2
-rw-r--r--gdb/testsuite/gdb.xml/tdesc-arch.exp2
-rw-r--r--gdb/testsuite/gdb.xml/tdesc-errors.exp2
-rw-r--r--gdb/testsuite/gdb.xml/tdesc-regs.exp2
-rw-r--r--gdb/testsuite/gdb.xml/tdesc-reload.c2
-rw-r--r--gdb/testsuite/gdb.xml/tdesc-reload.exp2
-rw-r--r--gdb/testsuite/gdb.xml/tdesc-xinclude.exp4
-rw-r--r--gdb/testsuite/lib/aarch64-scalable.exp24
-rw-r--r--gdb/testsuite/lib/aarch64-test-sme.c2
-rw-r--r--gdb/testsuite/lib/aarch64-test-sve.c2
-rw-r--r--gdb/testsuite/lib/aarch64.exp10
-rw-r--r--gdb/testsuite/lib/ada.exp7
-rw-r--r--gdb/testsuite/lib/append_gdb_boards_dir.exp2
-rw-r--r--gdb/testsuite/lib/attributes.h2
-rw-r--r--gdb/testsuite/lib/build-piece.exp2
-rw-r--r--gdb/testsuite/lib/cache.exp25
-rw-r--r--gdb/testsuite/lib/check-test-names.exp14
-rw-r--r--gdb/testsuite/lib/cl_util.c2
-rw-r--r--gdb/testsuite/lib/cl_util.h2
-rw-r--r--gdb/testsuite/lib/compile-support.exp12
-rw-r--r--gdb/testsuite/lib/compiler.F902
-rw-r--r--gdb/testsuite/lib/compiler.c2
-rwxr-xr-xgdb/testsuite/lib/compiler.cc2
-rw-r--r--gdb/testsuite/lib/completion-support.exp4
-rw-r--r--gdb/testsuite/lib/cp-support.exp11
-rw-r--r--gdb/testsuite/lib/d-support.exp9
-rw-r--r--gdb/testsuite/lib/dap-support.exp16
-rw-r--r--gdb/testsuite/lib/data-structures.exp2
-rw-r--r--gdb/testsuite/lib/debuginfod-support.exp8
-rwxr-xr-xgdb/testsuite/lib/dg-add-core-file-count.sh2
-rw-r--r--gdb/testsuite/lib/dtrace.exp4
-rw-r--r--gdb/testsuite/lib/dwarf.exp732
-rw-r--r--gdb/testsuite/lib/fortran.exp9
-rw-r--r--gdb/testsuite/lib/future.exp33
-rw-r--r--gdb/testsuite/lib/gdb-guile.exp6
-rw-r--r--gdb/testsuite/lib/gdb-python.exp23
-rw-r--r--gdb/testsuite/lib/gdb-utils.exp16
-rw-r--r--gdb/testsuite/lib/gdb.exp1244
-rw-r--r--gdb/testsuite/lib/gdb_watchdog.h75
-rw-r--r--gdb/testsuite/lib/gdbreplay-support.exp59
-rw-r--r--gdb/testsuite/lib/gdbserver-support.exp40
-rw-r--r--gdb/testsuite/lib/gen-perf-test.exp48
-rw-r--r--gdb/testsuite/lib/go.exp9
-rw-r--r--gdb/testsuite/lib/jit-elf-helpers.exp4
-rw-r--r--gdb/testsuite/lib/memory.exp2
-rw-r--r--gdb/testsuite/lib/mi-support.exp90
-rw-r--r--gdb/testsuite/lib/my-syscalls.S2
-rw-r--r--gdb/testsuite/lib/my-syscalls.h2
-rwxr-xr-xgdb/testsuite/lib/notty-wrap2
-rw-r--r--gdb/testsuite/lib/objc.exp9
-rw-r--r--gdb/testsuite/lib/opencl.exp2
-rw-r--r--gdb/testsuite/lib/opencl_hostapp.c2
-rw-r--r--gdb/testsuite/lib/pascal.exp37
-rwxr-xr-xgdb/testsuite/lib/pdtrace.in2
-rw-r--r--gdb/testsuite/lib/perftest.exp13
-rw-r--r--gdb/testsuite/lib/precise-aligned-alloc.c2
-rw-r--r--gdb/testsuite/lib/prelink-support.exp20
-rw-r--r--gdb/testsuite/lib/prompt.exp6
-rw-r--r--gdb/testsuite/lib/range-stepping-support.exp2
-rw-r--r--gdb/testsuite/lib/read1.c2
-rw-r--r--gdb/testsuite/lib/rocm.exp2
-rw-r--r--gdb/testsuite/lib/rust-support.exp9
-rw-r--r--gdb/testsuite/lib/selftest-support.exp222
-rw-r--r--gdb/testsuite/lib/set_unbuffered_mode.c2
-rw-r--r--gdb/testsuite/lib/sym-info-cmds.exp2
-rw-r--r--gdb/testsuite/lib/trace-support.exp36
-rw-r--r--gdb/testsuite/lib/tuiterm.exp2368
-rw-r--r--gdb/testsuite/lib/unbuffer_output.c2
-rw-r--r--gdb/testsuite/lib/valgrind.exp2
-rwxr-xr-xgdb/testsuite/make-check-all.sh7
-rwxr-xr-xgdb/testsuite/print-ts.py2
-rw-r--r--gdb/thread-fsm.h2
-rw-r--r--gdb/thread-iter.c2
-rw-r--r--gdb/thread-iter.h34
-rw-r--r--gdb/thread.c256
-rw-r--r--gdb/tic6x-linux-tdep.c8
-rw-r--r--gdb/tic6x-tdep.c8
-rw-r--r--gdb/tic6x-tdep.h2
-rw-r--r--gdb/tid-parse.c15
-rw-r--r--gdb/tid-parse.h2
-rw-r--r--gdb/tilegx-linux-nat.c6
-rw-r--r--gdb/tilegx-linux-tdep.c13
-rw-r--r--gdb/tilegx-tdep.c6
-rw-r--r--gdb/tilegx-tdep.h2
-rw-r--r--gdb/top.c21
-rw-r--r--gdb/top.h2
-rw-r--r--gdb/tracectf.c9
-rw-r--r--gdb/tracectf.h2
-rw-r--r--gdb/tracefile-tfile.c20
-rw-r--r--gdb/tracefile.c6
-rw-r--r--gdb/tracefile.h2
-rw-r--r--gdb/tracepoint.c34
-rw-r--r--gdb/tracepoint.h2
-rw-r--r--gdb/trad-frame.c2
-rw-r--r--gdb/trad-frame.h2
-rw-r--r--gdb/tramp-frame.c2
-rw-r--r--gdb/tramp-frame.h2
-rw-r--r--gdb/transform.m42
-rw-r--r--gdb/tsan-suppressions.txt2
-rw-r--r--gdb/tui/tui-command.c2
-rw-r--r--gdb/tui/tui-command.h2
-rw-r--r--gdb/tui/tui-data.c2
-rw-r--r--gdb/tui/tui-data.h2
-rw-r--r--gdb/tui/tui-disasm.c40
-rw-r--r--gdb/tui/tui-disasm.h2
-rw-r--r--gdb/tui/tui-file.c8
-rw-r--r--gdb/tui/tui-file.h13
-rw-r--r--gdb/tui/tui-hooks.c6
-rw-r--r--gdb/tui/tui-hooks.h2
-rw-r--r--gdb/tui/tui-interp.c6
-rw-r--r--gdb/tui/tui-io.c14
-rw-r--r--gdb/tui/tui-io.h2
-rw-r--r--gdb/tui/tui-layout.c13
-rw-r--r--gdb/tui/tui-layout.h2
-rw-r--r--gdb/tui/tui-location.c2
-rw-r--r--gdb/tui/tui-location.h2
-rw-r--r--gdb/tui/tui-regs.c6
-rw-r--r--gdb/tui/tui-regs.h2
-rw-r--r--gdb/tui/tui-source.c2
-rw-r--r--gdb/tui/tui-source.h2
-rw-r--r--gdb/tui/tui-status.c14
-rw-r--r--gdb/tui/tui-status.h2
-rw-r--r--gdb/tui/tui-win.c9
-rw-r--r--gdb/tui/tui-win.h2
-rw-r--r--gdb/tui/tui-wingeneral.c2
-rw-r--r--gdb/tui/tui-wingeneral.h2
-rw-r--r--gdb/tui/tui-winsource.c9
-rw-r--r--gdb/tui/tui-winsource.h2
-rw-r--r--gdb/tui/tui.c39
-rw-r--r--gdb/tui/tui.h2
-rw-r--r--gdb/type-codes.def2
-rw-r--r--gdb/type-stack.c8
-rw-r--r--gdb/type-stack.h145
-rw-r--r--gdb/typeprint.c13
-rw-r--r--gdb/typeprint.h2
-rw-r--r--gdb/ui-file.c78
-rw-r--r--gdb/ui-file.h63
-rw-r--r--gdb/ui-out.c4
-rw-r--r--gdb/ui-out.h2
-rw-r--r--gdb/ui-style.c94
-rw-r--r--gdb/ui-style.h70
-rw-r--r--gdb/ui.c6
-rw-r--r--gdb/ui.h6
-rw-r--r--gdb/unittests/array-view-selftests.c6
-rw-r--r--gdb/unittests/child-path-selftests.c6
-rw-r--r--gdb/unittests/cli-utils-selftests.c6
-rw-r--r--gdb/unittests/command-def-selftests.c10
-rw-r--r--gdb/unittests/common-utils-selftests.c6
-rw-r--r--gdb/unittests/copy_bitwise-selftests.c6
-rw-r--r--gdb/unittests/enum-flags-selftests.c7
-rw-r--r--gdb/unittests/environ-selftests.c6
-rw-r--r--gdb/unittests/filtered_iterator-selftests.c71
-rw-r--r--gdb/unittests/format_pieces-selftests.c100
-rw-r--r--gdb/unittests/frame_info_ptr-selftests.c6
-rw-r--r--gdb/unittests/function-view-selftests.c6
-rw-r--r--gdb/unittests/gdb_tilde_expand-selftests.c6
-rw-r--r--gdb/unittests/gmp-utils-selftests.c7
-rw-r--r--gdb/unittests/intrusive_list-selftests.c7
-rw-r--r--gdb/unittests/lookup_name_info-selftests.c6
-rw-r--r--gdb/unittests/main-thread-selftests.c6
-rw-r--r--gdb/unittests/memory-map-selftests.c6
-rw-r--r--gdb/unittests/memrange-selftests.c6
-rw-r--r--gdb/unittests/mkdir-recursive-selftests.c6
-rw-r--r--gdb/unittests/observable-selftests.c6
-rw-r--r--gdb/unittests/offset-type-selftests.c6
-rw-r--r--gdb/unittests/packed-selftests.c6
-rw-r--r--gdb/unittests/parallel-for-selftests.c189
-rw-r--r--gdb/unittests/parse-connection-spec-selftests.c6
-rw-r--r--gdb/unittests/path-join-selftests.c6
-rw-r--r--gdb/unittests/ptid-selftests.c2
-rw-r--r--gdb/unittests/remote-arg-selftests.c163
-rw-r--r--gdb/unittests/rsp-low-selftests.c8
-rw-r--r--gdb/unittests/scoped_fd-selftests.c6
-rw-r--r--gdb/unittests/scoped_ignore_signal-selftests.c6
-rw-r--r--gdb/unittests/scoped_mmap-selftests.c10
-rw-r--r--gdb/unittests/scoped_restore-selftests.c6
-rw-r--r--gdb/unittests/search-memory-selftests.c6
-rw-r--r--gdb/unittests/style-selftests.c38
-rw-r--r--gdb/unittests/tracepoint-selftests.c6
-rw-r--r--gdb/unittests/tui-selftests.c6
-rw-r--r--gdb/unittests/ui-file-selftests.c6
-rw-r--r--gdb/unittests/unique_xmalloc_ptr_char.c6
-rw-r--r--gdb/unittests/unpack-selftests.c6
-rw-r--r--gdb/unittests/utils-selftests.c59
-rw-r--r--gdb/unittests/vec-utils-selftests.c6
-rw-r--r--gdb/unittests/xml-utils-selftests.c6
-rw-r--r--gdb/unwind_stop_reasons.def2
-rw-r--r--gdb/user-regs.c6
-rw-r--r--gdb/user-regs.h2
-rw-r--r--gdb/utils.c172
-rw-r--r--gdb/utils.h7
-rw-r--r--gdb/v850-tdep.c6
-rw-r--r--gdb/valarith.c2
-rw-r--r--gdb/valops.c50
-rw-r--r--gdb/valprint.c7
-rw-r--r--gdb/valprint.h2
-rw-r--r--gdb/value.c42
-rw-r--r--gdb/value.h27
-rw-r--r--gdb/varobj-iter.h2
-rw-r--r--gdb/varobj.c8
-rw-r--r--gdb/varobj.h2
-rw-r--r--gdb/vax-bsd-nat.c6
-rw-r--r--gdb/vax-netbsd-tdep.c9
-rw-r--r--gdb/vax-tdep.c8
-rw-r--r--gdb/vax-tdep.h2
-rw-r--r--gdb/version.in2
-rw-r--r--gdb/windows-nat.c24
-rw-r--r--gdb/windows-nat.h6
-rw-r--r--gdb/windows-tdep.c119
-rw-r--r--gdb/windows-tdep.h3
-rw-r--r--gdb/x86-bsd-nat.c10
-rw-r--r--gdb/x86-bsd-nat.h2
-rw-r--r--gdb/x86-fbsd-nat.c2
-rw-r--r--gdb/x86-fbsd-nat.h2
-rw-r--r--gdb/x86-gnu-nat.c6
-rw-r--r--gdb/x86-linux-nat.c54
-rw-r--r--gdb/x86-linux-nat.h13
-rw-r--r--gdb/x86-nat.c2
-rw-r--r--gdb/x86-nat.h2
-rw-r--r--gdb/x86-tdep.c23
-rw-r--r--gdb/x86-tdep.h11
-rw-r--r--gdb/xcoffread.c13
-rw-r--r--gdb/xcoffread.h2
-rw-r--r--gdb/xml-builtin.h2
-rw-r--r--gdb/xml-support.c12
-rw-r--r--gdb/xml-support.h2
-rw-r--r--gdb/xml-syscall.c4
-rw-r--r--gdb/xml-syscall.h2
-rw-r--r--gdb/xml-tdesc.c4
-rw-r--r--gdb/xml-tdesc.h2
-rw-r--r--gdb/xstormy16-tdep.c16
-rw-r--r--gdb/xtensa-config.c2
-rw-r--r--gdb/xtensa-linux-nat.c6
-rw-r--r--gdb/xtensa-linux-tdep.c10
-rw-r--r--gdb/xtensa-tdep.c11
-rw-r--r--gdb/xtensa-tdep.h2
-rw-r--r--gdb/xtensa-xtregs.c2
-rw-r--r--gdb/yy-remap.h2
-rw-r--r--gdb/z80-tdep.c35
-rw-r--r--gdb/z80-tdep.h2
6972 files changed, 65760 insertions, 33477 deletions
diff --git a/gdb/.dir-locals.el b/gdb/.dir-locals.el
index eb4edba..8228d2b 100644
--- a/gdb/.dir-locals.el
+++ b/gdb/.dir-locals.el
@@ -1,5 +1,5 @@
;; Emacs settings.
-;; Copyright (C) 2012-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2025 Free Software Foundation, Inc.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS
index 187a1f6..c6189bc 100644
--- a/gdb/MAINTAINERS
+++ b/gdb/MAINTAINERS
@@ -234,7 +234,7 @@ Pedro Alves pedro@palves.net
John Baldwin jhb@freebsd.org
Kevin Buettner kevinb@redhat.com
Andrew Burgess aburgess@redhat.com
-Luis Machado luis.machado@arm.com
+Luis Machado luis.machado.foss@gmail.com
Simon Marchi simon.marchi@polymtl.ca
Tom Tromey tom@tromey.com
Tom de Vries tdevries@suse.de
@@ -320,7 +320,7 @@ the native maintainer when resolving ABI issues.
aarch64 --target=aarch64-elf
Alan Hayward alan.hayward@arm.com
- Luis Machado luis.machado@arm.com
+ Luis Machado luis.machado.foss@gmail.com
alpha --target=alpha-elf
@@ -332,7 +332,7 @@ the native maintainer when resolving ABI issues.
arm --target=arm-elf
Alan Hayward alan.hayward@arm.com
- Luis Machado luis.machado@arm.com
+ Luis Machado luis.machado.foss@gmail.com
avr --target=avr
@@ -492,7 +492,7 @@ sim/ See sim/MAINTAINERS
readline/ Master version: ftp://ftp.cwru.edu/pub/bash/
ALL
- Host maintainers (host dependant parts)
+ Host maintainers (host dependent parts)
(but get your changes into the master version)
tcl/ tk/ itcl/ ALL
@@ -554,6 +554,7 @@ Paul Brook paul@codesourcery.com
Julian Brown julian@codesourcery.com
Iain Buclaw ibuclaw@gdcproject.org
Kevin Buettner kevinb@redhat.com
+Gopi Kumar Bulusu gopi@sankhya.com
Richard Bunt richard.bunt@linaro.org
Andrew Burgess aburgess@redhat.com
David Carlton carlton@bactrian.org
@@ -567,6 +568,7 @@ J.T. Conklin jtc@acorntoolworks.com
Brendan Conoboy blc@redhat.com
Ludovic Courtès ludo@gnu.org
Tiago Stürmer Daitx tdaitx@linux.vnet.ibm.com
+Sébastien Darche sdarche@efficios.com
Sanjoy Das sanjoy@playingwithpointers.com
Jean-Charles Delay delay@adacore.com
DJ Delorie dj@redhat.com
@@ -602,15 +604,18 @@ Klaus Gerlicher klaus.gerlicher@intel.com
Mircea Gherzan mircea.gherzan@intel.com
Paul Gilliam pgilliam@us.ibm.com
Tristan Gingold tgingold@free.fr
+Timur Golubovich timurgol007@gmail.com
Anton Gorenkov xgsa@yandex.ru
Raoul Gough RaoulGough@yahoo.co.uk
Anthony Green green@redhat.com
Matthew Green mrg@eterna.com.au
Matthew Gretton-Dann matthew.gretton-dann@arm.com
+Aaron Griffith aargri@gmail.com
Maxim Grigoriev maxim2405@gmail.com
Jerome Guitton guitton@act-europe.fr
Alexandra Hájková ahajkova@redhat.com
Ben Harris bjh21@netbsd.org
+Jannik Hartung peacemakerctf@gmail.com
Alan Hayward alan.hayward@arm.com
Bernhard Heckel heckel_bernhard@web.de
Richard Henderson rth@redhat.com
@@ -682,6 +687,7 @@ Fawzi Mohamed fawzi.mohamed@nokia.com
Jason Molenda jmolenda@apple.com
Chris Moller cmoller@redhat.com
Patrick Monnerat patrick@monnerat.net
+Pietro Monteiro pietro@sociotechnical.xyz
Phil Muldoon pmuldoon@redhat.com
Pierre Muller muller@sourceware.org
Gaius Mulley gaiusmod2@gmail.com
@@ -724,6 +730,7 @@ Theodore A. Roth troth@openavr.org
Yvan Roux yvan.roux@foss.st.com
Ian Roxborough irox@redhat.com
Maciej W. Rozycki macro@orcam.me.uk
+Piotr Rudnicki piotr.rudnicki@intel.com
Kamil Rytarowski n54@gmx.com
Grace Sainsbury graces@redhat.com
Kei Sakamoto sakamoto.kei@renesas.com
@@ -772,7 +779,7 @@ David Ung davidu@mips.com
Shahab Vahedi shahab.vahedi@amd.com
D Venkatasubramanian dvenkat@noida.hcltech.com
Corinna Vinschen vinschen@redhat.com
-Jan Vrany jan.vrany@fit.cvut.cz
+Jan Vrany jan.vrany@labware.com
Sami Wagiaalla swagiaal@redhat.com
Keith Walker keith.walker@arm.com
Ricard Wanderlof ricardw@axis.com
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 0c4102d..29b4efa 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1,4 +1,4 @@
-# Copyright (C) 1989-2024 Free Software Foundation, Inc.
+# Copyright (C) 1989-2025 Free Software Foundation, Inc.
# This file is part of GDB.
@@ -265,7 +265,7 @@ INCSUPPORT = \
-I..
#
-# CLI sub directory definitons
+# CLI sub directory definitions
#
SUBDIR_CLI_SRCS = \
cli/cli-cmds.c \
@@ -282,7 +282,7 @@ SUBDIR_CLI_SRCS = \
SUBDIR_CLI_OBS = $(patsubst %.c,%.o,$(SUBDIR_CLI_SRCS))
#
-# MI sub directory definitons
+# MI sub directory definitions
#
SUBDIR_MI_SRCS = \
mi/mi-cmd-break.c \
@@ -350,7 +350,7 @@ SUBDIR_GCC_COMPILE_SRCS = \
SUBDIR_GCC_COMPILE_OBS = $(patsubst %.c,%.o,$(filter %.c,$(SUBDIR_GCC_COMPILE_SRCS)))
#
-# Guile sub directory definitons for guile support.
+# Guile sub directory definitions for guile support.
#
SUBDIR_GUILE_SRCS = \
guile/guile.c \
@@ -387,7 +387,7 @@ SUBDIR_GUILE_LDFLAGS =
SUBDIR_GUILE_CFLAGS =
#
-# python sub directory definitons
+# python sub directory definitions
#
SUBDIR_PYTHON_SRCS = \
python/py-arch.c \
@@ -399,6 +399,7 @@ SUBDIR_PYTHON_SRCS = \
python/py-color.c \
python/py-connection.c \
python/py-continueevent.c \
+ python/py-corefile.c \
python/py-dap.c \
python/py-disasm.c \
python/py-event.c \
@@ -430,6 +431,7 @@ SUBDIR_PYTHON_SRCS = \
python/py-registers.c \
python/py-signalevent.c \
python/py-stopevent.c \
+ python/py-style.c \
python/py-symbol.c \
python/py-symtab.c \
python/py-threadevent.c \
@@ -479,6 +481,7 @@ SELFTESTS_SRCS = \
unittests/ptid-selftests.c \
unittests/main-thread-selftests.c \
unittests/mkdir-recursive-selftests.c \
+ unittests/remote-arg-selftests.c \
unittests/rsp-low-selftests.c \
unittests/scoped_fd-selftests.c \
unittests/scoped_ignore_signal-selftests.c \
@@ -491,7 +494,6 @@ SELFTESTS_SRCS = \
unittests/ui-file-selftests.c \
unittests/unique_xmalloc_ptr_char.c \
unittests/unpack-selftests.c \
- unittests/utils-selftests.c \
unittests/vec-utils-selftests.c \
unittests/xml-utils-selftests.c
@@ -770,6 +772,7 @@ ALL_64_TARGET_OBS = \
mips-tdep.o \
mips64-obsd-tdep.o \
riscv-fbsd-tdep.o \
+ riscv-linux-canonicalize-syscall-gen.o \
riscv-linux-tdep.o \
riscv-none-tdep.o \
riscv-ravenscar-thread.o \
@@ -890,12 +893,14 @@ ALL_TARGET_OBS = \
solib-dsbt.o \
solib-frv.o \
solib-svr4.o \
+ solib-svr4-linux.o \
sparc-linux-tdep.o \
sparc-netbsd-tdep.o \
sparc-obsd-tdep.o \
sparc-ravenscar-thread.o \
sparc-sol2-tdep.o \
sparc-tdep.o \
+ svr4-tls-tdep.o \
symfile-mem.o \
tic6x-linux-tdep.o \
tic6x-tdep.o \
@@ -904,13 +909,22 @@ ALL_TARGET_OBS = \
vax-tdep.o \
windows-tdep.o \
x86-tdep.o \
- xcoffread.o \
xstormy16-tdep.o \
xtensa-config.o \
xtensa-linux-tdep.o \
xtensa-tdep.o \
z80-tdep.o
+# Object files for reading specific types of debug information.
+coff_SRCS = coffread.c coff-pe-read.c
+dbx_SRCS = dbxread.c
+elf_SRCS = elfread.c stap-probe.c dtrace-probe.c
+macho_SRCS = machoread.c
+mips_SRCS = mipsread.c
+xcoff_SRCS = xcoffread.c
+FORMAT_SRCS = @FORMAT_SRCS@
+FORMAT_OBS = $(patsubst %.c,%.o,$(FORMAT_SRCS))
+
# The following native-target dependent variables are defined on
# configure.nat.
NAT_FILE = @NAT_FILE@
@@ -1067,8 +1081,6 @@ COMMON_SFILES = \
c-varobj.c \
charset.c \
cli-out.c \
- coff-pe-read.c \
- coffread.c \
complaints.c \
completer.c \
copying.c \
@@ -1082,7 +1094,6 @@ COMMON_SFILES = \
d-lang.c \
d-namespace.c \
d-valprint.c \
- dbxread.c \
dcache.c \
debug.c \
debuginfod-support.c \
@@ -1090,36 +1101,6 @@ COMMON_SFILES = \
disasm.c \
displaced-stepping.c \
dummy-frame.c \
- dwarf2/abbrev.c \
- dwarf2/abbrev-table-cache.c \
- dwarf2/ada-imported.c \
- dwarf2/aranges.c \
- dwarf2/attribute.c \
- dwarf2/comp-unit-head.c \
- dwarf2/cooked-index.c \
- dwarf2/cooked-index-entry.c \
- dwarf2/cooked-index-shard.c \
- dwarf2/cooked-index-worker.c \
- dwarf2/cooked-indexer.c \
- dwarf2/cu.c \
- dwarf2/die.c \
- dwarf2/dwz.c \
- dwarf2/expr.c \
- dwarf2/frame-tailcall.c \
- dwarf2/frame.c \
- dwarf2/index-cache.c \
- dwarf2/index-common.c \
- dwarf2/index-write.c \
- dwarf2/leb.c \
- dwarf2/line-header.c \
- dwarf2/loc.c \
- dwarf2/macro.c \
- dwarf2/parent-map.c \
- dwarf2/read.c \
- dwarf2/read-debug-names.c \
- dwarf2/read-gdb-index.c \
- dwarf2/section.c \
- dwarf2/stringify.c \
extract-store-integer.c \
eval.c \
event-top.c \
@@ -1170,7 +1151,6 @@ COMMON_SFILES = \
maint.c \
maint-test-options.c \
maint-test-settings.c \
- mdebugread.c \
mem-break.c \
memattr.c \
memory-map.c \
@@ -1178,7 +1158,6 @@ COMMON_SFILES = \
memtag.c \
minidebug.c \
minsyms.c \
- mipsread.c \
namespace.c \
objc-lang.c \
objfiles.c \
@@ -1271,7 +1250,6 @@ SFILES = \
d-exp.y \
dtrace-probe.c \
elf-none-tdep.c \
- elfread.c \
f-exp.y \
gcore-elf.c \
gdb.c \
@@ -1299,31 +1277,67 @@ SFILES = \
# right, it is probably easiest just to list .h files here directly.
HFILES_NO_SRCDIR = \
+ aarch32-linux-nat.h \
aarch32-tdep.h \
+ aarch64-fbsd-tdep.h \
+ aarch64-linux-tdep.h \
+ aarch64-nat.h \
aarch64-ravenscar-thread.h \
aarch64-tdep.h \
+ ada-casefold.h \
+ ada-exp.h \
ada-lang.h \
addrmap.h \
alpha-bsd-tdep.h \
alpha-tdep.h \
- amd-dbgapi-target.h \
+ amd64-bsd-nat.h \
amd64-darwin-tdep.h \
+ amd64-fbsd-tdep.h \
amd64-linux-tdep.h \
amd64-nat.h \
amd64-ravenscar-thread.h \
amd64-tdep.h \
+ amd-dbgapi-target.h \
amdgpu-tdep.h \
annotate.h \
- arc-tdep.h \
+ arch/aarch32.h \
+ arch/aarch64-gcs-linux.h \
+ arch/aarch64.h \
+ arch/aarch64-insn.h \
+ arch/aarch64-mte.h \
+ arch/aarch64-mte-linux.h \
+ arch/aarch64-scalable-linux.h \
+ arch/amd64.h \
+ arch/amd64-linux-tdesc.h \
+ arch/arc.h \
+ arch/arm-get-next-pcs.h \
+ arch/arm.h \
+ arch/arm-linux.h \
+ arch/csky.h \
+ arch/i386.h \
+ arch/i386-linux-tdesc.h \
+ arch/loongarch.h \
+ arch/loongarch-insn.h \
+ arch/loongarch-syscall.h \
+ arch/ppc-linux-common.h \
+ arch/ppc-linux-tdesc.h \
+ arch/riscv.h \
+ arch/tic6x.h \
arch-utils.h \
+ arch/x86-linux-tdesc-features.h \
+ arch/x86-linux-tdesc.h \
+ arch/xtensa.h \
+ arc-linux-tdep.h \
+ arc-tdep.h \
+ arm-fbsd-tdep.h \
arm-linux-tdep.h \
arm-netbsd-tdep.h \
arm-tdep.h \
async-event.h \
auto-load.h \
auxv.h \
- ax.h \
ax-gdb.h \
+ ax.h \
bcache.h \
bfd-target.h \
bfin-tdep.h \
@@ -1332,96 +1346,161 @@ HFILES_NO_SRCDIR = \
breakpoint.h \
bsd-kvm.h \
bsd-uthread.h \
+ btrace.h \
bt-utils.h \
build-id.h \
- buildsym-legacy.h \
buildsym.h \
- c-lang.h \
+ buildsym-legacy.h \
+ c-exp.h \
+ cgen-remap.h \
charset.h \
charset-list.h \
+ c-lang.h \
+ cli/cli-cmds.h \
+ cli/cli-decode.h \
+ cli/cli-interp.h \
+ cli/cli-option.h \
+ cli/cli-script.h \
+ cli/cli-setshow.h \
+ cli/cli-style.h \
+ cli/cli-utils.h \
cli-out.h \
coff-pe-read.h \
command.h \
+ compile/compile-c.h \
+ compile/compile-cplus.h \
+ compile/compile.h \
+ compile/compile-internal.h \
+ compile/compile-object-load.h \
+ compile/compile-object-run.h \
+ compile/gcc-c-plugin.h \
+ compile/gcc-cp-plugin.h \
complaints.h \
completer.h \
+ config/djgpp/langinfo.h \
+ config/djgpp/nl_types.h \
+ config/i386/nm-x86-gnu.h \
+ config/nm-linux.h \
+ config/sparc/nm-sol2.h \
cp-abi.h \
cp-support.h \
+ cris-tdep.h \
csky-tdep.h \
- d-lang.h \
+ c-support.h \
+ ctfread.h \
darwin-nat.h \
dcache.h \
+ debuginfod-support.h \
defs.h \
dicos-tdep.h \
dictionary.h \
disasm-flags.h \
disasm.h \
+ disasm-selftests.h \
+ displaced-stepping.h \
+ d-lang.h \
dummy-frame.h \
+ dwarf2/abbrev.h \
+ dwarf2/abbrev-table-cache.h \
dwarf2/aranges.h \
- dwarf2/cooked-index.h \
+ dwarf2/attribute.h \
+ dwarf2/call-site.h \
dwarf2/cooked-index-entry.h \
+ dwarf2/cooked-indexer.h \
+ dwarf2/cooked-index.h \
dwarf2/cooked-index-shard.h \
dwarf2/cooked-index-worker.h \
- dwarf2/cooked-indexer.h \
dwarf2/cu.h \
- dwarf2/frame-tailcall.h \
- dwarf2/frame.h \
+ dwarf2/die.h \
+ dwarf2/dwz.h \
+ dwarf2/error.h \
dwarf2/expr.h \
+ dwarf2/file-and-dir.h \
+ dwarf2/frame.h \
+ dwarf2/frame-tailcall.h \
dwarf2/index-cache.h \
dwarf2/index-common.h \
+ dwarf2/index-write.h \
+ dwarf2/leb.h \
+ dwarf2/line-header.h \
+ dwarf2/line-program.h \
dwarf2/loc.h \
- dwarf2/read.h \
+ dwarf2/macro.h \
+ dwarf2/mapped-index.h \
+ dwarf2/parent-map.h \
+ dwarf2/public.h \
dwarf2/read-debug-names.h \
dwarf2/read-gdb-index.h \
+ dwarf2/read.h \
+ dwarf2/section.h \
+ dwarf2/sect-names.h \
+ dwarf2/stringify.h \
+ dwarf2/tag.h \
+ dwarf2/types.h \
+ dwarf2/unit-head.h \
+ elf-none-tdep.h \
event-top.h \
exceptions.h \
exec.h \
+ expop.h \
expression.h \
extension.h \
extension-priv.h \
extract-store-integer.h \
f-array-walker.h \
- f-lang.h \
fbsd-nat.h \
fbsd-tdep.h \
+ f-exp.h \
+ filename-seen-cache.h \
filesystem.h \
- frame.h \
+ f-lang.h \
frame-base.h \
+ frame.h \
+ frame-id.h \
frame-unwind.h \
frv-tdep.h \
ft32-tdep.h \
gcore-elf.h \
gcore.h \
+ gdbarch-gen.h \
+ gdbarch.h \
gdb_bfd.h \
+ gdbcore.h \
gdb_curses.h \
+ gdb-demangle.h \
gdb_expat.h \
gdb_proc_service.h \
gdb-stabs.h \
- gdb_vfork.h \
- gdb_wchar.h \
- gdbarch.h \
- gdbcore.h \
gdbthread.h \
gdbtypes.h \
+ gdb_vfork.h \
+ gdb_wchar.h \
glibc-tdep.h \
gmp-utils.h \
gnu-nat.h \
+ gnu-nat-mig.h \
go-lang.h \
gregset.h \
+ guile/guile.h \
+ guile/guile-internal.h \
hppa-bsd-tdep.h \
hppa-linux-offsets.h \
hppa-tdep.h \
i386-bsd-nat.h \
i386-darwin-tdep.h \
+ i386-fbsd-tdep.h \
i386-linux-tdep.h \
i386-tdep.h \
i387-tdep.h \
ia64-libunwind-tdep.h \
ia64-tdep.h \
+ infcall.h \
inf-child.h \
+ inferior.h \
+ inferior-iter.h \
inf-loop.h \
inf-ptrace.h \
- infcall.h \
- inferior.h \
+ infrun.h \
inline-frame.h \
interps.h \
jit.h \
@@ -1429,10 +1508,12 @@ HFILES_NO_SRCDIR = \
linespec.h \
linux-fork.h \
linux-nat.h \
+ linux-nat-trad.h \
linux-record.h \
linux-tdep.h \
location.h \
loongarch-tdep.h \
+ m2-exp.h \
m2-lang.h \
m32r-tdep.h \
m68k-tdep.h \
@@ -1440,104 +1521,209 @@ HFILES_NO_SRCDIR = \
macroscope.h \
macrotab.h \
main.h \
+ maint.h \
mdebugread.h \
memattr.h \
memory-map.h \
memrange.h \
+ memtag.h \
microblaze-tdep.h \
+ mi/mi-cmd-break.h \
+ mi/mi-cmds.h \
+ mi/mi-common.h \
+ mi/mi-console.h \
+ mi/mi-getopt.h \
+ mi/mi-interp.h \
+ mi/mi-main.h \
+ mi/mi-out.h \
+ mi/mi-parse.h \
+ minsyms.h \
+ mips-fbsd-tdep.h \
mips-linux-tdep.h \
mips-netbsd-tdep.h \
mips-tdep.h \
mn10300-tdep.h \
moxie-tdep.h \
+ namespace.h \
+ nat/aarch64-hw-point.h \
+ nat/aarch64-linux.h \
+ nat/aarch64-linux-hw-point.h \
+ nat/aarch64-mte-linux-ptrace.h \
+ nat/aarch64-scalable-linux-ptrace.h \
+ nat/aarch64-scalable-linux-sigcontext.h \
+ nat/amd64-linux-siginfo.h \
+ nat/fork-inferior.h \
+ nat/gdb_ptrace.h \
+ nat/gdb_thread_db.h \
+ nat/glibc_thread_db.h \
+ nat/i386-linux.h \
+ nat/linux-btrace.h \
+ nat/linux-namespaces.h \
+ nat/linux-nat.h \
+ nat/linux-osdata.h \
+ nat/linux-personality.h \
+ nat/linux-procfs.h \
+ nat/linux-ptrace.h \
+ nat/linux-waitpid.h \
+ nat/loongarch-hw-point.h \
+ nat/loongarch-linux.h \
+ nat/loongarch-linux-hw-point.h \
+ nat/mips-linux-watch.h \
+ nat/netbsd-nat.h \
+ nat/ppc-linux.h \
+ nat/riscv-linux-tdesc.h \
+ nat/windows-nat.h \
+ nat/x86-cpuid.h \
+ nat/x86-dregs.h \
+ nat/x86-gcc-cpuid.h \
+ nat/x86-linux-dregs.h \
+ nat/x86-linux.h \
+ nat/x86-linux-tdesc.h \
+ nat/x86-xstate.h \
+ nds32-tdep.h \
netbsd-nat.h \
netbsd-tdep.h \
- nds32-tdep.h \
- elf-none-tdep.h \
objc-lang.h \
+ objfile-flags.h \
objfiles.h \
obsd-nat.h \
obsd-tdep.h \
+ observable.h \
or1k-linux-tdep.h \
+ or1k-tdep.h \
osabi.h \
osdata.h \
- p-lang.h \
+ pager.h \
parser-defs.h \
+ p-lang.h \
+ ppc64-tdep.h \
ppc-fbsd-tdep.h \
ppc-linux-tdep.h \
ppc-netbsd-tdep.h \
ppc-obsd-tdep.h \
ppc-ravenscar-thread.h \
ppc-tdep.h \
- ppc64-tdep.h \
probe.h \
- proc-utils.h \
+ process-stratum-target.h \
procfs.h \
- progspace.h \
+ proc-utils.h \
+ producer.h \
progspace-and-thread.h \
+ progspace.h \
prologue-value.h \
psymtab.h \
+ python/py-color.h \
+ python/py-event.h \
+ python/py-events.h \
+ python/py-instruction.h \
+ python/py-record-btrace.h \
+ python/py-record-full.h \
+ python/py-record.h \
+ python/py-ref.h \
+ python/py-stopevent.h \
+ python/python.h \
+ python/python-internal.h \
+ python/py-uiout.h \
+ quick-symbol.h \
ravenscar-thread.h \
- record.h \
+ record-btrace.h \
record-full.h \
+ record.h \
regcache.h \
+ regformats/regdef.h \
reggroups.h \
+ registry.h \
regset.h \
- remote.h \
remote-fileio.h \
+ remote.h \
remote-notif.h \
riscv-fbsd-tdep.h \
+ riscv-linux-tdep.h \
riscv-ravenscar-thread.h \
riscv-tdep.h \
rs6000-aix-tdep.h \
run-on-main-thread.h \
+ rust-exp.h \
+ rust-lang.h \
s390-linux-tdep.h \
s390-tdep.h \
+ scoped-mock-context.h \
selftest-arch.h \
sentinel-frame.h \
ser-base.h \
ser-event.h \
+ serial.h \
ser-tcp.h \
ser-unix.h \
- serial.h \
sh-tdep.h \
sim-regno.h \
skip.h \
sol2-tdep.h \
- solib.h \
solib-aix.h \
solib-darwin.h \
+ solib-dsbt.h \
+ solib-frv.h \
+ solib.h \
solib-svr4.h \
+ solib-svr4-linux.h \
solib-target.h \
- solist.h \
- source.h \
source-cache.h \
+ source.h \
+ sparc64-tdep.h \
sparc-nat.h \
sparc-ravenscar-thread.h \
sparc-tdep.h \
- sparc64-tdep.h \
split-name.h \
stabsread.h \
stack.h \
stap-probe.h \
+ svr4-tls-tdep.h \
+ symfile-add-flags.h \
symfile.h \
symtab.h \
- target.h \
+ target-connection.h \
target-dcache.h \
+ target-debug.h \
target-descriptions.h \
+ target-float.h \
+ target.h \
+ target/resume.h \
+ target-section.h \
+ target/target.h \
+ target/wait.h \
+ target/waitstatus.h \
terminal.h \
+ test-target.h \
+ thread-fsm.h \
+ thread-iter.h \
+ tic6x-tdep.h \
tid-parse.h \
+ tilegx-tdep.h \
top.h \
tracectf.h \
tracefile.h \
tracepoint.h \
trad-frame.h \
- target-float.h \
tramp-frame.h \
- type-stack.h \
+ tui/tui-command.h \
+ tui/tui-data.h \
+ tui/tui-disasm.h \
+ tui/tui-file.h \
+ tui/tui.h \
+ tui/tui-hooks.h \
+ tui/tui-io.h \
+ tui/tui-layout.h \
+ tui/tui-location.h \
+ tui/tui-regs.h \
+ tui/tui-source.h \
+ tui/tui-status.h \
+ tui/tui-wingeneral.h \
+ tui/tui-win.h \
+ tui/tui-winsource.h \
typeprint.h \
- ui.h \
+ type-stack.h \
ui-file.h \
+ ui.h \
ui-out.h \
ui-style.h \
user-regs.h \
@@ -1550,111 +1736,18 @@ HFILES_NO_SRCDIR = \
windows-nat.h \
windows-tdep.h \
x86-bsd-nat.h \
+ x86-fbsd-nat.h \
x86-linux-nat.h \
x86-nat.h \
+ x86-tdep.h \
xcoffread.h \
xml-builtin.h \
xml-support.h \
xml-syscall.h \
xml-tdesc.h \
xtensa-tdep.h \
- arch/aarch32.h \
- arch/aarch64.h \
- arch/aarch64-insn.h \
- arch/aarch64-mte.h \
- arch/aarch64-mte-linux.h \
- arch/aarch64-scalable-linux.h \
- arch/amd64-linux-tdesc.h \
- arch/arc.h \
- arch/arm.h \
- arch/i386-linux-tdesc.h \
- arch/i386.h \
- arch/loongarch.h \
- arch/ppc-linux-common.h \
- arch/ppc-linux-tdesc.h \
- arch/riscv.h \
- arch/x86-linux-tdesc-features.h \
- arch/x86-linux-tdesc.h \
- cli/cli-cmds.h \
- cli/cli-decode.h \
- cli/cli-script.h \
- cli/cli-setshow.h \
- cli/cli-style.h \
- cli/cli-utils.h \
- compile/compile.h \
- compile/compile-c.h \
- compile/compile-cplus.h \
- compile/compile-internal.h \
- compile/compile-object-load.h \
- compile/compile-object-run.h \
- compile/gcc-c-plugin.h \
- compile/gcc-cp-plugin.h \
- config/nm-linux.h \
- config/djgpp/langinfo.h \
- config/djgpp/nl_types.h \
- config/i386/nm-i386gnu.h \
- config/sparc/nm-sol2.h \
- mi/mi-cmds.h \
- mi/mi-common.h \
- mi/mi-console.h \
- mi/mi-getopt.h \
- mi/mi-main.h \
- mi/mi-out.h \
- mi/mi-parse.h \
- nat/aarch64-linux.h \
- nat/aarch64-linux-hw-point.h \
- nat/aarch64-mte-linux-ptrace.h \
- nat/aarch64-scalable-linux-ptrace.h \
- nat/aarch64-scalable-linux-sigcontext.h \
- nat/amd64-linux-siginfo.h \
- nat/gdb_ptrace.h \
- nat/gdb_thread_db.h \
- nat/fork-inferior.h \
- nat/i386-linux.h \
- nat/linux-btrace.h \
- nat/linux-namespaces.h \
- nat/linux-nat.h \
- nat/linux-osdata.h \
- nat/linux-personality.h \
- nat/linux-ptrace.h \
- nat/linux-waitpid.h \
- nat/loongarch-hw-point.h \
- nat/loongarch-linux.h \
- nat/loongarch-linux-hw-point.h \
- nat/mips-linux-watch.h \
- nat/ppc-linux.h \
- nat/x86-cpuid.h \
- nat/x86-dregs.h \
- nat/x86-gcc-cpuid.h \
- nat/x86-linux.h \
- nat/x86-linux-dregs.h \
- nat/x86-linux-tdesc.h \
- python/py-event.h \
- python/py-events.h \
- python/py-stopevent.h \
- python/python.h \
- python/python-internal.h \
- regformats/regdef.h \
- target/resume.h \
- target/target.h \
- target/wait.h \
- target/waitstatus.h \
- tui/tui.h \
- tui/tui-command.h \
- tui/tui-data.h \
- tui/tui-disasm.h \
- tui/tui-file.h \
- tui/tui-hooks.h \
- tui/tui-io.h \
- tui/tui-layout.h \
- tui/tui-location.h \
- tui/tui-regs.h \
- tui/tui-source.h \
- tui/tui-status.h \
- tui/tui-win.h \
- tui/tui-wingeneral.h \
- tui/tui-winsource.h \
- x86-tdep.h
+ yy-remap.h \
+ z80-tdep.h
# Header files that already have srcdir in them, or which are in objdir.
@@ -1837,6 +1930,7 @@ ALLDEPFILES = \
remote-sim.c \
riscv-fbsd-nat.c \
riscv-fbsd-tdep.c \
+ riscv-linux-canonicalize-syscall-gen.c \
riscv-linux-nat.c \
riscv-linux-tdep.c \
riscv-none-tdep.c \
@@ -1883,6 +1977,7 @@ ALLDEPFILES = \
sparc64-obsd-tdep.c \
sparc64-sol2-tdep.c \
sparc64-tdep.c \
+ svr4-tls-tdep.c \
tilegx-linux-nat.c \
tilegx-linux-tdep.c \
tilegx-tdep.c \
@@ -1895,7 +1990,6 @@ ALLDEPFILES = \
x86-gnu-nat.c \
x86-nat.c \
x86-tdep.c \
- xcoffread.c \
xstormy16-tdep.c \
xtensa-config.c \
xtensa-linux-nat.c \
@@ -1909,6 +2003,41 @@ TAGFILES_NO_SRCDIR = $(SFILES) $(HFILES_NO_SRCDIR) $(ALLDEPFILES) \
$(CONFIG_SRCS)
TAGFILES_WITH_SRCDIR = $(HFILES_WITH_SRCDIR)
+# Files that are used to support certain debuginfo formats
+DWARF2_SRCS = \
+ dwarf2/abbrev.c \
+ dwarf2/abbrev-table-cache.c \
+ dwarf2/ada-imported.c \
+ dwarf2/aranges.c \
+ dwarf2/attribute.c \
+ dwarf2/cooked-index.c \
+ dwarf2/cooked-index-entry.c \
+ dwarf2/cooked-index-shard.c \
+ dwarf2/cooked-index-worker.c \
+ dwarf2/cooked-indexer.c \
+ dwarf2/cu.c \
+ dwarf2/die.c \
+ dwarf2/dwz.c \
+ dwarf2/expr.c \
+ dwarf2/frame-tailcall.c \
+ dwarf2/frame.c \
+ dwarf2/index-cache.c \
+ dwarf2/index-common.c \
+ dwarf2/index-write.c \
+ dwarf2/leb.c \
+ dwarf2/line-header.c \
+ dwarf2/line-program.c \
+ dwarf2/loc.c \
+ dwarf2/macro.c \
+ dwarf2/parent-map.c \
+ dwarf2/read.c \
+ dwarf2/read-debug-names.c \
+ dwarf2/read-gdb-index.c \
+ dwarf2/section.c \
+ dwarf2/stringify.c \
+ dwarf2/unit-head.c
+DWARF2_OBS = $(patsubst %.c,%.o, $(DWARF2_SRCS))
+
COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
mi/mi-common.o \
version.o \
@@ -1916,7 +2045,8 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
$(patsubst %.c,%.o,$(COMMON_SFILES)) \
$(SUBDIR_CLI_OBS) \
$(SUBDIR_MI_OBS) \
- $(SUBDIR_TARGET_OBS)
+ $(SUBDIR_TARGET_OBS) \
+ $(FORMAT_OBS)
SUBDIRS = doc @subdirs@ data-directory
CLEANDIRS = $(SUBDIRS)
@@ -2273,8 +2403,7 @@ TAGS: $(TAGFILES_NO_SRCDIR) $(TAGFILES_WITH_SRCDIR)
echo $(srcdir)/$$i ; \
done ; for i in $(TAGFILES_WITH_SRCDIR); do \
echo $$i ; \
- done) | sed -e 's/\.o$$/\.c/'` \
- `find $(srcdir)/config -name '*.h' -print`
+ done) | sed -e 's/\.o$$/\.c/'`
tags: TAGS
diff --git a/gdb/NEWS b/gdb/NEWS
index 6a557bb..b014685 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -1,7 +1,116 @@
What has changed in GDB?
(Organized release by release)
-*** Changes since GDB 16
+*** Changes since GDB 17
+
+* Support for .gdb_index sections with version less than 7 has been
+ removed.
+
+* GDB now accepts --no-escape-args as an alternative to --args on the
+ command line. GDB will not escape special shell characters within
+ arguments after --no-escape-args.
+
+* gdbserver now accepts --no-escape-args as a command line flag. When
+ this flag is used gdbserver will not escape special shell characters
+ within the inferior arguments.
+
+* The add-inferior, clone-inferior, and MI -add-inferior commands will
+ now give a warning, and create the new inferior without a
+ connection, when the current inferior's connection, at the time the
+ command is given, is unshareable. For example, the core-file target
+ cannot be shared between inferiors, nor can the Window native
+ target. These targets could never really be shared. Attempting to
+ share them would usually lead to GDB crashing. GDB now prevents
+ this invalid sharing.
+
+* When connecting to a remote server, if the server supports the new
+ qExecAndArgs packet, then GDB will copy the argument string from the
+ server and update the 'args' setting, as if 'set args ...' had been
+ used. This means that the arguments are visible from GDB using
+ 'show args', and that, if using the extended-remote protocol,
+ subsequent runs of the inferior will use the same arguments as the
+ first run.
+
+* New targets
+
+GNU/Linux/MicroBlaze (gdbserver) microblazeel-*linux*
+
+* New commands
+
+maintenance test-remote-args ARGS
+ Test splitting and joining of inferior arguments ARGS as they would
+ be split and joined when being passed to a remote target.
+
+* Changed commands
+
+maintenance info program-spaces
+ This command no longer displays the core file name.
+
+info inferiors
+ If an inferior has a core file loaded, then this will be displayed
+ as an additional line under the inferior's table entry in the
+ output.
+
+* Changed remote packets
+
+single-inf-arg in qSupported
+ The new single-inf-arg feature within the qSupported packet allows
+ GDB to inform the stub that it would like to send the inferior
+ arguments as a single string within the vRun packet. The stub can
+ reply with the single-inf-arg feature to indicate that it is able to
+ accept arguments as a single string.
+
+* New remote packets
+
+qExecAndArgs
+ This packet returns the executable filename and argument string with
+ which the server was started. If no such information was given to
+ the server then this is reflected in the reply.
+
+* Python API
+
+ ** New class gdb.Style for representing styles, a collection of
+ foreground and background gdb.Color objects, and an intensity.
+
+ ** New constants gdb.INTENSITY_NORMAL, gdb.INTENSITY_BOLD, and
+ gdb.INTENSITY_DIM for use with gdb.Style when representing
+ intensities.
+
+ ** New gdb.StyleParameterSet for creating custom style settings.
+ Use gdb.StyleParameterSet(NAME) to create 'set style NAME ...'
+ and 'show style NAME ...' parameters.
+
+ ** The gdb.write() function now takes an additional, optional,
+ 'style' argument, which can be used to style the output.
+
+ ** New gdb.Corefile class which represents a loaded core file. This
+ has an attribute Corefile.filename, the file name of the loaded
+ core file, and a method Corefile.is_valid(), which returns False
+ when a Corefile object becomes invalid (e.g. when the core file
+ is unloaded). There is also Corefile.mapped_files() which
+ returns a list of CorefileMappedFile objects, representing files
+ that were mapped into the core file when it was created.
+
+ ** New gdb.CorefileMappedFile type representing a file that was
+ mapped when the core file was created. Has read-only attributes
+ filename (string), build_id (string), is_main_executable
+ (boolean), and regions (list of CorefileMappedFileRegion objects).
+
+ ** New gdb.CorefileMappedFileRegion type, which represents a mapped
+ region of a file (see gdb.CorefileMappedFile above). Has
+ read-only attributes start, end, and file_offset.
+
+ ** New Inferior.corefile attribute. This read only attribute
+ contains the gdb.Corefile object if a core file is loaded into
+ the inferior, otherwise, this contains None.
+
+*** Changes in GDB 17
+
+* Debugging Linux programs that use x86-64 or x86-64 with 32-bit pointer
+ size (X32) Shadow Stacks are now supported.
+
+* Support for the shadow stack pointer register on x86-64 or x86-64 with
+ 32-bit pointer size (X32) GNU/Linux.
* Debugger Adapter Protocol changes
@@ -35,6 +144,31 @@
a -h or --help option, which prints each options and a brief
description.
+* The gcore script now has a -g option that lets you specify the GDB
+ binary invoked by gcore.
+
+* On systems that support linker namespaces, the output of the command
+ "info sharedlibraries" may add one more column, NS, which identifies the
+ namespace into which the library was loaded, if more than one namespace
+ is active.
+
+* New built-in convenience variables $linker_namespace_count and
+ $_linker_namespace. These show the number of active linker
+ namespaces, and the namespace to which the current location belongs to.
+ In systems that don't support linker namespaces, or if the inferior hasn't
+ started yet, these always return the integer 0.
+
+* Add record full support for rv64gc architectures
+
+* Debugging Linux programs that use AArch64 Guarded Control Stacks is now
+ supported.
+
+* New "--binary-output" command line option instructs GDB to set the
+ translation mode of its stdout/stderr to binary mode. This disables
+ Line Feed translation. MS-Windows only.
+
+* The "catch syscall" command now works on riscv*-linux* targets.
+
* New commands
maintenance check psymtabs
@@ -43,12 +177,33 @@ maintenance check psymtabs
maintenance check symtabs
Renamed from maintenance check-symtabs
+maintenance canonicalize
+ Show the canonical form of a C++ name.
+
set riscv numeric-register-names on|off
show riscv numeric-register-names
Controls whether GDB refers to risc-v registers by their numeric names
(e.g 'x1') or their abi names (e.g. 'ra').
Defaults to 'off', matching the old behaviour (abi names).
+set style emoji on|off|auto
+show style emoji
+ Controls whether GDB can display emoji. The default is "auto",
+ which means emoji will be displayed in some situations when
+ the host charset is UTF-8.
+
+set style warning-prefix STRING
+set style error-prefix STRING
+ These commands control the prefix that is printed before warnings
+ and errors, respectively. This functionality is intended for use
+ with emoji display, and so the prefixes are only displayed if emoji
+ styling is enabled.
+
+info linker-namespaces
+info linker-namespaces [[N]]
+ Print information about the given linker namespace (identified as N),
+ or about all the namespaces if no argument is given.
+
* Changed commands
info sharedlibrary
@@ -56,8 +211,42 @@ info sharedlibrary
command are now for the full memory range allocated to the shared
library.
+info threads [-gid] [-stopped] [-running] [ID]...
+ If no threads match the given ID(s) or filter options, GDB now prints
+
+ No threads matched.
+
+ without printing the provided arguments. The newly added '-stopped'
+ option makes GDB list the stopped threads only. Similarly,
+ '-running' makes GDB list the running threads only. If both options
+ are given together, both stopped and running threads are listed.
+ These new flags can be useful to get a reduced list when there is a
+ large number of threads.
+
+* GDB-internal Thread Local Storage (TLS) support
+
+ ** Linux targets for the x86_64, aarch64, ppc64, s390x, and riscv
+ architectures now have GDB-internal support for TLS address
+ lookup in addition to that traditionally provided by the
+ libthread_db library. This internal support works for programs
+ linked against either the GLIBC or MUSL C libraries. For
+ programs linked against MUSL, this new internal support provides
+ new debug functionality, allowing access to TLS variables, due to
+ the fact that MUSL does not implement the libthread_db library.
+ Internal TLS support is also useful in cross-debugging
+ situations, debugging statically linked binaries, and debugging
+ programs linked against GLIBC 2.33 and earlier, but which are not
+ linked against libpthread.
+
+ ** The command 'maint set force-internal-tls-address-lookup on' may
+ be used to force the internal TLS lookup mechanisms to be used.
+ Otherwise, TLS lookup via libthread_db will still be preferred,
+ when available.
+
* Python API
+ ** GDB no longer supports Python versions less than 3.4.
+
** New class gdb.Color for dealing with colors.
** New constant gdb.PARAM_COLOR represents color type of a
@@ -74,6 +263,27 @@ info sharedlibrary
when output is going to standard output, and False when output is
going to a string.
+ ** Setting the documentation string (__doc__) of a gdb.Parameter
+ sub-class to the empty string, means GDB will only display the
+ set_doc or show_doc strings in the set/show help output.
+
+ ** New gdb.ParameterPrefix class. This can be used to create 'set'
+ and 'show' gdb.Command prefixes, suitable for use with new
+ gdb.Parameters.
+
+ ** Prefix commands (gdb.Command sub-classes) that don't have an
+ invoke method will now behave like builtin prefix commands when
+ invoked without a sub-command name. This means printing the help
+ text for all sub-commands, unless the prefix command is a 'show'
+ command, in which case the value of all sub-commands is printed.
+
+ ** New gdb.warning() function that takes a string and prints it as a
+ warning, with GDB's standard 'warning' prefix.
+
+ ** New attribute gdb.Value.is_unavailable, this checks for
+ unavailability like gdb.Value.is_optimized_out checks for
+ optimized out values.
+
* Guile API
** New type <gdb:color> for dealing with colors.
@@ -81,6 +291,17 @@ info sharedlibrary
** New constant PARAM_COLOR represents color type of a value
of a <gdb:parameter> object. Parameter's value is <gdb::color> instance.
+ ** Eliding the #:doc string from make-parameter now means that GDB
+ will use a default documentation string. Setting #:doc to the
+ empty string for make-parameter means GDB will only display the
+ #:set_doc or #:show_doc strings in the set/show help output.
+
+ ** Prefix commands (using make-command) that don't have a #:invoke
+ property will now behave like builtin prefix commands when
+ invoked without a sub-command name. This means printing the help
+ text for all sub-commands, unless the prefix command is a 'show'
+ command, in which case the value of all sub-commands is printed.
+
* New remote packets
binary-upload in qSupported reply
@@ -89,6 +310,11 @@ binary-upload in qSupported reply
stub doesn't report this feature supported, then GDB will not use
the 'x' packet.
+vFile:lstat
+ Return information about files on the remote system. Like
+ vFile:stat but if the filename is a symbolic link, return
+ information about the link itself, the file the link refers to.
+
* Changed remote packets
qXfer:threads:read
@@ -97,6 +323,11 @@ qXfer:threads:read
should print as the target ID of the thread, for example in the
"info threads" command or when switching to the thread.
+vFile:stat
+ Previously, gdbserver incorrectly implemented this packet using
+ lstat rather than stat. This has now been corrected. The
+ documentation has also been clarified.
+
* MI changes
** The =library-unloaded event now includes the 'ranges' field, which
@@ -112,10 +343,31 @@ qXfer:threads:read
* Support for stabs debugging format and the a.out/dbx object format is
deprecated, and will be removed in GDB 18.
+* Configure changes
+
+--enable-binary-file-formats=[FORMAT,...]
+--enable-binary-file-formats=all
+ A user can now decide to only compile support for certain file formats.
+ The available formats at this point are: dbx, coff, xcoff, elf, mach-o
+ and mips. Some targets require specific file formats to be available,
+ and in such cases, the configure script will warn the user and add
+ support anyway. By default, all formats will be compiled in, to
+ continue the behavior from before adding the switch.
+
* A new configure option was added, allowing support for the compile
subsystem to be disabled at configure time, in the form of
--disable-gdb-compile.
+* A new configure option was added, allowing support for DWARF debug
+ information to be disabled at configure time. The flag is
+ --disable-gdb-dwarf-support.
+
+* A new configure option was added, allowing support for mdebug/ecoff
+ debug information to be disabled at configure time. The flag to do
+ that is --disable-gdb-mdebug-support.
+
+* The Alpha target now supports target descriptions.
+
*** Changes in GDB 16
* Support for Nios II targets has been removed as this architecture
@@ -7491,7 +7743,7 @@ for DW_OP_piece is still missing).
A number of long standing bugs that caused GDB to die while starting a
Java application have been fixed. GDB's Java support is now
-considered "useable".
+considered "usable".
* GNU/Linux support for fork, vfork, and exec.
diff --git a/gdb/README b/gdb/README
index 8836120..5dc2e7e 100644
--- a/gdb/README
+++ b/gdb/README
@@ -17,7 +17,7 @@ Unpacking and Installation -- quick overview
'gdb-VERSION.tar.gz', where VERSION is the version of GDB.
The GDB debugger sources, the generic GNU include
-files, the BFD ("binary file description") library, the readline
+files, the BFD ("Binary File Descriptor") library, the readline
library, and other libraries all have directories of their own
underneath the gdb-VERSION directory. The idea is that a variety of GNU
tools can share a common copy of these things. Be aware of variation
@@ -417,6 +417,30 @@ more obscure GDB `configure' options are not listed here.
There is no convenient way to generate a list of all available
targets.
+`--enable-binary-file-formats=FORMAT,FORMAT,...'
+`--enable-binary-file-formats=all'
+ Configure GDB to only be be able to read selected file formats.
+ The special value "all" causes all file formats to be compiled
+ in, and is the the default behavior of the option. This option
+ is meant for advanced users who are sure of what they expect,
+ if you are unsure which options you will need on your debugging
+ sessions, we recommend that you not use this feature. The
+ accepted options are:
+ * coff: Main format on Windows systems, this is required to
+ compile with windows target support;
+ * dbx (also known as a.out): Legacy file format, this is
+ recommended if you know you will be dealing with this
+ file format;
+ * elf: Main format on Linux systems, this is heavily
+ recommended when compiling with linux support;
+ * macho: Main format on MacOS systems, this is heavily
+ recommended when compiling for those targets;
+ * mips (also known as ecoff): Main file format for targets
+ running on MIPS CPUs, this is heavily recommended when
+ supporting those targets;
+ * xcoff: Main format on AIX systems, this is required to
+ compile for AIX targets and rs6000 CPUs.
+
`--with-gdb-datadir=PATH'
Set the GDB-specific data directory. GDB will look here for
certain supporting files or scripts. This defaults to the `gdb'
@@ -443,7 +467,14 @@ more obscure GDB `configure' options are not listed here.
supported).
`--disable-gdb-compile'
- Build GDB without support for the 'compile' command.
+ Build GDB without support for the 'compile' command. DWARF support
+ is required for this feature.
+
+`--disable-gdb-dwarf-support'
+ Build GDB without support for reading DWARF debug information.
+
+`--disable-gdb-mdebug-support'
+ Build GDB without support for reading mdebug debug information.
`--with-curses'
Use the curses library instead of the termcap library, for
@@ -533,7 +564,7 @@ more obscure GDB `configure' options are not listed here.
GDB scripting much more powerful than the restricted CLI
scripting language. If your host does not have Python installed,
you can find it on `http://www.python.org/download/'. The oldest
- version of Python supported by GDB is 3.2. The optional argument
+ version of Python supported by GDB is 3.4. The optional argument
PYTHON is used to find the Python headers and libraries. It can
be either the name of a Python executable, or the name of the
directory in which Python is installed.
diff --git a/gdb/aarch32-linux-nat.c b/gdb/aarch32-linux-nat.c
index edff97b..adccd1c 100644
--- a/gdb/aarch32-linux-nat.c
+++ b/gdb/aarch32-linux-nat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/aarch32-linux-nat.h b/gdb/aarch32-linux-nat.h
index 79ad5ad..8f474cf 100644
--- a/gdb/aarch32-linux-nat.h
+++ b/gdb/aarch32-linux-nat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/aarch32-tdep.c b/gdb/aarch32-tdep.c
index 5a54a71..8f27a4e 100644
--- a/gdb/aarch32-tdep.c
+++ b/gdb/aarch32-tdep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/aarch32-tdep.h b/gdb/aarch32-tdep.h
index 16ceb30..137f952 100644
--- a/gdb/aarch32-tdep.h
+++ b/gdb/aarch32-tdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/aarch64-fbsd-nat.c b/gdb/aarch64-fbsd-nat.c
index 7ca8463..037043b 100644
--- a/gdb/aarch64-fbsd-nat.c
+++ b/gdb/aarch64-fbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for FreeBSD/aarch64.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -293,10 +293,10 @@ void
aarch64_notify_debug_reg_change (ptid_t ptid,
int is_watchpoint, unsigned int idx)
{
- for (thread_info *tp : current_inferior ()->non_exited_threads ())
+ for (thread_info &tp : current_inferior ()->non_exited_threads ())
{
- if (tp->ptid.lwp_p ())
- aarch64_debug_pending_threads.emplace (tp->ptid.lwp ());
+ if (tp.ptid.lwp_p ())
+ aarch64_debug_pending_threads.emplace (tp.ptid.lwp ());
}
}
@@ -348,9 +348,7 @@ aarch64_notify_debug_reg_change (ptid_t ptid,
}
#endif
-void _initialize_aarch64_fbsd_nat ();
-void
-_initialize_aarch64_fbsd_nat ()
+INIT_GDB_FILE (aarch64_fbsd_nat)
{
#ifdef HAVE_DBREG
aarch64_initialize_hw_point ();
diff --git a/gdb/aarch64-fbsd-tdep.c b/gdb/aarch64-fbsd-tdep.c
index 844023c..db9b82f 100644
--- a/gdb/aarch64-fbsd-tdep.c
+++ b/gdb/aarch64-fbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for FreeBSD/aarch64.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -239,8 +239,7 @@ aarch64_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Generic FreeBSD support. */
fbsd_init_abi (info, gdbarch);
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_lp64_solib_ops);
tramp_frame_prepend_unwinder (gdbarch, &aarch64_fbsd_sigframe);
@@ -261,9 +260,7 @@ aarch64_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
}
-void _initialize_aarch64_fbsd_tdep ();
-void
-_initialize_aarch64_fbsd_tdep ()
+INIT_GDB_FILE (aarch64_fbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_aarch64, 0, GDB_OSABI_FREEBSD,
aarch64_fbsd_init_abi);
diff --git a/gdb/aarch64-fbsd-tdep.h b/gdb/aarch64-fbsd-tdep.h
index 6d53b28..074e79f 100644
--- a/gdb/aarch64-fbsd-tdep.h
+++ b/gdb/aarch64-fbsd-tdep.h
@@ -1,6 +1,6 @@
/* FreeBSD/aarch64 target support, prototypes.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index 48ab765..89ecedd 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux AArch64.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.
@@ -51,6 +51,7 @@
#include "gdb_proc_service.h"
#include "arch-utils.h"
+#include "arch/aarch64-gcs-linux.h"
#include "arch/aarch64-mte-linux.h"
#include "nat/aarch64-mte-linux-ptrace.h"
@@ -542,6 +543,67 @@ store_tlsregs_to_thread (struct regcache *regcache)
perror_with_name (_("unable to store TLS register"));
}
+/* Fill GDB's register array with the GCS register values from
+ the current thread. */
+
+static void
+fetch_gcsregs_from_thread (regcache *regcache)
+{
+ aarch64_gdbarch_tdep *tdep
+ = gdbarch_tdep<aarch64_gdbarch_tdep> (regcache->arch ());
+
+ gdb_assert (tdep->gcs_reg_base != -1);
+ gdb_assert (tdep->gcs_linux_reg_base != -1);
+
+ user_gcs user_gcs;
+ iovec iovec;
+
+ iovec.iov_base = &user_gcs;
+ iovec.iov_len = sizeof (user_gcs);
+
+ int tid = get_ptrace_pid (regcache->ptid ());
+ if (ptrace (PTRACE_GETREGSET, tid, NT_ARM_GCS, &iovec) != 0)
+ perror_with_name (_("Unable to fetch GCS registers"));
+
+ regcache->raw_supply (tdep->gcs_reg_base, &user_gcs.gcspr_el0);
+ regcache->raw_supply (tdep->gcs_linux_reg_base, &user_gcs.features_enabled);
+ regcache->raw_supply (tdep->gcs_linux_reg_base + 1,
+ &user_gcs.features_locked);
+}
+
+/* Store to the current thread the valid GCS register set in the GDB's
+ register array. */
+
+static void
+store_gcsregs_to_thread (regcache *regcache)
+{
+ aarch64_gdbarch_tdep *tdep
+ = gdbarch_tdep<aarch64_gdbarch_tdep> (regcache->arch ());
+
+ gdb_assert (tdep->gcs_reg_base != -1);
+ gdb_assert (tdep->gcs_linux_reg_base != -1);
+
+ if (REG_VALID != regcache->get_register_status (tdep->gcs_reg_base)
+ || REG_VALID != regcache->get_register_status (tdep->gcs_linux_reg_base)
+ || REG_VALID
+ != regcache->get_register_status (tdep->gcs_linux_reg_base + 1))
+ return;
+
+ user_gcs user_gcs;
+ regcache->raw_collect (tdep->gcs_reg_base, &user_gcs.gcspr_el0);
+ regcache->raw_collect (tdep->gcs_linux_reg_base, &user_gcs.features_enabled);
+ regcache->raw_collect (tdep->gcs_linux_reg_base + 1,
+ &user_gcs.features_locked);
+
+ iovec iovec;
+ iovec.iov_base = &user_gcs;
+ iovec.iov_len = sizeof (user_gcs);
+
+ int tid = get_ptrace_pid (regcache->ptid ());
+ if (ptrace (PTRACE_SETREGSET, tid, NT_ARM_GCS, &iovec) != 0)
+ perror_with_name (_("Unable to store GCS registers"));
+}
+
/* The AArch64 version of the "fetch_registers" target_ops method. Fetch
REGNO from the target and place the result into REGCACHE. */
@@ -577,6 +639,9 @@ aarch64_fetch_registers (struct regcache *regcache, int regno)
if (tdep->has_sme2 ())
fetch_zt_from_thread (regcache);
+
+ if (tdep->has_gcs_linux ())
+ fetch_gcsregs_from_thread (regcache);
}
/* General purpose register? */
else if (regno < AARCH64_V0_REGNUM)
@@ -609,6 +674,11 @@ aarch64_fetch_registers (struct regcache *regcache, int regno)
&& regno >= tdep->tls_regnum_base
&& regno < tdep->tls_regnum_base + tdep->tls_register_count)
fetch_tlsregs_from_thread (regcache);
+ /* GCS register? */
+ else if (tdep->has_gcs_linux ()
+ && (regno == tdep->gcs_reg_base || regno == tdep->gcs_linux_reg_base
+ || regno == tdep->gcs_linux_reg_base + 1))
+ fetch_gcsregs_from_thread (regcache);
}
/* A version of the "fetch_registers" target_ops method used when running
@@ -680,6 +750,9 @@ aarch64_store_registers (struct regcache *regcache, int regno)
if (tdep->has_sme2 ())
store_zt_to_thread (regcache);
+
+ if (tdep->has_gcs_linux ())
+ store_gcsregs_to_thread (regcache);
}
/* General purpose register? */
else if (regno < AARCH64_V0_REGNUM)
@@ -706,6 +779,11 @@ aarch64_store_registers (struct regcache *regcache, int regno)
&& regno >= tdep->tls_regnum_base
&& regno < tdep->tls_regnum_base + tdep->tls_register_count)
store_tlsregs_to_thread (regcache);
+ /* GCS register? */
+ else if (tdep->has_gcs_linux ()
+ && (regno == tdep->gcs_reg_base || regno == tdep->gcs_linux_reg_base
+ || regno == tdep->gcs_linux_reg_base + 1))
+ store_gcsregs_to_thread (regcache);
/* PAuth registers are read-only. */
}
@@ -881,6 +959,7 @@ aarch64_linux_nat_target::read_description ()
active or not. */
features.vq = aarch64_sve_get_vq (tid);
features.pauth = hwcap & AARCH64_HWCAP_PACA;
+ features.gcs = features.gcs_linux = hwcap & HWCAP_GCS;
features.mte = hwcap2 & HWCAP2_MTE;
features.tls = aarch64_tls_register_count (tid);
/* SME feature check. */
@@ -1068,9 +1147,7 @@ aarch64_linux_nat_target::is_address_tagged (gdbarch *gdbarch, CORE_ADDR address
return gdbarch_tagged_address_p (gdbarch, address);
}
-void _initialize_aarch64_linux_nat ();
-void
-_initialize_aarch64_linux_nat ()
+INIT_GDB_FILE (aarch64_linux_nat)
{
aarch64_initialize_hw_point ();
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index c825699..048be4f 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux AArch64.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.
@@ -23,7 +23,9 @@
#include "extract-store-integer.h"
#include "gdbarch.h"
#include "glibc-tdep.h"
+#include "solib-svr4-linux.h"
#include "linux-tdep.h"
+#include "svr4-tls-tdep.h"
#include "aarch64-tdep.h"
#include "aarch64-linux-tdep.h"
#include "osabi.h"
@@ -31,10 +33,12 @@
#include "symtab.h"
#include "tramp-frame.h"
#include "trad-frame.h"
+#include "dwarf2/frame.h"
#include "target.h"
#include "target/target.h"
#include "expop.h"
#include "auxv.h"
+#include "inferior.h"
#include "regcache.h"
#include "regset.h"
@@ -43,11 +47,11 @@
#include "parser-defs.h"
#include "user-regs.h"
#include "xml-syscall.h"
-#include <ctype.h>
#include "record-full.h"
#include "linux-record.h"
+#include "arch/aarch64-gcs-linux.h"
#include "arch/aarch64-mte.h"
#include "arch/aarch64-mte-linux.h"
#include "arch/aarch64-scalable-linux.h"
@@ -162,6 +166,7 @@
#define AARCH64_ZA_MAGIC 0x54366345
#define AARCH64_TPIDR2_MAGIC 0x54504902
#define AARCH64_ZT_MAGIC 0x5a544e01
+#define AARCH64_GCS_MAGIC 0x47435300
/* Defines for the extra_context that follows an AARCH64_EXTRA_MAGIC. */
#define AARCH64_EXTRA_DATAP_OFFSET 8
@@ -203,6 +208,11 @@
the signal context state. */
#define AARCH64_SME2_CONTEXT_REGS_OFFSET 16
+/* GCSPR register value offset in the GCS signal frame context. */
+#define AARCH64_GCS_CONTEXT_GCSPR_OFFSET 8
+/* features_enabled value offset in the GCS signal frame context. */
+#define AARCH64_GCS_CONTEXT_FEATURES_ENABLED_OFFSET 16
+
/* Holds information about the signal frame. */
struct aarch64_linux_sigframe
{
@@ -243,6 +253,13 @@ struct aarch64_linux_sigframe
bool za_payload = false;
/* True if we have a ZT entry in the signal context, false otherwise. */
bool zt_available = false;
+
+ /* True if we have a GCS entry in the signal context, false otherwise. */
+ bool gcs_availabe = false;
+ /* The Guarded Control Stack Pointer Register. */
+ uint64_t gcspr;
+ /* Flags indicating which GCS features are enabled for the thread. */
+ uint64_t gcs_features_enabled;
};
/* Read an aarch64_ctx, returning the magic value, and setting *SIZE to the
@@ -526,6 +543,39 @@ aarch64_linux_read_signal_frame_info (const frame_info_ptr &this_frame,
section += size;
break;
}
+ case AARCH64_GCS_MAGIC:
+ {
+ gdb_byte buf[8];
+
+ /* Extract the GCSPR. */
+ if (target_read_memory (section + AARCH64_GCS_CONTEXT_GCSPR_OFFSET,
+ buf, 8) != 0)
+ {
+ warning (_("Failed to read the GCS pointer from the GCS signal"
+ " frame context."));
+ section += size;
+ break;
+ }
+
+ signal_frame.gcspr = extract_unsigned_integer (buf, byte_order);
+
+ /* Extract the features_enabled field. */
+ if (target_read_memory (section
+ + AARCH64_GCS_CONTEXT_FEATURES_ENABLED_OFFSET,
+ buf, sizeof (buf)) != 0)
+ {
+ warning (_("Failed to read the enabled features from the GCS"
+ " signal frame context."));
+ section += size;
+ break;
+ }
+
+ signal_frame.gcs_features_enabled
+ = extract_unsigned_integer (buf, byte_order);
+ signal_frame.gcs_availabe = true;
+ section += size;
+ break;
+ }
case AARCH64_EXTRA_MAGIC:
{
/* Extra is always the last valid section in reserved and points to
@@ -700,6 +750,19 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self,
+ AARCH64_TPIDR2_CONTEXT_TPIDR2_OFFSET);
}
+ /* Restore the GCS registers, if the target supports it and if there is
+ an entry for them. */
+ if (signal_frame.gcs_availabe && tdep->has_gcs_linux ())
+ {
+ /* Restore GCSPR. */
+ trad_frame_set_reg_value (this_cache, tdep->gcs_reg_base,
+ signal_frame.gcspr);
+ /* Restore gcs_features_enabled. */
+ trad_frame_set_reg_value (this_cache, tdep->gcs_linux_reg_base,
+ signal_frame.gcs_features_enabled);
+ /* gcs_features_locked isn't present in the GCS signal context. */
+ }
+
trad_frame_set_id (this_cache, frame_id_build (signal_frame.sp, func));
}
@@ -1602,6 +1665,27 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg-aarch-tls", sizeof_tls_regset, sizeof_tls_regset,
&aarch64_linux_tls_regset, "TLS register", cb_data);
}
+
+ /* Handle GCS registers. */
+ if (tdep->has_gcs_linux ())
+ {
+ /* Create this on the fly in order to handle the variable regnums. */
+ const regcache_map_entry gcs_regmap[] =
+ {
+ { 1, tdep->gcs_linux_reg_base, 8 }, /* features_enabled */
+ { 1, tdep->gcs_linux_reg_base + 1, 8 }, /* features_locked */
+ { 1, tdep->gcs_reg_base, 8 }, /* GCSPR */
+ { 0 }
+ };
+
+ const regset aarch64_linux_gcs_regset =
+ {
+ gcs_regmap, regcache_supply_regset, regcache_collect_regset
+ };
+
+ cb (".reg-aarch-gcs", sizeof (user_gcs), sizeof (user_gcs),
+ &aarch64_linux_gcs_regset, "GCS registers", cb_data);
+ }
}
/* Implement the "core_read_description" gdbarch method. */
@@ -1626,6 +1710,7 @@ aarch64_linux_core_read_description (struct gdbarch *gdbarch,
length. */
features.vq = aarch64_linux_core_read_vq_from_sections (gdbarch, abfd);
features.pauth = hwcap & AARCH64_HWCAP_PACA;
+ features.gcs = features.gcs_linux = hwcap & HWCAP_GCS;
features.mte = hwcap2 & HWCAP2_MTE;
/* Handle the TLS section. */
@@ -1663,9 +1748,9 @@ aarch64_linux_core_read_description (struct gdbarch *gdbarch,
static int
aarch64_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
- return (*s == '#' || isdigit (*s) /* Literal number. */
+ return (*s == '#' || c_isdigit (*s) /* Literal number. */
|| *s == '[' /* Register indirection. */
- || isalpha (*s)); /* Register value. */
+ || c_isalpha (*s)); /* Register value. */
}
/* This routine is used to parse a special token in AArch64's assembly.
@@ -1696,7 +1781,7 @@ aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
start = tmp;
/* Register name. */
- while (isalnum (*tmp))
+ while (c_isalnum (*tmp))
++tmp;
if (*tmp != ',')
@@ -1724,7 +1809,7 @@ aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
else if (*tmp == '+')
++tmp;
- if (!isdigit (*tmp))
+ if (!c_isdigit (*tmp))
return {};
displacement = strtol (tmp, &endp, 10);
@@ -2450,6 +2535,80 @@ aarch64_linux_tagged_address_p (struct gdbarch *gdbarch, CORE_ADDR address)
return true;
}
+/* Implement the "get_shadow_stack_pointer" gdbarch method. */
+
+static std::optional<CORE_ADDR>
+aarch64_linux_get_shadow_stack_pointer (gdbarch *gdbarch, regcache *regcache,
+ bool &shadow_stack_enabled)
+{
+ aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
+ shadow_stack_enabled = false;
+
+ if (!tdep->has_gcs_linux ())
+ return {};
+
+ uint64_t features_enabled;
+ register_status status = regcache->cooked_read (tdep->gcs_linux_reg_base,
+ &features_enabled);
+ if (status != REG_VALID)
+ error (_("Can't read $gcs_features_enabled."));
+
+ CORE_ADDR gcspr;
+ status = regcache->cooked_read (tdep->gcs_reg_base, &gcspr);
+ if (status != REG_VALID)
+ error (_("Can't read $gcspr."));
+
+ shadow_stack_enabled = features_enabled & PR_SHADOW_STACK_ENABLE;
+ return gcspr;
+}
+
+/* Implement Guarded Control Stack Pointer Register unwinding. For each
+ previous GCS pointer check if its address is still in the GCS memory
+ range. If it's outside the range set the returned value to unavailable,
+ otherwise return a value containing the new GCS pointer. */
+
+static value *
+aarch64_linux_dwarf2_prev_gcspr (const frame_info_ptr &this_frame,
+ void **this_cache, int regnum)
+{
+ value *v = frame_unwind_got_register (this_frame, regnum, regnum);
+ gdb_assert (v != nullptr);
+
+ gdbarch *gdbarch = get_frame_arch (this_frame);
+
+ if (v->entirely_available () && !v->optimized_out ())
+ {
+ int size = register_size (gdbarch, regnum);
+ bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ CORE_ADDR gcspr = extract_unsigned_integer (v->contents_all ().data (),
+ size, byte_order);
+
+ /* Starting with v6.13, the Linux kernel supports Guarded Control
+ Stack. Using /proc/PID/smaps we can only check if the current
+ GCSPR points to GCS memory. Only if this is the case a valid
+ previous GCS pointer can be calculated. */
+ std::pair<CORE_ADDR, CORE_ADDR> range;
+ if (linux_address_in_shadow_stack_mem_range (gcspr, &range))
+ {
+ /* The GCS grows downwards. To compute the previous GCS pointer,
+ we need to increment the GCSPR. */
+ CORE_ADDR new_gcspr = gcspr + 8;
+
+ /* If NEW_GCSPR still points within the current GCS memory range
+ we consider it to be valid. */
+ if (new_gcspr < range.second)
+ return frame_unwind_got_address (this_frame, regnum, new_gcspr);
+ }
+ }
+
+ /* Return a value which is marked as unavailable in case we could not
+ calculate a valid previous GCS pointer. */
+ value *retval
+ = value::allocate_register (get_next_frame_sentinel_okay (this_frame),
+ regnum, register_type (gdbarch, regnum));
+ retval->mark_bytes_unavailable (0, retval->type ()->length ());
+ return retval;
+}
/* AArch64 Linux implementation of the report_signal_info gdbarch
hook. Displays information about possible memory tag violations. */
@@ -2461,17 +2620,18 @@ aarch64_linux_report_signal_info (struct gdbarch *gdbarch,
{
aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
- if (!tdep->has_mte () || siggnal != GDB_SIGNAL_SEGV)
+ if (!(tdep->has_mte () || tdep->has_gcs ()) || siggnal != GDB_SIGNAL_SEGV)
return;
CORE_ADDR fault_addr = 0;
- long si_code = 0;
+ long si_code = 0, si_errno = 0;
try
{
/* Sigcode tells us if the segfault is actually a memory tag
violation. */
si_code = parse_and_eval_long ("$_siginfo.si_code");
+ si_errno = parse_and_eval_long ("$_siginfo.si_errno");
fault_addr
= parse_and_eval_long ("$_siginfo._sifields._sigfault.si_addr");
@@ -2482,13 +2642,18 @@ aarch64_linux_report_signal_info (struct gdbarch *gdbarch,
return;
}
- /* If this is not a memory tag violation, just return. */
- if (si_code != SEGV_MTEAERR && si_code != SEGV_MTESERR)
+ const char *meaning;
+
+ if (si_code == SEGV_MTEAERR || si_code == SEGV_MTESERR)
+ meaning = _("Memory tag violation");
+ else if (si_code == SEGV_CPERR && si_errno == 0)
+ meaning = _("Guarded Control Stack error");
+ else
return;
uiout->text ("\n");
- uiout->field_string ("sigcode-meaning", _("Memory tag violation"));
+ uiout->field_string ("sigcode-meaning", meaning);
/* For synchronous faults, show additional information. */
if (si_code == SEGV_MTESERR)
@@ -2514,7 +2679,7 @@ aarch64_linux_report_signal_info (struct gdbarch *gdbarch,
uiout->field_string ("logical-tag", hex_string (ltag));
}
}
- else
+ else if (si_code != SEGV_CPERR)
{
uiout->text ("\n");
uiout->text (_("Fault address unavailable"));
@@ -2597,8 +2762,8 @@ aarch64_linux_fill_memtag_section (struct gdbarch *gdbarch, asection *osec)
static_cast<int> (memtag_type::allocation)))
{
warning (_("Failed to read MTE tags from memory range [%s,%s)."),
- phex_nz (start_address, sizeof (start_address)),
- phex_nz (end_address, sizeof (end_address)));
+ phex_nz (start_address),
+ phex_nz (end_address));
return false;
}
@@ -2701,6 +2866,57 @@ aarch64_use_target_description_from_corefile_notes (gdbarch *gdbarch,
return true;
}
+/* Fetch and return the TLS DTV (dynamic thread vector) address for PTID.
+ Throw a suitable TLS error if something goes wrong. */
+
+static CORE_ADDR
+aarch64_linux_get_tls_dtv_addr (struct gdbarch *gdbarch, ptid_t ptid,
+ svr4_tls_libc libc)
+{
+ /* On aarch64, the thread pointer is found in the TPIDR register.
+ Note that this is the first register in the TLS feature - see
+ features/aarch64-tls.c - and it will always be present. */
+ regcache *regcache
+ = get_thread_arch_regcache (current_inferior (), ptid, gdbarch);
+ aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
+ target_fetch_registers (regcache, tdep->tls_regnum_base);
+ ULONGEST thr_ptr;
+ if (regcache->cooked_read (tdep->tls_regnum_base, &thr_ptr) != REG_VALID)
+ throw_error (TLS_GENERIC_ERROR, _("Unable to fetch thread pointer"));
+
+ CORE_ADDR dtv_ptr_addr;
+ switch (libc)
+ {
+ case svr4_tls_libc_musl:
+ /* MUSL: The DTV pointer is found at the very end of the pthread
+ struct which is located *before* the thread pointer. I.e.
+ the thread pointer will be just beyond the end of the struct,
+ so the address of the DTV pointer is found one pointer-size
+ before the thread pointer. */
+ dtv_ptr_addr = thr_ptr - (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
+ break;
+ case svr4_tls_libc_glibc:
+ /* GLIBC: The thread pointer (tpidr) points at the TCB (thread control
+ block). On aarch64, this struct (tcbhead_t) is defined to
+ contain two pointers. The first is a pointer to the DTV and
+ the second is a pointer to private data. So the DTV pointer
+ address is the same as the thread pointer. */
+ dtv_ptr_addr = thr_ptr;
+ break;
+ default:
+ throw_error (TLS_GENERIC_ERROR, _("Unknown aarch64 C library"));
+ break;
+ }
+ gdb::byte_vector buf (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
+ if (target_read_memory (dtv_ptr_addr, buf.data (), buf.size ()) != 0)
+ throw_error (TLS_GENERIC_ERROR, _("Unable to fetch DTV address"));
+
+ const struct builtin_type *builtin = builtin_type (gdbarch);
+ CORE_ADDR dtv_addr = gdbarch_pointer_to_address
+ (gdbarch, builtin->builtin_data_ptr, buf.data ());
+ return dtv_addr;
+}
+
static void
aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@@ -2712,16 +2928,24 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
NULL };
aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
+ if (tdep->has_gcs () && !tdep->has_gcs_linux ())
+ {
+ warning (_("Incomplete GCS support in the target: missing Linux part."
+ " GCS feature disabled."));
+ tdep->gcs_reg_base = -1;
+ }
+
tdep->lowest_pc = 0x8000;
linux_init_abi (info, gdbarch, 1);
-
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- linux_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_lp64_svr4_solib_ops);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
+ set_gdbarch_get_thread_local_address (gdbarch,
+ svr4_tls_get_thread_local_address);
+ svr4_tls_register_tls_methods (info, gdbarch, aarch64_linux_get_tls_dtv_addr);
/* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
@@ -2759,9 +2983,6 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Register a hook for checking if an address is tagged or not. */
set_gdbarch_tagged_address_p (gdbarch, aarch64_linux_tagged_address_p);
- set_gdbarch_report_signal_info (gdbarch,
- aarch64_linux_report_signal_info);
-
/* Core file helpers. */
/* Core file helper to create a memory tag section for a particular
@@ -2778,6 +2999,9 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
aarch64_linux_decode_memtag_section);
}
+ if (tdep->has_mte () || tdep->has_gcs ())
+ set_gdbarch_report_signal_info (gdbarch, aarch64_linux_report_signal_info);
+
/* Initialize the aarch64_linux_record_tdep. */
/* These values are the size of the type that will be used in a system
call. They are obtained from Linux Kernel source. */
@@ -2959,6 +3183,13 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
sections. */
set_gdbarch_use_target_description_from_corefile_notes (gdbarch,
aarch64_use_target_description_from_corefile_notes);
+
+ if (tdep->has_gcs_linux ())
+ {
+ set_gdbarch_get_shadow_stack_pointer (gdbarch,
+ aarch64_linux_get_shadow_stack_pointer);
+ tdep->fn_prev_gcspr = aarch64_linux_dwarf2_prev_gcspr;
+ }
}
#if GDB_SELF_TEST
@@ -2985,9 +3216,7 @@ aarch64_linux_ltag_tests (void)
} /* namespace selftests */
#endif /* GDB_SELF_TEST */
-void _initialize_aarch64_linux_tdep ();
-void
-_initialize_aarch64_linux_tdep ()
+INIT_GDB_FILE (aarch64_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_aarch64, 0, GDB_OSABI_LINUX,
aarch64_linux_init_abi);
diff --git a/gdb/aarch64-linux-tdep.h b/gdb/aarch64-linux-tdep.h
index 4cca8e9..77d968f 100644
--- a/gdb/aarch64-linux-tdep.h
+++ b/gdb/aarch64-linux-tdep.h
@@ -1,6 +1,6 @@
/* GNU/Linux on AArch64 target support, prototypes.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.
diff --git a/gdb/aarch64-nat.c b/gdb/aarch64-nat.c
index 1ba9c4c..b6b8de9 100644
--- a/gdb/aarch64-nat.c
+++ b/gdb/aarch64-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for AArch64.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/aarch64-nat.h b/gdb/aarch64-nat.h
index 4687094..ec7c564 100644
--- a/gdb/aarch64-nat.h
+++ b/gdb/aarch64-nat.h
@@ -1,6 +1,6 @@
/* Native-dependent code for AArch64.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -92,10 +92,6 @@ struct aarch64_nat_target : public BaseTarget
int remove_hw_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt) override
{ return aarch64_remove_hw_breakpoint (gdbarch, bp_tgt); }
-
- bool watchpoint_addr_within_range (CORE_ADDR addr, CORE_ADDR start,
- int length) override
- { return start <= addr && start + length - 1 >= addr; }
};
#endif /* GDB_AARCH64_NAT_H */
diff --git a/gdb/aarch64-newlib-tdep.c b/gdb/aarch64-newlib-tdep.c
index 4ac42a4..5045d5f9 100644
--- a/gdb/aarch64-newlib-tdep.c
+++ b/gdb/aarch64-newlib-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Newlib AArch64.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.
@@ -35,9 +35,7 @@ aarch64_newlib_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->jb_pc = 11;
}
-void _initialize_aarch64_newlib_tdep ();
-void
-_initialize_aarch64_newlib_tdep ()
+INIT_GDB_FILE (aarch64_newlib_tdep)
{
gdbarch_register_osabi (bfd_arch_aarch64, 0, GDB_OSABI_NEWLIB,
aarch64_newlib_init_abi);
diff --git a/gdb/aarch64-ravenscar-thread.c b/gdb/aarch64-ravenscar-thread.c
index 5a877cd..70da667 100644
--- a/gdb/aarch64-ravenscar-thread.c
+++ b/gdb/aarch64-ravenscar-thread.c
@@ -1,6 +1,6 @@
/* Ravenscar Aarch64 target support.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/aarch64-ravenscar-thread.h b/gdb/aarch64-ravenscar-thread.h
index 9cf0113..198d052 100644
--- a/gdb/aarch64-ravenscar-thread.h
+++ b/gdb/aarch64-ravenscar-thread.h
@@ -1,6 +1,6 @@
/* Ravenscar Aarch64 target support.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index bd107b8..500ac77d 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -1,6 +1,6 @@
/* Common target dependent code for GDB on AArch64 systems.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.
@@ -159,6 +159,18 @@ static const char *const aarch64_mte_register_names[] =
"tag_ctl"
};
+static const char *const aarch64_gcs_register_names[] = {
+ /* Guarded Control Stack Pointer Register. */
+ "gcspr"
+};
+
+static const char *const aarch64_gcs_linux_register_names[] = {
+ /* Field in struct user_gcs. */
+ "gcs_features_enabled",
+ /* Field in struct user_gcs. */
+ "gcs_features_locked",
+};
+
static int aarch64_stack_frame_destroyed_p (struct gdbarch *, CORE_ADDR);
/* AArch64 prologue cache structure. */
@@ -1396,6 +1408,12 @@ aarch64_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
return;
}
}
+ if (tdep->has_gcs () && tdep->fn_prev_gcspr != nullptr
+ && regnum == tdep->gcs_reg_base)
+ {
+ reg->how = DWARF2_FRAME_REG_FN;
+ reg->loc.fn = tdep->fn_prev_gcspr;
+ }
}
/* Implement the execute_dwarf_cfa_vendor_op method. */
@@ -1875,6 +1893,55 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
}
}
+/* Push LR_VALUE to the Guarded Control Stack. */
+
+static void
+aarch64_push_gcs_entry (regcache *regs, CORE_ADDR lr_value)
+{
+ gdbarch *arch = regs->arch ();
+ aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (arch);
+ CORE_ADDR gcs_addr;
+
+ register_status status = regs->cooked_read (tdep->gcs_reg_base, &gcs_addr);
+ if (status != REG_VALID)
+ error (_("Can't read $gcspr."));
+
+ gcs_addr -= 8;
+ gdb_byte buf[8];
+ store_integer (buf, gdbarch_byte_order (arch), lr_value);
+ if (target_write_memory (gcs_addr, buf, sizeof (buf)) != 0)
+ error (_("Can't write to Guarded Control Stack."));
+
+ /* Update GCSPR. */
+ regcache_cooked_write_unsigned (regs, tdep->gcs_reg_base, gcs_addr);
+}
+
+/* Remove the newest entry from the Guarded Control Stack. */
+
+static void
+aarch64_pop_gcs_entry (regcache *regs)
+{
+ gdbarch *arch = regs->arch ();
+ aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (arch);
+ CORE_ADDR gcs_addr;
+
+ register_status status = regs->cooked_read (tdep->gcs_reg_base, &gcs_addr);
+ if (status != REG_VALID)
+ error (_("Can't read $gcspr."));
+
+ /* Update GCSPR. */
+ regcache_cooked_write_unsigned (regs, tdep->gcs_reg_base, gcs_addr + 8);
+}
+
+/* Implement the "shadow_stack_push" gdbarch method. */
+
+static void
+aarch64_shadow_stack_push (gdbarch *gdbarch, CORE_ADDR new_addr,
+ regcache *regcache)
+{
+ aarch64_push_gcs_entry (regcache, new_addr);
+}
+
/* Implement the "push_dummy_call" gdbarch method. */
static CORE_ADDR
@@ -2696,7 +2763,7 @@ aarch64_store_return_value (struct type *type, struct regcache *regs,
{
/* Integral values greater than one word are stored in
consecutive registers starting with r0. This will always
- be a multiple of the regiser size. */
+ be a multiple of the register size. */
int len = type->length ();
int regno = AARCH64_X0_REGNUM;
@@ -3557,6 +3624,9 @@ struct aarch64_displaced_step_copy_insn_closure
/* PC adjustment offset after displaced stepping. If 0, then we don't
write the PC back, assuming the PC is already the right address. */
int32_t pc_adjust = 0;
+
+ /* True if it's a branch instruction that saves the link register. */
+ bool linked_branch = false;
};
/* Data when visiting instructions for displaced stepping. */
@@ -3608,6 +3678,12 @@ aarch64_displaced_step_b (const int is_bl, const int32_t offset,
/* Update LR. */
regcache_cooked_write_unsigned (dsd->regs, AARCH64_LR_REGNUM,
data->insn_addr + 4);
+ dsd->dsc->linked_branch = true;
+ bool gcs_is_enabled;
+ gdbarch_get_shadow_stack_pointer (dsd->regs->arch (), dsd->regs,
+ gcs_is_enabled);
+ if (gcs_is_enabled)
+ aarch64_push_gcs_entry (dsd->regs, data->insn_addr + 4);
}
}
@@ -3766,6 +3842,12 @@ aarch64_displaced_step_others (const uint32_t insn,
aarch64_emit_insn (dsd->insn_buf, insn & 0xffdfffff);
regcache_cooked_write_unsigned (dsd->regs, AARCH64_LR_REGNUM,
data->insn_addr + 4);
+ dsd->dsc->linked_branch = true;
+ bool gcs_is_enabled;
+ gdbarch_get_shadow_stack_pointer (dsd->regs->arch (), dsd->regs,
+ gcs_is_enabled);
+ if (gcs_is_enabled)
+ aarch64_push_gcs_entry (dsd->regs, data->insn_addr + 4);
}
else
aarch64_emit_insn (dsd->insn_buf, insn);
@@ -3862,20 +3944,24 @@ aarch64_displaced_step_fixup (struct gdbarch *gdbarch,
CORE_ADDR from, CORE_ADDR to,
struct regcache *regs, bool completed_p)
{
+ aarch64_displaced_step_copy_insn_closure *dsc
+ = (aarch64_displaced_step_copy_insn_closure *) dsc_;
CORE_ADDR pc = regcache_read_pc (regs);
- /* If the displaced instruction didn't complete successfully then all we
- need to do is restore the program counter. */
+ /* If the displaced instruction didn't complete successfully then we need
+ to restore the program counter, and perhaps the Guarded Control Stack. */
if (!completed_p)
{
+ bool gcs_is_enabled;
+ gdbarch_get_shadow_stack_pointer (gdbarch, regs, gcs_is_enabled);
+ if (dsc->linked_branch && gcs_is_enabled)
+ aarch64_pop_gcs_entry (regs);
+
pc = from + (pc - to);
regcache_write_pc (regs, pc);
return;
}
- aarch64_displaced_step_copy_insn_closure *dsc
- = (aarch64_displaced_step_copy_insn_closure *) dsc_;
-
displaced_debug_printf ("PC after stepping: %s (was %s).",
paddress (gdbarch, pc), paddress (gdbarch, to));
@@ -4046,6 +4132,14 @@ aarch64_features_from_target_desc (const struct target_desc *tdesc)
features.sme2 = (tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.sme2")
!= nullptr);
+ /* Check for the GCS feature. */
+ features.gcs = (tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.gcs")
+ != nullptr);
+
+ /* Check for the GCS Linux feature. */
+ features.gcs_linux = (tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.gcs.linux")
+ != nullptr);
+
return features;
}
@@ -4236,7 +4330,7 @@ aarch64_memtag_to_string (struct gdbarch *gdbarch, struct value *tag_value)
CORE_ADDR tag = value_as_address (tag_value);
- return string_printf ("0x%s", phex_nz (tag, sizeof (tag)));
+ return string_printf ("0x%s", phex_nz (tag));
}
/* See aarch64-tdep.h. */
@@ -4344,7 +4438,7 @@ aarch64_initialize_sme_pseudo_names (struct gdbarch *gdbarch,
}
/* Initialize the current architecture based on INFO. If possible,
- re-use an architecture from ARCHES, which is a list of
+ reuse an architecture from ARCHES, which is a list of
architectures already created during this debugging session.
Called e.g. at program startup, when reading a core file, and when
@@ -4590,6 +4684,48 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
int first_w_regnum = num_pseudo_regs;
num_pseudo_regs += 31;
+ const tdesc_feature *feature_gcs
+ = tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.gcs");
+ int first_gcs_regnum = -1;
+ /* Add the GCS registers. */
+ if (feature_gcs != nullptr)
+ {
+ first_gcs_regnum = num_regs;
+ /* Validate the descriptor provides the mandatory GCS registers and
+ allocate their numbers. */
+ for (i = 0; i < ARRAY_SIZE (aarch64_gcs_register_names); i++)
+ valid_p &= tdesc_numbered_register (feature_gcs, tdesc_data.get (),
+ first_gcs_regnum + i,
+ aarch64_gcs_register_names[i]);
+
+ num_regs += i;
+ }
+
+ if (!valid_p)
+ return nullptr;
+
+ const tdesc_feature *feature_gcs_linux
+ = tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.gcs.linux");
+ int first_gcs_linux_regnum = -1;
+ /* Add the GCS Linux registers. */
+ if (feature_gcs_linux != nullptr && feature_gcs == nullptr)
+ {
+ /* This feature depends on the GCS feature. */
+ return nullptr;
+ }
+ else if (feature_gcs_linux != nullptr)
+ {
+ first_gcs_linux_regnum = num_regs;
+ /* Validate the descriptor provides the mandatory GCS Linux registers
+ and allocate their numbers. */
+ for (i = 0; i < ARRAY_SIZE (aarch64_gcs_linux_register_names); i++)
+ valid_p &= tdesc_numbered_register (feature_gcs_linux, tdesc_data.get (),
+ first_gcs_linux_regnum + i,
+ aarch64_gcs_linux_register_names[i]);
+
+ num_regs += i;
+ }
+
if (!valid_p)
return nullptr;
@@ -4611,6 +4747,8 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->mte_reg_base = first_mte_regnum;
tdep->tls_regnum_base = first_tls_regnum;
tdep->tls_register_count = tls_register_count;
+ tdep->gcs_reg_base = first_gcs_regnum;
+ tdep->gcs_linux_reg_base = first_gcs_linux_regnum;
/* Set the SME register set details. The pseudo-registers will be adjusted
later. */
@@ -4638,7 +4776,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_sw_breakpoint_from_kind (gdbarch,
aarch64_breakpoint::bp_from_kind);
set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
- set_gdbarch_software_single_step (gdbarch, aarch64_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, aarch64_software_single_step);
/* Information about registers, etc. */
set_gdbarch_sp_regnum (gdbarch, AARCH64_SP_REGNUM);
@@ -4733,6 +4871,9 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_get_pc_address_flags (gdbarch, aarch64_get_pc_address_flags);
+ if (tdep->has_gcs ())
+ set_gdbarch_shadow_stack_push (gdbarch, aarch64_shadow_stack_push);
+
tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
/* Fetch the updated number of registers after we're done adding all
@@ -4905,6 +5046,11 @@ aarch64_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
pulongest (tdep->sme_tile_pseudo_base));
gdb_printf (file, _("aarch64_dump_tdep: sme_svq = %s\n"),
pulongest (tdep->sme_svq));
+
+ gdb_printf (file, _("aarch64_dump_tdep: gcs_reg_base = %d\n"),
+ tdep->gcs_reg_base);
+ gdb_printf (file, _("aarch64_dump_tdep: gcs_linux_reg_base = %d\n"),
+ tdep->gcs_linux_reg_base);
}
#if GDB_SELF_TEST
@@ -4914,9 +5060,7 @@ static void aarch64_process_record_test (void);
}
#endif
-void _initialize_aarch64_tdep ();
-void
-_initialize_aarch64_tdep ()
+INIT_GDB_FILE (aarch64_tdep)
{
gdbarch_register (bfd_arch_aarch64, aarch64_gdbarch_init,
aarch64_dump_tdep);
diff --git a/gdb/aarch64-tdep.h b/gdb/aarch64-tdep.h
index d1a8731..99e7d26 100644
--- a/gdb/aarch64-tdep.h
+++ b/gdb/aarch64-tdep.h
@@ -1,6 +1,6 @@
/* Common target dependent code for GDB on AArch64 systems.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.
@@ -23,6 +23,7 @@
#define GDB_AARCH64_TDEP_H
#include "arch/aarch64.h"
+#include "dwarf2/frame.h"
#include "displaced-stepping.h"
#include "infrun.h"
#include "gdbarch.h"
@@ -182,6 +183,30 @@ struct aarch64_gdbarch_tdep : gdbarch_tdep_base
{
return sme2_zt0_regnum > 0;
}
+
+ /* First GCS register. This is -1 if no GCS registers are available. */
+ int gcs_reg_base = -1;
+
+ /* First GCS Linux-specific register. This is -1 if no GCS Linux feature is
+ available. */
+ int gcs_linux_reg_base = -1;
+
+ /* Function to unwind the GCSPR from the given frame. */
+ fn_prev_register fn_prev_gcspr = nullptr;
+
+ /* Returns true if the target supports GCS. */
+ bool
+ has_gcs () const
+ {
+ return gcs_reg_base != -1;
+ }
+
+ /* Returns true if the target supports the Linux GCS feature. */
+ bool
+ has_gcs_linux () const
+ {
+ return gcs_linux_reg_base != -1;
+ }
};
const target_desc *aarch64_read_description (const aarch64_features &features);
diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
index 9971423..cae0970 100644
--- a/gdb/aclocal.m4
+++ b/gdb/aclocal.m4
@@ -202,9 +202,11 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
m4_include([../config/acx.m4])
m4_include([../config/ax_pthread.m4])
m4_include([../config/bfd64.m4])
+m4_include([../config/clang-plugin.m4])
m4_include([../config/debuginfod.m4])
m4_include([../config/depstand.m4])
m4_include([../config/enable.m4])
+m4_include([../config/gcc-plugin.m4])
m4_include([../config/gettext-sister.m4])
m4_include([../config/gettext.m4])
m4_include([../config/intlmacosx.m4])
diff --git a/gdb/acx_configure_dir.m4 b/gdb/acx_configure_dir.m4
index c87fdf3..5d444ef 100644
--- a/gdb/acx_configure_dir.m4
+++ b/gdb/acx_configure_dir.m4
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-2024 Free Software Foundation, Inc.
+# Copyright (C) 1992-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
diff --git a/gdb/ada-casefold.h b/gdb/ada-casefold.h
index 47c0016..9d7a8b0 100644
--- a/gdb/ada-casefold.h
+++ b/gdb/ada-casefold.h
@@ -3,7 +3,7 @@
/* UTF-32 case-folding for GDB
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ada-exp.h b/gdb/ada-exp.h
index 0c8161e..7354d65 100644
--- a/gdb/ada-exp.h
+++ b/gdb/ada-exp.h
@@ -1,6 +1,6 @@
/* Definitions for Ada expressions
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -34,28 +34,10 @@ extern struct value *ada_abs (struct type *expect_type,
struct expression *exp,
enum noside noside, enum exp_opcode op,
struct value *arg1);
-extern struct value *ada_unop_in_range (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct type *type);
extern struct value *ada_mult_binop (struct type *expect_type,
struct expression *exp,
enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2);
-extern struct value *ada_equal_binop (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2);
-extern struct value *ada_ternop_slice (struct expression *exp,
- enum noside noside,
- struct value *array,
- struct value *low_bound_val,
- struct value *high_bound_val);
-extern struct value *ada_binop_in_bounds (struct expression *exp,
- enum noside noside,
- struct value *arg1,
- struct value *arg2,
- int n);
extern struct value *ada_binop_minmax (struct type *expect_type,
struct expression *exp,
enum noside noside, enum exp_opcode op,
@@ -224,12 +206,7 @@ public:
value *evaluate (struct type *expect_type,
struct expression *exp,
- enum noside noside) override
- {
- value *val = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
- return ada_unop_in_range (expect_type, exp, noside, UNOP_IN_RANGE,
- val, std::get<1> (m_storage));
- }
+ enum noside noside) override;
enum exp_opcode opcode () const override
{ return UNOP_IN_RANGE; }
@@ -271,14 +248,7 @@ public:
value *evaluate (struct type *expect_type,
struct expression *exp,
- enum noside noside) override
- {
- value *arg1 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
- value *arg2 = std::get<2> (m_storage)->evaluate (arg1->type (),
- exp, noside);
- return ada_equal_binop (expect_type, exp, noside, std::get<0> (m_storage),
- arg1, arg2);
- }
+ enum noside noside) override;
void do_generate_ax (struct expression *exp,
struct agent_expr *ax,
@@ -307,13 +277,7 @@ public:
value *evaluate (struct type *expect_type,
struct expression *exp,
- enum noside noside) override
- {
- value *array = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
- value *low = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
- value *high = std::get<2> (m_storage)->evaluate (nullptr, exp, noside);
- return ada_ternop_slice (exp, noside, array, low, high);
- }
+ enum noside noside) override;
enum exp_opcode opcode () const override
{ return TERNOP_SLICE; }
@@ -335,13 +299,7 @@ public:
value *evaluate (struct type *expect_type,
struct expression *exp,
- enum noside noside) override
- {
- value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
- value *arg2 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
- return ada_binop_in_bounds (exp, noside, arg1, arg2,
- std::get<2> (m_storage));
- }
+ enum noside noside) override;
enum exp_opcode opcode () const override
{ return BINOP_IN_BOUNDS; }
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index b25639e..ed5694e 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -1,5 +1,5 @@
/* YACC parser for Ada expressions, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -35,7 +35,6 @@
%{
-#include <ctype.h>
#include "gdbsupport/unordered_map.h"
#include "expression.h"
#include "value.h"
@@ -1338,7 +1337,7 @@ write_object_renaming (struct parser_state *par_state,
SEARCH_VFT);
if (sym_info.symbol == NULL)
error (_("Could not find renamed variable: %s"), ada_decode (name).c_str ());
- else if (sym_info.symbol->aclass () == LOC_TYPEDEF)
+ else if (sym_info.symbol->loc_class () == LOC_TYPEDEF)
/* We have a renaming of an old-style renaming symbol. Don't
trust the block information. */
sym_info.block = orig_left_context;
@@ -1380,7 +1379,7 @@ write_object_renaming (struct parser_state *par_state,
[[fallthrough]];
case 'S':
renaming_expr += 1;
- if (isdigit (*renaming_expr))
+ if (c_isdigit (*renaming_expr))
{
char *next;
long val = strtol (renaming_expr, &next, 10);
@@ -1408,7 +1407,7 @@ write_object_renaming (struct parser_state *par_state,
SEARCH_VFT);
if (index_sym_info.symbol == NULL)
error (_("Could not find %s"), index_name);
- else if (index_sym_info.symbol->aclass () == LOC_TYPEDEF)
+ else if (index_sym_info.symbol->loc_class () == LOC_TYPEDEF)
/* Index is an old-style renaming symbol. */
index_sym_info.block = orig_left_context;
write_var_from_sym (par_state, index_sym_info);
@@ -1478,14 +1477,14 @@ block_lookup (const struct block *context, const char *raw_name)
= ada_lookup_symbol_list (name, context, SEARCH_FUNCTION_DOMAIN);
if (context == NULL
- && (syms.empty () || syms[0].symbol->aclass () != LOC_BLOCK))
+ && (syms.empty () || syms[0].symbol->loc_class () != LOC_BLOCK))
symtab = lookup_symtab (current_program_space, name);
else
symtab = NULL;
if (symtab != NULL)
result = symtab->compunit ()->blockvector ()->static_block ();
- else if (syms.empty () || syms[0].symbol->aclass () != LOC_BLOCK)
+ else if (syms.empty () || syms[0].symbol->loc_class () != LOC_BLOCK)
{
if (context == NULL)
error (_("No file or function \"%s\"."), raw_name);
@@ -1511,7 +1510,7 @@ select_possible_type_sym (const std::vector<struct block_symbol> &syms)
preferred_index = -1; preferred_type = NULL;
for (i = 0; i < syms.size (); i += 1)
- switch (syms[i].symbol->aclass ())
+ switch (syms[i].symbol->loc_class ())
{
case LOC_TYPEDEF:
if (ada_prefer_type (syms[i].symbol->type (), preferred_type))
@@ -1555,7 +1554,7 @@ find_primitive_type (struct parser_state *par_state, const char *name)
strcpy (expanded_name, "standard__");
strcat (expanded_name, name);
sym = ada_lookup_symbol (expanded_name, NULL, SEARCH_TYPE_DOMAIN).symbol;
- if (sym != NULL && sym->aclass () == LOC_TYPEDEF)
+ if (sym != NULL && sym->loc_class () == LOC_TYPEDEF)
type = sym->type ();
}
@@ -1888,7 +1887,7 @@ ada_parse_state::find_completion_bounds ()
const char *end = pstate->lexptr;
/* First the end of the prefix. Here we stop at the token start or
at '.' or space. */
- for (; end > m_original_expr && end[-1] != '.' && !isspace (end[-1]); --end)
+ for (; end > m_original_expr && end[-1] != '.' && !c_isspace (end[-1]); --end)
{
/* Nothing. */
}
@@ -1966,7 +1965,7 @@ write_name_assoc (struct parser_state *par_state, struct stoken name)
par_state->expression_context_block,
SEARCH_VFT);
- if (syms.size () != 1 || syms[0].symbol->aclass () == LOC_TYPEDEF)
+ if (syms.size () != 1 || syms[0].symbol->loc_class () == LOC_TYPEDEF)
pstate->push_new<ada_string_operation> (copy_name (name));
else
write_var_from_sym (par_state, syms[0]);
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index a55ee12..4d363e6 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -1,6 +1,6 @@
/* Ada language support routines for GDB, the GNU debugger.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include <ctype.h>
#include "event-top.h"
#include "exceptions.h"
#include "extract-store-integer.h"
@@ -36,7 +35,7 @@
#include "objfiles.h"
#include "breakpoint.h"
#include "gdbcore.h"
-#include "hashtab.h"
+#include "gdbsupport/unordered_set.h"
#include "gdbsupport/gdb_obstack.h"
#include "ada-lang.h"
#include "completer.h"
@@ -52,6 +51,7 @@
#include "namespace.h"
#include "cli/cli-style.h"
#include "cli/cli-decode.h"
+#include "gdbsupport/string-set.h"
#include "value.h"
#include "mi/mi-common.h"
@@ -182,7 +182,7 @@ static struct value *ada_search_struct_field (const char *, struct value *, int,
struct type *);
static int find_struct_field (const char *, struct type *, int,
- struct type **, int *, int *, int *, int *);
+ struct type **, int *, int *, int *, LONGEST *);
static int ada_resolve_function (std::vector<struct block_symbol> &,
struct value **, int, const char *,
@@ -349,56 +349,58 @@ struct cache_entry_search
{
const char *name;
domain_search_flags domain;
+};
+
+/* Hash function for cache entry. */
- hashval_t hash () const
+struct cache_entry_hash
+{
+ using is_transparent = void;
+ using is_avalanching = void;
+
+ /* This implementation works for both cache_entry and
+ cache_entry_search. */
+ template<typename T>
+ uint64_t operator() (const T &entry) const noexcept
{
- /* This must agree with hash_cache_entry, below. */
- return htab_hash_string (name);
+ return ankerl::unordered_dense::hash<std::string_view> () (entry.name);
}
};
-/* Hash function for cache_entry. */
+/* Equality function for cache entry. */
-static hashval_t
-hash_cache_entry (const void *v)
+struct cache_entry_eq
{
- const cache_entry *entry = (const cache_entry *) v;
- return htab_hash_string (entry->name.c_str ());
-}
+ using is_transparent = void;
-/* Equality function for cache_entry. */
-
-static int
-eq_cache_entry (const void *a, const void *b)
-{
- const cache_entry *entrya = (const cache_entry *) a;
- const cache_entry_search *entryb = (const cache_entry_search *) b;
+ /* This implementation works for both cache_entry and
+ cache_entry_search. */
+ template<typename T>
+ bool operator() (const T &lhs, const cache_entry &rhs) const noexcept
+ {
+ return lhs.domain == rhs.domain && lhs.name == rhs.name;
+ }
+};
- return entrya->domain == entryb->domain && entrya->name == entryb->name;
-}
+using cache_entry_set
+ = gdb::unordered_set<cache_entry, cache_entry_hash, cache_entry_eq>;
/* Key to our per-program-space data. */
-static const registry<program_space>::key<htab, htab_deleter>
+static const registry<program_space>::key<cache_entry_set>
ada_pspace_data_handle;
-/* Return this module's data for the given program space (PSPACE).
- If not is found, add a zero'ed one now.
+/* Return this module's data for the given program space (PSPACE). If
+ not is found, one is created. This function always returns a valid
+ object. */
- This function always returns a valid object. */
-
-static htab_t
+static cache_entry_set &
get_ada_pspace_data (struct program_space *pspace)
{
- htab_t data = ada_pspace_data_handle.get (pspace);
+ cache_entry_set *data = ada_pspace_data_handle.get (pspace);
if (data == nullptr)
- {
- data = htab_create_alloc (10, hash_cache_entry, eq_cache_entry,
- htab_delete_entry<cache_entry>,
- xcalloc, xfree);
- ada_pspace_data_handle.set (pspace, data);
- }
+ data = ada_pspace_data_handle.emplace (pspace);
- return data;
+ return *data;
}
/* Utilities */
@@ -872,7 +874,7 @@ is_compiler_suffix (const char *str)
{
gdb_assert (*str == '[');
++str;
- while (*str != '\0' && isalpha (*str))
+ while (*str != '\0' && c_isalpha (*str))
++str;
/* We accept a missing "]" in order to support completion. */
return *str == '\0' || (str[0] == ']' && str[1] == '\0');
@@ -1164,7 +1166,7 @@ ada_encode (const char *decoded, bool fold)
static int
is_lower_alphanum (const char c)
{
- return (isdigit (c) || (isalpha (c) && islower (c)));
+ return (c_isdigit (c) || (c_isalpha (c) && c_islower (c)));
}
/* ENCODED is the linkage name of a symbol and LEN contains its length.
@@ -1182,11 +1184,11 @@ is_lower_alphanum (const char c)
static void
ada_remove_trailing_digits (const char *encoded, int *len)
{
- if (*len > 1 && isdigit (encoded[*len - 1]))
+ if (*len > 1 && c_isdigit (encoded[*len - 1]))
{
int i = *len - 2;
- while (i > 0 && isdigit (encoded[i]))
+ while (i > 0 && c_isdigit (encoded[i]))
i--;
if (i >= 0 && encoded[i] == '.')
*len = i;
@@ -1217,7 +1219,7 @@ ada_remove_po_subprogram_suffix (const char *encoded, int *len)
if (*len > 1
&& encoded[*len - 1] == 'N'
- && (isdigit (encoded[*len - 2]) || islower (encoded[*len - 2])))
+ && (c_isdigit (encoded[*len - 2]) || c_islower (encoded[*len - 2])))
*len = *len - 1;
}
@@ -1229,7 +1231,7 @@ static int
remove_compiler_suffix (const char *encoded, int *len)
{
int offset = *len - 1;
- while (offset > 0 && isalpha (encoded[offset]))
+ while (offset > 0 && c_isalpha (encoded[offset]))
--offset;
if (offset > 0 && encoded[offset] == '.')
{
@@ -1249,7 +1251,7 @@ convert_hex (const char *str, int n, uint32_t *out)
for (int i = 0; i < n; ++i)
{
- if (!isxdigit (str[i]))
+ if (!c_isxdigit (str[i]))
return false;
result <<= 4;
result |= fromhex (str[i]);
@@ -1308,7 +1310,7 @@ convert_from_hex_encoded (std::string &out, const char *str, int n)
/* See ada-lang.h. */
std::string
-ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
+ada_decode (const char *encoded, bool wrap, bool translate)
{
int i;
int len0;
@@ -1381,11 +1383,11 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
/* Remove trailing __{digit}+ or trailing ${digit}+. */
- if (len0 > 1 && isdigit (encoded[len0 - 1]))
+ if (len0 > 1 && c_isdigit (encoded[len0 - 1]))
{
i = len0 - 2;
- while ((i >= 0 && isdigit (encoded[i]))
- || (i >= 1 && encoded[i] == '_' && isdigit (encoded[i - 1])))
+ while ((i >= 0 && c_isdigit (encoded[i]))
+ || (i >= 1 && encoded[i] == '_' && c_isdigit (encoded[i - 1])))
i -= 1;
if (i > 1 && encoded[i] == '_' && encoded[i - 1] == '_')
len0 = i - 1;
@@ -1396,14 +1398,14 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
/* The first few characters that are not alphabetic are not part
of any encoding we use, so we can copy them over verbatim. */
- for (i = 0; i < len0 && !isalpha (encoded[i]); i += 1)
+ for (i = 0; i < len0 && !c_isalpha (encoded[i]); i += 1)
decoded.push_back (encoded[i]);
at_start_name = 1;
while (i < len0)
{
/* Is this a symbol function? */
- if (operators && at_start_name && encoded[i] == 'O')
+ if (at_start_name && encoded[i] == 'O')
{
int k;
@@ -1412,9 +1414,12 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
int op_len = strlen (ada_opname_table[k].encoded);
if ((strncmp (ada_opname_table[k].encoded + 1, encoded + i + 1,
op_len - 1) == 0)
- && !isalnum (encoded[i + op_len]))
+ && !c_isalnum (encoded[i + op_len]))
{
- decoded.append (ada_opname_table[k].decoded);
+ if (translate)
+ decoded.append (ada_opname_table[k].decoded);
+ else
+ decoded.append (ada_opname_table[k].encoded);
at_start_name = 0;
i += op_len;
break;
@@ -1437,11 +1442,11 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
if (len0 - i > 5 && encoded [i] == '_' && encoded [i+1] == '_'
&& encoded [i+2] == 'B' && encoded [i+3] == '_'
- && isdigit (encoded [i+4]))
+ && c_isdigit (encoded [i+4]))
{
int k = i + 5;
- while (k < len0 && isdigit (encoded[k]))
+ while (k < len0 && c_isdigit (encoded[k]))
k++; /* Skip any extra digit. */
/* Double-check that the "__B_{DIGITS}+" sequence we found
@@ -1464,11 +1469,11 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
internally generated. */
if (len0 - i > 3 && encoded [i] == '_' && encoded[i+1] == 'E'
- && isdigit (encoded[i+2]))
+ && c_isdigit (encoded[i+2]))
{
int k = i + 3;
- while (k < len0 && isdigit (encoded[k]))
+ while (k < len0 && c_isdigit (encoded[k]))
k++;
if (k < len0
@@ -1502,37 +1507,69 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
i++;
}
- if (wide && i < len0 + 3 && encoded[i] == 'U' && isxdigit (encoded[i + 1]))
+ /* Handle wide characters while respecting the arguments to the
+ function: we may want to copy them verbatim, but in this case
+ we do not want to register that we've copied an upper-case
+ character. */
+ if (i < len0 + 3 && encoded[i] == 'U' && c_isxdigit (encoded[i + 1]))
{
- if (convert_from_hex_encoded (decoded, &encoded[i + 1], 2))
+ if (translate)
{
- i += 3;
+ if (convert_from_hex_encoded (decoded, &encoded[i + 1], 2))
+ {
+ i += 3;
+ continue;
+ }
+ }
+ else
+ {
+ decoded.push_back (encoded[i]);
+ ++i;
continue;
}
}
- else if (wide && i < len0 + 5 && encoded[i] == 'W' && isxdigit (encoded[i + 1]))
+ else if (i < len0 + 5 && encoded[i] == 'W'
+ && c_isxdigit (encoded[i + 1]))
{
- if (convert_from_hex_encoded (decoded, &encoded[i + 1], 4))
+ if (translate)
{
- i += 5;
+ if (convert_from_hex_encoded (decoded, &encoded[i + 1], 4))
+ {
+ i += 5;
+ continue;
+ }
+ }
+ else
+ {
+ decoded.push_back (encoded[i]);
+ ++i;
continue;
}
}
- else if (wide && i < len0 + 10 && encoded[i] == 'W' && encoded[i + 1] == 'W'
- && isxdigit (encoded[i + 2]))
+ else if (i < len0 + 10 && encoded[i] == 'W' && encoded[i + 1] == 'W'
+ && c_isxdigit (encoded[i + 2]))
{
- if (convert_from_hex_encoded (decoded, &encoded[i + 2], 8))
+ if (translate)
+ {
+ if (convert_from_hex_encoded (decoded, &encoded[i + 2], 8))
+ {
+ i += 10;
+ continue;
+ }
+ }
+ else
{
- i += 10;
+ decoded.push_back (encoded[i]);
+ ++i;
continue;
}
}
- if (encoded[i] == 'X' && i != 0 && isalnum (encoded[i - 1]))
+ if (encoded[i] == 'X' && i != 0 && c_isalnum (encoded[i - 1]))
{
/* This is a X[bn]* sequence not separated from the previous
part of the name with a non-alpha-numeric character (in other
- words, immediately following an alpha-numeric character), then
+ words, immediately following an alphanumeric character), then
verify that it is placed at the end of the encoded name. If
not, then the encoding is not valid and we should abort the
decoding. Otherwise, just skip it, it is used in body-nested
@@ -1550,6 +1587,12 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
at_start_name = 1;
i += 2;
}
+ else if (isupper (encoded[i]) || encoded[i] == ' ')
+ {
+ /* Decoded names should never contain any uppercase
+ character. */
+ goto Suppress;
+ }
else
{
/* It's a character part of the decoded name, so just copy it
@@ -1559,16 +1602,6 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
}
}
- /* Decoded names should never contain any uppercase character.
- Double-check this, and abort the decoding if we find one. */
-
- if (operators)
- {
- for (i = 0; i < decoded.length(); ++i)
- if (isupper (decoded[i]) || decoded[i] == ' ')
- goto Suppress;
- }
-
/* If the compiler added a suffix, append it now. */
if (suffix >= 0)
decoded = decoded + "[" + &encoded[suffix] + "]";
@@ -1594,6 +1627,13 @@ ada_decode_tests ()
/* This isn't valid, but used to cause a crash. PR gdb/30639. The
result does not really matter very much. */
SELF_CHECK (ada_decode ("44") == "44");
+
+ /* Check that the settings used by the DWARF reader have the desired
+ effect. */
+ SELF_CHECK (ada_decode ("symada__cS", false, false) == "");
+ SELF_CHECK (ada_decode ("pkg__Oxor", false, false) == "pkg.Oxor");
+ SELF_CHECK (ada_decode ("pack__func_W017b", false, false)
+ == "pack.func_W017b");
}
#endif
@@ -1603,7 +1643,7 @@ ada_decode_tests ()
storage leak, it should not be significant unless there are massive
changes in the set of decoded names in successive versions of a
symbol table loaded during a single session. */
-static struct htab *decoded_names_store;
+static gdb::string_set decoded_names_store;
/* Returns the decoded name of GSYMBOL, as for ada_decode, caching it
in the language-specific part of GSYMBOL, if it has not been
@@ -1637,13 +1677,7 @@ ada_decode_symbol (const struct general_symbol_info *arg)
which case, we put the result on the heap. Since we only
decode when needed, we hope this usually does not cause a
significant memory leak (FIXME). */
-
- char **slot = (char **) htab_find_slot (decoded_names_store,
- decoded.c_str (), INSERT);
-
- if (*slot == NULL)
- *slot = xstrdup (decoded.c_str ());
- *resultp = *slot;
+ *resultp = decoded_names_store.insert (decoded);
}
}
@@ -1680,8 +1714,6 @@ ada_decode_symbol (const struct general_symbol_info *arg)
void
ada_fixup_array_indexes_type (struct type *index_desc_type)
{
- int i;
-
if (index_desc_type == NULL)
return;
gdb_assert (index_desc_type->num_fields () > 0);
@@ -1699,13 +1731,13 @@ ada_fixup_array_indexes_type (struct type *index_desc_type)
return;
/* Fixup each field of INDEX_DESC_TYPE. */
- for (i = 0; i < index_desc_type->num_fields (); i++)
+ for (auto &field : index_desc_type->fields ())
{
- const char *name = index_desc_type->field (i).name ();
+ const char *name = field.name ();
struct type *raw_type = ada_check_typedef (ada_find_any_type (name));
if (raw_type)
- index_desc_type->field (i).set_type (raw_type);
+ field.set_type (raw_type);
}
}
@@ -1732,16 +1764,6 @@ desc_base_type (struct type *type)
return type;
}
-/* True iff TYPE indicates a "thin" array pointer type. */
-
-static int
-is_thin_pntr (struct type *type)
-{
- return
- is_suffix (ada_type_name (desc_base_type (type)), "___XUT")
- || is_suffix (ada_type_name (desc_base_type (type)), "___XUT___XVE");
-}
-
/* The descriptor type for thin pointer type TYPE. */
static struct type *
@@ -1780,14 +1802,45 @@ thin_data_pntr (struct value *val)
return value_from_longest (data_type, val->address ());
}
-/* True iff TYPE indicates a "thick" array pointer type. */
+/* Different kinds of Ada-specific pointers. */
+enum class pointer_kind
+{
+ /* Not a thin or thick pointer. */
+ NOT_SPECIAL,
+ /* A thin pointer. */
+ THIN,
+ /* Thick pointer where the bounds are accessed via the P_BOUNDS
+ member, a pointer to the bounds. */
+ P_BOUNDS,
+ /* Thick pointer where the bounds are accessed via the BOUNDS
+ member, which directly holds the bounds. */
+ EXTENDED_ACCESS,
+};
-static int
-is_thick_pntr (struct type *type)
+/* Return a pointer_kind indicating whether TYPE is a special category
+ of pointer. Note that TYPE may be NULL, in which case NOT_SPECIAL
+ is returned. */
+
+static pointer_kind
+categorize_pointer (struct type *type)
{
type = desc_base_type (type);
- return (type != NULL && type->code () == TYPE_CODE_STRUCT
- && lookup_struct_elt_type (type, "P_BOUNDS", 1) != NULL);
+ if (type == nullptr)
+ return pointer_kind::NOT_SPECIAL;
+
+ if (is_suffix (ada_type_name (type), "___XUT")
+ || is_suffix (ada_type_name (type), "___XUT___XVE"))
+ return pointer_kind::THIN;
+
+ if (type->code () == TYPE_CODE_STRUCT)
+ {
+ if (lookup_struct_elt_type (type, "P_BOUNDS", 1) != nullptr)
+ return pointer_kind::P_BOUNDS;
+ if (lookup_struct_elt_type (type, "BOUNDS", 1) != nullptr)
+ return pointer_kind::EXTENDED_ACCESS;
+ }
+
+ return pointer_kind::NOT_SPECIAL;
}
/* If TYPE is the type of an array descriptor (fat or thin pointer) or a
@@ -1798,11 +1851,9 @@ desc_bounds_type (struct type *type)
{
struct type *r;
+ pointer_kind kind = categorize_pointer (type);
type = desc_base_type (type);
-
- if (type == NULL)
- return NULL;
- else if (is_thin_pntr (type))
+ if (kind == pointer_kind::THIN)
{
type = thin_descriptor_type (type);
if (type == NULL)
@@ -1811,25 +1862,36 @@ desc_bounds_type (struct type *type)
if (r != NULL)
return ada_check_typedef (r);
}
- else if (type->code () == TYPE_CODE_STRUCT)
+ else if (kind == pointer_kind::P_BOUNDS
+ || kind == pointer_kind::EXTENDED_ACCESS)
{
- r = lookup_struct_elt_type (type, "P_BOUNDS", 1);
+ const char *field_name = (kind == pointer_kind::EXTENDED_ACCESS
+ ? "BOUNDS"
+ : "P_BOUNDS");
+ r = lookup_struct_elt_type (type, field_name, 1);
if (r != NULL)
- return ada_check_typedef (ada_check_typedef (r)->target_type ());
+ {
+ struct type *bounds_type = ada_check_typedef (r);
+ if (bounds_type->code () == TYPE_CODE_PTR)
+ bounds_type = ada_check_typedef (bounds_type->target_type ());
+ return bounds_type;
+ }
}
return NULL;
}
/* If ARR is an array descriptor (fat or thin pointer), or pointer to
- one, a pointer to its bounds data. Otherwise, throw an
- exception. */
+ one, return a pointer to its bounds data. For a fat pointer, this
+ means the structure holding the bounds -- so for extended access
+ pointers in particular, it will just return the descriptor itself.
+ Otherwise, throw an exception. */
static struct value *
desc_bounds (struct value *arr)
{
struct type *type = ada_check_typedef (arr->type ());
-
- if (is_thin_pntr (type))
+ pointer_kind kind = categorize_pointer (type);
+ if (kind == pointer_kind::THIN)
{
struct type *bounds_type =
desc_bounds_type (thin_descriptor_type (type));
@@ -1850,14 +1912,18 @@ desc_bounds (struct value *arr)
value_from_longest (lookup_pointer_type (bounds_type),
addr - bounds_type->length ());
}
-
- else if (is_thick_pntr (type))
+ else if (kind == pointer_kind::P_BOUNDS
+ || kind == pointer_kind::EXTENDED_ACCESS)
{
- struct value *p_bounds = value_struct_elt (&arr, {}, "P_BOUNDS", NULL,
- _("Bad GNAT array descriptor"));
+ const char *field_name = (kind == pointer_kind::EXTENDED_ACCESS
+ ? "BOUNDS"
+ : "P_BOUNDS");
+ struct value *p_bounds
+ = value_struct_elt (&arr, {}, field_name, nullptr,
+ _("Bad GNAT array descriptor"));
struct type *p_bounds_type = p_bounds->type ();
- if (p_bounds_type
+ if (p_bounds_type != nullptr
&& p_bounds_type->code () == TYPE_CODE_PTR)
{
struct type *target_type = p_bounds_type->target_type ();
@@ -1867,7 +1933,8 @@ desc_bounds (struct value *arr)
(ada_check_typedef (target_type)),
p_bounds);
}
- else
+ else if (p_bounds_type == nullptr
+ || kind != pointer_kind::EXTENDED_ACCESS)
error (_("Bad GNAT array descriptor"));
return p_bounds;
@@ -1907,12 +1974,13 @@ fat_pntr_bounds_bitsize (struct type *type)
static struct type *
desc_data_target_type (struct type *type)
{
+ pointer_kind kind = categorize_pointer (type);
type = desc_base_type (type);
-
/* NOTE: The following is bogus; see comment in desc_bounds. */
- if (is_thin_pntr (type))
+ if (kind == pointer_kind::THIN)
return desc_base_type (thin_descriptor_type (type)->field (1).type ());
- else if (is_thick_pntr (type))
+ else if (kind == pointer_kind::P_BOUNDS
+ || kind == pointer_kind::EXTENDED_ACCESS)
{
struct type *data_type = lookup_struct_elt_type (type, "P_ARRAY", 1);
@@ -1931,10 +1999,11 @@ static struct value *
desc_data (struct value *arr)
{
struct type *type = arr->type ();
-
- if (is_thin_pntr (type))
+ pointer_kind kind = categorize_pointer (type);
+ if (kind == pointer_kind::THIN)
return thin_data_pntr (arr);
- else if (is_thick_pntr (type))
+ else if (kind == pointer_kind::P_BOUNDS
+ || kind == pointer_kind::EXTENDED_ACCESS)
return value_struct_elt (&arr, {}, "P_ARRAY", NULL,
_("Bad GNAT array descriptor"));
else
@@ -2132,7 +2201,10 @@ ada_type_of_array (struct value *arr, int bounds)
return ada_check_typedef (arr->type ());
descriptor = desc_bounds (arr);
- if (value_as_long (descriptor) == 0)
+ /* In the extended access case, the bounds struct is "inline" so
+ the pointer cannot be NULL. */
+ if (ada_check_typedef (descriptor->type ())->code () == TYPE_CODE_PTR
+ && value_as_long (descriptor) == 0)
return NULL;
while (arity > 0)
{
@@ -2143,8 +2215,8 @@ ada_type_of_array (struct value *arr, int bounds)
arity -= 1;
struct type *range_type
= create_static_range_type (alloc, low->type (),
- longest_to_int (value_as_long (low)),
- longest_to_int (value_as_long (high)));
+ value_as_long (low),
+ value_as_long (high));
elt_type = create_array_type (alloc, elt_type, range_type);
INIT_GNAT_SPECIFIC (elt_type);
@@ -2273,7 +2345,8 @@ ada_is_unconstrained_packed_array_type (struct type *type)
/* If we saw GNAT encodings, then the above code is sufficient.
However, with minimal encodings, we will just have a thick
pointer instead. */
- if (is_thick_pntr (type))
+ pointer_kind kind = categorize_pointer (type);
+ if (kind == pointer_kind::P_BOUNDS || kind == pointer_kind::EXTENDED_ACCESS)
{
type = desc_base_type (type);
/* The structure's first field is a pointer to an array, so this
@@ -2325,7 +2398,9 @@ decode_packed_array_bitsize (struct type *type)
tail = strstr (raw_name, "___XP");
if (tail == nullptr)
{
- gdb_assert (is_thick_pntr (type));
+ pointer_kind kind = categorize_pointer (type);
+ gdb_assert (kind == pointer_kind::P_BOUNDS
+ || kind == pointer_kind::EXTENDED_ACCESS);
/* The structure's first field is a pointer to an array, so this
fetches the array type. */
type = type->field (0).type ()->target_type ();
@@ -2986,8 +3061,11 @@ value_assign_to_component (struct value *container, struct value *component,
bool
ada_is_access_to_unconstrained_array (struct type *type)
{
- return (type->code () == TYPE_CODE_TYPEDEF
- && is_thick_pntr (ada_typedef_target_type (type)));
+ if (type->code () != TYPE_CODE_TYPEDEF)
+ return false;
+ pointer_kind kind = categorize_pointer (ada_typedef_target_type (type));
+ return (kind == pointer_kind::P_BOUNDS
+ || kind == pointer_kind::EXTENDED_ACCESS);
}
/* The value of the element of array ARR at the ARITY indices given in IND.
@@ -3047,7 +3125,7 @@ ada_value_subscript (struct value *arr, int arity, struct value **ind)
Note: Unlike what one would expect, this function is used instead of
ada_value_subscript for basically all non-packed array types. The reason
- for this is that a side effect of doing our own pointer arithmetics instead
+ for this is that a side effect of doing our own pointer arithmetic instead
of relying on value_subscript is that there is no implicit typedef peeling.
This is important for arrays of array accesses, where it allows us to
preserve the fact that the array's element is an array access, where the
@@ -3087,7 +3165,7 @@ ada_value_ptr_subscript (struct value *arr, int arity, struct value **ind)
this array is LOW, as per Ada rules. */
static struct value *
ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
- int low, int high)
+ LONGEST low, LONGEST high)
{
struct type *type0 = ada_check_typedef (type);
struct type *base_index_type = type0->index_type ()->target_type ();
@@ -3098,7 +3176,7 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
(alloc, type0->target_type (), index_type,
type0->dyn_prop (DYN_PROP_BYTE_STRIDE),
type0->field (0).bitsize ());
- int base_low = ada_discrete_type_low_bound (type0->index_type ());
+ LONGEST base_low = ada_discrete_type_low_bound (type0->index_type ());
std::optional<LONGEST> base_low_pos, low_pos;
CORE_ADDR base;
@@ -3122,7 +3200,7 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
static struct value *
-ada_value_slice (struct value *array, int low, int high)
+ada_value_slice (struct value *array, LONGEST low, LONGEST high)
{
struct type *type = ada_check_typedef (array->type ());
struct type *base_index_type = type->index_type ()->target_type ();
@@ -3395,7 +3473,7 @@ ada_array_length (struct value *arr, int n)
less than LOW, then LOW-1 is used. */
static struct value *
-empty_array (struct type *arr_type, int low, int high)
+empty_array (struct type *arr_type, LONGEST low, LONGEST high)
{
struct type *arr_type0 = ada_check_typedef (arr_type);
type_allocator alloc (arr_type0->index_type ()->target_type ());
@@ -3642,7 +3720,7 @@ See set/show multiple-symbol."));
if (syms[i].symbol == NULL)
continue;
- if (syms[i].symbol->aclass () == LOC_BLOCK)
+ if (syms[i].symbol->loc_class () == LOC_BLOCK)
{
struct symtab_and_line sal =
find_function_start_sal (syms[i].symbol, 1);
@@ -3664,7 +3742,7 @@ See set/show multiple-symbol."));
else
{
int is_enumeral =
- (syms[i].symbol->aclass () == LOC_CONST
+ (syms[i].symbol->loc_class () == LOC_CONST
&& syms[i].symbol->type () != NULL
&& syms[i].symbol->type ()->code () == TYPE_CODE_ENUM);
struct symtab *symtab = NULL;
@@ -3827,7 +3905,7 @@ ada_resolve_variable (struct symbol *sym, const struct block *block,
candidates.end (),
[] (block_symbol &bsym)
{
- switch (bsym.symbol->aclass ())
+ switch (bsym.symbol->loc_class ())
{
case LOC_REGISTER:
case LOC_ARG:
@@ -3850,7 +3928,7 @@ ada_resolve_variable (struct symbol *sym, const struct block *block,
candidates.end (),
[] (block_symbol &bsym)
{
- return bsym.symbol->aclass () == LOC_TYPEDEF;
+ return bsym.symbol->loc_class () == LOC_TYPEDEF;
}),
candidates.end ());
}
@@ -3950,9 +4028,9 @@ ada_type_match (struct type *ftype, struct type *atype)
atype = ada_check_typedef (atype);
if (ftype->code () == TYPE_CODE_REF)
- ftype = ftype->target_type ();
+ ftype = ada_check_typedef (ftype->target_type ());
if (atype->code () == TYPE_CODE_REF)
- atype = atype->target_type ();
+ atype = ada_check_typedef (atype->target_type ());
switch (ftype->code ())
{
@@ -4005,7 +4083,7 @@ ada_args_match (struct symbol *func, struct value **actuals, int n_actuals)
int i;
struct type *func_type = func->type ();
- if (func->aclass () == LOC_CONST
+ if (func->loc_class () == LOC_CONST
&& func_type->code () == TYPE_CODE_ENUM)
return (n_actuals == 0);
else if (func_type == NULL || func_type->code () != TYPE_CODE_FUNC)
@@ -4315,7 +4393,7 @@ ada_parse_renaming (struct symbol *sym,
if (sym == NULL)
return ADA_NOT_RENAMING;
- switch (sym->aclass ())
+ switch (sym->loc_class ())
{
default:
return ADA_NOT_RENAMING;
@@ -4695,19 +4773,18 @@ static int
lookup_cached_symbol (const char *name, domain_search_flags domain,
struct symbol **sym, const struct block **block)
{
- htab_t tab = get_ada_pspace_data (current_program_space);
+ cache_entry_set &htab = get_ada_pspace_data (current_program_space);
cache_entry_search search;
search.name = name;
search.domain = domain;
- cache_entry *e = (cache_entry *) htab_find_with_hash (tab, &search,
- search.hash ());
- if (e == nullptr)
+ auto iter = htab.find (search);
+ if (iter == htab.end ())
return 0;
if (sym != nullptr)
- *sym = e->sym;
+ *sym = iter->sym;
if (block != nullptr)
- *block = e->block;
+ *block = iter->block;
return 1;
}
@@ -4735,21 +4812,8 @@ cache_symbol (const char *name, domain_search_flags domain,
return;
}
- htab_t tab = get_ada_pspace_data (current_program_space);
- cache_entry_search search;
- search.name = name;
- search.domain = domain;
-
- void **slot = htab_find_slot_with_hash (tab, &search,
- search.hash (), INSERT);
-
- cache_entry *e = new cache_entry;
- e->name = name;
- e->domain = domain;
- e->sym = sym;
- e->block = block;
-
- *slot = e;
+ cache_entry_set &tab = get_ada_pspace_data (current_program_space);
+ tab.insert (cache_entry {name, domain, sym, block});
}
/* Symbol Lookup */
@@ -4795,7 +4859,7 @@ is_nonfunction (const std::vector<struct block_symbol> &syms)
for (const block_symbol &sym : syms)
if (sym.symbol->type ()->code () != TYPE_CODE_FUNC
&& (sym.symbol->type ()->code () != TYPE_CODE_ENUM
- || sym.symbol->aclass () != LOC_CONST))
+ || sym.symbol->loc_class () != LOC_CONST))
return 1;
return 0;
@@ -4830,10 +4894,10 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1)
if (sym0 == sym1)
return 1;
if (sym0->domain () != sym1->domain ()
- || sym0->aclass () != sym1->aclass ())
+ || sym0->loc_class () != sym1->loc_class ())
return 0;
- switch (sym0->aclass ())
+ switch (sym0->loc_class ())
{
case LOC_UNDEF:
return 1;
@@ -4920,9 +4984,8 @@ ada_lookup_simple_minsym (const char *name, struct objfile *objfile)
symbol_name_matcher_ftype *match_name
= ada_get_symbol_name_matcher (lookup_name);
- gdbarch_iterate_over_objfiles_in_search_order
- (objfile != NULL ? objfile->arch () : current_inferior ()->arch (),
- [&result, lookup_name, match_name] (struct objfile *obj)
+ current_program_space->iterate_over_objfiles_in_search_order
+ ([&result, lookup_name, match_name] (struct objfile *obj)
{
for (minimal_symbol *msymbol : obj->msymbols ())
{
@@ -5088,7 +5151,7 @@ remove_extra_symbols (std::vector<struct block_symbol> &syms)
should be identical. */
else if (syms[i].symbol->linkage_name () != NULL
- && syms[i].symbol->aclass () == LOC_STATIC
+ && syms[i].symbol->loc_class () == LOC_STATIC
&& is_nondebugging_type (syms[i].symbol->type ()))
{
for (j = 0; !remove_p && j < syms.size (); j += 1)
@@ -5097,8 +5160,8 @@ remove_extra_symbols (std::vector<struct block_symbol> &syms)
&& syms[j].symbol->linkage_name () != NULL
&& strcmp (syms[i].symbol->linkage_name (),
syms[j].symbol->linkage_name ()) == 0
- && (syms[i].symbol->aclass ()
- == syms[j].symbol->aclass ())
+ && (syms[i].symbol->loc_class ()
+ == syms[j].symbol->loc_class ())
&& syms[i].symbol->value_address ()
== syms[j].symbol->value_address ())
remove_p = true;
@@ -5107,12 +5170,12 @@ remove_extra_symbols (std::vector<struct block_symbol> &syms)
/* Two functions with the same block are identical. */
- else if (syms[i].symbol->aclass () == LOC_BLOCK)
+ else if (syms[i].symbol->loc_class () == LOC_BLOCK)
{
for (j = 0; !remove_p && j < syms.size (); j += 1)
{
if (i != j
- && syms[j].symbol->aclass () == LOC_BLOCK
+ && syms[j].symbol->loc_class () == LOC_BLOCK
&& (syms[i].symbol->value_block ()
== syms[j].symbol->value_block ()))
remove_p = true;
@@ -5189,7 +5252,7 @@ is_package_name (const char *name)
static int
old_renaming_is_invisible (const struct symbol *sym, const char *function_name)
{
- if (sym->aclass () != LOC_TYPEDEF)
+ if (sym->loc_class () != LOC_TYPEDEF)
return 0;
std::string scope = xget_renaming_scope (sym->type ());
@@ -5268,7 +5331,7 @@ remove_irrelevant_renamings (std::vector<struct block_symbol> *syms,
const char *name;
const char *suffix;
- if (sym == NULL || sym->aclass () == LOC_TYPEDEF)
+ if (sym == NULL || sym->loc_class () == LOC_TYPEDEF)
continue;
name = sym->linkage_name ();
suffix = strstr (name, "___XR");
@@ -5393,7 +5456,7 @@ match_data::operator() (struct block_symbol *bsym)
}
else
{
- if (sym->aclass () == LOC_UNRESOLVED)
+ if (sym->loc_class () == LOC_UNRESOLVED)
return true;
else if (sym->is_argument ())
arg_sym = sym;
@@ -5435,7 +5498,7 @@ ada_add_block_renamings (std::vector<struct block_symbol> &result,
better in this case since, in DWARF, DW_AT_import is a DIE reference,
not a simple name. But in order to do this, we would need to enhance
the DWARF reader to associate a symbol to this renaming, instead of a
- name. So, for now, we do something simpler: re-use the C++/Fortran
+ name. So, for now, we do something simpler: reuse the C++/Fortran
namespace machinery. */
r_name = (renaming->alias != NULL
? renaming->alias
@@ -5492,22 +5555,19 @@ map_matching_symbols (struct objfile *objfile,
match_data &data)
{
data.objfile = objfile;
- objfile->expand_symtabs_matching (nullptr, &lookup_name,
- nullptr, nullptr,
- global
- ? SEARCH_GLOBAL_BLOCK
- : SEARCH_STATIC_BLOCK,
- domain);
const int block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
- for (compunit_symtab *symtab : objfile->compunits ())
+ auto callback = [&] (compunit_symtab *symtab)
{
const struct block *block
= symtab->blockvector ()->block (block_kind);
- if (!iterate_over_symbols_terminated (block, lookup_name,
- domain, data))
- break;
- }
+ return iterate_over_symbols_terminated (block, lookup_name,
+ domain, data);
+ };
+
+ objfile->search (nullptr, &lookup_name, nullptr, callback,
+ global ? SEARCH_GLOBAL_BLOCK : SEARCH_STATIC_BLOCK,
+ domain);
}
/* Add to RESULT all non-local symbols whose name and domain match
@@ -5524,14 +5584,14 @@ add_nonlocal_symbols (std::vector<struct block_symbol> &result,
bool is_wild_match = lookup_name.ada ().wild_match_p ();
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- map_matching_symbols (objfile, lookup_name, domain, global, data);
+ map_matching_symbols (&objfile, lookup_name, domain, global, data);
- for (compunit_symtab *cu : objfile->compunits ())
+ for (compunit_symtab &cu : objfile.compunits ())
{
const struct block *global_block
- = cu->blockvector ()->global_block ();
+ = cu.blockvector ()->global_block ();
if (ada_add_block_renamings (result, global_block, lookup_name,
domain))
@@ -5545,8 +5605,8 @@ add_nonlocal_symbols (std::vector<struct block_symbol> &result,
std::string bracket_name = std::string ("<_ada_") + name + '>';
lookup_name_info name1 (bracket_name, symbol_name_match_type::FULL);
- for (objfile *objfile : current_program_space->objfiles ())
- map_matching_symbols (objfile, name1, domain, global, data);
+ for (objfile &objfile : current_program_space->objfiles ())
+ map_matching_symbols (&objfile, name1, domain, global, data);
}
}
@@ -5749,10 +5809,10 @@ is_name_suffix (const char *str)
/* Skip optional leading __[0-9]+. */
- if (len > 3 && str[0] == '_' && str[1] == '_' && isdigit (str[2]))
+ if (len > 3 && str[0] == '_' && str[1] == '_' && c_isdigit (str[2]))
{
str += 3;
- while (isdigit (str[0]))
+ while (c_isdigit (str[0]))
str += 1;
}
@@ -5761,7 +5821,7 @@ is_name_suffix (const char *str)
if (str[0] == '.' || str[0] == '$')
{
matching = str + 1;
- while (isdigit (matching[0]))
+ while (c_isdigit (matching[0]))
matching += 1;
if (matching[0] == '\0')
return 1;
@@ -5772,7 +5832,7 @@ is_name_suffix (const char *str)
if (len > 3 && str[0] == '_' && str[1] == '_' && str[2] == '_')
{
matching = str + 3;
- while (isdigit (matching[0]))
+ while (c_isdigit (matching[0]))
matching += 1;
if (matching[0] == '\0')
return 1;
@@ -5801,10 +5861,10 @@ is_name_suffix (const char *str)
#endif
/* _E[0-9]+[bs]$ */
- if (len > 3 && str[0] == '_' && str [1] == 'E' && isdigit (str[2]))
+ if (len > 3 && str[0] == '_' && str [1] == 'E' && c_isdigit (str[2]))
{
matching = str + 3;
- while (isdigit (matching[0]))
+ while (c_isdigit (matching[0]))
matching += 1;
if ((matching[0] == 'b' || matching[0] == 's')
&& matching [1] == '\0')
@@ -5854,17 +5914,17 @@ is_name_suffix (const char *str)
return 1;
return 0;
}
- if (!isdigit (str[2]))
+ if (!c_isdigit (str[2]))
return 0;
for (k = 3; str[k] != '\0'; k += 1)
- if (!isdigit (str[k]) && str[k] != '_')
+ if (!c_isdigit (str[k]) && str[k] != '_')
return 0;
return 1;
}
- if (str[0] == '$' && isdigit (str[1]))
+ if (str[0] == '$' && c_isdigit (str[1]))
{
for (k = 2; str[k] != '\0'; k += 1)
- if (!isdigit (str[k]) && str[k] != '_')
+ if (!c_isdigit (str[k]) && str[k] != '_')
return 0;
return 1;
}
@@ -5887,7 +5947,7 @@ is_valid_name_for_wild_match (const char *name0)
return 0;
for (i=0; decoded_name[i] != '\0'; i++)
- if (isalpha (decoded_name[i]) && !islower (decoded_name[i]))
+ if (c_isalpha (decoded_name[i]) && !c_islower (decoded_name[i]))
return 0;
return 1;
@@ -5998,7 +6058,7 @@ ada_add_block_symbols (std::vector<struct block_symbol> &result,
{
if (sym->matches (domain))
{
- if (sym->aclass () != LOC_UNRESOLVED)
+ if (sym->loc_class () != LOC_UNRESOLVED)
{
if (sym->is_argument ())
arg_sym = sym;
@@ -6047,7 +6107,7 @@ ada_add_block_symbols (std::vector<struct block_symbol> &result,
if (cmp == 0
&& is_name_suffix (sym->linkage_name () + name_len + 5))
{
- if (sym->aclass () != LOC_UNRESOLVED)
+ if (sym->loc_class () != LOC_UNRESOLVED)
{
if (sym->is_argument ())
arg_sym = sym;
@@ -6111,7 +6171,7 @@ ada_lookup_name_info::matches
angle bracket notation. */
const char *tmp;
- for (tmp = sym_name; *tmp != '\0' && !isupper (*tmp); tmp++);
+ for (tmp = sym_name; *tmp != '\0' && !c_isupper (*tmp); tmp++);
if (*tmp != '\0')
match = false;
}
@@ -6201,10 +6261,12 @@ ada_is_ignored_field (struct type *type, int field_num)
{
const char *name = type->field (field_num).name ();
- /* Anonymous field names should not be printed.
- brobecker/2007-02-20: I don't think this can actually happen
- but we don't want to print the value of anonymous fields anyway. */
- if (name == NULL)
+ /* Anonymous field names should not be printed. */
+ if (name == nullptr || name[0] == '\0')
+ return 1;
+
+ /* Skip artificial fields. */
+ if (type->field (field_num).is_artificial ())
return 1;
/* Normally, fields whose name start with an underscore ("_")
@@ -6226,7 +6288,7 @@ ada_is_ignored_field (struct type *type, int field_num)
{
/* Wrapper field. */
}
- else if (isupper (name[0]))
+ else if (c_isupper (name[0]))
return 1;
}
@@ -6450,7 +6512,7 @@ ada_get_tsd_type (struct inferior *inf)
if (data->tsd_type == 0)
data->tsd_type
- = lookup_transparent_type ("<ada__tags__type_specific_data>",
+ = lookup_transparent_type ("ada.tags.type_specific_data",
SEARCH_TYPE_DOMAIN);
return data->tsd_type;
}
@@ -6737,14 +6799,14 @@ ada_scan_number (const char str[], int k, LONGEST * R, int *new_k)
{
ULONGEST RU;
- if (!isdigit (str[k]))
+ if (!c_isdigit (str[k]))
return 0;
/* Do it the hard way so as not to make any assumption about
the relationship of unsigned long (%lu scan format code) and
LONGEST. */
RU = 0;
- while (isdigit (str[k]))
+ while (c_isdigit (str[k]))
{
RU = RU * 10 + (str[k] - '0');
k += 1;
@@ -6918,7 +6980,7 @@ static int
find_struct_field (const char *name, struct type *type, int offset,
struct type **field_type_p,
int *byte_offset_p, int *bit_offset_p, int *bit_size_p,
- int *index_p)
+ LONGEST *index_p)
{
int i;
int parent_offset = -1;
@@ -7032,12 +7094,10 @@ find_struct_field (const char *name, struct type *type, int offset,
/* Number of user-visible fields in record type TYPE. */
-static int
+static LONGEST
num_visible_fields (struct type *type)
{
- int n;
-
- n = 0;
+ LONGEST n = 0;
find_struct_field (NULL, type, 0, NULL, NULL, NULL, NULL, &n);
return n;
}
@@ -7097,17 +7157,16 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
else if (ada_is_variant_part (type, i))
{
/* PNH: Do we ever get here? See find_struct_field. */
- int j;
struct type *field_type = ada_check_typedef (type->field (i).type ());
int var_offset = offset + type->field (i).loc_bitpos () / 8;
- for (j = 0; j < field_type->num_fields (); j += 1)
+ for (const auto &field : field_type->fields ())
{
- struct value *v = ada_search_struct_field /* Force line
- break. */
- (name, arg,
- var_offset + field_type->field (j).loc_bitpos () / 8,
- field_type->field (j).type ());
+ struct value *v
+ = (ada_search_struct_field
+ (name, arg,
+ var_offset + field.loc_bitpos () / 8,
+ field.type ()));
if (v != NULL)
return v;
@@ -7401,10 +7460,10 @@ field_alignment (struct type *type, int f)
len = strlen (name);
- if (!isdigit (name[len - 1]))
+ if (!c_isdigit (name[len - 1]))
return 1;
- if (isdigit (name[len - 2]))
+ if (c_isdigit (name[len - 2]))
align_offset = len - 2;
else
align_offset = len - 1;
@@ -8199,12 +8258,11 @@ ada_is_redundant_index_type_desc (struct type *array_type,
struct type *desc_type)
{
struct type *this_layer = check_typedef (array_type);
- int i;
- for (i = 0; i < desc_type->num_fields (); i++)
+ for (const auto &field : desc_type->fields ())
{
if (!ada_is_redundant_range_encoding (this_layer->index_type (),
- desc_type->field (i).type ()))
+ field.type ()))
return 0;
this_layer = check_typedef (this_layer->target_type ());
}
@@ -8801,9 +8859,9 @@ ada_atr_enum_val (struct expression *exp, enum noside noside, struct type *type,
error (_("'Enum_Val requires integral argument"));
LONGEST value = value_as_long (arg);
- for (int i = 0; i < type->num_fields (); ++i)
+ for (const auto &field : type->fields ())
{
- if (type->field (i).loc_enumval () == value)
+ if (field.loc_enumval () == value)
return value_from_longest (original_type, value);
}
@@ -8986,7 +9044,7 @@ ada_unqualify_enum_name (const char *name)
{
while ((tmp = strstr (name, "__")) != NULL)
{
- if (isdigit (tmp[2]))
+ if (c_isdigit (tmp[2]))
break;
else
name = tmp + 2;
@@ -9029,7 +9087,7 @@ ada_enum_name (const char *name)
else
return name;
- if (isascii (v) && isprint (v))
+ if (c_isascii (v) && c_isprint (v))
storage = string_printf ("'%c'", v);
else if (name[1] == 'U')
storage = string_printf ("'[\"%02x\"]'", v);
@@ -9557,12 +9615,12 @@ void
ada_name_association::assign (aggregate_assigner &assigner,
operation_up &op)
{
- int index;
+ LONGEST index;
if (ada_is_direct_array_type (assigner.lhs->type ()))
{
value *tem = m_val->evaluate (nullptr, assigner.exp, EVAL_NORMAL);
- index = longest_to_int (value_as_long (tem));
+ index = value_as_long (tem);
}
else
{
@@ -9802,7 +9860,7 @@ ada_value_cast (struct type *type, struct value *arg2)
The following description is a general guide as to what should be
done (and what should NOT be done) in order to evaluate an expression
involving such types, and when. This does not cover how the semantic
- information is encoded by GNAT as this is covered separatly. For the
+ information is encoded by GNAT as this is covered separately. For the
document used as the reference for the GNAT encoding, see exp_dbug.ads
in the GNAT sources.
@@ -10063,14 +10121,19 @@ ada_unop_neg (struct type *expect_type,
return value_neg (arg1);
}
-/* A helper function for UNOP_IN_RANGE. */
+namespace expr
+{
+
+/* Implement UNOP_IN_RANGE. */
value *
-ada_unop_in_range (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct type *type)
+ada_unop_range_operation::evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside)
{
+ value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
+ struct type *type = std::get<1> (m_storage);
+
struct value *arg2, *arg3;
switch (type->code ())
{
@@ -10097,6 +10160,8 @@ ada_unop_in_range (struct type *expect_type,
}
}
+} /* namespace expr */
+
/* A helper function for OP_ATR_TAG. */
value *
@@ -10184,14 +10249,21 @@ ada_mult_binop (struct type *expect_type,
}
}
-/* A helper function for BINOP_EQUAL and BINOP_NOTEQUAL. */
+namespace expr
+{
+
+/* Implement BINOP_EQUAL and BINOP_NOTEQUAL. */
value *
-ada_equal_binop (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+ada_binop_equal_operation::evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside)
{
+ enum exp_opcode op = std::get<0> (m_storage);
+ value *arg1 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
+ value *arg2 = std::get<2> (m_storage)->evaluate (arg1->type (),
+ exp, noside);
+
int tem;
if (noside == EVAL_AVOID_SIDE_EFFECTS)
tem = 0;
@@ -10206,14 +10278,19 @@ ada_equal_binop (struct type *expect_type,
return value_from_longest (type, tem);
}
-/* A helper function for TERNOP_SLICE. */
+/* Implement TERNOP_SLICE. */
value *
-ada_ternop_slice (struct expression *exp,
- enum noside noside,
- struct value *array, struct value *low_bound_val,
- struct value *high_bound_val)
+ada_ternop_slice_operation::evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside)
{
+ value *array = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
+ value *low_bound_val
+ = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
+ value *high_bound_val
+ = std::get<2> (m_storage)->evaluate (nullptr, exp, noside);
+
LONGEST low_bound;
LONGEST high_bound;
@@ -10274,8 +10351,7 @@ ada_ternop_slice (struct expression *exp,
to_fixed_array_type (type0->target_type (), NULL, 1);
return ada_value_slice_from_ptr (array, arr_type0,
- longest_to_int (low_bound),
- longest_to_int (high_bound));
+ low_bound, high_bound);
}
}
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
@@ -10283,16 +10359,20 @@ ada_ternop_slice (struct expression *exp,
else if (high_bound < low_bound)
return empty_array (array->type (), low_bound, high_bound);
else
- return ada_value_slice (array, longest_to_int (low_bound),
- longest_to_int (high_bound));
+ return ada_value_slice (array, low_bound, high_bound);
}
-/* A helper function for BINOP_IN_BOUNDS. */
+/* Implement BINOP_IN_BOUNDS. */
value *
-ada_binop_in_bounds (struct expression *exp, enum noside noside,
- struct value *arg1, struct value *arg2, int n)
+ada_binop_in_bounds_operation::evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside)
{
+ value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
+ value *arg2 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
+ int n = std::get<2> (m_storage);
+
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
struct type *type = language_bool_type (exp->language_defn,
@@ -10317,6 +10397,8 @@ ada_binop_in_bounds (struct expression *exp, enum noside noside,
|| value_equal (arg2, arg1)));
}
+} /* namespace expr */
+
/* A helper function for some attribute operations. */
static value *
@@ -10519,7 +10601,6 @@ static LONGEST
convert_char_literal (struct type *type, LONGEST val)
{
char name[12];
- int f;
if (type == NULL)
return val;
@@ -10536,17 +10617,17 @@ convert_char_literal (struct type *type, LONGEST val)
else
xsnprintf (name, sizeof (name), "QWW%08lx", (unsigned long) val);
size_t len = strlen (name);
- for (f = 0; f < type->num_fields (); f += 1)
+ for (const auto &field : type->fields ())
{
/* Check the suffix because an enum constant in a package will
have a name like "pkg__QUxx". This is safe enough because we
already have the correct type, and because mangling means
there can't be clashes. */
- const char *ename = type->field (f).name ();
+ const char *ename = field.name ();
size_t elen = strlen (ename);
if (elen >= len && strcmp (name, ename + elen - len) == 0)
- return type->field (f).loc_enumval ();
+ return field.loc_enumval ();
}
return val;
}
@@ -11021,7 +11102,9 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
if (arrType == NULL)
error (_("Attempt to dereference null array pointer."));
- if (is_thick_pntr (type))
+ pointer_kind kind = categorize_pointer (type);
+ if (kind == pointer_kind::P_BOUNDS
+ || kind == pointer_kind::EXTENDED_ACCESS)
return arg1;
return value_at_lazy (arrType, 0);
}
@@ -11729,9 +11812,9 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
/* Make sure that the symbol we found corresponds to a function. */
- if (sym->aclass () != LOC_BLOCK)
+ if (sym->loc_class () != LOC_BLOCK)
error (_("Symbol \"%s\" is not a function (class = %d)"),
- sym->linkage_name (), sym->aclass ());
+ sym->linkage_name (), sym->loc_class ());
sym = standard_lookup (einfo->catch_handlers_sym, NULL,
SEARCH_FUNCTION_DOMAIN);
@@ -11751,9 +11834,9 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
/* Make sure that the symbol we found corresponds to a function. */
- if (sym->aclass () != LOC_BLOCK)
+ if (sym->loc_class () != LOC_BLOCK)
error (_("Symbol \"%s\" is not a function (class = %d)"),
- sym->linkage_name (), sym->aclass ());
+ sym->linkage_name (), sym->loc_class ());
return 1;
}
@@ -11780,14 +11863,14 @@ ada_exception_support_info_sniffer (void)
return;
}
- /* Try the v0 exception suport info. */
+ /* Try the v0 exception support info. */
if (ada_has_this_exception_support (&exception_support_info_v0))
{
data->exception_info = &exception_support_info_v0;
return;
}
- /* Try our fallback exception suport info. */
+ /* Try our fallback exception support info. */
if (ada_has_this_exception_support (&exception_support_info_fallback))
{
data->exception_info = &exception_support_info_fallback;
@@ -12553,7 +12636,7 @@ catch_ada_exception_command_split (const char *args,
args = skip_spaces (args);
if (startswith (args, "if")
- && (isspace (args[2]) || args[2] == '\0'))
+ && (c_isspace (args[2]) || args[2] == '\0'))
{
args += 2;
args = skip_spaces (args);
@@ -12708,7 +12791,7 @@ ada_exception_sal (enum ada_exception_catchpoint_kind ex)
throw_error (NOT_FOUND_ERROR, _("Catchpoint symbol not found: %s"),
sym_name);
- if (sym->aclass () != LOC_BLOCK)
+ if (sym->loc_class () != LOC_BLOCK)
error (_("Unable to insert catchpoint. %s is not a function."), sym_name);
return find_function_start_sal (sym, 1);
@@ -12830,7 +12913,7 @@ catch_ada_assert_command_split (const char *args, std::string &cond_string)
/* Check whether a condition was provided. */
if (startswith (args, "if")
- && (isspace (args[2]) || args[2] == '\0'))
+ && (c_isspace (args[2]) || args[2] == '\0'))
{
args += 2;
args = skip_spaces (args);
@@ -12874,10 +12957,10 @@ ada_is_exception_sym (struct symbol *sym)
{
const char *type_name = sym->type ()->name ();
- return (sym->aclass () != LOC_TYPEDEF
- && sym->aclass () != LOC_BLOCK
- && sym->aclass () != LOC_CONST
- && sym->aclass () != LOC_UNRESOLVED
+ return (sym->loc_class () != LOC_TYPEDEF
+ && sym->loc_class () != LOC_BLOCK
+ && sym->loc_class () != LOC_CONST
+ && sym->loc_class () != LOC_UNRESOLVED
&& type_name != NULL && strcmp (type_name, "exception") == 0);
}
@@ -12970,16 +13053,16 @@ ada_add_standard_exceptions (compiled_regex *preg,
/* Iterate over all objfiles irrespective of scope or linker
namespaces so we get all exceptions anywhere in the
progspace. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
if (match_name (msymbol->linkage_name (), lookup_name,
nullptr)
&& msymbol->type () != mst_solib_trampoline)
{
ada_exc_info info
- = {name, msymbol->value_address (objfile)};
+ = {name, msymbol->value_address (&objfile)};
exceptions->push_back (info);
}
@@ -13010,7 +13093,7 @@ ada_add_exceptions_from_frame (compiled_regex *preg,
{
for (struct symbol *sym : block_iterator_range (block))
{
- switch (sym->aclass ())
+ switch (sym->loc_class ())
{
case LOC_TYPEDEF:
case LOC_BLOCK:
@@ -13061,31 +13144,11 @@ ada_add_global_exceptions (compiled_regex *preg,
return preg == nullptr || preg->exec (name, 0, NULL, 0) == 0;
};
-
- /* In Ada, the symbol "search name" is a linkage name, whereas the
- regular expression used to do the matching refers to the natural
- name. So match against the decoded name. */
- expand_symtabs_matching (NULL,
- lookup_name_info::match_any (),
- [&] (const char *search_name)
- {
- std::string decoded = ada_decode (search_name);
- return name_matches_regex (decoded.c_str ());
- },
- NULL,
- SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
- SEARCH_VAR_DOMAIN,
- [&] (enum language lang)
- {
- /* Try to skip non-Ada CUs. */
- return lang == language_ada;
- });
-
/* Iterate over all objfiles irrespective of scope or linker namespaces
so we get all exceptions anywhere in the progspace. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *s : objfile->compunits ())
+ auto callback = [&] (compunit_symtab *s)
{
const struct blockvector *bv = s->blockvector ();
int i;
@@ -13104,7 +13167,30 @@ ada_add_global_exceptions (compiled_regex *preg,
exceptions->push_back (info);
}
}
- }
+
+ return true;
+ };
+
+ /* In Ada, the symbol "search name" is a linkage name, whereas
+ the regular expression used to do the matching refers to the
+ natural name. So match against the decoded name. */
+ auto any = lookup_name_info::match_any ();
+ objfile.search
+ (nullptr,
+ &any,
+ [&] (const char *search_name)
+ {
+ std::string decoded = ada_decode (search_name);
+ return name_matches_regex (decoded.c_str ());
+ },
+ callback,
+ SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
+ SEARCH_VAR_DOMAIN,
+ [&] (enum language lang)
+ {
+ /* Try to skip non-Ada CUs. */
+ return lang == language_ada;
+ });
}
}
@@ -13234,7 +13320,7 @@ do_full_match (const char *symbol_search_name,
&& symbol_search_name[1] == '_')
{
symbol_search_name += 2;
- while (isdigit (*symbol_search_name))
+ while (c_isdigit (*symbol_search_name))
++symbol_search_name;
if (symbol_search_name[0] == '_'
&& symbol_search_name[1] == '_')
@@ -13311,7 +13397,7 @@ ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name)
else
m_standard_p = false;
- m_decoded_name = ada_decode (m_encoded_name.c_str (), true, false, false);
+ m_decoded_name = ada_decode (m_encoded_name.c_str (), true, false);
/* If the name contains a ".", then the user is entering a fully
qualified entity name, and the match must not be done in wild
@@ -13612,28 +13698,20 @@ public:
const char *text, const char *word,
enum type_code code) const override
{
- const struct block *b, *surrounding_static_block = 0;
+ const struct block *surrounding_static_block = 0;
gdb_assert (code == TYPE_CODE_UNDEF);
lookup_name_info lookup_name (text, name_match_type, true);
- /* First, look at the partial symtab symbols. */
- expand_symtabs_matching (NULL,
- lookup_name,
- NULL,
- NULL,
- SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
- SEARCH_ALL_DOMAINS);
-
/* At this point scan through the misc symbol vectors and add each
symbol you find to the list. Eventually we want to ignore
anything that isn't a text symbol (everything else will be
handled by the psymtab code above). */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
QUIT;
@@ -13667,7 +13745,9 @@ public:
/* Search upwards from currently selected frame (so that we can
complete on local vars. */
- for (b = get_selected_block (0); b != NULL; b = b->superblock ())
+ for (const block *b = get_selected_block (0);
+ b != nullptr;
+ b = b->superblock ())
{
if (b->is_static_block ())
surrounding_static_block = b; /* For elmin of dups */
@@ -13687,45 +13767,38 @@ public:
/* Go through the symtabs and check the externs and statics for
symbols which match. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *s : objfile->compunits ())
+ auto callback = [&] (compunit_symtab *s)
{
QUIT;
- b = s->blockvector ()->global_block ();
- for (struct symbol *sym : block_iterator_range (b))
+ for (const block *b = s->blockvector ()->static_block ();
+ b != nullptr;
+ b = b->superblock ())
{
- if (completion_skip_symbol (mode, sym))
- continue;
+ /* Don't do this block twice. */
+ if (b == surrounding_static_block)
+ break;
- completion_list_add_name (tracker,
- sym->language (),
- sym->linkage_name (),
- lookup_name, text, word);
+ for (struct symbol *sym : block_iterator_range (b))
+ {
+ if (completion_skip_symbol (mode, sym))
+ continue;
+
+ completion_list_add_name (tracker,
+ sym->language (),
+ sym->linkage_name (),
+ lookup_name, text, word);
+ }
}
- }
- }
- for (objfile *objfile : current_program_space->objfiles ())
- {
- for (compunit_symtab *s : objfile->compunits ())
- {
- QUIT;
- b = s->blockvector ()->static_block ();
- /* Don't do this block twice. */
- if (b == surrounding_static_block)
- continue;
- for (struct symbol *sym : block_iterator_range (b))
- {
- if (completion_skip_symbol (mode, sym))
- continue;
+ return true;
+ };
- completion_list_add_name (tracker,
- sym->language (),
- sym->linkage_name (),
- lookup_name, text, word);
- }
- }
+ objfile.search
+ (nullptr, &lookup_name, nullptr, callback,
+ SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
+ SEARCH_ALL_DOMAINS);
}
}
@@ -13945,9 +14018,7 @@ static const char * const gnat_source_charsets[] =
nullptr
};
-void _initialize_ada_language ();
-void
-_initialize_ada_language ()
+INIT_GDB_FILE (ada_language)
{
add_setshow_prefix_cmd
("ada", no_class,
@@ -14049,10 +14120,6 @@ When enabled, the debugger will stop using the DW_AT_GNAT_descriptive_type\n\
DWARF attribute."),
NULL, NULL, &maint_set_ada_cmdlist, &maint_show_ada_cmdlist);
- decoded_names_store = htab_create_alloc (256, htab_hash_string,
- htab_eq_string,
- NULL, xcalloc, xfree);
-
/* The ada-lang observers. */
gdb::observers::new_objfile.attach (ada_new_objfile_observer, "ada-lang");
gdb::observers::all_objfiles_removed.attach (ada_clear_symbol_cache,
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 3582082..5e08c3b 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -1,6 +1,6 @@
/* Ada language support definitions for GDB, the GNU debugger.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -218,16 +218,13 @@ extern const char *ada_decode_symbol (const struct general_symbol_info *);
simply wrapped in <...>. If WRAP is false, then the empty string
will be returned.
- When OPERATORS is false, operator names will not be decoded. By
- default, they are decoded, e.g., 'Oadd' will be transformed to
- '"+"'.
-
- When WIDE is false, wide characters will be left as-is. By
- default, they converted from their hex encoding to the host
- charset. */
+ TRANSLATE has two effects. When true (the default), operator names
+ and wide characters will be decoded. E.g., 'Oadd' will be
+ transformed to '"+"', and wide characters converted from their hex
+ encoding to the host charset. When false, these will be left
+ alone. */
extern std::string ada_decode (const char *name, bool wrap = true,
- bool operators = true,
- bool wide = true);
+ bool translate = true);
extern std::vector<struct block_symbol> ada_lookup_symbol_list
(const char *, const struct block *, domain_search_flags);
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index 8291595..eec80cf 100644
--- a/gdb/ada-lex.l
+++ b/gdb/ada-lex.l
@@ -1,5 +1,5 @@
/* FLEX lexer for Ada expressions, for GDB. -*- c++ -*-
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -335,7 +335,6 @@ false { return FALSEKEYWORD; }
. { error (_("Invalid character '%s' in expression."), yytext); }
%%
-#include <ctype.h>
/* Initialize the lexer for processing new expression. */
static void
@@ -355,7 +354,7 @@ canonicalizeNumeral (char *s1, const char *s2)
{
if (*s2 != '_')
{
- *s1 = tolower(*s2);
+ *s1 = c_tolower(*s2);
s1 += 1;
}
}
@@ -411,7 +410,7 @@ processInt (struct parser_state *par_state, const char *base0,
exp = strtol(exp0, (char **) NULL, 10);
gdb_mpz result;
- while (isxdigit (*num0))
+ while (c_isxdigit (*num0))
{
int dig = fromhex (*num0);
if (dig >= base)
@@ -527,7 +526,7 @@ processId (const char *name0, int len)
struct stoken result;
result.ptr = name;
- while (len > 0 && isspace (name0[len-1]))
+ while (len > 0 && c_isspace (name0[len-1]))
len -= 1;
if (name0[0] == '<' || strstr (name0, "___") != NULL)
@@ -549,12 +548,12 @@ processId (const char *name0, int len)
}
else if (in_quotes)
name[i++] = name0[i0++];
- else if (isalnum (name0[i0]))
+ else if (c_isalnum (name0[i0]))
{
- name[i] = tolower (name0[i0]);
+ name[i] = c_tolower (name0[i0]);
i += 1; i0 += 1;
}
- else if (isspace (name0[i0]))
+ else if (c_isspace (name0[i0]))
i0 += 1;
else if (name0[i0] == '\'')
{
@@ -634,10 +633,10 @@ find_dot_all (const char *str)
do
i += 1;
- while (isspace (str[i]));
+ while (c_isspace (str[i]));
if (strncasecmp (str + i, "all", 3) == 0
- && !isalnum (str[i + 3]) && str[i + 3] != '_')
+ && !c_isalnum (str[i + 3]) && str[i + 3] != '_')
return i0;
}
return -1;
@@ -653,7 +652,7 @@ subseqMatch (const char *subseq, const char *str)
return 1;
else if (str[0] == '\0')
return 0;
- else if (tolower (subseq[0]) == tolower (str[0]))
+ else if (c_tolower (subseq[0]) == c_tolower (str[0]))
return subseqMatch (subseq+1, str+1) || subseqMatch (subseq, str+1);
else
return subseqMatch (subseq, str+1);
@@ -690,7 +689,7 @@ processAttribute (const char *str)
{
gdb_assert (*str == '\'');
++str;
- while (isspace (*str))
+ while (c_isspace (*str))
++str;
int len = strlen (str);
@@ -749,7 +748,7 @@ static void
rewind_to_char (int ch)
{
pstate->lexptr -= yyleng;
- while (toupper (*pstate->lexptr) != toupper (ch))
+ while (c_toupper (*pstate->lexptr) != c_toupper (ch))
pstate->lexptr -= 1;
yyrestart (NULL);
}
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 5f4eceb..f9551d4 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1650,9 +1650,7 @@ task_apply_command (const char *tidlist, int from_tty)
from_tty, flags);
}
-void _initialize_tasks ();
-void
-_initialize_tasks ()
+INIT_GDB_FILE (tasks)
{
/* Attach various observers. */
gdb::observers::normal_stop.attach (ada_tasks_normal_stop_observer,
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index ef466a1..5829a9b 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -1,5 +1,5 @@
/* Support for printing Ada types for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -23,7 +23,6 @@
#include "cli/cli-style.h"
#include "typeprint.h"
#include "ada-lang.h"
-#include <ctype.h>
static int print_selected_record_field_types (struct type *, struct type *,
int, int,
@@ -70,7 +69,7 @@ decoded_type_name (struct type *type)
if (s == name_buffer)
return name_buffer;
- if (!islower (s[1]))
+ if (!c_islower (s[1]))
return NULL;
for (s = q = name_buffer; *s != '\0'; q += 1)
@@ -702,7 +701,7 @@ print_variant_part (const variant_part &part,
name = "?";
else
{
- name = type->field (part.discriminant_index).name ();;
+ name = type->field (part.discriminant_index).name ();
discr_type = type->field (part.discriminant_index).type ();
}
diff --git a/gdb/ada-unicode.py b/gdb/ada-unicode.py
index f128dee..c269b4d 100755
--- a/gdb/ada-unicode.py
+++ b/gdb/ada-unicode.py
@@ -2,7 +2,7 @@
# Generate Unicode case-folding table for Ada.
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This file is part of GDB.
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 937bd39..c198fa5 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -1,6 +1,6 @@
/* Support for printing Ada values for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include <ctype.h>
#include "event-top.h"
#include "extract-store-integer.h"
#include "gdbtypes.h"
@@ -265,10 +264,10 @@ ada_emit_char (int c, struct type *type, struct ui_file *stream,
/* If this character fits in the normal ASCII range, and is
a printable character, then print the character as if it was
an ASCII character, even if this is a wide character.
- The UCHAR_MAX check is necessary because the isascii function
+ The UCHAR_MAX check is necessary because the c_isascii function
requires that its argument have a value of an unsigned char,
or EOF (EOF is obviously not printable). */
- if (c <= UCHAR_MAX && isascii (c) && isprint (c))
+ if (c <= UCHAR_MAX && c_isascii (c) && c_isprint (c))
{
if (c == quoter && c == '"')
gdb_printf (stream, "\"\"");
diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c
index 21412db..c87e7be 100644
--- a/gdb/ada-varobj.c
+++ b/gdb/ada-varobj.c
@@ -1,6 +1,6 @@
/* varobj support for Ada.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -379,16 +379,14 @@ ada_varobj_get_number_of_children (struct value *parent_value,
whose index is CHILD_INDEX:
- If CHILD_NAME is not NULL, then a copy of the child's name
- is saved in *CHILD_NAME. This copy must be deallocated
- with xfree after use.
+ is saved in *CHILD_NAME.
- If CHILD_VALUE is not NULL, then save the child's value
in *CHILD_VALUE. Same thing for the child's type with
CHILD_TYPE if not NULL.
- If CHILD_PATH_EXPR is not NULL, then compute the child's
- path expression. The resulting string must be deallocated
- after use with xfree.
+ path expression.
Computing the child's path expression requires the PARENT_PATH_EXPR
to be non-NULL. Otherwise, PARENT_PATH_EXPR may be null if
@@ -612,7 +610,7 @@ ada_varobj_describe_simple_array_child (struct value *parent_value,
{
std::string index_img = ada_varobj_scalar_image (index_type, real_index);
- /* Enumeration litterals by themselves are potentially ambiguous.
+ /* Enumeration literals by themselves are potentially ambiguous.
For instance, consider the following package spec:
package Pck is
@@ -620,10 +618,10 @@ ada_varobj_describe_simple_array_child (struct value *parent_value,
type Blood_Cells is (White, Red);
end Pck;
- In this case, the litteral "red" for instance, or even
- the fully-qualified litteral "pck.red" cannot be resolved
+ In this case, the literal "red" for instance, or even
+ the fully-qualified literal "pck.red" cannot be resolved
by itself. Type qualification is needed to determine which
- enumeration litterals should be used.
+ enumeration literals should be used.
The following variable will be used to contain the name
of the array index type when such type qualification is
@@ -805,9 +803,7 @@ ada_varobj_get_type_of_child (struct value *parent_value,
}
/* Return a string that contains the image of the given VALUE, using
- the print options OPTS as the options for formatting the result.
-
- The resulting string must be deallocated after use with xfree. */
+ the print options OPTS as the options for formatting the result. */
static std::string
ada_varobj_get_value_image (struct value *value,
@@ -825,9 +821,7 @@ ada_varobj_get_value_image (struct value *value,
in the array inside square brackets, but there are situations where
it's useful to add more info.
- OPTS are the print options used when formatting the result.
-
- The result should be deallocated after use using xfree. */
+ OPTS are the print options used when formatting the result. */
static std::string
ada_varobj_get_value_of_array_variable (struct value *value,
diff --git a/gdb/addrmap.c b/gdb/addrmap.c
index 1fc95f3..2b333a1 100644
--- a/gdb/addrmap.c
+++ b/gdb/addrmap.c
@@ -1,6 +1,6 @@
/* addrmap.c --- implementation of address map data structure.
- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+ Copyright (C) 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -201,10 +201,11 @@ xfree_wrapper (splay_tree_key key)
xfree ((void *) key);
}
-void
+bool
addrmap_mutable::set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
void *obj)
{
+ bool full_range = true;
splay_tree_node n, next;
void *prior_value;
@@ -234,7 +235,12 @@ addrmap_mutable::set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
n && addrmap_node_key (n) <= end_inclusive;
n = splay_tree_successor (addrmap_node_key (n)))
{
- if (! addrmap_node_value (n))
+ if (addrmap_node_value (n))
+ {
+ /* Already mapped. */
+ full_range = false;
+ }
+ else
addrmap_node_set_value (n, obj);
}
@@ -254,6 +260,8 @@ addrmap_mutable::set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
else
prior_value = addrmap_node_value (n);
}
+
+ return full_range;
}
@@ -398,20 +406,20 @@ namespace selftests {
/* Convert P to CORE_ADDR. */
static CORE_ADDR
-core_addr (void *p)
+core_addr (const void *p)
{
- return (CORE_ADDR)(uintptr_t)p;
+ return (CORE_ADDR) (uintptr_t) p;
}
/* Check that &ARRAY[LOW]..&ARRAY[HIGH] has VAL in MAP. */
-#define CHECK_ADDRMAP_FIND(MAP, ARRAY, LOW, HIGH, VAL) \
- do \
- { \
- for (unsigned i = LOW; i <= HIGH; ++i) \
- SELF_CHECK (MAP->find (core_addr (&ARRAY[i])) == VAL); \
- } \
- while (0)
+static void
+check_addrmap_find (const addrmap &map, const char *array, unsigned int low,
+ unsigned int high, const void *val)
+{
+ for (unsigned int i = low; i <= high; ++i)
+ SELF_CHECK (map.find (core_addr (&array[i])) == val);
+}
/* Entry point for addrmap unit tests. */
@@ -427,25 +435,26 @@ test_addrmap ()
/* Create mutable addrmap. */
auto_obstack temp_obstack;
- auto map = std::make_unique<struct addrmap_mutable> ();
- SELF_CHECK (map != nullptr);
+ addrmap_mutable map;
/* Check initial state. */
- CHECK_ADDRMAP_FIND (map, array, 0, 19, nullptr);
+ check_addrmap_find (map, array, 0, 19, nullptr);
/* Insert address range into mutable addrmap. */
- map->set_empty (core_addr (&array[10]), core_addr (&array[12]), val1);
- CHECK_ADDRMAP_FIND (map, array, 0, 9, nullptr);
- CHECK_ADDRMAP_FIND (map, array, 10, 12, val1);
- CHECK_ADDRMAP_FIND (map, array, 13, 19, nullptr);
+ bool full_range_p
+ = map.set_empty (core_addr (&array[10]), core_addr (&array[12]), val1);
+ SELF_CHECK (full_range_p);
+ check_addrmap_find (map, array, 0, 9, nullptr);
+ check_addrmap_find (map, array, 10, 12, val1);
+ check_addrmap_find (map, array, 13, 19, nullptr);
/* Create corresponding fixed addrmap. */
addrmap_fixed *map2
- = new (&temp_obstack) addrmap_fixed (&temp_obstack, map.get ());
+ = new (&temp_obstack) addrmap_fixed (&temp_obstack, &map);
SELF_CHECK (map2 != nullptr);
- CHECK_ADDRMAP_FIND (map2, array, 0, 9, nullptr);
- CHECK_ADDRMAP_FIND (map2, array, 10, 12, val1);
- CHECK_ADDRMAP_FIND (map2, array, 13, 19, nullptr);
+ check_addrmap_find (*map2, array, 0, 9, nullptr);
+ check_addrmap_find (*map2, array, 10, 12, val1);
+ check_addrmap_find (*map2, array, 13, 19, nullptr);
/* Iterate over both addrmaps. */
auto callback = [&] (CORE_ADDR start_addr, void *obj)
@@ -460,29 +469,29 @@ test_addrmap ()
SELF_CHECK (false);
return 0;
};
- SELF_CHECK (map->foreach (callback) == 0);
+ SELF_CHECK (map.foreach (callback) == 0);
SELF_CHECK (map2->foreach (callback) == 0);
/* Relocate fixed addrmap. */
map2->relocate (1);
- CHECK_ADDRMAP_FIND (map2, array, 0, 10, nullptr);
- CHECK_ADDRMAP_FIND (map2, array, 11, 13, val1);
- CHECK_ADDRMAP_FIND (map2, array, 14, 19, nullptr);
+ check_addrmap_find (*map2, array, 0, 10, nullptr);
+ check_addrmap_find (*map2, array, 11, 13, val1);
+ check_addrmap_find (*map2, array, 14, 19, nullptr);
/* Insert partially overlapping address range into mutable addrmap. */
- map->set_empty (core_addr (&array[11]), core_addr (&array[13]), val2);
- CHECK_ADDRMAP_FIND (map, array, 0, 9, nullptr);
- CHECK_ADDRMAP_FIND (map, array, 10, 12, val1);
- CHECK_ADDRMAP_FIND (map, array, 13, 13, val2);
- CHECK_ADDRMAP_FIND (map, array, 14, 19, nullptr);
+ full_range_p
+ = map.set_empty (core_addr (&array[11]), core_addr (&array[13]), val2);
+ SELF_CHECK (!full_range_p);
+ check_addrmap_find (map, array, 0, 9, nullptr);
+ check_addrmap_find (map, array, 10, 12, val1);
+ check_addrmap_find (map, array, 13, 13, val2);
+ check_addrmap_find (map, array, 14, 19, nullptr);
}
} /* namespace selftests */
#endif /* GDB_SELF_TEST */
-void _initialize_addrmap ();
-void
-_initialize_addrmap ()
+INIT_GDB_FILE (addrmap)
{
#if GDB_SELF_TEST
selftests::register_test ("addrmap", selftests::test_addrmap);
diff --git a/gdb/addrmap.h b/gdb/addrmap.h
index a2feb68..398bdd8 100644
--- a/gdb/addrmap.h
+++ b/gdb/addrmap.h
@@ -1,6 +1,6 @@
/* addrmap.h --- interface to address map data structure.
- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+ Copyright (C) 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -152,7 +152,7 @@ public:
/* In the mutable address map MAP, associate the addresses from START
to END_INCLUSIVE that are currently associated with NULL with OBJ
instead. Addresses mapped to an object other than NULL are left
- unchanged.
+ unchanged. Return true if the full range is mapped to OBJ.
As the name suggests, END_INCLUSIVE is also mapped to OBJ. This
convention is unusual, but it allows callers to accurately specify
@@ -186,7 +186,7 @@ public:
semantics than to provide an interface which allows it to be
implemented efficiently, but doesn't reveal too much of the
representation. */
- void set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
+ bool set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
void *obj);
/* Clear this addrmap. */
diff --git a/gdb/agent.c b/gdb/agent.c
index 7a2a8e5..c01f532 100644
--- a/gdb/agent.c
+++ b/gdb/agent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -52,8 +52,8 @@ set_can_use_agent (const char *args, int from_tty, struct cmd_list_element *c)
{
/* Since the setting was off, we may not have observed the objfiles and
therefore not looked up the required symbols. Do so now. */
- for (objfile *objfile : current_program_space->objfiles ())
- if (agent_look_up_symbols (objfile) == 0)
+ for (objfile &objfile : current_program_space->objfiles ())
+ if (agent_look_up_symbols (&objfile) == 0)
break;
}
if (target_use_agent (can_use) == 0)
@@ -73,9 +73,7 @@ agent_new_objfile (struct objfile *objfile)
agent_look_up_symbols (objfile);
}
-void _initialize_agent ();
-void
-_initialize_agent ()
+INIT_GDB_FILE (agent)
{
gdb::observers::new_objfile.attach (agent_new_objfile,
"agent");
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index f38d19d..7007f76 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -1,6 +1,6 @@
/* Low level interface for debugging AIX 4.3+ pthreads.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
Written by Nick Duffek <nsd@redhat.com>.
This file is part of GDB.
@@ -854,14 +854,14 @@ sync_threadlists (pid_t pid)
thread exits and gets into a PST_UNKNOWN state. So this thread
will not run in the above for loop. Therefore the below for loop
is to manually delete such threads. */
- for (struct thread_info *it : all_threads_safe ())
+ for (thread_info &it : all_threads_safe ())
{
- aix_thread_info *priv = get_aix_thread_info (it);
+ aix_thread_info *priv = get_aix_thread_info (&it);
if (in_queue_threads.count (priv->pdtid) == 0
- && in_thread_list (proc_target, it->ptid)
- && pid == it->ptid.pid ())
+ && in_thread_list (proc_target, it.ptid)
+ && pid == it.ptid.pid ())
{
- delete_thread (it);
+ delete_thread (&it);
data->exited_threads.insert (priv->pdtid);
}
}
@@ -2062,9 +2062,7 @@ aix_thread_target::get_ada_task_ptid (long lwp, ULONGEST thread)
/* Module startup initialization function, automagically called by
init.c. */
-void _initialize_aix_thread ();
-void
-_initialize_aix_thread ()
+INIT_GDB_FILE (aix_thread)
{
/* Notice when object files get loaded and unloaded. */
gdb::observers::new_objfile.attach (new_objfile, "aix-thread");
diff --git a/gdb/alloc.c b/gdb/alloc.c
index d07c81f..667ecad 100644
--- a/gdb/alloc.c
+++ b/gdb/alloc.c
@@ -1,6 +1,6 @@
/* Shared allocation functions for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/alpha-bsd-nat.c b/gdb/alpha-bsd-nat.c
index 11e1639..5f7d3ef 100644
--- a/gdb/alpha-bsd-nat.c
+++ b/gdb/alpha-bsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for Alpha BSD's.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -156,9 +156,7 @@ alphabsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
}
-void _initialize_alphabsd_nat ();
-void
-_initialize_alphabsd_nat ()
+INIT_GDB_FILE (alphabsd_nat)
{
add_inf_child_target (&the_alpha_bsd_nat_target);
diff --git a/gdb/alpha-bsd-tdep.c b/gdb/alpha-bsd-tdep.c
index 21e39cc..b74b738 100644
--- a/gdb/alpha-bsd-tdep.c
+++ b/gdb/alpha-bsd-tdep.c
@@ -1,6 +1,6 @@
/* Common target dependent code Alpha BSD's.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/alpha-bsd-tdep.h b/gdb/alpha-bsd-tdep.h
index 4783854..7f85c78 100644
--- a/gdb/alpha-bsd-tdep.h
+++ b/gdb/alpha-bsd-tdep.h
@@ -1,6 +1,6 @@
/* Common target dependent code for Alpha BSD's.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/alpha-linux-nat.c b/gdb/alpha-linux-nat.c
index 83d6bc4..1297a45 100644
--- a/gdb/alpha-linux-nat.c
+++ b/gdb/alpha-linux-nat.c
@@ -1,5 +1,5 @@
/* Low level Alpha GNU/Linux interface, for GDB when running native.
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -100,9 +100,7 @@ alpha_linux_nat_target::register_u_offset (struct gdbarch *gdbarch,
return FPR_BASE + regno - gdbarch_fp0_regnum (gdbarch);
}
-void _initialize_alpha_linux_nat ();
-void
-_initialize_alpha_linux_nat ()
+INIT_GDB_FILE (alpha_linux_nat)
{
linux_target = &the_alpha_linux_nat_target;
add_inf_child_target (&the_alpha_linux_nat_target);
diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c
index 9a40e0c..8b4b4f1 100644
--- a/gdb/alpha-linux-tdep.c
+++ b/gdb/alpha-linux-tdep.c
@@ -1,5 +1,5 @@
/* Target-dependent code for GNU/Linux on Alpha.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,6 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "frame.h"
+#include "solib-svr4-linux.h"
#include "osabi.h"
#include "solib-svr4.h"
#include "symtab.h"
@@ -369,9 +370,7 @@ alpha_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->jb_elt_size = 8;
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
-
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_lp64_svr4_solib_ops);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
@@ -386,9 +385,7 @@ alpha_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
alpha_linux_gdb_signal_to_target);
}
-void _initialize_alpha_linux_tdep ();
-void
-_initialize_alpha_linux_tdep ()
+INIT_GDB_FILE (alpha_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_LINUX,
alpha_linux_init_abi);
diff --git a/gdb/alpha-mdebug-tdep.c b/gdb/alpha-mdebug-tdep.c
index b43849c..b22641e 100644
--- a/gdb/alpha-mdebug-tdep.c
+++ b/gdb/alpha-mdebug-tdep.c
@@ -1,5 +1,5 @@
/* Target-dependent mdebug code for the ALPHA architecture.
- Copyright (C) 1993-2024 Free Software Foundation, Inc.
+ Copyright (C) 1993-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/alpha-netbsd-tdep.c b/gdb/alpha-netbsd-tdep.c
index f3cd62b..56143ee 100644
--- a/gdb/alpha-netbsd-tdep.c
+++ b/gdb/alpha-netbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for NetBSD/alpha.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Wasabi Systems, Inc.
@@ -261,11 +261,10 @@ alphanbsd_init_abi (struct gdbarch_info info,
/* NetBSD/alpha does not provide single step support via ptrace(2); we
must use software single-stepping. */
- set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, alpha_software_single_step);
/* NetBSD/alpha has SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_lp64_solib_ops);
tdep->dynamic_sigtramp_offset = alphanbsd_sigtramp_offset;
tdep->pc_in_sigtramp = alphanbsd_pc_in_sigtramp;
@@ -279,9 +278,7 @@ alphanbsd_init_abi (struct gdbarch_info info,
}
-void _initialize_alphanbsd_tdep ();
-void
-_initialize_alphanbsd_tdep ()
+INIT_GDB_FILE (alphanbsd_tdep)
{
/* Even though NetBSD/alpha used ELF since day one, it used the
traditional a.out-style core dump format before NetBSD 1.6, but
diff --git a/gdb/alpha-obsd-tdep.c b/gdb/alpha-obsd-tdep.c
index 8602e21..a84dfa8 100644
--- a/gdb/alpha-obsd-tdep.c
+++ b/gdb/alpha-obsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for OpenBSD/alpha.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -106,11 +106,10 @@ alphaobsd_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
/* OpenBSD/alpha 3.0 and earlier does not provide single step
support via ptrace(2); use software single-stepping for now. */
- set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, alpha_software_single_step);
/* OpenBSD/alpha has SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_lp64_solib_ops);
set_gdbarch_skip_solib_resolver (gdbarch, obsd_skip_solib_resolver);
tdep->dynamic_sigtramp_offset = alphaobsd_sigtramp_offset;
@@ -125,9 +124,7 @@ alphaobsd_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
}
-void _initialize_alphaobsd_tdep ();
-void
-_initialize_alphaobsd_tdep ()
+INIT_GDB_FILE (alphaobsd_tdep)
{
gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_OPENBSD,
alphaobsd_init_abi);
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 7201b72..59e0162 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger.
- Copyright (C) 1993-2024 Free Software Foundation, Inc.
+ Copyright (C) 1993-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -43,6 +43,9 @@
#include "alpha-tdep.h"
#include <algorithm>
+#include "target-descriptions.h"
+#include "features/alpha.c"
+
/* Instruction decoding. The notations for registers, immediates and
opcodes are the same as the one used in Compaq's Alpha architecture
handbook. */
@@ -75,60 +78,38 @@ static const int subq_opcode = 0x10;
static const int subq_function = 0x29;
-/* Return the name of the REGNO register.
+/* Alpha registers using their software names.
An empty name corresponds to a register number that used to
be used for a virtual register. That virtual register has
been removed, but the index is still reserved to maintain
compatibility with existing remote alpha targets. */
-static const char *
-alpha_register_name (struct gdbarch *gdbarch, int regno)
+static const char * const alpha_register_names[] =
{
- static const char * const register_names[] =
- {
- "v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6",
- "t7", "s0", "s1", "s2", "s3", "s4", "s5", "fp",
- "a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9",
- "t10", "t11", "ra", "t12", "at", "gp", "sp", "zero",
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
- "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
- "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
- "f24", "f25", "f26", "f27", "f28", "f29", "f30", "fpcr",
- "pc", "", "unique"
- };
-
- static_assert (ALPHA_NUM_REGS == ARRAY_SIZE (register_names));
- return register_names[regno];
-}
+ "v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6",
+ "t7", "s0", "s1", "s2", "s3", "s4", "s5", "fp",
+ "a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9",
+ "t10", "t11", "ra", "t12", "at", "gp", "sp", "zero",
+ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
+ "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
+ "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
+ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "fpcr",
+ "pc", "", "unique"
+};
+static_assert (ALPHA_NUM_REGS == ARRAY_SIZE (alpha_register_names));
static int
alpha_cannot_fetch_register (struct gdbarch *gdbarch, int regno)
{
- return (strlen (alpha_register_name (gdbarch, regno)) == 0);
+ return (strlen (alpha_register_names[regno]) == 0);
}
static int
alpha_cannot_store_register (struct gdbarch *gdbarch, int regno)
{
return (regno == ALPHA_ZERO_REGNUM
- || strlen (alpha_register_name (gdbarch, regno)) == 0);
-}
-
-static struct type *
-alpha_register_type (struct gdbarch *gdbarch, int regno)
-{
- if (regno == ALPHA_SP_REGNUM || regno == ALPHA_GP_REGNUM)
- return builtin_type (gdbarch)->builtin_data_ptr;
- if (regno == ALPHA_PC_REGNUM)
- return builtin_type (gdbarch)->builtin_func_ptr;
-
- /* Don't need to worry about little vs big endian until
- some jerk tries to port to alpha-unicosmk. */
- if (regno >= ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 31)
- return builtin_type (gdbarch)->builtin_double;
-
- return builtin_type (gdbarch)->builtin_int64;
+ || strlen (alpha_register_names[regno]) == 0);
}
/* Is REGNUM a member of REGGROUP? */
@@ -1705,7 +1686,7 @@ alpha_software_single_step (struct regcache *regcache)
}
-/* Initialize the current architecture based on INFO. If possible, re-use an
+/* Initialize the current architecture based on INFO. If possible, reuse an
architecture from ARCHES, which is a list of architectures already created
during this debugging session.
@@ -1715,11 +1696,39 @@ alpha_software_single_step (struct regcache *regcache)
static struct gdbarch *
alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
+ tdesc_arch_data_up tdesc_data;
+ const struct target_desc *tdesc = info.target_desc;
+
/* Find a candidate among extant architectures. */
arches = gdbarch_list_lookup_by_info (arches, &info);
if (arches != NULL)
return arches->gdbarch;
+ if (tdesc == nullptr)
+ tdesc = tdesc_alpha;
+
+ /* Validate target description. */
+ if (tdesc_has_registers (tdesc))
+ {
+ const struct tdesc_feature *feature;
+ bool valid_p;
+
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.alpha.core");
+ if (feature == nullptr)
+ return nullptr;
+
+ tdesc_data = tdesc_data_alloc ();
+ valid_p = true;
+ for (int i = 0; i < ALPHA_NUM_REGS; ++i)
+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i,
+ alpha_register_names[i]);
+
+ if (!valid_p)
+ return nullptr;
+ }
+
+ gdb_assert (tdesc_data != nullptr);
+
gdbarch *gdbarch
= gdbarch_alloc (&info, gdbarch_tdep_up (new alpha_gdbarch_tdep));
alpha_gdbarch_tdep *tdep = gdbarch_tdep<alpha_gdbarch_tdep> (gdbarch);
@@ -1756,8 +1765,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_pc_regnum (gdbarch, ALPHA_PC_REGNUM);
set_gdbarch_fp0_regnum (gdbarch, ALPHA_FP0_REGNUM);
- set_gdbarch_register_name (gdbarch, alpha_register_name);
- set_gdbarch_register_type (gdbarch, alpha_register_type);
+ tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
set_gdbarch_cannot_fetch_register (gdbarch, alpha_cannot_fetch_register);
set_gdbarch_cannot_store_register (gdbarch, alpha_cannot_store_register);
@@ -1789,7 +1797,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_cannot_step_breakpoint (gdbarch, 1);
/* Handles single stepping of atomic sequences. */
- set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, alpha_software_single_step);
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
@@ -1815,13 +1823,13 @@ alpha_dwarf2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
}
-void _initialize_alpha_tdep ();
-void
-_initialize_alpha_tdep ()
+INIT_GDB_FILE (alpha_tdep)
{
gdbarch_register (bfd_arch_alpha, alpha_gdbarch_init, NULL);
+ initialize_tdesc_alpha ();
+
/* Let the user set the fence post for heuristic_proc_start. */
/* We really would like to have both "0" and "unlimited" work, but
diff --git a/gdb/alpha-tdep.h b/gdb/alpha-tdep.h
index b42863f..5e0adf3 100644
--- a/gdb/alpha-tdep.h
+++ b/gdb/alpha-tdep.h
@@ -1,5 +1,5 @@
/* Common target dependent code for GDB on Alpha systems.
- Copyright (C) 1993-2024 Free Software Foundation, Inc.
+ Copyright (C) 1993-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/amd-dbgapi-target.c b/gdb/amd-dbgapi-target.c
index 996e16a..d296f28 100644
--- a/gdb/amd-dbgapi-target.c
+++ b/gdb/amd-dbgapi-target.c
@@ -1,6 +1,6 @@
/* Target used to communicate with the AMD Debugger API.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -104,12 +104,26 @@ amd_dbgapi_lib_debug_module ()
static gdb::observers::token amd_dbgapi_target_inferior_created_observer_token;
+/* See amd-dbgapi-target.h. */
+
const gdb::observers::token &
get_amd_dbgapi_target_inferior_created_observer_token ()
{
return amd_dbgapi_target_inferior_created_observer_token;
}
+/* inferior_execd observer token. */
+
+static gdb::observers::token amd_dbgapi_target_inferior_execd_observer_token;
+
+/* See amd-dbgapi-target.h. */
+
+const gdb::observers::token &
+get_amd_dbgapi_target_inferior_execd_observer_token ()
+{
+ return amd_dbgapi_target_inferior_execd_observer_token;
+}
+
/* A type holding coordinates, etc. info for a given wave. */
struct wave_coordinates
@@ -234,7 +248,7 @@ struct amd_dbgapi_inferior_info
};
static amd_dbgapi_event_id_t process_event_queue
- (amd_dbgapi_process_id_t process_id,
+ (amd_dbgapi_inferior_info &info,
amd_dbgapi_event_kind_t until_event_kind = AMD_DBGAPI_EVENT_KIND_NONE);
static const target_info amd_dbgapi_target_info = {
@@ -331,15 +345,15 @@ static const registry<inferior>::key<amd_dbgapi_inferior_info>
/* Fetch the amd_dbgapi_inferior_info data for the given inferior. */
-static struct amd_dbgapi_inferior_info *
-get_amd_dbgapi_inferior_info (struct inferior *inferior)
+static amd_dbgapi_inferior_info &
+get_amd_dbgapi_inferior_info (inferior *inferior)
{
amd_dbgapi_inferior_info *info = amd_dbgapi_inferior_data.get (inferior);
if (info == nullptr)
info = amd_dbgapi_inferior_data.emplace (inferior, inferior);
- return info;
+ return *info;
}
/* The async event handler registered with the event loop, indicating that we
@@ -416,11 +430,11 @@ wave_coordinates::fetch ()
static wave_info &
get_thread_wave_info (thread_info *tp)
{
- amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (tp->inf);
+ amd_dbgapi_inferior_info &info = get_amd_dbgapi_inferior_info (tp->inf);
amd_dbgapi_wave_id_t wave_id = get_amd_dbgapi_wave_id (tp->ptid);
- auto it = info->wave_info_map.find (wave_id.handle);
- gdb_assert (it != info->wave_info_map.end ());
+ auto it = info.wave_info_map.find (wave_id.handle);
+ gdb_assert (it != info.wave_info_map.end ());
return it->second;
}
@@ -443,6 +457,32 @@ async_event_handler_mark ()
mark_async_event_handler (amd_dbgapi_async_event_handler);
}
+/* Set forward progress requirement to REQUIRE for inferior INFO. */
+
+static void
+require_forward_progress (amd_dbgapi_inferior_info &info, bool require)
+{
+ /* If we try to disable forward progress requirement but the target expects
+ resumed threads to be committed to the target, we could wait for events
+ that will never arrive. */
+ if (!require)
+ gdb_assert (!info.inf->process_target ()->commit_resumed_state);
+
+ gdb_assert (info.process_id != AMD_DBGAPI_PROCESS_NONE);
+
+ /* Don't do unnecessary calls to amd-dbgapi to avoid polluting the logs. */
+ if (info.forward_progress_required == require)
+ return;
+
+ const auto progress
+ = require ? AMD_DBGAPI_PROGRESS_NORMAL : AMD_DBGAPI_PROGRESS_NO_FORWARD;
+ const auto status
+ = amd_dbgapi_process_set_progress (info.process_id, progress);
+ gdb_assert (status == AMD_DBGAPI_STATUS_SUCCESS);
+
+ info.forward_progress_required = require;
+}
+
/* Set forward progress requirement to REQUIRE for all processes of PROC_TARGET
matching PTID. */
@@ -455,23 +495,10 @@ require_forward_progress (ptid_t ptid, process_stratum_target *proc_target,
if (ptid != minus_one_ptid && inf->pid != ptid.pid ())
continue;
- amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (inf);
+ amd_dbgapi_inferior_info &info = get_amd_dbgapi_inferior_info (inf);
- if (info->process_id == AMD_DBGAPI_PROCESS_NONE)
- continue;
-
- /* Don't do unnecessary calls to amd-dbgapi to avoid polluting the logs. */
- if (info->forward_progress_required == require)
- continue;
-
- amd_dbgapi_status_t status
- = amd_dbgapi_process_set_progress
- (info->process_id, (require
- ? AMD_DBGAPI_PROGRESS_NORMAL
- : AMD_DBGAPI_PROGRESS_NO_FORWARD));
- gdb_assert (status == AMD_DBGAPI_STATUS_SUCCESS);
-
- info->forward_progress_required = require;
+ if (info.process_id != AMD_DBGAPI_PROCESS_NONE)
+ require_forward_progress (info, require);
/* If ptid targets a single inferior and we have found it, no need to
continue. */
@@ -485,7 +512,7 @@ require_forward_progress (ptid_t ptid, process_stratum_target *proc_target,
amd_dbgapi_process_id_t
get_amd_dbgapi_process_id (inferior *inf)
{
- return get_amd_dbgapi_inferior_info (inf)->process_id;
+ return get_amd_dbgapi_inferior_info (inf).process_id;
}
/* A breakpoint dbgapi wants us to insert, to handle shared library
@@ -520,7 +547,7 @@ void
amd_dbgapi_target_breakpoint::check_status (struct bpstat *bs)
{
struct inferior *inf = current_inferior ();
- amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (inf);
+ amd_dbgapi_inferior_info &info = get_amd_dbgapi_inferior_info (inf);
amd_dbgapi_status_t status;
bs->stop = 0;
@@ -528,13 +555,13 @@ amd_dbgapi_target_breakpoint::check_status (struct bpstat *bs)
/* Find the address the breakpoint is set at. */
auto match_breakpoint
- = [bs] (const decltype (info->breakpoint_map)::value_type &value)
+ = [bs] (const decltype (info.breakpoint_map)::value_type &value)
{ return value.second == bs->breakpoint_at; };
auto it
- = std::find_if (info->breakpoint_map.begin (), info->breakpoint_map.end (),
+ = std::find_if (info.breakpoint_map.begin (), info.breakpoint_map.end (),
match_breakpoint);
- if (it == info->breakpoint_map.end ())
+ if (it == info.breakpoint_map.end ())
error (_("Could not find breakpoint_id for breakpoint at %s"),
paddress (inf->arch (), bs->bp_location_at->address));
@@ -555,11 +582,12 @@ amd_dbgapi_target_breakpoint::check_status (struct bpstat *bs)
if (action == AMD_DBGAPI_BREAKPOINT_ACTION_RESUME)
return;
+ require_forward_progress (info, false);
+
/* If the action is AMD_DBGAPI_BREAKPOINT_ACTION_HALT, we need to wait until
a breakpoint resume event for this breakpoint_id is seen. */
amd_dbgapi_event_id_t resume_event_id
- = process_event_queue (info->process_id,
- AMD_DBGAPI_EVENT_KIND_BREAKPOINT_RESUME);
+ = process_event_queue (info, AMD_DBGAPI_EVENT_KIND_BREAKPOINT_RESUME);
/* We should always get a breakpoint_resume event after processing all
events generated by reporting the breakpoint hit. */
@@ -619,12 +647,12 @@ amd_dbgapi_target::pid_to_str (ptid_t ptid)
process_stratum_target *proc_target = current_inferior ()->process_target ();
inferior *inf = find_inferior_pid (proc_target, ptid.pid ());
gdb_assert (inf != nullptr);
- amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (inf);
+ const amd_dbgapi_inferior_info &info = get_amd_dbgapi_inferior_info (inf);
auto wave_id = get_amd_dbgapi_wave_id (ptid);
- auto it = info->wave_info_map.find (wave_id.handle);
- if (it != info->wave_info_map.end ())
+ auto it = info.wave_info_map.find (wave_id.handle);
+ if (it != info.wave_info_map.end ())
return it->second.coords.to_string ();
/* A wave we don't know about. Shouldn't usually happen, but
@@ -747,18 +775,18 @@ amd_dbgapi_target::resume (ptid_t scope_ptid, int step, enum gdb_signal signo)
/* Disable forward progress requirement. */
require_forward_progress (scope_ptid, proc_target, false);
- for (thread_info *thread : all_non_exited_threads (proc_target, scope_ptid))
+ for (thread_info &thread : all_non_exited_threads (proc_target, scope_ptid))
{
- if (!ptid_is_gpu (thread->ptid))
+ if (!ptid_is_gpu (thread.ptid))
continue;
- amd_dbgapi_wave_id_t wave_id = get_amd_dbgapi_wave_id (thread->ptid);
+ amd_dbgapi_wave_id_t wave_id = get_amd_dbgapi_wave_id (thread.ptid);
amd_dbgapi_status_t status;
- wave_info &wi = get_thread_wave_info (thread);
+ wave_info &wi = get_thread_wave_info (&thread);
amd_dbgapi_resume_mode_t &resume_mode = wi.last_resume_mode;
amd_dbgapi_exceptions_t wave_exception;
- if (thread->ptid == inferior_ptid)
+ if (thread.ptid == inferior_ptid)
{
resume_mode = (step
? AMD_DBGAPI_RESUME_MODE_SINGLE_STEP
@@ -880,7 +908,7 @@ amd_dbgapi_target::stop (ptid_t ptid)
if (m_report_thread_events)
{
- get_amd_dbgapi_inferior_info (thread->inf)->wave_events.emplace_back
+ get_amd_dbgapi_inferior_info (thread->inf).wave_events.emplace_back
(thread->ptid, target_waitstatus ().set_thread_exited (0));
if (target_is_async_p ())
@@ -906,10 +934,10 @@ amd_dbgapi_target::stop (ptid_t ptid)
for (auto *inf : all_inferiors (proc_target))
/* Use the threads_safe iterator since stop_one_thread may delete the
thread if it has exited. */
- for (auto *thread : inf->threads_safe ())
- if (thread->state != THREAD_EXITED && thread->ptid.matches (ptid)
- && ptid_is_gpu (thread->ptid))
- stop_one_thread (thread);
+ for (auto &thread : inf->threads_safe ())
+ if (thread.state != THREAD_EXITED && thread.ptid.matches (ptid)
+ && ptid_is_gpu (thread.ptid))
+ stop_one_thread (&thread);
}
/* Callback for our async event handler. */
@@ -948,18 +976,19 @@ private:
static void
dbgapi_notifier_handler (int err, gdb_client_data client_data)
{
- amd_dbgapi_inferior_info *info = (amd_dbgapi_inferior_info *) client_data;
+ amd_dbgapi_inferior_info &info
+ = *static_cast<amd_dbgapi_inferior_info *> (client_data);
int ret;
/* Drain the notifier pipe. */
do
{
char buf;
- ret = read (info->notifier, &buf, 1);
+ ret = read (info.notifier, &buf, 1);
}
while (ret >= 0 || (ret == -1 && errno == EINTR));
- if (info->inf->target_is_pushed (&the_amd_dbgapi_target))
+ if (info.inf->target_is_pushed (&the_amd_dbgapi_target))
{
/* The amd-dbgapi target is pushed: signal our async handler, the event
will be consumed through our wait method. */
@@ -976,7 +1005,7 @@ dbgapi_notifier_handler (int err, gdb_client_data client_data)
amd_dbgapi_event_id_t event_id;
amd_dbgapi_event_kind_t event_kind;
amd_dbgapi_status_t status
- = amd_dbgapi_process_next_pending_event (info->process_id, &event_id,
+ = amd_dbgapi_process_next_pending_event (info.process_id, &event_id,
&event_kind);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
error (_("next_pending_event failed (%s)"), get_status_string (status));
@@ -1000,17 +1029,17 @@ dbgapi_notifier_handler (int err, gdb_client_data client_data)
switch (runtime_state)
{
case AMD_DBGAPI_RUNTIME_STATE_LOADED_SUCCESS:
- gdb_assert (info->runtime_state == AMD_DBGAPI_RUNTIME_STATE_UNLOADED);
- info->runtime_state = runtime_state;
+ gdb_assert (info.runtime_state == AMD_DBGAPI_RUNTIME_STATE_UNLOADED);
+ info.runtime_state = runtime_state;
amd_dbgapi_debug_printf ("pushing amd-dbgapi target");
- info->inf->push_target (&the_amd_dbgapi_target);
+ info.inf->push_target (&the_amd_dbgapi_target);
/* The underlying target will already be async if we are running, but not if
we are attaching. */
- if (info->inf->process_target ()->is_async_p ())
+ if (info.inf->process_target ()->is_async_p ())
{
scoped_restore_current_thread restore_thread;
- switch_to_inferior_no_thread (info->inf);
+ switch_to_inferior_no_thread (info.inf);
/* Make sure our async event handler is created. */
target_async (true);
@@ -1018,14 +1047,14 @@ dbgapi_notifier_handler (int err, gdb_client_data client_data)
break;
case AMD_DBGAPI_RUNTIME_STATE_UNLOADED:
- gdb_assert (info->runtime_state
+ gdb_assert (info.runtime_state
== AMD_DBGAPI_RUNTIME_STATE_LOADED_ERROR_RESTRICTION);
- info->runtime_state = runtime_state;
+ info.runtime_state = runtime_state;
break;
case AMD_DBGAPI_RUNTIME_STATE_LOADED_ERROR_RESTRICTION:
- gdb_assert (info->runtime_state == AMD_DBGAPI_RUNTIME_STATE_UNLOADED);
- info->runtime_state = runtime_state;
+ gdb_assert (info.runtime_state == AMD_DBGAPI_RUNTIME_STATE_UNLOADED);
+ info.runtime_state = runtime_state;
warning (_("amd-dbgapi: unable to enable GPU debugging "
"due to a restriction error"));
break;
@@ -1054,10 +1083,10 @@ amd_dbgapi_target::async (bool enable)
for (inferior *inf : all_non_exited_inferiors (proc_target))
{
- amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (inf);
+ amd_dbgapi_inferior_info &info = get_amd_dbgapi_inferior_info (inf);
- if (info->notifier != -1)
- add_file_handler (info->notifier, dbgapi_notifier_handler, info,
+ if (info.notifier != -1)
+ add_file_handler (info.notifier, dbgapi_notifier_handler, &info,
string_printf ("amd-dbgapi notifier for pid %d",
inf->pid));
}
@@ -1077,10 +1106,11 @@ amd_dbgapi_target::async (bool enable)
for (inferior *inf : all_inferiors ())
{
- amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (inf);
+ const amd_dbgapi_inferior_info &info
+ = get_amd_dbgapi_inferior_info (inf);
- if (info->notifier != -1)
- delete_file_handler (info->notifier);
+ if (info.notifier != -1)
+ delete_file_handler (info.notifier);
}
delete_async_event_handler (&amd_dbgapi_async_event_handler);
@@ -1104,11 +1134,11 @@ amd_dbgapi_thread_deleted (thread_info *tp)
if (tp->inf->target_at (arch_stratum) == &the_amd_dbgapi_target
&& ptid_is_gpu (tp->ptid))
{
- amd_dbgapi_inferior_info *info = amd_dbgapi_inferior_data.get (tp->inf);
+ amd_dbgapi_inferior_info &info = get_amd_dbgapi_inferior_info (tp->inf);
auto wave_id = get_amd_dbgapi_wave_id (tp->ptid);
- auto it = info->wave_info_map.find (wave_id.handle);
- gdb_assert (it != info->wave_info_map.end ());
- info->wave_info_map.erase (it);
+ auto it = info.wave_info_map.find (wave_id.handle);
+ gdb_assert (it != info.wave_info_map.end ());
+ info.wave_info_map.erase (it);
}
}
@@ -1119,11 +1149,11 @@ static thread_info *
add_gpu_thread (inferior *inf, ptid_t wave_ptid)
{
process_stratum_target *proc_target = inf->process_target ();
- amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (inf);
+ amd_dbgapi_inferior_info &info = get_amd_dbgapi_inferior_info (inf);
auto wave_id = get_amd_dbgapi_wave_id (wave_ptid);
- if (!info->wave_info_map.try_emplace (wave_id.handle,
+ if (!info.wave_info_map.try_emplace (wave_id.handle,
wave_info (wave_id)).second)
internal_error ("wave ID %ld already in map", wave_id.handle);
@@ -1138,32 +1168,14 @@ add_gpu_thread (inferior *inf, ptid_t wave_ptid)
/* Process an event that was just pulled out of the amd-dbgapi library. */
static void
-process_one_event (amd_dbgapi_event_id_t event_id,
+process_one_event (amd_dbgapi_inferior_info &info,
+ amd_dbgapi_event_id_t event_id,
amd_dbgapi_event_kind_t event_kind)
{
/* Automatically mark this event processed when going out of scope. */
scoped_amd_dbgapi_event_processed mark_event_processed (event_id);
- amd_dbgapi_process_id_t process_id;
- amd_dbgapi_status_t status
- = amd_dbgapi_event_get_info (event_id, AMD_DBGAPI_EVENT_INFO_PROCESS,
- sizeof (process_id), &process_id);
- if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("event_get_info for event_%ld failed (%s)"), event_id.handle,
- get_status_string (status));
-
- amd_dbgapi_os_process_id_t pid;
- status = amd_dbgapi_process_get_info (process_id,
- AMD_DBGAPI_PROCESS_INFO_OS_ID,
- sizeof (pid), &pid);
- if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("process_get_info for process_%ld failed (%s)"),
- process_id.handle, get_status_string (status));
-
- auto *proc_target = current_inferior ()->process_target ();
- inferior *inf = find_inferior_pid (proc_target, pid);
- gdb_assert (inf != nullptr);
- amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (inf);
+ gdb_assert (info.inf != nullptr);
switch (event_kind)
{
@@ -1171,14 +1183,14 @@ process_one_event (amd_dbgapi_event_id_t event_id,
case AMD_DBGAPI_EVENT_KIND_WAVE_STOP:
{
amd_dbgapi_wave_id_t wave_id;
- status
+ amd_dbgapi_status_t status
= amd_dbgapi_event_get_info (event_id, AMD_DBGAPI_EVENT_INFO_WAVE,
sizeof (wave_id), &wave_id);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
error (_("event_get_info for event_%ld failed (%s)"),
event_id.handle, get_status_string (status));
- ptid_t event_ptid = make_gpu_ptid (pid, wave_id);
+ ptid_t event_ptid = make_gpu_ptid (info.inf->pid, wave_id);
target_waitstatus ws;
amd_dbgapi_wave_stop_reasons_t stop_reason;
@@ -1219,9 +1231,10 @@ process_one_event (amd_dbgapi_event_id_t event_id,
else
ws.set_stopped (GDB_SIGNAL_0);
- thread_info *thread = proc_target->find_thread (event_ptid);
+ thread_info *thread
+ = info.inf->process_target ()->find_thread (event_ptid);
if (thread == nullptr)
- thread = add_gpu_thread (inf, event_ptid);
+ thread = add_gpu_thread (info.inf, event_ptid);
/* If the wave is stopped because of a software breakpoint, the
program counter needs to be adjusted so that it points to the
@@ -1243,7 +1256,7 @@ process_one_event (amd_dbgapi_event_id_t event_id,
error (_("wave_get_info for wave_%ld failed (%s)"),
wave_id.handle, get_status_string (status));
- info->wave_events.emplace_back (event_ptid, ws);
+ info.wave_events.emplace_back (event_ptid, ws);
break;
}
@@ -1261,7 +1274,7 @@ process_one_event (amd_dbgapi_event_id_t event_id,
When amd_dbgapi_target_breakpoint::check_status is called, the current
inferior is the inferior that hit the breakpoint, which should still be
the case now. */
- gdb_assert (inf == current_inferior ());
+ gdb_assert (info.inf == current_inferior ());
handle_solib_event ();
break;
@@ -1275,22 +1288,22 @@ process_one_event (amd_dbgapi_event_id_t event_id,
{
amd_dbgapi_runtime_state_t runtime_state;
- status = amd_dbgapi_event_get_info (event_id,
- AMD_DBGAPI_EVENT_INFO_RUNTIME_STATE,
- sizeof (runtime_state),
- &runtime_state);
+ amd_dbgapi_status_t status
+ = amd_dbgapi_event_get_info (event_id,
+ AMD_DBGAPI_EVENT_INFO_RUNTIME_STATE,
+ sizeof (runtime_state), &runtime_state);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
error (_("event_get_info for event_%ld failed (%s)"),
event_id.handle, get_status_string (status));
gdb_assert (runtime_state == AMD_DBGAPI_RUNTIME_STATE_UNLOADED);
gdb_assert
- (info->runtime_state == AMD_DBGAPI_RUNTIME_STATE_LOADED_SUCCESS);
+ (info.runtime_state == AMD_DBGAPI_RUNTIME_STATE_LOADED_SUCCESS);
- info->runtime_state = runtime_state;
+ info.runtime_state = runtime_state;
- gdb_assert (inf->target_is_pushed (&the_amd_dbgapi_target));
- inf->unpush_target (&the_amd_dbgapi_target);
+ gdb_assert (info.inf->target_is_pushed (&the_amd_dbgapi_target));
+ info.inf->unpush_target (&the_amd_dbgapi_target);
}
break;
@@ -1331,20 +1344,18 @@ event_kind_str (amd_dbgapi_event_kind_t kind)
gdb_assert_not_reached ("unhandled amd_dbgapi_event_kind_t value");
}
-/* Drain the dbgapi event queue of a given process_id, or of all processes if
- process_id is AMD_DBGAPI_PROCESS_NONE. Stop processing the events if an
- event of a given kind is requested and `process_id` is not
- AMD_DBGAPI_PROCESS_NONE. Wave stop events that are not returned are queued
- into their inferior's amd_dbgapi_inferior_info pending wave events. */
+/* Drain the dbgapi event queue of a given inferior. Stop processing the
+ events if an event of a given kind is requested (not AMD_DBGAPI_EVENT_NONE).
+ Wave stop events that are not returned are queued into their inferior's
+ amd_dbgapi_inferior_info pending wave events. */
static amd_dbgapi_event_id_t
-process_event_queue (amd_dbgapi_process_id_t process_id,
+process_event_queue (amd_dbgapi_inferior_info &info,
amd_dbgapi_event_kind_t until_event_kind)
{
- /* An event of a given type can only be requested from a single
- process_id. */
- gdb_assert (until_event_kind == AMD_DBGAPI_EVENT_KIND_NONE
- || process_id != AMD_DBGAPI_PROCESS_NONE);
+ /* Pulling events with forward progress required may result in bad
+ performance, make sure it is not required. */
+ gdb_assert (!info.forward_progress_required);
while (true)
{
@@ -1352,7 +1363,7 @@ process_event_queue (amd_dbgapi_process_id_t process_id,
amd_dbgapi_event_kind_t event_kind;
amd_dbgapi_status_t status
- = amd_dbgapi_process_next_pending_event (process_id, &event_id,
+ = amd_dbgapi_process_next_pending_event (info.process_id, &event_id,
&event_kind);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
@@ -1368,7 +1379,7 @@ process_event_queue (amd_dbgapi_process_id_t process_id,
if (event_id == AMD_DBGAPI_EVENT_NONE || event_kind == until_event_kind)
return event_id;
- process_one_event (event_id, event_kind);
+ process_one_event (info, event_id, event_kind);
}
}
@@ -1390,13 +1401,13 @@ static std::pair<ptid_t, target_waitstatus>
consume_one_event (int pid)
{
auto *target = current_inferior ()->process_target ();
- struct amd_dbgapi_inferior_info *info = nullptr;
+ amd_dbgapi_inferior_info *info = nullptr;
if (pid == -1)
{
for (inferior *inf : all_inferiors (target))
{
- info = get_amd_dbgapi_inferior_info (inf);
+ info = &get_amd_dbgapi_inferior_info (inf);
if (!info->wave_events.empty ())
break;
}
@@ -1408,7 +1419,7 @@ consume_one_event (int pid)
inferior *inf = find_inferior_pid (target, pid);
gdb_assert (inf != nullptr);
- info = get_amd_dbgapi_inferior_info (inf);
+ info = &get_amd_dbgapi_inferior_info (inf);
}
if (info->wave_events.empty ())
@@ -1472,8 +1483,9 @@ amd_dbgapi_target::wait (ptid_t ptid, struct target_waitstatus *ws,
{
/* Drain the events for the current inferior from the amd_dbgapi and
preserve the ordering. */
- auto info = get_amd_dbgapi_inferior_info (current_inferior ());
- process_event_queue (info->process_id, AMD_DBGAPI_EVENT_KIND_NONE);
+ amd_dbgapi_inferior_info &info
+ = get_amd_dbgapi_inferior_info (current_inferior ());
+ process_event_queue (info);
std::tie (event_ptid, gpu_waitstatus) = consume_one_event (ptid.pid ());
if (event_ptid == minus_one_ptid)
@@ -1495,7 +1507,7 @@ amd_dbgapi_target::wait (ptid_t ptid, struct target_waitstatus *ws,
for (inferior *inf : all_inferiors ())
if (inf->target_at (arch_stratum) == &the_amd_dbgapi_target
- && get_amd_dbgapi_inferior_info (inf)->runtime_state
+ && get_amd_dbgapi_inferior_info (inf).runtime_state
== AMD_DBGAPI_RUNTIME_STATE_LOADED_SUCCESS)
{
ws->set_ignore ();
@@ -1596,20 +1608,20 @@ attach_amd_dbgapi (inferior *inf)
if (inf->vfork_parent != nullptr)
return;
- auto *info = get_amd_dbgapi_inferior_info (inf);
+ amd_dbgapi_inferior_info &info = get_amd_dbgapi_inferior_info (inf);
/* Are we already attached? */
- if (info->process_id != AMD_DBGAPI_PROCESS_NONE)
+ if (info.process_id != AMD_DBGAPI_PROCESS_NONE)
{
amd_dbgapi_debug_printf
- ("already attached: process_id = %" PRIu64, info->process_id.handle);
+ ("already attached: process_id = %" PRIu64, info.process_id.handle);
return;
}
amd_dbgapi_status_t status
= amd_dbgapi_process_attach
(reinterpret_cast<amd_dbgapi_client_process_id_t> (inf),
- &info->process_id);
+ &info.process_id);
if (status == AMD_DBGAPI_STATUS_ERROR_RESTRICTION)
{
warning (_("amd-dbgapi: unable to enable GPU debugging due to a "
@@ -1624,29 +1636,29 @@ attach_amd_dbgapi (inferior *inf)
return;
}
- if (amd_dbgapi_process_get_info (info->process_id,
+ if (amd_dbgapi_process_get_info (info.process_id,
AMD_DBGAPI_PROCESS_INFO_NOTIFIER,
- sizeof (info->notifier), &info->notifier)
+ sizeof (info.notifier), &info.notifier)
!= AMD_DBGAPI_STATUS_SUCCESS)
{
- amd_dbgapi_process_detach (info->process_id);
- info->process_id = AMD_DBGAPI_PROCESS_NONE;
+ amd_dbgapi_process_detach (info.process_id);
+ info.process_id = AMD_DBGAPI_PROCESS_NONE;
warning (_("amd-dbgapi: could not retrieve process %d's notifier, GPU "
"debugging will not be available."), inf->pid);
return;
}
amd_dbgapi_debug_printf ("process_id = %" PRIu64 ", notifier fd = %d",
- info->process_id.handle, info->notifier);
+ info.process_id.handle, info.notifier);
- set_process_memory_precision (*info);
+ set_process_memory_precision (info);
/* If GDB is attaching to a process that has the runtime loaded, there will
already be a "runtime loaded" event available. Consume it and push the
target. */
- dbgapi_notifier_handler (0, info);
+ dbgapi_notifier_handler (0, &info);
- add_file_handler (info->notifier, dbgapi_notifier_handler, info,
+ add_file_handler (info.notifier, dbgapi_notifier_handler, &info,
"amd-dbgapi notifier");
}
@@ -1663,30 +1675,30 @@ detach_amd_dbgapi (inferior *inf)
{
AMD_DBGAPI_SCOPED_DEBUG_START_END ("inf num = %d", inf->num);
- auto *info = get_amd_dbgapi_inferior_info (inf);
+ amd_dbgapi_inferior_info &info = get_amd_dbgapi_inferior_info (inf);
- if (info->process_id == AMD_DBGAPI_PROCESS_NONE)
+ if (info.process_id == AMD_DBGAPI_PROCESS_NONE)
return;
- info->runtime_state = AMD_DBGAPI_RUNTIME_STATE_UNLOADED;
+ info.runtime_state = AMD_DBGAPI_RUNTIME_STATE_UNLOADED;
- amd_dbgapi_status_t status = amd_dbgapi_process_detach (info->process_id);
+ amd_dbgapi_status_t status = amd_dbgapi_process_detach (info.process_id);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
warning (_("amd-dbgapi: could not detach from process %d (%s)"),
inf->pid, get_status_string (status));
- gdb_assert (info->notifier != -1);
- delete_file_handler (info->notifier);
+ gdb_assert (info.notifier != -1);
+ delete_file_handler (info.notifier);
/* This is a noop if the target is not pushed. */
inf->unpush_target (&the_amd_dbgapi_target);
/* Delete the breakpoints that are still active. */
- for (auto &&value : info->breakpoint_map)
+ for (auto &&value : info.breakpoint_map)
delete_breakpoint (value.second);
/* Reset the amd_dbgapi_inferior_info, except for precise_memory_mode. */
- *info = amd_dbgapi_inferior_info (inf, info->precise_memory.requested);
+ info = amd_dbgapi_inferior_info (inf, info.precise_memory.requested);
maybe_reset_amd_dbgapi ();
}
@@ -1860,25 +1872,26 @@ amd_dbgapi_target::update_thread_list ()
if (changed == AMD_DBGAPI_CHANGED_NO)
continue;
+ gdb::unique_xmalloc_ptr<amd_dbgapi_wave_id_t> wave_list_holder
+ (wave_list);
+
/* Create a set and free the wave list. */
std::set<ptid_t::tid_type> threads;
for (size_t i = 0; i < count; ++i)
threads.emplace (wave_list[i].handle);
- xfree (wave_list);
-
/* Prune the wave_ids that already have a thread_info. Any thread_info
which does not have a corresponding wave_id represents a wave which
is gone at this point and should be deleted. */
- for (thread_info *tp : inf->threads_safe ())
- if (ptid_is_gpu (tp->ptid) && tp->state != THREAD_EXITED)
+ for (thread_info &tp : inf->threads_safe ())
+ if (ptid_is_gpu (tp.ptid) && tp.state != THREAD_EXITED)
{
- auto it = threads.find (tp->ptid.tid ());
+ auto it = threads.find (tp.ptid.tid ());
if (it == threads.end ())
{
- auto wave_id = get_amd_dbgapi_wave_id (tp->ptid);
- wave_info &wi = get_thread_wave_info (tp);
+ auto wave_id = get_amd_dbgapi_wave_id (tp.ptid);
+ wave_info &wi = get_thread_wave_info (&tp);
/* Waves that were stepping or in progress of being
stopped are guaranteed to report a
@@ -1899,7 +1912,7 @@ amd_dbgapi_target::update_thread_list ()
{
amd_dbgapi_debug_printf ("wave_%ld disappeared, deleting it",
wave_id.handle);
- delete_thread_silent (tp);
+ delete_thread_silent (&tp);
}
}
else
@@ -1961,10 +1974,10 @@ amd_dbgapi_target::displaced_step_prepare (thread_info *thread,
}
/* Save the displaced stepping id in the per-inferior info. */
- amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (thread->inf);
+ amd_dbgapi_inferior_info &info = get_amd_dbgapi_inferior_info (thread->inf);
bool inserted
- = info->stepping_id_map.emplace (thread, stepping_id.handle).second;
+ = info.stepping_id_map.emplace (thread, stepping_id.handle).second;
gdb_assert (inserted);
/* Get the new (displaced) PC. */
@@ -1996,8 +2009,8 @@ amd_dbgapi_target::displaced_step_finish (thread_info *thread,
gdb_assert (thread->displaced_step_state.in_progress ());
/* Find the displaced stepping id for this thread. */
- amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (thread->inf);
- auto entry = info->stepping_id_map.extract (thread);
+ amd_dbgapi_inferior_info &info = get_amd_dbgapi_inferior_info (thread->inf);
+ auto entry = info.stepping_id_map.extract (thread);
gdb_assert (entry.has_value ());
amd_dbgapi_displaced_stepping_id_t stepping_id {entry->second};
@@ -2054,14 +2067,16 @@ static void
amd_dbgapi_target_inferior_cloned (inferior *original_inferior,
inferior *new_inferior)
{
- auto *orig_info = get_amd_dbgapi_inferior_info (original_inferior);
- auto *new_info = get_amd_dbgapi_inferior_info (new_inferior);
+ const amd_dbgapi_inferior_info &orig_info
+ = get_amd_dbgapi_inferior_info (original_inferior);
+ amd_dbgapi_inferior_info &new_info
+ = get_amd_dbgapi_inferior_info (new_inferior);
/* At this point, the process is not started. Therefore it is sufficient to
copy the precise memory request, it will be applied when the process
starts. */
- gdb_assert (new_info->process_id == AMD_DBGAPI_PROCESS_NONE);
- new_info->precise_memory.requested = orig_info->precise_memory.requested;
+ gdb_assert (new_info.process_id == AMD_DBGAPI_PROCESS_NONE);
+ new_info.precise_memory.requested = orig_info.precise_memory.requested;
}
/* inferior_execd observer. */
@@ -2077,8 +2092,8 @@ amd_dbgapi_inferior_execd (inferior *exec_inf, inferior *follow_inf)
/* If using "follow-exec-mode new", carry over the precise-memory setting
to the new inferior (otherwise, FOLLOW_INF and ORIG_INF point to the same
inferior, so this is a no-op). */
- get_amd_dbgapi_inferior_info (follow_inf)->precise_memory.requested
- = get_amd_dbgapi_inferior_info (exec_inf)->precise_memory.requested;
+ get_amd_dbgapi_inferior_info (follow_inf).precise_memory.requested
+ = get_amd_dbgapi_inferior_info (exec_inf).precise_memory.requested;
attach_amd_dbgapi (follow_inf);
}
@@ -2092,17 +2107,17 @@ amd_dbgapi_inferior_forked (inferior *parent_inf, inferior *child_inf,
if (child_inf != nullptr)
{
/* Copy precise-memory requested value from parent to child. */
- amd_dbgapi_inferior_info *parent_info
+ const amd_dbgapi_inferior_info &parent_info
= get_amd_dbgapi_inferior_info (parent_inf);
- amd_dbgapi_inferior_info *child_info
+ amd_dbgapi_inferior_info &child_info
= get_amd_dbgapi_inferior_info (child_inf);
- child_info->precise_memory.requested
- = parent_info->precise_memory.requested;
+ child_info.precise_memory.requested
+ = parent_info.precise_memory.requested;
if (fork_kind != TARGET_WAITKIND_VFORKED)
{
scoped_restore_current_thread restore_thread;
- switch_to_thread (*child_inf->threads ().begin ());
+ switch_to_thread (&*child_inf->threads ().begin ());
attach_amd_dbgapi (child_inf);
}
}
@@ -2171,10 +2186,10 @@ amd_dbgapi_insert_breakpoint_callback
amd_dbgapi_breakpoint_id_t breakpoint_id)
{
inferior *inf = reinterpret_cast<inferior *> (client_process_id);
- struct amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (inf);
+ amd_dbgapi_inferior_info &info = get_amd_dbgapi_inferior_info (inf);
- auto it = info->breakpoint_map.find (breakpoint_id.handle);
- if (it != info->breakpoint_map.end ())
+ auto it = info.breakpoint_map.find (breakpoint_id.handle);
+ if (it != info.breakpoint_map.end ())
return AMD_DBGAPI_STATUS_ERROR_INVALID_BREAKPOINT_ID;
/* We need to find the address in the given inferior's program space. */
@@ -2191,7 +2206,7 @@ amd_dbgapi_insert_breakpoint_callback
breakpoint *bp = install_breakpoint (true, std::move (bp_up), 1);
- info->breakpoint_map.emplace (breakpoint_id.handle, bp);
+ info.breakpoint_map.emplace (breakpoint_id.handle, bp);
return AMD_DBGAPI_STATUS_SUCCESS;
}
@@ -2203,14 +2218,14 @@ amd_dbgapi_remove_breakpoint_callback
amd_dbgapi_breakpoint_id_t breakpoint_id)
{
inferior *inf = reinterpret_cast<inferior *> (client_process_id);
- struct amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (inf);
+ amd_dbgapi_inferior_info &info = get_amd_dbgapi_inferior_info (inf);
- auto it = info->breakpoint_map.find (breakpoint_id.handle);
- if (it == info->breakpoint_map.end ())
+ auto it = info.breakpoint_map.find (breakpoint_id.handle);
+ if (it == info.breakpoint_map.end ())
return AMD_DBGAPI_STATUS_ERROR_INVALID_BREAKPOINT_ID;
delete_breakpoint (it->second);
- info->breakpoint_map.erase (it);
+ info.breakpoint_map.erase (it);
return AMD_DBGAPI_STATUS_SUCCESS;
}
@@ -2264,10 +2279,10 @@ amd_dbgapi_xfer_global_memory_callback
static void
amd_dbgapi_target_signal_received (gdb_signal sig)
{
- amd_dbgapi_inferior_info *info
+ const amd_dbgapi_inferior_info &info
= get_amd_dbgapi_inferior_info (current_inferior ());
- if (info->process_id == AMD_DBGAPI_PROCESS_NONE)
+ if (info.process_id == AMD_DBGAPI_PROCESS_NONE)
return;
if (!ptid_is_gpu (inferior_thread ()->ptid))
@@ -2276,7 +2291,7 @@ amd_dbgapi_target_signal_received (gdb_signal sig)
if (sig != GDB_SIGNAL_SEGV && sig != GDB_SIGNAL_BUS)
return;
- if (!info->precise_memory.enabled)
+ if (!info.precise_memory.enabled)
gdb_printf (_("\
Warning: precise memory violation signal reporting is not enabled, reported\n\
location may not be accurate. See \"show amdgpu precise-memory\".\n"));
@@ -2357,14 +2372,14 @@ static void
show_precise_memory_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- amd_dbgapi_inferior_info *info
+ const amd_dbgapi_inferior_info &info
= get_amd_dbgapi_inferior_info (current_inferior ());
gdb_printf (file,
_("AMDGPU precise memory access reporting is %s "
"(currently %s).\n"),
- info->precise_memory.requested ? "on" : "off",
- info->precise_memory.enabled ? "enabled" : "disabled");
+ info.precise_memory.requested ? "on" : "off",
+ info.precise_memory.enabled ? "enabled" : "disabled");
}
/* Callback for "set amdgpu precise-memory". */
@@ -2372,13 +2387,13 @@ show_precise_memory_mode (struct ui_file *file, int from_tty,
static void
set_precise_memory_mode (bool value)
{
- amd_dbgapi_inferior_info *info
+ amd_dbgapi_inferior_info &info
= get_amd_dbgapi_inferior_info (current_inferior ());
- info->precise_memory.requested = value;
+ info.precise_memory.requested = value;
- if (info->process_id != AMD_DBGAPI_PROCESS_NONE)
- set_process_memory_precision (*info);
+ if (info.process_id != AMD_DBGAPI_PROCESS_NONE)
+ set_process_memory_precision (info);
}
/* Return whether precise-memory is requested for the current inferior. */
@@ -2386,10 +2401,10 @@ set_precise_memory_mode (bool value)
static bool
get_precise_memory_mode ()
{
- amd_dbgapi_inferior_info *info
+ const amd_dbgapi_inferior_info &info
= get_amd_dbgapi_inferior_info (current_inferior ());
- return info->precise_memory.requested;
+ return info.precise_memory.requested;
}
/* List of set/show amdgpu commands. */
@@ -2462,9 +2477,9 @@ maybe_reset_amd_dbgapi ()
{
for (inferior *inf : all_non_exited_inferiors ())
{
- amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (inf);
+ const amd_dbgapi_inferior_info &info = get_amd_dbgapi_inferior_info (inf);
- if (info->process_id != AMD_DBGAPI_PROCESS_NONE)
+ if (info.process_id != AMD_DBGAPI_PROCESS_NONE)
return;
}
@@ -2479,10 +2494,7 @@ maybe_reset_amd_dbgapi ()
get_status_string (status));
}
-extern initialize_file_ftype _initialize_amd_dbgapi_target;
-
-void
-_initialize_amd_dbgapi_target ()
+INIT_GDB_FILE (amd_dbgapi_target)
{
/* Make sure the loaded debugger library version is greater than or equal to
the one used to build GDB. */
@@ -2510,7 +2522,9 @@ _initialize_amd_dbgapi_target ()
gdb::observers::inferior_created.attach
(amd_dbgapi_target_inferior_created,
amd_dbgapi_target_inferior_created_observer_token, "amd-dbgapi");
- gdb::observers::inferior_execd.attach (amd_dbgapi_inferior_execd, "amd-dbgapi");
+ gdb::observers::inferior_execd.attach
+ (amd_dbgapi_inferior_execd, amd_dbgapi_target_inferior_execd_observer_token,
+ "amd-dbgapi");
gdb::observers::inferior_forked.attach (amd_dbgapi_inferior_forked, "amd-dbgapi");
gdb::observers::inferior_exit.attach (amd_dbgapi_inferior_exited, "amd-dbgapi");
gdb::observers::inferior_pre_detach.attach (amd_dbgapi_inferior_pre_detach, "amd-dbgapi");
diff --git a/gdb/amd-dbgapi-target.h b/gdb/amd-dbgapi-target.h
index 0a9cafa..fe3a50b 100644
--- a/gdb/amd-dbgapi-target.h
+++ b/gdb/amd-dbgapi-target.h
@@ -1,6 +1,6 @@
/* Target used to communicate with the AMD Debugger API.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -54,6 +54,11 @@ using is_amd_dbgapi_handle
const gdb::observers::token &
get_amd_dbgapi_target_inferior_created_observer_token ();
+/* Get the token of amd-dbgapi's inferior_execd observer. */
+
+const gdb::observers::token &
+ get_amd_dbgapi_target_inferior_execd_observer_token ();
+
/* Comparison operators for amd-dbgapi handle types. */
template <typename T,
diff --git a/gdb/amd64-bsd-nat.c b/gdb/amd64-bsd-nat.c
index e0ba28f..85e6053 100644
--- a/gdb/amd64-bsd-nat.c
+++ b/gdb/amd64-bsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for AMD64 BSD's.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/amd64-bsd-nat.h b/gdb/amd64-bsd-nat.h
index 7ea2682..aab990d 100644
--- a/gdb/amd64-bsd-nat.h
+++ b/gdb/amd64-bsd-nat.h
@@ -1,6 +1,6 @@
/* Native-dependent code for modern AMD64 BSD's.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/amd64-darwin-tdep.c b/gdb/amd64-darwin-tdep.c
index f2741e2..c687b1f 100644
--- a/gdb/amd64-darwin-tdep.c
+++ b/gdb/amd64-darwin-tdep.c
@@ -1,5 +1,5 @@
/* Darwin support for GDB, the GNU debugger.
- Copyright (C) 1997-2024 Free Software Foundation, Inc.
+ Copyright (C) 1997-2025 Free Software Foundation, Inc.
Contributed by Apple Computer, Inc.
@@ -113,12 +113,10 @@ x86_darwin_init_abi_64 (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->jb_pc_offset = 56;
- set_gdbarch_so_ops (gdbarch, &darwin_so_ops);
+ set_gdbarch_make_solib_ops (gdbarch, make_darwin_solib_ops);
}
-void _initialize_amd64_darwin_tdep ();
-void
-_initialize_amd64_darwin_tdep ()
+INIT_GDB_FILE (amd64_darwin_tdep)
{
gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
GDB_OSABI_DARWIN, x86_darwin_init_abi_64);
diff --git a/gdb/amd64-darwin-tdep.h b/gdb/amd64-darwin-tdep.h
index c09cfe3..f5d8550 100644
--- a/gdb/amd64-darwin-tdep.h
+++ b/gdb/amd64-darwin-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for Darwin x86-64.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/amd64-dicos-tdep.c b/gdb/amd64-dicos-tdep.c
index 7624289..d7c211b 100644
--- a/gdb/amd64-dicos-tdep.c
+++ b/gdb/amd64-dicos-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for DICOS running on x86-64's, for GDB.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -45,9 +45,7 @@ amd64_dicos_osabi_sniffer (bfd *abfd)
return GDB_OSABI_UNKNOWN;
}
-void _initialize_amd64_dicos_tdep ();
-void
-_initialize_amd64_dicos_tdep ()
+INIT_GDB_FILE (amd64_dicos_tdep)
{
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
amd64_dicos_osabi_sniffer);
diff --git a/gdb/amd64-fbsd-nat.c b/gdb/amd64-fbsd-nat.c
index 6ce7c45..89bb049 100644
--- a/gdb/amd64-fbsd-nat.c
+++ b/gdb/amd64-fbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for FreeBSD/amd64.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -137,7 +137,7 @@ amd64_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
/* There is no amd64_fxsave_supplies or amd64_xsave_supplies.
Instead, the earlier register sets return early if the request
- was for a specific register that was already satisified to avoid
+ was for a specific register that was already satisfied to avoid
fetching the FPU/XSAVE state unnecessarily. */
#ifdef PT_GETXSTATE_INFO
@@ -214,7 +214,7 @@ amd64_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
/* There is no amd64_fxsave_supplies or amd64_xsave_supplies.
Instead, the earlier register sets return early if the request
- was for a specific register that was already satisified to avoid
+ was for a specific register that was already satisfied to avoid
fetching the FPU/XSAVE state unnecessarily. */
#ifdef PT_GETXSTATE_INFO
@@ -324,9 +324,7 @@ amd64_fbsd_nat_target::read_description ()
return i386_target_description (X86_XSTATE_SSE_MASK, true);
}
-void _initialize_amd64fbsd_nat ();
-void
-_initialize_amd64fbsd_nat ()
+INIT_GDB_FILE (amd64fbsd_nat)
{
add_inf_child_target (&the_amd64_fbsd_nat_target);
diff --git a/gdb/amd64-fbsd-tdep.c b/gdb/amd64-fbsd-tdep.c
index de29509..12f1e22 100644
--- a/gdb/amd64-fbsd-tdep.c
+++ b/gdb/amd64-fbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for FreeBSD/amd64.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -328,8 +328,7 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
amd64fbsd_core_read_description);
/* FreeBSD uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_lp64_solib_ops);
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
@@ -337,9 +336,7 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
amd64fbsd_get_thread_local_address);
}
-void _initialize_amd64fbsd_tdep ();
-void
-_initialize_amd64fbsd_tdep ()
+INIT_GDB_FILE (amd64fbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
GDB_OSABI_FREEBSD, amd64fbsd_init_abi);
diff --git a/gdb/amd64-fbsd-tdep.h b/gdb/amd64-fbsd-tdep.h
index 7e8acc6..c92618e 100644
--- a/gdb/amd64-fbsd-tdep.h
+++ b/gdb/amd64-fbsd-tdep.h
@@ -1,6 +1,6 @@
/* FreeBSD/amd64 target support, prototypes.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/amd64-gnu-tdep.c b/gdb/amd64-gnu-tdep.c
index 435095e..2b7337b 100644
--- a/gdb/amd64-gnu-tdep.c
+++ b/gdb/amd64-gnu-tdep.c
@@ -1,5 +1,5 @@
/* Target-dependent code for the GNU Hurd.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -218,13 +218,10 @@ amd64_gnu_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->sc_num_regs = ARRAY_SIZE (amd64_gnu_sc_reg_offset);
/* Hurd uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_lp64_solib_ops);
}
-void _initialize_amd64_gnu_tdep ();
-void
-_initialize_amd64_gnu_tdep ()
+INIT_GDB_FILE (amd64_gnu_tdep)
{
gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
GDB_OSABI_HURD, amd64_gnu_init_abi);
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index c3b7a19..4b23fd9 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux x86-64.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
Contributed by Jiri Smid, SuSE Labs.
This file is part of GDB.
@@ -32,6 +32,7 @@
#include "amd64-tdep.h"
#include "amd64-linux-tdep.h"
#include "i386-linux-tdep.h"
+#include "x86-tdep.h"
#include "gdbsupport/x86-xstate.h"
#include "x86-linux-nat.h"
@@ -86,6 +87,8 @@ static int amd64_linux_gregset32_reg_offset[] =
-1, -1, -1, -1, -1, -1, -1, -1, /* k0 ... k7 (AVX512) */
-1, -1, -1, -1, -1, -1, -1, -1, /* zmm0 ... zmm7 (AVX512) */
-1, /* PKEYS register PKRU */
+ -1, /* SSP register. */
+ -1, -1, /* fs/gs base registers. */
ORIG_RAX * 8 /* "orig_eax" */
};
@@ -237,6 +240,14 @@ amd64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
+ if ((regnum == -1 && tdep->ssp_regnum != -1)
+ || (regnum != -1 && regnum == tdep->ssp_regnum))
+ {
+ x86_linux_fetch_ssp (regcache, tid);
+ if (regnum != -1)
+ return;
+ }
+
/* Pre-4.14 kernels have a bug (fixed by commit 0852b374173b
"x86/fpu: Add FPU state copying quirk to handle XRSTOR failure on
Intel Skylake CPUs") that sometimes causes the mxcsr location in
@@ -302,6 +313,14 @@ amd64_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
gdb::byte_vector xstateregs (tdep->xsave_layout.sizeof_xsave);
+ if ((regnum == -1 && tdep->ssp_regnum != -1)
+ || (regnum != -1 && regnum == tdep->ssp_regnum))
+ {
+ x86_linux_store_ssp (regcache, tid);
+ if (regnum != -1)
+ return;
+ }
+
struct iovec iov;
iov.iov_base = xstateregs.data ();
@@ -424,9 +443,7 @@ amd64_linux_nat_target::low_siginfo_fixup (siginfo_t *ptrace,
return false;
}
-void _initialize_amd64_linux_nat ();
-void
-_initialize_amd64_linux_nat ()
+INIT_GDB_FILE (amd64_linux_nat)
{
amd64_native_gregset32_reg_offset = amd64_linux_gregset32_reg_offset;
amd64_native_gregset32_num_regs = I386_LINUX_NUM_REGS;
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index a7868c3..a21f8a9 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux x86-64.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
Contributed by Jiri Smid, SuSE Labs.
This file is part of GDB.
@@ -33,7 +33,10 @@
#include "amd64-linux-tdep.h"
#include "i386-linux-tdep.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
+#include "svr4-tls-tdep.h"
#include "gdbsupport/x86-xstate.h"
+#include "inferior.h"
#include "amd64-tdep.h"
#include "solib-svr4.h"
@@ -44,6 +47,9 @@
#include "expop.h"
#include "arch/amd64-linux-tdesc.h"
#include "inferior.h"
+#include "x86-tdep.h"
+#include "dwarf2/frame.h"
+#include "frame-unwind.h"
/* The syscall's XML filename for i386. */
#define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml"
@@ -105,6 +111,7 @@ int amd64_linux_gregset_reg_offset[] =
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, /* PKEYS register pkru */
+ -1, /* CET user mode register PL3_SSP. */
/* End of hardware registers */
21 * 8, 22 * 8, /* fs_base and gs_base. */
@@ -1589,6 +1596,15 @@ amd64_linux_record_signal (struct gdbarch *gdbarch,
return 0;
}
+/* Return true if the core file ABFD contains shadow stack pointer state.
+ Otherwise, return false. */
+
+static bool
+amd64_linux_core_read_ssp_state_p (bfd *abfd)
+{
+ return bfd_get_section_by_name (abfd, ".reg-ssp") != nullptr;
+}
+
/* Get Linux/x86 target description from core dump. */
static const struct target_desc *
@@ -1598,11 +1614,14 @@ amd64_linux_core_read_description (struct gdbarch *gdbarch,
{
/* Linux/x86-64. */
x86_xsave_layout layout;
- uint64_t xcr0 = i386_linux_core_read_xsave_info (abfd, layout);
- if (xcr0 == 0)
- xcr0 = X86_XSTATE_SSE_MASK;
+ uint64_t xstate_bv = i386_linux_core_read_xsave_info (abfd, layout);
+ if (xstate_bv == 0)
+ xstate_bv = X86_XSTATE_SSE_MASK;
+
+ if (amd64_linux_core_read_ssp_state_p (abfd))
+ xstate_bv |= X86_XSTATE_CET_U;
- return amd64_linux_read_description (xcr0 & X86_XSTATE_ALL_MASK,
+ return amd64_linux_read_description (xstate_bv & X86_XSTATE_ALL_MASK,
gdbarch_ptr_bit (gdbarch) == 32);
}
@@ -1633,6 +1652,37 @@ static const struct regset amd64_linux_xstateregset =
amd64_linux_collect_xstateregset
};
+/* Supply shadow stack pointer register from SSP to the register cache
+ REGCACHE. */
+
+static void
+amd64_linux_supply_ssp (const regset *regset,
+ regcache *regcache, int regnum,
+ const void *ssp, size_t len)
+{
+ gdb_assert (len == sizeof (uint64_t));
+ x86_supply_ssp (regcache, *static_cast<const uint64_t *> (ssp));
+}
+
+/* Collect the shadow stack pointer register from the register cache
+ REGCACHE and store it in SSP. */
+
+static void
+amd64_linux_collect_ssp (const regset *regset,
+ const regcache *regcache, int regnum,
+ void *ssp, size_t len)
+{
+ gdb_assert (len == sizeof (uint64_t));
+ x86_collect_ssp (regcache, *static_cast<uint64_t *> (ssp));
+}
+
+/* Shadow stack pointer register. */
+
+static const struct regset amd64_linux_ssp_register
+ {
+ NULL, amd64_linux_supply_ssp, amd64_linux_collect_ssp
+ };
+
/* Iterate over core file register note sections. */
static void
@@ -1649,6 +1699,14 @@ amd64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg-xstate", tdep->xsave_layout.sizeof_xsave,
tdep->xsave_layout.sizeof_xsave, &amd64_linux_xstateregset,
"XSAVE extended state", cb_data);
+
+ /* SSP can be unavailable. Thus, we need to check the register status
+ in case we write a core file (regcache != nullptr). */
+ if (tdep->ssp_regnum != -1
+ && (regcache == nullptr
+ || REG_VALID == regcache->get_register_status (tdep->ssp_regnum)))
+ cb (".reg-ssp", 8, 8, &amd64_linux_ssp_register,
+ "shadow stack pointer", cb_data);
}
/* The instruction sequences used in x86_64 machines for a
@@ -1832,9 +1890,198 @@ amd64_linux_remove_non_address_bits_watchpoint (gdbarch *gdbarch,
return (addr & amd64_linux_lam_untag_mask ());
}
+/* Fetch and return the TLS DTV (dynamic thread vector) address for PTID.
+ Throw a suitable TLS error if something goes wrong. */
+
+static CORE_ADDR
+amd64_linux_get_tls_dtv_addr (struct gdbarch *gdbarch, ptid_t ptid,
+ enum svr4_tls_libc libc)
+{
+ /* On x86-64, the thread pointer is found in the fsbase register. */
+ regcache *regcache
+ = get_thread_arch_regcache (current_inferior (), ptid, gdbarch);
+ target_fetch_registers (regcache, AMD64_FSBASE_REGNUM);
+ ULONGEST fsbase;
+ if (regcache->cooked_read (AMD64_FSBASE_REGNUM, &fsbase) != REG_VALID)
+ throw_error (TLS_GENERIC_ERROR, _("Unable to fetch thread pointer"));
+
+ /* The thread pointer (fsbase) points at the TCB (thread control
+ block). The first two members of this struct are both pointers,
+ where the first will be a pointer to the TCB (i.e. it points at
+ itself) and the second will be a pointer to the DTV (dynamic
+ thread vector). There are many other fields too, but the one
+ we care about here is the DTV pointer. Compute the address
+ of the DTV pointer, fetch it, and convert it to an address. */
+ CORE_ADDR dtv_ptr_addr = fsbase + gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
+ gdb::byte_vector buf (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
+ if (target_read_memory (dtv_ptr_addr, buf.data (), buf.size ()) != 0)
+ throw_error (TLS_GENERIC_ERROR, _("Unable to fetch DTV address"));
+
+ const struct builtin_type *builtin = builtin_type (gdbarch);
+ CORE_ADDR dtv_addr = gdbarch_pointer_to_address
+ (gdbarch, builtin->builtin_data_ptr, buf.data ());
+ return dtv_addr;
+}
+
+/* Return the number of bytes required to update the shadow stack pointer
+ by one element. For x32 the shadow stack elements are still 64-bit
+ aligned. Thus, gdbarch_addr_bit cannot be used to compute the new
+ stack pointer. */
+
+static inline int
+amd64_linux_shadow_stack_element_size_aligned (gdbarch *gdbarch)
+{
+ const bfd_arch_info *binfo = gdbarch_bfd_arch_info (gdbarch);
+ return (binfo->bits_per_word / binfo->bits_per_byte);
+}
+
+/* Read the shadow stack pointer register and return its value, if
+ possible. */
+
+static std::optional<CORE_ADDR>
+amd64_linux_get_shadow_stack_pointer (gdbarch *gdbarch, regcache *regcache,
+ bool &shadow_stack_enabled)
+{
+ shadow_stack_enabled = false;
+ const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
+
+ if (tdep->ssp_regnum < 0)
+ return {};
+
+ CORE_ADDR ssp;
+ if (regcache_raw_read_unsigned (regcache, tdep->ssp_regnum, &ssp)
+ != REG_VALID)
+ return {};
+
+ /* Dependent on the target in case the shadow stack pointer is
+ unavailable, the ssp register can be invalid or 0x0 when shadow stack
+ is supported by HW and the linux kernel but not enabled for the
+ current thread. */
+ if (ssp == 0x0)
+ return {};
+
+ /* In case there is a shadow stack pointer available which is non-null,
+ the shadow stack feature is enabled. */
+ shadow_stack_enabled = true;
+ return ssp;
+}
+
+/* If shadow stack is enabled, push the address NEW_ADDR to the shadow
+ stack and increment the shadow stack pointer accordingly. */
+
static void
-amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch,
- int num_disp_step_buffers)
+amd64_linux_shadow_stack_push (gdbarch *gdbarch, CORE_ADDR new_addr,
+ regcache *regcache)
+{
+ bool shadow_stack_enabled;
+ std::optional<CORE_ADDR> ssp
+ = amd64_linux_get_shadow_stack_pointer (gdbarch, regcache,
+ shadow_stack_enabled);
+
+ /* For amd64/Linux, if SSP has a value that means shadow stack is
+ enabled. */
+ if (!ssp.has_value ())
+ return;
+ else
+ gdb_assert (shadow_stack_enabled);
+
+ /* The shadow stack grows downwards. To push addresses to the stack,
+ we need to decrement SSP. */
+ const int element_size
+ = amd64_linux_shadow_stack_element_size_aligned (gdbarch);
+ const CORE_ADDR new_ssp = *ssp - element_size;
+
+ /* Using /proc/PID/smaps we can only check if NEW_SSP points to shadow
+ stack memory. If it doesn't, we assume the stack is full. */
+ std::pair<CORE_ADDR, CORE_ADDR> memrange;
+ if (!linux_address_in_shadow_stack_mem_range (new_ssp, &memrange))
+ error (_("No space left on the shadow stack."));
+
+ /* On x86 there can be a shadow stack token at bit 63. For x32, the
+ address size is only 32 bit. Always write back the full 8 bytes to
+ include the shadow stack token. */
+ const bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ write_memory_unsigned_integer (new_ssp, element_size, byte_order,
+ (ULONGEST) new_addr);
+
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
+ gdb_assert (tdep->ssp_regnum > -1);
+
+ regcache_raw_write_unsigned (regcache, tdep->ssp_regnum, new_ssp);
+}
+
+/* Implement shadow stack pointer unwinding. For each new shadow stack
+ pointer check if its address is still in the shadow stack memory range.
+ If it's outside the range set the returned value to unavailable,
+ otherwise return a value containing the new shadow stack pointer. */
+
+static value *
+amd64_linux_dwarf2_prev_ssp (const frame_info_ptr &this_frame,
+ void **this_cache, int regnum)
+{
+ value *v = frame_unwind_got_register (this_frame, regnum, regnum);
+ gdb_assert (v != nullptr);
+
+ gdbarch *gdbarch = get_frame_arch (this_frame);
+
+ if (v->entirely_available () && !v->optimized_out ())
+ {
+ int size = register_size (gdbarch, regnum);
+ bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ CORE_ADDR ssp = extract_unsigned_integer (v->contents_all ().data (),
+ size, byte_order);
+
+ /* Using /proc/PID/smaps we can only check if the current shadow
+ stack pointer SSP points to shadow stack memory. Only if this is
+ the case a valid previous shadow stack pointer can be
+ calculated. */
+ std::pair<CORE_ADDR, CORE_ADDR> range;
+ if (linux_address_in_shadow_stack_mem_range (ssp, &range))
+ {
+ /* The shadow stack grows downwards. To compute the previous
+ shadow stack pointer, we need to increment SSP. */
+ CORE_ADDR new_ssp
+ = ssp + amd64_linux_shadow_stack_element_size_aligned (gdbarch);
+
+ /* There can be scenarios where we have a shadow stack pointer
+ but the shadow stack is empty, as no call instruction has
+ been executed yet. If NEW_SSP points to the end of or before
+ (<=) the current shadow stack memory range we consider
+ NEW_SSP as valid (but empty). */
+ if (new_ssp <= range.second)
+ return frame_unwind_got_address (this_frame, regnum, new_ssp);
+ }
+ }
+
+ /* Return a value which is marked as unavailable in case we could not
+ calculate a valid previous shadow stack pointer. */
+ value *retval
+ = value::allocate_register (get_next_frame_sentinel_okay (this_frame),
+ regnum, register_type (gdbarch, regnum));
+ retval->mark_bytes_unavailable (0, retval->type ()->length ());
+ return retval;
+}
+
+/* Implement the "init_reg" dwarf2_frame_ops method. */
+
+static void
+amd64_init_reg (gdbarch *gdbarch, int regnum, dwarf2_frame_state_reg *reg,
+ const frame_info_ptr &this_frame)
+{
+ if (regnum == gdbarch_pc_regnum (gdbarch))
+ reg->how = DWARF2_FRAME_REG_RA;
+ else if (regnum == gdbarch_sp_regnum (gdbarch))
+ reg->how = DWARF2_FRAME_REG_CFA;
+ else if (regnum == AMD64_PL3_SSP_REGNUM)
+ {
+ reg->how = DWARF2_FRAME_REG_FN;
+ reg->loc.fn = amd64_linux_dwarf2_prev_ssp;
+ }
+}
+
+static void
+amd64_linux_init_abi_common (struct gdbarch_info info, struct gdbarch *gdbarch,
+ int num_disp_step_buffers)
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
@@ -1862,6 +2109,9 @@ amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch,
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
+ set_gdbarch_get_thread_local_address (gdbarch,
+ svr4_tls_get_thread_local_address);
+ svr4_tls_register_tls_methods (info, gdbarch, amd64_linux_get_tls_dtv_addr);
/* GNU/Linux uses SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
@@ -1886,6 +2136,11 @@ amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch,
set_gdbarch_remove_non_address_bits_watchpoint
(gdbarch, amd64_linux_remove_non_address_bits_watchpoint);
+
+ set_gdbarch_shadow_stack_push (gdbarch, amd64_linux_shadow_stack_push);
+ set_gdbarch_get_shadow_stack_pointer (gdbarch,
+ amd64_linux_get_shadow_stack_pointer);
+ dwarf2_frame_set_init_reg (gdbarch, amd64_init_reg);
}
static void
@@ -2092,8 +2347,7 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->i386_syscall_record = amd64_linux_syscall_record;
/* GNU/Linux uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_lp64_svr4_solib_ops);
/* Register DTrace handlers. */
set_gdbarch_dtrace_parse_probe_argument (gdbarch, amd64_dtrace_parse_probe_argument);
@@ -2306,13 +2560,10 @@ amd64_x32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->i386_syscall_record = amd64_x32_linux_syscall_record;
/* GNU/Linux uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
}
-void _initialize_amd64_linux_tdep ();
-void
-_initialize_amd64_linux_tdep ()
+INIT_GDB_FILE (amd64_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
GDB_OSABI_LINUX, amd64_linux_init_abi);
diff --git a/gdb/amd64-linux-tdep.h b/gdb/amd64-linux-tdep.h
index 4bcd423..20f4180 100644
--- a/gdb/amd64-linux-tdep.h
+++ b/gdb/amd64-linux-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux AMD64.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/amd64-nat.c b/gdb/amd64-nat.c
index 5c5c368..b0b7660 100644
--- a/gdb/amd64-nat.c
+++ b/gdb/amd64-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for AMD64.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/amd64-nat.h b/gdb/amd64-nat.h
index 56ad36c..81ce9b3 100644
--- a/gdb/amd64-nat.h
+++ b/gdb/amd64-nat.h
@@ -1,6 +1,6 @@
/* Native-dependent code for AMD64.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/amd64-netbsd-nat.c b/gdb/amd64-netbsd-nat.c
index 8bd3e12..c960b3c 100644
--- a/gdb/amd64-netbsd-nat.c
+++ b/gdb/amd64-netbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for NetBSD/amd64.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -55,9 +55,7 @@ static int amd64nbsd32_r_reg_offset[] =
static amd64_bsd_nat_target<nbsd_nat_target> the_amd64_nbsd_nat_target;
-void _initialize_amd64nbsd_nat ();
-void
-_initialize_amd64nbsd_nat ()
+INIT_GDB_FILE (amd64nbsd_nat)
{
amd64_native_gregset32_reg_offset = amd64nbsd32_r_reg_offset;
amd64_native_gregset32_num_regs = ARRAY_SIZE (amd64nbsd32_r_reg_offset);
diff --git a/gdb/amd64-netbsd-tdep.c b/gdb/amd64-netbsd-tdep.c
index 26404205..3dbbdd9 100644
--- a/gdb/amd64-netbsd-tdep.c
+++ b/gdb/amd64-netbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for NetBSD/amd64.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -116,13 +116,10 @@ amd64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->sc_num_regs = ARRAY_SIZE (amd64nbsd_r_reg_offset);
/* NetBSD uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_lp64_solib_ops);
}
-void _initialize_amd64nbsd_tdep ();
-void
-_initialize_amd64nbsd_tdep ()
+INIT_GDB_FILE (amd64nbsd_tdep)
{
/* The NetBSD/amd64 native dependent code makes this assumption. */
gdb_assert (ARRAY_SIZE (amd64nbsd_r_reg_offset) == AMD64_NUM_GREGS);
diff --git a/gdb/amd64-obsd-nat.c b/gdb/amd64-obsd-nat.c
index 717f6bd..8471520 100644
--- a/gdb/amd64-obsd-nat.c
+++ b/gdb/amd64-obsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for OpenBSD/amd64.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -127,9 +127,7 @@ amd64obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
static amd64_bsd_nat_target<obsd_nat_target> the_amd64_obsd_nat_target;
-void _initialize_amd64obsd_nat ();
-void
-_initialize_amd64obsd_nat ()
+INIT_GDB_FILE (amd64obsd_nat)
{
amd64_native_gregset32_reg_offset = amd64obsd32_r_reg_offset;
amd64_native_gregset32_num_regs = ARRAY_SIZE (amd64obsd32_r_reg_offset);
diff --git a/gdb/amd64-obsd-tdep.c b/gdb/amd64-obsd-tdep.c
index d1ebb06..6b60e0a 100644
--- a/gdb/amd64-obsd-tdep.c
+++ b/gdb/amd64-obsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for OpenBSD/amd64.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -443,16 +443,13 @@ amd64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
bsd_uthread_set_collect_uthread (gdbarch, amd64obsd_collect_uthread);
/* OpenBSD uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_lp64_solib_ops);
/* Unwind kernel trap frames correctly. */
frame_unwind_prepend_unwinder (gdbarch, &amd64obsd_trapframe_unwind);
}
-void _initialize_amd64obsd_tdep ();
-void
-_initialize_amd64obsd_tdep ()
+INIT_GDB_FILE (amd64obsd_tdep)
{
/* The OpenBSD/amd64 native dependent code makes this assumption. */
gdb_assert (ARRAY_SIZE (amd64obsd_r_reg_offset) == AMD64_NUM_GREGS);
diff --git a/gdb/amd64-ravenscar-thread.c b/gdb/amd64-ravenscar-thread.c
index a0de0d7..8b4ce1e 100644
--- a/gdb/amd64-ravenscar-thread.c
+++ b/gdb/amd64-ravenscar-thread.c
@@ -1,6 +1,6 @@
/* Ravenscar x86-64 target support.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/amd64-ravenscar-thread.h b/gdb/amd64-ravenscar-thread.h
index 41e3832..94d375a 100644
--- a/gdb/amd64-ravenscar-thread.h
+++ b/gdb/amd64-ravenscar-thread.h
@@ -1,6 +1,6 @@
/* Ravenscar x86-64 target support.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/amd64-sol2-tdep.c b/gdb/amd64-sol2-tdep.c
index 070d7ed..da551a1 100644
--- a/gdb/amd64-sol2-tdep.c
+++ b/gdb/amd64-sol2-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for AMD64 Solaris.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
Contributed by Joseph Myers, CodeSourcery, LLC.
@@ -96,13 +96,10 @@ amd64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->sc_num_regs = tdep->gregset_num_regs;
/* Solaris uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_lp64_solib_ops);
}
-void _initialize_amd64_sol2_tdep ();
-void
-_initialize_amd64_sol2_tdep ()
+INIT_GDB_FILE (amd64_sol2_tdep)
{
gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
GDB_OSABI_SOLARIS, amd64_sol2_init_abi);
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index bebfd0d..9245889 100644..100755
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for AMD64.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
Contributed by Jiri Smid, SuSE Labs.
@@ -513,20 +513,19 @@ amd64_has_unaligned_fields (struct type *type)
if (type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION)
{
- for (int i = 0; i < type->num_fields (); i++)
+ for (const auto &field : type->fields ())
{
- struct type *subtype = check_typedef (type->field (i).type ());
+ struct type *subtype = check_typedef (field.type ());
/* Ignore static fields, empty fields (for example nested
empty structures), and bitfields (these are handled by
the caller). */
- if (type->field (i).is_static ()
- || (type->field (i).bitsize () == 0
- && subtype->length () == 0)
- || type->field (i).is_packed ())
+ if (field.is_static ()
+ || (field.bitsize () == 0 && subtype->length () == 0)
+ || field.is_packed ())
continue;
- int bitpos = type->field (i).loc_bitpos ();
+ int bitpos = field.loc_bitpos ();
if (bitpos % 8 != 0)
return true;
@@ -1182,6 +1181,15 @@ vex3_prefix_p (gdb_byte pfx)
return pfx == 0xc4;
}
+/* True if PFX is the start of an XOP prefix. */
+
+static bool
+xop_prefix_p (const gdb_byte *pfx)
+{
+ gdb_byte m = pfx[1] & 0x1f;
+ return pfx[0] == 0x8f && m >= 8;
+}
+
/* Return true if PFX is the start of the 4-byte EVEX prefix. */
static bool
@@ -1352,7 +1360,7 @@ amd64_get_insn_details (gdb_byte *insn, struct amd64_insn *details)
details->enc_prefix_offset = insn - start;
insn += 2;
}
- else if (vex3_prefix_p (*insn))
+ else if (vex3_prefix_p (*insn) || xop_prefix_p (insn))
{
details->enc_prefix_offset = insn - start;
insn += 3;
@@ -1384,13 +1392,12 @@ amd64_get_insn_details (gdb_byte *insn, struct amd64_insn *details)
}
else if (prefix != nullptr && vex2_prefix_p (*prefix))
{
- need_modrm = twobyte_has_modrm[*insn];
+ /* All VEX2 instructions need ModR/M, except vzeroupper/vzeroall. */
+ need_modrm = *insn != 0x77 ? 1 : 0;
details->opcode_len = 2;
}
else if (prefix != nullptr && vex3_prefix_p (*prefix))
{
- need_modrm = twobyte_has_modrm[*insn];
-
gdb_byte m = prefix[1] & 0x1f;
if (m == 0)
{
@@ -1399,12 +1406,16 @@ amd64_get_insn_details (gdb_byte *insn, struct amd64_insn *details)
}
else if (m == 1)
{
- /* Escape 0x0f. */
+ /* Escape 0x0f. All VEX3 instructions in this map need ModR/M,
+ except vzeroupper/vzeroall. */
+ need_modrm = *insn != 0x77 ? 1 : 0;
details->opcode_len = 2;
}
else if (m == 2 || m == 3)
{
- /* Escape 0x0f 0x38 or 0x0f 0x3a. */
+ /* Escape 0x0f 0x38 or 0x0f 0x3a. All VEX3 instructions in
+ this map need ModR/M. */
+ need_modrm = 1;
details->opcode_len = 3;
}
else if (m == 7)
@@ -1420,7 +1431,8 @@ amd64_get_insn_details (gdb_byte *insn, struct amd64_insn *details)
}
else if (prefix != nullptr && evex_prefix_p (*prefix))
{
- need_modrm = twobyte_has_modrm[*insn];
+ /* All EVEX instructions need ModR/M. */
+ need_modrm = 1;
gdb_byte m = prefix[1] & 0x7;
if (m == 1)
@@ -1439,6 +1451,11 @@ amd64_get_insn_details (gdb_byte *insn, struct amd64_insn *details)
return;
}
}
+ else if (prefix != nullptr && xop_prefix_p (prefix))
+ {
+ details->opcode_len = 1;
+ need_modrm = 1;
+ }
else if (*insn == TWO_BYTE_OPCODE_ESCAPE)
{
/* Two or three-byte opcode. */
@@ -1509,7 +1526,7 @@ fixup_riprel (const struct amd64_insn &details, gdb_byte *insn,
{
/* VEX.!B is set implicitly. */
}
- else if (vex3_prefix_p (pfx[0]))
+ else if (vex3_prefix_p (pfx[0]) || xop_prefix_p (pfx))
pfx[1] |= VEX3_NOT_B;
else if (evex_prefix_p (pfx[0]))
{
@@ -1917,6 +1934,22 @@ amd64_displaced_step_fixup (struct gdbarch *gdbarch,
displaced_debug_printf ("relocated return addr at %s to %s",
paddress (gdbarch, rsp),
paddress (gdbarch, retaddr));
+
+ /* If shadow stack is enabled, we need to correct the return address
+ on the shadow stack too. */
+ bool shadow_stack_enabled;
+ std::optional<CORE_ADDR> ssp
+ = gdbarch_get_shadow_stack_pointer (gdbarch, regs,
+ shadow_stack_enabled);
+ if (shadow_stack_enabled)
+ {
+ gdb_assert (ssp.has_value ());
+ write_memory_unsigned_integer (*ssp, retaddr_len, byte_order,
+ retaddr);
+ displaced_debug_printf ("relocated shadow stack return addr at %s "
+ "to %s", paddress (gdbarch, *ssp),
+ paddress (gdbarch, retaddr));
+ }
}
}
@@ -2129,6 +2162,30 @@ amd64_alloc_frame_cache (void)
return cache;
}
+/* Check whether PC is at "endbr64" instruction. If so, return PC past it.
+ Otherwise, return PC passed to this function. */
+
+static CORE_ADDR
+amd64_skip_endbr (gdbarch *gdbarch, CORE_ADDR pc)
+{
+ static const gdb_byte endbr64[4] = { 0xf3, 0x0f, 0x1e, 0xfa };
+
+ bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ gdb_byte buf[3];
+ gdb_byte op = read_code_unsigned_integer (pc, 1, byte_order);
+
+ /* Check for the `endbr64` instruction, skip it if found. */
+ if (op == endbr64[0])
+ {
+ read_code (pc + 1, buf, 3);
+
+ if (memcmp (buf, &endbr64[1], 3) == 0)
+ return pc + 4;
+ }
+
+ return pc;
+}
+
/* GCC 4.4 and later, can put code in the prologue to realign the
stack pointer. Check whether PC points to such code, and update
CACHE accordingly. Return the first instruction after the code
@@ -2466,35 +2523,18 @@ amd64_x32_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
return std::min (pc + offset + 2, current_pc);
}
-/* Do a limited analysis of the prologue at PC and update CACHE
- accordingly. Bail out early if CURRENT_PC is reached. Return the
- address where the analysis stopped.
-
- We will handle only functions beginning with:
-
- pushq %rbp 0x55
- movq %rsp, %rbp 0x48 0x89 0xe5 (or 0x48 0x8b 0xec)
-
- or (for the X32 ABI):
-
- pushq %rbp 0x55
- movl %esp, %ebp 0x89 0xe5 (or 0x8b 0xec)
+/* Analyze frame setup instructions at PC on behalf of amd64_analyze_prologue
+ and update CACHE accordingly. Bail out early if CURRENT_PC is reached.
+ Return the address where the analysis stopped.
- The `endbr64` instruction can be found before these sequences, and will be
- skipped if found.
-
- Any function that doesn't start with one of these sequences will be
- assumed to have no prologue and thus no valid frame pointer in
- %rbp. */
+ See comment on amd64_analyze_prologue for the sequences handled. The
+ movq/movl after the push of %rbp is considered optional. 'endbr64' is
+ handled before this function. */
static CORE_ADDR
-amd64_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR pc, CORE_ADDR current_pc,
- struct amd64_frame_cache *cache)
+amd64_analyze_frame_setup (gdbarch *gdbarch, CORE_ADDR pc,
+ CORE_ADDR current_pc, amd64_frame_cache *cache)
{
- enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- /* The `endbr64` instruction. */
- static const gdb_byte endbr64[4] = { 0xf3, 0x0f, 0x1e, 0xfa };
/* There are two variations of movq %rsp, %rbp. */
static const gdb_byte mov_rsp_rbp_1[3] = { 0x48, 0x89, 0xe5 };
static const gdb_byte mov_rsp_rbp_2[3] = { 0x48, 0x8b, 0xec };
@@ -2502,34 +2542,11 @@ amd64_analyze_prologue (struct gdbarch *gdbarch,
static const gdb_byte mov_esp_ebp_1[2] = { 0x89, 0xe5 };
static const gdb_byte mov_esp_ebp_2[2] = { 0x8b, 0xec };
+ bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[3];
- gdb_byte op;
-
- if (current_pc <= pc)
- return current_pc;
-
- if (gdbarch_ptr_bit (gdbarch) == 32)
- pc = amd64_x32_analyze_stack_align (pc, current_pc, cache);
- else
- pc = amd64_analyze_stack_align (pc, current_pc, cache);
-
- op = read_code_unsigned_integer (pc, 1, byte_order);
-
- /* Check for the `endbr64` instruction, skip it if found. */
- if (op == endbr64[0])
- {
- read_code (pc + 1, buf, 3);
-
- if (memcmp (buf, &endbr64[1], 3) == 0)
- pc += 4;
-
- op = read_code_unsigned_integer (pc, 1, byte_order);
- }
+ gdb_byte op = read_code_unsigned_integer (pc, 1, byte_order);
- if (current_pc <= pc)
- return current_pc;
-
- if (op == 0x55) /* pushq %rbp */
+ if (op == 0x55) /* pushq %rbp. */
{
/* Take into account that we've executed the `pushq %rbp' that
starts this instruction sequence. */
@@ -2569,6 +2586,176 @@ amd64_analyze_prologue (struct gdbarch *gdbarch,
return pc;
}
+/* Check whether PC points at code pushing registers onto the stack. If so,
+ update CACHE and return pc after those pushes or CURRENT_PC, whichever is
+ smaller. Otherwise, return PC passed to this function.
+
+ In AMD64 prologue, we only expect GPRs being pushed onto the stack. */
+
+static CORE_ADDR
+amd64_analyze_register_saves (CORE_ADDR pc, CORE_ADDR current_pc,
+ amd64_frame_cache *cache)
+{
+ gdb_byte op;
+
+ /* Limit iterating to 16 GPRs available. */
+ for (int i = 0; i < 16 && pc < current_pc; i++)
+ {
+ int reg = 0;
+ int pc_offset = 0;
+
+ if (target_read_code (pc, &op, 1) == -1)
+ return pc;
+
+ /* push %r8 - %r15 REX prefix. We expect only REX.B to be set, but
+ because, for example, REX.R would be "unused" if it were there,
+ we mask opcode with 0xF1 in case compilers don't get rid of it
+ "because it doesn't matter anyway". */
+ if ((op & 0xF1) == 0x41)
+ {
+ reg += 8;
+ pc_offset = 1;
+
+ if (target_read_code (pc + 1, &op, 1) == -1)
+ return pc;
+ }
+
+ /* push %rax|%rcx|%rdx|%rbx|%rsp|%rbp|%rsi|%rdi
+
+ or with 0x41 prefix:
+ push %r8|%r9|%r10|%r11|%r12|%r13|%r14|%r15. */
+ if (op < 0x50 || op > 0x57)
+ break;
+
+ reg += op - 0x50;
+
+ int regnum = amd64_arch_reg_to_regnum (reg);
+ cache->sp_offset += 8;
+ cache->saved_regs[regnum] = -cache->sp_offset;
+
+ pc += 1 + pc_offset;
+ }
+
+ return pc;
+}
+
+/* Check whether PC points at code allocating space on the stack.
+ If so, update CACHE and return pc past it or CURRENT_PC, whichever is
+ smaller. Otherwise, return PC passed to this function. */
+
+static CORE_ADDR
+amd64_analyze_stack_alloc (gdbarch *arch, CORE_ADDR pc, CORE_ADDR current_pc,
+ amd64_frame_cache *cache)
+{
+ static const gdb_byte sub_imm8_rsp[] = { 0x83, 0xec };
+ static const gdb_byte sub_imm32_rsp[] = { 0x81, 0xec };
+ static const gdb_byte lea_disp_rsp[] = { 0x8D, 0x64 };
+
+ bfd_endian byte_order = gdbarch_byte_order (arch);
+ const CORE_ADDR start_pc = pc;
+
+ gdb_byte op;
+ if (target_read_code (pc, &op, 1) == -1)
+ return pc;
+
+ /* Check for REX.W, indicating 64-bit operand size (in this case, for
+ %rsp). */
+ if (op == 0x48)
+ pc++;
+
+ if (current_pc <= pc)
+ return current_pc;
+
+ gdb_byte buf[2];
+ read_code (pc, buf, 2);
+
+ /* Check for instruction allocating space on the stack, which looks like
+ sub imm8/32, %rsp
+ or
+ lea -imm (%rsp), %rsp
+
+ and forward pc past it + update cache. */
+
+ /* sub imm8, %rsp. */
+ if (memcmp (buf, sub_imm8_rsp, 2) == 0)
+ {
+ /* Instruction is 3 bytes long. The imm8 arg is the 3rd, single
+ byte. */
+ cache->sp_offset += read_code_integer (pc + 2, 1, byte_order);
+ return pc + 3;
+ }
+ /* sub imm32, %rsp. */
+ else if (memcmp (buf, sub_imm32_rsp, 2) == 0)
+ {
+ /* Instruction is 6 bytes long. The imm32 arg is stored in 4 bytes,
+ starting from 3rd one. */
+ cache->sp_offset += read_code_integer (pc + 2, 4, byte_order);
+ return pc + 6;
+ }
+ /* lea -imm (%rsp), %rsp. */
+ else if (memcmp (buf, lea_disp_rsp, 2) == 0)
+ {
+ /* Instruction is 4 bytes long. The imm arg is the 4th, single
+ byte. */
+ cache->sp_offset += -1 * read_code_integer (pc + 3, 1, byte_order);
+ return pc + 4;
+ }
+
+ return start_pc;
+}
+
+/* Do a limited analysis of the prologue at PC and update CACHE
+ accordingly. Bail out early if CURRENT_PC is reached. Return the
+ address where the analysis stopped.
+
+ We will handle only functions beginning with:
+
+ pushq %rbp 0x55
+ movq %rsp, %rbp 0x48 0x89 0xe5 (or 0x48 0x8b 0xec)
+
+ or (for the X32 ABI):
+
+ pushq %rbp 0x55
+ movl %esp, %ebp 0x89 0xe5 (or 0x8b 0xec)
+
+ The `endbr64` instruction can be found before these sequences, and will be
+ skipped if found.
+
+ Any function that doesn't start with one of these sequences will be
+ assumed to have no prologue and thus no valid frame pointer in
+ %rbp. */
+
+static CORE_ADDR
+amd64_analyze_prologue (gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR current_pc,
+ amd64_frame_cache *cache)
+{
+ if (current_pc <= pc)
+ return current_pc;
+
+ /* If generated, 'endbr64' will be placed before stack alignment too. */
+ pc = amd64_skip_endbr (gdbarch, pc);
+ if (current_pc <= pc)
+ return current_pc;
+
+ if (gdbarch_ptr_bit (gdbarch) == 32)
+ pc = amd64_x32_analyze_stack_align (pc, current_pc, cache);
+ else
+ pc = amd64_analyze_stack_align (pc, current_pc, cache);
+
+ if (current_pc <= pc)
+ return current_pc;
+
+ pc = amd64_analyze_frame_setup (gdbarch, pc, current_pc, cache);
+ if (current_pc <= pc)
+ return current_pc;
+
+ pc = amd64_analyze_register_saves (pc, current_pc, cache);
+ if (current_pc <= pc)
+ return current_pc;
+
+ return amd64_analyze_stack_alloc (gdbarch, pc, current_pc, cache);
+}
+
/* Work around false termination of prologue - GCC PR debug/48827.
START_PC is the first instruction of a function, PC is its minimal already
@@ -2608,7 +2795,7 @@ amd64_skip_xmm_prologue (CORE_ADDR pc, CORE_ADDR start_pc)
if (next_sal.line != start_pc_sal.line)
return pc;
- /* START_PC can be from overlayed memory, ignored here. */
+ /* START_PC can be from overlay memory, ignored here. */
if (target_read_code (next_sal.pc - 4, buf, sizeof (buf)) != 0)
return pc;
@@ -3367,6 +3554,9 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
tdep->num_pkeys_regs = 1;
}
+ if (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.pl3_ssp") != nullptr)
+ tdep->ssp_regnum = AMD64_PL3_SSP_REGNUM;
+
tdep->num_byte_regs = 20;
tdep->num_word_regs = 16;
tdep->num_dword_regs = 16;
@@ -3523,23 +3713,24 @@ amd64_x32_none_init_abi (gdbarch_info info, gdbarch *arch)
amd64_target_description (X86_XSTATE_SSE_MASK, true));
}
-/* Return the target description for a specified XSAVE feature mask. */
+/* See amd64-tdep.h. */
const struct target_desc *
-amd64_target_description (uint64_t xcr0, bool segments)
+amd64_target_description (uint64_t xstate_bv, bool segments)
{
static target_desc *amd64_tdescs \
- [2/*AVX*/][2/*AVX512*/][2/*PKRU*/][2/*segments*/] = {};
+ [2/*AVX*/][2/*AVX512*/][2/*PKRU*/][2/*CET_U*/][2/*segments*/] = {};
target_desc **tdesc;
- tdesc = &amd64_tdescs[(xcr0 & X86_XSTATE_AVX) ? 1 : 0]
- [(xcr0 & X86_XSTATE_AVX512) ? 1 : 0]
- [(xcr0 & X86_XSTATE_PKRU) ? 1 : 0]
+ tdesc = &amd64_tdescs[(xstate_bv & X86_XSTATE_AVX) ? 1 : 0]
+ [(xstate_bv & X86_XSTATE_AVX512) ? 1 : 0]
+ [(xstate_bv & X86_XSTATE_PKRU) ? 1 : 0]
+ [(xstate_bv & X86_XSTATE_CET_U) ? 1 : 0]
[segments ? 1 : 0];
if (*tdesc == NULL)
- *tdesc = amd64_create_target_description (xcr0, false, false,
- segments);
+ *tdesc = amd64_create_target_description (xstate_bv, false,
+ false, segments);
return *tdesc;
}
@@ -3728,6 +3919,42 @@ test_amd64_get_insn_details (void)
= { 0x62, 0xf1, 0x7c, 0x48, 0x28, 0x81, 0x00, 0xfc, 0xff, 0xff };
fixup_riprel (details, insn.data (), ECX_REG_NUM);
SELF_CHECK (insn == updated_insn);
+
+ /* INSN: vpblendw $0x7,%xmm4,%xmm6,%xmm2, vex3 prefix. */
+ insn = { 0xc4, 0xe3, 0x49, 0x0e, 0xd4, 0x07 };
+ amd64_get_insn_details (insn.data (), &details);
+ SELF_CHECK (details.opcode_len == 3);
+ SELF_CHECK (details.enc_prefix_offset == 0);
+ SELF_CHECK (details.opcode_offset == 3);
+ SELF_CHECK (details.modrm_offset == 4);
+
+ /* INSN: vpblendw $0x7,0xff(%rip),%ymm6,%ymm2, vex3 prefix. */
+ insn = { 0xc4, 0xe3, 0x4d, 0x0e, 0x15, 0xff, 0x00, 0x00, 0x00, 0x07 };
+ amd64_get_insn_details (insn.data (), &details);
+ SELF_CHECK (details.opcode_len == 3);
+ SELF_CHECK (details.enc_prefix_offset == 0);
+ SELF_CHECK (details.opcode_offset == 3);
+ SELF_CHECK (details.modrm_offset == 4);
+
+ /* INSN: vpblendw $0x7,0xff(%ecx),%ymm6,%ymm2, vex3 prefix. */
+ fixup_riprel (details, insn.data (), ECX_REG_NUM);
+ updated_insn
+ = { 0xc4, 0xe3, 0x4d, 0x0e, 0x91, 0xff, 0x00, 0x00, 0x00, 0x07 };
+ SELF_CHECK (insn == updated_insn);
+
+ /* INSN: vpcomtrueuq 0x0(%rip),%xmm7,%xmm0, xop prefix. */
+ insn = { 0x8f, 0xe8, 0x40, 0xef, 0x05, 0x00, 0x00, 0x00, 0x00, 0x07 };
+ amd64_get_insn_details (insn.data (), &details);
+ SELF_CHECK (details.opcode_len == 1);
+ SELF_CHECK (details.enc_prefix_offset == 0);
+ SELF_CHECK (details.opcode_offset == 3);
+ SELF_CHECK (details.modrm_offset == 4);
+
+ /* INSN: vpcomtrueuq 0x0(%ecx),%xmm7,%xmm0, xop prefix. */
+ fixup_riprel (details, insn.data (), ECX_REG_NUM);
+ updated_insn
+ = { 0x8f, 0xe8, 0x40, 0xef, 0x81, 0x00, 0x00, 0x00, 0x00, 0x07 };
+ SELF_CHECK (insn == updated_insn);
}
static void
@@ -3740,9 +3967,7 @@ amd64_insn_decode (void)
} // namespace selftests
#endif /* GDB_SELF_TEST */
-void _initialize_amd64_tdep ();
-void
-_initialize_amd64_tdep ()
+INIT_GDB_FILE (amd64_tdep)
{
gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_NONE,
amd64_none_init_abi);
diff --git a/gdb/amd64-tdep.h b/gdb/amd64-tdep.h
index 7439b6e..e663288 100644
--- a/gdb/amd64-tdep.h
+++ b/gdb/amd64-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent definitions for AMD64.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
Contributed by Jiri Smid, SuSE Labs.
This file is part of GDB.
@@ -81,6 +81,7 @@ enum amd64_regnum
AMD64_ZMM0H_REGNUM,
AMD64_ZMM31H_REGNUM = AMD64_ZMM0H_REGNUM + 31,
AMD64_PKRU_REGNUM,
+ AMD64_PL3_SSP_REGNUM,
AMD64_FSBASE_REGNUM,
AMD64_GSBASE_REGNUM
};
@@ -108,8 +109,12 @@ extern void amd64_init_abi (struct gdbarch_info info,
extern void amd64_x32_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch,
const target_desc *default_tdesc);
-extern const struct target_desc *amd64_target_description (uint64_t xcr0,
- bool segments);
+
+/* Return the target description for the specified xsave features as
+ defined in XSTATE_BV and SEGMENTS. */
+
+extern const struct target_desc *amd64_target_description
+ (uint64_t xstate_bv, bool segments);
/* Fill register REGNUM in REGCACHE with the appropriate
floating-point or SSE register value from *FXSAVE. If REGNUM is
diff --git a/gdb/amd64-windows-nat.c b/gdb/amd64-windows-nat.c
index a282762..f5c98f6 100644
--- a/gdb/amd64-windows-nat.c
+++ b/gdb/amd64-windows-nat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -94,9 +94,7 @@ amd64_windows_segment_register_p (int regnum)
return regnum >= AMD64_CS_REGNUM && regnum <= AMD64_GS_REGNUM;
}
-void _initialize_amd64_windows_nat ();
-void
-_initialize_amd64_windows_nat ()
+INIT_GDB_FILE (amd64_windows_nat)
{
x86_set_debug_register_length (8);
}
diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
index b9de332..c7977d2 100644
--- a/gdb/amd64-windows-tdep.c
+++ b/gdb/amd64-windows-tdep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1404,9 +1404,7 @@ amd64_cygwin_core_osabi_sniffer (bfd *abfd)
return GDB_OSABI_UNKNOWN;
}
-void _initialize_amd64_windows_tdep ();
-void
-_initialize_amd64_windows_tdep ()
+INIT_GDB_FILE (amd64_windows_tdep)
{
gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_WINDOWS,
amd64_windows_init_abi);
diff --git a/gdb/amdgpu-tdep.c b/gdb/amdgpu-tdep.c
index 3272d24..26e5a27 100644
--- a/gdb/amdgpu-tdep.c
+++ b/gdb/amdgpu-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the AMDGPU architectures.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1371,10 +1371,7 @@ amdgpu_register_type_parse_test ()
#endif
-void _initialize_amdgpu_tdep ();
-
-void
-_initialize_amdgpu_tdep ()
+INIT_GDB_FILE (amdgpu_tdep)
{
gdbarch_register (bfd_arch_amdgcn, amdgpu_gdbarch_init, NULL,
amdgpu_supports_arch_info);
diff --git a/gdb/amdgpu-tdep.h b/gdb/amdgpu-tdep.h
index 16c7b83..b468c6c 100644
--- a/gdb/amdgpu-tdep.h
+++ b/gdb/amdgpu-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for the AMDGPU architectures.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/annotate.c b/gdb/annotate.c
index c1d4229..55db2e2 100644
--- a/gdb/annotate.c
+++ b/gdb/annotate.c
@@ -1,5 +1,5 @@
/* Annotation routines for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -627,9 +627,7 @@ breakpoint_changed (struct breakpoint *b)
annotate_breakpoints_invalid ();
}
-void _initialize_annotate ();
-void
-_initialize_annotate ()
+INIT_GDB_FILE (annotate)
{
gdb::observers::breakpoint_created.attach (breakpoint_changed, "annotate");
gdb::observers::breakpoint_deleted.attach (breakpoint_changed, "annotate");
diff --git a/gdb/annotate.h b/gdb/annotate.h
index 04c1ad8..0f394f5 100644
--- a/gdb/annotate.h
+++ b/gdb/annotate.h
@@ -1,5 +1,5 @@
/* Annotation routines for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arc-linux-nat.c b/gdb/arc-linux-nat.c
index 66f0000..75fc4b7 100644
--- a/gdb/arc-linux-nat.c
+++ b/gdb/arc-linux-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux ARC.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -309,9 +309,7 @@ ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
}
/* Suppress warning from -Wmissing-prototypes. */
-void _initialize_arc_linux_nat ();
-void
-_initialize_arc_linux_nat ()
+INIT_GDB_FILE (arc_linux_nat)
{
/* Register the target. */
linux_target = &the_arc_linux_nat_target;
diff --git a/gdb/arc-linux-tdep.c b/gdb/arc-linux-tdep.c
index 69980f9..6a4f4b1 100644
--- a/gdb/arc-linux-tdep.c
+++ b/gdb/arc-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target dependent code for GNU/Linux ARC.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -19,6 +19,7 @@
/* GDB header files. */
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
#include "objfiles.h"
#include "opcode/arc.h"
#include "osabi.h"
@@ -727,7 +728,7 @@ arc_linux_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
arc_linux_sw_breakpoint_from_kind);
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
- set_gdbarch_software_single_step (gdbarch, arc_linux_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, arc_linux_software_single_step);
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
set_gdbarch_skip_solib_resolver (gdbarch, arc_linux_skip_solib_resolver);
set_gdbarch_iterate_over_regset_sections
@@ -736,15 +737,10 @@ arc_linux_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU/Linux uses SVR4-style shared libraries, with 32-bit ints, longs
and pointers (ILP32). */
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
}
-/* Suppress warning from -Wmissing-prototypes. */
-extern initialize_file_ftype _initialize_arc_linux_tdep;
-
-void
-_initialize_arc_linux_tdep ()
+INIT_GDB_FILE (arc_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_arc, 0, GDB_OSABI_LINUX,
arc_linux_init_osabi);
diff --git a/gdb/arc-linux-tdep.h b/gdb/arc-linux-tdep.h
index 9fe4116..8d142ef 100644
--- a/gdb/arc-linux-tdep.h
+++ b/gdb/arc-linux-tdep.h
@@ -1,6 +1,6 @@
/* Target dependent code for GNU/Linux ARC.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arc-newlib-tdep.c b/gdb/arc-newlib-tdep.c
index dbc0961..9a6f7a8 100644
--- a/gdb/arc-newlib-tdep.c
+++ b/gdb/arc-newlib-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Newlib ARC.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
Contributed by Synopsys Inc.
This file is part of GDB.
@@ -58,9 +58,7 @@ arc_newlib_osabi_sniffer (bfd *abfd)
return GDB_OSABI_UNKNOWN;
}
-void _initialize_arc_newlib_tdep ();
-void
-_initialize_arc_newlib_tdep ()
+INIT_GDB_FILE (arc_newlib_tdep)
{
gdbarch_register_osabi_sniffer (bfd_arch_arc, bfd_target_elf_flavour,
arc_newlib_osabi_sniffer);
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index d9fafc4..f5ae11c 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -1,6 +1,6 @@
/* Target dependent code for ARC architecture, for GDB.
- Copyright 2005-2024 Free Software Foundation, Inc.
+ Copyright 2005-2025 Free Software Foundation, Inc.
Contributed by Synopsys Inc.
This file is part of GDB.
@@ -2458,9 +2458,7 @@ dump_arc_instruction_command (const char *args, int from_tty)
arc_insn_dump (insn);
}
-void _initialize_arc_tdep ();
-void
-_initialize_arc_tdep ()
+INIT_GDB_FILE (arc_tdep)
{
gdbarch_register (bfd_arch_arc, arc_gdbarch_init, arc_dump_tdep);
diff --git a/gdb/arc-tdep.h b/gdb/arc-tdep.h
index 86a483d..0343108 100644
--- a/gdb/arc-tdep.h
+++ b/gdb/arc-tdep.h
@@ -1,6 +1,6 @@
/* Target dependent code for ARC architecture, for GDB.
- Copyright 2005-2024 Free Software Foundation, Inc.
+ Copyright 2005-2025 Free Software Foundation, Inc.
Contributed by Synopsys Inc.
This file is part of GDB.
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 3cc6d99..3776945 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -1,6 +1,6 @@
/* Dynamic architecture support for GDB, the GNU debugger.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -48,7 +48,7 @@
bool
default_displaced_step_hw_singlestep (struct gdbarch *gdbarch)
{
- return !gdbarch_software_single_step_p (gdbarch);
+ return !gdbarch_get_next_pcs_p (gdbarch);
}
CORE_ADDR
@@ -592,7 +592,7 @@ gdbarch_update_p (inferior *inf, struct gdbarch_info info)
info.abfd = inf->pspace->exec_bfd ();
if (info.abfd == NULL)
- info.abfd = inf->pspace->core_bfd ();
+ info.abfd = get_inferior_core_bfd (inf);
/* Check for the current target description. */
if (info.target_desc == NULL)
@@ -1218,6 +1218,16 @@ default_gdbarch_return_value
readbuf, writebuf);
}
+/* See arch-utils.h. */
+
+std::optional<CORE_ADDR>
+default_get_shadow_stack_pointer (gdbarch *gdbarch, regcache *regcache,
+ bool &shadow_stack_enabled)
+{
+ shadow_stack_enabled = false;
+ return {};
+}
+
obstack *gdbarch_obstack (gdbarch *arch)
{
return &arch->obstack;
@@ -1525,9 +1535,7 @@ core_file_exec_context::environment () const
return e;
}
-void _initialize_gdbarch_utils ();
-void
-_initialize_gdbarch_utils ()
+INIT_GDB_FILE (gdbarch_utils)
{
add_setshow_enum_cmd ("endian", class_support,
endian_enum, &set_endian_string,
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index d27cc1d..14a84b7 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -1,6 +1,6 @@
/* Dynamic architecture support for GDB, the GNU debugger.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -414,4 +414,9 @@ extern enum return_value_convention default_gdbarch_return_value
struct regcache *regcache, struct value **read_value,
const gdb_byte *writebuf);
+/* Default implementation of gdbarch default_get_shadow_stack_pointer
+ method. */
+extern std::optional<CORE_ADDR> default_get_shadow_stack_pointer
+ (gdbarch *gdbarch, regcache *regcache, bool &shadow_stack_enabled);
+
#endif /* GDB_ARCH_UTILS_H */
diff --git a/gdb/arch/aarch32.c b/gdb/arch/aarch32.c
index ead368f..9ae69fd 100644
--- a/gdb/arch/aarch32.c
+++ b/gdb/arch/aarch32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/aarch32.h b/gdb/arch/aarch32.h
index f3e70af..7dd43f8 100644
--- a/gdb/arch/aarch32.h
+++ b/gdb/arch/aarch32.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/aarch64-gcs-linux.h b/gdb/arch/aarch64-gcs-linux.h
new file mode 100644
index 0000000..018ca37
--- /dev/null
+++ b/gdb/arch/aarch64-gcs-linux.h
@@ -0,0 +1,44 @@
+/* Common Linux target-dependent definitions for AArch64 GCS
+
+ Copyright (C) 2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef GDB_ARCH_AARCH64_GCS_LINUX_H
+#define GDB_ARCH_AARCH64_GCS_LINUX_H
+
+#include <stdint.h>
+
+/* Feature check for Guarded Control Stack. */
+#ifndef HWCAP_GCS
+#define HWCAP_GCS (1ULL << 32)
+#endif
+
+/* Make sure we only define these if the kernel header doesn't. */
+#ifndef GCS_MAGIC
+
+/* GCS state (NT_ARM_GCS). */
+
+struct user_gcs
+{
+ uint64_t features_enabled;
+ uint64_t features_locked;
+ uint64_t gcspr_el0;
+};
+
+#endif /* GCS_MAGIC */
+
+#endif /* GDB_ARCH_AARCH64_GCS_LINUX_H */
diff --git a/gdb/arch/aarch64-insn.c b/gdb/arch/aarch64-insn.c
index 3caef45..4be15ab 100644
--- a/gdb/arch/aarch64-insn.c
+++ b/gdb/arch/aarch64-insn.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.
diff --git a/gdb/arch/aarch64-insn.h b/gdb/arch/aarch64-insn.h
index bd3a85f..f2b9d9c 100644
--- a/gdb/arch/aarch64-insn.h
+++ b/gdb/arch/aarch64-insn.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.
diff --git a/gdb/arch/aarch64-mte-linux.c b/gdb/arch/aarch64-mte-linux.c
index 49426d7..9f433b0 100644
--- a/gdb/arch/aarch64-mte-linux.c
+++ b/gdb/arch/aarch64-mte-linux.c
@@ -1,6 +1,6 @@
/* Common Linux target-dependent functionality for AArch64 MTE
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/aarch64-mte-linux.h b/gdb/arch/aarch64-mte-linux.h
index f933729..a4f55c5 100644
--- a/gdb/arch/aarch64-mte-linux.h
+++ b/gdb/arch/aarch64-mte-linux.h
@@ -1,6 +1,6 @@
/* Common Linux target-dependent definitions for AArch64 MTE
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/aarch64-mte.c b/gdb/arch/aarch64-mte.c
index 908e12c..3fd0b61 100644
--- a/gdb/arch/aarch64-mte.c
+++ b/gdb/arch/aarch64-mte.c
@@ -1,6 +1,6 @@
/* Common AArch64 functionality for MTE
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/aarch64-mte.h b/gdb/arch/aarch64-mte.h
index 0b4f4a3..ec495f0 100644
--- a/gdb/arch/aarch64-mte.h
+++ b/gdb/arch/aarch64-mte.h
@@ -1,6 +1,6 @@
/* Common AArch64 definitions for MTE
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/aarch64-scalable-linux.c b/gdb/arch/aarch64-scalable-linux.c
index 485d77e..110acf0 100644
--- a/gdb/arch/aarch64-scalable-linux.c
+++ b/gdb/arch/aarch64-scalable-linux.c
@@ -1,7 +1,7 @@
/* Common Linux arch-specific functionality for AArch64 scalable
extensions: SVE and SME.
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/aarch64-scalable-linux.h b/gdb/arch/aarch64-scalable-linux.h
index 886f4a2..a4bfcd8 100644
--- a/gdb/arch/aarch64-scalable-linux.h
+++ b/gdb/arch/aarch64-scalable-linux.h
@@ -1,7 +1,7 @@
/* Common AArch64 Linux arch-specific definitions for the scalable
extensions: SVE and SME.
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/aarch64.c b/gdb/arch/aarch64.c
index 5526aa1..dff2bc1 100644
--- a/gdb/arch/aarch64.c
+++ b/gdb/arch/aarch64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -26,6 +26,8 @@
#include "../features/aarch64-sme.c"
#include "../features/aarch64-sme2.c"
#include "../features/aarch64-tls.c"
+#include "../features/aarch64-gcs.c"
+#include "../features/aarch64-gcs-linux.c"
/* See arch/aarch64.h. */
@@ -65,6 +67,12 @@ aarch64_create_target_description (const aarch64_features &features)
if (features.sme2)
regnum = create_feature_aarch64_sme2 (tdesc.get (), regnum);
+ if (features.gcs)
+ regnum = create_feature_aarch64_gcs (tdesc.get (), regnum);
+
+ if (features.gcs_linux)
+ regnum = create_feature_aarch64_gcs_linux (tdesc.get (), regnum);
+
return tdesc.release ();
}
diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h
index f45a0e2..0fcdba7 100644
--- a/gdb/arch/aarch64.h
+++ b/gdb/arch/aarch64.h
@@ -1,6 +1,6 @@
/* Common target-dependent functionality for AArch64.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -51,6 +51,12 @@ struct aarch64_features
/* Whether SME2 is supported. */
bool sme2 = false;
+
+ /* Whether Guarded Control Stack is supported. */
+ bool gcs = false;
+
+ /* Whether Guarded Control Stack Linux features are supported. */
+ bool gcs_linux = false;
};
inline bool operator==(const aarch64_features &lhs, const aarch64_features &rhs)
@@ -60,7 +66,9 @@ inline bool operator==(const aarch64_features &lhs, const aarch64_features &rhs)
&& lhs.mte == rhs.mte
&& lhs.tls == rhs.tls
&& lhs.svq == rhs.svq
- && lhs.sme2 == rhs.sme2;
+ && lhs.sme2 == rhs.sme2
+ && lhs.gcs == rhs.gcs
+ && lhs.gcs_linux == rhs.gcs_linux;
}
namespace std
@@ -86,6 +94,10 @@ namespace std
/* SME2 feature. */
h = h << 1 | features.sme2;
+
+ h = h << 1 | features.gcs;
+ h = h << 1 | features.gcs_linux;
+
return h;
}
};
diff --git a/gdb/arch/amd64-linux-tdesc.c b/gdb/arch/amd64-linux-tdesc.c
index e9c4a99..8796662 100644
--- a/gdb/arch/amd64-linux-tdesc.c
+++ b/gdb/arch/amd64-linux-tdesc.c
@@ -1,6 +1,6 @@
/* Target description related code for GNU/Linux x86-64.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -26,34 +26,35 @@
/* See arch/amd64-linux-tdesc.h. */
const struct target_desc *
-amd64_linux_read_description (uint64_t xcr0, bool is_x32)
+amd64_linux_read_description (uint64_t xstate_bv, bool is_x32)
{
/* The type used for the amd64 and x32 target description caches. */
using tdesc_cache_type = std::unordered_map<uint64_t, const target_desc_up>;
/* Caches for the previously seen amd64 and x32 target descriptions,
- indexed by the xcr0 value that created the target description. These
- need to be static within this function to ensure they are initialised
- before first use. */
+ indexed by the xstate_bv value that created the target
+ description. These need to be static within this function to ensure
+ they are initialised before first use. */
static tdesc_cache_type amd64_tdesc_cache, x32_tdesc_cache;
tdesc_cache_type &tdesc_cache = is_x32 ? x32_tdesc_cache : amd64_tdesc_cache;
- /* Only some bits are checked when creating a tdesc, but the XCR0 value
- contains other feature bits that are not relevant for tdesc creation.
- When indexing into the TDESC_CACHE we need to use a consistent xcr0
- value otherwise we might fail to find an existing tdesc which has the
- same set of relevant bits set. */
- xcr0 &= is_x32
- ? x86_linux_x32_xcr0_feature_mask ()
- : x86_linux_amd64_xcr0_feature_mask ();
+ /* Only some bits are checked when creating a tdesc, but the
+ xstate_bv value contains other feature bits that are not
+ relevant for tdesc creation.
+ When indexing into the TDESC_CACHE we need to use a consistent
+ xstate_bv value otherwise we might fail to find an existing
+ tdesc which has the same set of relevant bits set. */
+ xstate_bv &= is_x32
+ ? x86_linux_x32_xstate_bv_feature_mask ()
+ : x86_linux_amd64_xstate_bv_feature_mask ();
- const auto it = tdesc_cache.find (xcr0);
+ const auto it = tdesc_cache.find (xstate_bv);
if (it != tdesc_cache.end ())
return it->second.get ();
/* Create the previously unseen target description. */
- target_desc_up tdesc (amd64_create_target_description (xcr0, is_x32,
+ target_desc_up tdesc (amd64_create_target_description (xstate_bv, is_x32,
true, true));
x86_linux_post_init_tdesc (tdesc.get (), true);
@@ -61,6 +62,6 @@ amd64_linux_read_description (uint64_t xcr0, bool is_x32)
target_desc_up. This is safe as the cache (and the pointers contained
within it) are not deleted until GDB exits. */
target_desc *ptr = tdesc.get ();
- tdesc_cache.emplace (xcr0, std::move (tdesc));
+ tdesc_cache.emplace (xstate_bv, std::move (tdesc));
return ptr;
}
diff --git a/gdb/arch/amd64-linux-tdesc.h b/gdb/arch/amd64-linux-tdesc.h
index f6a4248..4c0c591 100644
--- a/gdb/arch/amd64-linux-tdesc.h
+++ b/gdb/arch/amd64-linux-tdesc.h
@@ -1,6 +1,6 @@
/* Target description related code for GNU/Linux x86-64.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,9 +22,10 @@
struct target_desc;
-/* Return the AMD64 target descriptions corresponding to XCR0 and IS_X32. */
+/* Return the AMD64 target descriptions corresponding to XSTATE_BV and
+ IS_X32. */
-extern const target_desc *amd64_linux_read_description (uint64_t xcr0,
- bool is_x32);
+extern const target_desc *amd64_linux_read_description
+ (uint64_t xstate_bv, bool is_x32);
#endif /* GDB_ARCH_AMD64_LINUX_TDESC_H */
diff --git a/gdb/arch/amd64.c b/gdb/arch/amd64.c
index 5fc9947..9fbe802 100644
--- a/gdb/arch/amd64.c
+++ b/gdb/arch/amd64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -28,16 +28,15 @@
#include "../features/i386/64bit-sse.c"
#include "../features/i386/pkeys.c"
+#include "../features/i386/64bit-ssp.c"
+#include "../features/i386/32bit-ssp.c"
#include "../features/i386/x32-core.c"
-/* Create amd64 target descriptions according to XCR0. If IS_X32 is
- true, create the x32 ones. If IS_LINUX is true, create target
- descriptions for Linux. If SEGMENTS is true, then include
- the "org.gnu.gdb.i386.segments" feature registers. */
+/* See arch/amd64.h. */
target_desc *
-amd64_create_target_description (uint64_t xcr0, bool is_x32, bool is_linux,
- bool segments)
+amd64_create_target_description (uint64_t xstate_bv, bool is_x32,
+ bool is_linux, bool segments)
{
target_desc_up tdesc = allocate_target_description ();
@@ -62,14 +61,22 @@ amd64_create_target_description (uint64_t xcr0, bool is_x32, bool is_linux,
if (segments)
regnum = create_feature_i386_64bit_segments (tdesc.get (), regnum);
- if (xcr0 & X86_XSTATE_AVX)
+ if (xstate_bv & X86_XSTATE_AVX)
regnum = create_feature_i386_64bit_avx (tdesc.get (), regnum);
- if (xcr0 & X86_XSTATE_AVX512)
+ if (xstate_bv & X86_XSTATE_AVX512)
regnum = create_feature_i386_64bit_avx512 (tdesc.get (), regnum);
- if (xcr0 & X86_XSTATE_PKRU)
+ if (xstate_bv & X86_XSTATE_PKRU)
regnum = create_feature_i386_pkeys (tdesc.get (), regnum);
+ if (xstate_bv & X86_XSTATE_CET_U)
+ {
+ if (!is_x32)
+ regnum = create_feature_i386_64bit_ssp (tdesc.get (), regnum);
+ else
+ regnum = create_feature_i386_32bit_ssp (tdesc.get (), regnum);
+ }
+
return tdesc.release ();
}
diff --git a/gdb/arch/amd64.h b/gdb/arch/amd64.h
index 1c7a2bb..60c17eb 100644
--- a/gdb/arch/amd64.h
+++ b/gdb/arch/amd64.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,7 +21,13 @@
#include "gdbsupport/tdesc.h"
#include <stdint.h>
-target_desc *amd64_create_target_description (uint64_t xcr0, bool is_x32,
- bool is_linux, bool segments);
+/* Create amd64 target descriptions according to XSTATE_BV. If
+ IS_X32 is true, create the x32 ones. If IS_LINUX is true, create
+ target descriptions for Linux. If SEGMENTS is true, then include
+ the "org.gnu.gdb.i386.segments" feature registers. */
+
+target_desc *amd64_create_target_description (uint64_t xstate_bv,
+ bool is_x32, bool is_linux,
+ bool segments);
#endif /* GDB_ARCH_AMD64_H */
diff --git a/gdb/arch/arc.c b/gdb/arch/arc.c
index e807b60..b7de1da 100644
--- a/gdb/arch/arc.c
+++ b/gdb/arch/arc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,7 +17,6 @@
#include "arc.h"
-#include <stdlib.h>
#include <unordered_map>
#include <string>
diff --git a/gdb/arch/arc.h b/gdb/arch/arc.h
index 887431e..f0dbbb8 100644
--- a/gdb/arch/arc.h
+++ b/gdb/arch/arc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/arm-get-next-pcs.c b/gdb/arch/arm-get-next-pcs.c
index 6c18236..82b077c 100644
--- a/gdb/arch/arm-get-next-pcs.c
+++ b/gdb/arch/arm-get-next-pcs.c
@@ -1,6 +1,6 @@
/* Common code for ARM software single stepping support.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -39,10 +39,92 @@ arm_get_next_pcs_ctor (struct arm_get_next_pcs *self,
self->regcache = regcache;
}
-/* Checks for an atomic sequence of instructions beginning with a LDREX{,B,H,D}
- instruction and ending with a STREX{,B,H,D} instruction. If such a sequence
- is found, attempt to step through it. The end of the sequence address is
- added to the next_pcs list. */
+/* Return true if INSN matches one of the <value,mask> pairs in MATCHES. */
+
+static bool
+insn_matches (uint32_t insn, gdb::array_view<const uint32_t> matches)
+{
+ gdb_assert (matches.size () % 2 == 0);
+
+ for (int i = 0; i < matches.size (); i += 2)
+ {
+ uint32_t value = matches[i];
+ uint32_t mask = matches[i + 1];
+ if ((insn & mask) == value)
+ return true;
+ }
+
+ return false;
+}
+
+/* Return true if INSN is an ldaex arm insn. */
+
+static bool
+ldaex_arm_p (uint32_t insn)
+{
+ /* Copied from arm_opcodes in opcodes/arm-dis.c. */
+ const uint32_t matches_ldaex_arm[] = {
+ 0x01900e9f, 0x0ff00fff, /* ldaex. */
+ 0x01b00e9f, 0x0ff00fff, /* ldaexd. */
+ 0x01d00e9f, 0x0ff00fff, /* ldaexb. */
+ 0x01f00e9f, 0x0ff00fff /* ldaexh. */
+ };
+
+ return insn_matches (insn, matches_ldaex_arm);
+}
+
+/* Return true if INSN is an ldaex thumb32 insn. */
+
+static bool
+ldaex_thumb32_p (uint32_t insn)
+{
+ /* Copied from thumb32_opcodes in opcodes/arm-dis.c. */
+ const uint32_t matches_ldaex_thumb32[] = {
+ 0xe8d00fcf, 0xfff00fff, /* ldaexb. */
+ 0xe8d00fdf, 0xfff00fff, /* ldaexh. */
+ 0xe8d00fef, 0xfff00fff, /* ldaex. */
+ 0xe8d000ff, 0xfff000ff /* ldaexd. */
+ };
+
+ return insn_matches (insn, matches_ldaex_thumb32);
+}
+
+/* Return true if INSN is an stlex arm insn. */
+
+static bool
+stlex_arm_p (uint32_t insn)
+{
+ /* Copied from arm_opcodes in opcodes/arm-dis.c. */
+ const uint32_t matches_stlex_arm[] = {
+ 0x01800e90, 0x0ff00ff0, /* stlex. */
+ 0x01a00e90, 0x0ff00ff0, /* stlexd. */
+ 0x01c00e90, 0x0ff00ff0, /* stlexb. */
+ 0x01e00e90, 0x0ff00ff0, /* stlexh. */
+ };
+
+ return insn_matches (insn, matches_stlex_arm);
+}
+
+/* Return true if INSN is an stlex thumb32 insn. */
+
+static bool
+stlex_thumb32_p (uint32_t insn)
+{
+ /* Copied from thumb32_opcodes in opcodes/arm-dis.c. */
+ const uint32_t matches_stlex_thumb32[] = {
+ 0xe8c00fc0, 0xfff00ff0, /* stlexb. */
+ 0xe8c00fd0, 0xfff00ff0, /* stlexh. */
+ 0xe8c00fe0, 0xfff00ff0, /* stlex. */
+ 0xe8c000f0, 0xfff000f0, /* stlexd. */
+ };
+
+ return insn_matches (insn, matches_stlex_thumb32);
+}
+
+/* Checks for an atomic sequence of instructions beginning with an
+ LD[AR]EX{,B,H,D} instruction and ending with a ST[LR]EX{,B,H,D} instruction.
+ If such a sequence is found, attempt to step through it. The end of the
+ sequence address is added to the next_pcs list. */
static std::vector<CORE_ADDR>
thumb_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
@@ -64,18 +146,22 @@ thumb_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
if (itstate & 0x0f)
return {};
- /* Assume all atomic sequences start with a ldrex{,b,h,d} instruction. */
insn1 = self->ops->read_mem_uint (loc, 2, byte_order_for_code);
-
loc += 2;
+
if (thumb_insn_size (insn1) != 4)
return {};
insn2 = self->ops->read_mem_uint (loc, 2, byte_order_for_code);
-
loc += 2;
+
+ uint32_t insn = (uint32_t)insn2 | ((uint32_t)insn1 << 16);
+
+ /* Assume all atomic sequences start with an ld[ar]ex{,b,h,d}
+ instruction. */
if (!((insn1 & 0xfff0) == 0xe850
- || ((insn1 & 0xfff0) == 0xe8d0 && (insn2 & 0x00c0) == 0x0040)))
+ || ((insn1 & 0xfff0) == 0xe8d0 && (insn2 & 0x00c0) == 0x0040)
+ || ldaex_thumb32_p (insn)))
return {};
/* Assume that no atomic sequence is longer than "atomic_sequence_length"
@@ -110,9 +196,10 @@ thumb_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
else
{
insn2 = self->ops->read_mem_uint (loc, 2, byte_order_for_code);
-
loc += 2;
+ insn = (uint32_t)insn2 | ((uint32_t)insn1 << 16);
+
/* Assume that there is at most one conditional branch in the
atomic sequence. If a conditional branch is found, put a
breakpoint in its destination address. */
@@ -147,9 +234,10 @@ thumb_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
else if (thumb2_instruction_changes_pc (insn1, insn2))
return {};
- /* If we find a strex{,b,h,d}, we're done. */
+ /* If we find a st[lr]ex{,b,h,d}, we're done. */
if ((insn1 & 0xfff0) == 0xe840
- || ((insn1 & 0xfff0) == 0xe8c0 && (insn2 & 0x00c0) == 0x0040))
+ || ((insn1 & 0xfff0) == 0xe8c0 && (insn2 & 0x00c0) == 0x0040)
+ || stlex_thumb32_p (insn))
break;
}
}
@@ -177,10 +265,10 @@ thumb_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
return next_pcs;
}
-/* Checks for an atomic sequence of instructions beginning with a LDREX{,B,H,D}
- instruction and ending with a STREX{,B,H,D} instruction. If such a sequence
- is found, attempt to step through it. The end of the sequence address is
- added to the next_pcs list. */
+/* Checks for an atomic sequence of instructions beginning with an
+ LD[AR]EX{,B,H,D} instruction and ending with a ST[LR]EX{,B,H,D} instruction.
+ If such a sequence is found, attempt to step through it. The end of the
+ sequence address is added to the next_pcs list. */
static std::vector<CORE_ADDR>
arm_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
@@ -195,13 +283,16 @@ arm_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
int last_breakpoint = 0; /* Defaults to 0 (no breakpoints placed). */
const int atomic_sequence_length = 16; /* Instruction sequence length. */
- /* Assume all atomic sequences start with a ldrex{,b,h,d} instruction.
- Note that we do not currently support conditionally executed atomic
- instructions. */
insn = self->ops->read_mem_uint (loc, 4, byte_order_for_code);
-
loc += 4;
- if ((insn & 0xff9000f0) != 0xe1900090)
+
+ /* Currently we do not support conditionally executed atomic instructions. */
+ if (!insn_condition_always_true (insn))
+ return {};
+
+ /* Assume all atomic sequences start with an ld[ar]ex{,b,h,d} instruction. */
+ if (!((insn & 0x0f9000f0) == 0x01900090
+ || ldaex_arm_p (insn)))
return {};
/* Assume that no atomic sequence is longer than "atomic_sequence_length"
@@ -231,8 +322,14 @@ arm_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
else if (arm_instruction_changes_pc (insn))
return {};
- /* If we find a strex{,b,h,d}, we're done. */
- if ((insn & 0xff9000f0) == 0xe1800090)
+ /* Currently we do not support conditionally executed atomic
+ instructions. */
+ if (!insn_condition_always_true (insn))
+ return {};
+
+ /* If we find a st[lr]ex{,b,h,d}, we're done. */
+ if ((insn & 0x0f9000f0) == 0x01800090
+ || stlex_arm_p (insn))
break;
}
diff --git a/gdb/arch/arm-get-next-pcs.h b/gdb/arch/arm-get-next-pcs.h
index 7680373..e6ecbe9 100644
--- a/gdb/arch/arm-get-next-pcs.h
+++ b/gdb/arch/arm-get-next-pcs.h
@@ -1,6 +1,6 @@
/* Common code for ARM software single stepping support.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/arm-linux.c b/gdb/arch/arm-linux.c
index 246bade..18918ec 100644
--- a/gdb/arch/arm-linux.c
+++ b/gdb/arch/arm-linux.c
@@ -1,6 +1,6 @@
/* Common target dependent code for GNU/Linux on ARM systems.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/arm-linux.h b/gdb/arch/arm-linux.h
index 39c73c3..db8193b 100644
--- a/gdb/arch/arm-linux.h
+++ b/gdb/arch/arm-linux.h
@@ -1,6 +1,6 @@
/* Common target dependent code for GNU/Linux on ARM systems.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/arm.c b/gdb/arch/arm.c
index f1c292b..1843dbe 100644
--- a/gdb/arch/arm.c
+++ b/gdb/arch/arm.c
@@ -1,6 +1,6 @@
/* Common target dependent code for GDB on ARM systems.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -46,7 +46,7 @@ thumb_insn_size (unsigned short inst1)
int
condition_true (unsigned long cond, unsigned long status_reg)
{
- if (cond == INST_AL || cond == INST_NV)
+ if (condition_always_true (cond))
return 1;
switch (cond)
diff --git a/gdb/arch/arm.h b/gdb/arch/arm.h
index 7738d9c..d9c7503 100644
--- a/gdb/arch/arm.h
+++ b/gdb/arch/arm.h
@@ -1,5 +1,5 @@
/* Common target dependent code for GDB on ARM systems.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -194,6 +194,23 @@ struct reg_buffer_common;
first halfword is INST1. */
int thumb_insn_size (unsigned short inst1);
+/* Returns true if COND always evaluates to true. */
+
+static inline bool
+condition_always_true (unsigned long cond)
+{
+ return cond == INST_AL || cond == INST_NV;
+}
+
+/* Returns true if cond of INSN always evaluates to true. */
+
+static inline bool
+insn_condition_always_true (uint32_t insn)
+{
+ unsigned long cond = bits (insn, 28, 31);
+ return condition_always_true (cond);
+}
+
/* Returns true if the condition evaluates to true. */
int condition_true (unsigned long cond, unsigned long status_reg);
diff --git a/gdb/arch/csky.c b/gdb/arch/csky.c
index 32df2ad..64ead0d 100644
--- a/gdb/arch/csky.c
+++ b/gdb/arch/csky.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2022-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/csky.h b/gdb/arch/csky.h
index 67b2f17..9bcb554b 100644
--- a/gdb/arch/csky.h
+++ b/gdb/arch/csky.h
@@ -1,6 +1,6 @@
/* Common target-dependent functionality for CSKY
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/i386-linux-tdesc.c b/gdb/arch/i386-linux-tdesc.c
index 9f12e59..bd736eb 100644
--- a/gdb/arch/i386-linux-tdesc.c
+++ b/gdb/arch/i386-linux-tdesc.c
@@ -1,6 +1,6 @@
/* Target description related code for GNU/Linux i386.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -25,32 +25,35 @@
/* See arch/i386-linux-tdesc.h. */
const target_desc *
-i386_linux_read_description (uint64_t xcr0)
+i386_linux_read_description (uint64_t xstate_bv)
{
- /* Cache of previously seen i386 target descriptions, indexed by the xcr0
- value that created the target description. This needs to be static
- within this function to ensure it is initialised before first use. */
+ /* Cache of previously seen i386 target descriptions, indexed by the
+ xstate_bv value that created the target description. This
+ needs to be static within this function to ensure it is initialised
+ before first use. */
static std::unordered_map<uint64_t, const target_desc_up> i386_tdesc_cache;
- /* Only some bits are checked when creating a tdesc, but the XCR0 value
- contains other feature bits that are not relevant for tdesc creation.
- When indexing into the I386_TDESC_CACHE we need to use a consistent
- xcr0 value otherwise we might fail to find an existing tdesc which has
- the same set of relevant bits set. */
- xcr0 &= x86_linux_i386_xcr0_feature_mask ();
+ /* Only some bits are checked when creating a tdesc, but the
+ XSTATE_BV value contains other feature bits that are not relevant
+ for tdesc creation. When indexing into the I386_TDESC_CACHE
+ we need to use a consistent XSTATE_BV value otherwise we might fail
+ to find an existing tdesc which has the same set of relevant bits
+ set. */
+ xstate_bv &= x86_linux_i386_xstate_bv_feature_mask ();
- const auto it = i386_tdesc_cache.find (xcr0);
+ const auto it = i386_tdesc_cache.find (xstate_bv);
if (it != i386_tdesc_cache.end ())
return it->second.get ();
/* Create the previously unseen target description. */
- target_desc_up tdesc (i386_create_target_description (xcr0, true, false));
+ target_desc_up tdesc
+ (i386_create_target_description (xstate_bv, true, false));
x86_linux_post_init_tdesc (tdesc.get (), false);
/* Add to the cache, and return a pointer borrowed from the
target_desc_up. This is safe as the cache (and the pointers contained
within it) are not deleted until GDB exits. */
target_desc *ptr = tdesc.get ();
- i386_tdesc_cache.emplace (xcr0, std::move (tdesc));
+ i386_tdesc_cache.emplace (xstate_bv, std::move (tdesc));
return ptr;
}
diff --git a/gdb/arch/i386-linux-tdesc.h b/gdb/arch/i386-linux-tdesc.h
index 4ecd674..1cf2931 100644
--- a/gdb/arch/i386-linux-tdesc.h
+++ b/gdb/arch/i386-linux-tdesc.h
@@ -1,6 +1,6 @@
/* Target description related code for GNU/Linux i386.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,8 +22,9 @@
struct target_desc;
-/* Return the i386 target description corresponding to XCR0. */
+/* Return the i386 target description corresponding to XSTATE_BV. */
-extern const struct target_desc *i386_linux_read_description (uint64_t xcr0);
+extern const struct target_desc *i386_linux_read_description
+ (uint64_t xstate_bv);
#endif /* GDB_ARCH_I386_LINUX_TDESC_H */
diff --git a/gdb/arch/i386.c b/gdb/arch/i386.c
index 2072eae..4ec4f10 100644
--- a/gdb/arch/i386.c
+++ b/gdb/arch/i386.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -28,11 +28,13 @@
#include "../features/i386/32bit-avx512.c"
#include "../features/i386/32bit-segments.c"
#include "../features/i386/pkeys.c"
+#include "../features/i386/32bit-ssp.c"
-/* Create i386 target descriptions according to XCR0. */
+/* See arch/i386.h. */
target_desc *
-i386_create_target_description (uint64_t xcr0, bool is_linux, bool segments)
+i386_create_target_description (uint64_t xstate_bv, bool is_linux,
+ bool segments)
{
target_desc_up tdesc = allocate_target_description ();
@@ -44,10 +46,10 @@ i386_create_target_description (uint64_t xcr0, bool is_linux, bool segments)
long regnum = 0;
- if (xcr0 & X86_XSTATE_X87)
+ if (xstate_bv & X86_XSTATE_X87)
regnum = create_feature_i386_32bit_core (tdesc.get (), regnum);
- if (xcr0 & X86_XSTATE_SSE)
+ if (xstate_bv & X86_XSTATE_SSE)
regnum = create_feature_i386_32bit_sse (tdesc.get (), regnum);
if (is_linux)
@@ -56,14 +58,17 @@ i386_create_target_description (uint64_t xcr0, bool is_linux, bool segments)
if (segments)
regnum = create_feature_i386_32bit_segments (tdesc.get (), regnum);
- if (xcr0 & X86_XSTATE_AVX)
+ if (xstate_bv & X86_XSTATE_AVX)
regnum = create_feature_i386_32bit_avx (tdesc.get (), regnum);
- if (xcr0 & X86_XSTATE_AVX512)
+ if (xstate_bv & X86_XSTATE_AVX512)
regnum = create_feature_i386_32bit_avx512 (tdesc.get (), regnum);
- if (xcr0 & X86_XSTATE_PKRU)
+ if (xstate_bv & X86_XSTATE_PKRU)
regnum = create_feature_i386_pkeys (tdesc.get (), regnum);
+ if (xstate_bv & X86_XSTATE_CET_U)
+ regnum = create_feature_i386_32bit_ssp (tdesc.get (), regnum);
+
return tdesc.release ();
}
diff --git a/gdb/arch/i386.h b/gdb/arch/i386.h
index 1b5cc6e..91a581f 100644
--- a/gdb/arch/i386.h
+++ b/gdb/arch/i386.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,7 +21,12 @@
#include "gdbsupport/tdesc.h"
#include <stdint.h>
-target_desc *i386_create_target_description (uint64_t xcr0, bool is_linux,
+/* Create i386 target descriptions according to XSTATE_BV. If IS_LINUX is
+ true, create target descriptions for Linux. If SEGMENTS is true, then
+ include the "org.gnu.gdb.i386.segments" feature registers. */
+
+target_desc *i386_create_target_description (uint64_t xstate_bv,
+ bool is_linux,
bool segments);
#endif /* GDB_ARCH_I386_H */
diff --git a/gdb/arch/loongarch-insn.h b/gdb/arch/loongarch-insn.h
index afab10a..c94c082 100644
--- a/gdb/arch/loongarch-insn.h
+++ b/gdb/arch/loongarch-insn.h
@@ -1,6 +1,6 @@
/* Target-dependent code for LoongArch
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/arch/loongarch-syscall.h b/gdb/arch/loongarch-syscall.h
index c6a0136..af1da4e 100644
--- a/gdb/arch/loongarch-syscall.h
+++ b/gdb/arch/loongarch-syscall.h
@@ -1,6 +1,6 @@
/* Target-dependent code for LoongArch
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/arch/loongarch.c b/gdb/arch/loongarch.c
index 04b6dfc..25e698d 100644
--- a/gdb/arch/loongarch.c
+++ b/gdb/arch/loongarch.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2022-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -16,7 +16,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "loongarch.h"
-#include <stdlib.h>
#include <unordered_map>
/* Target description features. */
diff --git a/gdb/arch/loongarch.h b/gdb/arch/loongarch.h
index 07f37d8..251099c 100644
--- a/gdb/arch/loongarch.h
+++ b/gdb/arch/loongarch.h
@@ -1,6 +1,6 @@
/* Common target-dependent functionality for LoongArch
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/ppc-linux-common.c b/gdb/arch/ppc-linux-common.c
index 0a6915c..2088b76 100644
--- a/gdb/arch/ppc-linux-common.c
+++ b/gdb/arch/ppc-linux-common.c
@@ -1,6 +1,6 @@
/* Common target dependent code for GNU/Linux on PPC systems.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/ppc-linux-common.h b/gdb/arch/ppc-linux-common.h
index 1f72b29..fd4722c 100644
--- a/gdb/arch/ppc-linux-common.h
+++ b/gdb/arch/ppc-linux-common.h
@@ -1,6 +1,6 @@
/* Common target dependent code for GNU/Linux on PPC systems.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/ppc-linux-tdesc.h b/gdb/arch/ppc-linux-tdesc.h
index bde6ba2..1ff316a 100644
--- a/gdb/arch/ppc-linux-tdesc.h
+++ b/gdb/arch/ppc-linux-tdesc.h
@@ -1,6 +1,6 @@
/* Target description declarations shared between gdb, gdbserver and IPA.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/riscv.c b/gdb/arch/riscv.c
index 9a84844..c698fa2 100644
--- a/gdb/arch/riscv.c
+++ b/gdb/arch/riscv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -16,7 +16,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "riscv.h"
-#include <stdlib.h>
#include <unordered_map>
#include "../features/riscv/32bit-cpu.c"
diff --git a/gdb/arch/riscv.h b/gdb/arch/riscv.h
index bf65b0b..bc95e72 100644
--- a/gdb/arch/riscv.h
+++ b/gdb/arch/riscv.h
@@ -1,6 +1,6 @@
/* Common target-dependent functionality for RISC-V
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/tic6x.c b/gdb/arch/tic6x.c
index b8a722b..5724305 100644
--- a/gdb/arch/tic6x.c
+++ b/gdb/arch/tic6x.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/tic6x.h b/gdb/arch/tic6x.h
index efb3282..6120892 100644
--- a/gdb/arch/tic6x.h
+++ b/gdb/arch/tic6x.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/x86-linux-tdesc-features.c b/gdb/arch/x86-linux-tdesc-features.c
index f6eb112..bc34378 100644
--- a/gdb/arch/x86-linux-tdesc-features.c
+++ b/gdb/arch/x86-linux-tdesc-features.c
@@ -1,6 +1,6 @@
/* Target description related code for GNU/Linux x86 (i386 and x86-64).
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -28,18 +28,21 @@
We want to cache target descriptions, and this is currently done in
three separate caches, one each for i386, amd64, and x32. Additionally,
- the caching we're discussing here is Linux only, and for Linux, the only
- thing that has an impact on target description creation is the xcr0
- value.
-
- In order to ensure the cache functions correctly we need to filter out
- only those xcr0 feature bits that are relevant, we can then cache target
- descriptions based on the relevant feature bits. Two xcr0 values might
- be different, but have the same relevant feature bits. In this case we
- would expect the two xcr0 values to map to the same cache entry. */
+ the caching we're discussing here is Linux only. Currently for Linux,
+ the only thing that has an impact on target description creation are
+ the supported features in xsave which are modelled by a xstate_bv
+ value, which has the same format than the state component bitmap.
+
+ In order to ensure the cache functions correctly we need to filter only
+ those xstate_bv feature bits that are relevant, we can then cache
+ target descriptions based on the relevant feature bits. Two xstate_bv
+ values might be different, but have the same relevant feature bits. In
+ this case we would expect the two xstate_bv values to map to the same
+ cache entry. */
struct x86_xstate_feature {
- /* The xstate feature mask. This is a mask against an xcr0 value. */
+ /* The xstate feature mask. This is a mask against the state component
+ bitmap. */
uint64_t feature;
/* Is this feature checked when creating an i386 target description. */
@@ -56,12 +59,13 @@ struct x86_xstate_feature {
checked when building a target description for i386, amd64, or x32.
If in the future, due to simplifications or refactoring, this table ever
- ends up with 'true' for every xcr0 feature on every target type, then this
- is an indication that this table should probably be removed, and that the
- rest of the code in this file can be simplified. */
+ ends up with 'true' for every xsave feature on every target type, then
+ this is an indication that this table should probably be removed, and
+ that the rest of the code in this file can be simplified. */
static constexpr x86_xstate_feature x86_linux_all_xstate_features[] = {
/* Feature, i386, amd64, x32. */
+ { X86_XSTATE_CET_U, false, true, true },
{ X86_XSTATE_PKRU, true, true, true },
{ X86_XSTATE_AVX512, true, true, true },
{ X86_XSTATE_AVX, true, true, true },
@@ -73,7 +77,7 @@ static constexpr x86_xstate_feature x86_linux_all_xstate_features[] = {
that are checked for when building an i386 target description. */
static constexpr uint64_t
-x86_linux_i386_xcr0_feature_mask_1 ()
+x86_linux_i386_xstate_bv_feature_mask_1 ()
{
uint64_t mask = 0;
@@ -88,7 +92,7 @@ x86_linux_i386_xcr0_feature_mask_1 ()
that are checked for when building an amd64 target description. */
static constexpr uint64_t
-x86_linux_amd64_xcr0_feature_mask_1 ()
+x86_linux_amd64_xstate_bv_feature_mask_1 ()
{
uint64_t mask = 0;
@@ -103,7 +107,7 @@ x86_linux_amd64_xcr0_feature_mask_1 ()
that are checked for when building an x32 target description. */
static constexpr uint64_t
-x86_linux_x32_xcr0_feature_mask_1 ()
+x86_linux_x32_xstate_bv_feature_mask_1 ()
{
uint64_t mask = 0;
@@ -117,25 +121,25 @@ x86_linux_x32_xcr0_feature_mask_1 ()
/* See arch/x86-linux-tdesc-features.h. */
uint64_t
-x86_linux_i386_xcr0_feature_mask ()
+x86_linux_i386_xstate_bv_feature_mask ()
{
- return x86_linux_i386_xcr0_feature_mask_1 ();
+ return x86_linux_i386_xstate_bv_feature_mask_1 ();
}
/* See arch/x86-linux-tdesc-features.h. */
uint64_t
-x86_linux_amd64_xcr0_feature_mask ()
+x86_linux_amd64_xstate_bv_feature_mask ()
{
- return x86_linux_amd64_xcr0_feature_mask_1 ();
+ return x86_linux_amd64_xstate_bv_feature_mask_1 ();
}
/* See arch/x86-linux-tdesc-features.h. */
uint64_t
-x86_linux_x32_xcr0_feature_mask ()
+x86_linux_x32_xstate_bv_feature_mask ()
{
- return x86_linux_x32_xcr0_feature_mask_1 ();
+ return x86_linux_x32_xstate_bv_feature_mask_1 ();
}
#ifdef GDBSERVER
@@ -143,7 +147,7 @@ x86_linux_x32_xcr0_feature_mask ()
/* See arch/x86-linux-tdesc-features.h. */
int
-x86_linux_xcr0_to_tdesc_idx (uint64_t xcr0)
+x86_linux_xstate_bv_to_tdesc_idx (uint64_t xstate_bv)
{
/* The following table shows which features are checked for when creating
the target descriptions (see nat/x86-linux-tdesc.c), the feature order
@@ -160,7 +164,7 @@ x86_linux_xcr0_to_tdesc_idx (uint64_t xcr0)
for (int i = 0; i < ARRAY_SIZE (x86_linux_all_xstate_features); ++i)
{
- if ((xcr0 & x86_linux_all_xstate_features[i].feature)
+ if ((xstate_bv & x86_linux_all_xstate_features[i].feature)
== x86_linux_all_xstate_features[i].feature)
idx |= (1 << i);
}
@@ -250,17 +254,17 @@ x86_linux_i386_tdesc_count ()
/* See arch/x86-linux-tdesc-features.h. */
uint64_t
-x86_linux_tdesc_idx_to_xcr0 (int idx)
+x86_linux_tdesc_idx_to_xstate_bv (int idx)
{
- uint64_t xcr0 = 0;
+ uint64_t xstate_bv = 0;
for (int i = 0; i < ARRAY_SIZE (x86_linux_all_xstate_features); ++i)
{
if ((idx & (1 << i)) != 0)
- xcr0 |= x86_linux_all_xstate_features[i].feature;
+ xstate_bv |= x86_linux_all_xstate_features[i].feature;
}
- return xcr0;
+ return xstate_bv;
}
#endif /* IN_PROCESS_AGENT */
diff --git a/gdb/arch/x86-linux-tdesc-features.h b/gdb/arch/x86-linux-tdesc-features.h
index cf8351d..bc72727 100644
--- a/gdb/arch/x86-linux-tdesc-features.h
+++ b/gdb/arch/x86-linux-tdesc-features.h
@@ -1,6 +1,6 @@
/* Target description related code for GNU/Linux x86 (i386 and x86-64).
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -27,17 +27,20 @@
the set of features which are checked for when creating the target
description for each of amd64, x32, and i386. */
-extern uint64_t x86_linux_amd64_xcr0_feature_mask ();
-extern uint64_t x86_linux_x32_xcr0_feature_mask ();
-extern uint64_t x86_linux_i386_xcr0_feature_mask ();
+extern uint64_t x86_linux_amd64_xstate_bv_feature_mask ();
+extern uint64_t x86_linux_x32_xstate_bv_feature_mask ();
+extern uint64_t x86_linux_i386_xstate_bv_feature_mask ();
#ifdef GDBSERVER
-/* Convert an xcr0 value into an integer. The integer will be passed from
- gdbserver to the in-process-agent where it will then be passed through
- x86_linux_tdesc_idx_to_xcr0 to get back the original xcr0 value. */
+/* Convert an XSTATE_BV value into an integer. XSTATE_BV has the same
+ format than the state component bitmap and does include user and
+ supervisor state components. The integer will be passed from gdbserver
+ to the in-process-agent where it will then be passed through
+ x86_linux_tdesc_idx_to_xstate_bv to get back the original value. */
-extern int x86_linux_xcr0_to_tdesc_idx (uint64_t xcr0);
+
+extern int x86_linux_xstate_bv_to_tdesc_idx (uint64_t xstate_bv);
#endif /* GDBSERVER */
@@ -51,11 +54,13 @@ extern int x86_linux_amd64_tdesc_count ();
extern int x86_linux_x32_tdesc_count ();
extern int x86_linux_i386_tdesc_count ();
-/* Convert an index number (as returned from x86_linux_xcr0_to_tdesc_idx)
- into an xcr0 value which can then be used to create a target
- description. */
+/* Convert an index number (as returned from
+ x86_linux_xstate_bv_to_tdesc_idx) into an xstate_bv value which can
+ then be used to create a target description.
+ The return mask has the same format than the state component bitmap
+ and does include user and supervisor state components. */
-extern uint64_t x86_linux_tdesc_idx_to_xcr0 (int idx);
+extern uint64_t x86_linux_tdesc_idx_to_xstate_bv (int idx);
#endif /* IN_PROCESS_AGENT */
diff --git a/gdb/arch/x86-linux-tdesc.h b/gdb/arch/x86-linux-tdesc.h
index 718060c..0de2648 100644
--- a/gdb/arch/x86-linux-tdesc.h
+++ b/gdb/arch/x86-linux-tdesc.h
@@ -1,6 +1,6 @@
/* Target description related code for GNU/Linux x86 (i386 and x86-64).
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arch/xtensa.h b/gdb/arch/xtensa.h
index 70167b3..2f5b5a0 100644
--- a/gdb/arch/xtensa.h
+++ b/gdb/arch/xtensa.h
@@ -1,6 +1,6 @@
/* Common Target-dependent code for the Xtensa port of GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arm-bsd-tdep.c b/gdb/arm-bsd-tdep.c
index 1ccabcb..567ab08 100644
--- a/gdb/arm-bsd-tdep.c
+++ b/gdb/arm-bsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for ARM BSD's.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arm-fbsd-nat.c b/gdb/arm-fbsd-nat.c
index cbe9867..e068023 100644
--- a/gdb/arm-fbsd-nat.c
+++ b/gdb/arm-fbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for FreeBSD/arm.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -104,9 +104,7 @@ arm_fbsd_nat_target::read_description ()
return desc;
}
-void _initialize_arm_fbsd_nat ();
-void
-_initialize_arm_fbsd_nat ()
+INIT_GDB_FILE (arm_fbsd_nat)
{
add_inf_child_target (&the_arm_fbsd_nat_target);
}
diff --git a/gdb/arm-fbsd-tdep.c b/gdb/arm-fbsd-tdep.c
index dfb7532..fc81818 100644
--- a/gdb/arm-fbsd-tdep.c
+++ b/gdb/arm-fbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for FreeBSD/arm.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -300,8 +300,7 @@ arm_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tramp_frame_prepend_unwinder (gdbarch, &arm_fbsd_sigframe);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
tdep->jb_pc = 24;
tdep->jb_elt_size = 4;
@@ -319,12 +318,10 @@ arm_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, arm_software_single_step);
}
-void _initialize_arm_fbsd_tdep ();
-void
-_initialize_arm_fbsd_tdep ()
+INIT_GDB_FILE (arm_fbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_FREEBSD,
arm_fbsd_init_abi);
diff --git a/gdb/arm-fbsd-tdep.h b/gdb/arm-fbsd-tdep.h
index 151f26c..cc30375 100644
--- a/gdb/arm-fbsd-tdep.h
+++ b/gdb/arm-fbsd-tdep.h
@@ -1,6 +1,6 @@
/* FreeBSD/arm target support, prototypes.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 7b4faac..dc5165e 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -1,5 +1,5 @@
/* GNU/Linux on ARM native support.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -90,8 +90,6 @@ public:
bool stopped_data_address (CORE_ADDR *) override;
- bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override;
-
const struct target_desc *read_description () override;
/* Override linux_nat_target low methods. */
@@ -714,7 +712,7 @@ struct arm_linux_hw_breakpoint
The Linux ptrace interface to hardware break-/watch-points presents the
values in a vector centred around 0 (which is used fo generic information).
- Positive indicies refer to breakpoint addresses/control registers, negative
+ Positive indices refer to breakpoint addresses/control registers, negative
indices to watchpoint addresses/control registers.
The Linux vector is indexed as follows:
@@ -1206,14 +1204,6 @@ arm_linux_nat_target::stopped_by_watchpoint ()
return stopped_data_address (&addr);
}
-bool
-arm_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr,
- CORE_ADDR start,
- int length)
-{
- return start <= addr && start + length - 1 >= addr;
-}
-
/* Handle thread creation. We need to copy the breakpoints and watchpoints
in the parent thread to the child thread. */
void
@@ -1393,9 +1383,7 @@ arm_linux_nat_target::low_new_fork (struct lwp_info *parent, pid_t child_pid)
*child_state = *parent_state;
}
-void _initialize_arm_linux_nat ();
-void
-_initialize_arm_linux_nat ()
+INIT_GDB_FILE (arm_linux_nat)
{
/* Register the target. */
linux_target = &the_arm_linux_nat_target;
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 53c8a05..ff20ed8 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1,6 +1,6 @@
/* GNU/Linux on ARM target support.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -41,6 +41,7 @@
#include "arm-tdep.h"
#include "arm-linux-tdep.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
#include "glibc-tdep.h"
#include "arch-utils.h"
#include "inferior.h"
@@ -55,7 +56,6 @@
#include "stap-probe.h"
#include "parser-defs.h"
#include "user-regs.h"
-#include <ctype.h>
#include "elf/common.h"
/* Under ARM GNU/Linux the traditional way of performing a breakpoint
@@ -1166,10 +1166,10 @@ arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch,
static int
arm_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
- return (*s == '#' || *s == '$' || isdigit (*s) /* Literal number. */
+ return (*s == '#' || *s == '$' || c_isdigit (*s) /* Literal number. */
|| *s == '[' /* Register indirection or
displacement. */
- || isalpha (*s)); /* Register value. */
+ || c_isalpha (*s)); /* Register value. */
}
/* This routine is used to parse a special token in ARM's assembly.
@@ -1201,7 +1201,7 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
start = tmp;
/* Register name. */
- while (isalnum (*tmp))
+ while (c_isalnum (*tmp))
++tmp;
if (*tmp != ',')
@@ -1211,7 +1211,7 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
regname = (char *) alloca (len + 2);
offset = 0;
- if (isdigit (*start))
+ if (c_isdigit (*start))
{
/* If we are dealing with a register whose name begins with a
digit, it means we should prefix the name with the letter
@@ -1801,11 +1801,10 @@ arm_linux_init_abi (struct gdbarch_info info,
}
tdep->jb_elt_size = ARM_LINUX_JB_ELEMENT_SIZE;
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, arm_linux_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, arm_linux_software_single_step);
/* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, arm_linux_skip_trampoline_code);
@@ -2026,9 +2025,7 @@ arm_linux_init_abi (struct gdbarch_info info,
set_gdbarch_gcc_target_options (gdbarch, arm_linux_gcc_target_options);
}
-void _initialize_arm_linux_tdep ();
-void
-_initialize_arm_linux_tdep ()
+INIT_GDB_FILE (arm_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_LINUX,
arm_linux_init_abi);
diff --git a/gdb/arm-linux-tdep.h b/gdb/arm-linux-tdep.h
index 7aa69ce..ad6a1cd 100644
--- a/gdb/arm-linux-tdep.h
+++ b/gdb/arm-linux-tdep.h
@@ -1,6 +1,6 @@
/* GNU/Linux on ARM target support, prototypes.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arm-netbsd-nat.c b/gdb/arm-netbsd-nat.c
index 37f6530..ebf4084 100644
--- a/gdb/arm-netbsd-nat.c
+++ b/gdb/arm-netbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for BSD Unix running on ARM's, for GDB.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -354,9 +354,7 @@ arm_netbsd_nat_target::read_description ()
return arm_read_description (ARM_FP_TYPE_VFPV3, false);
}
-void _initialize_arm_netbsd_nat ();
-void
-_initialize_arm_netbsd_nat ()
+INIT_GDB_FILE (arm_netbsd_nat)
{
add_inf_child_target (&the_arm_netbsd_nat_target);
}
diff --git a/gdb/arm-netbsd-tdep.c b/gdb/arm-netbsd-tdep.c
index f77fec7..571d6f2 100644
--- a/gdb/arm-netbsd-tdep.c
+++ b/gdb/arm-netbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for NetBSD/arm.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -139,7 +139,7 @@ arm_netbsd_init_abi_common (struct gdbarch_info info,
set_gdbarch_iterate_over_regset_sections
(gdbarch, arm_nbsd_iterate_over_regset_sections);
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, arm_software_single_step);
}
static void
@@ -156,13 +156,10 @@ arm_netbsd_elf_init_abi (struct gdbarch_info info,
tdep->fp_model = ARM_FLOAT_SOFT_VFP;
/* NetBSD ELF uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
}
-void _initialize_arm_netbsd_tdep ();
-void
-_initialize_arm_netbsd_tdep ()
+INIT_GDB_FILE (arm_netbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD,
arm_netbsd_elf_init_abi);
diff --git a/gdb/arm-netbsd-tdep.h b/gdb/arm-netbsd-tdep.h
index 6e554d4..2bb8542 100644
--- a/gdb/arm-netbsd-tdep.h
+++ b/gdb/arm-netbsd-tdep.h
@@ -1,6 +1,6 @@
/* NetBSD/ARM support.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arm-none-tdep.c b/gdb/arm-none-tdep.c
index 4212af3..3ffcd2b 100644
--- a/gdb/arm-none-tdep.c
+++ b/gdb/arm-none-tdep.c
@@ -1,6 +1,6 @@
/* none on ARM target support.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -204,9 +204,7 @@ arm_none_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Initialize ARM bare-metal target support. */
-void _initialize_arm_none_tdep ();
-void
-_initialize_arm_none_tdep ()
+INIT_GDB_FILE (arm_none_tdep)
{
gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NONE,
arm_none_init_abi);
diff --git a/gdb/arm-obsd-tdep.c b/gdb/arm-obsd-tdep.c
index 56102b0..8a48b95 100644
--- a/gdb/arm-obsd-tdep.c
+++ b/gdb/arm-obsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for OpenBSD/arm.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -83,8 +83,7 @@ armobsd_init_abi (struct gdbarch_info info,
tramp_frame_prepend_unwinder (gdbarch, &armobsd_sigframe);
/* OpenBSD/arm uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
set_gdbarch_skip_solib_resolver (gdbarch, obsd_skip_solib_resolver);
tdep->jb_pc = 24;
@@ -97,7 +96,7 @@ armobsd_init_abi (struct gdbarch_info info,
tdep->struct_return = pcc_struct_return;
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, arm_software_single_step);
/* Breakpoints. */
switch (info.byte_order)
@@ -114,9 +113,7 @@ armobsd_init_abi (struct gdbarch_info info,
}
}
-void _initialize_armobsd_tdep ();
-void
-_initialize_armobsd_tdep ()
+INIT_GDB_FILE (armobsd_tdep)
{
gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_OPENBSD,
armobsd_init_abi);
diff --git a/gdb/arm-pikeos-tdep.c b/gdb/arm-pikeos-tdep.c
index b2c93bd..8d24342 100644
--- a/gdb/arm-pikeos-tdep.c
+++ b/gdb/arm-pikeos-tdep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2016-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -26,7 +26,7 @@ static void
arm_pikeos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, arm_software_single_step);
}
/* The ARM PikeOS OSABI sniffer (see gdbarch_register_osabi_sniffer).
@@ -73,9 +73,7 @@ arm_pikeos_osabi_sniffer (bfd *abfd)
return GDB_OSABI_UNKNOWN;
}
-void _initialize_arm_pikeos_tdep ();
-void
-_initialize_arm_pikeos_tdep ()
+INIT_GDB_FILE (arm_pikeos_tdep)
{
/* Register the sniffer for the PikeOS targets. */
gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_elf_flavour,
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 879f5cf..f4c2e04 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -1,6 +1,6 @@
/* Common target dependent code for GDB on ARM systems.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include <ctype.h>
#include "extract-store-integer.h"
#include "frame.h"
@@ -1669,7 +1668,7 @@ arm_analyze_load_stack_chk_guard(CORE_ADDR pc, struct gdbarch *gdbarch,
ldr Rn, .Label
....
- .Lable:
+ .Label:
.word __stack_chk_guard
Since ldr/str is a very popular instruction, we can't use them as
@@ -2504,15 +2503,15 @@ static const registry<bfd>::key<arm_exidx_data> arm_exidx_data_key;
static struct obj_section *
arm_obj_section_from_vma (struct objfile *objfile, bfd_vma vma)
{
- for (obj_section *osect : objfile->sections ())
- if (bfd_section_flags (osect->the_bfd_section) & SEC_ALLOC)
+ for (obj_section &osect : objfile->sections ())
+ if (bfd_section_flags (osect.the_bfd_section) & SEC_ALLOC)
{
bfd_vma start, size;
- start = bfd_section_vma (osect->the_bfd_section);
- size = bfd_section_size (osect->the_bfd_section);
+ start = bfd_section_vma (osect.the_bfd_section);
+ size = bfd_section_size (osect.the_bfd_section);
if (start <= vma && vma < start + size)
- return osect;
+ return &osect;
}
return NULL;
@@ -9202,7 +9201,7 @@ arm_store_return_value (struct type *type, struct regcache *regs,
{
/* Integral values greater than one word are stored in consecutive
registers starting with r0. This will always be a multiple of
- the regiser size. */
+ the register size. */
int len = type->length ();
int regno = ARM_A1_REGNUM;
@@ -9642,13 +9641,20 @@ show_disassembly_style_sfunc (struct ui_file *file, int from_tty,
const char *options = get_disassembler_options (gdbarch);
const char *style = "";
int len = 0;
- const char *opt;
+ const char *opt = options;
- FOR_EACH_DISASSEMBLER_OPTION (opt, options)
- if (startswith (opt, "reg-names-"))
+ if (opt)
+ while (1)
{
- style = &opt[strlen ("reg-names-")];
- len = strcspn (style, ",");
+ const char *opt_end = strchr (opt, ',');
+ if (startswith (opt, "reg-names-"))
+ {
+ style = &opt[strlen ("reg-names-")];
+ len = opt_end ? opt_end - style : 99;
+ }
+ if (!opt_end)
+ break;
+ opt = opt_end + 1;
}
gdb_printf (file, "The disassembly style is \"%.*s\".\n", len, style);
@@ -10103,7 +10109,7 @@ arm_get_pc_address_flags (const frame_info_ptr &frame, CORE_ADDR pc)
}
/* Initialize the current architecture based on INFO. If possible,
- re-use an architecture from ARCHES, which is a list of
+ reuse an architecture from ARCHES, which is a list of
architectures already created during this debugging session.
Called e.g. at program startup, when reading a core file, and when
@@ -11015,9 +11021,7 @@ static void arm_analyze_prologue_test ();
}
#endif
-void _initialize_arm_tdep ();
-void
-_initialize_arm_tdep ()
+INIT_GDB_FILE (arm_tdep)
{
long length;
int i, j;
diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h
index f8049f4..aa950fb 100644
--- a/gdb/arm-tdep.h
+++ b/gdb/arm-tdep.h
@@ -1,5 +1,5 @@
/* Common target dependent code for GDB on ARM systems.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/arm-wince-tdep.c b/gdb/arm-wince-tdep.c
index 403795f..f14c8e8 100644
--- a/gdb/arm-wince-tdep.c
+++ b/gdb/arm-wince-tdep.c
@@ -1,7 +1,7 @@
/* Target-dependent code for Windows CE running on ARM processors,
for GDB.
- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+ Copyright (C) 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -135,7 +135,7 @@ arm_wince_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_skip_trampoline_code (gdbarch, arm_pe_skip_trampoline_code);
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, arm_software_single_step);
/* Skip call to __gccmain that gcc places in main. */
set_gdbarch_skip_main_prologue (gdbarch, arm_wince_skip_main_prologue);
@@ -152,9 +152,7 @@ arm_wince_osabi_sniffer (bfd *abfd)
return GDB_OSABI_UNKNOWN;
}
-void _initialize_arm_wince_tdep ();
-void
-_initialize_arm_wince_tdep ()
+INIT_GDB_FILE (arm_wince_tdep)
{
gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_coff_flavour,
arm_wince_osabi_sniffer);
diff --git a/gdb/async-event.c b/gdb/async-event.c
index 32b5865..27b739f 100644
--- a/gdb/async-event.c
+++ b/gdb/async-event.c
@@ -1,5 +1,5 @@
/* Async events for the GDB event loop.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/async-event.h b/gdb/async-event.h
index 16045f4..c97b77b 100644
--- a/gdb/async-event.h
+++ b/gdb/async-event.h
@@ -1,5 +1,5 @@
/* Async events for the GDB event loop.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 71bbae4..8817bd1 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -1,6 +1,6 @@
/* GDB routines for supporting auto-loaded scripts.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include <ctype.h>
#include "auto-load.h"
#include "gdbsupport/gdb_vecs.h"
#include "progspace.h"
@@ -41,6 +40,7 @@
#include <algorithm>
#include "gdbsupport/pathstuff.h"
#include "cli/cli-style.h"
+#include "gdbsupport/selftest.h"
/* The section to look in for auto-loaded scripts (in file formats that
support sections).
@@ -162,6 +162,67 @@ show_auto_load_dir (struct ui_file *file, int from_tty,
value);
}
+/* Substitute all occurrences of string FROM by string TO in STRING.
+ STRING will be updated in place as needed. FROM needs to be
+ delimited by IS_DIR_SEPARATOR or DIRNAME_SEPARATOR (or be located
+ at the start or end of STRING. */
+
+static void
+substitute_path_component (std::string &string, std::string_view from,
+ std::string_view to)
+{
+ for (size_t s = 0;;)
+ {
+ s = string.find (from, s);
+ if (s == std::string::npos)
+ break;
+
+ if ((s == 0 || IS_DIR_SEPARATOR (string[s - 1])
+ || string[s - 1] == DIRNAME_SEPARATOR)
+ && (s + from.size () == string.size ()
+ || IS_DIR_SEPARATOR (string[s + from.size ()])
+ || string[s + from.size ()] == DIRNAME_SEPARATOR))
+ {
+ string.replace (s, from.size (), to);
+ s += to.size ();
+ }
+ else
+ s++;
+ }
+}
+
+#if GDB_SELF_TEST
+
+namespace selftests {
+namespace subst_path {
+
+static void
+test_substitute_path_component ()
+{
+ auto test = [] (std::string s, const char *from, const char *to,
+ const char *expected)
+ {
+ substitute_path_component (s, from, to);
+ SELF_CHECK (s == expected);
+ };
+
+ test ("/abc/$def/g", "abc", "xyz", "/xyz/$def/g");
+ test ("abc/$def/g", "abc", "xyz", "xyz/$def/g");
+ test ("/abc/$def/g", "$def", "xyz", "/abc/xyz/g");
+ test ("/abc/$def/g", "g", "xyz", "/abc/$def/xyz");
+ test ("/abc/$def/g", "ab", "xyz", "/abc/$def/g");
+ test ("/abc/$def/g", "def", "xyz", "/abc/$def/g");
+ test ("/abc/$def/g", "abc", "abc", "/abc/$def/g");
+ test ("/abc/$def/g", "abc", "", "//$def/g");
+ test ("/abc/$def/g", "abc/$def", "xyz", "/xyz/g");
+ test ("/abc/$def/abc", "abc", "xyz", "/xyz/$def/xyz");
+}
+
+}
+}
+
+#endif /* GDB_SELF_TEST */
+
/* Directory list safe to hold auto-loaded files. It is not checked for
absolute paths but they are strongly recommended. It is initialized by
_initialize_auto_load. */
@@ -178,16 +239,15 @@ static std::vector<gdb::unique_xmalloc_ptr<char>> auto_load_safe_path_vec;
static std::vector<gdb::unique_xmalloc_ptr<char>>
auto_load_expand_dir_vars (const char *string)
{
- char *s = xstrdup (string);
- substitute_path_component (&s, "$datadir", gdb_datadir.c_str ());
- substitute_path_component (&s, "$debugdir", debug_file_directory.c_str ());
+ std::string s = string;
+ substitute_path_component (s, "$datadir", gdb_datadir.c_str ());
+ substitute_path_component (s, "$debugdir", debug_file_directory.c_str ());
- if (debug_auto_load && strcmp (s, string) != 0)
- auto_load_debug_printf ("Expanded $-variables to \"%s\".", s);
+ if (debug_auto_load && s != string)
+ auto_load_debug_printf ("Expanded $-variables to \"%s\".", s.c_str ());
std::vector<gdb::unique_xmalloc_ptr<char>> dir_vec
- = dirnames_to_char_ptr_vec (s);
- xfree(s);
+ = dirnames_to_char_ptr_vec (s.c_str ());
return dir_vec;
}
@@ -984,7 +1044,7 @@ execute_script_contents (struct auto_load_pspace_info *pspace_info,
buf = name_holder.c_str ();
for (p = buf; *p != '\0'; ++p)
{
- if (isspace (*p))
+ if (c_isspace (*p))
break;
}
/* We don't allow nameless scripts, they're not helpful to the user. */
@@ -1507,9 +1567,7 @@ found and/or loaded."),
gdb::observers::token auto_load_new_objfile_observer_token;
-void _initialize_auto_load ();
-void
-_initialize_auto_load ()
+INIT_GDB_FILE (auto_load)
{
struct cmd_list_element *cmd;
gdb::unique_xmalloc_ptr<char> scripts_directory_help, gdb_name_help,
@@ -1650,4 +1708,9 @@ When non-zero, debugging output for files of 'set auto-load ...'\n\
is displayed."),
NULL, show_debug_auto_load,
&setdebuglist, &showdebuglist);
+
+#if GDB_SELF_TEST
+ selftests::register_test ("substitute_path_component",
+ selftests::subst_path::test_substitute_path_component);
+#endif
}
diff --git a/gdb/auto-load.h b/gdb/auto-load.h
index 48e6ccf..8dd963b 100644
--- a/gdb/auto-load.h
+++ b/gdb/auto-load.h
@@ -1,6 +1,6 @@
/* GDB routines for supporting auto-loaded scripts.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/auxv.c b/gdb/auxv.c
index c831b2b..06e2fb0 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -1,6 +1,6 @@
/* Auxiliary vector support for GDB, the GNU debugger.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -609,9 +609,7 @@ info_auxv_command (const char *cmd, int from_tty)
}
}
-void _initialize_auxv ();
-void
-_initialize_auxv ()
+INIT_GDB_FILE (auxv)
{
add_info ("auxv", info_auxv_command,
_("Display the inferior's auxiliary vector.\n\
diff --git a/gdb/auxv.h b/gdb/auxv.h
index 3faddff..6a187e9 100644
--- a/gdb/auxv.h
+++ b/gdb/auxv.h
@@ -1,6 +1,6 @@
/* Auxiliary vector support for GDB, the GNU debugger.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index b3fe3fe..6274529 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Atmel AVR, for GDB.
- Copyright (C) 1996-2024 Free Software Foundation, Inc.
+ Copyright (C) 1996-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1629,9 +1629,7 @@ avr_io_reg_read_command (const char *args, int from_tty)
}
}
-void _initialize_avr_tdep ();
-void
-_initialize_avr_tdep ()
+INIT_GDB_FILE (avr_tdep)
{
gdbarch_register (bfd_arch_avr, avr_gdbarch_init);
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 2b7d6ce..54717bf 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -1,6 +1,6 @@
/* GDB-specific functions for operating on agent expressions.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -525,7 +525,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
return computed_ops->tracepoint_var_ref (var, ax, value);
/* I'm imitating the code in read_var_value. */
- switch (var->aclass ())
+ switch (var->loc_class ())
{
case LOC_CONST: /* A constant, like an enum value. */
ax_const_l (ax, (LONGEST) var->value_longest ());
@@ -538,8 +538,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
break;
case LOC_CONST_BYTES:
- internal_error (_("gen_var_ref: LOC_CONST_BYTES "
- "symbols are not supported"));
+ error (_("gen_var_ref: LOC_CONST_BYTES symbols are not supported"));
/* Variable at a fixed location in memory. Easy. */
case LOC_STATIC:
@@ -2634,9 +2633,7 @@ maint_agent_printf_command (const char *cmdrest, int from_tty)
/* Initialization code. */
-void _initialize_ax_gdb ();
-void
-_initialize_ax_gdb ()
+INIT_GDB_FILE (ax_gdb)
{
add_cmd ("agent", class_maintenance, maint_agent_command,
_("\
diff --git a/gdb/ax-gdb.h b/gdb/ax-gdb.h
index 53f48ff..eed7a85 100644
--- a/gdb/ax-gdb.h
+++ b/gdb/ax-gdb.h
@@ -1,5 +1,5 @@
/* GDB-specific functions for operating on agent expressions
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index 3d00745..8dbd0c9 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -1,5 +1,5 @@
/* Functions for manipulating expressions designed to be executed on the agent
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ax.h b/gdb/ax.h
index 45fd560..6edad88 100644
--- a/gdb/ax.h
+++ b/gdb/ax.h
@@ -1,5 +1,5 @@
/* Definitions for expressions designed to be executed on the agent
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ax_cxx_compile_stdcxx.m4 b/gdb/ax_cxx_compile_stdcxx.m4
index 6c1d04a..3dc58fb 100644
--- a/gdb/ax_cxx_compile_stdcxx.m4
+++ b/gdb/ax_cxx_compile_stdcxx.m4
@@ -1,4 +1,4 @@
-# Copyright (c) 2016-2024 Free Software Foundation, Inc.
+# Copyright (c) 2016-2025 Free Software Foundation, Inc.
#
# Originally based on the AX_CXX_COMPILE_STDCXX macro found at the url
# below.
diff --git a/gdb/bcache.c b/gdb/bcache.c
index a9aab28..fd74c62 100644
--- a/gdb/bcache.c
+++ b/gdb/bcache.c
@@ -2,7 +2,7 @@
Written by Fred Fish <fnf@cygnus.com>
Rewritten by Jim Blandy <jimb@cygnus.com>
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -250,7 +250,7 @@ print_percentage (int portion, int total)
}
-/* Print statistics on BCACHE's memory usage and efficacity at
+/* Print statistics on BCACHE's memory usage and efficacy at
eliminating duplication. NAME should describe the kind of data
BCACHE holds. Statistics are printed using `gdb_printf' and
its ilk. */
diff --git a/gdb/bcache.h b/gdb/bcache.h
index 82cdd13..0980c07 100644
--- a/gdb/bcache.h
+++ b/gdb/bcache.h
@@ -2,7 +2,7 @@
Written by Fred Fish <fnf@cygnus.com>
Rewritten by Jim Blandy <jimb@cygnus.com>
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -173,7 +173,7 @@ struct bcache
added);
}
- /* Print statistics on this bcache's memory usage and efficacity at
+ /* Print statistics on this bcache's memory usage and efficacy at
eliminating duplication. TYPE should be a string describing the
kind of data this bcache holds. Statistics are printed using
`gdb_printf' and its ilk. */
diff --git a/gdb/bfd-target.c b/gdb/bfd-target.c
index 96e045e..855f5bb 100644
--- a/gdb/bfd-target.c
+++ b/gdb/bfd-target.c
@@ -1,6 +1,6 @@
/* Very simple "bfd" target, for GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/bfd-target.h b/gdb/bfd-target.h
index ab3233e..f922f34 100644
--- a/gdb/bfd-target.h
+++ b/gdb/bfd-target.h
@@ -1,6 +1,6 @@
/* Very simple "bfd" target, for GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/bfin-linux-tdep.c b/gdb/bfin-linux-tdep.c
index 0b1b018..d84f800 100644
--- a/gdb/bfin-linux-tdep.c
+++ b/gdb/bfin-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Analog Devices Blackfin processor, for GDB.
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
Contributed by Analog Devices, Inc.
@@ -161,9 +161,7 @@ bfin_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
bfin_linux_get_syscall_number);
}
-void _initialize_bfin_linux_tdep ();
-void
-_initialize_bfin_linux_tdep ()
+INIT_GDB_FILE (bfin_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_bfin, 0, GDB_OSABI_LINUX,
bfin_linux_init_abi);
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
index 78ade80..3a96e9f 100644
--- a/gdb/bfin-tdep.c
+++ b/gdb/bfin-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Analog Devices Blackfin processor, for GDB.
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
Contributed by Analog Devices, Inc.
@@ -769,7 +769,7 @@ bfin_abi (struct gdbarch *gdbarch)
}
/* Initialize the current architecture based on INFO. If possible,
- re-use an architecture from ARCHES, which is a list of
+ reuse an architecture from ARCHES, which is a list of
architectures already created during this debugging session.
Called e.g. at program startup, when reading a core file, and when
@@ -837,9 +837,7 @@ bfin_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_bfin_tdep ();
-void
-_initialize_bfin_tdep ()
+INIT_GDB_FILE (bfin_tdep)
{
gdbarch_register (bfd_arch_bfin, bfin_gdbarch_init);
}
diff --git a/gdb/bfin-tdep.h b/gdb/bfin-tdep.h
index d28af50..dc76eda 100644
--- a/gdb/bfin-tdep.h
+++ b/gdb/bfin-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for Analog Devices Blackfin processor, for GDB.
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
Contributed by Analog Devices, Inc.
diff --git a/gdb/block.c b/gdb/block.c
index cf7ca67..e09bccd 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -1,6 +1,6 @@
/* Block-related functions for the GNU debugger, GDB.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -325,10 +325,11 @@ block::set_scope (const char *scope, struct obstack *obstack)
next_range<using_direct>
block::get_using () const
{
- if (m_namespace_info == nullptr)
- return {};
- else
- return next_range<using_direct> (m_namespace_info->using_decl);
+ next_iterator<using_direct> begin (m_namespace_info != nullptr
+ ? m_namespace_info->using_decl
+ : nullptr);
+
+ return next_range<using_direct> (std::move (begin));
}
/* See block.h. */
@@ -618,7 +619,7 @@ block_iterator_next (struct block_iterator *iterator)
bool
best_symbol (struct symbol *a, const domain_search_flags domain)
{
- if (a->aclass () == LOC_UNRESOLVED)
+ if (a->loc_class () == LOC_UNRESOLVED)
return false;
if ((domain & SEARCH_VAR_DOMAIN) != 0)
@@ -644,10 +645,10 @@ better_symbol (struct symbol *a, struct symbol *b,
if (b->matches (domain) && !a->matches (domain))
return b;
- if (a->aclass () != LOC_UNRESOLVED && b->aclass () == LOC_UNRESOLVED)
+ if (a->loc_class () != LOC_UNRESOLVED && b->loc_class () == LOC_UNRESOLVED)
return a;
- if (b->aclass () != LOC_UNRESOLVED && a->aclass () == LOC_UNRESOLVED)
+ if (b->loc_class () != LOC_UNRESOLVED && a->loc_class () == LOC_UNRESOLVED)
return b;
return a;
@@ -670,22 +671,9 @@ block_lookup_symbol (const struct block *block, const lookup_name_info &name,
{
if (!block->function ())
{
- struct symbol *other = NULL;
-
- for (struct symbol *sym : block_iterator_range (block, &name))
- {
- /* See comment related to PR gcc/debug/91507 in
- block_lookup_symbol_primary. */
- if (best_symbol (sym, domain))
- return sym;
- /* This is a bit of a hack, but symbol_matches_domain might ignore
- STRUCT vs VAR domain symbols. So if a matching symbol is found,
- make sure there is no "better" matching symbol, i.e., one with
- exactly the same domain. PR 16253. */
- if (sym->matches (domain))
- other = better_symbol (other, sym, domain);
- }
- return other;
+ best_symbol_tracker tracker;
+ tracker.search (nullptr, block, name, domain);
+ return tracker.currently_best.symbol;
}
else
{
@@ -717,24 +705,13 @@ block_lookup_symbol (const struct block *block, const lookup_name_info &name,
/* See block.h. */
-struct symbol *
-block_lookup_symbol_primary (const struct block *block, const char *name,
+bool
+best_symbol_tracker::search (compunit_symtab *symtab,
+ const struct block *block,
+ const lookup_name_info &name,
const domain_search_flags domain)
{
- struct symbol *sym, *other;
- struct mdict_iterator mdict_iter;
-
- lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
-
- /* Verify BLOCK is STATIC_BLOCK or GLOBAL_BLOCK. */
- gdb_assert (block->superblock () == NULL
- || block->superblock ()->superblock () == NULL);
-
- other = NULL;
- for (sym = mdict_iter_match_first (block->multidict (), lookup_name,
- &mdict_iter);
- sym != NULL;
- sym = mdict_iter_match_next (lookup_name, &mdict_iter))
+ for (symbol *sym : block_iterator_range (block, &name))
{
/* With the fix for PR gcc/debug/91507, we get for:
...
@@ -764,17 +741,28 @@ block_lookup_symbol_primary (const struct block *block, const char *name,
the only option to make this work is improve the fallback to use the
size of the minimal symbol. Filed as PR exp/24989. */
if (best_symbol (sym, domain))
- return sym;
+ {
+ best_symtab = symtab;
+ currently_best = { sym, block };
+ return true;
+ }
/* This is a bit of a hack, but 'matches' might ignore
STRUCT vs VAR domain symbols. So if a matching symbol is found,
make sure there is no "better" matching symbol, i.e., one with
exactly the same domain. PR 16253. */
if (sym->matches (domain))
- other = better_symbol (other, sym, domain);
+ {
+ symbol *better = better_symbol (sym, currently_best.symbol, domain);
+ if (better != currently_best.symbol)
+ {
+ best_symtab = symtab;
+ currently_best = { better, block };
+ }
+ }
}
- return other;
+ return false;
}
/* See block.h. */
@@ -924,9 +912,7 @@ maintenance_info_blocks (const char *arg, int from_tty)
-void _initialize_block ();
-void
-_initialize_block ()
+INIT_GDB_FILE (block)
{
add_cmd ("blocks", class_maintenance, maintenance_info_blocks,
_("\
diff --git a/gdb/block.h b/gdb/block.h
index 75f5c8e..8a3ea82 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -1,6 +1,6 @@
/* Code dealing with blocks for GDB.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -146,7 +146,11 @@ struct block : public allocate_on_obstack<block>
/* Return an iterator range for this block's multidict. */
iterator_range<mdict_iterator_wrapper> multidict_symbols () const
- { return iterator_range<mdict_iterator_wrapper> (m_multidict); }
+ {
+ mdict_iterator_wrapper begin (m_multidict);
+
+ return iterator_range<mdict_iterator_wrapper> (std::move (begin));
+ }
/* Set this block's multidict. */
void set_multidict (multidictionary *multidict)
@@ -610,9 +614,16 @@ private:
struct block_iterator m_iter;
};
-/* An iterator range for block_iterator_wrapper. */
+/* Return an iterator range for block_iterator_wrapper. */
+
+inline iterator_range<block_iterator_wrapper>
+block_iterator_range (const block *block,
+ const lookup_name_info *name = nullptr)
+{
+ block_iterator_wrapper begin (block, name);
-typedef iterator_range<block_iterator_wrapper> block_iterator_range;
+ return iterator_range<block_iterator_wrapper> (std::move (begin));
+}
/* Return true if symbol A is the best match possible for DOMAIN. */
@@ -630,14 +641,27 @@ extern struct symbol *block_lookup_symbol (const struct block *block,
const lookup_name_info &name,
const domain_search_flags domain);
-/* Search BLOCK for symbol NAME in DOMAIN but only in primary symbol table of
- BLOCK. BLOCK must be STATIC_BLOCK or GLOBAL_BLOCK. Function is useful if
- one iterates all global/static blocks of an objfile. */
+/* When searching for a symbol, the "best" symbol is preferred over
+ one that is merely acceptable. See 'best_symbol'. This class
+ keeps track of this distinction while searching. */
-extern struct symbol *block_lookup_symbol_primary
- (const struct block *block,
- const char *name,
- const domain_search_flags domain);
+struct best_symbol_tracker
+{
+ /* The symtab in which the currently best symbol appears. */
+ compunit_symtab *best_symtab = nullptr;
+
+ /* The currently best (really "better") symbol. */
+ block_symbol currently_best {};
+
+ /* Search BLOCK (which must have come from SYMTAB) for a symbol
+ matching NAME and DOMAIN. When a symbol is found, update
+ 'currently_best'. If a best symbol is found, return true.
+ Otherwise, return false. SYMTAB can be nullptr if the caller
+ does not care about this tracking. */
+ bool search (compunit_symtab *symtab,
+ const block *block, const lookup_name_info &name,
+ domain_search_flags domain);
+};
/* Find symbol NAME in BLOCK and in DOMAIN. This will return a
matching symbol whose type is not a "opaque", see TYPE_IS_OPAQUE.
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 7275eb1..5a3e342 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -1,7 +1,7 @@
/* Get info from stack frames; convert between frames, blocks,
functions and pc values.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/bpf-tdep.c b/gdb/bpf-tdep.c
index 8f3e50d..be01e8b 100644
--- a/gdb/bpf-tdep.c
+++ b/gdb/bpf-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for BPF.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -307,7 +307,7 @@ bpf_return_value (struct gdbarch *gdbarch, struct value *function,
}
-/* Initialize the current architecture based on INFO. If possible, re-use an
+/* Initialize the current architecture based on INFO. If possible, reuse an
architecture from ARCHES, which is a list of architectures already created
during this debugging session. */
@@ -368,9 +368,7 @@ bpf_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_bpf_tdep ();
-void
-_initialize_bpf_tdep ()
+INIT_GDB_FILE (bpf_tdep)
{
gdbarch_register (bfd_arch_bpf, bpf_gdbarch_init);
diff --git a/gdb/break-catch-exec.c b/gdb/break-catch-exec.c
index bd412fc..9bfdb44 100644
--- a/gdb/break-catch-exec.c
+++ b/gdb/break-catch-exec.c
@@ -1,6 +1,6 @@
/* Everything about exec catchpoints, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -164,7 +164,7 @@ ep_parse_optional_if_clause (const char **arg)
{
const char *cond_string;
- if (((*arg)[0] != 'i') || ((*arg)[1] != 'f') || !isspace ((*arg)[2]))
+ if (((*arg)[0] != 'i') || ((*arg)[1] != 'f') || !c_isspace ((*arg)[2]))
return NULL;
/* Skip the "if" keyword. */
@@ -204,7 +204,7 @@ catch_exec_command_1 (const char *arg, int from_tty,
First, check if there's an if clause. */
cond_string = ep_parse_optional_if_clause (&arg);
- if ((*arg != '\0') && !isspace (*arg))
+ if ((*arg != '\0') && !c_isspace (*arg))
error (_("Junk at end of arguments."));
std::unique_ptr<exec_catchpoint> c
@@ -213,9 +213,7 @@ catch_exec_command_1 (const char *arg, int from_tty,
install_breakpoint (0, std::move (c), 1);
}
-void _initialize_break_catch_exec ();
-void
-_initialize_break_catch_exec ()
+INIT_GDB_FILE (break_catch_exec)
{
add_catch_command ("exec", _("Catch calls to exec."),
catch_exec_command_1,
diff --git a/gdb/break-catch-fork.c b/gdb/break-catch-fork.c
index afbd847..535040c9 100644
--- a/gdb/break-catch-fork.c
+++ b/gdb/break-catch-fork.c
@@ -1,6 +1,6 @@
/* Everything about vfork catchpoints, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -221,7 +221,7 @@ catch_fork_command_1 (const char *arg, int from_tty,
First, check if there's an if clause. */
cond_string = ep_parse_optional_if_clause (&arg);
- if ((*arg != '\0') && !isspace (*arg))
+ if ((*arg != '\0') && !c_isspace (*arg))
error (_("Junk at end of arguments."));
/* If this target supports it, create a fork or vfork catchpoint
@@ -242,9 +242,7 @@ catch_fork_command_1 (const char *arg, int from_tty,
}
}
-void _initialize_break_catch_fork ();
-void
-_initialize_break_catch_fork ()
+INIT_GDB_FILE (break_catch_fork)
{
add_catch_command ("fork", _("Catch calls to fork."),
catch_fork_command_1,
diff --git a/gdb/break-catch-load.c b/gdb/break-catch-load.c
index ce30b6f..b5594c2 100644
--- a/gdb/break-catch-load.c
+++ b/gdb/break-catch-load.c
@@ -1,6 +1,6 @@
/* Everything about load/unload catchpoints, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,9 +22,8 @@
#include "arch-utils.h"
#include "breakpoint.h"
#include "cli/cli-decode.h"
-#include "mi/mi-common.h"
#include "progspace.h"
-#include "solist.h"
+#include "solib.h"
#include "target.h"
#include "valprint.h"
@@ -119,7 +118,7 @@ solib_catchpoint::check_status (struct bpstat *bs)
for (solib *iter : current_program_space->added_solibs)
{
if (!regex
- || compiled->exec (iter->so_name.c_str (), 0, nullptr, 0) == 0)
+ || compiled->exec (iter->name.c_str (), 0, nullptr, 0) == 0)
return;
}
}
@@ -264,9 +263,7 @@ catch_unload_command_1 (const char *arg, int from_tty,
catch_load_or_unload (arg, from_tty, 0, command);
}
-void _initialize_break_catch_load ();
-void
-_initialize_break_catch_load ()
+INIT_GDB_FILE (break_catch_load)
{
add_catch_command ("load", _("Catch loads of shared libraries.\n\
Usage: catch load [REGEX]\n\
diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c
index 72a5ebc..9e1c6d6 100644
--- a/gdb/break-catch-sig.c
+++ b/gdb/break-catch-sig.c
@@ -1,6 +1,6 @@
/* Everything about signal catchpoints, for GDB.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,9 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "arch-utils.h"
-#include <ctype.h>
#include "breakpoint.h"
-#include "cli/cli-cmds.h"
#include "inferior.h"
#include "infrun.h"
#include "annotate.h"
@@ -409,9 +407,7 @@ catch_signal_command (const char *arg, int from_tty,
create_signal_catchpoint (tempflag, std::move (filter), catch_all);
}
-void _initialize_break_catch_sig ();
-void
-_initialize_break_catch_sig ()
+INIT_GDB_FILE (break_catch_sig)
{
add_catch_command ("signal", _("\
Catch signals by their names and/or numbers.\n\
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c
index 52ae60b..fad76e7 100644
--- a/gdb/break-catch-syscall.c
+++ b/gdb/break-catch-syscall.c
@@ -1,6 +1,6 @@
/* Everything about syscall catchpoints, for GDB.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,9 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include <ctype.h>
#include "breakpoint.h"
-#include "cli/cli-cmds.h"
#include "inferior.h"
#include "cli/cli-utils.h"
#include "annotate.h"
@@ -370,7 +368,7 @@ catch_syscall_split_args (const char *arg)
/* Skip whitespace. */
arg = skip_spaces (arg);
- for (i = 0; i < 127 && arg[i] && !isspace (arg[i]); ++i)
+ for (i = 0; i < 127 && arg[i] && !c_isspace (arg[i]); ++i)
cur_name[i] = arg[i];
cur_name[i] = '\0';
arg += i;
@@ -423,7 +421,7 @@ catch_syscall_command_1 (const char *arg, int from_tty,
struct syscall s;
struct gdbarch *gdbarch = get_current_arch ();
- /* Checking if the feature if supported. */
+ /* Checking if the feature is supported. */
if (gdbarch_get_syscall_number_p (gdbarch) == 0)
error (_("The feature 'catch syscall' is not supported on \
this architecture yet."));
@@ -570,9 +568,7 @@ clear_syscall_counts (struct inferior *inf)
inf_data->syscalls_counts.clear ();
}
-void _initialize_break_catch_syscall ();
-void
-_initialize_break_catch_syscall ()
+INIT_GDB_FILE (break_catch_syscall)
{
gdb::observers::inferior_exit.attach (clear_syscall_counts,
"break-catch-syscall");
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index c1c88d9..1a45d7c 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -1,6 +1,6 @@
/* Everything about catch/throw catchpoints, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,19 +18,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "arch-utils.h"
-#include <ctype.h>
#include "breakpoint.h"
#include "exceptions.h"
#include "inferior.h"
#include "annotate.h"
#include "valprint.h"
#include "cli/cli-utils.h"
-#include "completer.h"
-#include "gdbsupport/gdb_obstack.h"
#include "mi/mi-common.h"
-#include "linespec.h"
#include "probe.h"
-#include "objfiles.h"
#include "cp-abi.h"
#include "gdbsupport/gdb_regex.h"
#include "cp-support.h"
@@ -424,7 +419,7 @@ catch_exception_event (enum exception_event_kind ex_event,
cond_string = ep_parse_optional_if_clause (&arg);
- if ((*arg != '\0') && !isspace (*arg))
+ if ((*arg != '\0') && !c_isspace (*arg))
error (_("Junk at end of arguments."));
if (ex_event != EX_EVENT_THROW
@@ -499,9 +494,7 @@ static const struct internalvar_funcs exception_funcs =
-void _initialize_break_catch_throw ();
-void
-_initialize_break_catch_throw ()
+INIT_GDB_FILE (break_catch_throw)
{
/* Add catch and tcatch sub-commands. */
add_catch_command ("catch", _("\
diff --git a/gdb/break-cond-parse.c b/gdb/break-cond-parse.c
index 65615af..b771344 100644
--- a/gdb/break-cond-parse.c
+++ b/gdb/break-cond-parse.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2023 Free Software Foundation, Inc.
+/* Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -23,7 +23,6 @@
#include "break-cond-parse.h"
#include "tid-parse.h"
#include "ada-lang.h"
-#include "exceptions.h"
/* When parsing tokens from a string, which direction are we parsing?
@@ -67,12 +66,12 @@ find_next_token (const char **curr, parse_direction direction)
{
gdb_assert (direction == parse_direction::backward);
- while (isspace (**curr))
+ while (c_isspace (**curr))
--(*curr);
tok_end = *curr;
- while (!isspace (**curr))
+ while (!c_isspace (**curr))
--(*curr);
tok_start = (*curr) + 1;
@@ -569,10 +568,10 @@ test (const char *input, const char *condition, int thread = -1,
gdb::unique_xmalloc_ptr<char> extracted_rest;
int extracted_thread, extracted_inferior, extracted_task;
bool extracted_force_condition;
- std::string exception_msg, error_str;
+ std::string exception_msg;
- if (error_msg != nullptr)
- error_str = std::string (error_msg) + "\n";
+ if (error_msg == nullptr)
+ error_msg = "";
try
{
@@ -584,10 +583,7 @@ test (const char *input, const char *condition, int thread = -1,
}
catch (const gdb_exception_error &ex)
{
- string_file buf;
-
- exception_print (&buf, ex);
- exception_msg = buf.release ();
+ exception_msg = ex.what ();
}
if ((condition == nullptr) != (extracted_condition.get () == nullptr)
@@ -599,7 +595,7 @@ test (const char *input, const char *condition, int thread = -1,
|| inferior != extracted_inferior
|| task != extracted_task
|| force != extracted_force_condition
- || exception_msg != error_str)
+ || exception_msg != error_msg)
{
if (run_verbose ())
{
@@ -687,9 +683,7 @@ create_breakpoint_parse_arg_string_tests ()
} /* namespace selftests */
#endif /* GDB_SELF_TEST */
-void _initialize_break_cond_parse ();
-void
-_initialize_break_cond_parse ()
+INIT_GDB_FILE (break_cond_parse)
{
#if GDB_SELF_TEST
selftests::register_test
diff --git a/gdb/break-cond-parse.h b/gdb/break-cond-parse.h
index 33e60dd..175715b 100644
--- a/gdb/break-cond-parse.h
+++ b/gdb/break-cond-parse.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2023 Free Software Foundation, Inc.
+/* Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 0fb6fd9..bfcfc24 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1,6 +1,6 @@
/* Everything about breakpoints, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "arch-utils.h"
-#include <ctype.h>
#include "event-top.h"
#include "exceptions.h"
#include "gdbsupport/gdb_vecs.h"
@@ -50,7 +49,6 @@
#include "cli/cli-script.h"
#include "block.h"
#include "solib.h"
-#include "solist.h"
#include "observable.h"
#include "memattr.h"
#include "ada-lang.h"
@@ -255,14 +253,22 @@ DIAGNOSTIC_POP
static std::string
breakpoint_location_address_str (const bp_location *bl)
{
- std::string str = string_printf ("Breakpoint %d (%s) at address %s",
+ std::string str = string_printf ("Breakpoint %d (%s) ",
bl->owner->number,
- host_address_to_string (bl),
- paddress (bl->gdbarch, bl->address));
+ host_address_to_string (bl));
- std::string loc_string = bl->to_string ();
- if (!loc_string.empty ())
- str += string_printf (" %s", loc_string.c_str ());
+ if (bl_address_is_meaningful (bl))
+ {
+ gdb_assert (bl->gdbarch != nullptr);
+ str += string_printf ("at address %s",
+ paddress (bl->gdbarch, bl->address));
+
+ std::string loc_string = bl->to_string ();
+ if (!loc_string.empty ())
+ str += string_printf (" %s", loc_string.c_str ());
+ }
+ else
+ str += "with dummy location";
return str;
}
@@ -618,8 +624,8 @@ breakpoints_should_be_inserted_now (void)
/* Don't remove breakpoints yet if, even though all threads are
stopped, we still have events to process. */
- for (thread_info *tp : all_non_exited_threads ())
- if (tp->resumed () && tp->has_pending_waitstatus ())
+ for (thread_info &tp : all_non_exited_threads ())
+ if (tp.resumed () && tp.has_pending_waitstatus ())
return 1;
}
return 0;
@@ -717,11 +723,17 @@ all_breakpoints_safe ()
tracepoint_range
all_tracepoints ()
{
- return tracepoint_range (tracepoint_iterator (breakpoint_chain.begin ()),
- tracepoint_iterator (breakpoint_chain.end ()));
+ breakpoint_iterator begin (breakpoint_chain.begin ());
+ breakpoint_iterator end (breakpoint_chain.end ());
+ tracepoint_iterator tracepoint_begin (std::move (begin), end);
+ tracepoint_iterator tracepoint_end (end, end);
+
+ return tracepoint_range (std::move (tracepoint_begin),
+ std::move (tracepoint_end));
}
-/* Array is sorted by bp_location_is_less_than - primarily by the ADDRESS. */
+/* Array is sorted by bp_location_ptr_is_less_than - primarily by the
+ ADDRESS. */
static std::vector<bp_location *> bp_locations;
@@ -1280,7 +1292,7 @@ condition_completer (struct cmd_list_element *cmd,
{
tracker.advance_custom_word_point_by (1);
/* We don't support completion of history indices. */
- if (!isdigit (text[1]))
+ if (!c_isdigit (text[1]))
complete_internalvar (tracker, &text[1]);
return;
}
@@ -3657,13 +3669,13 @@ create_overlay_event_breakpoint (void)
{
const char *const func_name = "_ovly_debug_event";
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
struct breakpoint *b;
struct breakpoint_objfile_data *bp_objfile_data;
CORE_ADDR addr;
- bp_objfile_data = get_breakpoint_objfile_data (objfile);
+ bp_objfile_data = get_breakpoint_objfile_data (&objfile);
if (msym_not_found_p (bp_objfile_data->overlay_msym.minsym))
continue;
@@ -3672,7 +3684,7 @@ create_overlay_event_breakpoint (void)
{
bound_minimal_symbol m
= lookup_minimal_symbol_text (current_program_space, func_name,
- objfile);
+ &objfile);
if (m.minsym == NULL)
{
/* Avoid future lookups in this objfile. */
@@ -3683,7 +3695,7 @@ create_overlay_event_breakpoint (void)
}
addr = bp_objfile_data->overlay_msym.value_address ();
- b = create_internal_breakpoint (objfile->arch (), addr,
+ b = create_internal_breakpoint (objfile.arch (), addr,
bp_overlay_event);
b->locspec = new_explicit_location_spec_function (func_name);
@@ -3808,19 +3820,19 @@ create_longjmp_master_breakpoint (void)
{
set_current_program_space (pspace);
- for (objfile *obj : pspace->objfiles ())
+ for (objfile &obj : pspace->objfiles ())
{
/* Skip separate debug object, it's handled in the loop below. */
- if (obj->separate_debug_objfile_backlink != nullptr)
+ if (obj.separate_debug_objfile_backlink != nullptr)
continue;
/* Try a probe kind breakpoint on main objfile. */
- if (create_longjmp_master_breakpoint_probe (obj))
+ if (create_longjmp_master_breakpoint_probe (&obj))
continue;
/* Try longjmp_names kind breakpoints on main and separate_debug
objfiles. */
- for (objfile *debug_objfile : obj->separate_debug_objfiles ())
+ for (objfile *debug_objfile : obj.separate_debug_objfiles ())
if (create_longjmp_master_breakpoint_names (debug_objfile))
break;
}
@@ -3840,12 +3852,12 @@ create_std_terminate_master_breakpoint (void)
{
set_current_program_space (pspace);
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
struct breakpoint *b;
struct breakpoint_objfile_data *bp_objfile_data;
- bp_objfile_data = get_breakpoint_objfile_data (objfile);
+ bp_objfile_data = get_breakpoint_objfile_data (&objfile);
if (msym_not_found_p (bp_objfile_data->terminate_msym.minsym))
continue;
@@ -3854,7 +3866,7 @@ create_std_terminate_master_breakpoint (void)
{
bound_minimal_symbol m
= lookup_minimal_symbol (current_program_space, func_name,
- objfile);
+ &objfile);
if (m.minsym == NULL || (m.minsym->type () != mst_text
&& m.minsym->type () != mst_file_text))
{
@@ -3865,7 +3877,7 @@ create_std_terminate_master_breakpoint (void)
bp_objfile_data->terminate_msym = m;
}
- b = create_internal_breakpoint (objfile->arch (),
+ b = create_internal_breakpoint (objfile.arch (),
bp_objfile_data->terminate_msym,
bp_std_terminate_master);
b->locspec = new_explicit_location_spec_function (func_name);
@@ -3969,19 +3981,19 @@ create_exception_master_breakpoint_hook (objfile *objfile)
static void
create_exception_master_breakpoint (void)
{
- for (objfile *obj : current_program_space->objfiles ())
+ for (objfile &obj : current_program_space->objfiles ())
{
/* Skip separate debug object. */
- if (obj->separate_debug_objfile_backlink)
+ if (obj.separate_debug_objfile_backlink)
continue;
/* Try a probe kind breakpoint. */
- if (create_exception_master_breakpoint_probe (obj))
+ if (create_exception_master_breakpoint_probe (&obj))
continue;
/* Iterate over main and separate debug objects and try an
_Unwind_DebugHook kind breakpoint. */
- for (objfile *debug_objfile : obj->separate_debug_objfiles ())
+ for (objfile *debug_objfile : obj.separate_debug_objfiles ())
if (create_exception_master_breakpoint_hook (debug_objfile))
break;
}
@@ -5136,7 +5148,7 @@ print_solib_event (bool is_catchpoint)
if (!first)
current_uiout->text (" ");
first = false;
- current_uiout->field_string ("library", iter->so_name);
+ current_uiout->field_string ("library", iter->name);
current_uiout->text ("\n");
}
}
@@ -7504,7 +7516,7 @@ breakpoint_locations_match (const struct bp_location *loc1,
else
/* We compare bp_location.length in order to cover ranged
breakpoints. Keep this in sync with
- bp_location_is_less_than. */
+ bp_location_ptr_is_less_than. */
return (breakpoint_address_match (loc1->pspace->aspace.get (),
loc1->address,
loc2->pspace->aspace.get (),
@@ -8144,7 +8156,7 @@ disable_breakpoints_in_unloaded_shlib (program_space *pspace, const solib &solib
target_terminal::ours_for_output ();
warning (_("Temporarily disabling breakpoints "
"for unloaded shared library \"%s\""),
- solib.so_name.c_str ());
+ solib.name.c_str ());
disabled_shlib_breaks = true;
}
}
@@ -10289,7 +10301,7 @@ masked_watchpoint::print_recreate (struct ui_file *fp) const
}
gdb_printf (fp, " %s mask 0x%s", exp_string.get (),
- phex (hw_wp_mask, sizeof (CORE_ADDR)));
+ phex (hw_wp_mask));
print_recreate_thread (fp);
}
@@ -10457,7 +10469,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
int len;
len = exp_end - exp_start;
- while (len > 0 && isspace (exp_start[len - 1]))
+ while (len > 0 && c_isspace (exp_start[len - 1]))
len--;
error (_("Cannot watch constant value `%.*s'."), len, exp_start);
}
@@ -11205,14 +11217,17 @@ breakpoint_auto_delete (bpstat *bs)
delete_breakpoint (&b);
}
-/* A comparison function for bp_location AP and BP being interfaced to
- std::sort. Sort elements primarily by their ADDRESS (no matter what
- bl_address_is_meaningful says), secondarily by ordering first
- permanent elements and tertiarily just ensuring the array is sorted
- stable way despite std::sort being an unstable algorithm. */
+/* A comparison function for bp_location pointers A and B being interfaced to
+ std::sort, for instance to sort an std::vector<bp_location *>. Sort
+ elements:
+ - primarily by their ADDRESS (no matter what bl_address_is_meaningful
+ says),
+ - secondarily by ordering first permanent elements, and
+ - tertiarily just ensuring the array is sorted in a stable way despite
+ std::sort being an unstable algorithm. */
-static int
-bp_location_is_less_than (const bp_location *a, const bp_location *b)
+static bool
+bp_location_ptr_is_less_than (const bp_location *a, const bp_location *b)
{
if (a->address != b->address)
return a->address < b->address;
@@ -11250,6 +11265,15 @@ bp_location_is_less_than (const bp_location *a, const bp_location *b)
return a < b;
}
+/* A comparison function for bp_locations A and B being interfaced to
+ std::sort, for instance to sort an std::vector<bp_location>. */
+
+static bool
+bp_location_is_less_than (const bp_location &a, const bp_location &b)
+{
+ return bp_location_ptr_is_less_than (&a, &b);
+}
+
/* Set bp_locations_placed_address_before_address_max and
bp_locations_shadow_len_after_address_max according to the current
content of the bp_locations array. */
@@ -11455,7 +11479,7 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
handle_automatic_hardware_breakpoints (loc);
std::sort (bp_locations.begin (), bp_locations.end (),
- bp_location_is_less_than);
+ bp_location_ptr_is_less_than);
bp_locations_target_extensions_update ();
@@ -11903,9 +11927,7 @@ breakpoint::add_location (bp_location &loc)
auto ub = std::upper_bound (m_locations.begin (), m_locations.end (),
loc,
- [] (const bp_location &left,
- const bp_location &right)
- { return left.address < right.address; });
+ bp_location_is_less_than);
m_locations.insert (ub, loc);
}
@@ -13986,9 +14008,7 @@ int
insert_single_step_breakpoints (struct gdbarch *gdbarch)
{
regcache *regcache = get_thread_regcache (inferior_thread ());
- std::vector<CORE_ADDR> next_pcs;
-
- next_pcs = gdbarch_software_single_step (gdbarch, regcache);
+ std::vector<CORE_ADDR> next_pcs = gdbarch_get_next_pcs (gdbarch, regcache);
if (!next_pcs.empty ())
{
@@ -14095,7 +14115,7 @@ strace_command (const char *arg, int from_tty)
/* Decide if we are dealing with a static tracepoint marker (`-m'),
or with a normal static tracepoint. */
- if (arg && startswith (arg, "-m") && isspace (arg[2]))
+ if (arg && startswith (arg, "-m") && c_isspace (arg[2]))
{
ops = &strace_marker_breakpoint_ops;
locspec = new_linespec_location_spec (&arg,
@@ -14747,9 +14767,7 @@ static struct cmd_list_element *enablebreaklist = NULL;
cmd_list_element *commands_cmd_element = nullptr;
-void _initialize_breakpoint ();
-void
-_initialize_breakpoint ()
+INIT_GDB_FILE (breakpoint)
{
struct cmd_list_element *c;
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 94fba1c..9341112 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1,5 +1,5 @@
/* Data structures associated with breakpoints in GDB.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -425,7 +425,9 @@ public:
simplicity is more important than memory usage for breakpoints. */
/* Architecture associated with this location's address. May be
- different from the breakpoint architecture. */
+ different from the breakpoint architecture. Not every location has
+ an address (e.g. see add_dummy_location), so not every location has
+ an associated gdbarch -- this can be NULL for a valid location. */
struct gdbarch *gdbarch = NULL;
/* The program space associated with this breakpoint location
@@ -1740,7 +1742,7 @@ extern void disable_overlay_breakpoints (void);
extern void set_std_terminate_breakpoint (void);
extern void delete_std_terminate_breakpoint (void);
-/* These functions respectively disable or reenable all currently
+/* These functions respectively disable or re-enable all currently
enabled watchpoints. When disabled, the watchpoints are marked
call_disabled. When re-enabled, they are marked enabled.
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index 19353eb..baffa76 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -1,6 +1,6 @@
/* BSD Kernel Data Access Library (libkvm) interface.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -388,11 +388,11 @@ Generic command for manipulating the kernel memory interface."),
#ifndef HAVE_STRUCT_THREAD_TD_PCB
add_cmd ("proc", class_obscure, bsd_kvm_proc_cmd,
- _("Set current context from proc address"), &bsd_kvm_cmdlist);
+ _("Set current context from proc address."), &bsd_kvm_cmdlist);
#endif
add_cmd ("pcb", class_obscure, bsd_kvm_pcb_cmd,
/* i18n: PCB == "Process Control Block". */
- _("Set current context from pcb address"), &bsd_kvm_cmdlist);
+ _("Set current context from pcb address."), &bsd_kvm_cmdlist);
/* Some notes on the ptid usage on this target.
diff --git a/gdb/bsd-kvm.h b/gdb/bsd-kvm.h
index 6ddd154..92c2d78 100644
--- a/gdb/bsd-kvm.h
+++ b/gdb/bsd-kvm.h
@@ -1,6 +1,6 @@
/* BSD Kernel Data Access Library (libkvm) interface.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index 129e7a6..4509376 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -1,6 +1,6 @@
/* BSD user-level threads support.
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -25,7 +25,6 @@
#include "observable.h"
#include "regcache.h"
#include "solib.h"
-#include "solist.h"
#include "symfile.h"
#include "target.h"
@@ -280,13 +279,13 @@ bsd_uthread_solib_loaded (solib &so)
for (names = bsd_uthread_solib_names; *names; names++)
{
- if (startswith (so.so_original_name, *names))
+ if (startswith (so.original_name, *names))
{
solib_read_symbols (so, 0);
if (bsd_uthread_activate (so.objfile))
{
- bsd_uthread_solib_name = so.so_original_name;
+ bsd_uthread_solib_name = so.original_name;
return;
}
}
@@ -300,7 +299,7 @@ bsd_uthread_solib_unloaded (program_space *pspace, const solib &so,
if (bsd_uthread_solib_name.empty () || still_in_use)
return;
- if (so.so_original_name == bsd_uthread_solib_name)
+ if (so.original_name == bsd_uthread_solib_name)
bsd_uthread_deactivate ();
}
@@ -536,14 +535,12 @@ bsd_uthread_target::pid_to_str (ptid_t ptid)
if (ptid.tid () != 0)
return string_printf ("process %d, thread 0x%s",
ptid.pid (),
- phex_nz (ptid.tid (), sizeof (ULONGEST)));
+ phex_nz (ptid.tid ()));
return normal_pid_to_str (ptid);
}
-void _initialize_bsd_uthread ();
-void
-_initialize_bsd_uthread ()
+INIT_GDB_FILE (bsd_uthread)
{
gdb::observers::inferior_created.attach (bsd_uthread_inferior_created,
"bsd-uthread");
diff --git a/gdb/bsd-uthread.h b/gdb/bsd-uthread.h
index e236eaa..567a886 100644
--- a/gdb/bsd-uthread.h
+++ b/gdb/bsd-uthread.h
@@ -1,6 +1,6 @@
/* BSD user-level threads support.
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/bt-utils.c b/gdb/bt-utils.c
index 64d7701..922402e 100644
--- a/gdb/bt-utils.c
+++ b/gdb/bt-utils.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -40,6 +40,17 @@ gdb_internal_backtrace_set_cmd (const char *args, int from_tty,
#endif
}
+/* See bt-utils.h. */
+
+void
+sig_write (const char *msg)
+{
+ if (gdb_stderr == nullptr || gdb_stderr->fd () == -1)
+ std::ignore = ::write (2, msg, strlen (msg));
+ else
+ gdb_stderr->write_async_safe (msg, strlen (msg));
+}
+
#ifdef GDB_PRINT_INTERNAL_BACKTRACE
#ifdef GDB_PRINT_INTERNAL_BACKTRACE_USING_LIBBACKTRACE
@@ -53,11 +64,6 @@ libbacktrace_error (void *data, const char *errmsg, int errnum)
if (errnum < 0)
return;
- const auto sig_write = [] (const char *msg) -> void
- {
- gdb_stderr->write_async_safe (msg, strlen (msg));
- };
-
sig_write ("error creating backtrace: ");
sig_write (errmsg);
if (errnum > 0)
@@ -77,11 +83,6 @@ static int
libbacktrace_print (void *data, uintptr_t pc, const char *filename,
int lineno, const char *function)
{
- const auto sig_write = [] (const char *msg) -> void
- {
- gdb_stderr->write_async_safe (msg, strlen (msg));
- };
-
/* Buffer to print addresses and line numbers into. An 8-byte address
with '0x' prefix and a null terminator requires 20 characters. This
also feels like it should be enough to represent line numbers in most
@@ -128,16 +129,14 @@ gdb_internal_backtrace_1 ()
static void
gdb_internal_backtrace_1 ()
{
- const auto sig_write = [] (const char *msg) -> void
- {
- gdb_stderr->write_async_safe (msg, strlen (msg));
- };
-
/* Allow up to 25 frames of backtrace. */
void *buffer[25];
int frames = backtrace (buffer, ARRAY_SIZE (buffer));
- backtrace_symbols_fd (buffer, frames, gdb_stderr->fd ());
+ int fd = ((gdb_stderr == nullptr || gdb_stderr->fd () == -1)
+ ? 2
+ : gdb_stderr->fd ());
+ backtrace_symbols_fd (buffer, frames, fd);
if (frames == ARRAY_SIZE (buffer))
sig_write (_("Backtrace might be incomplete.\n"));
}
@@ -171,17 +170,9 @@ gdb_internal_backtrace ()
return;
#ifdef GDB_PRINT_INTERNAL_BACKTRACE
- const auto sig_write = [] (const char *msg) -> void
- {
- gdb_stderr->write_async_safe (msg, strlen (msg));
- };
-
sig_write (str_backtrace);
- if (gdb_stderr->fd () > -1)
- gdb_internal_backtrace_1 ();
- else
- sig_write (str_backtrace_unavailable);
+ gdb_internal_backtrace_1 ();
sig_write ("---------------------\n");
#endif
diff --git a/gdb/bt-utils.h b/gdb/bt-utils.h
index 0981ed7..c2fbe97 100644
--- a/gdb/bt-utils.h
+++ b/gdb/bt-utils.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -75,4 +75,9 @@ extern void gdb_internal_backtrace_set_cmd (const char *args, int from_tty,
extern void gdb_internal_backtrace_init_str ();
+/* Print MSG to gdb_stderr or stderr in a way that is safe to do from an
+ interrupt handler. */
+
+extern void sig_write (const char *msg);
+
#endif /* GDB_BT_UTILS_H */
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 152f6f2..ed7e41d 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -1,6 +1,6 @@
/* Branch trace support for GDB, the GNU debugger.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
@@ -39,7 +39,6 @@
#include "record-btrace.h"
#include <inttypes.h>
-#include <ctype.h>
#include <algorithm>
#include <string>
@@ -1531,23 +1530,23 @@ handle_pt_insn_events (struct btrace_thread_info *btinfo,
if (event.variant.vmexit.has_vmxr != 0)
{
- std::string seperator = aux_string.back () == ':' ? "" : ",";
- aux_string += seperator + std::string (" vmxr = ")
+ std::string separator = aux_string.back () == ':' ? "" : ",";
+ aux_string += separator + std::string (" vmxr = ")
+ hex_string (event.variant.vmexit.vmxr);
}
if (event.variant.vmexit.has_vmxq != 0)
{
- std::string seperator = aux_string.back () == ':' ? "" : ",";
- aux_string += seperator + std::string (" vmxq = ")
+ std::string separator = aux_string.back () == ':' ? "" : ",";
+ aux_string += separator + std::string (" vmxq = ")
+ hex_string (event.variant.vmexit.vmxq);
}
if (event.ip_suppressed == 0)
{
pc = event.variant.vmexit.ip;
- std::string seperator = aux_string.back () == ':' ? "" : ",";
- aux_string += seperator + std::string (" ip = ")
+ std::string separator = aux_string.back () == ':' ? "" : ",";
+ aux_string += separator + std::string (" ip = ")
+ hex_string (*pc);
}
@@ -2136,7 +2135,7 @@ btrace_stitch_bts (struct btrace_data_bts *btrace, struct thread_info *tp)
/* Adjust the block trace in order to stitch old and new trace together.
BTRACE is the new delta trace between the last and the current stop.
TP is the traced thread.
- May modifx BTRACE as well as the existing trace in TP.
+ May modify BTRACE as well as the existing trace in TP.
Return 0 on success, -1 otherwise. */
static int
@@ -2366,8 +2365,8 @@ btrace_free_objfile (struct objfile *objfile)
{
DEBUG ("free objfile");
- for (thread_info *tp : all_non_exited_threads ())
- btrace_clear (tp);
+ for (thread_info &tp : all_non_exited_threads ())
+ btrace_clear (&tp);
}
/* See btrace.h. */
@@ -3258,7 +3257,7 @@ get_uint (const char **arg)
begin = *arg;
pos = skip_spaces (begin);
- if (!isdigit (*pos))
+ if (!c_isdigit (*pos))
error (_("Expected positive number, got: %s."), pos);
number = strtoul (pos, &end, 10);
@@ -3277,7 +3276,7 @@ get_context_size (const char **arg)
{
const char *pos = skip_spaces (*arg);
- if (!isdigit (*pos))
+ if (!c_isdigit (*pos))
error (_("Expected positive number, got: %s."), pos);
char *end;
@@ -3501,9 +3500,7 @@ show_maint_btrace_pt_skip_pad (struct ui_file *file, int from_tty,
/* Initialize btrace maintenance commands. */
-void _initialize_btrace ();
-void
-_initialize_btrace ()
+INIT_GDB_FILE (btrace)
{
add_cmd ("btrace", class_maintenance, maint_info_btrace_cmd,
_("Info about branch tracing data."), &maintenanceinfolist);
diff --git a/gdb/btrace.h b/gdb/btrace.h
index e8867c8..558fe49 100644
--- a/gdb/btrace.h
+++ b/gdb/btrace.h
@@ -1,6 +1,6 @@
/* Branch trace support for GDB, the GNU debugger.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>.
diff --git a/gdb/build-id.c b/gdb/build-id.c
index 43a80dd..0ecd79f 100644
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -1,6 +1,6 @@
/* build-id-related functions.
- Copyright (C) 1991-2024 Free Software Foundation, Inc.
+ Copyright (C) 1991-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -29,6 +29,7 @@
#include "gdbsupport/scoped_fd.h"
#include "debuginfod-support.h"
#include "extension.h"
+#include "inferior.h"
/* See build-id.h. */
@@ -128,8 +129,9 @@ build_id_to_debug_bfd_1 (const std::string &original_link,
if (supports_target_stat != TRIBOOL_FALSE)
{
struct stat sb;
- int res = target_fileio_stat (nullptr, link_on_target, &sb,
- &target_errno);
+ int res = target_fileio_lstat (current_inferior (),
+ link_on_target, &sb,
+ &target_errno);
if (res != 0 && target_errno != FILEIO_ENOSYS)
{
@@ -157,7 +159,7 @@ build_id_to_debug_bfd_1 (const std::string &original_link,
the path doesn't exist, but we just assume that anything
other than EINVAL indicates the path doesn't exist. */
std::optional<std::string> link_target
- = target_fileio_readlink (nullptr, link_on_target,
+ = target_fileio_readlink (current_inferior (), link_on_target,
&target_errno);
if (link_target.has_value ()
|| target_errno == FILEIO_EINVAL)
diff --git a/gdb/build-id.h b/gdb/build-id.h
index e2a62fd..ffdb306 100644
--- a/gdb/build-id.h
+++ b/gdb/build-id.h
@@ -1,6 +1,6 @@
/* build-id-related functions.
- Copyright (C) 1991-2024 Free Software Foundation, Inc.
+ Copyright (C) 1991-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/buildsym-legacy.c b/gdb/buildsym-legacy.c
index a2d786b..af7bb53 100644
--- a/gdb/buildsym-legacy.c
+++ b/gdb/buildsym-legacy.c
@@ -1,5 +1,5 @@
/* Legacy support routines for building symbol tables in GDB's internal format.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/buildsym-legacy.h b/gdb/buildsym-legacy.h
index 1f032c4..4ae8e1a 100644
--- a/gdb/buildsym-legacy.h
+++ b/gdb/buildsym-legacy.h
@@ -1,5 +1,5 @@
/* Build symbol tables in GDB's internal format - legacy APIs
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 02d6848..2a8e95e 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -1,5 +1,5 @@
/* Support routines for building symbol tables in GDB's internal format.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -57,13 +57,11 @@ buildsym_compunit::buildsym_compunit (struct objfile *objfile_,
: m_objfile (objfile_),
m_last_source_file (name == nullptr ? nullptr : xstrdup (name)),
m_comp_dir (comp_dir_ == nullptr ? "" : comp_dir_),
+ m_owned_compunit_symtab (std::make_unique<compunit_symtab> (m_objfile, name)),
+ m_compunit_symtab (m_owned_compunit_symtab.get ()),
m_language (language_),
m_last_source_start_addr (last_addr)
{
- /* Allocate the compunit symtab now. The caller needs it to allocate
- non-primary symtabs. It is also needed by get_macro_table. */
- m_compunit_symtab = allocate_compunit_symtab (m_objfile, name);
-
/* Build the subfile for NAME (the main source file) so that we can record
a pointer to it for later.
IMPORTANT: Do not allocate a struct symtab for NAME here.
@@ -982,7 +980,7 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
}
}
- add_compunit_symtab_to_objfile (cu);
+ add_compunit_symtab_to_objfile (std::move (m_owned_compunit_symtab));
return cu;
}
diff --git a/gdb/buildsym.h b/gdb/buildsym.h
index 1d30f55..5d4b582 100644
--- a/gdb/buildsym.h
+++ b/gdb/buildsym.h
@@ -1,5 +1,5 @@
/* Build symbol tables in GDB's internal format.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -55,7 +55,7 @@ struct subfile
struct subfile *next = nullptr;
std::string name;
- /* This field is analoguous in function to symtab::filename_for_id.
+ /* This field is analogous in function to symtab::filename_for_id.
It is used to look up existing subfiles in calls to start_subfile. */
std::string name_for_id;
@@ -384,8 +384,11 @@ private:
the same lifetime as objfile. */
const char *m_debugformat = nullptr;
- /* The compunit we are building. */
- struct compunit_symtab *m_compunit_symtab = nullptr;
+ /* The compunit we are building. If the symtab is owned by this
+ object, both fields are set. For a re-opened symtab, only
+ m_compunit_symtab is set. */
+ std::unique_ptr<compunit_symtab> m_owned_compunit_symtab;
+ compunit_symtab *m_compunit_symtab;
/* Language of this compunit_symtab. */
enum language m_language;
diff --git a/gdb/c-exp.h b/gdb/c-exp.h
index a6c084d..f15185f 100644
--- a/gdb/c-exp.h
+++ b/gdb/c-exp.h
@@ -1,6 +1,6 @@
/* Definitions for C expressions
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 645cb59..11f0d88 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1,5 +1,5 @@
/* YACC parser for C expressions, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -35,7 +35,6 @@
%{
-#include <ctype.h>
#include "expression.h"
#include "value.h"
#include "parser-defs.h"
@@ -106,8 +105,35 @@ struct c_parse_state
/* The type stack. */
struct type_stack type_stack;
+
+ /* When set, a name token is not looked up. This can be useful when
+ the search domain is known by context. TYPE_CODE_UNDEF is used
+ to mean "unset" here -- typically only types with tags (enum,
+ struct, class, union) use this feature, but TYPE_CODE_VOID is
+ also used to avoid the lookup for field names. */
+ type_code assume_classification = TYPE_CODE_UNDEF;
+};
+
+/* Used for field names, which skip name lookup. */
+struct qualified_name_token
+{
+ /* The prefix, if any. This can be nullptr. */
+ const char *prefix;
+ /* The field name itself. */
+ const char *name;
+ /* True if the COMPLETE token was seen. */
+ bool complete;
};
+/* A convenient overload of copy_name. */
+static std::string
+copy_name (qualified_name_token token)
+{
+ if (token.prefix == nullptr)
+ return token.name;
+ return std::string (token.prefix) + "::" + token.name;
+}
+
/* This is set and cleared in c_parse. */
static struct c_parse_state *cpstate;
@@ -120,6 +146,8 @@ static void yyerror (const char *);
static int type_aggregate_p (struct type *);
+static void handle_qualified_field_name (qualified_name_token token);
+
using namespace expr;
%}
@@ -140,6 +168,7 @@ using namespace expr;
} typed_val_float;
struct type *tval;
struct stoken sval;
+ qualified_name_token qval;
struct typed_stoken tsval;
struct ttype tsym;
struct symtoken ssym;
@@ -160,7 +189,7 @@ using namespace expr;
static int parse_number (struct parser_state *par_state,
const char *, int, int, YYSTYPE *);
static struct stoken operator_stoken (const char *);
-static struct stoken typename_stoken (const char *);
+static qualified_name_token typename_stoken (const char *);
static void check_parameter_typelist (std::vector<struct type *> *);
#if defined(YYBISON) && YYBISON < 30800
@@ -171,7 +200,7 @@ static void c_print_token (FILE *file, int type, YYSTYPE value);
%type <voidval> exp exp1 type_exp start variable qualified_name lcurly function_method
%type <lval> rcurly
-%type <tval> type typebase scalar_type
+%type <tval> type typebase scalar_type tag_name_or_complete
%type <tvec> nonempty_typelist func_mod parameter_typelist
/* %type <bval> block */
@@ -202,7 +231,9 @@ static void c_print_token (FILE *file, int type, YYSTYPE value);
%token <voidval> COMPLETE
%token <tsym> TYPENAME
%token <theclass> CLASSNAME /* ObjC Class name */
-%type <sval> name field_name
+%type <sval> name
+%type <qval> qual_field_name field_name field_name_or_complete
+%type <qval> field_or_destructor
%type <svec> string_exp
%type <ssym> name_not_typename
%type <tsym> type_name
@@ -364,117 +395,73 @@ exp : ALIGNOF '(' type_exp ')' %prec UNARY
{ pstate->wrap<unop_alignof_operation> (); }
;
-exp : exp ARROW field_name
+exp : exp ARROW
{
- pstate->push_new<structop_ptr_operation>
- (pstate->pop (), copy_name ($3));
+ cpstate->assume_classification = TYPE_CODE_VOID;
}
- ;
-
-exp : exp ARROW field_name COMPLETE
+ field_name_or_complete
{
- structop_base_operation *op
- = new structop_ptr_operation (pstate->pop (),
- copy_name ($3));
- pstate->mark_struct_expression (op);
- pstate->push (operation_up (op));
- }
- ;
+ cpstate->assume_classification = TYPE_CODE_UNDEF;
-exp : exp ARROW COMPLETE
- {
- structop_base_operation *op
- = new structop_ptr_operation (pstate->pop (), "");
- pstate->mark_struct_expression (op);
- pstate->push (operation_up (op));
- }
- ;
-
-exp : exp ARROW '~' name
- {
- pstate->push_new<structop_ptr_operation>
- (pstate->pop (), "~" + copy_name ($4));
- }
- ;
-
-exp : exp ARROW '~' name COMPLETE
- {
- structop_base_operation *op
- = new structop_ptr_operation (pstate->pop (),
- "~" + copy_name ($4));
- pstate->mark_struct_expression (op);
- pstate->push (operation_up (op));
+ if ($4.prefix != nullptr)
+ {
+ handle_qualified_field_name ($4);
+ /* exp->type::name becomes exp->*(&type::name) */
+ /* Note: this doesn't work if name is a
+ static member! FIXME */
+ pstate->wrap<unop_addr_operation> ();
+ pstate->wrap2<structop_mptr_operation> ();
+ }
+ else
+ {
+ structop_base_operation *op
+ = new structop_ptr_operation (pstate->pop (),
+ copy_name ($4));
+ if ($4.complete)
+ pstate->mark_struct_expression (op);
+ pstate->push (operation_up (op));
+ }
}
;
-exp : exp ARROW qualified_name
- { /* exp->type::name becomes exp->*(&type::name) */
- /* Note: this doesn't work if name is a
- static member! FIXME */
- pstate->wrap<unop_addr_operation> ();
- pstate->wrap2<structop_mptr_operation> (); }
- ;
-
exp : exp ARROW_STAR exp
{ pstate->wrap2<structop_mptr_operation> (); }
;
-exp : exp '.' field_name
- {
- if (pstate->language ()->la_language
- == language_opencl)
- pstate->push_new<opencl_structop_operation>
- (pstate->pop (), copy_name ($3));
- else
- pstate->push_new<structop_operation>
- (pstate->pop (), copy_name ($3));
- }
- ;
-
-exp : exp '.' field_name COMPLETE
- {
- structop_base_operation *op
- = new structop_operation (pstate->pop (),
- copy_name ($3));
- pstate->mark_struct_expression (op);
- pstate->push (operation_up (op));
- }
- ;
-
-exp : exp '.' COMPLETE
+exp : exp '.'
{
- structop_base_operation *op
- = new structop_operation (pstate->pop (), "");
- pstate->mark_struct_expression (op);
- pstate->push (operation_up (op));
+ cpstate->assume_classification = TYPE_CODE_VOID;
}
- ;
-
-exp : exp '.' '~' name
+ field_name_or_complete
{
- pstate->push_new<structop_operation>
- (pstate->pop (), "~" + copy_name ($4));
- }
- ;
+ cpstate->assume_classification = TYPE_CODE_UNDEF;
-exp : exp '.' '~' name COMPLETE
- {
- structop_base_operation *op
- = new structop_operation (pstate->pop (),
- "~" + copy_name ($4));
- pstate->mark_struct_expression (op);
- pstate->push (operation_up (op));
+ if ($4.prefix != nullptr)
+ {
+ handle_qualified_field_name ($4);
+ /* exp.type::name becomes exp.*(&type::name) */
+ /* Note: this doesn't work if name is a
+ static member! FIXME */
+ pstate->wrap<unop_addr_operation> ();
+ pstate->wrap2<structop_member_operation> ();
+ }
+ else if (pstate->language ()->la_language
+ == language_opencl
+ && !$4.complete)
+ pstate->push_new<opencl_structop_operation>
+ (pstate->pop (), copy_name ($4));
+ else
+ {
+ structop_base_operation *op
+ = new structop_operation (pstate->pop (),
+ copy_name ($4));
+ if ($4.complete)
+ pstate->mark_struct_expression (op);
+ pstate->push (operation_up (op));
+ }
}
;
-exp : exp '.' qualified_name
- { /* exp.type::name becomes exp.*(&type::name) */
- /* Note: this doesn't work if name is a
- static member! FIXME */
- pstate->wrap<unop_addr_operation> ();
- pstate->wrap2<structop_member_operation> (); }
- ;
-
exp : exp DOT_STAR exp
{ pstate->wrap2<structop_member_operation> (); }
;
@@ -1261,12 +1248,12 @@ single_qualifier:
{ cpstate->type_stack.insert (tp_restrict); }
| '@' NAME
{
- cpstate->type_stack.insert (pstate,
+ cpstate->type_stack.insert (pstate->gdbarch (),
copy_name ($2.stoken).c_str ());
}
| '@' UNKNOWN_CPP_NAME
{
- cpstate->type_stack.insert (pstate,
+ cpstate->type_stack.insert (pstate->gdbarch (),
copy_name ($2.stoken).c_str ());
}
;
@@ -1316,15 +1303,13 @@ direct_abs_decl: '(' abs_decl ')'
| direct_abs_decl array_mod
{
cpstate->type_stack.push ($1);
- cpstate->type_stack.push ($2);
- cpstate->type_stack.push (tp_array);
+ cpstate->type_stack.push (tp_array, $2);
$$ = cpstate->type_stack.create ();
cpstate->type_stacks.emplace_back ($$);
}
| array_mod
{
- cpstate->type_stack.push ($1);
- cpstate->type_stack.push (tp_array);
+ cpstate->type_stack.push (tp_array, $1);
$$ = cpstate->type_stack.create ();
cpstate->type_stacks.emplace_back ($$);
}
@@ -1504,71 +1489,37 @@ typebase
{
$$ = init_complex_type (nullptr, $2);
}
- | STRUCT name
- { $$
- = lookup_struct (copy_name ($2).c_str (),
- pstate->expression_context_block);
- }
- | STRUCT COMPLETE
+ | STRUCT
{
- pstate->mark_completion_tag (TYPE_CODE_STRUCT,
- "", 0);
- $$ = NULL;
+ cpstate->assume_classification = TYPE_CODE_STRUCT;
}
- | STRUCT name COMPLETE
+ tag_name_or_complete
{
- pstate->mark_completion_tag (TYPE_CODE_STRUCT,
- $2.ptr, $2.length);
- $$ = NULL;
+ $$ = $3;
}
- | CLASS name
- { $$ = lookup_struct
- (copy_name ($2).c_str (),
- pstate->expression_context_block);
- }
- | CLASS COMPLETE
+ | CLASS
{
- pstate->mark_completion_tag (TYPE_CODE_STRUCT,
- "", 0);
- $$ = NULL;
+ cpstate->assume_classification = TYPE_CODE_STRUCT;
}
- | CLASS name COMPLETE
+ tag_name_or_complete
{
- pstate->mark_completion_tag (TYPE_CODE_STRUCT,
- $2.ptr, $2.length);
- $$ = NULL;
- }
- | UNION name
- { $$
- = lookup_union (copy_name ($2).c_str (),
- pstate->expression_context_block);
+ $$ = $3;
}
- | UNION COMPLETE
+ | ENUM
{
- pstate->mark_completion_tag (TYPE_CODE_UNION,
- "", 0);
- $$ = NULL;
+ cpstate->assume_classification = TYPE_CODE_ENUM;
}
- | UNION name COMPLETE
+ tag_name_or_complete
{
- pstate->mark_completion_tag (TYPE_CODE_UNION,
- $2.ptr, $2.length);
- $$ = NULL;
+ $$ = $3;
}
- | ENUM name
- { $$ = lookup_enum (copy_name ($2).c_str (),
- pstate->expression_context_block);
- }
- | ENUM COMPLETE
+ | UNION
{
- pstate->mark_completion_tag (TYPE_CODE_ENUM, "", 0);
- $$ = NULL;
+ cpstate->assume_classification = TYPE_CODE_UNION;
}
- | ENUM name COMPLETE
+ tag_name_or_complete
{
- pstate->mark_completion_tag (TYPE_CODE_ENUM, $2.ptr,
- $2.length);
- $$ = NULL;
+ $$ = $3;
}
/* It appears that this rule for templates is never
reduced; template recognition happens by lookahead
@@ -1793,13 +1744,66 @@ oper: OPERATOR NEW
}
;
+qual_field_name:
+ qual_field_name COLONCOLON name
+ {
+ $$.complete = false;
+ if ($1.prefix == nullptr)
+ $$.prefix = $1.name;
+ else
+ $$.prefix = obconcat (&cpstate->expansion_obstack,
+ $1.prefix, "::", $1.name, nullptr);
+ $$.name = obstack_strndup (&cpstate->expansion_obstack,
+ $3.ptr, $3.length);
+ }
+ | name
+ {
+ $$.complete = false;
+ $$.prefix = nullptr;
+ $$.name = obstack_strndup (&cpstate->expansion_obstack,
+ $1.ptr, $1.length);
+ }
+ ;
+
+field_or_destructor:
+ qual_field_name
+ | qual_field_name COLONCOLON '~' name
+ {
+ $$.complete = false;
+ if ($1.prefix == nullptr)
+ $$.prefix = $1.name;
+ else
+ $$.prefix = obconcat (&cpstate->expansion_obstack,
+ $1.prefix, "::", $1.name, nullptr);
+ char *name
+ = (char *) obstack_alloc (&cpstate->expansion_obstack,
+ $4.length + 2);
+ name[0] = '~';
+ memcpy (&name[1], $4.ptr, $4.length);
+ name[$4.length + 1] = '\0';
+ $$.name = name;
+ }
+ | '~' name
+ {
+ $$.complete = false;
+ $$.prefix = nullptr;
+ char *name
+ = (char *) obstack_alloc (&cpstate->expansion_obstack,
+ $2.length + 2);
+ name[0] = '~';
+ memcpy (&name[1], $2.ptr, $2.length);
+ name[$2.length + 1] = '\0';
+ $$.name = name;
+ }
+ ;
+
/* This rule exists in order to allow some tokens that would not normally
match the 'name' rule to appear as fields within a struct. The example
that initially motivated this was the RISC-V target which models the
floating point registers as a union with fields called 'float' and
'double'. */
field_name
- : name
+ : field_or_destructor
| DOUBLE_KEYWORD { $$ = typename_stoken ("double"); }
| FLOAT_KEYWORD { $$ = typename_stoken ("float"); }
| INT_KEYWORD { $$ = typename_stoken ("int"); }
@@ -1809,6 +1813,61 @@ field_name
| UNSIGNED { $$ = typename_stoken ("unsigned"); }
;
+field_name_or_complete
+ : field_name
+ | field_name COMPLETE
+ {
+ $$ = $1;
+ $$.complete = true;
+ }
+ | COMPLETE
+ {
+ $$ = typename_stoken ("");
+ $$.complete = true;
+ }
+ ;
+
+/* This rule is used when the preceding token is a keyword that takes
+ a tag name (e.g., "struct"). The "caller" should disable name
+ lookup, see c_parse_state::assume_classification. */
+tag_name_or_complete
+ : NAME
+ {
+ switch (cpstate->assume_classification)
+ {
+ case TYPE_CODE_STRUCT:
+ $$ = lookup_struct (copy_name ($1.stoken).c_str (),
+ pstate->expression_context_block);
+ break;
+ case TYPE_CODE_ENUM:
+ $$ = lookup_enum (copy_name ($1.stoken).c_str (),
+ pstate->expression_context_block);
+ break;
+ case TYPE_CODE_UNION:
+ $$ = lookup_union (copy_name ($1.stoken).c_str (),
+ pstate->expression_context_block);
+ break;
+ default:
+ gdb_assert_not_reached ();
+ }
+ cpstate->assume_classification = TYPE_CODE_UNDEF;
+ }
+ | COMPLETE
+ {
+ pstate->mark_completion_tag (cpstate->assume_classification,
+ "", 0);
+ cpstate->assume_classification = TYPE_CODE_UNDEF;
+ $$ = nullptr;
+ }
+ | NAME COMPLETE
+ {
+ pstate->mark_completion_tag (cpstate->assume_classification,
+ $1.stoken.ptr, $1.stoken.length);
+ cpstate->assume_classification = TYPE_CODE_UNDEF;
+ $$ = nullptr;
+ }
+ ;
+
name : NAME { $$ = $1.stoken; }
| BLOCKNAME { $$ = $1.stoken; }
| TYPENAME { $$ = $1.stoken; }
@@ -1866,12 +1925,10 @@ operator_stoken (const char *op)
/* Returns a stoken of the type named TYPE. */
-static struct stoken
+static qualified_name_token
typename_stoken (const char *type)
{
- struct stoken st = { type, 0 };
- st.length = strlen (type);
- return st;
+ return qualified_name_token { nullptr, type, false };
};
/* Return true if the type is aggregate-like. */
@@ -1969,13 +2026,13 @@ parse_number (struct parser_state *par_state,
len -= 2;
}
/* Handle suffixes: 'f' for float, 'l' for long double. */
- else if (len >= 1 && TOLOWER (buf[len - 1]) == 'f')
+ else if (len >= 1 && c_tolower (buf[len - 1]) == 'f')
{
putithere->typed_val_float.type
= parse_type (par_state)->builtin_float;
len -= 1;
}
- else if (len >= 1 && TOLOWER (buf[len - 1]) == 'l')
+ else if (len >= 1 && c_tolower (buf[len - 1]) == 'l')
{
putithere->typed_val_float.type
= parse_type (par_state)->builtin_long_double;
@@ -2181,9 +2238,9 @@ c_parse_escape (const char **ptr, struct obstack *output)
if (output)
obstack_grow_str (output, "\\x");
++tokptr;
- if (!ISXDIGIT (*tokptr))
+ if (!c_isxdigit (*tokptr))
error (_("\\x escape without a following hex digit"));
- while (ISXDIGIT (*tokptr))
+ while (c_isxdigit (*tokptr))
{
if (output)
obstack_1grow (output, *tokptr);
@@ -2206,7 +2263,7 @@ c_parse_escape (const char **ptr, struct obstack *output)
if (output)
obstack_grow_str (output, "\\");
for (i = 0;
- i < 3 && ISDIGIT (*tokptr) && *tokptr != '8' && *tokptr != '9';
+ i < 3 && c_isdigit (*tokptr) && *tokptr != '8' && *tokptr != '9';
++i)
{
if (output)
@@ -2231,9 +2288,9 @@ c_parse_escape (const char **ptr, struct obstack *output)
obstack_1grow (output, *tokptr);
}
++tokptr;
- if (!ISXDIGIT (*tokptr))
+ if (!c_isxdigit (*tokptr))
error (_("\\%c escape without a following hex digit"), c);
- for (i = 0; i < len && ISXDIGIT (*tokptr); ++i)
+ for (i = 0; i < len && c_isxdigit (*tokptr); ++i)
{
if (output)
obstack_1grow (output, *tokptr);
@@ -2818,7 +2875,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
size_t len = strlen ("selector");
if (strncmp (p, "selector", len) == 0
- && (p[len] == '\0' || ISSPACE (p[len])))
+ && (p[len] == '\0' || c_isspace (p[len])))
{
pstate->lexptr = p + len;
return SELECTOR;
@@ -2827,7 +2884,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
goto parse_string;
}
- while (ISSPACE (*p))
+ while (c_isspace (*p))
p++;
size_t len = strlen ("entry");
if (strncmp (p, "entry", len) == 0 && !c_ident_is_alnum (p[len])
@@ -3042,15 +3099,11 @@ classify_name (struct parser_state *par_state, const struct block *block,
std::string copy = copy_name (yylval.sval);
- /* Initialize this in case we *don't* use it in this call; that way
- we can refer to it unconditionally below. */
- memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
-
bsym = lookup_symbol (copy.c_str (), block, SEARCH_VFT,
par_state->language ()->name_of_this ()
? &is_a_field_of_this : NULL);
- if (bsym.symbol && bsym.symbol->aclass () == LOC_BLOCK)
+ if (bsym.symbol && bsym.symbol->loc_class () == LOC_BLOCK)
{
yylval.ssym.sym = bsym;
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
@@ -3098,7 +3151,7 @@ classify_name (struct parser_state *par_state, const struct block *block,
}
}
- if (bsym.symbol && bsym.symbol->aclass () == LOC_TYPEDEF)
+ if (bsym.symbol && bsym.symbol->loc_class () == LOC_TYPEDEF)
{
yylval.tsym.type = bsym.symbol->type ();
return TYPENAME;
@@ -3193,7 +3246,7 @@ classify_inner_name (struct parser_state *par_state,
return ERROR;
}
- switch (yylval.ssym.sym.symbol->aclass ())
+ switch (yylval.ssym.sym.symbol->loc_class ())
{
case LOC_BLOCK:
case LOC_LABEL:
@@ -3222,6 +3275,48 @@ classify_inner_name (struct parser_state *par_state,
internal_error (_("not reached"));
}
+/* A helper function for the specific case of a qualified field name,
+ like "obj->type1::type2::field". This takes the type prefix
+ ("type1::type2" in the example) and finds the corresponding type.
+ It will either throw an exception, or push a scope_operation on the
+ operation stack. */
+static void
+handle_qualified_field_name (qualified_name_token token)
+{
+ struct type *type = nullptr;
+ std::string accum;
+ for (const auto name : split_name (token.prefix, split_style::CXX))
+ {
+ std::string current (name);
+
+ if (accum.empty ())
+ accum = name;
+ else
+ accum = accum + "::" + current;
+
+ yylval.ssym.stoken.ptr = current.c_str ();
+ yylval.ssym.stoken.length = current.size ();
+ yylval.ssym.sym = {};
+ yylval.ssym.is_a_field_of_this = 0;
+
+ int kind = classify_inner_name (pstate,
+ pstate->expression_context_block,
+ type);
+ if (kind != TYPENAME)
+ error (_("could not find type '%s'"), accum.c_str ());
+
+ type = yylval.tsym.type;
+ }
+
+ type = check_typedef (type);
+ if (!type_aggregate_p (type))
+ error (_("`%s' is not defined as an aggregate type."),
+ TYPE_SAFE_NAME (type));
+ if (token.name[0] == '~')
+ destructor_name_p (token.name, type);
+ pstate->push_new<scope_operation> (type, token.name);
+}
+
/* The outer level of a two-level lexer. This calls the inner lexer
to return tokens. It then either returns these tokens, or
aggregates them into a larger token. This lets us work around a
@@ -3254,12 +3349,16 @@ yylex (void)
subsequent code is C++-only; but also depends on seeing a "::" or
name-like token. */
current.token = lex_one_token (pstate, &is_quoted_name);
- if (current.token == NAME)
+ if (cpstate->assume_classification == TYPE_CODE_UNDEF
+ && current.token == NAME)
current.token = classify_name (pstate, pstate->expression_context_block,
is_quoted_name, last_lex_was_structop);
if (pstate->language ()->la_language != language_cplus
|| (current.token != TYPENAME && current.token != COLONCOLON
- && current.token != FILENAME))
+ && current.token != FILENAME
+ && (cpstate->assume_classification == TYPE_CODE_UNDEF
+ || current.token != NAME))
+ || cpstate->assume_classification == TYPE_CODE_VOID)
return current.token;
/* Read any sequence of alternating "::" and name-like tokens into
@@ -3300,7 +3399,8 @@ yylex (void)
search_block = NULL;
else
{
- gdb_assert (current.token == TYPENAME);
+ gdb_assert (current.token == TYPENAME
+ || cpstate->assume_classification != TYPE_CODE_UNDEF);
search_block = pstate->expression_context_block;
obstack_grow (&name_obstack, current.value.sval.ptr,
current.value.sval.length);
@@ -3323,8 +3423,11 @@ yylex (void)
int classification;
yylval = next.value;
- classification = classify_inner_name (pstate, search_block,
- context_type);
+ if (cpstate->assume_classification != TYPE_CODE_UNDEF)
+ classification = NAME;
+ else
+ classification = classify_inner_name (pstate, search_block,
+ context_type);
/* We keep going until we either run out of names, or until
we have a qualified name which is not a type. */
if (classification != TYPENAME && classification != NAME)
@@ -3334,7 +3437,7 @@ yylex (void)
checkpoint = next_to_examine;
/* Update the partial name we are constructing. */
- if (context_type != NULL)
+ if (next_to_examine > 1)
{
/* We don't want to put a leading "::" into the name. */
obstack_grow_str (&name_obstack, "::");
@@ -3349,7 +3452,8 @@ yylex (void)
last_was_coloncolon = 0;
- if (classification == NAME)
+ if (cpstate->assume_classification == TYPE_CODE_UNDEF
+ && classification == NAME)
break;
context_type = yylval.tsym.type;
@@ -3396,18 +3500,18 @@ c_parse (struct parser_state *par_state)
c_parse_state cstate;
scoped_restore cstate_restore = make_scoped_restore (&cpstate, &cstate);
- gdb::unique_xmalloc_ptr<struct macro_scope> macro_scope;
+ macro_scope macro_scope;
if (par_state->expression_context_block)
macro_scope
= sal_macro_scope (find_pc_line (par_state->expression_context_pc, 0));
else
macro_scope = default_macro_scope ();
- if (! macro_scope)
+ if (!macro_scope.is_valid ())
macro_scope = user_macro_scope ();
scoped_restore restore_macro_scope
- = make_scoped_restore (&expression_macro_scope, macro_scope.get ());
+ = make_scoped_restore (&expression_macro_scope, &macro_scope);
scoped_restore restore_yydebug = make_scoped_restore (&yydebug,
par_state->debug);
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 5592234..e8e66a6 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -1,6 +1,6 @@
/* C language support routines for GDB, the GNU debugger.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -33,7 +33,6 @@
#include "cp-abi.h"
#include "cp-support.h"
#include "gdbsupport/gdb_obstack.h"
-#include <ctype.h>
#include "gdbcore.h"
#include "gdbarch.h"
#include "c-exp.h"
@@ -408,7 +407,7 @@ convert_ucn (const char *p, const char *limit, const char *dest_charset,
gdb_byte data[4];
int i;
- for (i = 0; i < length && p < limit && ISXDIGIT (*p); ++i, ++p)
+ for (i = 0; i < length && p < limit && c_isxdigit (*p); ++i, ++p)
result = (result << 4) + fromhex (*p);
for (i = 3; i >= 0; --i)
@@ -450,7 +449,7 @@ convert_octal (struct type *type, const char *p,
unsigned long value = 0;
for (i = 0;
- i < 3 && p < limit && ISDIGIT (*p) && *p != '8' && *p != '9';
+ i < 3 && p < limit && c_isdigit (*p) && *p != '8' && *p != '9';
++i)
{
value = 8 * value + fromhex (*p);
@@ -473,7 +472,7 @@ convert_hex (struct type *type, const char *p,
{
unsigned long value = 0;
- while (p < limit && ISXDIGIT (*p))
+ while (p < limit && c_isxdigit (*p))
{
value = 16 * value + fromhex (*p);
++p;
@@ -484,13 +483,6 @@ convert_hex (struct type *type, const char *p,
return p;
}
-#define ADVANCE \
- do { \
- ++p; \
- if (p == limit) \
- error (_("Malformed escape sequence")); \
- } while (0)
-
/* Convert an escape sequence to a target format. TYPE is the target
character type to use, and DEST_CHARSET is the name of the target
character set. The backslash of the escape sequence is at *P, and
@@ -502,19 +494,30 @@ static const char *
convert_escape (struct type *type, const char *dest_charset,
const char *p, const char *limit, struct obstack *output)
{
+ auto advance = [&] ()
+ {
+ ++p;
+ if (p == limit)
+ error (_("Malformed escape sequence"));
+ };
+
/* Skip the backslash. */
- ADVANCE;
+ advance ();
switch (*p)
{
case '\\':
- obstack_1grow (output, '\\');
+ /* Convert the backslash itself. This is probably overkill but
+ it doesn't hurt to do the full conversion. */
+ convert_between_encodings (host_charset (), dest_charset,
+ (const gdb_byte *) p, 1, 1,
+ output, translit_none);
++p;
break;
case 'x':
- ADVANCE;
- if (!ISXDIGIT (*p))
+ advance ();
+ if (!c_isxdigit (*p))
error (_("\\x used with no following hex digits."));
p = convert_hex (type, p, limit, output);
break;
@@ -535,8 +538,8 @@ convert_escape (struct type *type, const char *dest_charset,
{
int length = *p == 'u' ? 4 : 8;
- ADVANCE;
- if (!ISXDIGIT (*p))
+ advance ();
+ if (!c_isxdigit (*p))
error (_("\\u used with no following hex digits"));
p = convert_ucn (p, limit, dest_charset, output, length);
}
diff --git a/gdb/c-lang.h b/gdb/c-lang.h
index 06b7ad0..c4f729c 100644
--- a/gdb/c-lang.h
+++ b/gdb/c-lang.h
@@ -1,6 +1,6 @@
/* C language support definitions for GDB, the GNU debugger.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/c-support.h b/gdb/c-support.h
index 30858d1..5fd1118 100644
--- a/gdb/c-support.h
+++ b/gdb/c-support.h
@@ -1,5 +1,5 @@
/* Helper routines for C support in GDB.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -19,9 +19,7 @@
#ifndef GDB_C_SUPPORT_H
#define GDB_C_SUPPORT_H
-#include "safe-ctype.h"
-
-/* Like ISALPHA, but also returns true for the union of all UTF-8
+/* Like isalpha, but also returns true for the union of all UTF-8
multi-byte sequence bytes and non-ASCII characters in
extended-ASCII charsets (e.g., Latin1). I.e., returns true if the
high bit is set. Note that not all UTF-8 ranges are allowed in C++
@@ -32,15 +30,15 @@
static inline bool
c_ident_is_alpha (unsigned char ch)
{
- return ISALPHA (ch) || ch >= 0x80;
+ return c_isalpha (ch) || ch >= 0x80;
}
-/* Similarly, but Like ISALNUM. */
+/* Similarly, but Like isalnum. */
static inline bool
c_ident_is_alnum (unsigned char ch)
{
- return ISALNUM (ch) || ch >= 0x80;
+ return c_isalnum (ch) || ch >= 0x80;
}
#endif /* GDB_C_SUPPORT_H */
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 64a3808..be19987 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -1,5 +1,5 @@
/* Support for printing C and C++ types for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -251,8 +251,8 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
enum language language,
const struct type_print_options *flags)
{
- struct field *args = mtype->fields ();
- int nargs = mtype->num_fields ();
+ auto args = mtype->fields ();
+ int nargs = args.size ();
int varargs = mtype->has_varargs ();
int i;
@@ -515,16 +515,15 @@ c_type_print_args (struct type *type, struct ui_file *stream,
int linkage_name, enum language language,
const struct type_print_options *flags)
{
- int i;
int printed_any = 0;
gdb_printf (stream, "(");
- for (i = 0; i < type->num_fields (); i++)
+ for (const auto &field : type->fields ())
{
struct type *param_type;
- if (type->field (i).is_artificial () && linkage_name)
+ if (field.is_artificial () && linkage_name)
continue;
if (printed_any)
@@ -533,7 +532,7 @@ c_type_print_args (struct type *type, struct ui_file *stream,
stream->wrap_here (4);
}
- param_type = type->field (i).type ();
+ param_type = field.type ();
if (language == language_cplus && linkage_name)
{
@@ -815,7 +814,7 @@ c_type_print_template_args (const struct type_print_options *flags,
{
struct symbol *sym = TYPE_TEMPLATE_ARGUMENT (type, i);
- if (sym->aclass () != LOC_TYPEDEF)
+ if (sym->loc_class () != LOC_TYPEDEF)
continue;
if (first)
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index bad9490..1a51fed 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -1,6 +1,6 @@
/* Support for printing C values for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c
index 4751f0a..df407b1 100644
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -1,6 +1,6 @@
/* varobj support for C and C++.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/cgen-remap.h b/gdb/cgen-remap.h
index 30b8457..172c485 100644
--- a/gdb/cgen-remap.h
+++ b/gdb/cgen-remap.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2023-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/charset-list.h b/gdb/charset-list.h
index 9da3da2..2119e23 100644
--- a/gdb/charset-list.h
+++ b/gdb/charset-list.h
@@ -1,6 +1,6 @@
/* List of character set names for GDB.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/charset.c b/gdb/charset.c
index f1f66bb..fe725ef 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -1,6 +1,6 @@
/* Character set conversion support for GDB.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -24,7 +24,6 @@
#include "charset-list.h"
#include "gdbsupport/environ.h"
#include "arch-utils.h"
-#include <ctype.h>
#ifdef USE_WIN32API
#include <windows.h>
@@ -983,9 +982,7 @@ intermediate_encoding (void)
#endif /* USE_INTERMEDIATE_ENCODING_FUNCTION */
-void _initialize_charset ();
-void
-_initialize_charset ()
+INIT_GDB_FILE (charset)
{
/* The first element is always "auto". */
charsets.charsets.push_back (xstrdup ("auto"));
diff --git a/gdb/charset.h b/gdb/charset.h
index c4e0de5..a0f109d 100644
--- a/gdb/charset.h
+++ b/gdb/charset.h
@@ -1,5 +1,5 @@
/* Character set conversion support for GDB.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/check-include-guards.py b/gdb/check-include-guards.py
index 79b391d..366ae00 100755
--- a/gdb/check-include-guards.py
+++ b/gdb/check-include-guards.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/cli-out.c b/gdb/cli-out.c
index afa73eb..27a82f6 100644
--- a/gdb/cli-out.c
+++ b/gdb/cli-out.c
@@ -1,6 +1,6 @@
/* Output generating routines for GDB CLI.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
Written by Fernando Nasser for Cygnus.
diff --git a/gdb/cli-out.h b/gdb/cli-out.h
index bdbf990..c761dac 100644
--- a/gdb/cli-out.h
+++ b/gdb/cli-out.h
@@ -1,5 +1,5 @@
/* Output generating routines for GDB CLI.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
This file is part of GDB.
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 923b67b2..d353654 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1,6 +1,6 @@
/* GDB CLI commands.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -51,6 +51,7 @@
#include "cli/cli-cmds.h"
#include "cli/cli-style.h"
#include "cli/cli-utils.h"
+#include "terminal.h"
#include "extension.h"
#include "gdbsupport/pathstuff.h"
@@ -300,8 +301,8 @@ with_command_completer_1 (const char *set_cmd_prefix,
command as if it was a "set" command. */
if (delim == text
|| delim == nullptr
- || !isspace (delim[-1])
- || !(isspace (delim[2]) || delim[2] == '\0'))
+ || !c_isspace (delim[-1])
+ || !(c_isspace (delim[2]) || delim[2] == '\0'))
{
std::string new_text = std::string (set_cmd_prefix) + text;
tracker.advance_custom_word_point_by (-(int) strlen (set_cmd_prefix));
@@ -784,14 +785,14 @@ source_command (const char *args, int from_tty)
if (args[0] != '-')
break;
- if (args[1] == 'v' && isspace (args[2]))
+ if (args[1] == 'v' && c_isspace (args[2]))
{
source_verbose = 1;
/* Skip passed -v. */
args = &args[3];
}
- else if (args[1] == 's' && isspace (args[2]))
+ else if (args[1] == 's' && c_isspace (args[2]))
{
search_path = 1;
@@ -833,7 +834,7 @@ echo_command (const char *text, int from_tty)
gdb_printf ("%c", c);
}
- gdb_stdout->reset_style ();
+ gdb_stdout->emit_style_escape (ui_file_style ());
/* Force this output to appear now. */
gdb_flush (gdb_stdout);
@@ -949,9 +950,27 @@ shell_escape (const char *arg, int from_tty)
static void
shell_command (const char *arg, int from_tty)
{
+ scoped_gdb_ttystate save_restore_gdb_ttystate;
+ restore_initial_gdb_ttystate ();
+
shell_escape (arg, from_tty);
}
+/* Completion for the shell command. Currently, this just uses filename
+ completion, but we could, potentially, complete command names from $PATH
+ for the first word, which would make this even more shell like. */
+
+static void
+shell_command_completer (struct cmd_list_element *ignore,
+ completion_tracker &tracker,
+ const char *text, const char * /* word */)
+{
+ tracker.set_use_custom_word_point (true);
+ const char *word
+ = advance_to_filename_maybe_quoted_complete_word_point (tracker, text);
+ filename_maybe_quoted_completer (ignore, tracker, text, word);
+}
+
static void
edit_command (const char *arg, int from_tty)
{
@@ -1165,7 +1184,7 @@ pipe_command_completer (struct cmd_list_element *ignore,
delimiter = opts.delimiter.c_str ();
/* Check if we're past option values already. */
- if (text > org_text && !isspace (text[-1]))
+ if (text > org_text && !c_isspace (text[-1]))
return;
const char *delim = strstr (text, delimiter);
@@ -1178,8 +1197,32 @@ pipe_command_completer (struct cmd_list_element *ignore,
return;
}
- /* We're past the delimiter. What follows is a shell command, which
- we don't know how to complete. */
+ /* We're past the delimiter now, or at least, DELIM points to the
+ delimiter string. Update TEXT to point to the start of whatever
+ appears after the delimiter. */
+ text = skip_spaces (delim + strlen (delimiter));
+
+ /* We really are past the delimiter now, so offer completions. This is
+ like GDB's "shell" command, currently we only offer filename
+ completion, but in the future this could be improved by offering
+ completion of command names from $PATH.
+
+ What we don't do here is offer completions for the empty string. It
+ is assumed that the first word after the delimiter is going to be a
+ command name from $PATH, not a filename, so if the user has typed
+ nothing (yet) and tries to complete, there's no point offering a list
+ of files from the current directory.
+
+ Once the user has started to type something though, then we do start
+ offering filename completions. */
+ if (*text == '\0')
+ return;
+
+ tracker.set_use_custom_word_point (true);
+ tracker.advance_custom_word_point_by (text - org_text);
+ const char *word
+ = advance_to_filename_maybe_quoted_complete_word_point (tracker, text);
+ filename_maybe_quoted_completer (ignore, tracker, text, word);
}
/* Helper for the list_command function. Prints the lines around (and
@@ -1626,7 +1669,7 @@ disassemble_command (const char *arg, int from_tty)
if (*p == '\0')
error (_("Missing modifier."));
- while (*p && ! isspace (*p))
+ while (*p && ! c_isspace (*p))
{
switch (*p++)
{
@@ -1895,8 +1938,8 @@ alias_command_completer (struct cmd_list_element *ignore,
typing COMMAND DEFAULT-ARGS... */
if (delim != text
&& delim != nullptr
- && isspace (delim[-1])
- && (isspace (delim[1]) || delim[1] == '\0'))
+ && c_isspace (delim[-1])
+ && (c_isspace (delim[1]) || delim[1] == '\0'))
{
std::string new_text = std::string (delim + 1);
@@ -2578,9 +2621,7 @@ shell_internal_fn (struct gdbarch *gdbarch,
return value::allocate_optimized_out (int_type);
}
-void _initialize_cli_cmds ();
-void
-_initialize_cli_cmds ()
+INIT_GDB_FILE (cli_cmds)
{
struct cmd_list_element *c;
@@ -2803,7 +2844,7 @@ the previous command number shown."),
= add_com ("shell", class_support, shell_command, _("\
Execute the rest of the line as a shell command.\n\
With no arguments, run an inferior shell."));
- set_cmd_completer (shell_cmd, deprecated_filename_completer);
+ set_cmd_completer_handle_brkchars (shell_cmd, shell_command_completer);
add_com_alias ("!", shell_cmd, class_support, 0);
@@ -2861,6 +2902,7 @@ This can be changed using \"set listsize\", and the current value\n\
can be shown using \"show listsize\"."));
add_com_alias ("l", list_cmd, class_files, 1);
+ set_cmd_completer(list_cmd, location_completer);
c = add_com ("disassemble", class_vars, disassemble_command, _("\
Disassemble a specified section of memory.\n\
diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h
index 6719ad7..33d13fb 100644
--- a/gdb/cli/cli-cmds.h
+++ b/gdb/cli/cli-cmds.h
@@ -1,5 +1,5 @@
/* Header file for GDB CLI command implementation library.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 5008b48..2b30a6e 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -1,6 +1,6 @@
/* Handle lists of commands, their decoding and documentation, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -16,7 +16,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "symtab.h"
-#include <ctype.h>
#include "gdbsupport/gdb_regex.h"
#include "completer.h"
#include "ui-out.h"
@@ -2041,40 +2040,28 @@ void
print_doc_line (struct ui_file *stream, const char *str,
bool for_value_prefix)
{
- static char *line_buffer = 0;
- static int line_size;
- const char *p;
+ const char *p = strchr (str, '\n');
- if (!line_buffer)
- {
- line_size = 80;
- line_buffer = (char *) xmalloc (line_size);
- }
+ /* Only copy the input string if we really need to. */
+ std::optional<std::string> line_buffer;
+ if (p != nullptr)
+ line_buffer = std::string (str, p);
+ else if (for_value_prefix)
+ line_buffer = str;
- /* Searches for the first end of line or the end of STR. */
- p = str;
- while (*p && *p != '\n')
- p++;
- if (p - str > line_size - 1)
- {
- line_size = p - str + 1;
- xfree (line_buffer);
- line_buffer = (char *) xmalloc (line_size);
- }
- strncpy (line_buffer, str, p - str);
if (for_value_prefix)
{
- if (islower (line_buffer[0]))
- line_buffer[0] = toupper (line_buffer[0]);
- gdb_assert (p > str);
- if (line_buffer[p - str - 1] == '.')
- line_buffer[p - str - 1] = '\0';
- else
- line_buffer[p - str] = '\0';
+ char &c = (*line_buffer)[0];
+ if (c_islower (c))
+ c = c_toupper (c);
+ if (line_buffer->back () == '.')
+ line_buffer->pop_back ();
}
- else
- line_buffer[p - str] = '\0';
- gdb_puts (line_buffer, stream);
+
+ gdb_puts (line_buffer.has_value ()
+ ? line_buffer->c_str ()
+ : str,
+ stream);
}
/* Print one-line help for command C.
@@ -2239,7 +2226,7 @@ valid_cmd_char_p (int c)
/* Alas "42" is a legitimate user-defined command.
In the interests of not breaking anything we preserve that. */
- return isalnum (c) || c == '-' || c == '_' || c == '.';
+ return c_isalnum (c) || c == '-' || c == '_' || c == '.';
}
/* See command.h. */
@@ -2503,7 +2490,7 @@ lookup_cmd (const char **line, struct cmd_list_element *list,
}
else
{
- if (c->type == set_cmd && **line != '\0' && !isspace (**line))
+ if (c->type == set_cmd && **line != '\0' && !c_isspace (**line))
error (_("Argument must be preceded by space."));
/* We've got something. It may still not be what the caller
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index 85bd474..9be446f 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -1,6 +1,6 @@
/* Header file for GDB command decoding library.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -62,6 +62,8 @@ struct cmd_list_element
type (not_set_cmd),
doc (doc_)
{
+ gdb_assert (name != nullptr);
+ gdb_assert (doc != nullptr);
memset (&function, 0, sizeof (function));
}
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 2b9307e..3cdd9a3 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -1,6 +1,6 @@
/* Dump-to-file commands, for GDB, the GNU debugger.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Red Hat.
@@ -23,7 +23,6 @@
#include "cli/cli-cmds.h"
#include "value.h"
#include "completer.h"
-#include <ctype.h>
#include "target.h"
#include "readline/tilde.h"
#include "gdbcore.h"
@@ -397,7 +396,7 @@ restore_one_section (bfd *ibfd, asection *isec,
if (sec_end <= load_start
|| (load_end > 0 && sec_start >= load_end))
{
- /* No, no useable data in this section. */
+ /* No, no usable data in this section. */
gdb_printf (_("skipping section %s...\n"),
bfd_section_name (isec));
return;
@@ -564,9 +563,7 @@ restore_command (const char *args, int from_tty)
}
}
-void _initialize_cli_dump ();
-void
-_initialize_cli_dump ()
+INIT_GDB_FILE (cli_dump)
{
struct cmd_list_element *c;
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index dbe2ed1..d7b73df 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -1,6 +1,6 @@
/* CLI Definitions for GDB, the GNU debugger.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -321,9 +321,7 @@ cli_interp_factory (const char *name)
/* Standard gdb initialization hook. */
-void _initialize_cli_interp ();
-void
-_initialize_cli_interp ()
+INIT_GDB_FILE (cli_interp)
{
interp_factory_register (INTERP_CONSOLE, cli_interp_factory);
}
diff --git a/gdb/cli/cli-interp.h b/gdb/cli/cli-interp.h
index ed3d904..8f41725 100644
--- a/gdb/cli/cli-interp.h
+++ b/gdb/cli/cli-interp.h
@@ -1,6 +1,6 @@
/* CLI Definitions for GDB, the GNU debugger.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c
index 2c54cea..d6eb6c2 100644
--- a/gdb/cli/cli-logging.c
+++ b/gdb/cli/cli-logging.c
@@ -1,6 +1,6 @@
/* Command-line output logging for GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -202,9 +202,7 @@ show_logging_enabled (struct ui_file *file, int from_tty,
gdb_printf (file, _("off: Logging is disabled.\n"));
}
-void _initialize_cli_logging ();
-void
-_initialize_cli_logging ()
+INIT_GDB_FILE (cli_logging)
{
static struct cmd_list_element *set_logging_cmdlist, *show_logging_cmdlist;
diff --git a/gdb/cli/cli-option.c b/gdb/cli/cli-option.c
index 34ac164..5da8c73 100644
--- a/gdb/cli/cli-option.c
+++ b/gdb/cli/cli-option.c
@@ -1,6 +1,6 @@
/* CLI options framework, for GDB.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -227,7 +227,7 @@ parse_option (gdb::array_view<const option_def_group> options_group,
match = &o;
match_ctx = grp.ctx;
- if ((isspace (arg[len]) || arg[len] == '\0')
+ if ((c_isspace (arg[len]) || arg[len] == '\0')
&& strlen (o.name) == len)
break; /* Exact match. */
}
@@ -635,7 +635,7 @@ complete_options (completion_tracker &tracker,
if (ov
&& !tracker.have_completions ()
&& **args == '\0'
- && *args > text && !isspace ((*args)[-1]))
+ && *args > text && !c_isspace ((*args)[-1]))
{
tracker.advance_custom_word_point_by
(*args - text);
diff --git a/gdb/cli/cli-option.h b/gdb/cli/cli-option.h
index 38dcd82..6a56d5a 100644
--- a/gdb/cli/cli-option.h
+++ b/gdb/cli/cli-option.h
@@ -1,6 +1,6 @@
/* CLI options framework, for GDB.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 0337d01..048d391 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1,6 +1,6 @@
/* GDB CLI command scripting.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -19,7 +19,6 @@
#include "event-top.h"
#include "value.h"
-#include <ctype.h>
#include "ui-out.h"
#include "top.h"
@@ -829,7 +828,7 @@ locate_arg (const char *p)
while ((p = strchr (p, '$')))
{
if (startswith (p, "$arg")
- && (isdigit (p[4]) || p[4] == 'c'))
+ && (c_isdigit (p[4]) || p[4] == 'c'))
return p;
p++;
}
@@ -1324,9 +1323,9 @@ validate_comname (const char **comname)
/* Find the last word of the argument. */
p = *comname + strlen (*comname);
- while (p > *comname && isspace (p[-1]))
+ while (p > *comname && c_isspace (p[-1]))
p--;
- while (p > *comname && !isspace (p[-1]))
+ while (p > *comname && !c_isspace (p[-1]))
p--;
last_word = p;
@@ -1751,9 +1750,7 @@ show_user_1 (struct cmd_list_element *c, const char *prefix, const char *name,
}
-void _initialize_cli_script ();
-void
-_initialize_cli_script ()
+INIT_GDB_FILE (cli_script)
{
struct cmd_list_element *c;
diff --git a/gdb/cli/cli-script.h b/gdb/cli/cli-script.h
index 23a1e1f..1ce0754 100644
--- a/gdb/cli/cli-script.h
+++ b/gdb/cli/cli-script.h
@@ -1,5 +1,5 @@
/* Header file for GDB CLI command implementation library.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index b438e98..d92d14e 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -1,6 +1,6 @@
/* Handle set and show GDB commands.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,7 +17,6 @@
#include "readline/tilde.h"
#include "value.h"
-#include <ctype.h>
#include "arch-utils.h"
#include "observable.h"
#include "interps.h"
@@ -49,7 +48,7 @@ parse_auto_binary_operation (const char *arg)
{
int length = strlen (arg);
- while (isspace (arg[length - 1]) && length > 0)
+ while (c_isspace (arg[length - 1]) && length > 0)
length--;
/* Note that "o" is ambiguous. */
@@ -119,7 +118,7 @@ parse_cli_boolean_value (const char *arg)
static void
-deprecated_show_value_hack (struct ui_file *ignore_file,
+deprecated_show_value_hack (struct ui_file *file,
int ignore_from_tty,
struct cmd_list_element *c,
const char *value)
@@ -130,7 +129,7 @@ deprecated_show_value_hack (struct ui_file *ignore_file,
/* Print doc minus "Show " at start. Tell print_doc_line that
this is for a 'show value' prefix. */
- print_doc_line (gdb_stdout, c->doc + 5, true);
+ print_doc_line (file, c->doc + 5, true);
gdb_assert (c->var.has_value ());
@@ -139,17 +138,17 @@ deprecated_show_value_hack (struct ui_file *ignore_file,
case var_string:
case var_string_noescape:
case var_enum:
- gdb_printf ((" is \"%s\".\n"), value);
+ gdb_printf (file, _(" is \"%s\".\n"), value);
break;
case var_optional_filename:
case var_filename:
- gdb_printf ((" is \"%ps\".\n"),
+ gdb_printf (file, _(" is \"%ps\".\n"),
styled_string (file_name_style.style (), value));
break;
default:
- gdb_printf ((" is %s.\n"), value);
+ gdb_printf (file, _(" is %s.\n"), value);
break;
}
}
@@ -748,5 +747,3 @@ cmd_show_list (struct cmd_list_element *list, int from_tty)
}
}
}
-
-
diff --git a/gdb/cli/cli-setshow.h b/gdb/cli/cli-setshow.h
index 9eac86f..886f89f 100644
--- a/gdb/cli/cli-setshow.h
+++ b/gdb/cli/cli-setshow.h
@@ -1,5 +1,5 @@
/* Header file for GDB CLI set and show commands implementation.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c
index 5484245..d6829f0 100644
--- a/gdb/cli/cli-style.c
+++ b/gdb/cli/cli-style.c
@@ -1,6 +1,6 @@
/* CLI colorizing
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -23,6 +23,7 @@
#include "cli/cli-style.h"
#include "source-cache.h"
#include "observable.h"
+#include "charset.h"
/* True if styling is enabled. */
@@ -42,6 +43,10 @@ bool source_styling = true;
bool disassembler_styling = true;
+/* User-settable variable controlling emoji output. */
+
+static auto_boolean emoji_styling = AUTO_BOOLEAN_AUTO;
+
/* Names of intensities; must correspond to
ui_file_style::intensity. */
static const char * const cli_intensities[] = {
@@ -410,9 +415,86 @@ show_style_disassembler (struct ui_file *file, int from_tty,
gdb_printf (file, _("Disassembler output styling is disabled.\n"));
}
-void _initialize_cli_style ();
+/* Implement 'show style emoji'. */
+
+static void
+show_emoji_styling (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ if (emoji_styling == AUTO_BOOLEAN_TRUE)
+ gdb_printf (file, _("CLI emoji styling is enabled.\n"));
+ else if (emoji_styling == AUTO_BOOLEAN_FALSE)
+ gdb_printf (file, _("CLI emoji styling is disabled.\n"));
+ else
+ gdb_printf (file, _("CLI emoji styling is automatic (currently %s).\n"),
+ emojis_ok () ? _("enabled") : _("disabled"));
+}
+
+/* See cli-style.h. */
+
+bool
+emojis_ok ()
+{
+ if (!cli_styling || emoji_styling == AUTO_BOOLEAN_FALSE)
+ return false;
+ if (emoji_styling == AUTO_BOOLEAN_TRUE)
+ return true;
+ return strcmp (host_charset (), "UTF-8") == 0;
+}
+
+/* See cli-style.h. */
+
+void
+no_emojis ()
+{
+ emoji_styling = AUTO_BOOLEAN_FALSE;
+}
+
+/* Emoji warning prefix. */
+static std::string warning_prefix = "⚠️ ";
+
+/* Implement 'show style warning-prefix'. */
+
+static void
+show_warning_prefix (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ gdb_printf (file, _("Warning prefix is \"%s\".\n"),
+ warning_prefix.c_str ());
+}
+
+/* See cli-style.h. */
+
+void
+print_warning_prefix (ui_file *file)
+{
+ if (emojis_ok ())
+ gdb_puts (warning_prefix.c_str (), file);
+}
+
+/* Emoji error prefix. */
+static std::string error_prefix = "❌️ ";
+
+/* Implement 'show style error-prefix'. */
+
+static void
+show_error_prefix (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ gdb_printf (file, _("Error prefix is \"%s\".\n"),
+ error_prefix.c_str ());
+}
+
+/* See cli-style.h. */
+
void
-_initialize_cli_style ()
+print_error_prefix (ui_file *file)
+{
+ if (emojis_ok ())
+ gdb_puts (error_prefix.c_str (), file);
+}
+
+INIT_GDB_FILE (cli_style)
{
add_setshow_prefix_cmd ("style", no_class,
_("\
@@ -431,6 +513,13 @@ If enabled, output to the terminal is styled."),
set_style_enabled, show_style_enabled,
&style_set_list, &style_show_list);
+ add_setshow_auto_boolean_cmd ("emoji", no_class, &emoji_styling, _("\
+Set whether emoji output is enabled."), _("\
+Show whether emoji output is enabled."), _("\
+If enabled, emojis may be displayed."),
+ nullptr, show_emoji_styling,
+ &style_set_list, &style_show_list);
+
add_setshow_boolean_cmd ("sources", no_class, &source_styling, _("\
Set whether source code styling is enabled."), _("\
Show whether source code styling is enabled."), _("\
@@ -627,4 +716,23 @@ coming from your source code."),
&style_disasm_set_list);
add_alias_cmd ("symbol", function_prefix_cmds.show, no_class, 0,
&style_disasm_show_list);
+
+ add_setshow_string_cmd ("warning-prefix", no_class,
+ &warning_prefix,
+ _("Set the warning prefix text."),
+ _("Show the warning prefix text."),
+ _("\
+The warning prefix text is displayed before any warning, when\n\
+emoji output is enabled."),
+ nullptr, show_warning_prefix,
+ &style_set_list, &style_show_list);
+ add_setshow_string_cmd ("error-prefix", no_class,
+ &error_prefix,
+ _("Set the error prefix text."),
+ _("Show the error prefix text."),
+ _("\
+The error prefix text is displayed before any error, when\n\
+emoji output is enabled."),
+ nullptr, show_error_prefix,
+ &style_set_list, &style_show_list);
}
diff --git a/gdb/cli/cli-style.h b/gdb/cli/cli-style.h
index e94b48d..b1a950a 100644
--- a/gdb/cli/cli-style.h
+++ b/gdb/cli/cli-style.h
@@ -1,6 +1,6 @@
/* CLI stylizing
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -190,4 +190,18 @@ private:
bool m_old_value;
};
+/* Return true if emoji styling is allowed. */
+extern bool emojis_ok ();
+
+/* Disable emoji styling. This is here so that Windows can disable
+ emoji when the console is in use. It shouldn't be called
+ elsewhere. */
+extern void no_emojis ();
+
+/* Print the warning prefix, if desired. */
+extern void print_warning_prefix (ui_file *file);
+
+/* Print the error prefix, if desired. */
+extern void print_error_prefix (ui_file *file);
+
#endif /* GDB_CLI_CLI_STYLE_H */
diff --git a/gdb/cli/cli-utils.c b/gdb/cli/cli-utils.c
index 152fee9..d0ca594 100644
--- a/gdb/cli/cli-utils.c
+++ b/gdb/cli/cli-utils.c
@@ -1,6 +1,6 @@
/* CLI utilities.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,7 +20,6 @@
#include "cli/cli-utils.h"
#include "value.h"
-#include <ctype.h>
/* See documentation in cli-utils.h. */
@@ -46,7 +45,7 @@ get_ulongest (const char **pp, int trailer)
/* Internal variable. Make a copy of the name, so we can
null-terminate it to pass to lookup_internalvar(). */
const char *start = ++p;
- while (isalnum (*p) || *p == '_')
+ while (c_isalnum (*p) || *p == '_')
p++;
std::string varname (start, p - start);
if (!get_internalvar_integer (lookup_internalvar (varname.c_str ()),
@@ -67,7 +66,7 @@ get_ulongest (const char **pp, int trailer)
p = end;
}
- if (!(isspace (*p) || *p == '\0' || *p == trailer))
+ if (!(c_isspace (*p) || *p == '\0' || *p == trailer))
error (_("Trailing junk at: %s"), p);
p = skip_spaces (p);
*pp = p;
@@ -111,7 +110,7 @@ get_number_trailer (const char **pp, int trailer)
const char *start = ++p;
LONGEST longest_val;
- while (isalnum (*p) || *p == '_')
+ while (c_isalnum (*p) || *p == '_')
p++;
varname = (char *) alloca (p - start + 1);
strncpy (varname, start, p - start);
@@ -136,7 +135,7 @@ get_number_trailer (const char **pp, int trailer)
/* There is no number here. (e.g. "cond a == b"). */
{
/* Skip non-numeric token. */
- while (*p && !isspace((int) *p))
+ while (*p && !c_isspace((int) *p))
++p;
/* Return zero, which caller must interpret as error. */
retval = 0;
@@ -144,10 +143,10 @@ get_number_trailer (const char **pp, int trailer)
else
retval = atoi (p1);
}
- if (!(isspace (*p) || *p == '\0' || *p == trailer))
+ if (!(c_isspace (*p) || *p == '\0' || *p == trailer))
{
/* Trailing junk: return 0 and let caller print error msg. */
- while (!(isspace (*p) || *p == '\0' || *p == trailer))
+ while (!(c_isspace (*p) || *p == '\0' || *p == trailer))
++p;
retval = 0;
}
@@ -262,8 +261,8 @@ number_or_range_parser::get_number ()
option rather than an incomplete range, so check for end of
string as well. */
if (m_cur_tok[0] == '-'
- && !(isspace (m_cur_tok[-1])
- && (isalpha (m_cur_tok[1])
+ && !(c_isspace (m_cur_tok[-1])
+ && (c_isalpha (m_cur_tok[1])
|| m_cur_tok[1] == '-'
|| m_cur_tok[1] == '\0')))
{
@@ -293,7 +292,7 @@ number_or_range_parser::get_number ()
}
else
{
- if (isdigit (*(m_cur_tok + 1)))
+ if (c_isdigit (*(m_cur_tok + 1)))
error (_("negative value"));
if (*(m_cur_tok + 1) == '$')
{
@@ -330,9 +329,9 @@ number_or_range_parser::finished () const
integer, convenience var or negative convenience var. */
return (m_cur_tok == NULL || *m_cur_tok == '\0'
|| (!m_in_range
- && !(isdigit (*m_cur_tok) || *m_cur_tok == '$')
+ && !(c_isdigit (*m_cur_tok) || *m_cur_tok == '$')
&& !(*m_cur_tok == '-'
- && (isdigit (m_cur_tok[1]) || m_cur_tok[1] == '$'))));
+ && (c_isdigit (m_cur_tok[1]) || m_cur_tok[1] == '$'))));
}
/* Accept a number and a string-form list of numbers such as is
@@ -370,7 +369,7 @@ number_is_in_list (const char *list, int number)
const char *
remove_trailing_whitespace (const char *start, const char *s)
{
- while (s > start && isspace (*(s - 1)))
+ while (s > start && c_isspace (*(s - 1)))
--s;
return s;
@@ -420,7 +419,7 @@ int
check_for_argument (const char **str, const char *arg, int arg_len)
{
if (strncmp (*str, arg, arg_len) == 0
- && ((*str)[arg_len] == '\0' || isspace ((*str)[arg_len])))
+ && ((*str)[arg_len] == '\0' || c_isspace ((*str)[arg_len])))
{
*str += arg_len;
*str = skip_spaces (*str);
diff --git a/gdb/cli/cli-utils.h b/gdb/cli/cli-utils.h
index 4832d01..f9b0123 100644
--- a/gdb/cli/cli-utils.h
+++ b/gdb/cli/cli-utils.h
@@ -1,6 +1,6 @@
/* CLI utilities.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c
index bb85b00..9255555 100644
--- a/gdb/coff-pe-read.c
+++ b/gdb/coff-pe-read.c
@@ -2,7 +2,7 @@
convert to internal format, for GDB. Used as a last resort if no
debugging symbols recognized.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -35,7 +35,6 @@
#include "gdbsupport/common-utils.h"
#include "coff/internal.h"
-#include <ctype.h>
/* Internal section information */
@@ -189,7 +188,7 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader,
int i;
for (i = 0; i < forward_dll_name_len; i++)
- forward_qualified_name[i] = tolower (forward_qualified_name[i]);
+ forward_qualified_name[i] = c_tolower (forward_qualified_name[i]);
msymbol = lookup_minimal_symbol (current_program_space,
forward_qualified_name.c_str ());
}
@@ -694,9 +693,7 @@ show_debug_coff_pe_read (struct ui_file *file, int from_tty,
/* Adds "Set/show debug coff_pe_read" commands. */
-void _initialize_coff_pe_read ();
-void
-_initialize_coff_pe_read ()
+INIT_GDB_FILE (coff_pe_read)
{
add_setshow_zuinteger_cmd ("coff-pe-read", class_maintenance,
&debug_coff_pe_read,
diff --git a/gdb/coff-pe-read.h b/gdb/coff-pe-read.h
index c151046..faaece3 100644
--- a/gdb/coff-pe-read.h
+++ b/gdb/coff-pe-read.h
@@ -1,6 +1,6 @@
/* Interface to coff-pe-read.c (portable-executable-specific symbol reader).
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/coffread.c b/gdb/coffread.c
index c470668..0a3be97 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1,5 +1,5 @@
/* Read coff symbol tables and convert to internal format, for GDB.
- Copyright (C) 1987-2024 Free Software Foundation, Inc.
+ Copyright (C) 1987-2025 Free Software Foundation, Inc.
Contributed by David D. Johnson, Brown University (ddj@cs.brown.edu).
This file is part of GDB.
@@ -25,7 +25,6 @@
#include "bfd.h"
#include "gdbsupport/gdb_obstack.h"
-#include <ctype.h>
#include "coff/internal.h"
#include "libcoff.h"
@@ -336,7 +335,7 @@ coff_locate_sections (bfd *abfd, asection *sectp, void *csip)
/* We can have multiple .stab sections if linked with
--split-by-reloc. */
for (s = name + sizeof ".stab" - 1; *s != '\0'; s++)
- if (!isdigit (*s))
+ if (!c_isdigit (*s))
break;
if (*s == '\0')
csi->stabsects->push_back (sectp);
@@ -525,9 +524,9 @@ is_import_fixup_symbol (struct coff_symbol *cs,
/* The name must start with "__fu<digits>__". */
if (!startswith (cs->c_name, "__fu"))
return 0;
- if (! isdigit (cs->c_name[4]))
+ if (! c_isdigit (cs->c_name[4]))
return 0;
- for (i = 5; cs->c_name[i] != '\0' && isdigit (cs->c_name[i]); i++)
+ for (i = 5; cs->c_name[i] != '\0' && c_isdigit (cs->c_name[i]); i++)
/* Nothing, just incrementing index past all digits. */;
if (cs->c_name[i] != '_' || cs->c_name[i + 1] != '_')
return 0;
@@ -903,7 +902,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
symnum = 0;
while (symnum < nsyms)
{
- QUIT; /* Make this command interruptable. */
+ QUIT; /* Make this command interruptible. */
read_one_sym (cs, &main_sym, &main_aux);
@@ -1257,9 +1256,9 @@ coff_symtab_read (minimal_symbol_reader &reader,
/* Patch up any opaque types (references to types that are not defined
in the file where they are referenced, e.g. "struct foo *bar"). */
{
- for (compunit_symtab *cu : objfile->compunits ())
+ for (compunit_symtab &cu : objfile->compunits ())
{
- for (symtab *s : cu->filetabs ())
+ for (symtab *s : cu.filetabs ())
patch_opaque_types (s);
}
}
@@ -1567,7 +1566,7 @@ patch_opaque_types (struct symtab *s)
Remove syms from the chain when their types are stored,
but search the whole chain, as there may be several syms
from different files with the same name. */
- if (real_sym->aclass () == LOC_TYPEDEF
+ if (real_sym->loc_class () == LOC_TYPEDEF
&& real_sym->domain () == TYPE_DOMAIN
&& real_sym->type ()->code () == TYPE_CODE_PTR
&& real_sym->type ()->target_type ()->length () != 0)
@@ -1614,7 +1613,7 @@ static const struct symbol_register_ops coff_register_funcs = {
coff_reg_to_regnum
};
-/* The "aclass" index for computed COFF symbols. */
+/* The "loc_class" index for computed COFF symbols. */
static int coff_register_index;
@@ -1646,7 +1645,7 @@ process_coff_symbol (struct coff_symbol *cs,
(lookup_function_type (decode_function_type (cs, cs->c_type,
aux, objfile)));
- sym->set_aclass_index (LOC_BLOCK);
+ sym->set_loc_class_index (LOC_BLOCK);
if (cs->c_sclass == C_STAT || cs->c_sclass == C_THUMBSTAT
|| cs->c_sclass == C_THUMBSTATFUNC)
add_symbol_to_list (sym, get_file_symbols ());
@@ -1663,14 +1662,14 @@ process_coff_symbol (struct coff_symbol *cs,
break;
case C_AUTO:
- sym->set_aclass_index (LOC_LOCAL);
+ sym->set_loc_class_index (LOC_LOCAL);
add_symbol_to_list (sym, get_local_symbols ());
break;
case C_THUMBEXT:
case C_THUMBEXTFUNC:
case C_EXT:
- sym->set_aclass_index (LOC_STATIC);
+ sym->set_loc_class_index (LOC_STATIC);
sym->set_value_address ((CORE_ADDR) cs->c_value
+ objfile->section_offsets[SECT_OFF_TEXT (objfile)]);
add_symbol_to_list (sym, get_global_symbols ());
@@ -1679,7 +1678,7 @@ process_coff_symbol (struct coff_symbol *cs,
case C_THUMBSTAT:
case C_THUMBSTATFUNC:
case C_STAT:
- sym->set_aclass_index (LOC_STATIC);
+ sym->set_loc_class_index (LOC_STATIC);
sym->set_value_address ((CORE_ADDR) cs->c_value
+ objfile->section_offsets[SECT_OFF_TEXT (objfile)]);
if (within_function)
@@ -1698,7 +1697,7 @@ process_coff_symbol (struct coff_symbol *cs,
case C_GLBLREG:
#endif
case C_REG:
- sym->set_aclass_index (coff_register_index);
+ sym->set_loc_class_index (coff_register_index);
sym->set_value_longest (cs->c_value);
add_symbol_to_list (sym, get_local_symbols ());
break;
@@ -1708,20 +1707,20 @@ process_coff_symbol (struct coff_symbol *cs,
break;
case C_ARG:
- sym->set_aclass_index (LOC_ARG);
+ sym->set_loc_class_index (LOC_ARG);
sym->set_is_argument (1);
add_symbol_to_list (sym, get_local_symbols ());
break;
case C_REGPARM:
- sym->set_aclass_index (coff_register_index);
+ sym->set_loc_class_index (coff_register_index);
sym->set_is_argument (1);
sym->set_value_longest (cs->c_value);
add_symbol_to_list (sym, get_local_symbols ());
break;
case C_TPDEF:
- sym->set_aclass_index (LOC_TYPEDEF);
+ sym->set_loc_class_index (LOC_TYPEDEF);
sym->set_domain (TYPE_DOMAIN);
/* If type has no name, give it one. */
@@ -1776,7 +1775,7 @@ process_coff_symbol (struct coff_symbol *cs,
case C_STRTAG:
case C_UNTAG:
case C_ENTAG:
- sym->set_aclass_index (LOC_TYPEDEF);
+ sym->set_loc_class_index (LOC_TYPEDEF);
sym->set_domain (STRUCT_DOMAIN);
/* Some compilers try to be helpful by inventing "fake"
@@ -2165,7 +2164,7 @@ coff_read_enum_type (int index, int length, int lastsym,
name = obstack_strdup (&objfile->objfile_obstack, name);
sym->set_linkage_name (name);
- sym->set_aclass_index (LOC_CONST);
+ sym->set_loc_class_index (LOC_CONST);
sym->set_domain (VAR_DOMAIN);
sym->set_value_longest (ms->c_value);
add_symbol_to_list (sym, symlist);
@@ -2248,9 +2247,7 @@ static const struct sym_fns coff_sym_fns =
NULL, /* sym_probe_fns */
};
-void _initialize_coffread ();
-void
-_initialize_coffread ()
+INIT_GDB_FILE (coffread)
{
add_symtab_fns (bfd_target_coff_flavour, &coff_sym_fns);
diff --git a/gdb/command.h b/gdb/command.h
index 37c7ddf..f8a0212 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -1,6 +1,6 @@
/* Header file for command creation.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -558,7 +558,7 @@ extern struct cmd_list_element *lookup_cmd (const char **,
the section of text it matched, set *RESULT_LIST to point to the list in
which the last word was matched, and will return a pointer to the cmd
list element which the text matches. It will return NULL if no match at
- all was possible. It will return -1 (cast appropriately, ick) if ambigous
+ all was possible. It will return -1 (cast appropriately, ick) if ambiguous
matches are possible; in this case *RESULT_LIST will be set to point to
the list in which there are ambiguous choices (and *TEXT will be set to
the ambiguous text string).
diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
index a152e5a..ac8888f 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -1,6 +1,6 @@
/* C/C++ language support for compilation.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -185,18 +185,18 @@ static void
write_macro_definitions (const struct block *block, CORE_ADDR pc,
struct ui_file *file)
{
- gdb::unique_xmalloc_ptr<struct macro_scope> scope;
+ macro_scope scope;
if (block != NULL)
scope = sal_macro_scope (find_pc_line (pc, 0));
else
scope = default_macro_scope ();
- if (scope == NULL)
+ if (!scope.is_valid ())
scope = user_macro_scope ();
- if (scope != NULL && scope->file != NULL && scope->file->table != NULL)
+ if (scope.is_valid () && scope.file->table != nullptr)
{
- macro_for_each_in_scope (scope->file, scope->line,
+ macro_for_each_in_scope (scope.file, scope.line,
[&] (const char *name,
const macro_definition *macro,
macro_source_file *source,
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index 7070e5e..6578977 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -1,6 +1,6 @@
/* Convert symbols from GDB to GCC
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -61,7 +61,7 @@ convert_one_symbol (compile_c_instance *context,
context->error_symbol_once (sym.symbol);
- if (sym.symbol->aclass () == LOC_LABEL)
+ if (sym.symbol->loc_class () == LOC_LABEL)
sym_type = 0;
else
sym_type = context->convert_type (sym.symbol->type ());
@@ -79,7 +79,7 @@ convert_one_symbol (compile_c_instance *context,
CORE_ADDR addr = 0;
gdb::unique_xmalloc_ptr<char> symbol_name;
- switch (sym.symbol->aclass ())
+ switch (sym.symbol->loc_class ())
{
case LOC_TYPEDEF:
kind = GCC_C_SYMBOL_TYPEDEF;
@@ -536,7 +536,7 @@ generate_c_for_for_one_variable (compile_instance *compiler,
}
else
{
- switch (sym->aclass ())
+ switch (sym->loc_class ())
{
case LOC_REGISTER:
case LOC_ARG:
diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c
index 6407f12..bf1fea5 100644
--- a/gdb/compile/compile-c-types.c
+++ b/gdb/compile/compile-c-types.c
@@ -1,6 +1,6 @@
/* Convert types from GDB to GCC
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/compile/compile-c.h b/gdb/compile/compile-c.h
index b77b7aa..1a6b056 100644
--- a/gdb/compile/compile-c.h
+++ b/gdb/compile/compile-c.h
@@ -1,5 +1,5 @@
/* Header file for GDB compile C-language support.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c
index 6c482e7..96ebd84 100644
--- a/gdb/compile/compile-cplus-symbols.c
+++ b/gdb/compile/compile-cplus-symbols.c
@@ -1,6 +1,6 @@
/* Convert symbols from GDB to GCC
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -53,7 +53,7 @@ convert_one_symbol (compile_cplus_instance *instance,
instance->error_symbol_once (sym.symbol);
- if (sym.symbol->aclass () == LOC_LABEL)
+ if (sym.symbol->loc_class () == LOC_LABEL)
sym_type = 0;
else
sym_type = instance->convert_type (sym.symbol->type ());
@@ -70,7 +70,7 @@ convert_one_symbol (compile_cplus_instance *instance,
std::string name;
gdb::unique_xmalloc_ptr<char> symbol_name;
- switch (sym.symbol->aclass ())
+ switch (sym.symbol->loc_class ())
{
case LOC_TYPEDEF:
if (sym.symbol->type ()->code () == TYPE_CODE_TYPEDEF)
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index 8d14114..cf70fe4 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -1,6 +1,6 @@
/* Convert types from GDB to GCC
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1395,9 +1395,7 @@ gcc_cp_plugin::pop_binding_level (const char *debug_name)
return pop_binding_level ();
}
-void _initialize_compile_cplus_types ();
-void
-_initialize_compile_cplus_types ()
+INIT_GDB_FILE (compile_cplus_types)
{
add_setshow_boolean_cmd ("compile-cplus-types", no_class,
&debug_compile_cplus_types, _("\
diff --git a/gdb/compile/compile-cplus.h b/gdb/compile/compile-cplus.h
index d3b2d3e..d08feea 100644
--- a/gdb/compile/compile-cplus.h
+++ b/gdb/compile/compile-cplus.h
@@ -1,5 +1,5 @@
/* Header file for GDB compile C++ language support.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/compile/compile-internal.h b/gdb/compile/compile-internal.h
index 789782d..46a8ac2 100644
--- a/gdb/compile/compile-internal.h
+++ b/gdb/compile/compile-internal.h
@@ -1,5 +1,5 @@
/* Header file for GDB compile command and supporting functions.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/compile/compile-loc2c.c b/gdb/compile/compile-loc2c.c
index 2f5d85f..31fd8e2 100644
--- a/gdb/compile/compile-loc2c.c
+++ b/gdb/compile/compile-loc2c.c
@@ -1,6 +1,6 @@
/* Convert a DWARF location expression to C
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index 05e5b43..49b967a 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -1,6 +1,6 @@
/* Load module for 'compile' command.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/compile/compile-object-load.h b/gdb/compile/compile-object-load.h
index 463aa08..5122764 100644
--- a/gdb/compile/compile-object-load.h
+++ b/gdb/compile/compile-object-load.h
@@ -1,5 +1,5 @@
/* Header file to load module for 'compile' command.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c
index 8316377..30b45dc 100644
--- a/gdb/compile/compile-object-run.c
+++ b/gdb/compile/compile-object-run.c
@@ -1,6 +1,6 @@
/* Call module for 'compile' command.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/compile/compile-object-run.h b/gdb/compile/compile-object-run.h
index 64b2bd9..7515b70 100644
--- a/gdb/compile/compile-object-run.h
+++ b/gdb/compile/compile-object-run.h
@@ -1,5 +1,5 @@
/* Header file to call module for 'compile' command.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 01f43ad..5d81ec1 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -1,6 +1,6 @@
/* General Compile and inject code
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -45,6 +45,7 @@
#include "gdbsupport/pathstuff.h"
#include "gdbsupport/scoped_ignore_signal.h"
#include "gdbsupport/buildargv.h"
+#include "gdbsupport/cleanups.h"
/* Hold "compile" commands. */
@@ -868,9 +869,7 @@ compile_command (const char *args, int from_tty)
/* See compile.h. */
cmd_list_element *compile_cmd_element = nullptr;
-void _initialize_compile ();
-void
-_initialize_compile ()
+INIT_GDB_FILE (compile)
{
compile_cmd_element = add_prefix_cmd ("compile", class_obscure,
compile_command,
diff --git a/gdb/compile/compile.h b/gdb/compile/compile.h
index e18b5bc..9308623 100644
--- a/gdb/compile/compile.h
+++ b/gdb/compile/compile.h
@@ -1,6 +1,6 @@
/* Header file for Compile and inject module.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/compile/gcc-c-plugin.h b/gdb/compile/gcc-c-plugin.h
index d12472f..bc6710e 100644
--- a/gdb/compile/gcc-c-plugin.h
+++ b/gdb/compile/gcc-c-plugin.h
@@ -1,6 +1,6 @@
/* GCC C plug-in wrapper for GDB.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/compile/gcc-cp-plugin.h b/gdb/compile/gcc-cp-plugin.h
index 8f36993..d926355 100644
--- a/gdb/compile/gcc-cp-plugin.h
+++ b/gdb/compile/gcc-cp-plugin.h
@@ -1,6 +1,6 @@
/* GCC C++ plug-in wrapper for GDB.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/complaints.c b/gdb/complaints.c
index 80b358c..03d27d6 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -1,6 +1,6 @@
/* Support for complaint handling during symbol reading in GDB.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,11 +22,9 @@
#include "cli/cli-cmds.h"
#include "run-on-main-thread.h"
#include "top.h"
+#include "gdbsupport/cxx-thread.h"
#include "gdbsupport/selftest.h"
#include "gdbsupport/unordered_map.h"
-#if CXX_STD_THREAD
-#include <mutex>
-#endif
/* Map format strings to counters. */
@@ -38,9 +36,7 @@ static gdb::unordered_map<const char *, int> counters;
int stop_whining = 0;
-#if CXX_STD_THREAD
-static std::mutex complaint_mutex;
-#endif /* CXX_STD_THREAD */
+static gdb::mutex complaint_mutex;
/* See complaints.h. */
@@ -50,9 +46,7 @@ complaint_internal (const char *fmt, ...)
va_list args;
{
-#if CXX_STD_THREAD
- std::lock_guard<std::mutex> guard (complaint_mutex);
-#endif
+ gdb::lock_guard<gdb::mutex> guard (complaint_mutex);
if (++counters[fmt] > stop_whining)
return;
}
@@ -126,9 +120,7 @@ re_emit_complaints (const complaint_collection &complaints)
void
complaint_interceptor::warn (const char *fmt, va_list args)
{
-#if CXX_STD_THREAD
- std::lock_guard<std::mutex> guard (complaint_mutex);
-#endif
+ gdb::lock_guard<gdb::mutex> guard (complaint_mutex);
g_complaint_interceptor->m_complaints.insert (string_vprintf (fmt, args));
}
@@ -188,9 +180,7 @@ test_complaints ()
} /* namespace selftests */
#endif /* GDB_SELF_TEST */
-void _initialize_complaints ();
-void
-_initialize_complaints ()
+INIT_GDB_FILE (complaints)
{
add_setshow_zinteger_cmd ("complaints", class_support,
&stop_whining, _("\
diff --git a/gdb/complaints.h b/gdb/complaints.h
index 2065067..113cf5e 100644
--- a/gdb/complaints.h
+++ b/gdb/complaints.h
@@ -1,6 +1,6 @@
/* Definitions for complaint handling during symbol reading in GDB.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/completer.c b/gdb/completer.c
index 4735aa5..b919b4c 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -1,5 +1,5 @@
/* Line completion stuff for GDB, the GNU debugger.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -356,7 +356,7 @@ gdb_completer_file_name_quote_1 (const char *text, char quote_char)
if (quote_char == '\'')
{
/* There is no backslash escaping permitted within a single quoted
- string, so in this case we can just return the input sting. */
+ string, so in this case we can just return the input string. */
str = text;
}
else if (quote_char == '"')
@@ -1008,7 +1008,7 @@ complete_files_symbols (completion_tracker &tracker,
name, they cannot be asking for completion on files. */
if (strcspn (text, gdb_completer_file_name_break_characters)
== text_len)
- fn_list = make_source_files_completion_list (text, text);
+ fn_list = make_source_files_completion_list (text);
}
if (!fn_list.empty () && !tracker.have_completions ())
@@ -1059,7 +1059,7 @@ complete_source_filenames (const char *text)
the user cannot be asking for completion on files. */
if (strcspn (text, gdb_completer_file_name_break_characters)
== text_len)
- return make_source_files_completion_list (text, text);
+ return make_source_files_completion_list (text);
return {};
}
@@ -1142,7 +1142,7 @@ collect_explicit_location_matches (completion_tracker &tracker,
const char *source
= string_or_empty (explicit_loc->source_filename.get ());
completion_list matches
- = make_source_files_completion_list (source, source);
+ = make_source_files_completion_list (source);
tracker.add_completions (std::move (matches));
}
break;
@@ -3006,7 +3006,7 @@ gdb_printable_part (char *pathname)
temp = strrchr (pathname, '/');
#if defined (__MSDOS__)
- if (temp == 0 && ISALPHA ((unsigned char)pathname[0]) && pathname[1] == ':')
+ if (temp == 0 && c_isalpha (pathname[0]) && pathname[1] == ':')
temp = pathname + 1;
#endif
@@ -3513,9 +3513,7 @@ skip_over_slash_fmt (completion_tracker &tracker, const char **args)
return false;
}
-void _initialize_completer ();
-void
-_initialize_completer ()
+INIT_GDB_FILE (completer)
{
/* Setup some readline completion globals. */
rl_completion_word_break_hook = gdb_completion_word_break_characters;
diff --git a/gdb/completer.h b/gdb/completer.h
index 07953f1..0912fb2 100644
--- a/gdb/completer.h
+++ b/gdb/completer.h
@@ -1,5 +1,5 @@
/* Header for GDB line completion.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -722,7 +722,7 @@ extern void complete_nested_command_line (completion_tracker &tracker,
This function is designed so that trying to complete '/' will offer no
completions, the user needs to insert the format specification
themselves. Trying to complete '/FMT' (where FMT is any non-empty set
- of alpha-numeric characters) will cause readline to insert a single
+ of alphanumeric characters) will cause readline to insert a single
space, setting the user up to enter the expression. */
extern bool skip_over_slash_fmt (completion_tracker &tracker,
diff --git a/gdb/config.in b/gdb/config.in
index 86ff67d..efc3100 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -39,6 +39,9 @@
/* Define to BFD's default target vector. */
#undef DEFAULT_BFD_VEC
+/* defined if dwarf format was requested. */
+#undef DWARF_FORMAT_AVAILABLE
+
/* Handle .ctf type-info sections */
#undef ENABLE_LIBCTF
@@ -93,6 +96,9 @@
/* Define if amd-dbgapi is being linked in. */
#undef HAVE_AMD_DBGAPI
+/* Define to 1 if you have the <asm/termios.h> header file. */
+#undef HAVE_ASM_TERMIOS_H
+
/* Define to 1 if you have the `btowc' function. */
#undef HAVE_BTOWC
@@ -244,6 +250,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define to 1 if you have the <IOKit/serial/ioss.h> header file. */
+#undef HAVE_IOKIT_SERIAL_IOSS_H
+
/* Define to 1 if you have the `kinfo_getfile' function. */
#undef HAVE_KINFO_GETFILE
@@ -639,6 +648,9 @@
*/
#undef LT_OBJDIR
+/* defined if mdebug format was requested. */
+#undef MDEBUG_FORMAT_AVAILABLE
+
/* Name of this package. */
#undef PACKAGE
@@ -722,9 +734,6 @@
/* The size of `unsigned __int128', as computed by sizeof. */
#undef SIZEOF_UNSIGNED___INT128
-/* The size of `void *', as computed by sizeof. */
-#undef SIZEOF_VOID_P
-
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.
@@ -736,6 +745,9 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
+/* Which binary file formats were requested at configure time. */
+#undef SUPPORTED_BINARY_FILE_FORMATS
+
/* automatically load a system-wide gdbinit file */
#undef SYSTEM_GDBINIT
diff --git a/gdb/config/djgpp/README b/gdb/config/djgpp/README
index 2ae6535..cecc9d0 100644
--- a/gdb/config/djgpp/README
+++ b/gdb/config/djgpp/README
@@ -175,7 +175,7 @@ SOMETHING.tst (where SOMETHING is the name of the failed test). You
should compare each of the *.tst files with the corresponding *.out
file and convince yourself that the differences do not indicate a real
problem. Examples of differences you can disregard are changes in the
-copyright blurb printed by GDB, values of unitialized variables,
+copyright blurb printed by GDB, values of uninitialized variables,
addresses of global variables like argv[] and envp[] (which depend on
the size of your environment), etc.
diff --git a/gdb/config/djgpp/djcheck.sh b/gdb/config/djgpp/djcheck.sh
index 32c2a8e..f9810ad 100644
--- a/gdb/config/djgpp/djcheck.sh
+++ b/gdb/config/djgpp/djcheck.sh
@@ -2,7 +2,7 @@
# A shell script to run the test suite on the DJGPP version of GDB.
-# Copyright (C) 2000-2024 Free Software Foundation, Inc.
+# Copyright (C) 2000-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/config/djgpp/djconfig.sh b/gdb/config/djgpp/djconfig.sh
index ccec3c8..05b3bbe 100644
--- a/gdb/config/djgpp/djconfig.sh
+++ b/gdb/config/djgpp/djconfig.sh
@@ -5,7 +5,7 @@
# configuring other GNU programs for DJGPP.
#
#=====================================================================
-# Copyright (C) 1997-2024 Free Software Foundation, Inc.
+# Copyright (C) 1997-2025 Free Software Foundation, Inc.
#
# Originally written by Robert Hoehne, revised by Eli Zaretskii.
# This file is part of GDB.
@@ -123,7 +123,7 @@ do
done
# Now set the config shell. It is really needed, that the shell
-# points to a shell with full path and also it must conatain the
+# points to a shell with full path and also it must contain the
# .exe suffix. I assume here, that bash is installed. If not,
# install it. Additionally, the pathname must not contain a
# drive letter, so use the /dev/x/foo format supported by versions
diff --git a/gdb/config/djgpp/langinfo.h b/gdb/config/djgpp/langinfo.h
index 2ccb7ab..929b890 100644
--- a/gdb/config/djgpp/langinfo.h
+++ b/gdb/config/djgpp/langinfo.h
@@ -1,5 +1,5 @@
/* langinfo.h file for DJGPP.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
Written by Eli Zaretskii.
This file is part of GDB.
diff --git a/gdb/config/djgpp/nl_types.h b/gdb/config/djgpp/nl_types.h
index 48f1384..4b24ac6 100644
--- a/gdb/config/djgpp/nl_types.h
+++ b/gdb/config/djgpp/nl_types.h
@@ -1,5 +1,5 @@
/* nl_types.h for DJGPP.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
Written by Eli Zaretskii.
This file is part of GDB.
diff --git a/gdb/config/i386/nm-x86-gnu.h b/gdb/config/i386/nm-x86-gnu.h
index 5e06b9e..0ddde30 100644
--- a/gdb/config/i386/nm-x86-gnu.h
+++ b/gdb/config/i386/nm-x86-gnu.h
@@ -1,5 +1,5 @@
/* Native-dependent definitions for Intel 386 running the GNU Hurd
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/config/nm-linux.h b/gdb/config/nm-linux.h
index d599d3f..811ec5f 100644
--- a/gdb/config/nm-linux.h
+++ b/gdb/config/nm-linux.h
@@ -1,6 +1,6 @@
/* Native support for GNU/Linux.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/config/sparc/nm-sol2.h b/gdb/config/sparc/nm-sol2.h
index 14e1aa9..e356435 100644
--- a/gdb/config/sparc/nm-sol2.h
+++ b/gdb/config/sparc/nm-sol2.h
@@ -1,6 +1,6 @@
/* Native-dependent definitions for Solaris SPARC.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/configure b/gdb/configure
index e8a649f..db63481 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -706,6 +706,7 @@ LIBGUI
LTLIBLZMA
LIBLZMA
HAVE_LIBLZMA
+FORMAT_SRCS
SER_HARDWIRE
WERROR_CFLAGS
WARN_CFLAGS
@@ -761,8 +762,6 @@ TARGET_OBS
AMD_DBGAPI_LIBS
AMD_DBGAPI_CFLAGS
HAVE_GSTACK
-ENABLE_BFD_64_BIT_FALSE
-ENABLE_BFD_64_BIT_TRUE
subdirs
GDB_DATADIR
DEBUGDIR
@@ -822,6 +821,7 @@ DSYMUTIL
AWK
RANLIB
AR
+LLVM_CONFIG
OBJDUMP
LN_S
NM
@@ -934,7 +934,9 @@ with_relocated_sources
with_auto_load_dir
with_auto_load_safe_path
enable_targets
-enable_64_bit_bfd
+enable_binary_file_formats
+enable_gdb_mdebug_support
+enable_gdb_dwarf_support
with_amd_dbgapi
enable_tui
enable_gdbtk
@@ -1646,7 +1648,16 @@ Optional Features:
--disable-nls do not use Native Language Support
--enable-targets=TARGETS
alternative target configurations
- --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
+ --enable-binary-file-formats=FORMATS
+ enable support for selected file formats (default
+ 'all') available formats: coff, dbx, elf, macho,
+ mips, xcoff, all
+ --enable-gdb-mdebug-support
+ Enable support for the mdebug debuginfo format
+ (default 'yes')
+ --enable-gdb-dwarf-support
+ Enable support for the dwarf debuginfo format
+ (default 'yes')
--enable-tui enable full-screen terminal user interface (TUI)
--enable-gdbtk enable gdbtk graphical user interface (GUI)
--enable-profiling enable profiling of GDB
@@ -6477,8 +6488,266 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
-plugin_option=
+
+# Try CLANG_PLUGIN_FILE first since GCC_PLUGIN_OPTION may return the
+# wrong plugin_option with clang.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang" >&5
+$as_echo_n "checking for clang... " >&6; }
+if ${clang_cv_is_clang+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#ifdef __clang__
+ yes
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "yes" >/dev/null 2>&1; then :
+ clang_cv_is_clang=yes
+else
+ clang_cv_is_clang=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $clang_cv_is_clang" >&5
+$as_echo "$clang_cv_is_clang" >&6; }
+ plugin_file=
+ if test $clang_cv_is_clang = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang plugin file" >&5
+$as_echo_n "checking for clang plugin file... " >&6; }
+ plugin_names="LLVMgold.so"
+ for plugin in $plugin_names; do
+ plugin_file=`${CC} ${CFLAGS} --print-file-name $plugin`
+ if test x$plugin_file = x$plugin; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}llvm-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}llvm-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_LLVM_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$LLVM_CONFIG"; then
+ ac_cv_prog_LLVM_CONFIG="$LLVM_CONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_LLVM_CONFIG="${ac_tool_prefix}llvm-config"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+LLVM_CONFIG=$ac_cv_prog_LLVM_CONFIG
+if test -n "$LLVM_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLVM_CONFIG" >&5
+$as_echo "$LLVM_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LLVM_CONFIG"; then
+ ac_ct_LLVM_CONFIG=$LLVM_CONFIG
+ # Extract the first word of "llvm-config", so it can be a program name with args.
+set dummy llvm-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_LLVM_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_LLVM_CONFIG"; then
+ ac_cv_prog_ac_ct_LLVM_CONFIG="$ac_ct_LLVM_CONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_LLVM_CONFIG="llvm-config"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LLVM_CONFIG=$ac_cv_prog_ac_ct_LLVM_CONFIG
+if test -n "$ac_ct_LLVM_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LLVM_CONFIG" >&5
+$as_echo "$ac_ct_LLVM_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_LLVM_CONFIG" = x; then
+ LLVM_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ LLVM_CONFIG=$ac_ct_LLVM_CONFIG
+ fi
+else
+ LLVM_CONFIG="$ac_cv_prog_LLVM_CONFIG"
+fi
+
+ if test "$?" != 0; then
+ as_fn_error $? "Required tool 'llvm-config' not found on PATH." "$LINENO" 5
+ fi
+ clang_lib_dir=`$LLVM_CONFIG --libdir`
+ if test -f $clang_lib_dir/$plugin; then
+ plugin_file=$clang_lib_dir/$plugin
+ fi
+ if test x$plugin_file != x$plugin; then
+ break;
+ fi
+ fi
+ done
+ if test -z $plugin_file; then
+ as_fn_error $? "Couldn't find clang plugin file for $CC." "$LINENO" 5
+ fi
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AR" = x; then
+ AR=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+ if test "${AR}" = "" ; then
+ as_fn_error $? "Required archive tool 'ar' not found on PATH." "$LINENO" 5
+ fi
+ plugin_option="--plugin $plugin_file"
+ touch conftest.c
+ ${AR} $plugin_option rc conftest.a conftest.c
+ if test "$?" != 0; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5
+$as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;}
+ plugin_file=
+ fi
+ rm -f conftest.*
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $plugin_file" >&5
+$as_echo "$plugin_file" >&6; }
+ fi
+ plugin_file="$plugin_file"
+
+if test -n "$plugin_file"; then
+ plugin_option="--plugin $plugin_file"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -plugin option" >&5
+$as_echo_n "checking for -plugin option... " >&6; }
+
plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll"
+plugin_option=
for plugin in $plugin_names; do
plugin_so=`${CC} ${CFLAGS} --print-prog-name $plugin`
if test x$plugin_so = x$plugin; then
@@ -6489,7 +6758,119 @@ for plugin in $plugin_names; do
break
fi
done
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AR" = x; then
+ AR=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+if test "${AR}" = "" ; then
+ as_fn_error $? "Required archive tool 'ar' not found on PATH." "$LINENO" 5
+fi
+touch conftest.c
+${AR} $plugin_option rc conftest.a conftest.c
+if test "$?" != 0; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5
+$as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;}
+ plugin_option=
+fi
+rm -f conftest.*
+if test -n "$plugin_option"; then
+ plugin_option="$plugin_option"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $plugin_option" >&5
+$as_echo "$plugin_option" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
@@ -6584,17 +6965,15 @@ fi
test -z "$AR" && AR=ar
if test -n "$plugin_option"; then
- if $AR --help 2>&1 | grep -q "\--plugin"; then
- touch conftest.c
- $AR $plugin_option rc conftest.a conftest.c
- if test "$?" != 0; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5
-$as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;}
- else
+ case "$AR" in
+ *"$plugin_option"*)
+ ;;
+ *)
+ if $AR --help 2>&1 | grep -q "\--plugin"; then
AR="$AR $plugin_option"
fi
- rm -f conftest.*
- fi
+ ;;
+ esac
fi
test -z "$AR_FLAGS" && AR_FLAGS=cru
@@ -6801,9 +7180,15 @@ fi
test -z "$RANLIB" && RANLIB=:
if test -n "$plugin_option" && test "$RANLIB" != ":"; then
- if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
- RANLIB="$RANLIB $plugin_option"
- fi
+ case "$RANLIB" in
+ *"$plugin_option"*)
+ ;;
+ *)
+ if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
+ RANLIB="$RANLIB $plugin_option"
+ fi
+ ;;
+ esac
fi
@@ -11503,7 +11888,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11506 "configure"
+#line 11891 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11609,7 +11994,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11612 "configure"
+#line 11997 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19227,118 +19612,6 @@ fi
# Set the 'development' global.
. $srcdir/../bfd/development.sh
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_header_stdc=yes
-else
- ac_cv_header_stdc=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then :
- :
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- return 2;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
-
-fi
-
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
@@ -24878,71 +25151,103 @@ esac
fi
-
-# Check whether --enable-64-bit-bfd was given.
-if test "${enable_64_bit_bfd+set}" = set; then :
- enableval=$enable_64_bit_bfd; case $enableval in #(
- yes|no) :
- ;; #(
- *) :
- as_fn_error $? "bad value ${enableval} for 64-bit-bfd option" "$LINENO" 5 ;; #(
- *) :
- ;;
+# Check whether --enable-binary_file_formats was given.
+if test "${enable_binary_file_formats+set}" = set; then :
+ enableval=$enable_binary_file_formats; case "${enableval}" in
+ yes | "") as_fn_error $? "enable-binary-file-formats option must specify file formats or 'all'" "$LINENO" 5
+ ;;
+ no) enable_binary_file_formats= ;;
+ *) enable_binary_file_formats=$enableval ;;
esac
else
- enable_64_bit_bfd=no
+ enable_binary_file_formats=all
fi
-if test "x$enable_64_bit_bfd" = "xno"; then :
- # The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
-$as_echo_n "checking size of void *... " >&6; }
-if ${ac_cv_sizeof_void_p+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then :
+# Check whether to support mdebug/ecoff debug information.
+# Check whether --enable-gdb-mdebug-support was given.
+if test "${enable_gdb_mdebug_support+set}" = set; then :
+ enableval=$enable_gdb_mdebug_support;
+ case $enableval in
+ yes | no)
+ ;;
+ *)
+ as_fn_error $? "bad value $enableval for --enable-gdb-mdebug-support" "$LINENO" 5
+ ;;
+ esac
else
- if test "$ac_cv_type_void_p" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (void *)
-See \`config.log' for more details" "$LINENO" 5; }
- else
- ac_cv_sizeof_void_p=0
- fi
+ enable_gdb_mdebug_support=yes
fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
-$as_echo "$ac_cv_sizeof_void_p" >&6; }
+if test "x${enable_gdb_mdebug_support}" != "xno"; then
+ CONFIG_SRCS="$CONFIG_SRCS mdebugread.c"
+ CONFIG_OBS="$CONFIG_OBS mdebugread.o"
+$as_echo "#define MDEBUG_FORMAT_AVAILABLE 1" >>confdefs.h
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
-_ACEOF
+fi
+# Check whether to support dwarf debug information
+# Check whether --enable-gdb-dwarf-support was given.
+if test "${enable_gdb_dwarf_support+set}" = set; then :
+ enableval=$enable_gdb_dwarf_support;
+ case $enableval in
+ yes | no)
+ ;;
+ *)
+ as_fn_error $? "bad value $enableval for --enable-gdb-dwarf-support" "$LINENO" 5
+ ;;
+ esac
- if test "x$ac_cv_sizeof_void_p" = "x8"; then :
- enable_64_bit_bfd=yes
+else
+ enable_gdb_dwarf_support=yes
fi
+
+if test "x${enable_gdb_dwarf_support}" != "xno"; then
+
+$as_echo "#define DWARF_FORMAT_AVAILABLE 1" >>confdefs.h
+
+ CONFIG_SRCS="$CONFIG_SRCS \$(DWARF2_SRCS)"
+ CONFIG_OBS="$CONFIG_OBS \$(DWARF2_OBS)"
fi
- if test "x$enable_64_bit_bfd" = "xyes"; then
- ENABLE_BFD_64_BIT_TRUE=
- ENABLE_BFD_64_BIT_FALSE='#'
+# See whether 64-bit bfd lib has been enabled.
+OLD_CPPFLAGS=$CPPFLAGS
+# Put the old CPPFLAGS last, in case the user's CPPFLAGS point somewhere
+# with bfd, with -I/foo/include. We always want our bfd.
+CPPFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CPPFLAGS"
+# Note we cannot cache the result of this check because BFD64 may change
+# when a secondary target has been added or removed and we have no access
+# to this information here.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether BFD is 64-bit" >&5
+$as_echo_n "checking whether BFD is 64-bit... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include "bfd.h"
+int
+main ()
+{
+#ifdef BFD64
+HAVE_BFD64
+#endif
+ ;
+ return 0;
+}
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "HAVE_BFD64" >/dev/null 2>&1; then :
+ have_64_bit_bfd=yes
else
- ENABLE_BFD_64_BIT_TRUE='#'
- ENABLE_BFD_64_BIT_FALSE=
+ have_64_bit_bfd=no
fi
+rm -f conftest*
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_64_bit_bfd" >&5
+$as_echo "$have_64_bit_bfd" >&6; }
+CPPFLAGS=$OLD_CPPFLAGS
# Provide defaults for some variables set by the per-host and per-target
# configuration.
@@ -24962,10 +25267,21 @@ TARGET_OBS=
all_targets=
HAVE_NATIVE_GCORE_TARGET=
+# File formats that will be enabled based on the selected
+# target(s). These are chosen because they are required to
+# compile one or more of the selected targets.
+target_formats=
+
+# If all targets were requested, this is all formats that should
+# accompany them. These are just the ones required for compilation
+# to succeed, not the formats suggested based on targets.
+all_target_formats="coff xcoff"
+
for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
do
if test "$targ_alias" = "all"; then
all_targets=true
+ target_formats=$all_target_formats
else
# Canonicalize the secondary target names.
result=`$ac_config_sub $targ_alias 2>/dev/null`
@@ -24992,7 +25308,7 @@ fi
done
# Check whether this target needs 64-bit CORE_ADDR
- if test x${enable_64_bit_bfd} = xno; then
+ if test x${have_64_bit_bfd} = xno; then
. ${srcdir}/../bfd/config.bfd
fi
@@ -25005,19 +25321,10 @@ fi
done
if test x${all_targets} = xtrue; then
- if test x${enable_64_bit_bfd} = xyes; then
+ if test x${have_64_bit_bfd} = xyes; then
TARGET_OBS='$(ALL_TARGET_OBS) $(ALL_64_TARGET_OBS)'
else
- case ${host} in
- mips*)
- # If all targets were requested, but 64 bit bfd is not enabled,
- # the build will fail. See PR 28684.
- as_fn_error $? "--enable-targets=all requires --enable-64-bit-bfd" "$LINENO" 5
- ;;
- *)
- TARGET_OBS='$(ALL_TARGET_OBS)'
- ;;
- esac
+ TARGET_OBS='$(ALL_TARGET_OBS)'
fi
fi
@@ -28210,8 +28517,8 @@ int
main ()
{
- #if PY_MAJOR_VERSION != 3
- # error "We only support Python 3"
+ #if PY_VERSION_HEX < 0x03040000
+ # error "Minimum supported Python version is 3.4"
#endif
Py_Initialize ();
@@ -28987,11 +29294,20 @@ if test "${enable_gdb_compile+set}" = set; then :
esac
else
- enable_gdb_compile=yes
+ enable_gdb_compile=default
fi
-if test "${enable_gdb_compile}" == yes; then
+if test "${enable_gdb_compile}" = "default"; then
+ enable_gdb_compile=${enable_gdb_dwarf_support}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Defaulting compile support to '${enable_gdb_dwarf_support}'" >&5
+$as_echo "$as_me: WARNING: Defaulting compile support to '${enable_gdb_dwarf_support}'" >&2;}
+fi
+
+if test "${enable_gdb_compile}" = "yes"; then
+ if test "${enable_gdb_dwarf_support}" = "no"; then
+ as_fn_error $? "enabling gdb compile requires dwarf support" "$LINENO" 5
+ fi
$as_echo "#define HAVE_COMPILE 1" >>confdefs.h
@@ -29126,119 +29442,9 @@ fi
# Checks for header files. #
# ------------------------- #
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_header_stdc=yes
-else
- ac_cv_header_stdc=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then :
- :
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- return 2;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
-
-fi
-
for ac_header in \
+ IOKit/serial/ioss.h \
+ asm/termios.h \
machine/reg.h \
nlist.h \
ptrace.h \
@@ -31602,6 +31808,12 @@ fi
# Note that WIN32APILIBS is set by GDB_AC_COMMON.
WIN32LIBS="$WIN32LIBS $WIN32APILIBS"
+# Object files to be used when building with support for all file formats.
+# This should not have elf or macho, as support for those formats depends
+# on BFD enabling them as well.
+all_binary_file_srcs="\$(dbx_SRCS) \$(mips_SRCS) \$(coff_SRCS) \$(xcoff_SRCS)"
+
+bfd_supports_elf=no
# Add ELF support to GDB, but only if BFD includes ELF support.
OLD_CFLAGS=$CFLAGS
@@ -31619,7 +31831,7 @@ WIN32LIBS="$WIN32LIBS $WIN32APILIBS"
CC="./libtool --quiet --mode=link $CC"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF support in BFD" >&5
$as_echo_n "checking for ELF support in BFD... " >&6; }
-if ${gdb_cv_var_elf+:} false; then :
+if ${gdb_cv_var_bfd_elf+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -31638,28 +31850,27 @@ return bfd_get_elf_phdr_upper_bound (NULL);
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- gdb_cv_var_elf=yes
+ gdb_cv_var_bfd_elf=yes
else
- gdb_cv_var_elf=no
+ gdb_cv_var_bfd_elf=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_var_elf" >&5
-$as_echo "$gdb_cv_var_elf" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_var_bfd_elf" >&5
+$as_echo "$gdb_cv_var_bfd_elf" >&6; }
CC=$OLD_CC
CFLAGS=$OLD_CFLAGS
LDFLAGS=$OLD_LDFLAGS
LIBS=$OLD_LIBS
-if test "$gdb_cv_var_elf" = yes; then
- CONFIG_OBS="$CONFIG_OBS elfread.o stap-probe.o dtrace-probe.o \
- gcore-elf.o elf-none-tdep.o"
+if test "$gdb_cv_var_bfd_elf" = yes; then
+ CONFIG_OBS="$CONFIG_OBS gcore-elf.o elf-none-tdep.o"
$as_echo "#define HAVE_ELF 1" >>confdefs.h
- # -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
+ # -ldl is provided by bfd/Makefile.am (LIBDL) <PLUGINS>.
if test "$plugins" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
$as_echo_n "checking for library containing dlopen... " >&6; }
@@ -31718,9 +31929,12 @@ if test "$ac_res" != no; then :
fi
fi
+ bfd_supports_elf=yes
+ all_binary_file_srcs="$all_binary_file_srcs \$(elf_SRCS)"
fi
# Add macho support to GDB, but only if BFD includes it.
+bfd_supports_macho=no
OLD_CFLAGS=$CFLAGS
OLD_LDFLAGS=$LDFLAGS
@@ -31737,7 +31951,7 @@ fi
CC="./libtool --quiet --mode=link $CC"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mach-O support in BFD" >&5
$as_echo_n "checking for Mach-O support in BFD... " >&6; }
-if ${gdb_cv_var_macho+:} false; then :
+if ${gdb_cv_var_bfd_macho+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -31756,30 +31970,81 @@ return bfd_mach_o_lookup_command (NULL, 0, NULL);
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- gdb_cv_var_macho=yes
+ gdb_cv_var_bfd_macho=yes
else
- gdb_cv_var_macho=no
+ gdb_cv_var_bfd_macho=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_var_macho" >&5
-$as_echo "$gdb_cv_var_macho" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_var_bfd_macho" >&5
+$as_echo "$gdb_cv_var_bfd_macho" >&6; }
CC=$OLD_CC
CFLAGS=$OLD_CFLAGS
LDFLAGS=$OLD_LDFLAGS
LIBS=$OLD_LIBS
-if test "$gdb_cv_var_macho" = yes; then
- CONFIG_OBS="$CONFIG_OBS machoread.o"
+if test "$gdb_cv_var_bfd_macho" = yes; then
+ bfd_supports_macho=yes
+ all_binary_file_srcs="$all_binary_file_srcs \$(macho_SRCS)"
+fi
+
+FORMAT_SRCS=
+
+if test "$enable_binary_file_formats" != "all"; then
+ # Formats that are required by some requested target(s).
+ # Warn users that they are added, so no one is surprised.
+ for req in $target_formats; do
+ case ,$enable_binary_file_formats, in
+ *,$req,*)
+ # Do nothing.
+ ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"$req is required to support one or more requested targets. Adding it\"" >&5
+$as_echo "$as_me: WARNING: \"$req is required to support one or more requested targets. Adding it\"" >&2;}
+ enable_binary_file_formats="${enable_binary_file_formats},$req"
+ ;;
+ esac
+ done
+
+
+cat >>confdefs.h <<_ACEOF
+#define SUPPORTED_BINARY_FILE_FORMATS "$enable_binary_file_formats"
+_ACEOF
+
fi
+enable_binary_file_formats=$(echo $enable_binary_file_formats | sed 's/,/ /g')
+
+# Go through all requested and required binary file formats to compile
+# GDB, and double check that we can compile them.
+for format in $enable_binary_file_formats
+do
+ if test "$format" = "elf" && test "$bfd_supports_elf" != "yes"; then
+ as_fn_error but BFD does not support it." "\"elf support was requested" "$LINENO" 5;
+ elif test "$format" = "macho" && test "$bfd_supports_macho" != "yes"; then
+ as_fn_error but BFD does not support it." "\"Mach-O support was requested" "$LINENO" 5;
+ fi
+
+ if test "$format" = "all"; then
+ FORMAT_SRCS="$all_binary_file_srcs"
+ # We don't break here in case the user requested Mach-O or ELF, but
+ # BFD is not configured to support it. If we were to break, we would
+ # silently drop the requested support instead of erroring out.
+ else
+ fmt=$(echo "$format _SRCS" | sed 's/ //')
+ FORMAT_SRCS="$FORMAT_SRCS \$($fmt)"
+ fi
+done
+
+
+
# Add any host-specific objects to GDB.
CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}"
# If building on ELF, look for lzma support for embedded compressed debug info.
-if test "$gdb_cv_var_elf" = yes; then
+if test "$gdb_cv_var_bfd_elf" = yes; then
# Check whether --with-lzma was given.
if test "${with_lzma+set}" = set; then :
@@ -33946,10 +34211,6 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
-if test -z "${ENABLE_BFD_64_BIT_TRUE}" && test -z "${ENABLE_BFD_64_BIT_FALSE}"; then
- as_fn_error $? "conditional \"ENABLE_BFD_64_BIT\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
if test -z "${HAVE_PYTHON_TRUE}" && test -z "${HAVE_PYTHON_FALSE}"; then
as_fn_error $? "conditional \"HAVE_PYTHON\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 2411b10..5292410 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1,5 +1,5 @@
dnl Autoconf configure script for GDB, the GNU debugger.
-dnl Copyright (C) 1995-2024 Free Software Foundation, Inc.
+dnl Copyright (C) 1995-2025 Free Software Foundation, Inc.
dnl
dnl This file is part of GDB.
dnl
@@ -191,6 +191,44 @@ AS_HELP_STRING([--enable-targets=TARGETS], [alternative target configurations]),
;;
esac])
+AC_ARG_ENABLE(binary_file_formats,
+ AS_HELP_STRING([--enable-binary-file-formats=FORMATS],
+ [enable support for selected file formats (default 'all')
+ available formats: coff, dbx, elf, macho, mips, xcoff, all]),
+[case "${enableval}" in
+ yes | "") AC_MSG_ERROR(enable-binary-file-formats option must specify file formats or 'all')
+ ;;
+ no) enable_binary_file_formats= ;;
+ *) enable_binary_file_formats=$enableval ;;
+esac], [enable_binary_file_formats=all])
+
+# Check whether to support mdebug/ecoff debug information.
+AC_ARG_ENABLE(gdb-mdebug-support,
+AS_HELP_STRING([--enable-gdb-mdebug-support],
+ [Enable support for the mdebug debuginfo format (default 'yes')]),
+[GDB_CHECK_YES_NO_VAL([$enableval], [--enable-gdb-mdebug-support])],
+[enable_gdb_mdebug_support=yes])
+
+if test "x${enable_gdb_mdebug_support}" != "xno"; then
+ CONFIG_SRCS="$CONFIG_SRCS mdebugread.c"
+ CONFIG_OBS="$CONFIG_OBS mdebugread.o"
+ AC_DEFINE(MDEBUG_FORMAT_AVAILABLE, 1,
+ [defined if mdebug format was requested.])
+fi
+
+# Check whether to support dwarf debug information
+AC_ARG_ENABLE(gdb-dwarf-support,
+AS_HELP_STRING([--enable-gdb-dwarf-support],
+ [Enable support for the dwarf debuginfo format (default 'yes')]),
+[GDB_CHECK_YES_NO_VAL([$enableval], [--enable-gdb-dwarf-support])],
+[enable_gdb_dwarf_support=yes])
+
+if test "x${enable_gdb_dwarf_support}" != "xno"; then
+ AC_DEFINE(DWARF_FORMAT_AVAILABLE, 1,
+ [defined if dwarf format was requested.])
+ CONFIG_SRCS="$CONFIG_SRCS \$(DWARF2_SRCS)"
+ CONFIG_OBS="$CONFIG_OBS \$(DWARF2_OBS)"
+fi
BFD_64_BIT
@@ -212,10 +250,21 @@ TARGET_OBS=
all_targets=
HAVE_NATIVE_GCORE_TARGET=
+# File formats that will be enabled based on the selected
+# target(s). These are chosen because they are required to
+# compile one or more of the selected targets.
+target_formats=
+
+# If all targets were requested, this is all formats that should
+# accompany them. These are just the ones required for compilation
+# to succeed, not the formats suggested based on targets.
+all_target_formats="coff xcoff"
+
for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
do
if test "$targ_alias" = "all"; then
all_targets=true
+ target_formats=$all_target_formats
else
# Canonicalize the secondary target names.
result=`$ac_config_sub $targ_alias 2>/dev/null`
@@ -241,7 +290,7 @@ do
done
# Check whether this target needs 64-bit CORE_ADDR
- if test x${enable_64_bit_bfd} = xno; then
+ if test x${have_64_bit_bfd} = xno; then
. ${srcdir}/../bfd/config.bfd
fi
@@ -254,19 +303,10 @@ do
done
if test x${all_targets} = xtrue; then
- if test x${enable_64_bit_bfd} = xyes; then
+ if test x${have_64_bit_bfd} = xyes; then
TARGET_OBS='$(ALL_TARGET_OBS) $(ALL_64_TARGET_OBS)'
else
- case ${host} in
- mips*)
- # If all targets were requested, but 64 bit bfd is not enabled,
- # the build will fail. See PR 28684.
- AC_MSG_ERROR([--enable-targets=all requires --enable-64-bit-bfd])
- ;;
- *)
- TARGET_OBS='$(ALL_TARGET_OBS)'
- ;;
- esac
+ TARGET_OBS='$(ALL_TARGET_OBS)'
fi
fi
@@ -749,8 +789,8 @@ AC_DEFUN([AC_TRY_LIBPYTHON],
found_usable_python=no
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "Python.h"]],
[[
- #if PY_MAJOR_VERSION != 3
- # error "We only support Python 3"
+ #if PY_VERSION_HEX < 0x03040000
+ # error "Minimum supported Python version is 3.4"
#endif
Py_Initialize ();
]])],
@@ -1229,9 +1269,17 @@ AC_ARG_ENABLE([gdb-compile],
AS_HELP_STRING([--enable-gdb-compile],
[enable support for the compile subsystem, default 'yes']),
[GDB_CHECK_YES_NO_VAL([$enableval], [--enable-gdb-compile])],
- [enable_gdb_compile=yes])
+ [enable_gdb_compile=default])
-if test "${enable_gdb_compile}" == yes; then
+if test "${enable_gdb_compile}" = "default"; then
+ enable_gdb_compile=${enable_gdb_dwarf_support}
+ AC_MSG_WARN([Defaulting compile support to '${enable_gdb_dwarf_support}'])
+fi
+
+if test "${enable_gdb_compile}" = "yes"; then
+ if test "${enable_gdb_dwarf_support}" = "no"; then
+ AC_MSG_ERROR([enabling gdb compile requires dwarf support])
+ fi
AC_DEFINE(HAVE_COMPILE, 1, [Define if compiling support to gdb compile.])
CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_GCC_COMPILE_OBS)"
else
@@ -1328,8 +1376,9 @@ AC_SUBST(SRCHIGH_CFLAGS)
# Checks for header files. #
# ------------------------- #
-AC_HEADER_STDC
AC_CHECK_HEADERS([ \
+ IOKit/serial/ioss.h \
+ asm/termios.h \
machine/reg.h \
nlist.h \
ptrace.h \
@@ -1923,32 +1972,87 @@ fi
# Note that WIN32APILIBS is set by GDB_AC_COMMON.
WIN32LIBS="$WIN32LIBS $WIN32APILIBS"
+# Object files to be used when building with support for all file formats.
+# This should not have elf or macho, as support for those formats depends
+# on BFD enabling them as well.
+all_binary_file_srcs="\$(dbx_SRCS) \$(mips_SRCS) \$(coff_SRCS) \$(xcoff_SRCS)"
+
+bfd_supports_elf=no
# Add ELF support to GDB, but only if BFD includes ELF support.
-GDB_AC_CHECK_BFD([for ELF support in BFD], gdb_cv_var_elf,
+GDB_AC_CHECK_BFD([for ELF support in BFD], gdb_cv_var_bfd_elf,
[bfd_get_elf_phdr_upper_bound (NULL)], elf-bfd.h)
-if test "$gdb_cv_var_elf" = yes; then
- CONFIG_OBS="$CONFIG_OBS elfread.o stap-probe.o dtrace-probe.o \
- gcore-elf.o elf-none-tdep.o"
+if test "$gdb_cv_var_bfd_elf" = yes; then
+ CONFIG_OBS="$CONFIG_OBS gcore-elf.o elf-none-tdep.o"
AC_DEFINE(HAVE_ELF, 1,
[Define if ELF support should be included.])
- # -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
+ # -ldl is provided by bfd/Makefile.am (LIBDL) <PLUGINS>.
if test "$plugins" = "yes"; then
AC_SEARCH_LIBS(dlopen, dl)
fi
+ bfd_supports_elf=yes
+ all_binary_file_srcs="$all_binary_file_srcs \$(elf_SRCS)"
fi
# Add macho support to GDB, but only if BFD includes it.
-GDB_AC_CHECK_BFD([for Mach-O support in BFD], gdb_cv_var_macho,
+bfd_supports_macho=no
+GDB_AC_CHECK_BFD([for Mach-O support in BFD], gdb_cv_var_bfd_macho,
[bfd_mach_o_lookup_command (NULL, 0, NULL)], mach-o.h)
-if test "$gdb_cv_var_macho" = yes; then
- CONFIG_OBS="$CONFIG_OBS machoread.o"
+if test "$gdb_cv_var_bfd_macho" = yes; then
+ bfd_supports_macho=yes
+ all_binary_file_srcs="$all_binary_file_srcs \$(macho_SRCS)"
+fi
+
+FORMAT_SRCS=
+
+if test "$enable_binary_file_formats" != "all"; then
+ # Formats that are required by some requested target(s).
+ # Warn users that they are added, so no one is surprised.
+ for req in $target_formats; do
+ case ,$enable_binary_file_formats, in
+ *,$req,*)
+ # Do nothing.
+ ;;
+ *)
+ AC_MSG_WARN("$req is required to support one or more requested targets. Adding it")
+ enable_binary_file_formats="${enable_binary_file_formats},$req"
+ ;;
+ esac
+ done
+
+ AC_DEFINE_UNQUOTED(SUPPORTED_BINARY_FILE_FORMATS, "$enable_binary_file_formats",
+ Which binary file formats were requested at configure time. )
fi
+enable_binary_file_formats=$(echo $enable_binary_file_formats | sed 's/,/ /g')
+
+# Go through all requested and required binary file formats to compile
+# GDB, and double check that we can compile them.
+for format in $enable_binary_file_formats
+do
+ if test "$format" = "elf" && test "$bfd_supports_elf" != "yes"; then
+ AC_MSG_ERROR("elf support was requested, but BFD does not support it.");
+ elif test "$format" = "macho" && test "$bfd_supports_macho" != "yes"; then
+ AC_MSG_ERROR("Mach-O support was requested, but BFD does not support it.");
+ fi
+
+ if test "$format" = "all"; then
+ FORMAT_SRCS="$all_binary_file_srcs"
+ # We don't break here in case the user requested Mach-O or ELF, but
+ # BFD is not configured to support it. If we were to break, we would
+ # silently drop the requested support instead of erroring out.
+ else
+ fmt=$(echo "$format _SRCS" | sed 's/ //')
+ FORMAT_SRCS="$FORMAT_SRCS \$($fmt)"
+ fi
+done
+
+AC_SUBST(FORMAT_SRCS)
+
# Add any host-specific objects to GDB.
CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}"
# If building on ELF, look for lzma support for embedded compressed debug info.
-if test "$gdb_cv_var_elf" = yes; then
+if test "$gdb_cv_var_bfd_elf" = yes; then
AC_ARG_WITH(lzma,
AS_HELP_STRING([--with-lzma], [support lzma compression (auto/yes/no)]),
[], [with_lzma=auto])
diff --git a/gdb/configure.nat b/gdb/configure.nat
index 7b38962..2bd67ae 100644
--- a/gdb/configure.nat
+++ b/gdb/configure.nat
@@ -1,5 +1,5 @@
# ; -*- mode: sh ; -*-
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 18a15c0..8d821a1 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -85,7 +85,7 @@ hppa*-*-*)
i[34567]86-*-*)
cpu_obs="${i386_tobjs}"
- if test "x$enable_64_bit_bfd" = "xyes"; then
+ if test "x$have_64_bit_bfd" = "xyes"; then
cpu_obs="${amd64_tobjs} ${cpu_obs}"
fi
;;
@@ -151,13 +151,14 @@ aarch64*-*-linux*)
arch/arm.o arch/arm-linux.o arch/arm-get-next-pcs.o \
arm-tdep.o arm-linux-tdep.o \
glibc-tdep.o linux-tdep.o solib-svr4.o \
+ solib-svr4-linux.o svr4-tls-tdep.o \
symfile-mem.o linux-record.o"
;;
alpha*-*-linux*)
# Target: Little-endian Alpha running Linux
gdb_target_obs="alpha-mdebug-tdep.o alpha-linux-tdep.o \
- linux-tdep.o solib-svr4.o"
+ linux-tdep.o solib-svr4.o solib-svr4-linux.o"
;;
alpha*-*-netbsd* | alpha*-*-knetbsd*-gnu)
# Target: NetBSD/alpha
@@ -179,7 +180,7 @@ amdgcn*-*-*)
am33_2.0*-*-linux*)
# Target: Matsushita mn10300 (AM33) running Linux
gdb_target_obs="mn10300-tdep.o mn10300-linux-tdep.o linux-tdep.o \
- solib-svr4.o"
+ solib-svr4.o solib-svr4-linux.o"
;;
arc*-*-elf32)
@@ -189,7 +190,8 @@ arc*-*-elf32)
arc*-*-linux*)
# Target: ARC machine running Linux
- gdb_target_obs="arc-linux-tdep.o linux-tdep.o solib-svr4.o"
+ gdb_target_obs="arc-linux-tdep.o linux-tdep.o solib-svr4.o \
+ solib-svr4-linux.o"
;;
arm*-wince-pe | arm*-*-mingw32ce*)
@@ -199,7 +201,8 @@ arm*-wince-pe | arm*-*-mingw32ce*)
arm*-*-linux*)
# Target: ARM based machine running GNU/Linux
gdb_target_obs="arch/arm-linux.o arm-linux-tdep.o glibc-tdep.o \
- solib-svr4.o symfile-mem.o linux-tdep.o linux-record.o"
+ solib-svr4.o solib-svr4-linux.o symfile-mem.o \
+ linux-tdep.o linux-record.o"
;;
arm*-*-freebsd*)
# Target: FreeBSD/arm
@@ -239,13 +242,14 @@ bpf-*-*)
cris*)
# Target: CRIS
- gdb_target_obs="cris-tdep.o cris-linux-tdep.o linux-tdep.o solib-svr4.o"
+ gdb_target_obs="cris-tdep.o cris-linux-tdep.o linux-tdep.o \
+ solib-svr4.o solib-svr4-linux.o"
;;
csky*-*-linux*)
# Target: CSKY running GNU/Linux
gdb_target_obs="csky-tdep.o csky-linux-tdep.o glibc-tdep.o \
- linux-tdep.o solib-svr4.o"
+ linux-tdep.o solib-svr4.o solib-svr4-linux.o"
;;
csky*-*-*)
@@ -270,7 +274,8 @@ h8300-*-*)
hppa*-*-linux*)
# Target: HP PA-RISC running Linux
gdb_target_obs="hppa-linux-tdep.o glibc-tdep.o \
- linux-tdep.o solib-svr4.o symfile-mem.o"
+ linux-tdep.o solib-svr4.o solib-svr4-linux.o \
+ symfile-mem.o"
;;
hppa*-*-netbsd*)
# Target: NetBSD/hppa
@@ -284,7 +289,7 @@ hppa*-*-openbsd*)
i[34567]86-*-darwin*)
# Target: Darwin/i386
gdb_target_obs="i386-darwin-tdep.o solib-darwin.o"
- if test "x$enable_64_bit_bfd" = "xyes"; then
+ if test "x$have_64_bit_bfd" = "xyes"; then
# Target: GNU/Linux x86-64
gdb_target_obs="amd64-darwin-tdep.o ${gdb_target_obs}"
fi
@@ -315,13 +320,13 @@ i[34567]86-*-linux*)
# Target: Intel 386 running GNU/Linux
gdb_target_obs="i386-linux-tdep.o \
glibc-tdep.o \
- solib-svr4.o symfile-mem.o \
+ solib-svr4.o solib-svr4-linux.o symfile-mem.o \
linux-tdep.o linux-record.o \
arch/i386-linux-tdesc.o \
arch/x86-linux-tdesc-features.o"
- if test "x$enable_64_bit_bfd" = "xyes"; then
+ if test "x$have_64_bit_bfd" = "xyes"; then
# Target: GNU/Linux x86-64
- gdb_target_obs="amd64-linux-tdep.o \
+ gdb_target_obs="amd64-linux-tdep.o svr4-tls-tdep.o \
arch/amd64-linux-tdesc.o ${gdb_target_obs}"
fi
;;
@@ -345,7 +350,7 @@ i[34567]86-*-go32* | i[34567]86-*-msdosdjgpp*)
ia64-*-linux*)
# Target: Intel IA-64 running GNU/Linux
gdb_target_obs="ia64-linux-tdep.o linux-tdep.o \
- solib-svr4.o symfile-mem.o"
+ solib-svr4.o solib-svr4-linux.o symfile-mem.o"
;;
ia64-*-*vms*)
# Target: Intel IA-64 running OpenVMS
@@ -363,7 +368,8 @@ lm32-*-*)
loongarch*-*-linux*)
# Target: LoongArch running Linux
gdb_target_obs="loongarch-linux-tdep.o glibc-tdep.o \
- linux-tdep.o solib-svr4.o linux-record.o"
+ linux-tdep.o solib-svr4.o solib-svr4-linux.o \
+ linux-record.o"
;;
m32c-*-*)
@@ -374,8 +380,8 @@ m32c-*-*)
m32r*-*-linux*)
# Target: Renesas M32R running GNU/Linux
gdb_target_obs="m32r-tdep.o m32r-linux-tdep.o \
- glibc-tdep.o solib-svr4.o symfile-mem.o \
- linux-tdep.o"
+ glibc-tdep.o solib-svr4.o solib-svr4-linux.o \
+ symfile-mem.o linux-tdep.o"
;;
m32r*-*-*)
# Target: Renesas m32r processor
@@ -395,7 +401,8 @@ fido-*-elf*)
m68*-*-linux*)
# Target: Motorola m68k with a.out and ELF
gdb_target_obs="m68k-tdep.o m68k-linux-tdep.o solib-svr4.o \
- linux-tdep.o glibc-tdep.o symfile-mem.o"
+ solib-svr4-linux.o linux-tdep.o glibc-tdep.o \
+ symfile-mem.o"
;;
m68*-*-netbsd* | m68*-*-knetbsd*-gnu)
# Target: NetBSD/m68k
@@ -415,7 +422,7 @@ mep-*-*)
microblaze*-linux-*|microblaze*-*-linux*)
# Target: Xilinx MicroBlaze running Linux
gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o solib-svr4.o \
- symfile-mem.o linux-tdep.o"
+ solib-svr4-linux.o symfile-mem.o linux-tdep.o"
;;
microblaze*-*-*)
# Target: Xilinx MicroBlaze running standalone
@@ -425,7 +432,8 @@ microblaze*-*-*)
mips*-*-linux*)
# Target: Linux/MIPS
gdb_target_obs="mips-tdep.o mips-linux-tdep.o glibc-tdep.o \
- solib-svr4.o symfile-mem.o linux-tdep.o"
+ solib-svr4.o solib-svr4-linux.o symfile-mem.o \
+ linux-tdep.o"
;;
mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
# Target: MIPS running NetBSD
@@ -469,7 +477,8 @@ nds32*-*-elf)
or1k*-*-linux*)
# Target: OpenCores OpenRISC 1000 32-bit running Linux
gdb_target_obs="or1k-tdep.o or1k-linux-tdep.o solib-svr4.o \
- symfile-mem.o glibc-tdep.o linux-tdep.o"
+ solib-svr4-linux.o symfile-mem.o glibc-tdep.o \
+ linux-tdep.o"
;;
or1k-*-* | or1knd-*-*)
@@ -496,14 +505,15 @@ powerpc-*-openbsd*)
;;
powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*)
# Target: PowerPC running AIX
- gdb_target_obs="rs6000-tdep.o rs6000-aix-tdep.o xcoffread.o \
+ gdb_target_obs="rs6000-tdep.o rs6000-aix-tdep.o \
ppc-sysv-tdep.o solib-aix.o \
ravenscar-thread.o ppc-ravenscar-thread.o"
;;
powerpc*-*-linux*)
# Target: PowerPC running Linux
gdb_target_obs="rs6000-tdep.o ppc-linux-tdep.o ppc-sysv-tdep.o \
- ppc64-tdep.o solib-svr4.o \
+ ppc64-tdep.o solib-svr4.o solib-svr4-linux.o \
+ svr4-tls-tdep.o \
glibc-tdep.o symfile-mem.o linux-tdep.o \
ravenscar-thread.o ppc-ravenscar-thread.o \
linux-record.o \
@@ -512,8 +522,8 @@ powerpc*-*-linux*)
powerpc-*-lynx*178)
# Target: PowerPC running Lynx178.
gdb_target_obs="rs6000-tdep.o rs6000-lynx178-tdep.o \
- xcoffread.o ppc-sysv-tdep.o \
- ravenscar-thread.o ppc-ravenscar-thread.o"
+ ppc-sysv-tdep.o ravenscar-thread.o \
+ ppc-ravenscar-thread.o"
;;
powerpc*-*-*)
# Target: PowerPC running eabi
@@ -524,7 +534,9 @@ powerpc*-*-*)
s390*-*-linux*)
# Target: S390 running Linux
gdb_target_obs="s390-linux-tdep.o s390-tdep.o solib-svr4.o \
- linux-tdep.o linux-record.o symfile-mem.o"
+ solib-svr4-linux.o \
+ linux-tdep.o linux-record.o symfile-mem.o \
+ svr4-tls-tdep.o"
;;
riscv*-*-freebsd*)
@@ -534,8 +546,10 @@ riscv*-*-freebsd*)
riscv*-*-linux*)
# Target: Linux/RISC-V
- gdb_target_obs="riscv-linux-tdep.o glibc-tdep.o \
- linux-tdep.o solib-svr4.o symfile-mem.o linux-record.o"
+ gdb_target_obs="riscv-linux-canonicalize-syscall-gen.o \
+ riscv-linux-tdep.o glibc-tdep.o linux-tdep.o \
+ solib-svr4.o solib-svr4-linux.o symfile-mem.o \
+ linux-record.o svr4-tls-tdep.o"
;;
riscv*-*-*)
@@ -556,7 +570,7 @@ rx-*-*)
sh*-*-linux*)
# Target: GNU/Linux Super-H
gdb_target_obs="sh-tdep.o sh-linux-tdep.o \
- solib-svr4.o symfile-mem.o \
+ solib-svr4.o solib-svr4-linux.o symfile-mem.o \
glibc-tdep.o linux-tdep.o"
;;
sh*-*-netbsd* | sh*-*-knetbsd*-gnu)
@@ -575,10 +589,11 @@ sh*)
sparc-*-linux*)
# Target: GNU/Linux SPARC
gdb_target_obs="sparc-tdep.o \
- sparc-linux-tdep.o solib-svr4.o symfile-mem.o \
+ sparc-linux-tdep.o solib-svr4.o solib-svr4-linux.o \
+ symfile-mem.o \
linux-tdep.o \
ravenscar-thread.o sparc-ravenscar-thread.o"
- if test "x$enable_64_bit_bfd" = "xyes"; then
+ if test "x$have_64_bit_bfd" = "xyes"; then
# Target: GNU/Linux UltraSPARC
gdb_target_obs="sparc64-tdep.o \
sparc64-linux-tdep.o ${gdb_target_obs}"
@@ -588,7 +603,8 @@ sparc64-*-linux*)
# Target: GNU/Linux UltraSPARC
gdb_target_obs="sparc64-tdep.o \
sparc64-linux-tdep.o sparc-tdep.o \
- sparc-linux-tdep.o solib-svr4.o linux-tdep.o \
+ sparc-linux-tdep.o solib-svr4.o solib-svr4-linux.o \
+ linux-tdep.o \
ravenscar-thread.o sparc-ravenscar-thread.o"
;;
sparc*-*-freebsd* | sparc*-*-kfreebsd*-gnu)
@@ -656,6 +672,7 @@ tic6x-*-*)
tilegx-*-linux*)
# Target: TILE-Gx
gdb_target_obs="tilegx-tdep.o tilegx-linux-tdep.o solib-svr4.o \
+ solib-svr4-linux.o \
symfile-mem.o glibc-tdep.o linux-tdep.o"
;;
@@ -705,8 +722,9 @@ x86_64-*-elf*)
x86_64-*-linux*)
# Target: GNU/Linux x86-64
gdb_target_obs="amd64-linux-tdep.o ${i386_tobjs} \
- i386-linux-tdep.o glibc-tdep.o \
- solib-svr4.o symfile-mem.o linux-tdep.o linux-record.o \
+ i386-linux-tdep.o glibc-tdep.o svr4-tls-tdep.o \
+ solib-svr4.o solib-svr4-linux.o symfile-mem.o \
+ linux-tdep.o linux-record.o \
arch/i386-linux-tdesc.o arch/amd64-linux-tdesc.o \
arch/x86-linux-tdesc-features.o"
;;
@@ -736,7 +754,7 @@ x86_64-*-rtems*)
;;
x86_64-*-gnu*)
# Target: x86_64 running the GNU Hurd
- gdb_target_obs="amd64-gnu-tdep.o glibc-tdep.o solib-svr4.o"
+ gdb_target_obs="amd64-gnu-tdep.o i386-gnu-tdep.o glibc-tdep.o solib-svr4.o"
;;
xtensa*-*-*linux*)
# Target: GNU/Linux Xtensa
@@ -817,3 +835,17 @@ for t in x ${gdb_target_obs}; do
gdb_have_gcore=true
fi
done
+
+# Decide which file formats are absolutely required based on
+# the requested targets. Warn later that they are added, in
+# case the user didn't manually request them, or all readers.
+# It's fine to add the same format multiple times since the
+# loop that reads the options to FORMAT_OBS will ensure that
+# they are only added once.
+for i in $gdb_target_obs; do
+ case "${i}" in
+ *"windows-tdep.o" ) target_formats="${target_formats} coff";;
+ "rs6000-aix-tdep.o" ) target_formats="${target_formats} xcoff";;
+ "rs6000-lynx178-tdep.o" ) target_formats="${target_formats} xcoff";;
+ esac
+done
diff --git a/gdb/contrib/ari/create-web-ari-in-src.sh b/gdb/contrib/ari/create-web-ari-in-src.sh
index 64d3c73..b479ce5 100644
--- a/gdb/contrib/ari/create-web-ari-in-src.sh
+++ b/gdb/contrib/ari/create-web-ari-in-src.sh
@@ -2,7 +2,7 @@
# GDB script to create web ARI page directly from within gdb/ari directory.
#
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
@@ -50,7 +50,7 @@ if [ -z "${tempdir}" ] ; then
fi
fi
-# Default location of generate index.hmtl web page.
+# Default location of generated index.html web page.
if [ -z "${webdir}" ] ; then
# Use 'branch' subdir name if Tag contains branch
if [ -f "${srcdir}/gdb/CVS/Tag" ] ; then
diff --git a/gdb/contrib/ari/gdb_ari.sh b/gdb/contrib/ari/gdb_ari.sh
index 5ed7d61..e10bbe0 100755
--- a/gdb/contrib/ari/gdb_ari.sh
+++ b/gdb/contrib/ari/gdb_ari.sh
@@ -2,7 +2,7 @@
# GDB script to list of problems using awk.
#
-# Copyright (C) 2002-2024 Free Software Foundation, Inc.
+# Copyright (C) 2002-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
@@ -60,7 +60,7 @@ Options:
-Werror Treat all problems as errors.
-Wall Report all problems.
-Wari Report problems that should be fixed in new code.
- -WCATEGORY Report problems in the specifed category. The category
+ -WCATEGORY Report problems in the specified category. The category
can be prefixed with "no-". Valid categories
are: ${all}
EOF
@@ -159,7 +159,7 @@ BEGIN {
PWD = "'`pwd`'"
}
-# Print the error message for BUG. Append SUPLEMENT if non-empty.
+# Print the error message for BUG. Append SUPPLEMENT if non-empty.
function print_bug(file,line,prefix,category,bug,doc,supplement, suffix,idx) {
if (print_idx) {
idx = bug ": "
diff --git a/gdb/contrib/ari/gdb_find.sh b/gdb/contrib/ari/gdb_find.sh
index f0aa6d1..b6bd3f9 100644
--- a/gdb/contrib/ari/gdb_find.sh
+++ b/gdb/contrib/ari/gdb_find.sh
@@ -2,7 +2,7 @@
# GDB script to create list of files to check using gdb_ari.sh.
#
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/contrib/ari/update-web-ari.sh b/gdb/contrib/ari/update-web-ari.sh
index 75ab029..b9ef184 100644
--- a/gdb/contrib/ari/update-web-ari.sh
+++ b/gdb/contrib/ari/update-web-ari.sh
@@ -2,7 +2,7 @@
# GDB script to create GDB ARI web page.
#
-# Copyright (C) 2001-2024 Free Software Foundation, Inc.
+# Copyright (C) 2001-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
@@ -176,7 +176,7 @@ fi
# THIS HAS SUFFERED BIT ROT
if ${check_indent_p} && test -d "${srcdir}"
then
- printf "Analizing file indentation:" 1>&2
+ printf "Analyzing file indentation:" 1>&2
( cd "${srcdir}" && /bin/sh ${aridir}/gdb_find.sh ${project} | while read f
do
if /bin/sh ${aridir}/gdb_indent.sh < ${f} 2>/dev/null | cmp -s - ${f}
@@ -550,7 +550,7 @@ function print_heading (nb_file, where, bug_i) {
for (bug_i = 1; bug_i <= nr_bug; bug_i++) {
bug = i2bug[bug_i];
printf "<th>"
- # The title names are offset by one. Otherwize, when the browser
+ # The title names are offset by one. Otherwise, when the browser
# jumps to the name it leaves out half the relevant column.
#printf "<a name=\",%s\">&nbsp;</a>", bug
printf "<a name=\",%s\">&nbsp;</a>", i2bug[bug_i-1]
@@ -851,7 +851,7 @@ EOF
print_toc 0 -1 deprecate Deprecate <<EOF
Mechanisms that are a candidate for being made obsolete. Once core
GDB no longer depends on these mechanisms and/or there is a
-replacement available, these mechanims can be deprecated (adding the
+replacement available, these mechanisms can be deprecated (adding the
deprecated prefix) obsoleted (put into category obsolete) or deleted.
See obsolete and deprecated.
EOF
diff --git a/gdb/contrib/cc-with-tweaks.sh b/gdb/contrib/cc-with-tweaks.sh
index 4214b92..930ba5c 100755
--- a/gdb/contrib/cc-with-tweaks.sh
+++ b/gdb/contrib/cc-with-tweaks.sh
@@ -2,7 +2,7 @@
# Wrapper around gcc to tweak the output in various ways when running
# the testsuite.
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -42,6 +42,7 @@
# -Z invoke objcopy --compress-debug-sections
# -z compress using dwz
# -m compress using dwz -m
+# -5 compress using dwz -m -5
# -i make an index (.gdb_index)
# -c make an index (currently .gdb_index) in a cache dir
# -n make a dwarf5 index (.debug_names)
@@ -88,6 +89,7 @@ want_index=false
index_options=""
want_index_cache=false
want_dwz=false
+dwz_5flag=
want_multi=false
want_dwp=false
want_objcopy_compress=false
@@ -101,6 +103,7 @@ while [ $# -gt 0 ]; do
-n) want_index=true; index_options=-dwarf-5;;
-c) want_index_cache=true ;;
-m) want_multi=true ;;
+ -5) want_multi=true; dwz_5flag=-5 ;;
-p) want_dwp=true ;;
-l) want_gnu_debuglink=true ;;
*) break ;;
@@ -269,7 +272,7 @@ elif [ "$want_multi" = true ]; then
rm -f "$dwz_file"
cp "$output_file" "${output_file}.alt"
- $DWZ -m "$dwz_file" "$output_file" "${output_file}.alt" > /dev/null
+ $DWZ $dwz_5flag -m "$dwz_file" "$output_file" "${output_file}.alt" > /dev/null
rm -f "${output_file}.alt"
# Validate dwz's work by checking if the expected output file exists.
diff --git a/gdb/contrib/codespell-dictionary.txt b/gdb/contrib/codespell-dictionary.txt
new file mode 100644
index 0000000..09bc309
--- /dev/null
+++ b/gdb/contrib/codespell-dictionary.txt
@@ -0,0 +1 @@
+gdbsever->gdbserver
diff --git a/gdb/contrib/codespell-ignore-words.txt b/gdb/contrib/codespell-ignore-words.txt
index 2d6e13a..881b1d2 100644
--- a/gdb/contrib/codespell-ignore-words.txt
+++ b/gdb/contrib/codespell-ignore-words.txt
@@ -1,2 +1,3 @@
configury
SME
+Synopsys
diff --git a/gdb/contrib/codespell-log.sh b/gdb/contrib/codespell-log.sh
new file mode 100755
index 0000000..10780f8
--- /dev/null
+++ b/gdb/contrib/codespell-log.sh
@@ -0,0 +1,95 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2025 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Script to be used as pre-commit commit-msg hook to spell-check the commit
+# log using codespell.
+#
+# Using codespell directly as a pre-commit commit-msg hook has the drawback
+# that:
+# - if codespell fails, the commit fails
+# - if the commit log mentions a typo correction, it'll require a
+# codespell:ignore annotation.
+#
+# This script works around these problems by treating codespell output as a
+# hint, and ignoring codespell exit status.
+#
+# Implementation note: rather than using codespell directly, this script uses
+# pre-commit to call codespell, because it allows us to control the codespell
+# version that is used.
+
+# Exit on error.
+set -e
+
+# Initialize temporary file names.
+cfg=""
+output=""
+
+cleanup()
+{
+ for f in "$cfg" "$output"; do
+ if [ "$f" != "" ]; then
+ rm -f "$f"
+ fi
+ done
+}
+
+# Schedule cleanup.
+trap cleanup EXIT
+
+# Create temporary files.
+cfg=$(mktemp)
+output=$(mktemp)
+
+gen_cfg ()
+{
+ cat > "$1" <<EOF
+repos:
+- repo: https://github.com/codespell-project/codespell
+ rev: v2.4.1
+ hooks:
+ - id: codespell
+ name: codespell-log-internal
+ stages: [manual]
+ args: [--config, gdb/contrib/setup.cfg]
+EOF
+}
+
+# Generate pre-commit configuration file.
+gen_cfg "$cfg"
+
+# Setup pre-commit command to run.
+cmd=(pre-commit \
+ run \
+ -c "$cfg" \
+ codespell \
+ --hook-stage manual \
+ --files "$@")
+
+# Run pre-commit command.
+if "${cmd[@]}" \
+ > "$output" \
+ 2>&1; then
+ # Command succeeded quietly, we're done.
+ exit 0
+fi
+
+# Command failed quietly, now show the output.
+#
+# Simply doing "cat $output" doesn't produce colored output, so we just
+# run the command again, that should be fast enough.
+#
+# Ignore codespell exit status.
+"${cmd[@]}" || true
diff --git a/gdb/contrib/expect-read1.c b/gdb/contrib/expect-read1.c
index 454ecda..bb7317b 100644
--- a/gdb/contrib/expect-read1.c
+++ b/gdb/contrib/expect-read1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/contrib/expect-read1.sh b/gdb/contrib/expect-read1.sh
index 82c638c..e8589a2 100755
--- a/gdb/contrib/expect-read1.sh
+++ b/gdb/contrib/expect-read1.sh
@@ -1,7 +1,7 @@
#! /bin/sh
# runtest wrapper to reliably reproduce racy incomplete reads in the testsuite.
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
index b299f83..d2c523f 100755
--- a/gdb/contrib/gdb-add-index.sh
+++ b/gdb/contrib/gdb-add-index.sh
@@ -2,7 +2,7 @@
# Add a .gdb_index section to a file.
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/contrib/license-check-new-files.sh b/gdb/contrib/license-check-new-files.sh
new file mode 100755
index 0000000..710afa1
--- /dev/null
+++ b/gdb/contrib/license-check-new-files.sh
@@ -0,0 +1,149 @@
+#!/usr/bin/env python3
+
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This file is part of GDB.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This program requires the python modules GitPython (git) and scancode-toolkit.
+# It builds a list of all the newly added files to the repository and scans
+# each file for a license, printing it to the terminal. If "--skip" is used,
+# it will only output non-"common" licenses, e.g., omitting "GPL-3.0-or-later".
+# This makes it a little bit easier to detect any possible new licenses.
+#
+# Example:
+# bash$ cd /path/to/binutils-gdb/gdb
+# bash$ ./contrib/license-check-new-files.sh -s gdb-15-branchpoint gdb-16-branchpoint
+# Scanning directories gdb*/...
+# gdb/contrib/common-misspellings.txt: no longer in repo?
+# gdb/contrib/spellcheck.sh: no longer in repo?
+# gdbsupport/unordered_dense.h: MIT
+
+import os
+import sys
+import argparse
+from pathlib import PurePath
+from git import Repo
+from scancode import api
+
+# A list of "common" licenses. If "--skip" is used, any file
+# with a license in this list will be omitted from the output.
+COMMON_LICENSES = ["GPL-2.0-or-later", "GPL-3.0-or-later"]
+
+# Default list of directories to scan. Default scans are limited to
+# gdb-specific git directories because much of the rest of binutils-gdb
+# is actually owned by other projects/packages.
+DEFAULT_SCAN_DIRS = "gdb*"
+
+
+# Get the commit object associated with the string commit CSTR
+# from the git repository REPO.
+#
+# Returns the object or prints an error and exits.
+def get_commit(repo, cstr):
+ try:
+ return repo.commit(cstr)
+ except:
+ print(f'unknown commit "{cstr}"')
+ sys.exit(2)
+
+
+# Uses scancode-toolkit package to scan FILE's licenses.
+# Returns the full license dict from scancode on success or
+# propagates any exceptions.
+def get_licenses_for_file(file):
+ return api.get_licenses(file)
+
+
+# Helper function to print FILE to the terminal if skipping
+# common licenses.
+def skip_print_file(skip, file):
+ if skip:
+ print(f"{file}: ", end="")
+
+
+def main(argv):
+ parser = argparse.ArgumentParser()
+ parser.add_argument("from_commit")
+ parser.add_argument("to_commit")
+ parser.add_argument(
+ "-s", "--skip", help="skip common licenses in output", action="store_true"
+ )
+ parser.add_argument(
+ "-p",
+ "--paths",
+ help=f'paths to scan (default is "{DEFAULT_SCAN_DIRS}")',
+ type=str,
+ default=DEFAULT_SCAN_DIRS,
+ )
+ args = parser.parse_args()
+
+ # Commit boundaries to search for new files
+ from_commit = args.from_commit
+ to_commit = args.to_commit
+
+ # Get the list of new files from git. Try the current directory,
+ # looping up to the root attempting to find a valid git repository.
+ path = PurePath(os.getcwd())
+ paths = list(path.parents)
+ paths.insert(0, path)
+ for dir in paths:
+ try:
+ repo = Repo(dir)
+ break
+ except:
+ pass
+
+ if dir == path.parents[-1]:
+ print(f'not a git repository (or any parent up to mount point "{dir}")')
+ sys.exit(2)
+
+ # Get from/to commits
+ fc = get_commit(repo, from_commit)
+ tc = get_commit(repo, to_commit)
+
+ # Loop over new files
+ paths = [str(dir) for dir in args.paths.split(",")]
+ print(f'Scanning directories {",".join(f"{s}/" for s in paths)}...')
+ for file in fc.diff(tc, paths=paths).iter_change_type("A"):
+ filename = file.a_path
+ if not args.skip:
+ print(f"checking licenses for {filename}... ", end="", flush=True)
+ try:
+ f = dir.joinpath(dir, filename).as_posix()
+ lic = get_licenses_for_file(f)
+ if len(lic["license_clues"]) > 1:
+ print("multiple licenses detected")
+ elif (
+ not args.skip
+ or lic["detected_license_expression_spdx"] not in COMMON_LICENSES
+ ):
+ skip_print_file(args.skip, filename)
+ print(f"{lic['detected_license_expression_spdx']}")
+ except OSError:
+ # Likely hit a file that was added to the repo and subsequently removed.
+ skip_print_file(args.skip, filename)
+ print("no longer in repo?")
+ except KeyboardInterrupt:
+ print("interrupted")
+ break
+ except Exception as e:
+ # If scanning fails, there is little we can do but print an error.
+ skip_print_file(args.skip, filename)
+ print(e)
+
+
+if __name__ == "__main__":
+ main(sys.argv)
diff --git a/gdb/contrib/setup.cfg b/gdb/contrib/setup.cfg
index dbff165..5541a01 100644
--- a/gdb/contrib/setup.cfg
+++ b/gdb/contrib/setup.cfg
@@ -4,3 +4,16 @@
skip = */ChangeLog*,*/configure,gdbsupport/Makefile.in,*.dat,*.eps,gdb/features/*.c,gdb/ada-casefold.h,gdb/copying.c,gdb/gdbarch-gen.h,gdb/gdbarch-gen.c,gdb/target-delegates-gen.c
ignore-words = gdb/contrib/codespell-ignore-words.txt
+dictionary = gdb/contrib/codespell-dictionary.txt,-
+
+# Ignore all URLs.
+uri-ignore-words-list = *
+
+# This codespell issue (
+# https://github.com/codespell-project/codespell/issues/3381 ) reports the
+# need to have support for ignoring blocks of code.
+# A suggestion there is to use ignore-multiline-regex, which does work, but
+# has a bug: using -w drops all newlines in the updated files (
+# https://github.com/codespell-project/codespell/issues/3642 ).
+# Consequently, disabled. To be enabled when the bug is fixed.
+#ignore-multiline-regex = codespell:ignore-begin.*codespell:ignore-end
diff --git a/gdb/contrib/test_pubnames_and_indexes.py b/gdb/contrib/test_pubnames_and_indexes.py
index a3f5c92..7a3dec6 100644
--- a/gdb/contrib/test_pubnames_and_indexes.py
+++ b/gdb/contrib/test_pubnames_and_indexes.py
@@ -1,6 +1,6 @@
#! /usr/bin/env python3
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/contrib/words.sh b/gdb/contrib/words.sh
index 90b1bd9..a4bb2c7 100755
--- a/gdb/contrib/words.sh
+++ b/gdb/contrib/words.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2019-2024 Free Software Foundation, Inc.
+# Copyright (C) 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/copying.c b/gdb/copying.c
index af465e5..a198030 100644
--- a/gdb/copying.c
+++ b/gdb/copying.c
@@ -639,9 +639,7 @@ show_warranty_command (const char *ignore, int from_tty)
gdb_printf ("\n");
}
-void _initialize_copying ();
-void
-_initialize_copying ()
+INIT_GDB_FILE (copying)
{
add_cmd ("copying", no_set_class, show_copying_command,
_("Conditions for redistributing copies of GDB."),
diff --git a/gdb/copyright.py b/gdb/copyright.py
index 5ec9944..425b7d2 100755
--- a/gdb/copyright.py
+++ b/gdb/copyright.py
@@ -30,13 +30,16 @@
#
# This removes the bulk of the changes which are most likely to be correct.
+# pyright: strict
+
import argparse
import locale
import os
import os.path
+import pathlib
import subprocess
import sys
-from typing import List, Optional
+from typing import Iterable
def get_update_list():
@@ -66,24 +69,20 @@ def get_update_list():
.split("\0")
)
- def include_file(filename):
- (dirname, basename) = os.path.split(filename)
- dirbasename = os.path.basename(dirname)
- return not (
- basename in EXCLUDE_ALL_LIST
- or dirbasename in EXCLUDE_ALL_LIST
- or dirname in EXCLUDE_LIST
- or dirname in NOT_FSF_LIST
- or dirname in BY_HAND
- or filename in EXCLUDE_LIST
- or filename in NOT_FSF_LIST
- or filename in BY_HAND
- )
+ full_exclude_list = EXCLUDE_LIST + BY_HAND
+
+ def include_file(filename: str):
+ path = pathlib.Path(filename)
+ for pattern in full_exclude_list:
+ if path.full_match(pattern):
+ return False
+
+ return True
return filter(include_file, result)
-def update_files(update_list):
+def update_files(update_list: Iterable[str]):
"""Update the copyright header of the files in the given list.
We use gnulib's update-copyright script for that.
@@ -128,7 +127,7 @@ def update_files(update_list):
print("*** " + line)
-def may_have_copyright_notice(filename):
+def may_have_copyright_notice(filename: str):
"""Check that the given file does not seem to have a copyright notice.
The filename is relative to the root directory.
@@ -166,7 +165,7 @@ def get_parser() -> argparse.ArgumentParser:
return parser
-def main(argv: List[str]) -> Optional[int]:
+def main(argv: list[str]) -> int | None:
"""The main subprogram."""
parser = get_parser()
_ = parser.parse_args(argv)
@@ -192,11 +191,20 @@ def main(argv: List[str]) -> Optional[int]:
if BY_HAND:
print()
print(
- "\033[31mREMINDER: The following files must be updated by hand." "\033[0m"
+ "\033[31mREMINDER: The following files must be updated by hand:" "\033[0m"
)
for filename in BY_HAND:
print(" ", filename)
+ print()
+ print(
+ "\033[31mREMINDER: The following files contain code to print a copyright "
+ "notice at runtime, they must be updated by hand:\033[0m"
+ )
+ print(" gdb/top.c")
+ print(" gdbserver/gdbreplay.cc")
+ print(" gdbserver/server.cc")
+
############################################################################
#
@@ -210,8 +218,14 @@ def main(argv: List[str]) -> Optional[int]:
# generated, non-FSF, or otherwise special (e.g. license text,
# or test cases which must be sensitive to line numbering).
#
-# Filenames are relative to the root directory.
+# Entries are treated as glob patterns.
EXCLUDE_LIST = (
+ "**/aclocal.m4",
+ "**/configure",
+ "**/COPYING.LIB",
+ "**/COPYING",
+ "**/fdl.texi",
+ "**/gpl.texi",
"gdb/copying.c",
"gdb/nat/glibc_thread_db.h",
"gdb/CONTRIBUTE",
@@ -219,45 +233,11 @@ EXCLUDE_LIST = (
"gdbsupport/unordered_dense.h",
"gnulib/doc/gendocs_template",
"gnulib/doc/gendocs_template_min",
- "gnulib/import",
+ "gnulib/import/**",
"gnulib/config.in",
"gnulib/Makefile.in",
-)
-
-# Files which should not be modified, either because they are
-# generated, non-FSF, or otherwise special (e.g. license text,
-# or test cases which must be sensitive to line numbering).
-#
-# Matches any file or directory name anywhere. Use with caution.
-# This is mostly for files that can be found in multiple directories.
-# Eg: We want all files named COPYING to be left untouched.
-
-EXCLUDE_ALL_LIST = (
- "COPYING",
- "COPYING.LIB",
- "configure",
- "fdl.texi",
- "gpl.texi",
- "aclocal.m4",
-)
-
-# The list of files to update by hand.
-BY_HAND = (
- # Nothing at the moment :-).
-)
-
-# Files containing multiple copyright headers. This script is only
-# fixing the first one it finds, so we need to finish the update
-# by hand.
-MULTIPLE_COPYRIGHT_HEADERS = (
- "gdb/doc/gdb.texinfo",
- "gdb/doc/refcard.tex",
- "gdb/syscalls/update-netbsd.sh",
-)
-
-# The list of file which have a copyright, but not held by the FSF.
-# Filenames are relative to the root directory.
-NOT_FSF_LIST = (
+ "sim/Makefile.in",
+ # The files below have a copyright, but not held by the FSF.
"gdb/exc_request.defs",
"gdb/gdbtk",
"gdb/testsuite/gdb.gdbtk/",
@@ -294,9 +274,27 @@ NOT_FSF_LIST = (
"sim/mips/sim-main.c",
"sim/moxie/moxie-gdb.dts",
# Not a single file in sim/ppc/ appears to be copyright FSF :-(.
- "sim/ppc",
+ "sim/ppc/**",
"sim/testsuite/mips/mips32-dsp2.s",
)
+# The list of files to update by hand.
+#
+# Entries are treated as glob patterns.
+BY_HAND: tuple[str, ...] = (
+ # Nothing at the moment :-).
+)
+
+# Files containing multiple copyright headers. This script is only
+# fixing the first one it finds, so we need to finish the update
+# by hand.
+#
+# Entries are treated as glob patterns.
+MULTIPLE_COPYRIGHT_HEADERS = (
+ "gdb/doc/gdb.texinfo",
+ "gdb/doc/refcard.tex",
+ "gdb/syscalls/update-netbsd.sh",
+)
+
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 7fe5e83..666ff55 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -1,6 +1,6 @@
/* Core dump and executable file functions above target vector, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -66,13 +66,14 @@ reopen_exec_file (void)
void
validate_files (void)
{
- if (current_program_space->exec_bfd () && current_program_space->core_bfd ())
+ bfd *ebfd = current_program_space->exec_bfd ();
+ bfd *cbfd = get_inferior_core_bfd (current_inferior ());
+
+ if (ebfd != nullptr && cbfd != nullptr)
{
- if (!core_file_matches_executable_p (current_program_space->core_bfd (),
- current_program_space->exec_bfd ()))
+ if (!core_file_matches_executable_p (cbfd, ebfd))
warning (_("core file may not match specified executable file."));
- else if (gdb_bfd_get_mtime (current_program_space->exec_bfd ())
- > gdb_bfd_get_mtime (current_program_space->core_bfd ()))
+ else if (gdb_bfd_get_mtime (ebfd) > gdb_bfd_get_mtime (cbfd))
warning (_("exec file is newer than core file."));
}
}
@@ -391,9 +392,7 @@ set_gnutarget (const char *newtarget)
set_gnutarget_command (NULL, 0, NULL);
}
-void _initialize_core ();
-void
-_initialize_core ()
+INIT_GDB_FILE (core)
{
cmd_list_element *core_file_cmd
= add_cmd ("core-file", class_files, core_file_command, _("\
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 567ecd5..d48154d 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -1,6 +1,6 @@
/* Core dump and executable file functions below target vector, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -37,7 +37,6 @@
#include "exec.h"
#include "readline/tilde.h"
#include "solib.h"
-#include "solist.h"
#include "filenames.h"
#include "progspace.h"
#include "objfiles.h"
@@ -54,6 +53,7 @@
#include "xml-tdesc.h"
#include "memtag.h"
#include "cli/cli-style.h"
+#include "observable.h"
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
@@ -188,7 +188,8 @@ Specify the filename of the core file.")
class core_target final : public process_stratum_target
{
public:
- core_target ();
+ /* CBFD is the open core file BFD object. */
+ explicit core_target (gdb_bfd_ref_ptr cbfd);
const target_info &info () const override
{ return core_target_info; }
@@ -280,6 +281,9 @@ public:
return m_expected_exec_filename;
}
+ bfd *core_bfd () const
+ { return m_core_bfd.get (); }
+
private: /* per-core data */
/* Get rid of the core inferior. */
@@ -319,13 +323,46 @@ private: /* per-core data */
when processing the memory-mapped file information. This will only
be set if we find a mapped with a suitable build-id. */
std::string m_expected_exec_filename;
+
+ /* The core file BFD object. */
+ gdb_bfd_ref_ptr m_core_bfd;
};
-core_target::core_target ()
+/* If INF is connected to a core target, then return a pointer to the
+ core_target. If not connected to a core target, return NULL. */
+
+static core_target *
+get_core_target (inferior *inf)
+{
+ target_ops *proc_target = inf->process_target ();
+ return dynamic_cast<core_target *> (proc_target);
+}
+
+/* See gdbcore.h. */
+
+bfd *
+get_inferior_core_bfd (inferior *inf)
+{
+ gdb_assert (inf != nullptr);
+
+ core_target *targ = get_core_target (inf);
+ if (targ == nullptr)
+ return nullptr;
+
+ bfd *cbfd = targ->core_bfd ();
+ gdb_assert (cbfd != nullptr);
+
+ return cbfd;
+}
+
+/* See class declaration above. */
+
+core_target::core_target (gdb_bfd_ref_ptr cbfd_ref)
+ : m_core_bfd (std::move (cbfd_ref))
{
/* Find a first arch based on the BFD. We need the initial gdbarch so
we can setup the hooks to find a target description. */
- m_core_gdbarch = gdbarch_from_bfd (current_program_space->core_bfd ());
+ m_core_gdbarch = gdbarch_from_bfd (this->core_bfd ());
/* If the arch is able to read a target description from the core, it
could yield a more specific gdbarch. */
@@ -334,7 +371,7 @@ core_target::core_target ()
if (tdesc != nullptr)
{
struct gdbarch_info info;
- info.abfd = current_program_space->core_bfd ();
+ info.abfd = this->core_bfd ();
info.target_desc = tdesc;
m_core_gdbarch = gdbarch_find_by_info (info);
}
@@ -342,10 +379,10 @@ core_target::core_target ()
if (!m_core_gdbarch
|| !gdbarch_iterate_over_regset_sections_p (m_core_gdbarch))
error (_("\"%s\": Core file format not supported"),
- bfd_get_filename (current_program_space->core_bfd ()));
+ bfd_get_filename (this->core_bfd ()));
/* Find the data section */
- m_core_section_table = build_section_table (current_program_space->core_bfd ());
+ m_core_section_table = build_section_table (this->core_bfd ());
build_file_mappings ();
}
@@ -366,111 +403,26 @@ core_target::core_target ()
void
core_target::build_file_mappings ()
{
- /* Type holding information about a single file mapped into the inferior
- at the point when the core file was created. Associates a build-id
- with the list of regions the file is mapped into. */
- struct mapped_file
- {
- /* Type for a region of a file that was mapped into the inferior when
- the core file was generated. */
- struct region
- {
- /* Constructor. See member variables for argument descriptions. */
- region (CORE_ADDR start_, CORE_ADDR end_, CORE_ADDR file_ofs_)
- : start (start_),
- end (end_),
- file_ofs (file_ofs_)
- { /* Nothing. */ }
-
- /* The inferior address for the start of the mapped region. */
- CORE_ADDR start;
-
- /* The inferior address immediately after the mapped region. */
- CORE_ADDR end;
-
- /* The offset within the mapped file for this content. */
- CORE_ADDR file_ofs;
- };
-
- /* If not nullptr, then this is the build-id associated with this
- file. */
- const bfd_build_id *build_id = nullptr;
-
- /* If true then we have seen multiple different build-ids associated
- with the same filename. The build_id field will have been set back
- to nullptr, and we should not set build_id in future. */
- bool ignore_build_id_p = false;
-
- /* All the mapped regions of this file. */
- std::vector<region> regions;
- };
-
gdb::unordered_map<std::string, struct bfd *> bfd_map;
gdb::unordered_set<std::string> unavailable_paths;
/* All files mapped into the core file. The key is the filename. */
- gdb::unordered_map<std::string, mapped_file> mapped_files;
-
- /* See linux_read_core_file_mappings() in linux-tdep.c for an example
- read_core_file_mappings method. */
- gdbarch_read_core_file_mappings (m_core_gdbarch,
- current_program_space->core_bfd (),
+ std::vector<core_mapped_file> mapped_files
+ = gdb_read_core_file_mappings (m_core_gdbarch, this->core_bfd ());
- /* After determining the number of mappings, read_core_file_mappings
- will invoke this lambda. */
- [&] (ULONGEST)
- {
- },
-
- /* read_core_file_mappings will invoke this lambda for each mapping
- that it finds. */
- [&] (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs,
- const char *filename, const bfd_build_id *build_id)
- {
- /* Architecture-specific read_core_mapping methods are expected to
- weed out non-file-backed mappings. */
- gdb_assert (filename != nullptr);
-
- /* Add this mapped region to the data for FILENAME. */
- mapped_file &file_data = mapped_files[filename];
- file_data.regions.emplace_back (start, end, file_ofs);
- if (build_id != nullptr && !file_data.ignore_build_id_p)
- {
- if (file_data.build_id == nullptr)
- file_data.build_id = build_id;
- else if (!build_id_equal (build_id, file_data.build_id))
- {
- warning (_("Multiple build-ids found for %ps"),
- styled_string (file_name_style.style (), filename));
- file_data.build_id = nullptr;
- file_data.ignore_build_id_p = true;
- }
- }
- });
-
- /* Get the build-id of the core file. */
- const bfd_build_id *core_build_id
- = build_id_bfd_get (current_program_space->core_bfd ());
-
- for (const auto &iter : mapped_files)
+ for (const core_mapped_file &file_data : mapped_files)
{
- const std::string &filename = iter.first;
- const mapped_file &file_data = iter.second;
-
- /* If this mapped file has the same build-id as was discovered for
- the core-file itself, then we assume this is the main
- executable. Record the filename as we can use this later. */
- if (file_data.build_id != nullptr
- && m_expected_exec_filename.empty ()
- && build_id_equal (file_data.build_id, core_build_id))
- m_expected_exec_filename = filename;
+ /* If this mapped file is marked as the main executable then record
+ the filename as we can use this later. */
+ if (file_data.is_main_exec && m_expected_exec_filename.empty ())
+ m_expected_exec_filename = file_data.filename;
/* Use exec_file_find() to do sysroot expansion. It'll
also strip the potential sysroot "target:" prefix. If
there is no sysroot, an equivalent (possibly more
canonical) pathname will be provided. */
gdb::unique_xmalloc_ptr<char> expanded_fname
- = exec_file_find (filename.c_str (), nullptr);
+ = exec_file_find (file_data.filename.c_str (), nullptr);
bool build_id_mismatch = false;
if (expanded_fname != nullptr && file_data.build_id != nullptr)
@@ -512,7 +464,7 @@ core_target::build_file_mappings ()
{
abfd = find_objfile_by_build_id (current_program_space,
file_data.build_id,
- filename.c_str ());
+ file_data.filename.c_str ());
if (abfd != nullptr)
{
@@ -530,7 +482,7 @@ core_target::build_file_mappings ()
}
std::vector<mem_range> ranges;
- for (const mapped_file::region &region : file_data.regions)
+ for (const core_mapped_file::region &region : file_data.regions)
ranges.emplace_back (region.start, region.end - region.start);
if (expanded_fname == nullptr
@@ -540,43 +492,73 @@ core_target::build_file_mappings ()
/* If ABFD was opened, but the wrong format, close it now. */
abfd = nullptr;
+ /* When true, this indicates that the mapped contents of this
+ file are available within the core file. When false, some of
+ the mapped contents are not available. If the contents are
+ entirely available within the core file, then we don't need to
+ warn the user if GDB cannot find the file. */
+ bool content_is_in_core_file_p = true;
+
/* Record all regions for this file as unavailable. */
- for (const mapped_file::region &region : file_data.regions)
- m_core_unavailable_mappings.emplace_back (region.start,
- region.end
- - region.start);
+ for (const core_mapped_file::region &region : file_data.regions)
+ {
+ /* Check to see if the region is available within the core
+ file. */
+ bool found_region_in_core_file = false;
+ for (const target_section &ts : m_core_section_table)
+ {
+ if (ts.addr <= region.start && ts.endaddr >= region.end
+ && (ts.the_bfd_section->flags & SEC_HAS_CONTENTS) != 0)
+ {
+ found_region_in_core_file = true;
+ break;
+ }
+ }
+
+ /* This region is not available within the core file.
+ Without the file available to read from it is not possible
+ for GDB to read this mapping within the inferior. Warn
+ the user about this case. */
+ if (!found_region_in_core_file)
+ content_is_in_core_file_p = false;
+
+ /* Record the unavailable region. */
+ m_core_unavailable_mappings.emplace_back (region.start,
+ region.end
+ - region.start);
+ }
/* And give the user an appropriate warning. */
if (build_id_mismatch)
{
if (expanded_fname == nullptr
- || filename == expanded_fname.get ())
+ || file_data.filename == expanded_fname.get ())
warning (_("File %ps doesn't match build-id from core-file "
"during file-backed mapping processing"),
styled_string (file_name_style.style (),
- filename.c_str ()));
+ file_data.filename.c_str ()));
else
warning (_("File %ps which was expanded to %ps, doesn't match "
"build-id from core-file during file-backed "
"mapping processing"),
styled_string (file_name_style.style (),
- filename.c_str ()),
+ file_data.filename.c_str ()),
styled_string (file_name_style.style (),
expanded_fname.get ()));
}
- else
+ else if (!content_is_in_core_file_p)
{
if (expanded_fname == nullptr
- || filename == expanded_fname.get ())
+ || file_data.filename == expanded_fname.get ())
warning (_("Can't open file %ps during file-backed mapping "
"note processing"),
styled_string (file_name_style.style (),
- filename.c_str ()));
+ file_data.filename.c_str ()));
else
warning (_("Can't open file %ps which was expanded to %ps "
"during file-backed mapping note processing"),
styled_string (file_name_style.style (),
- filename.c_str ()),
+ file_data.filename.c_str ()),
styled_string (file_name_style.style (),
expanded_fname.get ()));
}
@@ -586,11 +568,10 @@ core_target::build_file_mappings ()
/* Ensure that the bfd will be closed when core_bfd is closed.
This can be checked before/after a core file detach via "maint
info bfds". */
- gdb_bfd_record_inclusion (current_program_space->core_bfd (),
- abfd.get ());
+ gdb_bfd_record_inclusion (this->core_bfd (), abfd.get ());
/* Create sections for each mapped region. */
- for (const mapped_file::region &region : file_data.regions)
+ for (const core_mapped_file::region &region : file_data.regions)
{
/* Make new BFD section. All sections have the same name,
which is permitted by bfd_make_section_anyway(). */
@@ -626,7 +607,7 @@ core_target::build_file_mappings ()
soname = gdb_bfd_read_elf_soname (actual_filename);
}
- m_mapped_file_info.add (soname.get (), filename.c_str (),
+ m_mapped_file_info.add (soname.get (), file_data.filename.c_str (),
actual_filename, std::move (ranges),
file_data.build_id);
}
@@ -641,7 +622,7 @@ core_target::build_file_mappings ()
void
core_target::clear_core ()
{
- if (current_program_space->core_bfd () != nullptr)
+ if (this->core_bfd () != nullptr)
{
switch_to_no_thread (); /* Avoid confusion from thread
stuff. */
@@ -651,7 +632,10 @@ core_target::clear_core ()
comments in clear_solib in solib.c. */
clear_solib (current_program_space);
- current_program_space->cbfd.reset (nullptr);
+ m_core_bfd.reset (nullptr);
+
+ /* Notify that the core file has changed. */
+ gdb::observers::core_file_changed.notify (current_inferior ());
}
}
@@ -712,10 +696,10 @@ core_file_command (const char *filename, int from_tty)
if (filename == NULL)
{
- if (current_program_space->core_bfd () != nullptr)
+ if (get_core_target (current_inferior ()) != nullptr)
{
target_detach (current_inferior (), from_tty);
- gdb_assert (current_program_space->core_bfd () == nullptr);
+ gdb_assert (get_core_target (current_inferior ()) == nullptr);
}
else
maybe_say_no_core_file_now (from_tty);
@@ -764,10 +748,13 @@ core_file_command (const char *filename, int from_tty)
.reg/1, .reg2/1, .reg/2, .reg2/2
After calling this function the rest of the core file handling code can
- treat this core file just like any other core file. */
+ treat this core file just like any other core file.
+
+ CBFD is the core file being loaded, and INF is the inferior through
+ which the core file will be examined. */
static void
-rename_vmcore_idle_reg_sections (bfd *abfd, inferior *inf)
+rename_vmcore_idle_reg_sections (bfd *cbfd, inferior *inf)
{
/* Map from the bfd section to its lwpid (the /NN number). */
std::vector<std::pair<asection *, int>> sections_and_lwpids;
@@ -782,7 +769,7 @@ rename_vmcore_idle_reg_sections (bfd *abfd, inferior *inf)
/* Look for all the .reg sections. Record the section object and the
lwpid which is extracted from the section name. Spot if any have an
lwpid of zero. */
- for (asection *sect : gdb_bfd_sections (current_program_space->core_bfd ()))
+ for (asection *sect : gdb_bfd_sections (cbfd))
{
if (startswith (bfd_section_name (sect), ".reg/"))
{
@@ -815,7 +802,7 @@ rename_vmcore_idle_reg_sections (bfd *abfd, inferior *inf)
std::string replacement_lwpid_str;
auto iter = sections_and_lwpids.begin ();
int replacement_lwpid = 0;
- for (asection *sect : gdb_bfd_sections (current_program_space->core_bfd ()))
+ for (asection *sect : gdb_bfd_sections (cbfd))
{
if (iter != sections_and_lwpids.end () && sect == iter->first)
{
@@ -853,7 +840,7 @@ rename_vmcore_idle_reg_sections (bfd *abfd, inferior *inf)
static_cast<int> (len - 2),
name, replacement_lwpid);
char *name_buf
- = static_cast<char *> (bfd_alloc (abfd, name_str.size () + 1));
+ = static_cast<char *> (bfd_alloc (cbfd, name_str.size () + 1));
if (name_buf == nullptr)
error (_("failed to allocate space for section name '%s'"),
name_str.c_str ());
@@ -927,7 +914,7 @@ locate_exec_from_corefile_exec_context (bfd *cbfd,
execbfd = open_and_check_build_id (exec_name);
else
{
- std::string p = (ldirname (bfd_get_filename (cbfd))
+ std::string p = (gdb_ldirname (bfd_get_filename (cbfd))
+ '/'
+ exec_name);
execbfd = open_and_check_build_id (p.c_str ());
@@ -941,7 +928,7 @@ locate_exec_from_corefile_exec_context (bfd *cbfd,
if (execbfd == nullptr)
{
const char *base_name = lbasename (exec_name);
- std::string p = (ldirname (bfd_get_filename (cbfd))
+ std::string p = (gdb_ldirname (bfd_get_filename (cbfd))
+ '/'
+ base_name);
execbfd = open_and_check_build_id (p.c_str ());
@@ -1023,16 +1010,17 @@ core_target_open (const char *arg, int from_tty)
target_preopen (from_tty);
+ /* The target_preopen call will remove any existing process stratum
+ target, which includes any existing core_target. */
+ gdb_assert (current_inferior ()->process_target () == nullptr);
+
+ /* Which will clear up any existing core file BFD. */
+ gdb_assert (get_inferior_core_bfd (current_inferior ()) == nullptr);
+
std::string filename = extract_single_filename_arg (arg);
if (filename.empty ())
- {
- if (current_program_space->core_bfd ())
- error (_("No core file specified. (Use `detach' "
- "to stop debugging a core file.)"));
- else
- error (_("No core file specified."));
- }
+ error (_("No core file specified."));
if (!IS_ABSOLUTE_PATH (filename.c_str ()))
filename = gdb_abspath (filename);
@@ -1062,9 +1050,7 @@ core_target_open (const char *arg, int from_tty)
filename.c_str (), bfd_errmsg (bfd_get_error ()));
}
- current_program_space->cbfd = std::move (temp_bfd);
-
- core_target *target = new core_target ();
+ core_target *target = new core_target (std::move (temp_bfd));
/* Own the target until it is successfully pushed. */
target_ops_up target_holder (target);
@@ -1086,7 +1072,7 @@ core_target_open (const char *arg, int from_tty)
/* Find (or fake) the pid for the process in this core file, and
initialise the current inferior with that pid. */
bool fake_pid_p = false;
- int pid = bfd_core_file_pid (current_program_space->core_bfd ());
+ int pid = bfd_core_file_pid (target->core_bfd ());
if (pid == 0)
{
fake_pid_p = true;
@@ -1099,14 +1085,14 @@ core_target_open (const char *arg, int from_tty)
inf->fake_pid_p = fake_pid_p;
/* Rename any .reg/0 sections, giving them each a fake lwpid. */
- rename_vmcore_idle_reg_sections (current_program_space->core_bfd (), inf);
+ rename_vmcore_idle_reg_sections (target->core_bfd (), inf);
/* Build up thread list from BFD sections, and possibly set the
current thread to the .reg/NN section matching the .reg
section. */
asection *reg_sect
- = bfd_get_section_by_name (current_program_space->core_bfd (), ".reg");
- for (asection *sect : gdb_bfd_sections (current_program_space->core_bfd ()))
+ = bfd_get_section_by_name (target->core_bfd (), ".reg");
+ for (asection *sect : gdb_bfd_sections (target->core_bfd ()))
add_to_thread_list (sect, reg_sect, inf);
if (inferior_ptid == null_ptid)
@@ -1136,22 +1122,22 @@ core_target_open (const char *arg, int from_tty)
the core file. */
core_file_exec_context ctx
= gdbarch_core_parse_exec_context (target->core_gdbarch (),
- current_program_space->core_bfd ());
+ target->core_bfd ());
/* If we don't have an executable loaded then see if we can locate one
based on the core file. */
if (current_program_space->exec_bfd () == nullptr)
- locate_exec_from_corefile_build_id (current_program_space->core_bfd (),
- target, ctx, from_tty);
+ locate_exec_from_corefile_build_id (target->core_bfd (), target, ctx,
+ from_tty);
/* If we have no exec file, try to set the architecture from the
core file. We don't do this unconditionally since an exec file
typically contains more information that helps us determine the
architecture than a core file. */
if (current_program_space->exec_bfd () == nullptr)
- set_gdbarch_from_file (current_program_space->core_bfd ());
+ set_gdbarch_from_file (target->core_bfd ());
- post_create_inferior (from_tty);
+ post_create_inferior (from_tty, true);
/* Now go through the target stack looking for threads since there
may be a thread_stratum target loaded on top of target core by
@@ -1189,7 +1175,7 @@ core_target_open (const char *arg, int from_tty)
else
{
const char *failing_command
- = bfd_core_file_failing_command (current_program_space->core_bfd ());
+ = bfd_core_file_failing_command (target->core_bfd ());
if (failing_command != nullptr)
gdb_printf (_("Core was generated by `%s'.\n"),
failing_command);
@@ -1198,7 +1184,7 @@ core_target_open (const char *arg, int from_tty)
/* Clearing any previous state of convenience variables. */
clear_exit_convenience_vars ();
- siggy = bfd_core_file_failing_signal (current_program_space->core_bfd ());
+ siggy = bfd_core_file_failing_signal (target->core_bfd ());
if (siggy > 0)
{
gdbarch *core_gdbarch = target->core_gdbarch ();
@@ -1248,6 +1234,9 @@ core_target_open (const char *arg, int from_tty)
exception_print (gdb_stderr, except);
}
}
+
+ /* Notify that the core file has changed. */
+ gdb::observers::core_file_changed.notify (current_inferior ());
}
void
@@ -1301,8 +1290,7 @@ core_target::get_core_register_section (struct regcache *regcache,
thread_section_name section_name (name, regcache->ptid ());
- section = bfd_get_section_by_name (current_program_space->core_bfd (),
- section_name.c_str ());
+ section = bfd_get_section_by_name (this->core_bfd (), section_name.c_str ());
if (! section)
{
if (required)
@@ -1325,8 +1313,8 @@ core_target::get_core_register_section (struct regcache *regcache,
}
gdb::byte_vector contents (size);
- if (!bfd_get_section_contents (current_program_space->core_bfd (), section,
- contents.data (), (file_ptr) 0, size))
+ if (!bfd_get_section_contents (this->core_bfd (), section, contents.data (),
+ (file_ptr) 0, size))
{
warning (_("Couldn't read %s registers from `%s' section in core file."),
human_name, section_name.c_str ());
@@ -1409,7 +1397,7 @@ core_target::fetch_registers (struct regcache *regcache, int regno)
void
core_target::files_info ()
{
- print_section_info (&m_core_section_table, current_program_space->core_bfd ());
+ print_section_info (&m_core_section_table, this->core_bfd ());
}
@@ -1529,8 +1517,7 @@ core_target::xfer_partial (enum target_object object, const char *annex,
struct bfd_section *section;
bfd_size_type size;
- section = bfd_get_section_by_name (current_program_space->core_bfd (),
- ".auxv");
+ section = bfd_get_section_by_name (this->core_bfd (), ".auxv");
if (section == NULL)
return TARGET_XFER_E_IO;
@@ -1543,9 +1530,8 @@ core_target::xfer_partial (enum target_object object, const char *annex,
if (size == 0)
return TARGET_XFER_EOF;
- if (!bfd_get_section_contents (current_program_space->core_bfd (),
- section, readbuf, (file_ptr) offset,
- size))
+ if (!bfd_get_section_contents (this->core_bfd (), section, readbuf,
+ (file_ptr) offset, size))
{
warning (_("Couldn't read NT_AUXV note in core file."));
return TARGET_XFER_E_IO;
@@ -1566,8 +1552,7 @@ core_target::xfer_partial (enum target_object object, const char *annex,
struct bfd_section *section;
bfd_size_type size;
- section = bfd_get_section_by_name (current_program_space->core_bfd (),
- ".wcookie");
+ section = bfd_get_section_by_name (this->core_bfd (), ".wcookie");
if (section == NULL)
return TARGET_XFER_E_IO;
@@ -1580,9 +1565,8 @@ core_target::xfer_partial (enum target_object object, const char *annex,
if (size == 0)
return TARGET_XFER_EOF;
- if (!bfd_get_section_contents (current_program_space->core_bfd (),
- section, readbuf, (file_ptr) offset,
- size))
+ if (!bfd_get_section_contents (this->core_bfd (), section, readbuf,
+ (file_ptr) offset, size))
{
warning (_("Couldn't read StackGhost cookie in core file."));
return TARGET_XFER_E_IO;
@@ -1602,9 +1586,8 @@ core_target::xfer_partial (enum target_object object, const char *annex,
return TARGET_XFER_E_IO;
else
{
- *xfered_len = gdbarch_core_xfer_shared_libraries (m_core_gdbarch,
- readbuf,
- offset, len);
+ *xfered_len = gdbarch_core_xfer_shared_libraries
+ (m_core_gdbarch, *this->core_bfd (), readbuf, offset, len);
if (*xfered_len == 0)
return TARGET_XFER_EOF;
@@ -1623,9 +1606,8 @@ core_target::xfer_partial (enum target_object object, const char *annex,
else
{
*xfered_len
- = gdbarch_core_xfer_shared_libraries_aix (m_core_gdbarch,
- readbuf, offset,
- len);
+ = gdbarch_core_xfer_shared_libraries_aix
+ (m_core_gdbarch, *this->core_bfd (), readbuf, offset, len);
if (*xfered_len == 0)
return TARGET_XFER_EOF;
@@ -1641,8 +1623,10 @@ core_target::xfer_partial (enum target_object object, const char *annex,
if (m_core_gdbarch != nullptr
&& gdbarch_core_xfer_siginfo_p (m_core_gdbarch))
{
- LONGEST l = gdbarch_core_xfer_siginfo (m_core_gdbarch, readbuf,
- offset, len);
+ struct bfd *cbfd = this->core_bfd ();
+ gdb_assert (cbfd != nullptr);
+ LONGEST l = gdbarch_core_xfer_siginfo (m_core_gdbarch, *cbfd,
+ readbuf, offset, len);
if (l >= 0)
{
@@ -1688,21 +1672,21 @@ core_target::read_description ()
/* First check whether the target wants us to use the corefile target
description notes. */
if (gdbarch_use_target_description_from_corefile_notes
- (m_core_gdbarch, current_program_space->core_bfd ()))
+ (m_core_gdbarch, m_core_bfd.get ()))
{
/* If the core file contains a target description note then go ahead and
use that. */
bfd_size_type tdesc_note_size = 0;
struct bfd_section *tdesc_note_section
- = bfd_get_section_by_name (current_program_space->core_bfd (), ".gdb-tdesc");
+ = bfd_get_section_by_name (m_core_bfd.get (), ".gdb-tdesc");
if (tdesc_note_section != nullptr)
tdesc_note_size = bfd_section_size (tdesc_note_section);
if (tdesc_note_size > 0)
{
gdb::char_vector contents (tdesc_note_size + 1);
- if (bfd_get_section_contents (current_program_space->core_bfd (),
- tdesc_note_section, contents.data (),
- (file_ptr) 0, tdesc_note_size))
+ if (bfd_get_section_contents (m_core_bfd.get (), tdesc_note_section,
+ contents.data (), (file_ptr) 0,
+ tdesc_note_size))
{
/* Ensure we have a null terminator. */
contents[tdesc_note_size] = '\0';
@@ -1724,8 +1708,8 @@ core_target::read_description ()
{
const struct target_desc *result;
- result = gdbarch_core_read_description
- (m_core_gdbarch, this, current_program_space->core_bfd ());
+ result = gdbarch_core_read_description (m_core_gdbarch, this,
+ m_core_bfd.get ());
if (result != nullptr)
return result;
}
@@ -1768,26 +1752,30 @@ core_target::thread_name (struct thread_info *thr)
{
if (m_core_gdbarch != nullptr
&& gdbarch_core_thread_name_p (m_core_gdbarch))
- return gdbarch_core_thread_name (m_core_gdbarch, thr);
+ {
+ bfd *cbfd = this->core_bfd ();
+ gdb_assert (cbfd != nullptr);
+ return gdbarch_core_thread_name (m_core_gdbarch, *cbfd, thr);
+ }
return NULL;
}
bool
core_target::has_memory ()
{
- return current_program_space->core_bfd () != nullptr;
+ return this->core_bfd () != nullptr;
}
bool
core_target::has_stack ()
{
- return current_program_space->core_bfd () != nullptr;
+ return this->core_bfd () != nullptr;
}
bool
core_target::has_registers ()
{
- return current_program_space->core_bfd () != nullptr;
+ return this->core_bfd () != nullptr;
}
/* Implement the to_info_proc method. */
@@ -1800,7 +1788,7 @@ core_target::info_proc (const char *args, enum info_proc_what request)
/* Since this is the core file target, call the 'core_info_proc'
method on gdbarch, not 'info_proc'. */
if (gdbarch_core_info_proc_p (gdbarch))
- gdbarch_core_info_proc (gdbarch, args, request);
+ gdbarch_core_info_proc (gdbarch, this->core_bfd (), args, request);
return true;
}
@@ -1813,8 +1801,7 @@ core_target::supports_memory_tagging ()
/* Look for memory tag sections. If they exist, that means this core file
supports memory tagging. */
- return (bfd_get_section_by_name (current_program_space->core_bfd (), "memtag")
- != nullptr);
+ return bfd_get_section_by_name (this->core_bfd (), "memtag") != nullptr;
}
/* Implementation of the "fetch_memtags" target_ops method. */
@@ -1833,8 +1820,8 @@ core_target::fetch_memtags (CORE_ADDR address, size_t len,
memtag_section_info info;
info.memtag_section = nullptr;
- while (get_next_core_memtag_section (current_program_space->core_bfd (),
- info.memtag_section, address, info))
+ while (get_next_core_memtag_section (this->core_bfd (), info.memtag_section,
+ address, info))
{
size_t adjusted_length
= (address + len < info.end_address) ? len : (info.end_address - address);
@@ -1875,7 +1862,9 @@ core_target::fetch_x86_xsave_layout ()
gdbarch_core_read_x86_xsave_layout_p (m_core_gdbarch))
{
x86_xsave_layout layout;
- if (!gdbarch_core_read_x86_xsave_layout (m_core_gdbarch, layout))
+ bfd *cbfd = this->core_bfd ();
+ gdb_assert (cbfd != nullptr);
+ if (!gdbarch_core_read_x86_xsave_layout (m_core_gdbarch, *cbfd, layout))
return {};
return layout;
@@ -1884,16 +1873,6 @@ core_target::fetch_x86_xsave_layout ()
return {};
}
-/* Get a pointer to the current core target. If not connected to a
- core target, return NULL. */
-
-static core_target *
-get_current_core_target ()
-{
- target_ops *proc_target = current_inferior ()->process_target ();
- return dynamic_cast<core_target *> (proc_target);
-}
-
/* Display file backed mappings from core file. */
void
@@ -1947,7 +1926,7 @@ core_target::info_proc_mappings (struct gdbarch *gdbarch)
static void
maintenance_print_core_file_backed_mappings (const char *args, int from_tty)
{
- core_target *targ = get_current_core_target ();
+ core_target *targ = get_core_target (current_inferior ());
if (targ != nullptr)
targ->info_proc_mappings (targ->core_gdbarch ());
}
@@ -2117,20 +2096,117 @@ mapped_file_info::lookup (const char *filename,
/* See gdbcore.h. */
+std::vector<core_mapped_file>
+gdb_read_core_file_mappings (struct gdbarch *gdbarch, struct bfd *cbfd)
+{
+ std::vector<core_mapped_file> results;
+
+ /* A map entry used while building RESULTS. */
+ struct map_entry
+ {
+ explicit map_entry (core_mapped_file *ptr)
+ : file_data (ptr)
+ { /* Nothing. */ }
+
+ /* Points to an entry in RESULTS, this allows entries to be quickly
+ looked up and updated as new mappings are read. */
+ core_mapped_file *file_data = nullptr;
+
+ /* If true then we have seen multiple different build-ids associated
+ with the filename of FILE_DATA. The FILE_DATA->build_id field will
+ have been set to nullptr, and we should not set FILE_DATA->build_id
+ in future. */
+ bool ignore_build_id_p = false;
+ };
+
+ /* All files mapped into the core file. The key is the filename. */
+ gdb::unordered_map<std::string, map_entry> mapped_files;
+
+ /* Get the build-id of the core file. At least on Linux, this will be
+ the build-id for the main executable. If other targets add the
+ gdbarch_read_core_file_mappings method, then it might turn out that
+ this logic is no longer true, in which case this might need to move
+ into the gdbarch_read_core_file_mappings method. */
+ const bfd_build_id *core_build_id = build_id_bfd_get (cbfd);
+
+ /* See linux_read_core_file_mappings() in linux-tdep.c for an example
+ read_core_file_mappings method. */
+ gdbarch_read_core_file_mappings (gdbarch, cbfd,
+ /* After determining the number of mappings, read_core_file_mappings
+ will invoke this lambda. */
+ [&] (ULONGEST)
+ {
+ },
+
+ /* read_core_file_mappings will invoke this lambda for each mapping
+ that it finds. */
+ [&] (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs,
+ const char *filename, const bfd_build_id *build_id)
+ {
+ /* Architecture-specific read_core_mapping methods are expected to
+ weed out non-file-backed mappings. */
+ gdb_assert (filename != nullptr);
+
+ /* Add this mapped region to the data for FILENAME. */
+ auto iter = mapped_files.find (filename);
+ if (iter == mapped_files.end ())
+ {
+ /* Create entry in results list. */
+ results.emplace_back ();
+
+ /* The entry to be added to the lookup map. */
+ map_entry entry (&results.back ());
+ entry.file_data->filename = filename;
+
+ /* Add entry to the quick lookup map and update ITER. */
+ auto inserted_result
+ = mapped_files.insert ({filename, std::move (entry)});
+ gdb_assert (inserted_result.second);
+ iter = inserted_result.first;
+ }
+
+ core_mapped_file &file_data = *iter->second.file_data;
+ bool &ignore_build_id_p = iter->second.ignore_build_id_p;
+
+ file_data.regions.emplace_back (start, end, file_ofs);
+ if (build_id != nullptr && !ignore_build_id_p)
+ {
+ if (file_data.build_id == nullptr)
+ file_data.build_id = build_id;
+ else if (!build_id_equal (build_id, file_data.build_id))
+ {
+ warning (_("Multiple build-ids found for %ps"),
+ styled_string (file_name_style.style (), filename));
+ file_data.build_id = nullptr;
+ ignore_build_id_p = true;
+ }
+ }
+
+ if (build_id != nullptr
+ && core_build_id != nullptr
+ && build_id_equal (build_id, core_build_id))
+ file_data.is_main_exec = true;
+ });
+
+ return results;
+}
+
+/* See gdbcore.h. */
+
std::optional <core_target_mapped_file_info>
core_target_find_mapped_file (const char *filename,
std::optional<CORE_ADDR> addr)
{
- core_target *targ = get_current_core_target ();
- if (targ == nullptr || current_program_space->cbfd.get () == nullptr)
+ core_target *targ = get_core_target (current_inferior ());
+ if (targ == nullptr)
return {};
+ gdb_assert (targ->core_bfd () != nullptr);
+
return targ->lookup_mapped_file_info (filename, addr);
}
-void _initialize_corelow ();
-void
-_initialize_corelow ()
+INIT_GDB_FILE (corelow)
{
add_target (core_target_info, core_target_open,
filename_maybe_quoted_completer);
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index 3167b74..d8cfc08 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -1,6 +1,6 @@
/* Generic code for supporting multiple C++ ABI's
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -384,9 +384,7 @@ show_cp_abi_cmd (const char *args, int from_tty)
uiout->text (").\n");
}
-void _initialize_cp_abi ();
-void
-_initialize_cp_abi ()
+INIT_GDB_FILE (cp_abi)
{
struct cmd_list_element *c;
diff --git a/gdb/cp-abi.h b/gdb/cp-abi.h
index 6c8d904..c564d67 100644
--- a/gdb/cp-abi.h
+++ b/gdb/cp-abi.h
@@ -3,7 +3,7 @@
Contributed by Daniel Berlin <dberlin@redhat.com>
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y
index 6c36abe..7221b78 100644
--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -1,6 +1,6 @@
/* YACC parser for C++ names, for GDB.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
Parts of the lexer are based on c-exp.y from GDB.
@@ -39,7 +39,6 @@
#include <unistd.h>
-#include "gdbsupport/gdb-safe-ctype.h"
#include "demangle.h"
#include "cp-support.h"
#include "c-support.h"
@@ -374,6 +373,22 @@ function
| colon_ext_only function_arglist start_opt
{ $$ = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, $1, $2.comp);
if ($3) $$ = state->fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, $$, $3); }
+ | colon_ext_only
+ {
+ /* This production is a hack to handle
+ something like "name::operator new[]" --
+ without arguments, this ordinarily would
+ not parse, but canonicalizing it is
+ important. So we infer the "()" and then
+ remove it when converting back to string.
+ Note that this works because this
+ production is terminal. */
+ demangle_component *comp
+ = state->fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE,
+ nullptr, nullptr);
+ $$ = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, $1, comp);
+ state->demangle_info->added_parens = true;
+ }
| conversion_op_name start_opt
{ $$ = $1.comp;
@@ -1346,7 +1361,7 @@ cpname_state::parse_number (const char *p, int len, int parsed_float,
/* See if it has `f' or `l' suffix (float or long double). */
- c = TOLOWER (p[len - 1]);
+ c = c_tolower (p[len - 1]);
if (c == 'f')
{
@@ -1358,7 +1373,7 @@ cpname_state::parse_number (const char *p, int len, int parsed_float,
len--;
type = make_builtin_type ("long double");
}
- else if (ISDIGIT (c) || c == '.')
+ else if (c_isdigit (c) || c == '.')
type = make_builtin_type ("double");
else
return ERROR;
@@ -1423,10 +1438,10 @@ cpname_state::parse_number (const char *p, int len, int parsed_float,
for (int off = 0; off < len; ++off)
{
int dig;
- if (ISDIGIT (p[off]))
+ if (c_isdigit (p[off]))
dig = p[off] - '0';
else
- dig = TOLOWER (p[off]) - 'a' + 10;
+ dig = c_tolower (p[off]) - 'a' + 10;
if (dig >= base)
return ERROR;
value *= base;
@@ -1753,7 +1768,7 @@ yylex (YYSTYPE *lvalp, cpname_state *state)
}
/* We will take any letters or digits. parse_number will
complain if past the radix, or if L or U are not final. */
- else if (! ISALNUM (*p))
+ else if (! c_isalnum (*p))
break;
if (no_tick.has_value ())
no_tick->push_back (*p);
@@ -2047,6 +2062,11 @@ cp_demangled_name_to_comp (const char *demangled_name,
auto result = std::make_unique<demangle_parse_info> ();
cpname_state state (demangled_name, result.get ());
+ /* Note that we can't set yydebug here, as is done in the other
+ parsers. Bison implements yydebug as a global, even with a pure
+ parser, and this parser is run from worker threads. So, changing
+ yydebug causes TSan reports. If you need to debug this parser,
+ debug gdb and set the global from the outer gdb. */
if (yyparse (&state))
{
if (state.global_errmsg && errmsg)
@@ -2106,13 +2126,17 @@ canonicalize_tests ()
should_be_the_same ("Foozle<int>::fogey<Empty<int> > (Empty<int>)",
"Foozle<int>::fogey<Empty<int>> (Empty<int>)");
+
+ should_be_the_same ("something :: operator new [ ]",
+ "something::operator new[]");
+ should_be_the_same ("something :: operator new",
+ "something::operator new");
+ should_be_the_same ("operator()", "operator ()");
}
#endif
-void _initialize_cp_name_parser ();
-void
-_initialize_cp_name_parser ()
+INIT_GDB_FILE (cp_name_parser)
{
#if GDB_SELF_TEST
selftests::register_test ("canonicalize", canonicalize_tests);
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 370cb36..009ea4b 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -1,5 +1,5 @@
/* Helper routines for C++ support in GDB.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
Contributed by David Carlton and by Kealia, Inc.
@@ -926,7 +926,7 @@ cp_lookup_nested_symbol (struct type *parent_type,
case TYPE_CODE_NAMESPACE:
case TYPE_CODE_UNION:
case TYPE_CODE_ENUM:
- /* NOTE: Handle modules here as well, because Fortran is re-using the C++
+ /* NOTE: Handle modules here as well, because Fortran is reusing the C++
specific code to lookup nested symbols in modules, by calling the
method lookup_symbol_nonlocal, which ends up here. */
case TYPE_CODE_MODULE:
@@ -1049,9 +1049,7 @@ maintenance_cplus_namespace (const char *args, int from_tty)
gdb_printf (_("The `maint namespace' command was removed.\n"));
}
-void _initialize_cp_namespace ();
-void
-_initialize_cp_namespace ()
+INIT_GDB_FILE (cp_namespace)
{
struct cmd_list_element *cmd;
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 6dd364d..7cfb545 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -1,5 +1,5 @@
/* Helper routines for C++ support in GDB.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by MontaVista Software.
@@ -35,7 +35,6 @@
#include "namespace.h"
#include <signal.h>
#include "gdbsupport/gdb_setjmp.h"
-#include "gdbsupport/gdb-safe-ctype.h"
#include "gdbsupport/selftest.h"
#include "gdbsupport/gdb-sigmask.h"
#include <atomic>
@@ -105,7 +104,7 @@ static int
cp_already_canonical (const char *string)
{
/* Identifier start character [a-zA-Z_]. */
- if (!ISIDST (string[0]))
+ if (!c_isalpha (string[0]) || string[0] == '_')
return 0;
/* These are the only two identifiers which canonicalize to other
@@ -117,7 +116,7 @@ cp_already_canonical (const char *string)
return 0;
/* Identifier character [a-zA-Z0-9_]. */
- while (ISIDNUM (string[1]))
+ while (c_isalpha (string[1]) || c_isdigit (string[1]) || string[1] == '_')
string++;
if (string[1] == '\0')
@@ -150,7 +149,8 @@ inspect_type (struct demangle_parse_info *info,
try
{
- sym = lookup_symbol (name, 0, SEARCH_VFT, 0).symbol;
+ sym = lookup_symbol (name, 0, (SEARCH_TYPE_DOMAIN
+ | SEARCH_STRUCT_DOMAIN), 0).symbol;
}
catch (const gdb_exception &except)
{
@@ -504,7 +504,8 @@ replace_typedefs (struct demangle_parse_info *info,
try
{
sym = lookup_symbol (local_name.get (), 0,
- SEARCH_VFT, 0).symbol;
+ (SEARCH_TYPE_DOMAIN
+ | SEARCH_STRUCT_DOMAIN), 0).symbol;
}
catch (const gdb_exception &except)
{
@@ -573,6 +574,17 @@ replace_typedefs (struct demangle_parse_info *info,
}
}
+/* A helper to strip a trailing "()" from PTR. The string is modified
+ in place. */
+
+static void
+maybe_strip_parens (char *ptr)
+{
+ size_t len = strlen (ptr);
+ if (len > 2 && ptr[len - 2] == '(' && ptr[len - 1] == ')')
+ ptr[len - 2] = '\0';
+}
+
/* Parse STRING and convert it to canonical form, resolving any
typedefs. If parsing fails, or if STRING is already canonical,
return nullptr. Otherwise return the canonical form. If
@@ -599,6 +611,9 @@ cp_canonicalize_string_full (const char *string,
estimated_len);
gdb_assert (us);
+ if (info->added_parens)
+ maybe_strip_parens (us.get ());
+
/* Finally, compare the original string with the computed
name, returning NULL if they are the same. */
if (strcmp (us.get (), string) == 0)
@@ -647,6 +662,9 @@ cp_canonicalize_string (const char *string)
return nullptr;
}
+ if (info->added_parens)
+ maybe_strip_parens (us.get ());
+
if (strcmp (us.get (), string) == 0)
return nullptr;
@@ -1118,7 +1136,7 @@ cp_find_first_component_aux (const char *name, int permissive)
&& startswith (name + index, CP_OPERATOR_STR))
{
index += CP_OPERATOR_LEN;
- while (ISSPACE(name[index]))
+ while (c_isspace(name[index]))
++index;
switch (name[index])
{
@@ -1455,17 +1473,14 @@ add_symbol_overload_list_qualified (const char *func_name,
? selected_block->objfile ()
: nullptr);
- gdbarch_iterate_over_objfiles_in_search_order
- (current_objfile ? current_objfile->arch () : current_inferior ()->arch (),
- [func_name, surrounding_static_block, &overload_list]
+ lookup_name_info base_lookup (func_name, symbol_name_match_type::FULL);
+ lookup_name_info lookup_name = base_lookup.make_ignore_params ();
+
+ current_program_space->iterate_over_objfiles_in_search_order
+ ([func_name, surrounding_static_block, &overload_list, lookup_name]
(struct objfile *obj)
{
- /* Look through the partial symtabs for all symbols which
- begin by matching FUNC_NAME. Make sure we read that
- symbol table in. */
- obj->expand_symtabs_for_function (func_name);
-
- for (compunit_symtab *cust : obj->compunits ())
+ auto callback = [&] (compunit_symtab *cust)
{
QUIT;
const struct block *b = cust->blockvector ()->global_block ();
@@ -1473,11 +1488,17 @@ add_symbol_overload_list_qualified (const char *func_name,
b = cust->blockvector ()->static_block ();
/* Don't do this block twice. */
- if (b == surrounding_static_block)
- continue;
+ if (b != surrounding_static_block)
+ add_symbol_overload_list_block (func_name, b, overload_list);
+ return true;
+ };
- add_symbol_overload_list_block (func_name, b, overload_list);
- }
+ /* Look through the partial symtabs for all symbols which
+ begin by matching FUNC_NAME. Make sure we read that
+ symbol table in. */
+ obj->search (nullptr, &lookup_name, nullptr, callback,
+ SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
+ SEARCH_FUNCTION_DOMAIN);
return 0;
}, current_objfile);
@@ -1501,7 +1522,7 @@ cp_lookup_rtti_type (const char *name, const struct block *block)
return NULL;
}
- if (rtti_sym->aclass () != LOC_TYPEDEF)
+ if (rtti_sym->loc_class () != LOC_TYPEDEF)
{
warning (_("RTTI symbol for class '%s' is not a type"), name);
return NULL;
@@ -2332,7 +2353,7 @@ find_toplevel_char (const char *s, char c)
scan += CP_OPERATOR_LEN;
if (*scan == c)
return scan;
- while (ISSPACE (*scan))
+ while (c_isspace (*scan))
{
++scan;
if (*scan == c)
@@ -2370,9 +2391,7 @@ find_toplevel_char (const char *s, char c)
return 0;
}
-void _initialize_cp_support ();
-void
-_initialize_cp_support ()
+INIT_GDB_FILE (cp_support)
{
cmd_list_element *maintenance_cplus
= add_basic_prefix_cmd ("cplus", class_maintenance,
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index b557c1d..ffe0ba1 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -1,5 +1,5 @@
/* Helper routines for C++ support in GDB.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by MontaVista Software.
Namespace support contributed by David Carlton.
@@ -63,6 +63,10 @@ struct demangle_parse_info
/* Any memory used during processing. */
auto_obstack obstack;
+ /* True if the parser had to add a dummy '()' at the end of the
+ input text to make it parse. */
+ bool added_parens = false;
+
/* Any other objects referred to by this object, and whose storage
lifetime must be linked. */
std::vector<std::unique_ptr<demangle_parse_info>> infos;
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 2634c1e..252072b 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -1,6 +1,6 @@
/* Support for printing C++ values for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -100,7 +100,7 @@ cp_is_vtbl_member (struct type *type)
/* The type name of the thunk pointer is NULL when using
dwarf2. We could test for a pointer to a function, but
there is no type info for the virtual table either, so it
- wont help. */
+ won't help. */
return cp_is_vtbl_ptr_type (type);
}
}
@@ -797,9 +797,7 @@ test_print_fields (gdbarch *arch)
#endif
-void _initialize_cp_valprint ();
-void
-_initialize_cp_valprint ()
+INIT_GDB_FILE (cp_valprint)
{
#if GDB_SELF_TEST
selftests::register_test_foreach_arch ("print-fields", test_print_fields);
diff --git a/gdb/cris-linux-tdep.c b/gdb/cris-linux-tdep.c
index 7ec5505..a39441e 100644
--- a/gdb/cris-linux-tdep.c
+++ b/gdb/cris-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux on CRIS processors, for GDB.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
Contributed by Axis Communications AB.
Written by Hendrik Ruijter, Stefan Andersson, Orjan Friberg,
@@ -23,6 +23,7 @@
#include "osabi.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
#include "solib-svr4.h"
#include "symtab.h"
#include "gdbarch.h"
@@ -41,14 +42,10 @@ cris_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- linux_ilp32_fetch_link_map_offsets);
-
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
}
-void _initialize_cris_linux_tdep ();
-void
-_initialize_cris_linux_tdep ()
+INIT_GDB_FILE (cris_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_cris, 0, GDB_OSABI_LINUX,
cris_linux_init_abi);
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index f531b4c..9cfc1eb 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -1,6 +1,6 @@
/* Target dependent code for CRIS, for GDB, the GNU debugger.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
Contributed by Axis Communications AB.
Written by Hendrik Ruijter, Stefan Andersson, and Orjan Friberg.
@@ -1467,7 +1467,7 @@ cris_register_size (struct gdbarch *gdbarch, int regno)
}
/* Nonzero if regno should not be fetched from the target. This is the case
- for unimplemented (size 0) and non-existant registers. */
+ for unimplemented (size 0) and non-existent registers. */
static int
cris_cannot_fetch_register (struct gdbarch *gdbarch, int regno)
@@ -1508,7 +1508,7 @@ cris_cannot_store_register (struct gdbarch *gdbarch, int regno)
}
/* Nonzero if regno should not be fetched from the target. This is the case
- for unimplemented (size 0) and non-existant registers. */
+ for unimplemented (size 0) and non-existent registers. */
static int
crisv32_cannot_fetch_register (struct gdbarch *gdbarch, int regno)
@@ -3816,9 +3816,7 @@ static void cris_iterate_over_regset_sections (struct gdbarch *gdbarch,
&cris_regset, NULL, cb_data);
}
-void _initialize_cris_tdep ();
-void
-_initialize_cris_tdep ()
+INIT_GDB_FILE (cris_tdep)
{
gdbarch_register (bfd_arch_cris, cris_gdbarch_init, cris_dump_tdep);
@@ -3995,7 +3993,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_cannot_store_register (gdbarch, cris_cannot_store_register);
set_gdbarch_cannot_fetch_register (gdbarch, cris_cannot_fetch_register);
- set_gdbarch_software_single_step (gdbarch, cris_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, cris_software_single_step);
break;
case 32:
diff --git a/gdb/cris-tdep.h b/gdb/cris-tdep.h
index 8be9547..d983f56 100644
--- a/gdb/cris-tdep.h
+++ b/gdb/cris-tdep.h
@@ -1,6 +1,6 @@
/* Target dependent code for CRIS, for GDB, the GNU debugger.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
Contributed by Axis Communications AB.
Written by Hendrik Ruijter, Stefan Andersson, and Orjan Friberg.
diff --git a/gdb/csky-linux-tdep.c b/gdb/csky-linux-tdep.c
index c02eedb..0651645 100644
--- a/gdb/csky-linux-tdep.c
+++ b/gdb/csky-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux on CSKY.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
Contributed by C-SKY Microsystems and Mentor Graphics.
@@ -22,6 +22,7 @@
#include "osabi.h"
#include "glibc-tdep.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
#include "gdbarch.h"
#include "solib-svr4.h"
#include "regset.h"
@@ -407,8 +408,7 @@ csky_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
@@ -426,9 +426,7 @@ csky_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
&csky_linux_rt_sigreturn_tramp_frame_kernel_4x);
}
-void _initialize_csky_linux_tdep ();
-void
-_initialize_csky_linux_tdep ()
+INIT_GDB_FILE (csky_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_csky, 0, GDB_OSABI_LINUX,
csky_linux_init_abi);
diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c
index 4f41a51..e6c6e2c 100644
--- a/gdb/csky-tdep.c
+++ b/gdb/csky-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the CSKY architecture, for GDB.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
Contributed by C-SKY Microsystems and Mentor Graphics.
@@ -1072,7 +1072,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
}
else if (CSKY_32_IS_MOV_FP_SP (insn))
{
- /* SP is saved to FP reg, means code afer prologue may
+ /* SP is saved to FP reg, means code after prologue may
modify SP. */
is_fp_saved = 1;
adjust_fp = stacksize;
@@ -2667,7 +2667,7 @@ csky_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
}
/* Initialize the current architecture based on INFO. If possible,
- re-use an architecture from ARCHES, which is a list of
+ reuse an architecture from ARCHES, which is a list of
architectures already created during this debugging session.
Called at program startup, when reading a core file, and when
@@ -2882,9 +2882,7 @@ csky_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_csky_tdep ();
-void
-_initialize_csky_tdep ()
+INIT_GDB_FILE (csky_tdep)
{
gdbarch_register (bfd_arch_csky, csky_gdbarch_init);
diff --git a/gdb/csky-tdep.h b/gdb/csky-tdep.h
index 2991719..924d5d9 100644
--- a/gdb/csky-tdep.h
+++ b/gdb/csky-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for the CSKY architecture, for GDB.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index ee7c30f..860894b 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -1,6 +1,6 @@
/* Compact ANSI-C Type Format (CTF) support in GDB.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -86,33 +86,38 @@
#include "ctf.h"
#include "ctf-api.h"
-static const registry<objfile>::key<htab, htab_deleter> ctf_tid_key;
+using ctf_type_map = gdb::unordered_map<ctf_id_t, struct type *>;
-struct ctf_fp_info
+struct ctf_dict_info
{
- explicit ctf_fp_info (ctf_dict_t *cfp) : fp (cfp) {}
- ~ctf_fp_info ();
- ctf_dict_t *fp;
+ explicit ctf_dict_info (ctf_dict_t *dict) : dict (dict) {}
+ ~ctf_dict_info ();
+
+ /* Map from IDs to types. */
+ ctf_type_map type_map;
+
+ /* The dictionary. */
+ ctf_dict_t *dict;
};
/* Cleanup function for the ctf_dict_key data. */
-ctf_fp_info::~ctf_fp_info ()
+ctf_dict_info::~ctf_dict_info ()
{
- if (fp == nullptr)
+ if (dict == nullptr)
return;
- ctf_archive_t *arc = ctf_get_arc (fp);
- ctf_dict_close (fp);
+ ctf_archive_t *arc = ctf_get_arc (dict);
+ ctf_dict_close (dict);
ctf_close (arc);
}
-static const registry<objfile>::key<ctf_fp_info> ctf_dict_key;
+static const registry<objfile>::key<ctf_dict_info> ctf_dict_key;
/* A CTF context consists of a file pointer and an objfile pointer. */
struct ctf_context
{
- ctf_dict_t *fp;
+ ctf_dict_t *dict;
struct objfile *of;
psymtab_storage *partial_symtabs;
partial_symtab *pst;
@@ -170,10 +175,9 @@ struct ctf_field_info
struct ctf_per_tu_data
{
- ctf_dict_t *fp;
+ ctf_dict_t *dict;
struct objfile *of;
ctf_archive_t *arc;
- psymtab_storage *pss;
psymbol_functions *psf;
};
@@ -202,89 +206,34 @@ static void process_struct_members (struct ctf_context *cp, ctf_id_t tid,
static struct type *read_forward_type (struct ctf_context *cp, ctf_id_t tid);
-static struct symbol *new_symbol (struct ctf_context *cp, struct type *type,
- ctf_id_t tid);
-
-struct ctf_tid_and_type
-{
- ctf_id_t tid;
- struct type *type;
-};
-
-/* Hash function for a ctf_tid_and_type. */
-
-static hashval_t
-tid_and_type_hash (const void *item)
-{
- const struct ctf_tid_and_type *ids
- = (const struct ctf_tid_and_type *) item;
-
- return ids->tid;
-}
-
-/* Equality function for a ctf_tid_and_type. */
-
-static int
-tid_and_type_eq (const void *item_lhs, const void *item_rhs)
-{
- const struct ctf_tid_and_type *ids_lhs
- = (const struct ctf_tid_and_type *) item_lhs;
- const struct ctf_tid_and_type *ids_rhs
- = (const struct ctf_tid_and_type *) item_rhs;
-
- return ids_lhs->tid == ids_rhs->tid;
-}
-
/* Set the type associated with TID to TYP. */
static struct type *
set_tid_type (struct objfile *of, ctf_id_t tid, struct type *typ)
{
- htab_t htab;
-
- htab = ctf_tid_key.get (of);
- if (htab == NULL)
- {
- htab = htab_create_alloc (1, tid_and_type_hash,
- tid_and_type_eq,
- NULL, xcalloc, xfree);
- ctf_tid_key.set (of, htab);
- }
-
- struct ctf_tid_and_type **slot, ids;
- ids.tid = tid;
- ids.type = typ;
- slot = (struct ctf_tid_and_type **) htab_find_slot (htab, &ids, INSERT);
- if (*slot == nullptr)
- *slot = XOBNEW (&of->objfile_obstack, struct ctf_tid_and_type);
- **slot = ids;
+ ctf_dict_info *info = ctf_dict_key.get (of);
+ gdb_assert (info != nullptr);
+ info->type_map.emplace (tid, typ);
return typ;
}
-/* Look up the type for TID in tid_and_type hash, return NULL if hash is
- empty or TID does not have a saved type. */
+/* Look up the type for TID in OF's type map. Return nullptr if TID
+ does not have a saved type. */
static struct type *
get_tid_type (struct objfile *of, ctf_id_t tid)
{
- struct ctf_tid_and_type *slot, ids;
- htab_t htab;
-
- htab = ctf_tid_key.get (of);
- if (htab == NULL)
- return nullptr;
+ ctf_dict_info *info = ctf_dict_key.get (of);
+ gdb_assert (info != nullptr);
- ids.tid = tid;
- ids.type = nullptr;
- slot = (struct ctf_tid_and_type *) htab_find (htab, &ids);
- if (slot)
- return slot->type;
- else
+ auto iter = info->type_map.find (tid);
+ if (iter == info->type_map.end ())
return nullptr;
+ return iter->second;
}
-/* Fetch the type for TID in CCP OF's tid_and_type hash, add the type to
- * context CCP if hash is empty or TID does not have a saved type. */
+/* Fetch the type for TID in CCP OF's type map, add the type to
+ context CCP if TID does not have a saved type. */
static struct type *
fetch_tid_type (struct ctf_context *ccp, ctf_id_t tid)
@@ -305,14 +254,14 @@ fetch_tid_type (struct ctf_context *ccp, ctf_id_t tid)
/* Return the size of storage in bits for INTEGER, FLOAT, or ENUM. */
static int
-get_bitsize (ctf_dict_t *fp, ctf_id_t tid, uint32_t kind)
+get_bitsize (ctf_dict_t *dict, ctf_id_t tid, uint32_t kind)
{
ctf_encoding_t cet;
if ((kind == CTF_K_INTEGER || kind == CTF_K_ENUM
|| kind == CTF_K_FLOAT)
- && ctf_type_reference (fp, tid) != CTF_ERR
- && ctf_type_encoding (fp, tid, &cet) != CTF_ERR)
+ && ctf_type_reference (dict, tid) != CTF_ERR
+ && ctf_type_encoding (dict, tid, &cet) != CTF_ERR)
return cet.cte_bits;
return 0;
@@ -328,7 +277,7 @@ set_symbol_address (struct objfile *of, struct symbol *sym, const char *name)
if (msym.minsym != NULL)
{
sym->set_value_address (msym.value_address ());
- sym->set_aclass_index (LOC_STATIC);
+ sym->set_loc_class_index (LOC_STATIC);
sym->set_section_index (msym.minsym->section_index ());
}
}
@@ -398,7 +347,7 @@ ctf_add_member_cb (const char *name,
fp = &new_field.field;
fp->set_name (name);
- kind = ctf_type_kind (ccp->fp, tid);
+ kind = ctf_type_kind (ccp->dict, tid);
t = fetch_tid_type (ccp, tid);
if (t == nullptr)
{
@@ -416,7 +365,7 @@ ctf_add_member_cb (const char *name,
fp->set_type (t);
fp->set_loc_bitpos (offset / TARGET_CHAR_BIT);
- fp->set_bitsize (get_bitsize (ccp->fp, tid, kind));
+ fp->set_bitsize (get_bitsize (ccp->dict, tid, kind));
fip->fields.emplace_back (new_field);
@@ -440,14 +389,14 @@ ctf_add_enum_member_cb (const char *name, int enum_value, void *arg)
fp->set_loc_enumval (enum_value);
fp->set_bitsize (0);
- if (name != nullptr)
+ if (name != nullptr && *name != '\0')
{
struct symbol *sym = new (&ccp->of->objfile_obstack) symbol;
OBJSTAT (ccp->of, n_syms++);
sym->set_language (language_c, &ccp->of->objfile_obstack);
sym->compute_and_set_names (name, false, ccp->of->per_bfd);
- sym->set_aclass_index (LOC_CONST);
+ sym->set_loc_class_index (LOC_CONST);
sym->set_domain (VAR_DOMAIN);
sym->set_type (fip->ptype);
add_symbol_to_list (sym, ccp->builder->get_global_symbols ());
@@ -458,68 +407,41 @@ ctf_add_enum_member_cb (const char *name, int enum_value, void *arg)
return 0;
}
-/* Add a new symbol entry, with its name from TID, its access index and
- domain from TID's kind, and its type from TYPE. */
+/* Add a new type symbol entry, with its name from TID, its access
+ index and domain from TID's kind, and its type from TYPE. */
-static struct symbol *
-new_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid)
+static void
+new_type_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid)
{
- struct objfile *objfile = ccp->of;
- ctf_dict_t *fp = ccp->fp;
- struct symbol *sym = nullptr;
+ ctf_dict_t *dict = ccp->dict;
- const char *name = ctf_type_name_raw (fp, tid);
- if (name != nullptr)
+ const char *name = ctf_type_name_raw (dict, tid);
+ if (name != nullptr && *name != '\0')
{
- sym = new (&objfile->objfile_obstack) symbol;
+ struct objfile *objfile = ccp->of;
+ struct symbol *sym = new (&objfile->objfile_obstack) symbol;
OBJSTAT (objfile, n_syms++);
sym->set_language (language_c, &objfile->objfile_obstack);
sym->compute_and_set_names (name, false, objfile->per_bfd);
- sym->set_domain (VAR_DOMAIN);
- sym->set_aclass_index (LOC_OPTIMIZED_OUT);
+ sym->set_domain (TYPE_DOMAIN);
+ sym->set_loc_class_index (LOC_TYPEDEF);
if (type != nullptr)
sym->set_type (type);
- uint32_t kind = ctf_type_kind (fp, tid);
+ uint32_t kind = ctf_type_kind (dict, tid);
switch (kind)
{
case CTF_K_STRUCT:
case CTF_K_UNION:
case CTF_K_ENUM:
- sym->set_aclass_index (LOC_TYPEDEF);
sym->set_domain (STRUCT_DOMAIN);
break;
- case CTF_K_FUNCTION:
- sym->set_aclass_index (LOC_STATIC);
- set_symbol_address (objfile, sym, sym->linkage_name ());
- break;
- case CTF_K_CONST:
- if (sym->type ()->code () == TYPE_CODE_VOID)
- sym->set_type (builtin_type (objfile)->builtin_int);
- break;
- case CTF_K_TYPEDEF:
- case CTF_K_INTEGER:
- case CTF_K_FLOAT:
- sym->set_aclass_index (LOC_TYPEDEF);
- sym->set_domain (TYPE_DOMAIN);
- break;
- case CTF_K_POINTER:
- break;
- case CTF_K_VOLATILE:
- case CTF_K_RESTRICT:
- break;
- case CTF_K_SLICE:
- case CTF_K_ARRAY:
- case CTF_K_UNKNOWN:
- break;
}
- add_symbol_to_list (sym, ccp->builder->get_file_symbols ());
+ add_symbol_to_list (sym, ccp->builder->get_global_symbols ());
}
-
- return sym;
}
/* Given a TID of kind CTF_K_INTEGER or CTF_K_FLOAT, find a representation
@@ -529,30 +451,30 @@ static struct type *
read_base_type (struct ctf_context *ccp, ctf_id_t tid)
{
struct objfile *of = ccp->of;
- ctf_dict_t *fp = ccp->fp;
+ ctf_dict_t *dict = ccp->dict;
ctf_encoding_t cet;
struct type *type = nullptr;
const char *name;
uint32_t kind;
- if (ctf_type_encoding (fp, tid, &cet))
+ if (ctf_type_encoding (dict, tid, &cet))
{
complaint (_("ctf_type_encoding read_base_type failed - %s"),
- ctf_errmsg (ctf_errno (fp)));
+ ctf_errmsg (ctf_errno (dict)));
return nullptr;
}
- name = ctf_type_name_raw (fp, tid);
- if (name == nullptr || strlen (name) == 0)
+ name = ctf_type_name_raw (dict, tid);
+ if (name == nullptr || *name == '\0')
{
- name = ctf_type_aname (fp, tid);
- if (name == nullptr)
+ name = ctf_type_aname (dict, tid);
+ if (name == nullptr || *name == '\0')
complaint (_("ctf_type_aname read_base_type failed - %s"),
- ctf_errmsg (ctf_errno (fp)));
+ ctf_errmsg (ctf_errno (dict)));
}
type_allocator alloc (of, language_c);
- kind = ctf_type_kind (fp, tid);
+ kind = ctf_type_kind (dict, tid);
if (kind == CTF_K_INTEGER)
{
uint32_t issigned, ischar, isbool;
@@ -609,7 +531,7 @@ process_base_type (struct ctf_context *ccp, ctf_id_t tid)
struct type *type;
type = read_base_type (ccp, tid);
- new_symbol (ccp, type, tid);
+ new_type_symbol (ccp, type, tid);
}
/* Start a structure or union scope (definition) with TID to create a type
@@ -623,24 +545,24 @@ static struct type *
read_structure_type (struct ctf_context *ccp, ctf_id_t tid)
{
struct objfile *of = ccp->of;
- ctf_dict_t *fp = ccp->fp;
+ ctf_dict_t *dict = ccp->dict;
struct type *type;
uint32_t kind;
type = type_allocator (of, language_c).new_type ();
- const char *name = ctf_type_name_raw (fp, tid);
- if (name != nullptr && strlen (name) != 0)
+ const char *name = ctf_type_name_raw (dict, tid);
+ if (name != nullptr && *name != '\0')
type->set_name (name);
- kind = ctf_type_kind (fp, tid);
+ kind = ctf_type_kind (dict, tid);
if (kind == CTF_K_UNION)
type->set_code (TYPE_CODE_UNION);
else
type->set_code (TYPE_CODE_STRUCT);
- type->set_length (ctf_type_size (fp, tid));
- set_type_align (type, ctf_type_align (fp, tid));
+ type->set_length (ctf_type_size (dict, tid));
+ set_type_align (type, ctf_type_align (dict, tid));
return set_tid_type (ccp->of, tid, type);
}
@@ -656,14 +578,14 @@ process_struct_members (struct ctf_context *ccp,
struct ctf_field_info fi;
fi.cur_context = ccp;
- if (ctf_member_iter (ccp->fp, tid, ctf_add_member_cb, &fi) == CTF_ERR)
+ if (ctf_member_iter (ccp->dict, tid, ctf_add_member_cb, &fi) == CTF_ERR)
complaint (_("ctf_member_iter process_struct_members failed - %s"),
- ctf_errmsg (ctf_errno (ccp->fp)));
+ ctf_errmsg (ctf_errno (ccp->dict)));
/* Attach fields to the type. */
attach_fields_to_type (&fi, type);
- new_symbol (ccp, type, tid);
+ new_type_symbol (ccp, type, tid);
}
static void
@@ -681,7 +603,7 @@ static struct type *
read_func_kind_type (struct ctf_context *ccp, ctf_id_t tid)
{
struct objfile *of = ccp->of;
- ctf_dict_t *fp = ccp->fp;
+ ctf_dict_t *dict = ccp->dict;
struct type *type, *rettype, *atype;
ctf_funcinfo_t cfi;
uint32_t argc;
@@ -689,15 +611,15 @@ read_func_kind_type (struct ctf_context *ccp, ctf_id_t tid)
type = type_allocator (of, language_c).new_type ();
type->set_code (TYPE_CODE_FUNC);
- if (ctf_func_type_info (fp, tid, &cfi) < 0)
+ if (ctf_func_type_info (dict, tid, &cfi) < 0)
{
- const char *fname = ctf_type_name_raw (fp, tid);
+ const char *fname = ctf_type_name_raw (dict, tid);
error (_("Error getting function type info: %s"),
fname == nullptr ? "noname" : fname);
}
rettype = fetch_tid_type (ccp, cfi.ctc_return);
type->set_target_type (rettype);
- set_type_align (type, ctf_type_align (fp, tid));
+ set_type_align (type, ctf_type_align (dict, tid));
/* Set up function's arguments. */
argc = cfi.ctc_argc;
@@ -708,7 +630,7 @@ read_func_kind_type (struct ctf_context *ccp, ctf_id_t tid)
if (argc != 0)
{
std::vector<ctf_id_t> argv (argc);
- if (ctf_func_type_args (fp, tid, argc, argv.data ()) == CTF_ERR)
+ if (ctf_func_type_args (dict, tid, argc, argv.data ()) == CTF_ERR)
return nullptr;
type->alloc_fields (argc);
@@ -734,20 +656,20 @@ static struct type *
read_enum_type (struct ctf_context *ccp, ctf_id_t tid)
{
struct objfile *of = ccp->of;
- ctf_dict_t *fp = ccp->fp;
+ ctf_dict_t *dict = ccp->dict;
struct type *type;
type = type_allocator (of, language_c).new_type ();
- const char *name = ctf_type_name_raw (fp, tid);
- if (name != nullptr && strlen (name) != 0)
+ const char *name = ctf_type_name_raw (dict, tid);
+ if (name != nullptr && *name != '\0')
type->set_name (name);
type->set_code (TYPE_CODE_ENUM);
- type->set_length (ctf_type_size (fp, tid));
+ type->set_length (ctf_type_size (dict, tid));
/* Set the underlying type based on its ctf_type_size bits. */
type->set_target_type (objfile_int_type (of, type->length (), false));
- set_type_align (type, ctf_type_align (fp, tid));
+ set_type_align (type, ctf_type_align (dict, tid));
return set_tid_type (of, tid, type);
}
@@ -762,14 +684,14 @@ process_enum_type (struct ctf_context *ccp, ctf_id_t tid)
fi.cur_context = ccp;
fi.ptype = type;
- if (ctf_enum_iter (ccp->fp, tid, ctf_add_enum_member_cb, &fi) == CTF_ERR)
+ if (ctf_enum_iter (ccp->dict, tid, ctf_add_enum_member_cb, &fi) == CTF_ERR)
complaint (_("ctf_enum_iter process_enum_type failed - %s"),
- ctf_errmsg (ctf_errno (ccp->fp)));
+ ctf_errmsg (ctf_errno (ccp->dict)));
/* Attach fields to the type. */
attach_fields_to_type (&fi, type);
- new_symbol (ccp, type, tid);
+ new_type_symbol (ccp, type, tid);
}
/* Add given cv-qualifiers CNST+VOLTL to the BASE_TYPE of array TID. */
@@ -806,15 +728,15 @@ static struct type *
read_array_type (struct ctf_context *ccp, ctf_id_t tid)
{
struct objfile *objfile = ccp->of;
- ctf_dict_t *fp = ccp->fp;
+ ctf_dict_t *dict = ccp->dict;
struct type *element_type, *range_type, *idx_type;
struct type *type;
ctf_arinfo_t ar;
- if (ctf_array_info (fp, tid, &ar) == CTF_ERR)
+ if (ctf_array_info (dict, tid, &ar) == CTF_ERR)
{
complaint (_("ctf_array_info read_array_type failed - %s"),
- ctf_errmsg (ctf_errno (fp)));
+ ctf_errmsg (ctf_errno (dict)));
return nullptr;
}
@@ -836,9 +758,9 @@ read_array_type (struct ctf_context *ccp, ctf_id_t tid)
type->set_target_is_stub (true);
}
else
- type->set_length (ctf_type_size (fp, tid));
+ type->set_length (ctf_type_size (dict, tid));
- set_type_align (type, ctf_type_align (fp, tid));
+ set_type_align (type, ctf_type_align (dict, tid));
return set_tid_type (objfile, tid, type);
}
@@ -872,7 +794,7 @@ static struct type *
read_volatile_type (struct ctf_context *ccp, ctf_id_t tid, ctf_id_t btid)
{
struct objfile *objfile = ccp->of;
- ctf_dict_t *fp = ccp->fp;
+ ctf_dict_t *dict = ccp->dict;
struct type *base_type, *cv_type;
base_type = fetch_tid_type (ccp, btid);
@@ -886,7 +808,7 @@ read_volatile_type (struct ctf_context *ccp, ctf_id_t tid, ctf_id_t btid)
}
}
- if (ctf_type_kind (fp, btid) == CTF_K_ARRAY)
+ if (ctf_type_kind (dict, btid) == CTF_K_ARRAY)
return add_array_cv_type (ccp, tid, base_type, 0, 1);
cv_type = make_cv_type (TYPE_CONST (base_type), 1, base_type, 0);
@@ -937,7 +859,7 @@ read_typedef_type (struct ctf_context *ccp, ctf_id_t tid,
this_type->set_target_is_stub (this_type->target_type () != nullptr);
- return set_tid_type (objfile, tid, this_type);
+ return this_type;
}
/* Read TID of kind CTF_K_POINTER with base type BTID. */
@@ -960,7 +882,7 @@ read_pointer_type (struct ctf_context *ccp, ctf_id_t tid, ctf_id_t btid)
}
type = lookup_pointer_type (target_type);
- set_type_align (type, ctf_type_align (ccp->fp, tid));
+ set_type_align (type, ctf_type_align (ccp->dict, tid));
return set_tid_type (of, tid, type);
}
@@ -971,17 +893,17 @@ static struct type *
read_forward_type (struct ctf_context *ccp, ctf_id_t tid)
{
struct objfile *of = ccp->of;
- ctf_dict_t *fp = ccp->fp;
+ ctf_dict_t *dict = ccp->dict;
struct type *type;
uint32_t kind;
type = type_allocator (of, language_c).new_type ();
- const char *name = ctf_type_name_raw (fp, tid);
- if (name != nullptr && strlen (name) != 0)
+ const char *name = ctf_type_name_raw (dict, tid);
+ if (name != nullptr && *name != '\0')
type->set_name (name);
- kind = ctf_type_kind_forwarded (fp, tid);
+ kind = ctf_type_kind_forwarded (dict, tid);
if (kind == CTF_K_UNION)
type->set_code (TYPE_CODE_UNION);
else
@@ -998,12 +920,12 @@ read_forward_type (struct ctf_context *ccp, ctf_id_t tid)
static struct type *
read_type_record (struct ctf_context *ccp, ctf_id_t tid)
{
- ctf_dict_t *fp = ccp->fp;
+ ctf_dict_t *dict = ccp->dict;
uint32_t kind;
struct type *type = nullptr;
ctf_id_t btid;
- kind = ctf_type_kind (fp, tid);
+ kind = ctf_type_kind (dict, tid);
switch (kind)
{
case CTF_K_STRUCT:
@@ -1017,26 +939,26 @@ read_type_record (struct ctf_context *ccp, ctf_id_t tid)
type = read_func_kind_type (ccp, tid);
break;
case CTF_K_CONST:
- btid = ctf_type_reference (fp, tid);
+ btid = ctf_type_reference (dict, tid);
type = read_const_type (ccp, tid, btid);
break;
case CTF_K_TYPEDEF:
{
- const char *name = ctf_type_name_raw (fp, tid);
- btid = ctf_type_reference (fp, tid);
+ const char *name = ctf_type_name_raw (dict, tid);
+ btid = ctf_type_reference (dict, tid);
type = read_typedef_type (ccp, tid, btid, name);
}
break;
case CTF_K_VOLATILE:
- btid = ctf_type_reference (fp, tid);
+ btid = ctf_type_reference (dict, tid);
type = read_volatile_type (ccp, tid, btid);
break;
case CTF_K_RESTRICT:
- btid = ctf_type_reference (fp, tid);
+ btid = ctf_type_reference (dict, tid);
type = read_restrict_type (ccp, tid, btid);
break;
case CTF_K_POINTER:
- btid = ctf_type_reference (fp, tid);
+ btid = ctf_type_reference (dict, tid);
type = read_pointer_type (ccp, tid, btid);
break;
case CTF_K_INTEGER:
@@ -1072,8 +994,8 @@ ctf_add_type_cb (ctf_id_t tid, void *arg)
if (type != nullptr)
return 0;
- ctf_id_t btid = ctf_type_reference (ccp->fp, tid);
- kind = ctf_type_kind (ccp->fp, tid);
+ ctf_id_t btid = ctf_type_reference (ccp->dict, tid);
+ kind = ctf_type_kind (ccp->dict, tid);
switch (kind)
{
case CTF_K_STRUCT:
@@ -1085,34 +1007,34 @@ ctf_add_type_cb (ctf_id_t tid, void *arg)
break;
case CTF_K_FUNCTION:
type = read_func_kind_type (ccp, tid);
- new_symbol (ccp, type, tid);
+ new_type_symbol (ccp, type, tid);
break;
case CTF_K_INTEGER:
case CTF_K_FLOAT:
process_base_type (ccp, tid);
break;
case CTF_K_TYPEDEF:
- new_symbol (ccp, read_type_record (ccp, tid), tid);
+ new_type_symbol (ccp, read_type_record (ccp, tid), tid);
break;
case CTF_K_CONST:
type = read_const_type (ccp, tid, btid);
- new_symbol (ccp, type, tid);
+ new_type_symbol (ccp, type, tid);
break;
case CTF_K_VOLATILE:
type = read_volatile_type (ccp, tid, btid);
- new_symbol (ccp, type, tid);
+ new_type_symbol (ccp, type, tid);
break;
case CTF_K_RESTRICT:
type = read_restrict_type (ccp, tid, btid);
- new_symbol (ccp, type, tid);
+ new_type_symbol (ccp, type, tid);
break;
case CTF_K_POINTER:
type = read_pointer_type (ccp, tid, btid);
- new_symbol (ccp, type, tid);
+ new_type_symbol (ccp, type, tid);
break;
case CTF_K_ARRAY:
type = read_array_type (ccp, tid);
- new_symbol (ccp, type, tid);
+ new_type_symbol (ccp, type, tid);
break;
case CTF_K_UNKNOWN:
break;
@@ -1135,51 +1057,30 @@ ctf_add_var_cb (const char *name, ctf_id_t id, void *arg)
type = get_tid_type (ccp->of, id);
- kind = ctf_type_kind (ccp->fp, id);
- switch (kind)
+ kind = ctf_type_kind (ccp->dict, id);
+
+ if (type == nullptr)
{
- case CTF_K_FUNCTION:
- if (name != nullptr && strcmp (name, "main") == 0)
- set_objfile_main_name (ccp->of, name, language_c);
- break;
- case CTF_K_INTEGER:
- case CTF_K_FLOAT:
- case CTF_K_VOLATILE:
- case CTF_K_RESTRICT:
- case CTF_K_TYPEDEF:
- case CTF_K_CONST:
- case CTF_K_POINTER:
- case CTF_K_ARRAY:
- if (type != nullptr)
- {
- sym = new_symbol (ccp, type, id);
- if (sym != nullptr)
- sym->compute_and_set_names (name, false, ccp->of->per_bfd);
- }
- break;
- case CTF_K_STRUCT:
- case CTF_K_UNION:
- case CTF_K_ENUM:
- if (type == nullptr)
- {
- complaint (_("ctf_add_var_cb: %s has NO type (%ld)"), name, id);
- type = builtin_type (ccp->of)->builtin_error;
- }
- sym = new (&ccp->of->objfile_obstack) symbol;
- OBJSTAT (ccp->of, n_syms++);
- sym->set_type (type);
- sym->set_domain (VAR_DOMAIN);
- sym->set_aclass_index (LOC_OPTIMIZED_OUT);
- sym->compute_and_set_names (name, false, ccp->of->per_bfd);
- add_symbol_to_list (sym, ccp->builder->get_file_symbols ());
- break;
- default:
- complaint (_("ctf_add_var_cb: kind unsupported (%d)"), kind);
- break;
+ complaint (_("ctf_add_var_cb: %s has NO type (%ld)"), name, id);
+ type = builtin_type (ccp->of)->builtin_error;
+ }
+ sym = new (&ccp->of->objfile_obstack) symbol;
+ OBJSTAT (ccp->of, n_syms++);
+ sym->set_type (type);
+ sym->set_loc_class_index (LOC_OPTIMIZED_OUT);
+ sym->compute_and_set_names (name, false, ccp->of->per_bfd);
+
+ if (kind == CTF_K_FUNCTION)
+ {
+ sym->set_domain (FUNCTION_DOMAIN);
+ if (name != nullptr && strcmp (name, "main") == 0)
+ set_objfile_main_name (ccp->of, name, language_c);
}
+ else
+ sym->set_domain (VAR_DOMAIN);
- if (sym != nullptr)
- set_symbol_address (ccp->of, sym, name);
+ add_symbol_to_list (sym, ccp->builder->get_global_symbols ());
+ set_symbol_address (ccp->of, sym, name);
return 0;
}
@@ -1196,7 +1097,7 @@ add_stt_entries (struct ctf_context *ccp, int functions)
struct symbol *sym = nullptr;
struct type *type;
- while ((tid = ctf_symbol_next (ccp->fp, &i, &tname, functions)) != CTF_ERR)
+ while ((tid = ctf_symbol_next (ccp->dict, &i, &tname, functions)) != CTF_ERR)
{
type = get_tid_type (ccp->of, tid);
if (type == nullptr)
@@ -1204,8 +1105,8 @@ add_stt_entries (struct ctf_context *ccp, int functions)
sym = new (&ccp->of->objfile_obstack) symbol;
OBJSTAT (ccp->of, n_syms++);
sym->set_type (type);
- sym->set_domain (VAR_DOMAIN);
- sym->set_aclass_index (LOC_STATIC);
+ sym->set_domain (functions ? FUNCTION_DOMAIN : VAR_DOMAIN);
+ sym->set_loc_class_index (LOC_STATIC);
sym->compute_and_set_names (tname, false, ccp->of->per_bfd);
add_symbol_to_list (sym, ccp->builder->get_global_symbols ());
set_symbol_address (ccp->of, sym, tname);
@@ -1241,38 +1142,6 @@ get_objfile_text_range (struct objfile *of, size_t *tsize)
return of->text_section_offset ();
}
-/* Start a symtab for OBJFILE in CTF format. */
-
-static void
-ctf_start_compunit_symtab (ctf_psymtab *pst,
- struct objfile *of, CORE_ADDR text_offset)
-{
- struct ctf_context *ccp;
-
- ccp = &pst->context;
- ccp->builder = new buildsym_compunit
- (of, pst->filename, nullptr,
- language_c, text_offset);
- ccp->builder->record_debugformat ("ctf");
-}
-
-/* Finish reading symbol/type definitions in CTF format.
- END_ADDR is the end address of the file's text. */
-
-static struct compunit_symtab *
-ctf_end_compunit_symtab (ctf_psymtab *pst,
- CORE_ADDR end_addr)
-{
- struct ctf_context *ccp;
-
- ccp = &pst->context;
- struct compunit_symtab *result
- = ccp->builder->end_compunit_symtab (end_addr);
- delete ccp->builder;
- ccp->builder = nullptr;
- return result;
-}
-
/* Add all members of an enum with type TID to partial symbol table. */
static void
@@ -1282,7 +1151,7 @@ ctf_psymtab_add_enums (struct ctf_context *ccp, ctf_id_t tid)
const char *ename;
ctf_next_t *i = nullptr;
- while ((ename = ctf_enum_next (ccp->fp, tid, &i, &val)) != nullptr)
+ while ((ename = ctf_enum_next (ccp->dict, tid, &i, &val)) != nullptr)
{
ccp->pst->add_psymbol (ename, true,
VAR_DOMAIN, LOC_CONST, -1,
@@ -1290,48 +1159,35 @@ ctf_psymtab_add_enums (struct ctf_context *ccp, ctf_id_t tid)
unrelocated_addr (0),
language_c, ccp->partial_symtabs, ccp->of);
}
- if (ctf_errno (ccp->fp) != ECTF_NEXT_END)
+ if (ctf_errno (ccp->dict) != ECTF_NEXT_END)
complaint (_("ctf_enum_next ctf_psymtab_add_enums failed - %s"),
- ctf_errmsg (ctf_errno (ccp->fp)));
+ ctf_errmsg (ctf_errno (ccp->dict)));
}
/* Add entries in either data objects or function info section, controlled
by FUNCTIONS, to psymtab. */
static void
-ctf_psymtab_add_stt_entries (ctf_dict_t *cfp, ctf_psymtab *pst,
+ctf_psymtab_add_stt_entries (ctf_dict_t *dict, ctf_psymtab *pst,
struct objfile *of, int functions)
{
ctf_next_t *i = nullptr;
ctf_id_t tid;
const char *tname;
- while ((tid = ctf_symbol_next (cfp, &i, &tname, functions)) != CTF_ERR)
+ while ((tid = ctf_symbol_next (dict, &i, &tname, functions)) != CTF_ERR)
{
- uint32_t kind = ctf_type_kind (cfp, tid);
- address_class aclass;
- domain_enum tdomain;
- switch (kind)
- {
- case CTF_K_STRUCT:
- case CTF_K_UNION:
- case CTF_K_ENUM:
- tdomain = STRUCT_DOMAIN;
- break;
- default:
- tdomain = VAR_DOMAIN;
- break;
- }
+ uint32_t kind = ctf_type_kind (dict, tid);
+ location_class loc_class;
+ domain_enum tdomain = functions ? FUNCTION_DOMAIN : VAR_DOMAIN;
if (kind == CTF_K_FUNCTION)
- aclass = LOC_STATIC;
- else if (kind == CTF_K_CONST)
- aclass = LOC_CONST;
+ loc_class = LOC_BLOCK;
else
- aclass = LOC_TYPEDEF;
+ loc_class = LOC_STATIC;
pst->add_psymbol (tname, true,
- tdomain, aclass, -1,
+ tdomain, loc_class, -1,
psymbol_placement::GLOBAL,
unrelocated_addr (0),
language_c, pst->context.partial_symtabs, of);
@@ -1341,19 +1197,19 @@ ctf_psymtab_add_stt_entries (ctf_dict_t *cfp, ctf_psymtab *pst,
/* Add entries in data objects section to psymtab. */
static void
-ctf_psymtab_add_stt_obj (ctf_dict_t *cfp, ctf_psymtab *pst,
+ctf_psymtab_add_stt_obj (ctf_dict_t *dict, ctf_psymtab *pst,
struct objfile *of)
{
- ctf_psymtab_add_stt_entries (cfp, pst, of, 0);
+ ctf_psymtab_add_stt_entries (dict, pst, of, 0);
}
/* Add entries in function info section to psymtab. */
static void
-ctf_psymtab_add_stt_func (ctf_dict_t *cfp, ctf_psymtab *pst,
+ctf_psymtab_add_stt_func (ctf_dict_t *dict, ctf_psymtab *pst,
struct objfile *of)
{
- ctf_psymtab_add_stt_entries (cfp, pst, of, 1);
+ ctf_psymtab_add_stt_entries (dict, pst, of, 1);
}
/* Read in full symbols for PST, and anything it depends on. */
@@ -1368,15 +1224,15 @@ ctf_psymtab::expand_psymtab (struct objfile *objfile)
ccp = &context;
/* Iterate over entries in data types section. */
- if (ctf_type_iter (ccp->fp, ctf_add_type_cb, ccp) == CTF_ERR)
+ if (ctf_type_iter (ccp->dict, ctf_add_type_cb, ccp) == CTF_ERR)
complaint (_("ctf_type_iter psymtab_to_symtab failed - %s"),
- ctf_errmsg (ctf_errno (ccp->fp)));
+ ctf_errmsg (ctf_errno (ccp->dict)));
/* Iterate over entries in variable info section. */
- if (ctf_variable_iter (ccp->fp, ctf_add_var_cb, ccp) == CTF_ERR)
+ if (ctf_variable_iter (ccp->dict, ctf_add_var_cb, ccp) == CTF_ERR)
complaint (_("ctf_variable_iter psymtab_to_symtab failed - %s"),
- ctf_errmsg (ctf_errno (ccp->fp)));
+ ctf_errmsg (ctf_errno (ccp->dict)));
/* Add entries in data objects and function info sections. */
add_stt_obj (ccp);
@@ -1406,12 +1262,18 @@ ctf_psymtab::read_symtab (struct objfile *objfile)
size_t tsize;
offset = get_objfile_text_range (objfile, &tsize);
- ctf_start_compunit_symtab (this, objfile, offset);
+
+ buildsym_compunit builder (objfile, this->filename, nullptr,
+ language_c, offset);
+ builder.record_debugformat ("ctf");
+ scoped_restore store_builder
+ = make_scoped_restore (&context.builder, &builder);
+
expand_psymtab (objfile);
set_text_low (unrelocated_addr (0));
set_text_high (unrelocated_addr (tsize));
- compunit_symtab = ctf_end_compunit_symtab (this, offset + tsize);
+ compunit_symtab = builder.end_compunit_symtab (offset + tsize);
/* Finish up the debug error message. */
if (info_verbose)
@@ -1434,7 +1296,7 @@ ctf_psymtab::read_symtab (struct objfile *objfile)
static ctf_psymtab *
create_partial_symtab (const char *name,
ctf_archive_t *arc,
- ctf_dict_t *cfp,
+ ctf_dict_t *dict,
psymtab_storage *partial_symtabs,
struct objfile *objfile)
{
@@ -1444,7 +1306,7 @@ create_partial_symtab (const char *name,
unrelocated_addr (0));
pst->context.arc = arc;
- pst->context.fp = cfp;
+ pst->context.dict = dict;
pst->context.of = objfile;
pst->context.partial_symtabs = partial_symtabs;
pst->context.pst = pst;
@@ -1465,52 +1327,42 @@ ctf_psymtab_type_cb (ctf_id_t tid, void *arg)
ccp = (struct ctf_context *) arg;
domain_enum domain = UNDEF_DOMAIN;
- enum address_class aclass = LOC_UNDEF;
- kind = ctf_type_kind (ccp->fp, tid);
+ location_class loc_class = LOC_UNDEF;
+ kind = ctf_type_kind (ccp->dict, tid);
switch (kind)
{
- case CTF_K_ENUM:
- ctf_psymtab_add_enums (ccp, tid);
- [[fallthrough]];
- case CTF_K_STRUCT:
- case CTF_K_UNION:
- domain = STRUCT_DOMAIN;
- aclass = LOC_TYPEDEF;
- break;
- case CTF_K_FUNCTION:
- case CTF_K_FORWARD:
- domain = VAR_DOMAIN;
- aclass = LOC_STATIC;
- section = SECT_OFF_TEXT (ccp->of);
- break;
- case CTF_K_CONST:
- domain = VAR_DOMAIN;
- aclass = LOC_STATIC;
- break;
- case CTF_K_TYPEDEF:
- case CTF_K_POINTER:
- case CTF_K_VOLATILE:
- case CTF_K_RESTRICT:
- domain = VAR_DOMAIN;
- aclass = LOC_TYPEDEF;
- break;
- case CTF_K_INTEGER:
- case CTF_K_FLOAT:
- domain = VAR_DOMAIN;
- aclass = LOC_TYPEDEF;
- break;
- case CTF_K_ARRAY:
- case CTF_K_UNKNOWN:
- return 0;
+ case CTF_K_ENUM:
+ ctf_psymtab_add_enums (ccp, tid);
+ [[fallthrough]];
+ case CTF_K_STRUCT:
+ case CTF_K_UNION:
+ domain = STRUCT_DOMAIN;
+ loc_class = LOC_TYPEDEF;
+ break;
+ case CTF_K_FUNCTION:
+ case CTF_K_FORWARD:
+ case CTF_K_CONST:
+ case CTF_K_TYPEDEF:
+ case CTF_K_POINTER:
+ case CTF_K_VOLATILE:
+ case CTF_K_RESTRICT:
+ case CTF_K_INTEGER:
+ case CTF_K_FLOAT:
+ case CTF_K_ARRAY:
+ domain = TYPE_DOMAIN;
+ loc_class = LOC_TYPEDEF;
+ break;
+ case CTF_K_UNKNOWN:
+ return 0;
}
- const char *name = ctf_type_name_raw (ccp->fp, tid);
- if (name == nullptr || strlen (name) == 0)
+ const char *name = ctf_type_name_raw (ccp->dict, tid);
+ if (name == nullptr || *name == '\0')
return 0;
ccp->pst->add_psymbol (name, false,
- domain, aclass, section,
- psymbol_placement::STATIC,
+ domain, loc_class, section,
+ psymbol_placement::GLOBAL,
unrelocated_addr (0),
language_c, ccp->partial_symtabs, ccp->of);
@@ -1524,8 +1376,12 @@ ctf_psymtab_var_cb (const char *name, ctf_id_t id, void *arg)
{
struct ctf_context *ccp = (struct ctf_context *) arg;
+ uint32_t kind = ctf_type_kind (ccp->dict, id);
ccp->pst->add_psymbol (name, true,
- VAR_DOMAIN, LOC_STATIC, -1,
+ kind == CTF_K_FUNCTION
+ ? FUNCTION_DOMAIN
+ : VAR_DOMAIN,
+ LOC_STATIC, -1,
psymbol_placement::GLOBAL,
unrelocated_addr (0),
language_c, ccp->partial_symtabs, ccp->of);
@@ -1536,7 +1392,7 @@ ctf_psymtab_var_cb (const char *name, ctf_id_t id, void *arg)
debugging information is available. */
static void
-scan_partial_symbols (ctf_dict_t *cfp, psymtab_storage *partial_symtabs,
+scan_partial_symbols (ctf_dict_t *dict, psymtab_storage *partial_symtabs,
struct ctf_per_tu_data *tup, const char *fname)
{
struct objfile *of = tup->of;
@@ -1548,26 +1404,26 @@ scan_partial_symbols (ctf_dict_t *cfp, psymtab_storage *partial_symtabs,
isparent = true;
}
- ctf_psymtab *pst = create_partial_symtab (fname, tup->arc, cfp,
+ ctf_psymtab *pst = create_partial_symtab (fname, tup->arc, dict,
partial_symtabs, of);
struct ctf_context *ccx = &pst->context;
if (isparent == false)
ccx->pst = pst;
- if (ctf_type_iter (cfp, ctf_psymtab_type_cb, ccx) == CTF_ERR)
+ if (ctf_type_iter (dict, ctf_psymtab_type_cb, ccx) == CTF_ERR)
complaint (_("ctf_type_iter scan_partial_symbols failed - %s"),
- ctf_errmsg (ctf_errno (cfp)));
+ ctf_errmsg (ctf_errno (dict)));
- if (ctf_variable_iter (cfp, ctf_psymtab_var_cb, ccx) == CTF_ERR)
+ if (ctf_variable_iter (dict, ctf_psymtab_var_cb, ccx) == CTF_ERR)
complaint (_("ctf_variable_iter scan_partial_symbols failed - %s"),
- ctf_errmsg (ctf_errno (cfp)));
+ ctf_errmsg (ctf_errno (dict)));
/* Scan CTF object and function sections which correspond to each
STT_FUNC or STT_OBJECT entry in the symbol table,
pick up what init_symtab has done. */
- ctf_psymtab_add_stt_obj (cfp, pst, of);
- ctf_psymtab_add_stt_func (cfp, pst, of);
+ ctf_psymtab_add_stt_obj (dict, pst, of);
+ ctf_psymtab_add_stt_func (dict, pst, of);
pst->end ();
}
@@ -1578,7 +1434,7 @@ static int
build_ctf_archive_member (ctf_dict_t *ctf, const char *name, void *arg)
{
struct ctf_per_tu_data *tup = (struct ctf_per_tu_data *) arg;
- ctf_dict_t *parent = tup->fp;
+ ctf_dict_t *parent = tup->dict;
if (strcmp (name, ".ctf") != 0)
ctf_import (ctf, parent);
@@ -1611,13 +1467,13 @@ elfctf_build_psymtabs (struct objfile *of)
error (_("ctf_bfdopen failed on %s - %s"),
bfd_get_filename (abfd), ctf_errmsg (err));
- ctf_dict_t *fp = ctf_dict_open (arc, NULL, &err);
- if (fp == nullptr)
+ ctf_dict_t *dict = ctf_dict_open (arc, NULL, &err);
+ if (dict == nullptr)
error (_("ctf_dict_open failed on %s - %s"),
bfd_get_filename (abfd), ctf_errmsg (err));
- ctf_dict_key.emplace (of, fp);
+ ctf_dict_key.emplace (of, dict);
- pcu.fp = fp;
+ pcu.dict = dict;
pcu.of = of;
pcu.arc = arc;
diff --git a/gdb/ctfread.h b/gdb/ctfread.h
index 711a1dd..d1323d4 100644
--- a/gdb/ctfread.h
+++ b/gdb/ctfread.h
@@ -1,6 +1,6 @@
/* CTF debugging format support for GDB.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/d-exp.y b/gdb/d-exp.y
index df89cb6..e774dee 100644
--- a/gdb/d-exp.y
+++ b/gdb/d-exp.y
@@ -1,6 +1,6 @@
/* YACC parser for D expressions, for GDB.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -38,7 +38,6 @@
%{
-#include <ctype.h>
#include "expression.h"
#include "value.h"
#include "parser-defs.h"
@@ -444,7 +443,7 @@ PrimaryExpression:
sym = lookup_symbol (copy.c_str (),
pstate->expression_context_block,
SEARCH_VFT, &is_a_field_of_this);
- if (sym.symbol && sym.symbol->aclass () != LOC_TYPEDEF)
+ if (sym.symbol && sym.symbol->loc_class () != LOC_TYPEDEF)
{
if (symbol_read_needs_frame (sym.symbol))
pstate->block_tracker->update (sym);
@@ -614,11 +613,9 @@ BasicType2:
| '*' BasicType2
{ type_stack->push (tp_pointer); }
| '[' INTEGER_LITERAL ']'
- { type_stack->push ($2.val);
- type_stack->push (tp_array); }
+ { type_stack->push (tp_array, $2.val); }
| '[' INTEGER_LITERAL ']' BasicType2
- { type_stack->push ($2.val);
- type_stack->push (tp_array); }
+ { type_stack->push (tp_array, $2.val); }
;
BasicType:
@@ -684,15 +681,15 @@ parse_number (struct parser_state *ps, const char *p,
len = strlen (s);
/* Check suffix for `i' , `fi' or `li' (idouble, ifloat or ireal). */
- if (len >= 1 && tolower (s[len - 1]) == 'i')
+ if (len >= 1 && c_tolower (s[len - 1]) == 'i')
{
- if (len >= 2 && tolower (s[len - 2]) == 'f')
+ if (len >= 2 && c_tolower (s[len - 2]) == 'f')
{
putithere->typed_val_float.type
= parse_d_type (ps)->builtin_ifloat;
len -= 2;
}
- else if (len >= 2 && tolower (s[len - 2]) == 'l')
+ else if (len >= 2 && c_tolower (s[len - 2]) == 'l')
{
putithere->typed_val_float.type
= parse_d_type (ps)->builtin_ireal;
@@ -706,13 +703,13 @@ parse_number (struct parser_state *ps, const char *p,
}
}
/* Check suffix for `f' or `l'' (float or real). */
- else if (len >= 1 && tolower (s[len - 1]) == 'f')
+ else if (len >= 1 && c_tolower (s[len - 1]) == 'f')
{
putithere->typed_val_float.type
= parse_d_type (ps)->builtin_float;
len -= 1;
}
- else if (len >= 1 && tolower (s[len - 1]) == 'l')
+ else if (len >= 1 && c_tolower (s[len - 1]) == 'l')
{
putithere->typed_val_float.type
= parse_d_type (ps)->builtin_real;
@@ -1133,8 +1130,8 @@ lex_one_token (struct parser_state *par_state)
/* Hex exponents start with 'p', because 'e' is a valid hex
digit and thus does not indicate a floating point number
when the radix is hex. */
- if ((!hex && !got_e && tolower (p[0]) == 'e')
- || (hex && !got_e && tolower (p[0] == 'p')))
+ if ((!hex && !got_e && c_tolower (p[0]) == 'e')
+ || (hex && !got_e && c_tolower (p[0] == 'p')))
got_dot = got_e = 1;
/* A '.' always indicates a decimal floating point number
regardless of the radix. If we have a '..' then its the
@@ -1142,7 +1139,8 @@ lex_one_token (struct parser_state *par_state)
else if (!got_dot && (p[0] == '.' && p[1] != '.'))
got_dot = 1;
/* This is the sign of the exponent, not the end of the number. */
- else if (got_e && (tolower (p[-1]) == 'e' || tolower (p[-1]) == 'p')
+ else if (got_e && (c_tolower (p[-1]) == 'e'
+ || c_tolower (p[-1]) == 'p')
&& (*p == '-' || *p == '+'))
continue;
/* We will take any letters or digits, ignoring any embedded '_'.
@@ -1167,9 +1165,9 @@ lex_one_token (struct parser_state *par_state)
const char *p = &tokstart[1];
size_t len = strlen ("entry");
- while (isspace (*p))
+ while (c_isspace (*p))
p++;
- if (strncmp (p, "entry", len) == 0 && !isalnum (p[len])
+ if (strncmp (p, "entry", len) == 0 && !c_isalnum (p[len])
&& p[len] != '_')
{
pstate->lexptr = &p[len];
@@ -1334,7 +1332,7 @@ classify_name (struct parser_state *par_state, const struct block *block)
std::string copy = copy_name (yylval.sval);
sym = lookup_symbol (copy.c_str (), block, SEARCH_VFT, &is_a_field_of_this);
- if (sym.symbol && sym.symbol->aclass () == LOC_TYPEDEF)
+ if (sym.symbol && sym.symbol->loc_class () == LOC_TYPEDEF)
{
yylval.tsym.type = sym.symbol->type ();
return TYPENAME;
@@ -1383,7 +1381,7 @@ classify_inner_name (struct parser_state *par_state,
if (yylval.ssym.sym.symbol == NULL)
return ERROR;
- if (yylval.ssym.sym.symbol->aclass () == LOC_TYPEDEF)
+ if (yylval.ssym.sym.symbol->loc_class () == LOC_TYPEDEF)
{
yylval.tsym.type = yylval.ssym.sym.symbol->type ();
return TYPENAME;
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 32d9cc8..0119a01 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -1,6 +1,6 @@
/* D language support routines for GDB, the GNU debugger.
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/d-lang.h b/gdb/d-lang.h
index 8a94447..41615e0 100644
--- a/gdb/d-lang.h
+++ b/gdb/d-lang.h
@@ -1,6 +1,6 @@
/* D language support definitions for GDB, the GNU debugger.
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/d-namespace.c b/gdb/d-namespace.c
index 530349e..b5e046e 100644
--- a/gdb/d-namespace.c
+++ b/gdb/d-namespace.c
@@ -1,6 +1,6 @@
/* Helper routines for D support in GDB.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c
index 543bb19..bf2c44e 100644
--- a/gdb/d-valprint.c
+++ b/gdb/d-valprint.c
@@ -1,6 +1,6 @@
/* Support for printing D values for GDB, the GNU debugger.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c
index 0157dfb..3ec49af 100644
--- a/gdb/darwin-nat-info.c
+++ b/gdb/darwin-nat-info.c
@@ -1,5 +1,5 @@
/* Darwin support for GDB, the GNU debugger.
- Copyright (C) 1997-2024 Free Software Foundation, Inc.
+ Copyright (C) 1997-2025 Free Software Foundation, Inc.
Contributed by Apple Computer, Inc.
@@ -839,9 +839,7 @@ info_mach_exceptions_command (const char *args, int from_tty)
}
}
-void _initialize_darwin_info_commands ();
-void
-_initialize_darwin_info_commands ()
+INIT_GDB_FILE (darwin_info_commands)
{
add_info ("mach-tasks", info_mach_tasks_command,
_("Get list of tasks in system."));
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index ea47344..a767657 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1,5 +1,5 @@
/* Darwin support for GDB, the GNU debugger.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
Contributed by AdaCore.
@@ -47,7 +47,6 @@
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
-#include <ctype.h>
#include <sys/sysctl.h>
#include <sys/proc.h>
#include <libproc.h>
@@ -1691,7 +1690,7 @@ darwin_attach_pid (struct inferior *inf)
static struct thread_info *
thread_info_from_private_thread_info (darwin_thread_info *pti)
{
- for (struct thread_info *it : all_threads ())
+ for (struct thread_info &it : all_threads ())
{
darwin_thread_info *iter_pti = get_darwin_thread_info (it);
@@ -1853,7 +1852,7 @@ copy_shell_to_cache (const char *shell, const std::string &new_name)
error (_("Could not open shell (%s) for reading: %s"),
shell, safe_strerror (errno));
- std::string new_dir = ldirname (new_name.c_str ());
+ std::string new_dir = gdb_ldirname (new_name.c_str ());
if (!mkdir_recursive (new_dir.c_str ()))
error (_("Could not make cache directory \"%s\": %s"),
new_dir.c_str (), safe_strerror (errno));
@@ -2469,9 +2468,7 @@ darwin_nat_target::supports_multi_process ()
return true;
}
-void _initialize_darwin_nat ();
-void
-_initialize_darwin_nat ()
+INIT_GDB_FILE (darwin_nat)
{
kern_return_t kret;
diff --git a/gdb/darwin-nat.h b/gdb/darwin-nat.h
index 4ead0ea..90bf293 100644
--- a/gdb/darwin-nat.h
+++ b/gdb/darwin-nat.h
@@ -1,5 +1,5 @@
/* Common things used by the various darwin files
- Copyright (C) 1995-2024 Free Software Foundation, Inc.
+ Copyright (C) 1995-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
index c08a68d..d7f4c98 100644
--- a/gdb/data-directory/Makefile.in
+++ b/gdb/data-directory/Makefile.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# Makefile for building a staged copy of the data-directory.
# This file is part of GDB.
@@ -61,6 +61,7 @@ GEN_SYSCALLS_FILES = \
mips-o32-linux.xml \
ppc-linux.xml \
ppc64-linux.xml \
+ riscv-linux.xml \
s390-linux.xml \
s390x-linux.xml \
sparc-linux.xml \
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 9e2e572..260f583 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -1,5 +1,5 @@
/* Read dbx symbol tables and convert to internal format, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -248,9 +248,7 @@ static const struct sym_fns aout_sym_fns =
NULL, /* sym_probe_fns */
};
-void _initialize_dbxread ();
-void
-_initialize_dbxread ()
+INIT_GDB_FILE (dbxread)
{
add_symtab_fns (bfd_target_aout_flavour, &aout_sym_fns);
}
diff --git a/gdb/dcache.c b/gdb/dcache.c
index 2f40d27..7a15278 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -1,6 +1,6 @@
/* Caching code for GDB, the GNU debugger.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -679,9 +679,7 @@ set_dcache_line_size (const char *args, int from_tty,
target_dcache_invalidate (current_program_space->aspace);
}
-void _initialize_dcache ();
-void
-_initialize_dcache ()
+INIT_GDB_FILE (dcache)
{
add_setshow_boolean_cmd ("remotecache", class_support,
&dcache_enabled_p, _("\
diff --git a/gdb/dcache.h b/gdb/dcache.h
index 21f49e5..6a99541 100644
--- a/gdb/dcache.h
+++ b/gdb/dcache.h
@@ -1,7 +1,7 @@
/* Declarations for caching. Typically used by remote back ends for
caching remote memory.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/debug.c b/gdb/debug.c
index f7d2451..b6a3f1d 100644
--- a/gdb/debug.c
+++ b/gdb/debug.c
@@ -1,6 +1,6 @@
/* Debug printing functions.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
index 2ae7228..e99c13b 100644
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -1,5 +1,5 @@
/* debuginfod utilities for GDB.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,6 +18,7 @@
#include "diagnostics.h"
#include <errno.h>
+#include "gdbsupport/cleanups.h"
#include "gdbsupport/scoped_fd.h"
#include "debuginfod-support.h"
#include <optional>
@@ -594,9 +595,7 @@ maint_get_debuginfod_download_sections ()
/* Register debuginfod commands. */
-void _initialize_debuginfod ();
-void
-_initialize_debuginfod ()
+INIT_GDB_FILE (debuginfod)
{
/* set/show debuginfod */
add_setshow_prefix_cmd ("debuginfod", class_run,
diff --git a/gdb/debuginfod-support.h b/gdb/debuginfod-support.h
index 2b396dc..764c335 100644
--- a/gdb/debuginfod-support.h
+++ b/gdb/debuginfod-support.h
@@ -1,5 +1,5 @@
/* debuginfod utilities for GDB.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/defs.h b/gdb/defs.h
index 5d52e66..147a8d2 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -1,5 +1,5 @@
/* Basic, host-specific, and target-specific definitions for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -190,8 +190,6 @@ extern std::string relocate_gdb_directory (const char *initial, bool relocatable
/* From top.c */
-typedef void initialize_file_ftype (void);
-
extern char *gdb_readline_wrapper (const char *);
extern const char *command_line_input (std::string &cmd_line_buffer,
@@ -227,8 +225,8 @@ extern const char *pc_prefix (CORE_ADDR);
DATA is passed without changes from a caller. */
typedef int (*find_memory_region_ftype) (CORE_ADDR addr, unsigned long size,
- int read, int write, int exec,
- int modified, bool memory_tagged,
+ bool read, bool write, bool exec,
+ bool modified, bool memory_tagged,
void *data);
/* * Possible lvalue types. Like enum language, this should be in
@@ -407,4 +405,10 @@ DEF_ENUM_FLAGS_TYPE (enum user_selected_what_flag, user_selected_what);
#include "utils.h"
+/* File initialization macro. This is found by make-init-c and used
+ to construct the gdb initialization function. */
+#define INIT_GDB_FILE(NAME) \
+ extern void _initialize_ ## NAME (); \
+ void _initialize_ ## NAME ()
+
#endif /* GDB_DEFS_H */
diff --git a/gdb/dicos-tdep.c b/gdb/dicos-tdep.c
index 96b841a..d6bc9a5 100644
--- a/gdb/dicos-tdep.c
+++ b/gdb/dicos-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent, architecture-independent code for DICOS, for GDB.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -27,7 +27,7 @@
void
dicos_init_abi (struct gdbarch *gdbarch)
{
- set_gdbarch_so_ops (gdbarch, &solib_target_so_ops);
+ set_gdbarch_make_solib_ops (gdbarch, make_target_solib_ops);
/* Every process, although has its own address space, sees the same
list of shared libraries. There's no "main executable" in DICOS,
diff --git a/gdb/dicos-tdep.h b/gdb/dicos-tdep.h
index 5305deb..920cf3f 100644
--- a/gdb/dicos-tdep.h
+++ b/gdb/dicos-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent, architecture-independent code for DICOS, for GDB.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
index f673877..e53331b 100644
--- a/gdb/dictionary.c
+++ b/gdb/dictionary.c
@@ -1,6 +1,6 @@
/* Routines for name->symbol lookups in GDB.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
Contributed by David Carlton <carlton@bactrian.org> and by Kealia,
Inc.
@@ -20,12 +20,10 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include <ctype.h>
#include "gdbsupport/gdb_obstack.h"
#include "symtab.h"
#include "buildsym.h"
#include "dictionary.h"
-#include "gdbsupport/gdb-safe-ctype.h"
#include "gdbsupport/unordered_map.h"
#include "language.h"
@@ -772,7 +770,7 @@ language_defn::search_name_hash (const char *string0) const
if (c == 'B' && string[3] == '_')
{
- for (string += 4; ISDIGIT (*string); ++string)
+ for (string += 4; c_isdigit (*string); ++string)
;
continue;
}
@@ -952,14 +950,9 @@ mdict_create_hashed (struct obstack *obstack,
retval->n_allocated_dictionaries = nsyms.size ();
int idx = 0;
- for (const auto &pair : nsyms)
- {
- enum language language = pair.first;
- std::vector<symbol *> symlist = pair.second;
-
- retval->dictionaries[idx++]
- = dict_create_hashed (obstack, language, symlist);
- }
+ for (const auto &[language, symlist] : nsyms)
+ retval->dictionaries[idx++] = dict_create_hashed (obstack, language,
+ symlist);
return retval;
}
@@ -997,14 +990,9 @@ mdict_create_linear (struct obstack *obstack,
retval->n_allocated_dictionaries = nsyms.size ();
int idx = 0;
- for (const auto &pair : nsyms)
- {
- enum language language = pair.first;
- std::vector<symbol *> symlist = pair.second;
-
- retval->dictionaries[idx++]
- = dict_create_linear (obstack, language, symlist);
- }
+ for (const auto &[language, symlist] : nsyms)
+ retval->dictionaries[idx++] = dict_create_linear (obstack, language,
+ symlist);
return retval;
}
@@ -1135,10 +1123,8 @@ mdict_add_pending (struct multidictionary *mdict,
gdb::unordered_map<enum language, std::vector<symbol *>> nsyms
= collate_pending_symbols_by_language (symbol_list);
- for (const auto &pair : nsyms)
+ for (const auto &[language, symlist] : nsyms)
{
- enum language language = pair.first;
- std::vector<symbol *> symlist = pair.second;
struct dictionary *dict = find_language_dictionary (mdict, language);
if (dict == nullptr)
diff --git a/gdb/dictionary.h b/gdb/dictionary.h
index 79b2f70..530cd99 100644
--- a/gdb/dictionary.h
+++ b/gdb/dictionary.h
@@ -1,6 +1,6 @@
/* Routines for name->symbol lookups in GDB.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
Contributed by David Carlton <carlton@bactrian.org> and by Kealia,
Inc.
diff --git a/gdb/disable-implicit-rules.mk b/gdb/disable-implicit-rules.mk
index 2a4aade..1a2bb74 100644
--- a/gdb/disable-implicit-rules.mk
+++ b/gdb/disable-implicit-rules.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This file is part of GDB.
diff --git a/gdb/disasm-flags.h b/gdb/disasm-flags.h
index 9f48d98..67415a1 100644
--- a/gdb/disasm-flags.h
+++ b/gdb/disasm-flags.h
@@ -1,6 +1,6 @@
/* Disassemble flags for GDB.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/disasm-selftests.c b/gdb/disasm-selftests.c
index 97bda8d..0d06065 100644
--- a/gdb/disasm-selftests.c
+++ b/gdb/disasm-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for disassembler for GDB, the GNU debugger.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,6 +21,7 @@
#include "gdbsupport/selftest.h"
#include "selftest-arch.h"
#include "gdbarch.h"
+#include "disasm-selftests.h"
namespace selftests {
@@ -329,11 +330,95 @@ memory_error_test (struct gdbarch *gdbarch)
SELF_CHECK (saw_memory_error);
}
-} /* namespace selftests */
+/* Disassemble INSN (a GDBARCH insn), and return the result. */
+
+static std::string
+disassemble_one_insn_to_string (struct gdbarch *gdbarch,
+ gdb::array_view<const gdb_byte> insn)
+{
+ string_file buffer;
+
+ class gdb_disassembler_test : public gdb_disassembler
+ {
+ public:
+
+ explicit gdb_disassembler_test (struct gdbarch *gdbarch,
+ gdb::array_view<const gdb_byte> insn,
+ string_file &buffer)
+ : gdb_disassembler (gdbarch,
+ &buffer,
+ gdb_disassembler_test::read_memory),
+ m_insn (insn)
+ {
+ }
+
+ int
+ print_insn (CORE_ADDR memaddr)
+ {
+ try
+ {
+ return gdb_disassembler::print_insn (memaddr);
+ }
+ catch (const gdb_exception_error &)
+ {
+ return -1;
+ }
+ }
+
+ private:
+ gdb::array_view<const gdb_byte> m_insn;
+
+ static int read_memory (bfd_vma memaddr, gdb_byte *myaddr,
+ unsigned int len,
+ struct disassemble_info *info) noexcept
+ {
+ gdb_disassembler_test *self
+ = static_cast<gdb_disassembler_test *>(info->application_data);
+
+ if (len > self->m_insn.size ())
+ return -1;
+
+ for (size_t i = 0; i < len; i++)
+ myaddr[i] = self->m_insn[i];
+
+ return 0;
+ }
+ };
+
+ gdb_disassembler_test di (gdbarch, insn, buffer);
+ if (di.print_insn (0) != insn.size ())
+ return "";
+
+ return buffer.string ();
+}
+
+/* See disasm-selftests.h. */
-void _initialize_disasm_selftests ();
void
-_initialize_disasm_selftests ()
+disassemble_insn (gdbarch *gdbarch, gdb::byte_vector &insn,
+ const std::string &expected)
+{
+ std::string buffer
+ = disassemble_one_insn_to_string (gdbarch, insn);
+
+ bool check_ok = buffer == expected;
+
+ if (run_verbose () || !check_ok)
+ {
+ for (gdb_byte b : insn)
+ debug_printf ("0x%02x ", b);
+ debug_printf ("-> %s\n", buffer.c_str ());
+ }
+
+ if (!check_ok)
+ debug_printf ("expected: %s\n", expected.c_str ());
+
+ SELF_CHECK (check_ok);
+}
+
+} /* namespace selftests */
+
+INIT_GDB_FILE (disasm_selftests)
{
selftests::register_test_foreach_arch ("print_one_insn",
selftests::print_one_insn_test);
diff --git a/gdb/disasm-selftests.h b/gdb/disasm-selftests.h
new file mode 100644
index 0000000..29acf87
--- /dev/null
+++ b/gdb/disasm-selftests.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef GDB_DISASM_SELFTESTS_H
+#define GDB_DISASM_SELFTESTS_H
+
+namespace selftests
+{
+
+/* Check that disassembly of INSN (a GDBARCH insn) matches EXPECTED. */
+
+void
+disassemble_insn (gdbarch *gdbarch, gdb::byte_vector &insn,
+ const std::string &expected);
+
+}
+
+#endif /* GDB_DISASM_SELFTESTS_H */
diff --git a/gdb/disasm.c b/gdb/disasm.c
index 11d6efd..73b094b 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -1,6 +1,6 @@
/* Disassemble support for GDB.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -28,7 +28,6 @@
#include "cli/cli-cmds.h"
#include "dis-asm.h"
#include "source.h"
-#include "gdbsupport/gdb-safe-ctype.h"
#include <algorithm>
#include <optional>
#include "valprint.h"
@@ -1270,7 +1269,6 @@ set_disassembler_options (const char *prospective_options)
= make_unique_xstrdup (prospective_options);
char *options = remove_whitespace_and_extra_commas
(prospective_options_local.get ());
- const char *opt;
/* Allow all architectures, even ones that do not support 'set disassembler',
to reset their disassembler options to NULL. */
@@ -1292,9 +1290,13 @@ set_disassembler_options (const char *prospective_options)
valid_options = &valid_options_and_args->options;
/* Verify we have valid disassembler options. */
- FOR_EACH_DISASSEMBLER_OPTION (opt, options)
+ char *opt = options;
+ while (1)
{
size_t i;
+ char *opt_end = strchr (opt, ',');
+ if (opt_end)
+ *opt_end = 0;
for (i = 0; valid_options->name[i] != NULL; i++)
if (valid_options->arg != NULL && valid_options->arg[i] != NULL)
{
@@ -1309,8 +1311,7 @@ set_disassembler_options (const char *prospective_options)
if (valid_options->arg[i]->values == NULL)
break;
for (j = 0; valid_options->arg[i]->values[j] != NULL; j++)
- if (disassembler_options_cmp
- (arg, valid_options->arg[i]->values[j]) == 0)
+ if (strcmp (arg, valid_options->arg[i]->values[j]) == 0)
{
found = true;
break;
@@ -1318,7 +1319,7 @@ set_disassembler_options (const char *prospective_options)
if (found)
break;
}
- else if (disassembler_options_cmp (opt, valid_options->name[i]) == 0)
+ else if (strcmp (opt, valid_options->name[i]) == 0)
break;
if (valid_options->name[i] == NULL)
{
@@ -1327,6 +1328,10 @@ set_disassembler_options (const char *prospective_options)
opt);
return;
}
+ if (!opt_end)
+ break;
+ *opt_end = ',';
+ opt = opt_end + 1;
}
*disassembler_options = options;
@@ -1470,9 +1475,7 @@ disassembler_options_completer (struct cmd_list_element *ignore,
/* Initialization code. */
-void _initialize_disasm ();
-void
-_initialize_disasm ()
+INIT_GDB_FILE (disasm)
{
/* Add the command that controls the disassembler options. */
set_show_commands set_show_disas_opts
diff --git a/gdb/disasm.h b/gdb/disasm.h
index be500e5..13ac683 100644
--- a/gdb/disasm.h
+++ b/gdb/disasm.h
@@ -1,5 +1,5 @@
/* Disassemble support for GDB.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/displaced-stepping.c b/gdb/displaced-stepping.c
index ff7f910..6699296 100644
--- a/gdb/displaced-stepping.c
+++ b/gdb/displaced-stepping.c
@@ -1,6 +1,6 @@
/* Displaced stepping related things.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -315,9 +315,7 @@ displaced_step_buffers::restore_in_ptid (ptid_t ptid)
}
}
-void _initialize_displaced_stepping ();
-void
-_initialize_displaced_stepping ()
+INIT_GDB_FILE (displaced_stepping)
{
add_setshow_boolean_cmd ("displaced", class_maintenance,
&debug_displaced, _("\
diff --git a/gdb/displaced-stepping.h b/gdb/displaced-stepping.h
index 7949e5d..16ec1d6 100644
--- a/gdb/displaced-stepping.h
+++ b/gdb/displaced-stepping.h
@@ -1,6 +1,6 @@
/* Displaced stepping related things.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -246,7 +246,7 @@ private:
std::vector<displaced_step_buffer> m_buffers;
};
-/* Default implemention of target_ops::supports_displaced_step.
+/* Default implementation of target_ops::supports_displaced_step.
Forwards the call to the architecture of THREAD. */
diff --git a/gdb/doc/Doxyfile-base.in b/gdb/doc/Doxyfile-base.in
index 709a013..dc42b53 100644
--- a/gdb/doc/Doxyfile-base.in
+++ b/gdb/doc/Doxyfile-base.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# Base doxyfile for GDB.
# This file is part of GDB.
diff --git a/gdb/doc/Doxyfile-gdb-api.in b/gdb/doc/Doxyfile-gdb-api.in
index d3ba254..b4d6d5f 100644
--- a/gdb/doc/Doxyfile-gdb-api.in
+++ b/gdb/doc/Doxyfile-gdb-api.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# Doxygen file for GDB internal API.
# This file is part of GDB.
diff --git a/gdb/doc/Doxyfile-gdb-xref.in b/gdb/doc/Doxyfile-gdb-xref.in
index 3ec76b8..ce5aaaa 100644
--- a/gdb/doc/Doxyfile-gdb-xref.in
+++ b/gdb/doc/Doxyfile-gdb-xref.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# Doxygen file for a full GDB cross-reference.
# This file is part of GDB.
diff --git a/gdb/doc/Doxyfile-gdbserver.in b/gdb/doc/Doxyfile-gdbserver.in
index 0f7b34b..c130115 100644
--- a/gdb/doc/Doxyfile-gdbserver.in
+++ b/gdb/doc/Doxyfile-gdbserver.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# Doxygen file for a GDBserver cross-reference.
# This file is part of GDB.
diff --git a/gdb/doc/Makefile.in b/gdb/doc/Makefile.in
index c75714b..b9c79b9 100644
--- a/gdb/doc/Makefile.in
+++ b/gdb/doc/Makefile.in
@@ -1,4 +1,4 @@
-##Copyright (C) 1991-2024 Free Software Foundation, Inc.
+##Copyright (C) 1991-2025 Free Software Foundation, Inc.
# Makefile for GDB documentation.
# This file is part of GDB.
diff --git a/gdb/doc/agentexpr.texi b/gdb/doc/agentexpr.texi
index b15953f..970f930 100644
--- a/gdb/doc/agentexpr.texi
+++ b/gdb/doc/agentexpr.texi
@@ -7,7 +7,7 @@
@c This file is part of the GDB manual.
@c
-@c Copyright (C) 2003--2024 Free Software Foundation, Inc.
+@c Copyright (C) 2003--2025 Free Software Foundation, Inc.
@c
@c See the file gdb.texinfo for copying conditions.
diff --git a/gdb/doc/all-cfg.texi b/gdb/doc/all-cfg.texi
index 4ba231f..5d2af66 100644
--- a/gdb/doc/all-cfg.texi
+++ b/gdb/doc/all-cfg.texi
@@ -1,6 +1,6 @@
@c GDB MANUAL configuration file.
@c
-@c Copyright (C) 1993--2024 Free Software Foundation, Inc.
+@c Copyright (C) 1993--2025 Free Software Foundation, Inc.
@c
@c NOTE: While the GDB manual is configurable (by changing these
@c switches), its configuration is ***NOT*** automatically tied in to
diff --git a/gdb/doc/annotate.texinfo b/gdb/doc/annotate.texinfo
index fdcd5a8..eccdb87 100644
--- a/gdb/doc/annotate.texinfo
+++ b/gdb/doc/annotate.texinfo
@@ -27,7 +27,7 @@
@c cost. Having a smaller cheaper manual helps the GNU Press with its sales.
@copying
-Copyright @copyright{} 1994--2024 Free Software Foundation, Inc.
+Copyright @copyright{} 1994--2025 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
diff --git a/gdb/doc/doxy-index.in b/gdb/doc/doxy-index.in
index 67636bb..2da8658 100644
--- a/gdb/doc/doxy-index.in
+++ b/gdb/doc/doxy-index.in
@@ -1,4 +1,4 @@
-<!-- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2014-2025 Free Software Foundation, Inc.
Navigation page for Doxygen-generated GDB info.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index e034ac5..e0fc0ff 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -1,5 +1,5 @@
\input texinfo @c -*-texinfo-*-
-@c Copyright (C) 1988--2024 Free Software Foundation, Inc.
+@c Copyright (C) 1988--2025 Free Software Foundation, Inc.
@c
@c %**start of header
@c makeinfo ignores cmds prev to setfilename, so its arg cannot make use
@@ -50,7 +50,7 @@
@copying
@c man begin COPYRIGHT
-Copyright @copyright{} 1988-2024 Free Software Foundation, Inc.
+Copyright @copyright{} 1988-2025 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -120,7 +120,7 @@ This is the @value{EDITION} Edition, for @value{GDBN}
@end ifset
Version @value{GDBVN}.
-Copyright (C) 1988-2024 Free Software Foundation, Inc.
+Copyright (C) 1988-2025 Free Software Foundation, Inc.
This edition of the GDB manual is dedicated to the memory of Fred
Fish. Fred was a long-standing contributor to GDB and to Free
@@ -898,14 +898,17 @@ debugger attached to a bare board, there may not be any notion of
``process'', and there is often no way to get a core dump. @value{GDBN}
will warn you if it is unable to attach or to read core dumps.
-You can optionally have @code{@value{GDBP}} pass any arguments after the
-executable file to the inferior using @code{--args}. This option stops
-option processing.
+You can optionally have @code{@value{GDBP}} pass any arguments after
+the executable file to the inferior using @code{--args} or
+@code{--no-escape-args}. These options stop option processing.
@smallexample
@value{GDBP} --args gcc -O2 -c foo.c
@end smallexample
This will cause @code{@value{GDBP}} to debug @code{gcc}, and to set
-@code{gcc}'s command-line arguments (@pxref{Arguments}) to @samp{-O2 -c foo.c}.
+@code{gcc}'s command-line arguments (@pxref{Arguments}) to @samp{-O2
+-c foo.c}. For the differences between @code{--args} and
+@code{--no-escape-args}, see @ref{--args and --no-escape-args options,
+,@code{--args} and @code{--no-escape-args}}.
You can run @code{@value{GDBP}} without printing the front material, which describes
@value{GDBN}'s non-warranty, by specifying @code{--silent}
@@ -1212,6 +1215,17 @@ Run @value{GDBN} using @var{directory} as its data directory.
The data directory is where @value{GDBN} searches for its
auxiliary files. @xref{Data Files}.
+@item -binary-output
+@cindex @code{--binary-output}
+
+Instructs @value{GDBN} to set the translation mode of its
+@code{stdout}/@code{stderr} to binary. MS-Windows only. Useful for
+running the @value{GDBN} testsuite. By default, @value{GDBN} opens
+@code{stdout}/@code{stderr} in text mode, and translates @samp{\n}
+(LF, a single Line Feed) into @samp{\r\n} (CR-LF, a Carriage
+Return-Line Feed combination). If this option is set, no translation
+is done.
+
@item -fullname
@itemx -f
@cindex @code{--fullname}
@@ -1240,12 +1254,67 @@ that control @value{GDBN}, and level 2 has been deprecated.
The annotation mechanism has largely been superseded by @sc{gdb/mi}
(@pxref{GDB/MI}).
+@anchor{--args and --no-escape-args options}
@item --args
@cindex @code{--args}
Change interpretation of command line so that arguments following the
executable file are passed as command line arguments to the inferior.
This option stops option processing.
+Arguments supplied using @code{--args} will have backslashes applied
+to escape any special shell characters. This ensures that when the
+inferior starts it is passed arguments exactly as @value{GDBN}
+receives them.
+
+For example, consider the following command run under a shell:
+
+@smallexample
+$ @value{GDBP} --args ls *.c
+@end smallexample
+
+@noindent
+In this case the shell will expand @kbd{*.c} at the time @value{GDBN}
+is invoked, not at the time that the inferior is invoked. As a
+result, if an additional @kbd{.c} file is created after @value{GDBN}
+is started, but before the inferior is started, then the inferior will
+not show the file in its output; the list of matching files was
+resolved at the time @value{GDBN} was started.
+
+If you quote the @kbd{*} character used on the @value{GDBN} command
+line argument then this will prevent the shell that starts
+@value{GDBN} from expanding the @kbd{*.c} pattern, however, this
+quoting will also be passed to the shell that @value{GDBN} invokes in
+order to start the inferior (@pxref{set startup-with-shell}), and this
+will prevent the @kbd{*.c} pattern being expanded at this point either:
+
+@smallexample
+$ @value{GDBP} --args ls '*.c'
+(@value{GDBP}) show args
+Argument list to give program being debugged when it is started is "\*.log".
+@end smallexample
+
+@noindent
+If this quoting behaviour does not meet your needs, then you could use
+@code{--no-escape-args} instead, which is described below.
+
+@item --no-escape-args
+@cindex @code{--no-escape-args}
+Change interpretation of command line so that arguments following the
+executable file are passed as command line arguments to the inferior.
+This option stops option processing.
+
+Unlike @code{--args}, arguments after the executable name will not
+have any escaping applied to them. As a result, any special shell
+characters that are not expanded by the shell that invokes
+@value{GDBN} will be expanded by the shell that @value{GDBN} uses to
+start the inferior.
+
+@smallexample
+$ @value{GDBP} --no-escape-args ls '*.c'
+(@value{GDBP}) show args
+Argument list to give program being debugged when it is started is "*.log".
+@end smallexample
+
@item -baud @var{bps}
@itemx -b @var{bps}
@cindex @code{--baud}
@@ -3298,6 +3367,7 @@ elements, even duplicates or overlapping ranges are valid. E.g.@:
To find out what inferiors exist at any moment, use @w{@code{info
inferiors}}:
+@anchor{info inferiors command}
@table @code
@kindex info inferiors [ @var{id}@dots{} ]
@item info inferiors
@@ -3321,10 +3391,14 @@ the connection.
@item
the name of the executable the inferior is running.
-
@end enumerate
@noindent
+If an inferior is currently debugging a core file, then an additional
+line will be printed after the line describing the inferior, this
+additional line gives the file name of the core file being debugged.
+
+@noindent
An asterisk @samp{*} preceding the @value{GDBN} inferior number
indicates the current inferior.
@@ -3336,7 +3410,19 @@ For example,
(@value{GDBP}) info inferiors
Num Description Connection Executable
* 1 process 3401 1 (native) goodbye
+ 2 process 2307 2 (extended0remote host:10000) hello
+@end smallexample
+
+Adding an additional inferior that is debugging a core file causes the
+additional core file line to be displayed, for example@:
+
+@smallexample
+(@value{GDBP}) info inferiors
+ Num Description Connection Executable
+* 1 process 3401 1 (native) goodbye
2 process 2307 2 (extended-remote host:10000) hello
+ 3 process 1578 3 (core) broken
+ core file core.1578
@end smallexample
To get information about the current inferior, use @code{inferior}:
@@ -3439,8 +3525,40 @@ with no connection yet. You can then for example use the @code{target
remote} command to connect to some other @code{gdbserver} instance,
use @code{run} to spawn a local program, etc.
+Not all connections can be shared between inferiors. For example, the
+@code{target core} target is unique for each inferior. That is,
+multiple inferiors can use @code{target core} at the same time, but
+each @code{target core} is different. If you try to
+@code{add-inferior}, and the current inferior is @code{target core},
+then @value{GDBN} will give a warning and create the new inferior
+without a connection, like this@:
+
+@smallexample
+(@value{GDBP}) file test1
+Reading symbols from test1...
+(@value{GDBP}) target core core.test1.433190
+[New LWP 433190]
+Core was generated by `./test1'.
+Program terminated with signal SIGSEGV, Segmentation fault.
+#0 0x0000000000401111 in foo () at test1.c:6
+6 return *global_ptr;
+(@value{GDBP}) add-inferior
+[New inferior 2]
+warning: can't share connection 1 (core) between inferiors
+Added inferior 2
+@end smallexample
+
+Another target that cannot be shared is @code{target remote}
+(@pxref{Connecting,,Types of Remote Connections}). A remote target
+doesn't allow new inferiors to be started, as such creating a new,
+non-running, inferior that shares a remote connection doesn't make
+sense. As with the core target above, if you try to
+@code{add-inferior}, and the current inferior is @code{target remote},
+then @value{GDBN} will give a warning and create the new inferior
+without a connection.
+
@kindex clone-inferior
-@item clone-inferior [ -copies @var{n} ] [ @var{infno} ]
+@item clone-inferior [ -copies @var{n} ] [ -no-connection ] [ @var{infno} ]
Adds @var{n} inferiors ready to execute the same program as inferior
@var{infno}; @var{n} defaults to 1, and @var{infno} defaults to the
number of the current inferior. This command copies the values of the
@@ -3465,6 +3583,13 @@ Added inferior 2.
You can now simply switch focus to inferior 2 and run it.
+Like @code{add-inferior}, @code{clone-inferior} shares the connection
+with the inferior @var{infno}. If the @var{-no-connection} option is
+given, then the new inferior will be created without a connection. If
+the connection of inferior @var{infno} can't be shared, then
+@value{GDBN} will give a warning, and the new inferior will be created
+without a connection.
+
@anchor{remove_inferiors_cli}
@kindex remove-inferiors
@item remove-inferiors @var{infno}@dots{}
@@ -3547,10 +3672,6 @@ the program space number assigned by @value{GDBN}
the name of the executable loaded into the program space, with e.g.,
the @code{file} command.
-@item
-the name of the core file loaded into the program space, with e.g.,
-the @code{core-file} command.
-
@end enumerate
@noindent
@@ -3563,7 +3684,7 @@ example, the list of inferiors bound to the program space.
@smallexample
(@value{GDBP}) maint info program-spaces
- Id Executable Core File
+ Id Executable
* 1 hello
2 goodbye
Bound inferiors: ID 1 (process 21561)
@@ -3577,7 +3698,7 @@ the parent and child processes of a @code{vfork} call. For example,
@smallexample
(@value{GDBP}) maint info program-spaces
- Id Executable Core File
+ Id Executable
* 1 vfork-test
Bound inferiors: ID 2 (process 18050), ID 1 (process 18045)
@end smallexample
@@ -3661,7 +3782,7 @@ programs:
@item @samp{thread apply [@var{thread-id-list} | all] @var{args}},
a command to apply a command to a list of threads
@item thread-specific breakpoints
-@item @samp{set print thread-events}, which controls printing of
+@item @samp{set print thread-events}, which controls printing of
messages on thread start and exit.
@item @samp{set libthread-db-search-path @var{path}}, which lets
the user specify which @code{libthread_db} to use if the default choice
@@ -3807,7 +3928,7 @@ Thread 1 "main" received signal SIGINT, Interrupt.
@table @code
@anchor{info_threads}
@kindex info threads
-@item info threads @r{[}-gid@r{]} @r{[}@var{thread-id-list}@r{]}
+@item info threads @r{[}-gid@r{]} @r{[}-stopped@r{]} @r{[}-running@r{]} @r{[}@var{thread-id-list}@r{]}
Display information about one or more threads. With no arguments
displays information about all threads. You can specify the list of
@@ -3857,6 +3978,14 @@ If you're debugging multiple inferiors, @value{GDBN} displays thread
IDs using the qualified @var{inferior-num}.@var{thread-num} format.
Otherwise, only @var{thread-num} is shown.
+If you specify the @samp{-stopped} option, @value{GDBN} filters the
+output of the command to print the stopped threads only. Similarly,
+if you specify the @samp{-running} option, @value{GDBN} filters the
+output to print the running threads only. These options can be
+helpful to reduce the output list if there is a large number of
+threads. If you specify both options, @value{GDBN} prints both
+stopped and running threads.
+
If you specify the @samp{-gid} option, @value{GDBN} displays a column
indicating each thread's global thread ID:
@@ -3992,8 +4121,8 @@ system-give name, and removing the user-specified name will cause
Search for and display thread ids whose name or @var{systag}
matches the supplied regular expression.
-As well as being the complement to the @samp{thread name} command,
-this command also allows you to identify a thread by its target
+As well as being the complement to the @samp{thread name} command,
+this command also allows you to identify a thread by its target
@var{systag}. For instance, on @sc{gnu}/Linux, the target @var{systag}
is the LWP id.
@@ -4001,7 +4130,7 @@ is the LWP id.
(@value{GDBP}) thread find 26688
Thread 4 has target id 'Thread 0x41e02940 (LWP 26688)'
(@value{GDBP}) info thread 4
- Id Target Id Frame
+ Id Target Id Frame
4 Thread 0x41e02940 (LWP 26688) 0x00000031ca6cd372 in select ()
@end smallexample
@@ -4069,8 +4198,8 @@ If none of @code{libthread_db} libraries initialize successfully,
Setting @code{libthread-db-search-path} is currently implemented
only on some platforms.
-@kindex show libthread-db-search-path
-@item show libthread-db-search-path
+@kindex show libthread-db-search-path
+@item show libthread-db-search-path
Display current libthread_db search path.
@kindex set debug libthread-db
@@ -4090,6 +4219,56 @@ When @samp{on} @value{GDBN} will print additional messages when
threads are created and deleted.
@end table
+@cindex thread local storage
+@cindex @acronym{TLS}
+For some debugging targets, @value{GDBN} has support for accessing
+variables that reside in Thread Local Storage (@acronym{TLS}).
+@acronym{TLS} variables are similar to global variables, except that
+each thread has its own copy of the variable. While often used in
+multi-threaded programs, @acronym{TLS} variables can also be used in
+programs without threads. The C library variable @var{errno} is,
+perhaps, the most prominent example of a @acronym{TLS} variable that
+is frequently used in non-threaded programs. For targets where
+@value{GDBN} does not have good @acronym{TLS} support, printing or
+changing the value of @var{errno} might not be directly possible.
+
+@sc{gnu}/Linux and FreeBSD targets have support for accessing
+@acronym{TLS} variables. On @sc{gnu}/Linux, the helper library,
+@code{libthread_db}, is used to help resolve the addresses of
+@acronym{TLS} variables. Some FreeBSD and some @sc{gnu}/Linux targets
+also have @value{GDBN}-internal @acronym{TLS} resolution code.
+@sc{gnu}/Linux targets will attempt to use the @acronym{TLS} address
+lookup functionality provided by @code{libthread_db}, but will fall
+back to using its internal @acronym{TLS} support when
+@code{libthread_db} is not available. This can happen in
+cross-debugging scenarios or when debugging programs that are linked
+in such a way that @code{libthread_db} support is unavailable -- this
+includes statically linked programs, linking against @acronym{GLIBC}
+versions earlier than 2.34, but not with @code{libpthread}, and use of
+other (non-@acronym{GLIBC}) C libraries.
+
+@table @code
+@kindex maint set force-internal-tls-address-lookup
+@kindex maint show force-internal-tls-address-lookup
+@cindex internal @acronym{TLS} address lookup
+@item maint set force-internal-tls-address-lookup
+@itemx maint show force-internal-tls-address-lookup
+Turns on or off forced use of @value{GDBN}-internal @acronym{TLS}
+address lookup code. Use @code{on} to enable and @code{off} to
+disable. The default for this setting is @code{off}.
+
+When disabled, @value{GDBN} will attempt to use a helper
+@code{libthread_db} library if possible, but will fall back to use of
+its own internal @acronym{TLS} address lookup mechanisms if necessary.
+
+When enabled, @value{GDBN} will only use @value{GDBN}'s internal
+@acronym{TLS} address lookup mechanisms, if they exist.
+
+This command is only available for @sc{gnu}/Linux targets. Its
+primary use is for testing -- certain tests in the @value{GDBN} test
+suite use this command to force use of internal TLS address lookup.
+@end table
+
@node Forks
@section Debugging Forks
@@ -4166,14 +4345,14 @@ retain debugger control over them both.
@table @code
@item on
The child process (or parent process, depending on the value of
-@code{follow-fork-mode}) will be detached and allowed to run
+@code{follow-fork-mode}) will be detached and allowed to run
independently. This is the default.
@item off
Both processes will be held under the control of @value{GDBN}.
-One process (child or parent, depending on the value of
+One process (child or parent, depending on the value of
@code{follow-fork-mode}) is debugged as usual, while the other
-is held suspended.
+is held suspended.
@end table
@@ -4302,8 +4481,8 @@ the critical statement, instead of having to restart your program
from the beginning, you can just go back to the checkpoint and
start again from there.
-This can be especially useful if it takes a lot of time or
-steps to reach the point where you think the bug occurs.
+This can be especially useful if it takes a lot of time or
+steps to reach the point where you think the bug occurs.
To use the @code{checkpoint}/@code{restart} method of debugging:
@@ -4387,7 +4566,7 @@ different execution path this time.
@cindex checkpoints and process id
Finally, there is one bit of internal program state that will be
different when you return to a checkpoint --- the program's process
-id. Each checkpoint will have a unique process id (or @var{pid}),
+id. Each checkpoint will have a unique process id (or @var{pid}),
and each will be different from the program's original @var{pid}.
If your program has saved a local copy of its process id, this could
potentially pose a problem.
@@ -4395,15 +4574,15 @@ potentially pose a problem.
@subsection A Non-obvious Benefit of Using Checkpoints
On some systems such as @sc{gnu}/Linux, address space randomization
-is performed on new processes for security reasons. This makes it
+is performed on new processes for security reasons. This makes it
difficult or impossible to set a breakpoint, or watchpoint, on an
-absolute address if you have to restart the program, since the
+absolute address if you have to restart the program, since the
absolute location of a symbol will change from one execution to the
next.
-A checkpoint, however, is an @emph{identical} copy of a process.
-Therefore if you create a checkpoint at (eg.@:) the start of main,
-and simply return to that checkpoint instead of restarting the
+A checkpoint, however, is an @emph{identical} copy of a process.
+Therefore if you create a checkpoint at (eg.@:) the start of main,
+and simply return to that checkpoint instead of restarting the
process, you can avoid the effects of address randomization and
your symbols will all stay in the same place.
@@ -6228,7 +6407,7 @@ for more information on how to add @code{SystemTap} @acronym{SDT}
probes in your applications.}. @code{SystemTap} probes are usable
from assembly, C and C@t{++} languages@footnote{See
@uref{http://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation}
-for a good reference on how the @acronym{SDT} probes are implemented.}.
+for a good reference on how the @acronym{SDT} probes are implemented.}.
@item @code{DTrace} (@uref{http://oss.oracle.com/projects/DTrace})
@acronym{USDT} probes. @code{DTrace} probes are usable from C and
@@ -7144,9 +7323,9 @@ Depending on target support, @code{$_siginfo} may also be writable.
(@pxref{Threads,, Debugging Programs with Multiple Threads}). There
are two modes of controlling execution of your program within the
debugger. In the default mode, referred to as @dfn{all-stop mode},
-when any thread in your program stops (for example, at a breakpoint
-or while being stepped), all other threads in the program are also stopped by
-@value{GDBN}. On some targets, @value{GDBN} also supports
+when any thread in your program stops (for example, at a breakpoint
+or while being stepped), all other threads in the program are also stopped by
+@value{GDBN}. On some targets, @value{GDBN} also supports
@dfn{non-stop mode}, in which other threads can continue to run freely while
you examine the stopped thread in the debugger.
@@ -7194,7 +7373,7 @@ Whenever @value{GDBN} stops your program, due to a breakpoint or a
signal, it automatically selects the thread where that breakpoint or
signal happened. @value{GDBN} alerts you to the context switch with a
message such as @samp{[Switching to Thread @var{n}]} to identify the
-thread.
+thread.
@anchor{set scheduler-locking}
@@ -7499,7 +7678,7 @@ Tasks}); using more than one of the @code{thread}, @code{inferior}, or
@code{task} keywords when creating a breakpoint will give an error.
@node Interrupted System Calls
-@subsection Interrupted System Calls
+@subsection Interrupted System Calls
@cindex thread breakpoints and system calls
@cindex system calls and thread breakpoints
@@ -7673,7 +7852,7 @@ targets may be able undo things like device I/O, and some may not.
The contract between @value{GDBN} and the reverse executing target
requires only that the target do something reasonable when
-@value{GDBN} tells it to execute backwards, and then report the
+@value{GDBN} tells it to execute backwards, and then report the
results back to @value{GDBN}. Whatever the target reports back to
@value{GDBN}, @value{GDBN} will report back to the user. @value{GDBN}
assumes that the memory and registers that the target reports are in a
@@ -7732,7 +7911,7 @@ the current (innermost) stack frame. If the line contains function
calls, they will be ``un-executed'' without stopping. Starting from
the first line of a function, @code{reverse-next} will take you back
to the caller of that function, @emph{before} the function was called,
-just as the normal @code{next} command would take you from the last
+just as the normal @code{next} command would take you from the last
line of a function back to its return to its caller
@footnote{Unless the code is too heavily optimized.}.
@@ -7807,9 +7986,9 @@ previous instruction; otherwise, it will work in record mode, if the
platform supports reverse execution, or stop if not.
Currently, process record and replay is supported on ARM, Aarch64,
-LoongArch, Moxie, PowerPC, PowerPC64, S/390, and x86 (i386/amd64) running
-GNU/Linux. Process record and replay can be used both when native
-debugging, and when remote debugging via @code{gdbserver}.
+LoongArch, Moxie, PowerPC, PowerPC64, S/390, RISC-V and x86 (i386/amd64)
+running GNU/Linux. Process record and replay can be used both when
+native debugging, and when remote debugging via @code{gdbserver}.
When recording an inferior, @value{GDBN} may print auxiliary information
during stepping commands and commands displaying the execution history.
@@ -10737,7 +10916,7 @@ Enter the index of the element you want to explore in `cs.arr': 5
(cs.arr)[5] = 4
-Press enter to return to parent value:
+Press enter to return to parent value:
@end smallexample
In general, at any stage of exploration, you can go deeper towards the
@@ -12588,7 +12767,7 @@ with the corresponding objfile (e.g., shared library).
@xref{Objfiles In Python}, for more details on objfiles in Python.
@end itemize
-@xref{Selecting Pretty-Printers}, for further information on how
+@xref{Selecting Pretty-Printers}, for further information on how
pretty-printers are selected,
@xref{Writing a Pretty-Printer}, for implementing pretty printers
@@ -12602,7 +12781,7 @@ Here is how a C@t{++} @code{std::string} looks without a pretty-printer:
@smallexample
(@value{GDBP}) print s
$1 = @{
- static npos = 4294967295,
+ static npos = 4294967295,
_M_dataplus = @{
<std::allocator<char>> = @{
<__gnu_cxx::new_allocator<char>> = @{
@@ -13046,6 +13225,18 @@ variable which may be @samp{truecolor} or @samp{24bit}. Other color spaces are
determined by the "Co" termcap which in turn depends on the @env{TERM}
environment variable.
+@vindex $_linker_namespace_count@r{, convenience variable}
+@item $_linker_namespace_count
+Number of active linker namespaces in the inferior (@pxref{Files}). In systems
+with no support for linker namespaces or if the inferior hasn't started, this
+variable will always be set to @samp{0}.
+
+@vindex $_linker_namespace@r{, convenience variable}
+@item $_linker_namespace
+The namespace which contains the current location in the inferior. This returns
+@value{GDBN}'s internal numbering for the namespace. In systems with no support
+for linker namespaces, this variable will always be set to @samp{0}.
+
@end table
@node Convenience Funs
@@ -15659,7 +15850,7 @@ Num Type Disp Enb Address What
end
collect globfoo2
end
- pass count 1200
+ pass count 1200
2 tracepoint keep y <MULTIPLE>
collect $eip
2.1 y 0x0804859c in func4 at change-loc.h:35
@@ -18669,7 +18860,7 @@ type = POINTER TO ARRAY [-2..2] OF foo = RECORD
f1 : CARDINAL;
f2 : CHAR;
f3 : ARRAY [-2..2] OF CARDINAL;
-END
+END
@end smallexample
@node M2 Defaults
@@ -18818,8 +19009,8 @@ to be difficult.
@cindex expressions in Ada
@menu
-* Ada Mode Intro:: General remarks on the Ada syntax
- and semantics supported by Ada mode
+* Ada Mode Intro:: General remarks on the Ada syntax
+ and semantics supported by Ada mode
in @value{GDBN}.
* Omissions from Ada:: Restrictions on the Ada expression syntax.
* Additions to Ada:: Extensions of the Ada expression syntax.
@@ -18839,22 +19030,22 @@ to be difficult.
@subsubsection Introduction
@cindex Ada mode, general
-The Ada mode of @value{GDBN} supports a fairly large subset of Ada expression
+The Ada mode of @value{GDBN} supports a fairly large subset of Ada expression
syntax, with some extensions.
-The philosophy behind the design of this subset is
+The philosophy behind the design of this subset is
@itemize @bullet
@item
-That @value{GDBN} should provide basic literals and access to operations for
-arithmetic, dereferencing, field selection, indexing, and subprogram calls,
+That @value{GDBN} should provide basic literals and access to operations for
+arithmetic, dereferencing, field selection, indexing, and subprogram calls,
leaving more sophisticated computations to subprograms written into the
program (which therefore may be called from @value{GDBN}).
-@item
+@item
That type safety and strict adherence to Ada language restrictions
are not particularly important to the @value{GDBN} user.
-@item
+@item
That brevity is important to the @value{GDBN} user.
@end itemize
@@ -18864,13 +19055,13 @@ according to Ada rules, thus making it unnecessary to fully qualify most
names with their packages, regardless of context. Where this causes
ambiguity, @value{GDBN} asks the user's intent.
-The debugger will start in Ada mode if it detects an Ada main program.
+The debugger will start in Ada mode if it detects an Ada main program.
As for other languages, it will enter Ada mode when stopped in a program that
was translated from an Ada source file.
-While in Ada mode, you may use `@t{--}' for comments. This is useful
-mostly for documenting command files. The standard @value{GDBN} comment
-(@samp{#}) still works at the beginning of a line in Ada mode, but not in the
+While in Ada mode, you may use `@t{--}' for comments. This is useful
+mostly for documenting command files. The standard @value{GDBN} comment
+(@samp{#}) still works at the beginning of a line in Ada mode, but not in the
middle (to allow based literals).
@node Omissions from Ada
@@ -18889,10 +19080,10 @@ Only a subset of the attributes are supported:
on array objects (not on types and subtypes).
@item
-@t{'Min} and @t{'Max}.
+@t{'Min} and @t{'Max}.
-@item
-@t{'Pos} and @t{'Val}.
+@item
+@t{'Pos} and @t{'Val}.
@item
@t{'Tag}.
@@ -18901,8 +19092,8 @@ Only a subset of the attributes are supported:
@t{'Range} on array objects (not subtypes), but only as the right
operand of the membership (@code{in}) operator.
-@item
-@t{'Access}, @t{'Unchecked_Access}, and
+@item
+@t{'Access}, @t{'Unchecked_Access}, and
@t{'Unrestricted_Access} (a GNAT extension).
@item
@@ -18923,20 +19114,20 @@ Equality tests (@samp{=} and @samp{/=}) on arrays test for bitwise
equality of representations. They will generally work correctly
for strings and arrays whose elements have integer or enumeration types.
They may not work correctly for arrays whose element
-types have user-defined equality, for arrays of real values
+types have user-defined equality, for arrays of real values
(in particular, IEEE-conformant floating point, because of negative
zeroes and NaNs), and for arrays whose elements contain unused bits with
-indeterminate values.
+indeterminate values.
@item
-The other component-by-component array operations (@code{and}, @code{or},
+The other component-by-component array operations (@code{and}, @code{or},
@code{xor}, @code{not}, and relational tests other than equality)
-are not implemented.
+are not implemented.
-@item
+@item
@cindex array aggregates (Ada)
@cindex record aggregates (Ada)
-@cindex aggregates (Ada)
+@cindex aggregates (Ada)
There is limited support for array and record aggregates. They are
permitted only on the right sides of assignments, as in these examples:
@@ -18954,7 +19145,7 @@ discriminant's value by assigning an aggregate has an
undefined effect if that discriminant is used within the record.
However, you can first modify discriminants by directly assigning to
them (which normally would not be allowed in Ada), and then performing an
-aggregate assignment. For example, given a variable @code{A_Rec}
+aggregate assignment. For example, given a variable @code{A_Rec}
declared to have a type such as:
@smallexample
@@ -18974,7 +19165,7 @@ assignments:
As this example also illustrates, @value{GDBN} is very loose about the usual
rules concerning aggregates. You may leave out some of the
-components of an array or record aggregate (such as the @code{Len}
+components of an array or record aggregate (such as the @code{Len}
component in the assignment to @code{A_Rec} above); they will retain their
original values upon assignment. You may freely use dynamic values as
indices in component associations. You may even use overlapping or
@@ -18998,16 +19189,16 @@ The @code{new} operator is not implemented.
@item
Entry calls are not implemented.
-@item
-Aside from printing, arithmetic operations on the native VAX floating-point
+@item
+Aside from printing, arithmetic operations on the native VAX floating-point
formats are not supported.
@item
It is not possible to slice a packed array.
@item
-The names @code{True} and @code{False}, when not part of a qualified name,
-are interpreted as if implicitly prefixed by @code{Standard}, regardless of
+The names @code{True} and @code{False}, when not part of a qualified name,
+are interpreted as if implicitly prefixed by @code{Standard}, regardless of
context.
Should your program
redefine these names in a package or procedure (at best a dubious practice),
@@ -19019,7 +19210,7 @@ Based real literals are not implemented.
@node Additions to Ada
@subsubsection Additions to Ada
-@cindex Ada, deviations from
+@cindex Ada, deviations from
As it does for other languages, @value{GDBN} makes certain generic
extensions to Ada (@pxref{Expressions}):
@@ -19040,12 +19231,12 @@ which certain debugging information has been optimized away.
appears in function or file @var{B}.'' When @var{B} is a file name,
you must typically surround it in single quotes.
-@item
+@item
The expression @code{@{@var{type}@} @var{addr}} means ``the variable of type
@var{type} that appears at address @var{addr}.''
@item
-A name starting with @samp{$} is a convenience variable
+A name starting with @samp{$} is a convenience variable
(@pxref{Convenience Vars}) or a machine register (@pxref{Registers}).
@end itemize
@@ -19053,7 +19244,7 @@ In addition, @value{GDBN} provides a few other shortcuts and outright
additions specific to Ada:
@itemize @bullet
-@item
+@item
The assignment statement is allowed as an expression, returning
its right-hand operand as its value. Thus, you may enter
@@ -19062,8 +19253,8 @@ its right-hand operand as its value. Thus, you may enter
(@value{GDBP}) print A(tmp := y + 1)
@end smallexample
-@item
-The semicolon is allowed as an ``operator,'' returning as its value
+@item
+The semicolon is allowed as an ``operator,'' returning as its value
the value of its right-hand operand.
This allows, for example,
complex conditional breaks:
@@ -19086,13 +19277,13 @@ constant: zero means @code{Float} is used, one means
$1 = 23.0
@end smallexample
-@item
-Rather than use catenation and symbolic character names to introduce special
-characters into strings, one may instead use a special bracket notation,
-which is also used to print strings. A sequence of characters of the form
-@samp{["@var{XX}"]} within a string or character literal denotes the
+@item
+Rather than use catenation and symbolic character names to introduce special
+characters into strings, one may instead use a special bracket notation,
+which is also used to print strings. A sequence of characters of the form
+@samp{["@var{XX}"]} within a string or character literal denotes the
(single) character whose numeric encoding is @var{XX} in hexadecimal. The
-sequence of characters @samp{["""]} also denotes a single quotation mark
+sequence of characters @samp{["""]} also denotes a single quotation mark
in strings. For example,
@smallexample
"One line.["0a"]Next line.["0a"]"
@@ -19111,7 +19302,7 @@ to write
@end smallexample
@item
-When printing arrays, @value{GDBN} uses positional notation when the
+When printing arrays, @value{GDBN} uses positional notation when the
array has a lower bound of 1, and uses a modified named notation otherwise.
For example, a one-dimensional array of three integers with a lower bound
of 3 might print as
@@ -19121,30 +19312,30 @@ of 3 might print as
@end smallexample
@noindent
-That is, in contrast to valid Ada, only the first component has a @code{=>}
+That is, in contrast to valid Ada, only the first component has a @code{=>}
clause.
@item
You may abbreviate attributes in expressions with any unique,
-multi-character subsequence of
+multi-character subsequence of
their names (an exact match gets preference).
For example, you may use @t{a'len}, @t{a'gth}, or @t{a'lh}
in place of @t{a'length}.
@item
@cindex quoting Ada internal identifiers
-Since Ada is case-insensitive, the debugger normally maps identifiers you type
-to lower case. The GNAT compiler uses upper-case characters for
+Since Ada is case-insensitive, the debugger normally maps identifiers you type
+to lower case. The GNAT compiler uses upper-case characters for
some of its internal identifiers, which are normally of no interest to users.
For the rare occasions when you actually have to look at them,
-enclose them in angle brackets to avoid the lower-case mapping.
+enclose them in angle brackets to avoid the lower-case mapping.
For example,
@smallexample
(@value{GDBP}) print <JMPBUF_SAVE>[0]
@end smallexample
@item
-Printing an object of class-wide type or dereferencing an
+Printing an object of class-wide type or dereferencing an
access-to-class-wide value will display all the components of the object's
specific type (as indicated by its run-time tag). Likewise, component
selection on such a value will operate on the specific type of the
@@ -19173,7 +19364,7 @@ Multiple matches for f
[0] cancel
[1] foo.f (integer) return boolean at foo.adb:23
[2] foo.f (foo.new_integer) return boolean at foo.adb:28
->
+>
@end smallexample
In this case, just select one menu entry either to cancel expression evaluation
@@ -19610,12 +19801,12 @@ Show the current source character set for Ada.
Besides the omissions listed previously (@pxref{Omissions from Ada}),
we know of several problems with and limitations of Ada mode in
@value{GDBN},
-some of which will be fixed with planned future releases of the debugger
+some of which will be fixed with planned future releases of the debugger
and the GNU Ada compiler.
@itemize @bullet
-@item
-Static constants that the compiler chooses not to materialize as objects in
+@item
+Static constants that the compiler chooses not to materialize as objects in
storage are invisible to the debugger.
@item
@@ -19626,22 +19817,22 @@ argument lists are treated as positional).
Many useful library packages are currently invisible to the debugger.
@item
-Fixed-point arithmetic, conversions, input, and output is carried out using
-floating-point arithmetic, and may give results that only approximate those on
+Fixed-point arithmetic, conversions, input, and output is carried out using
+floating-point arithmetic, and may give results that only approximate those on
the host machine.
@item
-The GNAT compiler never generates the prefix @code{Standard} for any of
-the standard symbols defined by the Ada language. @value{GDBN} knows about
+The GNAT compiler never generates the prefix @code{Standard} for any of
+the standard symbols defined by the Ada language. @value{GDBN} knows about
this: it will strip the prefix from names when you use it, and will never
look for a name you have so qualified among local symbols, nor match against
-symbols in other packages or subprograms. If you have
-defined entities anywhere in your program other than parameters and
-local variables whose simple names match names in @code{Standard},
+symbols in other packages or subprograms. If you have
+defined entities anywhere in your program other than parameters and
+local variables whose simple names match names in @code{Standard},
GNAT's lack of qualification here can cause confusion. When this happens,
-you can usually resolve the confusion
+you can usually resolve the confusion
by qualifying the problematic names with package
-@code{Standard} explicitly.
+@code{Standard} explicitly.
@end itemize
Older versions of the compiler sometimes generate erroneous debugging
@@ -21896,6 +22087,9 @@ wish to debug a core file instead, you must kill the subprocess in which
the program is running. To do this, use the @code{kill} command
(@pxref{Kill Process, ,Killing the Child Process}).
+To see which core files are loaded into which inferiors, use the
+@kbd{info inferiors} command (@pxref{info inferiors command}).
+
@kindex add-symbol-file
@cindex dynamic linking
@item add-symbol-file @var{filename} @r{[} -readnow @r{|} -readnever @r{]} @r{[} -o @var{offset} @r{]} @r{[} @var{textaddress} @r{]} @r{[} -s @var{section} @var{address} @dots{} @r{]}
@@ -22172,6 +22366,18 @@ be determined then the address range for the @code{.text} section from
the library will be listed. If the @code{.text} section cannot be
found then no addresses will be listed.
+On systems that support linker namespaces, the output includes an
+additional column @code{NS} if the inferior has more than one active
+namespace when the command is used. This column the linker namespace
+that the shared library was loaded into.
+
+@cindex linker namespaces
+@dfn{Linker namespaces} are a feature of some standard libraries, that allow
+shared objects to be loaded in isolated environment, eliminating the
+possibility that those objects may cross-talk. Each set of isolated
+shared objects is said to belong to a ``namespace'', and linker related
+actions such as relocations do not cross namespace boundaries.
+
@kindex info dll
@item info dll @var{regex}
This is an alias of @code{info sharedlibrary}.
@@ -22207,6 +22413,22 @@ less useful than setting a catchpoint, because it does not allow for
conditions or commands as a catchpoint does.
@table @code
+@kindex info linker-namespaces
+@item info linker-namespaces
+@item info linker-namespaces @code{[[@var{n}]]}
+
+With no argument, print the number of linker namespaces which are
+currently active --- that is, namespaces that have libraries loaded
+into them. Then, it prints the number of libraries loaded into each
+namespace, and all the libraries loaded into them, in the same way
+as @code{info sharedlibrary}.
+
+If an argument @code{[[@var{n}]]} is provided, only prints the
+library count and the libraried for the provided namespace @var{n}.
+The surrounding square brackets are optional.
+@end table
+
+@table @code
@item set stop-on-solib-events
@kindex set stop-on-solib-events
This command controls whether @value{GDBN} should give you control
@@ -23609,7 +23831,7 @@ current exec-file loaded by @value{GDBN} (@pxref{set exec-file-mismatch}).
@cindex symbol files, remote debugging
@value{GDBN}, running on the host, needs access to symbol and debugging
-information for your program running on the target. This requires
+information for your program running on the target. This requires
access to an unstripped copy of your program, and possibly any associated
symbol files. Note that this section applies equally to both @code{target
remote} mode and @code{target extended-remote} mode.
@@ -24448,6 +24670,12 @@ extended-remote}. This should be set to a filename valid on the
target system. If it is not set, the target will use a default
filename (e.g.@: the last program run).
+When connecting to a remote system, with @kbd{target extended-remote}
+or @kbd{target remote}, if the remote server supports the
+@code{qExecAndArgs} packet (@pxref{qExecAndArgs}), then the
+@kbd{remote exec-file} will be updated to reflect the executable
+currently running on the remote system.
+
@item set remote interrupt-sequence
@cindex interrupt remote programs
@cindex select Ctrl-C, BREAK or BREAK-g
@@ -24485,7 +24713,7 @@ debugging agent is launched in parallel with @value{GDBN}; there is a race
condition because the agent may not become ready to accept the connection
before @value{GDBN} attempts to connect. When auto-retry is
enabled, if the initial attempt to connect fails, @value{GDBN} reattempts
-to establish the connection using the timeout specified by
+to establish the connection using the timeout specified by
@code{set tcp connect-timeout}.
@item set tcp auto-retry off
@@ -24499,7 +24727,7 @@ Show the current auto-retry setting.
@cindex connection timeout, for remote TCP target
@cindex timeout, for remote target connection
Set the timeout for establishing a TCP connection to the remote target to
-@var{seconds}. The timeout affects both polling to retry failed connections
+@var{seconds}. The timeout affects both polling to retry failed connections
(enabled by @code{set tcp auto-retry on}) and waiting for connections
that are merely slow to complete, and represents an approximate cumulative
value. If @var{seconds} is @code{unlimited}, there is no timeout and
@@ -24684,6 +24912,10 @@ future connections is shown. The available settings are:
@tab @code{vFile:stat}
@tab Host I/O
+@item @code{hostio-lstat-packet}
+@tab @code{vFile:lstat}
+@tab Host I/O
+
@item @code{hostio-setfs-packet}
@tab @code{vFile:setfs}
@tab Host I/O
@@ -26202,7 +26434,7 @@ Show whether ARM-specific debugging messages are enabled.
@end table
@table @code
-@item target sim @r{[}@var{simargs}@r{]} @dots{}
+@item target sim @r{[}@var{simargs}@r{]} @dots{}
The @value{GDBN} ARM simulator accepts the following optional arguments.
@table @code
@@ -26255,8 +26487,8 @@ This host system is used to download the configuration bitstream to
the target FPGA. The Xilinx Microprocessor Debugger (XMD) program
communicates with the target board using the JTAG interface and
presents a @code{gdbserver} interface to the board. By default
-@code{xmd} uses port @code{1234}. (While it is possible to change
-this default port, it requires the use of undocumented @code{xmd}
+@code{xmd} uses port @code{1234}. (While it is possible to change
+this default port, it requires the use of undocumented @code{xmd}
commands. Contact Xilinx support if you need to do this.)
Use these GDB commands to connect to the MicroBlaze target processor.
@@ -26466,7 +26698,7 @@ Show the current CRIS version.
@item set cris-dwarf2-cfi
@cindex DWARF-2 CFI and CRIS
Set the usage of DWARF-2 CFI for CRIS debugging. The default is @samp{on}.
-Change to @samp{off} when using @code{gcc-cris} whose version is below
+Change to @samp{off} when using @code{gcc-cris} whose version is below
@code{R59}.
@item show cris-dwarf2-cfi
@@ -26475,7 +26707,7 @@ Show the current state of using DWARF-2 CFI.
@item set cris-mode @var{mode}
@cindex CRIS mode
Set the current CRIS mode to @var{mode}. It should only be changed when
-debugging in guru mode, in which case it should be set to
+debugging in guru mode, in which case it should be set to
@samp{guru} (the default is @samp{normal}).
@item show cris-mode
@@ -26547,8 +26779,9 @@ Show whether AArch64 debugging messages are displayed.
@end table
-@subsubsection AArch64 SVE.
-@cindex AArch64 SVE.
+@subsubsection AArch64 Scalable Vector Extension
+@cindex Scalable Vector Extension, AArch64
+@cindex SVE, AArch64
When @value{GDBN} is debugging the AArch64 architecture, if the Scalable Vector
Extension (SVE) is present, then @value{GDBN} will provide the vector registers
@@ -26587,11 +26820,10 @@ internally by @value{GDBN} and the Linux Kernel.
@end itemize
-@subsubsection AArch64 SME.
+@subsubsection AArch64 Scalable Matrix Extension
@anchor{AArch64 SME}
-@cindex SME
-@cindex AArch64 SME
-@cindex Scalable Matrix Extension
+@cindex Scalable Matrix Extension, AArch64
+@cindex SME, AArch64
The Scalable Matrix Extension (@url{https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/scalable-matrix-extension-armv9-a-architecture, @acronym{SME}})
is an AArch64 architecture extension that expands on the concept of the
@@ -26783,11 +27015,10 @@ incorrect values for SVE registers (when in streaming mode).
This is the same limitation we have for the @acronym{SVE} registers, and there
are plans to address this limitation going forward.
-@subsubsection AArch64 SME2.
+@subsubsection AArch64 Scalable Matrix Extension 2
@anchor{AArch64 SME2}
-@cindex SME2
-@cindex AArch64 SME2
-@cindex Scalable Matrix Extension 2
+@cindex Scalable Matrix Extension 2, AArch64
+@cindex SME2, AArch64
The Scalable Matrix Extension 2 is an AArch64 architecture extension that
further expands the @acronym{SME} extension with the following:
@@ -26827,8 +27058,9 @@ For more information about @acronym{SME2}, please refer to the
official @url{https://developer.arm.com/documentation/ddi0487/latest,
architecture documentation}.
-@subsubsection AArch64 Pointer Authentication.
-@cindex AArch64 Pointer Authentication.
+@subsubsection AArch64 Pointer Authentication
+@cindex Pointer Authentication, AArch64
+@cindex PAC, AArch64
@anchor{AArch64 PAC}
When @value{GDBN} is debugging the AArch64 architecture, and the program is
@@ -26838,8 +27070,9 @@ When GDB prints a backtrace, any addresses that required unmasking will be
postfixed with the marker [PAC]. When using the MI, this is printed as part
of the @code{addr_flags} field.
-@subsubsection AArch64 Memory Tagging Extension.
-@cindex AArch64 Memory Tagging Extension.
+@subsubsection AArch64 Memory Tagging Extension
+@cindex Memory Tagging Extension, AArch64
+@cindex MTE, AArch64
When @value{GDBN} is debugging the AArch64 architecture, the program is
using the v8.5-A feature Memory Tagging Extension (MTE) and there is support
@@ -26893,6 +27126,32 @@ information automatically from the core file, and will show one of the above
messages depending on whether the synchronous or asynchronous mode is selected.
@xref{Memory Tagging}. @xref{Memory}.
+@subsubsection AArch64 Guarded Control Stack
+@cindex Guarded Control Stack, AArch64
+@cindex GCS, AArch64
+
+When @value{GDBN} is debugging the AArch64 architecture, the program is
+using the feature Guarded Control Stack (GCS), the operating system kernel
+is Linux and it supports GCS, @value{GDBN} will make a couple of special
+registers --- @code{gcs_features_enabled} and @code{gcs_features_locked}
+--- available through the @code{org.gnu.gdb.aarch64.gcs.linux} feature.
+These registers expose some options that can be controlled at runtime and
+emulate the @code{prctl} option @code{PR_SET_SHADOW_STACK_STATUS}. For
+further information, see the
+@uref{https://www.kernel.org/doc/html/latest/arch/arm64/gcs.html,ignored,
+documentation} in the Linux kernel.
+
+Naturally the Guarded Control Stack pointer at @code{EL0} is also
+available, as the @code{gcspr} register.
+
+To aid debugging, @value{GDBN} will note when SIGSEGV signals are generated
+as a result of a Guarded Control Stack error:
+
+@smallexample
+Program received signal SIGSEGV, Segmentation fault
+Guarded Control Stack error.
+@end smallexample
+
@node x86
@subsection x86
@@ -26934,6 +27193,46 @@ registers
@end itemize
+@subsubsection Intel Control-Flow Enforcement Technology.
+@cindex Intel Control-Flow Enforcement Technology.
+
+The @dfn{Intel Control-Flow Enforcement Technology} (@acronym{Intel CET})
+provides two capabilities to defend against ``Return-oriented Programming''
+and ``call/jmp-oriented programming'' style control-flow attacks:
+
+@itemize @bullet
+@item Shadow Stack:
+A shadow stack is a second stack for a program. It holds the return
+addresses pushed by the call instruction. The @code{RET} instruction pops the
+return addresses from both call and shadow stack. If the return addresses from
+the two stacks do not match, the processor signals a control protection
+exception.
+@item Indirect Branch Tracking (IBT):
+When IBT is enabled, the CPU implements a state machine that tracks
+indirect @code{JMP} and @code{CALL} instructions. The state machine can
+be either IDLE or WAIT_FOR_ENDBRANCH. When a @code{JMP} or @code{CALL} is
+executed the state machine chages to the WAIT_FOR_ENDBRANCH state. In
+WAIT_FOR_ENDBRANCH state the next instruction in the program stream
+must be an @code{ENDBR} instruction, otherwise the processor signals a
+control protection exception. After executing a @code{ENDBR} instruction
+the state machine returns to the IDLE state.
+@end itemize
+
+Impact on @value{GDBN} commands:
+@itemize @bullet
+@item Call/Print:
+Inferior calls in @value{GDBN} reset the current PC to the beginning of the
+function that is called. No call instruction is executed, but the @code{RET}
+instruction actually is. To avoid a control protection exception due to the
+missing return address on the shadow stack, @value{GDBN} pushes the new return
+address to the shadow stack and updates the shadow stack pointer.
+@item Step:
+With displaced stepping, @value{GDBN} may run an out of line copy of a call
+instruction. In this case, the wrong return address is pushed to the shadow
+stack. @value{GDBN} corrects this value to avoid a control protection
+exception. For more details on displaced stepping, see @ref{displaced-stepping}.
+@end itemize
+
@node Alpha
@subsection Alpha
@@ -27099,7 +27398,7 @@ given @var{address}.
@subsection PowerPC
@cindex PowerPC architecture
-When @value{GDBN} is debugging the PowerPC architecture, it provides a set of
+When @value{GDBN} is debugging the PowerPC architecture, it provides a set of
pseudo-registers to enable inspection of 128-bit wide Decimal Floating Point
numbers stored in the floating point registers. These values must be stored
in two consecutive registers, always starting at an even register like
@@ -27118,38 +27417,38 @@ wide Extended Floating Point Registers (@samp{f32} through @samp{f63}).
@cindex Application Data Integrity
@subsubsection ADI Support
-The M7 processor supports an Application Data Integrity (ADI) feature that
-detects invalid data accesses. When software allocates memory and enables
-ADI on the allocated memory, it chooses a 4-bit version number, sets the
-version in the upper 4 bits of the 64-bit pointer to that data, and stores
-the 4-bit version in every cacheline of that data. Hardware saves the latter
-in spare bits in the cache and memory hierarchy. On each load and store,
-the processor compares the upper 4 VA (virtual address) bits to the
-cacheline's version. If there is a mismatch, the processor generates a
-version mismatch trap which can be either precise or disrupting. The trap
-is an error condition which the kernel delivers to the process as a SIGSEGV
+The M7 processor supports an Application Data Integrity (ADI) feature that
+detects invalid data accesses. When software allocates memory and enables
+ADI on the allocated memory, it chooses a 4-bit version number, sets the
+version in the upper 4 bits of the 64-bit pointer to that data, and stores
+the 4-bit version in every cacheline of that data. Hardware saves the latter
+in spare bits in the cache and memory hierarchy. On each load and store,
+the processor compares the upper 4 VA (virtual address) bits to the
+cacheline's version. If there is a mismatch, the processor generates a
+version mismatch trap which can be either precise or disrupting. The trap
+is an error condition which the kernel delivers to the process as a SIGSEGV
signal.
Note that only 64-bit applications can use ADI and need to be built with
ADI-enabled.
-Values of the ADI version tags, which are in granularity of a
-cacheline (64 bytes), can be viewed or modified.
+Values of the ADI version tags, which are in granularity of a
+cacheline (64 bytes), can be viewed or modified.
@table @code
@kindex adi examine
@item adi (examine | x) [ / @var{n} ] @var{addr}
-The @code{adi examine} command displays the value of one ADI version tag per
-cacheline.
+The @code{adi examine} command displays the value of one ADI version tag per
+cacheline.
-@var{n} is a decimal integer specifying the number in bytes; the default
-is 1. It specifies how much ADI version information, at the ratio of 1:ADI
-block size, to display.
+@var{n} is a decimal integer specifying the number in bytes; the default
+is 1. It specifies how much ADI version information, at the ratio of 1:ADI
+block size, to display.
-@var{addr} is the address in user address space where you want @value{GDBN}
-to begin displaying the ADI version tags.
+@var{addr} is the address in user address space where you want @value{GDBN}
+to begin displaying the ADI version tags.
Below is an example of displaying ADI versions of variable "shmaddr".
@@ -27161,19 +27460,19 @@ Below is an example of displaying ADI versions of variable "shmaddr".
@kindex adi assign
@item adi (assign | a) [ / @var{n} ] @var{addr} = @var{tag}
-The @code{adi assign} command is used to assign new ADI version tag
-to an address.
+The @code{adi assign} command is used to assign new ADI version tag
+to an address.
-@var{n} is a decimal integer specifying the number in bytes;
-the default is 1. It specifies how much ADI version information, at the
-ratio of 1:ADI block size, to modify.
+@var{n} is a decimal integer specifying the number in bytes;
+the default is 1. It specifies how much ADI version information, at the
+ratio of 1:ADI block size, to modify.
-@var{addr} is the address in user address space where you want @value{GDBN}
-to begin modifying the ADI version tags.
+@var{addr} is the address in user address space where you want @value{GDBN}
+to begin modifying the ADI version tags.
@var{tag} is the new ADI version tag.
-For example, do the following to modify then verify ADI versions of
+For example, do the following to modify then verify ADI versions of
variable "shmaddr":
@smallexample
@@ -27556,6 +27855,16 @@ or a prompt that does not.
@item set prompt @var{newprompt}
Directs @value{GDBN} to use @var{newprompt} as its prompt string henceforth.
+For example, this will set a blue-colored ``(gdb)'' prompt:
+
+@smallexample
+set prompt \001\033[0;34m\002(gdb)\001\033[0m\002
+@end smallexample
+
+It uses @samp{\001} and @samp{\002} to begin and end a sequence of
+non-printing characters, to make sure they're not counted in the string
+length.
+
@kindex show prompt
@item show prompt
Prints a line of the form: @samp{Gdb's prompt is: @var{your-prompt}}
@@ -27891,6 +28200,19 @@ value, then @value{GDBN} will change this to @samp{off} at startup.
@item show style enabled
Show the current state of styling.
+@item set style emoji @samp{auto|on|off}
+Enable or disable the use of emoji. On most hosts, the default is
+@samp{auto}, meaning that emoji will only be used if the host
+character set is @samp{UTF-8}; however, on Windows the default is
+@samp{off} when using the console. Note that disabling styling as a
+whole will also prevent emoji display.
+
+Currently, emoji are printed whenever @value{GDBN} reports an error or
+a warning.
+
+@item show style emoji
+Show the current state of emoji output.
+
@item set style sources @samp{on|off}
Enable or disable source code styling. This affects whether source
code, such as the output of the @code{list} command, is styled. The
@@ -27907,6 +28229,18 @@ then it will be used.
@item show style sources
Show the current state of source code styling.
+@anchor{warning-prefix}
+@item set style warning-prefix
+@itemx show style warning-prefix
+@itemx set style error-prefix
+@itemx show style error-prefix
+
+These commands control the prefix that is printed before warnings and
+errors, respectively. This functionality is intended for use with
+emoji display, and so the prefixes are only displayed if emoji styling
+is enabled. The defaults are the warning sign emoji for warnings, and
+and the cross mark emoji for errors.
+
@item set style tui-current-position @samp{on|off}
Enable or disable styling of the source and assembly code highlighted
by the TUI's current position indicator. The default is @samp{off}.
@@ -28952,7 +29286,7 @@ Show the current state of @sc{gnu}/Hurd debugging messages.
@item set debug infrun
@cindex inferior debugging info
Turns on or off display of @value{GDBN} debugging info for running the inferior.
-The default is off. @file{infrun.c} contains GDB's runtime state machine used
+The default is off. @file{infrun.c} contains GDB's runtime state machine used
for implementing operations such as single-stepping the inferior.
@item show debug infrun
Displays the current state of @value{GDBN} inferior debugging.
@@ -31209,138 +31543,13 @@ appropriate @code{set style} commands. @xref{Output Styling}.
@cindex Emacs
@cindex @sc{gnu} Emacs
-A special interface allows you to use @sc{gnu} Emacs to view (and
-edit) the source files for the program you are debugging with
-@value{GDBN}.
-
-To use this interface, use the command @kbd{M-x gdb} in Emacs. Give the
-executable file you want to debug as an argument. This command starts
-@value{GDBN} as a subprocess of Emacs, with input and output through a newly
-created Emacs buffer.
-@c (Do not use the @code{-tui} option to run @value{GDBN} from Emacs.)
-
-Running @value{GDBN} under Emacs can be just like running @value{GDBN} normally except for two
-things:
-
-@itemize @bullet
-@item
-All ``terminal'' input and output goes through an Emacs buffer, called
-the GUD buffer.
-
-This applies both to @value{GDBN} commands and their output, and to the input
-and output done by the program you are debugging.
-
-This is useful because it means that you can copy the text of previous
-commands and input them again; you can even use parts of the output
-in this way.
-
-All the facilities of Emacs' Shell mode are available for interacting
-with your program. In particular, you can send signals the usual
-way---for example, @kbd{C-c C-c} for an interrupt, @kbd{C-c C-z} for a
-stop.
-@item
-@value{GDBN} displays source code through Emacs.
-
-Each time @value{GDBN} displays a stack frame, Emacs automatically finds the
-source file for that frame and puts an arrow (@samp{=>}) at the
-left margin of the current line. Emacs uses a separate buffer for
-source display, and splits the screen to show both your @value{GDBN} session
-and the source.
-
-Explicit @value{GDBN} @code{list} or search commands still produce output as
-usual, but you probably have no reason to use them from Emacs.
-@end itemize
-
-We call this @dfn{text command mode}. Emacs 22.1, and later, also uses
-a graphical mode, enabled by default, which provides further buffers
-that can control the execution and describe the state of your program.
-@xref{GDB Graphical Interface,,, Emacs, The @sc{gnu} Emacs Manual}.
-
-If you specify an absolute file name when prompted for the @kbd{M-x
-gdb} argument, then Emacs sets your current working directory to where
-your program resides. If you only specify the file name, then Emacs
-sets your current working directory to the directory associated
-with the previous buffer. In this case, @value{GDBN} may find your
-program by searching your environment's @env{PATH} variable, but on
-some operating systems it might not find the source. So, although the
-@value{GDBN} input and output session proceeds normally, the auxiliary
-buffer does not display the current source and line of execution.
-
-The initial working directory of @value{GDBN} is printed on the top
-line of the GUD buffer and this serves as a default for the commands
-that specify files for @value{GDBN} to operate on. @xref{Files,
-,Commands to Specify Files}.
-
-By default, @kbd{M-x gdb} calls the program called @file{gdb}. If you
-need to call @value{GDBN} by a different name (for example, if you
-keep several configurations around, with different names) you can
-customize the Emacs variable @code{gud-gdb-command-name} to run the
-one you want.
-
-In the GUD buffer, you can use these special Emacs commands in
-addition to the standard Shell mode commands:
-
-@table @kbd
-@item C-h m
-Describe the features of Emacs' GUD Mode.
-
-@item C-c C-s
-Execute to another source line, like the @value{GDBN} @code{step} command; also
-update the display window to show the current file and location.
+In @sc{gnu} Emacs there is a special interface to @value{GDBN}, which
+facilitates viewing the source code for the program you are debugging.
+There is also an IDE-like interface to GDB, with specialized buffers for
+breakpoints, stack frames and other aspects of the debugger state.
-@item C-c C-n
-Execute to next source line in this function, skipping all function
-calls, like the @value{GDBN} @code{next} command. Then update the display window
-to show the current file and location.
-
-@item C-c C-i
-Execute one instruction, like the @value{GDBN} @code{stepi} command; update
-display window accordingly.
-
-@item C-c C-f
-Execute until exit from the selected stack frame, like the @value{GDBN}
-@code{finish} command.
-
-@item C-c C-r
-Continue execution of your program, like the @value{GDBN} @code{continue}
-command.
-
-@item C-c <
-Go up the number of frames indicated by the numeric argument
-(@pxref{Arguments, , Numeric Arguments, Emacs, The @sc{gnu} Emacs Manual}),
-like the @value{GDBN} @code{up} command.
-
-@item C-c >
-Go down the number of frames indicated by the numeric argument, like the
-@value{GDBN} @code{down} command.
-@end table
-
-In any source file, the Emacs command @kbd{C-x @key{SPC}} (@code{gud-break})
-tells @value{GDBN} to set a breakpoint on the source line point is on.
-
-In text command mode, if you type @kbd{M-x speedbar}, Emacs displays a
-separate frame which shows a backtrace when the GUD buffer is current.
-Move point to any frame in the stack and type @key{RET} to make it
-become the current frame and display the associated source in the
-source buffer. Alternatively, click @kbd{Mouse-2} to make the
-selected frame become the current one. In graphical mode, the
-speedbar displays watch expressions.
-
-If you accidentally delete the source-display buffer, an easy way to get
-it back is to type the command @code{f} in the @value{GDBN} buffer, to
-request a frame display; when you run under Emacs, this recreates
-the source buffer if necessary to show you the context of the current
-frame.
-
-The source files displayed in Emacs are in ordinary Emacs buffers
-which are visiting the source files in the usual way. You can edit
-the files with these buffers if you wish; but keep in mind that @value{GDBN}
-communicates with Emacs in terms of line numbers. If you add or
-delete lines from the text, the line numbers that @value{GDBN} knows cease
-to correspond properly with the code.
-
-A more detailed description of Emacs' interaction with @value{GDBN} is
+A detailed description of Emacs' interaction with @value{GDBN} is
given in the Emacs manual (@pxref{Debuggers,,, Emacs, The @sc{gnu}
Emacs Manual}).
@@ -31361,7 +31570,7 @@ in the form of a reference manual.
Note that @sc{gdb/mi} is still under construction, so some of the
features described below are incomplete and subject to change
-(@pxref{GDB/MI Development and Front Ends, , @sc{gdb/mi} Development and Front Ends}).
+(@pxref{GDB/MI Development and Front Ends, , @sc{gdb/mi} Development and Front Ends}).
@unnumberedsec Notation and Terminology
@@ -31447,7 +31656,7 @@ a command and reported as part of that command response.
The important examples of notifications are:
@itemize @bullet
-@item
+@item
Exec notifications. These are used to report changes in
target state---when a target is resumed, or stopped. It would not
be feasible to include this information in response of resuming
@@ -31456,7 +31665,7 @@ different threads. Also, quite some time may pass before any event
happens in the target, while a frontend needs to know whether the resuming
command itself was successfully executed.
-@item
+@item
Console output, and status notifications. Console output
notifications are used to report output of CLI commands, as well as
diagnostics for other commands. Status notifications are used to
@@ -31476,8 +31685,8 @@ orthogonal frontend design.
There's no guarantee that whenever an MI command reports an error,
@value{GDBN} or the target are in any specific state, and especially,
the state is not reverted to the state before the MI command was
-processed. Therefore, whenever an MI command results in an error,
-we recommend that the frontend refreshes all the information shown in
+processed. Therefore, whenever an MI command results in an error,
+we recommend that the frontend refreshes all the information shown in
the user interface.
@@ -31499,7 +31708,7 @@ be specified. The CLI interface maintains the selected thread and frame,
and supplies them to target on each command. This is convenient,
because a command line user would not want to specify that information
explicitly on each command, and because user interacts with
-@value{GDBN} via a single terminal, so no confusion is possible as
+@value{GDBN} via a single terminal, so no confusion is possible as
to what thread and frame are the current ones.
In the case of MI, the concept of selected thread and frame is less
@@ -31525,7 +31734,7 @@ frontend's selection to the one specified by user. @value{GDBN}
communicates the suggestion to change current thread and frame using the
@samp{=thread-selected} notification.
-Note that historically, MI shares the selected thread with CLI, so
+Note that historically, MI shares the selected thread with CLI, so
frontends used the @code{-thread-select} to execute commands in the
right context. However, getting this to work right is cumbersome. The
simplest way is for frontend to emit @code{-thread-select} command
@@ -31554,7 +31763,7 @@ For instance:
@smallexample
-data-evaluate-expression --language c "sizeof (void*)"
^done,value="4"
-(gdb)
+(gdb)
@end smallexample
The valid language names are the same names accepted by the
@@ -31635,8 +31844,8 @@ hardware systems, each one having several cores with several different
processes running on each core. This section describes the MI
mechanism to support such debugging scenarios.
-The key observation is that regardless of the structure of the
-target, MI can have a global list of threads, because most commands that
+The key observation is that regardless of the structure of the
+target, MI can have a global list of threads, because most commands that
accept the @samp{--thread} option do not need to know what process that
thread belongs to. Therefore, it is not necessary to introduce
neither additional @samp{--process} option, nor an notion of the
@@ -32177,7 +32386,7 @@ A breakpoint was reached.
A watchpoint was triggered.
@item read-watchpoint-trigger
A read watchpoint was triggered.
-@item access-watchpoint-trigger
+@item access-watchpoint-trigger
An access watchpoint was triggered.
@item function-finished
An -exec-finish or similar CLI command was accomplished.
@@ -32186,15 +32395,15 @@ An -exec-until or similar CLI command was accomplished.
@item watchpoint-scope
A watchpoint has gone out of scope.
@item end-stepping-range
-An -exec-next, -exec-next-instruction, -exec-step, -exec-step-instruction or
+An -exec-next, -exec-next-instruction, -exec-step, -exec-step-instruction or
similar CLI command was accomplished.
-@item exited-signalled
+@item exited-signalled
The inferior exited because of a signal.
-@item exited
+@item exited
The inferior exited.
-@item exited-normally
+@item exited-normally
The inferior exited normally.
-@item signal-received
+@item signal-received
A signal was received by the inferior.
@item solib-event
The inferior has stopped due to a library being loaded or unloaded.
@@ -34267,8 +34476,8 @@ other cases.
@end smallexample
Resumes the execution of the inferior program, which will continue
-to execute until it reaches a debugger stop event. If the
-@samp{--reverse} option is specified, execution resumes in reverse until
+to execute until it reaches a debugger stop event. If the
+@samp{--reverse} option is specified, execution resumes in reverse until
it reaches a stop event. Stop events may include
@itemize @bullet
@item
@@ -35263,10 +35472,10 @@ object, or to change display format.
Variable objects have hierarchical tree structure. Any variable object
that corresponds to a composite type, such as structure in C, has
a number of child variable objects, for example corresponding to each
-element of a structure. A child variable object can itself have
-children, recursively. Recursion ends when we reach
+element of a structure. A child variable object can itself have
+children, recursively. Recursion ends when we reach
leaf variable objects, which always have built-in types. Child variable
-objects are created only by explicit request, so if a frontend
+objects are created only by explicit request, so if a frontend
is not interested in the children of a particular variable object, no
child will be created.
@@ -35275,7 +35484,7 @@ string, or set the value from a string. String value can be also
obtained for a non-leaf variable object, but it's generally a string
that only indicates the type of the object, and does not list its
contents. Assignment to a non-leaf variable object is not allowed.
-
+
A frontend does not need to read the values of all variable objects each time
the program stops. Instead, MI provides an update command that lists all
variable objects whose values has changed since the last update
@@ -35292,7 +35501,7 @@ relatively slow for embedded targets, so a frontend might want
to disable automatic update for the variables that are either not
visible on the screen, or ``closed''. This is possible using so
called ``frozen variable objects''. Such variable objects are never
-implicitly updated.
+implicitly updated.
Variable objects can be either @dfn{fixed} or @dfn{floating}. For the
fixed variable object, the expression is parsed when the variable
@@ -35533,8 +35742,8 @@ but with padding zeroes to the left of the value. For example, a 32-bit
hexadecimal value of 0x1234 would be represented as 0x00001234 in the
zero-hexadecimal format.
-For a variable with children, the format is set only on the
-variable itself, and the children are not affected.
+For a variable with children, the format is set only on the
+variable itself, and the children are not affected.
@findex -var-show-format
@subheading The @code{-var-show-format} Command
@@ -35750,7 +35959,7 @@ Returns an expression that can be evaluated in the current
context and will yield the same value that a variable object has.
Compare this with the @code{-var-info-expression} command, which
result can be used only for UI presentation. Typical use of
-the @code{-var-info-path-expression} command is creating a
+the @code{-var-info-path-expression} command is creating a
watchpoint from a variable object.
This command is currently not valid for children of a dynamic varobj,
@@ -35795,10 +36004,10 @@ where @var{attr} is @code{@{ @{ editable | noneditable @} | TBD @}}.
Evaluates the expression that is represented by the specified variable
object and returns its value as a string. The format of the string
-can be specified with the @samp{-f} option. The possible values of
-this option are the same as for @code{-var-set-format}
+can be specified with the @samp{-f} option. The possible values of
+this option are the same as for @code{-var-set-format}
(@pxref{-var-set-format}). If the @samp{-f} option is not specified,
-the current display format will be used. The current display format
+the current display format will be used. The current display format
can be changed using the @code{-var-set-format} command.
@smallexample
@@ -35975,12 +36184,12 @@ type_changed="false"@}]
Set the frozenness flag on the variable object @var{name}. The
@var{flag} parameter should be either @samp{1} to make the variable
frozen or @samp{0} to make it unfrozen. If a variable object is
-frozen, then neither itself, nor any of its children, are
-implicitly updated by @code{-var-update} of
+frozen, then neither itself, nor any of its children, are
+implicitly updated by @code{-var-update} of
a parent variable or by @code{-var-update *}. Only
@code{-var-update} of the variable itself will update its value and
values of its children. After a variable object is unfrozen, it is
-implicitly updated by all subsequent @code{-var-update} operations.
+implicitly updated by all subsequent @code{-var-update} operations.
Unfreezing a variable does not update it, only subsequent
@code{-var-update} does.
@@ -38314,7 +38523,7 @@ Signal handling commands are not implemented.
Attach to a process @var{pid} or a file @var{file} outside of
@value{GDBN}, or a thread group @var{gid}. If attaching to a thread
-group, the id previously returned by
+group, the id previously returned by
@samp{-list-thread-groups --available} must be used.
@subsubheading @value{GDBN} Command
@@ -38867,7 +39076,7 @@ Example output:
@smallexample
(gdb) -list-features
-^done,result=["feature1","feature2"]
+^done,features=["feature1","feature2"]
@end smallexample
The current list of features is:
@@ -38922,7 +39131,7 @@ to an array, structure, or union.
@subheading The @code{-list-target-features} Command
Returns a list of particular features that are supported by the
-target. Those features affect the permitted MI commands, but
+target. Those features affect the permitted MI commands, but
unlike the features reported by the @code{-list-features} command, the
features depend on which target GDB is using at the moment. Whenever
a target can change, due to commands such as @code{-target-select},
@@ -38932,7 +39141,7 @@ Example output:
@smallexample
(gdb) -list-target-features
-^done,result=["async"]
+^done,features=["async"]
@end smallexample
The current list of features is:
@@ -39310,6 +39519,11 @@ with no connection yet. You can then for example use the
@code{gdbserver} instance, use @code{-exec-run} to spawn a local
program, etc.
+If the connection of the current inferior cannot be shared, e.g.@: the
+@code{-target-select core} target cannot be shared between inferiors,
+then @value{GDBN} will give a warning and create the new inferior
+without a connection.
+
The command response always has a field, @var{inferior}, whose value
is the identifier of the thread group corresponding to the new
inferior.
@@ -39381,7 +39595,7 @@ The corresponding @value{GDBN} command is @samp{remove-inferiors}
@smallexample
-interpreter-exec @var{interpreter} @var{command}
@end smallexample
-@anchor{-interpreter-exec}
+@anchor{-interpreter-exec}
Execute the specified @var{command} in the given @var{interpreter}.
@@ -40008,7 +40222,7 @@ normal exception and not normally be logged.
This chapter documents @value{GDBN}'s @dfn{just-in-time} (JIT) compilation
interface. A JIT compiler is a program or library that generates native
executable code at runtime and executes it, usually in order to achieve good
-performance while maintaining platform independence.
+performance while maintaining platform independence.
Programs that use JIT compilation are normally difficult to debug because
portions of their code are generated at runtime, instead of being loaded from
@@ -41264,6 +41478,14 @@ Configure @value{GDBN} for cross-debugging programs running on the
specified list of targets. The special value @samp{all} configures
@value{GDBN} for debugging programs running on any target it supports.
+@item --enable-binary-file-formats=@r{[}@var{format}@r{]}@dots{}
+@itemx --enable-binary-file-formats=all
+Configure @value{GDBN} to support certain binary file formats. If a
+format is the main (or only) file format for a given target, the
+configure script may add support to it anyway, and warn the user.
+If not given, all file formats that @value{GDBN} supports are compiled
+in.
+
@item --with-gdb-datadir=@var{path}
Set the @value{GDBN}-specific data directory. @value{GDBN} will look
here for certain supporting files or scripts. This defaults to the
@@ -41351,7 +41573,7 @@ libpython is present and found at configure time.) Python makes
@value{GDBN} scripting much more powerful than the restricted CLI
scripting language. If your host does not have Python installed, you
can find it on @url{http://www.python.org/download/}. The oldest version
-of Python supported by GDB is 3.0.1. The optional argument @var{python}
+of Python supported by GDB is 3.4. The optional argument @var{python}
is used to find the Python headers and libraries. It can be either
the name of a Python executable, or the name of the directory in which
Python is installed.
@@ -41440,7 +41662,7 @@ If @value{GDBN} has been configured with the option @option{--prefix=$prefix},
they may be subject to relocation. Two possible cases:
@itemize @bullet
-@item
+@item
If the default location of this init file/directory contains @file{$prefix},
it will be subject to relocation. Suppose that the configure options
are @option{--prefix=$prefix --with-system-gdbinit=$prefix/etc/gdbinit};
@@ -41549,6 +41771,13 @@ into remote agent bytecodes and display them as a disassembled list.
This command is useful for debugging the agent version of dynamic
printf (@pxref{Dynamic Printf}).
+@kindex maint canonicalize
+@item maint canonicalize @var{name}
+Print the canonical form of @var{name}, a C@t{++} name. Because a
+C@t{++} name may have multiple possible spellings, @value{GDBN}
+computes a canonical form of a name for internal use. For example,
+@code{short int} and @code{short} are two ways to name the same type.
+
@kindex maint info breakpoints
@anchor{maint info breakpoints}
@item maint info breakpoints
@@ -41702,6 +41931,7 @@ GLOBAL Disassembler_2 (Matches current architecture)
@cindex out-of-line single-stepping
@item set displaced-stepping
@itemx show displaced-stepping
+@anchor{displaced-stepping}
Control whether or not @value{GDBN} will do @dfn{displaced stepping}
if the target supports it. Displaced stepping is a way to single-step
over breakpoints without removing them from the inferior, by executing
@@ -42678,6 +42908,26 @@ These are representative commands for each @var{kind} of setting type
@value{GDBN} supports. They are used by the testsuite for exercising
the settings infrastructure.
+@kindex maint test-remote-args
+@item maint test-remote-args @var{args}
+For targets that don't support passing inferior arguments as a single
+string (@pxref{single-inf-arg}), @value{GDBN} will attempt to split
+the inferior arguments before passing them to the remote target, and
+the remote target might choose to join the inferior arguments upon
+receipt. Historically gdbserver did join inferior arguments, but now
+it will request inferior arguments be passed as a single string if
+@value{GDBN} supports this feature.
+
+This maintenance command splits @var{args} as @value{GDBN} would
+normally split such an argument string before passing the arguments to
+a remote target, the split arguments are then printed.
+
+The split arguments are then joined together as gdbserver would join
+them, and the result is printed.
+
+This command is intended to help diagnose issues passing inferior
+arguments to remote targets.
+
@kindex maint set backtrace-on-fatal-signal
@kindex maint show backtrace-on-fatal-signal
@item maint set backtrace-on-fatal-signal [on|off]
@@ -42745,6 +42995,7 @@ reports and error and the command is aborted.
@item show watchdog
Show the current setting of the target wait timeout.
+
@end table
@node Remote Protocol
@@ -42838,7 +43089,7 @@ debugging stub incorporated in your program) sends a @var{response}. In
the case of step and continue @var{command}s, the response is only sent
when the operation has completed, and the target has again stopped all
threads in all attached processes. This is the default all-stop mode
-behavior, but the remote protocol also supports @value{GDBN}'s non-stop
+behavior, but the remote protocol also supports @value{GDBN}'s non-stop
execution mode; see @ref{Remote Non-Stop}, for details.
@var{packet-data} consists of a sequence of characters with the
@@ -42974,7 +43225,7 @@ bytes @samp{foo}, followed by a @var{bar}, followed directly by a
@var{baz}.
@cindex @var{thread-id}, in remote protocol
-@anchor{thread-id syntax}
+@anchor{thread-id syntax}
Several packets and replies include a @var{thread-id} field to identify
a thread. Normally these are positive numbers with a target-specific
interpretation, formatted as big-endian hex strings. A @var{thread-id}
@@ -43116,7 +43367,7 @@ Don't use this packet; instead, define a general set packet
@item D
@itemx D;@var{pid}
@cindex @samp{D} packet
-The first form of the packet is used to detach @value{GDBN} from the
+The first form of the packet is used to detach @value{GDBN} from the
remote system. It is sent to the remote target
before @value{GDBN} disconnects via the @code{detach} command.
@@ -43397,10 +43648,10 @@ attached without being stopped if that is supported by the target.
@c In non-stop mode, on a successful vAttach, the stub should set the
@c current thread to a thread of the newly-attached process. After
@c attaching, GDB queries for the attached process's thread ID with qC.
-@c Also note that, from a user perspective, whether or not the
-@c target is stopped on attach in non-stop mode depends on whether you
-@c use the foreground or background version of the attach command, not
-@c on what vAttach does; GDB does the right thing with respect to either
+@c Also note that, from a user perspective, whether or not the
+@c target is stopped on attach in non-stop mode depends on whether you
+@c use the foreground or background version of the attach command, not
+@c on what vAttach does; GDB does the right thing with respect to either
@c stopping or restarting threads.
This packet is only available in extended mode (@pxref{extended mode}).
@@ -43459,7 +43710,7 @@ in a degenerate way as a single instruction step operation.)
@end table
-The optional argument @var{addr} normally associated with the
+The optional argument @var{addr} normally associated with the
@samp{c}, @samp{C}, @samp{s}, and @samp{S} packets is
not supported in @samp{vCont}.
@@ -43601,6 +43852,12 @@ command line. The file and arguments are hex-encoded strings. If
(e.g.@: the last program run). The program is created in the stopped
state.
+If @value{GDBN} sent the @samp{single-inf-arg} feature in the
+@samp{qSupported} packet (@pxref{single-inf-arg}), and the stub replied
+with @samp{single-inf-arg+}, then there will only be a single
+@var{argument} string, which includes all inferior arguments,
+separated with whitespace.
+
@c FIXME: What about non-stop mode?
This packet is only available in extended mode (@pxref{extended mode}).
@@ -43888,10 +44145,10 @@ list of loaded libraries. The @var{r} part is ignored.
@cindex replay log events, remote reply
@item replaylog
-The packet indicates that the target cannot continue replaying
+The packet indicates that the target cannot continue replaying
logged execution events, because it has reached the end (or the
beginning when executing backward) of the log. The value of @var{r}
-will be either @samp{begin} or @samp{end}. @xref{Reverse Execution},
+will be either @samp{begin} or @samp{end}. @xref{Reverse Execution},
for more information.
@item swbreak
@@ -44143,7 +44400,7 @@ Return the current thread ID.
Reply:
@table @samp
@item QC @var{thread-id}
-Where @var{thread-id} is a thread ID as documented in
+Where @var{thread-id} is a thread ID as documented in
@ref{thread-id syntax}.
@item @r{(anything else)}
Any other reply implies the old thread ID.
@@ -44397,7 +44654,7 @@ information associated with the variable.)
@var{lm} is the (big endian, hex encoded) OS/ABI-specific encoding of the
load module associated with the thread local storage. For example,
a @sc{gnu}/Linux system will pass the link map address of the shared
-object associated with the thread local storage under consideration.
+object associated with the thread local storage under consideration.
Other operating environments may choose to represent the load module
differently, so the precise meaning of this parameter will vary.
@@ -44568,7 +44825,7 @@ kept at fixed offsets relative to the last relocated segment.
@cindex thread information, remote request
@cindex @samp{qP} packet
Returns information on @var{thread-id}. Where: @var{mode} is a hex
-encoded 32 bit mode; @var{thread-id} is a thread ID
+encoded 32 bit mode; @var{thread-id} is a thread ID
(@pxref{thread-id syntax}).
Don't use this packet; use the @samp{qThreadExtraInfo} query instead
@@ -44592,7 +44849,7 @@ The request succeeded.
This packet is not probed by default; the remote stub must request it,
by supplying an appropriate @samp{qSupported} response (@pxref{qSupported}).
-Use of this packet is controlled by the @code{set non-stop} command;
+Use of this packet is controlled by the @code{set non-stop} command;
@pxref{Non-Stop Mode}.
@item QCatchSyscalls:1 @r{[};@var{sysno}@r{]}@dots{}
@@ -44635,7 +44892,7 @@ by supplying an appropriate @samp{qSupported} response (@pxref{qSupported}).
@cindex pass signals to inferior, remote request
@cindex @samp{QPassSignals} packet
@anchor{QPassSignals}
-Each listed @var{signal} should be passed directly to the inferior process.
+Each listed @var{signal} should be passed directly to the inferior process.
Signals are numbered identically to continue packets and stop replies
(@pxref{Stop Reply Packets}). Each @var{signal} list item should be
strictly greater than the previous item. These signals do not need to stop
@@ -44842,7 +45099,8 @@ packets.)
@anchor{qSearch memory}
Search @var{length} bytes at @var{address} for @var{search-pattern}.
Both @var{address} and @var{length} are encoded in hex;
-@var{search-pattern} is a sequence of bytes, also hex encoded.
+@var{search-pattern} is a sequence of binary-encoded bytes
+(@pxref{Binary Data}).
Reply:
@table @samp
@@ -44923,11 +45181,11 @@ state, even if the stub had previously been communicating with
a different version of @value{GDBN}.
The following values of @var{gdbfeature} (for the packet sent by @value{GDBN})
-are defined:
+are defined:
@table @samp
@item multiprocess
-This feature indicates whether @value{GDBN} supports multiprocess
+This feature indicates whether @value{GDBN} supports multiprocess
extensions to the remote protocol. @value{GDBN} does not use such
extensions unless the stub also reports that it supports them by
including @samp{multiprocess+} in its @samp{qSupported} reply.
@@ -44984,6 +45242,14 @@ didn't support @samp{E.@var{errtext}}, and older versions of
New packets should be written to support @samp{E.@var{errtext}}
regardless of this feature being true or not.
+
+@anchor{single-inf-arg}
+@item single-inf-arg
+This feature indicates that @value{GDBN} would like to send the
+inferior arguments as a single string within the @samp{vRun} packet.
+@value{GDBN} will not send the arguments as a single string unless the
+stub also reports that it supports this behaviour by including
+@samp{single-inf-arg+} in its @samp{qSupported} reply.
@end table
Stubs should ignore any unknown values for
@@ -45287,6 +45553,11 @@ These are the currently defined stub features and their properties:
@tab @samp{-}
@tab No
+@item @samp{single-inf-arg}
+@tab No
+@tab @samp{-}
+@tab No
+
@end multitable
These are the currently defined stub features, in more detail:
@@ -45536,6 +45807,12 @@ if it sent the @samp{error-message} feature.
@item binary-upload
The remote stub supports the @samp{x} packet (@pxref{x packet}).
+
+@item single-inf-arg
+The remote stub would like to receive the inferior arguments as a
+single string within the @samp{vRun} packet. The stub should only
+send this feature if @value{GDBN} sent @samp{single-inf-arg+} in the
+@samp{qSupported} packet.
@end table
@item qSymbol::
@@ -45619,13 +45896,13 @@ packets.)
@itemx QTSave
@itemx qTsP
@itemx qTsV
-@itemx QTStart
-@itemx QTStop
+@itemx QTStart
+@itemx QTStop
@itemx QTEnable
@itemx QTDisable
-@itemx QTinit
-@itemx QTro
-@itemx qTStatus
+@itemx QTinit
+@itemx QTro
+@itemx qTStatus
@itemx qTV
@itemx qTfSTM
@itemx qTsSTM
@@ -45753,7 +46030,7 @@ stub indicated it supports the augmented form of this packet
by supplying an appropriate @samp{qSupported} response
(@pxref{qXfer read}, @ref{qSupported}).
-This packet is optional for better performance on SVR4 targets.
+This packet is optional for better performance on SVR4 targets.
@value{GDBN} uses memory read packets to read the SVR4 library list otherwise.
This packet is not probed by default; the remote stub must request it,
@@ -45924,6 +46201,45 @@ The remote server attached to an existing process.
The remote server created a new process.
@end table
+@cindex query executable, remote request
+@cindex query program arguments, remote request
+@cindex @samp{qExecAndArgs} packet
+@item qExecAndArgs
+@anchor{qExecAndArgs}
+Return the program filename and arguments string with which the remote
+server was started, if the remote server was started with such things.
+If the remote server was started without the filename of a program to
+execute, or without any arguments, then the reply indicates this.
+
+Reply:
+@table @samp
+@item U
+The program filename and arguments are unset. If @value{GDBN} wants
+to start a new inferior, for example with @samp{vRun}, then it will
+need to provide the filename of a program to use.
+
+@item S;@var{prog};@var{args};
+@itemx S;;@var{args};
+The program filename provided to the remote server when it started was
+@var{prog}, which is a hex encoded string. The complete argument
+string passed to the inferior when it started as @var{args}, this is
+also a hex encoded string.
+
+If no arguments were passed when the inferior started then @var{args}
+be an empty string.
+
+It is valid for @var{prog} to be the empty string, this indicates that
+the server has no program set, @value{GDBN} will need to supply a
+program name in order to start a new inferior. It is valid to reply
+with an empty @var{prog} and non-empty @var{args}, @value{GDBN} will
+set the inferior arguments, but the user will need to supply a remote
+exec-file before an inferior can be started.
+
+The argument string @var{args} is passed directly to @value{GDBN} as
+if to the @kbd{set args} command. And escaping required should be
+present in @var{args}, no changes are made by @value{GDBN}.
+@end table
+
@item Qbtrace:bts
Enable branch tracing for the current thread using Branch Trace Store.
@@ -46721,12 +47037,28 @@ If an error occurs the return value is -1. The format of the
returned binary attachment is as described in @ref{struct stat}.
@item vFile:stat: @var{filename}
-Get information about the file @var{filename} on the target.
-On success the information is returned as a binary attachment
-and the return value is the size of this attachment in bytes.
-If an error occurs the return value is -1. The format of the
+Get information about the file @var{filename} on the target as if from
+a @samp{stat} call. On success the information is returned as a binary
+attachment and the return value is the size of this attachment in
+bytes. If an error occurs the return value is -1. The format of the
returned binary attachment is as described in @ref{struct stat}.
+If @var{filename} is a symbolic link, then the information returned is
+about the file the link refers to, this is inline with the @samp{stat}
+library call.
+
+@item vFile:lstat: @var{filename}
+Get information about the file @var{filename} on the target as if from
+an @samp{lstat} call. On success the information is returned as a
+binary attachment and the return value is the size of this attachment
+in bytes. If an error occurs the return value is -1. The format of
+the returned binary attachment is as described in @ref{struct stat}.
+
+This packet is identical to @samp{vFile:stat}, except if
+@var{filename} is a symbolic link, then this packet returns
+information about the link itself, not the file that the link refers
+to, this is inline with the @samp{lstat} library call.
+
@item vFile:unlink: @var{filename}
Delete the file at @var{filename} on the target. Return 0,
or -1 if an error occurs. The @var{filename} is a string.
@@ -46796,7 +47128,7 @@ packet}) with the usual packet framing instead of the single byte
Stubs are not required to recognize these interrupt mechanisms and the
precise meaning associated with receipt of the interrupt is
implementation defined. If the target supports debugging of multiple
-threads and/or processes, it should attempt to interrupt all
+threads and/or processes, it should attempt to interrupt all
currently-executing threads and processes.
If the stub is successful at interrupting the
running program, it should send one of the stop
@@ -46928,7 +47260,7 @@ The following notifications are defined:
@tab vStopped
@tab @var{reply}. The @var{reply} has the form of a stop reply, as
described in @ref{Stop Reply Packets}. Refer to @ref{Remote Non-Stop},
-for information on how these notifications are acknowledged by
+for information on how these notifications are acknowledged by
@value{GDBN}.
@tab Report an asynchronous stop event in non-stop mode.
@@ -46962,7 +47294,7 @@ to run. When reporting a @samp{W} or @samp{X} response, all running
threads belonging to other attached processes continue to run.
In non-stop mode, the target shall respond to the @samp{?} packet as
-follows. First, any incomplete stop reply notification/@samp{vStopped}
+follows. First, any incomplete stop reply notification/@samp{vStopped}
sequence in progress is abandoned. The target must begin a new
sequence reporting stop events for all stopped threads, whether or not
it has previously reported those events to @value{GDBN}. The first
@@ -47097,12 +47429,12 @@ It uses its own internal representation of datatypes and values. Both
translating the system-dependent value representations into the internal
protocol representations when data is transmitted.
-The communication is synchronous. A system call is possible only when
-@value{GDBN} is waiting for a response from the @samp{C}, @samp{c}, @samp{S}
+The communication is synchronous. A system call is possible only when
+@value{GDBN} is waiting for a response from the @samp{C}, @samp{c}, @samp{S}
or @samp{s} packets. While @value{GDBN} handles the request for a system call,
the target is stopped to allow deterministic access to the target's
memory. Therefore File-I/O is not interruptible by target signals. On
-the other hand, it is possible to interrupt File-I/O by a user interrupt
+the other hand, it is possible to interrupt File-I/O by a user interrupt
(@samp{Ctrl-C}) within @value{GDBN}.
The target's request to perform a host system call does not finish
@@ -47120,7 +47452,7 @@ request from @value{GDBN} is required.
<- target hits breakpoint and sends a Txx packet
@end smallexample
-The protocol only supports I/O on the console and to regular files on
+The protocol only supports I/O on the console and to regular files on
the host file system. Character or block special devices, pipes,
named pipes, sockets or any other communication method on the host
system are not supported by this protocol.
@@ -47133,7 +47465,7 @@ File I/O is not supported in non-stop mode.
The File-I/O protocol uses the @code{F} packet as the request as well
as reply packet. Since a File-I/O system call can only occur when
-@value{GDBN} is waiting for a response from the continuing or stepping target,
+@value{GDBN} is waiting for a response from the continuing or stepping target,
the File-I/O request is a reply that @value{GDBN} has to expect as a result
of a previous @samp{C}, @samp{c}, @samp{S} or @samp{s} packet.
This @code{F} packet contains all information needed to allow @value{GDBN}
@@ -47155,7 +47487,7 @@ At this point, @value{GDBN} has to perform the following actions.
@itemize @bullet
@item
-If the parameters include pointer values to data needed as input to a
+If the parameters include pointer values to data needed as input to a
system call, @value{GDBN} requests this data from the target with a
standard @code{m} packet request. This additional communication has to be
expected by the target implementation and is handled as any other @code{m}
@@ -47211,11 +47543,11 @@ The @code{F} request packet has the following format:
@var{call-id} is the identifier to indicate the host system call to be called.
This is just the name of the function.
-@var{parameter@dots{}} are the parameters to the system call.
+@var{parameter@dots{}} are the parameters to the system call.
Parameters are hexadecimal integer values, either the actual values in case
of scalar datatypes, pointers to target buffer space in case of compound
datatypes and unspecified memory areas, or pointer/length pairs in case
-of string parameters. These are appended to the @var{call-id} as a
+of string parameters. These are appended to the @var{call-id} as a
comma-delimited list. All values are transmitted in ASCII
string representation, pointer/length pairs separated by a slash.
@@ -47883,10 +48215,10 @@ The call was interrupted by the user.
@end table
-@value{GDBN} takes over the full task of calling the necessary host calls
-to perform the @code{system} call. The return value of @code{system} on
+@value{GDBN} takes over the full task of calling the necessary host calls
+to perform the @code{system} call. The return value of @code{system} on
the host is simplified before it's returned
-to the target. Any termination signal information from the child process
+to the target. Any termination signal information from the child process
is discarded, and the return value consists
entirely of the exit status of the called command.
@@ -47922,9 +48254,9 @@ protocol.
@unnumberedsubsubsec Integral Datatypes
@cindex integral datatypes, in file-i/o protocol
-The integral datatypes used in the system calls are @code{int},
+The integral datatypes used in the system calls are @code{int},
@code{unsigned int}, @code{long}, @code{unsigned long},
-@code{mode_t}, and @code{time_t}.
+@code{mode_t}, and @code{time_t}.
@code{int}, @code{unsigned int}, @code{mode_t} and @code{time_t} are
implemented as 32 bit values in this protocol.
@@ -47968,10 +48300,10 @@ at address 0x123456 is transmitted as
@cindex memory transfer, in file-i/o protocol
Structured data which is transferred using a memory read or write (for
-example, a @code{struct stat}) is expected to be in a protocol-specific format
+example, a @code{struct stat}) is expected to be in a protocol-specific format
with all scalar multibyte datatypes being big endian. Translation to
-this representation needs to be done both by the target before the @code{F}
-packet is sent, and by @value{GDBN} before
+this representation needs to be done both by the target before the @code{F}
+packet is sent, and by @value{GDBN} before
it transfers memory to the target. Transferred pointers to structured
data should point to the already-coerced data at any time.
@@ -47980,7 +48312,7 @@ data should point to the already-coerced data at any time.
@unnumberedsubsubsec struct stat
@cindex struct stat, in file-i/o protocol
-The buffer of type @code{struct stat} used by the target and @value{GDBN}
+The buffer of type @code{struct stat} used by the target and @value{GDBN}
is defined as follows:
@smallexample
@@ -48121,6 +48453,7 @@ All values are given in decimal representation.
EPERM 1
ENOENT 2
EINTR 4
+ EIO 5
EBADF 9
EACCES 13
EFAULT 14
@@ -48136,6 +48469,7 @@ All values are given in decimal representation.
ENOSPC 28
ESPIPE 29
EROFS 30
+ ENOSYS 88
ENAMETOOLONG 91
EUNKNOWN 9999
@end smallexample
@@ -49194,6 +49528,7 @@ registers using the capitalization used in the description.
@menu
* AArch64 Features::
+* Alpha Features::
* ARC Features::
* ARM Features::
* i386 Features::
@@ -49500,6 +49835,104 @@ of bytes.
Extra registers are allowed in this feature, but they will not affect
@value{GDBN}.
+@subsubsection AArch64 GCS registers feature
+
+The @samp{org.gnu.gdb.aarch64.gcs} feature is optional. If present, it
+means the target supports Guarded Control Stacks and must contain the
+following register:
+
+@itemize @minus
+
+@item
+@code{gcspr}, which points to the thread's Guarded Control Stack. It is 64
+bits in size and has a type of @samp{data_ptr}.
+
+@end itemize
+
+The @samp{org.gnu.gdb.aarch64.gcs.linux} feature is optional. If present,
+then the @samp{org.gnu.gdb.aarch64.gcs} feature must also be present. The
+@samp{org.gnu.gdb.aarch64.gcs.linux} feature represents facilities provided
+by the Linux kernel for GCS support and should contain the following:
+
+@itemize @minus
+
+@item
+@code{gcs_features_enabled} shows the features currently enabled via the
+prctl or ptrace system calls. It is represented as if it were a 64-bit
+register with a custom flags type.
+
+@item
+@code{gcs_features_locked} shows the features currently locked via the
+prctl or ptrace system calls. It is represented as if it were a 64-bit
+register with a custom flags type.
+
+@end itemize
+
+The custom flags type allows @value{GDBN} to print a human-friendly
+representation of the contents of @code{gcs_features_enabled} and
+@code{gcs_features_locked} and should contain:
+
+@itemize @minus
+
+@item
+@code{PR_SHADOW_STACK_ENABLE}
+
+@item
+@code{PR_SHADOW_STACK_WRITE}
+
+@item
+@code{PR_SHADOW_STACK_PUSH}
+
+@end itemize
+
+For further information, see the
+@uref{https://www.kernel.org/doc/html/latest/arch/arm64/gcs.html,ignored,
+documentation} in the Linux kernel.
+
+Extra registers are allowed in these features, but they will not affect
+@value{GDBN}.
+
+@node Alpha Features
+@subsection Alpha Features
+@cindex target descriptions, Alpha Features
+
+The @samp{org.gnu.gdb.alpha.core} feature is required for Alpha targets. It
+must contain the following 64-bit registers; note that @value{GDBN} uses the
+software names for Alpha registers:
+
+@itemize @minus
+@item
+@samp{v0}: function return value
+@item
+@samp{t0} through @samp{t12}: temporary registers
+@item
+@samp{s0} through @samp{s5}: saved registers
+@item
+@samp{fp}: frame pointer
+@item
+@samp{a0} through @samp{a5}: argument registers
+@item
+@samp{ra}: return address
+@item
+@samp{at}: assembler temporary register
+@item
+@samp{gp}: global pointer
+@item
+@samp{sp}: stack pointer
+@item
+@samp{zero}: always zero
+@item
+@samp{f0} through @samp{f30}: floating-point registers
+@item
+@samp{fpcr}: floating-point control register
+@item
+@samp{pc}: program counter
+@item
+@samp{}: an anonymous register for historical purpose
+@item
+@samp{unique}: PALcode memory slot
+@end itemize
+
@node ARC Features
@subsection ARC Features
@cindex target descriptions, ARC Features
@@ -49849,9 +50282,9 @@ targets. It should describe the following registers:
@item
@samp{eflags}, @samp{cs}, @samp{ss}, @samp{ds}, @samp{es},
@samp{fs}, @samp{gs}
-@item
+@item
@samp{st0} through @samp{st7}
-@item
+@item
@samp{fctrl}, @samp{fstat}, @samp{ftag}, @samp{fiseg}, @samp{fioff},
@samp{foseg}, @samp{fooff} and @samp{fop}
@end itemize
@@ -49866,7 +50299,7 @@ describe registers:
@samp{xmm0} through @samp{xmm7} for i386
@item
@samp{xmm0} through @samp{xmm15} for amd64
-@item
+@item
@samp{mxcsr}
@end itemize
@@ -49933,6 +50366,12 @@ The @samp{org.gnu.gdb.i386.pkeys} feature is optional. It should
describe a single register, @samp{pkru}. It is a 32-bit register
valid for i386 and amd64.
+The @samp{org.gnu.gdb.i386.pl3_ssp} feature is optional. It should
+describe the user mode register @samp{pl3_ssp} which has 64 bits on
+amd64, 32 bits on amd64 with 32-bit pointer size (X32) and 32 bits on i386.
+Following the restriction of the Linux kernel, only @value{GDBN} for amd64
+targets makes use of this feature for now.
+
@node LoongArch Features
@subsection LoongArch Features
@cindex target descriptions, LoongArch Features
@@ -49994,7 +50433,7 @@ Linux kernel to control restartable syscalls.
@item @samp{org.gnu.gdb.m68k.core}
@itemx @samp{org.gnu.gdb.coldfire.core}
@itemx @samp{org.gnu.gdb.fido.core}
-One of those features must be always present.
+One of those features must be always present.
The feature that is present determines which flavor of m68k is
used. The feature that is present should contain registers
@samp{d0} through @samp{d7}, @samp{a0} through @samp{a5}, @samp{fp},
@@ -50298,7 +50737,7 @@ contain registers @samp{TSR}, @samp{ILC} and @samp{RILC}.
Users of @value{GDBN} often wish to obtain information about the state of
the operating system running on the target---for example the list of
processes, or the list of open files. This section describes the
-mechanism that makes it possible. This mechanism is similar to the
+mechanism that makes it possible. This mechanism is similar to the
target features mechanism (@pxref{Target Descriptions}), but focuses
on a different aspect of target.
@@ -50452,17 +50891,13 @@ unless otherwise noted:
@enumerate
@item
-The version number, currently 9. Versions 1, 2 and 3 are obsolete.
-Version 4 uses a different hashing function from versions 5 and 6.
-Version 6 includes symbols for inlined functions, whereas versions 4
-and 5 do not. Version 7 adds attributes to the CU indices in the
-symbol table. Version 8 specifies that symbols from DWARF type units
+The version number, currently 9. Versions 1 through 6 are obsolete.
+Version 7 adds attributes to the CU indices in the symbol table.
+Version 8 specifies that symbols from DWARF type units
(@samp{DW_TAG_type_unit}) refer to the type unit's symbol table and not the
compilation unit (@samp{DW_TAG_comp_unit}) using the type. Version 9 adds
the name and the language of the main function to the index.
-@value{GDBN} will only read version 4, 5, or 6 indices
-by specifying @code{set use-deprecated-index-sections on}.
GDB has a workaround for potentially broken version 7 indices so it is
currently not flagged as deprecated.
@@ -50481,7 +50916,8 @@ The offset, from the start of the file, of the address area.
The offset, from the start of the file, of the symbol table.
@item
-The offset, from the start of the file, of the shortcut table.
+The offset, from the start of the file, of the shortcut table. This
+field was introduced with index version 9.
@item
The offset, from the start of the file, of the constant pool.
@@ -50574,6 +51010,8 @@ in the constant pool. This value must be ignored if the value for the language
of main is zero.
@end table
+This data structure was introduced in index version 9.
+
@item
The constant pool. This is simply a bunch of bytes. It is organized
so that alignment is correct: CU vectors are stored first, followed by
@@ -51006,9 +51444,10 @@ Note that targets that give their output via @value{GDBN}, as opposed to writing
directly to @code{stdout}, will also be made silent.
@item --args @var{prog} [@var{arglist}]
-Change interpretation of command line so that arguments following this
-option are passed as arguments to the inferior. As an example, take
-the following command:
+@itemx --no-escape-args @var{prog} [@var{arglist}]
+Change interpretation of command line so that arguments following
+either of these options are passed as arguments to the inferior. As
+an example, take the following command:
@smallexample
gdb ./a.out -q
@@ -51023,7 +51462,44 @@ gdb --args ./a.out -q
@end smallexample
@noindent
-starts @value{GDBN} with the introductory message, and passes the option to the inferior.
+starts @value{GDBN} with the introductory message, and passes the
+option @code{-q} to the inferior.
+
+The difference between @option{--args} and @option{--no-escape-args}
+is whether @value{GDBN} applies escapes to the arguments it sees:
+
+@smallexample
+gdb --args ./a.out *.c
+@end smallexample
+
+@noindent
+in this case the @code{*.c} is expanded by the shell that invokes
+@value{GDBN}, the list of matching files will be fixed in the inferior
+argument list. If instead this is used:
+
+@smallexample
+gdb --args ./a.out '*.c'
+@end smallexample
+
+@noindent
+then the shell that invokes @value{GDBN} will not expand @code{*.c},
+instead @value{GDBN} will escape the @code{*} character, so when a.out
+is invoked it will be passed a literal @code{*.c}. If instead this is
+used:
+
+@smallexample
+gdb --no-escape-args ./a.out '*.c'
+@end smallexample
+
+@noindent
+now @value{GDBN} will not escape the @code{*} character. When the
+inferior is invoked the @code{*.c} will be expanded, and the inferior
+will be passed the list of files as present at the time the inferior
+is invoked.
+
+This change of behaviour can be important if the list of matching
+files could change between the time that @value{GDBN} is started, and
+the time the inferior is started.
@item --pid=@var{pid}
Attach @value{GDBN} to an already running program, with the PID @var{pid}.
@@ -51365,6 +51841,18 @@ additional connections are possible. However, if you start @code{gdbserver}
with the @option{--once} option, it will stop listening for any further
connection attempts after connecting to the first @value{GDBN} session.
+@item --no-escape-args
+By default, inferior arguments passed on the @command{gdbserver}
+command line will have any special shell characters escaped by
+@command{gdbserver}. This ensures that when @command{gdbserver}
+invokes the inferior, the arguments passed to the inferior are
+identical to the arguments passed to @command{gdbserver}.
+
+To disable this escaping, use @option{--no-escape-args}. With this
+option special shell characters will not be escaped. When
+@command{gdbserver} starts a new shell in order to invoke the
+inferior, this new shell will expand any special shell characters.
+
@c --disable-packet is not documented for users.
@c --disable-randomization and --no-disable-randomization are superseded by
@@ -51427,6 +51915,12 @@ composed as @file{@var{prefix}.@var{pid}}, where @var{pid} is the
process ID of the running program being analyzed by @command{gcore}.
If not specified, @var{prefix} defaults to @var{core}.
+@item -g @var{gdb}
+Use @var{gdb} as the executable binary to invoke @value{GDBN} for
+running the gcore command. This argument is optional, and defaults to
+invoking the @value{GDBN} binary that is installed alongside
+@command{gcore}.
+
@item -d @var{directory}
Use @var{directory} as the data directory when invoking @value{GDBN} for running
the gcore command. This argument is optional.
diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi
index f1b638e..fcedef0 100644
--- a/gdb/doc/guile.texi
+++ b/gdb/doc/guile.texi
@@ -1,11 +1,11 @@
-@c Copyright (C) 2008--2024 Free Software Foundation, Inc.
+@c Copyright (C) 2008--2025 Free Software Foundation, Inc.
@c Permission is granted to copy, distribute and/or modify this document
@c under the terms of the GNU Free Documentation License, Version 1.3 or
@c any later version published by the Free Software Foundation; with the
@c Invariant Sections being ``Free Software'' and ``Free Software Needs
@c Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
@c and with the Back-Cover Texts as in (a) below.
-@c
+@c
@c (a) The FSF's Back-Cover Text is: ``You are free to copy and modify
@c this GNU Manual. Buying copies from GNU Press supports the FSF in
@c developing GNU and promoting software freedom.''
@@ -1772,6 +1772,16 @@ invoking it interactively. If this function throws an exception,
it is turned into a @value{GDBN} @code{error} call.
Otherwise, the return value is ignored.
+For non-prefix commands, @var{invoke} is required. For prefix
+commands @var{invoke} is optional. Only prefix commands that need to
+handle unknown sub-commands should supply @var{invoke}.
+
+For prefix commands that don't supply @var{invoke}, if the prefix
+command is used without a sub-command name then @value{GDBN} will
+display the help text for every sub-command, unless the prefix command
+is a @kbd{show} sub-command, in which case @value{GDBN} will list the
+values of all sub-commands.
+
The argument @var{command-class} is one of the @samp{COMMAND_} constants
defined below. This argument tells @value{GDBN} how to categorize the
new command in the help system. The default is @code{COMMAND_NONE}.
@@ -1826,7 +1836,7 @@ $1 = ("1" "2 \"3" "4 \"5" "6 '7")
@deffn {Scheme Procedure} throw-user-error message . args
Throw a @code{gdb:user-error} exception.
-The argument @var{message} is the error message as a format string, like the
+The argument @var{message} is the error message as a format string, like the
@var{fmt} argument to the @code{format} Scheme function.
@xref{Formatted Output,,, guile, GNU Guile Reference Manual}.
The argument @var{args} is a list of the optional arguments of @var{message}.
@@ -2098,8 +2108,10 @@ is the @code{<gdb:parameter>} object representing the parameter, and
This function must return a string, and will be displayed to the user.
@value{GDBN} will add a trailing newline.
-The argument @var{doc} is the help text for the new parameter.
-If there is no documentation string, a default value is used.
+The argument @var{doc} is the help text for the new parameter. If
+there is no documentation string, a default value is used. If the
+documentation string is empty, then @value{GDBN} will print just the
+@var{set-doc} and @var{show-doc} strings (see below).
The argument @var{set-doc} is the help text for this parameter's
@code{set} command.
@@ -2425,7 +2437,7 @@ The previous frame's analyzer returns an invalid result.
This frame is the outermost.
@item FRAME_UNWIND_UNAVAILABLE
-Cannot unwind further, because that would require knowing the
+Cannot unwind further, because that would require knowing the
values of registers or memory that have not been collected.
@item FRAME_UNWIND_INNER_ID
@@ -3899,6 +3911,9 @@ Return string to change terminal's color to this.
If @var{is_foreground} is @code{#t}, then the returned sequence will change
foreground color. Otherwise, the returned sequence will change background
color.
+
+If styling is currently disabled (@pxref{Output Styling,,@kbd{set style
+enabled}}), then this procedure will return an empty string.
@end deffn
When color is initialized, its color space must be specified. The
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index 50342bb..ed11317 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -5,7 +5,7 @@
@c Invariant Sections being ``Free Software'' and ``Free Software Needs
@c Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
@c and with the Back-Cover Texts as in (a) below.
-@c
+@c
@c (a) The FSF's Back-Cover Text is: ``You are free to copy and modify
@c this GNU Manual. Buying copies from GNU Press supports the FSF in
@c developing GNU and promoting software freedom.''
@@ -226,6 +226,7 @@ optional arguments while skipping others. Example:
using Python.
* Lazy Strings In Python:: Python representation of lazy strings.
* Colors In Python:: Python representation of colors.
+* Styles In Python:: Python representation of styles.
* Architectures In Python:: Python representation of architectures.
* Registers In Python:: Python representation of registers.
* Connections In Python:: Python representation of connections.
@@ -233,6 +234,7 @@ optional arguments while skipping others. Example:
* Disassembly In Python:: Instruction Disassembly In Python
* Missing Debug Info In Python:: Handle missing debug info from Python.
* Missing Objfiles In Python:: Handle objfiles from Python.
+* Core Files In Python:: Python representation of core files.
@end menu
@node Basic Python
@@ -257,7 +259,7 @@ Python code must not override these, or even change the options using
signals, @value{GDBN} will most likely stop working correctly. Note
that it is unfortunately common for GUI toolkits to install a
@code{SIGCHLD} handler. When creating a new Python thread, you can
-use @code{gdb.block_signals} or @code{gdb.Thread} to handle this
+use @code{gdb.blocked_signals} or @code{gdb.Thread} to handle this
correctly; see @ref{Threading in GDB}.
@item
@@ -451,7 +453,7 @@ will be @code{None} and 0 respectively. This is identical to
historical compatibility.
@end defun
-@defun gdb.write (string @r{[}, stream@r{]})
+@defun gdb.write (string @r{[}, stream@r{]} @r{[}, style@r{]})
Print a string to @value{GDBN}'s paginated output stream. The
optional @var{stream} determines the stream to print to. The default
stream is @value{GDBN}'s standard output stream. Possible stream
@@ -474,18 +476,25 @@ values are:
@value{GDBN}'s log stream (@pxref{Logging Output}).
@end table
+The @var{style} should be a @code{gdb.Style} object (@pxref{Styles In
+Python}), or @code{None} (the default). If @var{style} is @code{None}
+then the current style for @var{stream} will be applied to @var{text}.
+If @var{style} is a @code{gdb.Style} object, then this style is
+applied to @var{text}, after which the default output style is
+restored.
+
Writing to @code{sys.stdout} or @code{sys.stderr} will automatically
call this function and will automatically direct the output to the
relevant stream.
@end defun
-@defun gdb.flush (@r{[}, stream@r{]})
+@defun gdb.flush (@r{[}stream@r{]})
Flush the buffer of a @value{GDBN} paginated stream so that the
contents are displayed immediately. @value{GDBN} will flush the
contents of a stream automatically when it encounters a newline in the
buffer. The optional @var{stream} determines the stream to flush. The
default stream is @value{GDBN}'s standard output stream. Possible
-stream values are:
+stream values are:
@table @code
@findex STDOUT
@@ -509,6 +518,17 @@ Flushing @code{sys.stdout} or @code{sys.stderr} will automatically
call this function for the relevant stream.
@end defun
+@defun gdb.warning (text)
+Print a warning message to @value{GDBN}'s standard output stream. The
+warning message is the warning prefix (@pxref{warning-prefix}), the
+string @w{@samp{warning: }}, and then @var{text}, which must be a
+non-empty string.
+
+Due to the warning prefix, @var{text} should not begin with a capital
+letter (except for proper nouns), and @var{text} should end with a
+period.
+@end defun
+
@defun gdb.target_charset ()
Return the name of the current target character set (@pxref{Character
Sets}). This differs from @code{gdb.parameter('target-charset')} in
@@ -557,7 +577,7 @@ If @var{prompt_hook} is callable, @value{GDBN} will call the method
assigned to this operation before a prompt is displayed by
@value{GDBN}.
-The parameter @code{current_prompt} contains the current @value{GDBN}
+The parameter @code{current_prompt} contains the current @value{GDBN}
prompt. This method must return a Python string, or @code{None}. If
a string is returned, the @value{GDBN} prompt will be set to that
string. If @code{None} is returned, @value{GDBN} will continue to use
@@ -654,22 +674,22 @@ threads, you must be careful to only call @value{GDBN}-specific
functions in the @value{GDBN} thread. @value{GDBN} provides some
functions to help with this.
-@defun gdb.block_signals ()
+@defun gdb.blocked_signals ()
As mentioned earlier (@pxref{Basic Python}), certain signals must be
-delivered to the @value{GDBN} main thread. The @code{block_signals}
+delivered to the @value{GDBN} main thread. The @code{blocked_signals}
function returns a context manager that will block these signals on
entry. This can be used when starting a new thread to ensure that the
signals are blocked there, like:
@smallexample
-with gdb.block_signals():
+with gdb.blocked_signals():
start_new_thread()
@end smallexample
@end defun
@deftp {class} gdb.Thread
This is a subclass of Python's @code{threading.Thread} class. It
-overrides the @code{start} method to call @code{block_signals}, making
+overrides the @code{start} method to call @code{blocked_signals}, making
this an easy-to-use drop-in replacement for creating threads that will
work well in @value{GDBN}.
@end deftp
@@ -899,7 +919,26 @@ this attribute holds @code{None}.
@cindex optimized out value in Python
@defvar Value.is_optimized_out
This read-only boolean attribute is true if the compiler optimized out
-this value, thus it is not available for fetching from the inferior.
+this value, or any part of this value, and thus it is not available
+for fetching from the inferior.
+@end defvar
+
+@cindex unavailable values in Python
+@defvar Value.is_unavailable
+This read-only boolean attribute is true if this value, or any part of
+this value, is not available to @value{GDBN}. Where an optimized out
+value has been removed from the program by the compiler, an
+unavailable value does exist in the program, but @value{GDBN} is
+unable to fetch it.
+
+Some reasons why this might occur include, but are not limited to: a
+core file format that @value{GDBN} doesn't fully understand; during
+live debugging if the debug API has no mechanism to access the
+required state, e.g.@: the kernel gives an error when trying to read a
+particular register set; or reading a value from @value{GDBN}'s
+history, when only a partial value was stored, e.g.@: due to the
+@kbd{max-value-size} setting (@pxref{set
+max-value-size,,max-value-size}).
@end defvar
@defvar Value.type
@@ -925,17 +964,17 @@ it will just return the static type of the value as in @kbd{ptype foo}
@defvar Value.is_lazy
The value of this read-only boolean attribute is @code{True} if this
-@code{gdb.Value} has not yet been fetched from the inferior.
-@value{GDBN} does not fetch values until necessary, for efficiency.
+@code{gdb.Value} has not yet been fetched from the inferior.
+@value{GDBN} does not fetch values until necessary, for efficiency.
For example:
@smallexample
myval = gdb.parse_and_eval ('somevar')
@end smallexample
-The value of @code{somevar} is not fetched at this time. It will be
+The value of @code{somevar} is not fetched at this time. It will be
fetched when the value is needed, or when the @code{fetch_lazy}
-method is invoked.
+method is invoked.
@end defvar
@defvar Value.bytes
@@ -1313,7 +1352,7 @@ and encoded until a null of appropriate width is found.
@end defun
@defun Value.fetch_lazy ()
-If the @code{gdb.Value} object is currently a lazy value
+If the @code{gdb.Value} object is currently a lazy value
(@code{gdb.Value.is_lazy} is @code{True}), then the value is
fetched from the inferior. Any errors that occur in the process
will produce a Python exception.
@@ -3357,27 +3396,27 @@ defined as follows:
class MyClass_geta(gdb.xmethod.XMethod):
def __init__(self):
gdb.xmethod.XMethod.__init__(self, 'geta')
-
+
def get_worker(self, method_name):
if method_name == 'geta':
return MyClassWorker_geta()
-
-
+
+
class MyClass_sum(gdb.xmethod.XMethod):
def __init__(self):
gdb.xmethod.XMethod.__init__(self, 'sum')
-
+
def get_worker(self, method_name):
if method_name == 'operator+':
return MyClassWorker_plus()
-
-
+
+
class MyClassMatcher(gdb.xmethod.XMethodMatcher):
def __init__(self):
gdb.xmethod.XMethodMatcher.__init__(self, 'MyClassMatcher')
# List of methods 'managed' by this matcher
self.methods = [MyClass_geta(), MyClass_sum()]
-
+
def match(self, class_type, method_name):
if class_type.tag != 'MyClass':
return None
@@ -3387,7 +3426,7 @@ class MyClassMatcher(gdb.xmethod.XMethodMatcher):
worker = method.get_worker(method_name)
if worker:
workers.append(worker)
-
+
return workers
@end smallexample
@@ -3415,18 +3454,18 @@ class MyClassWorker_geta(gdb.xmethod.XMethodWorker):
def get_result_type(self, obj):
return gdb.lookup_type('int')
-
+
def __call__(self, obj):
return obj['a_']
-
-
+
+
class MyClassWorker_plus(gdb.xmethod.XMethodWorker):
def get_arg_types(self):
return gdb.lookup_type('MyClass')
def get_result_type(self, obj):
return gdb.lookup_type('int')
-
+
def __call__(self, obj, other):
return obj['a_'] + other['a_']
@end smallexample
@@ -3469,12 +3508,12 @@ class MyTemplate
public:
MyTemplate () : dsize_(10), data_ (new T [10]) @{ @}
~MyTemplate () @{ delete [] data_; @}
-
+
int footprint (void)
@{
return sizeof (T) * dsize_ + sizeof (MyTemplate<T>);
@}
-
+
private:
int dsize_;
T *data_;
@@ -3500,12 +3539,12 @@ class MyTemplateWorker_footprint(gdb.xmethod.XMethodWorker):
return (self.class_type.sizeof +
obj['dsize_'] *
self.class_type.template_argument(0).sizeof)
-
-
+
+
class MyTemplateMatcher_footprint(gdb.xmethod.XMethodMatcher):
def __init__(self):
gdb.xmethod.XMethodMatcher.__init__(self, 'MyTemplateMatcher')
-
+
def match(self, class_type, method_name):
if (re.match('MyTemplate<[ \t\n]*[_a-zA-Z][ _a-zA-Z0-9]*>',
class_type.tag) and
@@ -3596,6 +3635,15 @@ necessary quoting for the shell; when a sequence is assigned, the
quoting is applied by @value{GDBN}.
@end defvar
+@defvar Inferior.corefile
+If a core file has been loaded into this inferior (@pxref{core-file
+command}), then this contains a @code{gdb.Corefile} object that
+represents the loaded core file (@pxref{Core Files In Python}).
+
+If no core file has been loaded into this inferior, then this
+attribute contains @code{None}.
+@end defvar
+
A @code{gdb.Inferior} object has the following methods:
@defun Inferior.is_valid ()
@@ -3797,7 +3845,7 @@ Emits @code{events.ExitedEvent}, which indicates that the inferior has
exited. @code{events.ExitedEvent} has two attributes:
@defvar ExitedEvent.exit_code
-An integer representing the exit code, if available, which the inferior
+An integer representing the exit code, if available, which the inferior
has returned. (The exit code could be unavailable if, for example,
@value{GDBN} detaches from the inferior.) If the exit code is unavailable,
the attribute does not exist.
@@ -3852,7 +3900,7 @@ Also emits @code{gdb.BreakpointEvent}, which extends
been hit, and has the following attributes:
@defvar BreakpointEvent.breakpoints
-A sequence containing references to all the breakpoints (type
+A sequence containing references to all the breakpoints (type
@code{gdb.Breakpoint}) that were hit.
@xref{Breakpoints In Python}, for details of the @code{gdb.Breakpoint} object.
@end defvar
@@ -4525,6 +4573,7 @@ You can implement new @value{GDBN} CLI commands in Python. A CLI
command is implemented using an instance of the @code{gdb.Command}
class, most commonly using a subclass.
+@anchor{Command.__init__}
@defun Command.__init__ (name, command_class @r{[}, completer_class @r{[}, prefix@r{]]})
The object initializer for @code{Command} registers the new command
with @value{GDBN}. This initializer is normally invoked from the
@@ -4554,10 +4603,11 @@ registered.
The help text for the new command is taken from the Python
documentation string for the command's class, if there is one. If no
-documentation string is provided, the default value ``This command is
-not documented.'' is used.
+documentation string is provided, the default value @samp{This command
+is not documented.} is used.
@end defun
+@anchor{Command.dont_repeat}
@cindex don't repeat Python command
@defun Command.dont_repeat ()
By default, a @value{GDBN} command is repeated when the user enters a
@@ -4568,6 +4618,7 @@ exception). This is similar to the user command @code{dont-repeat},
see @ref{Define, dont-repeat}.
@end defun
+@anchor{Command.invoke}
@defun Command.invoke (argument, from_tty)
This method is called by @value{GDBN} when this command is invoked.
@@ -4581,6 +4632,17 @@ that the command came from elsewhere.
If this method throws an exception, it is turned into a @value{GDBN}
@code{error} call. Otherwise, the return value is ignored.
+For non-prefix commands (@pxref{Command.__init__}), the @code{invoke}
+method is required. For prefix commands the @code{invoke} method is
+optional. Only prefix commands that need to handle unknown
+sub-commands should implement the @code{invoke} method.
+
+For prefix commands that don't implement @code{invoke}, if the prefix
+command is used without a sub-command name then @value{GDBN} will
+display the help text for every sub-command, unless the prefix command
+is a @kbd{show} sub-command, in which case @value{GDBN} will list the
+values of all sub-commands.
+
@findex gdb.string_to_argv
To break @var{argument} up into an argv-like string use
@code{gdb.string_to_argv}. This function behaves identically to
@@ -5079,7 +5141,9 @@ string from the parameter's class, if there is one. If there is no
documentation string, a default value is used. The documentation
string is included in the output of the parameters @code{help set} and
@code{help show} commands, and should be written taking this into
-account.
+account. If the documentation string for the parameter's class is the
+empty string then @value{GDBN} will only use @code{Parameter.set_doc}
+or @code{Parameter.show_doc} (see below) in the @kbd{help} output.
@end defun
@defvar Parameter.set_doc
@@ -5258,6 +5322,211 @@ constants provided when the parameter is created.
The value is @code{gdb.Color} instance.
@end table
+When creating multiple new parameters using @code{gdb.Parameter}, it
+is often desirable to create a prefix command that can be used to
+group related parameters together, for example, if you wished to add
+the parameters @kbd{plugin-name feature-1} and @kbd{plugin-name
+feature-2}, then the @kbd{plugin-name} would need to be a prefix
+command (@pxref{CLI Commands In Python}).
+
+@anchor{gdb.ParameterPrefix}
+However, when creating parameters, you will almost always need to
+create two prefix commands, one as a @kbd{set} sub-command, and one as
+a @kbd{show} sub-command. @value{GDBN} provides the
+@code{gdb.ParameterPrefix} helper class to make creation of these two
+prefixes easier.
+
+@defun ParameterPrefix.__init__ (name, command_class, doc = @code{None})
+The object initializer for @code{ParameterPrefix} registers two new
+@code{gdb.Command} prefixes, one as a @kbd{set} sub-command, and the
+other as a @kbd{show} sub-command.
+
+@var{name}, a string, is the name of the new prefix, without either
+@kbd{set} or @kbd{show}, similar to the @var{name} passed to
+@code{gdb.Parameter} (@pxref{Parameters In Python}). For example, to
+create the prefixes @kbd{set plugin-name} and @kbd{show plugin-name},
+you would pass the string @kbd{plugin-name}.
+
+@var{command_class} should be one of the @samp{COMMAND_} constants
+(@pxref{CLI Commands In Python}). This argument tells @value{GDBN} how to
+categorize the new parameter prefixes in the help system.
+
+There are a number of ways in which the help text for the two new
+prefix commands can be provided. If the @var{doc} parameter is not
+@code{None}, then this will be used as the documentation string for
+both prefix commands.
+
+If @var{doc} is @code{None}, but @code{gdb.ParameterPrefix} has been
+sub-classed, then the prefix command documentation will be taken from
+sub-classes documentation string (i.e., the @code{__doc__} attribute).
+
+If @var{doc} is @code{None}, and there is no @code{__doc__} string,
+then the default value @samp{This command is not documented.} is used.
+
+When writing the help text, keep in mind that the same text is used
+for both the @kbd{set} and @kbd{show} prefix commands.
+@end defun
+
+@defun ParameterPrefix.invoke_set (argument, from_tty)
+If a sub-class defines this method, then @value{GDBN} will call this
+when the prefix command is used with an unknown sub-command. The
+@var{argument} and @var{from_tty} parameters are the same as for
+@code{gdb.Command.invoke} (@pxref{Command.invoke}).
+
+If this method throws an exception, it is turned into a @value{GDBN}
+@code{error} call. Otherwise, the return value is ignored.
+
+It is not required that a @code{ParameterPrefix} sub-class override
+this method. Usually, a parameter prefix only exists as a means to
+group related parameters together. @value{GDBN} handles this use case
+automatically with no need to implement @code{invoke_set}.
+@end defun
+
+@defun ParameterPrefix.invoke_show (argument, from_tty)
+This is like the @code{invoke_set} method, but for the @kbd{show}
+prefix command. As with @code{invoke_set}, implementation of this
+method is optional, and usually not required.
+@end defun
+
+@cindex don't repeat Python command
+@defun ParameterPrefix.dont_repeat ()
+Like @code{Command.dont_repeat} (@pxref{Command.dont_repeat}), this
+can be called from @code{ParameterPrefix.invoke_set} or
+@code{ParameterPrefix.invoke_show} to prevent the prefix commands from
+being repeated.
+@end defun
+
+Here is a small example that uses @code{gdb.ParameterPrefix} along
+with @code{gdb.Parameter} to create two new parameters
+@kbd{plugin-name feature-1} and @kbd{plugin-name feature-2}. As
+neither @code{invoke_set} or @code{invoke_show} is needed, this
+example does not sub-class @code{gdb.ParameterPrefix}:
+
+@smallexample
+class ExampleParam(gdb.Parameter):
+ def __init__ (self, name):
+ super ().__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)
+ self.value = True
+
+gdb.ParameterPrefix("plugin-name", gdb.COMMAND_NONE,
+ """An example parameter prefix.
+
+ This groups together some parameters.""")
+ExampleParam("plugin-name feature-1")
+ExampleParam("plugin-name feature-2")
+@end smallexample
+
+@anchor{Creating Style Parameters}
+The helper class @code{gdb.StyleParameterSet} exists to make it easier
+to create new styles. @value{GDBN} places style settings under
+@samp{show style @dots{}} and @samp{set style @dots{}}, an example of a style
+is @samp{filename}. Each style is really a prefix command (@pxref{CLI
+Commands In Python}), with sub-commands @samp{foreground},
+@samp{background}, and optionally, @samp{intensity}.
+
+It is simple enough to create a new style using two @code{gdb.Command}
+objects for the prefix commands (one for @samp{set}, and one for
+@samp{show}), and three @code{gdb.Parameter} objects, one each for the
+@samp{foreground}, @samp{background}, and @samp{intensity}. You would
+also want to take care to craft the help text so that the new style
+behaves the same as the existing styles.
+
+Or, you can use the @code{gdb.StyleParameterSet} class, which takes
+care of all this, as the following example shows:
+
+@smallexample
+@group
+(@value{GDBP}) python s = gdb.StyleParameterSet("my-style")
+(@value{GDBP}) show style my-style
+style my-style background: The "my-style" style background color is: none
+style my-style foreground: The "my-style" style foreground color is: none
+style my-style intensity: The "my-style" style display intensity is: normal
+(@value{GDBP})
+@end group
+@end smallexample
+
+You might also want to group a number of styles within a new prefix,
+similar to how @value{GDBN} groups disassembler related styles within
+the @samp{style disassembler} prefix. This can be done using
+@code{gdb.ParameterPrefix} (@pxref{gdb.ParameterPrefix}), as in this
+example:
+
+@smallexample
+@group
+(@value{GDBP}) python gdb.ParameterPrefix("style group", gdb.COMMAND_NONE)
+(@value{GDBP}) python s_a = gdb.StyleParameterSet("group aa")
+(@value{GDBP}) python s_b = gdb.StyleParameterSet("group bb")
+(@value{GDBP}) show style group
+style group aa background: The "group aa" style background color is: none
+style group aa foreground: The "group aa" style foreground color is: none
+style group aa intensity: The "group aa" style display intensity is: normal
+style group bb background: The "group bb" style background color is: none
+style group bb foreground: The "group bb" style foreground color is: none
+style group bb intensity: The "group bb" style display intensity is: normal
+(@value{GDBP})
+@end group
+@end smallexample
+
+The @code{gdb.StyleParameterSet} class has the following methods and
+attributes:
+
+@defun StyleParameterSet.__init__(name, @w{add_intensity=@code{True}}, @w{doc=@code{None}})
+Create a new style group based on @var{name}, which is a string. For
+example if @var{name} is @samp{my-style}, then @value{GDBN} will
+create the prefix commands @samp{set style my-style} and @samp{show
+style my-style}. Within these prefix commands will be
+@samp{foreground}, @samp{background}, and @samp{intensity} parameters
+with the appropriate types.
+
+It is also possible for @var{name} to consist of multiple words, so
+long as each prefix command (except the last one) already exists. For
+example, it is valid to use a @var{name} value of @samp{disassembler
+my-style}, as the @samp{disassembler} prefix command already exists.
+@value{GDBN} would then create @samp{set style disassembler my-style}
+and @samp{show style disassembler my-style}, and within the
+@samp{my-style} prefixes will be the @samp{foreground},
+@samp{background}, and @samp{intensity} parameters with the
+appropriate types.
+
+Every style requires a @samp{foreground} and @samp{background}, but
+not every style needs an @samp{intensity}. If @var{add_intensity} is
+@code{True} (the default), then the @samp{intensity} parameter will be
+created. If @var{add_intensity} is @code{False}, then the
+@samp{intensity} parameter will not be created.
+
+If the @samp{intensity} parameter is not created, then the
+@code{gdb.Style} (@pxref{Styles In Python}) created from this
+@code{gdb.StyleParameterSet} will have @code{gdb.INTENSITY_NORMAL}.
+
+The @var{doc} should be a string which will be used as the help text
+for the @var{name} prefix command. This text is used as the
+@code{Command.__doc__} value for the @code{gdb.Command} object that is
+the prefix command object (@pxref{CLI Commands In Python}). If
+@var{doc} is @code{None} (the default) then a basic default help text
+is used.
+@end defun
+
+@defun StyleParameterSet.apply(string)
+Equivalent to @code{StyleParameterSet.style.apply(string)}. Returns a
+copy of @var{string} with escape sequences added to the start and end.
+The escape sequence at the start applies this style, and the escape
+sequence at the end restores the terminal default.
+
+If styling is disabled (i.e.@: @samp{set style enabled off}), then no
+escape sequences are added and this method returns a copy of
+@var{string}.
+@end defun
+
+@defvar StyleParameterSet.style
+This read/write attribute holds a @code{gdb.Style} object
+(@pxref{Styles In Python}), that is a named style associated with this
+style parameter group.
+@end defvar
+
+@defvar StyleParameterSet.value
+This is an alias for @code{StyleParameterSet.style}, see above.
+@end defvar
+
@node Functions In Python
@subsubsection Writing new convenience functions
@@ -5808,7 +6077,7 @@ compatibility.
This frame is the outermost.
@item gdb.FRAME_UNWIND_UNAVAILABLE
-Cannot unwind further, because that would require knowing the
+Cannot unwind further, because that would require knowing the
values of registers or memory that have not been collected.
@item gdb.FRAME_UNWIND_INNER_ID
@@ -6944,22 +7213,22 @@ is not writable.
A finish breakpoint is a temporary breakpoint set at the return address of
a frame, based on the @code{finish} command. @code{gdb.FinishBreakpoint}
-extends @code{gdb.Breakpoint}. The underlying breakpoint will be disabled
-and deleted when the execution will run out of the breakpoint scope (i.e.@:
+extends @code{gdb.Breakpoint}. The underlying breakpoint will be disabled
+and deleted when the execution will run out of the breakpoint scope (i.e.@:
@code{Breakpoint.stop} or @code{FinishBreakpoint.out_of_scope} triggered).
-Finish breakpoints are thread specific and must be create with the right
-thread selected.
-
+Finish breakpoints are thread specific and must be create with the right
+thread selected.
+
@defun FinishBreakpoint.__init__ (@r{[}frame@r{]} @r{[}, internal@r{]})
Create a finish breakpoint at the return address of the @code{gdb.Frame}
object @var{frame}. If @var{frame} is not provided, this defaults to the
newest frame. The optional @var{internal} argument allows the breakpoint to
-become invisible to the user. @xref{Breakpoints In Python}, for further
+become invisible to the user. @xref{Breakpoints In Python}, for further
details about this argument.
@end defun
@defun FinishBreakpoint.out_of_scope (self)
-In some circumstances (e.g.@: @code{longjmp}, C@t{++} exceptions, @value{GDBN}
+In some circumstances (e.g.@: @code{longjmp}, C@t{++} exceptions, @value{GDBN}
@code{return} command, @dots{}), a function may not properly terminate, and
thus never hit the finish breakpoint. When @value{GDBN} notices such a
situation, the @code{out_of_scope} callback will be triggered.
@@ -6972,17 +7241,17 @@ class MyFinishBreakpoint (gdb.FinishBreakpoint)
def stop (self):
print ("normal finish")
return True
-
+
def out_of_scope ():
print ("abnormal finish")
-@end smallexample
+@end smallexample
@end defun
@defvar FinishBreakpoint.return_value
-When @value{GDBN} is stopped at a finish breakpoint and the frame
+When @value{GDBN} is stopped at a finish breakpoint and the frame
used to build the @code{gdb.FinishBreakpoint} object had debug symbols, this
attribute will contain a @code{gdb.Value} object corresponding to the return
-value of the function. The value will be @code{None} if the function return
+value of the function. The value will be @code{None} if the function return
type is @code{void} or if the return value was not computable. This attribute
is not writable.
@end defvar
@@ -7049,13 +7318,13 @@ writable.
@cindex colors in python
@tindex gdb.Color
-You can assign instance of @code{Color} to the @code{value} of
+You can assign instance of @code{gdb.Color} to the @code{value} of
a @code{Parameter} instance created with @code{PARAM_COLOR}.
-@code{Color} may refer to an index from color palette or contain components
-of a color from some colorspace.
+@code{gdb.Color} may refer to an index from a color palette or contain
+components of a color from some color space.
-@defun Color.__init__ (@r{[}@var{value} @r{[}, @var{color-space}@r{]}@r{]})
+@defun Color.__init__ (@r{[}value @r{[}, color_space@r{]}@r{]})
@var{value} is @code{None} (meaning the terminal's default color),
an integer index of a color in palette, tuple with color components
@@ -7065,8 +7334,9 @@ or one of the following color names:
@samp{green}, @samp{yellow}, @samp{blue}, @samp{magenta}, @samp{cyan},
or @samp{white}.
-@var{color-space} should be one of the @samp{COLORSPACE_} constants. This
-argument tells @value{GDBN} which color space @var{value} belongs.
+@var{color_space} should be one of the @samp{COLORSPACE_} constants
+listed below. This argument tells @value{GDBN} which color space
+@var{value} belongs.
@end defun
@defvar Color.is_none
@@ -7094,12 +7364,15 @@ This attribute exist if @code{is_direct} is @code{True}. Its value is tuple
with integer components of a color.
@end defvar
-@defun Color.escape_sequence (@var{self}, @var{is_foreground})
+@defun Color.escape_sequence (is_foreground)
Returns string to change terminal's color to this.
If @var{is_foreground} is @code{True}, then the returned sequence will change
foreground color. Otherwise, the returned sequence will change background
color.
+
+If styling is currently disabled (@pxref{Output Styling,,@kbd{set style
+enabled}}), then this method will return an empty string.
@end defun
When color is initialized, its color space must be specified. The
@@ -7136,6 +7409,148 @@ Direct 24-bit RGB colors.
@end table
+It is not possible to sub-class the @code{Color} class.
+
+@node Styles In Python
+@subsubsection Python representation of styles
+
+@cindex styles in python
+@tindex gdb.Style
+
+A style object contains the foreground and background colors
+(@pxref{Colors In Python}), along with an intensity, and can be used
+to apply this styling to output produced from Python.
+
+@value{GDBN} has many styles builtin (@pxref{Output Styling}), and
+style objects can be created that apply these builtin styles to Python
+output. It is also possible to create new styles which can be used to
+style Python output (@pxref{Creating Style Parameters}).
+
+The style class is called @code{gdb.Style}, and has the following
+methods and attributes:
+
+@defun Style.__init__ (style_name)
+Create a @code{gdb.Style} that represents a builtin named style. The
+@var{style_name} must be a non-empty string that names a style that
+exists as a setting in @value{GDBN} within @samp{set style @dots{}}. For
+example, the string @samp{"filename"} can be used to create a
+@code{gdb.Style} object representing the @samp{set style filename}
+style.
+
+If @var{style_name} names an unknown style then a @code{RuntimeError}
+exception is raised.
+@end defun
+
+@defun Style.__init__ (foreground=@code{None}, background=@code{None}, intensity=gdb.INTENSITY_NORMAL)
+Create a custom @code{gdb.Style}, manually specifying the three
+individual components. All of the arguments are optional. By
+default, if no arguments are given, then the default style will be
+created, this will produce output with the default terminal foreground
+and background colors, along with the normal level of intensity
+(i.e.@: neither bold, nor dim).
+
+The @var{foreground} and @var{background} arguments should either be
+@code{None}, in which case the terminal default colors are used, or a
+@code{gdb.Color} object (@pxref{Colors In Python}). Any other object
+type will result in a @code{TypeError} exception being raised.
+
+The @var{intensity} argument should be one of the intensity constants
+defined below (@pxref{Style Intensities}). Passing a none integer
+value results in a @code{TypeError} exception, and passing an invalid
+constant results in a @code{ValueError} exception.
+@end defun
+
+@defun Style.escape_sequence ()
+If styling is enabled (@pxref{Output Styling}, then this method
+returns the string which is the terminal escape sequence necessary to
+apply this @code{gdb.Style}.
+
+If styling is disabled then this method returns the empty string.
+
+If this is a named style, which for some reason can no longer be read,
+then a @code{RuntimeError} exception is raised.
+@end defun
+
+@defun Style.apply (string)
+This method returns @var{string}, which must be a @code{str} object,
+with an escape sequence at both the start, and at the end. The escape
+sequence at the start applies this style, while the escape sequence at
+the end applies the terminal's default style.
+
+The effect of this is that, printing the result of this method, will
+print @var{string} with this style applied. Future output will be
+printed with the terminal's default style.
+
+If styling is currently disabled (@pxref{Output Styling}), then
+@code{Style.apply} just returns a copy of @var{string} with no escape
+sequences added.
+
+If this is a named style, which for some reason can no longer be read,
+then a @code{RuntimeError} exception is raised.
+@end defun
+
+@defvar Style.foreground
+This read/write attribute contains the @code{gdb.Color} object
+representing this style's foreground color. Writing to this attribute
+updates the style's foreground color.
+
+If the @code{gdb.Style} object was created using a named style (i.e.@:
+using the single argument @var{style_name} @code{__init__} method),
+then the underlying setting will be updated.
+
+For unnamed styles, only the @code{gdb.Style} object will change.
+@end defvar
+
+@defvar Style.background
+This read/write attribute contains the @code{gdb.Color} object
+representing this style's background color. Writing to this attribute
+updates the style's background color.
+
+If the @code{gdb.Style} object was created using a named style (i.e.@:
+using the single argument @var{style_name} @code{__init__} method),
+then the underlying setting will be updated.
+
+For unnamed styles, only the @code{gdb.Style} object will change.
+@end defvar
+
+@defvar Style.intensity
+This read/write attribute contains the intensity for this style, and
+will be one of the constants defined below (@pxref{Style
+Intensities}). Writing to this attribute updates the style's
+intensity.
+
+It is also possible to write @code{None} to this attribute, this is
+equivalent of writing @code{gdb.INTENSITY_NORMAL}. This attribute
+will never read as @code{None}.
+
+If the @code{gdb.Style} object was created using a named style (i.e.@:
+using the single argument @var{style_name} @code{__init__} method),
+then the underlying setting will be updated.
+
+For unnamed styles, only the @code{gdb.Style} object will change.
+@end defvar
+
+@anchor{Style Intensities}
+The following constants are defined to represent the different style
+intensities:
+
+@table @code
+@findex INTENSITY_NORMAL
+@findex gdb.INTENSITY_NORMAL
+@item gdb.INTENSITY_NORMAL
+This is the terminal's default intensity.
+
+@findex INTENSITY_BOLD
+@findex gdb.INTENSITY_BOLD
+@item gdb.INTENSITY_BOLD
+This is for bold text.
+
+@findex INTENSITY_DIM
+@findex gdb.INTENSITY_DIM
+@item gdb.INTENSITY_DIM
+This is for dim text.
+@end table
+
@node Architectures In Python
@subsubsection Python representation of architectures
@cindex Python architectures
@@ -8479,6 +8894,106 @@ handlers, all of the matching handlers are enabled. The
@code{enabled} field of each matching handler is set to @code{True}.
@end table
+@node Core Files In Python
+@subsubsection Core Files In Python
+@cindex python, core files
+
+When a core file is loaded into an inferior (@pxref{Inferiors In
+Python}) for examination (@pxref{core-file command}), information
+about the core file is contained in a @code{gdb.Corefile} object.
+
+The @code{gdb.Corefile} for an inferior can be accessed using the
+@code{Inferior.corefile} attribute. This will be @code{None} if
+no core file is loaded.
+
+A @code{gdb.Corefile} object has the following attributes:
+
+@defvar Corefile.filename
+This read only attribute contains a non-empty string, the file name of
+the core file. Attempting to access this attribute on an invalid
+@code{gdb.Corefile} object will raise a @code{RuntimeError} exception.
+@end defvar
+
+A @code{gdb.Corefile} object has the following methods:
+
+@defun Corefile.is_valid ()
+Returns @code{True} if the @code{gdb.Corefile} object is valid,
+@code{False} if not. A @code{gdb.Corefile} object will become invalid
+when the core file is unloaded from the inferior using the
+@kbd{core-file} command (@pxref{core-file command}), or if the
+inferior in which the core file is loaded is deleted. All other
+@code{gdb.Corefile} methods and attributes will throw an exception if
+it is invalid at the time the method is called, or the attribute
+accessed.
+@end defun
+
+@defun Corefile.mapped_files ()
+Return a list of @code{gdb.CorefileMappedFile} (see below) objects
+representing files that were mapped into the process when the core
+file was created. This information is read from the @samp{NT_FILE}
+core file note on Linux. Not every target supports accessing this
+information, for targets without support, an empty list will be
+returned.
+@end defun
+
+One may add arbitrary attributes to @code{gdb.Corefile} objects in the
+usual Python way. This is useful if, for example, one needs to do
+some extra record keeping associated with the corefile.
+@xref{choosing attribute names}, for guidance on selecting a suitable
+name for new attributes.
+
+The @code{Corefile.mapped_files ()} method returns a list of
+@code{gdb.CorefileMappedFile} objects. Each of these objects
+represents a file that was fully, or partially, mapped into the
+processes address space when the core file was created.
+
+A @code{gdb.CorefileMappedFile} object has the following attributes:
+
+@defvar CorefileMappedFile.filename
+This read only attribute contains a non-empty string, the file name of
+the mapped file.
+@end defvar
+
+@defvar CorefileMappedFile.build_id
+This read only attribute contains a non-empty string or @code{None}.
+This is the build-id of the mapped file extracted from the core file,
+or @code{None} if there was no build-id, or @value{GDBN} was unable to
+extract the build-id.
+@end defvar
+
+@defvar CorefileMappedFile.is_main_executable
+This read only attribute is @code{True} if @value{GDBN} believes this
+mapping represents the main executable for which this core file was
+created. This will be @code{False} for all other mappings.
+@end defvar
+
+@defvar CorefileMappedFile.regions
+This read only attribute contains a list of
+@code{gdb.CorefileMappedFileRegion} objects. Each of these objects
+describes a region of the file that was mapped into the process when
+the core file was created, further details are given below.
+@end defvar
+
+The @code{gdb.CorefileMappedFileRegion} object describes which part of
+a file that was mapped into a process when the core file was created.
+
+A @code{gdb.CorefileMappedFile} object has the following attributes:
+
+@defvar CorefileMappedFileRegion.start
+This read only attribute contains the start address of this mapping
+within the inferior.
+@end defvar
+
+@defvar CorefileMappedFileRegion.end
+This read only attribute contains end address of this mapping within
+the inferior.
+@end defvar
+
+@defvar CorefileMappedFileRegion.file_offset
+This read only attribute contains the offset within the mapped file
+for this mapping.
+@end defvar
+
@node Python Auto-loading
@subsection Python Auto-loading
@cindex Python auto-loading
diff --git a/gdb/doc/refcard.tex b/gdb/doc/refcard.tex
index 78b88f5..8a40262 100644
--- a/gdb/doc/refcard.tex
+++ b/gdb/doc/refcard.tex
@@ -1,7 +1,7 @@
%%%%%%%%%%%%%%%% gdb-refcard.tex %%%%%%%%%%%%%%%%
%This file is TeX source for a reference card describing GDB, the GNU debugger.
-%Copyright (C) 1991--2024 Free Software Foundation, Inc.
+%Copyright (C) 1991--2025 Free Software Foundation, Inc.
%Permission is granted to make and distribute verbatim copies of
%this reference provided the copyright notices and permission notices
%are preserved on all copies.
@@ -307,7 +307,7 @@ shell {\it cmd}&execute arbitrary shell command string\cr
\line{\smrm \opt{ } surround optional arguments \hfill $\ldots$ show
one or more arguments}
\vskip\baselineskip
-\centerline{\smrm \copyright 1998-2024 Free Software Foundation, Inc.\qquad Permissions on back}
+\centerline{\smrm \copyright 1998-2025 Free Software Foundation, Inc.\qquad Permissions on back}
\eject
\sec Breakpoints and Watchpoints;
break \opt{\it file\tt:}{\it line}\par
@@ -632,7 +632,7 @@ statement.\cr
\vfill
{\smrm\parskip=6pt
-Copyright \copyright 1991-2024 Free Software Foundation, Inc.
+Copyright \copyright 1991-2025 Free Software Foundation, Inc.
Author: Roland H. Pesch
The author assumes no responsibility for any errors on this card.
diff --git a/gdb/doc/stabs.texinfo b/gdb/doc/stabs.texinfo
index 98810f8..eac342a 100644
--- a/gdb/doc/stabs.texinfo
+++ b/gdb/doc/stabs.texinfo
@@ -17,7 +17,7 @@
@end direntry
@copying
-Copyright @copyright{} 1992--2024 Free Software Foundation, Inc.
+Copyright @copyright{} 1992--2025 Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by Julia Menapace, Jim Kingdon,
and David MacKenzie.
diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
index ac1b1c5..c663571 100644
--- a/gdb/dtrace-probe.c
+++ b/gdb/dtrace-probe.c
@@ -1,6 +1,6 @@
/* DTrace probe support for GDB.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
Contributed by Oracle, Inc.
@@ -424,7 +424,7 @@ dtrace_process_dof_probe (struct objfile *objfile,
It follows that if there are DTrace is-enabled probes defined for
some provider/name but no DTrace regular probes defined then the
- GDB user wont be able to enable/disable these conditionals. */
+ GDB user won't be able to enable/disable these conditionals. */
num_probes = DOF_UINT (dof, probe->dofpr_noffs);
if (num_probes == 0)
@@ -889,9 +889,7 @@ info_probes_dtrace_command (const char *arg, int from_tty)
info_probes_for_spops (arg, from_tty, &dtrace_static_probe_ops);
}
-void _initialize_dtrace_probe ();
-void
-_initialize_dtrace_probe ()
+INIT_GDB_FILE (dtrace_probe)
{
all_static_probe_ops.push_back (&dtrace_static_probe_ops);
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index 697cc11..445a7b4 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -1,6 +1,6 @@
/* Code dealing with dummy stack frames, for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -425,9 +425,7 @@ maintenance_print_dummy_frames (const char *args, int from_tty)
}
}
-void _initialize_dummy_frame ();
-void
-_initialize_dummy_frame ()
+INIT_GDB_FILE (dummy_frame)
{
add_cmd ("dummy-frames", class_maintenance, maintenance_print_dummy_frames,
_("Print the contents of the internal dummy-frame stack."),
diff --git a/gdb/dummy-frame.h b/gdb/dummy-frame.h
index dc28a8d..1dbef62 100644
--- a/gdb/dummy-frame.h
+++ b/gdb/dummy-frame.h
@@ -1,6 +1,6 @@
/* Code dealing with dummy stack frames, for GDB, the GNU debugger.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/abbrev-table-cache.c b/gdb/dwarf2/abbrev-table-cache.c
index 2395ae4..536769b 100644
--- a/gdb/dwarf2/abbrev-table-cache.c
+++ b/gdb/dwarf2/abbrev-table-cache.c
@@ -1,6 +1,6 @@
/* DWARF 2 abbrev table cache
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/abbrev-table-cache.h b/gdb/dwarf2/abbrev-table-cache.h
index d99fb8d..74d81c7 100644
--- a/gdb/dwarf2/abbrev-table-cache.h
+++ b/gdb/dwarf2/abbrev-table-cache.h
@@ -1,6 +1,6 @@
/* DWARF abbrev table cache
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/abbrev.c b/gdb/dwarf2/abbrev.c
index 9f7ead8..e3c268e 100644
--- a/gdb/dwarf2/abbrev.c
+++ b/gdb/dwarf2/abbrev.c
@@ -1,6 +1,6 @@
/* DWARF 2 abbreviations
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
Inc. with support from Florida State University (under contract
@@ -108,6 +108,8 @@ abbrev_table::read (struct dwarf2_section_info *section,
cur_abbrev->has_children = read_1_byte (abfd, abbrev_ptr);
abbrev_ptr += 1;
+ cur_abbrev->maybe_ada_import = false;
+
unsigned int size = 0;
unsigned int sibling_offset = -1;
bool is_csize = true;
@@ -242,7 +244,12 @@ abbrev_table::read (struct dwarf2_section_info *section,
}
else if (has_hardcoded_declaration
&& (cur_abbrev->tag != DW_TAG_variable || !has_external))
- cur_abbrev->interesting = false;
+ {
+ cur_abbrev->interesting = false;
+ if (cur_abbrev->tag == DW_TAG_subprogram && has_name
+ && has_linkage_name)
+ cur_abbrev->maybe_ada_import = true;
+ }
else if (!tag_interesting_for_index (cur_abbrev->tag))
cur_abbrev->interesting = false;
else
diff --git a/gdb/dwarf2/abbrev.h b/gdb/dwarf2/abbrev.h
index 29914f9..a36bb8c 100644
--- a/gdb/dwarf2/abbrev.h
+++ b/gdb/dwarf2/abbrev.h
@@ -1,6 +1,6 @@
/* DWARF abbrev table
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
Inc. with support from Florida State University (under contract
@@ -51,6 +51,14 @@ struct abbrev_info
/* True if the DIE has children. */
bool has_children;
bool interesting;
+ /* In Ada, an imported subprogram DIE will be marked as a
+ declaration, but will have both a name and a linkage name. This
+ declaration may be the only spot where that name is associated
+ with an object, so it has to show up in the index. But, because
+ abbrevs are CU-independent, we can't check the language when
+ computing them and instead we keep a separate flag to indicate
+ that the scanner should check this DIE. */
+ bool maybe_ada_import;
unsigned short size_if_constant;
unsigned short sibling_offset;
/* Number of attributes. */
diff --git a/gdb/dwarf2/ada-imported.c b/gdb/dwarf2/ada-imported.c
index 1654d58..48e6fcc 100644
--- a/gdb/dwarf2/ada-imported.c
+++ b/gdb/dwarf2/ada-imported.c
@@ -1,6 +1,6 @@
/* Ada Pragma Import support.
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -109,7 +109,7 @@ ada_alias_get_block_value (const struct symbol *sym)
if (real_symbol.symbol == nullptr)
error (_("could not find alias '%s' for function '%s'"),
name, sym->print_name ());
- if (real_symbol.symbol->aclass () != LOC_BLOCK)
+ if (real_symbol.symbol->loc_class () != LOC_BLOCK)
error (_("alias '%s' for function '%s' is not a function"),
name, sym->print_name ());
diff --git a/gdb/dwarf2/aranges.c b/gdb/dwarf2/aranges.c
index 7016eee..437aca4 100644
--- a/gdb/dwarf2/aranges.c
+++ b/gdb/dwarf2/aranges.c
@@ -1,6 +1,6 @@
/* DWARF aranges handling
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -59,6 +59,7 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
gdb::unordered_set<sect_offset> debug_info_offset_seen;
const bfd_endian dwarf5_byte_order = gdbarch_byte_order (gdbarch);
+ const int signed_addr_p = bfd_get_sign_extend_vma (abfd);
const gdb_byte *addr = section->buffer;
while (addr < section->buffer + section->size)
{
@@ -167,8 +168,13 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
plongest (entry_addr - section->buffer));
return false;
}
- ULONGEST start = extract_unsigned_integer (addr, address_size,
- dwarf5_byte_order);
+ ULONGEST start;
+ if (signed_addr_p)
+ start = extract_signed_integer (addr, address_size,
+ dwarf5_byte_order);
+ else
+ start = extract_unsigned_integer (addr, address_size,
+ dwarf5_byte_order);
addr += address_size;
ULONGEST length = extract_unsigned_integer (addr, address_size,
dwarf5_byte_order);
diff --git a/gdb/dwarf2/aranges.h b/gdb/dwarf2/aranges.h
index 2ba8a05..e2edfb9 100644
--- a/gdb/dwarf2/aranges.h
+++ b/gdb/dwarf2/aranges.h
@@ -1,6 +1,6 @@
/* DWARF aranges handling
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/attribute.c b/gdb/dwarf2/attribute.c
index 49c0bc0..d2b5364 100644
--- a/gdb/dwarf2/attribute.c
+++ b/gdb/dwarf2/attribute.c
@@ -1,6 +1,6 @@
/* DWARF attributes
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
Inc. with support from Florida State University (under contract
@@ -73,7 +73,8 @@ attribute::form_is_string () const
|| form == DW_FORM_strx3
|| form == DW_FORM_strx4
|| form == DW_FORM_GNU_str_index
- || form == DW_FORM_GNU_strp_alt);
+ || form == DW_FORM_GNU_strp_alt
+ || form == DW_FORM_strp_sup);
}
/* See attribute.h. */
@@ -185,11 +186,59 @@ attribute::unsigned_constant () const
/* See attribute.h. */
+std::optional<LONGEST>
+attribute::signed_constant () const
+{
+ if (form_is_strictly_signed ())
+ return u.snd;
+
+ switch (form)
+ {
+ case DW_FORM_data8:
+ case DW_FORM_udata:
+ /* Not sure if DW_FORM_udata should be handled or not. Anyway
+ for DW_FORM_data8, there's no need to sign-extend. */
+ return u.snd;
+
+ case DW_FORM_data1:
+ return sign_extend (u.unsnd, 8);
+ case DW_FORM_data2:
+ return sign_extend (u.unsnd, 16);
+ case DW_FORM_data4:
+ return sign_extend (u.unsnd, 32);
+ }
+
+ /* For DW_FORM_data16 see attribute::form_is_constant. */
+ complaint (_("Attribute value is not a constant (%s)"),
+ dwarf_form_name (form));
+ return {};
+}
+
+/* See attribute.h. */
+
+std::optional<LONGEST>
+attribute::confused_constant () const
+{
+ if (form_is_strictly_signed ())
+ return u.snd;
+ else if (form_is_constant ())
+ return u.unsnd;
+
+ /* For DW_FORM_data16 see attribute::form_is_constant. */
+ complaint (_("Attribute value is not a constant (%s)"),
+ dwarf_form_name (form));
+ return {};
+}
+
+/* See attribute.h. */
+
bool
attribute::form_is_unsigned () const
{
return (form == DW_FORM_ref_addr
|| form == DW_FORM_GNU_ref_alt
+ || form == DW_FORM_ref_sup4
+ || form == DW_FORM_ref_sup8
|| form == DW_FORM_data2
|| form == DW_FORM_data4
|| form == DW_FORM_data8
@@ -293,5 +342,8 @@ attribute::as_boolean () const
return true;
else if (form == DW_FORM_flag)
return u.unsnd != 0;
- return constant_value (0) != 0;
+ /* Using signed_constant here will work even for the weird case
+ where a negative value is provided. Probably doesn't matter but
+ also seems harmless. */
+ return signed_constant ().value_or (0) != 0;
}
diff --git a/gdb/dwarf2/attribute.h b/gdb/dwarf2/attribute.h
index ce6c563..234de4e 100644
--- a/gdb/dwarf2/attribute.h
+++ b/gdb/dwarf2/attribute.h
@@ -1,6 +1,6 @@
/* DWARF attributes
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
Inc. with support from Florida State University (under contract
@@ -114,6 +114,34 @@ struct attribute
returned. */
std::optional<ULONGEST> unsigned_constant () const;
+ /* Return a signed constant value. This only handles constant forms
+ (i.e., form_is_constant -- and not the extended list of
+ "unsigned" forms) and assumes a signed value is desired. This
+ function will sign-extend DW_FORM_data* values.
+
+ If non-constant form is used, then complaint is issued and an
+ empty value is returned. */
+ std::optional<LONGEST> signed_constant () const;
+
+ /* Return a signed constant value. However, for narrow forms like
+ DW_FORM_data1, sign extension is not done.
+
+ DWARF advises compilers to generally use DW_FORM_[su]data to
+ avoid ambiguity. However, both GCC and LLVM ignore this for
+ certain attributes. Furthermore in DWARF, whether a narrower
+ form causes sign-extension depends on the attribute -- for
+ attributes that can only assume non-negative values, sign
+ extension is not done.
+
+ Unfortunately, both compilers also emit certain attributes in a
+ "confused" way, using DW_FORM_sdata for signed values, and
+ possibly choosing a narrow form (e.g., DW_FORM_data1) otherwise
+ -- assuming that sign-extension will not be done.
+
+ This method should only be called when this "confused" treatment
+ is necessary. */
+ std::optional<LONGEST> confused_constant () const;
+
/* Return non-zero if ATTR's value falls in the 'constant' class, or
zero otherwise. When this function returns true, you can apply
the constant_value method to it.
@@ -144,7 +172,9 @@ struct attribute
|| form == DW_FORM_ref4
|| form == DW_FORM_ref8
|| form == DW_FORM_ref_udata
- || form == DW_FORM_GNU_ref_alt);
+ || form == DW_FORM_GNU_ref_alt
+ || form == DW_FORM_ref_sup4
+ || form == DW_FORM_ref_sup8);
}
/* Check if the attribute's form is a DW_FORM_block*
@@ -164,10 +194,29 @@ struct attribute
false. */
bool form_is_strictly_signed () const;
+ /* Check if the attribute's form is an unsigned constant form. This
+ only returns true for forms that are strictly unsigned -- that
+ is, for a context-dependent form like DW_FORM_data1, this returns
+ false. */
+ bool form_is_strictly_unsigned () const
+ {
+ return form == DW_FORM_udata;
+ }
+
/* Check if the attribute's form is a form that requires
"reprocessing". */
bool form_requires_reprocessing () const;
+ /* Check if attribute's form refers to the separate "dwz" file.
+ This is only useful for references to the .debug_info section,
+ not to the supplementary .debug_str section. */
+ bool form_is_alt () const
+ {
+ return (form == DW_FORM_GNU_ref_alt
+ || form == DW_FORM_ref_sup4
+ || form == DW_FORM_ref_sup8);
+ }
+
/* Return DIE offset of this attribute. Return 0 with complaint if
the attribute is not of the required kind. */
diff --git a/gdb/dwarf2/call-site.h b/gdb/dwarf2/call-site.h
index ffade3b..2cc4883 100644
--- a/gdb/dwarf2/call-site.h
+++ b/gdb/dwarf2/call-site.h
@@ -1,6 +1,6 @@
/* Call site information.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules.
@@ -198,7 +198,7 @@ struct call_site
struct call_site *tail_call_next = nullptr;
/* * Describe DW_AT_call_target. Missing attribute uses
- FIELD_LOC_KIND_DWARF_BLOCK with FIELD_DWARF_BLOCK == NULL. */
+ m_loc_kind == DWARF_BLOCK with m_loc.dwarf_block == nullptr. */
struct call_site_target target {};
diff --git a/gdb/dwarf2/cooked-index-entry.c b/gdb/dwarf2/cooked-index-entry.c
index 3e322f1..0482b64 100644
--- a/gdb/dwarf2/cooked-index-entry.c
+++ b/gdb/dwarf2/cooked-index-entry.c
@@ -1,6 +1,6 @@
/* Entry in the cooked index
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -19,7 +19,6 @@
#include "dwarf2/cooked-index-entry.h"
#include "dwarf2/tag.h"
-#include "gdbsupport/gdb-safe-ctype.h"
#include "gdbsupport/selftest.h"
/* See cooked-index-entry.h. */
@@ -33,6 +32,7 @@ to_string (cooked_index_flag flags)
MAP_ENUM_FLAG (IS_LINKAGE),
MAP_ENUM_FLAG (IS_TYPE_DECLARATION),
MAP_ENUM_FLAG (IS_PARENT_DEFERRED),
+ MAP_ENUM_FLAG (IS_SYNTHESIZED),
};
return flags.to_string (mapping);
@@ -56,7 +56,7 @@ cooked_index_entry::compare (const char *stra, const char *strb,
template functions" section in the manual. */
if (c == '<')
return '\0';
- return TOLOWER ((unsigned char) c);
+ return c_tolower (c);
};
unsigned char a = munge (*stra);
@@ -188,8 +188,15 @@ cooked_index_entry::full_name (struct obstack *storage,
break;
case language_ada:
+ /* If GNAT emits hierarchical names (patches not in at the time
+ of writing), then we need to compute the linkage name here.
+ However for traditional GNAT, the linkage name will be in
+ 'name'. Detect this by looking for "__"; see also
+ cooked_index_shard::finalize. */
if ((name_flags & FOR_ADA_LINKAGE_NAME) != 0)
{
+ if (strstr (name, "__") != nullptr)
+ return name;
sep = "__";
break;
}
@@ -233,8 +240,7 @@ cooked_index_entry::write_scope (struct obstack *storage,
obstack_grow (storage, sep, strlen (sep));
}
-void _initialize_dwarf2_entry ();
-void _initialize_dwarf2_entry ()
+INIT_GDB_FILE (dwarf2_entry)
{
#if GDB_SELF_TEST
selftests::register_test ("cooked_index_entry::compare", test_compare);
diff --git a/gdb/dwarf2/cooked-index-entry.h b/gdb/dwarf2/cooked-index-entry.h
index bb47e32..db2b6d7 100644
--- a/gdb/dwarf2/cooked-index-entry.h
+++ b/gdb/dwarf2/cooked-index-entry.h
@@ -1,6 +1,6 @@
/* Entry in the cooked index
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/cooked-index-shard.c b/gdb/dwarf2/cooked-index-shard.c
index 683feb2..e440d85 100644
--- a/gdb/dwarf2/cooked-index-shard.c
+++ b/gdb/dwarf2/cooked-index-shard.c
@@ -1,6 +1,6 @@
/* Shards for the cooked index
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -86,7 +86,21 @@ cooked_index_shard::add (sect_offset die_offset, enum dwarf_tag tag,
implicit "main" discovery. */
if ((flags & IS_MAIN) != 0)
m_main = result;
- else if ((flags & IS_PARENT_DEFERRED) == 0
+ /* The language check here is subtle: it exists solely to work
+ around a bug in .gdb_index. That index does not record
+ languages, but it might emit an entry for "main". However,
+ recognizing this "main" as being the main program would be wrong
+ -- for example, an Ada program has a C "main" but this is not the
+ desired target of the "start" command. Requiring the language to
+ be set here avoids over-eagerly setting the "main" when using
+ .gdb_index. Should .gdb_index ever be removed (PR symtab/31363),
+ the language_unknown check here could also be removed.
+
+ Note that this explicit check isn't truly needed (it is covered
+ by language_may_use_plain_main as well), but it's handy as a spot
+ to document. */
+ else if (lang != language_unknown
+ && (flags & IS_PARENT_DEFERRED) == 0
&& parent_entry.resolved == nullptr
&& m_main == nullptr
&& language_may_use_plain_main (lang)
@@ -108,7 +122,7 @@ cooked_index_shard::handle_gnat_encoded_entry
characters are left as-is. This is done to make name matching a
bit simpler; and for wide characters, it means the choice of Ada
source charset does not affect the indexer directly. */
- std::string canonical = ada_decode (entry->name, false, false, false);
+ std::string canonical = ada_decode (entry->name, false, false);
if (canonical.empty ())
{
entry->canonical = entry->name;
diff --git a/gdb/dwarf2/cooked-index-shard.h b/gdb/dwarf2/cooked-index-shard.h
index eb80926..3a8e34d 100644
--- a/gdb/dwarf2/cooked-index-shard.h
+++ b/gdb/dwarf2/cooked-index-shard.h
@@ -1,6 +1,6 @@
/* Shards for the cooked index
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -48,6 +48,13 @@ public:
cooked_index_entry_ref parent_entry,
dwarf2_per_cu *per_cu);
+ /* Add a copy of NAME to the index. Return a pointer to the
+ copy. */
+ const char *add (std::string_view name)
+ {
+ return m_names.insert (name);
+ }
+
/* Install a new fixed addrmap from the given mutable addrmap. */
void install_addrmap (addrmap_mutable *map)
{
diff --git a/gdb/dwarf2/cooked-index-worker.c b/gdb/dwarf2/cooked-index-worker.c
index da51a8c..abaf41f 100644
--- a/gdb/dwarf2/cooked-index-worker.c
+++ b/gdb/dwarf2/cooked-index-worker.c
@@ -20,6 +20,7 @@
#include "dwarf2/cooked-index-worker.h"
#include "dwarf2/cooked-index.h"
#include "gdbsupport/thread-pool.h"
+#include "maint.h"
#include "run-on-main-thread.h"
#include "event-top.h"
#include "exceptions.h"
@@ -131,9 +132,8 @@ bool
cooked_index_worker::wait (cooked_state desired_state, bool allow_quit)
{
bool done;
-#if CXX_STD_THREAD
{
- std::unique_lock<std::mutex> lock (m_mutex);
+ gdb::unique_lock<gdb::mutex> lock (m_mutex);
/* This may be called from a non-main thread -- this functionality
is needed for the index cache -- but in this case we require
@@ -145,7 +145,7 @@ cooked_index_worker::wait (cooked_state desired_state, bool allow_quit)
if (allow_quit)
{
std::chrono::milliseconds duration { 15 };
- if (m_cond.wait_for (lock, duration) == std::cv_status::timeout)
+ if (m_cond.wait_for (lock, duration) == gdb::cv_status::timeout)
QUIT;
}
else
@@ -153,11 +153,6 @@ cooked_index_worker::wait (cooked_state desired_state, bool allow_quit)
}
done = m_state == cooked_state::CACHE_DONE;
}
-#else
- /* Without threads, all the work is done immediately on the main
- thread, and there is never anything to wait for. */
- done = desired_state == cooked_state::CACHE_DONE;
-#endif /* CXX_STD_THREAD */
/* Only the main thread is allowed to report complaints and the
like. */
@@ -212,15 +207,10 @@ cooked_index_worker::set (cooked_state desired_state)
{
gdb_assert (desired_state != cooked_state::INITIAL);
-#if CXX_STD_THREAD
- std::lock_guard<std::mutex> guard (m_mutex);
+ gdb::lock_guard<gdb::mutex> guard (m_mutex);
gdb_assert (desired_state > m_state);
m_state = desired_state;
m_cond.notify_one ();
-#else
- /* Without threads, all the work is done immediately on the main
- thread, and there is never anything to do. */
-#endif /* CXX_STD_THREAD */
}
/* See cooked-index-worker.h. */
@@ -244,8 +234,12 @@ cooked_index_worker::write_to_cache (const cooked_index *idx)
void
cooked_index_worker::done_reading ()
{
- for (auto &one_result : m_results)
- m_all_parents_map.add_map (*one_result.get_parent_map ());
+ {
+ scoped_time_it time_it ("DWARF add parent map", m_per_command_time);
+
+ for (auto &one_result : m_results)
+ m_all_parents_map.add_map (*one_result.get_parent_map ());
+ }
dwarf2_per_bfd *per_bfd = m_per_objfile->per_bfd;
cooked_index *table
diff --git a/gdb/dwarf2/cooked-index-worker.h b/gdb/dwarf2/cooked-index-worker.h
index df5c31d..4213b4e 100644
--- a/gdb/dwarf2/cooked-index-worker.h
+++ b/gdb/dwarf2/cooked-index-worker.h
@@ -25,11 +25,9 @@
#include "dwarf2/cooked-index-shard.h"
#include "dwarf2/types.h"
#include "dwarf2/read.h"
-
-#if CXX_STD_THREAD
-#include <mutex>
-#include <condition_variable>
-#endif /* CXX_STD_THREAD */
+#include "maint.h"
+#include "run-on-main-thread.h"
+#include "gdbsupport/cxx-thread.h"
using cutu_reader_up = std::unique_ptr<cutu_reader>;
@@ -85,6 +83,13 @@ public:
name, parent_entry, per_cu);
}
+ /* Add a copy of NAME to the index. Return a pointer to the
+ copy. */
+ const char *add (std::string_view name)
+ {
+ return m_shard->add (name);
+ }
+
/* Install the current addrmap into the shard being constructed,
then transfer ownership of the index to the caller. */
cooked_index_shard_up release_shard ()
@@ -101,17 +106,32 @@ public:
return &m_addrmap;
}
+ /* Set the mutable addrmap. */
+ void set_addrmap (addrmap_mutable new_map)
+ {
+ m_addrmap = std::move (new_map);
+ }
+
/* Return the parent_map that is currently being created. */
parent_map *get_parent_map ()
{
return &m_parent_map;
}
- /* Add an exception to the list of exceptions caught while reading.
- These are passed forward and printed by the main thread. */
- void note_error (gdb_exception &&except)
+ /* Catch exceptions from calling F (), and add them to the list of caught
+ exceptions. These are passed forward and printed by the main thread. */
+ template <typename F>
+ void
+ catch_error (F &&f)
{
- m_exceptions.push_back (std::move (except));
+ try
+ {
+ f ();
+ }
+ catch (gdb_exception &ex)
+ {
+ m_exceptions.push_back (std::move (ex));
+ }
}
/* Called when the thread using this object is done with its work.
@@ -199,7 +219,7 @@ enum class cooked_state
This is an abstract base class that defines the basic behavior of
scanners. Separate concrete implementations exist for scanning
- .debug_names and .debug_info. */
+ .debug_names, .gdb_index, and .debug_info. */
class cooked_index_worker
{
@@ -207,8 +227,12 @@ public:
explicit cooked_index_worker (dwarf2_per_objfile *per_objfile)
: m_per_objfile (per_objfile),
- m_cache_store (global_index_cache, per_objfile->per_bfd)
- { }
+ m_cache_store (global_index_cache, per_objfile->per_bfd),
+ m_per_command_time (per_command_time)
+ {
+ /* Make sure we capture per_command_time from the main thread. */
+ gdb_assert (is_main_thread ());
+ }
virtual ~cooked_index_worker ()
{ }
DISABLE_COPY_AND_ASSIGN (cooked_index_worker);
@@ -268,8 +292,14 @@ protected:
/* The per-objfile object. */
dwarf2_per_objfile *m_per_objfile;
+
/* Result of each worker task. */
std::vector<cooked_index_worker_result> m_results;
+
+ /* Mutex to synchronize access to M_RESULTS when workers append their
+ result. */
+ gdb::mutex m_results_mutex;
+
/* Any warnings emitted. For the time being at least, this only
needed in do_reading, not in every worker. Note that
deferred_warnings uses gdb_stderr in its constructor, and this
@@ -281,13 +311,12 @@ protected:
parent relationships. */
parent_map_map m_all_parents_map;
-#if CXX_STD_THREAD
/* Current state of this object. */
cooked_state m_state = cooked_state::INITIAL;
/* Mutex and condition variable used to synchronize. */
- std::mutex m_mutex;
- std::condition_variable m_cond;
-#endif /* CXX_STD_THREAD */
+ gdb::mutex m_mutex;
+ gdb::condition_variable m_cond;
+
/* This flag indicates whether any complaints or exceptions that
arose during scanning have been reported by 'wait'. This may
only be modified on the main thread. */
@@ -298,6 +327,9 @@ protected:
std::optional<gdb_exception> m_failed;
/* An object used to write to the index cache. */
index_cache_store_context m_cache_store;
+
+ /* Captured value of per_command_time. */
+ bool m_per_command_time;
};
using cooked_index_worker_up = std::unique_ptr<cooked_index_worker>;
diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
index 0f20b07..6209590 100644
--- a/gdb/dwarf2/cooked-index.c
+++ b/gdb/dwarf2/cooked-index.c
@@ -1,6 +1,6 @@
/* DIE indexing
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,6 +21,7 @@
#include "dwarf2/read.h"
#include "dwarf2/stringify.h"
#include "event-top.h"
+#include "maint.h"
#include "observable.h"
#include "run-on-main-thread.h"
#include "gdbsupport/task-group.h"
@@ -101,7 +102,12 @@ cooked_index::set_contents ()
{
auto this_shard = shard.get ();
const parent_map_map *parent_maps = m_state->get_parent_map_map ();
- finalizers.add_task ([=] () { this_shard->finalize (parent_maps); });
+ finalizers.add_task ([=] ()
+ {
+ scoped_time_it time_it ("DWARF finalize worker",
+ m_state->m_per_command_time);
+ this_shard->finalize (parent_maps);
+ });
}
finalizers.start ();
@@ -321,9 +327,7 @@ maintenance_wait_for_index_cache (const char *args, int from_tty)
wait_for_index_cache (0);
}
-void _initialize_cooked_index ();
-void
-_initialize_cooked_index ()
+INIT_GDB_FILE (cooked_index)
{
add_cmd ("wait-for-index-cache", class_maintenance,
maintenance_wait_for_index_cache, _("\
diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h
index 384938e..90a18af 100644
--- a/gdb/dwarf2/cooked-index.h
+++ b/gdb/dwarf2/cooked-index.h
@@ -1,6 +1,6 @@
/* DIE indexing
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -237,15 +237,15 @@ struct cooked_index_functions : public dwarf2_base_index_functions
dwarf2_base_index_functions::expand_all_symtabs (objfile);
}
- bool expand_symtabs_matching
+ bool search
(struct objfile *objfile,
- expand_symtabs_file_matcher file_matcher,
+ search_symtabs_file_matcher file_matcher,
const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
+ search_symtabs_symbol_matcher symbol_matcher,
+ search_symtabs_expansion_listener listener,
block_search_flags search_flags,
domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher) override;
+ search_symtabs_lang_matcher lang_matcher) override;
struct compunit_symtab *find_pc_sect_compunit_symtab
(struct objfile *objfile, bound_minimal_symbol msymbol,
@@ -260,8 +260,8 @@ struct cooked_index_functions : public dwarf2_base_index_functions
bool need_fullname) override
{
wait (objfile, true);
- return (dwarf2_base_index_functions::map_symbol_filenames
- (objfile, fun, need_fullname));
+ dwarf2_base_index_functions::map_symbol_filenames (objfile, fun,
+ need_fullname);
}
void compute_main_name (struct objfile *objfile) override
diff --git a/gdb/dwarf2/cooked-indexer.c b/gdb/dwarf2/cooked-indexer.c
index 1f3a235..913ff77 100644
--- a/gdb/dwarf2/cooked-indexer.c
+++ b/gdb/dwarf2/cooked-indexer.c
@@ -20,6 +20,9 @@
#include "dwarf2/cooked-indexer.h"
#include "dwarf2/cooked-index-worker.h"
#include "dwarf2/error.h"
+#include "dwarf2/read.h"
+#include "cp-support.h"
+#include "demangle.h"
/* See cooked-indexer.h. */
@@ -83,19 +86,17 @@ tag_can_have_linkage_name (enum dwarf_tag tag)
cutu_reader *
cooked_indexer::ensure_cu_exists (cutu_reader *reader,
- sect_offset sect_off, bool is_dwz,
+ const section_and_offset &sect_off,
bool for_scanning)
{
/* Lookups for type unit references are always in the CU, and
cross-CU references will crash. */
- if (reader->cu ()->per_cu->is_dwz == is_dwz
- && reader->cu ()->header.offset_in_cu_p (sect_off))
+ if (reader->section () == sect_off.section
+ && reader->cu ()->header.offset_in_unit_p (sect_off.offset))
return reader;
dwarf2_per_objfile *per_objfile = reader->cu ()->per_objfile;
- dwarf2_per_cu *per_cu
- = dwarf2_find_containing_comp_unit (sect_off, is_dwz,
- per_objfile->per_bfd);
+ dwarf2_per_cu *per_cu = dwarf2_find_containing_unit (sect_off, per_objfile);
/* When scanning, we only want to visit a given CU a single time.
Doing this check here avoids self-imports as well. */
@@ -109,20 +110,20 @@ cooked_indexer::ensure_cu_exists (cutu_reader *reader,
cutu_reader *result = m_index_storage->get_reader (per_cu);
if (result == nullptr)
{
- cutu_reader new_reader (*per_cu, *per_objfile, nullptr, nullptr, false,
- language_minimal,
- &m_index_storage->get_abbrev_table_cache ());
-
- if (new_reader.is_dummy () || new_reader.top_level_die () == nullptr
- || !new_reader.top_level_die ()->has_children)
+ const abbrev_table_cache &abbrev_table_cache
+ = m_index_storage->get_abbrev_table_cache ();
+ auto new_reader
+ = std::make_unique<cutu_reader> (*per_cu, *per_objfile, nullptr,
+ nullptr, false, language_minimal,
+ &abbrev_table_cache);
+
+ if (new_reader->is_dummy ())
return nullptr;
- auto copy = std::make_unique<cutu_reader> (std::move (new_reader));
- result = m_index_storage->preserve (std::move (copy));
+ result = m_index_storage->preserve (std::move (new_reader));
}
- if (result->is_dummy () || result->top_level_die () == nullptr
- || !result->top_level_die ()->has_children)
+ if (result->is_dummy ())
return nullptr;
if (for_scanning)
@@ -148,10 +149,8 @@ cooked_indexer::scan_attributes (dwarf2_per_cu *scanning_per_cu,
bool *is_enum_class,
bool for_specification)
{
- bool origin_is_dwz = false;
bool is_declaration = false;
- sect_offset origin_offset {};
-
+ std::optional<section_and_offset> origin;
std::optional<unrelocated_addr> low_pc;
std::optional<unrelocated_addr> high_pc;
bool high_pc_relative = false;
@@ -221,8 +220,8 @@ cooked_indexer::scan_attributes (dwarf2_per_cu *scanning_per_cu,
case DW_AT_specification:
case DW_AT_abstract_origin:
case DW_AT_extension:
- origin_offset = attr.get_ref_die_offset ();
- origin_is_dwz = attr.form == DW_FORM_GNU_ref_alt;
+ origin = { &get_section_for_ref (attr, reader->cu ()),
+ attr.get_ref_die_offset () };
break;
case DW_AT_external:
@@ -301,7 +300,7 @@ cooked_indexer::scan_attributes (dwarf2_per_cu *scanning_per_cu,
|| abbrev->tag == DW_TAG_namespace)
&& abbrev->has_children)
*flags |= IS_TYPE_DECLARATION;
- else
+ else if (!is_ada_import_or_export (reader->cu (), *name, *linkage_name))
{
*linkage_name = nullptr;
*name = nullptr;
@@ -311,19 +310,19 @@ cooked_indexer::scan_attributes (dwarf2_per_cu *scanning_per_cu,
|| (*linkage_name == nullptr
&& tag_can_have_linkage_name (abbrev->tag))
|| (*parent_entry == nullptr && m_language != language_c))
- && origin_offset != sect_offset (0))
+ && origin.has_value ())
{
cutu_reader *new_reader
- = ensure_cu_exists (reader, origin_offset, origin_is_dwz, false);
+ = ensure_cu_exists (reader, *origin, false);
if (new_reader == nullptr)
error (_(DWARF_ERROR_PREFIX
"cannot follow reference to DIE at %s"
" [in module %s]"),
- sect_offset_str (origin_offset),
+ sect_offset_str (origin->offset),
bfd_get_filename (reader->abfd ()));
const gdb_byte *new_info_ptr
- = (new_reader->buffer () + to_underlying (origin_offset));
+ = (new_reader->buffer () + to_underlying (origin->offset));
if (*parent_entry == nullptr)
{
@@ -347,7 +346,7 @@ cooked_indexer::scan_attributes (dwarf2_per_cu *scanning_per_cu,
if (new_abbrev == nullptr)
error (_(DWARF_ERROR_PREFIX
"Unexpected null DIE at offset %s [in module %s]"),
- sect_offset_str (origin_offset),
+ sect_offset_str (origin->offset),
bfd_get_filename (new_reader->abfd ()));
new_info_ptr += bytes_read;
@@ -411,8 +410,7 @@ cooked_indexer::index_imported_unit (cutu_reader *reader,
const gdb_byte *info_ptr,
const abbrev_info *abbrev)
{
- sect_offset sect_off {};
- bool is_dwz = false;
+ std::optional<section_and_offset> target;
for (int i = 0; i < abbrev->num_attrs; ++i)
{
@@ -421,19 +419,16 @@ cooked_indexer::index_imported_unit (cutu_reader *reader,
info_ptr = reader->read_attribute (&attr, &abbrev->attrs[i], info_ptr);
if (attr.name == DW_AT_import)
- {
- sect_off = attr.get_ref_die_offset ();
- is_dwz = (attr.form == DW_FORM_GNU_ref_alt
- || reader->cu ()->per_cu->is_dwz);
- }
+ target = { &get_section_for_ref (attr, reader->cu ()),
+ attr.get_ref_die_offset () };
}
/* Did not find DW_AT_import. */
- if (sect_off == sect_offset (0))
+ if (!target.has_value ())
return info_ptr;
cutu_reader *new_reader
- = ensure_cu_exists (reader, sect_off, is_dwz, true);
+ = ensure_cu_exists (reader, *target, true);
if (new_reader != nullptr)
{
index_dies (new_reader, new_reader->info_ptr (), nullptr, false);
@@ -514,7 +509,8 @@ cooked_indexer::index_dies (cutu_reader *reader,
/* If a DIE parent is a DW_TAG_subprogram, then the DIE is only
interesting if it's a DW_TAG_subprogram or a DW_TAG_entry_point. */
bool die_interesting
- = (abbrev->interesting
+ = ((abbrev->interesting
+ || (m_language == language_ada && abbrev->maybe_ada_import))
&& (parent_entry == nullptr
|| parent_entry->tag != DW_TAG_subprogram
|| abbrev->tag == DW_TAG_subprogram
@@ -550,6 +546,11 @@ cooked_indexer::index_dies (cutu_reader *reader,
flags &= ~IS_STATIC;
flags |= parent_entry->flags & IS_STATIC;
}
+ else if (abbrev->tag == DW_TAG_imported_declaration)
+ {
+ /* Match the full reader. */
+ flags &= ~IS_STATIC;
+ }
if (abbrev->tag == DW_TAG_namespace
&& m_language == language_cplus
@@ -562,6 +563,30 @@ cooked_indexer::index_dies (cutu_reader *reader,
name = nullptr;
}
+ /* An otherwise anonymous type might be given a name (via
+ typedef) for linkage purposes, and gdb tries to handle this
+ case. See anon-struct.exp. In this case, GCC will emit a
+ funny thing: a linkage name for the type, but in "type" form.
+ That is, it will not start with _Z. */
+ if ((abbrev->tag == DW_TAG_class_type
+ || abbrev->tag == DW_TAG_structure_type
+ || abbrev->tag == DW_TAG_union_type)
+ && m_language == language_cplus
+ && name == nullptr
+ && linkage_name != nullptr)
+ {
+ gdb::unique_xmalloc_ptr<char> dem
+ = gdb_demangle (linkage_name, DMGL_GNU_V3 | DMGL_TYPES);
+ if (dem != nullptr)
+ {
+ /* We're only interested in the last component. */
+ std::vector<std::string_view> split
+ = split_name (dem.get (), split_style::CXX);
+ name = m_index_storage->add (split.back ());
+ linkage_name = nullptr;
+ }
+ }
+
cooked_index_entry *this_entry = nullptr;
if (name != nullptr)
{
diff --git a/gdb/dwarf2/cooked-indexer.h b/gdb/dwarf2/cooked-indexer.h
index 904c55f..83cbf7f 100644
--- a/gdb/dwarf2/cooked-indexer.h
+++ b/gdb/dwarf2/cooked-indexer.h
@@ -30,6 +30,7 @@ struct cooked_index_worker_result;
struct cutu_reader;
struct dwarf2_per_cu;
struct dwarf2_per_objfile;
+struct section_and_offset;
/* An instance of this is created to index a CU. */
@@ -55,8 +56,7 @@ private:
the DIEs in the CU; when false, this use is assumed to be to look
up just a single DIE. */
cutu_reader *ensure_cu_exists (cutu_reader *reader,
- sect_offset sect_off,
- bool is_dwz,
+ const section_and_offset &sect_off,
bool for_scanning);
/* Index DIEs in the READER starting at INFO_PTR. PARENT is
diff --git a/gdb/dwarf2/cu.c b/gdb/dwarf2/cu.c
index 0e17b73..86b77f5 100644
--- a/gdb/dwarf2/cu.c
+++ b/gdb/dwarf2/cu.c
@@ -1,6 +1,6 @@
/* DWARF CU data structure
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/cu.h b/gdb/dwarf2/cu.h
index 6979b7c..68010a0 100644
--- a/gdb/dwarf2/cu.h
+++ b/gdb/dwarf2/cu.h
@@ -1,6 +1,6 @@
/* DWARF CU data structure
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,7 +21,7 @@
#define GDB_DWARF2_CU_H
#include "buildsym.h"
-#include "dwarf2/comp-unit-head.h"
+#include "dwarf2/unit-head.h"
#include <optional>
#include "language.h"
#include "gdbsupport/unordered_set.h"
@@ -54,6 +54,11 @@ struct dwarf2_cu
DISABLE_COPY_AND_ASSIGN (dwarf2_cu);
+ /* The section the DIEs were effectively read from. This could be
+ .debug_info, .debug_types, or with split DWARF, their .dwo
+ variants. */
+ const dwarf2_section_info &section () const;
+
/* TU version of handle_DW_AT_stmt_list for read_type_unit_scope.
Create the set of symtabs used by this TU, or if this TU is sharing
symtabs with another TU and the symtabs have already been created
@@ -99,8 +104,17 @@ struct dwarf2_cu
void add_dependence (dwarf2_per_cu *ref_per_cu)
{ m_dependencies.emplace (ref_per_cu); }
+ /* Find the DIE at section offset SECT_OFF.
+
+ Return nullptr if not found. */
+ die_info *find_die (sect_offset sect_off) const
+ {
+ auto it = die_hash.find (sect_off);
+ return it != die_hash.end () ? *it : nullptr;
+ }
+
/* The header of the compilation unit. */
- struct comp_unit_head header;
+ struct unit_head header;
/* Base address of this compilation unit. */
std::optional<unrelocated_addr> base_address;
@@ -360,7 +374,7 @@ public:
right place. And since the DW_TAG_compile_unit DIE in the split-unit can't
have a DW_AT_ranges attribute, we can use the
- die->tag != DW_AT_compile_unit
+ die->tag != DW_TAG_compile_unit
to determine whether the base should be added or not. */
ULONGEST gnu_ranges_base = 0;
diff --git a/gdb/dwarf2/die.c b/gdb/dwarf2/die.c
index 9437c2f..7ed18bf 100644
--- a/gdb/dwarf2/die.c
+++ b/gdb/dwarf2/die.c
@@ -1,6 +1,6 @@
/* DWARF DIEs
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -90,6 +90,8 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
gdb_puts (hex_string (die->attrs[i].as_unsigned ()), f);
break;
case DW_FORM_GNU_ref_alt:
+ case DW_FORM_ref_sup4:
+ case DW_FORM_ref_sup8:
gdb_printf (f, "alt ref address: ");
gdb_puts (hex_string (die->attrs[i].as_unsigned ()), f);
break;
@@ -123,6 +125,7 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
case DW_FORM_strx:
case DW_FORM_GNU_str_index:
case DW_FORM_GNU_strp_alt:
+ case DW_FORM_strp_sup:
gdb_printf (f, "string: \"%s\" (%s canonicalized)",
die->attrs[i].as_string ()
? die->attrs[i].as_string () : "",
diff --git a/gdb/dwarf2/die.h b/gdb/dwarf2/die.h
index cffb5cb..6f269ca 100644
--- a/gdb/dwarf2/die.h
+++ b/gdb/dwarf2/die.h
@@ -1,6 +1,6 @@
/* DWARF DIEs
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -108,7 +108,9 @@ struct die_info
DIE. */
next_range<die_info> children () const
{
- return next_range<die_info> (child);
+ next_iterator<die_info> begin (child);
+
+ return next_range<die_info> (std::move (begin));
}
/* DWARF-2 tag for this DIE. */
diff --git a/gdb/dwarf2/dwz.c b/gdb/dwarf2/dwz.c
index f36d6a6..1aa0d03 100644
--- a/gdb/dwarf2/dwz.c
+++ b/gdb/dwarf2/dwz.c
@@ -1,6 +1,6 @@
/* DWARF DWZ handling for GDB.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,6 +21,7 @@
#include "build-id.h"
#include "debuginfod-support.h"
+#include "dwarf2/leb.h"
#include "dwarf2/read.h"
#include "dwarf2/sect-names.h"
#include "filenames.h"
@@ -34,15 +35,17 @@
const char *
dwz_file::read_string (struct objfile *objfile, LONGEST str_offset)
{
- str.read (objfile);
+ /* This must be true because the sections are read in when the
+ dwz_file is created. */
+ gdb_assert (str.readin);
if (str.buffer == NULL)
- error (_("DW_FORM_GNU_strp_alt used without .debug_str "
+ error (_("supplementary DWARF file missing .debug_str "
"section [in module %s]"),
this->filename ());
if (str_offset >= str.size)
- error (_("DW_FORM_GNU_strp_alt pointing outside of "
- ".debug_str section [in module %s]"),
+ error (_("invalid string reference to supplementary DWARF file "
+ "[in module %s]"),
this->filename ());
gdb_assert (HOST_CHAR_BIT == 8);
if (str.buffer[str_offset] == '\0')
@@ -53,36 +56,171 @@ dwz_file::read_string (struct objfile *objfile, LONGEST str_offset)
/* A helper function to find the sections for a .dwz file. */
static void
-locate_dwz_sections (struct objfile *objfile, bfd *abfd, asection *sectp,
- dwz_file *dwz_file)
+locate_dwz_sections (objfile *objfile, dwz_file &dwz_file)
{
- dwarf2_section_info *sect = nullptr;
+ for (asection *sec : gdb_bfd_sections (dwz_file.dwz_bfd))
+ {
+ dwarf2_section_info *sect = nullptr;
- /* Note that we only support the standard ELF names, because .dwz
+ /* Note that we only support the standard ELF names, because .dwz
is ELF-only (at the time of writing). */
- if (dwarf2_elf_names.abbrev.matches (sectp->name))
- sect = &dwz_file->abbrev;
- else if (dwarf2_elf_names.info.matches (sectp->name))
- sect = &dwz_file->info;
- else if (dwarf2_elf_names.str.matches (sectp->name))
- sect = &dwz_file->str;
- else if (dwarf2_elf_names.line.matches (sectp->name))
- sect = &dwz_file->line;
- else if (dwarf2_elf_names.macro.matches (sectp->name))
- sect = &dwz_file->macro;
- else if (dwarf2_elf_names.gdb_index.matches (sectp->name))
- sect = &dwz_file->gdb_index;
- else if (dwarf2_elf_names.debug_names.matches (sectp->name))
- sect = &dwz_file->debug_names;
- else if (dwarf2_elf_names.types.matches (sectp->name))
- sect = &dwz_file->types;
-
- if (sect != nullptr)
+ if (dwarf2_elf_names.abbrev.matches (sec->name))
+ sect = &dwz_file.abbrev;
+ else if (dwarf2_elf_names.info.matches (sec->name))
+ sect = &dwz_file.info;
+ else if (dwarf2_elf_names.str.matches (sec->name))
+ sect = &dwz_file.str;
+ else if (dwarf2_elf_names.line.matches (sec->name))
+ sect = &dwz_file.line;
+ else if (dwarf2_elf_names.macro.matches (sec->name))
+ sect = &dwz_file.macro;
+ else if (dwarf2_elf_names.gdb_index.matches (sec->name))
+ sect = &dwz_file.gdb_index;
+ else if (dwarf2_elf_names.debug_names.matches (sec->name))
+ sect = &dwz_file.debug_names;
+ else if (dwarf2_elf_names.types.matches (sec->name))
+ sect = &dwz_file.types;
+
+ if (sect != nullptr)
+ {
+ sect->s.section = sec;
+ sect->size = bfd_section_size (sec);
+ sect->read (objfile);
+ }
+ }
+}
+
+/* Helper that throws an exception when reading the .debug_sup
+ section. */
+
+static void
+debug_sup_failure (const char *text, bfd *abfd)
+{
+ error (_("%s [in modules %s]"), text, bfd_get_filename (abfd));
+}
+
+/* Look for the .debug_sup section and read it. If the section does
+ not exist, this returns false. If the section does exist but fails
+ to parse for some reason, an exception is thrown. Otherwise, if
+ everything goes well, this returns true and fills in the out
+ parameters. */
+
+static bool
+get_debug_sup_info (bfd *abfd,
+ std::string *filename,
+ size_t *buildid_len,
+ gdb::unique_xmalloc_ptr<bfd_byte> *buildid)
+{
+ asection *sect = bfd_get_section_by_name (abfd, ".debug_sup");
+ if (sect == nullptr)
+ return false;
+
+ bfd_byte *contents;
+ if (!bfd_malloc_and_get_section (abfd, sect, &contents))
+ debug_sup_failure (_("could not read .debug_sup section"), abfd);
+
+ gdb::unique_xmalloc_ptr<bfd_byte> content_holder (contents);
+ bfd_size_type size = bfd_section_size (sect);
+
+ /* Version of this section. */
+ if (size < 4)
+ debug_sup_failure (_(".debug_sup section too short"), abfd);
+ unsigned int version = read_2_bytes (abfd, contents);
+ contents += 2;
+ size -= 2;
+ if (version != 5)
+ debug_sup_failure (_(".debug_sup has wrong version number"), abfd);
+
+ /* Skip the is_supplementary value. We already ensured there were
+ enough bytes, above. */
+ ++contents;
+ --size;
+
+ /* The spec says that in the supplementary file, this must be \0,
+ but it doesn't seem very important. */
+ const char *fname = (const char *) contents;
+ size_t len = strlen (fname) + 1;
+ if (filename != nullptr)
+ *filename = fname;
+ contents += len;
+ size -= len;
+
+ if (size == 0)
+ debug_sup_failure (_(".debug_sup section missing ID"), abfd);
+
+ unsigned int bytes_read;
+ *buildid_len = read_unsigned_leb128 (abfd, contents, &bytes_read);
+ contents += bytes_read;
+ size -= bytes_read;
+
+ if (size < *buildid_len)
+ debug_sup_failure (_("extra data after .debug_sup section ID"), abfd);
+
+ if (*buildid_len != 0)
+ buildid->reset ((bfd_byte *) xmemdup (contents, *buildid_len,
+ *buildid_len));
+
+ return true;
+}
+
+/* Validate that ABFD matches the given BUILDID. If DWARF5 is true,
+ then this is done by examining the .debug_sup data. */
+
+static bool
+verify_id (bfd *abfd, size_t len, const bfd_byte *buildid, bool dwarf5)
+{
+ if (!bfd_check_format (abfd, bfd_object))
+ return false;
+
+ if (dwarf5)
{
- sect->s.section = sectp;
- sect->size = bfd_section_size (sectp);
- sect->read (objfile);
+ size_t new_len;
+ gdb::unique_xmalloc_ptr<bfd_byte> new_id;
+
+ if (!get_debug_sup_info (abfd, nullptr, &new_len, &new_id))
+ return false;
+ return (len == new_len
+ && memcmp (buildid, new_id.get (), len) == 0);
}
+ else
+ return build_id_verify (abfd, len, buildid);
+}
+
+/* Find either the .debug_sup or .gnu_debugaltlink section and return
+ its contents. Returns true on success and sets out parameters, or
+ false if nothing is found. */
+
+static bool
+read_alt_info (bfd *abfd, std::string *filename,
+ size_t *buildid_len,
+ gdb::unique_xmalloc_ptr<bfd_byte> *buildid,
+ bool *dwarf5)
+{
+ if (get_debug_sup_info (abfd, filename, buildid_len, buildid))
+ {
+ *dwarf5 = true;
+ return true;
+ }
+
+ bfd_size_type buildid_len_arg;
+ bfd_set_error (bfd_error_no_error);
+ bfd_byte *buildid_out;
+ gdb::unique_xmalloc_ptr<char> new_filename
+ (bfd_get_alt_debug_link_info (abfd, &buildid_len_arg,
+ &buildid_out));
+ if (new_filename == nullptr)
+ {
+ if (bfd_get_error () == bfd_error_no_error)
+ return false;
+ error (_("could not read '.gnu_debugaltlink' section: %s"),
+ bfd_errmsg (bfd_get_error ()));
+ }
+ *filename = new_filename.get ();
+
+ *buildid_len = buildid_len_arg;
+ buildid->reset (buildid_out);
+ *dwarf5 = false;
+ return true;
}
/* Attempt to find a .dwz file (whose full path is represented by
@@ -93,7 +231,7 @@ locate_dwz_sections (struct objfile *objfile, bfd *abfd, asection *sectp,
static gdb_bfd_ref_ptr
dwz_search_other_debugdirs (std::string &filename, bfd_byte *buildid,
- size_t buildid_len)
+ size_t buildid_len, bool dwarf5)
{
/* Let's assume that the path represented by FILENAME has the
"/.dwz/" subpath in it. This is what (most) GNU/Linux
@@ -161,7 +299,7 @@ dwz_search_other_debugdirs (std::string &filename, bfd_byte *buildid,
if (dwz_bfd == nullptr)
continue;
- if (!build_id_verify (dwz_bfd.get (), buildid_len, buildid))
+ if (!verify_id (dwz_bfd.get (), buildid_len, buildid, dwarf5))
{
dwz_bfd.reset (nullptr);
continue;
@@ -177,11 +315,8 @@ dwz_search_other_debugdirs (std::string &filename, bfd_byte *buildid,
/* See dwz.h. */
void
-dwarf2_read_dwz_file (dwarf2_per_objfile *per_objfile)
+dwz_file::read_dwz_file (dwarf2_per_objfile *per_objfile)
{
- bfd_size_type buildid_len_arg;
- size_t buildid_len;
- bfd_byte *buildid;
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
/* This may query the user via the debuginfod support, so it may
@@ -193,29 +328,22 @@ dwarf2_read_dwz_file (dwarf2_per_objfile *per_objfile)
/* Set this early, so that on error it remains NULL. */
per_bfd->dwz_file.emplace (nullptr);
- bfd_set_error (bfd_error_no_error);
- gdb::unique_xmalloc_ptr<char> data
- (bfd_get_alt_debug_link_info (per_bfd->obfd,
- &buildid_len_arg, &buildid));
- if (data == NULL)
+ size_t buildid_len;
+ gdb::unique_xmalloc_ptr<bfd_byte> buildid;
+ std::string filename;
+ bool dwarf5;
+ if (!read_alt_info (per_bfd->obfd, &filename, &buildid_len, &buildid,
+ &dwarf5))
{
- if (bfd_get_error () == bfd_error_no_error)
- return;
- error (_("could not read '.gnu_debugaltlink' section: %s"),
- bfd_errmsg (bfd_get_error ()));
+ /* Nothing found, nothing to do. */
+ return;
}
- gdb::unique_xmalloc_ptr<bfd_byte> buildid_holder (buildid);
-
- buildid_len = (size_t) buildid_len_arg;
-
- std::string filename = data.get ();
-
if (!IS_ABSOLUTE_PATH (filename.c_str ()))
{
gdb::unique_xmalloc_ptr<char> abs = gdb_realpath (per_bfd->filename ());
- filename = ldirname (abs.get ()) + SLASH_STRING + filename;
+ filename = gdb_ldirname (abs.get ()) + SLASH_STRING + filename;
}
/* First try the file name given in the section. If that doesn't
@@ -223,25 +351,26 @@ dwarf2_read_dwz_file (dwarf2_per_objfile *per_objfile)
gdb_bfd_ref_ptr dwz_bfd (gdb_bfd_open (filename.c_str (), gnutarget));
if (dwz_bfd != NULL)
{
- if (!build_id_verify (dwz_bfd.get (), buildid_len, buildid))
+ if (!verify_id (dwz_bfd.get (), buildid_len, buildid.get (), dwarf5))
dwz_bfd.reset (nullptr);
}
if (dwz_bfd == NULL)
- dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid);
+ dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid.get ());
if (dwz_bfd == nullptr)
{
/* If the user has provided us with different
debug file directories, we can try them in order. */
- dwz_bfd = dwz_search_other_debugdirs (filename, buildid, buildid_len);
+ dwz_bfd = dwz_search_other_debugdirs (filename, buildid.get (),
+ buildid_len, dwarf5);
}
if (dwz_bfd == nullptr)
{
gdb::unique_xmalloc_ptr<char> alt_filename;
scoped_fd fd
- = debuginfod_debuginfo_query (buildid, buildid_len,
+ = debuginfod_debuginfo_query (buildid.get (), buildid_len,
per_bfd->filename (), &alt_filename);
if (fd.get () >= 0)
@@ -252,20 +381,20 @@ dwarf2_read_dwz_file (dwarf2_per_objfile *per_objfile)
if (dwz_bfd == nullptr)
warning (_("File \"%s\" from debuginfod cannot be opened as bfd"),
alt_filename.get ());
- else if (!build_id_verify (dwz_bfd.get (), buildid_len, buildid))
+ else if (!verify_id (dwz_bfd.get (), buildid_len, buildid.get (),
+ dwarf5))
dwz_bfd.reset (nullptr);
}
}
if (dwz_bfd == NULL)
- error (_("could not find '.gnu_debugaltlink' file for %s"),
+ error (_("could not find supplementary DWARF file (%s) for %s"),
+ filename.c_str (),
per_bfd->filename ());
- auto result = std::make_unique<dwz_file> (std::move (dwz_bfd));
+ dwz_file_up result (new dwz_file (std::move (dwz_bfd)));
- for (asection *sec : gdb_bfd_sections (result->dwz_bfd))
- locate_dwz_sections (per_objfile->objfile, result->dwz_bfd.get (),
- sec, result.get ());
+ locate_dwz_sections (per_objfile->objfile, *result);
gdb_bfd_record_inclusion (per_bfd->obfd, result->dwz_bfd.get ());
bfd_cache_close (result->dwz_bfd.get ());
diff --git a/gdb/dwarf2/dwz.h b/gdb/dwarf2/dwz.h
index cd5143f..372f7e6 100644
--- a/gdb/dwarf2/dwz.h
+++ b/gdb/dwarf2/dwz.h
@@ -1,6 +1,6 @@
/* DWARF DWZ handling for GDB.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -31,10 +31,12 @@ struct dwarf2_per_objfile;
struct dwz_file
{
- dwz_file (gdb_bfd_ref_ptr &&bfd)
- : dwz_bfd (std::move (bfd))
- {
- }
+ /* Open the separate '.dwz' debug file, if needed. This will set
+ the appropriate field in the per-BFD structure. If the DWZ file
+ exists, the relevant sections are read in as well. Throws an
+ exception if the .gnu_debugaltlink or .debug_sup section exists
+ but is invalid or if the file cannot be found. */
+ static void read_dwz_file (dwarf2_per_objfile *per_objfile);
const char *filename () const
{
@@ -64,16 +66,15 @@ struct dwz_file
return a pointer to the string. */
const char *read_string (struct objfile *objfile, LONGEST str_offset);
-};
-using dwz_file_up = std::unique_ptr<dwz_file>;
+private:
-/* Open the separate '.dwz' debug file, if needed. This just sets the
- appropriate field in the per-BFD structure. If the DWZ file
- exists, the relevant sections are read in as well. Throws an error
- if the .gnu_debugaltlink section exists but the file cannot be
- found. */
+ explicit dwz_file (gdb_bfd_ref_ptr &&bfd)
+ : dwz_bfd (std::move (bfd))
+ {
+ }
+};
-extern void dwarf2_read_dwz_file (dwarf2_per_objfile *per_objfile);
+using dwz_file_up = std::unique_ptr<dwz_file>;
#endif /* GDB_DWARF2_DWZ_H */
diff --git a/gdb/dwarf2/error.h b/gdb/dwarf2/error.h
index f8861f2..432775a 100644
--- a/gdb/dwarf2/error.h
+++ b/gdb/dwarf2/error.h
@@ -1,6 +1,6 @@
/* DWARF error handling utilities.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
index 3a6165a..aa2fd9d 100644
--- a/gdb/dwarf2/expr.c
+++ b/gdb/dwarf2/expr.c
@@ -1,6 +1,6 @@
/* DWARF 2 Expression Evaluator.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
Contributed by Daniel Berlin (dan@dberlin.org)
@@ -880,6 +880,34 @@ dwarf_expr_context::read_mem (gdb_byte *buf, CORE_ADDR addr,
/* See expr.h. */
+value *
+dwarf_expr_context::deref (CORE_ADDR addr, int size, struct type *type)
+{
+ gdb_byte *buf = (gdb_byte *) alloca (size);
+ this->read_mem (buf, addr, size);
+
+ if (type == nullptr)
+ type = this->address_type ();
+
+ /* If the size of the object read from memory is different
+ from the type length, we need to zero-extend it. */
+ if (type->length () != size)
+ {
+ gdbarch *arch = this->m_per_objfile->objfile->arch ();
+ bfd_endian byte_order = gdbarch_byte_order (arch);
+ ULONGEST datum
+ = extract_unsigned_integer (buf, size, byte_order);
+
+ buf = (gdb_byte *) alloca (type->length ());
+ store_unsigned_integer (buf, type->length (),
+ byte_order, datum);
+ }
+
+ return value_from_contents_and_address (type, buf, addr);
+}
+
+/* See expr.h. */
+
void
dwarf_expr_context::push_dwarf_reg_entry_value (call_site_parameter_kind kind,
call_site_parameter_u kind_u,
@@ -1507,6 +1535,27 @@ dwarf_block_to_sp_offset (struct gdbarch *gdbarch, const gdb_byte *buf,
return 1;
}
+/* Return true if, for an expr evaluated in the context of FRAME, we can
+ assume that DW_OP_entry_value (expr) == expr.
+
+ We can assume this right after executing a call, when stopped at the
+ start of the called function, in other words, when:
+ - FRAME is the innermost frame, and
+ - FRAME->pc is the first insn in a function. */
+
+static bool
+trivial_entry_value (frame_info_ptr frame)
+{
+ bool innermost_frame = frame_relative_level (frame) == 0;
+
+ /* Get pc corresponding to frame. Use get_frame_address_in_block to make
+ sure we get a pc in the correct function in the case of tail calls. */
+ CORE_ADDR pc = get_frame_address_in_block (frame);
+ bool at_first_insn = find_function_type (pc) != nullptr;
+
+ return innermost_frame && at_first_insn;
+}
+
/* The engine for the expression evaluator. Using the context in this
object, evaluate the expression between OP_PTR and OP_END. */
@@ -1710,6 +1759,10 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
case DW_OP_reg29:
case DW_OP_reg30:
case DW_OP_reg31:
+ /* The value of a register is relative to a frame, so we require a
+ valid frame. */
+ ensure_have_frame (this->m_frame, "DW_OP_reg<n>");
+
dwarf_expr_require_composition (op_ptr, op_end, "DW_OP_reg");
result = op - DW_OP_reg0;
@@ -1718,6 +1771,10 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
break;
case DW_OP_regx:
+ /* The value of a register is relative to a frame, so we require a
+ valid frame. */
+ ensure_have_frame (this->m_frame, "DW_OP_regx");
+
op_ptr = safe_read_uleb128 (op_ptr, op_end, &reg);
dwarf_expr_require_composition (op_ptr, op_end, "DW_OP_regx");
@@ -1916,7 +1973,6 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
case DW_OP_GNU_deref_type:
{
int addr_size = (op == DW_OP_deref ? this->m_addr_size : *op_ptr++);
- gdb_byte *buf = (gdb_byte *) alloca (addr_size);
CORE_ADDR addr = fetch_address (0);
struct type *type;
@@ -1931,21 +1987,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
else
type = address_type;
- this->read_mem (buf, addr, addr_size);
-
- /* If the size of the object read from memory is different
- from the type length, we need to zero-extend it. */
- if (type->length () != addr_size)
- {
- ULONGEST datum =
- extract_unsigned_integer (buf, addr_size, byte_order);
-
- buf = (gdb_byte *) alloca (type->length ());
- store_unsigned_integer (buf, type->length (),
- byte_order, datum);
- }
-
- result_val = value_from_contents_and_address (type, buf, addr);
+ result_val = this->deref (addr, addr_size, type);
break;
}
@@ -2274,6 +2316,17 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
if (kind_u.dwarf_reg != -1)
{
op_ptr += len;
+
+ if (trivial_entry_value (this->m_frame))
+ {
+ /* We can assume that DW_OP_entry_value (expr) == expr.
+ Handle as DW_OP_regx. */
+ result_val
+ = value_from_ulongest (address_type, kind_u.dwarf_reg);
+ this->m_location = DWARF_VALUE_REGISTER;
+ break;
+ }
+
this->push_dwarf_reg_entry_value (CALL_SITE_PARAMETER_DWARF_REG,
kind_u,
-1 /* deref_size */);
@@ -2288,6 +2341,17 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
if (deref_size == -1)
deref_size = this->m_addr_size;
op_ptr += len;
+
+ if (trivial_entry_value (this->m_frame))
+ {
+ /* We can assume that DW_OP_entry_value (expr) == expr.
+ Handle as DW_OP_bregx;DW_OP_deref_size. */
+ CORE_ADDR addr
+ = read_addr_from_reg (this->m_frame, kind_u.dwarf_reg);
+ result_val = this->deref (addr, deref_size);
+ break;
+ }
+
this->push_dwarf_reg_entry_value (CALL_SITE_PARAMETER_DWARF_REG,
kind_u, deref_size);
goto no_push;
diff --git a/gdb/dwarf2/expr.h b/gdb/dwarf2/expr.h
index 4ef2e3a..0129fb9 100644
--- a/gdb/dwarf2/expr.h
+++ b/gdb/dwarf2/expr.h
@@ -1,6 +1,6 @@
/* DWARF 2 Expression Evaluator.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
Contributed by Daniel Berlin <dan@dberlin.org>.
@@ -256,6 +256,10 @@ private:
but with the address being 0. In this situation, we arrange for
memory reads to come from the passed-in buffer. */
void read_mem (gdb_byte *buf, CORE_ADDR addr, size_t length);
+
+ /* Deref ADDR with size SIZE and return a value of type TYPE.
+ If TYPE == nullptr, defaults to this->address_type (). */
+ value *deref (CORE_ADDR addr, int size, struct type *type = nullptr);
};
/* Return the value of register number REG (a DWARF register number),
diff --git a/gdb/dwarf2/file-and-dir.h b/gdb/dwarf2/file-and-dir.h
index 6d8cfc9..163479f 100644
--- a/gdb/dwarf2/file-and-dir.h
+++ b/gdb/dwarf2/file-and-dir.h
@@ -1,6 +1,6 @@
/* DWARF file and directory
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
Inc. with support from Florida State University (under contract
diff --git a/gdb/dwarf2/frame-tailcall.c b/gdb/dwarf2/frame-tailcall.c
index 2d7ab74..e31ae10 100644
--- a/gdb/dwarf2/frame-tailcall.c
+++ b/gdb/dwarf2/frame-tailcall.c
@@ -1,6 +1,6 @@
/* Virtual tail call frames unwinder for GDB.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -478,9 +478,7 @@ const struct frame_unwind_legacy dwarf2_tailcall_frame_unwind (
tailcall_frame_prev_arch
);
-void _initialize_tailcall_frame ();
-void
-_initialize_tailcall_frame ()
+INIT_GDB_FILE (tailcall_frame)
{
cache_htab = htab_create_alloc (50, cache_hash, cache_eq, NULL, xcalloc,
xfree);
diff --git a/gdb/dwarf2/frame-tailcall.h b/gdb/dwarf2/frame-tailcall.h
index e830261..b48de22 100644
--- a/gdb/dwarf2/frame-tailcall.h
+++ b/gdb/dwarf2/frame-tailcall.h
@@ -1,6 +1,6 @@
/* Definitions for virtual tail call frames unwinder for GDB.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c
index c290dfb..8d0d59f 100644
--- a/gdb/dwarf2/frame.c
+++ b/gdb/dwarf2/frame.c
@@ -1,6 +1,6 @@
/* Frame unwinder for frames with DWARF Call Frame Information.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
Contributed by Mark Kettenis.
@@ -1619,18 +1619,18 @@ set_comp_unit (struct objfile *objfile, struct comp_unit *unit)
static struct dwarf2_fde *
dwarf2_frame_find_fde (CORE_ADDR *pc, dwarf2_per_objfile **out_per_objfile)
{
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
CORE_ADDR offset;
- if (objfile->obfd == nullptr)
+ if (objfile.obfd == nullptr)
continue;
- comp_unit *unit = find_comp_unit (objfile);
+ comp_unit *unit = find_comp_unit (&objfile);
if (unit == NULL)
{
- dwarf2_build_frame_info (objfile);
- unit = find_comp_unit (objfile);
+ dwarf2_build_frame_info (&objfile);
+ unit = find_comp_unit (&objfile);
}
gdb_assert (unit != NULL);
@@ -1638,8 +1638,8 @@ dwarf2_frame_find_fde (CORE_ADDR *pc, dwarf2_per_objfile **out_per_objfile)
if (fde_table->empty ())
continue;
- gdb_assert (!objfile->section_offsets.empty ());
- offset = objfile->text_section_offset ();
+ gdb_assert (!objfile.section_offsets.empty ());
+ offset = objfile.text_section_offset ();
gdb_assert (!fde_table->empty ());
unrelocated_addr seek_pc = (unrelocated_addr) (*pc - offset);
@@ -1652,7 +1652,7 @@ dwarf2_frame_find_fde (CORE_ADDR *pc, dwarf2_per_objfile **out_per_objfile)
{
*pc = (CORE_ADDR) (*it)->initial_location + offset;
if (out_per_objfile != nullptr)
- *out_per_objfile = get_dwarf2_per_objfile (objfile);
+ *out_per_objfile = get_dwarf2_per_objfile (&objfile);
return *it;
}
@@ -2247,9 +2247,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
set_comp_unit (objfile, unit.release ());
}
-void _initialize_dwarf2_frame ();
-void
-_initialize_dwarf2_frame ()
+INIT_GDB_FILE (dwarf2_frame)
{
#if GDB_SELF_TEST
selftests::register_test_foreach_arch ("execute_cfa_program",
diff --git a/gdb/dwarf2/frame.h b/gdb/dwarf2/frame.h
index 15d89ea..9357cc1 100644
--- a/gdb/dwarf2/frame.h
+++ b/gdb/dwarf2/frame.h
@@ -1,6 +1,6 @@
/* Frame unwinder for frames with DWARF Call Frame Information.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
Contributed by Mark Kettenis.
@@ -198,6 +198,15 @@ struct dwarf2_frame_state
bool armcc_cfa_offsets_reversed = false;
};
+/* If DWARF supoprt was requested, create the real prototype for the
+ append_unwinders function. Otherwise, create a fake inline function.
+
+ There is no need to emit a warning for some of these, because they aren't
+ actively reading DWARF when this is called, they're just initializing GDB.
+
+ These should probably be moved to dwarf2/public.h. */
+#if defined(DWARF_FORMAT_AVAILABLE)
+
/* Set the architecture-specific register state initialization
function for GDBARCH to INIT_REG. */
@@ -287,4 +296,56 @@ extern void *dwarf2_frame_get_fn_data (const frame_info_ptr &this_frame,
void **this_cache,
fn_prev_register cookie);
+#else /* DWARF_FORMAT_AVAILABLE */
+
+static inline void dwarf2_append_unwinders (struct gdbarch *gdbarch) { }
+
+static inline void dwarf2_frame_set_init_reg (
+ gdbarch *gdbarch, void (*init_reg) (struct gdbarch *,int,
+ dwarf2_frame_state_reg *,
+ const frame_info_ptr &)) { }
+
+static inline const struct frame_base *
+ dwarf2_frame_base_sniffer (const frame_info_ptr &this_frame)
+{
+ warning (_("No dwarf support available."));
+ return nullptr;
+}
+
+static inline void dwarf2_frame_set_signal_frame_p
+ (gdbarch *gdbarch, int (*signal_frame_p) (struct gdbarch *,
+ const frame_info_ptr &)) { }
+
+static inline void *dwarf2_frame_get_fn_data (const frame_info_ptr &this_frame,
+ void **this_cache,
+ fn_prev_register cookie)
+{
+ return nullptr;
+}
+
+static inline void *dwarf2_frame_allocate_fn_data
+ (const frame_info_ptr &this_frame, void **this_cache,
+ fn_prev_register cookie, unsigned long size)
+{
+ return nullptr;
+}
+
+static inline int dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
+ struct dwarf2_per_cu_data *data,
+ int *regnum_out, LONGEST *offset_out,
+ CORE_ADDR *text_offset_out,
+ const gdb_byte **cfa_start_out,
+ const gdb_byte **cfa_end_out)
+{
+ return 0;
+}
+
+static inline void
+ dwarf2_frame_set_adjust_regnum (struct gdbarch *gdbarch,
+ int (*adjust_regnum) (struct gdbarch *,
+ int, int))
+{}
+
+#endif /* DWARF_FORMAT_AVAILABLE */
+
#endif /* GDB_DWARF2_FRAME_H */
diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
index 7617bd7..cfe8ce9 100644
--- a/gdb/dwarf2/index-cache.c
+++ b/gdb/dwarf2/index-cache.c
@@ -1,6 +1,6 @@
/* Caching of GDB/DWARF index files.
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -342,9 +342,7 @@ show_index_cache_stats_command (const char *arg, int from_tty)
indent, global_index_cache.n_misses ());
}
-void _initialize_index_cache ();
-void
-_initialize_index_cache ()
+INIT_GDB_FILE (index_cache)
{
/* Set the default index cache directory. */
std::string cache_dir = get_standard_cache_dir ();
diff --git a/gdb/dwarf2/index-cache.h b/gdb/dwarf2/index-cache.h
index 4d9bfd7..19fa6ef 100644
--- a/gdb/dwarf2/index-cache.h
+++ b/gdb/dwarf2/index-cache.h
@@ -1,6 +1,6 @@
/* Caching of GDB/DWARF index files.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/index-common.c b/gdb/dwarf2/index-common.c
index 08b2f37..a314ce7 100644
--- a/gdb/dwarf2/index-common.c
+++ b/gdb/dwarf2/index-common.c
@@ -1,6 +1,6 @@
/* Things needed for both reading and writing DWARF indices.
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -31,7 +31,7 @@ mapped_index_string_hash (int index_version, const void *p)
while ((c = *str++) != 0)
{
if (index_version >= 5)
- c = tolower (c);
+ c = c_tolower (c);
r = r * 67 + c - 113;
}
@@ -45,12 +45,12 @@ dwarf5_djb_hash (const char *str_)
{
const unsigned char *str = (const unsigned char *) str_;
- /* Note: tolower here ignores UTF-8, which isn't fully compliant.
+ /* Note: c_tolower here ignores UTF-8, which isn't fully compliant.
See http://dwarfstd.org/ShowIssue.php?issue=161027.1. */
uint32_t hash = 5381;
while (int c = *str++)
- hash = hash * 33 + tolower (c);
+ hash = hash * 33 + c_tolower (c);
return hash;
}
@@ -59,11 +59,11 @@ dwarf5_djb_hash (const char *str_)
uint32_t
dwarf5_djb_hash (std::string_view str)
{
- /* Note: tolower here ignores UTF-8, which isn't fully compliant.
+ /* Note: c_tolower here ignores UTF-8, which isn't fully compliant.
See http://dwarfstd.org/ShowIssue.php?issue=161027.1. */
uint32_t hash = 5381;
for (char c : str)
- hash = hash * 33 + tolower (c & 0xff);
+ hash = hash * 33 + c_tolower (c & 0xff);
return hash;
}
diff --git a/gdb/dwarf2/index-common.h b/gdb/dwarf2/index-common.h
index ca37721..ae060d8 100644
--- a/gdb/dwarf2/index-common.h
+++ b/gdb/dwarf2/index-common.h
@@ -1,6 +1,6 @@
/* Things needed for both reading and writing DWARF indices.
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
index da1f6cd..52131be 100644
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -1,6 +1,6 @@
/* DWARF index writing support for GDB.
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -55,7 +55,7 @@
#define DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE(cu_index, value) \
do { \
gdb_assert ((value) >= GDB_INDEX_SYMBOL_KIND_TYPE \
- && (value) <= GDB_INDEX_SYMBOL_KIND_OTHER); \
+ && (value) <= GDB_INDEX_SYMBOL_KIND_UNUSED5); \
GDB_INDEX_SYMBOL_KIND_SET_VALUE((cu_index), (value)); \
} while (0)
@@ -422,10 +422,47 @@ symtab_index_entry::minimize ()
if (name == nullptr || cu_indices.empty ())
return;
- std::sort (cu_indices.begin (), cu_indices.end ());
+ /* We sort the indexes in a funny way: GDB_INDEX_SYMBOL_KIND_UNUSED5
+ is always sorted last; then otherwise we sort by numeric value.
+ This ensures that we prefer the definition when both a definition
+ and a declaration (stub type) are seen. */
+ std::sort (cu_indices.begin (), cu_indices.end (),
+ [] (offset_type vala, offset_type valb)
+ {
+ auto kinda = GDB_INDEX_SYMBOL_KIND_VALUE (vala);
+ auto kindb = GDB_INDEX_SYMBOL_KIND_VALUE (valb);
+ if (kinda != kindb)
+ {
+ /* Declaration sorts last. */
+ if (kinda == GDB_INDEX_SYMBOL_KIND_UNUSED5)
+ return false;
+ if (kindb == GDB_INDEX_SYMBOL_KIND_UNUSED5)
+ return true;
+ }
+ return vala < valb;
+ });
auto from = std::unique (cu_indices.begin (), cu_indices.end ());
cu_indices.erase (from, cu_indices.end ());
+ /* Rewrite GDB_INDEX_SYMBOL_KIND_UNUSED5. This ensures that a type
+ declaration will be deleted by the subsequent squashing step, if
+ warranted. */
+ for (auto &val : cu_indices)
+ {
+ gdb_index_symbol_kind kind = GDB_INDEX_SYMBOL_KIND_VALUE (val);
+ if (kind != GDB_INDEX_SYMBOL_KIND_UNUSED5)
+ continue;
+
+ offset_type newval = 0;
+ DW2_GDB_INDEX_CU_SET_VALUE (newval, GDB_INDEX_CU_VALUE (val));
+ DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE
+ (newval, GDB_INDEX_SYMBOL_STATIC_VALUE (val));
+ DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE (newval,
+ GDB_INDEX_SYMBOL_KIND_TYPE);
+
+ val = newval;
+ }
+
/* We don't want to enter a type more than once, so
remove any such duplicates from the list as well. When doing
this, we want to keep the entry from the first CU -- but this is
@@ -720,7 +757,7 @@ public:
});
m_name_table_string_offs.push_back_reorder
- (m_debugstrlookup.lookup (name.c_str ())); /* ??? */
+ (m_debugstrlookup.lookup (name.c_str ()));
m_name_table_entry_offs.push_back_reorder (m_entry_pool.size ());
for (const cooked_index_entry *entry : these_entries)
@@ -872,7 +909,7 @@ public:
m_debugstrlookup.file_write (file_str);
}
- void add_cu (dwarf2_per_cu *per_cu, offset_type index)
+ void add_cu (const dwarf2_per_cu *per_cu, offset_type index)
{
m_cu_index_htab.emplace (per_cu, index);
}
@@ -885,10 +922,21 @@ private:
{
public:
- /* Object constructor to be called for current DWARF2_PER_BFD. */
- debug_str_lookup (dwarf2_per_bfd *per_bfd)
+ /* Object constructor to be called for current DWARF2_PER_BFD.
+ All .debug_str section strings are automatically stored. */
+ explicit debug_str_lookup (dwarf2_per_bfd *per_bfd)
: m_per_bfd (per_bfd)
{
+ gdb_assert (per_bfd->str.readin);
+ const gdb_byte *data = per_bfd->str.buffer;
+ if (data == nullptr)
+ return;
+ while (data < per_bfd->str.buffer + per_bfd->str.size)
+ {
+ const char *const s = reinterpret_cast<const char *> (data);
+ m_str_table.emplace (c_str_view (s), data - per_bfd->str.buffer);
+ data += strlen (s) + 1;
+ }
}
/* Return offset of symbol name S in the .debug_str section. Add
@@ -896,13 +944,6 @@ private:
yet. */
size_t lookup (const char *s)
{
- /* Most strings will have come from the string table
- already. */
- const gdb_byte *b = (const gdb_byte *) s;
- if (b >= m_per_bfd->str.buffer
- && b < m_per_bfd->str.buffer + m_per_bfd->str.size)
- return b - m_per_bfd->str.buffer;
-
const auto it = m_str_table.find (c_str_view (s));
if (it != m_str_table.end ())
return it->second;
@@ -1212,6 +1253,21 @@ write_cooked_index (cooked_index *table,
const cu_index_map &cu_index_htab,
struct mapped_symtab *symtab)
{
+ gdb::unordered_set<const cooked_index_entry *> required_decl_entries;
+ for (const cooked_index_entry *entry : table->all_entries ())
+ {
+ /* Any type declaration that is used as a (non-trivial) parent
+ entry must be written out. */
+ if ((entry->flags & IS_TYPE_DECLARATION) == 0)
+ {
+ for (const cooked_index_entry *parent = entry->get_parent ();
+ parent != nullptr;
+ parent = parent->get_parent ())
+ if ((parent->flags & IS_TYPE_DECLARATION) != 0)
+ required_decl_entries.insert (parent);
+ }
+ }
+
for (const cooked_index_entry *entry : table->all_entries ())
{
const auto it = cu_index_htab.find (entry->per_cu);
@@ -1237,11 +1293,10 @@ write_cooked_index (cooked_index *table,
be redundant are rare and not worth supporting. */
continue;
}
- else if ((entry->flags & IS_TYPE_DECLARATION) != 0)
- {
- /* Don't add type declarations to the index. */
- continue;
- }
+ /* Don't add most type declarations to the index. */
+ else if ((entry->flags & IS_TYPE_DECLARATION) != 0
+ && !required_decl_entries.contains (entry))
+ continue;
gdb_index_symbol_kind kind;
if (entry->tag == DW_TAG_subprogram
@@ -1252,7 +1307,16 @@ write_cooked_index (cooked_index *table,
|| entry->tag == DW_TAG_enumerator)
kind = GDB_INDEX_SYMBOL_KIND_VARIABLE;
else if (tag_is_type (entry->tag))
- kind = GDB_INDEX_SYMBOL_KIND_TYPE;
+ {
+ /* If we added a type declaration, we want to note this
+ fact for later, because we don't want a type declaration
+ to cause the real definition to be omitted from the
+ index. GDB_INDEX_SYMBOL_KIND_UNUSED5 is used here, but
+ rewritten later before the index is written. */
+ kind = ((entry->flags & IS_TYPE_DECLARATION) == 0
+ ? GDB_INDEX_SYMBOL_KIND_TYPE
+ : GDB_INDEX_SYMBOL_KIND_UNUSED5);
+ }
else
kind = GDB_INDEX_SYMBOL_KIND_OTHER;
@@ -1289,6 +1353,40 @@ write_shortcuts_table (cooked_index *table, data_buf &shortcuts,
shortcuts.append_offset (main_name_offset);
}
+/* Get sorted (by section offset) lists of comp units and type units. */
+
+static std::pair<std::vector<const dwarf2_per_cu *>,
+ std::vector<const signatured_type *>>
+get_unit_lists (const dwarf2_per_bfd &per_bfd)
+{
+ std::vector<const dwarf2_per_cu *> comp_units;
+ std::vector<const signatured_type *> type_units;
+
+ for (const auto &unit : per_bfd.all_units)
+ if (unit->is_debug_types)
+ type_units.emplace_back (static_cast<const signatured_type *>
+ (unit.get ()));
+ else
+ comp_units.emplace_back (unit.get ());
+
+ auto by_sect_off = [] (const dwarf2_per_cu *lhs, const dwarf2_per_cu *rhs)
+ { return lhs->sect_off < rhs->sect_off; };
+
+ /* Sort both lists, even though it is technically not always required:
+
+ - while .gdb_index requires the CU list to be sorted, DWARF 5 doesn't
+ say anything about the order of CUs in .debug_names.
+ - .gdb_index doesn't require the TU list to be sorted, and DWARF 5
+ doesn't say anything about the order of TUs in .debug_names.
+
+ However, it helps make sure that GDB produce a stable and predictable
+ output, which is nice. */
+ std::sort (comp_units.begin (), comp_units.end (), by_sect_off);
+ std::sort (type_units.begin (), type_units.end (), by_sect_off);
+
+ return {std::move (comp_units), std::move (type_units)};
+}
+
/* Write contents of a .gdb_index section for OBJFILE into OUT_FILE.
If OBJFILE has an associated dwz file, write contents of a .gdb_index
section for that dwz file into DWZ_OUT_FILE. If OBJFILE does not have an
@@ -1299,8 +1397,6 @@ write_gdbindex (dwarf2_per_bfd *per_bfd, cooked_index *table,
FILE *out_file, FILE *dwz_out_file)
{
mapped_symtab symtab;
- data_buf objfile_cu_list;
- data_buf dwz_cu_list;
/* While we're scanning CU's create a table that maps a dwarf2_per_cu (which
is what addrmap records) to its index (which is what is recorded in the
@@ -1308,40 +1404,44 @@ write_gdbindex (dwarf2_per_bfd *per_bfd, cooked_index *table,
cu_index_map cu_index_htab;
cu_index_htab.reserve (per_bfd->all_units.size ());
- /* Store out the .debug_type CUs, if any. */
- data_buf types_cu_list;
+ auto [comp_units, type_units] = get_unit_lists (*per_bfd);
+ int counter = 0;
- /* The CU list is already sorted, so we don't need to do additional
- work here. */
+ /* Write comp units. */
+ data_buf objfile_cu_list;
+ data_buf dwz_cu_list;
- int counter = 0;
- for (const dwarf2_per_cu_up &per_cu : per_bfd->all_units)
+ for (const dwarf2_per_cu *per_cu : comp_units)
{
- const auto insertpair = cu_index_htab.emplace (per_cu.get (), counter);
+ const auto insertpair = cu_index_htab.emplace (per_cu, counter);
gdb_assert (insertpair.second);
- /* See enhancement PR symtab/30838. */
- gdb_assert (!(per_cu->is_dwz && per_cu->is_debug_types));
-
/* The all_units list contains CUs read from the objfile as well as
from the eventual dwz file. We need to place the entry in the
corresponding index. */
- data_buf &cu_list = (per_cu->is_debug_types
- ? types_cu_list
- : per_cu->is_dwz ? dwz_cu_list : objfile_cu_list);
+ data_buf &cu_list = per_cu->is_dwz ? dwz_cu_list : objfile_cu_list;
cu_list.append_uint (8, BFD_ENDIAN_LITTLE,
to_underlying (per_cu->sect_off));
- if (per_cu->is_debug_types)
- {
- signatured_type *sig_type = (signatured_type *) per_cu.get ();
- cu_list.append_uint (8, BFD_ENDIAN_LITTLE,
- to_underlying (sig_type->type_offset_in_tu));
- cu_list.append_uint (8, BFD_ENDIAN_LITTLE,
- sig_type->signature);
- }
- else
- cu_list.append_uint (8, BFD_ENDIAN_LITTLE, per_cu->length ());
+ cu_list.append_uint (8, BFD_ENDIAN_LITTLE, per_cu->length ());
+ ++counter;
+ }
+
+ /* Write type units. */
+ data_buf types_cu_list;
+
+ for (const signatured_type *sig_type : type_units)
+ {
+ const auto insertpair = cu_index_htab.emplace (sig_type, counter);
+ gdb_assert (insertpair.second);
+ /* See enhancement PR symtab/30838. */
+ gdb_assert (!sig_type->is_dwz);
+
+ types_cu_list.append_uint (8, BFD_ENDIAN_LITTLE,
+ to_underlying (sig_type->sect_off));
+ types_cu_list.append_uint (8, BFD_ENDIAN_LITTLE,
+ to_underlying (sig_type->type_offset_in_tu));
+ types_cu_list.append_uint (8, BFD_ENDIAN_LITTLE, sig_type->signature);
++counter;
}
@@ -1388,29 +1488,35 @@ write_debug_names (dwarf2_per_bfd *per_bfd, cooked_index *table,
const enum bfd_endian dwarf5_byte_order
= bfd_big_endian (per_bfd->obfd) ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
- /* The CU list is already sorted, so we don't need to do additional
- work here. Also, the debug_types entries do not appear in
- all_units, but only in their own hash table. */
- data_buf cu_list;
- data_buf types_cu_list;
+ auto [comp_units, type_units] = get_unit_lists (*per_bfd);
debug_names nametable (per_bfd, dwarf5_is_dwarf64, dwarf5_byte_order);
- int counter = 0;
- int types_counter = 0;
- for (const dwarf2_per_cu_up &per_cu : per_bfd->all_units)
+ data_buf comp_unit_list;
+ int comp_unit_counter = 0;
+
+ for (const auto per_cu : comp_units)
+ {
+ nametable.add_cu (per_cu, comp_unit_counter);
+ comp_unit_list.append_uint (nametable.dwarf5_offset_size (),
+ dwarf5_byte_order,
+ to_underlying (per_cu->sect_off));
+ comp_unit_counter++;
+ }
+
+ data_buf type_unit_list;
+ int type_unit_counter = 0;
+
+ for (const auto per_cu : type_units)
{
- int &this_counter = per_cu->is_debug_types ? types_counter : counter;
- data_buf &this_list = per_cu->is_debug_types ? types_cu_list : cu_list;
-
- nametable.add_cu (per_cu.get (), this_counter);
- this_list.append_uint (nametable.dwarf5_offset_size (),
- dwarf5_byte_order,
- to_underlying (per_cu->sect_off));
- ++this_counter;
+ nametable.add_cu (per_cu, type_unit_counter);
+ type_unit_list.append_uint (nametable.dwarf5_offset_size (),
+ dwarf5_byte_order,
+ to_underlying (per_cu->sect_off));
+ type_unit_counter++;
}
/* Verify that all units are represented. */
- gdb_assert (counter == per_bfd->all_comp_units.size ());
- gdb_assert (types_counter == per_bfd->all_type_units.size ());
+ gdb_assert (comp_unit_counter == per_bfd->num_comp_units);
+ gdb_assert (type_unit_counter == per_bfd->num_type_units);
for (const cooked_index_entry *entry : table->all_entries ())
nametable.insert (entry);
@@ -1425,8 +1531,8 @@ write_debug_names (dwarf2_per_bfd *per_bfd, cooked_index *table,
+ sizeof (dwarf5_augmentation_3));
size_t expected_bytes = 0;
expected_bytes += bytes_of_header;
- expected_bytes += cu_list.size ();
- expected_bytes += types_cu_list.size ();
+ expected_bytes += comp_unit_list.size ();
+ expected_bytes += type_unit_list.size ();
expected_bytes += nametable.bytes ();
data_buf header;
@@ -1449,11 +1555,11 @@ write_debug_names (dwarf2_per_bfd *per_bfd, cooked_index *table,
header.append_uint (2, dwarf5_byte_order, 0);
/* comp_unit_count - The number of CUs in the CU list. */
- header.append_uint (4, dwarf5_byte_order, counter);
+ header.append_uint (4, dwarf5_byte_order, comp_unit_counter);
/* local_type_unit_count - The number of TUs in the local TU
list. */
- header.append_uint (4, dwarf5_byte_order, types_counter);
+ header.append_uint (4, dwarf5_byte_order, type_unit_counter);
/* foreign_type_unit_count - The number of TUs in the foreign TU
list. */
@@ -1481,8 +1587,8 @@ write_debug_names (dwarf2_per_bfd *per_bfd, cooked_index *table,
gdb_assert (header.size () == bytes_of_header);
header.file_write (out_file);
- cu_list.file_write (out_file);
- types_cu_list.file_write (out_file);
+ comp_unit_list.file_write (out_file);
+ type_unit_list.file_write (out_file);
nametable.file_write (out_file, out_file_str);
assert_file_size (out_file, expected_bytes);
@@ -1661,19 +1767,19 @@ save_gdb_index_command (const char *args, int from_tty)
dw_index_kind index_kind
= (opts.dwarf_5 ? dw_index_kind::DEBUG_NAMES : dw_index_kind::GDB_INDEX);
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
/* If the objfile does not correspond to an actual file, skip it. */
- if ((objfile->flags & OBJF_NOT_FILENAME) != 0)
+ if ((objfile.flags & OBJF_NOT_FILENAME) != 0)
continue;
- dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
+ dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (&objfile);
if (per_objfile != NULL)
{
try
{
- const char *basename = lbasename (objfile_name (objfile));
+ const char *basename = lbasename (objfile_name (&objfile));
const dwz_file *dwz = per_objfile->per_bfd->get_dwz_file ();
const char *dwz_basename = NULL;
@@ -1687,7 +1793,7 @@ save_gdb_index_command (const char *args, int from_tty)
{
exception_fprintf (gdb_stderr, except,
_("Error while writing index for `%s': "),
- objfile_name (objfile));
+ objfile_name (&objfile));
}
}
@@ -1768,9 +1874,7 @@ gdb_index ()
} /* selftests namespace. */
#endif
-void _initialize_dwarf_index_write ();
-void
-_initialize_dwarf_index_write ()
+INIT_GDB_FILE (dwarf_index_write)
{
#if GDB_SELF_TEST
selftests::register_test ("gdb_index", selftests::gdb_index);
diff --git a/gdb/dwarf2/index-write.h b/gdb/dwarf2/index-write.h
index 1982e85..e4ac812 100644
--- a/gdb/dwarf2/index-write.h
+++ b/gdb/dwarf2/index-write.h
@@ -1,6 +1,6 @@
/* DWARF index writing support for GDB.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/leb.c b/gdb/dwarf2/leb.c
index 1b7202e..4ccee5a 100644
--- a/gdb/dwarf2/leb.c
+++ b/gdb/dwarf2/leb.c
@@ -1,6 +1,6 @@
/* Low-level DWARF 2 reading code
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
Inc. with support from Florida State University (under contract
diff --git a/gdb/dwarf2/leb.h b/gdb/dwarf2/leb.h
index 36582b4..4c1ac4b 100644
--- a/gdb/dwarf2/leb.h
+++ b/gdb/dwarf2/leb.h
@@ -1,6 +1,6 @@
/* Low-level DWARF 2 reading code
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
Inc. with support from Florida State University (under contract
diff --git a/gdb/dwarf2/line-header.c b/gdb/dwarf2/line-header.c
index eddb2ef..4652306 100644
--- a/gdb/dwarf2/line-header.c
+++ b/gdb/dwarf2/line-header.c
@@ -1,6 +1,6 @@
/* DWARF 2 debugging format support for GDB.
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "dwarf2/comp-unit-head.h"
+#include "dwarf2/unit-head.h"
#include "dwarf2/leb.h"
#include "dwarf2/line-header.h"
#include "dwarf2/read.h"
@@ -95,7 +95,7 @@ dwarf2_statement_list_fits_in_line_number_section_complaint (void)
static LONGEST
read_checked_initial_length_and_offset (bfd *abfd, const gdb_byte *buf,
- const struct comp_unit_head *cu_header,
+ const struct unit_head *cu_header,
unsigned int *bytes_read,
unsigned int *offset_size)
{
@@ -253,11 +253,10 @@ read_formatted_entries (dwarf2_per_objfile *per_objfile, bfd *abfd,
/* See line-header.h. */
line_header_up
-dwarf_decode_line_header (sect_offset sect_off, bool is_dwz,
- dwarf2_per_objfile *per_objfile,
- struct dwarf2_section_info *section,
- const struct comp_unit_head *cu_header,
- const char *comp_dir)
+dwarf_decode_line_header (sect_offset sect_off, bool is_dwz,
+ dwarf2_per_objfile *per_objfile,
+ struct dwarf2_section_info *section,
+ const unit_head *cu_header, const char *comp_dir)
{
const gdb_byte *line_ptr;
unsigned int bytes_read, offset_size;
diff --git a/gdb/dwarf2/line-header.h b/gdb/dwarf2/line-header.h
index d08ab55..e6f9ea9 100644
--- a/gdb/dwarf2/line-header.h
+++ b/gdb/dwarf2/line-header.h
@@ -1,6 +1,6 @@
/* DWARF 2 debugging format support for GDB.
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -218,7 +218,7 @@ file_entry::include_dir (const line_header *lh) const
extern line_header_up dwarf_decode_line_header
(sect_offset sect_off, bool is_dwz, dwarf2_per_objfile *per_objfile,
- struct dwarf2_section_info *section, const struct comp_unit_head *cu_header,
+ struct dwarf2_section_info *section, const struct unit_head *cu_header,
const char *comp_dir);
#endif /* GDB_DWARF2_LINE_HEADER_H */
diff --git a/gdb/dwarf2/line-program.c b/gdb/dwarf2/line-program.c
new file mode 100644
index 0000000..c30f70d
--- /dev/null
+++ b/gdb/dwarf2/line-program.c
@@ -0,0 +1,720 @@
+/* DWARF 2 debugging format support for GDB.
+
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "dwarf2/line-program.h"
+#include "dwarf2/cu.h"
+#include "dwarf2/line-header.h"
+#include "dwarf2/read.h"
+#include "buildsym.h"
+#include "complaints.h"
+#include "filenames.h"
+#include "gdbarch.h"
+
+static void
+dwarf2_debug_line_missing_file_complaint ()
+{
+ complaint (_(".debug_line section has line data without a file"));
+}
+
+static void
+dwarf2_debug_line_missing_end_sequence_complaint ()
+{
+ complaint (_(".debug_line section has line "
+ "program sequence without an end"));
+}
+
+/* State machine to track the state of the line number program. */
+
+class lnp_state_machine
+{
+public:
+ /* Initialize a machine state for the start of a line number
+ program. */
+ lnp_state_machine (struct dwarf2_cu *cu, gdbarch *arch, line_header *lh);
+
+ file_entry *current_file ()
+ {
+ /* lh->file_names is 0-based, but the file name numbers in the
+ statement program are 1-based. */
+ return m_line_header->file_name_at (m_file);
+ }
+
+ /* Record the line in the state machine. END_SEQUENCE is true if
+ we're processing the end of a sequence. */
+ void record_line (bool end_sequence);
+
+ /* Check ADDRESS is -1, -2, or zero and less than UNRELOCATED_LOWPC, and if
+ true nop-out rest of the lines in this sequence. */
+ void check_line_address (struct dwarf2_cu *cu,
+ const gdb_byte *line_ptr,
+ unrelocated_addr unrelocated_lowpc,
+ unrelocated_addr address);
+
+ void handle_set_discriminator (unsigned int discriminator)
+ {
+ m_discriminator = discriminator;
+ m_line_has_non_zero_discriminator |= discriminator != 0;
+ }
+
+ /* Handle DW_LNE_set_address. */
+ void handle_set_address (unrelocated_addr address)
+ {
+ m_op_index = 0;
+ m_address
+ = (unrelocated_addr) gdbarch_adjust_dwarf2_line (m_gdbarch,
+ (CORE_ADDR) address,
+ false);
+ }
+
+ /* Handle DW_LNS_advance_pc. */
+ void handle_advance_pc (CORE_ADDR adjust);
+
+ /* Handle a special opcode. */
+ void handle_special_opcode (unsigned char op_code);
+
+ /* Handle DW_LNS_advance_line. */
+ void handle_advance_line (int line_delta)
+ {
+ advance_line (line_delta);
+ }
+
+ /* Handle DW_LNS_set_file. */
+ void handle_set_file (file_name_index file);
+
+ /* Handle DW_LNS_negate_stmt. */
+ void handle_negate_stmt ()
+ {
+ m_flags ^= LEF_IS_STMT;
+ }
+
+ /* Handle DW_LNS_const_add_pc. */
+ void handle_const_add_pc ();
+
+ /* Handle DW_LNS_fixed_advance_pc. */
+ void handle_fixed_advance_pc (CORE_ADDR addr_adj)
+ {
+ addr_adj = gdbarch_adjust_dwarf2_line (m_gdbarch, addr_adj, true);
+ m_address = (unrelocated_addr) ((CORE_ADDR) m_address + addr_adj);
+ m_op_index = 0;
+ }
+
+ /* Handle DW_LNS_copy. */
+ void handle_copy ()
+ {
+ record_line (false);
+ m_discriminator = 0;
+ m_flags &= ~LEF_PROLOGUE_END;
+ m_flags &= ~LEF_EPILOGUE_BEGIN;
+ }
+
+ /* Handle DW_LNE_end_sequence. */
+ void handle_end_sequence ()
+ {
+ m_currently_recording_lines = true;
+ }
+
+ /* Handle DW_LNS_set_prologue_end. */
+ void handle_set_prologue_end ()
+ {
+ m_flags |= LEF_PROLOGUE_END;
+ }
+
+ void handle_set_epilogue_begin ()
+ {
+ m_flags |= LEF_EPILOGUE_BEGIN;
+ }
+
+private:
+ /* Advance the line by LINE_DELTA. */
+ void advance_line (int line_delta)
+ {
+ m_line += line_delta;
+
+ if (line_delta != 0)
+ m_line_has_non_zero_discriminator = m_discriminator != 0;
+ }
+
+ bool record_line_p ();
+ void finish_line ();
+ void record_line_1 (unsigned int line, linetable_entry_flags flags);
+
+ struct dwarf2_cu *m_cu;
+
+ /* The builder associated with the CU. */
+ buildsym_compunit *m_builder;
+
+ gdbarch *m_gdbarch;
+
+ /* The line number header. */
+ line_header *m_line_header;
+
+ /* These are part of the standard DWARF line number state machine,
+ and initialized according to the DWARF spec. */
+
+ unsigned char m_op_index = 0;
+ /* The line table index of the current file. */
+ file_name_index m_file = 1;
+ unsigned int m_line = 1;
+
+ /* These are initialized in the constructor. */
+
+ unrelocated_addr m_address;
+ linetable_entry_flags m_flags;
+ unsigned int m_discriminator = 0;
+
+ /* Additional bits of state we need to track. */
+
+ /* The last file a line number was recorded for. */
+ struct subfile *m_last_subfile = NULL;
+
+ /* The address of the last line entry. */
+ unrelocated_addr m_last_address;
+
+ /* Set to true when a previous line at the same address (using
+ m_last_address) had LEF_IS_STMT set in m_flags. This is reset to false
+ when a line entry at a new address (m_address different to
+ m_last_address) is processed. */
+ bool m_stmt_at_address = false;
+
+ /* When true, record the lines we decode. */
+ bool m_currently_recording_lines = true;
+
+ /* The last line number that was recorded, used to coalesce
+ consecutive entries for the same line. This can happen, for
+ example, when discriminators are present. PR 17276. */
+ unsigned int m_last_line = 0;
+ bool m_line_has_non_zero_discriminator = false;
+};
+
+void
+lnp_state_machine::handle_advance_pc (CORE_ADDR adjust)
+{
+ CORE_ADDR addr_adj = (((m_op_index + adjust)
+ / m_line_header->maximum_ops_per_instruction)
+ * m_line_header->minimum_instruction_length);
+ addr_adj = gdbarch_adjust_dwarf2_line (m_gdbarch, addr_adj, true);
+ m_address = (unrelocated_addr) ((CORE_ADDR) m_address + addr_adj);
+ m_op_index = ((m_op_index + adjust)
+ % m_line_header->maximum_ops_per_instruction);
+}
+
+void
+lnp_state_machine::handle_special_opcode (unsigned char op_code)
+{
+ unsigned char adj_opcode = op_code - m_line_header->opcode_base;
+ unsigned char adj_opcode_d = adj_opcode / m_line_header->line_range;
+ unsigned char adj_opcode_r = adj_opcode % m_line_header->line_range;
+ CORE_ADDR addr_adj = (((m_op_index + adj_opcode_d)
+ / m_line_header->maximum_ops_per_instruction)
+ * m_line_header->minimum_instruction_length);
+ addr_adj = gdbarch_adjust_dwarf2_line (m_gdbarch, addr_adj, true);
+ m_address = (unrelocated_addr) ((CORE_ADDR) m_address + addr_adj);
+ m_op_index = ((m_op_index + adj_opcode_d)
+ % m_line_header->maximum_ops_per_instruction);
+
+ int line_delta = m_line_header->line_base + adj_opcode_r;
+ advance_line (line_delta);
+ record_line (false);
+ m_discriminator = 0;
+ m_flags &= ~LEF_PROLOGUE_END;
+ m_flags &= ~LEF_EPILOGUE_BEGIN;
+}
+
+void
+lnp_state_machine::handle_set_file (file_name_index file)
+{
+ m_file = file;
+
+ const file_entry *fe = current_file ();
+ if (fe == NULL)
+ dwarf2_debug_line_missing_file_complaint ();
+ else
+ {
+ m_line_has_non_zero_discriminator = m_discriminator != 0;
+ dwarf2_start_subfile (m_cu, *fe, *m_line_header);
+ }
+}
+
+void
+lnp_state_machine::handle_const_add_pc ()
+{
+ CORE_ADDR adjust
+ = (255 - m_line_header->opcode_base) / m_line_header->line_range;
+
+ CORE_ADDR addr_adj
+ = (((m_op_index + adjust)
+ / m_line_header->maximum_ops_per_instruction)
+ * m_line_header->minimum_instruction_length);
+
+ addr_adj = gdbarch_adjust_dwarf2_line (m_gdbarch, addr_adj, true);
+ m_address = (unrelocated_addr) ((CORE_ADDR) m_address + addr_adj);
+ m_op_index = ((m_op_index + adjust)
+ % m_line_header->maximum_ops_per_instruction);
+}
+
+/* Return true if we should add LINE to the line number table.
+ LINE is the line to add, LAST_LINE is the last line that was added,
+ LAST_SUBFILE is the subfile for LAST_LINE.
+ LINE_HAS_NON_ZERO_DISCRIMINATOR is non-zero if LINE has ever
+ had a non-zero discriminator.
+
+ We have to be careful in the presence of discriminators.
+ E.g., for this line:
+
+ for (i = 0; i < 100000; i++);
+
+ clang can emit four line number entries for that one line,
+ each with a different discriminator.
+ See gdb.dwarf2/dw2-single-line-discriminators.exp for an example.
+
+ However, we want gdb to coalesce all four entries into one.
+ Otherwise the user could stepi into the middle of the line and
+ gdb would get confused about whether the pc really was in the
+ middle of the line.
+
+ Things are further complicated by the fact that two consecutive
+ line number entries for the same line is a heuristic used by gcc
+ to denote the end of the prologue. So we can't just discard duplicate
+ entries, we have to be selective about it. The heuristic we use is
+ that we only collapse consecutive entries for the same line if at least
+ one of those entries has a non-zero discriminator. PR 17276.
+
+ Note: Addresses in the line number state machine can never go backwards
+ within one sequence, thus this coalescing is ok. */
+
+bool
+lnp_state_machine::record_line_p ()
+{
+ if (m_builder->get_current_subfile () != m_last_subfile)
+ return true;
+ if (m_line != m_last_line)
+ return true;
+ /* Same line for the same file that we've seen already.
+ As a last check, for pr 17276, only record the line if the line
+ has never had a non-zero discriminator. */
+ if (!m_line_has_non_zero_discriminator)
+ return true;
+ return false;
+}
+
+/* Use the CU's builder to record line number LINE with the given
+ flags. */
+
+void
+lnp_state_machine::record_line_1 (unsigned int line,
+ linetable_entry_flags flags)
+{
+ if (m_currently_recording_lines)
+ {
+ unrelocated_addr addr
+ = unrelocated_addr (gdbarch_addr_bits_remove (m_gdbarch,
+ (CORE_ADDR) m_address));
+
+ if (dwarf_line_debug)
+ gdb_printf (gdb_stdlog, "Recording line %u, file %s, address %s\n",
+ m_line, lbasename (m_last_subfile->name.c_str ()),
+ paddress (m_gdbarch, (CORE_ADDR) addr));
+
+ m_builder->record_line (m_last_subfile, line, addr, flags);
+ }
+}
+
+/* Subroutine of dwarf_decode_lines_1 to simplify it.
+ Mark the end of a set of line number records. */
+
+void
+lnp_state_machine::finish_line ()
+{
+ if (m_last_subfile == nullptr)
+ return;
+
+ if (dwarf_line_debug)
+ {
+ gdb_printf (gdb_stdlog,
+ "Finishing current line, file %s, address %s\n",
+ lbasename (m_last_subfile->name.c_str ()),
+ paddress (m_gdbarch, (CORE_ADDR) m_address));
+ }
+
+ record_line_1 (0, LEF_IS_STMT);
+}
+
+void
+lnp_state_machine::record_line (bool end_sequence)
+{
+ if (dwarf_line_debug)
+ {
+ gdb_printf (gdb_stdlog,
+ "Processing actual line %u: file %u,"
+ " address %s, is_stmt %u, prologue_end %u,"
+ " epilogue_begin %u, discrim %u%s\n",
+ m_line, m_file,
+ paddress (m_gdbarch, (CORE_ADDR) m_address),
+ (m_flags & LEF_IS_STMT) != 0,
+ (m_flags & LEF_PROLOGUE_END) != 0,
+ (m_flags & LEF_EPILOGUE_BEGIN) != 0,
+ m_discriminator,
+ (end_sequence ? "\t(end sequence)" : ""));
+ }
+
+ file_entry *fe = current_file ();
+
+ if (fe == NULL)
+ dwarf2_debug_line_missing_file_complaint ();
+ /* For now we ignore lines not starting on an instruction boundary.
+ But not when processing end_sequence for compatibility with the
+ previous version of the code. */
+ else if (m_op_index == 0 || end_sequence)
+ {
+ /* When we switch files we insert an end maker in the first file,
+ switch to the second file and add a new line entry. The
+ problem is that the end marker inserted in the first file will
+ discard any previous line entries at the same address. If the
+ line entries in the first file are marked as is-stmt, while
+ the new line in the second file is non-stmt, then this means
+ the end marker will discard is-stmt lines so we can have a
+ non-stmt line. This means that there are less addresses at
+ which the user can insert a breakpoint.
+
+ To improve this we track the last address in m_last_address,
+ and whether we have seen an is-stmt at this address. Then
+ when switching files, if we have seen a stmt at the current
+ address, and we are switching to create a non-stmt line, then
+ discard the new line. */
+ bool file_changed = m_last_subfile != m_builder->get_current_subfile ();
+ bool ignore_this_line
+ = ((file_changed && !end_sequence && m_last_address == m_address
+ && ((m_flags & LEF_IS_STMT) == 0)
+ && m_stmt_at_address)
+ || (!end_sequence && m_line == 0));
+
+ if ((file_changed && !ignore_this_line) || end_sequence)
+ finish_line ();
+
+ if (!end_sequence && !ignore_this_line)
+ {
+ linetable_entry_flags lte_flags = m_flags;
+ if (m_cu->producer_is_codewarrior ())
+ lte_flags |= LEF_IS_STMT;
+
+ if (record_line_p ())
+ {
+ m_last_subfile = m_builder->get_current_subfile ();
+ record_line_1 (m_line, lte_flags);
+ m_last_line = m_line;
+ }
+ }
+ }
+
+ /* Track whether we have seen any IS_STMT true at m_address in case we
+ have multiple line table entries all at m_address. */
+ if (m_last_address != m_address)
+ {
+ m_stmt_at_address = false;
+ m_last_address = m_address;
+ }
+ m_stmt_at_address |= (m_flags & LEF_IS_STMT) != 0;
+}
+
+lnp_state_machine::lnp_state_machine (struct dwarf2_cu *cu, gdbarch *arch,
+ line_header *lh)
+ : m_cu (cu),
+ m_builder (cu->get_builder ()),
+ m_gdbarch (arch),
+ m_line_header (lh),
+ /* Call `gdbarch_adjust_dwarf2_line' on the initial 0 address as
+ if there was a line entry for it so that the backend has a
+ chance to adjust it and also record it in case it needs it.
+ This is currently used by MIPS code,
+ cf. `mips_adjust_dwarf2_line'. */
+ m_address ((unrelocated_addr) gdbarch_adjust_dwarf2_line (arch, 0, 0)),
+ m_flags (lh->default_is_stmt ? LEF_IS_STMT : (linetable_entry_flags) 0),
+ m_last_address (m_address)
+{
+}
+
+void
+lnp_state_machine::check_line_address (struct dwarf2_cu *cu,
+ const gdb_byte *line_ptr,
+ unrelocated_addr unrelocated_lowpc,
+ unrelocated_addr address)
+{
+ /* Linkers resolve a symbolic relocation referencing a GC'd function to 0,
+ -1 or -2 (-2 is used by certain lld versions, see
+ https://github.com/llvm/llvm-project/commit/e618ccbf431f6730edb6d1467a127c3a52fd57f7).
+ If ADDRESS is 0, ignoring the opcode will err if the text section is
+ located at 0x0. In this case, additionally check that if
+ ADDRESS < UNRELOCATED_LOWPC. */
+
+ if ((address == (unrelocated_addr) 0 && address < unrelocated_lowpc)
+ || address == (unrelocated_addr) -1
+ || address == (unrelocated_addr) -2)
+ {
+ /* This line table is for a function which has been
+ GCd by the linker. Ignore it. PR gdb/12528 */
+
+ struct objfile *objfile = cu->per_objfile->objfile;
+ long line_offset = line_ptr - get_debug_line_section (cu)->buffer;
+
+ complaint (_(".debug_line address at offset 0x%lx is 0 [in module %s]"),
+ line_offset, objfile_name (objfile));
+ m_currently_recording_lines = false;
+ /* Note: m_currently_recording_lines is left as false until we see
+ DW_LNE_end_sequence. */
+ }
+}
+
+/* Subroutine of dwarf_decode_lines to simplify it.
+ Process the line number information in LH. */
+
+static void
+dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu,
+ unrelocated_addr lowpc)
+{
+ const gdb_byte *line_ptr, *extended_end;
+ const gdb_byte *line_end;
+ unsigned int bytes_read, extended_len;
+ unsigned char op_code, extended_op;
+ struct objfile *objfile = cu->per_objfile->objfile;
+ bfd *abfd = objfile->obfd.get ();
+ struct gdbarch *gdbarch = objfile->arch ();
+
+ line_ptr = lh->statement_program_start;
+ line_end = lh->statement_program_end;
+
+ /* Read the statement sequences until there's nothing left. */
+ while (line_ptr < line_end)
+ {
+ /* The DWARF line number program state machine. Reset the state
+ machine at the start of each sequence. */
+ lnp_state_machine state_machine (cu, gdbarch, lh);
+ bool end_sequence = false;
+
+ /* Start a subfile for the current file of the state
+ machine. */
+ const file_entry *fe = state_machine.current_file ();
+
+ if (fe != NULL)
+ dwarf2_start_subfile (cu, *fe, *lh);
+
+ /* Decode the table. */
+ while (line_ptr < line_end && !end_sequence)
+ {
+ op_code = read_1_byte (abfd, line_ptr);
+ line_ptr += 1;
+
+ if (op_code >= lh->opcode_base)
+ {
+ /* Special opcode. */
+ state_machine.handle_special_opcode (op_code);
+ }
+ else switch (op_code)
+ {
+ case DW_LNS_extended_op:
+ extended_len = read_unsigned_leb128 (abfd, line_ptr,
+ &bytes_read);
+ line_ptr += bytes_read;
+ extended_end = line_ptr + extended_len;
+ extended_op = read_1_byte (abfd, line_ptr);
+ line_ptr += 1;
+ if (DW_LNE_lo_user <= extended_op
+ && extended_op <= DW_LNE_hi_user)
+ {
+ /* Vendor extension, ignore. */
+ line_ptr = extended_end;
+ break;
+ }
+ switch (extended_op)
+ {
+ case DW_LNE_end_sequence:
+ state_machine.handle_end_sequence ();
+ end_sequence = true;
+ break;
+ case DW_LNE_set_address:
+ {
+ unrelocated_addr address
+ = cu->header.read_address (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+
+ state_machine.check_line_address (cu, line_ptr, lowpc,
+ address);
+ state_machine.handle_set_address (address);
+ }
+ break;
+ case DW_LNE_define_file:
+ {
+ const char *cur_file;
+ unsigned int mod_time, length;
+ dir_index dindex;
+
+ cur_file = read_direct_string (abfd, line_ptr,
+ &bytes_read);
+ line_ptr += bytes_read;
+ dindex = (dir_index)
+ read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+ mod_time =
+ read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+ length =
+ read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+ lh->add_file_name (cur_file, dindex, mod_time, length);
+ }
+ break;
+ case DW_LNE_set_discriminator:
+ {
+ /* The discriminator is not interesting to the
+ debugger; just ignore it. We still need to
+ check its value though:
+ if there are consecutive entries for the same
+ (non-prologue) line we want to coalesce them.
+ PR 17276. */
+ unsigned int discr
+ = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+
+ state_machine.handle_set_discriminator (discr);
+ }
+ break;
+ default:
+ complaint (_("mangled .debug_line section"));
+ return;
+ }
+ /* Make sure that we parsed the extended op correctly. If e.g.
+ we expected a different address size than the producer used,
+ we may have read the wrong number of bytes. */
+ if (line_ptr != extended_end)
+ {
+ complaint (_("mangled .debug_line section"));
+ return;
+ }
+ break;
+ case DW_LNS_copy:
+ state_machine.handle_copy ();
+ break;
+ case DW_LNS_advance_pc:
+ {
+ CORE_ADDR adjust
+ = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+
+ state_machine.handle_advance_pc (adjust);
+ }
+ break;
+ case DW_LNS_advance_line:
+ {
+ int line_delta
+ = read_signed_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+
+ state_machine.handle_advance_line (line_delta);
+ }
+ break;
+ case DW_LNS_set_file:
+ {
+ file_name_index file
+ = (file_name_index) read_unsigned_leb128 (abfd, line_ptr,
+ &bytes_read);
+ line_ptr += bytes_read;
+
+ state_machine.handle_set_file (file);
+ }
+ break;
+ case DW_LNS_set_column:
+ (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+ break;
+ case DW_LNS_negate_stmt:
+ state_machine.handle_negate_stmt ();
+ break;
+ case DW_LNS_set_basic_block:
+ break;
+ /* Add to the address register of the state machine the
+ address increment value corresponding to special opcode
+ 255. I.e., this value is scaled by the minimum
+ instruction length since special opcode 255 would have
+ scaled the increment. */
+ case DW_LNS_const_add_pc:
+ state_machine.handle_const_add_pc ();
+ break;
+ case DW_LNS_fixed_advance_pc:
+ {
+ CORE_ADDR addr_adj = read_2_bytes (abfd, line_ptr);
+ line_ptr += 2;
+
+ state_machine.handle_fixed_advance_pc (addr_adj);
+ }
+ break;
+ case DW_LNS_set_prologue_end:
+ state_machine.handle_set_prologue_end ();
+ break;
+ case DW_LNS_set_epilogue_begin:
+ state_machine.handle_set_epilogue_begin ();
+ break;
+ default:
+ {
+ /* Unknown standard opcode, ignore it. */
+ int i;
+
+ for (i = 0; i < lh->standard_opcode_lengths[op_code]; i++)
+ {
+ (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+ }
+ }
+ }
+ }
+
+ if (!end_sequence)
+ dwarf2_debug_line_missing_end_sequence_complaint ();
+
+ /* We got a DW_LNE_end_sequence (or we ran off the end of the buffer,
+ in which case we still finish recording the last line). */
+ state_machine.record_line (true);
+ }
+}
+
+/* See dwarf2/line-program.h. */
+
+void
+dwarf_decode_lines (struct line_header *lh, struct dwarf2_cu *cu,
+ unrelocated_addr lowpc, bool decode_mapping)
+{
+ if (decode_mapping)
+ dwarf_decode_lines_1 (lh, cu, lowpc);
+
+ /* Make sure a symtab is created for every file, even files
+ which contain only variables (i.e. no code with associated
+ line numbers). */
+ buildsym_compunit *builder = cu->get_builder ();
+ struct compunit_symtab *cust = builder->get_compunit_symtab ();
+
+ for (auto &fe : lh->file_names ())
+ {
+ dwarf2_start_subfile (cu, fe, *lh);
+ subfile *sf = builder->get_current_subfile ();
+
+ if (sf->symtab == nullptr)
+ sf->symtab = allocate_symtab (cust, sf->name.c_str (),
+ sf->name_for_id.c_str ());
+
+ fe.symtab = sf->symtab;
+ }
+}
diff --git a/gdb/dwarf2/line-program.h b/gdb/dwarf2/line-program.h
new file mode 100644
index 0000000..824f18f
--- /dev/null
+++ b/gdb/dwarf2/line-program.h
@@ -0,0 +1,47 @@
+/* DWARF 2 debugging format support for GDB.
+
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef GDB_DWARF2_LINE_PROGRAM_H
+#define GDB_DWARF2_LINE_PROGRAM_H
+
+/* Decode the Line Number Program (LNP) for the given line_header
+ structure and CU. The actual information extracted and the type
+ of structures created from the LNP depends on the value of PST.
+
+ FND holds the CU file name and directory, if known.
+ It is used for relative paths in the line table.
+
+ NOTE: It is important that psymtabs have the same file name (via
+ strcmp) as the corresponding symtab. Since the directory is not
+ used in the name of the symtab we don't use it in the name of the
+ psymtabs we create. E.g. expand_line_sal requires this when
+ finding psymtabs to expand. A good testcase for this is
+ mb-inline.exp.
+
+ LOWPC is the lowest address in CU (or 0 if not known).
+
+ Boolean DECODE_MAPPING specifies we need to fully decode .debug_line
+ for its PC<->lines mapping information. Otherwise only the filename
+ table is read in. */
+
+extern void dwarf_decode_lines (struct line_header *lh,
+ struct dwarf2_cu *cu,
+ unrelocated_addr lowpc, bool decode_mapping);
+
+#endif /* GDB_DWARF2_LINE_PROGRAM_H */
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index 8f66694..37c85d8 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -1,6 +1,6 @@
/* DWARF 2 location expression support for GDB.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
Contributed by Daniel Jacobowitz, MontaVista Software, Inc.
@@ -1732,11 +1732,10 @@ dwarf2_evaluate_property (const dynamic_prop *prop,
*value = prop->const_val ();
return true;
- case PROP_ADDR_OFFSET:
+ case PROP_FIELD:
{
const dwarf2_property_baton *baton = prop->baton ();
const struct property_addr_info *pinfo;
- struct value *val;
for (pinfo = addr_stack; pinfo != NULL; pinfo = pinfo->next)
{
@@ -1747,14 +1746,40 @@ dwarf2_evaluate_property (const dynamic_prop *prop,
}
if (pinfo == NULL)
error (_("cannot find reference address for offset property"));
- if (pinfo->valaddr.data () != NULL)
- val = value_from_contents
- (baton->offset_info.type,
- pinfo->valaddr.data () + baton->offset_info.offset);
- else
- val = value_at (baton->offset_info.type,
- pinfo->addr + baton->offset_info.offset);
- *value = value_as_address (val);
+
+ struct field resolved_field = baton->field;
+ resolve_dynamic_field (resolved_field, pinfo, initial_frame);
+
+ /* Storage for memory if we need to read it. */
+ gdb::byte_vector memory;
+ const gdb_byte *bytes = pinfo->valaddr.data ();
+ if (bytes == nullptr)
+ {
+ int bitpos = resolved_field.loc_bitpos ();
+ int bitsize = resolved_field.bitsize ();
+ if (bitsize == 0)
+ bitsize = check_typedef (resolved_field.type ())->length () * 8;
+
+ /* Read just the minimum number of bytes needed to satisfy
+ unpack_field_as_long. So, update the resolved field's
+ starting offset to remove any unnecessary leading
+ bytes. */
+ int byte_offset = bitpos / 8;
+
+ bitpos %= 8;
+ resolved_field.set_loc_bitpos (bitpos);
+
+ /* Make sure to include any remaining bit offset in the
+ size computation, in case the value straddles a
+ byte. */
+ int byte_length = align_up (bitsize + bitpos, 8) / 8;
+ memory.resize (byte_length);
+
+ read_memory (pinfo->addr + byte_offset, memory.data (),
+ byte_length);
+ bytes = memory.data ();
+ }
+ *value = unpack_field_as_long (bytes, &resolved_field);
return true;
}
@@ -4129,9 +4154,7 @@ const struct symbol_computed_ops dwarf2_loclist_funcs = {
loclist_generate_c_location
};
-void _initialize_dwarf2loc ();
-void
-_initialize_dwarf2loc ()
+INIT_GDB_FILE (dwarf2loc)
{
add_setshow_zuinteger_cmd ("entry-values", class_maintenance,
&entry_values_debug,
diff --git a/gdb/dwarf2/loc.h b/gdb/dwarf2/loc.h
index de9e144..c672320 100644
--- a/gdb/dwarf2/loc.h
+++ b/gdb/dwarf2/loc.h
@@ -1,6 +1,6 @@
/* DWARF 2 location expression support for GDB.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,6 +20,7 @@
#ifndef GDB_DWARF2_LOC_H
#define GDB_DWARF2_LOC_H
+#include "gdbtypes.h"
#include "dwarf2/expr.h"
struct symbol_computed_ops;
@@ -99,31 +100,9 @@ struct property_addr_info
/* If not NULL, a pointer to the info for the object containing
the object described by this node. */
- struct property_addr_info *next;
+ const property_addr_info *next;
};
-/* Converts a dynamic property into a static one. FRAME is the frame in which
- the property is evaluated; if NULL, the selected frame (if any) is used
- instead.
-
- ADDR_STACK is the stack of addresses that might be needed to evaluate the
- property. When evaluating a property that is not related to a type, it can
- be NULL.
-
- Returns true if PROP could be converted and the static value is passed
- back into VALUE, otherwise returns false.
-
- Any values in PUSH_VALUES will be pushed before evaluating the location
- expression, PUSH_VALUES[0] will be pushed first, then PUSH_VALUES[1],
- etc. This means the during evaluation PUSH_VALUES[0] will be at the
- bottom of the stack. */
-
-bool dwarf2_evaluate_property (const struct dynamic_prop *prop,
- const frame_info_ptr &frame,
- const property_addr_info *addr_stack,
- CORE_ADDR *value,
- gdb::array_view<CORE_ADDR> push_values = {});
-
/* A helper for the compiler interface that compiles a single dynamic
property to C code.
@@ -167,6 +146,9 @@ struct dwarf2_locexpr_baton
directly. */
bool is_reference;
+ /* True if this object is actually a dwarf2_field_location_baton. */
+ bool is_field_location;
+
/* The objfile that was used when creating this. */
dwarf2_per_objfile *per_objfile;
@@ -175,6 +157,23 @@ struct dwarf2_locexpr_baton
dwarf2_per_cu *per_cu;
};
+/* If the DWARF location for a field used DW_AT_bit_size, then an
+ object of this type is created to represent the field location.
+ This is then used to apply the bit offset after computing the
+ field's byte offset. Objects of this type always set the
+ 'is_field_location' member in dwarf2_locexpr_baton. See also
+ apply_bit_offset_to_field. */
+
+struct dwarf2_field_location_baton : public dwarf2_locexpr_baton
+{
+ /* The bit offset, coming from DW_AT_bit_offset. */
+ LONGEST bit_offset;
+
+ /* The DW_AT_byte_size of the field. If no explicit byte size was
+ specified, this is 0. */
+ LONGEST explicit_byte_size;
+};
+
struct dwarf2_loclist_baton
{
/* The initial base address for the location list, based on the compilation
@@ -202,23 +201,6 @@ struct dwarf2_loclist_baton
unsigned char dwarf_version;
};
-/* The baton used when a dynamic property is an offset to a parent
- type. This can be used, for instance, then the bound of an array
- inside a record is determined by the value of another field inside
- that record. */
-
-struct dwarf2_offset_baton
-{
- /* The offset from the parent type where the value of the property
- is stored. In the example provided above, this would be the offset
- of the field being used as the array bound. */
- LONGEST offset;
-
- /* The type of the object whose property is dynamic. In the example
- provided above, this would the array's index type. */
- struct type *type;
-};
-
/* A dynamic property is either expressed as a single location expression
or a location list. If the property is an indirection, pointing to
another die, keep track of the targeted type in PROPERTY_TYPE.
@@ -241,8 +223,8 @@ struct dwarf2_property_baton
/* Location list to be evaluated in the context of PROPERTY_TYPE. */
struct dwarf2_loclist_baton loclist;
- /* The location is an offset to PROPERTY_TYPE. */
- struct dwarf2_offset_baton offset_info;
+ /* The location is stored in a field of PROPERTY_TYPE. */
+ struct field field;
};
};
@@ -307,8 +289,53 @@ extern struct value *indirect_synthetic_pointer
Function always returns non-NULL value. It throws NO_ENTRY_VALUE_ERROR if
it cannot resolve the parameter for any reason. */
+#if defined(DWARF_FORMAT_AVAILABLE)
+
+/* Converts a dynamic property into a static one. FRAME is the frame in which
+ the property is evaluated; if NULL, the selected frame (if any) is used
+ instead.
+
+ ADDR_STACK is the stack of addresses that might be needed to evaluate the
+ property. When evaluating a property that is not related to a type, it can
+ be NULL.
+
+ Returns true if PROP could be converted and the static value is passed
+ back into VALUE, otherwise returns false.
+
+ Any values in PUSH_VALUES will be pushed before evaluating the location
+ expression, PUSH_VALUES[0] will be pushed first, then PUSH_VALUES[1],
+ etc. This means the during evaluation PUSH_VALUES[0] will be at the
+ bottom of the stack. */
+
+bool dwarf2_evaluate_property (const struct dynamic_prop *prop,
+ const frame_info_ptr &frame,
+ const property_addr_info *addr_stack,
+ CORE_ADDR *value,
+ gdb::array_view<CORE_ADDR> push_values = {});
+
extern struct value *value_of_dwarf_reg_entry (struct type *type,
const frame_info_ptr &frame,
enum call_site_parameter_kind kind,
union call_site_parameter_u kind_u);
+
+#else /* DWARF_FORMAT_AVAILABLE */
+
+static inline bool
+dwarf2_evaluate_property (const struct dynamic_prop *, const frame_info_ptr &,
+ const property_addr_info *, CORE_ADDR *,
+ gdb::array_view<CORE_ADDR> = {})
+{
+ return false;
+}
+
+static inline struct value *
+value_of_dwarf_reg_entry (struct type *type, const frame_info_ptr &frame,
+ enum call_site_parameter_kind kind,
+ union call_site_parameter_u kind_u)
+{
+ error (_("No dwarf support available."));
+}
+
+#endif /* DWARF_FORMAT_AVAILABLE */
+
#endif /* GDB_DWARF2_LOC_H */
diff --git a/gdb/dwarf2/macro.c b/gdb/dwarf2/macro.c
index 2d9d4b7..1dc3a9e 100644
--- a/gdb/dwarf2/macro.c
+++ b/gdb/dwarf2/macro.c
@@ -1,6 +1,6 @@
/* Read DWARF macro information
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
Inc. with support from Florida State University (under contract
@@ -259,6 +259,7 @@ skip_form_bytes (bfd *abfd, const gdb_byte *bytes, const gdb_byte *buffer_end,
case DW_FORM_sec_offset:
case DW_FORM_strp:
case DW_FORM_GNU_strp_alt:
+ case DW_FORM_strp_sup:
bytes += offset_size;
break;
diff --git a/gdb/dwarf2/macro.h b/gdb/dwarf2/macro.h
index 7ef2134..9cbd560 100644
--- a/gdb/dwarf2/macro.h
+++ b/gdb/dwarf2/macro.h
@@ -1,6 +1,6 @@
/* DWARF macro support for GDB.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/mapped-index.h b/gdb/dwarf2/mapped-index.h
index 15677ec..1690690 100644
--- a/gdb/dwarf2/mapped-index.h
+++ b/gdb/dwarf2/mapped-index.h
@@ -1,6 +1,6 @@
/* Base class for mapped indices
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/parent-map.h b/gdb/dwarf2/parent-map.h
index 130098f..51fe7dd 100644
--- a/gdb/dwarf2/parent-map.h
+++ b/gdb/dwarf2/parent-map.h
@@ -1,6 +1,6 @@
/* DIE indexing
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/public.h b/gdb/dwarf2/public.h
index 8247641..f9e7488 100644
--- a/gdb/dwarf2/public.h
+++ b/gdb/dwarf2/public.h
@@ -1,6 +1,6 @@
/* Public API for gdb DWARF reader
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -30,6 +30,8 @@ enum class dw_index_kind
DEBUG_NAMES,
};
+#if defined(DWARF_FORMAT_AVAILABLE)
+
/* Try to locate the sections we need for DWARF 2 debugging
information. If these are found, begin reading the DWARF and
return true. Otherwise, return false. NAMES points to the dwarf2
@@ -44,4 +46,27 @@ extern bool dwarf2_initialize_objfile
extern void dwarf2_build_frame_info (struct objfile *);
+/* Append the DWARF-2 frame unwinders to GDBARCH's list. */
+
+void dwarf2_append_unwinders (struct gdbarch *gdbarch);
+
+#else /* DWARF_FORMAT_AVAILABLE */
+
+static inline bool
+dwarf2_initialize_objfile (struct objfile *,
+ const struct dwarf2_debug_sections * = nullptr,
+ bool = false)
+{
+ warning (_("No dwarf support available."));
+ return false;
+}
+
+static inline void
+dwarf2_build_frame_info (struct objfile *)
+{
+ warning (_("No dwarf support available."));
+}
+
+#endif /* DWARF_FORMAT_AVAILABLE */
+
#endif /* GDB_DWARF2_PUBLIC_H */
diff --git a/gdb/dwarf2/read-debug-names.c b/gdb/dwarf2/read-debug-names.c
index 96a8ad3..ddf4935 100644
--- a/gdb/dwarf2/read-debug-names.c
+++ b/gdb/dwarf2/read-debug-names.c
@@ -1,6 +1,6 @@
/* Reading code for .debug_names
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -114,6 +114,14 @@ struct mapped_debug_names_reader
gdb::unordered_map<ULONGEST, index_val> abbrev_map;
+ /* List of CUs in the same order as found in the index header (DWARF 5 section
+ 6.1.1.4.2). */
+ std::vector<dwarf2_per_cu *> comp_units;
+
+ /* List of local TUs in the same order as found in the index (DWARF 5 section
+ 6.1.1.4.3). */
+ std::vector<dwarf2_per_cu *> type_units;
+
/* Even though the scanning of .debug_names and creation of the
cooked index entries is done serially, we create multiple shards
so that the finalization step can be parallelized. The shards
@@ -232,7 +240,7 @@ mapped_debug_names_reader::scan_one_entry (const char *name,
case DW_IDX_compile_unit:
{
/* Don't crash on bad data. */
- if (ull >= per_objfile->per_bfd->all_comp_units.size ())
+ if (ull >= this->comp_units.size ())
{
complaint (_(".debug_names entry has bad CU index %s"
" [in module %s]"),
@@ -240,30 +248,31 @@ mapped_debug_names_reader::scan_one_entry (const char *name,
bfd_get_filename (abfd));
continue;
}
+
+ per_cu = this->comp_units[ull];
+ break;
}
- per_cu = per_objfile->per_bfd->get_cu (ull);
- break;
case DW_IDX_type_unit:
- /* Don't crash on bad data. */
- if (ull >= per_objfile->per_bfd->all_type_units.size ())
- {
- complaint (_(".debug_names entry has bad TU index %s"
- " [in module %s]"),
- pulongest (ull),
- bfd_get_filename (abfd));
- continue;
- }
{
- int nr_cus = per_objfile->per_bfd->all_comp_units.size ();
- per_cu = per_objfile->per_bfd->get_cu (nr_cus + ull);
+ /* Don't crash on bad data. */
+ if (ull >= this->type_units.size ())
+ {
+ complaint (_(".debug_names entry has bad TU index %s"
+ " [in module %s]"),
+ pulongest (ull),
+ bfd_get_filename (abfd));
+ continue;
+ }
+
+ per_cu = this->type_units[ull];
+ break;
}
- break;
case DW_IDX_die_offset:
die_offset = sect_offset (ull);
/* In a per-CU index (as opposed to a per-module index), index
entries without CU attribute implicitly refer to the single CU. */
- if (per_cu == NULL)
- per_cu = per_objfile->per_bfd->get_cu (0);
+ if (per_cu == nullptr)
+ per_cu = this->comp_units[0];
break;
case DW_IDX_parent:
parent = ull;
@@ -416,15 +425,11 @@ cooked_index_worker_debug_names::do_reading ()
{
complaint_interceptor complaint_handler;
- try
+ /* Arbitrarily put all exceptions into the first result. */
+ m_map.indices[0].catch_error ([&] ()
{
m_map.scan_all_names ();
- }
- catch (gdb_exception &exc)
- {
- /* Arbitrarily put all exceptions into the first result. */
- m_map.indices[0].note_error (std::move (exc));
- }
+ });
bool first = true;
for (auto &iter : m_map.indices)
@@ -444,45 +449,45 @@ cooked_index_worker_debug_names::do_reading ()
bfd_thread_cleanup ();
}
-/* Check the signatured type hash table from .debug_names. */
+/* Build the list of TUs (mapped_debug_names_reader::type_units) from the index
+ header and verify that it matches the list of TUs read from the DIEs in
+ `.debug_info`.
+
+ Return true if they match, false otherwise. */
static bool
-check_signatured_type_table_from_debug_names
- (dwarf2_per_objfile *per_objfile,
- const mapped_debug_names_reader &map,
- struct dwarf2_section_info *section)
+build_and_check_tu_list_from_debug_names (dwarf2_per_objfile *per_objfile,
+ mapped_debug_names_reader &map,
+ dwarf2_section_info *section)
{
struct objfile *objfile = per_objfile->objfile;
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
- int nr_cus = per_bfd->all_comp_units.size ();
- int nr_cus_tus = per_bfd->all_units.size ();
section->read (objfile);
- uint32_t j = nr_cus;
for (uint32_t i = 0; i < map.tu_count; ++i)
{
+ /* Read one entry from the TU list. */
sect_offset sect_off
= (sect_offset) (extract_unsigned_integer
(map.tu_table_reordered + i * map.offset_size,
map.offset_size,
map.dwarf5_byte_order));
- bool found = false;
- for (; j < nr_cus_tus; j++)
- if (per_bfd->get_cu (j)->sect_off == sect_off)
- {
- found = true;
- break;
- }
- if (!found)
+ /* Find the matching dwarf2_per_cu. */
+ dwarf2_per_cu *per_cu = dwarf2_find_unit ({ section, sect_off },
+ per_bfd);
+
+ if (per_cu == nullptr || !per_cu->is_debug_types)
{
warning (_("Section .debug_names has incorrect entry in TU table,"
" ignoring .debug_names."));
return false;
}
- per_bfd->all_comp_units_index_tus.push_back (per_bfd->get_cu (j));
+
+ map.type_units.emplace_back (per_cu);
}
+
return true;
}
@@ -704,40 +709,11 @@ read_debug_names_from_section (dwarf2_per_objfile *per_objfile,
list. */
static bool
-check_cus_from_debug_names_list (dwarf2_per_bfd *per_bfd,
- const mapped_debug_names_reader &map,
- dwarf2_section_info &section,
- bool is_dwz)
+build_and_check_cu_list_from_debug_names (dwarf2_per_bfd *per_bfd,
+ mapped_debug_names_reader &map,
+ dwarf2_section_info &section)
{
- int nr_cus = per_bfd->all_comp_units.size ();
-
- if (!map.augmentation_is_gdb)
- {
- uint32_t j = 0;
- for (uint32_t i = 0; i < map.cu_count; ++i)
- {
- sect_offset sect_off
- = (sect_offset) (extract_unsigned_integer
- (map.cu_table_reordered + i * map.offset_size,
- map.offset_size,
- map.dwarf5_byte_order));
- bool found = false;
- for (; j < nr_cus; j++)
- if (per_bfd->get_cu (j)->sect_off == sect_off)
- {
- found = true;
- break;
- }
- if (!found)
- {
- warning (_("Section .debug_names has incorrect entry in CU table,"
- " ignoring .debug_names."));
- return false;
- }
- per_bfd->all_comp_units_index_cus.push_back (per_bfd->get_cu (j));
- }
- return true;
- }
+ int nr_cus = per_bfd->num_comp_units;
if (map.cu_count != nr_cus)
{
@@ -753,43 +729,51 @@ check_cus_from_debug_names_list (dwarf2_per_bfd *per_bfd,
(map.cu_table_reordered + i * map.offset_size,
map.offset_size,
map.dwarf5_byte_order));
- if (sect_off != per_bfd->get_cu (i)->sect_off)
+
+ /* Find the matching dwarf2_per_cu. */
+ dwarf2_per_cu *per_cu = dwarf2_find_unit ({ &section, sect_off }, per_bfd);
+
+ if (per_cu == nullptr || per_cu->is_debug_types)
{
warning (_("Section .debug_names has incorrect entry in CU table,"
" ignoring .debug_names."));
return false;
}
+
+ map.comp_units.emplace_back (per_cu);
}
return true;
}
-/* Read the CU list from the mapped index, and use it to create all
- the CU objects for this dwarf2_per_objfile. */
+/* Build the list of CUs (mapped_debug_names_reader::compile_units) from the
+ index header and verify that it matches the list of CUs read from the DIEs in
+ `.debug_info`.
+
+ Return true if they match, false otherwise. */
static bool
-check_cus_from_debug_names (dwarf2_per_bfd *per_bfd,
- const mapped_debug_names_reader &map,
- const mapped_debug_names_reader &dwz_map)
+build_and_check_cu_lists_from_debug_names (dwarf2_per_bfd *per_bfd,
+ mapped_debug_names_reader &map,
+ mapped_debug_names_reader &dwz_map)
{
- if (!check_cus_from_debug_names_list (per_bfd, map, per_bfd->infos[0],
- false /* is_dwz */))
+ if (!build_and_check_cu_list_from_debug_names (per_bfd, map,
+ per_bfd->infos[0]))
return false;
if (dwz_map.cu_count == 0)
return true;
dwz_file *dwz = per_bfd->get_dwz_file ();
- return check_cus_from_debug_names_list (per_bfd, dwz_map, dwz->info,
- true /* is_dwz */);
+ return build_and_check_cu_list_from_debug_names (per_bfd, dwz_map, dwz->info);
}
-/* This does all the work for dwarf2_read_debug_names, but putting it
- into a separate function makes some cleanup a bit simpler. */
+/* See read-debug-names.h. */
-static bool
-do_dwarf2_read_debug_names (dwarf2_per_objfile *per_objfile)
+bool
+dwarf2_read_debug_names (dwarf2_per_objfile *per_objfile)
{
+ scoped_remove_all_units remove_all_units (*per_objfile->per_bfd);
mapped_debug_names_reader map;
mapped_debug_names_reader dwz_map;
struct objfile *objfile = per_objfile->objfile;
@@ -819,7 +803,7 @@ do_dwarf2_read_debug_names (dwarf2_per_objfile *per_objfile)
}
create_all_units (per_objfile);
- if (!check_cus_from_debug_names (per_bfd, map, dwz_map))
+ if (!build_and_check_cu_lists_from_debug_names (per_bfd, map, dwz_map))
return false;
if (map.tu_count != 0)
@@ -835,8 +819,8 @@ do_dwarf2_read_debug_names (dwarf2_per_objfile *per_objfile)
? &per_bfd->types[0]
: &per_bfd->infos[0]);
- if (!check_signatured_type_table_from_debug_names (per_objfile,
- map, section))
+ if (!build_and_check_tu_list_from_debug_names (per_objfile, map,
+ section))
return false;
}
@@ -866,17 +850,7 @@ do_dwarf2_read_debug_names (dwarf2_per_objfile *per_objfile)
(per_objfile, std::move (map)));
auto idx = std::make_unique<debug_names_index> (std::move (cidn));
per_bfd->start_reading (std::move (idx));
+ remove_all_units.disable ();
return true;
}
-
-/* See read-debug-names.h. */
-
-bool
-dwarf2_read_debug_names (dwarf2_per_objfile *per_objfile)
-{
- bool result = do_dwarf2_read_debug_names (per_objfile);
- if (!result)
- per_objfile->per_bfd->all_units.clear ();
- return result;
-}
diff --git a/gdb/dwarf2/read-debug-names.h b/gdb/dwarf2/read-debug-names.h
index ef91a70..3abbc03 100644
--- a/gdb/dwarf2/read-debug-names.h
+++ b/gdb/dwarf2/read-debug-names.h
@@ -1,6 +1,6 @@
/* Reading code for .debug_names
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c
index 3439163..e02340f 100644
--- a/gdb/dwarf2/read-gdb-index.c
+++ b/gdb/dwarf2/read-gdb-index.c
@@ -1,6 +1,6 @@
/* Reading code for .gdb_index
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -27,16 +27,67 @@
#include "event-top.h"
#include "gdb/gdb-index.h"
#include "gdbsupport/gdb-checked-static-cast.h"
-#include "mapped-index.h"
+#include "cooked-index.h"
#include "read.h"
#include "extract-store-integer.h"
#include "cp-support.h"
#include "symtab.h"
#include "gdbsupport/selftest.h"
+#include "tag.h"
/* When true, do not reject deprecated .gdb_index sections. */
static bool use_deprecated_index_sections = false;
+struct dwarf2_gdb_index : public cooked_index_functions
+{
+ /* This dumps minimal information about the index.
+ It is called via "mt print objfiles".
+ One use is to verify .gdb_index has been loaded by the
+ gdb.dwarf2/gdb-index.exp testcase. */
+ void dump (struct objfile *objfile) override;
+};
+
+/* This is a cooked index as ingested from .gdb_index. */
+
+class cooked_gdb_index : public cooked_index
+{
+public:
+
+ cooked_gdb_index (cooked_index_worker_up worker,
+ int version)
+ : cooked_index (std::move (worker)),
+ version (version)
+ { }
+
+ /* This can't be used to write an index. */
+ cooked_index *index_for_writing () override
+ { return nullptr; }
+
+ quick_symbol_functions_up make_quick_functions () const override
+ { return quick_symbol_functions_up (new dwarf2_gdb_index); }
+
+ bool version_check () const override
+ {
+ return version >= 8;
+ }
+
+ /* Index data format version. */
+ int version;
+};
+
+/* See above. */
+
+void
+dwarf2_gdb_index::dump (struct objfile *objfile)
+{
+ dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
+
+ cooked_gdb_index *index = (gdb::checked_static_cast<cooked_gdb_index *>
+ (per_objfile->per_bfd->index_table.get ()));
+ gdb_printf (".gdb_index: version %d\n", index->version);
+ cooked_index_functions::dump (objfile);
+}
+
/* This is a view into the index that converts from bytes to an
offset_type, and allows indexing. Unaligned bytes are specifically
allowed here, and handled via unpacking. */
@@ -77,46 +128,18 @@ private:
gdb::array_view<const gdb_byte> m_bytes;
};
-/* An index into a (C++) symbol name component in a symbol name as
- recorded in the mapped_index's symbol table. For each C++ symbol
- in the symbol table, we record one entry for the start of each
- component in the symbol in a table of name components, and then
- sort the table, in order to be able to binary search symbol names,
- ignoring leading namespaces, both completion and regular look up.
- For example, for symbol "A::B::C", we'll have an entry that points
- to "A::B::C", another that points to "B::C", and another for "C".
- Note that function symbols in GDB index have no parameter
- information, just the function/method names. You can convert a
- name_component to a "const char *" using the
- 'mapped_index::symbol_name_at(offset_type)' method. */
-
-struct name_component
-{
- /* Offset in the symbol name where the component starts. Stored as
- a (32-bit) offset instead of a pointer to save memory and improve
- locality on 64-bit architectures. */
- offset_type name_offset;
-
- /* The symbol's index in the symbol and constant pool tables of a
- mapped_index. */
- offset_type idx;
-};
-
-/* A description of .gdb_index index. The file format is described in
- a comment by the code that writes the index. */
+/* A worker for reading .gdb_index. The file format is described in
+ the manual. */
-struct mapped_gdb_index : public dwarf_scanner_base
+struct mapped_gdb_index
{
- /* The name_component table (a sorted vector). See name_component's
- description above. */
- std::vector<name_component> name_components;
-
- /* How NAME_COMPONENTS is sorted. */
- enum case_sensitivity name_components_casing;
-
/* Index data format version. */
int version = 0;
+ /* Compile units followed by type units, in the order as found in the
+ index. Indices found in index entries can index directly into this. */
+ std::vector<dwarf2_per_cu *> units;
+
/* The address table data. */
gdb::array_view<const gdb_byte> address_table;
@@ -132,6 +155,15 @@ struct mapped_gdb_index : public dwarf_scanner_base
/* An address map that maps from PC to dwarf2_per_cu. */
addrmap_fixed *index_addrmap = nullptr;
+ /* The name of 'main', or nullptr if not known. */
+ const char *main_name = nullptr;
+
+ /* The language of 'main', if known. */
+ enum language main_lang = language_minimal;
+
+ /* The result we're constructing. */
+ cooked_index_worker_result result;
+
/* Return the index into the constant pool of the name of the IDXth
symbol in the symbol table. */
offset_type symbol_name_index (offset_type idx) const
@@ -148,221 +180,41 @@ struct mapped_gdb_index : public dwarf_scanner_base
/* Return whether the name at IDX in the symbol table should be
ignored. */
- virtual bool symbol_name_slot_invalid (offset_type idx) const
+ bool symbol_name_slot_invalid (offset_type idx) const
{
- return (symbol_name_index (idx) == 0
- && symbol_vec_index (idx) == 0);
+ return symbol_name_index (idx) == 0 && symbol_vec_index (idx) == 0;
}
/* Convenience method to get at the name of the symbol at IDX in the
symbol table. */
- virtual const char *symbol_name_at
- (offset_type idx, dwarf2_per_objfile *per_objfile) const
+ const char *symbol_name_at (offset_type idx,
+ dwarf2_per_objfile *per_objfile) const
{
return (const char *) (this->constant_pool.data ()
+ symbol_name_index (idx));
}
- virtual size_t symbol_name_count () const
+ size_t symbol_name_count () const
{ return this->symbol_table.size () / 2; }
+ /* Set the name and language of the main function from the shortcut
+ table. */
+ void set_main_name (dwarf2_per_objfile *per_objfile);
+
/* Build the symbol name component sorted vector, if we haven't
yet. */
void build_name_components (dwarf2_per_objfile *per_objfile);
-
- /* Returns the lower (inclusive) and upper (exclusive) bounds of the
- possible matches for LN_NO_PARAMS in the name component
- vector. */
- std::pair<std::vector<name_component>::const_iterator,
- std::vector<name_component>::const_iterator>
- find_name_components_bounds (const lookup_name_info &ln_no_params,
- enum language lang,
- dwarf2_per_objfile *per_objfile) const;
-
- quick_symbol_functions_up make_quick_functions () const override;
-
- bool version_check () const override
- {
- return version >= 8;
- }
-
- dwarf2_per_cu *lookup (unrelocated_addr addr) override
- {
- if (index_addrmap == nullptr)
- return nullptr;
-
- void *obj = index_addrmap->find (static_cast<CORE_ADDR> (addr));
- return static_cast<dwarf2_per_cu *> (obj);
- }
-
- cooked_index *index_for_writing () override
- { return nullptr; }
};
-
-/* Starting from a search name, return the string that finds the upper
- bound of all strings that start with SEARCH_NAME in a sorted name
- list. Returns the empty string to indicate that the upper bound is
- the end of the list. */
-
-static std::string
-make_sort_after_prefix_name (const char *search_name)
-{
- /* When looking to complete "func", we find the upper bound of all
- symbols that start with "func" by looking for where we'd insert
- the closest string that would follow "func" in lexicographical
- order. Usually, that's "func"-with-last-character-incremented,
- i.e. "fund". Mind non-ASCII characters, though. Usually those
- will be UTF-8 multi-byte sequences, but we can't be certain.
- Especially mind the 0xff character, which is a valid character in
- non-UTF-8 source character sets (e.g. Latin1 'ÿ'), and we can't
- rule out compilers allowing it in identifiers. Note that
- conveniently, strcmp/strcasecmp are specified to compare
- characters interpreted as unsigned char. So what we do is treat
- the whole string as a base 256 number composed of a sequence of
- base 256 "digits" and add 1 to it. I.e., adding 1 to 0xff wraps
- to 0, and carries 1 to the following more-significant position.
- If the very first character in SEARCH_NAME ends up incremented
- and carries/overflows, then the upper bound is the end of the
- list. The string after the empty string is also the empty
- string.
-
- Some examples of this operation:
-
- SEARCH_NAME => "+1" RESULT
-
- "abc" => "abd"
- "ab\xff" => "ac"
- "\xff" "a" "\xff" => "\xff" "b"
- "\xff" => ""
- "\xff\xff" => ""
- "" => ""
-
- Then, with these symbols for example:
-
- func
- func1
- fund
-
- completing "func" looks for symbols between "func" and
- "func"-with-last-character-incremented, i.e. "fund" (exclusive),
- which finds "func" and "func1", but not "fund".
-
- And with:
-
- funcÿ (Latin1 'ÿ' [0xff])
- funcÿ1
- fund
-
- completing "funcÿ" looks for symbols between "funcÿ" and "fund"
- (exclusive), which finds "funcÿ" and "funcÿ1", but not "fund".
-
- And with:
-
- ÿÿ (Latin1 'ÿ' [0xff])
- ÿÿ1
-
- completing "ÿ" or "ÿÿ" looks for symbols between between "ÿÿ" and
- the end of the list.
- */
- std::string after = search_name;
- while (!after.empty () && (unsigned char) after.back () == 0xff)
- after.pop_back ();
- if (!after.empty ())
- after.back () = (unsigned char) after.back () + 1;
- return after;
-}
-
-/* See declaration. */
-
-std::pair<std::vector<name_component>::const_iterator,
- std::vector<name_component>::const_iterator>
-mapped_gdb_index::find_name_components_bounds
- (const lookup_name_info &lookup_name_without_params, language lang,
- dwarf2_per_objfile *per_objfile) const
-{
- auto *name_cmp
- = this->name_components_casing == case_sensitive_on ? strcmp : strcasecmp;
-
- const char *lang_name
- = lookup_name_without_params.language_lookup_name (lang);
-
- /* Comparison function object for lower_bound that matches against a
- given symbol name. */
- auto lookup_compare_lower = [&] (const name_component &elem,
- const char *name)
- {
- const char *elem_qualified = this->symbol_name_at (elem.idx, per_objfile);
- const char *elem_name = elem_qualified + elem.name_offset;
- return name_cmp (elem_name, name) < 0;
- };
-
- /* Comparison function object for upper_bound that matches against a
- given symbol name. */
- auto lookup_compare_upper = [&] (const char *name,
- const name_component &elem)
- {
- const char *elem_qualified = this->symbol_name_at (elem.idx, per_objfile);
- const char *elem_name = elem_qualified + elem.name_offset;
- return name_cmp (name, elem_name) < 0;
- };
-
- auto begin = this->name_components.begin ();
- auto end = this->name_components.end ();
-
- /* Find the lower bound. */
- auto lower = [&] ()
- {
- if (lookup_name_without_params.completion_mode () && lang_name[0] == '\0')
- return begin;
- else
- return std::lower_bound (begin, end, lang_name, lookup_compare_lower);
- } ();
-
- /* Find the upper bound. */
- auto upper = [&] ()
- {
- if (lookup_name_without_params.completion_mode ())
- {
- /* In completion mode, we want UPPER to point past all
- symbols names that have the same prefix. I.e., with
- these symbols, and completing "func":
-
- function << lower bound
- function1
- other_function << upper bound
-
- We find the upper bound by looking for the insertion
- point of "func"-with-last-character-incremented,
- i.e. "fund". */
- std::string after = make_sort_after_prefix_name (lang_name);
- if (after.empty ())
- return end;
- return std::lower_bound (lower, end, after.c_str (),
- lookup_compare_lower);
- }
- else
- return std::upper_bound (lower, end, lang_name, lookup_compare_upper);
- } ();
-
- return {lower, upper};
-}
-
/* See declaration. */
void
mapped_gdb_index::build_name_components (dwarf2_per_objfile *per_objfile)
{
- if (!this->name_components.empty ())
- return;
+ std::vector<std::pair<std::string_view, std::vector<cooked_index_entry *>>>
+ need_parents;
+ gdb::unordered_map<std::string_view, cooked_index_entry *> by_name;
- this->name_components_casing = case_sensitivity;
- auto *name_cmp
- = this->name_components_casing == case_sensitive_on ? strcmp : strcasecmp;
-
- /* The code below only knows how to break apart components of C++
- symbol names (and other languages that use '::' as
- namespace/module separator) and Ada symbol names. */
auto count = this->symbol_name_count ();
for (offset_type idx = 0; idx < count; idx++)
{
@@ -371,813 +223,186 @@ mapped_gdb_index::build_name_components (dwarf2_per_objfile *per_objfile)
const char *name = this->symbol_name_at (idx, per_objfile);
- /* Add each name component to the name component table. */
- unsigned int previous_len = 0;
+ /* This code only knows how to break apart components of C++
+ symbol names (and other languages that use '::' as
+ namespace/module separator) and Ada symbol names.
+ It's unfortunate that we need the language, but since it is
+ really only used to rebuild full names, pairing it with the
+ split method is fine. */
+ enum language lang;
+ std::vector<std::string_view> components;
if (strstr (name, "::") != nullptr)
{
- for (unsigned int current_len = cp_find_first_component (name);
- name[current_len] != '\0';
- current_len += cp_find_first_component (name + current_len))
- {
- gdb_assert (name[current_len] == ':');
- this->name_components.push_back ({previous_len, idx});
- /* Skip the '::'. */
- current_len += 2;
- previous_len = current_len;
- }
+ components = split_name (name, split_style::CXX);
+ lang = language_cplus;
}
- else
+ else if (strchr (name, '<') != nullptr)
{
- /* Handle the Ada encoded (aka mangled) form here. */
- for (const char *iter = strstr (name, "__");
- iter != nullptr;
- iter = strstr (iter, "__"))
- {
- this->name_components.push_back ({previous_len, idx});
- iter += 2;
- previous_len = iter - name;
- }
+ /* Guess that this is a template and so a C++ name. */
+ components.emplace_back (name);
+ lang = language_cplus;
}
-
- this->name_components.push_back ({previous_len, idx});
- }
-
- /* Sort name_components elements by name. */
- auto name_comp_compare = [&] (const name_component &left,
- const name_component &right)
- {
- const char *left_qualified
- = this->symbol_name_at (left.idx, per_objfile);
- const char *right_qualified
- = this->symbol_name_at (right.idx, per_objfile);
-
- const char *left_name = left_qualified + left.name_offset;
- const char *right_name = right_qualified + right.name_offset;
-
- return name_cmp (left_name, right_name) < 0;
- };
-
- std::sort (this->name_components.begin (),
- this->name_components.end (),
- name_comp_compare);
-}
-
-/* Helper for dw2_expand_symtabs_matching that works with a
- mapped_index_base instead of the containing objfile. This is split
- to a separate function in order to be able to unit test the
- name_components matching using a mock mapped_index_base. For each
- symbol name that matches, calls MATCH_CALLBACK, passing it the
- symbol's index in the mapped_index_base symbol table. */
-
-static bool
-dw2_expand_symtabs_matching_symbol
- (mapped_gdb_index &index,
- const lookup_name_info &lookup_name_in,
- expand_symtabs_symbol_matcher symbol_matcher,
- gdb::function_view<bool (offset_type)> match_callback,
- dwarf2_per_objfile *per_objfile,
- expand_symtabs_lang_matcher lang_matcher)
-{
- lookup_name_info lookup_name_without_params
- = lookup_name_in.make_ignore_params ();
-
- /* Build the symbol name component sorted vector, if we haven't
- yet. */
- index.build_name_components (per_objfile);
-
- /* The same symbol may appear more than once in the range though.
- E.g., if we're looking for symbols that complete "w", and we have
- a symbol named "w1::w2", we'll find the two name components for
- that same symbol in the range. To be sure we only call the
- callback once per symbol, we first collect the symbol name
- indexes that matched in a temporary vector and ignore
- duplicates. */
- std::vector<offset_type> matches;
-
- struct name_and_matcher
- {
- symbol_name_matcher_ftype *matcher;
- const char *name;
-
- bool operator== (const name_and_matcher &other) const
- {
- return matcher == other.matcher && strcmp (name, other.name) == 0;
- }
- };
-
- /* A vector holding all the different symbol name matchers, for all
- languages. */
- std::vector<name_and_matcher> matchers;
-
- for (int i = 0; i < nr_languages; i++)
- {
- enum language lang_e = (enum language) i;
- if (lang_matcher != nullptr && !lang_matcher (lang_e))
- continue;
-
- const language_defn *lang = language_def (lang_e);
- symbol_name_matcher_ftype *name_matcher
- = lang->get_symbol_name_matcher (lookup_name_without_params);
-
- name_and_matcher key {
- name_matcher,
- lookup_name_without_params.language_lookup_name (lang_e)
- };
-
- /* Don't insert the same comparison routine more than once.
- Note that we do this linear walk. This is not a problem in
- practice because the number of supported languages is
- low. */
- if (std::find (matchers.begin (), matchers.end (), key)
- != matchers.end ())
- continue;
- matchers.push_back (std::move (key));
-
- auto bounds
- = index.find_name_components_bounds (lookup_name_without_params,
- lang_e, per_objfile);
-
- /* Now for each symbol name in range, check to see if we have a name
- match, and if so, call the MATCH_CALLBACK callback. */
-
- for (; bounds.first != bounds.second; ++bounds.first)
+ else if (strstr (name, "__") != nullptr)
{
- const char *qualified
- = index.symbol_name_at (bounds.first->idx, per_objfile);
-
- if (!name_matcher (qualified, lookup_name_without_params, NULL)
- || (symbol_matcher != NULL && !symbol_matcher (qualified)))
- continue;
-
- matches.push_back (bounds.first->idx);
+ /* The Ada case is handled during finalization, because gdb
+ does not write the synthesized package names into the
+ index. */
+ components.emplace_back (name);
+ lang = language_ada;
}
- }
-
- std::sort (matches.begin (), matches.end ());
-
- /* Finally call the callback, once per match. */
- ULONGEST prev = -1;
- bool result = true;
- for (offset_type idx : matches)
- {
- if (prev != idx)
+ else
{
- if (!match_callback (idx))
- {
- result = false;
- break;
- }
- prev = idx;
+ components = split_name (name, split_style::DOT_STYLE);
+ /* Mark ordinary names as having an unknown language. This
+ is a hack to avoid problems with some Ada names. */
+ lang = (components.size () == 1) ? language_unknown : language_go;
}
- }
-
- /* Above we use a type wider than idx's for 'prev', since 0 and
- (offset_type)-1 are both possible values. */
- static_assert (sizeof (prev) > sizeof (offset_type), "");
-
- return result;
-}
-
-#if GDB_SELF_TEST
-namespace selftests { namespace dw2_expand_symtabs_matching {
-
-/* A mock .gdb_index/.debug_names-like name index table, enough to
- exercise dw2_expand_symtabs_matching_symbol, which works with the
- mapped_index_base interface. Builds an index from the symbol list
- passed as parameter to the constructor. */
-class mock_mapped_index : public mapped_gdb_index
-{
-public:
- mock_mapped_index (gdb::array_view<const char *> symbols)
- : m_symbol_table (symbols)
- {}
-
- DISABLE_COPY_AND_ASSIGN (mock_mapped_index);
-
- bool symbol_name_slot_invalid (offset_type idx) const override
- { return false; }
-
- /* Return the number of names in the symbol table. */
- size_t symbol_name_count () const override
- {
- return m_symbol_table.size ();
- }
-
- /* Get the name of the symbol at IDX in the symbol table. */
- const char *symbol_name_at
- (offset_type idx, dwarf2_per_objfile *per_objfile) const override
- {
- return m_symbol_table[idx];
- }
-
- quick_symbol_functions_up make_quick_functions () const override
- {
- return nullptr;
- }
-
-private:
- gdb::array_view<const char *> m_symbol_table;
-};
-
-/* Convenience function that converts a NULL pointer to a "<null>"
- string, to pass to print routines. */
-
-static const char *
-string_or_null (const char *str)
-{
- return str != NULL ? str : "<null>";
-}
-
-/* Check if a lookup_name_info built from
- NAME/MATCH_TYPE/COMPLETION_MODE matches the symbols in the mock
- index. EXPECTED_LIST is the list of expected matches, in expected
- matching order. If no match expected, then an empty list is
- specified. Returns true on success. On failure prints a warning
- indicating the file:line that failed, and returns false. */
-
-static bool
-check_match (const char *file, int line,
- mock_mapped_index &mock_index,
- const char *name, symbol_name_match_type match_type,
- bool completion_mode,
- std::initializer_list<const char *> expected_list,
- dwarf2_per_objfile *per_objfile)
-{
- lookup_name_info lookup_name (name, match_type, completion_mode);
-
- bool matched = true;
-
- auto mismatch = [&] (const char *expected_str,
- const char *got)
- {
- warning (_("%s:%d: match_type=%s, looking-for=\"%s\", "
- "expected=\"%s\", got=\"%s\"\n"),
- file, line,
- (match_type == symbol_name_match_type::FULL
- ? "FULL" : "WILD"),
- name, string_or_null (expected_str), string_or_null (got));
- matched = false;
- };
-
- auto expected_it = expected_list.begin ();
- auto expected_end = expected_list.end ();
-
- dw2_expand_symtabs_matching_symbol (mock_index, lookup_name,
- nullptr,
- [&] (offset_type idx)
- {
- const char *matched_name = mock_index.symbol_name_at (idx, per_objfile);
- const char *expected_str
- = expected_it == expected_end ? NULL : *expected_it++;
-
- if (expected_str == NULL || strcmp (expected_str, matched_name) != 0)
- mismatch (expected_str, matched_name);
- return true;
- }, per_objfile, nullptr);
-
- const char *expected_str
- = expected_it == expected_end ? NULL : *expected_it++;
- if (expected_str != NULL)
- mismatch (expected_str, NULL);
-
- return matched;
-}
-
-/* The symbols added to the mock mapped_index for testing (in
- canonical form). */
-static const char *test_symbols[] = {
- "function",
- "std::bar",
- "std::zfunction",
- "std::zfunction2",
- "w1::w2",
- "ns::foo<char*>",
- "ns::foo<int>",
- "ns::foo<long>",
- "ns2::tmpl<int>::foo2",
- "(anonymous namespace)::A::B::C",
-
- /* These are used to check that the increment-last-char in the
- matching algorithm for completion doesn't match "t1_fund" when
- completing "t1_func". */
- "t1_func",
- "t1_func1",
- "t1_fund",
- "t1_fund1",
-
- /* A UTF-8 name with multi-byte sequences to make sure that
- cp-name-parser understands this as a single identifier ("função"
- is "function" in PT). */
- (const char *)u8"u8função",
-
- /* Test a symbol name that ends with a 0xff character, which is a
- valid character in non-UTF-8 source character sets (e.g. Latin1
- 'ÿ'), and we can't rule out compilers allowing it in identifiers.
- We test this because the completion algorithm finds the upper
- bound of symbols by looking for the insertion point of
- "func"-with-last-character-incremented, i.e. "fund", and adding 1
- to 0xff should wraparound and carry to the previous character.
- See comments in make_sort_after_prefix_name. */
- "yfunc\377",
-
- /* Some more symbols with \377 (0xff). See above. */
- "\377",
- "\377\377123",
-
- /* A name with all sorts of complications. Starts with "z" to make
- it easier for the completion tests below. */
-#define Z_SYM_NAME \
- "z::std::tuple<(anonymous namespace)::ui*, std::bar<(anonymous namespace)::ui> >" \
- "::tuple<(anonymous namespace)::ui*, " \
- "std::default_delete<(anonymous namespace)::ui>, void>"
-
- Z_SYM_NAME
-};
-
-/* Returns true if the mapped_index_base::find_name_component_bounds
- method finds EXPECTED_SYMS in INDEX when looking for SEARCH_NAME,
- in completion mode. */
-
-static bool
-check_find_bounds_finds (mapped_gdb_index &index,
- const char *search_name,
- gdb::array_view<const char *> expected_syms,
- dwarf2_per_objfile *per_objfile)
-{
- lookup_name_info lookup_name (search_name,
- symbol_name_match_type::FULL, true);
-
- auto bounds = index.find_name_components_bounds (lookup_name,
- language_cplus,
- per_objfile);
-
- size_t distance = std::distance (bounds.first, bounds.second);
- if (distance != expected_syms.size ())
- return false;
-
- for (size_t exp_elem = 0; exp_elem < distance; exp_elem++)
- {
- auto nc_elem = bounds.first + exp_elem;
- const char *qualified = index.symbol_name_at (nc_elem->idx, per_objfile);
- if (strcmp (qualified, expected_syms[exp_elem]) != 0)
- return false;
- }
-
- return true;
-}
-
-/* Test the lower-level mapped_index::find_name_component_bounds
- method. */
-
-static void
-test_mapped_index_find_name_component_bounds ()
-{
- mock_mapped_index mock_index (test_symbols);
-
- mock_index.build_name_components (NULL /* per_objfile */);
-
- /* Test the lower-level mapped_index::find_name_component_bounds
- method in completion mode. */
- {
- static const char *expected_syms[] = {
- "t1_func",
- "t1_func1",
- };
-
- SELF_CHECK (check_find_bounds_finds
- (mock_index, "t1_func", expected_syms,
- NULL /* per_objfile */));
- }
-
- /* Check that the increment-last-char in the name matching algorithm
- for completion doesn't get confused with Ansi1 'ÿ' / 0xff. See
- make_sort_after_prefix_name. */
- {
- static const char *expected_syms1[] = {
- "\377",
- "\377\377123",
- };
- SELF_CHECK (check_find_bounds_finds
- (mock_index, "\377", expected_syms1, NULL /* per_objfile */));
-
- static const char *expected_syms2[] = {
- "\377\377123",
- };
- SELF_CHECK (check_find_bounds_finds
- (mock_index, "\377\377", expected_syms2,
- NULL /* per_objfile */));
- }
-}
-
-/* Test dw2_expand_symtabs_matching_symbol. */
-
-static void
-test_dw2_expand_symtabs_matching_symbol ()
-{
- mock_mapped_index mock_index (test_symbols);
-
- /* We let all tests run until the end even if some fails, for debug
- convenience. */
- bool any_mismatch = false;
-
- /* Create the expected symbols list (an initializer_list). Needed
- because lists have commas, and we need to pass them to CHECK,
- which is a macro. */
-#define EXPECT(...) { __VA_ARGS__ }
-
- /* Wrapper for check_match that passes down the current
- __FILE__/__LINE__. */
-#define CHECK_MATCH(NAME, MATCH_TYPE, COMPLETION_MODE, EXPECTED_LIST) \
- any_mismatch |= !check_match (__FILE__, __LINE__, \
- mock_index, \
- NAME, MATCH_TYPE, COMPLETION_MODE, \
- EXPECTED_LIST, NULL)
-
- /* Identity checks. */
- for (const char *sym : test_symbols)
- {
- /* Should be able to match all existing symbols. */
- CHECK_MATCH (sym, symbol_name_match_type::FULL, false,
- EXPECT (sym));
-
- /* Should be able to match all existing symbols with
- parameters. */
- std::string with_params = std::string (sym) + "(int)";
- CHECK_MATCH (with_params.c_str (), symbol_name_match_type::FULL, false,
- EXPECT (sym));
-
- /* Should be able to match all existing symbols with
- parameters and qualifiers. */
- with_params = std::string (sym) + " ( int ) const";
- CHECK_MATCH (with_params.c_str (), symbol_name_match_type::FULL, false,
- EXPECT (sym));
-
- /* This should really find sym, but cp-name-parser.y doesn't
- know about lvalue/rvalue qualifiers yet. */
- with_params = std::string (sym) + " ( int ) &&";
- CHECK_MATCH (with_params.c_str (), symbol_name_match_type::FULL, false,
- {});
- }
-
- /* Check that the name matching algorithm for completion doesn't get
- confused with Latin1 'ÿ' / 0xff. See
- make_sort_after_prefix_name. */
- {
- static const char str[] = "\377";
- CHECK_MATCH (str, symbol_name_match_type::FULL, true,
- EXPECT ("\377", "\377\377123"));
- }
-
- /* Check that the increment-last-char in the matching algorithm for
- completion doesn't match "t1_fund" when completing "t1_func". */
- {
- static const char str[] = "t1_func";
- CHECK_MATCH (str, symbol_name_match_type::FULL, true,
- EXPECT ("t1_func", "t1_func1"));
- }
-
- /* Check that completion mode works at each prefix of the expected
- symbol name. */
- {
- static const char str[] = "function(int)";
- size_t len = strlen (str);
- std::string lookup;
-
- for (size_t i = 1; i < len; i++)
- {
- lookup.assign (str, i);
- CHECK_MATCH (lookup.c_str (), symbol_name_match_type::FULL, true,
- EXPECT ("function"));
- }
- }
-
- /* While "w" is a prefix of both components, the match function
- should still only be called once. */
- {
- CHECK_MATCH ("w", symbol_name_match_type::FULL, true,
- EXPECT ("w1::w2"));
- CHECK_MATCH ("w", symbol_name_match_type::WILD, true,
- EXPECT ("w1::w2"));
- }
-
- /* Same, with a "complicated" symbol. */
- {
- static const char str[] = Z_SYM_NAME;
- size_t len = strlen (str);
- std::string lookup;
-
- for (size_t i = 1; i < len; i++)
- {
- lookup.assign (str, i);
- CHECK_MATCH (lookup.c_str (), symbol_name_match_type::FULL, true,
- EXPECT (Z_SYM_NAME));
- }
- }
-
- /* In FULL mode, an incomplete symbol doesn't match. */
- {
- CHECK_MATCH ("std::zfunction(int", symbol_name_match_type::FULL, false,
- {});
- }
-
- /* A complete symbol with parameters matches any overload, since the
- index has no overload info. */
- {
- CHECK_MATCH ("std::zfunction(int)", symbol_name_match_type::FULL, true,
- EXPECT ("std::zfunction", "std::zfunction2"));
- CHECK_MATCH ("zfunction(int)", symbol_name_match_type::WILD, true,
- EXPECT ("std::zfunction", "std::zfunction2"));
- CHECK_MATCH ("zfunc", symbol_name_match_type::WILD, true,
- EXPECT ("std::zfunction", "std::zfunction2"));
- }
-
- /* Check that whitespace is ignored appropriately. A symbol with a
- template argument list. */
- {
- static const char expected[] = "ns::foo<int>";
- CHECK_MATCH ("ns :: foo < int > ", symbol_name_match_type::FULL, false,
- EXPECT (expected));
- CHECK_MATCH ("foo < int > ", symbol_name_match_type::WILD, false,
- EXPECT (expected));
- }
-
- /* Check that whitespace is ignored appropriately. A symbol with a
- template argument list that includes a pointer. */
- {
- static const char expected[] = "ns::foo<char*>";
- /* Try both completion and non-completion modes. */
- static const bool completion_mode[2] = {false, true};
- for (size_t i = 0; i < 2; i++)
- {
- CHECK_MATCH ("ns :: foo < char * >", symbol_name_match_type::FULL,
- completion_mode[i], EXPECT (expected));
- CHECK_MATCH ("foo < char * >", symbol_name_match_type::WILD,
- completion_mode[i], EXPECT (expected));
-
- CHECK_MATCH ("ns :: foo < char * > (int)", symbol_name_match_type::FULL,
- completion_mode[i], EXPECT (expected));
- CHECK_MATCH ("foo < char * > (int)", symbol_name_match_type::WILD,
- completion_mode[i], EXPECT (expected));
- }
- }
-
- {
- /* Check method qualifiers are ignored. */
- static const char expected[] = "ns::foo<char*>";
- CHECK_MATCH ("ns :: foo < char * > ( int ) const",
- symbol_name_match_type::FULL, true, EXPECT (expected));
- CHECK_MATCH ("ns :: foo < char * > ( int ) &&",
- symbol_name_match_type::FULL, true, EXPECT (expected));
- CHECK_MATCH ("foo < char * > ( int ) const",
- symbol_name_match_type::WILD, true, EXPECT (expected));
- CHECK_MATCH ("foo < char * > ( int ) &&",
- symbol_name_match_type::WILD, true, EXPECT (expected));
- }
-
- /* Test lookup names that don't match anything. */
- {
- CHECK_MATCH ("bar2", symbol_name_match_type::WILD, false,
- {});
-
- CHECK_MATCH ("doesntexist", symbol_name_match_type::FULL, false,
- {});
- }
-
- /* Some wild matching tests, exercising "(anonymous namespace)",
- which should not be confused with a parameter list. */
- {
- static const char *syms[] = {
- "A::B::C",
- "B::C",
- "C",
- "A :: B :: C ( int )",
- "B :: C ( int )",
- "C ( int )",
- };
-
- for (const char *s : syms)
- {
- CHECK_MATCH (s, symbol_name_match_type::WILD, false,
- EXPECT ("(anonymous namespace)::A::B::C"));
- }
- }
-
- {
- static const char expected[] = "ns2::tmpl<int>::foo2";
- CHECK_MATCH ("tmp", symbol_name_match_type::WILD, true,
- EXPECT (expected));
- CHECK_MATCH ("tmpl<", symbol_name_match_type::WILD, true,
- EXPECT (expected));
- }
-
- SELF_CHECK (!any_mismatch);
-
-#undef EXPECT
-#undef CHECK_MATCH
-}
-
-static void
-run_test ()
-{
- test_mapped_index_find_name_component_bounds ();
- test_dw2_expand_symtabs_matching_symbol ();
-}
-
-}} /* namespace selftests::dw2_expand_symtabs_matching */
-
-#endif /* GDB_SELF_TEST */
-
-struct dwarf2_gdb_index : public dwarf2_base_index_functions
-{
- /* This dumps minimal information about the index.
- It is called via "mt print objfiles".
- One use is to verify .gdb_index has been loaded by the
- gdb.dwarf2/gdb-index.exp testcase. */
- void dump (struct objfile *objfile) override;
-
- bool expand_symtabs_matching
- (struct objfile *objfile,
- expand_symtabs_file_matcher file_matcher,
- const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
- block_search_flags search_flags,
- domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher) override;
-};
-
-/* This dumps minimal information about the index.
- It is called via "mt print objfiles".
- One use is to verify .gdb_index has been loaded by the
- gdb.dwarf2/gdb-index.exp testcase. */
-
-void
-dwarf2_gdb_index::dump (struct objfile *objfile)
-{
- dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
-
- mapped_gdb_index *index = (gdb::checked_static_cast<mapped_gdb_index *>
- (per_objfile->per_bfd->index_table.get ()));
- gdb_printf (".gdb_index: version %d\n", index->version);
- gdb_printf ("\n");
-}
-
-/* Helper for dw2_expand_matching symtabs. Called on each symbol
- matched, to expand corresponding CUs that were marked. IDX is the
- index of the symbol name that matched. */
-
-static bool
-dw2_expand_marked_cus (dwarf2_per_objfile *per_objfile, offset_type idx,
- expand_symtabs_file_matcher file_matcher,
- expand_symtabs_expansion_listener expansion_notify,
- block_search_flags search_flags,
- domain_search_flags kind,
- expand_symtabs_lang_matcher lang_matcher)
-{
- offset_type vec_len, vec_idx;
- bool global_seen = false;
- mapped_gdb_index &index
- = *(gdb::checked_static_cast<mapped_gdb_index *>
- (per_objfile->per_bfd->index_table.get ()));
-
- offset_view vec (index.constant_pool.slice (index.symbol_vec_index (idx)));
- vec_len = vec[0];
- for (vec_idx = 0; vec_idx < vec_len; ++vec_idx)
- {
- offset_type cu_index_and_attrs = vec[vec_idx + 1];
- /* This value is only valid for index versions >= 7. */
- int is_static = GDB_INDEX_SYMBOL_STATIC_VALUE (cu_index_and_attrs);
- gdb_index_symbol_kind symbol_kind =
- GDB_INDEX_SYMBOL_KIND_VALUE (cu_index_and_attrs);
- int cu_index = GDB_INDEX_CU_VALUE (cu_index_and_attrs);
- /* Only check the symbol attributes if they're present.
- Indices prior to version 7 don't record them,
- and indices >= 7 may elide them for certain symbols
- (gold does this). */
- int attrs_valid =
- (index.version >= 7
- && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
-
- /* Work around gold/15646. */
- if (attrs_valid
- && !is_static
- && symbol_kind == GDB_INDEX_SYMBOL_KIND_TYPE)
+ std::vector<cooked_index_entry *> these_entries;
+ offset_view vec (constant_pool.slice (symbol_vec_index (idx)));
+ offset_type vec_len = vec[0];
+ bool global_seen = false;
+ for (offset_type vec_idx = 0; vec_idx < vec_len; ++vec_idx)
{
- if (global_seen)
+ offset_type cu_index_and_attrs = vec[vec_idx + 1];
+ gdb_index_symbol_kind symbol_kind
+ = GDB_INDEX_SYMBOL_KIND_VALUE (cu_index_and_attrs);
+ /* Only use a symbol if the attributes are present. Indices
+ prior to version 7 don't record them, and indices >= 7
+ may elide them for certain symbols (gold does this). */
+ if (symbol_kind == GDB_INDEX_SYMBOL_KIND_NONE)
continue;
- global_seen = true;
- }
+ int is_static = GDB_INDEX_SYMBOL_STATIC_VALUE (cu_index_and_attrs);
- /* Only check the symbol's kind if it has one. */
- if (attrs_valid)
- {
- if (is_static)
- {
- if ((search_flags & SEARCH_STATIC_BLOCK) == 0)
- continue;
- }
- else
+ int cu_index = GDB_INDEX_CU_VALUE (cu_index_and_attrs);
+ /* Don't crash on bad data. */
+ if (cu_index >= units.size ())
{
- if ((search_flags & SEARCH_GLOBAL_BLOCK) == 0)
- continue;
+ complaint (_(".gdb_index entry has bad CU index"
+ " [in module %s]"),
+ objfile_name (per_objfile->objfile));
+ continue;
}
+ dwarf2_per_cu *per_cu = units[cu_index];
- domain_search_flags mask = 0;
+ enum language this_lang = lang;
+ dwarf_tag tag;
switch (symbol_kind)
{
case GDB_INDEX_SYMBOL_KIND_VARIABLE:
- mask = SEARCH_VAR_DOMAIN;
+ tag = DW_TAG_variable;
break;
case GDB_INDEX_SYMBOL_KIND_FUNCTION:
- mask = SEARCH_FUNCTION_DOMAIN;
+ tag = DW_TAG_subprogram;
break;
case GDB_INDEX_SYMBOL_KIND_TYPE:
- mask = SEARCH_TYPE_DOMAIN | SEARCH_STRUCT_DOMAIN;
+ if (is_static)
+ tag = (dwarf_tag) DW_TAG_GDB_INDEX_TYPE;
+ else
+ {
+ /* Work around gold/15646. */
+ if (global_seen)
+ continue;
+ global_seen = true;
+
+ tag = DW_TAG_structure_type;
+ this_lang = language_cplus;
+ }
break;
+ /* The "default" should not happen, but we mention it to
+ avoid an uninitialized warning. */
+ default:
case GDB_INDEX_SYMBOL_KIND_OTHER:
- mask = SEARCH_MODULE_DOMAIN;
+ tag = (dwarf_tag) DW_TAG_GDB_INDEX_OTHER;
break;
}
- if ((kind & mask) == 0)
- continue;
- }
- /* Don't crash on bad data. */
- if (cu_index >= per_objfile->per_bfd->all_units.size ())
- {
- complaint (_(".gdb_index entry has bad CU index"
- " [in module %s]"), objfile_name (per_objfile->objfile));
- continue;
+ cooked_index_flag flags = 0;
+ if (is_static)
+ flags |= IS_STATIC;
+ if (main_name != nullptr
+ && tag == DW_TAG_subprogram
+ && strcmp (name, main_name) == 0)
+ {
+ flags |= IS_MAIN;
+ this_lang = main_lang;
+ /* Don't bother looking for another. */
+ main_name = nullptr;
+ }
+
+ /* Note that this assumes the final component ends in \0. */
+ cooked_index_entry *entry = result.add (per_cu->sect_off, tag,
+ flags, this_lang,
+ components.back ().data (),
+ nullptr, per_cu);
+ /* Don't bother pushing if we do not need a parent. */
+ if (components.size () > 1)
+ these_entries.push_back (entry);
+
+ /* We don't care exactly which entry ends up in this
+ map. */
+ by_name[std::string_view (name)] = entry;
}
- dwarf2_per_cu *per_cu = per_objfile->per_bfd->get_cu (cu_index);
+ if (components.size () > 1)
+ {
+ std::string_view penultimate = components[components.size () - 2];
+ std::string_view prefix (name, &penultimate.back () + 1 - name);
- if (!dw2_expand_symtabs_matching_one (per_cu, per_objfile, file_matcher,
- expansion_notify, lang_matcher))
- return false;
+ need_parents.emplace_back (prefix, std::move (these_entries));
+ }
}
- return true;
+ for (const auto &[prefix, entries] : need_parents)
+ {
+ auto iter = by_name.find (prefix);
+ /* If we can't find the parent entry, just lose. It should
+ always be there. We could synthesize it from the components,
+ if we kept those, but that seems like overkill. */
+ if (iter != by_name.end ())
+ {
+ for (cooked_index_entry *entry : entries)
+ entry->set_parent (iter->second);
+ }
+ }
}
-bool
-dwarf2_gdb_index::expand_symtabs_matching
- (objfile *objfile,
- expand_symtabs_file_matcher file_matcher,
- const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
- block_search_flags search_flags,
- domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher)
+/* The worker that reads a mapped index and fills in a
+ cooked_index_worker_result. */
+
+class gdb_index_worker : public cooked_index_worker
{
- dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
+public:
- dw_expand_symtabs_matching_file_matcher (per_objfile, file_matcher);
+ gdb_index_worker (dwarf2_per_objfile *per_objfile,
+ std::unique_ptr<mapped_gdb_index> map)
+ : cooked_index_worker (per_objfile),
+ map (std::move (map))
+ { }
- /* This invariant is documented in quick-functions.h. */
- gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr);
- if (lookup_name == nullptr)
- {
- for (dwarf2_per_cu *per_cu : all_units_range (per_objfile->per_bfd))
- {
- QUIT;
+ void do_reading () override;
- if (!dw2_expand_symtabs_matching_one (per_cu, per_objfile,
- file_matcher,
- expansion_notify,
- lang_matcher))
- return false;
- }
- return true;
- }
+ /* The map we're reading. */
+ std::unique_ptr<mapped_gdb_index> map;
+};
- mapped_gdb_index &index
- = *(gdb::checked_static_cast<mapped_gdb_index *>
- (per_objfile->per_bfd->index_table.get ()));
+void
+gdb_index_worker::do_reading ()
+{
+ complaint_interceptor complaint_handler;
+ map->build_name_components (m_per_objfile);
- bool result
- = dw2_expand_symtabs_matching_symbol (index, *lookup_name,
- symbol_matcher,
- [&] (offset_type idx)
- {
- if (!dw2_expand_marked_cus (per_objfile, idx, file_matcher,
- expansion_notify, search_flags, domain,
- lang_matcher))
- return false;
- return true;
- }, per_objfile, lang_matcher);
+ m_results.push_back (std::move (map->result));
+ m_results[0].done_reading (complaint_handler.release ());
- return result;
-}
+ /* No longer needed. */
+ map.reset ();
-quick_symbol_functions_up
-mapped_gdb_index::make_quick_functions () const
-{
- return quick_symbol_functions_up (new dwarf2_gdb_index);
+ done_reading ();
+
+ bfd_thread_cleanup ();
}
/* A helper function that reads the .gdb_index from BUFFER and fills
@@ -1206,11 +431,9 @@ read_gdb_index_from_buffer (const char *filename,
/* Version check. */
offset_type version = metadata[0];
- /* Versions earlier than 3 emitted every copy of a psymbol. This
- causes the index to behave very poorly for certain requests. Version 3
- contained incomplete addrmap. So, it seems better to just ignore such
- indices. */
- if (version < 4)
+ /* GDB now requires the symbol attributes, which were added in
+ version 7. */
+ if (version < 7)
{
static int warning_printed = 0;
if (!warning_printed)
@@ -1221,30 +444,6 @@ read_gdb_index_from_buffer (const char *filename,
}
return 0;
}
- /* Index version 4 uses a different hash function than index version
- 5 and later.
-
- Versions earlier than 6 did not emit psymbols for inlined
- functions. Using these files will cause GDB not to be able to
- set breakpoints on inlined functions by name, so we ignore these
- indices unless the user has done
- "set use-deprecated-index-sections on". */
- if (version < 6 && !deprecated_ok)
- {
- static int warning_printed = 0;
- if (!warning_printed)
- {
- warning (_("\
-Skipping deprecated .gdb_index section in %s.\n\
-Do \"%ps\" before the file is read\n\
-to use the section anyway."),
- filename,
- styled_string (command_style.style (),
- "set use-deprecated-index-sections on"));
- warning_printed = 1;
- }
- return 0;
- }
/* Version 7 indices generated by gold refer to the CU for a symbol instead
of the TU (for symbols coming from TUs),
http://sourceware.org/bugzilla/show_bug.cgi?id=15021.
@@ -1313,7 +512,7 @@ static void
create_cus_from_gdb_index_list (dwarf2_per_bfd *per_bfd,
const gdb_byte *cu_list, offset_type n_elements,
struct dwarf2_section_info *section,
- int is_dwz)
+ int is_dwz, std::vector<dwarf2_per_cu *> &units)
{
for (offset_type i = 0; i < n_elements; i += 2)
{
@@ -1324,10 +523,10 @@ create_cus_from_gdb_index_list (dwarf2_per_bfd *per_bfd,
ULONGEST length = extract_unsigned_integer (cu_list + 8, 8, BFD_ENDIAN_LITTLE);
cu_list += 2 * 8;
- per_bfd->all_units.emplace_back (per_bfd->allocate_per_cu (section,
- sect_off,
- length,
- is_dwz));
+ dwarf2_per_cu_up per_cu = per_bfd->allocate_per_cu (section, sect_off,
+ length, is_dwz);
+ units.emplace_back (per_cu.get ());
+ per_bfd->all_units.emplace_back (std::move (per_cu));
}
}
@@ -1337,20 +536,21 @@ create_cus_from_gdb_index_list (dwarf2_per_bfd *per_bfd,
static void
create_cus_from_gdb_index (dwarf2_per_bfd *per_bfd,
const gdb_byte *cu_list, offset_type cu_list_elements,
+ std::vector<dwarf2_per_cu *> &units,
const gdb_byte *dwz_list, offset_type dwz_elements)
{
gdb_assert (per_bfd->all_units.empty ());
per_bfd->all_units.reserve ((cu_list_elements + dwz_elements) / 2);
create_cus_from_gdb_index_list (per_bfd, cu_list, cu_list_elements,
- &per_bfd->infos[0], 0);
+ &per_bfd->infos[0], 0, units);
if (dwz_elements == 0)
return;
dwz_file *dwz = per_bfd->get_dwz_file ();
create_cus_from_gdb_index_list (per_bfd, dwz_list, dwz_elements,
- &dwz->info, 1);
+ &dwz->info, 1, units);
}
/* Create the signatured type hash table from the index. */
@@ -1358,7 +558,8 @@ create_cus_from_gdb_index (dwarf2_per_bfd *per_bfd,
static void
create_signatured_type_table_from_gdb_index
(dwarf2_per_bfd *per_bfd, struct dwarf2_section_info *section,
- const gdb_byte *bytes, offset_type elements)
+ const gdb_byte *bytes, offset_type elements,
+ std::vector<dwarf2_per_cu *> &units)
{
signatured_type_set sig_types_hash;
@@ -1382,26 +583,60 @@ create_signatured_type_table_from_gdb_index
sig_type->type_offset_in_tu = type_offset_in_tu;
sig_types_hash.emplace (sig_type.get ());
+ units.emplace_back (sig_type.get ());
per_bfd->all_units.emplace_back (sig_type.release ());
}
per_bfd->signatured_types = std::move (sig_types_hash);
}
-/* Read the address map data from the mapped GDB index. */
+/* Read the address map data from the mapped GDB index. Return true if no
+ errors were found, otherwise return false. */
-static void
+static bool
create_addrmap_from_gdb_index (dwarf2_per_objfile *per_objfile,
mapped_gdb_index *index)
{
- dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
- const gdb_byte *iter, *end;
+ objfile *objfile = per_objfile->objfile;
addrmap_mutable mutable_map;
- iter = index->address_table.data ();
- end = iter + index->address_table.size ();
+ /* Build an unrelocated address map of the sections in this objfile. */
+ addrmap_mutable sect_map;
+ for (obj_section &s : objfile->sections ())
+ {
+ if (s.addr_unrel () >= s.endaddr_unrel ())
+ continue;
+
+ CORE_ADDR start = CORE_ADDR (s.addr_unrel ());
+ CORE_ADDR end_inclusive = CORE_ADDR (s.endaddr_unrel ()) - 1;
+ sect_map.set_empty (start, end_inclusive, &s);
+ }
+
+ auto find_section
+ = [&] (ULONGEST addr, struct obj_section *&cached_section)
+ {
+ if (cached_section != nullptr
+ && cached_section->contains (unrelocated_addr (addr)))
+ return cached_section;
+
+ cached_section = (struct obj_section *) sect_map.find (addr);
+ return cached_section;
+ };
+
+ auto invalid_range_warning = [&] (ULONGEST lo, ULONGEST hi)
+ {
+ warning (_(".gdb_index address table has invalid range (%s - %s),"
+ " ignoring .gdb_index"),
+ hex_string (lo), hex_string (hi));
+ return false;
+ };
+
+ /* Cache the section for possible re-use on the next entry. */
+ struct obj_section *prev_sect = nullptr;
+ const gdb_byte *iter = index->address_table.data ();
+ const gdb_byte *end = iter + index->address_table.size ();
while (iter < end)
{
ULONGEST hi, lo, cu_index;
@@ -1412,40 +647,51 @@ create_addrmap_from_gdb_index (dwarf2_per_objfile *per_objfile,
cu_index = extract_unsigned_integer (iter, 4, BFD_ENDIAN_LITTLE);
iter += 4;
- if (lo > hi)
+ if (lo >= hi)
+ return invalid_range_warning (lo, hi);
+
+ if (cu_index >= index->units.size ())
{
- complaint (_(".gdb_index address table has invalid range (%s - %s)"),
- hex_string (lo), hex_string (hi));
- continue;
+ warning (_(".gdb_index address table has invalid CU number %u,"
+ " ignoring .gdb_index"),
+ (unsigned) cu_index);
+ return false;
}
- if (cu_index >= per_bfd->all_units.size ())
+ /* Variable hi is the exclusive upper bound, get the inclusive one. */
+ CORE_ADDR hi_incl = hi - 1;
+
+ struct obj_section *lo_sect = find_section (lo, prev_sect);
+ struct obj_section *hi_sect = find_section (hi_incl, prev_sect);
+ if (lo_sect == nullptr || hi_sect == nullptr)
+ return invalid_range_warning (lo, hi);
+
+ bool full_range_p
+ = mutable_map.set_empty (lo, hi_incl, index->units[cu_index]);
+ if (!full_range_p)
{
- complaint (_(".gdb_index address table has invalid CU number %u"),
- (unsigned) cu_index);
- continue;
+ warning (_(".gdb_index address table has a range (%s - %s) that"
+ " overlaps with an earlier range, ignoring .gdb_index"),
+ hex_string (lo), hex_string (hi));
+ return false;
}
-
- mutable_map.set_empty (lo, hi - 1, per_bfd->get_cu (cu_index));
}
- index->index_addrmap
- = new (&per_bfd->obstack) addrmap_fixed (&per_bfd->obstack, &mutable_map);
-}
+ index->result.set_addrmap (std::move (mutable_map));
-/* Sets the name and language of the main function from the shortcut table. */
+ return true;
+}
-static void
-set_main_name_from_gdb_index (dwarf2_per_objfile *per_objfile,
- mapped_gdb_index *index)
+void
+mapped_gdb_index::set_main_name (dwarf2_per_objfile *per_objfile)
{
const auto expected_size = 2 * sizeof (offset_type);
- if (index->shortcut_table.size () < expected_size)
+ if (this->shortcut_table.size () < expected_size)
/* The data in the section is not present, is corrupted or is in a version
we don't know about. Regardless, we can't make use of it. */
return;
- auto ptr = index->shortcut_table.data ();
+ auto ptr = this->shortcut_table.data ();
const auto dw_lang = extract_unsigned_integer (ptr, 4, BFD_ENDIAN_LITTLE);
if (dw_lang >= DW_LANG_hi_user)
{
@@ -1461,13 +707,11 @@ set_main_name_from_gdb_index (dwarf2_per_objfile *per_objfile,
}
ptr += 4;
- const auto lang = dwarf_lang_to_enum_language (dw_lang);
+ main_lang = dwarf_lang_to_enum_language (dw_lang);
const auto name_offset = extract_unsigned_integer (ptr,
sizeof (offset_type),
BFD_ENDIAN_LITTLE);
- const auto name = (const char *) (index->constant_pool.data () + name_offset);
-
- set_objfile_main_name (per_objfile->objfile, name, (enum language) lang);
+ main_name = (const char *) (this->constant_pool.data () + name_offset);
}
/* See read-gdb-index.h. */
@@ -1482,6 +726,7 @@ dwarf2_read_gdb_index
offset_type cu_list_elements, types_list_elements, dwz_list_elements = 0;
struct objfile *objfile = per_objfile->objfile;
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
+ scoped_remove_all_units remove_all_units (*per_bfd);
gdb::array_view<const gdb_byte> main_index_contents
= get_gdb_index_contents (objfile, per_bfd);
@@ -1528,8 +773,8 @@ dwarf2_read_gdb_index
}
}
- create_cus_from_gdb_index (per_bfd, cu_list, cu_list_elements, dwz_list,
- dwz_list_elements);
+ create_cus_from_gdb_index (per_bfd, cu_list, cu_list_elements, map->units,
+ dwz_list, dwz_list_elements);
if (types_list_elements)
{
@@ -1537,10 +782,7 @@ dwarf2_read_gdb_index
an index. */
if (per_bfd->infos.size () > 1
|| per_bfd->types.size () > 1)
- {
- per_bfd->all_units.clear ();
- return false;
- }
+ return false;
dwarf2_section_info *section
= (per_bfd->types.size () == 1
@@ -1548,24 +790,30 @@ dwarf2_read_gdb_index
: &per_bfd->infos[0]);
create_signatured_type_table_from_gdb_index (per_bfd, section, types_list,
- types_list_elements);
+ types_list_elements,
+ map->units);
}
finalize_all_units (per_bfd);
- create_addrmap_from_gdb_index (per_objfile, map.get ());
+ if (!create_addrmap_from_gdb_index (per_objfile, map.get ()))
+ return false;
+
+ map->set_main_name (per_objfile);
- set_main_name_from_gdb_index (per_objfile, map.get ());
+ int version = map->version;
+ auto worker = std::make_unique<gdb_index_worker> (per_objfile,
+ std::move (map));
+ auto idx = std::make_unique<cooked_gdb_index> (std::move (worker),
+ version);
- per_bfd->index_table = std::move (map);
+ per_bfd->start_reading (std::move (idx));
+ remove_all_units.disable ();
return true;
}
-void _initialize_read_gdb_index ();
-
-void
-_initialize_read_gdb_index ()
+INIT_GDB_FILE (read_gdb_index)
{
add_setshow_boolean_cmd ("use-deprecated-index-sections",
no_class, &use_deprecated_index_sections, _("\
@@ -1578,9 +826,4 @@ Warning: This option must be enabled before gdb reads the file."),
NULL,
NULL,
&setlist, &showlist);
-
-#if GDB_SELF_TEST
- selftests::register_test ("dw2_expand_symtabs_matching",
- selftests::dw2_expand_symtabs_matching::run_test);
-#endif
}
diff --git a/gdb/dwarf2/read-gdb-index.h b/gdb/dwarf2/read-gdb-index.h
index e38a831..c8f1fd0 100644
--- a/gdb/dwarf2/read-gdb-index.h
+++ b/gdb/dwarf2/read-gdb-index.h
@@ -1,6 +1,6 @@
/* Reading code for .gdb_index
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -27,6 +27,20 @@ struct dwarf2_per_objfile;
struct dwz_file;
struct objfile;
+/* .gdb_index doesn't distinguish between the various "other" symbols
+ -- but the symbol search machinery really wants to. For example,
+ an imported decl is "other" but is really a namespace and thus in
+ TYPE_DOMAIN; whereas a Fortran module is also "other" but is in the
+ MODULE_DOMAIN. We use this value internally to represent the
+ "other" case so that matching can work. The exact value does not
+ matter, all that matters here is that it won't overlap with any
+ symbol that gdb might create. */
+#define DW_TAG_GDB_INDEX_OTHER 0xffff
+
+/* Similarly, .gdb_index can't distinguish between the type and struct
+ domains. This is a special tag that inhabits both. */
+#define DW_TAG_GDB_INDEX_TYPE 0xfffe
+
/* Callback types for dwarf2_read_gdb_index. */
typedef gdb::function_view
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 17f06ff..955893c 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1,6 +1,6 @@
/* DWARF 2 debugging format support for GDB.
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
Inc. with support from Florida State University (under contract
@@ -31,13 +31,14 @@
#include "dwarf2/abbrev.h"
#include "dwarf2/aranges.h"
#include "dwarf2/attribute.h"
-#include "dwarf2/comp-unit-head.h"
+#include "dwarf2/unit-head.h"
#include "dwarf2/cooked-index-worker.h"
#include "dwarf2/cooked-indexer.h"
#include "dwarf2/cu.h"
#include "dwarf2/index-cache.h"
#include "dwarf2/leb.h"
#include "dwarf2/line-header.h"
+#include "dwarf2/line-program.h"
#include "dwarf2/dwz.h"
#include "dwarf2/macro.h"
#include "dwarf2/die.h"
@@ -51,7 +52,8 @@
#include "elf-bfd.h"
#include "event-top.h"
#include "exceptions.h"
-#include "gdbsupport/task-group.h"
+#include "gdbsupport/parallel-for.h"
+#include "maint.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "objfiles.h"
@@ -91,7 +93,6 @@
#include "count-one-bits.h"
#include "dwarf2/abbrev-table-cache.h"
#include "cooked-index.h"
-#include "gdbsupport/thread-pool.h"
#include "run-on-main-thread.h"
#include "dwarf2/parent-map.h"
#include "dwarf2/error.h"
@@ -146,7 +147,7 @@ static const registry<bfd>::key<dwarf2_per_bfd> dwarf2_per_bfd_bfd_data_key;
static const registry<objfile>::key<dwarf2_per_bfd>
dwarf2_per_bfd_objfile_data_key;
-/* The "aclass" indices for various kinds of computed DWARF symbols. */
+/* The "loc_class" indices for various kinds of computed DWARF symbols. */
static int dwarf2_locexpr_index;
static int dwarf2_loclist_index;
@@ -279,7 +280,7 @@ struct dwo_sections
struct dwarf2_section_info str;
struct dwarf2_section_info str_offsets;
/* In the case of a virtual DWO file, these two are unused. */
- struct dwarf2_section_info info;
+ std::vector<dwarf2_section_info> infos;
std::vector<dwarf2_section_info> types;
};
@@ -288,24 +289,29 @@ struct dwo_sections
struct dwo_unit
{
/* Backlink to the containing struct dwo_file. */
- struct dwo_file *dwo_file;
+ struct dwo_file *dwo_file = nullptr;
/* The "id" that distinguishes this CU/TU.
.debug_info calls this "dwo_id", .debug_types calls this "signature".
Since signatures came first, we stick with it for consistency. */
- ULONGEST signature;
+ ULONGEST signature = 0;
/* The section this CU/TU lives in, in the DWO file. */
- struct dwarf2_section_info *section;
+ dwarf2_section_info *section = nullptr;
+
+ /* This is set if SECTION is owned by this dwo_unit. */
+ dwarf2_section_info_up section_holder;
/* Same as dwarf2_per_cu::{sect_off,length} but in the DWO section. */
- sect_offset sect_off;
- unsigned int length;
+ sect_offset sect_off {};
+ unsigned int length = 0;
/* For types, offset in the type's DIE of the type defined by this TU. */
cu_offset type_offset_in_tu;
};
+using dwo_unit_up = std::unique_ptr<dwo_unit>;
+
/* Hash function for dwo_unit objects, based on the signature. */
struct dwo_unit_hash
@@ -315,7 +321,7 @@ struct dwo_unit_hash
std::size_t operator() (ULONGEST signature) const noexcept
{ return signature; }
- std::size_t operator() (const dwo_unit *unit) const noexcept
+ std::size_t operator() (const dwo_unit_up &unit) const noexcept
{ return (*this) (unit->signature); }
};
@@ -329,16 +335,16 @@ struct dwo_unit_eq
{
using is_transparent = void;
- bool operator() (ULONGEST sig, const dwo_unit *unit) const noexcept
+ bool operator() (ULONGEST sig, const dwo_unit_up &unit) const noexcept
{ return sig == unit->signature; }
- bool operator() (const dwo_unit *a, const dwo_unit *b) const noexcept
+ bool operator() (const dwo_unit_up &a, const dwo_unit_up &b) const noexcept
{ return (*this) (a->signature, b); }
};
/* Set of dwo_unit object, using their signature as identity. */
-using dwo_unit_set = gdb::unordered_set<dwo_unit *, dwo_unit_hash, dwo_unit_eq>;
+using dwo_unit_set = gdb::unordered_set<dwo_unit_up, dwo_unit_hash, dwo_unit_eq>;
/* include/dwarf2.h defines the DWP section codes.
It defines a max value but it doesn't define a min value, which we
@@ -598,6 +604,9 @@ struct dwp_file
dwo_unit_set loaded_cus;
dwo_unit_set loaded_tus;
+ /* Mutex to synchronize access to LOADED_CUS and LOADED_TUS. */
+ gdb::mutex loaded_cutus_lock;
+
/* Table to map ELF section numbers to their sections.
This is only needed for the DWP V1 file format. */
unsigned int num_sections = 0;
@@ -622,15 +631,21 @@ struct variant_field
/* A variant can contain other variant parts. */
std::vector<variant_part_builder> variant_parts;
- /* If we see a DW_TAG_variant, then this will be set if this is the
- default branch. */
- bool default_branch = false;
/* If we see a DW_AT_discr_value, then this will be the discriminant
- value. */
- ULONGEST discriminant_value = 0;
+ value. Just the attribute is stored here, because we have to
+ defer deciding whether the value is signed or unsigned until the
+ end. */
+ const attribute *discriminant_attr = nullptr;
/* If we see a DW_AT_discr_list, then this is a pointer to the list
data. */
struct dwarf_block *discr_list_data = nullptr;
+
+ /* If both DW_AT_discr_value and DW_AT_discr_list are absent, then
+ this is the default branch. */
+ bool is_default () const
+ {
+ return discriminant_attr == nullptr && discr_list_data == nullptr;
+ }
};
/* This represents a DW_TAG_variant_part. */
@@ -727,9 +742,6 @@ show_dwarf_synchronous (struct ui_file *file, int from_tty,
/* local function prototypes */
-static void build_type_psymtabs_reader (cutu_reader *reader,
- cooked_index_worker_result *storage);
-
static void var_decode_location (struct attribute *attr,
struct symbol *sym,
struct dwarf2_cu *cu);
@@ -742,9 +754,9 @@ static unrelocated_addr read_addr_index (struct dwarf2_cu *cu,
static sect_offset read_abbrev_offset (dwarf2_per_objfile *per_objfile,
dwarf2_section_info *, sect_offset);
-static const char *read_indirect_string
- (dwarf2_per_objfile *per_objfile, bfd *, const gdb_byte *,
- const struct comp_unit_head *, unsigned int *);
+static const char *read_indirect_string (dwarf2_per_objfile *per_objfile, bfd *,
+ const gdb_byte *, const unit_head *,
+ unsigned int *);
static unrelocated_addr read_addr_index_from_leb128 (struct dwarf2_cu *,
const gdb_byte *,
@@ -773,13 +785,6 @@ static line_header_up dwarf_decode_line_header (sect_offset sect_off,
struct dwarf2_cu *cu,
const char *comp_dir);
-static void dwarf_decode_lines (struct line_header *,
- struct dwarf2_cu *,
- unrelocated_addr, int decode_mapping);
-
-static void dwarf2_start_subfile (dwarf2_cu *cu, const file_entry &fe,
- const line_header &lh);
-
static struct symbol *new_symbol (struct die_info *, struct type *,
struct dwarf2_cu *, struct symbol * = NULL);
@@ -843,6 +848,11 @@ static struct dwarf2_section_info *cu_debug_loc_section (struct dwarf2_cu *cu);
static struct dwarf2_section_info *cu_debug_rnglists_section
(struct dwarf2_cu *cu, dwarf_tag tag);
+static void dw_search_file_matcher
+ (dwarf2_per_objfile *per_objfile,
+ auto_bool_vector &cus_to_skip,
+ search_symtabs_file_matcher file_matcher);
+
static void get_scope_pc_bounds (struct die_info *,
unrelocated_addr *, unrelocated_addr *,
struct dwarf2_cu *);
@@ -973,9 +983,6 @@ static void queue_comp_unit (dwarf2_per_cu *per_cu,
static void process_queue (dwarf2_per_objfile *per_objfile);
-static bool is_ada_import_or_export (dwarf2_cu *cu, const char *name,
- const char *linkagename);
-
/* Class, the destructor of which frees all allocated queue entries. This
will only have work to do if an error was thrown while processing the
dwarf. If no error was thrown then the queue entries should have all
@@ -1029,24 +1036,11 @@ dwarf2_per_cu_deleter::operator() (dwarf2_per_cu *data)
delete data;
}
-static const char *compute_include_file_name
- (const struct line_header *lh,
- const file_entry &fe,
- const file_and_directory &cu_info,
- std::string &name_holder);
-
static struct dwo_unit *lookup_dwo_unit_in_dwp
(dwarf2_per_bfd *per_bfd, struct dwp_file *dwp_file,
const char *comp_dir, ULONGEST signature, int is_debug_types);
-static struct dwp_file *get_dwp_file (dwarf2_per_objfile *per_objfile);
-
-static struct dwo_unit *lookup_dwo_comp_unit
- (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
- ULONGEST signature);
-
-static struct dwo_unit *lookup_dwo_type_unit
- (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir);
+static void open_and_init_dwp_file (dwarf2_per_objfile *per_objfile);
static void queue_and_load_all_dwo_tus (dwarf2_cu *cu);
@@ -1056,19 +1050,6 @@ static void process_cu_includes (dwarf2_per_objfile *per_objfile);
/* Various complaints about symbol reading that don't abort the process. */
static void
-dwarf2_debug_line_missing_file_complaint (void)
-{
- complaint (_(".debug_line section has line data without a file"));
-}
-
-static void
-dwarf2_debug_line_missing_end_sequence_complaint (void)
-{
- complaint (_(".debug_line section has line "
- "program sequence without an end"));
-}
-
-static void
dwarf2_complex_location_expr_complaint (void)
{
complaint (_("location expression too complex"));
@@ -1289,7 +1270,16 @@ dwarf2_has_info (struct objfile *objfile,
BFD, to avoid races. */
try
{
- dwarf2_read_dwz_file (per_objfile);
+ dwz_file::read_dwz_file (per_objfile);
+ }
+ catch (const gdb_exception_error &err)
+ {
+ warning (_("%s"), err.what ());
+ }
+
+ try
+ {
+ open_and_init_dwp_file (per_objfile);
}
catch (const gdb_exception_error &err)
{
@@ -1316,7 +1306,7 @@ dwarf2_per_bfd::locate_sections (asection *sectp,
bfd_size_type size = sectp->size;
warning (_("Discarding section %s which has an invalid size (%s) "
"[in module %s]"),
- bfd_section_name (sectp), phex_nz (size, sizeof (size)),
+ bfd_section_name (sectp), phex_nz (size),
this->filename ());
}
else if (names.info.matches (sectp->name))
@@ -1537,16 +1527,37 @@ struct readnow_functions : public dwarf2_base_index_functions
{
}
- bool expand_symtabs_matching
- (struct objfile *objfile,
- expand_symtabs_file_matcher file_matcher,
- const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
- block_search_flags search_flags,
- domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher) override
+ bool search (struct objfile *objfile,
+ search_symtabs_file_matcher file_matcher,
+ const lookup_name_info *lookup_name,
+ search_symtabs_symbol_matcher symbol_matcher,
+ search_symtabs_expansion_listener listener,
+ block_search_flags search_flags,
+ domain_search_flags domain,
+ search_symtabs_lang_matcher lang_matcher) override
{
+ dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
+ auto_bool_vector cus_to_skip;
+ dw_search_file_matcher (per_objfile, cus_to_skip, file_matcher);
+
+ for (const auto &per_cu : per_objfile->per_bfd->all_units)
+ {
+ QUIT;
+
+ /* Skip various types of unit that should not be searched
+ directly: partial units and dummy units. */
+ if (/* Note that we request the non-strict unit type here. If
+ there was an error while reading, like in
+ dw-form-strx-out-of-bounds.exp, then the unit type may
+ not be set. */
+ per_cu->unit_type (false) == DW_UT_partial
+ || per_cu->unit_type (false) == 0
+ || per_objfile->get_symtab (per_cu.get ()) == nullptr)
+ continue;
+ if (!dw2_search_one (per_cu.get (), per_objfile, cus_to_skip,
+ file_matcher, listener, lang_matcher))
+ return false;
+ }
return true;
}
};
@@ -1632,7 +1643,7 @@ dw2_do_instantiate_symtab (dwarf2_per_cu *per_cu,
&& per_objfile->per_bfd->index_table != NULL
&& !per_objfile->per_bfd->index_table->version_check ()
/* DWP files aren't supported yet. */
- && get_dwp_file (per_objfile) == NULL)
+ && per_objfile->per_bfd->dwp_file == nullptr)
queue_and_load_all_dwo_tus (cu);
}
@@ -1674,6 +1685,7 @@ dwarf2_per_bfd::allocate_per_cu (dwarf2_section_info *section,
dwarf2_per_cu_up result (new dwarf2_per_cu (this, section, sect_off,
length, is_dwz));
result->index = all_units.size ();
+ this->num_comp_units++;
return result;
}
@@ -1690,10 +1702,79 @@ dwarf2_per_bfd::allocate_signatured_type (dwarf2_section_info *section,
= std::make_unique<signatured_type> (this, section, sect_off, length,
is_dwz, signature);
result->index = all_units.size ();
- tu_stats.nr_tus++;
+ this->num_type_units++;
return result;
}
+/* Subroutine of dw2_get_file_names_reader to simplify it.
+ Return the file name for the given file_entry.
+ CU_INFO describes the CU's DW_AT_name and DW_AT_comp_dir.
+ If space for the result is malloc'd, *NAME_HOLDER will be set.
+ Returns NULL if FILE_INDEX should be ignored, i.e., it is
+ equivalent to CU_INFO. */
+
+static const char *
+compute_include_file_name (const struct line_header *lh, const file_entry &fe,
+ const file_and_directory &cu_info,
+ std::string &name_holder)
+{
+ const char *include_name = fe.name;
+ const char *include_name_to_compare = include_name;
+
+ const char *dir_name = fe.include_dir (lh);
+
+ std::string hold_compare;
+ if (!IS_ABSOLUTE_PATH (include_name)
+ && (dir_name != nullptr || cu_info.get_comp_dir () != nullptr))
+ {
+ /* Avoid creating a duplicate name for CU_INFO.
+ We do this by comparing INCLUDE_NAME and CU_INFO.
+ Before we do the comparison, however, we need to account
+ for DIR_NAME and COMP_DIR.
+ First prepend dir_name (if non-NULL). If we still don't
+ have an absolute path prepend comp_dir (if non-NULL).
+ However, the directory we record in the include-file's
+ psymtab does not contain COMP_DIR (to match the
+ corresponding symtab(s)).
+
+ Example:
+
+ bash$ cd /tmp
+ bash$ gcc -g ./hello.c
+ include_name = "hello.c"
+ dir_name = "."
+ DW_AT_comp_dir = comp_dir = "/tmp"
+ DW_AT_name = "./hello.c"
+
+ */
+
+ if (dir_name != NULL)
+ {
+ name_holder = path_join (dir_name, include_name);
+ include_name = name_holder.c_str ();
+ include_name_to_compare = include_name;
+ }
+ if (!IS_ABSOLUTE_PATH (include_name)
+ && cu_info.get_comp_dir () != nullptr)
+ {
+ hold_compare = path_join (cu_info.get_comp_dir (), include_name);
+ include_name_to_compare = hold_compare.c_str ();
+ }
+ }
+
+ std::string copied_name;
+ const char *cu_filename = cu_info.get_name ();
+ if (!IS_ABSOLUTE_PATH (cu_filename) && cu_info.get_comp_dir () != nullptr)
+ {
+ copied_name = path_join (cu_info.get_comp_dir (), cu_filename);
+ cu_filename = copied_name.c_str ();
+ }
+
+ if (FILENAME_CMP (include_name_to_compare, cu_filename) == 0)
+ return nullptr;
+ return include_name;
+}
+
/* die_reader_func for dw2_get_file_names. */
static void
@@ -1885,13 +1966,13 @@ dwarf2_base_index_functions::print_stats (struct objfile *objfile,
for (int i = 0; i < total; ++i)
{
- dwarf2_per_cu *per_cu = per_objfile->per_bfd->get_cu (i);
+ dwarf2_per_cu *per_cu = per_objfile->per_bfd->get_unit (i);
if (!per_objfile->symtab_set_p (per_cu))
++count;
}
- gdb_printf (_(" Number of read CUs: %d\n"), total - count);
- gdb_printf (_(" Number of unread CUs: %d\n"), count);
+ gdb_printf (_(" Number of read units: %d\n"), total - count);
+ gdb_printf (_(" Number of unread units: %d\n"), count);
}
void
@@ -1913,14 +1994,16 @@ dwarf2_base_index_functions::expand_all_symtabs (struct objfile *objfile)
/* See read.h. */
bool
-dw2_expand_symtabs_matching_one
+dw2_search_one
(dwarf2_per_cu *per_cu,
dwarf2_per_objfile *per_objfile,
- expand_symtabs_file_matcher file_matcher,
- expand_symtabs_expansion_listener expansion_notify,
- expand_symtabs_lang_matcher lang_matcher)
+ auto_bool_vector &cus_to_skip,
+ search_symtabs_file_matcher file_matcher,
+ search_symtabs_expansion_listener listener,
+ search_symtabs_lang_matcher lang_matcher)
{
- if (file_matcher != nullptr && !per_cu->mark)
+ /* Already visited, or intentionally skipped. */
+ if (cus_to_skip.is_set (per_cu->index))
return true;
if (lang_matcher != nullptr)
@@ -1932,22 +2015,27 @@ dw2_expand_symtabs_matching_one
return true;
}
- bool symtab_was_null = !per_objfile->symtab_set_p (per_cu);
compunit_symtab *symtab
= dw2_instantiate_symtab (per_cu, per_objfile, false);
gdb_assert (symtab != nullptr);
- if (expansion_notify != NULL && symtab_was_null)
- return expansion_notify (symtab);
+ if (listener != nullptr)
+ {
+ cus_to_skip.set (per_cu->index, true);
+ return listener (symtab);
+ }
return true;
}
-/* See read.h. */
+/* If FILE_MATCHER is non-NULL, update CUS_TO_SKIP as appropriate
+ based on FILE_MATCHER. */
-void
-dw_expand_symtabs_matching_file_matcher
- (dwarf2_per_objfile *per_objfile, expand_symtabs_file_matcher file_matcher)
+static void
+dw_search_file_matcher
+ (dwarf2_per_objfile *per_objfile,
+ auto_bool_vector &cus_to_skip,
+ search_symtabs_file_matcher file_matcher)
{
if (file_matcher == NULL)
return;
@@ -1963,54 +2051,50 @@ dw_expand_symtabs_matching_file_matcher
QUIT;
if (per_cu->is_debug_types)
- continue;
- per_cu->mark = 0;
-
- /* We only need to look at symtabs not already expanded. */
- if (per_objfile->symtab_set_p (per_cu.get ()))
- continue;
+ {
+ cus_to_skip.set (per_cu->index, true);
+ continue;
+ }
if (per_cu->fnd != nullptr)
{
file_and_directory *fnd = per_cu->fnd.get ();
if (file_matcher (fnd->get_name (), false))
- {
- per_cu->mark = 1;
- continue;
- }
+ continue;
/* Before we invoke realpath, which can get expensive when many
files are involved, do a quick comparison of the basenames. */
if ((basenames_may_differ
|| file_matcher (lbasename (fnd->get_name ()), true))
&& file_matcher (fnd->get_fullname (), false))
- {
- per_cu->mark = 1;
- continue;
- }
+ continue;
}
quick_file_names *file_data = dw2_get_file_names (per_cu.get (),
per_objfile);
if (file_data == NULL)
- continue;
+ {
+ cus_to_skip.set (per_cu->index, true);
+ continue;
+ }
if (visited_not_found.contains (file_data))
- continue;
- else if (visited_found.contains (file_data))
{
- per_cu->mark = 1;
+ cus_to_skip.set (per_cu->index, true);
continue;
}
+ else if (visited_found.contains (file_data))
+ continue;
+ bool matched = false;
for (int j = 0; j < file_data->num_file_names; ++j)
{
const char *this_real_name;
if (file_matcher (file_data->file_names[j], false))
{
- per_cu->mark = 1;
+ matched = true;
break;
}
@@ -2024,15 +2108,18 @@ dw_expand_symtabs_matching_file_matcher
this_real_name = dw2_get_real_path (per_objfile, file_data, j);
if (file_matcher (this_real_name, false))
{
- per_cu->mark = 1;
+ matched = true;
break;
}
}
- if (per_cu->mark)
+ if (matched)
visited_found.insert (file_data);
else
- visited_not_found.insert (file_data);
+ {
+ cus_to_skip.set (per_cu->index, true);
+ visited_not_found.insert (file_data);
+ }
}
}
@@ -2354,6 +2441,24 @@ get_abbrev_section_for_cu (dwarf2_per_cu *this_cu)
return abbrev;
}
+/* "less than" function used to both sort and bisect units in the
+ `dwarf2_per_bfd::all_units` vector. Return true if the LHS CU comes before
+ (is "less" than) the section and offset in RHS.
+
+ For simplicity, sort sections by their pointer. This is not ideal, because
+ it can cause the behavior to change across runs, making some bugs harder to
+ investigate. An improvement would be for sections to be sorted by their
+ properties. */
+
+static bool
+all_units_less_than (const dwarf2_per_cu &lhs, const section_and_offset &rhs)
+{
+ if (lhs.section != rhs.section)
+ return lhs.section < rhs.section;
+
+ return lhs.sect_off < rhs.offset;
+}
+
/* Fetch the abbreviation table offset from a comp or type unit header. */
static sect_offset
@@ -2383,111 +2488,6 @@ read_abbrev_offset (dwarf2_per_objfile *per_objfile,
return (sect_offset) read_offset (abfd, info_ptr, offset_size);
}
-/* A helper for create_debug_types_hash_table. Read types from SECTION
- and fill them into DWO_FILE's type unit hash table. It will process only
- type units, therefore DW_UT_type. */
-
-static void
-create_debug_type_hash_table (dwarf2_per_objfile *per_objfile,
- dwo_file *dwo_file, dwarf2_section_info *section,
- rcuh_kind section_kind)
-{
- struct objfile *objfile = per_objfile->objfile;
- struct dwarf2_section_info *abbrev_section;
- bfd *abfd;
- const gdb_byte *info_ptr, *end_ptr;
-
- abbrev_section = &dwo_file->sections.abbrev;
-
- dwarf_read_debug_printf ("Reading %s for %s",
- section->get_name (),
- abbrev_section->get_file_name ());
-
- section->read (objfile);
- info_ptr = section->buffer;
-
- if (info_ptr == NULL)
- return;
-
- /* We can't set abfd until now because the section may be empty or
- not present, in which case the bfd is unknown. */
- abfd = section->get_bfd_owner ();
-
- /* We don't use cutu_reader here because we don't need to read
- any dies: the signature is in the header. */
-
- end_ptr = info_ptr + section->size;
- while (info_ptr < end_ptr)
- {
- const gdb_byte *ptr = info_ptr;
- struct comp_unit_head header;
- unsigned int length;
-
- sect_offset sect_off = (sect_offset) (ptr - section->buffer);
-
- /* Initialize it due to a false compiler warning. */
- header.signature = -1;
- header.type_cu_offset_in_tu = (cu_offset) -1;
-
- /* We need to read the type's signature in order to build the hash
- table, but we don't need anything else just yet. */
-
- ptr = read_and_check_comp_unit_head (per_objfile, &header, section,
- abbrev_section, ptr, section_kind);
-
- length = header.get_length_with_initial ();
-
- /* Skip dummy type units. */
- if (ptr >= info_ptr + length
- || peek_abbrev_code (abfd, ptr) == 0
- || (header.unit_type != DW_UT_type
- && header.unit_type != DW_UT_split_type))
- {
- info_ptr += length;
- continue;
- }
-
- dwo_unit *dwo_tu
- = OBSTACK_ZALLOC (&per_objfile->per_bfd->obstack, dwo_unit);
- dwo_tu->dwo_file = dwo_file;
- dwo_tu->signature = header.signature;
- dwo_tu->type_offset_in_tu = header.type_cu_offset_in_tu;
- dwo_tu->section = section;
- dwo_tu->sect_off = sect_off;
- dwo_tu->length = length;
-
- auto [it, inserted] = dwo_file->tus.emplace (dwo_tu);
- if (!inserted)
- complaint (_("debug type entry at offset %s is duplicate to"
- " the entry at offset %s, signature %s"),
- sect_offset_str (sect_off),
- sect_offset_str ((*it)->sect_off),
- hex_string (header.signature));
-
- dwarf_read_debug_printf_v (" offset %s, signature %s",
- sect_offset_str (sect_off),
- hex_string (header.signature));
-
- info_ptr += length;
- }
-}
-
-/* Create the hash table of all entries in the .debug_types
- (or .debug_types.dwo) section(s).
- DWO_FILE is a pointer to the DWO file object.
-
- Note: This function processes DWO files only, not DWP files. */
-
-static void
-create_debug_types_hash_table
- (dwarf2_per_objfile *per_objfile, dwo_file *dwo_file,
- gdb::array_view<dwarf2_section_info> type_sections)
-{
- for (dwarf2_section_info &section : type_sections)
- create_debug_type_hash_table (per_objfile, dwo_file, &section,
- rcuh_kind::TYPE);
-}
-
/* Add an entry for signature SIG to per_bfd->signatured_types. */
static signatured_type_set::iterator
@@ -2502,7 +2502,17 @@ add_type_unit (dwarf2_per_bfd *per_bfd, dwarf2_section_info *section,
false /* is_dwz */, sig);
signatured_type *sig_type = sig_type_holder.get ();
- per_bfd->all_units.emplace_back (sig_type_holder.release ());
+ /* Preserve the ordering of per_bfd->all_units. */
+ auto insert_it
+ = std::lower_bound (per_bfd->all_units.begin (), per_bfd->all_units.end (),
+ sig_type,
+ [] (const dwarf2_per_cu_up &lhs,
+ const signatured_type *rhs) {
+ return all_units_less_than (*lhs, { rhs->section,
+ rhs->sect_off });
+ });
+
+ per_bfd->all_units.emplace (insert_it, sig_type_holder.release ());
auto emplace_ret = per_bfd->signatured_types.emplace (sig_type);
/* Assert that an insertion took place - that there wasn't a type unit with
@@ -2586,7 +2596,7 @@ lookup_dwo_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
if (it == dwo_file->tus.end ())
return nullptr;
- dwo_unit *dwo_entry = *it;
+ dwo_unit *dwo_entry = it->get ();
/* If the global table doesn't have an entry for this TU, add one. */
if (sig_type_it == per_bfd->signatured_types.end ())
@@ -2610,7 +2620,7 @@ lookup_dwp_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
- struct dwp_file *dwp_file = get_dwp_file (per_objfile);
+ dwp_file *dwp_file = per_objfile->per_bfd->dwp_file.get ();
gdb_assert (cu->dwo_unit);
gdb_assert (dwp_file != NULL);
@@ -2652,7 +2662,7 @@ lookup_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
{
/* We're in a DWO/DWP file, and we're using .gdb_index.
These cases require special processing. */
- if (get_dwp_file (per_objfile) == NULL)
+ if (per_objfile->per_bfd->dwp_file == nullptr)
return lookup_dwo_signatured_type (cu, sig);
else
return lookup_dwp_signatured_type (cu, sig);
@@ -2712,9 +2722,8 @@ cutu_reader::read_cutu_die_from_dwo (dwarf2_cu *cu, dwo_unit *dwo_unit,
die_info *stub_comp_unit_die,
const char *stub_comp_dir)
{
- dwarf2_per_objfile *per_objfile = cu->per_objfile;
dwarf2_per_cu *per_cu = cu->per_cu;
- struct objfile *objfile = per_objfile->objfile;
+ struct objfile *objfile = cu->per_objfile->objfile;
bfd *abfd;
struct dwarf2_section_info *dwo_abbrev_section;
@@ -2790,9 +2799,10 @@ cutu_reader::read_cutu_die_from_dwo (dwarf2_cu *cu, dwo_unit *dwo_unit,
{
signatured_type *sig_type = (struct signatured_type *) per_cu;
- m_info_ptr = read_and_check_comp_unit_head (per_objfile, &cu->header,
- section, dwo_abbrev_section,
- m_info_ptr, rcuh_kind::TYPE);
+ m_info_ptr = read_and_check_unit_head (&cu->header, section,
+ dwo_abbrev_section, m_info_ptr,
+ ruh_kind::TYPE);
+
/* This is not an assert because it can be caused by bad debug info. */
if (sig_type->signature != cu->header.signature)
{
@@ -2808,7 +2818,7 @@ cutu_reader::read_cutu_die_from_dwo (dwarf2_cu *cu, dwo_unit *dwo_unit,
/* For DWOs coming from DWP files, we don't know the CU length
nor the type's offset in the TU until now. */
dwo_unit->length = cu->header.get_length_with_initial ();
- dwo_unit->type_offset_in_tu = cu->header.type_cu_offset_in_tu;
+ dwo_unit->type_offset_in_tu = cu->header.type_offset_in_tu;
/* Establish the type offset that can be used to lookup the type.
For DWO files, we don't know it until now. */
@@ -2817,10 +2827,9 @@ cutu_reader::read_cutu_die_from_dwo (dwarf2_cu *cu, dwo_unit *dwo_unit,
}
else
{
- m_info_ptr
- = read_and_check_comp_unit_head (per_objfile, &cu->header, section,
- dwo_abbrev_section, m_info_ptr,
- rcuh_kind::COMPILE);
+ m_info_ptr = read_and_check_unit_head (&cu->header, section,
+ dwo_abbrev_section, m_info_ptr,
+ ruh_kind::COMPILE);
gdb_assert (dwo_unit->sect_off == cu->header.sect_off);
/* For DWOs coming from DWP files, we don't know the CU length
until now. */
@@ -2873,16 +2882,10 @@ lookup_dwo_id (struct dwarf2_cu *cu, struct die_info* comp_unit_die)
Returns nullptr if the specified DWO unit cannot be found. */
-static struct dwo_unit *
-lookup_dwo_unit (dwarf2_cu *cu, die_info *comp_unit_die, const char *dwo_name)
+dwo_unit *
+cutu_reader::lookup_dwo_unit (dwarf2_cu *cu, die_info *comp_unit_die,
+ const char *dwo_name)
{
-#if CXX_STD_THREAD
- /* We need a lock here to handle the DWO hash table. */
- static std::mutex dwo_lock;
-
- std::lock_guard<std::mutex> guard (dwo_lock);
-#endif
-
dwarf2_per_cu *per_cu = cu->per_cu;
struct dwo_unit *dwo_unit;
const char *comp_dir;
@@ -2970,7 +2973,7 @@ cutu_reader::cutu_reader (dwarf2_per_cu &this_cu,
dwarf2_cu *existing_cu,
bool skip_partial,
enum language pretend_language,
- const abbrev_table_cache *cache)
+ const abbrev_table_cache *abbrev_cache)
{
struct objfile *objfile = per_objfile.objfile;
struct dwarf2_section_info *section = this_cu.section;
@@ -3030,33 +3033,33 @@ cutu_reader::cutu_reader (dwarf2_per_cu &this_cu,
indexer. This assert is avoided in this case because (1) it
is irrelevant, and (2) the get_cu method is not
thread-safe. */
- gdb_assert (cache != nullptr
+ gdb_assert (abbrev_cache != nullptr
|| per_objfile.get_cu (&this_cu) == nullptr);
m_new_cu = std::make_unique<dwarf2_cu> (&this_cu, &per_objfile);
cu = m_new_cu.get ();
}
/* Get the header. */
- if (to_underlying (cu->header.first_die_cu_offset) != 0 && !rereading_dwo_cu)
+ if (to_underlying (cu->header.first_die_offset_in_unit) != 0
+ && !rereading_dwo_cu)
{
/* We already have the header, there's no need to read it in again. */
- m_info_ptr += to_underlying (cu->header.first_die_cu_offset);
+ m_info_ptr += to_underlying (cu->header.first_die_offset_in_unit);
}
else
{
if (this_cu.is_debug_types)
{
- m_info_ptr
- = read_and_check_comp_unit_head (&per_objfile, &cu->header, section,
- abbrev_section, m_info_ptr,
- rcuh_kind::TYPE);
+ m_info_ptr = read_and_check_unit_head (&cu->header, section,
+ abbrev_section, m_info_ptr,
+ ruh_kind::TYPE);
/* Since per_cu is the first member of struct signatured_type,
we can go from a pointer to one to a pointer to the other. */
sig_type = (struct signatured_type *) &this_cu;
gdb_assert (sig_type->signature == cu->header.signature);
gdb_assert (sig_type->type_offset_in_tu
- == cu->header.type_cu_offset_in_tu);
+ == cu->header.type_offset_in_tu);
gdb_assert (this_cu.sect_off == cu->header.sect_off);
/* LENGTH has not been set yet for type units if we're
@@ -3069,10 +3072,9 @@ cutu_reader::cutu_reader (dwarf2_per_cu &this_cu,
}
else
{
- m_info_ptr
- = read_and_check_comp_unit_head (&per_objfile, &cu->header, section,
- abbrev_section, m_info_ptr,
- rcuh_kind::COMPILE);
+ m_info_ptr = read_and_check_unit_head (&cu->header, section,
+ abbrev_section, m_info_ptr,
+ ruh_kind::COMPILE);
gdb_assert (this_cu.sect_off == cu->header.sect_off);
this_cu.set_length (cu->header.get_length_with_initial ());
@@ -3092,9 +3094,9 @@ cutu_reader::cutu_reader (dwarf2_per_cu &this_cu,
gdb_assert (cu->header.abbrev_sect_off == abbrev_table->sect_off);
else
{
- if (cache != nullptr)
- abbrev_table = cache->find (abbrev_section,
- cu->header.abbrev_sect_off);
+ if (abbrev_cache != nullptr)
+ abbrev_table = abbrev_cache->find (abbrev_section,
+ cu->header.abbrev_sect_off);
if (abbrev_table == nullptr)
{
abbrev_section->read (objfile);
@@ -3204,12 +3206,11 @@ cutu_reader::cutu_reader (dwarf2_per_cu &this_cu,
m_info_ptr = section->buffer + to_underlying (this_cu.sect_off);
const gdb_byte *begin_info_ptr = m_info_ptr;
- m_info_ptr
- = read_and_check_comp_unit_head (&per_objfile, &m_new_cu->header, section,
- abbrev_section, m_info_ptr,
- (this_cu.is_debug_types
- ? rcuh_kind::TYPE
- : rcuh_kind::COMPILE));
+ m_info_ptr = read_and_check_unit_head (&m_new_cu->header, section,
+ abbrev_section, m_info_ptr,
+ (this_cu.is_debug_types
+ ? ruh_kind::TYPE
+ : ruh_kind::COMPILE));
m_new_cu->str_offsets_base = parent_cu.str_offsets_base;
m_new_cu->addr_base = parent_cu.addr_base;
@@ -3283,33 +3284,178 @@ get_type_unit_group_key (struct dwarf2_cu *cu, const struct attribute *stmt_list
return {cu->dwo_unit, static_cast<sect_offset> (line_offset)};
}
-/* Subroutine of dwarf2_build_psymtabs_hard to simplify it.
- Process compilation unit THIS_CU for a psymtab. */
+/* A subclass of cooked_index_worker that handles scanning
+ .debug_info. */
-static void
-process_psymtab_comp_unit (dwarf2_per_cu *this_cu,
- dwarf2_per_objfile *per_objfile,
- cooked_index_worker_result *storage)
+class cooked_index_worker_debug_info : public cooked_index_worker
+{
+public:
+ cooked_index_worker_debug_info (dwarf2_per_objfile *per_objfile)
+ : cooked_index_worker (per_objfile)
+ {
+ gdb_assert (is_main_thread ());
+
+ struct objfile *objfile = per_objfile->objfile;
+ dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
+
+ dwarf_read_debug_printf ("Building psymtabs of objfile %s ...",
+ objfile_name (objfile));
+
+ per_bfd->map_info_sections (objfile);
+ }
+
+private:
+ /* The task for parallel workers that index units. */
+ struct parallel_indexing_worker
+ {
+ parallel_indexing_worker (const char *step_name,
+ cooked_index_worker_debug_info *parent)
+ : m_scoped_time_it (step_name, parent->m_per_command_time),
+ m_parent (parent)
+ {
+ }
+
+ DISABLE_COPY_AND_ASSIGN (parallel_indexing_worker);
+
+ ~parallel_indexing_worker ()
+ {
+ bfd_thread_cleanup ();
+
+ m_thread_storage.done_reading (m_complaint_handler.release ());
+
+ /* Append the results of this worker to the parent instance. */
+ gdb::lock_guard<gdb::mutex> lock (m_parent->m_results_mutex);
+ m_parent->m_results.emplace_back (std::move (m_thread_storage));
+ }
+
+ void operator() (iterator_range<dwarf2_per_cu_up *> range)
+ {
+ for (auto &it : range)
+ this->process_one (*it);
+ }
+
+ private:
+ void process_one (dwarf2_per_cu &unit)
+ {
+ m_thread_storage.catch_error ([&] ()
+ {
+ m_parent->process_unit (&unit, m_parent->m_per_objfile,
+ &m_thread_storage);
+ });
+ }
+
+ /* Measures the execution time of this worker. */
+ scoped_time_it m_scoped_time_it;
+
+ /* Delayed complaints and errors recorded while indexing units. */
+ complaint_interceptor m_complaint_handler;
+ std::vector<gdb_exception> m_errors;
+
+ /* Index storage for this worker. */
+ cooked_index_worker_result m_thread_storage;
+
+ /* The instance that spawned this worker. */
+ cooked_index_worker_debug_info *m_parent;
+ };
+
+ void do_reading () override;
+
+ /* Print collected type unit statistics. */
+
+ void print_tu_stats (dwarf2_per_objfile *per_objfile)
+ {
+ dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
+ tu_stats *tu_stats = &per_bfd->tu_stats;
+
+ dwarf_read_debug_printf ("Type unit statistics:");
+ dwarf_read_debug_printf (" %d TUs", per_bfd->num_type_units);
+ dwarf_read_debug_printf (" %d uniq abbrev tables",
+ tu_stats->nr_uniq_abbrev_tables);
+ dwarf_read_debug_printf (" %d symtabs from stmt_list entries",
+ tu_stats->nr_symtabs);
+ dwarf_read_debug_printf (" %d symtab sharers",
+ tu_stats->nr_symtab_sharers);
+ dwarf_read_debug_printf (" %d type units without a stmt_list",
+ tu_stats->nr_stmt_less_type_units);
+ dwarf_read_debug_printf (" %d all_type_units reallocs",
+ tu_stats->nr_all_type_units_reallocs);
+ }
+
+ void print_stats () override
+ {
+ if (dwarf_read_debug > 0)
+ print_tu_stats (m_per_objfile);
+
+ if (dwarf_read_debug > 1)
+ {
+ dwarf_read_debug_printf_v ("Final m_all_parents_map:");
+ m_all_parents_map.dump (m_per_objfile->per_bfd);
+ }
+ }
+
+ /* After the last DWARF-reading task has finished, this function
+ does the remaining work to finish the scan. */
+ void done_reading () override;
+
+ /* An iterator for the comp units. */
+ using unit_iterator = std::vector<dwarf2_per_cu_up>::iterator;
+
+ /* Process unit THIS_CU. */
+ void process_unit (dwarf2_per_cu *this_cu, dwarf2_per_objfile *per_objfile,
+ cooked_index_worker_result *storage);
+
+ /* Process all type units existing in PER_OBJFILE::PER_BFD::ALL_UNITS. */
+ void process_type_units (dwarf2_per_objfile *per_objfile,
+ cooked_index_worker_result *storage);
+
+ /* Process the type unit wrapped in READER. */
+ void process_type_unit (cutu_reader *reader,
+ cooked_index_worker_result *storage);
+
+ /* Process all type units of all DWO files.
+
+ This is needed in case a TU was emitted without its skeleton.
+ Note: This can't be done until we know what all the DWO files are. */
+ void process_skeletonless_type_units (dwarf2_per_objfile *per_objfile,
+ cooked_index_worker_result *storage);
+
+ /* Process the type unit represented by DWO_UNIT. */
+ void process_skeletonless_type_unit (dwo_unit *dwo_unit,
+ dwarf2_per_objfile *per_objfile,
+ cooked_index_worker_result *storage);
+
+ /* A storage object for "leftovers" -- see the 'start' method, but
+ essentially things not parsed during the normal CU parsing
+ passes. */
+ cooked_index_worker_result m_index_storage;
+};
+
+void
+cooked_index_worker_debug_info::process_unit
+ (dwarf2_per_cu *this_cu, dwarf2_per_objfile *per_objfile,
+ cooked_index_worker_result *storage)
{
cutu_reader *reader = storage->get_reader (this_cu);
if (reader == nullptr)
{
- cutu_reader new_reader (*this_cu, *per_objfile, nullptr, nullptr, false,
- language_minimal,
- &storage->get_abbrev_table_cache ());
+ const abbrev_table_cache &abbrev_table_cache
+ = storage->get_abbrev_table_cache ();
+ auto new_reader = std::make_unique<cutu_reader> (*this_cu, *per_objfile,
+ nullptr, nullptr, false,
+ language_minimal,
+ &abbrev_table_cache);
- if (new_reader.cu () == nullptr || new_reader.is_dummy ())
+ if (new_reader->is_dummy ())
return;
- auto copy = std::make_unique<cutu_reader> (std::move (new_reader));
- reader = storage->preserve (std::move (copy));
+ reader = storage->preserve (std::move (new_reader));
}
- if (reader->top_level_die () == nullptr || reader->is_dummy ())
+ if (reader->is_dummy ())
return;
if (this_cu->is_debug_types)
- build_type_psymtabs_reader (reader, storage);
+ process_type_unit (reader, storage);
else if (reader->top_level_die ()->tag != DW_TAG_partial_unit)
{
bool nope = false;
@@ -3322,11 +3468,9 @@ process_psymtab_comp_unit (dwarf2_per_cu *this_cu,
}
}
-/* Reader function for build_type_psymtabs. */
-
-static void
-build_type_psymtabs_reader (cutu_reader *reader,
- cooked_index_worker_result *storage)
+void
+cooked_index_worker_debug_info::process_type_unit
+ (cutu_reader *reader, cooked_index_worker_result *storage)
{
struct dwarf2_cu *cu = reader->cu ();
dwarf2_per_cu *per_cu = cu->per_cu;
@@ -3360,32 +3504,15 @@ struct tu_abbrev_offset
sect_offset abbrev_offset;
};
-/* Efficiently read all the type units.
-
- The efficiency is because we sort TUs by the abbrev table they use and
- only read each abbrev table once. In one program there are 200K TUs
- sharing 8K abbrev tables.
-
- The main purpose of this function is to support building the
- dwarf2_per_objfile->per_bfd->type_unit_groups table.
- TUs typically share the DW_AT_stmt_list of the CU they came from, so we
- can collapse the search space by grouping them by stmt_list.
- The savings can be significant, in the same program from above the 200K TUs
- share 8K stmt_list tables.
-
- FUNC is expected to call get_type_unit_group, which will create the
- struct type_unit_group if necessary and add it to
- dwarf2_per_objfile->per_bfd->type_unit_groups. */
-
-static void
-build_type_psymtabs (dwarf2_per_objfile *per_objfile,
- cooked_index_worker_result *storage)
+void
+cooked_index_worker_debug_info::process_type_units
+ (dwarf2_per_objfile *per_objfile, cooked_index_worker_result *storage)
{
struct tu_stats *tu_stats = &per_objfile->per_bfd->tu_stats;
abbrev_table_up abbrev_table;
sect_offset abbrev_offset;
- if (per_objfile->per_bfd->all_type_units.size () == 0)
+ if (per_objfile->per_bfd->num_type_units == 0)
return;
/* TUs typically share abbrev tables, and there can be way more TUs than
@@ -3412,7 +3539,7 @@ build_type_psymtabs (dwarf2_per_objfile *per_objfile,
/* Sort in a separate table to maintain the order of all_units
for .gdb_index: TU indices directly index all_type_units. */
std::vector<tu_abbrev_offset> sorted_by_abbrev;
- sorted_by_abbrev.reserve (per_objfile->per_bfd->all_type_units.size ());
+ sorted_by_abbrev.reserve (per_objfile->per_bfd->num_type_units);
for (const auto &cu : per_objfile->per_bfd->all_units)
if (cu->is_debug_types)
@@ -3445,38 +3572,17 @@ build_type_psymtabs (dwarf2_per_objfile *per_objfile,
abbrev_table.get (), nullptr, false,
language_minimal);
if (!reader.is_dummy ())
- build_type_psymtabs_reader (&reader, storage);
+ storage->catch_error ([&] ()
+ {
+ process_type_unit (&reader, storage);
+ });
}
}
-/* Print collected type unit statistics. */
-
-static void
-print_tu_stats (dwarf2_per_objfile *per_objfile)
-{
- struct tu_stats *tu_stats = &per_objfile->per_bfd->tu_stats;
-
- dwarf_read_debug_printf ("Type unit statistics:");
- dwarf_read_debug_printf (" %d TUs", tu_stats->nr_tus);
- dwarf_read_debug_printf (" %d uniq abbrev tables",
- tu_stats->nr_uniq_abbrev_tables);
- dwarf_read_debug_printf (" %d symtabs from stmt_list entries",
- tu_stats->nr_symtabs);
- dwarf_read_debug_printf (" %d symtab sharers",
- tu_stats->nr_symtab_sharers);
- dwarf_read_debug_printf (" %d type units without a stmt_list",
- tu_stats->nr_stmt_less_type_units);
- dwarf_read_debug_printf (" %d all_type_units reallocs",
- tu_stats->nr_all_type_units_reallocs);
-}
-
-/* Traversal function for process_skeletonless_type_units.
- Read a TU in a DWO file and build partial symbols for it. */
-
-static void
-process_skeletonless_type_unit (dwo_unit *dwo_unit,
- dwarf2_per_objfile *per_objfile,
- cooked_index_worker_result *storage)
+void
+cooked_index_worker_debug_info::process_skeletonless_type_unit
+ (dwo_unit *dwo_unit, dwarf2_per_objfile *per_objfile,
+ cooked_index_worker_result *storage)
{
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
@@ -3498,106 +3604,23 @@ process_skeletonless_type_unit (dwo_unit *dwo_unit,
cutu_reader reader (**sig_type_it, *per_objfile, nullptr, nullptr, false,
language_minimal);
if (!reader.is_dummy ())
- build_type_psymtabs_reader (&reader, storage);
-}
-
-/* Scan all TUs of DWO files, verifying we've processed them.
- This is needed in case a TU was emitted without its skeleton.
- Note: This can't be done until we know what all the DWO files are. */
-
-static void
-process_skeletonless_type_units (dwarf2_per_objfile *per_objfile,
- cooked_index_worker_result *storage)
-{
- /* Skeletonless TUs in DWP files without .gdb_index is not supported yet. */
- if (get_dwp_file (per_objfile) == nullptr)
- for (const dwo_file_up &file : per_objfile->per_bfd->dwo_files)
- for (dwo_unit *unit : file->tus)
- process_skeletonless_type_unit (unit, per_objfile, storage);
+ process_type_unit (&reader, storage);
}
-/* A subclass of cooked_index_worker that handles scanning
- .debug_info. */
-
-class cooked_index_worker_debug_info : public cooked_index_worker
-{
-public:
- cooked_index_worker_debug_info (dwarf2_per_objfile *per_objfile)
- : cooked_index_worker (per_objfile)
- {
- gdb_assert (is_main_thread ());
-
- struct objfile *objfile = per_objfile->objfile;
- dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
-
- dwarf_read_debug_printf ("Building psymtabs of objfile %s ...",
- objfile_name (objfile));
-
- per_bfd->map_info_sections (objfile);
- }
-
-private:
-
- void do_reading () override;
-
- void print_stats () override
- {
- if (dwarf_read_debug > 0)
- print_tu_stats (m_per_objfile);
- if (dwarf_read_debug > 1)
- {
- dwarf_read_debug_printf_v ("Final m_all_parents_map:");
- m_all_parents_map.dump (m_per_objfile->per_bfd);
- }
- }
-
- /* After the last DWARF-reading task has finished, this function
- does the remaining work to finish the scan. */
- void done_reading () override;
-
- /* An iterator for the comp units. */
- using unit_iterator = std::vector<dwarf2_per_cu_up>::iterator;
-
- /* Process a batch of CUs. This may be called multiple times in
- separate threads. TASK_NUMBER indicates which task this is --
- the result is stored in that slot of M_RESULTS. */
- void process_cus (size_t task_number, unit_iterator first,
- unit_iterator end);
-
- /* A storage object for "leftovers" -- see the 'start' method, but
- essentially things not parsed during the normal CU parsing
- passes. */
- cooked_index_worker_result m_index_storage;
-};
-
void
-cooked_index_worker_debug_info::process_cus (size_t task_number,
- unit_iterator first,
- unit_iterator end)
+cooked_index_worker_debug_info::process_skeletonless_type_units
+ (dwarf2_per_objfile *per_objfile, cooked_index_worker_result *storage)
{
- SCOPE_EXIT { bfd_thread_cleanup (); };
-
- /* Ensure that complaints are handled correctly. */
- complaint_interceptor complaint_handler;
+ scoped_time_it time_it ("DWARF skeletonless type units", m_per_command_time);
- std::vector<gdb_exception> errors;
- cooked_index_worker_result thread_storage;
- for (auto inner = first; inner != end; ++inner)
- {
- dwarf2_per_cu *per_cu = inner->get ();
-
- try
- {
- process_psymtab_comp_unit (per_cu, m_per_objfile, &thread_storage);
- }
- catch (gdb_exception &except)
- {
- thread_storage.note_error (std::move (except));
- }
- }
-
- thread_storage.done_reading (complaint_handler.release ());
- m_results[task_number] = std::move (thread_storage);
+ /* Skeletonless TUs in DWP files without .gdb_index is not supported yet. */
+ if (per_objfile->per_bfd->dwp_file == nullptr)
+ for (const dwo_file_up &file : per_objfile->per_bfd->dwo_files)
+ for (const dwo_unit_up &unit : file->tus)
+ storage->catch_error ([&] ()
+ {
+ process_skeletonless_type_unit (unit.get (), per_objfile, storage);
+ });
}
void
@@ -3618,68 +3641,23 @@ cooked_index_worker_debug_info::do_reading ()
dwarf2_per_bfd *per_bfd = m_per_objfile->per_bfd;
create_all_units (m_per_objfile);
- build_type_psymtabs (m_per_objfile, &m_index_storage);
+ process_type_units (m_per_objfile, &m_index_storage);
if (!per_bfd->debug_aranges.empty ())
read_addrmap_from_aranges (m_per_objfile, &per_bfd->debug_aranges,
m_index_storage.get_addrmap (),
&m_warnings);
- /* We want to balance the load between the worker threads. This is
- done by using the size of each CU as a rough estimate of how
- difficult it will be to operate on. This isn't ideal -- for
- example if dwz is used, the early CUs will all tend to be
- "included" and won't be parsed independently. However, this
- heuristic works well for typical compiler output. */
-
- size_t total_size = 0;
- for (const auto &per_cu : per_bfd->all_units)
- total_size += per_cu->length ();
-
- /* How many worker threads we plan to use. We may not actually use
- this many. We use 1 as the minimum to avoid division by zero,
- and anyway in the N==0 case the work will be done
- synchronously. */
- const size_t n_worker_threads
- = std::max (gdb::thread_pool::g_thread_pool->thread_count (), (size_t) 1);
-
- /* How much effort should be put into each worker. */
- const size_t size_per_thread
- = std::max (total_size / n_worker_threads, (size_t) 1);
-
- /* Work is done in a task group. */
- gdb::task_group workers ([this] ()
- {
- this->done_reading ();
- });
+ /* Launch parallel tasks to index units.
- auto end = per_bfd->all_units.end ();
- size_t task_count = 0;
- for (auto iter = per_bfd->all_units.begin (); iter != end; )
- {
- auto last = iter;
- /* Put all remaining CUs into the last task. */
- if (task_count == n_worker_threads - 1)
- last = end;
- else
- {
- size_t chunk_size = 0;
- for (; last != end && chunk_size < size_per_thread; ++last)
- chunk_size += (*last)->length ();
- }
-
- gdb_assert (iter != last);
- workers.add_task ([this, task_count, iter, last] ()
- {
- process_cus (task_count, iter, last);
- });
-
- ++task_count;
- iter = last;
- }
-
- m_results.resize (task_count);
- workers.start ();
+ The (unfortunate) reason why we don't use
+ std::vector<dwarf2_per_cu_up>::iterator as the parallel-for-each iterator
+ type is that std::atomic won't work with that type when building with
+ -D_GLIBCXX_DEBUG. */
+ gdb::parallel_for_each_async<1, dwarf2_per_cu_up *, parallel_indexing_worker>
+ (per_bfd->all_units.data (),
+ per_bfd->all_units.data () + per_bfd->all_units.size (),
+ [this] () { this->done_reading (); }, "DWARF indexing worker", this);
}
static void
@@ -3688,10 +3666,11 @@ read_comp_units_from_section (dwarf2_per_objfile *per_objfile,
struct dwarf2_section_info *abbrev_section,
unsigned int is_dwz,
signatured_type_set &sig_types,
- rcuh_kind section_kind)
+ ruh_kind section_kind)
{
const gdb_byte *info_ptr;
struct objfile *objfile = per_objfile->objfile;
+ dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
dwarf_read_debug_printf ("Reading %s for %s",
section->get_name (),
@@ -3707,23 +3686,22 @@ read_comp_units_from_section (dwarf2_per_objfile *per_objfile,
sect_offset sect_off = (sect_offset) (info_ptr - section->buffer);
- comp_unit_head cu_header;
- read_and_check_comp_unit_head (per_objfile, &cu_header, section,
- abbrev_section, info_ptr,
- section_kind);
+ unit_head cu_header;
+ read_and_check_unit_head (&cu_header, section, abbrev_section, info_ptr,
+ section_kind);
unsigned int length = cu_header.get_length_with_initial ();
/* Save the compilation unit for later lookup. */
if (cu_header.unit_type != DW_UT_type)
- this_cu
- = per_objfile->per_bfd->allocate_per_cu (section, sect_off, length, is_dwz);
+ this_cu = per_bfd->allocate_per_cu (section, sect_off, length, is_dwz);
else
{
- auto sig_type = per_objfile->per_bfd->allocate_signatured_type
- (section, sect_off, length, is_dwz, cu_header.signature);
+ auto sig_type
+ = per_bfd->allocate_signatured_type (section, sect_off, length,
+ is_dwz, cu_header.signature);
signatured_type *sig_ptr = sig_type.get ();
- sig_type->type_offset_in_tu = cu_header.type_cu_offset_in_tu;
+ sig_type->type_offset_in_tu = cu_header.type_offset_in_tu;
this_cu.reset (sig_type.release ());
auto inserted = sig_types.emplace (sig_ptr).second;
@@ -3737,20 +3715,26 @@ read_comp_units_from_section (dwarf2_per_objfile *per_objfile,
}
info_ptr = info_ptr + this_cu->length ();
- per_objfile->per_bfd->all_units.push_back (std::move (this_cu));
+ per_bfd->all_units.push_back (std::move (this_cu));
}
}
-/* Initialize the views on all_units. */
+/* See read.h. */
void
finalize_all_units (dwarf2_per_bfd *per_bfd)
{
- size_t nr_tus = per_bfd->tu_stats.nr_tus;
- size_t nr_cus = per_bfd->all_units.size () - nr_tus;
- gdb::array_view<dwarf2_per_cu_up> tmp = per_bfd->all_units;
- per_bfd->all_comp_units = tmp.slice (0, nr_cus);
- per_bfd->all_type_units = tmp.slice (nr_cus, nr_tus);
+ /* Sanity check. */
+ gdb_assert (per_bfd->all_units.size ()
+ == per_bfd->num_comp_units + per_bfd->num_type_units);
+
+ /* Ensure that the all_units vector is in the expected order for
+ dwarf2_find_containing_unit to be able to perform a binary search. */
+ std::sort (per_bfd->all_units.begin (), per_bfd->all_units.end (),
+ [] (const dwarf2_per_cu_up &a, const dwarf2_per_cu_up &b)
+ {
+ return all_units_less_than (*a, { b->section, b->sect_off });
+ });
}
/* See read.h. */
@@ -3759,28 +3743,27 @@ void
create_all_units (dwarf2_per_objfile *per_objfile)
{
gdb_assert (per_objfile->per_bfd->all_units.empty ());
+ scoped_remove_all_units remove_all_units (*per_objfile->per_bfd);
signatured_type_set sig_types;
for (dwarf2_section_info &section : per_objfile->per_bfd->infos)
read_comp_units_from_section (per_objfile, &section,
&per_objfile->per_bfd->abbrev, 0, sig_types,
- rcuh_kind::COMPILE);
+ ruh_kind::COMPILE);
for (dwarf2_section_info &section : per_objfile->per_bfd->types)
read_comp_units_from_section (per_objfile, &section,
&per_objfile->per_bfd->abbrev, 0, sig_types,
- rcuh_kind::TYPE);
+ ruh_kind::TYPE);
dwz_file *dwz = per_objfile->per_bfd->get_dwz_file ();
if (dwz != NULL)
{
read_comp_units_from_section (per_objfile, &dwz->info, &dwz->abbrev, 1,
- sig_types, rcuh_kind::COMPILE);
+ sig_types, ruh_kind::COMPILE);
if (!dwz->types.empty ())
{
- per_objfile->per_bfd->all_units.clear ();
-
/* See enhancement PR symtab/30838. */
error (_(DWARF_ERROR_PREFIX
".debug_types section not supported in dwz file"));
@@ -3790,6 +3773,7 @@ create_all_units (dwarf2_per_objfile *per_objfile)
per_objfile->per_bfd->signatured_types = std::move (sig_types);
finalize_all_units (per_objfile->per_bfd);
+ remove_all_units.disable ();
}
/* Return the initial uleb128 in the die at INFO_PTR. */
@@ -3896,11 +3880,13 @@ cutu_reader::skip_one_attribute (dwarf_form form, const gdb_byte *info_ptr)
case DW_FORM_data4:
case DW_FORM_ref4:
case DW_FORM_strx4:
+ case DW_FORM_ref_sup4:
return info_ptr + 4;
case DW_FORM_data8:
case DW_FORM_ref8:
case DW_FORM_ref_sig8:
+ case DW_FORM_ref_sup8:
return info_ptr + 8;
case DW_FORM_data16:
@@ -3913,6 +3899,7 @@ cutu_reader::skip_one_attribute (dwarf_form form, const gdb_byte *info_ptr)
case DW_FORM_sec_offset:
case DW_FORM_strp:
case DW_FORM_GNU_strp_alt:
+ case DW_FORM_strp_sup:
return info_ptr + m_cu->header.offset_size;
case DW_FORM_exprloc:
@@ -4319,7 +4306,7 @@ fixup_go_packaging (struct dwarf2_cu *cu)
struct symbol *sym = list->symbol[i];
if (sym->language () == language_go
- && sym->aclass () == LOC_BLOCK)
+ && sym->loc_class () == LOC_BLOCK)
{
gdb::unique_xmalloc_ptr<char> this_package_name
= go_symbol_package_name (sym);
@@ -4356,7 +4343,7 @@ fixup_go_packaging (struct dwarf2_cu *cu)
sym->set_language (language_go, &objfile->objfile_obstack);
sym->compute_and_set_names (saved_package_name, false, objfile->per_bfd);
sym->set_domain (TYPE_DOMAIN);
- sym->set_aclass_index (LOC_TYPEDEF);
+ sym->set_loc_class_index (LOC_TYPEDEF);
sym->set_type (type);
add_symbol_to_list (sym, cu->get_builder ()->get_global_symbols ());
@@ -4566,9 +4553,9 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
else
{
struct type *disr_type = nullptr;
- for (int i = 0; i < type->num_fields (); ++i)
+ for (const auto &field : type->fields ())
{
- disr_type = type->field (i).type ();
+ disr_type = field.type ();
if (disr_type->code () != TYPE_CODE_STRUCT)
{
@@ -4607,7 +4594,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
field *new_fields
= (struct field *) TYPE_ZALLOC (type, ((type->num_fields () + 1)
* sizeof (struct field)));
- memcpy (new_fields + 1, type->fields (),
+ memcpy (new_fields + 1, type->fields ().data (),
type->num_fields () * sizeof (struct field));
type->set_fields (new_fields);
type->set_num_fields (type->num_fields () + 1);
@@ -4621,13 +4608,12 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
variant name. For convenience we build a map here. */
struct type *enum_type = disr_field->type ();
gdb::unordered_map<std::string_view, ULONGEST> discriminant_map;
- for (int i = 0; i < enum_type->num_fields (); ++i)
+ for (const auto &field : enum_type->fields ())
{
- if (enum_type->field (i).loc_kind () == FIELD_LOC_KIND_ENUMVAL)
+ if (field.loc_kind () == FIELD_LOC_KIND_ENUMVAL)
{
- const char *name
- = rust_last_path_segment (enum_type->field (i).name ());
- discriminant_map[name] = enum_type->field (i).loc_enumval ();
+ const char *name = rust_last_path_segment (field.name ());
+ discriminant_map[name] = field.loc_enumval ();
}
}
@@ -4663,7 +4649,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
if (sub_type->num_fields () > 0)
{
sub_type->set_num_fields (sub_type->num_fields () - 1);
- sub_type->set_fields (sub_type->fields () + 1);
+ sub_type->set_fields (sub_type->fields ().data () + 1);
}
type->field (i).set_name (variant_name);
sub_type->set_name
@@ -5003,6 +4989,21 @@ process_full_type_unit (dwarf2_cu *cu)
cu->reset_builder ();
}
+/* See read.h. */
+
+const dwarf2_section_info &
+get_section_for_ref (const attribute &attr, dwarf2_cu *cu)
+{
+ gdb_assert (attr.form_is_ref ());
+
+ if (attr.form_is_alt ())
+ return cu->per_cu->per_bfd->get_dwz_file (true)->info;
+
+ /* If the source is already in the supplementary (dwz) file, then CU->SECTION
+ already represents the section in the supplementary file. */
+ return cu->section ();
+}
+
/* Process an imported unit DIE. */
static void
@@ -5022,12 +5023,11 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu)
attr = dwarf2_attr (die, DW_AT_import, cu);
if (attr != NULL)
{
+ const dwarf2_section_info &section = get_section_for_ref (*attr, cu);
sect_offset sect_off = attr->get_ref_die_offset ();
- bool is_dwz = (attr->form == DW_FORM_GNU_ref_alt || cu->per_cu->is_dwz);
dwarf2_per_objfile *per_objfile = cu->per_objfile;
dwarf2_per_cu *per_cu
- = dwarf2_find_containing_comp_unit (sect_off, is_dwz,
- per_objfile->per_bfd);
+ = dwarf2_find_containing_unit ({ &section, sect_off }, per_objfile);
/* We're importing a C++ compilation unit with tag DW_TAG_compile_unit
into another compilation unit, at root level. Regard this as a hint,
@@ -5729,7 +5729,7 @@ read_alias (struct die_info *die, struct dwarf2_cu *cu)
type = die_type (d, imported_cu);
struct symbol *sym = new_symbol (die, type, cu);
attr = dwarf2_attr (d, DW_AT_location, imported_cu);
- sym->set_aclass_index (LOC_UNRESOLVED);
+ sym->set_loc_class_index (LOC_UNRESOLVED);
if (attr != nullptr)
var_decode_location (attr, sym, cu);
return true;
@@ -5952,7 +5952,7 @@ find_file_and_directory (struct die_info *die, struct dwarf2_cu *cu)
&& res.get_name () != nullptr
&& IS_ABSOLUTE_PATH (res.get_name ()))
{
- res.set_comp_dir (ldirname (res.get_name ()));
+ res.set_comp_dir (gdb_ldirname (res.get_name ()));
res.set_name (make_unique_xstrdup (lbasename (res.get_name ())));
}
@@ -6096,7 +6096,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
sect_offset line_offset = (sect_offset) attr->as_unsigned ();
line_header_up lh = dwarf_decode_line_header (line_offset, cu,
fnd.get_comp_dir ());
- if (lh->version == 5 && lh->is_valid_file_index (1))
+ if (lh->version == 5 && lh->include_dir_at (1) != nullptr)
{
std::string dir = lh->include_dir_at (1);
fnd.set_comp_dir (std::move (dir));
@@ -6148,6 +6148,20 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
}
}
+/* See cu.h.
+
+ This function is defined in this file (instead of cu.c) because it needs
+ to see the definition of struct dwo_unit. */
+
+const dwarf2_section_info &
+dwarf2_cu::section () const
+{
+ if (this->dwo_unit != nullptr)
+ return *this->dwo_unit->section;
+ else
+ return *this->per_cu->section;
+}
+
void
dwarf2_cu::setup_type_unit_groups (struct die_info *die)
{
@@ -6299,80 +6313,151 @@ static dwo_file *
lookup_dwo_file (dwarf2_per_bfd *per_bfd, const char *dwo_name,
const char *comp_dir)
{
+ gdb::lock_guard<gdb::mutex> guard (per_bfd->dwo_files_lock);
auto it = per_bfd->dwo_files.find (dwo_file_search {dwo_name, comp_dir});
-
return it != per_bfd->dwo_files.end () ? it->get() : nullptr;
}
-/* Create the dwo_units for the CUs in a DWO_FILE.
- Note: This function processes DWO files only, not DWP files. */
+/* Add DWO_FILE to the per-BFD DWO file hash table.
-static void
-create_cus_hash_table (dwarf2_cu *cu, dwo_file &dwo_file)
+ Return the dwo_file actually kept in the hash table.
+
+ If another thread raced with this one, opening the exact same DWO file and
+ inserting it first in the hash table, then keep that other thread's copy
+ and DWO_FILE gets freed. */
+
+static dwo_file *
+add_dwo_file (dwarf2_per_bfd *per_bfd, dwo_file_up dwo_file)
{
- dwarf2_per_objfile *per_objfile = cu->per_objfile;
- struct objfile *objfile = per_objfile->objfile;
- dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
- const gdb_byte *info_ptr, *end_ptr;
- auto &section = dwo_file.sections.info;
+ gdb::lock_guard<gdb::mutex> lock (per_bfd->dwo_files_lock);
+ return per_bfd->dwo_files.emplace (std::move (dwo_file)).first->get ();
+}
- section.read (objfile);
- info_ptr = section.buffer;
+void
+cutu_reader::create_dwo_unit_hash_tables (dwo_file &dwo_file,
+ dwarf2_cu &skeleton_cu,
+ dwarf2_section_info &section,
+ ruh_kind section_kind)
+{
+ dwarf2_per_objfile &per_objfile = *skeleton_cu.per_objfile;
+ dwarf2_per_bfd &per_bfd = *per_objfile.per_bfd;
+
+ const gdb_byte *info_ptr = section.buffer;
if (info_ptr == NULL)
return;
- dwarf_read_debug_printf ("Reading %s for %s:",
- section.get_name (),
+ dwarf_read_debug_printf ("Reading %s for %s:", section.get_name (),
section.get_file_name ());
- end_ptr = info_ptr + section.size;
+ const gdb_byte *end_ptr = info_ptr + section.size;
+
while (info_ptr < end_ptr)
{
sect_offset sect_off = (sect_offset) (info_ptr - section.buffer);
+ unit_head header;
+ dwarf2_section_info *abbrev_section = &dwo_file.sections.abbrev;
+ const gdb_byte *info_ptr_post_header
+ = read_and_check_unit_head (&header, &section, abbrev_section,
+ info_ptr, section_kind);
- /* The length of the CU gets set by the cutu_reader just below. */
- dwarf2_per_cu per_cu (per_bfd, &section, sect_off, 0 /* length */,
- false /* is_dwz */);
- cutu_reader reader (per_cu, *per_objfile, language_minimal,
- *cu, dwo_file);
+ unsigned int length = header.get_length_with_initial ();
+ info_ptr += length;
- info_ptr += per_cu.length ();
+ /* Skip dummy units. */
+ if (info_ptr_post_header >= info_ptr
+ || peek_abbrev_code (section.get_bfd_owner (),
+ info_ptr_post_header) == 0)
+ continue;
- if (reader.is_dummy())
+ if (header.unit_type != DW_UT_compile
+ && header.unit_type != DW_UT_split_compile
+ && header.unit_type != DW_UT_type
+ && header.unit_type != DW_UT_split_type)
continue;
- std::optional<ULONGEST> signature
- = lookup_dwo_id (cu, reader.top_level_die ());
- if (!signature.has_value ())
+ ULONGEST signature;
+
+ /* For type units (all DWARF versions) and DWARF 5 compile units, the
+ signature/DWO ID is already available in the header. For compile
+ units in DWARF < 5, we need to read the DW_AT_GNU_dwo_id attribute
+ from the top-level DIE.
+
+ For DWARF < 5 compile units, the unit type will be set to DW_UT_compile
+ by read_and_check_comp_unit_head. */
+ if (header.version < 5 && header.unit_type == DW_UT_compile)
{
- complaint (_(DWARF_ERROR_PREFIX
- "debug entry at offset %s is missing its dwo_id"
- " [in module %s]"),
- sect_offset_str (sect_off),
- dwo_file.dwo_name.c_str ());
- continue;
+ /* The length of the CU is not necessary. */
+ dwarf2_per_cu per_cu (&per_bfd, &section, sect_off, length,
+ false /* is_dwz */);
+ cutu_reader reader (per_cu, per_objfile, language_minimal,
+ skeleton_cu, dwo_file);
+
+ std::optional<ULONGEST> opt_signature
+ = lookup_dwo_id (reader.cu (), reader.top_level_die ());
+
+ if (!opt_signature.has_value ())
+ {
+ complaint (_ (DWARF_ERROR_PREFIX
+ "debug entry at offset %s is missing its dwo_id"
+ " [in module %s]"),
+ sect_offset_str (sect_off),
+ dwo_file.dwo_name.c_str ());
+ continue;
+ }
+
+ signature = *opt_signature;
}
+ else
+ signature = header.signature;
- dwo_unit *dwo_unit = OBSTACK_ZALLOC (&per_bfd->obstack, struct dwo_unit);
+ auto dwo_unit = std::make_unique<struct dwo_unit> ();
+ /* Set the fields common to compile and type units. */
dwo_unit->dwo_file = &dwo_file;
- dwo_unit->signature = *signature;
+ dwo_unit->signature = signature;
dwo_unit->section = &section;
dwo_unit->sect_off = sect_off;
- dwo_unit->length = per_cu.length ();
+ dwo_unit->length = length;
- dwarf_read_debug_printf (" offset %s, dwo_id %s",
- sect_offset_str (sect_off),
- hex_string (dwo_unit->signature));
+ switch (header.unit_type)
+ {
+ case DW_UT_compile:
+ case DW_UT_split_compile:
+ {
+ dwarf_read_debug_printf (" compile unit at offset %s, dwo_id %s",
+ sect_offset_str (sect_off),
+ hex_string (dwo_unit->signature));
- auto [it, inserted] = dwo_file.cus.emplace (dwo_unit);
- if (!inserted)
- complaint (_("debug cu entry at offset %s is duplicate to"
- " the entry at offset %s, signature %s"),
- sect_offset_str (sect_off),
- sect_offset_str ((*it)->sect_off),
- hex_string (dwo_unit->signature));
+ auto [it, inserted] = dwo_file.cus.emplace (std::move (dwo_unit));
+ if (!inserted)
+ complaint (_("debug cu entry at offset %s is duplicate to"
+ " the entry at offset %s, signature %s"),
+ sect_offset_str (sect_off),
+ sect_offset_str ((*it)->sect_off),
+ hex_string (dwo_unit->signature));
+ break;
+ }
+
+ case DW_UT_type:
+ case DW_UT_split_type:
+ {
+ dwo_unit->type_offset_in_tu = header.type_offset_in_tu;
+
+ dwarf_read_debug_printf (" type unit at offset %s, signature %s",
+ sect_offset_str (sect_off),
+ hex_string (dwo_unit->signature));
+
+ auto [it, inserted] = dwo_file.tus.emplace (std::move (dwo_unit));
+ if (!inserted)
+ complaint (_("debug type entry at offset %s is duplicate to"
+ " the entry at offset %s, signature %s"),
+ sect_offset_str (sect_off),
+ sect_offset_str ((*it)->sect_off),
+ hex_string (header.signature));
+ break;
+ }
+ }
}
}
@@ -6530,27 +6615,18 @@ create_cus_hash_table (dwarf2_cu *cu, dwo_file &dwo_file)
Note: This function processes DWP files only, not DWO files. */
static struct dwp_hash_table *
-create_dwp_hash_table (dwarf2_per_objfile *per_objfile,
- struct dwp_file *dwp_file, int is_debug_types)
+create_dwp_hash_table (dwarf2_per_bfd *per_bfd, struct dwp_file *dwp_file,
+ dwarf2_section_info &index)
{
- struct objfile *objfile = per_objfile->objfile;
bfd *dbfd = dwp_file->dbfd.get ();
- const gdb_byte *index_ptr, *index_end;
- struct dwarf2_section_info *index;
uint32_t version, nr_columns, nr_units, nr_slots;
struct dwp_hash_table *htab;
- if (is_debug_types)
- index = &dwp_file->sections.tu_index;
- else
- index = &dwp_file->sections.cu_index;
-
- if (index->empty ())
+ if (index.empty ())
return NULL;
- index->read (objfile);
- index_ptr = index->buffer;
- index_end = index_ptr + index->size;
+ const gdb_byte *index_ptr = index.buffer;
+ const gdb_byte *index_end = index_ptr + index.size;
/* For Version 5, the version is really 2 bytes of data & 2 bytes of padding.
For now it's safe to just read 4 bytes (particularly as it's difficult to
@@ -6581,7 +6657,7 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile,
pulongest (nr_slots), dwp_file->name);
}
- htab = OBSTACK_ZALLOC (&per_objfile->per_bfd->obstack, struct dwp_hash_table);
+ htab = OBSTACK_ZALLOC (&per_bfd->obstack, struct dwp_hash_table);
htab->version = version;
htab->nr_columns = nr_columns;
htab->nr_units = nr_units;
@@ -6853,7 +6929,7 @@ locate_v1_virtual_dwo_sections (asection *sectp,
COMP_DIR is the DW_AT_comp_dir attribute of the referencing CU.
This is for DWP version 1 files. */
-static struct dwo_unit *
+static dwo_unit_up
create_dwo_unit_in_dwp_v1 (dwarf2_per_bfd *per_bfd,
struct dwp_file *dwp_file,
uint32_t unit_index,
@@ -6976,19 +7052,17 @@ create_dwo_unit_in_dwp_v1 (dwarf2_per_bfd *per_bfd,
types we'll grow the vector and eventually have to reallocate space
for it, invalidating all copies of pointers into the previous
contents. */
- auto [it, inserted]
- = per_bfd->dwo_files.emplace (std::move (new_dwo_file));
- gdb_assert (inserted);
- dwo_file = it->get ();
+ dwo_file = add_dwo_file (per_bfd, std::move (new_dwo_file));
}
else
dwarf_read_debug_printf ("Using existing virtual DWO: %s",
virtual_dwo_name.c_str ());
- dwo_unit *dwo_unit = OBSTACK_ZALLOC (&per_bfd->obstack, struct dwo_unit);
+ auto dwo_unit = std::make_unique<struct dwo_unit> ();
dwo_unit->dwo_file = dwo_file;
dwo_unit->signature = signature;
- dwo_unit->section = XOBNEW (&per_bfd->obstack, struct dwarf2_section_info);
+ dwo_unit->section_holder = std::make_unique<dwarf2_section_info> ();
+ dwo_unit->section = dwo_unit->section_holder.get ();
*dwo_unit->section = sections.info_or_types;
/* dwo_unit->{offset,length,type_offset_in_tu} are set later. */
@@ -7046,7 +7120,7 @@ create_dwp_v2_or_v5_section (dwarf2_per_bfd *per_bfd,
COMP_DIR is the DW_AT_comp_dir attribute of the referencing CU.
This is for DWP version 2 files. */
-static struct dwo_unit *
+static dwo_unit_up
create_dwo_unit_in_dwp_v2 (dwarf2_per_bfd *per_bfd,
struct dwp_file *dwp_file,
uint32_t unit_index,
@@ -7181,19 +7255,17 @@ create_dwo_unit_in_dwp_v2 (dwarf2_per_bfd *per_bfd,
types we'll grow the vector and eventually have to reallocate space
for it, invalidating all copies of pointers into the previous
contents. */
- auto [it, inserted]
- = per_bfd->dwo_files.emplace (std::move (new_dwo_file));
- gdb_assert (inserted);
- dwo_file = it->get ();
+ dwo_file = add_dwo_file (per_bfd, std::move (new_dwo_file));
}
else
dwarf_read_debug_printf ("Using existing virtual DWO: %s",
virtual_dwo_name.c_str ());
- dwo_unit *dwo_unit = OBSTACK_ZALLOC (&per_bfd->obstack, struct dwo_unit);
+ auto dwo_unit = std::make_unique<struct dwo_unit> ();
dwo_unit->dwo_file = dwo_file;
dwo_unit->signature = signature;
- dwo_unit->section = XOBNEW (&per_bfd->obstack, struct dwarf2_section_info);
+ dwo_unit->section_holder = std::make_unique<dwarf2_section_info> ();
+ dwo_unit->section = dwo_unit->section_holder.get ();
*dwo_unit->section = create_dwp_v2_or_v5_section
(per_bfd,
is_debug_types
@@ -7211,7 +7283,7 @@ create_dwo_unit_in_dwp_v2 (dwarf2_per_bfd *per_bfd,
COMP_DIR is the DW_AT_comp_dir attribute of the referencing CU.
This is for DWP version 5 files. */
-static struct dwo_unit *
+static dwo_unit_up
create_dwo_unit_in_dwp_v5 (dwarf2_per_bfd *per_bfd,
struct dwp_file *dwp_file,
uint32_t unit_index,
@@ -7351,16 +7423,13 @@ create_dwo_unit_in_dwp_v5 (dwarf2_per_bfd *per_bfd,
types we'll grow the vector and eventually have to reallocate space
for it, invalidating all copies of pointers into the previous
contents. */
- auto [it, inserted]
- = per_bfd->dwo_files.emplace (std::move (new_dwo_file));
- gdb_assert (inserted);
- dwo_file = it->get ();
+ dwo_file = add_dwo_file (per_bfd, std::move (new_dwo_file));
}
else
dwarf_read_debug_printf ("Using existing virtual DWO: %s",
virtual_dwo_name.c_str ());
- dwo_unit *dwo_unit = OBSTACK_ZALLOC (&per_bfd->obstack, struct dwo_unit);
+ auto dwo_unit = std::make_unique<struct dwo_unit> ();
dwo_unit->dwo_file = dwo_file;
dwo_unit->signature = signature;
dwo_unit->section
@@ -7391,9 +7460,12 @@ lookup_dwo_unit_in_dwp (dwarf2_per_bfd *per_bfd,
auto &dwo_unit_set
= is_debug_types ? dwp_file->loaded_tus : dwp_file->loaded_cus;
- if (auto it = dwo_unit_set.find (signature);
- it != dwo_unit_set.end ())
- return *it;
+ {
+ gdb::lock_guard<gdb::mutex> guard (dwp_file->loaded_cutus_lock);
+ if (auto it = dwo_unit_set.find (signature);
+ it != dwo_unit_set.end ())
+ return it->get ();
+ }
/* Use a for loop so that we don't loop forever on bad debug info. */
for (unsigned int i = 0; i < dwp_htab->nr_slots; ++i)
@@ -7407,7 +7479,7 @@ lookup_dwo_unit_in_dwp (dwarf2_per_bfd *per_bfd,
uint32_t unit_index =
read_4_bytes (dbfd,
dwp_htab->unit_table + hash * sizeof (uint32_t));
- dwo_unit *dwo_unit;
+ dwo_unit_up dwo_unit;
if (dwp_file->version == 1)
dwo_unit
@@ -7422,9 +7494,11 @@ lookup_dwo_unit_in_dwp (dwarf2_per_bfd *per_bfd,
= create_dwo_unit_in_dwp_v5 (per_bfd, dwp_file, unit_index,
comp_dir, signature, is_debug_types);
- auto [it, inserted] = dwo_unit_set.emplace (dwo_unit);
- gdb_assert (inserted);
- return *it;
+ /* If another thread raced with this one, opening the exact same
+ DWO unit, then we'll keep that other thread's copy. */
+ gdb::lock_guard<gdb::mutex> guard (dwp_file->loaded_cutus_lock);
+ auto it = dwo_unit_set.emplace (std::move (dwo_unit)).first;
+ return it->get ();
}
if (signature_in_table == 0)
@@ -7480,7 +7554,7 @@ try_open_dwop_file (dwarf2_per_bfd *per_bfd, const char *file_name, int is_dwp,
search_path = per_bfd->captured_debug_dir.c_str ();
/* Add the path for the executable binary to the list of search paths. */
- std::string objfile_dir = ldirname (per_bfd->filename ());
+ std::string objfile_dir = gdb_ldirname (per_bfd->filename ());
search_path_holder.reset (concat (objfile_dir.c_str (),
dirname_separator_string,
search_path, nullptr));
@@ -7501,14 +7575,21 @@ try_open_dwop_file (dwarf2_per_bfd *per_bfd, const char *file_name, int is_dwp,
if (sym_bfd == NULL)
return NULL;
- if (!bfd_check_format (sym_bfd.get (), bfd_object))
- return NULL;
+ {
+ /* The operations below are not thread-safe, use a lock to synchronize
+ concurrent accesses. */
+ static gdb::mutex mutex;
+ gdb::lock_guard<gdb::mutex> lock (mutex);
+
+ if (!bfd_check_format (sym_bfd.get (), bfd_object))
+ return NULL;
- /* Success. Record the bfd as having been included by the objfile's bfd.
+ /* Success. Record the bfd as having been included by the objfile's bfd.
This is important because things like demangled_names_hash lives in the
objfile's per_bfd space and may have references to things like symbol
names that live in the DWO/DWP file's per_bfd space. PR 16426. */
- gdb_bfd_record_inclusion (per_bfd->obfd, sym_bfd.get ());
+ gdb_bfd_record_inclusion (per_bfd->obfd, sym_bfd.get ());
+ }
return sym_bfd;
}
@@ -7520,9 +7601,9 @@ try_open_dwop_file (dwarf2_per_bfd *per_bfd, const char *file_name, int is_dwp,
Upon success, the canonicalized path of the file is stored in the bfd,
same as symfile_bfd_open. */
-static gdb_bfd_ref_ptr
-open_dwo_file (dwarf2_per_bfd *per_bfd, const char *file_name,
- const char *comp_dir)
+gdb_bfd_ref_ptr
+cutu_reader::open_dwo_file (dwarf2_per_bfd *per_bfd, const char *file_name,
+ const char *comp_dir)
{
if (IS_ABSOLUTE_PATH (file_name))
return try_open_dwop_file (per_bfd, file_name,
@@ -7557,48 +7638,67 @@ open_dwo_file (dwarf2_per_bfd *per_bfd, const char *file_name,
/* This function is mapped across the sections and remembers the offset and
size of each of the DWO debugging sections we are interested in. */
-static void
-dwarf2_locate_dwo_sections (struct objfile *objfile, bfd *abfd,
- asection *sectp, dwo_sections *dwo_sections)
+void
+cutu_reader::locate_dwo_sections (objfile *objfile, dwo_file &dwo_file)
{
const struct dwop_section_names *names = &dwop_section_names;
+ dwo_sections &dwo_sections = dwo_file.sections;
+ bool complained_about_macro_already = false;
+
+ for (asection *sec : gdb_bfd_sections (dwo_file.dbfd))
+ {
+ struct dwarf2_section_info *dw_sect = nullptr;
+
+ if (names->abbrev_dwo.matches (sec->name))
+ dw_sect = &dwo_sections.abbrev;
+ else if (names->info_dwo.matches (sec->name))
+ dw_sect = &dwo_sections.infos.emplace_back (dwarf2_section_info {});
+ else if (names->line_dwo.matches (sec->name))
+ dw_sect = &dwo_sections.line;
+ else if (names->loc_dwo.matches (sec->name))
+ dw_sect = &dwo_sections.loc;
+ else if (names->loclists_dwo.matches (sec->name))
+ dw_sect = &dwo_sections.loclists;
+ else if (names->macinfo_dwo.matches (sec->name))
+ dw_sect = &dwo_sections.macinfo;
+ else if (names->macro_dwo.matches (sec->name))
+ {
+ /* gcc versions <= 13 generate multiple .debug_macro.dwo sections with
+ some unresolved links between them. It's not usable, so do as if
+ there were not there. */
+ if (!complained_about_macro_already)
+ {
+ if (dwo_sections.macro.s.section == nullptr)
+ dw_sect = &dwo_sections.macro;
+ else
+ {
+ warning (_("Multiple .debug_macro.dwo sections found in "
+ "%s, ignoring them."), dwo_file.dbfd->filename);
- struct dwarf2_section_info *dw_sect = nullptr;
-
- if (names->abbrev_dwo.matches (sectp->name))
- dw_sect = &dwo_sections->abbrev;
- else if (names->info_dwo.matches (sectp->name))
- dw_sect = &dwo_sections->info;
- else if (names->line_dwo.matches (sectp->name))
- dw_sect = &dwo_sections->line;
- else if (names->loc_dwo.matches (sectp->name))
- dw_sect = &dwo_sections->loc;
- else if (names->loclists_dwo.matches (sectp->name))
- dw_sect = &dwo_sections->loclists;
- else if (names->macinfo_dwo.matches (sectp->name))
- dw_sect = &dwo_sections->macinfo;
- else if (names->macro_dwo.matches (sectp->name))
- dw_sect = &dwo_sections->macro;
- else if (names->rnglists_dwo.matches (sectp->name))
- dw_sect = &dwo_sections->rnglists;
- else if (names->str_dwo.matches (sectp->name))
- dw_sect = &dwo_sections->str;
- else if (names->str_offsets_dwo.matches (sectp->name))
- dw_sect = &dwo_sections->str_offsets;
- else if (names->types_dwo.matches (sectp->name))
- {
- struct dwarf2_section_info type_section;
-
- memset (&type_section, 0, sizeof (type_section));
- dwo_sections->types.push_back (type_section);
- dw_sect = &dwo_sections->types.back ();
- }
+ dwo_sections.macro = dwarf2_section_info {};
+ complained_about_macro_already = true;
+ }
+ }
+ }
+ else if (names->rnglists_dwo.matches (sec->name))
+ dw_sect = &dwo_sections.rnglists;
+ else if (names->str_dwo.matches (sec->name))
+ dw_sect = &dwo_sections.str;
+ else if (names->str_offsets_dwo.matches (sec->name))
+ dw_sect = &dwo_sections.str_offsets;
+ else if (names->types_dwo.matches (sec->name))
+ dw_sect = &dwo_sections.types.emplace_back (dwarf2_section_info {});
+
+ if (dw_sect != nullptr)
+ {
+ /* Make sure we don't overwrite a section info that has been filled in
+ already. */
+ gdb_assert (!dw_sect->readin);
- if (dw_sect != nullptr)
- {
- dw_sect->s.section = sectp;
- dw_sect->size = bfd_section_size (sectp);
- dw_sect->read (objfile);
+ dw_sect->s.section = sec;
+ dw_sect->size = bfd_section_size (sec);
+ dw_sect->read (objfile);
+ }
}
}
@@ -7606,9 +7706,9 @@ dwarf2_locate_dwo_sections (struct objfile *objfile, bfd *abfd,
by PER_CU. This is for the non-DWP case.
The result is NULL if DWO_NAME can't be found. */
-static dwo_file_up
-open_and_init_dwo_file (dwarf2_cu *cu, const char *dwo_name,
- const char *comp_dir)
+dwo_file_up
+cutu_reader::open_and_init_dwo_file (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir)
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
@@ -7626,18 +7726,13 @@ open_and_init_dwo_file (dwarf2_cu *cu, const char *dwo_name,
dwo_file->comp_dir = comp_dir;
dwo_file->dbfd = std::move (dbfd);
- for (asection *sec : gdb_bfd_sections (dwo_file->dbfd))
- dwarf2_locate_dwo_sections (per_objfile->objfile, dwo_file->dbfd.get (),
- sec, &dwo_file->sections);
+ this->locate_dwo_sections (per_objfile->objfile, *dwo_file);
- create_cus_hash_table (cu, *dwo_file);
+ for (dwarf2_section_info &section : dwo_file->sections.infos)
+ create_dwo_unit_hash_tables (*dwo_file, *cu, section, ruh_kind::COMPILE);
- if (cu->header.version < 5)
- create_debug_types_hash_table (per_objfile, dwo_file.get (),
- dwo_file->sections.types);
- else
- create_debug_type_hash_table (per_objfile, dwo_file.get (),
- &dwo_file->sections.info, rcuh_kind::COMPILE);
+ for (dwarf2_section_info &section : dwo_file->sections.types)
+ create_dwo_unit_hash_tables (*dwo_file, *cu, section, ruh_kind::TYPE);
dwarf_read_debug_printf ("DWO file found: %s", dwo_name);
@@ -7673,6 +7768,10 @@ dwarf2_locate_common_dwp_sections (struct objfile *objfile, bfd *abfd,
if (dw_sect != nullptr)
{
+ /* Make sure we don't overwrite a section info that has been filled in
+ already. */
+ gdb_assert (!dw_sect->readin);
+
dw_sect->s.section = sectp;
dw_sect->size = bfd_section_size (sectp);
dw_sect->read (objfile);
@@ -7718,6 +7817,10 @@ dwarf2_locate_v2_dwp_sections (struct objfile *objfile, bfd *abfd,
if (dw_sect != nullptr)
{
+ /* Make sure we don't overwrite a section info that has been filled in
+ already. */
+ gdb_assert (!dw_sect->readin);
+
dw_sect->s.section = sectp;
dw_sect->size = bfd_section_size (sectp);
dw_sect->read (objfile);
@@ -7761,6 +7864,10 @@ dwarf2_locate_v5_dwp_sections (struct objfile *objfile, bfd *abfd,
if (dw_sect != nullptr)
{
+ /* Make sure we don't overwrite a section info that has been filled in
+ already. */
+ gdb_assert (!dw_sect->readin);
+
dw_sect->s.section = sectp;
dw_sect->size = bfd_section_size (sectp);
dw_sect->read (objfile);
@@ -7803,10 +7910,9 @@ open_dwp_file (dwarf2_per_bfd *per_bfd, const char *file_name)
}
/* Initialize the use of the DWP file for the current objfile.
- By convention the name of the DWP file is ${objfile}.dwp.
- The result is NULL if it can't be found. */
+ By convention the name of the DWP file is ${objfile}.dwp. */
-static dwp_file_up
+static void
open_and_init_dwp_file (dwarf2_per_objfile *per_objfile)
{
struct objfile *objfile = per_objfile->objfile;
@@ -7823,7 +7929,7 @@ open_and_init_dwp_file (dwarf2_per_objfile *per_objfile)
struct objfile *backlink = objfile->separate_debug_objfile_backlink;
const char *backlink_basename = lbasename (backlink->original_name);
- dwp_name = ldirname (objfile->original_name) + SLASH_STRING + backlink_basename;
+ dwp_name = gdb_ldirname (objfile->original_name) + SLASH_STRING + backlink_basename;
}
else
dwp_name = objfile->original_name;
@@ -7844,7 +7950,7 @@ open_and_init_dwp_file (dwarf2_per_objfile *per_objfile)
{
dwarf_read_debug_printf ("DWP file not found: %s", dwp_name.c_str ());
- return dwp_file_up ();
+ return;
}
const char *name = bfd_get_filename (dbfd.get ());
@@ -7858,9 +7964,10 @@ open_and_init_dwp_file (dwarf2_per_objfile *per_objfile)
dwarf2_locate_common_dwp_sections (objfile, dwp_file->dbfd.get (), sec,
dwp_file.get ());
- dwp_file->cus = create_dwp_hash_table (per_objfile, dwp_file.get (), 0);
-
- dwp_file->tus = create_dwp_hash_table (per_objfile, dwp_file.get (), 1);
+ dwp_file->cus = create_dwp_hash_table (per_bfd, dwp_file.get (),
+ dwp_file->sections.cu_index);
+ dwp_file->tus = create_dwp_hash_table (per_bfd, dwp_file.get (),
+ dwp_file->sections.tu_index);
/* The DWP file version is stored in the hash table. Oh well. */
if (dwp_file->cus && dwp_file->tus
@@ -7900,20 +8007,8 @@ open_and_init_dwp_file (dwarf2_per_objfile *per_objfile)
bfd_cache_close (dwp_file->dbfd.get ());
- return dwp_file;
-}
-
-/* Wrapper around open_and_init_dwp_file, only open it once. */
-
-static struct dwp_file *
-get_dwp_file (dwarf2_per_objfile *per_objfile)
-{
- if (!per_objfile->per_bfd->dwp_checked)
- {
- per_objfile->per_bfd->dwp_file = open_and_init_dwp_file (per_objfile);
- per_objfile->per_bfd->dwp_checked = 1;
- }
- return per_objfile->per_bfd->dwp_file.get ();
+ /* Everything worked, install this dwp_file in the per_bfd. */
+ per_objfile->per_bfd->dwp_file = std::move (dwp_file);
}
/* Subroutine of lookup_dwo_comp_unit, lookup_dwo_type_unit.
@@ -7932,22 +8027,23 @@ get_dwp_file (dwarf2_per_objfile *per_objfile)
The result is a pointer to the dwo_unit object or NULL if we didn't find it
(dwo_id mismatch or couldn't find the DWO/DWP file). */
-static struct dwo_unit *
-lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
- ULONGEST signature, int is_debug_types)
+dwo_unit *
+cutu_reader::lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir, ULONGEST signature,
+ int is_debug_types)
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
struct objfile *objfile = per_objfile->objfile;
const char *kind = is_debug_types ? "TU" : "CU";
- struct dwp_file *dwp_file;
/* First see if there's a DWP file.
If we have a DWP file but didn't find the DWO inside it, don't
look for the original DWO file. It makes gdb behave differently
depending on whether one is debugging in the build tree. */
- dwp_file = get_dwp_file (per_objfile);
+ dwp_file *dwp_file = per_objfile->per_bfd->dwp_file.get ();
+
if (dwp_file != NULL)
{
const struct dwp_hash_table *dwp_htab =
@@ -7983,12 +8079,7 @@ lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
= open_and_init_dwo_file (cu, dwo_name, comp_dir);
if (new_dwo_file != nullptr)
- {
- auto [it, inserted]
- = per_bfd->dwo_files.emplace (std::move (new_dwo_file));
- gdb_assert (inserted);
- dwo_file = (*it).get ();
- }
+ dwo_file = add_dwo_file (per_bfd, std::move (new_dwo_file));
}
if (dwo_file != NULL)
@@ -7999,13 +8090,13 @@ lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
{
if (auto it = dwo_file->tus.find (signature);
it != dwo_file->tus.end ())
- dwo_cutu = *it;
+ dwo_cutu = it->get ();
}
else if (!is_debug_types && !dwo_file->cus.empty ())
{
if (auto it = dwo_file->cus.find (signature);
it != dwo_file->cus.end ())
- dwo_cutu = *it;
+ dwo_cutu = it->get ();
}
if (dwo_cutu != NULL)
@@ -8048,9 +8139,9 @@ lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
/* Lookup the DWO CU DWO_NAME/SIGNATURE referenced from THIS_CU.
See lookup_dwo_cutu_unit for details. */
-static struct dwo_unit *
-lookup_dwo_comp_unit (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
- ULONGEST signature)
+dwo_unit *
+cutu_reader::lookup_dwo_comp_unit (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir, ULONGEST signature)
{
gdb_assert (!cu->per_cu->is_debug_types);
@@ -8060,8 +8151,9 @@ lookup_dwo_comp_unit (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
/* Lookup the DWO TU DWO_NAME/SIGNATURE referenced from THIS_TU.
See lookup_dwo_cutu_unit for details. */
-static struct dwo_unit *
-lookup_dwo_type_unit (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir)
+dwo_unit *
+cutu_reader::lookup_dwo_type_unit (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir)
{
gdb_assert (cu->per_cu->is_debug_types);
@@ -8104,15 +8196,15 @@ queue_and_load_all_dwo_tus (dwarf2_cu *cu)
gdb_assert (cu != nullptr);
gdb_assert (!cu->per_cu->is_debug_types);
- gdb_assert (get_dwp_file (cu->per_objfile) == nullptr);
+ gdb_assert (cu->per_objfile->per_bfd->dwp_file == nullptr);
dwo_unit = cu->dwo_unit;
gdb_assert (dwo_unit != NULL);
dwo_file = dwo_unit->dwo_file;
- for (struct dwo_unit *unit : dwo_file->tus)
- queue_and_load_dwo_tu (unit, cu);
+ for (const dwo_unit_up &unit : dwo_file->tus)
+ queue_and_load_dwo_tu (unit.get (), cu);
}
/* Read in various DIEs. */
@@ -8788,7 +8880,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
struct dwarf2_locexpr_baton *dlbaton;
struct dwarf_block *block = attr->as_block ();
- dlbaton = XOBNEW (&objfile->objfile_obstack, struct dwarf2_locexpr_baton);
+ dlbaton = OBSTACK_ZALLOC (&objfile->objfile_obstack,
+ struct dwarf2_locexpr_baton);
dlbaton->data = block->data;
dlbaton->size = block->size;
dlbaton->per_objfile = per_objfile;
@@ -8887,7 +8980,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
parameter->kind = CALL_SITE_PARAMETER_PARAM_OFFSET;
sect_offset sect_off = origin->get_ref_die_offset ();
- if (!cu->header.offset_in_cu_p (sect_off))
+ if (!cu->header.offset_in_unit_p (sect_off))
{
/* As DW_OP_GNU_parameter_ref uses CU-relative offset this
binding can be done only inside one CU. Such referenced DIE
@@ -9255,7 +9348,7 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu, dwarf_tag tag,
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
struct objfile *objfile = per_objfile->objfile;
- struct comp_unit_head *cu_header = &cu->header;
+ unit_head *cu_header = &cu->header;
bfd *obfd = objfile->obfd.get ();
unsigned int addr_size = cu_header->addr_size;
CORE_ADDR mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
@@ -9911,69 +10004,44 @@ dwarf2_access_attribute (struct die_info *die, struct dwarf2_cu *cu)
}
}
-/* Look for DW_AT_data_member_location or DW_AT_data_bit_offset. Set
- *OFFSET to the byte offset. If the attribute was not found return
- 0, otherwise return 1. If it was found but could not properly be
- handled, set *OFFSET to 0. */
+/* Look for DW_AT_data_member_location or DW_AT_data_bit_offset and
+ store the results in FIELD. */
-static int
+static void
handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
- LONGEST *offset)
+ struct field *field)
{
- struct attribute *attr;
+ const auto data_member_location_attr
+ = dwarf2_attr (die, DW_AT_data_member_location, cu);
- attr = dwarf2_attr (die, DW_AT_data_member_location, cu);
- if (attr != NULL)
+ if (data_member_location_attr != nullptr)
{
- *offset = 0;
- CORE_ADDR temp;
+ bool has_bit_offset = false;
+ LONGEST bit_offset = 0;
+ LONGEST anonymous_size = 0;
+ const auto bit_offset_attr = dwarf2_attr (die, DW_AT_bit_offset, cu);
- /* Note that we do not check for a section offset first here.
- This is because DW_AT_data_member_location is new in DWARF 4,
- so if we see it, we can assume that a constant form is really
- a constant and not a section offset. */
- if (attr->form_is_constant ())
- *offset = attr->constant_value (0);
- else if (attr->form_is_section_offset ())
- dwarf2_complex_location_expr_complaint ();
- else if (attr->form_is_block ()
- && decode_locdesc (attr->as_block (), cu, &temp))
+ if (bit_offset_attr != nullptr && bit_offset_attr->form_is_constant ())
{
- *offset = temp;
- }
- else
- dwarf2_complex_location_expr_complaint ();
+ has_bit_offset = true;
+ bit_offset = bit_offset_attr->confused_constant ().value_or (0);
- return 1;
- }
- else
- {
- attr = dwarf2_attr (die, DW_AT_data_bit_offset, cu);
- if (attr != nullptr)
- {
- *offset = attr->constant_value (0);
- return 1;
- }
- }
+ const auto byte_size_attr = dwarf2_attr (die, DW_AT_byte_size, cu);
- return 0;
-}
-
-/* Look for DW_AT_data_member_location or DW_AT_data_bit_offset and
- store the results in FIELD. */
-
-static void
-handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
- struct field *field)
-{
- struct attribute *attr;
+ if (byte_size_attr != nullptr && byte_size_attr->form_is_constant ())
+ {
+ /* The size of the anonymous object containing
+ the bit field is explicit, so use the
+ indicated size (in bytes). */
+ anonymous_size
+ = byte_size_attr->unsigned_constant ().value_or (0);
+ }
+ }
- attr = dwarf2_attr (die, DW_AT_data_member_location, cu);
- if (attr != NULL)
- {
- if (attr->form_is_constant ())
+ if (data_member_location_attr->form_is_constant ())
{
- LONGEST offset = attr->constant_value (0);
+ LONGEST offset
+ = data_member_location_attr->confused_constant ().value_or (0);
/* Work around this GCC 11 bug, where it would erroneously use -1
data member locations, instead of 0:
@@ -9988,23 +10056,40 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
}
field->set_loc_bitpos (offset * bits_per_byte);
+ if (has_bit_offset)
+ apply_bit_offset_to_field (*field, bit_offset, anonymous_size);
}
- else if (attr->form_is_section_offset ())
- dwarf2_complex_location_expr_complaint ();
- else if (attr->form_is_block ())
+ else if (data_member_location_attr->form_is_block ())
{
CORE_ADDR offset;
- if (decode_locdesc (attr->as_block (), cu, &offset))
- field->set_loc_bitpos (offset * bits_per_byte);
+ if (decode_locdesc (data_member_location_attr->as_block (), cu,
+ &offset))
+ {
+ field->set_loc_bitpos (offset * bits_per_byte);
+
+ if (has_bit_offset)
+ apply_bit_offset_to_field (*field, bit_offset, anonymous_size);
+ }
else
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
struct objfile *objfile = per_objfile->objfile;
- struct dwarf2_locexpr_baton *dlbaton
- = XOBNEW (&objfile->objfile_obstack,
- struct dwarf2_locexpr_baton);
- dlbaton->data = attr->as_block ()->data;
- dlbaton->size = attr->as_block ()->size;
+ struct dwarf2_locexpr_baton *dlbaton;
+ if (has_bit_offset)
+ {
+ dwarf2_field_location_baton *flbaton
+ = OBSTACK_ZALLOC (&objfile->objfile_obstack,
+ dwarf2_field_location_baton);
+ flbaton->is_field_location = true;
+ flbaton->bit_offset = bit_offset;
+ flbaton->explicit_byte_size = anonymous_size;
+ dlbaton = flbaton;
+ }
+ else
+ dlbaton = OBSTACK_ZALLOC (&objfile->objfile_obstack,
+ struct dwarf2_locexpr_baton);
+ dlbaton->data = data_member_location_attr->as_block ()->data;
+ dlbaton->size = data_member_location_attr->as_block ()->size;
/* When using this baton, we want to compute the address
of the field, not the value. This is why
is_reference is set to false here. */
@@ -10012,28 +10097,74 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
dlbaton->per_objfile = per_objfile;
dlbaton->per_cu = cu->per_cu;
- field->set_loc_dwarf_block (dlbaton);
+ field->set_loc_dwarf_block_addr (dlbaton);
}
}
else
- dwarf2_complex_location_expr_complaint ();
+ complaint (_("Unsupported form %s for DW_AT_data_member_location"),
+ dwarf_form_name (data_member_location_attr->form));
}
else
{
- attr = dwarf2_attr (die, DW_AT_data_bit_offset, cu);
- if (attr != nullptr)
- field->set_loc_bitpos (attr->constant_value (0));
+ const auto data_bit_offset_attr
+ = dwarf2_attr (die, DW_AT_data_bit_offset, cu);
+
+ if (data_bit_offset_attr != nullptr)
+ {
+ if (data_bit_offset_attr->form_is_constant ())
+ field->set_loc_bitpos (data_bit_offset_attr->unsigned_constant ()
+ .value_or (0));
+ else if (data_bit_offset_attr->form_is_block ())
+ {
+ /* This is a DWARF extension. See
+ https://dwarfstd.org/issues/250501.1.html. */
+ dwarf2_per_objfile *per_objfile = cu->per_objfile;
+ dwarf2_locexpr_baton *dlbaton
+ = OBSTACK_ZALLOC (&per_objfile->objfile->objfile_obstack,
+ dwarf2_locexpr_baton);
+ dlbaton->data = data_bit_offset_attr->as_block ()->data;
+ dlbaton->size = data_bit_offset_attr->as_block ()->size;
+ dlbaton->per_objfile = per_objfile;
+ dlbaton->per_cu = cu->per_cu;
+
+ field->set_loc_dwarf_block_bitpos (dlbaton);
+ }
+ else
+ complaint (_("Unsupported form %s for DW_AT_data_bit_offset"),
+ dwarf_form_name (data_bit_offset_attr->form));
+ }
}
}
+/* A helper that computes the location of a field. The CU and the
+ DW_TAG_member DIE are passed in. The results are stored in
+ *FP. */
+
+static void
+compute_field_location (dwarf2_cu *cu, die_info *die, field *fp)
+{
+ /* Get type of field. */
+ fp->set_type (die_type (die, cu));
+
+ fp->set_loc_bitpos (0);
+
+ /* Get bit size of field (zero if none). */
+ attribute *attr = dwarf2_attr (die, DW_AT_bit_size, cu);
+ if (attr != nullptr)
+ fp->set_bitsize (attr->unsigned_constant ().value_or (0));
+ else
+ fp->set_bitsize (0);
+
+ /* Get bit offset of field. */
+ handle_member_location (die, cu, fp);
+}
+
/* Add an aggregate field to the field list. */
static void
dwarf2_add_field (struct field_info *fip, struct die_info *die,
struct dwarf2_cu *cu)
{
- struct objfile *objfile = cu->per_objfile->objfile;
- struct gdbarch *gdbarch = objfile->arch ();
struct nextfield *new_field;
struct attribute *attr;
struct field *fp;
@@ -10083,64 +10214,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
}
/* Data member other than a C++ static data member. */
- /* Get type of field. */
- fp->set_type (die_type (die, cu));
-
- fp->set_loc_bitpos (0);
-
- /* Get bit size of field (zero if none). */
- attr = dwarf2_attr (die, DW_AT_bit_size, cu);
- if (attr != nullptr)
- fp->set_bitsize (attr->constant_value (0));
- else
- fp->set_bitsize (0);
-
- /* Get bit offset of field. */
- handle_member_location (die, cu, fp);
- attr = dwarf2_attr (die, DW_AT_bit_offset, cu);
- if (attr != nullptr && attr->form_is_constant ())
- {
- if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
- {
- /* For big endian bits, the DW_AT_bit_offset gives the
- additional bit offset from the MSB of the containing
- anonymous object to the MSB of the field. We don't
- have to do anything special since we don't need to
- know the size of the anonymous object. */
- fp->set_loc_bitpos (fp->loc_bitpos () + attr->constant_value (0));
- }
- else
- {
- /* For little endian bits, compute the bit offset to the
- MSB of the anonymous object, subtract off the number of
- bits from the MSB of the field to the MSB of the
- object, and then subtract off the number of bits of
- the field itself. The result is the bit offset of
- the LSB of the field. */
- int anonymous_size;
- int bit_offset = attr->constant_value (0);
-
- attr = dwarf2_attr (die, DW_AT_byte_size, cu);
- if (attr != nullptr && attr->form_is_constant ())
- {
- /* The size of the anonymous object containing
- the bit field is explicit, so use the
- indicated size (in bytes). */
- anonymous_size = attr->constant_value (0);
- }
- else
- {
- /* The size of the anonymous object containing
- the bit field must be inferred from the type
- attribute of the data member containing the
- bit field. */
- anonymous_size = fp->type ()->length ();
- }
- fp->set_loc_bitpos (fp->loc_bitpos ()
- + anonymous_size * bits_per_byte
- - bit_offset - fp->bitsize ());
- }
- }
+ compute_field_location (cu, die, fp);
/* Get name of field. */
fieldname = dwarf2_name (die, cu);
@@ -10279,13 +10353,19 @@ convert_variant_range (struct obstack *obstack, const variant_field &variant,
{
std::vector<discriminant_range> ranges;
- if (variant.default_branch)
+ if (variant.is_default ())
return {};
if (variant.discr_list_data == nullptr)
{
- discriminant_range r
- = {variant.discriminant_value, variant.discriminant_value};
+ ULONGEST value;
+
+ if (is_unsigned)
+ value = variant.discriminant_attr->unsigned_constant ().value_or (0);
+ else
+ value = variant.discriminant_attr->signed_constant ().value_or (0);
+
+ discriminant_range r = { value, value };
ranges.push_back (r);
}
else
@@ -10582,7 +10662,6 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
smash_to_method_type (fnp->type, type,
this_type->target_type (),
this_type->fields (),
- this_type->num_fields (),
this_type->has_varargs ());
/* Handle static member functions.
@@ -10804,8 +10883,7 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile)
self_type = pfn_type->field (0).type ()->target_type ();
new_type = type_allocator (type).new_type ();
smash_to_method_type (new_type, self_type, pfn_type->target_type (),
- pfn_type->fields (), pfn_type->num_fields (),
- pfn_type->has_varargs ());
+ pfn_type->fields (), pfn_type->has_varargs ());
smash_to_methodptr_type (type, new_type);
}
@@ -11099,7 +11177,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
if (attr != nullptr)
{
if (attr->form_is_constant ())
- type->set_length (attr->constant_value (0));
+ type->set_length (attr->unsigned_constant ().value_or (0));
else
{
struct dynamic_prop prop;
@@ -11244,12 +11322,14 @@ handle_variant (struct die_info *die, struct type *type,
{
discr = dwarf2_attr (die, DW_AT_discr_list, cu);
if (discr == nullptr || discr->as_block ()->size == 0)
- variant.default_branch = true;
+ {
+ /* Nothing to do here -- default branch. */
+ }
else
variant.discr_list_data = discr->as_block ();
}
else
- variant.discriminant_value = discr->constant_value (0);
+ variant.discriminant_attr = discr;
for (die_info *variant_child : die->children ())
handle_struct_member_die (variant_child, type, fi, template_args, cu);
@@ -11311,6 +11391,21 @@ handle_struct_member_die (struct die_info *child_die, struct type *type,
handle_variant (child_die, type, fi, template_args, cu);
}
+/* Create a property baton for a field. DIE is the field's DIE. The
+ baton's "field" member is filled in, but the other members of the
+ baton are not. The new property baton is returned. */
+
+static dwarf2_property_baton *
+find_field_create_baton (dwarf2_cu *cu, die_info *die)
+{
+ dwarf2_property_baton *result
+ = XOBNEW (&cu->per_objfile->objfile->objfile_obstack,
+ struct dwarf2_property_baton);
+ memset (&result->field, 0, sizeof (result->field));
+ compute_field_location (cu, die, &result->field);
+ return result;
+}
+
/* Finish creating a structure or union type, including filling in its
members and creating a symbol for it. This function also handles Fortran
namelist variables, their items or members and creating a symbol for
@@ -11575,25 +11670,30 @@ die_byte_order (die_info *die, dwarf2_cu *cu, enum bfd_endian *byte_order)
/* Assuming DIE is an enumeration type, and TYPE is its associated
type, update TYPE using some information only available in DIE's
- children. In particular, the fields are computed. */
+ children. In particular, the fields are computed. If IS_UNSIGNED
+ is set, the enumeration type's sign is already known (a true value
+ means unsigned), and so examining the constants to determine the
+ sign isn't needed; when this is unset, the enumerator constants are
+ read as signed values. */
static void
update_enumeration_type_from_children (struct die_info *die,
struct type *type,
- struct dwarf2_cu *cu)
+ struct dwarf2_cu *cu,
+ std::optional<bool> is_unsigned)
{
- int unsigned_enum = 1;
- int flag_enum = 1;
+ /* This is used to check whether the enum is signed or unsigned; for
+ simplicity, it is always correct regardless of whether
+ IS_UNSIGNED is set. */
+ bool unsigned_enum = is_unsigned.value_or (true);
+ bool flag_enum = true;
- auto_obstack obstack;
std::vector<struct field> fields;
for (die_info *child_die : die->children ())
{
struct attribute *attr;
LONGEST value;
- const gdb_byte *bytes;
- struct dwarf2_locexpr_baton *baton;
const char *name;
if (child_die->tag != DW_TAG_enumerator)
@@ -11607,19 +11707,26 @@ update_enumeration_type_from_children (struct die_info *die,
if (name == NULL)
name = "<anonymous enumerator>";
- dwarf2_const_value_attr (attr, type, name, &obstack, cu,
- &value, &bytes, &baton);
- if (value < 0)
- {
- unsigned_enum = 0;
- flag_enum = 0;
- }
+ /* Can't check UNSIGNED_ENUM here because that is
+ optimistic. */
+ if (is_unsigned.has_value () && *is_unsigned)
+ value = attr->unsigned_constant ().value_or (0);
else
{
- if (count_one_bits_ll (value) >= 2)
- flag_enum = 0;
+ /* Read as signed, either because we don't know the sign or
+ because we know it is definitely signed. */
+ value = attr->signed_constant ().value_or (0);
+
+ if (value < 0)
+ {
+ unsigned_enum = false;
+ flag_enum = false;
+ }
}
+ if (flag_enum && count_one_bits_ll (value) >= 2)
+ flag_enum = false;
+
struct field &field = fields.emplace_back ();
field.set_name (dwarf2_physname (name, child_die, cu));
field.set_loc_enumval (value);
@@ -11628,13 +11735,10 @@ update_enumeration_type_from_children (struct die_info *die,
if (!fields.empty ())
type->copy_fields (fields);
else
- flag_enum = 0;
+ flag_enum = false;
- if (unsigned_enum)
- type->set_is_unsigned (true);
-
- if (flag_enum)
- type->set_is_flag_enum (true);
+ type->set_is_unsigned (unsigned_enum);
+ type->set_is_flag_enum (flag_enum);
}
/* Given a DW_AT_enumeration_type die, set its type. We do not
@@ -11678,7 +11782,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
attr = dwarf2_attr (die, DW_AT_byte_size, cu);
if (attr != nullptr)
- type->set_length (attr->constant_value (0));
+ type->set_length (attr->unsigned_constant ().value_or (0));
else
type->set_length (0);
@@ -11692,6 +11796,11 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
if (die_is_declaration (die, cu))
type->set_is_stub (true);
+ /* If the underlying type is known, and is unsigned, then we'll
+ assume the enumerator constants are unsigned. Otherwise we have
+ to assume they are signed. */
+ std::optional<bool> is_unsigned;
+
/* If this type has an underlying type that is not a stub, then we
may use its attributes. We always use the "unsigned" attribute
in this situation, because ordinarily we guess whether the type
@@ -11704,7 +11813,8 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
struct type *underlying_type = type->target_type ();
underlying_type = check_typedef (underlying_type);
- type->set_is_unsigned (underlying_type->is_unsigned ());
+ is_unsigned = underlying_type->is_unsigned ();
+ type->set_is_unsigned (*is_unsigned);
if (type->length () == 0)
type->set_length (underlying_type->length ());
@@ -11724,7 +11834,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
Note that, as usual, this must come after set_die_type to avoid
infinite recursion when trying to compute the names of the
enumerators. */
- update_enumeration_type_from_children (die, type, cu);
+ update_enumeration_type_from_children (die, type, cu, is_unsigned);
return type;
}
@@ -12074,7 +12184,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
attr = dwarf2_attr (die, DW_AT_bit_stride, cu);
if (attr != NULL)
- bit_stride = attr->constant_value (0);
+ bit_stride = attr->unsigned_constant ().value_or (0);
/* Irix 6.2 native cc creates array types without children for
arrays with unspecified length. */
@@ -12289,7 +12399,8 @@ mark_common_block_symbol_computed (struct symbol *sym,
gdb_assert (member_loc->form_is_block ()
|| member_loc->form_is_constant ());
- baton = XOBNEW (&objfile->objfile_obstack, struct dwarf2_locexpr_baton);
+ baton = OBSTACK_ZALLOC (&objfile->objfile_obstack,
+ struct dwarf2_locexpr_baton);
baton->per_objfile = per_objfile;
baton->per_cu = cu->per_cu;
gdb_assert (baton->per_cu);
@@ -12298,7 +12409,7 @@ mark_common_block_symbol_computed (struct symbol *sym,
if (member_loc->form_is_constant ())
{
- offset = member_loc->constant_value (0);
+ offset = member_loc->unsigned_constant ().value_or (0);
baton->size += 1 /* DW_OP_addr */ + cu->header.addr_size;
}
else
@@ -12331,7 +12442,7 @@ mark_common_block_symbol_computed (struct symbol *sym,
gdb_assert (ptr - baton->data == baton->size);
SYMBOL_LOCATION_BATON (sym) = baton;
- sym->set_aclass_index (dwarf2_locexpr_index);
+ sym->set_loc_class_index (dwarf2_locexpr_index);
}
/* Create appropriate locally-scoped variables for all the
@@ -12595,7 +12706,7 @@ static struct type *
read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu)
{
struct gdbarch *gdbarch = cu->per_objfile->objfile->arch ();
- struct comp_unit_head *cu_header = &cu->header;
+ unit_head *cu_header = &cu->header;
struct type *type;
struct attribute *attr_byte_size;
struct attribute *attr_address_class;
@@ -12613,7 +12724,8 @@ read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu)
attr_byte_size = dwarf2_attr (die, DW_AT_byte_size, cu);
if (attr_byte_size)
- byte_size = attr_byte_size->constant_value (cu_header->addr_size);
+ byte_size = (attr_byte_size->unsigned_constant ()
+ .value_or (cu_header->addr_size));
else
byte_size = cu_header->addr_size;
@@ -12692,8 +12804,7 @@ read_tag_ptr_to_member_type (struct die_info *die, struct dwarf2_cu *cu)
= type_allocator (cu->per_objfile->objfile, cu->lang ()).new_type ();
smash_to_method_type (new_type, domain, to_type->target_type (),
- to_type->fields (), to_type->num_fields (),
- to_type->has_varargs ());
+ to_type->fields (), to_type->has_varargs ());
type = lookup_methodptr_type (new_type);
}
else
@@ -12709,7 +12820,7 @@ static struct type *
read_tag_reference_type (struct die_info *die, struct dwarf2_cu *cu,
enum type_code refcode)
{
- struct comp_unit_head *cu_header = &cu->header;
+ unit_head *cu_header = &cu->header;
struct type *type, *target_type;
struct attribute *attr;
@@ -12725,7 +12836,8 @@ read_tag_reference_type (struct die_info *die, struct dwarf2_cu *cu,
type = lookup_reference_type (target_type, refcode);
attr = dwarf2_attr (die, DW_AT_byte_size, cu);
if (attr != nullptr)
- type->set_length (attr->constant_value (cu_header->addr_size));
+ type->set_length (attr->unsigned_constant ()
+ .value_or (cu_header->addr_size));
else
type->set_length (cu_header->addr_size);
@@ -12889,9 +13001,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
len = dwarf2_attr (die, DW_AT_byte_size, cu);
if (len != nullptr && len->form_is_constant ())
{
- /* Pass 0 as the default as we know this attribute is constant
- and the default value will not be returned. */
- LONGEST sz = len->constant_value (0);
+ LONGEST sz = len->unsigned_constant ().value_or (0);
prop_type = objfile_int_type (objfile, sz, true);
}
else
@@ -12910,15 +13020,14 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
else if (attr != nullptr)
{
/* This DW_AT_string_length just contains the length with no
- indirection. There's no need to create a dynamic property in this
- case. Pass 0 for the default value as we know it will not be
- returned in this case. */
- length = attr->constant_value (0);
+ indirection. There's no need to create a dynamic property in
+ this case. */
+ length = attr->unsigned_constant ().value_or (0);
}
else if ((attr = dwarf2_attr (die, DW_AT_byte_size, cu)) != nullptr)
{
/* We don't currently support non-constant byte sizes for strings. */
- length = attr->constant_value (1);
+ length = attr->unsigned_constant ().value_or (1);
}
else
{
@@ -13193,7 +13302,7 @@ read_typedef (struct die_info *die, struct dwarf2_cu *cu)
a given gmp_mpz given an attribute. */
static void
-get_mpz (struct dwarf2_cu *cu, gdb_mpz *value, struct attribute *attr)
+get_mpz_for_rational (dwarf2_cu *cu, gdb_mpz *value, attribute *attr)
{
/* GCC will sometimes emit a 16-byte constant value as a DWARF
location expression that pushes an implicit value. */
@@ -13227,10 +13336,11 @@ get_mpz (struct dwarf2_cu *cu, gdb_mpz *value, struct attribute *attr)
? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE,
true);
}
- else if (attr->form_is_unsigned ())
- *value = gdb_mpz (attr->as_unsigned ());
else
- *value = gdb_mpz (attr->constant_value (1));
+ {
+ /* Rational constants for Ada are always unsigned. */
+ *value = gdb_mpz (attr->unsigned_constant ().value_or (1));
+ }
}
/* Assuming DIE is a rational DW_TAG_constant, read the DIE's
@@ -13259,8 +13369,8 @@ get_dwarf2_rational_constant (struct die_info *die, struct dwarf2_cu *cu,
if (num_attr == nullptr || denom_attr == nullptr)
return;
- get_mpz (cu, numerator, num_attr);
- get_mpz (cu, denominator, denom_attr);
+ get_mpz_for_rational (cu, numerator, num_attr);
+ get_mpz_for_rational (cu, denominator, denom_attr);
}
/* Same as get_dwarf2_rational_constant, but extracting an unsigned
@@ -13316,7 +13426,7 @@ ada_get_gnat_encoded_number (const char *encoding, int &k, gdb_mpz *result)
{
/* The next character should be an underscore ('_') followed
by a digit. */
- if (encoding[k] != '_' || !isdigit (encoding[k + 1]))
+ if (encoding[k] != '_' || !c_isdigit (encoding[k + 1]))
return false;
/* Skip the underscore. */
@@ -13324,7 +13434,7 @@ ada_get_gnat_encoded_number (const char *encoding, int &k, gdb_mpz *result)
int start = k;
/* Determine the number of digits for our number. */
- while (isdigit (encoding[k]))
+ while (c_isdigit (encoding[k]))
k++;
if (k == start)
return false;
@@ -13409,14 +13519,14 @@ finish_fixed_point_type (struct type *type, const char *suffix,
}
else if (attr->name == DW_AT_binary_scale)
{
- LONGEST scale_exp = attr->constant_value (0);
+ LONGEST scale_exp = attr->signed_constant ().value_or (0);
gdb_mpz &num_or_denom = scale_exp > 0 ? scale_num : scale_denom;
num_or_denom <<= std::abs (scale_exp);
}
else if (attr->name == DW_AT_decimal_scale)
{
- LONGEST scale_exp = attr->constant_value (0);
+ LONGEST scale_exp = attr->signed_constant ().value_or (0);
gdb_mpz &num_or_denom = scale_exp > 0 ? scale_num : scale_denom;
num_or_denom = gdb_mpz::pow (10, std::abs (scale_exp));
@@ -13616,7 +13726,6 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
struct type *type;
struct attribute *attr;
ULONGEST encoding = 0;
- int bits = 0;
const char *name;
attr = dwarf2_attr (die, DW_AT_encoding, cu);
@@ -13626,9 +13735,33 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
if (value.has_value ())
encoding = *value;
}
+
attr = dwarf2_attr (die, DW_AT_byte_size, cu);
+ std::optional<ULONGEST> byte_size;
if (attr != nullptr)
- bits = attr->constant_value (0) * TARGET_CHAR_BIT;
+ byte_size = attr->unsigned_constant ();
+ attr = dwarf2_attr (die, DW_AT_bit_size, cu);
+ std::optional<ULONGEST> bit_size;
+ if (attr != nullptr)
+ bit_size = attr->unsigned_constant ();
+
+ attr = dwarf2_attr (die, DW_AT_data_bit_offset, cu);
+ std::optional<ULONGEST> bit_offset;
+ if (attr != nullptr)
+ bit_offset = attr->unsigned_constant ();
+
+ int bits = 0;
+ if (byte_size.has_value ())
+ bits = TARGET_CHAR_BIT * *byte_size;
+ else if (bit_size.has_value ())
+ bits = align_up (*bit_size, 8);
+ else
+ {
+ /* No size, so arrange for an error type. */
+ complaint (_("DW_TAG_base_type has neither bit- nor byte-size"));
+ encoding = (ULONGEST) -1;
+ }
+
name = dwarf2_full_name (nullptr, die, cu);
if (!name)
complaint (_("DW_AT_name missing from DW_TAG_base_type"));
@@ -13774,29 +13907,21 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
type->set_endianity_is_not_default (not_default);
- if (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_INT)
+ /* If both a byte size and bit size were provided, then that means
+ that not every bit in the object contributes to the value. */
+ if (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_INT
+ && byte_size.has_value ()
+ && bit_size.has_value ())
{
- attr = dwarf2_attr (die, DW_AT_bit_size, cu);
- if (attr != nullptr && attr->form_is_constant ())
+ /* DWARF says: If this attribute is omitted a default data bit
+ offset of zero is assumed. */
+ ULONGEST offset = bit_offset.value_or (0);
+
+ /* Only use the attributes if they make sense together. */
+ if (*bit_size + offset <= 8 * type->length ())
{
- unsigned real_bit_size = attr->constant_value (0);
- if (real_bit_size >= 0 && real_bit_size <= 8 * type->length ())
- {
- attr = dwarf2_attr (die, DW_AT_data_bit_offset, cu);
- /* Only use the attributes if they make sense together. */
- if (attr == nullptr
- || (attr->form_is_constant ()
- && attr->constant_value (0) >= 0
- && (attr->constant_value (0) + real_bit_size
- <= 8 * type->length ())))
- {
- TYPE_MAIN_TYPE (type)->type_specific.int_stuff.bit_size
- = real_bit_size;
- if (attr != nullptr)
- TYPE_MAIN_TYPE (type)->type_specific.int_stuff.bit_offset
- = attr->constant_value (0);
- }
- }
+ TYPE_MAIN_TYPE (type)->type_specific.int_stuff.bit_size = *bit_size;
+ TYPE_MAIN_TYPE (type)->type_specific.int_stuff.bit_offset = offset;
}
}
@@ -13937,17 +14062,13 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
case DW_AT_data_member_location:
case DW_AT_data_bit_offset:
{
- LONGEST offset;
-
- if (!handle_member_location (target_die, target_cu, &offset))
+ baton = find_field_create_baton (cu, target_die);
+ if (baton == nullptr)
return 0;
- baton = XOBNEW (obstack, struct dwarf2_property_baton);
baton->property_type = read_type_die (target_die->parent,
- target_cu);
- baton->offset_info.offset = offset;
- baton->offset_info.type = die_type (target_die, target_cu);
- prop->set_addr_offset (baton);
+ target_cu);
+ prop->set_field (baton);
break;
}
}
@@ -14107,8 +14228,13 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
LONGEST bias = 0;
struct attribute *bias_attr = dwarf2_attr (die, DW_AT_GNU_bias, cu);
- if (bias_attr != nullptr && bias_attr->form_is_constant ())
- bias = bias_attr->constant_value (0);
+ if (bias_attr != nullptr)
+ {
+ if (base_type->is_unsigned ())
+ bias = (LONGEST) bias_attr->unsigned_constant ().value_or (0);
+ else
+ bias = bias_attr->signed_constant ().value_or (0);
+ }
/* Normally, the DWARF producers are expected to use a signed
constant form (Eg. DW_FORM_sdata) to express negative bounds.
@@ -14195,7 +14321,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
attr = dwarf2_attr (die, DW_AT_byte_size, cu);
if (attr != nullptr)
- range_type->set_length (attr->constant_value (0));
+ range_type->set_length (attr->unsigned_constant ().value_or (0));
maybe_set_alignment (cu, die, range_type);
@@ -14424,21 +14550,22 @@ cooked_index_functions::find_compunit_symtab_by_address
}
bool
-cooked_index_functions::expand_symtabs_matching
+cooked_index_functions::search
(objfile *objfile,
- expand_symtabs_file_matcher file_matcher,
+ search_symtabs_file_matcher file_matcher,
const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
+ search_symtabs_symbol_matcher symbol_matcher,
+ search_symtabs_expansion_listener listener,
block_search_flags search_flags,
domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher)
+ search_symtabs_lang_matcher lang_matcher)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
cooked_index *table = wait (objfile, true);
- dw_expand_symtabs_matching_file_matcher (per_objfile, file_matcher);
+ auto_bool_vector cus_to_skip;
+ dw_search_file_matcher (per_objfile, cus_to_skip, file_matcher);
/* This invariant is documented in quick-functions.h. */
gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr);
@@ -14448,10 +14575,8 @@ cooked_index_functions::expand_symtabs_matching
{
QUIT;
- if (!dw2_expand_symtabs_matching_one (per_cu, per_objfile,
- file_matcher,
- expansion_notify,
- lang_matcher))
+ if (!dw2_search_one (per_cu, per_objfile, cus_to_skip, file_matcher,
+ listener, lang_matcher))
return false;
}
return true;
@@ -14526,13 +14651,8 @@ cooked_index_functions::expand_symtabs_matching
{
QUIT;
- /* No need to consider symbols from expanded CUs. */
- if (per_objfile->symtab_set_p (entry->per_cu))
- continue;
-
- /* If file-matching was done, we don't need to consider
- symbols from unmarked CUs. */
- if (file_matcher != nullptr && !entry->per_cu->mark)
+ /* We don't need to consider symbols from some CUs. */
+ if (cus_to_skip.is_set (entry->per_cu->index))
continue;
/* See if the symbol matches the type filter. */
@@ -14549,13 +14669,26 @@ cooked_index_functions::expand_symtabs_matching
continue;
}
+ /* This is a bit of a hack to support .gdb_index. Since
+ .gdb_index does not record languages, and since we want
+ to know the language to avoid excessive CU expansion due
+ to false matches, if we see a symbol with an unknown
+ language we find the CU's language. Only the .gdb_index
+ reader creates such symbols. */
+ enum language entry_lang = entry->lang;
+ if (entry_lang == language_unknown)
+ {
+ entry->per_cu->ensure_lang (per_objfile);
+ entry_lang = entry->per_cu->lang ();
+ }
+
/* We've found the base name of the symbol; now walk its
parentage chain, ensuring that each component
matches. */
bool found = true;
const cooked_index_entry *parent = entry->get_parent ();
- const language_defn *lang_def = language_def (entry->lang);
+ const language_defn *lang_def = language_def (entry_lang);
for (int i = name_vec.size () - 1; i > 0; --i)
{
/* If we ran out of entries, or if this segment doesn't
@@ -14565,17 +14698,15 @@ cooked_index_functions::expand_symtabs_matching
found = false;
break;
}
- if (parent->lang != language_unknown)
+
+ symbol_name_matcher_ftype *name_matcher
+ = (lang_def->get_symbol_name_matcher
+ (segment_lookup_names[i-1]));
+ if (!name_matcher (parent->canonical,
+ segment_lookup_names[i-1], nullptr))
{
- symbol_name_matcher_ftype *name_matcher
- = lang_def->get_symbol_name_matcher
- (segment_lookup_names[i-1]);
- if (!name_matcher (parent->canonical,
- segment_lookup_names[i-1], nullptr))
- {
- found = false;
- break;
- }
+ found = false;
+ break;
}
parent = parent->get_parent ();
@@ -14598,27 +14729,23 @@ cooked_index_functions::expand_symtabs_matching
seems like the loop above could just examine every
element of the name, avoiding the need to check here; but
this is hard. See PR symtab/32733. */
- if (symbol_matcher != nullptr || entry->lang != language_unknown)
+ auto_obstack temp_storage;
+ const char *full_name = entry->full_name (&temp_storage,
+ FOR_ADA_LINKAGE_NAME);
+ if (symbol_matcher == nullptr)
{
- auto_obstack temp_storage;
- const char *full_name = entry->full_name (&temp_storage,
- FOR_ADA_LINKAGE_NAME);
- if (symbol_matcher == nullptr)
- {
- symbol_name_matcher_ftype *name_matcher
- = (lang_def->get_symbol_name_matcher
- (lookup_name_without_params));
- if (!name_matcher (full_name, lookup_name_without_params,
- nullptr))
- continue;
- }
- else if (!symbol_matcher (full_name))
+ symbol_name_matcher_ftype *name_matcher
+ = (lang_def->get_symbol_name_matcher
+ (lookup_name_without_params));
+ if (!name_matcher (full_name, lookup_name_without_params,
+ nullptr))
continue;
}
+ else if (!symbol_matcher (full_name))
+ continue;
- if (!dw2_expand_symtabs_matching_one (entry->per_cu, per_objfile,
- file_matcher,
- expansion_notify, nullptr))
+ if (!dw2_search_one (entry->per_cu, per_objfile, cus_to_skip,
+ file_matcher, listener, nullptr))
return false;
}
}
@@ -14876,7 +15003,7 @@ cutu_reader::read_attribute_value (attribute *attr, unsigned form,
{
dwarf2_per_objfile *per_objfile = m_cu->per_objfile;
struct objfile *objfile = per_objfile->objfile;
- struct comp_unit_head *cu_header = &m_cu->header;
+ unit_head *cu_header = &m_cu->header;
unsigned int bytes_read;
struct dwarf_block *blk;
@@ -14927,10 +15054,12 @@ cutu_reader::read_attribute_value (attribute *attr, unsigned form,
info_ptr += 2;
break;
case DW_FORM_data4:
+ case DW_FORM_ref_sup4:
attr->set_unsigned (read_4_bytes (m_abfd, info_ptr));
info_ptr += 4;
break;
case DW_FORM_data8:
+ case DW_FORM_ref_sup8:
attr->set_unsigned (read_8_bytes (m_abfd, info_ptr));
info_ptr += 8;
break;
@@ -14982,6 +15111,7 @@ cutu_reader::read_attribute_value (attribute *attr, unsigned form,
}
[[fallthrough]];
case DW_FORM_GNU_strp_alt:
+ case DW_FORM_strp_sup:
{
dwz_file *dwz = per_objfile->per_bfd->get_dwz_file (true);
LONGEST str_offset
@@ -15181,8 +15311,7 @@ read_indirect_string_at_offset (dwarf2_per_objfile *per_objfile,
static const char *
read_indirect_string (dwarf2_per_objfile *per_objfile, bfd *abfd,
- const gdb_byte *buf,
- const struct comp_unit_head *cu_header,
+ const gdb_byte *buf, const unit_head *cu_header,
unsigned int *bytes_read_ptr)
{
LONGEST str_offset = cu_header->read_offset (abfd, buf, bytes_read_ptr);
@@ -15206,7 +15335,7 @@ dwarf2_per_objfile::read_line_string (const gdb_byte *buf,
const char *
dwarf2_per_objfile::read_line_string (const gdb_byte *buf,
- const struct comp_unit_head *cu_header,
+ const unit_head *cu_header,
unsigned int *bytes_read_ptr)
{
bfd *abfd = objfile->obfd.get ();
@@ -15339,9 +15468,16 @@ read_str_index (struct dwarf2_cu *cu,
" in CU at offset %s [in module %s]"),
form_name, str_section->get_name (),
sect_offset_str (cu->header.sect_off), objf_name);
- info_ptr = (str_offsets_section->buffer
- + str_offsets_base
- + str_index * offset_size);
+
+ ULONGEST str_offsets_offset = str_offsets_base + str_index * offset_size;
+ if (str_offsets_offset >= str_offsets_section->size)
+ error (_(DWARF_ERROR_PREFIX
+ "Offset from %s pointing outside of %s section in CU at offset %s"
+ " [in module %s]"),
+ form_name, str_offsets_section->get_name (),
+ sect_offset_str (cu->header.sect_off), objf_name);
+ info_ptr = str_offsets_section->buffer + str_offsets_offset;
+
if (offset_size == 4)
str_offset = bfd_get_32 (abfd, info_ptr);
else
@@ -15654,9 +15790,9 @@ die_specification (struct die_info *die, struct dwarf2_cu **spec_cu)
return follow_die_ref (die, spec_attr, spec_cu);
}
-/* A convenience function to find the proper .debug_line section for a CU. */
+/* See dwarf2/read.h. */
-static struct dwarf2_section_info *
+struct dwarf2_section_info *
get_debug_line_section (struct dwarf2_cu *cu)
{
struct dwarf2_section_info *section;
@@ -15707,808 +15843,9 @@ dwarf_decode_line_header (sect_offset sect_off, struct dwarf2_cu *cu,
comp_dir);
}
-/* Subroutine of dwarf_decode_lines to simplify it.
- Return the file name for the given file_entry.
- CU_INFO describes the CU's DW_AT_name and DW_AT_comp_dir.
- If space for the result is malloc'd, *NAME_HOLDER will be set.
- Returns NULL if FILE_INDEX should be ignored, i.e., it is
- equivalent to CU_INFO. */
-
-static const char *
-compute_include_file_name (const struct line_header *lh, const file_entry &fe,
- const file_and_directory &cu_info,
- std::string &name_holder)
-{
- const char *include_name = fe.name;
- const char *include_name_to_compare = include_name;
-
- const char *dir_name = fe.include_dir (lh);
-
- std::string hold_compare;
- if (!IS_ABSOLUTE_PATH (include_name)
- && (dir_name != nullptr || cu_info.get_comp_dir () != nullptr))
- {
- /* Avoid creating a duplicate name for CU_INFO.
- We do this by comparing INCLUDE_NAME and CU_INFO.
- Before we do the comparison, however, we need to account
- for DIR_NAME and COMP_DIR.
- First prepend dir_name (if non-NULL). If we still don't
- have an absolute path prepend comp_dir (if non-NULL).
- However, the directory we record in the include-file's
- psymtab does not contain COMP_DIR (to match the
- corresponding symtab(s)).
-
- Example:
-
- bash$ cd /tmp
- bash$ gcc -g ./hello.c
- include_name = "hello.c"
- dir_name = "."
- DW_AT_comp_dir = comp_dir = "/tmp"
- DW_AT_name = "./hello.c"
-
- */
-
- if (dir_name != NULL)
- {
- name_holder = path_join (dir_name, include_name);
- include_name = name_holder.c_str ();
- include_name_to_compare = include_name;
- }
- if (!IS_ABSOLUTE_PATH (include_name)
- && cu_info.get_comp_dir () != nullptr)
- {
- hold_compare = path_join (cu_info.get_comp_dir (), include_name);
- include_name_to_compare = hold_compare.c_str ();
- }
- }
-
- std::string copied_name;
- const char *cu_filename = cu_info.get_name ();
- if (!IS_ABSOLUTE_PATH (cu_filename) && cu_info.get_comp_dir () != nullptr)
- {
- copied_name = path_join (cu_info.get_comp_dir (), cu_filename);
- cu_filename = copied_name.c_str ();
- }
-
- if (FILENAME_CMP (include_name_to_compare, cu_filename) == 0)
- return nullptr;
- return include_name;
-}
-
-/* State machine to track the state of the line number program. */
-
-class lnp_state_machine
-{
-public:
- /* Initialize a machine state for the start of a line number
- program. */
- lnp_state_machine (struct dwarf2_cu *cu, gdbarch *arch, line_header *lh);
-
- file_entry *current_file ()
- {
- /* lh->file_names is 0-based, but the file name numbers in the
- statement program are 1-based. */
- return m_line_header->file_name_at (m_file);
- }
-
- /* Record the line in the state machine. END_SEQUENCE is true if
- we're processing the end of a sequence. */
- void record_line (bool end_sequence);
-
- /* Check ADDRESS is -1, -2, or zero and less than UNRELOCATED_LOWPC, and if
- true nop-out rest of the lines in this sequence. */
- void check_line_address (struct dwarf2_cu *cu,
- const gdb_byte *line_ptr,
- unrelocated_addr unrelocated_lowpc,
- unrelocated_addr address);
-
- void handle_set_discriminator (unsigned int discriminator)
- {
- m_discriminator = discriminator;
- m_line_has_non_zero_discriminator |= discriminator != 0;
- }
-
- /* Handle DW_LNE_set_address. */
- void handle_set_address (unrelocated_addr address)
- {
- m_op_index = 0;
- m_address
- = (unrelocated_addr) gdbarch_adjust_dwarf2_line (m_gdbarch,
- (CORE_ADDR) address,
- false);
- }
-
- /* Handle DW_LNS_advance_pc. */
- void handle_advance_pc (CORE_ADDR adjust);
-
- /* Handle a special opcode. */
- void handle_special_opcode (unsigned char op_code);
-
- /* Handle DW_LNS_advance_line. */
- void handle_advance_line (int line_delta)
- {
- advance_line (line_delta);
- }
-
- /* Handle DW_LNS_set_file. */
- void handle_set_file (file_name_index file);
-
- /* Handle DW_LNS_negate_stmt. */
- void handle_negate_stmt ()
- {
- m_flags ^= LEF_IS_STMT;
- }
-
- /* Handle DW_LNS_const_add_pc. */
- void handle_const_add_pc ();
-
- /* Handle DW_LNS_fixed_advance_pc. */
- void handle_fixed_advance_pc (CORE_ADDR addr_adj)
- {
- addr_adj = gdbarch_adjust_dwarf2_line (m_gdbarch, addr_adj, true);
- m_address = (unrelocated_addr) ((CORE_ADDR) m_address + addr_adj);
- m_op_index = 0;
- }
-
- /* Handle DW_LNS_copy. */
- void handle_copy ()
- {
- record_line (false);
- m_discriminator = 0;
- m_flags &= ~LEF_PROLOGUE_END;
- m_flags &= ~LEF_EPILOGUE_BEGIN;
- }
-
- /* Handle DW_LNE_end_sequence. */
- void handle_end_sequence ()
- {
- m_currently_recording_lines = true;
- }
-
- /* Handle DW_LNS_set_prologue_end. */
- void handle_set_prologue_end ()
- {
- m_flags |= LEF_PROLOGUE_END;
- }
-
- void handle_set_epilogue_begin ()
- {
- m_flags |= LEF_EPILOGUE_BEGIN;
- }
-
-private:
- /* Advance the line by LINE_DELTA. */
- void advance_line (int line_delta)
- {
- m_line += line_delta;
-
- if (line_delta != 0)
- m_line_has_non_zero_discriminator = m_discriminator != 0;
- }
-
- struct dwarf2_cu *m_cu;
-
- gdbarch *m_gdbarch;
-
- /* The line number header. */
- line_header *m_line_header;
-
- /* These are part of the standard DWARF line number state machine,
- and initialized according to the DWARF spec. */
-
- unsigned char m_op_index = 0;
- /* The line table index of the current file. */
- file_name_index m_file = 1;
- unsigned int m_line = 1;
-
- /* These are initialized in the constructor. */
-
- unrelocated_addr m_address;
- linetable_entry_flags m_flags;
- unsigned int m_discriminator = 0;
-
- /* Additional bits of state we need to track. */
-
- /* The last file a line number was recorded for. */
- struct subfile *m_last_subfile = NULL;
-
- /* The address of the last line entry. */
- unrelocated_addr m_last_address;
-
- /* Set to true when a previous line at the same address (using
- m_last_address) had LEF_IS_STMT set in m_flags. This is reset to false
- when a line entry at a new address (m_address different to
- m_last_address) is processed. */
- bool m_stmt_at_address = false;
-
- /* When true, record the lines we decode. */
- bool m_currently_recording_lines = true;
-
- /* The last line number that was recorded, used to coalesce
- consecutive entries for the same line. This can happen, for
- example, when discriminators are present. PR 17276. */
- unsigned int m_last_line = 0;
- bool m_line_has_non_zero_discriminator = false;
-};
-
-void
-lnp_state_machine::handle_advance_pc (CORE_ADDR adjust)
-{
- CORE_ADDR addr_adj = (((m_op_index + adjust)
- / m_line_header->maximum_ops_per_instruction)
- * m_line_header->minimum_instruction_length);
- addr_adj = gdbarch_adjust_dwarf2_line (m_gdbarch, addr_adj, true);
- m_address = (unrelocated_addr) ((CORE_ADDR) m_address + addr_adj);
- m_op_index = ((m_op_index + adjust)
- % m_line_header->maximum_ops_per_instruction);
-}
-
-void
-lnp_state_machine::handle_special_opcode (unsigned char op_code)
-{
- unsigned char adj_opcode = op_code - m_line_header->opcode_base;
- unsigned char adj_opcode_d = adj_opcode / m_line_header->line_range;
- unsigned char adj_opcode_r = adj_opcode % m_line_header->line_range;
- CORE_ADDR addr_adj = (((m_op_index + adj_opcode_d)
- / m_line_header->maximum_ops_per_instruction)
- * m_line_header->minimum_instruction_length);
- addr_adj = gdbarch_adjust_dwarf2_line (m_gdbarch, addr_adj, true);
- m_address = (unrelocated_addr) ((CORE_ADDR) m_address + addr_adj);
- m_op_index = ((m_op_index + adj_opcode_d)
- % m_line_header->maximum_ops_per_instruction);
-
- int line_delta = m_line_header->line_base + adj_opcode_r;
- advance_line (line_delta);
- record_line (false);
- m_discriminator = 0;
- m_flags &= ~LEF_PROLOGUE_END;
- m_flags &= ~LEF_EPILOGUE_BEGIN;
-}
-
-void
-lnp_state_machine::handle_set_file (file_name_index file)
-{
- m_file = file;
-
- const file_entry *fe = current_file ();
- if (fe == NULL)
- dwarf2_debug_line_missing_file_complaint ();
- else
- {
- m_line_has_non_zero_discriminator = m_discriminator != 0;
- dwarf2_start_subfile (m_cu, *fe, *m_line_header);
- }
-}
-
-void
-lnp_state_machine::handle_const_add_pc ()
-{
- CORE_ADDR adjust
- = (255 - m_line_header->opcode_base) / m_line_header->line_range;
-
- CORE_ADDR addr_adj
- = (((m_op_index + adjust)
- / m_line_header->maximum_ops_per_instruction)
- * m_line_header->minimum_instruction_length);
-
- addr_adj = gdbarch_adjust_dwarf2_line (m_gdbarch, addr_adj, true);
- m_address = (unrelocated_addr) ((CORE_ADDR) m_address + addr_adj);
- m_op_index = ((m_op_index + adjust)
- % m_line_header->maximum_ops_per_instruction);
-}
-
-/* Return non-zero if we should add LINE to the line number table.
- LINE is the line to add, LAST_LINE is the last line that was added,
- LAST_SUBFILE is the subfile for LAST_LINE.
- LINE_HAS_NON_ZERO_DISCRIMINATOR is non-zero if LINE has ever
- had a non-zero discriminator.
-
- We have to be careful in the presence of discriminators.
- E.g., for this line:
-
- for (i = 0; i < 100000; i++);
-
- clang can emit four line number entries for that one line,
- each with a different discriminator.
- See gdb.dwarf2/dw2-single-line-discriminators.exp for an example.
-
- However, we want gdb to coalesce all four entries into one.
- Otherwise the user could stepi into the middle of the line and
- gdb would get confused about whether the pc really was in the
- middle of the line.
-
- Things are further complicated by the fact that two consecutive
- line number entries for the same line is a heuristic used by gcc
- to denote the end of the prologue. So we can't just discard duplicate
- entries, we have to be selective about it. The heuristic we use is
- that we only collapse consecutive entries for the same line if at least
- one of those entries has a non-zero discriminator. PR 17276.
-
- Note: Addresses in the line number state machine can never go backwards
- within one sequence, thus this coalescing is ok. */
-
-static int
-dwarf_record_line_p (struct dwarf2_cu *cu,
- unsigned int line, unsigned int last_line,
- int line_has_non_zero_discriminator,
- struct subfile *last_subfile)
-{
- if (cu->get_builder ()->get_current_subfile () != last_subfile)
- return 1;
- if (line != last_line)
- return 1;
- /* Same line for the same file that we've seen already.
- As a last check, for pr 17276, only record the line if the line
- has never had a non-zero discriminator. */
- if (!line_has_non_zero_discriminator)
- return 1;
- return 0;
-}
-
-/* Use the CU's builder to record line number LINE beginning at
- address ADDRESS in the line table of subfile SUBFILE. */
-
-static void
-dwarf_record_line_1 (struct gdbarch *gdbarch, struct subfile *subfile,
- unsigned int line, unrelocated_addr address,
- linetable_entry_flags flags,
- struct dwarf2_cu *cu)
-{
- unrelocated_addr addr
- = unrelocated_addr (gdbarch_addr_bits_remove (gdbarch,
- (CORE_ADDR) address));
-
- if (cu != nullptr)
- {
- if (dwarf_line_debug)
- gdb_printf (gdb_stdlog, "Recording line %u, file %s, address %s\n",
- line, lbasename (subfile->name.c_str ()),
- paddress (gdbarch, (CORE_ADDR) address));
-
- cu->get_builder ()->record_line (subfile, line, addr, flags);
- }
-}
-
-/* Subroutine of dwarf_decode_lines_1 to simplify it.
- Mark the end of a set of line number records.
- The arguments are the same as for dwarf_record_line_1.
- If SUBFILE is NULL the request is ignored. */
-
-static void
-dwarf_finish_line (struct gdbarch *gdbarch, struct subfile *subfile,
- unrelocated_addr address, struct dwarf2_cu *cu)
-{
- if (subfile == NULL)
- return;
-
- if (dwarf_line_debug)
- {
- gdb_printf (gdb_stdlog,
- "Finishing current line, file %s, address %s\n",
- lbasename (subfile->name.c_str ()),
- paddress (gdbarch, (CORE_ADDR) address));
- }
-
- dwarf_record_line_1 (gdbarch, subfile, 0, address, LEF_IS_STMT, cu);
-}
-
-void
-lnp_state_machine::record_line (bool end_sequence)
-{
- if (dwarf_line_debug)
- {
- gdb_printf (gdb_stdlog,
- "Processing actual line %u: file %u,"
- " address %s, is_stmt %u, prologue_end %u,"
- " epilogue_begin %u, discrim %u%s\n",
- m_line, m_file,
- paddress (m_gdbarch, (CORE_ADDR) m_address),
- (m_flags & LEF_IS_STMT) != 0,
- (m_flags & LEF_PROLOGUE_END) != 0,
- (m_flags & LEF_EPILOGUE_BEGIN) != 0,
- m_discriminator,
- (end_sequence ? "\t(end sequence)" : ""));
- }
-
- file_entry *fe = current_file ();
-
- if (fe == NULL)
- dwarf2_debug_line_missing_file_complaint ();
- /* For now we ignore lines not starting on an instruction boundary.
- But not when processing end_sequence for compatibility with the
- previous version of the code. */
- else if (m_op_index == 0 || end_sequence)
- {
- /* When we switch files we insert an end maker in the first file,
- switch to the second file and add a new line entry. The
- problem is that the end marker inserted in the first file will
- discard any previous line entries at the same address. If the
- line entries in the first file are marked as is-stmt, while
- the new line in the second file is non-stmt, then this means
- the end marker will discard is-stmt lines so we can have a
- non-stmt line. This means that there are less addresses at
- which the user can insert a breakpoint.
-
- To improve this we track the last address in m_last_address,
- and whether we have seen an is-stmt at this address. Then
- when switching files, if we have seen a stmt at the current
- address, and we are switching to create a non-stmt line, then
- discard the new line. */
- bool file_changed
- = m_last_subfile != m_cu->get_builder ()->get_current_subfile ();
- bool ignore_this_line
- = ((file_changed && !end_sequence && m_last_address == m_address
- && ((m_flags & LEF_IS_STMT) == 0)
- && m_stmt_at_address)
- || (!end_sequence && m_line == 0));
-
- if ((file_changed && !ignore_this_line) || end_sequence)
- {
- dwarf_finish_line (m_gdbarch, m_last_subfile, m_address,
- m_currently_recording_lines ? m_cu : nullptr);
- }
-
- if (!end_sequence && !ignore_this_line)
- {
- linetable_entry_flags lte_flags = m_flags;
- if (m_cu->producer_is_codewarrior ())
- lte_flags |= LEF_IS_STMT;
-
- if (dwarf_record_line_p (m_cu, m_line, m_last_line,
- m_line_has_non_zero_discriminator,
- m_last_subfile))
- {
- buildsym_compunit *builder = m_cu->get_builder ();
- dwarf_record_line_1 (m_gdbarch,
- builder->get_current_subfile (),
- m_line, m_address, lte_flags,
- m_currently_recording_lines ? m_cu : nullptr);
-
- m_last_subfile = m_cu->get_builder ()->get_current_subfile ();
- m_last_line = m_line;
- }
- }
- }
-
- /* Track whether we have seen any IS_STMT true at m_address in case we
- have multiple line table entries all at m_address. */
- if (m_last_address != m_address)
- {
- m_stmt_at_address = false;
- m_last_address = m_address;
- }
- m_stmt_at_address |= (m_flags & LEF_IS_STMT) != 0;
-}
-
-lnp_state_machine::lnp_state_machine (struct dwarf2_cu *cu, gdbarch *arch,
- line_header *lh)
- : m_cu (cu),
- m_gdbarch (arch),
- m_line_header (lh),
- /* Call `gdbarch_adjust_dwarf2_line' on the initial 0 address as
- if there was a line entry for it so that the backend has a
- chance to adjust it and also record it in case it needs it.
- This is currently used by MIPS code,
- cf. `mips_adjust_dwarf2_line'. */
- m_address ((unrelocated_addr) gdbarch_adjust_dwarf2_line (arch, 0, 0)),
- m_flags (lh->default_is_stmt ? LEF_IS_STMT : (linetable_entry_flags) 0),
- m_last_address (m_address)
-{
-}
+/* See dwarf2/read.h. */
void
-lnp_state_machine::check_line_address (struct dwarf2_cu *cu,
- const gdb_byte *line_ptr,
- unrelocated_addr unrelocated_lowpc,
- unrelocated_addr address)
-{
- /* Linkers resolve a symbolic relocation referencing a GC'd function to 0,
- -1 or -2 (-2 is used by certain lld versions, see
- https://github.com/llvm/llvm-project/commit/e618ccbf431f6730edb6d1467a127c3a52fd57f7).
- If ADDRESS is 0, ignoring the opcode will err if the text section is
- located at 0x0. In this case, additionally check that if
- ADDRESS < UNRELOCATED_LOWPC. */
-
- if ((address == (unrelocated_addr) 0 && address < unrelocated_lowpc)
- || address == (unrelocated_addr) -1
- || address == (unrelocated_addr) -2)
- {
- /* This line table is for a function which has been
- GCd by the linker. Ignore it. PR gdb/12528 */
-
- struct objfile *objfile = cu->per_objfile->objfile;
- long line_offset = line_ptr - get_debug_line_section (cu)->buffer;
-
- complaint (_(".debug_line address at offset 0x%lx is 0 [in module %s]"),
- line_offset, objfile_name (objfile));
- m_currently_recording_lines = false;
- /* Note: m_currently_recording_lines is left as false until we see
- DW_LNE_end_sequence. */
- }
-}
-
-/* Subroutine of dwarf_decode_lines to simplify it.
- Process the line number information in LH. */
-
-static void
-dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu,
- unrelocated_addr lowpc)
-{
- const gdb_byte *line_ptr, *extended_end;
- const gdb_byte *line_end;
- unsigned int bytes_read, extended_len;
- unsigned char op_code, extended_op;
- struct objfile *objfile = cu->per_objfile->objfile;
- bfd *abfd = objfile->obfd.get ();
- struct gdbarch *gdbarch = objfile->arch ();
-
- line_ptr = lh->statement_program_start;
- line_end = lh->statement_program_end;
-
- /* Read the statement sequences until there's nothing left. */
- while (line_ptr < line_end)
- {
- /* The DWARF line number program state machine. Reset the state
- machine at the start of each sequence. */
- lnp_state_machine state_machine (cu, gdbarch, lh);
- bool end_sequence = false;
-
- /* Start a subfile for the current file of the state
- machine. */
- const file_entry *fe = state_machine.current_file ();
-
- if (fe != NULL)
- dwarf2_start_subfile (cu, *fe, *lh);
-
- /* Decode the table. */
- while (line_ptr < line_end && !end_sequence)
- {
- op_code = read_1_byte (abfd, line_ptr);
- line_ptr += 1;
-
- if (op_code >= lh->opcode_base)
- {
- /* Special opcode. */
- state_machine.handle_special_opcode (op_code);
- }
- else switch (op_code)
- {
- case DW_LNS_extended_op:
- extended_len = read_unsigned_leb128 (abfd, line_ptr,
- &bytes_read);
- line_ptr += bytes_read;
- extended_end = line_ptr + extended_len;
- extended_op = read_1_byte (abfd, line_ptr);
- line_ptr += 1;
- if (DW_LNE_lo_user <= extended_op
- && extended_op <= DW_LNE_hi_user)
- {
- /* Vendor extension, ignore. */
- line_ptr = extended_end;
- break;
- }
- switch (extended_op)
- {
- case DW_LNE_end_sequence:
- state_machine.handle_end_sequence ();
- end_sequence = true;
- break;
- case DW_LNE_set_address:
- {
- unrelocated_addr address
- = cu->header.read_address (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
-
- state_machine.check_line_address (cu, line_ptr, lowpc,
- address);
- state_machine.handle_set_address (address);
- }
- break;
- case DW_LNE_define_file:
- {
- const char *cur_file;
- unsigned int mod_time, length;
- dir_index dindex;
-
- cur_file = read_direct_string (abfd, line_ptr,
- &bytes_read);
- line_ptr += bytes_read;
- dindex = (dir_index)
- read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- mod_time =
- read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- length =
- read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- lh->add_file_name (cur_file, dindex, mod_time, length);
- }
- break;
- case DW_LNE_set_discriminator:
- {
- /* The discriminator is not interesting to the
- debugger; just ignore it. We still need to
- check its value though:
- if there are consecutive entries for the same
- (non-prologue) line we want to coalesce them.
- PR 17276. */
- unsigned int discr
- = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
-
- state_machine.handle_set_discriminator (discr);
- }
- break;
- default:
- complaint (_("mangled .debug_line section"));
- return;
- }
- /* Make sure that we parsed the extended op correctly. If e.g.
- we expected a different address size than the producer used,
- we may have read the wrong number of bytes. */
- if (line_ptr != extended_end)
- {
- complaint (_("mangled .debug_line section"));
- return;
- }
- break;
- case DW_LNS_copy:
- state_machine.handle_copy ();
- break;
- case DW_LNS_advance_pc:
- {
- CORE_ADDR adjust
- = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
-
- state_machine.handle_advance_pc (adjust);
- }
- break;
- case DW_LNS_advance_line:
- {
- int line_delta
- = read_signed_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
-
- state_machine.handle_advance_line (line_delta);
- }
- break;
- case DW_LNS_set_file:
- {
- file_name_index file
- = (file_name_index) read_unsigned_leb128 (abfd, line_ptr,
- &bytes_read);
- line_ptr += bytes_read;
-
- state_machine.handle_set_file (file);
- }
- break;
- case DW_LNS_set_column:
- (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- break;
- case DW_LNS_negate_stmt:
- state_machine.handle_negate_stmt ();
- break;
- case DW_LNS_set_basic_block:
- break;
- /* Add to the address register of the state machine the
- address increment value corresponding to special opcode
- 255. I.e., this value is scaled by the minimum
- instruction length since special opcode 255 would have
- scaled the increment. */
- case DW_LNS_const_add_pc:
- state_machine.handle_const_add_pc ();
- break;
- case DW_LNS_fixed_advance_pc:
- {
- CORE_ADDR addr_adj = read_2_bytes (abfd, line_ptr);
- line_ptr += 2;
-
- state_machine.handle_fixed_advance_pc (addr_adj);
- }
- break;
- case DW_LNS_set_prologue_end:
- state_machine.handle_set_prologue_end ();
- break;
- case DW_LNS_set_epilogue_begin:
- state_machine.handle_set_epilogue_begin ();
- break;
- default:
- {
- /* Unknown standard opcode, ignore it. */
- int i;
-
- for (i = 0; i < lh->standard_opcode_lengths[op_code]; i++)
- {
- (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- }
- }
- }
- }
-
- if (!end_sequence)
- dwarf2_debug_line_missing_end_sequence_complaint ();
-
- /* We got a DW_LNE_end_sequence (or we ran off the end of the buffer,
- in which case we still finish recording the last line). */
- state_machine.record_line (true);
- }
-}
-
-/* Decode the Line Number Program (LNP) for the given line_header
- structure and CU. The actual information extracted and the type
- of structures created from the LNP depends on the value of PST.
-
- FND holds the CU file name and directory, if known.
- It is used for relative paths in the line table.
-
- NOTE: It is important that psymtabs have the same file name (via
- strcmp) as the corresponding symtab. Since the directory is not
- used in the name of the symtab we don't use it in the name of the
- psymtabs we create. E.g. expand_line_sal requires this when
- finding psymtabs to expand. A good testcase for this is
- mb-inline.exp.
-
- LOWPC is the lowest address in CU (or 0 if not known).
-
- Boolean DECODE_MAPPING specifies we need to fully decode .debug_line
- for its PC<->lines mapping information. Otherwise only the filename
- table is read in. */
-
-static void
-dwarf_decode_lines (struct line_header *lh, struct dwarf2_cu *cu,
- unrelocated_addr lowpc, int decode_mapping)
-{
- if (decode_mapping)
- dwarf_decode_lines_1 (lh, cu, lowpc);
-
- /* Make sure a symtab is created for every file, even files
- which contain only variables (i.e. no code with associated
- line numbers). */
- buildsym_compunit *builder = cu->get_builder ();
- struct compunit_symtab *cust = builder->get_compunit_symtab ();
-
- for (auto &fe : lh->file_names ())
- {
- dwarf2_start_subfile (cu, fe, *lh);
- subfile *sf = builder->get_current_subfile ();
-
- if (sf->symtab == nullptr)
- sf->symtab = allocate_symtab (cust, sf->name.c_str (),
- sf->name_for_id.c_str ());
-
- fe.symtab = sf->symtab;
- }
-}
-
-/* Start a subfile for DWARF. FILENAME is the name of the file and
- DIRNAME the name of the source directory which contains FILENAME
- or NULL if not known.
- This routine tries to keep line numbers from identical absolute and
- relative file names in a common subfile.
-
- Using the `list' example from the GDB testsuite, which resides in
- /srcdir and compiling it with Irix6.2 cc in /compdir using a filename
- of /srcdir/list0.c yields the following debugging information for list0.c:
-
- DW_AT_name: /srcdir/list0.c
- DW_AT_comp_dir: /compdir
- files.files[0].name: list0.h
- files.files[0].dir: /srcdir
- files.files[1].name: list0.c
- files.files[1].dir: /srcdir
-
- The line number information for list0.c has to end up in a single
- subfile, so that `break /srcdir/list0.c:1' works as expected.
- start_subfile will ensure that this happens provided that we pass the
- concatenation of files.files[1].dir and files.files[1].name as the
- subfile's name. */
-
-static void
dwarf2_start_subfile (dwarf2_cu *cu, const file_entry &fe,
const line_header &lh)
{
@@ -16538,7 +15875,7 @@ var_decode_location (struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->per_objfile->objfile;
- struct comp_unit_head *cu_header = &cu->header;
+ unit_head *cu_header = &cu->header;
/* NOTE drow/2003-01-30: There used to be a comment and some special
code here to turn a symbol with DW_AT_external and a
@@ -16554,7 +15891,7 @@ var_decode_location (struct attribute *attr, struct symbol *sym,
variable has been optimized away. */
if (attr->form_is_block () && attr->as_block ()->size == 0)
{
- sym->set_aclass_index (LOC_OPTIMIZED_OUT);
+ sym->set_loc_class_index (LOC_OPTIMIZED_OUT);
return;
}
@@ -16584,7 +15921,7 @@ var_decode_location (struct attribute *attr, struct symbol *sym,
else
tem = read_addr_index_from_leb128 (cu, block->data + 1, &dummy);
sym->set_value_address ((CORE_ADDR) tem);
- sym->set_aclass_index (LOC_STATIC);
+ sym->set_loc_class_index (LOC_STATIC);
fixup_symbol_section (sym, objfile);
sym->set_value_address
(sym->value_address ()
@@ -16621,20 +15958,20 @@ add_ada_export_symbol (struct symbol *orig, const char *new_name,
= new (&cu->per_objfile->objfile->objfile_obstack) symbol (*orig);
copy->set_linkage_name (new_name);
SYMBOL_LOCATION_BATON (copy) = (void *) orig_name;
- copy->set_aclass_index (copy->aclass () == LOC_BLOCK
+ copy->set_loc_class_index (copy->loc_class () == LOC_BLOCK
? ada_block_index
: ada_imported_index);
add_symbol_to_list (copy, list_to_add);
}
-/* A helper function that decides if a given symbol is an Ada Pragma
- Import or Pragma Export. */
+/* See read.h. */
-static bool
+bool
is_ada_import_or_export (dwarf2_cu *cu, const char *name,
const char *linkagename)
{
return (cu->lang () == language_ada
+ && name != nullptr
&& linkagename != nullptr
&& !streq (name, linkagename)
/* The following exclusions are necessary because symbols
@@ -16721,7 +16058,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
/* Default assumptions.
Use the passed type or decode it from the die. */
sym->set_domain (UNDEF_DOMAIN);
- sym->set_aclass_index (LOC_OPTIMIZED_OUT);
+ sym->set_loc_class_index (LOC_OPTIMIZED_OUT);
if (type != NULL)
sym->set_type (type);
else
@@ -16771,10 +16108,10 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
CORE_ADDR addr = per_objfile->relocate (attr->as_address ());
sym->set_section_index (SECT_OFF_TEXT (objfile));
sym->set_value_address (addr);
- sym->set_aclass_index (LOC_LABEL);
+ sym->set_loc_class_index (LOC_LABEL);
}
else
- sym->set_aclass_index (LOC_OPTIMIZED_OUT);
+ sym->set_loc_class_index (LOC_OPTIMIZED_OUT);
sym->set_type (builtin_type (objfile)->builtin_core_addr);
sym->set_domain (LABEL_DOMAIN);
list_to_add = cu->list_in_scope;
@@ -16783,7 +16120,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
/* SYMBOL_BLOCK_VALUE (sym) will be filled in later by
finish_block. */
sym->set_domain (FUNCTION_DOMAIN);
- sym->set_aclass_index (LOC_BLOCK);
+ sym->set_loc_class_index (LOC_BLOCK);
/* DW_TAG_entry_point provides an additional entry_point to an
existing sub_program. Therefore, we inherit the "external"
attribute from the sub_program to which the entry_point
@@ -16798,7 +16135,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
/* SYMBOL_BLOCK_VALUE (sym) will be filled in later by
finish_block. */
sym->set_domain (FUNCTION_DOMAIN);
- sym->set_aclass_index (LOC_BLOCK);
+ sym->set_loc_class_index (LOC_BLOCK);
attr2 = dwarf2_attr (die, DW_AT_external, cu);
if ((attr2 != nullptr && attr2->as_boolean ())
|| cu->lang () == language_ada
@@ -16827,7 +16164,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
/* For Import, create a symbol using the source
name, and have it refer to the linkage name. */
SYMBOL_LOCATION_BATON (sym) = (void *) linkagename;
- sym->set_aclass_index (ada_block_index);
+ sym->set_loc_class_index (ada_block_index);
}
else
{
@@ -16843,7 +16180,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
/* SYMBOL_BLOCK_VALUE (sym) will be filled in later by
finish_block. */
sym->set_domain (FUNCTION_DOMAIN);
- sym->set_aclass_index (LOC_BLOCK);
+ sym->set_loc_class_index (LOC_BLOCK);
sym->set_is_inlined (1);
list_to_add = cu->list_in_scope;
break;
@@ -16895,7 +16232,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
&& die->parent->tag == DW_TAG_common_block)
attr2 = NULL;
- if (sym->aclass () == LOC_STATIC
+ if (sym->loc_class () == LOC_STATIC
&& sym->value_address () == 0
&& !per_objfile->per_bfd->has_section_at_zero)
{
@@ -16906,7 +16243,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
}
else if (attr2 != nullptr && attr2->as_boolean ())
{
- if (sym->aclass () == LOC_STATIC
+ if (sym->loc_class () == LOC_STATIC
&& (objfile->flags & OBJF_MAINLINE) == 0
&& per_objfile->per_bfd->can_copy)
{
@@ -16975,7 +16312,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
? cu->get_builder ()->get_global_symbols ()
: cu->list_in_scope);
SYMBOL_LOCATION_BATON (sym) = (void *) linkagename;
- sym->set_aclass_index (ada_imported_index);
+ sym->set_loc_class_index (ada_imported_index);
}
else if (attr2 != nullptr && attr2->as_boolean ()
&& dwarf2_attr (die, DW_AT_type, cu) != NULL)
@@ -16988,12 +16325,12 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
? cu->get_builder ()->get_global_symbols ()
: cu->list_in_scope);
- sym->set_aclass_index (LOC_UNRESOLVED);
+ sym->set_loc_class_index (LOC_UNRESOLVED);
}
else if (!die_is_declaration (die, cu))
{
/* Use the default LOC_OPTIMIZED_OUT class. */
- gdb_assert (sym->aclass () == LOC_OPTIMIZED_OUT);
+ gdb_assert (sym->loc_class () == LOC_OPTIMIZED_OUT);
if (!suppress_add)
list_to_add = cu->list_in_scope;
}
@@ -17049,13 +16386,13 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
there's a special hack for C++ in the matching code,
so we don't need to enter a separate typedef for the
tag. */
- sym->set_aclass_index (LOC_TYPEDEF);
+ sym->set_loc_class_index (LOC_TYPEDEF);
sym->set_domain (STRUCT_DOMAIN);
}
else
{
/* Other languages don't have a tag namespace. */
- sym->set_aclass_index (LOC_TYPEDEF);
+ sym->set_loc_class_index (LOC_TYPEDEF);
sym->set_domain (TYPE_DOMAIN);
}
@@ -17100,7 +16437,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
case DW_TAG_base_type:
case DW_TAG_subrange_type:
case DW_TAG_generic_subrange:
- sym->set_aclass_index (LOC_TYPEDEF);
+ sym->set_loc_class_index (LOC_TYPEDEF);
sym->set_domain (TYPE_DOMAIN);
list_to_add = cu->list_in_scope;
break;
@@ -17124,21 +16461,21 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
case DW_TAG_imported_declaration:
case DW_TAG_namespace:
sym->set_domain (TYPE_DOMAIN);
- sym->set_aclass_index (LOC_TYPEDEF);
+ sym->set_loc_class_index (LOC_TYPEDEF);
list_to_add = cu->get_builder ()->get_global_symbols ();
break;
case DW_TAG_module:
- sym->set_aclass_index (LOC_TYPEDEF);
+ sym->set_loc_class_index (LOC_TYPEDEF);
sym->set_domain (MODULE_DOMAIN);
list_to_add = cu->get_builder ()->get_global_symbols ();
break;
case DW_TAG_common_block:
- sym->set_aclass_index (LOC_COMMON_BLOCK);
+ sym->set_loc_class_index (LOC_COMMON_BLOCK);
sym->set_domain (COMMON_BLOCK_DOMAIN);
list_to_add = cu->list_in_scope;
break;
case DW_TAG_namelist:
- sym->set_aclass_index (LOC_STATIC);
+ sym->set_loc_class_index (LOC_STATIC);
sym->set_domain (VAR_DOMAIN);
list_to_add = cu->list_in_scope;
break;
@@ -17171,40 +16508,6 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
return (sym);
}
-/* Given an attr with a DW_FORM_dataN value in host byte order,
- zero-extend it as appropriate for the symbol's type. The DWARF
- standard (v4) is not entirely clear about the meaning of using
- DW_FORM_dataN for a constant with a signed type, where the type is
- wider than the data. The conclusion of a discussion on the DWARF
- list was that this is unspecified. We choose to always zero-extend
- because that is the interpretation long in use by GCC. */
-
-static gdb_byte *
-dwarf2_const_value_data (const struct attribute *attr, struct obstack *obstack,
- struct dwarf2_cu *cu, LONGEST *value, int bits)
-{
- struct objfile *objfile = cu->per_objfile->objfile;
- enum bfd_endian byte_order = bfd_big_endian (objfile->obfd.get ()) ?
- BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
- LONGEST l = attr->constant_value (0);
-
- if (bits < sizeof (*value) * 8)
- {
- l &= ((LONGEST) 1 << bits) - 1;
- *value = l;
- }
- else if (bits == sizeof (*value) * 8)
- *value = l;
- else
- {
- gdb_byte *bytes = (gdb_byte *) obstack_alloc (obstack, bits / 8);
- store_unsigned_integer (bytes, bits / 8, byte_order, l);
- return bytes;
- }
-
- return NULL;
-}
-
/* Read a constant value from an attribute. Either set *VALUE, or if
the value does not fit in *VALUE, set *BYTES - either already
allocated on the objfile obstack, or newly allocated on OBSTACK,
@@ -17220,7 +16523,7 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
struct objfile *objfile = per_objfile->objfile;
- struct comp_unit_head *cu_header = &cu->header;
+ unit_head *cu_header = &cu->header;
struct dwarf_block *blk;
enum bfd_endian byte_order = (bfd_big_endian (objfile->obfd.get ()) ?
BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE);
@@ -17244,7 +16547,7 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
/* Symbols of this form are reasonably rare, so we just
piggyback on the existing location code rather than writing
a new implementation of symbol_computed_ops. */
- *baton = XOBNEW (obstack, struct dwarf2_locexpr_baton);
+ *baton = OBSTACK_ZALLOC (obstack, struct dwarf2_locexpr_baton);
(*baton)->per_objfile = per_objfile;
(*baton)->per_cu = cu->per_cu;
gdb_assert ((*baton)->per_cu);
@@ -17264,6 +16567,7 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
case DW_FORM_strx:
case DW_FORM_GNU_str_index:
case DW_FORM_GNU_strp_alt:
+ case DW_FORM_strp_sup:
/* The string is already allocated on the objfile obstack, point
directly to it. */
*bytes = (const gdb_byte *) attr->as_string ();
@@ -17287,25 +16591,13 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
converted to host endianness, so we just need to sign- or
zero-extend it as appropriate. */
case DW_FORM_data1:
- *bytes = dwarf2_const_value_data (attr, obstack, cu, value, 8);
- break;
case DW_FORM_data2:
- *bytes = dwarf2_const_value_data (attr, obstack, cu, value, 16);
- break;
case DW_FORM_data4:
- *bytes = dwarf2_const_value_data (attr, obstack, cu, value, 32);
- break;
case DW_FORM_data8:
- *bytes = dwarf2_const_value_data (attr, obstack, cu, value, 64);
- break;
-
case DW_FORM_sdata:
case DW_FORM_implicit_const:
- *value = attr->as_signed ();
- break;
-
case DW_FORM_udata:
- *value = attr->as_unsigned ();
+ *value = attr->confused_constant ().value_or (0);
break;
default:
@@ -17336,17 +16628,17 @@ dwarf2_const_value (const struct attribute *attr, struct symbol *sym,
if (baton != NULL)
{
SYMBOL_LOCATION_BATON (sym) = baton;
- sym->set_aclass_index (dwarf2_locexpr_index);
+ sym->set_loc_class_index (dwarf2_locexpr_index);
}
else if (bytes != NULL)
{
sym->set_value_bytes (bytes);
- sym->set_aclass_index (LOC_CONST_BYTES);
+ sym->set_loc_class_index (LOC_CONST_BYTES);
}
else
{
sym->set_value_longest (value);
- sym->set_aclass_index (LOC_CONST);
+ sym->set_loc_class_index (LOC_CONST);
}
}
@@ -17470,11 +16762,12 @@ lookup_die_type (struct die_info *die, const struct attribute *attr,
/* First see if we have it cached. */
- if (attr->form == DW_FORM_GNU_ref_alt)
+ if (attr->form_is_alt ())
{
+ const auto &section = get_section_for_ref (*attr, cu);
sect_offset sect_off = attr->get_ref_die_offset ();
dwarf2_per_cu *per_cu
- = dwarf2_find_containing_comp_unit (sect_off, 1, per_objfile->per_bfd);
+ = dwarf2_find_containing_unit ({ &section, sect_off }, per_objfile);
this_type = get_die_type_at_offset (sect_off, per_cu, per_objfile);
}
@@ -17712,9 +17005,11 @@ anonymous_struct_prefix (struct die_info *die, struct dwarf2_cu *cu)
return NULL;
attr = dw2_linkage_name_attr (die, cu);
+ if (attr == nullptr)
+ return nullptr;
const char *attr_name = attr->as_string ();
- if (attr == NULL || attr_name == NULL)
- return NULL;
+ if (attr_name == nullptr)
+ return nullptr;
/* dwarf2_name had to be already called. */
gdb_assert (attr->canonical_string_p ());
@@ -18175,14 +17470,13 @@ follow_die_ref_or_sig (struct die_info *src_die, const struct attribute *attr,
return die;
}
-/* Follow reference OFFSET.
- On entry *REF_CU is the CU of the source die referencing OFFSET.
+/* Follow reference TARGET.
+ On entry *REF_CU is the CU of the source die referencing TARGET.
On exit *REF_CU is the CU of the result.
- Returns NULL if OFFSET is invalid. */
+ Returns nullptr if TARGET is invalid. */
-static struct die_info *
-follow_die_offset (sect_offset sect_off, int offset_in_dwz,
- struct dwarf2_cu **ref_cu)
+static die_info *
+follow_die_offset (const section_and_offset &target, dwarf2_cu **ref_cu)
{
dwarf2_cu *source_cu = *ref_cu;
dwarf2_cu *target_cu = source_cu;
@@ -18194,23 +17488,23 @@ follow_die_offset (sect_offset sect_off, int offset_in_dwz,
dwarf_read_debug_printf_v ("source CU offset: %s, target offset: %s, "
"source CU contains target offset: %d",
sect_offset_str (source_cu->per_cu->sect_off),
- sect_offset_str (sect_off),
- source_cu->header.offset_in_cu_p (sect_off));
+ sect_offset_str (target.offset),
+ (target.section == &source_cu->section ()
+ && source_cu->header.offset_in_unit_p (target.offset)));
if (source_cu->per_cu->is_debug_types)
{
/* .debug_types CUs cannot reference anything outside their CU.
If they need to, they have to reference a signatured type via
DW_FORM_ref_sig8. */
- if (!source_cu->header.offset_in_cu_p (sect_off))
+ if (!source_cu->header.offset_in_unit_p (target.offset))
return NULL;
}
- else if (offset_in_dwz != source_cu->per_cu->is_dwz
- || !source_cu->header.offset_in_cu_p (sect_off))
+ else if (target.section != &source_cu->section ()
+ || !source_cu->header.offset_in_unit_p (target.offset))
{
dwarf2_per_cu *target_per_cu
- = dwarf2_find_containing_comp_unit (sect_off, offset_in_dwz,
- per_objfile->per_bfd);
+ = dwarf2_find_containing_unit (target, per_objfile);
dwarf_read_debug_printf_v ("target CU offset: %s, "
"target CU DIEs loaded: %d",
@@ -18232,14 +17526,13 @@ follow_die_offset (sect_offset sect_off, int offset_in_dwz,
error (_(DWARF_ERROR_PREFIX
"cannot follow reference to DIE at %s"
" [in module %s]"),
- sect_offset_str (sect_off),
+ sect_offset_str (target.offset),
objfile_name (per_objfile->objfile));
}
*ref_cu = target_cu;
- auto it = target_cu->die_hash.find (sect_off);
- return it != target_cu->die_hash.end () ? *it : nullptr;
+ return target_cu->find_die (target.offset);
}
/* Follow reference attribute ATTR of SRC_DIE.
@@ -18251,24 +17544,21 @@ follow_die_ref (struct die_info *src_die, const struct attribute *attr,
struct dwarf2_cu **ref_cu)
{
sect_offset sect_off = attr->get_ref_die_offset ();
- struct dwarf2_cu *cu = *ref_cu;
- struct die_info *die;
+ struct dwarf2_cu *src_cu = *ref_cu;
- if (attr->form != DW_FORM_GNU_ref_alt && src_die->sect_off == sect_off)
+ if (!attr->form_is_alt () && src_die->sect_off == sect_off)
{
/* Self-reference, we're done. */
return src_die;
}
- die = follow_die_offset (sect_off,
- (attr->form == DW_FORM_GNU_ref_alt
- || cu->per_cu->is_dwz),
- ref_cu);
- if (!die)
+ const dwarf2_section_info &section = get_section_for_ref (*attr, src_cu);
+ die_info *die = follow_die_offset ({ &section, sect_off }, ref_cu);
+ if (die == nullptr)
error (_(DWARF_ERROR_PREFIX
"Cannot find DIE at %s referenced from DIE at %s [in module %s]"),
sect_offset_str (sect_off), sect_offset_str (src_die->sect_off),
- objfile_name (cu->per_objfile->objfile));
+ objfile_name (src_cu->per_objfile->objfile));
return die;
}
@@ -18281,7 +17571,6 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off, dwarf2_per_cu *per_cu,
gdb::function_view<CORE_ADDR ()> get_frame_pc,
bool resolve_abstract_p)
{
- struct die_info *die;
struct attribute *attr;
struct dwarf2_locexpr_baton retval;
struct objfile *objfile = per_objfile->objfile;
@@ -18299,8 +17588,8 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off, dwarf2_per_cu *per_cu,
sect_offset_str (sect_off), objfile_name (objfile));
}
- die = follow_die_offset (sect_off, per_cu->is_dwz, &cu);
- if (!die)
+ die_info *die = follow_die_offset ({ &cu->section (), sect_off }, &cu);
+ if (die == nullptr)
error (_(DWARF_ERROR_PREFIX
"Cannot find DIE at %s referenced [in module %s]"),
sect_offset_str (sect_off), objfile_name (objfile));
@@ -18316,8 +17605,8 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off, dwarf2_per_cu *per_cu,
: per_objfile->per_bfd->abstract_to_concrete[die->sect_off])
{
struct dwarf2_cu *cand_cu = cu;
- struct die_info *cand
- = follow_die_offset (cand_off, per_cu->is_dwz, &cand_cu);
+ die_info *cand
+ = follow_die_offset ({ &cu->section (), cand_off }, &cand_cu);
if (!cand
|| !cand->parent
|| cand->parent->tag != DW_TAG_subprogram)
@@ -18419,7 +17708,6 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off,
obstack *obstack,
LONGEST *len)
{
- struct die_info *die;
struct attribute *attr;
const gdb_byte *result = NULL;
struct type *type;
@@ -18440,7 +17728,7 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off,
sect_offset_str (sect_off), objfile_name (objfile));
}
- die = follow_die_offset (sect_off, per_cu->is_dwz, &cu);
+ die_info *die = follow_die_offset ({ &cu->section (), sect_off }, &cu);
if (!die)
error (_(DWARF_ERROR_PREFIX
"Cannot find DIE at %s referenced [in module %s]"),
@@ -18473,6 +17761,7 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off,
case DW_FORM_strx:
case DW_FORM_GNU_str_index:
case DW_FORM_GNU_strp_alt:
+ case DW_FORM_strp_sup:
/* The string is already allocated on the objfile obstack, point
directly to it. */
{
@@ -18498,47 +17787,19 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off,
symbol's value "represented as it would be on the target
architecture." By the time we get here, it's already been
converted to host endianness, so we just need to sign- or
- zero-extend it as appropriate. */
+ zero-extend it as appropriate.
+
+ Both GCC and LLVM agree that these are always signed, though. */
case DW_FORM_data1:
- type = die_type (die, cu);
- result = dwarf2_const_value_data (attr, obstack, cu, &value, 8);
- if (result == NULL)
- result = write_constant_as_bytes (obstack, byte_order,
- type, value, len);
- break;
case DW_FORM_data2:
- type = die_type (die, cu);
- result = dwarf2_const_value_data (attr, obstack, cu, &value, 16);
- if (result == NULL)
- result = write_constant_as_bytes (obstack, byte_order,
- type, value, len);
- break;
case DW_FORM_data4:
- type = die_type (die, cu);
- result = dwarf2_const_value_data (attr, obstack, cu, &value, 32);
- if (result == NULL)
- result = write_constant_as_bytes (obstack, byte_order,
- type, value, len);
- break;
case DW_FORM_data8:
- type = die_type (die, cu);
- result = dwarf2_const_value_data (attr, obstack, cu, &value, 64);
- if (result == NULL)
- result = write_constant_as_bytes (obstack, byte_order,
- type, value, len);
- break;
-
case DW_FORM_sdata:
case DW_FORM_implicit_const:
- type = die_type (die, cu);
- result = write_constant_as_bytes (obstack, byte_order,
- type, attr->as_signed (), len);
- break;
-
case DW_FORM_udata:
type = die_type (die, cu);
- result = write_constant_as_bytes (obstack, byte_order,
- type, attr->as_unsigned (), len);
+ value = attr->confused_constant ().value_or (0);
+ result = write_constant_as_bytes (obstack, byte_order, type, value, len);
break;
default:
@@ -18557,8 +17818,6 @@ dwarf2_fetch_die_type_sect_off (sect_offset sect_off, dwarf2_per_cu *per_cu,
dwarf2_per_objfile *per_objfile,
const char **var_name)
{
- struct die_info *die;
-
dwarf2_cu *cu = per_objfile->get_cu (per_cu);
if (cu == nullptr)
cu = load_cu (per_cu, per_objfile, false);
@@ -18566,7 +17825,7 @@ dwarf2_fetch_die_type_sect_off (sect_offset sect_off, dwarf2_per_cu *per_cu,
if (cu == nullptr)
return nullptr;
- die = follow_die_offset (sect_off, per_cu->is_dwz, &cu);
+ die_info *die = follow_die_offset ({ &cu->section (), sect_off }, &cu);
if (!die)
return NULL;
@@ -18615,8 +17874,8 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type,
gdb_assert (sig_cu != NULL);
gdb_assert (to_underlying (sig_type->type_offset_in_section) != 0);
- if (auto die_it = sig_cu->die_hash.find (sig_type->type_offset_in_section);
- die_it != sig_cu->die_hash.end ())
+ if (die_info *die = sig_cu->find_die (sig_type->type_offset_in_section);
+ die != nullptr)
{
/* For .gdb_index version 7 keep track of included TUs.
http://sourceware.org/bugzilla/show_bug.cgi?id=15021. */
@@ -18625,7 +17884,7 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type,
(*ref_cu)->per_cu->imported_symtabs.push_back (sig_cu->per_cu);
*ref_cu = sig_cu;
- return *die_it;
+ return die;
}
return NULL;
@@ -18952,7 +18211,7 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu,
case DW_OP_deref:
/* If we're not the last op, then we definitely can't encode
- this using GDB's address_class enum. This is valid for partial
+ this using GDB's location_class enum. This is valid for partial
global symbols, although the variable's address will be bogus
in the psymtab. */
if (i < size)
@@ -19182,7 +18441,7 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym,
/* .debug_loc{,.dwo} may not exist at all, or the offset may be outside
the section. If so, fall through to the complaint in the
other branch. */
- && attr->as_unsigned () < section->get_size (objfile))
+ && attr->as_unsigned () < section->size)
{
struct dwarf2_loclist_baton *baton;
@@ -19194,7 +18453,7 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym,
complaint (_("Location list used without "
"specifying the CU base address."));
- sym->set_aclass_index ((is_block
+ sym->set_loc_class_index ((is_block
? dwarf2_loclist_block_index
: dwarf2_loclist_index));
SYMBOL_LOCATION_BATON (sym) = baton;
@@ -19203,7 +18462,8 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym,
{
struct dwarf2_locexpr_baton *baton;
- baton = XOBNEW (&objfile->objfile_obstack, struct dwarf2_locexpr_baton);
+ baton = OBSTACK_ZALLOC (&objfile->objfile_obstack,
+ struct dwarf2_locexpr_baton);
baton->per_objfile = per_objfile;
baton->per_cu = cu->per_cu;
gdb_assert (baton->per_cu);
@@ -19226,7 +18486,7 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym,
baton->size = 0;
}
- sym->set_aclass_index ((is_block
+ sym->set_loc_class_index ((is_block
? dwarf2_locexpr_block_index
: dwarf2_locexpr_index));
SYMBOL_LOCATION_BATON (sym) = baton;
@@ -19235,7 +18495,7 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym,
/* See read.h. */
-const comp_unit_head *
+const unit_head *
dwarf2_per_cu::get_header () const
{
if (!m_header_read_in)
@@ -19243,8 +18503,7 @@ dwarf2_per_cu::get_header () const
const gdb_byte *info_ptr
= this->section->buffer + to_underlying (this->sect_off);
- read_comp_unit_head (&m_header, info_ptr, this->section,
- rcuh_kind::COMPILE);
+ read_unit_head (&m_header, info_ptr, this->section, ruh_kind::COMPILE);
m_header_read_in = true;
}
@@ -19273,7 +18532,7 @@ dwarf2_per_cu::offset_size () const
int
dwarf2_per_cu::ref_addr_size () const
{
- const comp_unit_head *header = this->get_header ();
+ const unit_head *header = this->get_header ();
if (header->version == 2)
return header->addr_size;
@@ -19316,69 +18575,115 @@ dwarf2_per_cu::ensure_lang (dwarf2_per_objfile *per_objfile)
true, language_minimal, nullptr);
}
-/* A helper function for dwarf2_find_containing_comp_unit that returns
- the index of the result, and that searches a vector. It will
- return a result even if the offset in question does not actually
- occur in any CU. This is separate so that it can be unit
- tested. */
+/* Return the unit from ALL_UNITS that potentially contains TARGET.
-static int
-dwarf2_find_containing_comp_unit
- (sect_offset sect_off,
- unsigned int offset_in_dwz,
- const std::vector<dwarf2_per_cu_up> &all_units)
+ Since the unit lengths may not be known yet, this function doesn't check that
+ TARGET.OFFSET actually falls within the range of the returned unit. The
+ caller is responsible for this.
+
+ If no units possibly match TARGET, return nullptr. */
+
+static dwarf2_per_cu *
+dwarf2_find_containing_unit (const section_and_offset &target,
+ const std::vector<dwarf2_per_cu_up> &all_units)
{
- int low, high;
+ auto it = std::lower_bound (all_units.begin (), all_units.end (), target,
+ [] (const dwarf2_per_cu_up &per_cu,
+ const section_and_offset &key)
+ {
+ return all_units_less_than (*per_cu, key);
+ });
- low = 0;
- high = all_units.size () - 1;
- while (high > low)
+ if (it == all_units.begin ())
{
- int mid = low + (high - low) / 2;
- dwarf2_per_cu *mid_cu = all_units[mid].get ();
-
- if (mid_cu->is_dwz > offset_in_dwz
- || (mid_cu->is_dwz == offset_in_dwz
- && mid_cu->sect_off + mid_cu->length () > sect_off))
- high = mid;
+ /* TARGET falls before the first unit of the first section, or is an
+ exact match with the first. */
+ if ((*it)->section == target.section && (*it)->sect_off == target.offset)
+ return it->get ();
else
- low = mid + 1;
+ return nullptr;
+ }
+
+ if (it != all_units.end ()
+ && (*it)->section == target.section
+ && (*it)->sect_off == target.offset)
+ {
+ /* TARGET is an exact match with the start of *IT, so *IT is what we're
+ looking for. */
+ return it->get ();
}
- gdb_assert (low == high);
- return low;
+
+ /* Otherwise, the match is the one just before, as long as it matches the
+ section we're looking for. */
+ --it;
+
+ if ((*it)->section == target.section)
+ return it->get ();
+
+ return nullptr;
}
/* See read.h. */
dwarf2_per_cu *
-dwarf2_find_containing_comp_unit (sect_offset sect_off,
- unsigned int offset_in_dwz,
- dwarf2_per_bfd *per_bfd)
+dwarf2_find_containing_unit (const section_and_offset &target,
+ dwarf2_per_objfile *per_objfile)
{
- int low = dwarf2_find_containing_comp_unit
- (sect_off, offset_in_dwz, per_bfd->all_units);
- dwarf2_per_cu *this_cu = per_bfd->all_units[low].get ();
-
- if (this_cu->is_dwz != offset_in_dwz || this_cu->sect_off > sect_off)
+ dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
+ dwarf2_per_cu *per_cu
+ = dwarf2_find_containing_unit (target, per_bfd->all_units);
+ auto error_out = [&target, per_bfd] ()
{
- if (low == 0 || this_cu->is_dwz != offset_in_dwz)
- error (_(DWARF_ERROR_PREFIX
- "could not find CU containing offset %s [in module %s]"),
- sect_offset_str (sect_off),
- per_bfd->filename ());
+ error (_(DWARF_ERROR_PREFIX
+ "could not find unit containing offset %s [in module %s]"),
+ sect_offset_str (target.offset), per_bfd->filename ());
+ };
- gdb_assert (per_bfd->all_units[low-1]->sect_off
- <= sect_off);
- return per_bfd->all_units[low - 1].get ();
- }
- else
- {
- if (low == per_bfd->all_units.size () - 1
- && sect_off >= this_cu->sect_off + this_cu->length ())
- error (_("invalid dwarf2 offset %s"), sect_offset_str (sect_off));
- gdb_assert (sect_off < this_cu->sect_off + this_cu->length ());
- return this_cu;
- }
+ if (per_cu == nullptr)
+ error_out ();
+
+ gdb_assert (per_cu->section == target.section);
+
+ /* Some producers of dwarf2_per_cu objects (thinking of the .gdb_index reader)
+ do not set the length ahead of time. The length is needed to check if
+ the target is truly within PER_CU's range, so compute it now. Constructing
+ the cutu_reader object has the side-effect of setting PER_CU's length.
+ Even though it should happen too often, it could be replaced with
+ something more lightweight that has the same effect. */
+ if (!per_cu->length_is_set ())
+ cutu_reader (*per_cu, *per_objfile, nullptr, nullptr, false,
+ language_minimal);
+
+ /* Now we can check if the target section offset is within PER_CU's range. */
+ if (target.offset < per_cu->sect_off
+ || target.offset >= per_cu->sect_off + per_cu->length ())
+ error_out ();
+
+ return per_cu;
+}
+
+/* See read.h. */
+
+dwarf2_per_cu *
+dwarf2_find_unit (const section_and_offset &start, dwarf2_per_bfd *per_bfd)
+{
+ auto it = std::lower_bound (per_bfd->all_units.begin (),
+ per_bfd->all_units.end (), start,
+ [] (const dwarf2_per_cu_up &per_cu,
+ const section_and_offset &key)
+ {
+ return all_units_less_than (*per_cu, key);
+ });
+
+ if (it == per_bfd->all_units.end ())
+ return nullptr;
+
+ dwarf2_per_cu *per_cu = it->get ();
+
+ if (per_cu->section != start.section || per_cu->sect_off != start.offset)
+ return nullptr;
+
+ return per_cu;
}
#if GDB_SELF_TEST
@@ -19389,59 +18694,55 @@ namespace find_containing_comp_unit {
static void
run_test ()
{
- char dummy_per_bfd;
- char dummy_section;
-
- const auto create_dummy_per_cu = [&] (sect_offset sect_off,
- unsigned int length,
- bool is_dwz)
- {
- auto per_bfd = reinterpret_cast<dwarf2_per_bfd *> (&dummy_per_bfd);
- auto section = reinterpret_cast<dwarf2_section_info *> (&dummy_section);
+ auto dummy_per_bfd = reinterpret_cast<dwarf2_per_bfd *> (0x3000);
+ auto &main_section = *reinterpret_cast<dwarf2_section_info *> (0x4000);
+ auto &dwz_section = *reinterpret_cast<dwarf2_section_info *> (0x5000);
+ std::vector<dwarf2_per_cu_up> units;
- return dwarf2_per_cu_up (new dwarf2_per_cu (per_bfd, section, sect_off,
- length, is_dwz));
+ /* Create one dummy unit, append it to UNITS, return a non-owning
+ reference. */
+ auto create_dummy_per_unit = [&] (dwarf2_section_info &section,
+ unsigned int sect_off, bool is_dwz)
+ -> dwarf2_per_cu &
+ {
+ /* Omit the length, because dwarf2_find_containing_unit does not consider
+ it. */
+ return *units.emplace_back (new dwarf2_per_cu (dummy_per_bfd, &section,
+ sect_offset (sect_off),
+ 0, is_dwz));
};
- /* Units in the main file. */
- dwarf2_per_cu_up one = create_dummy_per_cu (sect_offset (0), 5, false);
- dwarf2_per_cu *one_ptr = one.get ();
- dwarf2_per_cu_up two
- = create_dummy_per_cu (sect_offset (one->length ()), 7, false);
- dwarf2_per_cu *two_ptr = two.get ();
-
- /* Units in the supplementary (dwz) file. */
- dwarf2_per_cu_up three = create_dummy_per_cu (sect_offset (0), 5, true);
- dwarf2_per_cu *three_ptr = three.get ();
- dwarf2_per_cu_up four
- = create_dummy_per_cu (sect_offset (three->length ()), 7, true);
- dwarf2_per_cu *four_ptr = four.get ();
-
- std::vector<dwarf2_per_cu_up> units;
- units.push_back (std::move (one));
- units.push_back (std::move (two));
- units.push_back (std::move (three));
- units.push_back (std::move (four));
-
- int result;
+ /* Create 2 units in the main file and 2 units in the supplementary (dwz)
+ file. */
+ auto &main1 = create_dummy_per_unit (main_section, 10, false);
+ auto &main2 = create_dummy_per_unit (main_section, 20, false);
+ auto &dwz1 = create_dummy_per_unit (dwz_section, 10, false);
+ auto &dwz2 = create_dummy_per_unit (dwz_section, 20, false);
+
+ /* Check that looking up a unit at all offsets in the range [START,END[ in
+ section SECTION finds EXPECTED. */
+ auto check_range = [&units] (dwarf2_section_info &section, unsigned int start,
+ unsigned int end, dwarf2_per_cu *expected)
+ {
+ for (unsigned int sect_off = start; sect_off < end; ++sect_off)
+ {
+ section_and_offset target { &section, sect_offset (sect_off) };
+ dwarf2_per_cu *result = dwarf2_find_containing_unit (target, units);
- result = dwarf2_find_containing_comp_unit (sect_offset (0), 0, units);
- SELF_CHECK (units[result].get () == one_ptr);
- result = dwarf2_find_containing_comp_unit (sect_offset (3), 0, units);
- SELF_CHECK (units[result].get () == one_ptr);
- result = dwarf2_find_containing_comp_unit (sect_offset (5), 0, units);
- SELF_CHECK (units[result].get () == two_ptr);
+ SELF_CHECK (result == expected);
+ }
+ };
- result = dwarf2_find_containing_comp_unit (sect_offset (0), 1, units);
- SELF_CHECK (units[result].get () == three_ptr);
- result = dwarf2_find_containing_comp_unit (sect_offset (3), 1, units);
- SELF_CHECK (units[result].get () == three_ptr);
- result = dwarf2_find_containing_comp_unit (sect_offset (5), 1, units);
- SELF_CHECK (units[result].get () == four_ptr);
-}
+ check_range (main_section, 0, 10, nullptr);
+ check_range (main_section, 10, 20, &main1);
+ check_range (main_section, 20, 30, &main2);
+ check_range (dwz_section, 0, 10, nullptr);
+ check_range (dwz_section, 10, 20, &dwz1);
+ check_range (dwz_section, 20, 30, &dwz2);
}
-}
+} /* namespace find_containing_comp_unit */
+} /* namespace selftests */
#endif /* GDB_SELF_TEST */
@@ -19736,9 +19037,7 @@ show_check_physname (struct ui_file *file, int from_tty,
value);
}
-void _initialize_dwarf2_read ();
-void
-_initialize_dwarf2_read ()
+INIT_GDB_FILE (dwarf2_read)
{
add_setshow_prefix_cmd ("dwarf", class_maintenance,
_("\
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 7f56dac..f0d46f6 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -1,6 +1,6 @@
/* DWARF 2 debugging format support for GDB.
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,13 +22,14 @@
#include <queue>
#include "dwarf2/abbrev.h"
-#include "dwarf2/comp-unit-head.h"
+#include "dwarf2/unit-head.h"
#include "dwarf2/file-and-dir.h"
#include "dwarf2/index-cache.h"
#include "dwarf2/mapped-index.h"
#include "dwarf2/section.h"
#include "dwarf2/cu.h"
#include "dwarf2/dwz.h"
+#include "gdbsupport/cxx-thread.h"
#include "gdbsupport/gdb_obstack.h"
#include "gdbsupport/function-view.h"
#include "gdbsupport/packed.h"
@@ -44,7 +45,6 @@ struct tu_stats
int nr_symtab_sharers = 0;
int nr_stmt_less_type_units = 0;
int nr_all_type_units_reallocs = 0;
- int nr_tus = 0;
};
struct abbrev_table_cache;
@@ -52,6 +52,7 @@ struct dwarf2_cu;
struct dwarf2_debug_sections;
struct dwarf2_per_bfd;
struct dwarf2_per_cu;
+struct file_entry;
struct mapped_index;
struct mapped_debug_names;
struct signatured_type;
@@ -125,7 +126,6 @@ struct dwarf2_per_cu
lto_artificial (false),
queued (false),
m_header_read_in (false),
- mark (false),
files_read (false),
scanned (false),
section (section),
@@ -193,10 +193,6 @@ public:
it private at the moment. */
mutable packed<bool, 1> m_header_read_in;
- /* A temporary mark bit used when iterating over all CUs in
- expand_symtabs_matching. */
- packed<unsigned int, 1> mark;
-
/* True if we've tried to read the file table. There will be no
point in trying to read it again next time. */
packed<bool, 1> files_read;
@@ -233,14 +229,14 @@ public:
/* Backlink to the owner of this. */
dwarf2_per_bfd *per_bfd;
- /* DWARF header of this CU. Note that dwarf2_cu reads its own version of the
- header, which may differ from this one, since it may pass rcuh_kind::TYPE
- to read_comp_unit_head, whereas for dwarf2_per_cu we always pass
- rcuh_kind::COMPILE.
+ /* DWARF header of this unit. Note that dwarf2_cu reads its own version of
+ the header, which may differ from this one, since it may pass
+ rch_kind::TYPE to read_unit_head, whereas for dwarf2_per_cu we always pass
+ ruh_kind::COMPILE.
Don't access this field directly, use the get_header method instead. It
should be private, but we can't make it private at the moment. */
- mutable comp_unit_head m_header;
+ mutable unit_head m_header;
/* The file and directory for this CU. This is cached so that we
don't need to re-examine the DWO in some situations. This may be
@@ -271,7 +267,7 @@ public:
std::vector<dwarf2_per_cu *> imported_symtabs;
/* Get the header of this per_cu, reading it if necessary. */
- const comp_unit_head *get_header () const;
+ const unit_head *get_header () const;
/* Return the address size given in the compilation unit header for
this CU. */
@@ -293,6 +289,10 @@ public:
return m_length;
}
+ /* Return true if the length of this CU has been set. */
+ bool length_is_set () const
+ { return m_length != 0; }
+
void set_length (unsigned int length, bool strict_p = true)
{
if (m_length == 0)
@@ -512,30 +512,16 @@ struct dwarf2_per_bfd
const char *filename () const
{ return bfd_get_filename (this->obfd); }
- /* Return the CU given its index. */
- dwarf2_per_cu *get_cu (int index) const
+ /* Return the unit given its index. */
+ dwarf2_per_cu *get_unit (int index) const
{
return this->all_units[index].get ();
}
- /* Return the CU given its index in the CU table in the index. */
- dwarf2_per_cu *get_index_cu (int index) const
- {
- if (this->all_comp_units_index_cus.empty ())
- return get_cu (index);
-
- return this->all_comp_units_index_cus[index];
- }
-
- dwarf2_per_cu *get_index_tu (int index) const
- {
- return this->all_comp_units_index_tus[index];
- }
-
/* Return the separate '.dwz' debug file. If there is no
- .gnu_debugaltlink section in the file, then the result depends on
- REQUIRE: if REQUIRE is true, error out; if REQUIRE is false,
- return nullptr. */
+ .gnu_debugaltlink or .debug_sup section in the file, then the
+ result depends on REQUIRE: if REQUIRE is true, error out; if
+ REQUIRE is false, return nullptr. */
struct dwz_file *get_dwz_file (bool require = false)
{
gdb_assert (!require || this->dwz_file.has_value ());
@@ -546,7 +532,7 @@ struct dwarf2_per_bfd
{
result = this->dwz_file->get ();
if (require && result == nullptr)
- error (_("could not read '.gnu_debugaltlink' section"));
+ error (_("could not find supplementary DWARF file"));
}
return result;
@@ -616,13 +602,9 @@ public:
the target compilation unit of a particular reference. */
std::vector<dwarf2_per_cu_up> all_units;
- /* The all_units vector contains both CUs and TUs. Provide views on the
- vector that are limited to either the CU part or the TU part. */
- gdb::array_view<dwarf2_per_cu_up> all_comp_units;
- gdb::array_view<dwarf2_per_cu_up> all_type_units;
-
- std::vector<dwarf2_per_cu *> all_comp_units_index_cus;
- std::vector<dwarf2_per_cu *> all_comp_units_index_tus;
+ /* Number of compilation and type units in the ALL_UNITS vector. */
+ unsigned int num_comp_units = 0;
+ unsigned int num_type_units = 0;
/* Set of signatured_types, used to look up by signature. */
signatured_type_set signatured_types;
@@ -634,8 +616,8 @@ public:
/* Set of dwo_file objects. */
dwo_file_up_set dwo_files;
- /* True if we've checked for whether there is a DWP file. */
- bool dwp_checked = false;
+ /* Mutex to synchronize access to DWO_FILES. */
+ gdb::mutex dwo_files_lock;
/* The DWP file if there is one, or NULL. */
dwp_file_up dwp_file;
@@ -683,6 +665,36 @@ public:
std::string captured_debug_dir;
};
+/* Scoped object to remove all units from PER_BFD and clear other associated
+ fields in case of failure. */
+
+struct scoped_remove_all_units
+{
+ explicit scoped_remove_all_units (dwarf2_per_bfd &per_bfd)
+ : m_per_bfd (&per_bfd)
+ {}
+
+ DISABLE_COPY_AND_ASSIGN (scoped_remove_all_units);
+
+ ~scoped_remove_all_units ()
+ {
+ if (m_per_bfd == nullptr)
+ return;
+
+ m_per_bfd->all_units.clear ();
+ m_per_bfd->num_comp_units = 0;
+ m_per_bfd->num_type_units = 0;
+ }
+
+ /* Disable this object. Call this to keep the units of M_PER_BFD on the
+ success path. */
+ void disable () { m_per_bfd = nullptr; }
+
+private:
+ /* This is nullptr if the object is disabled. */
+ dwarf2_per_bfd *m_per_bfd;
+};
+
/* An iterator for all_units that is based on index. This
approach makes it possible to iterate over all_units safely,
when some caller in the loop may add new units. */
@@ -705,7 +717,7 @@ public:
dwarf2_per_cu *operator* () const
{
- return m_per_bfd->get_cu (m_index);
+ return m_per_bfd->get_unit (m_index);
}
bool operator== (const all_units_iterator &other) const
@@ -815,7 +827,7 @@ struct dwarf2_per_objfile
BUF is assumed to be in a compilation unit described by CU_HEADER.
Return *BYTES_READ_PTR count of bytes read from BUF. */
const char *read_line_string (const gdb_byte *buf,
- const struct comp_unit_head *cu_header,
+ const struct unit_head *unit_header,
unsigned int *bytes_read_ptr);
/* Return pointer to string at .debug_line_str offset as read from BUF.
@@ -927,7 +939,7 @@ public:
dwarf2_cu *existing_cu,
bool skip_partial,
enum language pretend_language,
- const abbrev_table_cache *cache = nullptr);
+ const abbrev_table_cache *abbrev_cache = nullptr);
cutu_reader (dwarf2_per_cu &this_cu,
dwarf2_per_objfile &per_objfile,
@@ -937,8 +949,6 @@ public:
DISABLE_COPY_AND_ASSIGN (cutu_reader);
- cutu_reader (cutu_reader &&) = default;
-
/* Return true if either:
- the unit is empty (just a header without any DIE)
@@ -1028,6 +1038,31 @@ private:
const char *read_dwo_str_index (ULONGEST str_index);
+ gdb_bfd_ref_ptr open_dwo_file (dwarf2_per_bfd *per_bfd, const char *file_name,
+ const char *comp_dir);
+
+ dwo_file_up open_and_init_dwo_file (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir);
+
+ void locate_dwo_sections (objfile *objfile, dwo_file &dwo_file);
+
+ void create_dwo_unit_hash_tables (dwo_file &dwo_file, dwarf2_cu &skeleton_cu,
+ dwarf2_section_info &section,
+ ruh_kind section_kind);
+
+ dwo_unit *lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir, ULONGEST signature,
+ int is_debug_types);
+
+ dwo_unit *lookup_dwo_comp_unit (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir, ULONGEST signature);
+
+ dwo_unit *lookup_dwo_type_unit (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir);
+
+ dwo_unit *lookup_dwo_unit (dwarf2_cu *cu, die_info *comp_unit_die,
+ const char *dwo_name);
+
/* The bfd of die_section. */
bfd *m_abfd;
@@ -1179,32 +1214,51 @@ struct dwarf2_base_index_functions : public quick_symbol_functions
bool need_fullname) override;
};
-/* If FILE_MATCHER is NULL or if PER_CU has
- dwarf2_per_cu_quick_data::MARK set (see
- dw_expand_symtabs_matching_file_matcher), expand the CU and call
- EXPANSION_NOTIFY on it. */
+/* This is used to track whether a CU has already been visited during
+ symbol expansion. It is an auto-resizing bool vector. */
+class auto_bool_vector
+{
+public:
+
+ auto_bool_vector () = default;
-extern bool dw2_expand_symtabs_matching_one
- (dwarf2_per_cu *per_cu,
- dwarf2_per_objfile *per_objfile,
- expand_symtabs_file_matcher file_matcher,
- expand_symtabs_expansion_listener expansion_notify,
- expand_symtabs_lang_matcher lang_matcher);
+ /* Return true if element I is set. */
+ bool is_set (size_t i) const
+ {
+ if (i < m_vec.size ())
+ return m_vec[i];
+ return false;
+ }
+
+ /* Set a value in this vector, growing it automatically. */
+ void set (size_t i, bool value)
+ {
+ if (m_vec.size () < i + 1)
+ m_vec.resize (i + 1);
+ m_vec[i] = value;
+ }
-/* If FILE_MATCHER is non-NULL, set all the
- dwarf2_per_cu_quick_data::MARK of the current DWARF2_PER_OBJFILE
- that match FILE_MATCHER. */
+private:
+ std::vector<bool> m_vec;
+};
-extern void dw_expand_symtabs_matching_file_matcher
- (dwarf2_per_objfile *per_objfile,
- expand_symtabs_file_matcher file_matcher);
+/* If FILE_MATCHER is NULL and if CUS_TO_SKIP does not include the
+ CU's index, expand the CU and call LISTENER on it. */
+
+extern bool dw2_search_one
+ (dwarf2_per_cu *per_cu,
+ dwarf2_per_objfile *per_objfile,
+ auto_bool_vector &cus_to_skip,
+ search_symtabs_file_matcher file_matcher,
+ search_symtabs_expansion_listener listener,
+ search_symtabs_lang_matcher lang_matcher);
/* Return pointer to string at .debug_str offset STR_OFFSET. */
extern const char *read_indirect_string_at_offset
(dwarf2_per_objfile *per_objfile, LONGEST str_offset);
-/* Initialize the views on all_units. */
+/* Finalize the all_units vector. */
extern void finalize_all_units (dwarf2_per_bfd *per_bfd);
@@ -1249,14 +1303,17 @@ extern pc_bounds_kind dwarf2_get_pc_bounds (die_info *die,
dwarf2_cu *cu, addrmap_mutable *map,
void *datum);
-/* Locate the .debug_info compilation unit from CU's objfile which contains
- the DIE at OFFSET. Raises an error on failure. */
+/* Locate the unit in PER_OBJFILE which contains the DIE at TARGET. Raises an
+ error on failure. */
+
+extern dwarf2_per_cu *dwarf2_find_containing_unit
+ (const section_and_offset &target, dwarf2_per_objfile *per_objfile);
+
+/* Locate the unit starting at START in PER_BFD. Return nullptr if not
+ found. */
-extern dwarf2_per_cu *dwarf2_find_containing_comp_unit (sect_offset sect_off,
- unsigned int
- offset_in_dwz,
- dwarf2_per_bfd
- *per_bfd);
+extern dwarf2_per_cu *dwarf2_find_unit (const section_and_offset &start,
+ dwarf2_per_bfd *per_bfd);
/* Decode simple location descriptions.
@@ -1299,4 +1356,46 @@ extern int dwarf2_ranges_read (unsigned offset, unrelocated_addr *low_return,
extern file_and_directory &find_file_and_directory (die_info *die,
dwarf2_cu *cu);
+
+/* Return the section that ATTR, an attribute with ref form, references. */
+
+extern const dwarf2_section_info &get_section_for_ref
+ (const attribute &attr, dwarf2_cu *cu);
+
+/* A convenience function to find the proper .debug_line section for a CU. */
+
+extern struct dwarf2_section_info *get_debug_line_section
+ (struct dwarf2_cu *cu);
+
+/* Start a subfile for DWARF. FILENAME is the name of the file and
+ DIRNAME the name of the source directory which contains FILENAME
+ or NULL if not known.
+ This routine tries to keep line numbers from identical absolute and
+ relative file names in a common subfile.
+
+ Using the `list' example from the GDB testsuite, which resides in
+ /srcdir and compiling it with Irix6.2 cc in /compdir using a filename
+ of /srcdir/list0.c yields the following debugging information for list0.c:
+
+ DW_AT_name: /srcdir/list0.c
+ DW_AT_comp_dir: /compdir
+ files.files[0].name: list0.h
+ files.files[0].dir: /srcdir
+ files.files[1].name: list0.c
+ files.files[1].dir: /srcdir
+
+ The line number information for list0.c has to end up in a single
+ subfile, so that `break /srcdir/list0.c:1' works as expected.
+ start_subfile will ensure that this happens provided that we pass the
+ concatenation of files.files[1].dir and files.files[1].name as the
+ subfile's name. */
+extern void dwarf2_start_subfile (dwarf2_cu *cu, const file_entry &fe,
+ const line_header &lh);
+
+/* A helper function that decides if a given symbol is an Ada Pragma
+ Import or Pragma Export. */
+
+extern bool is_ada_import_or_export (dwarf2_cu *cu, const char *name,
+ const char *linkagename);
+
#endif /* GDB_DWARF2_READ_H */
diff --git a/gdb/dwarf2/sect-names.h b/gdb/dwarf2/sect-names.h
index 03a571c..71e11f8 100644
--- a/gdb/dwarf2/sect-names.h
+++ b/gdb/dwarf2/sect-names.h
@@ -1,6 +1,6 @@
/* DWARF 2 section names.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/section.c b/gdb/dwarf2/section.c
index e0b63fd..0a790f4 100644
--- a/gdb/dwarf2/section.c
+++ b/gdb/dwarf2/section.c
@@ -1,6 +1,6 @@
/* DWARF 2 low-level section code
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
Inc. with support from Florida State University (under contract
diff --git a/gdb/dwarf2/section.h b/gdb/dwarf2/section.h
index 09bddd4..fbdb025 100644
--- a/gdb/dwarf2/section.h
+++ b/gdb/dwarf2/section.h
@@ -1,6 +1,6 @@
/* DWARF 2 low-level section code
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
Inc. with support from Florida State University (under contract
@@ -43,6 +43,8 @@
the real section this "virtual" section is contained in, and BUFFER,SIZE
describe the virtual section. */
+#include "dwarf2/types.h"
+
struct dwarf2_section_info
{
/* Return the name of this section. */
@@ -81,19 +83,6 @@ struct dwarf2_section_info
If the section is compressed, uncompress it before returning. */
void read (struct objfile *objfile);
- /* A helper function that returns the size of a section in a safe way.
- If you are positive that the section has been read before using the
- size, then it is safe to refer to the dwarf2_section_info object's
- "size" field directly. In other cases, you must call this
- function, because for compressed sections the size field is not set
- correctly until the section has been read. */
- bfd_size_type get_size (struct objfile *objfile)
- {
- if (!readin)
- read (objfile);
- return size;
- }
-
/* Issue a complaint that something was outside the bounds of this
buffer. */
void overflow_complaint () const;
@@ -125,4 +114,14 @@ struct dwarf2_section_info
bool is_virtual;
};
+using dwarf2_section_info_up = std::unique_ptr<dwarf2_section_info>;
+
+/* A pair-like structure to represent an offset into a section. */
+
+struct section_and_offset
+{
+ const dwarf2_section_info *section;
+ sect_offset offset;
+};
+
#endif /* GDB_DWARF2_SECTION_H */
diff --git a/gdb/dwarf2/stringify.c b/gdb/dwarf2/stringify.c
index 1a4e280..bdb5125 100644
--- a/gdb/dwarf2/stringify.c
+++ b/gdb/dwarf2/stringify.c
@@ -1,6 +1,6 @@
/* DWARF stringify code
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
Inc. with support from Florida State University (under contract
@@ -25,6 +25,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "dwarf2.h"
+#include "dwarf2/read-gdb-index.h"
#include "dwarf2/stringify.h"
/* A convenience function that returns an "unknown" DWARF name,
@@ -44,6 +45,11 @@ dwarf_unknown (const char *str, unsigned v)
const char *
dwarf_tag_name (unsigned tag)
{
+ if (tag == DW_TAG_GDB_INDEX_OTHER)
+ return "DW_TAG_GDB_INDEX_OTHER";
+ else if (tag == DW_TAG_GDB_INDEX_TYPE)
+ return "DW_TAG_GDB_INDEX_TYPE";
+
const char *name = get_DW_TAG_name (tag);
if (name == NULL)
diff --git a/gdb/dwarf2/stringify.h b/gdb/dwarf2/stringify.h
index 1fb7ab3..254582e 100644
--- a/gdb/dwarf2/stringify.h
+++ b/gdb/dwarf2/stringify.h
@@ -1,6 +1,6 @@
/* DWARF stringify code
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/tag.h b/gdb/dwarf2/tag.h
index 865c2bc..9b5c775 100644
--- a/gdb/dwarf2/tag.h
+++ b/gdb/dwarf2/tag.h
@@ -1,6 +1,6 @@
/* Tag attributes
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,6 +22,7 @@
#include "dwarf2.h"
#include "symtab.h"
+#include "read-gdb-index.h"
/* Return true if TAG represents a type, false otherwise. */
@@ -102,6 +103,10 @@ tag_matches_domain (dwarf_tag tag, domain_search_flags search, language lang)
}
break;
+ case DW_TAG_imported_declaration:
+ /* DW_TAG_imported_declaration isn't necessarily a type, but the
+ scanner doesn't track the referent, and the full reader
+ also currently puts it in TYPE_DOMAIN. */
case DW_TAG_padding:
case DW_TAG_array_type:
case DW_TAG_pointer_type:
@@ -140,6 +145,13 @@ tag_matches_domain (dwarf_tag tag, domain_search_flags search, language lang)
else
flags = SEARCH_MODULE_DOMAIN;
break;
+
+ case DW_TAG_GDB_INDEX_OTHER:
+ flags = SEARCH_MODULE_DOMAIN | SEARCH_TYPE_DOMAIN;
+ break;
+ case DW_TAG_GDB_INDEX_TYPE:
+ flags = SEARCH_STRUCT_DOMAIN | SEARCH_TYPE_DOMAIN;
+ break;
}
return (flags & search) != 0;
diff --git a/gdb/dwarf2/types.h b/gdb/dwarf2/types.h
index 8cb689d..3d33b42 100644
--- a/gdb/dwarf2/types.h
+++ b/gdb/dwarf2/types.h
@@ -1,6 +1,6 @@
/* Common internal types for the DWARF reader
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/dwarf2/comp-unit-head.c b/gdb/dwarf2/unit-head.c
index 1413971..0c7614f 100644
--- a/gdb/dwarf2/comp-unit-head.c
+++ b/gdb/dwarf2/unit-head.c
@@ -1,6 +1,6 @@
/* DWARF 2 debugging format support for GDB.
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
Inc. with support from Florida State University (under contract
@@ -24,119 +24,117 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "dwarf2/comp-unit-head.h"
+#include "dwarf2/unit-head.h"
#include "dwarf2/leb.h"
-#include "dwarf2/read.h"
#include "dwarf2/section.h"
#include "dwarf2/stringify.h"
#include "dwarf2/error.h"
-/* See comp-unit-head.h. */
+/* See unit-head.h. */
const gdb_byte *
-read_comp_unit_head (struct comp_unit_head *cu_header,
- const gdb_byte *info_ptr,
- struct dwarf2_section_info *section,
- rcuh_kind section_kind)
+read_unit_head (struct unit_head *header, const gdb_byte *info_ptr,
+ struct dwarf2_section_info *section, ruh_kind section_kind)
{
int signed_addr;
unsigned int bytes_read;
const char *filename = section->get_file_name ();
bfd *abfd = section->get_bfd_owner ();
- cu_header->set_length (read_initial_length (abfd, info_ptr, &bytes_read));
- cu_header->initial_length_size = bytes_read;
- cu_header->offset_size = (bytes_read == 4) ? 4 : 8;
+ header->set_length (read_initial_length (abfd, info_ptr, &bytes_read));
+ header->initial_length_size = bytes_read;
+ header->offset_size = (bytes_read == 4) ? 4 : 8;
info_ptr += bytes_read;
unsigned version = read_2_bytes (abfd, info_ptr);
if (version < 2 || version > 5)
error (_(DWARF_ERROR_PREFIX
- "wrong version in compilation unit header "
+ "wrong version in unit header "
"(is %d, should be 2, 3, 4 or 5) [in module %s]"),
version, filename);
- cu_header->version = version;
+ header->version = version;
info_ptr += 2;
- if (cu_header->version < 5)
+ if (header->version < 5)
switch (section_kind)
{
- case rcuh_kind::COMPILE:
- cu_header->unit_type = DW_UT_compile;
+ case ruh_kind::COMPILE:
+ header->unit_type = DW_UT_compile;
break;
- case rcuh_kind::TYPE:
- cu_header->unit_type = DW_UT_type;
+ case ruh_kind::TYPE:
+ header->unit_type = DW_UT_type;
break;
default:
- internal_error (_("read_comp_unit_head: invalid section_kind"));
+ internal_error (_("read_unit_head: invalid section_kind"));
}
else
{
- cu_header->unit_type = static_cast<enum dwarf_unit_type>
- (read_1_byte (abfd, info_ptr));
+ header->unit_type
+ = static_cast<enum dwarf_unit_type> (read_1_byte (abfd, info_ptr));
info_ptr += 1;
- switch (cu_header->unit_type)
+ switch (header->unit_type)
{
case DW_UT_compile:
case DW_UT_partial:
case DW_UT_skeleton:
case DW_UT_split_compile:
- if (section_kind != rcuh_kind::COMPILE)
+ if (section_kind != ruh_kind::COMPILE)
error (_(DWARF_ERROR_PREFIX
- "wrong unit_type in compilation unit header "
+ "wrong unit_type in unit header "
"(is %s, should be %s) [in module %s]"),
- dwarf_unit_type_name (cu_header->unit_type),
+ dwarf_unit_type_name (header->unit_type),
dwarf_unit_type_name (DW_UT_type), filename);
break;
case DW_UT_type:
case DW_UT_split_type:
- section_kind = rcuh_kind::TYPE;
+ section_kind = ruh_kind::TYPE;
break;
default:
error (_(DWARF_ERROR_PREFIX
- "wrong unit_type in compilation unit header "
+ "wrong unit_type in unit header "
"(is %#04x, should be one of: %s, %s, %s, %s or %s) "
"[in module %s]"),
- cu_header->unit_type, dwarf_unit_type_name (DW_UT_compile),
+ header->unit_type, dwarf_unit_type_name (DW_UT_compile),
dwarf_unit_type_name (DW_UT_skeleton),
dwarf_unit_type_name (DW_UT_split_compile),
dwarf_unit_type_name (DW_UT_type),
dwarf_unit_type_name (DW_UT_split_type), filename);
}
- cu_header->addr_size = read_1_byte (abfd, info_ptr);
+ header->addr_size = read_1_byte (abfd, info_ptr);
info_ptr += 1;
}
- cu_header->abbrev_sect_off
- = (sect_offset) cu_header->read_offset (abfd, info_ptr, &bytes_read);
+ header->abbrev_sect_off
+ = (sect_offset) header->read_offset (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
- if (cu_header->version < 5)
+ if (header->version < 5)
{
- cu_header->addr_size = read_1_byte (abfd, info_ptr);
+ header->addr_size = read_1_byte (abfd, info_ptr);
info_ptr += 1;
}
signed_addr = bfd_get_sign_extend_vma (abfd);
if (signed_addr < 0)
- internal_error (_("read_comp_unit_head: dwarf from non elf file"));
- cu_header->signed_addr_p = signed_addr;
+ internal_error (_("read_unit_head: dwarf from non elf file"));
+ header->signed_addr_p = signed_addr;
- bool header_has_signature = section_kind == rcuh_kind::TYPE
- || cu_header->unit_type == DW_UT_skeleton
- || cu_header->unit_type == DW_UT_split_compile;
+ bool header_has_signature =
+ (section_kind == ruh_kind::TYPE
+ || header->unit_type == DW_UT_skeleton
+ || header->unit_type == DW_UT_split_compile);
if (header_has_signature)
{
- cu_header->signature = read_8_bytes (abfd, info_ptr);
+ header->signature = read_8_bytes (abfd, info_ptr);
info_ptr += 8;
}
- if (section_kind == rcuh_kind::TYPE)
+ if (section_kind == ruh_kind::TYPE)
{
LONGEST type_offset;
- type_offset = cu_header->read_offset (abfd, info_ptr, &bytes_read);
+ type_offset = header->read_offset (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
- cu_header->type_cu_offset_in_tu = (cu_offset) type_offset;
- if (to_underlying (cu_header->type_cu_offset_in_tu) != type_offset)
+ header->type_offset_in_tu = (cu_offset) type_offset;
+ if (to_underlying (header->type_offset_in_tu) != type_offset)
error (_(DWARF_ERROR_PREFIX
- "Too big type_offset in compilation unit "
+ "Too big type_offset in unit "
"header (is %s) [in module %s]"),
plongest (type_offset), filename);
}
@@ -144,64 +142,56 @@ read_comp_unit_head (struct comp_unit_head *cu_header,
return info_ptr;
}
-/* Subroutine of read_and_check_comp_unit_head and
- read_and_check_type_unit_head to simplify them.
+/* Subroutine of read_and_check_unit_head to to simplify it.
Perform various error checking on the header. */
static void
-error_check_comp_unit_head (dwarf2_per_objfile *per_objfile,
- struct comp_unit_head *header,
- struct dwarf2_section_info *section,
- struct dwarf2_section_info *abbrev_section)
+error_check_unit_head (unit_head *header, dwarf2_section_info *section,
+ dwarf2_section_info *abbrev_section)
{
const char *filename = section->get_file_name ();
- if (to_underlying (header->abbrev_sect_off)
- >= abbrev_section->get_size (per_objfile->objfile))
+ if (to_underlying (header->abbrev_sect_off) >= abbrev_section->size)
error (_(DWARF_ERROR_PREFIX
- "bad offset (%s) in compilation unit header "
+ "bad offset (%s) in unit header "
"(offset %s + 6) [in module %s]"),
sect_offset_str (header->abbrev_sect_off),
- sect_offset_str (header->sect_off),
- filename);
+ sect_offset_str (header->sect_off), filename);
/* Cast to ULONGEST to use 64-bit arithmetic when possible to
avoid potential 32-bit overflow. */
if (((ULONGEST) header->sect_off + header->get_length_with_initial ())
> section->size)
error (_(DWARF_ERROR_PREFIX
- "bad length (0x%x) in compilation unit header "
+ "bad length (0x%x) in unit header "
"(offset %s + 0) [in module %s]"),
header->get_length_without_initial (), sect_offset_str (header->sect_off),
filename);
}
-/* See comp-unit-head.h. */
+/* See unit-head.h. */
const gdb_byte *
-read_and_check_comp_unit_head (dwarf2_per_objfile *per_objfile,
- struct comp_unit_head *header,
- struct dwarf2_section_info *section,
- struct dwarf2_section_info *abbrev_section,
- const gdb_byte *info_ptr,
- rcuh_kind section_kind)
+read_and_check_unit_head (unit_head *header, dwarf2_section_info *section,
+ dwarf2_section_info *abbrev_section,
+ const gdb_byte *info_ptr, ruh_kind section_kind)
{
- const gdb_byte *beg_of_comp_unit = info_ptr;
+ const gdb_byte *beg_of_unit = info_ptr;
- header->sect_off = (sect_offset) (beg_of_comp_unit - section->buffer);
+ header->sect_off = (sect_offset) (beg_of_unit - section->buffer);
- info_ptr = read_comp_unit_head (header, info_ptr, section, section_kind);
+ info_ptr = read_unit_head (header, info_ptr, section, section_kind);
- header->first_die_cu_offset = (cu_offset) (info_ptr - beg_of_comp_unit);
+ header->first_die_offset_in_unit = (cu_offset) (info_ptr - beg_of_unit);
- error_check_comp_unit_head (per_objfile, header, section, abbrev_section);
+ error_check_unit_head (header, section, abbrev_section);
return info_ptr;
}
unrelocated_addr
-comp_unit_head::read_address (bfd *abfd, const gdb_byte *buf,
- unsigned int *bytes_read) const
+unit_head::read_address (bfd *abfd, const gdb_byte *buf,
+ unsigned int *bytes_read) const
{
ULONGEST retval = 0;
diff --git a/gdb/dwarf2/comp-unit-head.h b/gdb/dwarf2/unit-head.h
index d161783..6272888 100644
--- a/gdb/dwarf2/comp-unit-head.h
+++ b/gdb/dwarf2/unit-head.h
@@ -1,6 +1,6 @@
/* Low-level DWARF 2 reading code
- Copyright (C) 1994-2024 Free Software Foundation, Inc.
+ Copyright (C) 1994-2025 Free Software Foundation, Inc.
Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
Inc. with support from Florida State University (under contract
@@ -24,18 +24,19 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#ifndef GDB_DWARF2_COMP_UNIT_HEAD_H
-#define GDB_DWARF2_COMP_UNIT_HEAD_H
+#ifndef GDB_DWARF2_UNIT_HEAD_H
+#define GDB_DWARF2_UNIT_HEAD_H
#include "dwarf2.h"
#include "dwarf2/leb.h"
#include "dwarf2/types.h"
struct dwarf2_per_objfile;
+struct dwarf2_section_info;
-/* The data in a compilation unit header, after target2host
- translation, looks like this. */
-struct comp_unit_head
+/* The data in a unit header, after target2host translation, looks like
+ this. */
+struct unit_head
{
private:
unsigned int m_length = 0;
@@ -53,16 +54,16 @@ public:
enum dwarf_unit_type unit_type {};
- /* Offset to first die in this cu from the start of the cu.
- This will be the first byte following the compilation unit header. */
- cu_offset first_die_cu_offset {};
+ /* Offset to first die in this unit from the start of the unit.
+ This will be the first byte following the unit header. */
+ cu_offset first_die_offset_in_unit {};
- /* Offset to the first byte of this compilation unit header in the
- .debug_info section, for resolving relative reference dies. */
+ /* Offset to the first byte of this unit header in the containing section,
+ for resolving relative reference dies. */
sect_offset sect_off {};
/* For types, offset in the type's DIE of the type defined by this TU. */
- cu_offset type_cu_offset_in_tu {};
+ cu_offset type_offset_in_tu {};
/* 64-bit signature of this unit. For type units, it denotes the signature of
the type (DW_UT_type in DWARF 4, additionally DW_UT_split_type in DWARF 5).
@@ -75,22 +76,22 @@ public:
m_length = length;
}
- /* Return the total length of the CU described by this header, including the
+ /* Return the total length of the unit described by this header, including the
initial length field. */
unsigned int get_length_with_initial () const
{
return m_length + initial_length_size;
}
- /* Return the total length of the CU described by this header, excluding the
+ /* Return the total length of the unit described by this header, excluding the
initial length field. */
unsigned int get_length_without_initial () const
{
return m_length;
}
- /* Return TRUE if OFF is within this CU. */
- bool offset_in_cu_p (sect_offset off) const
+ /* Return TRUE if OFF is within this unit. */
+ bool offset_in_unit_p (sect_offset off) const
{
sect_offset bottom = sect_off;
sect_offset top = sect_off + get_length_with_initial ();
@@ -98,7 +99,7 @@ public:
}
/* Read an offset from the data stream. The size of the offset is
- given by cu_header->offset_size. */
+ given by unit_head::offset_size. */
LONGEST read_offset (bfd *abfd, const gdb_byte *buf,
unsigned int *bytes_read) const
{
@@ -112,28 +113,24 @@ public:
unsigned int *bytes_read) const;
};
-/* Expected enum dwarf_unit_type for read_comp_unit_head. */
-enum class rcuh_kind { COMPILE, TYPE };
+/* Expected enum dwarf_unit_type for read_unit_head. */
+enum class ruh_kind { COMPILE, TYPE };
-/* Read in the comp unit header information from the debug_info at info_ptr.
- Use rcuh_kind::COMPILE as the default type if not known by the caller.
- NOTE: This leaves members offset, first_die_offset to be filled in
+/* Read in the unit header information from the debug_info at info_ptr.
+ Use ruh_kind::COMPILE as the default type if not known by the caller.
+ NOTE: This leaves members sect_off, first_die_unit_offset to be filled in
by the caller. */
-extern const gdb_byte *read_comp_unit_head
- (struct comp_unit_head *cu_header,
- const gdb_byte *info_ptr,
- struct dwarf2_section_info *section,
- rcuh_kind section_kind);
+extern const gdb_byte *read_unit_head (unit_head *header,
+ const gdb_byte *info_ptr,
+ dwarf2_section_info *section,
+ ruh_kind section_kind);
-/* Read in a CU/TU header and perform some basic error checking.
+/* Read in a unit header and perform some basic error checking.
The contents of the header are stored in HEADER.
The result is a pointer to the start of the first DIE. */
-extern const gdb_byte *read_and_check_comp_unit_head
- (dwarf2_per_objfile *per_objfile,
- struct comp_unit_head *header,
- struct dwarf2_section_info *section,
- struct dwarf2_section_info *abbrev_section,
- const gdb_byte *info_ptr,
- rcuh_kind section_kind);
-
-#endif /* GDB_DWARF2_COMP_UNIT_HEAD_H */
+extern const gdb_byte *read_and_check_unit_head
+ (unit_head *header, dwarf2_section_info *section,
+ dwarf2_section_info *abbrev_section, const gdb_byte *info_ptr,
+ ruh_kind section_kind);
+
+#endif /* GDB_DWARF2_UNIT_HEAD_H */
diff --git a/gdb/elf-none-tdep.c b/gdb/elf-none-tdep.c
index d46c41c..74adac5 100644
--- a/gdb/elf-none-tdep.c
+++ b/gdb/elf-none-tdep.c
@@ -1,7 +1,7 @@
/* Common code for targets with the none ABI (bare-metal), but where the
BFD library is build with ELF support.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -100,12 +100,12 @@ elf_none_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd,
gcore_elf_build_thread_register_notes (gdbarch, signalled_thr,
stop_signal, obfd, &note_data,
note_size);
- for (thread_info *thr : current_inferior ()->non_exited_threads ())
+ for (thread_info &thr : current_inferior ()->non_exited_threads ())
{
- if (thr == signalled_thr)
+ if (&thr == signalled_thr)
continue;
- gcore_elf_build_thread_register_notes (gdbarch, thr, stop_signal, obfd,
+ gcore_elf_build_thread_register_notes (gdbarch, &thr, stop_signal, obfd,
&note_data, note_size);
}
diff --git a/gdb/elf-none-tdep.h b/gdb/elf-none-tdep.h
index 1881e4b..7739d3f 100644
--- a/gdb/elf-none-tdep.h
+++ b/gdb/elf-none-tdep.h
@@ -1,6 +1,6 @@
/* Architecture independent code for ABI 'none' (bare-metal).
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 3756fa3..152576d 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1,6 +1,6 @@
/* Read ELF (Executable and Linking Format) object files for GDB.
- Copyright (C) 1991-2024 Free Software Foundation, Inc.
+ Copyright (C) 1991-2025 Free Software Foundation, Inc.
Written by Fred Fish at Cygnus Support.
@@ -776,9 +776,8 @@ elf_gnu_ifunc_resolve_by_cache (const char *name, CORE_ADDR *addr_p)
To search other namespaces, we would need to provide context, e.g. in
form of an objfile in that namespace. */
- gdbarch_iterate_over_objfiles_in_search_order
- (current_inferior ()->arch (),
- [name, &addr_p, &found] (struct objfile *objfile)
+ current_program_space->iterate_over_objfiles_in_search_order
+ ([name, &addr_p, &found] (struct objfile *objfile)
{
htab_t htab;
elf_gnu_ifunc_cache *entry_p;
@@ -830,9 +829,8 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
To search other namespaces, we would need to provide context, e.g. in
form of an objfile in that namespace. */
- gdbarch_iterate_over_objfiles_in_search_order
- (current_inferior ()->arch (),
- [name, name_got_plt, &addr_p, &found] (struct objfile *objfile)
+ current_program_space->iterate_over_objfiles_in_search_order
+ ([name, name_got_plt, &addr_p, &found] (struct objfile *objfile)
{
bfd *obfd = objfile->obfd.get ();
struct gdbarch *gdbarch = objfile->arch ();
@@ -898,7 +896,7 @@ elf_gnu_ifunc_resolve_name (const char *name, CORE_ADDR *addr_p)
return false;
}
-/* Call STT_GNU_IFUNC - a function returning addresss of a real function to
+/* Call STT_GNU_IFUNC - a function returning address of a real function to
call. PC is theSTT_GNU_IFUNC resolving function entry. The value returned
is the entry point of the resolved STT_GNU_IFUNC target function to call.
*/
@@ -1050,7 +1048,7 @@ elf_gnu_ifunc_resolver_return_stop (code_breakpoint *b)
b->type = bp_breakpoint;
update_breakpoint_locations (b, current_program_space,
- find_function_start_sal (resolved_pc, NULL, true),
+ find_function_start_sal (resolved_pc, true),
{});
}
@@ -1513,9 +1511,7 @@ static const struct gnu_ifunc_fns elf_gnu_ifunc_fns =
elf_gnu_ifunc_resolver_return_stop
};
-void _initialize_elfread ();
-void
-_initialize_elfread ()
+INIT_GDB_FILE (elfread)
{
add_symtab_fns (bfd_target_elf_flavour, &elf_sym_fns);
diff --git a/gdb/eval.c b/gdb/eval.c
index 63961cc..07fa0af 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1,6 +1,6 @@
/* Evaluate expressions for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -38,7 +38,6 @@
#include "gdbsupport/gdb_obstack.h"
#include "objfiles.h"
#include "typeprint.h"
-#include <ctype.h>
#include "expop.h"
#include "c-exp.h"
#include "inferior.h"
@@ -492,7 +491,7 @@ fake_method::fake_method (type_instance_flags flags,
fake_method::~fake_method ()
{
- xfree (m_type.fields ());
+ xfree (m_type.fields ().data ());
}
namespace expr
@@ -994,9 +993,10 @@ add_struct_fields (struct type *type, completion_list &output,
output.emplace_back (concat (prefix, type->field (i).name (),
nullptr));
}
- else if (type->field (i).type ()->code () == TYPE_CODE_UNION)
+ else if (type->field (i).type ()->code () == TYPE_CODE_UNION
+ || type->field (i).type ()->code () == TYPE_CODE_STRUCT)
{
- /* Recurse into anonymous unions. */
+ /* Recurse into anonymous unions and structures. */
add_struct_fields (type->field (i).type (),
output, fieldname, namelen, prefix);
}
@@ -1180,8 +1180,8 @@ ternop_slice_operation::evaluate (struct type *expect_type,
struct value *upper
= std::get<2> (m_storage)->evaluate (nullptr, exp, noside);
- int lowbound = value_as_long (low);
- int upperbound = value_as_long (upper);
+ LONGEST lowbound = value_as_long (low);
+ LONGEST upperbound = value_as_long (upper);
return value_slice (array, lowbound, upperbound - lowbound + 1);
}
@@ -2284,14 +2284,18 @@ logical_and_operation::evaluate (struct type *expect_type,
}
else
{
+ type *type = language_bool_type (exp->language_defn,
+ exp->gdbarch);
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return value::zero (type, not_lval);
+
bool tem = value_logical_not (arg1);
if (!tem)
{
arg2 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
tem = value_logical_not (arg2);
}
- struct type *type = language_bool_type (exp->language_defn,
- exp->gdbarch);
+
return value_from_longest (type, !tem);
}
}
@@ -2313,6 +2317,11 @@ logical_or_operation::evaluate (struct type *expect_type,
}
else
{
+ type *type = language_bool_type (exp->language_defn,
+ exp->gdbarch);
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return value::zero (type, not_lval);
+
bool tem = value_logical_not (arg1);
if (tem)
{
@@ -2320,8 +2329,6 @@ logical_or_operation::evaluate (struct type *expect_type,
tem = value_logical_not (arg2);
}
- struct type *type = language_bool_type (exp->language_defn,
- exp->gdbarch);
return value_from_longest (type, !tem);
}
}
@@ -2557,27 +2564,26 @@ unop_extract_operation::evaluate (struct type *expect_type,
}
-
/* Helper for evaluate_subexp_for_address. */
static value *
-evaluate_subexp_for_address_base (struct expression *exp, enum noside noside,
- value *x)
+evaluate_subexp_for_address_base (enum noside noside, value *x)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
struct type *type = check_typedef (x->type ());
+ enum type_code typecode = type->code ();
if (TYPE_IS_REFERENCE (type))
return value::zero (lookup_pointer_type (type->target_type ()),
- not_lval);
- else if (x->lval () == lval_memory || value_must_coerce_to_target (x))
- return value::zero (lookup_pointer_type (x->type ()),
- not_lval);
+ not_lval);
+ else if (x->lval () == lval_memory || value_must_coerce_to_target (x)
+ || typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)
+ return value::zero (lookup_pointer_type (x->type ()), not_lval);
else
- error (_("Attempt to take address of "
- "value not located in memory."));
+ error (_("Attempt to take address of value not located in memory."));
}
+
return value_addr (x);
}
@@ -2597,7 +2603,7 @@ value *
operation::evaluate_for_address (struct expression *exp, enum noside noside)
{
value *val = evaluate (nullptr, exp, noside);
- return evaluate_subexp_for_address_base (exp, noside, val);
+ return evaluate_subexp_for_address_base (noside, val);
}
value *
@@ -2624,7 +2630,7 @@ unop_ind_base_operation::evaluate_for_address (struct expression *exp,
if (unop_user_defined_p (UNOP_IND, x))
{
x = value_x_unop (x, UNOP_IND, noside);
- return evaluate_subexp_for_address_base (exp, noside, x);
+ return evaluate_subexp_for_address_base (noside, x);
}
return coerce_array (x);
@@ -2678,11 +2684,11 @@ var_value_operation::evaluate_for_address (struct expression *exp,
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
struct type *type = lookup_pointer_type (var->type ());
- enum address_class sym_class = var->aclass ();
+ location_class loc_class = var->loc_class ();
- if (sym_class == LOC_CONST
- || sym_class == LOC_CONST_BYTES
- || sym_class == LOC_REGISTER)
+ if (loc_class == LOC_CONST
+ || loc_class == LOC_CONST_BYTES
+ || loc_class == LOC_REGISTER)
error (_("Attempt to take address of register or constant."));
return value::zero (type, not_lval);
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 1fe3784..3138e8c 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -1,6 +1,6 @@
/* Top level stuff for GDB, the GNU debugger.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
@@ -980,11 +980,6 @@ handle_fatal_signal (int sig)
#endif
#ifdef GDB_PRINT_INTERNAL_BACKTRACE
- const auto sig_write = [] (const char *msg) -> void
- {
- gdb_stderr->write_async_safe (msg, strlen (msg));
- };
-
if (bt_on_fatal_signal)
{
sig_write ("\n\n");
@@ -1027,7 +1022,13 @@ handle_fatal_signal (int sig)
}
sig_write ("\n\n");
- gdb_stderr->flush ();
+ if (gdb_stderr == nullptr || gdb_stderr->fd () == -1)
+ {
+ /* Writing to file descriptor instead of stream, no flush
+ required. */
+ }
+ else
+ gdb_stderr->flush ();
}
#endif
@@ -1179,6 +1180,9 @@ quit (void)
throw_forced_quit ("SIGTERM");
}
+ /* Pressing ^C cancels i-search. Tell readline that a ^C happened. */
+ rl_callback_sigcleanup ();
+
#ifdef __MSDOS__
/* No steenking SIGINT will ever be coming our way when the
program is resumed. Don't lie. */
@@ -1649,9 +1653,7 @@ show_debug_event_loop_command (struct ui_file *file, int from_tty,
gdb_printf (file, _("Event loop debugging is %s.\n"), value);
}
-void _initialize_event_top ();
-void
-_initialize_event_top ()
+INIT_GDB_FILE (event_top)
{
add_setshow_enum_cmd ("event-loop", class_maintenance,
debug_event_loop_enum,
diff --git a/gdb/event-top.h b/gdb/event-top.h
index 57f86f9..79e0590 100644
--- a/gdb/event-top.h
+++ b/gdb/event-top.h
@@ -1,6 +1,6 @@
/* Definitions used by event-top.c, for GDB, the GNU debugger.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index 741049a..35400f3 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -1,6 +1,6 @@
/* Exception (throw catch) mechanism, for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -25,6 +25,7 @@
#include "serial.h"
#include "ui.h"
#include <optional>
+#include "cli/cli-style.h"
static void
print_flush (void)
@@ -105,6 +106,7 @@ exception_print (struct ui_file *file, const struct gdb_exception &e)
if (e.reason < 0 && e.message != NULL)
{
print_flush ();
+ print_error_prefix (file);
print_exception (file, e);
}
}
@@ -118,6 +120,7 @@ exception_fprintf (struct ui_file *file, const struct gdb_exception &e,
va_list args;
print_flush ();
+ print_error_prefix (file);
/* Print the prefix. */
va_start (args, prefix);
diff --git a/gdb/exceptions.h b/gdb/exceptions.h
index bf7141d..4a06b6b 100644
--- a/gdb/exceptions.h
+++ b/gdb/exceptions.h
@@ -1,6 +1,6 @@
/* Exception (throw catch) mechanism, for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/exec.c b/gdb/exec.c
index a1fed77..a904f5c 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -1,6 +1,6 @@
/* Work with executable files, for GDB.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -42,9 +42,8 @@
#include "readline/tilde.h"
#include "gdbcore.h"
-#include <ctype.h>
#include <sys/stat.h>
-#include "solist.h"
+#include "solib.h"
#include <algorithm>
#include "gdbsupport/pathstuff.h"
#include "cli/cli-style.h"
@@ -218,28 +217,32 @@ validate_exec_file (int from_tty)
if (exec_file_mismatch_mode == exec_file_mismatch_off)
return;
+ /* If there's no current executable, then there's nothing to
+ validate against, so we're done. */
const char *current_exec_file = current_program_space->exec_filename ();
- struct inferior *inf = current_inferior ();
- /* Try to determine a filename from the process itself. */
- const char *pid_exec_file = target_pid_to_exec_file (inf->pid);
- bool build_id_mismatch = false;
-
- /* If we cannot validate the exec file, return. */
- if (current_exec_file == NULL || pid_exec_file == NULL)
+ if (current_exec_file == nullptr)
return;
- /* Try validating via build-id, if available. This is the most
- reliable check. */
+ /* Try to determine a filename from the process itself. If we
+ cannot get an executable from the process, then no validation is
+ possible. */
+ const char *pid_exec_file
+ = target_pid_to_exec_file (current_inferior ()->pid);
+ if (pid_exec_file == nullptr)
+ return;
- /* In case current_exec_file was changed, reopen_exec_file ensures
- an up to date build_id (will do nothing if the file timestamp
- did not change). If exec file changed, reopen_exec_file has
- allocated another file name, so get_exec_file again. */
+ /* In case current_exec_file was changed, reopen_exec_file ensures an up
+ to date build_id (will do nothing if the file timestamp did not
+ change). If exec file changed, reopen_exec_file has allocated another
+ file name, so get_exec_file again. */
reopen_exec_file ();
current_exec_file = current_program_space->exec_filename ();
+ /* Try validating via build-id, if available. This is the most reliable
+ check. */
const bfd_build_id *exec_file_build_id
= build_id_bfd_get (current_program_space->exec_bfd ());
+ bool build_id_mismatch = false;
if (exec_file_build_id != nullptr)
{
/* Prepend the target prefix, to force gdb_bfd_open to open the
@@ -334,6 +337,14 @@ exec_file_locate_attach (int pid, int defer_bp_reset, int from_tty)
gdb::unique_xmalloc_ptr<char> exec_file_host
= exec_file_find (exec_file_target, NULL);
+ if (exec_file_host == nullptr)
+ {
+ warning (_("No executable has been specified, and target executable "
+ "%ps could not be found. Try using the \"%ps\" command."),
+ styled_string (file_name_style.style (), exec_file_target),
+ styled_string (command_style.style (), "file"));
+ return;
+ }
if (defer_bp_reset)
add_flags |= SYMFILE_DEFER_BP_RESET;
@@ -641,13 +652,13 @@ program_space::add_target_sections (struct objfile *objfile)
gdb_assert (objfile != nullptr);
/* Compute the number of sections to add. */
- for (obj_section *osect : objfile->sections ())
+ for (obj_section &osect : objfile->sections ())
{
- if (bfd_section_size (osect->the_bfd_section) == 0)
+ if (bfd_section_size (osect.the_bfd_section) == 0)
continue;
- m_target_sections.emplace_back (osect->addr (), osect->endaddr (),
- osect->the_bfd_section, objfile);
+ m_target_sections.emplace_back (osect.addr (), osect.endaddr (),
+ osect.the_bfd_section, objfile);
}
}
@@ -1003,7 +1014,7 @@ set_section_command (const char *args, int from_tty)
error (_("Must specify section name and its virtual address"));
/* Parse out section name. */
- for (secname = args; !isspace (*args); args++);
+ for (secname = args; !c_isspace (*args); args++);
unsigned seclen = args - secname;
/* Parse out new virtual address. */
@@ -1065,9 +1076,7 @@ exec_target::find_memory_regions (find_memory_region_ftype func, void *data)
return objfile_find_memory_regions (this, func, data);
}
-void _initialize_exec ();
-void
-_initialize_exec ()
+INIT_GDB_FILE (exec)
{
struct cmd_list_element *c;
diff --git a/gdb/exec.h b/gdb/exec.h
index 77482af..1503c36 100644
--- a/gdb/exec.h
+++ b/gdb/exec.h
@@ -1,6 +1,6 @@
/* Work with executable files, for GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/expop.h b/gdb/expop.h
index 580a71e..e755df5 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -1,6 +1,6 @@
/* Definitions for expressions in GDB
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -308,6 +308,25 @@ dump_for_expression (struct ui_file *stream, int depth,
op->dump (stream, depth);
}
+/* If evaluating with noside == EVAL_AVOID_SIDE_EFFECTS, we are essentially
+ interested in the type of ARG. However, if ARG is of reference type,
+ this would give us a memory value that would cause a failure if GDB
+ attempts to access the contents. Convert to the target type to avoid
+ such problems. */
+
+static value *
+convert_reference_to_target_type (value *arg, enum noside noside)
+{
+ struct type *type = check_typedef (arg->type ());
+ if (noside == EVAL_AVOID_SIDE_EFFECTS && TYPE_IS_REFERENCE (type))
+ {
+ struct type *target_type = check_typedef (type->target_type ());
+ return value::zero (target_type, not_lval);
+ }
+
+ return arg;
+}
+
extern void dump_for_expression (struct ui_file *stream, int depth,
enum exp_opcode op);
extern void dump_for_expression (struct ui_file *stream, int depth,
@@ -476,11 +495,11 @@ check_constant (const gdb_mpz &cst)
static inline bool
check_constant (struct symbol *sym)
{
- enum address_class sc = sym->aclass ();
- return (sc == LOC_BLOCK
- || sc == LOC_CONST
- || sc == LOC_CONST_BYTES
- || sc == LOC_LABEL);
+ location_class lc = sym->loc_class ();
+ return (lc == LOC_BLOCK
+ || lc == LOC_CONST
+ || lc == LOC_CONST_BYTES
+ || lc == LOC_LABEL);
}
static inline bool
@@ -953,7 +972,7 @@ public:
struct value *val
= std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
- if (value_logical_not (val))
+ if (noside != EVAL_AVOID_SIDE_EFFECTS && value_logical_not (val))
return std::get<2> (m_storage)->evaluate (nullptr, exp, noside);
return std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
}
@@ -1187,6 +1206,10 @@ public:
= std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
value *rhs
= std::get<1> (m_storage)->evaluate_with_coercion (exp, noside);
+
+ lhs = convert_reference_to_target_type (lhs, noside);
+ rhs = convert_reference_to_target_type (rhs, noside);
+
return eval_op_add (expect_type, exp, noside, lhs, rhs);
}
@@ -1223,6 +1246,10 @@ public:
= std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
value *rhs
= std::get<1> (m_storage)->evaluate_with_coercion (exp, noside);
+
+ lhs = convert_reference_to_target_type (lhs, noside);
+ rhs = convert_reference_to_target_type (rhs, noside);
+
return eval_op_sub (expect_type, exp, noside, lhs, rhs);
}
@@ -1265,6 +1292,10 @@ public:
= std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
value *rhs
= std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
+
+ lhs = convert_reference_to_target_type (lhs, noside);
+ rhs = convert_reference_to_target_type (rhs, noside);
+
return FUNC (expect_type, exp, noside, OP, lhs, rhs);
}
@@ -1340,6 +1371,10 @@ public:
value *rhs
= std::get<1> (this->m_storage)->evaluate (lhs->type (), exp,
noside);
+
+ lhs = convert_reference_to_target_type (lhs, noside);
+ rhs = convert_reference_to_target_type (rhs, noside);
+
return FUNC (expect_type, exp, noside, OP, lhs, rhs);
}
};
@@ -1434,6 +1469,7 @@ public:
enum noside noside) override
{
value *val = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
+ val = convert_reference_to_target_type (val, noside);
return FUNC (expect_type, exp, noside, OP, val);
}
diff --git a/gdb/expprint.c b/gdb/expprint.c
index 2d8bccd..a32b7ac 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -1,6 +1,6 @@
/* Print in infix form a struct expression.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -33,7 +33,6 @@
#include "expop.h"
#include "ada-exp.h"
-#include <ctype.h>
/* Meant to be used in debug sessions, so don't export it in a header file. */
extern void ATTRIBUTE_USED debug_exp (struct expression *exp);
diff --git a/gdb/expression.h b/gdb/expression.h
index bc0bdb7..21e267c 100644
--- a/gdb/expression.h
+++ b/gdb/expression.h
@@ -1,6 +1,6 @@
/* Definitions for expressions stored in reversed prefix form, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/extension-priv.h b/gdb/extension-priv.h
index a38f104..cde64a2 100644
--- a/gdb/extension-priv.h
+++ b/gdb/extension-priv.h
@@ -1,7 +1,7 @@
/* Private implementation details of interface between gdb and its
extension languages.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -262,12 +262,13 @@ struct extension_language_ops
const char *method_name,
std::vector<xmethod_worker_up> *dm_vec);
- /* Colorize a source file. NAME is the source file's name, and
- CONTENTS is the contents of the file. This should either return
- colorized (using ANSI terminal escapes) version of the contents,
+ /* Colorize a source file. NAME is the source file's name, CONTENTS is the
+ contents of the file, and LANG is the language. This should either
+ return colorized (using ANSI terminal escapes) version of the contents,
or an empty option. */
std::optional<std::string> (*colorize) (const std::string &name,
- const std::string &contents);
+ const std::string &contents,
+ enum language lang);
/* Colorize a single line of disassembler output, CONTENT. This should
either return colorized (using ANSI terminal escapes) version of the
diff --git a/gdb/extension.c b/gdb/extension.c
index b78ea4f..1e967c5 100644
--- a/gdb/extension.c
+++ b/gdb/extension.c
@@ -1,6 +1,6 @@
/* Interface between gdb and its extension languages.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -34,6 +34,8 @@
#include <array>
#include "inferior.h"
#include "gdbsupport/scoped_signal_handler.h"
+#include "gdbsupport/scoped_ignore_signal.h"
+#include "run-on-main-thread.h"
static script_sourcer_func source_gdb_script;
static objfile_script_sourcer_func source_gdb_objfile_script;
@@ -638,7 +640,7 @@ breakpoint_ext_lang_cond_says_stop (struct breakpoint *b)
This requires cooperation with the extension languages so the support
is defined here. */
-#if CXX_STD_THREAD
+#if CXX_STD_THREAD && defined __MINGW32__
#include <mutex>
@@ -648,10 +650,19 @@ breakpoint_ext_lang_cond_says_stop (struct breakpoint *b)
available, DAP will not start.
This lock is held for accesses to quit_flag, active_ext_lang, and
- cooperative_sigint_handling_disabled. */
+ cooperative_sigint_handling_disabled.
+
+ This lock is only required for targets that don't support kill(), and,
+ it is assumed, handle SIGINT not as a signal, but as a new thread. For
+ these targets this mutex prevents multiple threads adjusting the above
+ state at the same time.
+
+ For targets that support kill() gdb.interrupt is implemented by just
+ sending SIGINT to the process, which is then handled in the "normal"
+ way. */
static std::recursive_mutex ext_lang_mutex;
-#endif /* CXX_STD_THREAD */
+#endif /* CXX_STD_THREAD && defined (__MINGW32__)*/
/* This flag tracks quit requests when we haven't called out to an
extension language. it also holds quit requests when we transition to
@@ -700,6 +711,44 @@ void (*hook_set_active_ext_lang) () = nullptr;
}
#endif
+namespace gdb
+{
+/* Wrapper that acquires the global EXT_LANG_MUTEX, but only for hosts
+ that might call quit related functions from a separate thread.
+ Specifically, this is hosts that don't support Unix like signals
+ (currently only Mingw).
+
+ For hosts with signal support, we don't try to use a mutex as a signal
+ might interrupt the lock acquisition, in which case deadlock will
+ occur. However, for these hosts, all the quit related functions are
+ called on the main thread (there's an assert for this), so the lack of
+ locking shouldn't be an issue.
+
+ For Mingw, without signals, the implementation of the Python
+ gdb.interrupt function can call set_quit_flag() from a second thread,
+ and additionally, the emulation of SIGINT involves the creation of a
+ temporary thread which calls the sigint handler. So for Mingw, we do
+ need the mutex, but that's OK, as no signal can interrupt the lock
+ acquisition. */
+struct ext_lang_guard
+{
+ ext_lang_guard ()
+ {
+#if CXX_STD_THREAD && !defined __MINGW32__
+ gdb_assert (is_main_thread ());
+#endif /* CXX_STD_THREAD && ! defined __MINGW32__ */
+ }
+
+ ~ext_lang_guard () { /* Nothing. */ }
+
+private:
+#if CXX_STD_THREAD && defined __MINGW32__
+ std::lock_guard<typeof (ext_lang_mutex)> m_guard { ext_lang_mutex };
+#endif
+};
+
+}
+
/* True if cooperative SIGINT handling is disabled. This is needed so
that calls to set_active_ext_lang do not re-enable cooperative
handling, which if enabled would make set_quit_flag store the
@@ -708,9 +757,7 @@ static bool cooperative_sigint_handling_disabled = false;
scoped_disable_cooperative_sigint_handling::scoped_disable_cooperative_sigint_handling ()
{
-#if CXX_STD_THREAD
- std::lock_guard guard (ext_lang_mutex);
-#endif /* CXX_STD_THREAD */
+ gdb::ext_lang_guard guard;
/* Force the active extension language to the GDB scripting
language. This ensures that a previously saved SIGINT is moved
@@ -729,9 +776,7 @@ scoped_disable_cooperative_sigint_handling::scoped_disable_cooperative_sigint_ha
scoped_disable_cooperative_sigint_handling::~scoped_disable_cooperative_sigint_handling ()
{
-#if CXX_STD_THREAD
- std::lock_guard guard (ext_lang_mutex);
-#endif /* CXX_STD_THREAD */
+ gdb::ext_lang_guard guard;
cooperative_sigint_handling_disabled = m_prev_cooperative_sigint_handling_disabled;
restore_active_ext_lang (m_prev_active_ext_lang_state);
@@ -771,9 +816,7 @@ scoped_disable_cooperative_sigint_handling::~scoped_disable_cooperative_sigint_h
struct active_ext_lang_state *
set_active_ext_lang (const struct extension_language_defn *now_active)
{
-#if CXX_STD_THREAD
- std::lock_guard guard (ext_lang_mutex);
-#endif /* CXX_STD_THREAD */
+ gdb::ext_lang_guard guard;
#if GDB_SELF_TEST
if (selftests::hook_set_active_ext_lang)
@@ -827,9 +870,7 @@ set_active_ext_lang (const struct extension_language_defn *now_active)
void
restore_active_ext_lang (struct active_ext_lang_state *previous)
{
-#if CXX_STD_THREAD
- std::lock_guard guard (ext_lang_mutex);
-#endif /* CXX_STD_THREAD */
+ gdb::ext_lang_guard guard;
if (cooperative_sigint_handling_disabled)
{
@@ -861,9 +902,7 @@ restore_active_ext_lang (struct active_ext_lang_state *previous)
void
set_quit_flag ()
{
-#if CXX_STD_THREAD
- std::lock_guard guard (ext_lang_mutex);
-#endif /* CXX_STD_THREAD */
+ gdb::ext_lang_guard guard;
if (active_ext_lang->ops != NULL
&& active_ext_lang->ops->set_quit_flag != NULL)
@@ -886,9 +925,7 @@ set_quit_flag ()
bool
check_quit_flag ()
{
-#if CXX_STD_THREAD
- std::lock_guard guard (ext_lang_mutex);
-#endif /* CXX_STD_THREAD */
+ gdb::ext_lang_guard guard;
bool result = false;
@@ -974,7 +1011,8 @@ xmethod_worker::get_result_type (value *object, gdb::array_view<value *> args)
/* See extension.h. */
std::optional<std::string>
-ext_lang_colorize (const std::string &filename, const std::string &contents)
+ext_lang_colorize (const std::string &filename, const std::string &contents,
+ enum language lang)
{
std::optional<std::string> result;
@@ -983,7 +1021,7 @@ ext_lang_colorize (const std::string &filename, const std::string &contents)
if (extlang->ops == nullptr
|| extlang->ops->colorize == nullptr)
continue;
- result = extlang->ops->colorize (filename, contents);
+ result = extlang->ops->colorize (filename, contents, lang);
if (result.has_value ())
return result;
}
@@ -1101,9 +1139,7 @@ ext_lang_before_prompt (const char *current_gdb_prompt)
}
}
-void _initialize_extension ();
-void
-_initialize_extension ()
+INIT_GDB_FILE (extension)
{
gdb::observers::before_prompt.attach (ext_lang_before_prompt, "extension");
}
diff --git a/gdb/extension.h b/gdb/extension.h
index 957642a..c607df8 100644
--- a/gdb/extension.h
+++ b/gdb/extension.h
@@ -1,6 +1,6 @@
/* Interface between gdb and its extension languages.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -325,12 +325,14 @@ extern void get_matching_xmethod_workers
std::vector<xmethod_worker_up> *workers);
/* Try to colorize some source code. FILENAME is the name of the file
- holding the code. CONTENTS is the source code itself. This will
- either a colorized (using ANSI terminal escapes) version of the
- source code, or an empty value if colorizing could not be done. */
+ holding the code. CONTENTS is the source code itself. LANG is the
+ language of the CONTENTS. This will either a colorized (using ANSI
+ terminal escapes) version of the source code, or an empty value if
+ colorizing could not be done. */
extern std::optional<std::string> ext_lang_colorize
- (const std::string &filename, const std::string &contents);
+ (const std::string &filename, const std::string &contents,
+ enum language lang);
/* Try to colorize a single line of disassembler output, CONTENT for
GDBARCH. This will return either a colorized (using ANSI terminal
diff --git a/gdb/extract-store-integer.c b/gdb/extract-store-integer.c
index 8987cf5..d73040b 100644
--- a/gdb/extract-store-integer.c
+++ b/gdb/extract-store-integer.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1986-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -337,9 +337,7 @@ extract_integer_test ()
#endif
-void _initialize_extract_store_integer ();
-void
-_initialize_extract_store_integer ()
+INIT_GDB_FILE (extract_store_integer)
{
#if GDB_SELF_TEST
selftests::register_test ("copy_integer_to_size",
diff --git a/gdb/extract-store-integer.h b/gdb/extract-store-integer.h
index a51ef3d..2e91844 100644
--- a/gdb/extract-store-integer.h
+++ b/gdb/extract-store-integer.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1986-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/f-array-walker.h b/gdb/f-array-walker.h
index 27d7ae1..2cb3612 100644
--- a/gdb/f-array-walker.h
+++ b/gdb/f-array-walker.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2020-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/f-exp.h b/gdb/f-exp.h
index 47d469a..df0328b 100644
--- a/gdb/f-exp.h
+++ b/gdb/f-exp.h
@@ -1,6 +1,6 @@
/* Definitions for Fortran expressions
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 259f274..a8ee9a3 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -1,6 +1,6 @@
/* YACC parser for Fortran expressions, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
Contributed by Motorola. Adapted from the C parser by Farooq Butt
(fmbutt@engage.sps.mot.com).
@@ -48,7 +48,6 @@
#include "language.h"
#include "f-lang.h"
#include "block.h"
-#include <ctype.h>
#include <algorithm>
#include "type-stack.h"
#include "f-exp.h"
@@ -1061,8 +1060,8 @@ parse_number (struct parser_state *par_state,
while (len-- > 0)
{
c = *p++;
- if (isupper (c))
- c = tolower (c);
+ if (c_isupper (c))
+ c = c_tolower (c);
if (len == 0 && c == 'l')
long_p = 1;
else if (len == 0 && c == 'u')
@@ -1160,8 +1159,7 @@ push_kind_type (LONGEST val, struct type *type)
ival = static_cast <int> (val);
}
- type_stack->push (ival);
- type_stack->push (tp_kind);
+ type_stack->push (tp_kind, ival);
}
/* Helper function for convert_to_kind_type. */
@@ -1663,7 +1661,7 @@ yylex (void)
{
result = lookup_symbol (tmp.c_str (), pstate->expression_context_block,
domain, NULL);
- if (result.symbol && result.symbol->aclass () == LOC_TYPEDEF)
+ if (result.symbol && result.symbol->loc_class () == LOC_TYPEDEF)
{
yylval.tsym.type = result.symbol->type ();
return TYPENAME;
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index db96753..1aa9fc4 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -1,6 +1,6 @@
/* Fortran language support routines for GDB, the GNU debugger.
- Copyright (C) 1993-2024 Free Software Foundation, Inc.
+ Copyright (C) 1993-2025 Free Software Foundation, Inc.
Contributed by Motorola. Adapted from the C parser by Farooq Butt
(fmbutt@engage.sps.mot.com).
@@ -1836,9 +1836,7 @@ builtin_f_type (struct gdbarch *gdbarch)
static struct cmd_list_element *set_fortran_list;
static struct cmd_list_element *show_fortran_list;
-void _initialize_f_language ();
-void
-_initialize_f_language ()
+INIT_GDB_FILE (f_language)
{
add_setshow_prefix_cmd
("fortran", no_class,
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
index 180ac0e..f60d02a 100644
--- a/gdb/f-lang.h
+++ b/gdb/f-lang.h
@@ -1,6 +1,6 @@
/* Fortran language support definitions for GDB, the GNU debugger.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
Contributed by Motorola. Adapted from the C definitions by Farooq Butt
(fmbutt@engage.sps.mot.com).
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index 36e434a..04eca74 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -1,6 +1,6 @@
/* Support for printing Fortran types for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
Contributed by Motorola. Adapted from the C version by Farooq Butt
(fmbutt@engage.sps.mot.com).
@@ -299,8 +299,6 @@ void
f_language::f_type_print_base (struct type *type, struct ui_file *stream,
int show, int level) const
{
- int index;
-
QUIT;
stream->wrap_here (4);
@@ -414,28 +412,30 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream,
if (show > 0)
f_type_print_derivation_info (type, stream);
- gdb_puts (" ", stream);
-
- gdb_puts (type->name (), stream);
+ if (type->name () != nullptr)
+ {
+ gdb_puts (" ", stream);
+ gdb_puts (type->name (), stream);
+ }
/* According to the definition,
we only print structure elements in case show > 0. */
if (show > 0)
{
gdb_puts ("\n", stream);
- for (index = 0; index < type->num_fields (); index++)
+ for (const auto &field : type->fields ())
{
- f_type_print_base (type->field (index).type (), stream,
- show - 1, level + 4);
+ f_type_print_base (field.type (), stream, show - 1, level + 4);
gdb_puts (" :: ", stream);
- fputs_styled (type->field (index).name (),
+ fputs_styled (field.name (),
variable_name_style.style (), stream);
- f_type_print_varspec_suffix (type->field (index).type (),
+ f_type_print_varspec_suffix (field.type (),
stream, show - 1, 0, 0, 0, false);
gdb_puts ("\n", stream);
}
gdb_printf (stream, "%*sEnd Type ", level, "");
- gdb_puts (type->name (), stream);
+ if (type->name () != nullptr)
+ gdb_puts (type->name (), stream);
}
break;
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index cd87dd2..935bf02 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -1,6 +1,6 @@
/* Support for printing Fortran values for GDB, the GNU debugger.
- Copyright (C) 1993-2024 Free Software Foundation, Inc.
+ Copyright (C) 1993-2025 Free Software Foundation, Inc.
Contributed by Motorola. Adapted from the C definitions by Farooq Butt
(fmbutt@engage.sps.mot.com), additionally worked over by Stan Shebs.
@@ -631,7 +631,7 @@ info_common_command_for_block (const struct block *block, const char *comname,
const struct common_block *common = sym->value_common_block ();
size_t index;
- gdb_assert (sym->aclass () == LOC_COMMON_BLOCK);
+ gdb_assert (sym->loc_class () == LOC_COMMON_BLOCK);
if (comname && (!sym->linkage_name ()
|| strcmp (comname, sym->linkage_name ()) != 0))
@@ -719,9 +719,7 @@ info_common_command (const char *comname, int from_tty)
}
}
-void _initialize_f_valprint ();
-void
-_initialize_f_valprint ()
+INIT_GDB_FILE (f_valprint)
{
add_info ("common", info_common_command,
_("Print out the values contained in a Fortran COMMON block."));
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 8e0523d..3a4bd55 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for FreeBSD.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -188,7 +188,7 @@ fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
Pass MODIFIED as true, we do not know the real modification state. */
func (kve->kve_start, size, kve->kve_protection & KVME_PROT_READ,
kve->kve_protection & KVME_PROT_WRITE,
- kve->kve_protection & KVME_PROT_EXEC, 1, false, data);
+ kve->kve_protection & KVME_PROT_EXEC, true, false, data);
}
return 0;
}
@@ -304,7 +304,7 @@ fbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
if (pid == 0)
error (_("No current process: you must name one."));
}
- else if (built_argv.count () == 1 && isdigit (built_argv[0][0]))
+ else if (built_argv.count () == 1 && c_isdigit (built_argv[0][0]))
pid = strtol (built_argv[0], NULL, 10);
else
error (_("Invalid arguments."));
@@ -1203,7 +1203,7 @@ fbsd_nat_target::resume_one_process (ptid_t ptid, int step,
return;
}
- for (thread_info *tp : inf->non_exited_threads ())
+ for (thread_info &tp : inf->non_exited_threads ())
{
/* If ptid is a specific LWP, suspend all other LWPs in the
process, otherwise resume all LWPs in the process.. */
@@ -1887,7 +1887,7 @@ fbsd_nat_target::detach_fork_children (inferior *inf)
{
/* Detach any child processes associated with pending fork events in
threads belonging to this process. */
- for (thread_info *tp : inf->non_exited_threads ())
+ for (thread_info &tp : inf->non_exited_threads ())
detach_fork_children (tp);
/* Unwind state associated with any pending events. Reset
@@ -2465,14 +2465,12 @@ fbsd_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo)
if (ptrace (PT_LWPINFO, pid, (caddr_t) &pl, sizeof pl) == -1)
return false;
if (!(pl.pl_flags & PL_FLAG_SI))
- return false;;
+ return false;
*siginfo = pl.pl_siginfo;
return (true);
}
-void _initialize_fbsd_nat ();
-void
-_initialize_fbsd_nat ()
+INIT_GDB_FILE (fbsd_nat)
{
add_setshow_boolean_cmd ("fbsd-lwp", class_maintenance,
&debug_fbsd_lwp, _("\
diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h
index 2123175..76d5aee 100644
--- a/gdb/fbsd-nat.h
+++ b/gdb/fbsd-nat.h
@@ -1,6 +1,6 @@
/* Native-dependent code for FreeBSD.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -122,6 +122,10 @@ public:
bool supports_disable_randomization () override;
+ /* FreeBSD ptrace targets are shareable. */
+ bool is_shareable () override final
+ { return true; }
+
/* Methods meant to be overridden by arch-specific target
classes. */
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index e50ddb0..a2f000b 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for FreeBSD, architecture-independent.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -548,7 +548,8 @@ fbsd_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
string in a static buffer. */
static const char *
-fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr)
+fbsd_core_thread_name (struct gdbarch *gdbarch, bfd &cbfd,
+ struct thread_info *thr)
{
static char buf[80];
struct bfd_section *section;
@@ -564,16 +565,15 @@ fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr)
extract the null-terminated name from the start of the
note. */
thread_section_name section_name (".thrmisc", thr->ptid);
- bfd *cbfd = current_program_space->core_bfd ();
- section = bfd_get_section_by_name (cbfd, section_name.c_str ());
+ section = bfd_get_section_by_name (&cbfd, section_name.c_str ());
if (section != NULL && bfd_section_size (section) > 0)
{
/* Truncate the name if it is longer than "buf". */
size = bfd_section_size (section);
if (size > sizeof buf - 1)
size = sizeof buf - 1;
- if (bfd_get_section_contents (cbfd, section, buf, (file_ptr) 0, size)
+ if (bfd_get_section_contents (&cbfd, section, buf, (file_ptr) 0, size)
&& buf[0] != '\0')
{
buf[size] = '\0';
@@ -582,7 +582,7 @@ fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr)
as its thread name instead of an empty name if a name
has not been set explicitly. Return a NULL name in
that case. */
- if (strcmp (buf, elf_tdata (cbfd)->core->program) != 0)
+ if (strcmp (buf, elf_tdata (&cbfd)->core->program) != 0)
return buf;
}
}
@@ -594,8 +594,8 @@ fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr)
/* Implement the "core_xfer_siginfo" gdbarch method. */
static LONGEST
-fbsd_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf,
- ULONGEST offset, ULONGEST len)
+fbsd_core_xfer_siginfo (struct gdbarch *gdbarch, struct bfd &cbfd,
+ gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
{
size_t siginfo_size;
@@ -607,13 +607,12 @@ fbsd_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf,
return -1;
thread_section_name section_name (".note.freebsdcore.lwpinfo", inferior_ptid);
- bfd *cbfd = current_program_space->core_bfd ();
- asection *section = bfd_get_section_by_name (cbfd, section_name.c_str ());
+ asection *section = bfd_get_section_by_name (&cbfd, section_name.c_str ());
if (section == NULL)
return -1;
gdb_byte buf[4];
- if (!bfd_get_section_contents (cbfd, section, buf,
+ if (!bfd_get_section_contents (&cbfd, section, buf,
LWPINFO_OFFSET + LWPINFO_PL_FLAGS, 4))
return -1;
@@ -630,7 +629,7 @@ fbsd_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf,
else
siginfo_offset = LWPINFO_OFFSET + LWPINFO64_PL_SIGINFO;
- if (!bfd_get_section_contents (cbfd, section, readbuf,
+ if (!bfd_get_section_contents (&cbfd, section, readbuf,
siginfo_offset + offset, len))
return -1;
@@ -723,12 +722,12 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
enum gdb_signal stop_signal = signalled_thr->stop_signal ();
gcore_elf_build_thread_register_notes (gdbarch, signalled_thr, stop_signal,
obfd, &note_data, note_size);
- for (thread_info *thr : current_inferior ()->non_exited_threads ())
+ for (thread_info &thr : current_inferior ()->non_exited_threads ())
{
- if (thr == signalled_thr)
+ if (&thr == signalled_thr)
continue;
- gcore_elf_build_thread_register_notes (gdbarch, thr, stop_signal,
+ gcore_elf_build_thread_register_notes (gdbarch, &thr, stop_signal,
obfd, &note_data, note_size);
}
@@ -1015,12 +1014,11 @@ fbsd_info_proc_files_entry (int kf_type, int kf_fd, int kf_flags,
gdb_printf ("\n");
}
-/* Implement "info proc files" for a corefile. */
+/* Implement "info proc files" for corefile CBFD. */
static void
-fbsd_core_info_proc_files (struct gdbarch *gdbarch)
+fbsd_core_info_proc_files (struct gdbarch *gdbarch, bfd *cbfd)
{
- bfd *cbfd = current_program_space->core_bfd ();
asection *section = bfd_get_section_by_name (cbfd, ".note.freebsdcore.files");
if (section == NULL)
{
@@ -1143,15 +1141,14 @@ fbsd_info_proc_mappings_entry (int addr_bit, ULONGEST kve_start,
}
}
-/* Implement "info proc mappings" for a corefile. */
+/* Implement "info proc mappings" for corefile CBFD. */
static void
-fbsd_core_info_proc_mappings (struct gdbarch *gdbarch)
+fbsd_core_info_proc_mappings (struct gdbarch *gdbarch, bfd *cbfd)
{
asection *section;
unsigned char *descdata, *descend;
size_t note_size;
- bfd *cbfd = current_program_space->core_bfd ();
section = bfd_get_section_by_name (cbfd, ".note.freebsdcore.vmmap");
if (section == NULL)
@@ -1194,15 +1191,14 @@ fbsd_core_info_proc_mappings (struct gdbarch *gdbarch)
}
/* Fetch the pathname of a vnode for a single file descriptor from the
- file table core note. */
+ file table core note in CBFD. */
static gdb::unique_xmalloc_ptr<char>
-fbsd_core_vnode_path (struct gdbarch *gdbarch, int fd)
+fbsd_core_vnode_path (struct gdbarch *gdbarch, bfd *cbfd, int fd)
{
asection *section;
unsigned char *descdata, *descend;
size_t note_size;
- bfd *cbfd = current_program_space->core_bfd ();
section = bfd_get_section_by_name (cbfd, ".note.freebsdcore.files");
if (section == NULL)
@@ -1242,14 +1238,12 @@ fbsd_core_vnode_path (struct gdbarch *gdbarch, int fd)
return nullptr;
}
-/* Helper function to read a struct timeval. */
+/* Helper function to read a struct timeval from core file CBFD. */
static void
-fbsd_core_fetch_timeval (struct gdbarch *gdbarch, unsigned char *data,
- LONGEST &sec, ULONGEST &usec)
+fbsd_core_fetch_timeval (struct gdbarch *gdbarch, bfd *cbfd,
+ unsigned char *data, LONGEST &sec, ULONGEST &usec)
{
- bfd *cbfd = current_program_space->core_bfd ();
-
if (gdbarch_addr_bit (gdbarch) == 64)
{
sec = bfd_get_signed_64 (cbfd, data);
@@ -1267,12 +1261,11 @@ fbsd_core_fetch_timeval (struct gdbarch *gdbarch, unsigned char *data,
}
}
-/* Print out the contents of a signal set. */
+/* Print out the contents of a signal set SIGSET in core file CBFD. */
static void
-fbsd_print_sigset (const char *descr, unsigned char *sigset)
+fbsd_print_sigset (bfd *cbfd, const char *descr, unsigned char *sigset)
{
- bfd *cbfd = current_program_space->core_bfd ();
gdb_printf ("%s: ", descr);
for (int i = 0; i < SIG_WORDS; i++)
gdb_printf ("%08x ",
@@ -1280,10 +1273,10 @@ fbsd_print_sigset (const char *descr, unsigned char *sigset)
gdb_printf ("\n");
}
-/* Implement "info proc status" for a corefile. */
+/* Implement "info proc status" for corefile CBFD. */
static void
-fbsd_core_info_proc_status (struct gdbarch *gdbarch)
+fbsd_core_info_proc_status (struct gdbarch *gdbarch, bfd *cbfd)
{
const struct kinfo_proc_layout *kp;
asection *section;
@@ -1292,7 +1285,6 @@ fbsd_core_info_proc_status (struct gdbarch *gdbarch)
size_t note_size;
ULONGEST value;
LONGEST sec;
- bfd *cbfd = current_program_space->core_bfd ();
section = bfd_get_section_by_name (cbfd, ".note.freebsdcore.proc");
if (section == NULL)
@@ -1387,25 +1379,25 @@ fbsd_core_info_proc_status (struct gdbarch *gdbarch)
value = bfd_get (long_bit, cbfd,
descdata + kp->ki_rusage_ch + kp->ru_majflt);
gdb_printf ("Major faults, children: %s\n", pulongest (value));
- fbsd_core_fetch_timeval (gdbarch,
+ fbsd_core_fetch_timeval (gdbarch, cbfd,
descdata + kp->ki_rusage + kp->ru_utime,
sec, value);
gdb_printf ("utime: %s.%06d\n", plongest (sec), (int) value);
- fbsd_core_fetch_timeval (gdbarch,
+ fbsd_core_fetch_timeval (gdbarch, cbfd,
descdata + kp->ki_rusage + kp->ru_stime,
sec, value);
gdb_printf ("stime: %s.%06d\n", plongest (sec), (int) value);
- fbsd_core_fetch_timeval (gdbarch,
+ fbsd_core_fetch_timeval (gdbarch, cbfd,
descdata + kp->ki_rusage_ch + kp->ru_utime,
sec, value);
gdb_printf ("utime, children: %s.%06d\n", plongest (sec), (int) value);
- fbsd_core_fetch_timeval (gdbarch,
+ fbsd_core_fetch_timeval (gdbarch, cbfd,
descdata + kp->ki_rusage_ch + kp->ru_stime,
sec, value);
gdb_printf ("stime, children: %s.%06d\n", plongest (sec), (int) value);
gdb_printf ("'nice' value: %d\n",
(int) bfd_get_signed_8 (core_bfd, descdata + kp->ki_nice));
- fbsd_core_fetch_timeval (gdbarch, descdata + kp->ki_start, sec, value);
+ fbsd_core_fetch_timeval (gdbarch, cbfd, descdata + kp->ki_start, sec, value);
gdb_printf ("Start time: %s.%06d\n", plongest (sec), (int) value);
gdb_printf ("Virtual memory size: %s kB\n",
pulongest (bfd_get (addr_bit, cbfd,
@@ -1426,15 +1418,15 @@ fbsd_core_info_proc_status (struct gdbarch *gdbarch)
pulongest (bfd_get (long_bit, cbfd,
descdata + kp->ki_rusage
+ kp->ru_maxrss)));
- fbsd_print_sigset ("Ignored Signals", descdata + kp->ki_sigignore);
- fbsd_print_sigset ("Caught Signals", descdata + kp->ki_sigcatch);
+ fbsd_print_sigset (cbfd, "Ignored Signals", descdata + kp->ki_sigignore);
+ fbsd_print_sigset (cbfd, "Caught Signals", descdata + kp->ki_sigcatch);
}
/* Implement the "core_info_proc" gdbarch method. */
static void
-fbsd_core_info_proc (struct gdbarch *gdbarch, const char *args,
- enum info_proc_what what)
+fbsd_core_info_proc (struct gdbarch *gdbarch, struct bfd *cbfd,
+ const char *args, enum info_proc_what what)
{
bool do_cmdline = false;
bool do_cwd = false;
@@ -1482,7 +1474,6 @@ fbsd_core_info_proc (struct gdbarch *gdbarch, const char *args,
return;
}
- bfd *cbfd = current_program_space->core_bfd ();
pid = bfd_core_file_pid (cbfd);
if (pid != 0)
gdb_printf (_("process %d\n"), pid);
@@ -1500,7 +1491,7 @@ fbsd_core_info_proc (struct gdbarch *gdbarch, const char *args,
if (do_cwd)
{
gdb::unique_xmalloc_ptr<char> cwd =
- fbsd_core_vnode_path (gdbarch, KINFO_FILE_FD_TYPE_CWD);
+ fbsd_core_vnode_path (gdbarch, cbfd, KINFO_FILE_FD_TYPE_CWD);
if (cwd)
gdb_printf ("cwd = '%s'\n", cwd.get ());
else
@@ -1509,18 +1500,18 @@ fbsd_core_info_proc (struct gdbarch *gdbarch, const char *args,
if (do_exe)
{
gdb::unique_xmalloc_ptr<char> exe =
- fbsd_core_vnode_path (gdbarch, KINFO_FILE_FD_TYPE_TEXT);
+ fbsd_core_vnode_path (gdbarch, cbfd, KINFO_FILE_FD_TYPE_TEXT);
if (exe)
gdb_printf ("exe = '%s'\n", exe.get ());
else
warning (_("unable to read executable path name"));
}
if (do_files)
- fbsd_core_info_proc_files (gdbarch);
+ fbsd_core_info_proc_files (gdbarch, cbfd);
if (do_mappings)
- fbsd_core_info_proc_mappings (gdbarch);
+ fbsd_core_info_proc_mappings (gdbarch, cbfd);
if (do_status)
- fbsd_core_info_proc_status (gdbarch);
+ fbsd_core_info_proc_status (gdbarch, cbfd);
}
/* Print descriptions of FreeBSD-specific AUXV entries to FILE. */
@@ -2326,7 +2317,7 @@ fbsd_vdso_range (struct gdbarch *gdbarch, struct mem_range *range)
if (!target_has_execution ())
{
/* Search for the ending address in the NT_PROCSTAT_VMMAP note. */
- bfd *cbfd = current_program_space->core_bfd ();
+ bfd *cbfd = get_inferior_core_bfd (current_inferior ());
asection *section = bfd_get_section_by_name (cbfd,
".note.freebsdcore.vmmap");
if (section == nullptr)
diff --git a/gdb/fbsd-tdep.h b/gdb/fbsd-tdep.h
index 79381b3..3e1e97f 100644
--- a/gdb/fbsd-tdep.h
+++ b/gdb/fbsd-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for FreeBSD, architecture independent.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/features/Makefile b/gdb/features/Makefile
index 344c12c..d17c349 100644
--- a/gdb/features/Makefile
+++ b/gdb/features/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2024 Free Software Foundation, Inc.
+# Copyright (C) 2007-2025 Free Software Foundation, Inc.
# This file is part of GDB.
@@ -100,6 +100,7 @@ OUTPUTS = $(patsubst %,$(outdir)/%.dat,$(WHICH))
# --enable-targets=all GDB. You can override this by passing XMLTOC
# to make on the command line.
XMLTOC = \
+ alpha.xml \
microblaze-with-stack-protect.xml \
microblaze.xml \
mips-dsp-linux.xml \
@@ -203,6 +204,8 @@ FEATURE_XMLFILES = aarch64-core.xml \
aarch64-fpu.xml \
aarch64-pauth.xml \
aarch64-mte.xml \
+ aarch64-gcs.xml \
+ aarch64-gcs-linux.xml \
arc/v1-core.xml \
arc/v1-aux.xml \
arc/v2-core.xml \
@@ -225,6 +228,7 @@ FEATURE_XMLFILES = aarch64-core.xml \
i386/32bit-avx.xml \
i386/32bit-avx512.xml \
i386/32bit-segments.xml \
+ i386/32bit-ssp.xml \
i386/64bit-avx512.xml \
i386/64bit-core.xml \
i386/64bit-segments.xml \
@@ -232,6 +236,7 @@ FEATURE_XMLFILES = aarch64-core.xml \
i386/64bit-linux.xml \
i386/64bit-sse.xml \
i386/pkeys.xml \
+ i386/64bit-ssp.xml \
i386/x32-core.xml \
loongarch/base32.xml \
loongarch/base64.xml \
diff --git a/gdb/features/aarch64-core.xml b/gdb/features/aarch64-core.xml
index 13fe7ec..b804651 100644
--- a/gdb/features/aarch64-core.xml
+++ b/gdb/features/aarch64-core.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2009-2025 Free Software Foundation, Inc.
Contributed by ARM Ltd.
Copying and distribution of this file, with or without modification,
diff --git a/gdb/features/aarch64-fpu.xml b/gdb/features/aarch64-fpu.xml
index 7893955..509824f 100644
--- a/gdb/features/aarch64-fpu.xml
+++ b/gdb/features/aarch64-fpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2009-2025 Free Software Foundation, Inc.
Contributed by ARM Ltd.
Copying and distribution of this file, with or without modification,
diff --git a/gdb/features/aarch64-gcs-linux.c b/gdb/features/aarch64-gcs-linux.c
new file mode 100644
index 0000000..6b0d25b
--- /dev/null
+++ b/gdb/features/aarch64-gcs-linux.c
@@ -0,0 +1,21 @@
+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
+ Original: aarch64-gcs-linux.xml */
+
+#include "gdbsupport/tdesc.h"
+
+static int
+create_feature_aarch64_gcs_linux (struct target_desc *result, long regnum)
+{
+ struct tdesc_feature *feature;
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.aarch64.gcs.linux");
+ tdesc_type_with_fields *type_with_fields;
+ type_with_fields = tdesc_create_flags (feature, "features_flags", 8);
+ tdesc_add_flag (type_with_fields, 0, "PR_SHADOW_STACK_ENABLE");
+ tdesc_add_flag (type_with_fields, 1, "PR_SHADOW_STACK_WRITE");
+ tdesc_add_flag (type_with_fields, 2, "PR_SHADOW_STACK_PUSH");
+
+ tdesc_create_reg (feature, "gcs_features_enabled", regnum++, 1, "system", 64, "features_flags");
+ tdesc_create_reg (feature, "gcs_features_locked", regnum++, 1, "system", 64, "features_flags");
+ return regnum;
+}
diff --git a/gdb/features/aarch64-gcs-linux.xml b/gdb/features/aarch64-gcs-linux.xml
new file mode 100644
index 0000000..8d9d2ce
--- /dev/null
+++ b/gdb/features/aarch64-gcs-linux.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2025 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.aarch64.gcs.linux">
+ <flags id="features_flags" size="8">
+ <field name="PR_SHADOW_STACK_ENABLE" start="0" end="0"/>
+ <field name="PR_SHADOW_STACK_WRITE" start="1" end="1"/>
+ <field name="PR_SHADOW_STACK_PUSH" start="2" end="2"/>
+ </flags>
+
+ <reg name="gcs_features_enabled" bitsize="64" type="features_flags" group="system"/>
+ <reg name="gcs_features_locked" bitsize="64" type="features_flags" group="system"/>
+</feature>
diff --git a/gdb/features/aarch64-gcs.c b/gdb/features/aarch64-gcs.c
new file mode 100644
index 0000000..2b2caf2
--- /dev/null
+++ b/gdb/features/aarch64-gcs.c
@@ -0,0 +1,14 @@
+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
+ Original: aarch64-gcs.xml */
+
+#include "gdbsupport/tdesc.h"
+
+static int
+create_feature_aarch64_gcs (struct target_desc *result, long regnum)
+{
+ struct tdesc_feature *feature;
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.aarch64.gcs");
+ tdesc_create_reg (feature, "gcspr", regnum++, 1, "system", 64, "data_ptr");
+ return regnum;
+}
diff --git a/gdb/features/aarch64-gcs.xml b/gdb/features/aarch64-gcs.xml
new file mode 100644
index 0000000..bbee5e0
--- /dev/null
+++ b/gdb/features/aarch64-gcs.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2025 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.aarch64.gcs">
+ <reg name="gcspr" bitsize="64" type="data_ptr" group="system"/>
+</feature>
diff --git a/gdb/features/aarch64-mte.xml b/gdb/features/aarch64-mte.xml
index 62a07de..4440f11 100644
--- a/gdb/features/aarch64-mte.xml
+++ b/gdb/features/aarch64-mte.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2021-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/aarch64-pauth.xml b/gdb/features/aarch64-pauth.xml
index 9fcf690..f608b44 100644
--- a/gdb/features/aarch64-pauth.xml
+++ b/gdb/features/aarch64-pauth.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/aarch64-sme.c b/gdb/features/aarch64-sme.c
index 591c9af..8930452 100644
--- a/gdb/features/aarch64-sme.c
+++ b/gdb/features/aarch64-sme.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2023-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/features/aarch64-sme2.c b/gdb/features/aarch64-sme2.c
index f078abe..b5d4e79 100644
--- a/gdb/features/aarch64-sme2.c
+++ b/gdb/features/aarch64-sme2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2023-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/features/aarch64-sve.c b/gdb/features/aarch64-sve.c
index 67fc801..0b15881 100644
--- a/gdb/features/aarch64-sve.c
+++ b/gdb/features/aarch64-sve.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/features/aarch64-tls.c b/gdb/features/aarch64-tls.c
index f974976..abf7e7b 100644
--- a/gdb/features/aarch64-tls.c
+++ b/gdb/features/aarch64-tls.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2022-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/features/alpha-core.xml b/gdb/features/alpha-core.xml
new file mode 100644
index 0000000..c9e12f4
--- /dev/null
+++ b/gdb/features/alpha-core.xml
@@ -0,0 +1,136 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2025 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.alpha.core">
+ <!-- IEEE rounding mode values -->
+ <enum id="dyn_rm_enum" size="8">
+ <!-- Chopped rounding mode -->
+ <evalue name="chop" value="0"/>
+ <!-- Minus infinity -->
+ <evalue name="-inf" value="1"/>
+ <!-- Normal rounding -->
+ <evalue name="norm" value="2"/>
+ <!-- Plus infinity -->
+ <evalue name="+inf" value="3"/>
+ </enum>
+
+ <!-- Floating-Point Control Register Flags -->
+ <flags id="fpcr_flags" size="8">
+ <!-- Denormal Operand Exception Disable -->
+ <field name="DNOD" start="47" end="47"/>
+ <!-- Denormal Operands to Zero -->
+ <field name="DNZ" start="48" end="48"/>
+ <!-- Invalid Operation Disable -->
+ <field name="INVD" start="49" end="49"/>
+ <!-- Division by Zero Disable -->
+ <field name="DZED" start="50" end="50"/>
+ <!-- Overflow Disable -->
+ <field name="OVFD" start="51" end="51"/>
+ <!-- Invalid Operation -->
+ <field name="INV" start="52" end="52"/>
+ <!-- Division by Zero -->
+ <field name="DZE" start="53" end="53"/>
+ <!-- Overflow -->
+ <field name="OVF" start="54" end="54"/>
+ <!-- Underflow -->
+ <field name="UNF" start="55" end="55"/>
+ <!-- Inexact Result -->
+ <field name="INE" start="56" end="56"/>
+ <!-- Integer Overflow -->
+ <field name="IOV" start="57" end="57"/>
+ <!-- Dynamic Rounding Mode -->
+ <field name="DYN_RM" start="58" end="59" type="dyn_rm_enum"/>
+ <!-- Underflow to Zero -->
+ <field name="UNDZ" start="60" end="60"/>
+ <!-- Underflow Disable -->
+ <field name="UNFD" start="61" end="61"/>
+ <!-- Inexact Disable -->
+ <field name="INED" start="62" end="62"/>
+ <!-- Summary Bit -->
+ <field name="SUM" start="63" end="63"/>
+ </flags>
+
+ <!-- Integer Registers -->
+ <reg name="v0" bitsize="64" type="int64"/>
+ <reg name="t0" bitsize="64" type="int64"/>
+ <reg name="t1" bitsize="64" type="int64"/>
+ <reg name="t2" bitsize="64" type="int64"/>
+ <reg name="t3" bitsize="64" type="int64"/>
+ <reg name="t4" bitsize="64" type="int64"/>
+ <reg name="t5" bitsize="64" type="int64"/>
+ <reg name="t6" bitsize="64" type="int64"/>
+ <reg name="t7" bitsize="64" type="int64"/>
+ <reg name="s0" bitsize="64" type="int64"/>
+ <reg name="s1" bitsize="64" type="int64"/>
+ <reg name="s2" bitsize="64" type="int64"/>
+ <reg name="s3" bitsize="64" type="int64"/>
+ <reg name="s4" bitsize="64" type="int64"/>
+ <reg name="s5" bitsize="64" type="int64"/>
+ <reg name="fp" bitsize="64" type="int64"/>
+ <reg name="a0" bitsize="64" type="int64"/>
+ <reg name="a1" bitsize="64" type="int64"/>
+ <reg name="a2" bitsize="64" type="int64"/>
+ <reg name="a3" bitsize="64" type="int64"/>
+ <reg name="a4" bitsize="64" type="int64"/>
+ <reg name="a5" bitsize="64" type="int64"/>
+ <reg name="t8" bitsize="64" type="int64"/>
+ <reg name="t9" bitsize="64" type="int64"/>
+ <reg name="t10" bitsize="64" type="int64"/>
+ <reg name="t11" bitsize="64" type="int64"/>
+ <reg name="ra" bitsize="64" type="int64"/>
+ <reg name="t12" bitsize="64" type="int64"/>
+ <reg name="at" bitsize="64" type="int64"/>
+ <reg name="gp" bitsize="64" type="data_ptr"/>
+ <reg name="sp" bitsize="64" type="data_ptr"/>
+ <reg name="zero" bitsize="64" type="int64" save-restore="no"/>
+
+ <!-- Floating-Point Registers -->
+ <reg name="f0" bitsize="64" type="float" group="float"/>
+ <reg name="f1" bitsize="64" type="float" group="float"/>
+ <reg name="f2" bitsize="64" type="float" group="float"/>
+ <reg name="f3" bitsize="64" type="float" group="float"/>
+ <reg name="f4" bitsize="64" type="float" group="float"/>
+ <reg name="f5" bitsize="64" type="float" group="float"/>
+ <reg name="f6" bitsize="64" type="float" group="float"/>
+ <reg name="f7" bitsize="64" type="float" group="float"/>
+ <reg name="f8" bitsize="64" type="float" group="float"/>
+ <reg name="f9" bitsize="64" type="float" group="float"/>
+ <reg name="f10" bitsize="64" type="float" group="float"/>
+ <reg name="f11" bitsize="64" type="float" group="float"/>
+ <reg name="f12" bitsize="64" type="float" group="float"/>
+ <reg name="f13" bitsize="64" type="float" group="float"/>
+ <reg name="f14" bitsize="64" type="float" group="float"/>
+ <reg name="f15" bitsize="64" type="float" group="float"/>
+ <reg name="f16" bitsize="64" type="float" group="float"/>
+ <reg name="f17" bitsize="64" type="float" group="float"/>
+ <reg name="f18" bitsize="64" type="float" group="float"/>
+ <reg name="f19" bitsize="64" type="float" group="float"/>
+ <reg name="f20" bitsize="64" type="float" group="float"/>
+ <reg name="f21" bitsize="64" type="float" group="float"/>
+ <reg name="f22" bitsize="64" type="float" group="float"/>
+ <reg name="f23" bitsize="64" type="float" group="float"/>
+ <reg name="f24" bitsize="64" type="float" group="float"/>
+ <reg name="f25" bitsize="64" type="float" group="float"/>
+ <reg name="f26" bitsize="64" type="float" group="float"/>
+ <reg name="f27" bitsize="64" type="float" group="float"/>
+ <reg name="f28" bitsize="64" type="float" group="float"/>
+ <reg name="f29" bitsize="64" type="float" group="float"/>
+ <reg name="f30" bitsize="64" type="float" group="float"/>
+
+ <!-- Floating-Point Control Register -->
+ <reg name="fpcr" bitsize="64" type="fpcr_flags" group="float"/>
+
+ <!-- Program Counter -->
+ <reg name="pc" bitsize="64" type="code_ptr"/>
+
+ <!-- Reserved Index for Former Virtual Register -->
+ <reg name="" bitsize="64" type="int64" save-restore="no"/>
+
+ <!-- PALcode Memory Slot -->
+ <reg name="unique" bitsize="64" type="int64" group="system"/>
+</feature>
diff --git a/gdb/features/alpha.c b/gdb/features/alpha.c
new file mode 100644
index 0000000..35f12fc
--- /dev/null
+++ b/gdb/features/alpha.c
@@ -0,0 +1,111 @@
+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
+ Original: alpha.xml */
+
+#include "osabi.h"
+#include "target-descriptions.h"
+
+const struct target_desc *tdesc_alpha;
+static void
+initialize_tdesc_alpha (void)
+{
+ target_desc_up result = allocate_target_description ();
+ struct tdesc_feature *feature;
+
+ feature = tdesc_create_feature (result.get (), "org.gnu.gdb.alpha.core");
+ tdesc_type_with_fields *type_with_fields;
+ type_with_fields = tdesc_create_enum (feature, "dyn_rm_enum", 8);
+ tdesc_add_enum_value (type_with_fields, 0, "chop");
+ tdesc_add_enum_value (type_with_fields, 1, "-inf");
+ tdesc_add_enum_value (type_with_fields, 2, "norm");
+ tdesc_add_enum_value (type_with_fields, 3, "+inf");
+
+ type_with_fields = tdesc_create_flags (feature, "fpcr_flags", 8);
+ tdesc_add_flag (type_with_fields, 47, "DNOD");
+ tdesc_add_flag (type_with_fields, 48, "DNZ");
+ tdesc_add_flag (type_with_fields, 49, "INVD");
+ tdesc_add_flag (type_with_fields, 50, "DZED");
+ tdesc_add_flag (type_with_fields, 51, "OVFD");
+ tdesc_add_flag (type_with_fields, 52, "INV");
+ tdesc_add_flag (type_with_fields, 53, "DZE");
+ tdesc_add_flag (type_with_fields, 54, "OVF");
+ tdesc_add_flag (type_with_fields, 55, "UNF");
+ tdesc_add_flag (type_with_fields, 56, "INE");
+ tdesc_add_flag (type_with_fields, 57, "IOV");
+ tdesc_type *field_type;
+ field_type = tdesc_named_type (feature, "dyn_rm_enum");
+ tdesc_add_typed_bitfield (type_with_fields, "DYN_RM", 58, 59, field_type);
+ tdesc_add_flag (type_with_fields, 60, "UNDZ");
+ tdesc_add_flag (type_with_fields, 61, "UNFD");
+ tdesc_add_flag (type_with_fields, 62, "INED");
+ tdesc_add_flag (type_with_fields, 63, "SUM");
+
+ tdesc_create_reg (feature, "v0", 0, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "t0", 1, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "t1", 2, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "t2", 3, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "t3", 4, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "t4", 5, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "t5", 6, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "t6", 7, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "t7", 8, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "s0", 9, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "s1", 10, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "s2", 11, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "s3", 12, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "s4", 13, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "s5", 14, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "fp", 15, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "a0", 16, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "a1", 17, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "a2", 18, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "a3", 19, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "a4", 20, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "a5", 21, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "t8", 22, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "t9", 23, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "t10", 24, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "t11", 25, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "ra", 26, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "t12", 27, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "at", 28, 1, NULL, 64, "int64");
+ tdesc_create_reg (feature, "gp", 29, 1, NULL, 64, "data_ptr");
+ tdesc_create_reg (feature, "sp", 30, 1, NULL, 64, "data_ptr");
+ tdesc_create_reg (feature, "zero", 31, 0, NULL, 64, "int64");
+ tdesc_create_reg (feature, "f0", 32, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f1", 33, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f2", 34, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f3", 35, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f4", 36, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f5", 37, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f6", 38, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f7", 39, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f8", 40, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f9", 41, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f10", 42, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f11", 43, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f12", 44, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f13", 45, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f14", 46, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f15", 47, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f16", 48, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f17", 49, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f18", 50, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f19", 51, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f20", 52, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f21", 53, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f22", 54, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f23", 55, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f24", 56, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f25", 57, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f26", 58, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f27", 59, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f28", 60, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f29", 61, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "f30", 62, 1, "float", 64, "float");
+ tdesc_create_reg (feature, "fpcr", 63, 1, "float", 64, "fpcr_flags");
+ tdesc_create_reg (feature, "pc", 64, 1, NULL, 64, "code_ptr");
+ tdesc_create_reg (feature, "", 65, 0, NULL, 64, "int64");
+ tdesc_create_reg (feature, "unique", 66, 1, "system", 64, "int64");
+
+ tdesc_alpha = result.release ();
+}
diff --git a/gdb/features/alpha.xml b/gdb/features/alpha.xml
new file mode 100644
index 0000000..3ae0ab8
--- /dev/null
+++ b/gdb/features/alpha.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2025 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<target version="1.0">
+ <xi:include href="alpha-core.xml"/>
+</target>
diff --git a/gdb/features/arc/v1-aux.xml b/gdb/features/arc/v1-aux.xml
index 4b9fd13..5759eaa 100644
--- a/gdb/features/arc/v1-aux.xml
+++ b/gdb/features/arc/v1-aux.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2015-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/arc/v1-core.xml b/gdb/features/arc/v1-core.xml
index 01fd832..60ae134 100644
--- a/gdb/features/arc/v1-core.xml
+++ b/gdb/features/arc/v1-core.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2015-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/arc/v2-aux.xml b/gdb/features/arc/v2-aux.xml
index 46b77c7..9492d1f 100644
--- a/gdb/features/arc/v2-aux.xml
+++ b/gdb/features/arc/v2-aux.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2015-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/arc/v2-core.xml b/gdb/features/arc/v2-core.xml
index 27d4228..8676b75 100644
--- a/gdb/features/arc/v2-core.xml
+++ b/gdb/features/arc/v2-core.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2015-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/arm/arm-core.xml b/gdb/features/arm/arm-core.xml
index c573fa6..498aee1 100644
--- a/gdb/features/arm/arm-core.xml
+++ b/gdb/features/arm/arm-core.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/arm/arm-fpa.xml b/gdb/features/arm/arm-fpa.xml
index fce0e1e..bbf39c2 100644
--- a/gdb/features/arm/arm-fpa.xml
+++ b/gdb/features/arm/arm-fpa.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/arm/arm-m-profile-mve.xml b/gdb/features/arm/arm-m-profile-mve.xml
index 852d485..43546fc 100644
--- a/gdb/features/arm/arm-m-profile-mve.xml
+++ b/gdb/features/arm/arm-m-profile-mve.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2021-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/arm/arm-m-profile-with-fpa.xml b/gdb/features/arm/arm-m-profile-with-fpa.xml
index 9b5cf64..26b7d66 100644
--- a/gdb/features/arm/arm-m-profile-with-fpa.xml
+++ b/gdb/features/arm/arm-m-profile-with-fpa.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2019-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/arm/arm-m-profile.xml b/gdb/features/arm/arm-m-profile.xml
index a30be2a..1ec0a80 100644
--- a/gdb/features/arm/arm-m-profile.xml
+++ b/gdb/features/arm/arm-m-profile.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/arm/arm-m-system.xml b/gdb/features/arm/arm-m-system.xml
index 17f4915..7e5fbd5 100644
--- a/gdb/features/arm/arm-m-system.xml
+++ b/gdb/features/arm/arm-m-system.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/arm/arm-secext.xml b/gdb/features/arm/arm-secext.xml
index 13d13d7..97ec233 100644
--- a/gdb/features/arm/arm-secext.xml
+++ b/gdb/features/arm/arm-secext.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/arm/arm-tls.xml b/gdb/features/arm/arm-tls.xml
index 97e4913..cb004b9 100644
--- a/gdb/features/arm/arm-tls.xml
+++ b/gdb/features/arm/arm-tls.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/arm/arm-vfpv2.xml b/gdb/features/arm/arm-vfpv2.xml
index 5caeddc..2dc2ba7 100644
--- a/gdb/features/arm/arm-vfpv2.xml
+++ b/gdb/features/arm/arm-vfpv2.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2009-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/arm/arm-vfpv3.xml b/gdb/features/arm/arm-vfpv3.xml
index 87020fe..8c1dbe6 100644
--- a/gdb/features/arm/arm-vfpv3.xml
+++ b/gdb/features/arm/arm-vfpv3.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2009-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/arm/xscale-iwmmxt.xml b/gdb/features/arm/xscale-iwmmxt.xml
index 6f1138e..3fe1d16 100644
--- a/gdb/features/arm/xscale-iwmmxt.xml
+++ b/gdb/features/arm/xscale-iwmmxt.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/btrace-conf.dtd b/gdb/features/btrace-conf.dtd
index c6f3f60..64b595d 100644
--- a/gdb/features/btrace-conf.dtd
+++ b/gdb/features/btrace-conf.dtd
@@ -1,4 +1,4 @@
-<!-- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/btrace.dtd b/gdb/features/btrace.dtd
index 44b063f..543a8fb 100644
--- a/gdb/features/btrace.dtd
+++ b/gdb/features/btrace.dtd
@@ -1,4 +1,4 @@
-<!-- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/cskyv2-linux.xml b/gdb/features/cskyv2-linux.xml
index ef1ccc0..45eb180 100644
--- a/gdb/features/cskyv2-linux.xml
+++ b/gdb/features/cskyv2-linux.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/feature_to_c.awk b/gdb/features/feature_to_c.awk
index ae866fe..0f06115 100644
--- a/gdb/features/feature_to_c.awk
+++ b/gdb/features/feature_to_c.awk
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2024 Free Software Foundation, Inc.
+# Copyright (C) 2007-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/features/feature_to_c.sh b/gdb/features/feature_to_c.sh
index d5d3db7..d518ae3 100755
--- a/gdb/features/feature_to_c.sh
+++ b/gdb/features/feature_to_c.sh
@@ -2,7 +2,7 @@
# Convert text files to compilable C arrays.
#
-# Copyright (C) 2007-2024 Free Software Foundation, Inc.
+# Copyright (C) 2007-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/features/gdb-target.dtd b/gdb/features/gdb-target.dtd
index d07703f..2ecc41e 100644
--- a/gdb/features/gdb-target.dtd
+++ b/gdb/features/gdb-target.dtd
@@ -1,4 +1,4 @@
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/i386/32bit-avx.xml b/gdb/features/i386/32bit-avx.xml
index 251f13d..5cd9a93 100644
--- a/gdb/features/i386/32bit-avx.xml
+++ b/gdb/features/i386/32bit-avx.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/i386/32bit-avx512.xml b/gdb/features/i386/32bit-avx512.xml
index 05e3213..949ff42 100644
--- a/gdb/features/i386/32bit-avx512.xml
+++ b/gdb/features/i386/32bit-avx512.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2014-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/i386/32bit-core.xml b/gdb/features/i386/32bit-core.xml
index 3c774f6..e1473aa 100644
--- a/gdb/features/i386/32bit-core.xml
+++ b/gdb/features/i386/32bit-core.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/i386/32bit-linux.xml b/gdb/features/i386/32bit-linux.xml
index aa57c0a..0bfc0bc 100644
--- a/gdb/features/i386/32bit-linux.xml
+++ b/gdb/features/i386/32bit-linux.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/i386/32bit-segments.xml b/gdb/features/i386/32bit-segments.xml
index b84c865..c800a71 100644
--- a/gdb/features/i386/32bit-segments.xml
+++ b/gdb/features/i386/32bit-segments.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2016-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/i386/32bit-sse.xml b/gdb/features/i386/32bit-sse.xml
index e6afdd4..a292906 100644
--- a/gdb/features/i386/32bit-sse.xml
+++ b/gdb/features/i386/32bit-sse.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/i386/32bit-ssp.c b/gdb/features/i386/32bit-ssp.c
new file mode 100644
index 0000000..991bae3
--- /dev/null
+++ b/gdb/features/i386/32bit-ssp.c
@@ -0,0 +1,14 @@
+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
+ Original: 32bit-ssp.xml */
+
+#include "gdbsupport/tdesc.h"
+
+static int
+create_feature_i386_32bit_ssp (struct target_desc *result, long regnum)
+{
+ struct tdesc_feature *feature;
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.pl3_ssp");
+ tdesc_create_reg (feature, "pl3_ssp", regnum++, 1, NULL, 32, "data_ptr");
+ return regnum;
+}
diff --git a/gdb/features/i386/32bit-ssp.xml b/gdb/features/i386/32bit-ssp.xml
new file mode 100644
index 0000000..d17e700
--- /dev/null
+++ b/gdb/features/i386/32bit-ssp.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.i386.pl3_ssp">
+ <reg name="pl3_ssp" bitsize="32" type="data_ptr"/>
+</feature>
diff --git a/gdb/features/i386/64bit-avx.xml b/gdb/features/i386/64bit-avx.xml
index bae5143..c57385d 100644
--- a/gdb/features/i386/64bit-avx.xml
+++ b/gdb/features/i386/64bit-avx.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/i386/64bit-avx512.xml b/gdb/features/i386/64bit-avx512.xml
index 07921d4..d4081ff 100644
--- a/gdb/features/i386/64bit-avx512.xml
+++ b/gdb/features/i386/64bit-avx512.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2014-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/i386/64bit-core.xml b/gdb/features/i386/64bit-core.xml
index 5cbae2c..6746c25 100644
--- a/gdb/features/i386/64bit-core.xml
+++ b/gdb/features/i386/64bit-core.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/i386/64bit-linux.xml b/gdb/features/i386/64bit-linux.xml
index 9ee944d..a72a9f7 100644
--- a/gdb/features/i386/64bit-linux.xml
+++ b/gdb/features/i386/64bit-linux.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/i386/64bit-segments.xml b/gdb/features/i386/64bit-segments.xml
index 80156d4..0c05d38 100644
--- a/gdb/features/i386/64bit-segments.xml
+++ b/gdb/features/i386/64bit-segments.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2016-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/i386/64bit-sse.xml b/gdb/features/i386/64bit-sse.xml
index bcee5a2..6fc7632 100644
--- a/gdb/features/i386/64bit-sse.xml
+++ b/gdb/features/i386/64bit-sse.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/i386/64bit-ssp.c b/gdb/features/i386/64bit-ssp.c
new file mode 100644
index 0000000..5468099
--- /dev/null
+++ b/gdb/features/i386/64bit-ssp.c
@@ -0,0 +1,14 @@
+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
+ Original: 64bit-ssp.xml */
+
+#include "gdbsupport/tdesc.h"
+
+static int
+create_feature_i386_64bit_ssp (struct target_desc *result, long regnum)
+{
+ struct tdesc_feature *feature;
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.pl3_ssp");
+ tdesc_create_reg (feature, "pl3_ssp", regnum++, 1, NULL, 64, "data_ptr");
+ return regnum;
+}
diff --git a/gdb/features/i386/64bit-ssp.xml b/gdb/features/i386/64bit-ssp.xml
new file mode 100644
index 0000000..a0688d0
--- /dev/null
+++ b/gdb/features/i386/64bit-ssp.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.i386.pl3_ssp">
+ <reg name="pl3_ssp" bitsize="64" type="data_ptr"/>
+</feature>
diff --git a/gdb/features/i386/pkeys.xml b/gdb/features/i386/pkeys.xml
index 6d2a2b1..0996090 100644
--- a/gdb/features/i386/pkeys.xml
+++ b/gdb/features/i386/pkeys.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2016-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/i386/x32-core.xml b/gdb/features/i386/x32-core.xml
index ba7aee9..3395d4a 100644
--- a/gdb/features/i386/x32-core.xml
+++ b/gdb/features/i386/x32-core.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2012-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/library-list-aix.dtd b/gdb/features/library-list-aix.dtd
index dc4586e..1eed464 100644
--- a/gdb/features/library-list-aix.dtd
+++ b/gdb/features/library-list-aix.dtd
@@ -1,4 +1,4 @@
-<!-- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/library-list-svr4.dtd b/gdb/features/library-list-svr4.dtd
index 671fd85..ab56491 100644
--- a/gdb/features/library-list-svr4.dtd
+++ b/gdb/features/library-list-svr4.dtd
@@ -1,4 +1,4 @@
-<!-- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2011-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/library-list.dtd b/gdb/features/library-list.dtd
index 98ed7bc..66945cb 100644
--- a/gdb/features/library-list.dtd
+++ b/gdb/features/library-list.dtd
@@ -1,4 +1,4 @@
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/loongarch/base32.xml b/gdb/features/loongarch/base32.xml
index b8af2b6..7562223 100644
--- a/gdb/features/loongarch/base32.xml
+++ b/gdb/features/loongarch/base32.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/loongarch/base64.xml b/gdb/features/loongarch/base64.xml
index 5cd7bec..57c86f5 100644
--- a/gdb/features/loongarch/base64.xml
+++ b/gdb/features/loongarch/base64.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/loongarch/fpu.xml b/gdb/features/loongarch/fpu.xml
index c68fc1b..c892fea 100644
--- a/gdb/features/loongarch/fpu.xml
+++ b/gdb/features/loongarch/fpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2021-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/loongarch/lasx.xml b/gdb/features/loongarch/lasx.xml
index 753b982..d44de54 100644
--- a/gdb/features/loongarch/lasx.xml
+++ b/gdb/features/loongarch/lasx.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/loongarch/lbt.xml b/gdb/features/loongarch/lbt.xml
index 6526ee6..32183d4 100644
--- a/gdb/features/loongarch/lbt.xml
+++ b/gdb/features/loongarch/lbt.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/loongarch/lsx.xml b/gdb/features/loongarch/lsx.xml
index e19a404..4288d6f 100644
--- a/gdb/features/loongarch/lsx.xml
+++ b/gdb/features/loongarch/lsx.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml
index d1d7d53..4182d4b 100644
--- a/gdb/features/microblaze-core.xml
+++ b/gdb/features/microblaze-core.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2014-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/microblaze-linux.xml b/gdb/features/microblaze-linux.xml
index 688a3f8..ee38f1a 100644
--- a/gdb/features/microblaze-linux.xml
+++ b/gdb/features/microblaze-linux.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
+<!-- Copyright (C) 2014-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/microblaze-stack-protect.xml b/gdb/features/microblaze-stack-protect.xml
index b5f6840..4ecae94 100644
--- a/gdb/features/microblaze-stack-protect.xml
+++ b/gdb/features/microblaze-stack-protect.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2014-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/microblaze-with-stack-protect.xml b/gdb/features/microblaze-with-stack-protect.xml
index c1e3699..6a0c602 100644
--- a/gdb/features/microblaze-with-stack-protect.xml
+++ b/gdb/features/microblaze-with-stack-protect.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2014-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/microblaze.xml b/gdb/features/microblaze.xml
index 8c10bcc..353c429 100644
--- a/gdb/features/microblaze.xml
+++ b/gdb/features/microblaze.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2014-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/mips-cp0.xml b/gdb/features/mips-cp0.xml
index fb489f4..4d5a1ef 100644
--- a/gdb/features/mips-cp0.xml
+++ b/gdb/features/mips-cp0.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/mips-cpu.xml b/gdb/features/mips-cpu.xml
index 779a0a7..9fb053c 100644
--- a/gdb/features/mips-cpu.xml
+++ b/gdb/features/mips-cpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/mips-dsp-linux.xml b/gdb/features/mips-dsp-linux.xml
index 84dcf03..209e76d 100644
--- a/gdb/features/mips-dsp-linux.xml
+++ b/gdb/features/mips-dsp-linux.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2012-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/mips-dsp.xml b/gdb/features/mips-dsp.xml
index 7e10e69..4146e05 100644
--- a/gdb/features/mips-dsp.xml
+++ b/gdb/features/mips-dsp.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2012-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/mips-fpu.xml b/gdb/features/mips-fpu.xml
index 4424b3b..a4ab60f 100644
--- a/gdb/features/mips-fpu.xml
+++ b/gdb/features/mips-fpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/mips-linux.xml b/gdb/features/mips-linux.xml
index 2e735fa..bb0c66c 100644
--- a/gdb/features/mips-linux.xml
+++ b/gdb/features/mips-linux.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/mips64-cp0.xml b/gdb/features/mips64-cp0.xml
index dbb82d9..cfc2864 100644
--- a/gdb/features/mips64-cp0.xml
+++ b/gdb/features/mips64-cp0.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/mips64-cpu.xml b/gdb/features/mips64-cpu.xml
index 2989ee4..e3f5f27 100644
--- a/gdb/features/mips64-cpu.xml
+++ b/gdb/features/mips64-cpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/mips64-dsp-linux.xml b/gdb/features/mips64-dsp-linux.xml
index 6c10855..c8fc120 100644
--- a/gdb/features/mips64-dsp-linux.xml
+++ b/gdb/features/mips64-dsp-linux.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2012-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/mips64-dsp.xml b/gdb/features/mips64-dsp.xml
index f711868..18ace0e 100644
--- a/gdb/features/mips64-dsp.xml
+++ b/gdb/features/mips64-dsp.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2012-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/mips64-fpu.xml b/gdb/features/mips64-fpu.xml
index b66b986..8b1f9de 100644
--- a/gdb/features/mips64-fpu.xml
+++ b/gdb/features/mips64-fpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/mips64-linux.xml b/gdb/features/mips64-linux.xml
index f861982..60eda28 100644
--- a/gdb/features/mips64-linux.xml
+++ b/gdb/features/mips64-linux.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/nds32-core.xml b/gdb/features/nds32-core.xml
index 38571af..9be7753 100644
--- a/gdb/features/nds32-core.xml
+++ b/gdb/features/nds32-core.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/nds32-fpu.xml b/gdb/features/nds32-fpu.xml
index f362fbd..dddad9f 100644
--- a/gdb/features/nds32-fpu.xml
+++ b/gdb/features/nds32-fpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/nds32-system.xml b/gdb/features/nds32-system.xml
index e42d98a..ae2e661 100644
--- a/gdb/features/nds32-system.xml
+++ b/gdb/features/nds32-system.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/nds32.xml b/gdb/features/nds32.xml
index 0926c95..dbbeb4f 100644
--- a/gdb/features/nds32.xml
+++ b/gdb/features/nds32.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/or1k-core.xml b/gdb/features/or1k-core.xml
index 0f24458..1d6700f 100644
--- a/gdb/features/or1k-core.xml
+++ b/gdb/features/or1k-core.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2017-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/or1k-linux.xml b/gdb/features/or1k-linux.xml
index 7f57b7e..86ec853 100644
--- a/gdb/features/or1k-linux.xml
+++ b/gdb/features/or1k-linux.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2021-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/or1k.xml b/gdb/features/or1k.xml
index 54d98cc..f3dab0e 100644
--- a/gdb/features/or1k.xml
+++ b/gdb/features/or1k.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2016-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/osdata.dtd b/gdb/features/osdata.dtd
index 6350b7a..d5befc3 100644
--- a/gdb/features/osdata.dtd
+++ b/gdb/features/osdata.dtd
@@ -1,4 +1,4 @@
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/print-osabi.xsl b/gdb/features/print-osabi.xsl
index 77f9931..4e19244 100644
--- a/gdb/features/print-osabi.xsl
+++ b/gdb/features/print-osabi.xsl
@@ -1,6 +1,6 @@
<!--
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/features/riscv/32bit-cpu.xml b/gdb/features/riscv/32bit-cpu.xml
index dc948c7..76180b8 100644
--- a/gdb/features/riscv/32bit-cpu.xml
+++ b/gdb/features/riscv/32bit-cpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/riscv/32bit-fpu.xml b/gdb/features/riscv/32bit-fpu.xml
index 985d0e9..d5ec19b 100644
--- a/gdb/features/riscv/32bit-fpu.xml
+++ b/gdb/features/riscv/32bit-fpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/riscv/64bit-cpu.xml b/gdb/features/riscv/64bit-cpu.xml
index 60f42f2..61ec01e 100644
--- a/gdb/features/riscv/64bit-cpu.xml
+++ b/gdb/features/riscv/64bit-cpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/riscv/64bit-fpu.xml b/gdb/features/riscv/64bit-fpu.xml
index 8f18bf1..1e1838e 100644
--- a/gdb/features/riscv/64bit-fpu.xml
+++ b/gdb/features/riscv/64bit-fpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/riscv/rv32e-xregs.xml b/gdb/features/riscv/rv32e-xregs.xml
index ff0f9c7..c1013f2 100644
--- a/gdb/features/riscv/rv32e-xregs.xml
+++ b/gdb/features/riscv/rv32e-xregs.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-altivec.xml b/gdb/features/rs6000/power-altivec.xml
index 243de8d..eb95210 100644
--- a/gdb/features/rs6000/power-altivec.xml
+++ b/gdb/features/rs6000/power-altivec.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-core.xml b/gdb/features/rs6000/power-core.xml
index 3b81a73..ba53eb9 100644
--- a/gdb/features/rs6000/power-core.xml
+++ b/gdb/features/rs6000/power-core.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-dscr.xml b/gdb/features/rs6000/power-dscr.xml
index 4d6865e..4735056 100644
--- a/gdb/features/rs6000/power-dscr.xml
+++ b/gdb/features/rs6000/power-dscr.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-ebb.xml b/gdb/features/rs6000/power-ebb.xml
index 1379ab1..4020d64 100644
--- a/gdb/features/rs6000/power-ebb.xml
+++ b/gdb/features/rs6000/power-ebb.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-fpu-isa205.xml b/gdb/features/rs6000/power-fpu-isa205.xml
index 8cf63c9..822fe67 100644
--- a/gdb/features/rs6000/power-fpu-isa205.xml
+++ b/gdb/features/rs6000/power-fpu-isa205.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-fpu.xml b/gdb/features/rs6000/power-fpu.xml
index 0ad8801..076486d 100644
--- a/gdb/features/rs6000/power-fpu.xml
+++ b/gdb/features/rs6000/power-fpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-htm-altivec.xml b/gdb/features/rs6000/power-htm-altivec.xml
index cab4c9a..f9513fb 100644
--- a/gdb/features/rs6000/power-htm-altivec.xml
+++ b/gdb/features/rs6000/power-htm-altivec.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-htm-core.xml b/gdb/features/rs6000/power-htm-core.xml
index 1ec64fc..69ab345 100644
--- a/gdb/features/rs6000/power-htm-core.xml
+++ b/gdb/features/rs6000/power-htm-core.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-htm-dscr.xml b/gdb/features/rs6000/power-htm-dscr.xml
index a15621f..d6bacaa 100644
--- a/gdb/features/rs6000/power-htm-dscr.xml
+++ b/gdb/features/rs6000/power-htm-dscr.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-htm-fpu.xml b/gdb/features/rs6000/power-htm-fpu.xml
index 1f67d91..274a09a 100644
--- a/gdb/features/rs6000/power-htm-fpu.xml
+++ b/gdb/features/rs6000/power-htm-fpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-htm-ppr.xml b/gdb/features/rs6000/power-htm-ppr.xml
index 6d645e1..d73f430 100644
--- a/gdb/features/rs6000/power-htm-ppr.xml
+++ b/gdb/features/rs6000/power-htm-ppr.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-htm-spr.xml b/gdb/features/rs6000/power-htm-spr.xml
index d7e37ba..3f5b94c 100644
--- a/gdb/features/rs6000/power-htm-spr.xml
+++ b/gdb/features/rs6000/power-htm-spr.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-htm-tar.xml b/gdb/features/rs6000/power-htm-tar.xml
index 828ca75..ee3170a 100644
--- a/gdb/features/rs6000/power-htm-tar.xml
+++ b/gdb/features/rs6000/power-htm-tar.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-htm-vsx.xml b/gdb/features/rs6000/power-htm-vsx.xml
index bb5a1cb..9721c8f 100644
--- a/gdb/features/rs6000/power-htm-vsx.xml
+++ b/gdb/features/rs6000/power-htm-vsx.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-linux-pmu.xml b/gdb/features/rs6000/power-linux-pmu.xml
index 7f44bbc..791ed0a 100644
--- a/gdb/features/rs6000/power-linux-pmu.xml
+++ b/gdb/features/rs6000/power-linux-pmu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-linux.xml b/gdb/features/rs6000/power-linux.xml
index 6e98bd4..22d1ced 100644
--- a/gdb/features/rs6000/power-linux.xml
+++ b/gdb/features/rs6000/power-linux.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-oea.xml b/gdb/features/rs6000/power-oea.xml
index fd9bcca..7c35eb8 100644
--- a/gdb/features/rs6000/power-oea.xml
+++ b/gdb/features/rs6000/power-oea.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-ppr.xml b/gdb/features/rs6000/power-ppr.xml
index 2f34a21..13f4886 100644
--- a/gdb/features/rs6000/power-ppr.xml
+++ b/gdb/features/rs6000/power-ppr.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-spe.xml b/gdb/features/rs6000/power-spe.xml
index b04aca6..4eafcb1 100644
--- a/gdb/features/rs6000/power-spe.xml
+++ b/gdb/features/rs6000/power-spe.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-tar.xml b/gdb/features/rs6000/power-tar.xml
index d282716..5584c75 100644
--- a/gdb/features/rs6000/power-tar.xml
+++ b/gdb/features/rs6000/power-tar.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power-vsx.xml b/gdb/features/rs6000/power-vsx.xml
index 334345a..0823027 100644
--- a/gdb/features/rs6000/power-vsx.xml
+++ b/gdb/features/rs6000/power-vsx.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power64-core.xml b/gdb/features/rs6000/power64-core.xml
index c2f6a90..e6161bb 100644
--- a/gdb/features/rs6000/power64-core.xml
+++ b/gdb/features/rs6000/power64-core.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power64-htm-core.xml b/gdb/features/rs6000/power64-htm-core.xml
index 3e509ee..fc47fa5 100644
--- a/gdb/features/rs6000/power64-htm-core.xml
+++ b/gdb/features/rs6000/power64-htm-core.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/power64-linux.xml b/gdb/features/rs6000/power64-linux.xml
index c0ae303..7d2962a 100644
--- a/gdb/features/rs6000/power64-linux.xml
+++ b/gdb/features/rs6000/power64-linux.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-32.xml b/gdb/features/rs6000/powerpc-32.xml
index d81c28f..dbc3dc1 100644
--- a/gdb/features/rs6000/powerpc-32.xml
+++ b/gdb/features/rs6000/powerpc-32.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-32l.xml b/gdb/features/rs6000/powerpc-32l.xml
index 2a5c0a5..1df3cd8 100644
--- a/gdb/features/rs6000/powerpc-32l.xml
+++ b/gdb/features/rs6000/powerpc-32l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-403.xml b/gdb/features/rs6000/powerpc-403.xml
index 167ca89..5138b00 100644
--- a/gdb/features/rs6000/powerpc-403.xml
+++ b/gdb/features/rs6000/powerpc-403.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-403gc.xml b/gdb/features/rs6000/powerpc-403gc.xml
index fc6aa56..5de8026 100644
--- a/gdb/features/rs6000/powerpc-403gc.xml
+++ b/gdb/features/rs6000/powerpc-403gc.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-405.xml b/gdb/features/rs6000/powerpc-405.xml
index f027d24..379b9ab 100644
--- a/gdb/features/rs6000/powerpc-405.xml
+++ b/gdb/features/rs6000/powerpc-405.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2009-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-505.xml b/gdb/features/rs6000/powerpc-505.xml
index c17f95a..916e8f5 100644
--- a/gdb/features/rs6000/powerpc-505.xml
+++ b/gdb/features/rs6000/powerpc-505.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-601.xml b/gdb/features/rs6000/powerpc-601.xml
index e1e45fc..82e7d48 100644
--- a/gdb/features/rs6000/powerpc-601.xml
+++ b/gdb/features/rs6000/powerpc-601.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-602.xml b/gdb/features/rs6000/powerpc-602.xml
index 45677b8..14ba3af 100644
--- a/gdb/features/rs6000/powerpc-602.xml
+++ b/gdb/features/rs6000/powerpc-602.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-603.xml b/gdb/features/rs6000/powerpc-603.xml
index ea77ecf..cd949c4 100644
--- a/gdb/features/rs6000/powerpc-603.xml
+++ b/gdb/features/rs6000/powerpc-603.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-604.xml b/gdb/features/rs6000/powerpc-604.xml
index 2b2e4c5..8da101d 100644
--- a/gdb/features/rs6000/powerpc-604.xml
+++ b/gdb/features/rs6000/powerpc-604.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-64.xml b/gdb/features/rs6000/powerpc-64.xml
index 6590817..d20e99c 100644
--- a/gdb/features/rs6000/powerpc-64.xml
+++ b/gdb/features/rs6000/powerpc-64.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-64l.xml b/gdb/features/rs6000/powerpc-64l.xml
index 808512e..3d205f4 100644
--- a/gdb/features/rs6000/powerpc-64l.xml
+++ b/gdb/features/rs6000/powerpc-64l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-7400.xml b/gdb/features/rs6000/powerpc-7400.xml
index 0197721..2e4ef38 100644
--- a/gdb/features/rs6000/powerpc-7400.xml
+++ b/gdb/features/rs6000/powerpc-7400.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-750.xml b/gdb/features/rs6000/powerpc-750.xml
index fce28c0..797df49 100644
--- a/gdb/features/rs6000/powerpc-750.xml
+++ b/gdb/features/rs6000/powerpc-750.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-860.xml b/gdb/features/rs6000/powerpc-860.xml
index 386001d..9d91255 100644
--- a/gdb/features/rs6000/powerpc-860.xml
+++ b/gdb/features/rs6000/powerpc-860.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-altivec32.xml b/gdb/features/rs6000/powerpc-altivec32.xml
index c16b586..0a3b7e8 100644
--- a/gdb/features/rs6000/powerpc-altivec32.xml
+++ b/gdb/features/rs6000/powerpc-altivec32.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-altivec32l.xml b/gdb/features/rs6000/powerpc-altivec32l.xml
index 6c4388a..9858195 100644
--- a/gdb/features/rs6000/powerpc-altivec32l.xml
+++ b/gdb/features/rs6000/powerpc-altivec32l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-altivec64.xml b/gdb/features/rs6000/powerpc-altivec64.xml
index fed5242..56263d6 100644
--- a/gdb/features/rs6000/powerpc-altivec64.xml
+++ b/gdb/features/rs6000/powerpc-altivec64.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-altivec64l.xml b/gdb/features/rs6000/powerpc-altivec64l.xml
index 21b84a2..4db7691 100644
--- a/gdb/features/rs6000/powerpc-altivec64l.xml
+++ b/gdb/features/rs6000/powerpc-altivec64l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-e500.xml b/gdb/features/rs6000/powerpc-e500.xml
index f793667..98b8273 100644
--- a/gdb/features/rs6000/powerpc-e500.xml
+++ b/gdb/features/rs6000/powerpc-e500.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-e500l.xml b/gdb/features/rs6000/powerpc-e500l.xml
index 9f0f84a..11d656b 100644
--- a/gdb/features/rs6000/powerpc-e500l.xml
+++ b/gdb/features/rs6000/powerpc-e500l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-isa205-32l.xml b/gdb/features/rs6000/powerpc-isa205-32l.xml
index 74931bb..927c2de 100644
--- a/gdb/features/rs6000/powerpc-isa205-32l.xml
+++ b/gdb/features/rs6000/powerpc-isa205-32l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-isa205-64l.xml b/gdb/features/rs6000/powerpc-isa205-64l.xml
index c274765..c99c86c 100644
--- a/gdb/features/rs6000/powerpc-isa205-64l.xml
+++ b/gdb/features/rs6000/powerpc-isa205-64l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-isa205-altivec32l.xml b/gdb/features/rs6000/powerpc-isa205-altivec32l.xml
index fe70722..54c9637 100644
--- a/gdb/features/rs6000/powerpc-isa205-altivec32l.xml
+++ b/gdb/features/rs6000/powerpc-isa205-altivec32l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-isa205-altivec64l.xml b/gdb/features/rs6000/powerpc-isa205-altivec64l.xml
index 1a7c28e..4c863e5 100644
--- a/gdb/features/rs6000/powerpc-isa205-altivec64l.xml
+++ b/gdb/features/rs6000/powerpc-isa205-altivec64l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml b/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml
index 75b651c..9b953eb 100644
--- a/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml
+++ b/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml b/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml
index c6f81b1..2661f9c 100644
--- a/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml
+++ b/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-isa205-vsx32l.xml b/gdb/features/rs6000/powerpc-isa205-vsx32l.xml
index dead8e4..0c89e30 100644
--- a/gdb/features/rs6000/powerpc-isa205-vsx32l.xml
+++ b/gdb/features/rs6000/powerpc-isa205-vsx32l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-isa205-vsx64l.xml b/gdb/features/rs6000/powerpc-isa205-vsx64l.xml
index 89c9fcb..ca87da3 100644
--- a/gdb/features/rs6000/powerpc-isa205-vsx64l.xml
+++ b/gdb/features/rs6000/powerpc-isa205-vsx64l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-isa207-htm-vsx32l.xml b/gdb/features/rs6000/powerpc-isa207-htm-vsx32l.xml
index 9c8b357..374e3cf 100644
--- a/gdb/features/rs6000/powerpc-isa207-htm-vsx32l.xml
+++ b/gdb/features/rs6000/powerpc-isa207-htm-vsx32l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-isa207-htm-vsx64l.xml b/gdb/features/rs6000/powerpc-isa207-htm-vsx64l.xml
index 893541c..7b9dafb 100644
--- a/gdb/features/rs6000/powerpc-isa207-htm-vsx64l.xml
+++ b/gdb/features/rs6000/powerpc-isa207-htm-vsx64l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-isa207-vsx32l.xml b/gdb/features/rs6000/powerpc-isa207-vsx32l.xml
index 6c1dab6..4c9710e 100644
--- a/gdb/features/rs6000/powerpc-isa207-vsx32l.xml
+++ b/gdb/features/rs6000/powerpc-isa207-vsx32l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-isa207-vsx64l.xml b/gdb/features/rs6000/powerpc-isa207-vsx64l.xml
index 746eeaa..19cfdb8 100644
--- a/gdb/features/rs6000/powerpc-isa207-vsx64l.xml
+++ b/gdb/features/rs6000/powerpc-isa207-vsx64l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-vsx32.xml b/gdb/features/rs6000/powerpc-vsx32.xml
index a9ecc4e..c2d516f 100644
--- a/gdb/features/rs6000/powerpc-vsx32.xml
+++ b/gdb/features/rs6000/powerpc-vsx32.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-vsx32l.xml b/gdb/features/rs6000/powerpc-vsx32l.xml
index 73e61ce..4d00297 100644
--- a/gdb/features/rs6000/powerpc-vsx32l.xml
+++ b/gdb/features/rs6000/powerpc-vsx32l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-vsx64.xml b/gdb/features/rs6000/powerpc-vsx64.xml
index 57f2902..53db22c 100644
--- a/gdb/features/rs6000/powerpc-vsx64.xml
+++ b/gdb/features/rs6000/powerpc-vsx64.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/powerpc-vsx64l.xml b/gdb/features/rs6000/powerpc-vsx64l.xml
index 9165bc2..c3cd31d 100644
--- a/gdb/features/rs6000/powerpc-vsx64l.xml
+++ b/gdb/features/rs6000/powerpc-vsx64l.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rs6000/rs6000.xml b/gdb/features/rs6000/rs6000.xml
index 7f65c7e..f3820f9 100644
--- a/gdb/features/rs6000/rs6000.xml
+++ b/gdb/features/rs6000/rs6000.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/rx.xml b/gdb/features/rx.xml
index a103f83..201db4f 100644
--- a/gdb/features/rx.xml
+++ b/gdb/features/rx.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2019-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-acr.xml b/gdb/features/s390-acr.xml
index 3200f3c..055155e 100644
--- a/gdb/features/s390-acr.xml
+++ b/gdb/features/s390-acr.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-core32.xml b/gdb/features/s390-core32.xml
index 8f64ed1..0e4008f 100644
--- a/gdb/features/s390-core32.xml
+++ b/gdb/features/s390-core32.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-core64.xml b/gdb/features/s390-core64.xml
index 771f2b2..1d6d1b1 100644
--- a/gdb/features/s390-core64.xml
+++ b/gdb/features/s390-core64.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-fpr.xml b/gdb/features/s390-fpr.xml
index 02db0b1..71a0da4 100644
--- a/gdb/features/s390-fpr.xml
+++ b/gdb/features/s390-fpr.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-gs-linux64.xml b/gdb/features/s390-gs-linux64.xml
index e33e8a4..5de9825 100644
--- a/gdb/features/s390-gs-linux64.xml
+++ b/gdb/features/s390-gs-linux64.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2017-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-gs.xml b/gdb/features/s390-gs.xml
index 16bdac8..c9bb317 100644
--- a/gdb/features/s390-gs.xml
+++ b/gdb/features/s390-gs.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2017-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-gsbc.xml b/gdb/features/s390-gsbc.xml
index fae2aa7..b6db229 100644
--- a/gdb/features/s390-gsbc.xml
+++ b/gdb/features/s390-gsbc.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2017-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-linux32.xml b/gdb/features/s390-linux32.xml
index 6a51c21..cfc775f 100644
--- a/gdb/features/s390-linux32.xml
+++ b/gdb/features/s390-linux32.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-linux32v1.xml b/gdb/features/s390-linux32v1.xml
index 6378076..a553734 100644
--- a/gdb/features/s390-linux32v1.xml
+++ b/gdb/features/s390-linux32v1.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-linux32v2.xml b/gdb/features/s390-linux32v2.xml
index 0646ce3..f64906d 100644
--- a/gdb/features/s390-linux32v2.xml
+++ b/gdb/features/s390-linux32v2.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-linux64.xml b/gdb/features/s390-linux64.xml
index e8d8f03..45bf154 100644
--- a/gdb/features/s390-linux64.xml
+++ b/gdb/features/s390-linux64.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-linux64v1.xml b/gdb/features/s390-linux64v1.xml
index fc63a16..2e68af8 100644
--- a/gdb/features/s390-linux64v1.xml
+++ b/gdb/features/s390-linux64v1.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-linux64v2.xml b/gdb/features/s390-linux64v2.xml
index 3d0c9f9..09c0727 100644
--- a/gdb/features/s390-linux64v2.xml
+++ b/gdb/features/s390-linux64v2.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-tdb.xml b/gdb/features/s390-tdb.xml
index fb97117..4b78a7b 100644
--- a/gdb/features/s390-tdb.xml
+++ b/gdb/features/s390-tdb.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-te-linux64.xml b/gdb/features/s390-te-linux64.xml
index 399053a..910a97c 100644
--- a/gdb/features/s390-te-linux64.xml
+++ b/gdb/features/s390-te-linux64.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-tevx-linux64.xml b/gdb/features/s390-tevx-linux64.xml
index 2dbb039..a985c57 100644
--- a/gdb/features/s390-tevx-linux64.xml
+++ b/gdb/features/s390-tevx-linux64.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2015-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-vx-linux64.xml b/gdb/features/s390-vx-linux64.xml
index 6b32bf8..6013d3a 100644
--- a/gdb/features/s390-vx-linux64.xml
+++ b/gdb/features/s390-vx-linux64.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2015-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390-vx.xml b/gdb/features/s390-vx.xml
index c86ed2b..c5eee12 100644
--- a/gdb/features/s390-vx.xml
+++ b/gdb/features/s390-vx.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2015-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390x-core64.xml b/gdb/features/s390x-core64.xml
index 0e4aaa5..c5af641 100644
--- a/gdb/features/s390x-core64.xml
+++ b/gdb/features/s390x-core64.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390x-gs-linux64.xml b/gdb/features/s390x-gs-linux64.xml
index c41e460..727d9cc 100644
--- a/gdb/features/s390x-gs-linux64.xml
+++ b/gdb/features/s390x-gs-linux64.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2017-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390x-linux64.xml b/gdb/features/s390x-linux64.xml
index 31afe82..0a3e0fd 100644
--- a/gdb/features/s390x-linux64.xml
+++ b/gdb/features/s390x-linux64.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390x-linux64v1.xml b/gdb/features/s390x-linux64v1.xml
index 8aa26b4..4772e63 100644
--- a/gdb/features/s390x-linux64v1.xml
+++ b/gdb/features/s390x-linux64v1.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390x-linux64v2.xml b/gdb/features/s390x-linux64v2.xml
index 3769a75..78f68e0 100644
--- a/gdb/features/s390x-linux64v2.xml
+++ b/gdb/features/s390x-linux64v2.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390x-te-linux64.xml b/gdb/features/s390x-te-linux64.xml
index c48831d..57e2e9b 100644
--- a/gdb/features/s390x-te-linux64.xml
+++ b/gdb/features/s390x-te-linux64.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390x-tevx-linux64.xml b/gdb/features/s390x-tevx-linux64.xml
index a53bfff..5732e6f 100644
--- a/gdb/features/s390x-tevx-linux64.xml
+++ b/gdb/features/s390x-tevx-linux64.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2015-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/s390x-vx-linux64.xml b/gdb/features/s390x-vx-linux64.xml
index fcf75de..cc84b37 100644
--- a/gdb/features/s390x-vx-linux64.xml
+++ b/gdb/features/s390x-vx-linux64.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2015-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/sparc/sparc32-cp0.xml b/gdb/features/sparc/sparc32-cp0.xml
index baa80c2..a7f6e64 100644
--- a/gdb/features/sparc/sparc32-cp0.xml
+++ b/gdb/features/sparc/sparc32-cp0.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/sparc/sparc32-cpu.xml b/gdb/features/sparc/sparc32-cpu.xml
index 43c4768..b28c533 100644
--- a/gdb/features/sparc/sparc32-cpu.xml
+++ b/gdb/features/sparc/sparc32-cpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/sparc/sparc32-fpu.xml b/gdb/features/sparc/sparc32-fpu.xml
index e0de97b..289c1d2 100644
--- a/gdb/features/sparc/sparc32-fpu.xml
+++ b/gdb/features/sparc/sparc32-fpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/sparc/sparc32-solaris.xml b/gdb/features/sparc/sparc32-solaris.xml
index 7a88743..c6c29d5 100644
--- a/gdb/features/sparc/sparc32-solaris.xml
+++ b/gdb/features/sparc/sparc32-solaris.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/sparc/sparc64-cp0.xml b/gdb/features/sparc/sparc64-cp0.xml
index 473198b..cef58f3 100644
--- a/gdb/features/sparc/sparc64-cp0.xml
+++ b/gdb/features/sparc/sparc64-cp0.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/sparc/sparc64-cpu.xml b/gdb/features/sparc/sparc64-cpu.xml
index 7f4802d..b8a66d9 100644
--- a/gdb/features/sparc/sparc64-cpu.xml
+++ b/gdb/features/sparc/sparc64-cpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/sparc/sparc64-fpu.xml b/gdb/features/sparc/sparc64-fpu.xml
index 8710585..cef935e 100644
--- a/gdb/features/sparc/sparc64-fpu.xml
+++ b/gdb/features/sparc/sparc64-fpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/sparc/sparc64-solaris.xml b/gdb/features/sparc/sparc64-solaris.xml
index 8c4b67b..afaf64f 100644
--- a/gdb/features/sparc/sparc64-solaris.xml
+++ b/gdb/features/sparc/sparc64-solaris.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2013-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/threads.dtd b/gdb/features/threads.dtd
index 862fb62..f2e5614 100644
--- a/gdb/features/threads.dtd
+++ b/gdb/features/threads.dtd
@@ -1,4 +1,4 @@
-<!-- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2008-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/tic6x-c62x-linux.xml b/gdb/features/tic6x-c62x-linux.xml
index 180d55e..b0d1f08 100644
--- a/gdb/features/tic6x-c62x-linux.xml
+++ b/gdb/features/tic6x-c62x-linux.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/tic6x-c64x-linux.xml b/gdb/features/tic6x-c64x-linux.xml
index 6c3ccfd..4b1d22c 100644
--- a/gdb/features/tic6x-c64x-linux.xml
+++ b/gdb/features/tic6x-c64x-linux.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/tic6x-c64xp-linux.xml b/gdb/features/tic6x-c64xp-linux.xml
index e2c6916..a0103f6 100644
--- a/gdb/features/tic6x-c64xp-linux.xml
+++ b/gdb/features/tic6x-c64xp-linux.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/tic6x-c6xp.xml b/gdb/features/tic6x-c6xp.xml
index 1fca5b3..e549f7e 100644
--- a/gdb/features/tic6x-c6xp.xml
+++ b/gdb/features/tic6x-c6xp.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/tic6x-core.xml b/gdb/features/tic6x-core.xml
index d577202..1fe0f19 100644
--- a/gdb/features/tic6x-core.xml
+++ b/gdb/features/tic6x-core.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/tic6x-gp.xml b/gdb/features/tic6x-gp.xml
index 0d2fd83..60b96b1 100644
--- a/gdb/features/tic6x-gp.xml
+++ b/gdb/features/tic6x-gp.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/traceframe-info.dtd b/gdb/features/traceframe-info.dtd
index 52e0c6f..77a84bd 100644
--- a/gdb/features/traceframe-info.dtd
+++ b/gdb/features/traceframe-info.dtd
@@ -1,4 +1,4 @@
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/xinclude.dtd b/gdb/features/xinclude.dtd
index 59e92ae..9dfdc27 100644
--- a/gdb/features/xinclude.dtd
+++ b/gdb/features/xinclude.dtd
@@ -1,4 +1,4 @@
-<!-- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2007-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/z80-cpu.xml b/gdb/features/z80-cpu.xml
index b29fd5d..0bce3b1 100644
--- a/gdb/features/z80-cpu.xml
+++ b/gdb/features/z80-cpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2020-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/features/z80.xml b/gdb/features/z80.xml
index 9d71f82..c697bfb 100644
--- a/gdb/features/z80.xml
+++ b/gdb/features/z80.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2020-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/filename-seen-cache.h b/gdb/filename-seen-cache.h
index 3cac93f..0e25ecb 100644
--- a/gdb/filename-seen-cache.h
+++ b/gdb/filename-seen-cache.h
@@ -1,6 +1,6 @@
/* Filename-seen cache for the GNU debugger, GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/filesystem.c b/gdb/filesystem.c
index 564bc1c..a272c13 100644
--- a/gdb/filesystem.c
+++ b/gdb/filesystem.c
@@ -1,6 +1,6 @@
/* Handle different target file systems for GDB, the GNU Debugger.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -76,9 +76,7 @@ is \"%s\".\n"),
value);
}
-void _initialize_filesystem ();
-void
-_initialize_filesystem ()
+INIT_GDB_FILE (filesystem)
{
add_setshow_enum_cmd ("target-file-system-kind",
class_files,
diff --git a/gdb/filesystem.h b/gdb/filesystem.h
index 73b9a8b..8a06595 100644
--- a/gdb/filesystem.h
+++ b/gdb/filesystem.h
@@ -1,5 +1,5 @@
/* Handle different target file systems for GDB, the GNU Debugger.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/findcmd.c b/gdb/findcmd.c
index a802efe..03c3fcc 100644
--- a/gdb/findcmd.c
+++ b/gdb/findcmd.c
@@ -1,6 +1,6 @@
/* The find command.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "arch-utils.h"
-#include <ctype.h>
#include "cli/cli-cmds.h"
#include "value.h"
#include "target.h"
@@ -76,12 +75,12 @@ parse_find_args (const char *args, ULONGEST *max_countp,
{
++s;
- while (*s != '\0' && *s != '/' && !isspace (*s))
+ while (*s != '\0' && *s != '/' && !c_isspace (*s))
{
- if (isdigit (*s))
+ if (c_isdigit (*s))
{
max_count = atoi (s);
- while (isdigit (*s))
+ while (c_isdigit (*s))
++s;
continue;
}
@@ -279,9 +278,7 @@ find_command (const char *args, int from_tty)
found_count > 1 ? "s" : "");
}
-void _initialize_mem_search ();
-void
-_initialize_mem_search ()
+INIT_GDB_FILE (mem_search)
{
add_cmd ("find", class_vars, find_command, _("\
Search memory for a sequence of bytes.\n\
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 1a9d2be..41efc8d 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -1,6 +1,6 @@
/* Find a variable's value in memory, for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -65,14 +65,15 @@ value_of_register (int regnum, const frame_info_ptr &next_frame)
/* See value.h. */
value *
-value_of_register_lazy (const frame_info_ptr &next_frame, int regnum)
+value_of_register_lazy (const frame_info_ptr &next_frame, int regnum,
+ struct type *type)
{
gdbarch *gdbarch = frame_unwind_arch (next_frame);
gdb_assert (regnum < gdbarch_num_cooked_regs (gdbarch));
gdb_assert (next_frame != nullptr);
- return value::allocate_register_lazy (next_frame, regnum);
+ return value::allocate_register_lazy (next_frame, regnum, type);
}
/* Given a pointer of type TYPE in target form in BUF, return the
@@ -124,7 +125,7 @@ symbol_read_needs (struct symbol *sym)
computed_ops != nullptr)
return computed_ops->get_symbol_read_needs (sym);
- switch (sym->aclass ())
+ switch (sym->loc_class ())
{
/* All cases listed explicitly so that gcc -Wall will detect it if
we failed to consider one. */
@@ -306,7 +307,7 @@ language_defn::read_var_value (struct symbol *var,
if (const symbol_computed_ops *computed_ops = var->computed_ops ())
return computed_ops->read_variable (var, frame);
- switch (var->aclass ())
+ switch (var->loc_class ())
{
case LOC_CONST:
if (is_dynamic_type (type))
@@ -429,7 +430,7 @@ language_defn::read_var_value (struct symbol *var,
const symbol_register_ops *reg_ops = var->register_ops ();
int regno = reg_ops->register_number (var, get_frame_arch (frame));
- if (var->aclass () == LOC_REGPARM_ADDR)
+ if (var->loc_class () == LOC_REGPARM_ADDR)
addr = value_as_address
(value_from_register (lookup_pointer_type (type), regno, frame));
else
@@ -445,9 +446,8 @@ language_defn::read_var_value (struct symbol *var,
struct obj_section *obj_section;
bound_minimal_symbol bmsym;
- gdbarch_iterate_over_objfiles_in_search_order
- (var->arch (),
- [var, &bmsym] (objfile *objfile)
+ current_program_space->iterate_over_objfiles_in_search_order
+ ([var, &bmsym] (objfile *objfile)
{
bmsym = lookup_minimal_symbol (current_program_space,
var->linkage_name (), objfile);
@@ -485,7 +485,8 @@ language_defn::read_var_value (struct symbol *var,
/* Determine address of TLS variable. */
if (obj_section
&& (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0)
- addr = target_translate_tls_address (obj_section->objfile, addr);
+ addr = target_translate_tls_address (obj_section->objfile, addr,
+ var->print_name ());
}
break;
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 539b116..fd7f1e0 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -1,6 +1,6 @@
/* Fork a Unix child process, and set up to debug it, for GDB.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
Contributed by Cygnus Support.
@@ -153,9 +153,7 @@ show_startup_with_shell (struct ui_file *file, int from_tty,
value);
}
-void _initialize_fork_child ();
-void
-_initialize_fork_child ()
+INIT_GDB_FILE (fork_child)
{
add_setshow_filename_cmd ("exec-wrapper", class_run, &exec_wrapper, _("\
Set a wrapper for running programs.\n\
diff --git a/gdb/frame-base.c b/gdb/frame-base.c
index 7faa999..9179533 100644
--- a/gdb/frame-base.c
+++ b/gdb/frame-base.c
@@ -1,6 +1,6 @@
/* Definitions for frame address handler, for GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/frame-base.h b/gdb/frame-base.h
index 8436929..889d39c 100644
--- a/gdb/frame-base.h
+++ b/gdb/frame-base.h
@@ -1,6 +1,6 @@
/* Definitions for a frame base, for GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -32,7 +32,7 @@ struct regcache;
the NEXT frame's register unwind method, to determine the address
of THIS frame's `base'.
- The exact meaning of `base' is highly dependant on the type of the
+ The exact meaning of `base' is highly dependent on the type of the
debug info. It is assumed that dwarf2, stabs, ... will each
provide their own methods.
diff --git a/gdb/frame-id.h b/gdb/frame-id.h
index 30850e2..1828468 100644
--- a/gdb/frame-id.h
+++ b/gdb/frame-id.h
@@ -1,6 +1,6 @@
/* Definitions for dealing with stack frames, for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index 33b23f9..3709215 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -1,6 +1,6 @@
/* Definitions for frame unwinder, for GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -49,6 +49,7 @@ static constexpr std::initializer_list<const frame_unwind *>
standard_unwinders =
{
&dummy_frame_unwind,
+#if defined(DWARF_FORMAT_AVAILABLE)
/* The DWARF tailcall sniffer must come before the inline sniffer.
Otherwise, we can end up in a situation where a DWARF frame finds
tailcall information, but then the inline sniffer claims a frame
@@ -57,6 +58,7 @@ static constexpr std::initializer_list<const frame_unwind *>
activated if the newer frame was created using the DWARF
unwinder, and it also found tailcall information. */
&dwarf2_tailcall_frame_unwind,
+#endif
&inline_frame_unwind,
};
@@ -295,8 +297,16 @@ struct value *
frame_unwind_got_register (const frame_info_ptr &frame,
int regnum, int new_regnum)
{
+ struct gdbarch *gdbarch = frame_unwind_arch (frame);
+ struct type *regnum_type = register_type (gdbarch, regnum);
+ struct type *new_regnum_type = register_type (gdbarch, new_regnum);
+
+ /* REGNUM has been copied into NEW_REGNUM, therefore, the former
+ must be smaller or equal in size to the latter. */
+ gdb_assert (regnum_type->length () <= new_regnum_type->length ());
+
return value_of_register_lazy (get_next_frame_sentinel_okay (frame),
- new_regnum);
+ new_regnum, regnum_type);
}
/* Return a value which indicates that FRAME saved REGNUM in memory at
@@ -612,9 +622,7 @@ maintenance_enable_frame_unwinders (const char *args, int from_tty)
enable_disable_frame_unwinders (args, from_tty, true);
}
-void _initialize_frame_unwind ();
-void
-_initialize_frame_unwind ()
+INIT_GDB_FILE (frame_unwind)
{
/* Add "maint info frame-unwinders". */
add_cmd ("frame-unwinders",
diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h
index baf09ed..a967b7c 100644
--- a/gdb/frame-unwind.h
+++ b/gdb/frame-unwind.h
@@ -1,6 +1,6 @@
/* Definitions for a frame unwinder, for GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/frame.c b/gdb/frame.c
index 88560b8..5c41dcd 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1,6 +1,6 @@
/* Cache and manage frames for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -2617,7 +2617,7 @@ inside_main_func (const frame_info_ptr &this_frame)
SEARCH_FUNCTION_DOMAIN, nullptr);
/* This lookup should always yield a block-valued symbol. */
- if (bs.symbol != nullptr && bs.symbol->aclass () == LOC_BLOCK)
+ if (bs.symbol != nullptr && bs.symbol->loc_class () == LOC_BLOCK)
{
const struct block *block = bs.symbol->value_block ();
gdb_assert (block != nullptr);
@@ -2663,15 +2663,14 @@ get_prev_frame (const frame_info_ptr &this_frame)
{
FRAME_SCOPED_DEBUG_ENTER_EXIT;
- CORE_ADDR frame_pc;
- int frame_pc_p;
+ std::optional<CORE_ADDR> frame_pc;
/* There is always a frame. If this assertion fails, suspect that
something should be calling get_selected_frame() or
get_current_frame(). */
gdb_assert (this_frame != NULL);
- frame_pc_p = get_frame_pc_if_available (this_frame, &frame_pc);
+ frame_pc = get_frame_pc_if_available (this_frame);
/* tausq/2004-12-07: Dummy frames are skipped because it doesn't make much
sense to stop unwinding at a dummy frame. One place where a dummy
@@ -2686,7 +2685,7 @@ get_prev_frame (const frame_info_ptr &this_frame)
if (this_frame->level >= 0
&& get_frame_type (this_frame) == NORMAL_FRAME
&& !user_set_backtrace_options.backtrace_past_main
- && frame_pc_p
+ && frame_pc.has_value ()
&& inside_main_func (this_frame))
/* Don't unwind past main(). Note, this is done _before_ the
frame has been marked as previously unwound. That way if the
@@ -2733,7 +2732,7 @@ get_prev_frame (const frame_info_ptr &this_frame)
if (this_frame->level >= 0
&& get_frame_type (this_frame) == NORMAL_FRAME
&& !user_set_backtrace_options.backtrace_past_entry
- && frame_pc_p
+ && frame_pc.has_value ()
&& inside_entry_func (this_frame))
{
frame_debug_got_null_frame (this_frame, "inside entry func");
@@ -2747,7 +2746,7 @@ get_prev_frame (const frame_info_ptr &this_frame)
&& (get_frame_type (this_frame) == NORMAL_FRAME
|| get_frame_type (this_frame) == INLINE_FRAME)
&& get_frame_type (get_next_frame (this_frame)) == NORMAL_FRAME
- && frame_pc_p && frame_pc == 0)
+ && frame_pc.has_value () && *frame_pc == 0)
{
frame_debug_got_null_frame (this_frame, "zero PC");
return NULL;
@@ -2763,25 +2762,24 @@ get_frame_pc (const frame_info_ptr &frame)
return frame_unwind_pc (frame_info_ptr (frame->next));
}
-bool
-get_frame_pc_if_available (const frame_info_ptr &frame, CORE_ADDR *pc)
+std::optional<CORE_ADDR>
+get_frame_pc_if_available (const frame_info_ptr &frame)
{
+ std::optional<CORE_ADDR> pc;
gdb_assert (frame->next != NULL);
try
{
- *pc = frame_unwind_pc (frame_info_ptr (frame->next));
+ pc = frame_unwind_pc (frame_info_ptr (frame->next));
}
catch (const gdb_exception_error &ex)
{
- if (ex.error == NOT_AVAILABLE_ERROR)
- return false;
- else
+ if (ex.error != NOT_AVAILABLE_ERROR)
throw;
}
- return true;
+ return pc;
}
/* Return an address that falls within THIS_FRAME's code block. */
@@ -2870,7 +2868,7 @@ find_frame_sal (const frame_info_ptr &frame)
{
frame_info_ptr next_frame;
int notcurrent;
- CORE_ADDR pc;
+ std::optional<CORE_ADDR> pc;
if (frame_inlined_callees (frame) > 0)
{
@@ -2914,11 +2912,11 @@ find_frame_sal (const frame_info_ptr &frame)
PC and such a PC indicates the current (rather than next)
instruction/line, consequently, for such cases, want to get the
line containing fi->pc. */
- if (!get_frame_pc_if_available (frame, &pc))
+ if (!(pc = get_frame_pc_if_available (frame)))
return {};
- notcurrent = (pc != get_frame_address_in_block (frame));
- return find_pc_line (pc, notcurrent);
+ notcurrent = (*pc != get_frame_address_in_block (frame));
+ return find_pc_line (*pc, notcurrent);
}
/* Per "frame.h", return the ``address'' of the frame. Code should
@@ -3424,9 +3422,7 @@ frame_info_ptr::reinflate () const
return m_ptr;
}
-void _initialize_frame ();
-void
-_initialize_frame ()
+INIT_GDB_FILE (frame)
{
obstack_init (&frame_cache_obstack);
diff --git a/gdb/frame.h b/gdb/frame.h
index e207c71..99a7983 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -1,6 +1,6 @@
/* Definitions for dealing with stack frames, for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -504,7 +504,8 @@ extern CORE_ADDR get_frame_pc (const frame_info_ptr &);
/* Same as get_frame_pc, but return a boolean indication of whether
the PC is actually available, instead of throwing an error. */
-extern bool get_frame_pc_if_available (const frame_info_ptr &frame, CORE_ADDR *pc);
+extern std::optional<CORE_ADDR> get_frame_pc_if_available
+ (const frame_info_ptr &frame);
/* An address (not necessarily aligned to an instruction boundary)
that falls within THIS frame's code block.
@@ -586,7 +587,7 @@ void set_current_sal_from_frame (const frame_info_ptr &);
the old get_frame_base method was not sufficient.
get_frame_base_address: get_frame_locals_address:
- get_frame_args_address: A set of high-level debug-info dependant
+ get_frame_args_address: A set of high-level debug-info dependent
addresses that fall within the frame. These addresses almost
certainly will not match the stack address part of a frame ID (as
returned by get_frame_base).
diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c
index 4941e4a..2a0fe1b 100644
--- a/gdb/frv-linux-tdep.c
+++ b/gdb/frv-linux-tdep.c
@@ -1,7 +1,7 @@
/* Target-dependent code for GNU/Linux running on the Fujitsu FR-V,
for GDB.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -482,9 +482,7 @@ frv_linux_elf_osabi_sniffer (bfd *abfd)
return GDB_OSABI_UNKNOWN;
}
-void _initialize_frv_linux_tdep ();
-void
-_initialize_frv_linux_tdep ()
+INIT_GDB_FILE (frv_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_frv, 0, GDB_OSABI_LINUX,
frv_linux_init_abi);
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index b022cc7..b2d6e1a 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the Fujitsu FR-V, for GDB, the GNU Debugger.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -25,6 +25,7 @@
#include "frame.h"
#include "frame-unwind.h"
#include "frame-base.h"
+#include "solib-frv.h"
#include "trad-frame.h"
#include "dis-asm.h"
#include "sim-regno.h"
@@ -1554,7 +1555,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_convert_from_func_ptr_addr (gdbarch,
frv_convert_from_func_ptr_addr);
- set_gdbarch_so_ops (gdbarch, &frv_so_ops);
+ set_gdbarch_make_solib_ops (gdbarch, make_frv_solib_ops);
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
@@ -1569,9 +1570,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_frv_tdep ();
-void
-_initialize_frv_tdep ()
+INIT_GDB_FILE (frv_tdep)
{
gdbarch_register (bfd_arch_frv, frv_gdbarch_init);
}
diff --git a/gdb/frv-tdep.h b/gdb/frv-tdep.h
index 0d78ec4..7b51b42 100644
--- a/gdb/frv-tdep.h
+++ b/gdb/frv-tdep.h
@@ -1,5 +1,5 @@
/* Architecture-dependent code for the Fujitsu FR-V, for GDB, the GNU Debugger.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -118,7 +118,4 @@ CORE_ADDR frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point);
needed for TLS support. */
CORE_ADDR frv_fetch_objfile_link_map (struct objfile *objfile);
-struct solib_ops;
-extern const solib_ops frv_so_ops;
-
#endif /* GDB_FRV_TDEP_H */
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index 2ef77a2..3384929 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for FT32.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -310,7 +310,7 @@ ft32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
return sal.end;
}
}
- /* No useable line symbol. Use result of prologue parsing method. */
+ /* No usable line symbol. Use result of prologue parsing method. */
return plg_end;
}
}
@@ -621,9 +621,7 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Register this machine's init routine. */
-void _initialize_ft32_tdep ();
-void
-_initialize_ft32_tdep ()
+INIT_GDB_FILE (ft32_tdep)
{
gdbarch_register (bfd_arch_ft32, ft32_gdbarch_init);
}
diff --git a/gdb/ft32-tdep.h b/gdb/ft32-tdep.h
index ee4a247..73ceed0 100644
--- a/gdb/ft32-tdep.h
+++ b/gdb/ft32-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for the FT32.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/gcore-1.in b/gdb/gcore-1.in
index c0979a5..fe2bb3d 100644..100755
--- a/gdb/gcore-1.in
+++ b/gdb/gcore-1.in
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,13 +32,16 @@ dump_all_cmds=()
data_directory_opt=()
+# The GDB binary to run.
+gdb_binary=
+
function print_usage() {
prefix="Usage: $0"
- paddin=$(printf '%*s' ${#prefix})
+ padding=$(printf '%*s' ${#prefix})
echo "$prefix [-h|--help] [-v|--version]"
- echo "$paddin [-a] [-o prefix] [-d data-directory]"
- echo "$paddin pid1 [pid2...pidN]"
+ echo "$padding [-a] [-o prefix] [-g gdb] [-d data-directory]"
+ echo "$padding pid1 [pid2...pidN]"
}
function print_try_help() {
@@ -55,6 +58,8 @@ function print_help() {
echo " -a Dump all memory mappings."
echo " -o prefix Use 'prefix.pid' as the core file name."
echo " The default prefix is 'core'."
+ echo " -g gdb The GDB binary to run."
+ echo " Defaults to GDB installed alongside gcore."
echo " -d dir Pass '--data-directory dir' as an argument"
echo " to GDB."
}
@@ -63,10 +68,10 @@ function print_version() {
echo "GNU gcore (${PKGVERSION}) ${VERSION}"
}
-while getopts vhao:d:-: OPT; do
+while getopts vhao:g:d:-: OPT; do
if [ "$OPT" = "-" ]; then
OPT="${OPTARG%%=*}"
- OPTARG="${OPTARG#'$OPT'}"
+ OPTARG="${OPTARG#"$OPT"}"
OPTARG="${OPTARG#=}"
fi
@@ -82,6 +87,9 @@ while getopts vhao:d:-: OPT; do
o)
prefix=$OPTARG
;;
+ g)
+ gdb_binary="$OPTARG"
+ ;;
d)
data_directory_opt=("--data-directory" "$OPTARG")
;;
@@ -119,13 +127,13 @@ fi
# Attempt to fetch the absolute path to the gcore script that was
# called.
-binary_path=`dirname "$0"`
+binary_path=$(dirname "$0")
-if test "x$binary_path" = x. ; then
+if test "$binary_path" = . ; then
# We got "." back as a path. This means the user executed
# the gcore script locally (i.e. ./gcore) or called the
# script via a shell interpreter (i.e. sh gcore).
- binary_basename=`basename "$0"`
+ binary_basename=$(basename "$0")
# If the gcore script was called like "sh gcore" and the script
# lives in the current directory, "which" will not give us "gcore".
@@ -139,15 +147,21 @@ if test "x$binary_path" = x. ; then
# The gcore script was not found in ".", which means the script
# was called from somewhere else in $PATH by "sh gcore".
# Extract the correct path now.
- binary_path_from_env=`which "$0"`
- binary_path=`dirname "$binary_path_from_env"`
+ binary_path_from_env=$(which "$0")
+ binary_path=$(dirname "$binary_path_from_env")
fi
fi
+if [ -z "$gdb_binary" ]; then
+ gdb_binary="$binary_path/@GDB_TRANSFORM_NAME@"
+fi
+
+gdb_binary_basename=$(basename "$gdb_binary")
+
# Check if the GDB binary is in the expected path. If not, just
# quit with a message.
-if [ ! -f "$binary_path/@GDB_TRANSFORM_NAME@" ]; then
- echo "gcore: GDB binary (${binary_path}/@GDB_TRANSFORM_NAME@) not found"
+if [ ! -f "$gdb_binary" ]; then
+ echo "gcore: GDB binary ($gdb_binary) not found"
exit 1
fi
@@ -159,7 +173,7 @@ for pid in "$@"
do
# `</dev/null' to avoid touching interactive terminal if it is
# available but not accessible as GDB would get stopped on SIGTTIN.
- "$binary_path/@GDB_TRANSFORM_NAME@" </dev/null \
+ "$gdb_binary" </dev/null \
"${data_directory_opt[@]}" \
--nx --batch --readnever -iex 'set debuginfod enabled off' \
-ex "set pagination off" -ex "set height 0" -ex "set width 0" \
@@ -169,7 +183,7 @@ do
if [ -r "$prefix.$pid" ] ; then
rc=0
else
- echo "@GCORE_TRANSFORM_NAME@: failed to create $prefix.$pid"
+ echo "$gdb_binary_basename: failed to create $prefix.$pid"
rc=1
break
fi
diff --git a/gdb/gcore-elf.c b/gdb/gcore-elf.c
index c88fa08..1e4376d 100644
--- a/gdb/gcore-elf.c
+++ b/gdb/gcore-elf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/gcore-elf.h b/gdb/gcore-elf.h
index 8217f0b..c43d0df 100644
--- a/gdb/gcore-elf.h
+++ b/gdb/gcore-elf.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/gcore.c b/gdb/gcore.c
index 969a854..e015f44 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -1,6 +1,6 @@
/* Generate a core file for the inferior process.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -398,8 +398,8 @@ make_output_phdrs (bfd *obfd, asection *osec)
DATA is 'bfd *' for the core file GDB is creating. */
static int
-gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
- int write, int exec, int modified, bool memory_tagged,
+gcore_create_callback (CORE_ADDR vaddr, unsigned long size, bool read,
+ bool write, bool exec, bool modified, bool memory_tagged,
void *data)
{
bfd *obfd = (bfd *) data;
@@ -409,7 +409,7 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
/* If the memory segment has no permissions set, ignore it, otherwise
when we later try to access it for read/write, we'll get an error
or jam the kernel. */
- if (read == 0 && write == 0 && exec == 0 && modified == 0)
+ if (!read && !write && !exec && !modified)
{
if (info_verbose)
gdb_printf ("Ignore segment, %s bytes at %s\n",
@@ -419,19 +419,19 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
return 0;
}
- if (write == 0 && modified == 0 && !solib_keep_data_in_core (vaddr, size))
+ if (!write && !modified && !solib_keep_data_in_core (vaddr, size))
{
/* See if this region of memory lies inside a known file on disk.
If so, we can avoid copying its contents by clearing SEC_LOAD. */
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section *objsec : objfile->sections ())
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &objsec : objfile.sections ())
{
- bfd *abfd = objfile->obfd.get ();
- asection *asec = objsec->the_bfd_section;
+ bfd *abfd = objfile.obfd.get ();
+ asection *asec = objsec.the_bfd_section;
bfd_vma align = (bfd_vma) 1 << bfd_section_alignment (asec);
- bfd_vma start = objsec->addr () & -align;
- bfd_vma end = (objsec->endaddr () + align - 1) & -align;
+ bfd_vma start = objsec.addr () & -align;
+ bfd_vma end = (objsec.endaddr () + align - 1) & -align;
/* Match if either the entire memory region lies inside the
section (i.e. a mapping covering some pages of a large
@@ -440,7 +440,7 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
This BFD was synthesized from reading target memory,
we don't want to omit that. */
- if (objfile->separate_debug_objfile_backlink == NULL
+ if (objfile.separate_debug_objfile_backlink == NULL
&& ((vaddr >= start && vaddr + size <= end)
|| (start >= vaddr && end <= vaddr + size))
&& !(bfd_get_file_flags (abfd) & BFD_IN_MEMORY))
@@ -453,7 +453,7 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
keep:;
}
- if (write == 0)
+ if (!write)
flags |= SEC_READONLY;
if (exec)
@@ -489,8 +489,8 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
static int
gcore_create_memtag_section_callback (CORE_ADDR vaddr, unsigned long size,
- int read, int write, int exec,
- int modified, bool memory_tagged,
+ bool read, bool write, bool exec,
+ bool modified, bool memory_tagged,
void *data)
{
/* Are there memory tags in this particular memory map entry? */
@@ -532,14 +532,14 @@ objfile_find_memory_regions (struct target_ops *self,
bfd_vma temp_bottom = 0, temp_top = 0;
/* Call callback function for each objfile section. */
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section *objsec : objfile->sections ())
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &objsec : objfile.sections ())
{
- asection *isec = objsec->the_bfd_section;
+ asection *isec = objsec.the_bfd_section;
flagword flags = bfd_section_flags (isec);
/* Separate debug info files are irrelevant for gcore. */
- if (objfile->separate_debug_objfile_backlink != NULL)
+ if (objfile.separate_debug_objfile_backlink != NULL)
continue;
if ((flags & SEC_ALLOC) || (flags & SEC_LOAD))
@@ -547,11 +547,11 @@ objfile_find_memory_regions (struct target_ops *self,
int size = bfd_section_size (isec);
int ret;
- ret = (*func) (objsec->addr (), size,
- 1, /* All sections will be readable. */
+ ret = (*func) (objsec.addr (), size,
+ true, /* All sections will be readable. */
(flags & SEC_READONLY) == 0, /* Writable. */
(flags & SEC_CODE) != 0, /* Executable. */
- 1, /* MODIFIED is unknown, pass it as true. */
+ true, /* MODIFIED is unknown, pass it as true. */
false, /* No memory tags in the object file. */
obfd);
if (ret != 0)
@@ -562,10 +562,10 @@ objfile_find_memory_regions (struct target_ops *self,
/* Make a stack segment. */
if (derive_stack_segment (&temp_bottom, &temp_top))
(*func) (temp_bottom, temp_top - temp_bottom,
- 1, /* Stack section will be readable. */
- 1, /* Stack section will be writable. */
- 0, /* Stack section will not be executable. */
- 1, /* Stack section will be modified. */
+ true, /* Stack section will be readable. */
+ true, /* Stack section will be writable. */
+ false, /* Stack section will not be executable. */
+ true, /* Stack section will be modified. */
false, /* No memory tags in the object file. */
obfd);
@@ -573,10 +573,10 @@ objfile_find_memory_regions (struct target_ops *self,
if (derive_heap_segment (current_program_space->exec_bfd (), &temp_bottom,
&temp_top))
(*func) (temp_bottom, temp_top - temp_bottom,
- 1, /* Heap section will be readable. */
- 1, /* Heap section will be writable. */
- 0, /* Heap section will not be executable. */
- 1, /* Heap section will be modified. */
+ true, /* Heap section will be readable. */
+ true, /* Heap section will be writable. */
+ false, /* Heap section will not be executable. */
+ true, /* Heap section will be modified. */
false, /* No memory tags in the object file. */
obfd);
@@ -850,9 +850,9 @@ gcore_find_signalled_thread ()
&& curr_thr->stop_signal () != GDB_SIGNAL_0)
return curr_thr;
- for (thread_info *thr : current_inferior ()->non_exited_threads ())
- if (thr->stop_signal () != GDB_SIGNAL_0)
- return thr;
+ for (thread_info &thr : current_inferior ()->non_exited_threads ())
+ if (thr.stop_signal () != GDB_SIGNAL_0)
+ return &thr;
/* Default to the current thread, unless it has exited. */
if (curr_thr->state != THREAD_EXITED)
@@ -861,9 +861,7 @@ gcore_find_signalled_thread ()
return nullptr;
}
-void _initialize_gcore ();
-void
-_initialize_gcore ()
+INIT_GDB_FILE (gcore)
{
cmd_list_element *generate_core_file_cmd
= add_com ("generate-core-file", class_files, gcore_command, _("\
diff --git a/gdb/gcore.h b/gdb/gcore.h
index 21e7a8d..48dc290 100644
--- a/gdb/gcore.h
+++ b/gdb/gcore.h
@@ -1,6 +1,6 @@
/* Support for reading/writing gcore files.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/gdb-code-style.el b/gdb/gdb-code-style.el
index c6e34c2..16e41d9 100644
--- a/gdb/gdb-code-style.el
+++ b/gdb/gdb-code-style.el
@@ -1,6 +1,6 @@
;;; gdb-code-style.el --- code style checker for GDB contributors
-;; Copyright (C) 2012-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2025 Free Software Foundation, Inc.
;; Author: Yao Qi <yao@codesourcery.com>
;; Created: 17 April 2012
diff --git a/gdb/gdb-demangle.c b/gdb/gdb-demangle.c
index ed5aca2..c285788 100644
--- a/gdb/gdb-demangle.c
+++ b/gdb/gdb-demangle.c
@@ -1,6 +1,6 @@
/* Basic C++ demangling support for GDB.
- Copyright (C) 1991-2024 Free Software Foundation, Inc.
+ Copyright (C) 1991-2025 Free Software Foundation, Inc.
Written by Fred Fish at Cygnus Support.
@@ -208,9 +208,7 @@ demangle_command (const char *args, int from_tty)
error (_("Can't demangle \"%s\""), name);
}
-void _initialize_gdb_demangle ();
-void
-_initialize_gdb_demangle ()
+INIT_GDB_FILE (gdb_demangle)
{
int i, ndems;
diff --git a/gdb/gdb-demangle.h b/gdb/gdb-demangle.h
index 86a8bd6..514481e 100644
--- a/gdb/gdb-demangle.h
+++ b/gdb/gdb-demangle.h
@@ -1,5 +1,5 @@
/* Basic C++ demangling support for GDB.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in
index d5d533a..1ce90b9 100644
--- a/gdb/gdb-gdb.gdb.in
+++ b/gdb/gdb-gdb.gdb.in
@@ -37,3 +37,9 @@ document pdie
Pretty print a DWARF DIE.
Syntax: pdie die [depth]
end
+
+# Trivial and uninteresting functions to skip.
+skip -rfu "^enum_flags<.*>::enum_flags"
+skip -rfu "^gdb::array_view<.*>::array_view"
+skip -rfu "^gdb::function_view<.*>::function_view"
+skip -rfu "^gdb::ref_ptr<.*>::get"
diff --git a/gdb/gdb-gdb.py.in b/gdb/gdb-gdb.py.in
index 7cab694..7388c6f 100644
--- a/gdb/gdb-gdb.py.in
+++ b/gdb/gdb-gdb.py.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
@@ -122,7 +122,7 @@ class StructTypePrettyPrinter:
class StructMainTypePrettyPrinter:
- """Pretty-print an objet of type main_type"""
+ """Pretty-print an object of type main_type"""
def __init__(self, val):
self.val = val
@@ -164,8 +164,10 @@ class StructMainTypePrettyPrinter:
return "physaddr = 0x%x" % loc_val["physaddr"]
elif loc_kind == "FIELD_LOC_KIND_PHYSNAME":
return "physname = %s" % loc_val["physname"]
- elif loc_kind == "FIELD_LOC_KIND_DWARF_BLOCK":
- return "dwarf_block = %s" % loc_val["dwarf_block"]
+ elif loc_kind == "FIELD_LOC_KIND_DWARF_BLOCK_ADDR":
+ return "dwarf_block_addr = %s" % loc_val["dwarf_block"]
+ elif loc_kind == "FIELD_LOC_KIND_DWARF_BLOCK_BITPOS":
+ return "dwarf_block_bitpos = %s" % loc_val["dwarf_block"]
else:
return "m_loc = ??? (unsupported m_loc_kind value)"
diff --git a/gdb/gdb-stabs.h b/gdb/gdb-stabs.h
index b76abe1..9909129 100644
--- a/gdb/gdb-stabs.h
+++ b/gdb/gdb-stabs.h
@@ -1,5 +1,5 @@
/* Definitions for symbol-reading containing "stabs", for GDB.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by John Gilmore.
This file is part of GDB.
@@ -20,9 +20,9 @@
#ifndef GDB_GDB_STABS_H
#define GDB_GDB_STABS_H
-/* During initial symbol readin, we need to have a structure to keep
+/* During initial symbol reading, we need to have a structure to keep
track of which psymtabs have which bincls in them. This structure
- is used during readin to setup the list of dependencies within each
+ is used during reading to setup the list of dependencies within each
partial symbol table. */
struct legacy_psymtab;
diff --git a/gdb/gdb.c b/gdb/gdb.c
index 5326df4..6e4358c 100644
--- a/gdb/gdb.c
+++ b/gdb/gdb.c
@@ -1,5 +1,5 @@
/* Main function for CLI gdb.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index 1a57b3c..4c641fe 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -1,6 +1,6 @@
/* Definitions for BFD wrappers used by GDB.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -33,18 +33,15 @@
#include "gdbsupport/fileio.h"
#include "inferior.h"
#include "cli/cli-style.h"
+#include "gdbsupport/cxx-thread.h"
#include "gdbsupport/unordered_map.h"
#include "gdbsupport/unordered_set.h"
-#if CXX_STD_THREAD
-
-#include <mutex>
-
/* Lock held when doing BFD operations. A recursive mutex is used
because we use this mutex internally and also for BFD, just to make
life a bit simpler, and we may sometimes hold it while calling into
BFD. */
-static std::recursive_mutex gdb_bfd_mutex;
+static gdb::recursive_mutex gdb_bfd_mutex;
/* BFD locking function. */
@@ -64,8 +61,6 @@ gdb_bfd_unlock (void *ignore)
return true;
}
-#endif /* CXX_STD_THREAD */
-
/* An object of this type is stored in the section's user data when
mapping a section. */
@@ -153,7 +148,6 @@ struct gdb_bfd_data
/* The registry. */
registry<bfd> registry_fields;
-#if CXX_STD_THREAD
/* Most of the locking needed for multi-threaded operation is
handled by BFD itself. However, the current BFD model is that
locking is only needed for global operations -- but it turned out
@@ -163,8 +157,7 @@ struct gdb_bfd_data
This lock is the fix: wrappers for important BFD functions will
acquire this lock before performing operations that might modify
the state of this BFD. */
- std::mutex per_bfd_mutex;
-#endif
+ gdb::mutex per_bfd_mutex;
};
registry<bfd> *
@@ -548,9 +541,7 @@ gdb_bfd_open (const char *name, const char *target, int fd,
name += strlen (TARGET_SYSROOT_PREFIX);
}
-#if CXX_STD_THREAD
- std::lock_guard<std::recursive_mutex> guard (gdb_bfd_mutex);
-#endif
+ gdb::lock_guard<gdb::recursive_mutex> guard (gdb_bfd_mutex);
if (fd == -1)
{
@@ -677,9 +668,7 @@ gdb_bfd_ref (struct bfd *abfd)
if (abfd == NULL)
return;
-#if CXX_STD_THREAD
- std::lock_guard<std::recursive_mutex> guard (gdb_bfd_mutex);
-#endif
+ gdb::lock_guard<gdb::recursive_mutex> guard (gdb_bfd_mutex);
gdata = (struct gdb_bfd_data *) bfd_usrdata (abfd);
@@ -709,9 +698,7 @@ gdb_bfd_unref (struct bfd *abfd)
if (abfd == NULL)
return;
-#if CXX_STD_THREAD
- std::lock_guard<std::recursive_mutex> guard (gdb_bfd_mutex);
-#endif
+ gdb::lock_guard<gdb::recursive_mutex> guard (gdb_bfd_mutex);
gdata = (struct gdb_bfd_data *) bfd_usrdata (abfd);
gdb_assert (gdata->refc >= 1);
@@ -779,10 +766,8 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
abfd = sectp->owner;
-#if CXX_STD_THREAD
gdb_bfd_data *gdata = (gdb_bfd_data *) bfd_usrdata (abfd);
- std::lock_guard<std::mutex> guard (gdata->per_bfd_mutex);
-#endif
+ gdb::lock_guard<gdb::mutex> guard (gdata->per_bfd_mutex);
descriptor = get_section_descriptor (sectp);
@@ -1115,10 +1100,8 @@ bool
gdb_bfd_get_full_section_contents (bfd *abfd, asection *section,
gdb::byte_vector *contents)
{
-#if CXX_STD_THREAD
gdb_bfd_data *gdata = (gdb_bfd_data *) bfd_usrdata (abfd);
- std::lock_guard<std::mutex> guard (gdata->per_bfd_mutex);
-#endif
+ gdb::lock_guard<gdb::mutex> guard (gdata->per_bfd_mutex);
bfd_size_type section_size = bfd_section_size (section);
@@ -1133,10 +1116,8 @@ gdb_bfd_get_full_section_contents (bfd *abfd, asection *section,
int
gdb_bfd_stat (bfd *abfd, struct stat *sbuf)
{
-#if CXX_STD_THREAD
gdb_bfd_data *gdata = (gdb_bfd_data *) bfd_usrdata (abfd);
- std::lock_guard<std::mutex> guard (gdata->per_bfd_mutex);
-#endif
+ gdb::lock_guard<gdb::mutex> guard (gdata->per_bfd_mutex);
return bfd_stat (abfd, sbuf);
}
@@ -1146,10 +1127,8 @@ gdb_bfd_stat (bfd *abfd, struct stat *sbuf)
long
gdb_bfd_get_mtime (bfd *abfd)
{
-#if CXX_STD_THREAD
gdb_bfd_data *gdata = (gdb_bfd_data *) bfd_usrdata (abfd);
- std::lock_guard<std::mutex> guard (gdata->per_bfd_mutex);
-#endif
+ gdb::lock_guard<gdb::mutex> guard (gdata->per_bfd_mutex);
return bfd_get_mtime (abfd);
}
@@ -1290,9 +1269,7 @@ get_bfd_inferior_data (struct inferior *inf)
static unsigned long
increment_bfd_error_count (const std::string &str)
{
-#if CXX_STD_THREAD
- std::lock_guard<std::recursive_mutex> guard (gdb_bfd_mutex);
-#endif
+ gdb::lock_guard<gdb::recursive_mutex> guard (gdb_bfd_mutex);
struct bfd_inferior_data *bid = get_bfd_inferior_data (current_inferior ());
auto &map = bid->bfd_error_string_counts;
@@ -1337,18 +1314,14 @@ gdb_bfd_init ()
{
if (bfd_init () == BFD_INIT_MAGIC)
{
-#if CXX_STD_THREAD
if (bfd_thread_init (gdb_bfd_lock, gdb_bfd_unlock, nullptr))
-#endif
return;
}
error (_("fatal error: libbfd ABI mismatch"));
}
-void _initialize_gdb_bfd ();
-void
-_initialize_gdb_bfd ()
+INIT_GDB_FILE (gdb_bfd)
{
add_cmd ("bfds", class_maintenance, maintenance_info_bfds, _("\
List the BFDs that are currently open."),
diff --git a/gdb/gdb_bfd.h b/gdb/gdb_bfd.h
index 7830bf3..eb4428e 100644
--- a/gdb/gdb_bfd.h
+++ b/gdb/gdb_bfd.h
@@ -1,6 +1,6 @@
/* Definitions for BFD wrappers used by GDB.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -24,7 +24,6 @@
#include "gdbsupport/byte-vector.h"
#include "gdbsupport/function-view.h"
#include "gdbsupport/gdb_ref_ptr.h"
-#include "gdbsupport/iterator-range.h"
#include "gdbsupport/next-iterator.h"
/* A registry adaptor for BFD. This arranges to store the registry in
@@ -242,13 +241,17 @@ using gdb_bfd_section_range = next_range<asection>;
static inline gdb_bfd_section_range
gdb_bfd_sections (bfd *abfd)
{
- return gdb_bfd_section_range (abfd->sections);
+ next_iterator<asection> begin (abfd->sections);
+
+ return gdb_bfd_section_range (std::move (begin));
}
static inline gdb_bfd_section_range
gdb_bfd_sections (const gdb_bfd_ref_ptr &abfd)
{
- return gdb_bfd_section_range (abfd->sections);
+ next_iterator<asection> begin (abfd->sections);
+
+ return gdb_bfd_section_range (std::move (begin));
};
/* A wrapper for bfd_stat that acquires the per-BFD lock on ABFD. */
diff --git a/gdb/gdb_buildall.sh b/gdb/gdb_buildall.sh
index c138c3c..2053333 100644
--- a/gdb/gdb_buildall.sh
+++ b/gdb/gdb_buildall.sh
@@ -2,7 +2,7 @@
# Build script to build GDB with all targets enabled.
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -261,7 +261,7 @@ echo "done."
# Clean up build directory if necessary.
if ${clean}
then
- echo "cleanning up $dir"
+ echo "cleaning up $dir"
rm -rf ${dir}
fi
diff --git a/gdb/gdb_curses.h b/gdb/gdb_curses.h
index d726864..b9d6514 100644
--- a/gdb/gdb_curses.h
+++ b/gdb/gdb_curses.h
@@ -1,6 +1,6 @@
/* Portable <curses.h>.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/gdb_expat.h b/gdb/gdb_expat.h
index 36cee80..6379cd9 100644
--- a/gdb/gdb_expat.h
+++ b/gdb/gdb_expat.h
@@ -1,6 +1,6 @@
/* Slightly more portable version of <expat.h>.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/gdb_mbuild.sh b/gdb/gdb_mbuild.sh
index 05bca0e..686af4c 100755
--- a/gdb/gdb_mbuild.sh
+++ b/gdb/gdb_mbuild.sh
@@ -3,7 +3,7 @@
# Multi-build script for testing compilation of all maintained
# configs of GDB.
-# Copyright (C) 2002-2024 Free Software Foundation, Inc.
+# Copyright (C) 2002-2025 Free Software Foundation, Inc.
# Contributed by Richard Earnshaw (rearnsha@arm.com)
diff --git a/gdb/gdb_proc_service.h b/gdb/gdb_proc_service.h
index c5e060b..f140adc 100644
--- a/gdb/gdb_proc_service.h
+++ b/gdb/gdb_proc_service.h
@@ -1,5 +1,5 @@
/* <proc_service.h> replacement for systems that don't have it.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/gdb_vfork.h b/gdb/gdb_vfork.h
index 69f4955..4d6b8a5 100644
--- a/gdb/gdb_vfork.h
+++ b/gdb/gdb_vfork.h
@@ -1,5 +1,5 @@
/* GDB-friendly replacement for <vfork.h>.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/gdb_wchar.h b/gdb/gdb_wchar.h
index 365f560..9db0d5e 100644
--- a/gdb/gdb_wchar.h
+++ b/gdb/gdb_wchar.h
@@ -1,5 +1,5 @@
/* Wide characters for gdb
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -113,8 +113,8 @@ typedef char gdb_wchar_t;
typedef int gdb_wint_t;
#define gdb_wcslen strlen
-#define gdb_iswprint isprint
-#define gdb_iswxdigit isxdigit
+#define gdb_iswprint c_isprint
+#define gdb_iswxdigit c_isxdigit
#define gdb_btowc /* empty */
#define gdb_WEOF EOF
diff --git a/gdb/gdbarch-gen.c b/gdb/gdbarch-gen.c
index 97d7ed9..7887b13 100644
--- a/gdb/gdbarch-gen.c
+++ b/gdb/gdbarch-gen.c
@@ -3,7 +3,7 @@
/* Dynamic architecture support for GDB, the GNU debugger.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -153,11 +153,11 @@ struct gdbarch
gdbarch_set_memtags_ftype *set_memtags = default_set_memtags;
gdbarch_get_memtag_ftype *get_memtag = default_get_memtag;
CORE_ADDR memtag_granule_size = 0;
- gdbarch_software_single_step_ftype *software_single_step = nullptr;
+ gdbarch_get_next_pcs_ftype *get_next_pcs = nullptr;
gdbarch_single_step_through_delay_ftype *single_step_through_delay = nullptr;
gdbarch_print_insn_ftype *print_insn = default_print_insn;
gdbarch_skip_trampoline_code_ftype *skip_trampoline_code = generic_skip_trampoline_code;
- const solib_ops * so_ops = &solib_target_so_ops;
+ gdbarch_make_solib_ops_ftype *make_solib_ops = make_target_solib_ops;
gdbarch_skip_solib_resolver_ftype *skip_solib_resolver = generic_skip_solib_resolver;
gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline = generic_in_solib_return_trampoline;
gdbarch_in_indirect_branch_thunk_ftype *in_indirect_branch_thunk = default_in_indirect_branch_thunk;
@@ -240,7 +240,6 @@ struct gdbarch
gdbarch_gen_return_address_ftype *gen_return_address = default_gen_return_address;
gdbarch_info_proc_ftype *info_proc = nullptr;
gdbarch_core_info_proc_ftype *core_info_proc = nullptr;
- gdbarch_iterate_over_objfiles_in_search_order_ftype *iterate_over_objfiles_in_search_order = default_iterate_over_objfiles_in_search_order;
struct ravenscar_arch_ops * ravenscar_ops = NULL;
gdbarch_insn_is_call_ftype *insn_is_call = default_insn_is_call;
gdbarch_insn_is_ret_ftype *insn_is_ret = default_insn_is_ret;
@@ -262,6 +261,8 @@ struct gdbarch
gdbarch_read_core_file_mappings_ftype *read_core_file_mappings = default_read_core_file_mappings;
gdbarch_use_target_description_from_corefile_notes_ftype *use_target_description_from_corefile_notes = default_use_target_description_from_corefile_notes;
gdbarch_core_parse_exec_context_ftype *core_parse_exec_context = default_core_parse_exec_context;
+ gdbarch_shadow_stack_push_ftype *shadow_stack_push = nullptr;
+ gdbarch_get_shadow_stack_pointer_ftype *get_shadow_stack_pointer = default_get_shadow_stack_pointer;
};
/* Create a new ``struct gdbarch'' based on information provided by
@@ -421,11 +422,11 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of set_memtags, invalid_p == 0. */
/* Skip verify of get_memtag, invalid_p == 0. */
/* Skip verify of memtag_granule_size, invalid_p == 0. */
- /* Skip verify of software_single_step, has predicate. */
+ /* Skip verify of get_next_pcs, has predicate. */
/* Skip verify of single_step_through_delay, has predicate. */
/* Skip verify of print_insn, invalid_p == 0. */
/* Skip verify of skip_trampoline_code, invalid_p == 0. */
- /* Skip verify of so_ops, invalid_p == 0. */
+ /* Skip verify of make_solib_ops, invalid_p == 0. */
/* Skip verify of skip_solib_resolver, invalid_p == 0. */
/* Skip verify of in_solib_return_trampoline, invalid_p == 0. */
/* Skip verify of in_indirect_branch_thunk, invalid_p == 0. */
@@ -513,7 +514,6 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of gen_return_address, invalid_p == 0. */
/* Skip verify of info_proc, has predicate. */
/* Skip verify of core_info_proc, has predicate. */
- /* Skip verify of iterate_over_objfiles_in_search_order, invalid_p == 0. */
/* Skip verify of ravenscar_ops, invalid_p == 0. */
/* Skip verify of insn_is_call, invalid_p == 0. */
/* Skip verify of insn_is_ret, invalid_p == 0. */
@@ -535,6 +535,8 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of read_core_file_mappings, invalid_p == 0. */
/* Skip verify of use_target_description_from_corefile_notes, invalid_p == 0. */
/* Skip verify of core_parse_exec_context, invalid_p == 0. */
+ /* Skip verify of shadow_stack_push, has predicate. */
+ /* Skip verify of get_shadow_stack_pointer, invalid_p == 0. */
if (!log.empty ())
internal_error (_("verify_gdbarch: the following are invalid ...%s"),
log.c_str ());
@@ -948,11 +950,11 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: memtag_granule_size = %s\n",
core_addr_to_string_nz (gdbarch->memtag_granule_size));
gdb_printf (file,
- "gdbarch_dump: gdbarch_software_single_step_p() = %d\n",
- gdbarch_software_single_step_p (gdbarch));
+ "gdbarch_dump: gdbarch_get_next_pcs_p() = %d\n",
+ gdbarch_get_next_pcs_p (gdbarch));
gdb_printf (file,
- "gdbarch_dump: software_single_step = <%s>\n",
- host_address_to_string (gdbarch->software_single_step));
+ "gdbarch_dump: get_next_pcs = <%s>\n",
+ host_address_to_string (gdbarch->get_next_pcs));
gdb_printf (file,
"gdbarch_dump: gdbarch_single_step_through_delay_p() = %d\n",
gdbarch_single_step_through_delay_p (gdbarch));
@@ -966,8 +968,8 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: skip_trampoline_code = <%s>\n",
host_address_to_string (gdbarch->skip_trampoline_code));
gdb_printf (file,
- "gdbarch_dump: so_ops = %s\n",
- host_address_to_string (gdbarch->so_ops));
+ "gdbarch_dump: make_solib_ops = <%s>\n",
+ host_address_to_string (gdbarch->make_solib_ops));
gdb_printf (file,
"gdbarch_dump: skip_solib_resolver = <%s>\n",
host_address_to_string (gdbarch->skip_solib_resolver));
@@ -1338,9 +1340,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: core_info_proc = <%s>\n",
host_address_to_string (gdbarch->core_info_proc));
gdb_printf (file,
- "gdbarch_dump: iterate_over_objfiles_in_search_order = <%s>\n",
- host_address_to_string (gdbarch->iterate_over_objfiles_in_search_order));
- gdb_printf (file,
"gdbarch_dump: ravenscar_ops = %s\n",
host_address_to_string (gdbarch->ravenscar_ops));
gdb_printf (file,
@@ -1406,6 +1405,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
gdb_printf (file,
"gdbarch_dump: core_parse_exec_context = <%s>\n",
host_address_to_string (gdbarch->core_parse_exec_context));
+ gdb_printf (file,
+ "gdbarch_dump: gdbarch_shadow_stack_push_p() = %d\n",
+ gdbarch_shadow_stack_push_p (gdbarch));
+ gdb_printf (file,
+ "gdbarch_dump: shadow_stack_push = <%s>\n",
+ host_address_to_string (gdbarch->shadow_stack_push));
+ gdb_printf (file,
+ "gdbarch_dump: get_shadow_stack_pointer = <%s>\n",
+ host_address_to_string (gdbarch->get_shadow_stack_pointer));
if (gdbarch->dump_tdep != NULL)
gdbarch->dump_tdep (gdbarch, file);
}
@@ -3388,27 +3396,27 @@ set_gdbarch_memtag_granule_size (struct gdbarch *gdbarch,
}
bool
-gdbarch_software_single_step_p (struct gdbarch *gdbarch)
+gdbarch_get_next_pcs_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- return gdbarch->software_single_step != NULL;
+ return gdbarch->get_next_pcs != NULL;
}
std::vector<CORE_ADDR>
-gdbarch_software_single_step (struct gdbarch *gdbarch, struct regcache *regcache)
+gdbarch_get_next_pcs (struct gdbarch *gdbarch, struct regcache *regcache)
{
gdb_assert (gdbarch != NULL);
- gdb_assert (gdbarch->software_single_step != NULL);
+ gdb_assert (gdbarch->get_next_pcs != NULL);
if (gdbarch_debug >= 2)
- gdb_printf (gdb_stdlog, "gdbarch_software_single_step called\n");
- return gdbarch->software_single_step (regcache);
+ gdb_printf (gdb_stdlog, "gdbarch_get_next_pcs called\n");
+ return gdbarch->get_next_pcs (regcache);
}
void
-set_gdbarch_software_single_step (struct gdbarch *gdbarch,
- gdbarch_software_single_step_ftype software_single_step)
+set_gdbarch_get_next_pcs (struct gdbarch *gdbarch,
+ gdbarch_get_next_pcs_ftype get_next_pcs)
{
- gdbarch->software_single_step = software_single_step;
+ gdbarch->get_next_pcs = get_next_pcs;
}
bool
@@ -3469,21 +3477,21 @@ set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch,
gdbarch->skip_trampoline_code = skip_trampoline_code;
}
-const solib_ops *
-gdbarch_so_ops (struct gdbarch *gdbarch)
+solib_ops_up
+gdbarch_make_solib_ops (struct gdbarch *gdbarch, program_space *pspace)
{
gdb_assert (gdbarch != NULL);
- /* Skip verify of so_ops, invalid_p == 0. */
+ gdb_assert (gdbarch->make_solib_ops != NULL);
if (gdbarch_debug >= 2)
- gdb_printf (gdb_stdlog, "gdbarch_so_ops called\n");
- return gdbarch->so_ops;
+ gdb_printf (gdb_stdlog, "gdbarch_make_solib_ops called\n");
+ return gdbarch->make_solib_ops (pspace);
}
void
-set_gdbarch_so_ops (struct gdbarch *gdbarch,
- const solib_ops * so_ops)
+set_gdbarch_make_solib_ops (struct gdbarch *gdbarch,
+ gdbarch_make_solib_ops_ftype make_solib_ops)
{
- gdbarch->so_ops = so_ops;
+ gdbarch->make_solib_ops = make_solib_ops;
}
CORE_ADDR
@@ -3962,13 +3970,13 @@ gdbarch_core_xfer_shared_libraries_p (struct gdbarch *gdbarch)
}
ULONGEST
-gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
+gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, struct bfd &cbfd, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->core_xfer_shared_libraries != NULL);
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_core_xfer_shared_libraries called\n");
- return gdbarch->core_xfer_shared_libraries (gdbarch, readbuf, offset, len);
+ return gdbarch->core_xfer_shared_libraries (gdbarch, cbfd, readbuf, offset, len);
}
void
@@ -3986,13 +3994,13 @@ gdbarch_core_xfer_shared_libraries_aix_p (struct gdbarch *gdbarch)
}
ULONGEST
-gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
+gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, struct bfd &cbfd, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->core_xfer_shared_libraries_aix != NULL);
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_core_xfer_shared_libraries_aix called\n");
- return gdbarch->core_xfer_shared_libraries_aix (gdbarch, readbuf, offset, len);
+ return gdbarch->core_xfer_shared_libraries_aix (gdbarch, cbfd, readbuf, offset, len);
}
void
@@ -4034,13 +4042,13 @@ gdbarch_core_thread_name_p (struct gdbarch *gdbarch)
}
const char *
-gdbarch_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr)
+gdbarch_core_thread_name (struct gdbarch *gdbarch, struct bfd &cbfd, struct thread_info *thr)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->core_thread_name != NULL);
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_core_thread_name called\n");
- return gdbarch->core_thread_name (gdbarch, thr);
+ return gdbarch->core_thread_name (gdbarch, cbfd, thr);
}
void
@@ -4058,13 +4066,13 @@ gdbarch_core_xfer_siginfo_p (struct gdbarch *gdbarch)
}
LONGEST
-gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
+gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, struct bfd &cbfd, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->core_xfer_siginfo != NULL);
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_core_xfer_siginfo called\n");
- return gdbarch->core_xfer_siginfo (gdbarch, readbuf, offset, len);
+ return gdbarch->core_xfer_siginfo (gdbarch, cbfd, readbuf, offset, len);
}
void
@@ -4082,13 +4090,13 @@ gdbarch_core_read_x86_xsave_layout_p (struct gdbarch *gdbarch)
}
bool
-gdbarch_core_read_x86_xsave_layout (struct gdbarch *gdbarch, x86_xsave_layout &xsave_layout)
+gdbarch_core_read_x86_xsave_layout (struct gdbarch *gdbarch, struct bfd &cbfd, x86_xsave_layout &xsave_layout)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->core_read_x86_xsave_layout != NULL);
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_core_read_x86_xsave_layout called\n");
- return gdbarch->core_read_x86_xsave_layout (gdbarch, xsave_layout);
+ return gdbarch->core_read_x86_xsave_layout (gdbarch, cbfd, xsave_layout);
}
void
@@ -5155,13 +5163,13 @@ gdbarch_core_info_proc_p (struct gdbarch *gdbarch)
}
void
-gdbarch_core_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what)
+gdbarch_core_info_proc (struct gdbarch *gdbarch, struct bfd *cbfd, const char *args, enum info_proc_what what)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->core_info_proc != NULL);
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_core_info_proc called\n");
- gdbarch->core_info_proc (gdbarch, args, what);
+ gdbarch->core_info_proc (gdbarch, cbfd, args, what);
}
void
@@ -5171,23 +5179,6 @@ set_gdbarch_core_info_proc (struct gdbarch *gdbarch,
gdbarch->core_info_proc = core_info_proc;
}
-void
-gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb, struct objfile *current_objfile)
-{
- gdb_assert (gdbarch != NULL);
- gdb_assert (gdbarch->iterate_over_objfiles_in_search_order != NULL);
- if (gdbarch_debug >= 2)
- gdb_printf (gdb_stdlog, "gdbarch_iterate_over_objfiles_in_search_order called\n");
- gdbarch->iterate_over_objfiles_in_search_order (gdbarch, cb, current_objfile);
-}
-
-void
-set_gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch,
- gdbarch_iterate_over_objfiles_in_search_order_ftype iterate_over_objfiles_in_search_order)
-{
- gdbarch->iterate_over_objfiles_in_search_order = iterate_over_objfiles_in_search_order;
-}
-
struct ravenscar_arch_ops *
gdbarch_ravenscar_ops (struct gdbarch *gdbarch)
{
@@ -5551,3 +5542,44 @@ set_gdbarch_core_parse_exec_context (struct gdbarch *gdbarch,
{
gdbarch->core_parse_exec_context = core_parse_exec_context;
}
+
+bool
+gdbarch_shadow_stack_push_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->shadow_stack_push != NULL;
+}
+
+void
+gdbarch_shadow_stack_push (struct gdbarch *gdbarch, CORE_ADDR new_addr, regcache *regcache)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->shadow_stack_push != NULL);
+ if (gdbarch_debug >= 2)
+ gdb_printf (gdb_stdlog, "gdbarch_shadow_stack_push called\n");
+ gdbarch->shadow_stack_push (gdbarch, new_addr, regcache);
+}
+
+void
+set_gdbarch_shadow_stack_push (struct gdbarch *gdbarch,
+ gdbarch_shadow_stack_push_ftype shadow_stack_push)
+{
+ gdbarch->shadow_stack_push = shadow_stack_push;
+}
+
+std::optional<CORE_ADDR>
+gdbarch_get_shadow_stack_pointer (struct gdbarch *gdbarch, regcache *regcache, bool &shadow_stack_enabled)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->get_shadow_stack_pointer != NULL);
+ if (gdbarch_debug >= 2)
+ gdb_printf (gdb_stdlog, "gdbarch_get_shadow_stack_pointer called\n");
+ return gdbarch->get_shadow_stack_pointer (gdbarch, regcache, shadow_stack_enabled);
+}
+
+void
+set_gdbarch_get_shadow_stack_pointer (struct gdbarch *gdbarch,
+ gdbarch_get_shadow_stack_pointer_ftype get_shadow_stack_pointer)
+{
+ gdbarch->get_shadow_stack_pointer = get_shadow_stack_pointer;
+}
diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h
index 1aa6715..24fa8ba 100644
--- a/gdb/gdbarch-gen.h
+++ b/gdb/gdbarch-gen.h
@@ -3,7 +3,7 @@
/* Dynamic architecture support for GDB, the GNU debugger.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -792,11 +792,11 @@ extern void set_gdbarch_memtag_granule_size (struct gdbarch *gdbarch, CORE_ADDR
the condition is true, so that we ensure forward progress when stepping
past a conditional branch to self. */
-extern bool gdbarch_software_single_step_p (struct gdbarch *gdbarch);
+extern bool gdbarch_get_next_pcs_p (struct gdbarch *gdbarch);
-typedef std::vector<CORE_ADDR> (gdbarch_software_single_step_ftype) (struct regcache *regcache);
-extern std::vector<CORE_ADDR> gdbarch_software_single_step (struct gdbarch *gdbarch, struct regcache *regcache);
-extern void set_gdbarch_software_single_step (struct gdbarch *gdbarch, gdbarch_software_single_step_ftype *software_single_step);
+typedef std::vector<CORE_ADDR> (gdbarch_get_next_pcs_ftype) (struct regcache *regcache);
+extern std::vector<CORE_ADDR> gdbarch_get_next_pcs (struct gdbarch *gdbarch, struct regcache *regcache);
+extern void set_gdbarch_get_next_pcs (struct gdbarch *gdbarch, gdbarch_get_next_pcs_ftype *get_next_pcs);
/* Return non-zero if the processor is executing a delay slot and a
further single-step is needed before the instruction finishes. */
@@ -818,10 +818,11 @@ typedef CORE_ADDR (gdbarch_skip_trampoline_code_ftype) (const frame_info_ptr &fr
extern CORE_ADDR gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, const frame_info_ptr &frame, CORE_ADDR pc);
extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_skip_trampoline_code_ftype *skip_trampoline_code);
-/* Vtable of solib operations functions. */
+/* Return a newly-allocated solib_ops object capable of providing the solibs for this architecture. */
-extern const solib_ops * gdbarch_so_ops (struct gdbarch *gdbarch);
-extern void set_gdbarch_so_ops (struct gdbarch *gdbarch, const solib_ops * so_ops);
+typedef solib_ops_up (gdbarch_make_solib_ops_ftype) (program_space *pspace);
+extern solib_ops_up gdbarch_make_solib_ops (struct gdbarch *gdbarch, program_space *pspace);
+extern void set_gdbarch_make_solib_ops (struct gdbarch *gdbarch, gdbarch_make_solib_ops_ftype *make_solib_ops);
/* If in_solib_dynsym_resolve_code() returns true, and SKIP_SOLIB_RESOLVER
evaluates non-zero, this is the address where the debugger will place
@@ -1028,8 +1029,8 @@ extern void set_gdbarch_decode_memtag_section (struct gdbarch *gdbarch, gdbarch_
extern bool gdbarch_core_xfer_shared_libraries_p (struct gdbarch *gdbarch);
-typedef ULONGEST (gdbarch_core_xfer_shared_libraries_ftype) (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
-extern ULONGEST gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
+typedef ULONGEST (gdbarch_core_xfer_shared_libraries_ftype) (struct gdbarch *gdbarch, struct bfd &cbfd, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
+extern ULONGEST gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, struct bfd &cbfd, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
extern void set_gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries);
/* Read offset OFFSET of TARGET_OBJECT_LIBRARIES_AIX formatted shared
@@ -1038,8 +1039,8 @@ extern void set_gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb
extern bool gdbarch_core_xfer_shared_libraries_aix_p (struct gdbarch *gdbarch);
-typedef ULONGEST (gdbarch_core_xfer_shared_libraries_aix_ftype) (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
-extern ULONGEST gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
+typedef ULONGEST (gdbarch_core_xfer_shared_libraries_aix_ftype) (struct gdbarch *gdbarch, struct bfd &cbfd, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
+extern ULONGEST gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, struct bfd &cbfd, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
extern void set_gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, gdbarch_core_xfer_shared_libraries_aix_ftype *core_xfer_shared_libraries_aix);
/* How the core target converts a PTID from a core file to a string. */
@@ -1050,31 +1051,31 @@ typedef std::string (gdbarch_core_pid_to_str_ftype) (struct gdbarch *gdbarch, pt
extern std::string gdbarch_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid);
extern void set_gdbarch_core_pid_to_str (struct gdbarch *gdbarch, gdbarch_core_pid_to_str_ftype *core_pid_to_str);
-/* How the core target extracts the name of a thread from a core file. */
+/* How the core target extracts the name of a thread from core file CBFD. */
extern bool gdbarch_core_thread_name_p (struct gdbarch *gdbarch);
-typedef const char * (gdbarch_core_thread_name_ftype) (struct gdbarch *gdbarch, struct thread_info *thr);
-extern const char * gdbarch_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr);
+typedef const char * (gdbarch_core_thread_name_ftype) (struct gdbarch *gdbarch, struct bfd &cbfd, struct thread_info *thr);
+extern const char * gdbarch_core_thread_name (struct gdbarch *gdbarch, struct bfd &cbfd, struct thread_info *thr);
extern void set_gdbarch_core_thread_name (struct gdbarch *gdbarch, gdbarch_core_thread_name_ftype *core_thread_name);
/* Read offset OFFSET of TARGET_OBJECT_SIGNAL_INFO signal information
- from core file into buffer READBUF with length LEN. Return the number
+ from core file CBFD into buffer READBUF with length LEN. Return the number
of bytes read (zero indicates EOF, a negative value indicates failure). */
extern bool gdbarch_core_xfer_siginfo_p (struct gdbarch *gdbarch);
-typedef LONGEST (gdbarch_core_xfer_siginfo_ftype) (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
-extern LONGEST gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
+typedef LONGEST (gdbarch_core_xfer_siginfo_ftype) (struct gdbarch *gdbarch, struct bfd &cbfd, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
+extern LONGEST gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, struct bfd &cbfd, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
extern void set_gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, gdbarch_core_xfer_siginfo_ftype *core_xfer_siginfo);
-/* Read x86 XSAVE layout information from core file into XSAVE_LAYOUT.
+/* Read x86 XSAVE layout information from core file CBFD into XSAVE_LAYOUT.
Returns true if the layout was read successfully. */
extern bool gdbarch_core_read_x86_xsave_layout_p (struct gdbarch *gdbarch);
-typedef bool (gdbarch_core_read_x86_xsave_layout_ftype) (struct gdbarch *gdbarch, x86_xsave_layout &xsave_layout);
-extern bool gdbarch_core_read_x86_xsave_layout (struct gdbarch *gdbarch, x86_xsave_layout &xsave_layout);
+typedef bool (gdbarch_core_read_x86_xsave_layout_ftype) (struct gdbarch *gdbarch, struct bfd &cbfd, x86_xsave_layout &xsave_layout);
+extern bool gdbarch_core_read_x86_xsave_layout (struct gdbarch *gdbarch, struct bfd &cbfd, x86_xsave_layout &xsave_layout);
extern void set_gdbarch_core_read_x86_xsave_layout (struct gdbarch *gdbarch, gdbarch_core_read_x86_xsave_layout_ftype *core_read_x86_xsave_layout);
/* BFD target to use when generating a core file. */
@@ -1147,7 +1148,7 @@ extern void set_gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, gdbar
the displaced instruction buffer).
The default implementation returns false on all targets that provide a
- gdbarch_software_single_step routine, and true otherwise. */
+ gdbarch_get_next_pcs routine, and true otherwise. */
typedef bool (gdbarch_displaced_step_hw_singlestep_ftype) (struct gdbarch *gdbarch);
extern bool gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch);
@@ -1625,27 +1626,14 @@ extern void set_gdbarch_info_proc (struct gdbarch *gdbarch, gdbarch_info_proc_ft
/* Implement the "info proc" command for core files. Note that there
are two "info_proc"-like methods on gdbarch -- one for core files,
- one for live targets. */
+ one for live targets. CBFD is the core file being read from. */
extern bool gdbarch_core_info_proc_p (struct gdbarch *gdbarch);
-typedef void (gdbarch_core_info_proc_ftype) (struct gdbarch *gdbarch, const char *args, enum info_proc_what what);
-extern void gdbarch_core_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what);
+typedef void (gdbarch_core_info_proc_ftype) (struct gdbarch *gdbarch, struct bfd *cbfd, const char *args, enum info_proc_what what);
+extern void gdbarch_core_info_proc (struct gdbarch *gdbarch, struct bfd *cbfd, const char *args, enum info_proc_what what);
extern void set_gdbarch_core_info_proc (struct gdbarch *gdbarch, gdbarch_core_info_proc_ftype *core_info_proc);
-/* Iterate over all objfiles in the order that makes the most sense
- for the architecture to make global symbol searches.
-
- CB is a callback function passed an objfile to be searched. The iteration stops
- if this function returns nonzero.
-
- If not NULL, CURRENT_OBJFILE corresponds to the objfile being
- inspected when the symbol search was requested. */
-
-typedef void (gdbarch_iterate_over_objfiles_in_search_order_ftype) (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb, struct objfile *current_objfile);
-extern void gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb, struct objfile *current_objfile);
-extern void set_gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, gdbarch_iterate_over_objfiles_in_search_order_ftype *iterate_over_objfiles_in_search_order);
-
/* Ravenscar arch-dependent ops. */
extern struct ravenscar_arch_ops * gdbarch_ravenscar_ops (struct gdbarch *gdbarch);
@@ -1801,3 +1789,31 @@ extern void set_gdbarch_use_target_description_from_corefile_notes (struct gdbar
typedef core_file_exec_context (gdbarch_core_parse_exec_context_ftype) (struct gdbarch *gdbarch, bfd *cbfd);
extern core_file_exec_context gdbarch_core_parse_exec_context (struct gdbarch *gdbarch, bfd *cbfd);
extern void set_gdbarch_core_parse_exec_context (struct gdbarch *gdbarch, gdbarch_core_parse_exec_context_ftype *core_parse_exec_context);
+
+/* Some targets support special hardware-assisted control-flow protection
+ technologies. For example, the Intel Control-Flow Enforcement Technology
+ (Intel CET) on x86 provides a shadow stack and indirect branch tracking.
+ To enable shadow stack support for inferior calls the shadow_stack_push
+ gdbarch hook has to be provided. The get_shadow_stack_pointer gdbarch
+ hook has to be provided to enable displaced stepping.
+
+ Push NEW_ADDR to the shadow stack and update the shadow stack pointer. */
+
+extern bool gdbarch_shadow_stack_push_p (struct gdbarch *gdbarch);
+
+typedef void (gdbarch_shadow_stack_push_ftype) (struct gdbarch *gdbarch, CORE_ADDR new_addr, regcache *regcache);
+extern void gdbarch_shadow_stack_push (struct gdbarch *gdbarch, CORE_ADDR new_addr, regcache *regcache);
+extern void set_gdbarch_shadow_stack_push (struct gdbarch *gdbarch, gdbarch_shadow_stack_push_ftype *shadow_stack_push);
+
+/* If possible, return the shadow stack pointer. If the shadow stack
+ feature is enabled then set SHADOW_STACK_ENABLED to true, otherwise
+ set SHADOW_STACK_ENABLED to false. This hook has to be provided to enable
+ displaced stepping for shadow stack enabled programs.
+ On some architectures, the shadow stack pointer is available even if the
+ feature is disabled. So dependent on the target, an implementation of
+ this function may return a valid shadow stack pointer, but set
+ SHADOW_STACK_ENABLED to false. */
+
+typedef std::optional<CORE_ADDR> (gdbarch_get_shadow_stack_pointer_ftype) (struct gdbarch *gdbarch, regcache *regcache, bool &shadow_stack_enabled);
+extern std::optional<CORE_ADDR> gdbarch_get_shadow_stack_pointer (struct gdbarch *gdbarch, regcache *regcache, bool &shadow_stack_enabled);
+extern void set_gdbarch_get_shadow_stack_pointer (struct gdbarch *gdbarch, gdbarch_get_shadow_stack_pointer_ftype *get_shadow_stack_pointer);
diff --git a/gdb/gdbarch-selftests.c b/gdb/gdbarch-selftests.c
index 8f42557..5c94f60 100644
--- a/gdb/gdbarch-selftests.c
+++ b/gdb/gdbarch-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for gdbarch for GDB, the GNU debugger.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -183,9 +183,7 @@ check_stack_growth (struct gdbarch *gdbarch)
} /* namespace selftests */
-void _initialize_gdbarch_selftests ();
-void
-_initialize_gdbarch_selftests ()
+INIT_GDB_FILE (gdbarch_selftests)
{
selftests::register_test_foreach_arch ("register_to_value",
selftests::register_to_value_test);
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 786b720..2049761 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -1,6 +1,6 @@
/* Dynamic architecture support for GDB, the GNU debugger.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -30,6 +30,7 @@
#include "displaced-stepping.h"
#include "gdbsupport/gdb-checked-static-cast.h"
#include "registry.h"
+#include "solib.h"
struct floatformat;
struct ui_file;
@@ -74,12 +75,6 @@ struct gdbarch_tdep_base
using gdbarch_tdep_up = std::unique_ptr<gdbarch_tdep_base>;
-/* Callback type for the 'iterate_over_objfiles_in_search_order'
- gdbarch method. */
-
-using iterate_over_objfiles_in_search_order_cb_ftype
- = gdb::function_view<bool(objfile *)>;
-
/* Callback type for regset section iterators. The callback usually
invokes the REGSET's supply or collect method, to which it must
pass a buffer - for collects this buffer will need to be created using
@@ -210,7 +205,7 @@ gdbarch_tdep (struct gdbarch *gdbarch)
information obtained from INFO.ABFD or the global defaults.
The ARCHES parameter is a linked list (sorted most recently used)
- of all the previously created architures for this architecture
+ of all the previously created architectures for this architecture
family. The (possibly NULL) ARCHES->gdbarch can used to access
values from the previously selected architecture for this
architecture family.
diff --git a/gdb/gdbarch.py b/gdb/gdbarch.py
index dd1658d..ec66eea 100755
--- a/gdb/gdbarch.py
+++ b/gdb/gdbarch.py
@@ -2,7 +2,7 @@
# Architecture commands for GDB, the GNU debugger.
#
-# Copyright (C) 1998-2024 Free Software Foundation, Inc.
+# Copyright (C) 1998-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py
index a4f1220..3820ae3 100644
--- a/gdb/gdbarch_components.py
+++ b/gdb/gdbarch_components.py
@@ -1,6 +1,6 @@
# Dynamic architecture support for GDB, the GNU debugger.
-# Copyright (C) 1998-2024 Free Software Foundation, Inc.
+# Copyright (C) 1998-2025 Free Software Foundation, Inc.
# This file is part of GDB.
@@ -1395,7 +1395,7 @@ the condition is true, so that we ensure forward progress when stepping
past a conditional branch to self.
""",
type="std::vector<CORE_ADDR>",
- name="software_single_step",
+ name="get_next_pcs",
params=[("struct regcache *", "regcache")],
predicate=True,
)
@@ -1431,12 +1431,12 @@ Function(
invalid=False,
)
-Value(
- comment="Vtable of solib operations functions.",
- type="const solib_ops *",
- name="so_ops",
- predefault="&solib_target_so_ops",
- printer="host_address_to_string (gdbarch->so_ops)",
+Function(
+ comment="Return a newly-allocated solib_ops object capable of providing the solibs for this architecture.",
+ type="solib_ops_up",
+ name="make_solib_ops",
+ params=[("program_space *", "pspace")],
+ predefault="make_target_solib_ops",
invalid=False,
)
@@ -1738,7 +1738,12 @@ failed, otherwise, return the red length of READBUF.
""",
type="ULONGEST",
name="core_xfer_shared_libraries",
- params=[("gdb_byte *", "readbuf"), ("ULONGEST", "offset"), ("ULONGEST", "len")],
+ params=[
+ ("struct bfd &", "cbfd"),
+ ("gdb_byte *", "readbuf"),
+ ("ULONGEST", "offset"),
+ ("ULONGEST", "len"),
+ ],
predicate=True,
)
@@ -1750,7 +1755,12 @@ Return the number of bytes read (zero indicates failure).
""",
type="ULONGEST",
name="core_xfer_shared_libraries_aix",
- params=[("gdb_byte *", "readbuf"), ("ULONGEST", "offset"), ("ULONGEST", "len")],
+ params=[
+ ("struct bfd &", "cbfd"),
+ ("gdb_byte *", "readbuf"),
+ ("ULONGEST", "offset"),
+ ("ULONGEST", "len"),
+ ],
predicate=True,
)
@@ -1766,34 +1776,39 @@ How the core target converts a PTID from a core file to a string.
Method(
comment="""
-How the core target extracts the name of a thread from a core file.
+How the core target extracts the name of a thread from core file CBFD.
""",
type="const char *",
name="core_thread_name",
- params=[("struct thread_info *", "thr")],
+ params=[("struct bfd &", "cbfd"), ("struct thread_info *", "thr")],
predicate=True,
)
Method(
comment="""
Read offset OFFSET of TARGET_OBJECT_SIGNAL_INFO signal information
-from core file into buffer READBUF with length LEN. Return the number
+from core file CBFD into buffer READBUF with length LEN. Return the number
of bytes read (zero indicates EOF, a negative value indicates failure).
""",
type="LONGEST",
name="core_xfer_siginfo",
- params=[("gdb_byte *", "readbuf"), ("ULONGEST", "offset"), ("ULONGEST", "len")],
+ params=[
+ ("struct bfd &", "cbfd"),
+ ("gdb_byte *", "readbuf"),
+ ("ULONGEST", "offset"),
+ ("ULONGEST", "len"),
+ ],
predicate=True,
)
Method(
comment="""
-Read x86 XSAVE layout information from core file into XSAVE_LAYOUT.
+Read x86 XSAVE layout information from core file CBFD into XSAVE_LAYOUT.
Returns true if the layout was read successfully.
""",
type="bool",
name="core_read_x86_xsave_layout",
- params=[("x86_xsave_layout &", "xsave_layout")],
+ params=[("struct bfd &", "cbfd"), ("x86_xsave_layout &", "xsave_layout")],
predicate=True,
)
@@ -1891,7 +1906,7 @@ receive control again (e.g. by placing a software breakpoint instruction into
the displaced instruction buffer).
The default implementation returns false on all targets that provide a
-gdbarch_software_single_step routine, and true otherwise.
+gdbarch_get_next_pcs routine, and true otherwise.
""",
type="bool",
name="displaced_step_hw_singlestep",
@@ -2554,33 +2569,16 @@ Method(
comment="""
Implement the "info proc" command for core files. Note that there
are two "info_proc"-like methods on gdbarch -- one for core files,
-one for live targets.
+one for live targets. CBFD is the core file being read from.
""",
type="void",
name="core_info_proc",
- params=[("const char *", "args"), ("enum info_proc_what", "what")],
- predicate=True,
-)
-
-Method(
- comment="""
-Iterate over all objfiles in the order that makes the most sense
-for the architecture to make global symbol searches.
-
-CB is a callback function passed an objfile to be searched. The iteration stops
-if this function returns nonzero.
-
-If not NULL, CURRENT_OBJFILE corresponds to the objfile being
-inspected when the symbol search was requested.
-""",
- type="void",
- name="iterate_over_objfiles_in_search_order",
params=[
- ("iterate_over_objfiles_in_search_order_cb_ftype", "cb"),
- ("struct objfile *", "current_objfile"),
+ ("struct bfd *", "cbfd"),
+ ("const char *", "args"),
+ ("enum info_proc_what", "what"),
],
- predefault="default_iterate_over_objfiles_in_search_order",
- invalid=False,
+ predicate=True,
)
Value(
@@ -2848,3 +2846,38 @@ which all assume current_inferior() is the one to read from.
predefault="default_core_parse_exec_context",
invalid=False,
)
+
+Method(
+ comment="""
+Some targets support special hardware-assisted control-flow protection
+technologies. For example, the Intel Control-Flow Enforcement Technology
+(Intel CET) on x86 provides a shadow stack and indirect branch tracking.
+To enable shadow stack support for inferior calls the shadow_stack_push
+gdbarch hook has to be provided. The get_shadow_stack_pointer gdbarch
+hook has to be provided to enable displaced stepping.
+
+Push NEW_ADDR to the shadow stack and update the shadow stack pointer.
+""",
+ type="void",
+ name="shadow_stack_push",
+ params=[("CORE_ADDR", "new_addr"), ("regcache *", "regcache")],
+ predicate=True,
+)
+
+Method(
+ comment="""
+If possible, return the shadow stack pointer. If the shadow stack
+feature is enabled then set SHADOW_STACK_ENABLED to true, otherwise
+set SHADOW_STACK_ENABLED to false. This hook has to be provided to enable
+displaced stepping for shadow stack enabled programs.
+On some architectures, the shadow stack pointer is available even if the
+feature is disabled. So dependent on the target, an implementation of
+this function may return a valid shadow stack pointer, but set
+SHADOW_STACK_ENABLED to false.
+""",
+ type="std::optional<CORE_ADDR>",
+ name="get_shadow_stack_pointer",
+ params=[("regcache *", "regcache"), ("bool &", "shadow_stack_enabled")],
+ predefault="default_get_shadow_stack_pointer",
+ invalid=False,
+)
diff --git a/gdb/gdbarch_types.py b/gdb/gdbarch_types.py
index b98e60b..bbc1c92 100644
--- a/gdb/gdbarch_types.py
+++ b/gdb/gdbarch_types.py
@@ -1,6 +1,6 @@
# Architecture commands for GDB, the GNU debugger.
#
-# Copyright (C) 1998-2024 Free Software Foundation, Inc.
+# Copyright (C) 1998-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/gdbcopyright.py b/gdb/gdbcopyright.py
index 36749a2..24ae441 100644
--- a/gdb/gdbcopyright.py
+++ b/gdb/gdbcopyright.py
@@ -1,6 +1,6 @@
# Copyright constant for Python code to use.
#
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index 773a75b..8b4adaa 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -1,6 +1,6 @@
/* Machine independent variables that describe the core file under GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -258,4 +258,52 @@ std::optional<core_target_mapped_file_info>
core_target_find_mapped_file (const char *filename,
std::optional<CORE_ADDR> addr);
+/* Type holding information about a single file mapped into the inferior
+ at the point when the core file was created. Associates a build-id
+ with the list of regions the file is mapped into. */
+struct core_mapped_file
+{
+ /* Type for a region of a file that was mapped into the inferior when
+ the core file was generated. */
+ struct region
+ {
+ /* Constructor. See member variables for argument descriptions. */
+ region (CORE_ADDR start_, CORE_ADDR end_, CORE_ADDR file_ofs_)
+ : start (start_),
+ end (end_),
+ file_ofs (file_ofs_)
+ { /* Nothing. */ }
+
+ /* The inferior address for the start of the mapped region. */
+ CORE_ADDR start;
+
+ /* The inferior address immediately after the mapped region. */
+ CORE_ADDR end;
+
+ /* The offset within the mapped file for this content. */
+ CORE_ADDR file_ofs;
+ };
+
+ /* The filename as recorded in the core file. */
+ std::string filename;
+
+ /* If not nullptr, then this is the build-id associated with this
+ file. */
+ const bfd_build_id *build_id = nullptr;
+
+ /* All the mapped regions of this file. */
+ std::vector<region> regions;
+
+ /* True if this is the main executable. */
+ bool is_main_exec = false;
+};
+
+extern std::vector<core_mapped_file> gdb_read_core_file_mappings
+ (struct gdbarch *gdbarch, struct bfd *cbfd);
+
+/* Return the core file bfd for inferior INF, if that inferior has a core
+ file loaded. Otherwise, return NULL. */
+
+extern bfd *get_inferior_core_bfd (inferior *inf);
+
#endif /* GDB_GDBCORE_H */
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 6cffd86..26bd9f2 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -1,5 +1,5 @@
/* Multi-process/thread control defs for GDB, the GNU debugger.
- Copyright (C) 1987-2024 Free Software Foundation, Inc.
+ Copyright (C) 1987-2025 Free Software Foundation, Inc.
Contributed by Lynx Real-Time Systems, Inc. Los Gatos, CA.
@@ -70,10 +70,10 @@ extern bool debug_threads;
you want. */
enum thread_state
{
- /* In the frontend's perpective, the thread is stopped. */
+ /* In the frontend's perspective, the thread is stopped. */
THREAD_STOPPED,
- /* In the frontend's perpective, the thread is running. */
+ /* In the frontend's perspective, the thread is running. */
THREAD_RUNNING,
/* The thread is listed, but known to have exited. We keep it
@@ -747,7 +747,7 @@ extern struct thread_info *iterate_over_threads (thread_callback_func);
Used like this, it walks over all threads of all inferiors of all
targets:
- for (thread_info *thr : all_threads ())
+ for (thread_info &thr : all_threads ())
{ .... }
FILTER_PTID can be used to filter out threads that don't match.
@@ -786,15 +786,18 @@ all_non_exited_threads (process_stratum_target *proc_target = nullptr,
currently-iterated thread. When combined with range-for, this
allow convenient patterns like this:
- for (thread_info *t : all_threads_safe ())
+ for (thread_info &t : all_threads_safe ())
if (some_condition ())
- delete f;
+ delete &f;
*/
inline all_threads_safe_range
all_threads_safe ()
{
- return all_threads_safe_range (all_threads_iterator::begin_t {});
+ all_threads_iterator begin (all_threads_iterator::begin_t {});
+ all_threads_safe_iterator safe_begin (std::move (begin));
+
+ return all_threads_safe_range (std::move (safe_begin));
}
extern int thread_count (process_stratum_target *proc_target);
@@ -973,10 +976,8 @@ using thread_step_over_list_node
= intrusive_member_node<thread_info, &thread_info::step_over_list_node>;
using thread_step_over_list
= intrusive_list<thread_info, thread_step_over_list_node>;
-using thread_step_over_list_iterator
- = reference_to_pointer_iterator<thread_step_over_list::iterator>;
using thread_step_over_list_safe_iterator
- = basic_safe_iterator<thread_step_over_list_iterator>;
+ = basic_safe_iterator<thread_step_over_list::iterator>;
using thread_step_over_list_safe_range
= iterator_range<thread_step_over_list_safe_iterator>;
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 3f78230..715db74 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1,6 +1,6 @@
/* Support routines for manipulating internal types for GDB.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules.
@@ -561,27 +561,19 @@ make_function_type (struct type *type, struct type **typeptr)
return ntype;
}
-/* Given a type TYPE, return a type of functions that return that type.
- May need to construct such a type if this is the first use. */
-
-struct type *
-lookup_function_type (struct type *type)
-{
- return make_function_type (type, (struct type **) 0);
-}
-
-/* Given a type TYPE and argument types, return the appropriate
- function type. If the final type in PARAM_TYPES is NULL, make a
- varargs function. */
+/* See gdbtypes.h. */
struct type *
-lookup_function_type_with_arguments (struct type *type,
- int nparams,
- struct type **param_types)
+create_function_type (type_allocator &alloc,
+ struct type *return_type,
+ int nparams,
+ struct type **param_types)
{
- struct type *fn = make_function_type (type, (struct type **) 0);
+ struct type *fn = alloc.new_type ();
int i;
+ make_function_type (return_type, &fn);
+
if (nparams > 0)
{
if (param_types[nparams - 1] == NULL)
@@ -608,6 +600,26 @@ lookup_function_type_with_arguments (struct type *type,
return fn;
}
+/* See gdbtypes.h. */
+
+struct type *
+lookup_function_type (struct type *return_type)
+{
+ type_allocator alloc (return_type);
+ return create_function_type (alloc, return_type, 0, nullptr);
+}
+
+/* See gdbtypes.h. */
+
+struct type *
+lookup_function_type_with_arguments (struct type *return_type,
+ int nparams,
+ struct type **param_types)
+{
+ type_allocator alloc (return_type);
+ return create_function_type (alloc, return_type, nparams, param_types);
+}
+
/* Identify address space identifier by name -- return a
type_instance_flags. */
@@ -902,7 +914,7 @@ operator== (const dynamic_prop &l, const dynamic_prop &r)
return true;
case PROP_CONST:
return l.const_val () == r.const_val ();
- case PROP_ADDR_OFFSET:
+ case PROP_FIELD:
case PROP_LOCEXPR:
case PROP_LOCLIST:
return l.baton () == r.baton ();
@@ -1080,10 +1092,10 @@ get_discrete_low_bound (struct type *type)
entries. */
LONGEST low = type->field (0).loc_enumval ();
- for (int i = 0; i < type->num_fields (); i++)
+ for (const auto &field : type->fields ())
{
- if (type->field (i).loc_enumval () < low)
- low = type->field (i).loc_enumval ();
+ if (field.loc_enumval () < low)
+ low = field.loc_enumval ();
}
return low;
@@ -1147,10 +1159,10 @@ get_discrete_high_bound (struct type *type)
entries. */
LONGEST high = type->field (0).loc_enumval ();
- for (int i = 0; i < type->num_fields (); i++)
+ for (const auto &field : type->fields ())
{
- if (type->field (i).loc_enumval () > high)
- high = type->field (i).loc_enumval ();
+ if (field.loc_enumval () > high)
+ high = field.loc_enumval ();
}
return high;
@@ -1602,15 +1614,15 @@ smash_to_methodptr_type (struct type *type, struct type *to_type)
void
smash_to_method_type (struct type *type, struct type *self_type,
- struct type *to_type, struct field *args,
- int nargs, int varargs)
+ struct type *to_type, gdb::array_view<struct field> args,
+ int varargs)
{
smash_type (type);
type->set_code (TYPE_CODE_METHOD);
type->set_target_type (to_type);
set_type_self_type (type, self_type);
- type->set_fields (args);
- type->set_num_fields (nargs);
+ type->set_fields (args.data ());
+ type->set_num_fields (args.size ());
if (varargs)
type->set_has_varargs (true);
@@ -1821,12 +1833,18 @@ lookup_struct_elt (struct type *type, const char *name, int noerr)
}
else if (!t_field_name || *t_field_name == '\0')
{
- struct_elt elt
- = lookup_struct_elt (type->field (i).type (), name, 1);
- if (elt.field != NULL)
+ struct type *field_type = type->field (i).type ();
+ enum type_code field_code = check_typedef (field_type)->code ();
+
+ if (field_code == TYPE_CODE_STRUCT || field_code == TYPE_CODE_UNION)
{
- elt.offset += type->field (i).loc_bitpos ();
- return elt;
+ struct_elt elt
+ = lookup_struct_elt (type->field (i).type (), name, 1);
+ if (elt.field != NULL)
+ {
+ elt.offset += type->field (i).loc_bitpos ();
+ return elt;
+ }
}
}
}
@@ -2121,7 +2139,7 @@ is_dynamic_type_internal (struct type *type, bool top_level)
return true;
/* If the field is at a fixed offset, then it is not
dynamic. */
- if (type->field (i).loc_kind () != FIELD_LOC_KIND_DWARF_BLOCK)
+ if (!type->field (i).loc_is_dwarf_block ())
continue;
/* Do not consider C++ virtual base types to be dynamic
due to the field's offset being dynamic; these are
@@ -2146,7 +2164,7 @@ is_dynamic_type (struct type *type)
}
static struct type *resolve_dynamic_type_internal
- (struct type *type, struct property_addr_info *addr_stack,
+ (struct type *type, const property_addr_info *addr_stack,
const frame_info_ptr &frame, bool top_level);
/* Given a dynamic range type (dyn_range_type) and a stack of
@@ -2167,7 +2185,7 @@ static struct type *resolve_dynamic_type_internal
static struct type *
resolve_dynamic_range (struct type *dyn_range_type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const frame_info_ptr &frame,
int rank, bool resolve_p = true)
{
@@ -2269,7 +2287,7 @@ resolve_dynamic_range (struct type *dyn_range_type,
static struct type *
resolve_dynamic_array_or_string_1 (struct type *type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const frame_info_ptr &frame,
int rank, bool resolve_p)
{
@@ -2397,7 +2415,7 @@ resolve_dynamic_array_or_string_1 (struct type *type,
static struct type *
resolve_dynamic_array_or_string (struct type *type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const frame_info_ptr &frame)
{
CORE_ADDR value;
@@ -2490,27 +2508,26 @@ resolve_dynamic_array_or_string (struct type *type,
static struct type *
resolve_dynamic_union (struct type *type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const frame_info_ptr &frame)
{
struct type *resolved_type;
- int i;
unsigned int max_len = 0;
gdb_assert (type->code () == TYPE_CODE_UNION);
resolved_type = copy_type (type);
resolved_type->copy_fields (type);
- for (i = 0; i < resolved_type->num_fields (); ++i)
+ for (auto &field : resolved_type->fields ())
{
struct type *t;
- if (type->field (i).is_static ())
+ if (field.is_static ())
continue;
- t = resolve_dynamic_type_internal (resolved_type->field (i).type (),
- addr_stack, frame, false);
- resolved_type->field (i).set_type (t);
+ t = resolve_dynamic_type_internal (field.type (), addr_stack,
+ frame, false);
+ field.set_type (t);
struct type *real_type = check_typedef (t);
if (real_type->length () > max_len)
@@ -2534,7 +2551,7 @@ variant::matches (ULONGEST value, bool is_unsigned) const
static void
compute_variant_fields_inner (struct type *type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const variant_part &part,
std::vector<bool> &flags);
@@ -2549,7 +2566,7 @@ compute_variant_fields_inner (struct type *type,
static void
compute_variant_fields_recurse (struct type *type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const variant &variant,
std::vector<bool> &flags,
bool enabled)
@@ -2581,7 +2598,7 @@ compute_variant_fields_recurse (struct type *type,
static void
compute_variant_fields_inner (struct type *type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const variant_part &part,
std::vector<bool> &flags)
{
@@ -2650,7 +2667,7 @@ compute_variant_fields_inner (struct type *type,
static void
compute_variant_fields (struct type *type,
struct type *resolved_type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const gdb::array_view<variant_part> &parts)
{
/* Assume all fields are included by default. */
@@ -2676,17 +2693,121 @@ compute_variant_fields (struct type *type,
}
}
+/* See gdbtypes.h. */
+
+void
+apply_bit_offset_to_field (struct field &field, LONGEST bit_offset,
+ LONGEST explicit_byte_size)
+{
+ struct type *field_type = field.type ();
+ struct gdbarch *gdbarch = field_type->arch ();
+ LONGEST current_bitpos = field.loc_bitpos ();
+
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
+ {
+ /* For big endian bits, the DW_AT_bit_offset gives the
+ additional bit offset from the MSB of the containing
+ anonymous object to the MSB of the field. We don't
+ have to do anything special since we don't need to
+ know the size of the anonymous object. */
+ field.set_loc_bitpos (current_bitpos + bit_offset);
+ }
+ else
+ {
+ /* For little endian bits, compute the bit offset to the
+ MSB of the anonymous object, subtract off the number of
+ bits from the MSB of the field to the MSB of the
+ object, and then subtract off the number of bits of
+ the field itself. The result is the bit offset of
+ the LSB of the field. */
+ LONGEST object_size = explicit_byte_size;
+ if (object_size == 0)
+ object_size = field_type->length ();
+
+ field.set_loc_bitpos (current_bitpos
+ + 8 * object_size
+ - bit_offset
+ - field.bitsize ());
+ }
+}
+
+/* See gdbtypes.h. */
+
+void
+resolve_dynamic_field (struct field &field,
+ const property_addr_info *addr_stack,
+ const frame_info_ptr &frame)
+{
+ gdb_assert (!field.is_static ());
+
+ if (field.loc_is_dwarf_block ())
+ {
+ dwarf2_locexpr_baton *field_loc
+ = field.loc_dwarf_block ();
+
+ struct dwarf2_property_baton baton;
+ baton.property_type = lookup_pointer_type (field.type ());
+ baton.locexpr = *field_loc;
+
+ struct dynamic_prop prop;
+ prop.set_locexpr (&baton);
+
+ CORE_ADDR vals[1] = {addr_stack->addr};
+ CORE_ADDR addr_or_bitpos;
+ if (dwarf2_evaluate_property (&prop, frame, addr_stack,
+ &addr_or_bitpos, vals))
+ {
+ if (field.loc_kind () == FIELD_LOC_KIND_DWARF_BLOCK_ADDR)
+ field.set_loc_bitpos (TARGET_CHAR_BIT
+ * (addr_or_bitpos - addr_stack->addr));
+ else
+ field.set_loc_bitpos (addr_or_bitpos);
+
+ if (field_loc->is_field_location)
+ {
+ dwarf2_field_location_baton *fl_baton
+ = static_cast<dwarf2_field_location_baton *> (field_loc);
+ apply_bit_offset_to_field (field, fl_baton->bit_offset,
+ fl_baton->explicit_byte_size);
+ }
+ }
+ }
+
+ /* As we know this field is not a static field, the field's
+ field_loc_kind should be FIELD_LOC_KIND_BITPOS. Verify
+ this is the case, but only trigger a simple error rather
+ than an internal error if that fails. While failing
+ that verification indicates a bug in our code, the error
+ is not severe enough to suggest to the user he stops
+ his debugging session because of it. */
+ if (field.loc_kind () != FIELD_LOC_KIND_BITPOS)
+ error (_("Cannot determine struct field location"
+ " (invalid location kind)"));
+
+ struct property_addr_info pinfo;
+ pinfo.type = check_typedef (field.type ());
+ size_t offset = field.loc_bitpos () / TARGET_CHAR_BIT;
+ pinfo.valaddr = addr_stack->valaddr;
+ if (!pinfo.valaddr.empty ())
+ pinfo.valaddr = pinfo.valaddr.slice (offset);
+ pinfo.addr = addr_stack->addr + offset;
+ pinfo.next = addr_stack;
+
+ field.set_type (resolve_dynamic_type_internal (field.type (),
+ &pinfo, frame, false));
+ gdb_assert (field.loc_kind () == FIELD_LOC_KIND_BITPOS);
+}
+
/* Resolve dynamic bounds of members of the struct TYPE to static
bounds. ADDR_STACK is a stack of struct property_addr_info to
be used if needed during the dynamic resolution. */
static struct type *
resolve_dynamic_struct (struct type *type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const frame_info_ptr &frame)
{
struct type *resolved_type;
- int i;
unsigned resolved_type_bit_length = 0;
gdb_assert (type->code () == TYPE_CODE_STRUCT);
@@ -2707,63 +2828,21 @@ resolve_dynamic_struct (struct type *type,
resolved_type->copy_fields (type);
}
- for (i = 0; i < resolved_type->num_fields (); ++i)
+ for (auto &field : resolved_type->fields ())
{
unsigned new_bit_length;
- struct property_addr_info pinfo;
- if (resolved_type->field (i).is_static ())
+ if (field.is_static ())
continue;
- if (resolved_type->field (i).loc_kind () == FIELD_LOC_KIND_DWARF_BLOCK)
- {
- struct dwarf2_property_baton baton;
- baton.property_type
- = lookup_pointer_type (resolved_type->field (i).type ());
- baton.locexpr = *resolved_type->field (i).loc_dwarf_block ();
-
- struct dynamic_prop prop;
- prop.set_locexpr (&baton);
-
- CORE_ADDR addr;
- if (dwarf2_evaluate_property (&prop, frame, addr_stack, &addr,
- {addr_stack->addr}))
- resolved_type->field (i).set_loc_bitpos
- (TARGET_CHAR_BIT * (addr - addr_stack->addr));
- }
-
- /* As we know this field is not a static field, the field's
- field_loc_kind should be FIELD_LOC_KIND_BITPOS. Verify
- this is the case, but only trigger a simple error rather
- than an internal error if that fails. While failing
- that verification indicates a bug in our code, the error
- is not severe enough to suggest to the user he stops
- his debugging session because of it. */
- if (resolved_type->field (i).loc_kind () != FIELD_LOC_KIND_BITPOS)
- error (_("Cannot determine struct field location"
- " (invalid location kind)"));
+ resolve_dynamic_field (field, addr_stack, frame);
- pinfo.type = check_typedef (resolved_type->field (i).type ());
- size_t offset = resolved_type->field (i).loc_bitpos () / TARGET_CHAR_BIT;
- pinfo.valaddr = addr_stack->valaddr;
- if (!pinfo.valaddr.empty ())
- pinfo.valaddr = pinfo.valaddr.slice (offset);
- pinfo.addr = addr_stack->addr + offset;
- pinfo.next = addr_stack;
-
- resolved_type->field (i).set_type
- (resolve_dynamic_type_internal (resolved_type->field (i).type (),
- &pinfo, frame, false));
- gdb_assert (resolved_type->field (i).loc_kind ()
- == FIELD_LOC_KIND_BITPOS);
-
- new_bit_length = resolved_type->field (i).loc_bitpos ();
- if (resolved_type->field (i).bitsize () != 0)
- new_bit_length += resolved_type->field (i).bitsize ();
+ new_bit_length = field.loc_bitpos ();
+ if (field.bitsize () != 0)
+ new_bit_length += field.bitsize ();
else
{
- struct type *real_type
- = check_typedef (resolved_type->field (i).type ());
+ struct type *real_type = check_typedef (field.type ());
new_bit_length += (real_type->length () * TARGET_CHAR_BIT);
}
@@ -2797,7 +2876,7 @@ resolve_dynamic_struct (struct type *type,
static struct type *
resolve_dynamic_type_internal (struct type *type,
- struct property_addr_info *addr_stack,
+ const property_addr_info *addr_stack,
const frame_info_ptr &frame,
bool top_level)
{
@@ -3330,7 +3409,8 @@ check_stub_method (struct type *type, int method_id, int signature_id)
/* MTYPE may currently be a function (TYPE_CODE_FUNC).
We want a method (TYPE_CODE_METHOD). */
smash_to_method_type (mtype, type, mtype->target_type (),
- argtypes, argcount, p[-2] == '.');
+ gdb::make_array_view (argtypes, argcount),
+ p[-2] == '.');
mtype->set_is_stub (false);
TYPE_FN_FIELD_STUB (f, signature_id) = 0;
}
@@ -3634,12 +3714,12 @@ type_align (struct type *type)
case TYPE_CODE_UNION:
{
int number_of_non_static_fields = 0;
- for (unsigned i = 0; i < type->num_fields (); ++i)
+ for (const auto &field : type->fields ())
{
- if (!type->field (i).is_static ())
+ if (!field.is_static ())
{
number_of_non_static_fields++;
- ULONGEST f_align = type_align (type->field (i).type ());
+ ULONGEST f_align = type_align (field.type ());
if (f_align == 0)
{
/* Don't pretend we know something we don't. */
@@ -4356,7 +4436,8 @@ check_types_equal (struct type *type1, struct type *type2,
field2->loc_physname ()))
return false;
break;
- case FIELD_LOC_KIND_DWARF_BLOCK:
+ case FIELD_LOC_KIND_DWARF_BLOCK_ADDR:
+ case FIELD_LOC_KIND_DWARF_BLOCK_BITPOS:
{
struct dwarf2_locexpr_baton *block1, *block2;
@@ -4973,19 +5054,14 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value)
situation. */
static void
-print_args (struct field *args, int nargs, int spaces)
+print_args (gdb::array_view<struct field> args, int spaces)
{
- if (args != NULL)
+ for (int i = 0; i < args.size (); i++)
{
- int i;
-
- for (i = 0; i < nargs; i++)
- {
- gdb_printf
- ("%*s[%d] name '%s'\n", spaces, "", i,
- args[i].name () != NULL ? args[i].name () : "<NULL>");
- recursive_dump_type (args[i].type (), spaces + 2);
- }
+ gdb_printf
+ ("%*s[%d] name '%s'\n", spaces, "", i,
+ args[i].name () != NULL ? args[i].name () : "<NULL>");
+ recursive_dump_type (args[i].type (), spaces + 2);
}
}
@@ -5026,9 +5102,8 @@ dump_fn_fieldlists (struct type *type, int spaces)
gdb_printf
("%*sargs %s\n", spaces + 8, "",
- host_address_to_string (TYPE_FN_FIELD_ARGS (f, overload_idx)));
+ host_address_to_string (TYPE_FN_FIELD_ARGS (f, overload_idx).data ()));
print_args (TYPE_FN_FIELD_ARGS (f, overload_idx),
- TYPE_FN_FIELD_TYPE (f, overload_idx)->num_fields (),
spaces + 8 + 2);
gdb_printf
("%*sfcontext %s\n", spaces + 8, "",
@@ -5310,7 +5385,7 @@ recursive_dump_type (struct type *type, int spaces)
}
gdb_printf ("\n");
}
- gdb_printf ("%s\n", host_address_to_string (type->fields ()));
+ gdb_printf ("%s\n", host_address_to_string (type->fields ().data ()));
for (idx = 0; idx < type->num_fields (); idx++)
{
field &fld = type->field (idx);
@@ -5501,8 +5576,12 @@ copy_type_recursive (struct type *type, copied_types_hash_t &copied_types)
new_type->field (i).set_loc_physname
(xstrdup (type->field (i).loc_physname ()));
break;
- case FIELD_LOC_KIND_DWARF_BLOCK:
- new_type->field (i).set_loc_dwarf_block
+ case FIELD_LOC_KIND_DWARF_BLOCK_ADDR:
+ new_type->field (i).set_loc_dwarf_block_addr
+ (type->field (i).loc_dwarf_block ());
+ break;
+ case FIELD_LOC_KIND_DWARF_BLOCK_BITPOS:
+ new_type->field (i).set_loc_dwarf_block_bitpos
(type->field (i).loc_dwarf_block ());
break;
default:
@@ -5687,7 +5766,7 @@ append_composite_type_field_raw (struct type *t, const char *name,
struct field *f;
t->set_num_fields (t->num_fields () + 1);
- t->set_fields (XRESIZEVEC (struct field, t->fields (),
+ t->set_fields (XRESIZEVEC (struct field, t->fields ().data (),
t->num_fields ()));
f = &t->field (t->num_fields () - 1);
memset (f, 0, sizeof f[0]);
@@ -5838,7 +5917,7 @@ type::alloc_fields (unsigned int nfields, bool init)
return;
}
- size_t size = nfields * sizeof (*this->fields ());
+ size_t size = nfields * sizeof (struct field);
struct field *fields
= (struct field *) (init
? TYPE_ZALLOC (this, size)
@@ -5857,8 +5936,8 @@ type::copy_fields (struct type *src)
if (nfields == 0)
return;
- size_t size = nfields * sizeof (*this->fields ());
- memcpy (this->fields (), src->fields (), size);
+ size_t size = nfields * sizeof (struct field);
+ memcpy (this->fields ().data (), src->fields ().data (), size);
}
/* See gdbtypes.h. */
@@ -5871,8 +5950,8 @@ type::copy_fields (std::vector<struct field> &src)
if (nfields == 0)
return;
- size_t size = nfields * sizeof (*this->fields ());
- memcpy (this->fields (), src.data (), size);
+ size_t size = nfields * sizeof (struct field);
+ memcpy (this->fields ().data (), src.data (), size);
}
/* See gdbtypes.h. */
@@ -6115,17 +6194,25 @@ builtin_type (struct objfile *objfile)
return builtin_type (objfile->arch ());
}
-/* See gdbtypes.h. */
+/* See dwarf2/call-site.h. */
CORE_ADDR
call_site::pc () const
{
+ /* dwarf2_per_objfile is defined in dwarf/read.c, so if that is disabled
+ at configure time, we won't be able to use this relocate function.
+ This is dwarf-specific, and would ideally be in call-site.h, but
+ including dwarf2/read.h in dwarf2/call-site.h will lead to things being
+ included in the wrong order and many compilation errors will happen.
+ This is the next best thing. */
+#if defined(DWARF_FORMAT_AVAILABLE)
return per_objfile->relocate (m_unrelocated_pc);
+#else
+ gdb_assert_not_reached ("unexpected call_site object found");
+#endif
}
-void _initialize_gdbtypes ();
-void
-_initialize_gdbtypes ()
+INIT_GDB_FILE (gdbtypes)
{
add_setshow_zuinteger_cmd ("overload", no_class, &overload_debug,
_("Set debugging of C++ overloading."),
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 0cc97ae..0d514d0 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1,6 +1,6 @@
/* Internal type definitions for GDB.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules.
@@ -259,7 +259,7 @@ enum dynamic_prop_kind
{
PROP_UNDEFINED, /* Not defined. */
PROP_CONST, /* Constant. */
- PROP_ADDR_OFFSET, /* Address offset. */
+ PROP_FIELD, /* Field of a type. */
PROP_LOCEXPR, /* Location expression. */
PROP_LOCLIST, /* Location list. */
PROP_VARIANT_PARTS, /* Variant parts. */
@@ -347,7 +347,7 @@ struct dynamic_prop
{
gdb_assert (m_kind == PROP_LOCEXPR
|| m_kind == PROP_LOCLIST
- || m_kind == PROP_ADDR_OFFSET);
+ || m_kind == PROP_FIELD);
return m_data.baton;
}
@@ -364,9 +364,9 @@ struct dynamic_prop
m_data.baton = baton;
}
- void set_addr_offset (const dwarf2_property_baton *baton)
+ void set_field (const dwarf2_property_baton *baton)
{
- m_kind = PROP_ADDR_OFFSET;
+ m_kind = PROP_FIELD;
m_data.baton = baton;
}
@@ -480,7 +480,10 @@ enum field_loc_kind
FIELD_LOC_KIND_ENUMVAL, /**< enumval */
FIELD_LOC_KIND_PHYSADDR, /**< physaddr */
FIELD_LOC_KIND_PHYSNAME, /**< physname */
- FIELD_LOC_KIND_DWARF_BLOCK /**< dwarf_block */
+ /* A DWARF block that computes the address of the field. */
+ FIELD_LOC_KIND_DWARF_BLOCK_ADDR, /**< dwarf_block */
+ /* A DWARF block that computes the bit offset of the field. */
+ FIELD_LOC_KIND_DWARF_BLOCK_BITPOS,
};
/* * A discriminant to determine which field in the
@@ -616,6 +619,13 @@ struct field
return m_loc_kind;
}
+ /* Return true if this location has either "DWARF block" kind. */
+ bool loc_is_dwarf_block () const
+ {
+ return (m_loc_kind == FIELD_LOC_KIND_DWARF_BLOCK_ADDR
+ || m_loc_kind == FIELD_LOC_KIND_DWARF_BLOCK_BITPOS);
+ }
+
LONGEST loc_bitpos () const
{
gdb_assert (m_loc_kind == FIELD_LOC_KIND_BITPOS);
@@ -666,13 +676,19 @@ struct field
dwarf2_locexpr_baton *loc_dwarf_block () const
{
- gdb_assert (m_loc_kind == FIELD_LOC_KIND_DWARF_BLOCK);
+ gdb_assert (loc_is_dwarf_block ());
return m_loc.dwarf_block;
}
- void set_loc_dwarf_block (dwarf2_locexpr_baton *dwarf_block)
+ void set_loc_dwarf_block_addr (dwarf2_locexpr_baton *dwarf_block)
{
- m_loc_kind = FIELD_LOC_KIND_DWARF_BLOCK;
+ m_loc_kind = FIELD_LOC_KIND_DWARF_BLOCK_ADDR;
+ m_loc.dwarf_block = dwarf_block;
+ }
+
+ void set_loc_dwarf_block_bitpos (dwarf2_locexpr_baton *dwarf_block)
+ {
+ m_loc_kind = FIELD_LOC_KIND_DWARF_BLOCK_BITPOS;
m_loc.dwarf_block = dwarf_block;
}
@@ -1064,12 +1080,6 @@ struct type
this->main_type->m_nfields = num_fields;
}
- /* Get the fields array of this type. */
- struct field *fields () const
- {
- return this->main_type->flds_bnds.fields;
- }
-
/* Get the field at index IDX. */
struct field &field (int idx) const
{
@@ -1077,6 +1087,13 @@ struct type
return this->fields ()[idx];
}
+ /* Return an array view of the fields. */
+ gdb::array_view<struct field> fields () const
+ {
+ return gdb::make_array_view (this->main_type->flds_bnds.fields,
+ num_fields ());
+ }
+
/* Set the fields array of this type. */
void set_fields (struct field *fields)
{
@@ -2454,8 +2471,9 @@ extern struct type *lookup_memberptr_type (struct type *, struct type *);
extern struct type *lookup_methodptr_type (struct type *);
extern void smash_to_method_type (struct type *type, struct type *self_type,
- struct type *to_type, struct field *args,
- int nargs, int varargs);
+ struct type *to_type,
+ gdb::array_view<struct field> args,
+ int varargs);
extern void smash_to_memberptr_type (struct type *, struct type *,
struct type *);
@@ -2510,11 +2528,25 @@ extern struct type *lookup_pointer_type (struct type *);
extern struct type *make_function_type (struct type *, struct type **);
-extern struct type *lookup_function_type (struct type *);
-
-extern struct type *lookup_function_type_with_arguments (struct type *,
- int,
- struct type **);
+/* Given a return type and argument types, create new function type.
+ If the final type in PARAM_TYPES is NULL, create a varargs function.
+ New type is allocated using ALLOC. */
+extern struct type *create_function_type (type_allocator &alloc,
+ struct type *return_type,
+ int nparams,
+ struct type **param_types);
+
+/* Like create_function_type, but allocate the new function type at
+ the same obstack as RETURN_TYPE and with unspecified number of
+ parameters and their types. */
+extern struct type *lookup_function_type (struct type *return_type);
+
+/* Like create_function_type, but allocate the new function type at
+ the same obstack as RETURN_TYPE. */
+extern struct type *lookup_function_type_with_arguments
+ (struct type *return_type,
+ int nparams,
+ struct type **param_types);
/* Create a range type using ALLOC.
@@ -2629,6 +2661,41 @@ extern struct type *resolve_dynamic_type
"dynamic". */
extern bool is_dynamic_type (struct type *type);
+/* Resolve any dynamic components of FIELD. FIELD is updated.
+ ADDR_STACK and FRAME are used where necessary to supply information
+ for the resolution process; see resolve_dynamic_type.
+ Specifically, after calling this, the field's bit position will be
+ a constant, and the field's type will not have dynamic properties.
+
+ This function assumes that FIELD is not a static field. */
+
+extern void resolve_dynamic_field (struct field &field,
+ const struct property_addr_info *addr_stack,
+ const frame_info_ptr &frame);
+
+/* A helper function that handles the DWARF semantics for
+ DW_AT_bit_offset.
+
+ DWARF 3 specified DW_AT_bit_offset in a funny way, making it simple
+ to use on big-endian targets but somewhat difficult for
+ little-endian. This function handles the logic here.
+
+ While DW_AT_bit_offset was deprecated in DWARF 4 (and removed
+ entirely from DWARF 5), it is still useful because it is the only
+ way to describe a field that appears at a non-constant bit
+ offset.
+
+ FIELD is updated in-place. It is assumed that FIELD already has a
+ constant bit position. BIT_OFFSET is the value of the
+ DW_AT_bit_offset attribute, and EXPLICIT_BYTE_SIZE is either the
+ value of a DW_AT_byte_size from the field's DIE -- indicating an
+ explicit size of the enclosing anonymous object -- or it may be 0,
+ indicating that the field's type size should be used. */
+
+extern void apply_bit_offset_to_field (struct field &field,
+ LONGEST bit_offset,
+ LONGEST explicit_byte_size);
+
extern struct type *check_typedef (struct type *);
extern void check_stub_method_group (struct type *, int);
diff --git a/gdb/glibc-tdep.c b/gdb/glibc-tdep.c
index e3bf00c..12ad3cc 100644
--- a/gdb/glibc-tdep.c
+++ b/gdb/glibc-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the GNU C Library (glibc).
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/glibc-tdep.h b/gdb/glibc-tdep.h
index 17006d0..b73c409 100644
--- a/gdb/glibc-tdep.h
+++ b/gdb/glibc-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for the GNU C Library (glibc).
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/gmp-utils.c b/gdb/gmp-utils.c
index aabdd5f..5c5423a 100644
--- a/gdb/gmp-utils.c
+++ b/gdb/gmp-utils.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -250,10 +250,7 @@ xfree_for_gmp (void *ptr, size_t size)
xfree (ptr);
}
-void _initialize_gmp_utils ();
-
-void
-_initialize_gmp_utils ()
+INIT_GDB_FILE (gmp_utils)
{
/* Tell GMP to use GDB's memory management routines. */
mp_set_memory_functions (xmalloc, xrealloc_for_gmp, xfree_for_gmp);
diff --git a/gdb/gmp-utils.h b/gdb/gmp-utils.h
index f1c9104..b9d1424 100644
--- a/gdb/gmp-utils.h
+++ b/gdb/gmp-utils.h
@@ -1,6 +1,6 @@
/* Miscellaneous routines making it easier to use GMP within GDB's framework.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/gnu-nat-mig.h b/gdb/gnu-nat-mig.h
index 01c1ed4..06d0748 100644
--- a/gdb/gnu-nat-mig.h
+++ b/gdb/gnu-nat-mig.h
@@ -1,5 +1,5 @@
/* Common things used by the various *gnu-nat.c files
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index c6fe7a9..41cbebf 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -1,5 +1,5 @@
/* Interface GDB to the GNU Hurd.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -50,7 +50,6 @@ extern "C"
}
-#include <ctype.h>
#include <setjmp.h>
#include <signal.h>
#include <sys/ptrace.h>
@@ -2624,7 +2623,7 @@ gnu_nat_target::find_memory_regions (find_memory_region_ftype func,
last_protection & VM_PROT_READ,
last_protection & VM_PROT_WRITE,
last_protection & VM_PROT_EXECUTE,
- 1, /* MODIFIED is unknown, pass it as true. */
+ true, /* MODIFIED is unknown, pass it as true. */
false, /* No memory tags in the object file. */
data);
last_region_address = region_address;
@@ -2926,7 +2925,7 @@ set_sig_thread_cmd (const char *args, int from_tty)
{
struct inf *inf = cur_inf ();
- if (!args || (!isdigit (*args) && strcmp (args, "none") != 0))
+ if (!args || (!c_isdigit (*args) && strcmp (args, "none") != 0))
error (_("Illegal argument to \"set signal-thread\" command.\n"
"Should be a thread ID, or \"none\"."));
@@ -3434,9 +3433,7 @@ to the thread's initial suspend-count when gdb notices the threads."),
&thread_cmd_list);
}
-void _initialize_gnu_nat ();
-void
-_initialize_gnu_nat ()
+INIT_GDB_FILE (gnu_nat)
{
proc_server = getproc ();
diff --git a/gdb/gnu-nat.h b/gdb/gnu-nat.h
index 700a01a..b77d819 100644
--- a/gdb/gnu-nat.h
+++ b/gdb/gnu-nat.h
@@ -1,5 +1,5 @@
/* Common things used by the various *gnu-nat.c files
- Copyright (C) 1995-2024 Free Software Foundation, Inc.
+ Copyright (C) 1995-2025 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c
index 0a9c09e..1fbc41d 100644
--- a/gdb/gnu-v2-abi.c
+++ b/gdb/gnu-v2-abi.c
@@ -1,6 +1,6 @@
/* Abstraction of GNU v2 abi.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
Contributed by Daniel Berlin <dberlin@redhat.com>
@@ -26,7 +26,6 @@
#include "gdb-demangle.h"
#include "cp-abi.h"
#include "cp-support.h"
-#include <ctype.h>
static cp_abi_ops gnu_v2_abi_ops;
@@ -46,7 +45,7 @@ static enum ctor_kinds
gnuv2_is_constructor_name (const char *name)
{
if ((name[0] == '_' && name[1] == '_'
- && (isdigit (name[2]) || strchr ("Qt", name[2])))
+ && (c_isdigit (name[2]) || strchr ("Qt", name[2])))
|| startswith (name, "__ct__"))
return complete_object_ctor;
else
@@ -265,15 +264,9 @@ gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top, int *using_enc)
if (top && ((*top) >0))
{
if (rtti_type->length () > known_type->length ())
- {
- if (full)
- *full=0;
- }
+ *full = 0;
else
- {
- if (full)
- *full=1;
- }
+ *full = 1;
}
}
else
@@ -411,9 +404,7 @@ init_gnuv2_ops (void)
gnu_v2_abi_ops.baseclass_offset = gnuv2_baseclass_offset;
}
-void _initialize_gnu_v2_abi ();
-void
-_initialize_gnu_v2_abi ()
+INIT_GDB_FILE (gnu_v2_abi)
{
init_gnuv2_ops ();
register_cp_abi (&gnu_v2_abi_ops);
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index b51c4d2..e3818d9 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -1,7 +1,7 @@
/* Abstraction of GNU v3 abi.
Contributed by Jim Blandy <jimb@redhat.com>
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -476,7 +476,7 @@ gnuv3_baseclass_offset (struct type *type, int index,
return TYPE_BASECLASS_BITPOS (type, index) / 8;
/* If we have a DWARF expression for the offset, evaluate it. */
- if (type->field (index).loc_kind () == FIELD_LOC_KIND_DWARF_BLOCK)
+ if (type->field (index).loc_kind () == FIELD_LOC_KIND_DWARF_BLOCK_ADDR)
{
struct dwarf2_property_baton baton;
baton.property_type
@@ -1178,7 +1178,7 @@ gnuv3_get_type_from_type_info (struct value *type_info_ptr)
{
/* We have to parse the type name, since in general there is not a
symbol for a type. This is somewhat bogus since there may be a
- mis-parse. Another approach might be to re-use the demangler's
+ mis-parse. Another approach might be to reuse the demangler's
internal form to reconstruct the type somehow. */
std::string type_name = gnuv3_get_typename_from_type_info (type_info_ptr);
expression_up expr (parse_expression (type_name.c_str ()));
@@ -1570,9 +1570,7 @@ init_gnuv3_ops (void)
gnu_v3_abi_ops.pass_by_reference = gnuv3_pass_by_reference;
}
-void _initialize_gnu_v3_abi ();
-void
-_initialize_gnu_v3_abi ()
+INIT_GDB_FILE (gnu_v3_abi)
{
init_gnuv3_ops ();
diff --git a/gdb/go-exp.y b/gdb/go-exp.y
index 8fd6737..5da8cef 100644
--- a/gdb/go-exp.y
+++ b/gdb/go-exp.y
@@ -1,6 +1,6 @@
/* YACC parser for Go expressions, for GDB.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -51,7 +51,6 @@
%{
-#include <ctype.h>
#include "expression.h"
#include "value.h"
#include "parser-defs.h"
@@ -663,13 +662,13 @@ parse_number (struct parser_state *par_state,
/* Handle suffixes: 'f' for float32, 'l' for long double.
FIXME: This appears to be an extension -- do we want this? */
- if (len >= 1 && tolower (p[len - 1]) == 'f')
+ if (len >= 1 && c_tolower (p[len - 1]) == 'f')
{
putithere->typed_val_float.type
= builtin_go_types->builtin_float32;
len--;
}
- else if (len >= 1 && tolower (p[len - 1]) == 'l')
+ else if (len >= 1 && c_tolower (p[len - 1]) == 'l')
{
putithere->typed_val_float.type
= parse_type (par_state)->builtin_long_double;
@@ -1113,9 +1112,9 @@ lex_one_token (struct parser_state *par_state)
const char *p = &tokstart[1];
size_t len = strlen ("entry");
- while (isspace (*p))
+ while (c_isspace (*p))
p++;
- if (strncmp (p, "entry", len) == 0 && !isalnum (p[len])
+ if (strncmp (p, "entry", len) == 0 && !c_isalnum (p[len])
&& p[len] != '_')
{
par_state->lexptr = &p[len];
@@ -1290,7 +1289,7 @@ package_name_p (const char *name, const struct block *block)
&is_a_field_of_this).symbol;
if (sym
- && sym->aclass () == LOC_TYPEDEF
+ && sym->loc_class () == LOC_TYPEDEF
&& sym->type ()->code () == TYPE_CODE_MODULE)
return 1;
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index 18d3fc1..23ffedb 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -1,6 +1,6 @@
/* Go language support routines for GDB, the GNU debugger.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -41,7 +41,6 @@
#include "parser-defs.h"
#include "gdbarch.h"
-#include <ctype.h>
/* The main function in the main package. */
static const char GO_MAIN_MAIN[] = "main.main";
@@ -292,7 +291,7 @@ unpack_mangled_go_symbol (const char *mangled_name,
while (p > buf)
{
int current = *(const unsigned char *) --p;
- int current_is_digit = isdigit (current);
+ int current_is_digit = c_isdigit (current);
if (saw_digit)
{
diff --git a/gdb/go-lang.h b/gdb/go-lang.h
index 030febc..8391688 100644
--- a/gdb/go-lang.h
+++ b/gdb/go-lang.h
@@ -1,6 +1,6 @@
/* Go language support definitions for GDB, the GNU debugger.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/go-typeprint.c b/gdb/go-typeprint.c
index 7778c71..5269f53 100644
--- a/gdb/go-typeprint.c
+++ b/gdb/go-typeprint.c
@@ -1,6 +1,6 @@
/* Support for printing Go types for GDB, the GNU debugger.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/go-valprint.c b/gdb/go-valprint.c
index 43f279a..3248b6c 100644
--- a/gdb/go-valprint.c
+++ b/gdb/go-valprint.c
@@ -1,6 +1,6 @@
/* Support for printing Go values for GDB, the GNU debugger.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index 7852f56..ab13b57 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -1,5 +1,5 @@
/* Native debugging support for Intel x86 running DJGPP.
- Copyright (C) 1997-2024 Free Software Foundation, Inc.
+ Copyright (C) 1997-2025 Free Software Foundation, Inc.
Written by Robert Hoehne.
This file is part of GDB.
@@ -103,7 +103,6 @@
#include "cli/cli-utils.h"
#include "inf-child.h"
-#include <ctype.h>
#include <unistd.h>
#include <sys/utsname.h>
#include <io.h>
@@ -2057,9 +2056,7 @@ go32_pte_for_address (const char *arg, int from_tty)
static struct cmd_list_element *info_dos_cmdlist = NULL;
-void _initialize_go32_nat ();
-void
-_initialize_go32_nat ()
+INIT_GDB_FILE (go32_nat)
{
x86_dr_low.set_control = go32_set_dr7;
x86_dr_low.set_addr = go32_set_dr;
diff --git a/gdb/gregset.h b/gdb/gregset.h
index 9345625..b77ea6b 100644
--- a/gdb/gregset.h
+++ b/gdb/gregset.h
@@ -1,5 +1,5 @@
/* Interface for functions using gregset and fpregset types.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/gstack-1.in b/gdb/gstack-1.in
index 25339d9..ac5e8d4 100755
--- a/gdb/gstack-1.in
+++ b/gdb/gstack-1.in
@@ -64,7 +64,7 @@ function print_version() {
while getopts hv-: OPT; do
if [ "$OPT" = "-" ]; then
OPT="${OPTARG%%=*}"
- OPTARG="${OPTARG#'$OPT'}"
+ OPTARG="${OPTARG#"$OPT"}"
OPTARG="${OPTARG#=}"
fi
@@ -132,6 +132,7 @@ EOF
)
# Run GDB and remove some unwanted noise.
+# shellcheck disable=SC2086
"$GDB" --quiet -nx $GDBARGS <<EOF |
set width 0
set height 0
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
index 090badd..60a8bf3 100644
--- a/gdb/guile/guile-internal.h
+++ b/gdb/guile/guile-internal.h
@@ -1,6 +1,6 @@
/* Internal header for GDB/Scheme code.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -449,10 +449,11 @@ extern const struct block *bkscm_scm_to_block
/* scm-cmd.c */
-extern char *gdbscm_parse_command_name (const char *name,
- const char *func_name, int arg_pos,
- struct cmd_list_element ***base_list,
- struct cmd_list_element **start_list);
+extern char *gdbscm_parse_command_name
+ (const char *name, const char *func_name, int arg_pos,
+ struct cmd_list_element ***base_list,
+ struct cmd_list_element **start_list,
+ struct cmd_list_element **prefix_cmd = nullptr);
extern int gdbscm_valid_command_class_p (int command_class);
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index 5358b83..66a74b3 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -1,6 +1,6 @@
/* General GDB/Guile code.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -827,9 +827,7 @@ message == an error message without a stack will be printed."),
&set_guile_list, &show_guile_list);
}
-void _initialize_guile ();
-void
-_initialize_guile ()
+INIT_GDB_FILE (guile)
{
install_gdb_commands ();
}
diff --git a/gdb/guile/guile.h b/gdb/guile/guile.h
index 6ce4864..b90a306 100644
--- a/gdb/guile/guile.h
+++ b/gdb/guile/guile.h
@@ -1,6 +1,6 @@
/* General GDB/Scheme code.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/guile/lib/gdb.scm b/gdb/guile/lib/gdb.scm
index afa6aa3..d0272970 100644
--- a/gdb/guile/lib/gdb.scm
+++ b/gdb/guile/lib/gdb.scm
@@ -1,6 +1,6 @@
;; Scheme side of the gdb module.
;;
-;; Copyright (C) 2014-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2025 Free Software Foundation, Inc.
;;
;; This file is part of GDB.
;;
diff --git a/gdb/guile/lib/gdb/boot.scm b/gdb/guile/lib/gdb/boot.scm
index 31a47d0..b41551b 100644
--- a/gdb/guile/lib/gdb/boot.scm
+++ b/gdb/guile/lib/gdb/boot.scm
@@ -1,6 +1,6 @@
;; Bootstrap the Scheme side of the gdb module.
;;
-;; Copyright (C) 2014-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2025 Free Software Foundation, Inc.
;;
;; This file is part of GDB.
;;
diff --git a/gdb/guile/lib/gdb/experimental.scm b/gdb/guile/lib/gdb/experimental.scm
index 0c79d18..df56f05 100644
--- a/gdb/guile/lib/gdb/experimental.scm
+++ b/gdb/guile/lib/gdb/experimental.scm
@@ -1,7 +1,7 @@
;; Various experimental utilities.
;; Anything in this file can change or disappear.
;;
-;; Copyright (C) 2014-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2025 Free Software Foundation, Inc.
;;
;; This file is part of GDB.
;;
diff --git a/gdb/guile/lib/gdb/init.scm b/gdb/guile/lib/gdb/init.scm
index a675c6c..81a16e5 100644
--- a/gdb/guile/lib/gdb/init.scm
+++ b/gdb/guile/lib/gdb/init.scm
@@ -1,6 +1,6 @@
;; Scheme side of the gdb module.
;;
-;; Copyright (C) 2014-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2025 Free Software Foundation, Inc.
;;
;; This file is part of GDB.
;;
diff --git a/gdb/guile/lib/gdb/iterator.scm b/gdb/guile/lib/gdb/iterator.scm
index 7ef15be..14a957b 100644
--- a/gdb/guile/lib/gdb/iterator.scm
+++ b/gdb/guile/lib/gdb/iterator.scm
@@ -1,7 +1,7 @@
;; Iteration utilities.
;; Anything in this file can change or disappear.
;;
-;; Copyright (C) 2014-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2025 Free Software Foundation, Inc.
;;
;; This file is part of GDB.
;;
diff --git a/gdb/guile/lib/gdb/printing.scm b/gdb/guile/lib/gdb/printing.scm
index 19daddd..3116c7c 100644
--- a/gdb/guile/lib/gdb/printing.scm
+++ b/gdb/guile/lib/gdb/printing.scm
@@ -1,6 +1,6 @@
;; Additional pretty-printer support.
;;
-;; Copyright (C) 2014-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2025 Free Software Foundation, Inc.
;;
;; This file is part of GDB.
;;
diff --git a/gdb/guile/lib/gdb/support.scm b/gdb/guile/lib/gdb/support.scm
index 8b575ef..f508f16 100644
--- a/gdb/guile/lib/gdb/support.scm
+++ b/gdb/guile/lib/gdb/support.scm
@@ -1,6 +1,6 @@
;; Internal support routines.
;;
-;; Copyright (C) 2014-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2025 Free Software Foundation, Inc.
;;
;; This file is part of GDB.
;;
diff --git a/gdb/guile/lib/gdb/types.scm b/gdb/guile/lib/gdb/types.scm
index 7d8d3c6..a7b168c 100644
--- a/gdb/guile/lib/gdb/types.scm
+++ b/gdb/guile/lib/gdb/types.scm
@@ -1,5 +1,5 @@
;; Type utilities.
-;; Copyright (C) 2010-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2025 Free Software Foundation, Inc.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
diff --git a/gdb/guile/scm-arch.c b/gdb/guile/scm-arch.c
index 02adad0..8704d16 100644
--- a/gdb/guile/scm-arch.c
+++ b/gdb/guile/scm-arch.c
@@ -1,6 +1,6 @@
/* Scheme interface to architecture.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/guile/scm-auto-load.c b/gdb/guile/scm-auto-load.c
index ea87ab7..4413744 100644
--- a/gdb/guile/scm-auto-load.c
+++ b/gdb/guile/scm-auto-load.c
@@ -1,6 +1,6 @@
/* GDB routines for supporting auto-loaded Guile scripts.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c
index 4ca4311..a4e692b 100644
--- a/gdb/guile/scm-block.c
+++ b/gdb/guile/scm-block.c
@@ -1,6 +1,6 @@
/* Scheme interface to blocks.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index b8a5d82..7765b1e 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -1,6 +1,6 @@
/* Scheme interface to breakpoints.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index 8255529..ef4c9d6 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -1,6 +1,6 @@
/* GDB commands implemented in Scheme.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,7 +20,6 @@
/* See README file in this directory for implementation notes, coding
conventions, et.al. */
-#include <ctype.h>
#include "charset.h"
#include "cli/cli-cmds.h"
#include "cli/cli-decode.h"
@@ -457,11 +456,13 @@ cmdscm_completer (struct cmd_list_element *command,
name of the new command. All earlier words must be existing prefix
commands.
- *BASE_LIST is set to the final prefix command's list of
- *sub-commands.
+ *BASE_LIST is set to the final prefix command's list of sub-commands.
START_LIST is the list in which the search starts.
+ When PREFIX_CMD is not NULL then *PREFIX_CMD is set to the prefix
+ command itself, or NULL, if there is no prefix command.
+
This function returns the xmalloc()d name of the new command.
On error a Scheme exception is thrown. */
@@ -469,13 +470,17 @@ char *
gdbscm_parse_command_name (const char *name,
const char *func_name, int arg_pos,
struct cmd_list_element ***base_list,
- struct cmd_list_element **start_list)
+ struct cmd_list_element **start_list,
+ struct cmd_list_element **prefix_cmd)
{
struct cmd_list_element *elt;
int len = strlen (name);
int i, lastchar;
char *msg;
+ if (prefix_cmd != nullptr)
+ *prefix_cmd = nullptr;
+
/* Skip trailing whitespace. */
for (i = len - 1; i >= 0 && (name[i] == ' ' || name[i] == '\t'); --i)
;
@@ -490,9 +495,9 @@ gdbscm_parse_command_name (const char *name,
/* Find first character of the final word. */
for (; i > 0 && valid_cmd_char_p (name[i - 1]); --i)
;
- gdb::unique_xmalloc_ptr<char> result ((char *) xmalloc (lastchar - i + 2));
- memcpy (result.get (), &name[i], lastchar - i + 1);
- result.get ()[lastchar - i + 1] = '\0';
+
+ gdb::unique_xmalloc_ptr<char> result
+ = make_unique_xstrndup (&name[i], lastchar - i + 1);
/* Skip whitespace again. */
for (--i; i >= 0 && (name[i] == ' ' || name[i] == '\t'); --i)
@@ -503,18 +508,21 @@ gdbscm_parse_command_name (const char *name,
return result.release ();
}
- gdb::unique_xmalloc_ptr<char> prefix_text ((char *) xmalloc (i + 2));
- memcpy (prefix_text.get (), name, i + 1);
- prefix_text.get ()[i + 1] = '\0';
+ gdb::unique_xmalloc_ptr<char> prefix_text
+ = make_unique_xstrndup (name, i + 1);
const char *prefix_text2 = prefix_text.get ();
elt = lookup_cmd_1 (&prefix_text2, *start_list, NULL, NULL, 1);
- if (elt == NULL || elt == CMD_LIST_AMBIGUOUS)
+ if (elt == nullptr || elt == CMD_LIST_AMBIGUOUS || *prefix_text2 != '\0')
{
msg = xstrprintf (_("could not find command prefix '%s'"),
prefix_text.get ()).release ();
scm_dynwind_begin ((scm_t_dynwind_flags) 0);
gdbscm_dynwind_xfree (msg);
+ /* Release memory now as the destructors will not be run when the
+ guile exception is thrown. */
+ result = nullptr;
+ prefix_text = nullptr;
gdbscm_out_of_range_error (func_name, arg_pos,
gdbscm_scm_from_c_string (name), msg);
}
@@ -522,6 +530,8 @@ gdbscm_parse_command_name (const char *name,
if (elt->is_prefix ())
{
*base_list = elt->subcommands;
+ if (prefix_cmd != nullptr)
+ *prefix_cmd = elt;
return result.release ();
}
@@ -529,6 +539,10 @@ gdbscm_parse_command_name (const char *name,
prefix_text.get ()).release ();
scm_dynwind_begin ((scm_t_dynwind_flags) 0);
gdbscm_dynwind_xfree (msg);
+ /* Release memory now as the destructors will not be run when the guile
+ exception is thrown. */
+ result = nullptr;
+ prefix_text = nullptr;
gdbscm_out_of_range_error (func_name, arg_pos,
gdbscm_scm_from_c_string (name), msg);
/* NOTREACHED */
@@ -743,8 +757,9 @@ gdbscm_register_command_x (SCM self)
if (cmdscm_is_valid (c_smob))
scm_misc_error (FUNC_NAME, _("command is already registered"), SCM_EOL);
+ struct cmd_list_element *prefix_cmd = nullptr;
cmd_name = gdbscm_parse_command_name (c_smob->name, FUNC_NAME, SCM_ARG1,
- &cmd_list, &cmdlist);
+ &cmd_list, &cmdlist, &prefix_cmd);
c_smob->cmd_name = gdbscm_gc_xstrdup (cmd_name);
xfree (cmd_name);
@@ -753,18 +768,50 @@ gdbscm_register_command_x (SCM self)
{
if (c_smob->is_prefix)
{
- /* If we have our own "invoke" method, then allow unknown
- sub-commands. */
- int allow_unknown = gdbscm_is_true (c_smob->invoke);
+ bool has_invoke = gdbscm_is_true (c_smob->invoke) == 1;
- cmd = add_prefix_cmd (c_smob->cmd_name, c_smob->cmd_class,
- NULL, c_smob->doc, &c_smob->sub_list,
- allow_unknown, cmd_list);
+ if (has_invoke)
+ {
+ cmd = add_prefix_cmd (c_smob->cmd_name, c_smob->cmd_class,
+ NULL, c_smob->doc, &c_smob->sub_list,
+ 1 /* allow_unknown */, cmd_list);
+ cmd->func = cmdscm_function;
+ }
+ else
+ {
+ /* If there is no 'invoke' method, then create the prefix
+ using the standard prefix callbacks. This means that for
+ 'set prefix' the user will get the help text listing all
+ of the sub-commands, and for 'show prefix', the user will
+ see all of the sub-command values. */
+ if (prefix_cmd != nullptr)
+ {
+ while (prefix_cmd->prefix != nullptr)
+ prefix_cmd = prefix_cmd->prefix;
+ }
+
+ bool is_show = (prefix_cmd != nullptr
+ && prefix_cmd->subcommands == &showlist);
+
+ if (is_show)
+ cmd = add_show_prefix_cmd (c_smob->cmd_name,
+ c_smob->cmd_class,
+ c_smob->doc,
+ &c_smob->sub_list,
+ 0 /* allow_unknown */, cmd_list);
+ else
+ cmd = add_basic_prefix_cmd (c_smob->cmd_name,
+ c_smob->cmd_class,
+ c_smob->doc,
+ &c_smob->sub_list,
+ 0 /* allow_unknown */, cmd_list);
+ }
}
else
{
cmd = add_cmd (c_smob->cmd_name, c_smob->cmd_class,
c_smob->doc, cmd_list);
+ cmd->func = cmdscm_function;
}
}
catch (const gdb_exception &except)
@@ -777,7 +824,6 @@ gdbscm_register_command_x (SCM self)
So no more errors after this point. */
/* There appears to be no API to set this. */
- cmd->func = cmdscm_function;
cmd->destroyer = cmdscm_destroyer;
c_smob->command = cmd;
diff --git a/gdb/guile/scm-color.c b/gdb/guile/scm-color.c
index 6ebe252..cde22e5 100644
--- a/gdb/guile/scm-color.c
+++ b/gdb/guile/scm-color.c
@@ -1,6 +1,6 @@
/* GDB parameters implemented in Guile.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -24,6 +24,7 @@
#include "language.h"
#include "arch-utils.h"
#include "guile-internal.h"
+#include "cli/cli-style.h"
/* A GDB color. */
@@ -354,8 +355,14 @@ gdbscm_color_escape_sequence (SCM self, SCM is_fg_scm)
const ui_file_style::color &color = coscm_get_color (self);
SCM_ASSERT_TYPE (gdbscm_is_bool (is_fg_scm), is_fg_scm, SCM_ARG2, FUNC_NAME,
_("boolean"));
- bool is_fg = gdbscm_is_true (is_fg_scm);
- std::string s = color.to_ansi (is_fg);
+
+ std::string s;
+ if (term_cli_styling ())
+ {
+ bool is_fg = gdbscm_is_true (is_fg_scm);
+ s = color.to_ansi (is_fg);
+ }
+
return gdbscm_scm_from_host_string (s.c_str (), s.size ());
}
diff --git a/gdb/guile/scm-disasm.c b/gdb/guile/scm-disasm.c
index 0c7c4ec..1c8fc2d 100644
--- a/gdb/guile/scm-disasm.c
+++ b/gdb/guile/scm-disasm.c
@@ -1,6 +1,6 @@
/* Scheme interface to architecture.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/guile/scm-exception.c b/gdb/guile/scm-exception.c
index 61007de..2861c88 100644
--- a/gdb/guile/scm-exception.c
+++ b/gdb/guile/scm-exception.c
@@ -1,6 +1,6 @@
/* GDB/Scheme exception support.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index c94fcfe..db35ae5 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -1,6 +1,6 @@
/* Scheme interface to stack frames.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/guile/scm-gsmob.c b/gdb/guile/scm-gsmob.c
index b3efad2..7a7a69d 100644
--- a/gdb/guile/scm-gsmob.c
+++ b/gdb/guile/scm-gsmob.c
@@ -1,6 +1,6 @@
/* GDB/Scheme smobs (gsmob is pronounced "jee smob")
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/guile/scm-iterator.c b/gdb/guile/scm-iterator.c
index f4d5344..9c2f0e8 100644
--- a/gdb/guile/scm-iterator.c
+++ b/gdb/guile/scm-iterator.c
@@ -1,6 +1,6 @@
/* Simple iterators for GDB/Scheme.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/guile/scm-lazy-string.c b/gdb/guile/scm-lazy-string.c
index 586c92c..0c5aa59 100644
--- a/gdb/guile/scm-lazy-string.c
+++ b/gdb/guile/scm-lazy-string.c
@@ -1,6 +1,6 @@
/* Scheme interface to lazy strings.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/guile/scm-math.c b/gdb/guile/scm-math.c
index 7a4a703..6c4ee79 100644
--- a/gdb/guile/scm-math.c
+++ b/gdb/guile/scm-math.c
@@ -1,6 +1,6 @@
/* GDB/Scheme support for math operations on values.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/guile/scm-objfile.c b/gdb/guile/scm-objfile.c
index d6c0559..35477d8 100644
--- a/gdb/guile/scm-objfile.c
+++ b/gdb/guile/scm-objfile.c
@@ -1,6 +1,6 @@
/* Scheme interface to objfiles.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -353,9 +353,9 @@ gdbscm_objfiles (void)
result = SCM_EOL;
- for (objfile *objf : current_program_space->objfiles ())
+ for (objfile &objf : current_program_space->objfiles ())
{
- SCM item = ofscm_scm_from_objfile (objf);
+ SCM item = ofscm_scm_from_objfile (&objf);
result = scm_cons (item, result);
}
diff --git a/gdb/guile/scm-param.c b/gdb/guile/scm-param.c
index 749c5ea..5137847 100644
--- a/gdb/guile/scm-param.c
+++ b/gdb/guile/scm-param.c
@@ -1,6 +1,6 @@
/* GDB parameters implemented in Guile.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -308,13 +308,37 @@ pascm_is_valid (param_smob *p_smob)
return p_smob->commands.set != nullptr;
}
-/* A helper function which return the default documentation string for
- a parameter (which is to say that it's undocumented). */
+
+/* The different types of documentation string. */
+
+enum doc_string_type
+{
+ doc_string_set,
+ doc_string_show,
+ doc_string_description
+};
+
+/* A helper function which returns the default documentation string for
+ a parameter CMD_NAME. The DOC_TYPE indicates which type of
+ documentation string is needed. The returned string is dynamically
+ allocated. */
static char *
-get_doc_string (void)
+get_doc_string (doc_string_type doc_type, const char *cmd_name)
{
- return xstrdup (_("This command is not documented."));
+ if (doc_type == doc_string_description)
+ return xstrdup (_("This command is not documented."));
+ else
+ {
+ gdb_assert (cmd_name != nullptr);
+
+ if (doc_type == doc_string_show)
+ return xstrprintf (_("Show the current value of '%s'."),
+ cmd_name).release ();
+ else
+ return xstrprintf (_("Set the current value of '%s'."),
+ cmd_name).release ();
+ }
}
/* Subroutine of pascm_set_func, pascm_show_func to simplify them.
@@ -990,11 +1014,14 @@ gdbscm_make_parameter (SCM name_scm, SCM rest)
&show_doc_arg_pos, &show_doc,
&initial_value_arg_pos, &initial_value_scm);
- /* If doc is NULL, leave it NULL. See add_setshow_cmd_full. */
+ if (doc == nullptr)
+ doc = get_doc_string (doc_string_description, nullptr);
+ else if (*doc == '\0')
+ doc = nullptr;
if (set_doc == NULL)
- set_doc = get_doc_string ();
+ set_doc = get_doc_string (doc_string_set, name);
if (show_doc == NULL)
- show_doc = get_doc_string ();
+ show_doc = get_doc_string (doc_string_show, name);
s = name;
name = gdbscm_canonicalize_command_name (s, 0);
diff --git a/gdb/guile/scm-ports.c b/gdb/guile/scm-ports.c
index ab78b5c..f3e3ec8 100644
--- a/gdb/guile/scm-ports.c
+++ b/gdb/guile/scm-ports.c
@@ -1,7 +1,7 @@
/* Support for connecting Guile's stdio to GDB's.
as well as r/w memory via ports.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -336,9 +336,15 @@ ioscm_flush (SCM port)
return;
if (scm_is_eq (port, error_port_scm))
- gdb_flush (gdb_stderr);
+ {
+ if (gdb_stderr != nullptr)
+ gdb_flush (gdb_stderr);
+ }
else
- gdb_flush (gdb_stdout);
+ {
+ if (gdb_stdout != nullptr)
+ gdb_flush (gdb_stdout);
+ }
}
#else /* !USING_GUILE_BEFORE_2_2 */
diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index 128c318..95a6637 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -1,6 +1,6 @@
/* GDB/Scheme pretty-printing.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -427,9 +427,9 @@ ppscm_search_pp_list (SCM list, SCM value)
static SCM
ppscm_find_pretty_printer_from_objfiles (SCM value)
{
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- objfile_smob *o_smob = ofscm_objfile_smob_from_objfile (objfile);
+ objfile_smob *o_smob = ofscm_objfile_smob_from_objfile (&objfile);
SCM pp
= ppscm_search_pp_list (ofscm_objfile_smob_pretty_printers (o_smob),
value);
diff --git a/gdb/guile/scm-progspace.c b/gdb/guile/scm-progspace.c
index fcdcca2..06936a8 100644
--- a/gdb/guile/scm-progspace.c
+++ b/gdb/guile/scm-progspace.c
@@ -1,6 +1,6 @@
/* Guile interface to program spaces.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -277,11 +277,11 @@ gdbscm_progspace_objfiles (SCM self)
result = SCM_EOL;
- for (objfile *objfile : p_smob->pspace->objfiles ())
+ for (objfile &objfile : p_smob->pspace->objfiles ())
{
- if (objfile->separate_debug_objfile_backlink == NULL)
+ if (objfile.separate_debug_objfile_backlink == NULL)
{
- SCM item = ofscm_scm_from_objfile (objfile);
+ SCM item = ofscm_scm_from_objfile (&objfile);
result = scm_cons (item, result);
}
diff --git a/gdb/guile/scm-safe-call.c b/gdb/guile/scm-safe-call.c
index bc0a1e6..95dcf3a 100644
--- a/gdb/guile/scm-safe-call.c
+++ b/gdb/guile/scm-safe-call.c
@@ -1,6 +1,6 @@
/* GDB/Scheme support for safe calls into the Guile interpreter.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/guile/scm-string.c b/gdb/guile/scm-string.c
index a249bcc..d99cf3d 100644
--- a/gdb/guile/scm-string.c
+++ b/gdb/guile/scm-string.c
@@ -1,6 +1,6 @@
/* GDB/Scheme charset interface.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index 368a598..1d3fb29 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -1,6 +1,6 @@
/* Scheme interface to symbols.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -405,7 +405,7 @@ gdbscm_symbol_addr_class (SCM self)
= syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
const struct symbol *symbol = s_smob->symbol;
- return scm_from_int (symbol->aclass ());
+ return scm_from_int (symbol->loc_class ());
}
/* (symbol-argument? <gdb:symbol>) -> boolean */
@@ -428,11 +428,9 @@ gdbscm_symbol_constant_p (SCM self)
symbol_smob *s_smob
= syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
const struct symbol *symbol = s_smob->symbol;
- enum address_class theclass;
+ location_class loc_class = symbol->loc_class ();
- theclass = symbol->aclass ();
-
- return scm_from_bool (theclass == LOC_CONST || theclass == LOC_CONST_BYTES);
+ return scm_from_bool (loc_class == LOC_CONST || loc_class == LOC_CONST_BYTES);
}
/* (symbol-function? <gdb:symbol>) -> boolean */
@@ -443,11 +441,9 @@ gdbscm_symbol_function_p (SCM self)
symbol_smob *s_smob
= syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
const struct symbol *symbol = s_smob->symbol;
- enum address_class theclass;
-
- theclass = symbol->aclass ();
+ location_class loc_class = symbol->loc_class ();
- return scm_from_bool (theclass == LOC_BLOCK);
+ return scm_from_bool (loc_class == LOC_BLOCK);
}
/* (symbol-variable? <gdb:symbol>) -> boolean */
@@ -458,14 +454,12 @@ gdbscm_symbol_variable_p (SCM self)
symbol_smob *s_smob
= syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
const struct symbol *symbol = s_smob->symbol;
- enum address_class theclass;
-
- theclass = symbol->aclass ();
+ location_class loc_class = symbol->loc_class ();
return scm_from_bool (!symbol->is_argument ()
- && (theclass == LOC_LOCAL || theclass == LOC_REGISTER
- || theclass == LOC_STATIC || theclass == LOC_COMPUTED
- || theclass == LOC_OPTIMIZED_OUT));
+ && (loc_class == LOC_LOCAL || loc_class == LOC_REGISTER
+ || loc_class == LOC_STATIC || loc_class == LOC_COMPUTED
+ || loc_class == LOC_OPTIMIZED_OUT));
}
/* (symbol-needs-frame? <gdb:symbol>) -> boolean
@@ -526,7 +520,7 @@ gdbscm_symbol_value (SCM self, SCM rest)
if (!gdbscm_is_false (frame_scm))
f_smob = frscm_get_frame_smob_arg_unsafe (frame_scm, frame_pos, FUNC_NAME);
- if (symbol->aclass () == LOC_TYPEDEF)
+ if (symbol->loc_class () == LOC_TYPEDEF)
{
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self,
_("cannot get the value of a typedef"));
diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c
index 2fd4b03..e337a4b 100644
--- a/gdb/guile/scm-symtab.c
+++ b/gdb/guile/scm-symtab.c
@@ -1,6 +1,6 @@
/* Scheme interface to symbol tables.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index f228762..13676ce 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -1,6 +1,6 @@
/* Scheme interface to types.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -510,7 +510,7 @@ tyscm_field_smob_to_field (field_smob *f_smob)
struct type *type = tyscm_field_smob_containing_type (f_smob);
/* This should be non-NULL by construction. */
- gdb_assert (type->fields () != NULL);
+ gdb_assert (type->fields ().data () != nullptr);
return &type->field (f_smob->field_num);
}
diff --git a/gdb/guile/scm-utils.c b/gdb/guile/scm-utils.c
index 45f42ba..e782637 100644
--- a/gdb/guile/scm-utils.c
+++ b/gdb/guile/scm-utils.c
@@ -1,6 +1,6 @@
/* General utility routines for GDB/Scheme code.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index 0f4a6a4..3207980 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -1,6 +1,6 @@
/* Scheme interface to values.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -604,7 +604,7 @@ gdbscm_value_dynamic_type (SCM self)
type = value_rtti_type (value, NULL, NULL, NULL);
else
{
- /* Re-use object's static type. */
+ /* Reuse object's static type. */
type = NULL;
}
}
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index a845900..15b0002 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -1,6 +1,6 @@
/* Target-machine dependent code for Renesas H8/300, for GDB.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -541,7 +541,7 @@ h8300_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* Found a line number, use it as end of prologue. */
return sal.end;
- /* No useable line symbol. Use prologue parsing method. */
+ /* No usable line symbol. Use prologue parsing method. */
h8300_init_frame_cache (gdbarch, &cache);
return h8300_analyze_prologue (gdbarch, func_addr, func_end, &cache);
}
@@ -1374,9 +1374,7 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
-void _initialize_h8300_tdep ();
-void
-_initialize_h8300_tdep ()
+INIT_GDB_FILE (h8300_tdep)
{
gdbarch_register (bfd_arch_h8300, h8300_gdbarch_init);
}
diff --git a/gdb/hppa-bsd-tdep.c b/gdb/hppa-bsd-tdep.c
index 67fee6b..b9cd61e 100644
--- a/gdb/hppa-bsd-tdep.c
+++ b/gdb/hppa-bsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for HP PA-RISC BSD's.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -54,12 +54,12 @@ hppabsd_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
faddr_sec = find_pc_section (faddr);
if (faddr_sec != NULL)
{
- for (struct obj_section *sec : faddr_sec->objfile->sections ())
+ for (struct obj_section &sec : faddr_sec->objfile->sections ())
{
- if (strcmp (sec->the_bfd_section->name, ".dynamic") == 0)
+ if (strcmp (sec.the_bfd_section->name, ".dynamic") == 0)
{
- CORE_ADDR addr = sec->addr ();
- CORE_ADDR endaddr = sec->endaddr ();
+ CORE_ADDR addr = sec.addr ();
+ CORE_ADDR endaddr = sec.endaddr ();
while (addr < endaddr)
{
@@ -81,7 +81,7 @@ hppabsd_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
DT_PLTGOT, so we have to do it ourselves. */
pltgot = extract_unsigned_integer (buf, sizeof buf,
byte_order);
- pltgot += sec->objfile->text_section_offset ();
+ pltgot += sec.objfile->text_section_offset ();
return pltgot;
}
@@ -128,8 +128,7 @@ hppabsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_skip_trampoline_code (gdbarch, hppa_skip_trampoline_code);
/* OpenBSD and NetBSD use SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
/* Hook in the DWARF CFI frame unwinder. */
dwarf2_frame_set_init_reg (gdbarch, hppabsd_dwarf2_frame_init_reg);
diff --git a/gdb/hppa-bsd-tdep.h b/gdb/hppa-bsd-tdep.h
index 54599ab..64e45b7 100644
--- a/gdb/hppa-bsd-tdep.h
+++ b/gdb/hppa-bsd-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for HP PA-RISC BSD's.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/hppa-linux-nat.c b/gdb/hppa-linux-nat.c
index 96faeb3..5e63e7f 100644
--- a/gdb/hppa-linux-nat.c
+++ b/gdb/hppa-linux-nat.c
@@ -1,6 +1,6 @@
/* Functions specific to running GDB native on HPPA running GNU/Linux.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -383,9 +383,7 @@ fill_fpregset (const struct regcache *regcache,
}
}
-void _initialize_hppa_linux_nat ();
-void
-_initialize_hppa_linux_nat ()
+INIT_GDB_FILE (hppa_linux_nat)
{
/* Register the target. */
linux_target = &the_hppa_linux_nat_target;
diff --git a/gdb/hppa-linux-offsets.h b/gdb/hppa-linux-offsets.h
index 958afd1..bbbd968 100644
--- a/gdb/hppa-linux-offsets.h
+++ b/gdb/hppa-linux-offsets.h
@@ -1,6 +1,6 @@
/* Register offsets for HPPA running GNU/Linux.
- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+ Copyright (C) 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c
index f43a5e7..d0bb562 100644
--- a/gdb/hppa-linux-tdep.c
+++ b/gdb/hppa-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux running on PA-RISC, for GDB.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -32,6 +32,7 @@
#include "regcache.h"
#include "hppa-tdep.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
#include "elf/common.h"
/* Map DWARF DBX register numbers to GDB register numbers. */
@@ -322,7 +323,7 @@ static const struct frame_unwind_legacy hppa_linux_sigtramp_frame_unwind (
/* Attempt to find (and return) the global pointer for the given
function.
- This is a rather nasty bit of code searchs for the .dynamic section
+ This rather nasty bit of code searches for the .dynamic section
in the objfile corresponding to the pc of the function we're trying
to call. Once it finds the addresses at which the .dynamic section
lives in the child process, it scans the Elf32_Dyn entries for a
@@ -361,14 +362,14 @@ hppa_linux_find_global_pointer (struct gdbarch *gdbarch,
faddr_sect = find_pc_section (faddr);
if (faddr_sect != NULL)
{
- for (obj_section *osect : faddr_sect->objfile->sections ())
+ for (obj_section &osect : faddr_sect->objfile->sections ())
{
- if (strcmp (osect->the_bfd_section->name, ".dynamic") == 0)
+ if (strcmp (osect.the_bfd_section->name, ".dynamic") == 0)
{
CORE_ADDR addr, endaddr;
- addr = osect->addr ();
- endaddr = osect->endaddr ();
+ addr = osect.addr ();
+ endaddr = osect.endaddr ();
while (addr < endaddr)
{
@@ -499,8 +500,7 @@ hppa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
frame_unwind_append_unwinder (gdbarch, &hppa_linux_sigtramp_frame_unwind);
/* GNU/Linux uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
tdep->in_solib_call_trampoline = hppa_in_solib_call_trampoline;
set_gdbarch_skip_trampoline_code (gdbarch, hppa_skip_trampoline_code);
@@ -524,9 +524,7 @@ hppa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
svr4_fetch_objfile_link_map);
}
-void _initialize_hppa_linux_tdep ();
-void
-_initialize_hppa_linux_tdep ()
+INIT_GDB_FILE (hppa_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_LINUX,
hppa_linux_init_abi);
diff --git a/gdb/hppa-netbsd-nat.c b/gdb/hppa-netbsd-nat.c
index e7df997..1ebf205 100644
--- a/gdb/hppa-netbsd-nat.c
+++ b/gdb/hppa-netbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for NetBSD/hppa.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -229,9 +229,7 @@ hppa_nbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
}
}
-void _initialize_hppanbsd_nat ();
-void
-_initialize_hppanbsd_nat ()
+INIT_GDB_FILE (hppanbsd_nat)
{
add_inf_child_target (&the_hppa_nbsd_nat_target);
}
diff --git a/gdb/hppa-netbsd-tdep.c b/gdb/hppa-netbsd-tdep.c
index c71e191..90d8eb8 100644
--- a/gdb/hppa-netbsd-tdep.c
+++ b/gdb/hppa-netbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for NetBSD/hppa
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -210,9 +210,7 @@ hppanbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tramp_frame_prepend_unwinder (gdbarch, &hppanbsd_sigtramp_si4);
}
-void _initialize_hppanbsd_tdep ();
-void
-_initialize_hppanbsd_tdep ()
+INIT_GDB_FILE (hppanbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_NETBSD,
hppanbsd_init_abi);
diff --git a/gdb/hppa-obsd-nat.c b/gdb/hppa-obsd-nat.c
index 566903a..322b6f9 100644
--- a/gdb/hppa-obsd-nat.c
+++ b/gdb/hppa-obsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for OpenBSD/hppa.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -250,9 +250,7 @@ hppa_obsd_nat_target::store_registers (struct regcache *regcache, int regnum)
}
}
-void _initialize_hppaobsd_nat ();
-void
-_initialize_hppaobsd_nat ()
+INIT_GDB_FILE (hppaobsd_nat)
{
add_inf_child_target (&the_hppa_obsd_nat_target);
}
diff --git a/gdb/hppa-obsd-tdep.c b/gdb/hppa-obsd-tdep.c
index fed9637..a511fa8 100644
--- a/gdb/hppa-obsd-tdep.c
+++ b/gdb/hppa-obsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for OpenBSD/hppa
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -166,9 +166,7 @@ hppaobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
(gdbarch, hppaobsd_iterate_over_regset_sections);
}
-void _initialize_hppabsd_tdep ();
-void
-_initialize_hppabsd_tdep ()
+INIT_GDB_FILE (hppabsd_tdep)
{
gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_OPENBSD,
hppaobsd_init_abi);
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 1fb68f2..acd0028 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the HP PA-RISC architecture.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
Contributed by the Center for Software Science at the
University of Utah (pa-gdb-bugs@cs.utah.edu).
@@ -487,18 +487,18 @@ find_unwind_entry (CORE_ADDR pc)
return NULL;
}
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
struct hppa_unwind_info *ui;
ui = NULL;
- struct hppa_objfile_private *priv = hppa_objfile_priv_data.get (objfile);
+ struct hppa_objfile_private *priv = hppa_objfile_priv_data.get (&objfile);
if (priv)
ui = priv->unwind_info;
if (!ui)
{
- read_unwind_info (objfile);
- priv = hppa_objfile_priv_data.get (objfile);
+ read_unwind_info (&objfile);
+ priv = hppa_objfile_priv_data.get (&objfile);
if (priv == NULL)
error (_("Internal error reading unwind information."));
ui = priv->unwind_info;
@@ -920,12 +920,12 @@ hppa64_convert_code_addr_to_fptr (struct gdbarch *gdbarch, CORE_ADDR code)
if (!(sec->the_bfd_section->flags & SEC_CODE))
return code;
- for (obj_section *opd : sec->objfile->sections ())
+ for (obj_section &opd : sec->objfile->sections ())
{
- if (strcmp (opd->the_bfd_section->name, ".opd") == 0)
+ if (strcmp (opd.the_bfd_section->name, ".opd") == 0)
{
- for (CORE_ADDR addr = opd->addr ();
- addr < opd->endaddr ();
+ for (CORE_ADDR addr = opd.addr ();
+ addr < opd.endaddr ();
addr += 2 * 8)
{
ULONGEST opdaddr;
@@ -3119,9 +3119,7 @@ hppa_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
gdb_printf (file, "elf = %s\n", tdep->is_elf ? "yes" : "no");
}
-void _initialize_hppa_tdep ();
-void
-_initialize_hppa_tdep ()
+INIT_GDB_FILE (hppa_tdep)
{
gdbarch_register (bfd_arch_hppa, hppa_gdbarch_init, hppa_dump_tdep);
diff --git a/gdb/hppa-tdep.h b/gdb/hppa-tdep.h
index e1143a5..0015321 100644
--- a/gdb/hppa-tdep.h
+++ b/gdb/hppa-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for the HP PA-RISC architecture.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/i386-bsd-nat.c b/gdb/i386-bsd-nat.c
index e1db6c7..c5eda86 100644
--- a/gdb/i386-bsd-nat.c
+++ b/gdb/i386-bsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for modern i386 BSD's.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -237,9 +237,7 @@ i386bsd_store_inferior_registers (struct regcache *regcache, int regnum)
}
}
-void _initialize_i386bsd_nat ();
-void
-_initialize_i386bsd_nat ()
+INIT_GDB_FILE (i386bsd_nat)
{
/* To support the recognition of signal handlers, i386-bsd-tdep.c
hardcodes some constants. Inclusion of this file means that we
diff --git a/gdb/i386-bsd-nat.h b/gdb/i386-bsd-nat.h
index 54061ab..b11fd7e 100644
--- a/gdb/i386-bsd-nat.h
+++ b/gdb/i386-bsd-nat.h
@@ -1,6 +1,6 @@
/* Native-dependent code for modern i386 BSD's.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/i386-bsd-tdep.c b/gdb/i386-bsd-tdep.c
index ba7817a..eedce22 100644
--- a/gdb/i386-bsd-tdep.c
+++ b/gdb/i386-bsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for i386 BSD's.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/i386-darwin-nat.c b/gdb/i386-darwin-nat.c
index 55c6123..09d6ba6 100644
--- a/gdb/i386-darwin-nat.c
+++ b/gdb/i386-darwin-nat.c
@@ -1,5 +1,5 @@
/* Darwin support for GDB, the GNU debugger.
- Copyright (C) 1997-2024 Free Software Foundation, Inc.
+ Copyright (C) 1997-2025 Free Software Foundation, Inc.
Contributed by Apple Computer, Inc.
@@ -631,9 +631,7 @@ darwin_set_sstep (thread_t thread, int enable)
}
}
-void _initialize_i386_darwin_nat ();
-void
-_initialize_i386_darwin_nat ()
+INIT_GDB_FILE (i386_darwin_nat)
{
#ifdef BFD64
amd64_native_gregset64_reg_offset = amd64_darwin_thread_state_reg_offset;
diff --git a/gdb/i386-darwin-tdep.c b/gdb/i386-darwin-tdep.c
index 0481296..a91afa2 100644
--- a/gdb/i386-darwin-tdep.c
+++ b/gdb/i386-darwin-tdep.c
@@ -1,5 +1,5 @@
/* Darwin support for GDB, the GNU debugger.
- Copyright (C) 1997-2024 Free Software Foundation, Inc.
+ Copyright (C) 1997-2025 Free Software Foundation, Inc.
Contributed by Apple Computer, Inc.
@@ -271,7 +271,7 @@ i386_darwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
alignment. */
set_gdbarch_long_double_bit (gdbarch, 128);
- set_gdbarch_so_ops (gdbarch, &darwin_so_ops);
+ set_gdbarch_make_solib_ops (gdbarch, make_darwin_solib_ops);
}
static enum gdb_osabi
@@ -286,9 +286,7 @@ i386_mach_o_osabi_sniffer (bfd *abfd)
return GDB_OSABI_UNKNOWN;
}
-void _initialize_i386_darwin_tdep ();
-void
-_initialize_i386_darwin_tdep ()
+INIT_GDB_FILE (i386_darwin_tdep)
{
gdbarch_register_osabi_sniffer (bfd_arch_unknown, bfd_target_mach_o_flavour,
i386_mach_o_osabi_sniffer);
diff --git a/gdb/i386-darwin-tdep.h b/gdb/i386-darwin-tdep.h
index 7ccdeec..e4f484f 100644
--- a/gdb/i386-darwin-tdep.h
+++ b/gdb/i386-darwin-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for Darwin x86.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/i386-dicos-tdep.c b/gdb/i386-dicos-tdep.c
index 9859c85..50570c9 100644
--- a/gdb/i386-dicos-tdep.c
+++ b/gdb/i386-dicos-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for DICOS running on i386's, for GDB.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -40,9 +40,7 @@ i386_dicos_osabi_sniffer (bfd *abfd)
return GDB_OSABI_UNKNOWN;
}
-void _initialize_i386_dicos_tdep ();
-void
-_initialize_i386_dicos_tdep ()
+INIT_GDB_FILE (i386_dicos_tdep)
{
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
i386_dicos_osabi_sniffer);
diff --git a/gdb/i386-fbsd-nat.c b/gdb/i386-fbsd-nat.c
index d9f4067..f4088a3 100644
--- a/gdb/i386-fbsd-nat.c
+++ b/gdb/i386-fbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for FreeBSD/i386.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -92,7 +92,7 @@ i386_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
/* There is no i386_fxsave_supplies or i386_xsave_supplies.
Instead, the earlier register sets return early if the request
- was for a specific register that was already satisified to avoid
+ was for a specific register that was already satisfied to avoid
fetching the FPU/XSAVE state unnecessarily. */
#ifdef PT_GETXSTATE_INFO
@@ -171,7 +171,7 @@ i386_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
/* There is no i386_fxsave_supplies or i386_xsave_supplies.
Instead, the earlier register sets return early if the request
- was for a specific register that was already satisified to avoid
+ was for a specific register that was already satisfied to avoid
fetching the FPU/XSAVE state unnecessarily. */
#ifdef PT_GETXSTATE_INFO
@@ -330,9 +330,7 @@ i386_fbsd_nat_target::read_description ()
return i386_target_description (X86_XSTATE_X87_MASK, true);
}
-void _initialize_i386fbsd_nat ();
-void
-_initialize_i386fbsd_nat ()
+INIT_GDB_FILE (i386fbsd_nat)
{
add_inf_child_target (&the_i386_fbsd_nat_target);
diff --git a/gdb/i386-fbsd-tdep.c b/gdb/i386-fbsd-tdep.c
index d6d477a..a32880e 100644
--- a/gdb/i386-fbsd-tdep.c
+++ b/gdb/i386-fbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for FreeBSD/i386.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -274,11 +274,10 @@ i386_fbsd_core_read_xsave_info (bfd *abfd, x86_xsave_layout &layout)
/* See i386-fbsd-tdep.h. */
bool
-i386_fbsd_core_read_x86_xsave_layout (struct gdbarch *gdbarch,
+i386_fbsd_core_read_x86_xsave_layout (struct gdbarch *gdbarch, bfd &cbfd,
x86_xsave_layout &layout)
{
- return i386_fbsd_core_read_xsave_info (current_program_space->core_bfd (),
- layout) != 0;
+ return i386_fbsd_core_read_xsave_info (&cbfd, layout) != 0;
}
/* Implement the core_read_description gdbarch method. */
@@ -402,8 +401,7 @@ i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
i386fbsd_core_read_description);
/* FreeBSD uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
@@ -411,9 +409,7 @@ i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
i386fbsd_get_thread_local_address);
}
-void _initialize_i386fbsd_tdep ();
-void
-_initialize_i386fbsd_tdep ()
+INIT_GDB_FILE (i386fbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_FREEBSD,
i386fbsd_init_abi);
diff --git a/gdb/i386-fbsd-tdep.h b/gdb/i386-fbsd-tdep.h
index 3b953e5..acc5776 100644
--- a/gdb/i386-fbsd-tdep.h
+++ b/gdb/i386-fbsd-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for FreeBSD x86.
- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+ Copyright (C) 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -32,8 +32,9 @@
uint64_t i386_fbsd_core_read_xsave_info (bfd *abfd, x86_xsave_layout &layout);
/* Implement the core_read_x86_xsave_layout gdbarch method. */
-bool i386_fbsd_core_read_x86_xsave_layout (struct gdbarch *gdbarch,
- x86_xsave_layout &layout);
+extern bool i386_fbsd_core_read_x86_xsave_layout (struct gdbarch *gdbarch,
+ bfd &cbfd,
+ x86_xsave_layout &layout);
/* The format of the XSAVE extended area is determined by hardware.
Cores store the XSAVE extended area in a NT_X86_XSTATE note that
diff --git a/gdb/i386-gnu-tdep.c b/gdb/i386-gnu-tdep.c
index 5ffc138..f944fa5 100644
--- a/gdb/i386-gnu-tdep.c
+++ b/gdb/i386-gnu-tdep.c
@@ -1,5 +1,5 @@
/* Target-dependent code for the GNU Hurd.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -180,8 +180,7 @@ i386gnu_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Hurd uses SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
/* Hurd uses the dynamic linker included in the GNU C Library. */
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
@@ -202,9 +201,7 @@ i386gnu_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->sc_num_regs = ARRAY_SIZE (i386_gnu_sc_reg_offset);
}
-void _initialize_i386gnu_tdep ();
-void
-_initialize_i386gnu_tdep ()
+INIT_GDB_FILE (i386gnu_tdep)
{
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_HURD, i386gnu_init_abi);
}
diff --git a/gdb/i386-go32-tdep.c b/gdb/i386-go32-tdep.c
index 738b258..e6a1721 100644
--- a/gdb/i386-go32-tdep.c
+++ b/gdb/i386-go32-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for DJGPP/i386.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -61,9 +61,7 @@ i386_coff_osabi_sniffer (bfd *abfd)
}
-void _initialize_i386_go32_tdep ();
-void
-_initialize_i386_go32_tdep ()
+INIT_GDB_FILE (i386_go32_tdep)
{
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
i386_coff_osabi_sniffer);
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index d2cbe51..f5112d2 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux i386.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -696,9 +696,7 @@ i386_linux_nat_target::low_resume (ptid_t ptid, int step, enum gdb_signal signal
perror_with_name (("ptrace"));
}
-void _initialize_i386_linux_nat ();
-void
-_initialize_i386_linux_nat ()
+INIT_GDB_FILE (i386_linux_nat)
{
linux_target = &the_i386_linux_nat_target;
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 2b7bd2b..34e1391 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux i386.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -30,6 +30,7 @@
#include "i386-tdep.h"
#include "i386-linux-tdep.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
#include "utils.h"
#include "glibc-tdep.h"
#include "solib-svr4.h"
@@ -1043,6 +1044,8 @@ int i386_linux_gregset_reg_offset[] =
-1, -1, -1, -1, -1, -1, -1, -1, /* k0 ... k7 (AVX512) */
-1, -1, -1, -1, -1, -1, -1, -1, /* zmm0 ... zmm7 (AVX512) */
-1, /* PKRU register */
+ -1, /* SSP register. */
+ -1, -1, /* fs/gs base registers. */
11 * 4, /* "orig_eax" */
};
@@ -1104,11 +1107,10 @@ i386_linux_core_read_xsave_info (bfd *abfd, x86_xsave_layout &layout)
/* See i386-linux-tdep.h. */
bool
-i386_linux_core_read_x86_xsave_layout (struct gdbarch *gdbarch,
+i386_linux_core_read_x86_xsave_layout (struct gdbarch *gdbarch, bfd &cbfd,
x86_xsave_layout &layout)
{
- return i386_linux_core_read_xsave_info (current_program_space->core_bfd (),
- layout) != 0;
+ return i386_linux_core_read_xsave_info (&cbfd, layout) != 0;
}
/* See arch/x86-linux-tdesc.h. */
@@ -1461,8 +1463,7 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU/Linux uses SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
/* GNU/Linux uses the dynamic linker included in the GNU C Library. */
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
@@ -1490,10 +1491,11 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
i386_linux_get_syscall_number);
}
-void _initialize_i386_linux_tdep ();
-void
-_initialize_i386_linux_tdep ()
+INIT_GDB_FILE (i386_linux_tdep)
{
+ gdb_assert (ARRAY_SIZE (i386_linux_gregset_reg_offset)
+ == I386_LINUX_NUM_REGS);
+
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_LINUX,
i386_linux_init_abi);
}
diff --git a/gdb/i386-linux-tdep.h b/gdb/i386-linux-tdep.h
index bd5527c..8a1a244 100644
--- a/gdb/i386-linux-tdep.h
+++ b/gdb/i386-linux-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux x86.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,20 +21,29 @@
#define GDB_I386_LINUX_TDEP_H
#include "gdbsupport/x86-xstate.h"
+#include "i386-tdep.h"
-/* The Linux kernel pretends there is an additional "orig_eax"
- register. Since GDB needs access to that register to be able to
- properly restart system calls when necessary (see
- i386-linux-tdep.c) we need our own versions of a number of
- functions that deal with GDB's register cache. */
+/* Additional register numbers for i386 Linux, these are in addition to
+ the register numbers found in 'enum i386_regnum', see i386-tdep.h. */
-/* Register number for the "orig_eax" pseudo-register. If this
- pseudo-register contains a value >= 0 it is interpreted as the
- system call number that the kernel is supposed to restart. */
-#define I386_LINUX_ORIG_EAX_REGNUM (I386_PKRU_REGNUM + 1)
+enum i386_linux_regnum
+{
+ /* STOP! The values in this enum are numbered after the values in the
+ enum i386_regnum. New entries should be placed after the ORIG_EAX
+ entry. */
-/* Total number of registers for GNU/Linux. */
-#define I386_LINUX_NUM_REGS (I386_LINUX_ORIG_EAX_REGNUM + 1)
+ /* Register number for the "orig_eax" pseudo-register. GDB needs access
+ to this register to be able to properly restart system calls when
+ necessary (see i386-linux-tdep.c). If this pseudo-register contains a
+ value >= 0 it is interpreted as the system call number that the kernel
+ is supposed to restart. */
+ I386_LINUX_ORIG_EAX_REGNUM = I386_NUM_REGS,
+
+ /* Total number of registers for GNU/Linux. */
+ I386_LINUX_NUM_REGS
+
+ /* STOP! Add new entries before I386_LINUX_NUM_REGS. */
+};
/* Read the XSAVE extended state xcr0 value from the ABFD core file.
If it appears to be valid, return it and fill LAYOUT with values
@@ -47,6 +56,7 @@ extern uint64_t i386_linux_core_read_xsave_info (bfd *abfd,
/* Implement the core_read_x86_xsave_layout gdbarch method. */
extern bool i386_linux_core_read_x86_xsave_layout (struct gdbarch *gdbarch,
+ bfd &cbfd,
x86_xsave_layout &layout);
extern int i386_linux_gregset_reg_offset[];
diff --git a/gdb/i386-netbsd-nat.c b/gdb/i386-netbsd-nat.c
index 7eaaaf3..efbf361 100644
--- a/gdb/i386-netbsd-nat.c
+++ b/gdb/i386-netbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for NetBSD/i386.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -72,9 +72,7 @@ i386nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
static i386_bsd_nat_target<nbsd_nat_target> the_i386_nbsd_nat_target;
-void _initialize_i386nbsd_nat ();
-void
-_initialize_i386nbsd_nat ()
+INIT_GDB_FILE (i386nbsd_nat)
{
add_inf_child_target (&the_i386_nbsd_nat_target);
diff --git a/gdb/i386-netbsd-tdep.c b/gdb/i386-netbsd-tdep.c
index a437656..a1124d0 100644
--- a/gdb/i386-netbsd-tdep.c
+++ b/gdb/i386-netbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for NetBSD/i386.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -415,16 +415,13 @@ i386nbsdelf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
i386_elf_init_abi (info, gdbarch);
/* NetBSD ELF uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
/* NetBSD ELF uses -fpcc-struct-return by default. */
tdep->struct_return = pcc_struct_return;
}
-void _initialize_i386nbsd_tdep ();
-void
-_initialize_i386nbsd_tdep ()
+INIT_GDB_FILE (i386nbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_NETBSD,
i386nbsdelf_init_abi);
diff --git a/gdb/i386-obsd-nat.c b/gdb/i386-obsd-nat.c
index 2b3d391..f478e73 100644
--- a/gdb/i386-obsd-nat.c
+++ b/gdb/i386-obsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for OpenBSD/i386.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -89,9 +89,7 @@ i386obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
static i386_bsd_nat_target<obsd_nat_target> the_i386_obsd_nat_target;
-void _initialize_i386obsd_nat ();
-void
-_initialize_i386obsd_nat ()
+INIT_GDB_FILE (i386obsd_nat)
{
add_inf_child_target (&i386_obsd_nat_target);
diff --git a/gdb/i386-obsd-tdep.c b/gdb/i386-obsd-tdep.c
index ea8addc..1126597 100644
--- a/gdb/i386-obsd-tdep.c
+++ b/gdb/i386-obsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for OpenBSD/i386.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -441,13 +441,10 @@ i386obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
frame_unwind_prepend_unwinder (gdbarch, &i386obsd_trapframe_unwind);
/* OpenBSD ELF uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
}
-void _initialize_i386obsd_tdep ();
-void
-_initialize_i386obsd_tdep ()
+INIT_GDB_FILE (i386obsd_tdep)
{
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_OPENBSD,
i386obsd_init_abi);
diff --git a/gdb/i386-sol2-nat.c b/gdb/i386-sol2-nat.c
index 20ca9d6..1e87007 100644
--- a/gdb/i386-sol2-nat.c
+++ b/gdb/i386-sol2-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for Solaris x86.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -25,7 +25,7 @@
#include "target.h"
#include "procfs.h"
-/* This file provids the (temporary) glue between the Solaris x86
+/* This file provides the (temporary) glue between the Solaris x86
target dependent code and the machine independent SVR4 /proc
support. */
@@ -252,9 +252,7 @@ fill_fpregset (const struct regcache *regcache,
#endif
-void _initialize_amd64_sol2_nat ();
-void
-_initialize_amd64_sol2_nat ()
+INIT_GDB_FILE (amd64_sol2_nat)
{
#if PR_MODEL_NATIVE == PR_MODEL_LP64
amd64_native_gregset32_reg_offset = amd64_sol2_gregset32_reg_offset;
diff --git a/gdb/i386-sol2-tdep.c b/gdb/i386-sol2-tdep.c
index b85ac17..4ff08d2 100644
--- a/gdb/i386-sol2-tdep.c
+++ b/gdb/i386-sol2-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Solaris x86.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -86,8 +86,7 @@ i386_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->sc_num_regs = tdep->gregset_num_regs;
/* Solaris has SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
}
@@ -102,9 +101,7 @@ i386_sol2_osabi_sniffer (bfd *abfd)
return GDB_OSABI_UNKNOWN;
}
-void _initialize_i386_sol2_tdep ();
-void
-_initialize_i386_sol2_tdep ()
+INIT_GDB_FILE (i386_sol2_tdep)
{
/* Register an ELF OS ABI sniffer for Solaris 2 binaries. */
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 1d6d592..d3ad402 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1,6 +1,6 @@
/* Intel 386 target-dependent stuff.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -60,10 +60,7 @@
#include "stap-probe.h"
#include "user-regs.h"
-#include "cli/cli-utils.h"
#include "expression.h"
-#include "parser-defs.h"
-#include <ctype.h>
#include <algorithm>
#include <unordered_set>
#include "producer.h"
@@ -899,6 +896,22 @@ i386_displaced_step_fixup (struct gdbarch *gdbarch,
displaced_debug_printf ("relocated return addr at %s to %s",
paddress (gdbarch, esp),
paddress (gdbarch, retaddr));
+
+ /* If shadow stack is enabled, we need to correct the return address
+ on the shadow stack too. */
+ bool shadow_stack_enabled;
+ std::optional<CORE_ADDR> ssp
+ = gdbarch_get_shadow_stack_pointer (gdbarch, regs,
+ shadow_stack_enabled);
+ if (shadow_stack_enabled)
+ {
+ gdb_assert (ssp.has_value ());
+ write_memory_unsigned_integer (*ssp, retaddr_len, byte_order,
+ retaddr);
+ displaced_debug_printf ("relocated shadow stack return addr at %s "
+ "to %s", paddress (gdbarch, *ssp),
+ paddress (gdbarch, retaddr));
+ }
}
}
@@ -2322,7 +2335,7 @@ static const struct frame_unwind_legacy i386_epilogue_frame_unwind (
/* These trampolines are used on cross x86 targets, when taking the
address of a nested function. When executing these trampolines,
no stack frame is set up, so we are in a similar situation as in
- epilogues and i386_epilogue_frame_this_id can be re-used. */
+ epilogues and i386_epilogue_frame_this_id can be reused. */
/* Static chain passed in register. */
@@ -3881,9 +3894,9 @@ int
i386_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
return (*s == '$' /* Literal number. */
- || (isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement. */
+ || (c_isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement. */
|| (*s == '(' && s[1] == '%') /* Register indirection. */
- || (*s == '%' && isalpha (s[1]))); /* Register access. */
+ || (*s == '%' && c_isalpha (s[1]))); /* Register access. */
}
/* Helper function for i386_stap_parse_special_token.
@@ -3900,7 +3913,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
{
const char *s = p->arg;
- if (isdigit (*s) || *s == '-' || *s == '+')
+ if (c_isdigit (*s) || *s == '-' || *s == '+')
{
bool got_minus[3];
int i;
@@ -3918,7 +3931,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
got_minus[0] = true;
}
- if (!isdigit ((unsigned char) *s))
+ if (!c_isdigit (*s))
return {};
displacements[0] = strtol (s, &endp, 10);
@@ -3939,7 +3952,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
got_minus[1] = true;
}
- if (!isdigit ((unsigned char) *s))
+ if (!c_isdigit (*s))
return {};
displacements[1] = strtol (s, &endp, 10);
@@ -3960,7 +3973,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
got_minus[2] = true;
}
- if (!isdigit ((unsigned char) *s))
+ if (!c_isdigit (*s))
return {};
displacements[2] = strtol (s, &endp, 10);
@@ -3972,7 +3985,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
s += 2;
start = s;
- while (isalnum (*s))
+ while (c_isalnum (*s))
++s;
if (*s++ != ')')
@@ -4033,7 +4046,7 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
{
const char *s = p->arg;
- if (isdigit (*s) || *s == '(' || *s == '-' || *s == '+')
+ if (c_isdigit (*s) || *s == '(' || *s == '-' || *s == '+')
{
bool offset_minus = false;
long offset = 0;
@@ -4051,10 +4064,10 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
offset_minus = true;
}
- if (offset_minus && !isdigit (*s))
+ if (offset_minus && !c_isdigit (*s))
return {};
- if (isdigit (*s))
+ if (c_isdigit (*s))
{
char *endp;
@@ -4068,7 +4081,7 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
s += 2;
start = s;
- while (isalnum (*s))
+ while (c_isalnum (*s))
++s;
if (*s != ',' || s[1] != '%')
@@ -4084,7 +4097,7 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
s += 2;
start = s;
- while (isalnum (*s))
+ while (c_isalnum (*s))
++s;
len_index = s - start;
@@ -4800,7 +4813,7 @@ static int i386_record_floats (struct gdbarch *gdbarch,
static int
i386_record_vex (struct i386_record_s *ir, uint8_t vex_w, uint8_t vex_r,
- int opcode, struct gdbarch *gdbarch)
+ struct gdbarch *gdbarch)
{
/* We need this to find YMM (and once AVX-512 is supported, ZMM) registers.
We should always save the largest available register, since an
@@ -4814,6 +4827,11 @@ i386_record_vex (struct i386_record_s *ir, uint8_t vex_w, uint8_t vex_r,
SCOPE_EXIT { inferior_thread ()->set_executing (true); };
inferior_thread () -> set_executing (false);
+ uint8_t opcode;
+ if (record_read_memory (gdbarch, ir->addr, &opcode, 1))
+ return -1;
+ ir->addr++;
+
switch (opcode)
{
case 0x10: /* VMOVS[S|D] XMM, mem. */
@@ -4854,12 +4872,6 @@ i386_record_vex (struct i386_record_s *ir, uint8_t vex_w, uint8_t vex_r,
i386_record_lea_modrm (ir);
}
break;
- case 0x14: /* VUNPCKL[PS|PD]. */
- case 0x15: /* VUNPCKH [PS|PD]. */
- i386_record_modrm (ir);
- record_full_arch_list_add_reg (ir->regcache,
- tdep->ymm0_regnum + ir->reg + vex_r * 8);
- break;
case 0x6e: /* VMOVD XMM, reg/mem */
/* This is moving from a regular register or memory region into an
XMM register. */
@@ -4915,6 +4927,16 @@ i386_record_vex (struct i386_record_s *ir, uint8_t vex_w, uint8_t vex_r,
return -1;
}
break;
+ case 0xd0: /* VADDSUBPD XMM1, XMM2, reg/mem */
+ /* VADDSUBPS XMM1, XMM2, reg/mem */
+ i386_record_modrm (ir);
+ /* The most significant bit of the register offset
+ is vex_r. */
+ record_full_arch_list_add_reg (ir->regcache,
+ tdep->ymm0_regnum
+ + ir->reg + vex_r * 8);
+ break;
+
case 0xd6: /* VMOVQ reg/mem XMM */
i386_record_modrm (ir);
/* This is the vmovq version that stores into a regular register
@@ -4979,6 +5001,27 @@ i386_record_vex (struct i386_record_s *ir, uint8_t vex_w, uint8_t vex_r,
}
break;
+ case 0x19: /* VBROADCASTSD and VEXTRACTF128. */
+ case 0x39: /* VEXTRACTI128. */
+ i386_record_modrm (ir);
+ /* vextract instructions use ModRM.R/M and VEX.B to address the
+ output register, while vbroadcast use ModRM.Reg and VEX.R.
+ They are differentiated through map_select. */
+ if (ir->map_select == 2)
+ record_full_arch_list_add_reg (ir->regcache,
+ tdep->ymm0_regnum + ir->reg
+ + 8 * vex_r);
+ else
+ record_full_arch_list_add_reg (ir->regcache,
+ tdep->ymm0_regnum + ir->rm
+ + 8 * ir->rex_b);
+ break;
+
+ case 0x18: /* VBROADCASTSS and VINSERTI128. */
+ case 0x20: /* VPINSRB. */
+ case 0x21: /* VINSERTPS. */
+ case 0x22: /* VINSR[D|Q]. */
+ case 0x38: /* VINSERTF128. */
case 0x60: /* VPUNPCKLBW */
case 0x61: /* VPUNPCKLWD */
case 0x62: /* VPUNPCKLDQ */
@@ -4987,6 +5030,7 @@ i386_record_vex (struct i386_record_s *ir, uint8_t vex_w, uint8_t vex_r,
case 0x69: /* VPUNPCKHWD */
case 0x6a: /* VPUNPCKHDQ */
case 0x6d: /* VPUNPCKHQDQ */
+ case 0xc4: /* VPINSRW. */
{
i386_record_modrm (ir);
int reg_offset = ir->reg + vex_r * 8;
@@ -4995,6 +5039,61 @@ i386_record_vex (struct i386_record_s *ir, uint8_t vex_w, uint8_t vex_r,
}
break;
+ case 0x14: /* VPEXTRB and VUNPCKL[PS|PD]. */
+ case 0x15: /* VPEXTRW (to memory) and VUNPCKH [PS|PD]. */
+ case 0x16: /* VPEXTR[D|Q], VPERMPS, VMOVLHPS and VMOVHP[S|D] to reg. */
+ {
+ i386_record_modrm (ir);
+ /* All vpextr instructions in this case use map_select == 3,
+ while vpermps has map_select == 2 and the other instructions
+ have map_select == 1. The opcode 0xc5 is for vpextr, but also
+ uses map_select == 1, but due to other inconsistencies with
+ the other vpextr instructions, it is in a separate case to
+ avoid making this even more of a mess. */
+ if (ir->map_select == 3)
+ {
+ if (ir->mod == 3)
+ {
+ /* ModRM.Mod being equal to 3 means this ModRM encodes
+ a register. */
+ record_full_arch_list_add_reg (ir->regcache,
+ ir->regmap[X86_RECORD_REAX_REGNUM
+ + ir->rm]);
+ }
+ else
+ {
+ /* Even though the test only generated ModRM.Mod == 0,
+ in theory all values != 3 are viable to encode a memory
+ address, so all of them are passed along. */
+ /* Size is mostly based on the opcode, except for
+ double/quadword difference. */
+ ir->ot = opcode - 0x14;
+ if (opcode == 0x16 && vex_w == 1)
+ ir->ot ++;
+ /* I'm not sure if this is the original use, but in here
+ rip_offset is used to indicate that the RIP pointer will
+ be 1 byte away from where the instruction expects it to
+ be, because the immediate will not have been read by the
+ time the address changed is calculated. */
+ ir->rip_offset = 1;
+ i386_record_lea_modrm (ir);
+ }
+ }
+ else
+ {
+ record_full_arch_list_add_reg (ir->regcache,
+ tdep->ymm0_regnum + ir->reg
+ + vex_r * 8);
+ }
+ break;
+ }
+ case 0xc5: /* VPEXTRW to register. */
+ i386_record_modrm (ir);
+ record_full_arch_list_add_reg (ir->regcache,
+ ir->regmap[X86_RECORD_REAX_REGNUM
+ + ir->reg]);
+ break;
+
case 0x74: /* VPCMPEQB */
case 0x75: /* VPCMPEQB */
case 0x76: /* VPCMPEQB */
@@ -5006,17 +5105,96 @@ i386_record_vex (struct i386_record_s *ir, uint8_t vex_w, uint8_t vex_r,
}
break;
- case 0x78: /* VPBROADCASTB */
- case 0x79: /* VPBROADCASTW */
+ case 0x71: /* VPS[LL|RA|RL]W with constant shift. */
+ case 0x72: /* VPS[LL|RA|RL]D with constant shift. */
+ case 0x73: /* VPS[LL|RL][Q|DQ] with constant shift. */
+ {
+ record_full_arch_list_add_reg (ir->regcache,
+ tdep->ymm0_regnum + ir->vvvv);
+ break;
+ }
+
+ case 0x2c: /* VCVTTSD2SI and VCVTTSS2SI. */
+ case 0x2d: /* VCVTSD2SI and VCVTSS2SI. */
+ i386_record_modrm (ir);
+ record_full_arch_list_add_reg (ir->regcache,
+ ir->regmap[X86_RECORD_REAX_REGNUM
+ + ir->reg]);
+ break;
+
+ case 0x17: /* VEXTRACTPS and VMOVHP[S|D] to memory. */
+ case 0x13: /* VMOVLPD to memory. */
+ i386_record_modrm (ir);
+ if (ir->map_select == 1) /* This is the VMOV family. */
+ {
+ ir->ot = 3;
+ i386_record_lea_modrm (ir);
+ }
+ else
+ record_full_arch_list_add_reg (ir->regcache,
+ ir->regmap[X86_RECORD_REAX_REGNUM
+ + ir->rm]);
+ break;
+
+ case 0x00: /* VSHUFB and VPERMQ. */
+ case 0x01: /* VPERMPD. */
+ case 0x02: /* VPBLENDD. */
+ case 0x04: /* VPERMILPS with immediate. */
+ case 0x05: /* VPERMILPD with immediate. */
+ case 0x06: /* VMPERM2F128. */
+ case 0x0c: /* VPERMILPS with register and VBLENDPS. */
+ case 0x0d: /* VPERMILPD with register and VBLENDPD. */
+ case 0x0e: /* VPBLENDW. */
+ case 0x12: /* VMOVDDUP, VMOVHLPS and VMOVLPD to register. */
+ case 0x1a: /* VBROADCASTF128. */
+ case 0x2a: /* VCVTSI2SS. */
+ case 0x2b: /* VPACKUSDW. */
+ case 0x36: /* VPERMD. */
+ case 0x40: /* VPMULLD */
+ case 0x46: /* VPERM2I128. */
+ case 0x4a: /* VBLENDVPS. */
+ case 0x4b: /* VBLENDVPD. */
+ case 0x4c: /* VPBLENDVB. */
+ case 0x57: /* VXORP[S|D] */
case 0x58: /* VPBROADCASTD and VADD[P|S][S|D] */
case 0x59: /* VPBROADCASTQ and VMUL[P|S][S|D] */
+ case 0x5a: /* VCVTPS2PD, VCVTSD2SS, VCVTSS2SD and VCVTPD2PS. */
+ case 0x5b: /* VCVTDQ2PS, VCVTTPS2PD and VCVTPS2DQ. */
case 0x5c: /* VSUB[P|S][S|D] */
case 0x5d: /* VMIN[P|S][S|D] */
case 0x5e: /* VDIV[P|S][S|D] */
case 0x5f: /* VMAX[P|S][S|D] */
+ case 0x63: /* VPACKSSWB. */
+ case 0X67: /* VPACKUSWB. */
+ case 0x6b: /* VPACKSSDW. */
+ case 0x70: /* VPSHUF[B|D|HW|LW]. */
+ case 0x78: /* VPBROADCASTB */
+ case 0x79: /* VPBROADCASTW */
+ case 0xc6: /* VSHUFP[S|D]. */
+ case 0xd1: /* VPSRLW, dynamic shift. */
+ case 0xd2: /* VPSRLD, dynamic shift. */
+ case 0xd3: /* VPSRLQ, dynamic shift. */
+ case 0xd4: /* VPADDQ */
+ case 0xd5: /* VPMULLW */
+ case 0xdb: /* VPAND */
+ case 0xdf: /* VPANDN */
+ case 0xe1: /* VPSRAW, dynamic shift. */
+ case 0xe2: /* VPSRAD, dynamic shift. */
+ case 0xe4: /* VPMULHUW */
+ case 0xe5: /* VPMULHW */
+ case 0xe6: /* VCVTDQ2PD, VCVTTPD2DQ and VCVTPD2DQ. */
+ case 0xf1: /* VPSLLW, dynamic shift. */
+ case 0xf2: /* VPSLLD, dynamic shift. */
+ case 0xf3: /* VPSLLQ, dynamic shift. */
+ case 0xf4: /* VPMULUDQ */
+ case 0xf6: /* VPSADBW. */
+ case 0xfc: /* VPADDB */
+ case 0xfd: /* VPADDW */
+ case 0xfe: /* VPADDD */
{
- /* vpbroadcast and arithmethic operations are differentiated
- by map_select, but it doesn't change the recording mechanics. */
+ /* This set of instructions all share the same exact way to encode
+ the destination register, so there's no reason to try and
+ differentiate them. */
i386_record_modrm (ir);
int reg_offset = ir->reg + vex_r * 8;
gdb_assert (tdep->num_ymm_regs > reg_offset);
@@ -5025,6 +5203,17 @@ i386_record_vex (struct i386_record_s *ir, uint8_t vex_w, uint8_t vex_r,
}
break;
+ case 0x2e: /* VUCOMIS[S|D]. */
+ case 0x2f: /* VCOMIS[S|D]. */
+ {
+ /* Despite what the manual implies, saying that the first register
+ will be written to, actual testing shows that the only register
+ changed is EFLAGS. */
+ record_full_arch_list_add_reg (ir->regcache,
+ ir->regmap[X86_RECORD_EFLAGS_REGNUM]);
+ break;
+ }
+
case 0x77:/* VZEROUPPER */
{
int num_regs = tdep->num_ymm_regs;
@@ -5117,8 +5306,11 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
"addr = %s\n",
paddress (gdbarch, ir.addr));
- /* prefixes */
- while (1)
+ /* Process the prefixes. This used to be an infinite loop, but since
+ a VEX prefix is always the last one before the opcode, according to
+ Intel's manual anyway, and some AVX opcodes may conflict with
+ prefixes, it's safe to leave the loop as soon as we see VEX. */
+ while (!vex_prefix)
{
if (record_read_memory (gdbarch, ir.addr, &opcode8, 1))
return -1;
@@ -5258,7 +5450,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
{
/* If we found the VEX prefix, i386 will either record or warn that
the instruction isn't supported, so we can return the VEX result. */
- return i386_record_vex (&ir, rex_w, rex_r, opcode, gdbarch);
+ return i386_record_vex (&ir, rex_w, rex_r, gdbarch);
}
reswitch:
switch (opcode)
@@ -8403,7 +8595,8 @@ i386_validate_tdesc_p (i386_gdbarch_tdep *tdep,
const struct tdesc_feature *feature_core;
const struct tdesc_feature *feature_sse, *feature_avx, *feature_avx512,
- *feature_pkeys, *feature_segments;
+ *feature_pkeys, *feature_segments,
+ *feature_pl3_ssp;
int i, num_regs, valid_p;
if (! tdesc_has_registers (tdesc))
@@ -8429,6 +8622,9 @@ i386_validate_tdesc_p (i386_gdbarch_tdep *tdep,
/* Try PKEYS */
feature_pkeys = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.pkeys");
+ /* Try Shadow Stack. */
+ feature_pl3_ssp = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.pl3_ssp");
+
valid_p = 1;
/* The XCR0 bits. */
@@ -8544,6 +8740,15 @@ i386_validate_tdesc_p (i386_gdbarch_tdep *tdep,
tdep->pkeys_register_names[i]);
}
+ if (feature_pl3_ssp != nullptr)
+ {
+ if (tdep->ssp_regnum < 0)
+ tdep->ssp_regnum = I386_PL3_SSP_REGNUM;
+
+ valid_p &= tdesc_numbered_register (feature_pl3_ssp, tdesc_data,
+ tdep->ssp_regnum, "pl3_ssp");
+ }
+
return valid_p;
}
@@ -8800,41 +9005,12 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->num_core_regs = I386_NUM_GREGS + I387_NUM_REGS;
tdep->register_names = i386_register_names;
- /* No upper YMM registers. */
- tdep->ymmh_register_names = NULL;
- tdep->ymm0h_regnum = -1;
-
- /* No upper ZMM registers. */
- tdep->zmmh_register_names = NULL;
- tdep->zmm0h_regnum = -1;
-
- /* No high XMM registers. */
- tdep->xmm_avx512_register_names = NULL;
- tdep->xmm16_regnum = -1;
-
- /* No upper YMM16-31 registers. */
- tdep->ymm16h_register_names = NULL;
- tdep->ymm16h_regnum = -1;
-
tdep->num_byte_regs = 8;
tdep->num_word_regs = 8;
tdep->num_dword_regs = 0;
tdep->num_mmx_regs = 8;
tdep->num_ymm_regs = 0;
- /* No AVX512 registers. */
- tdep->k0_regnum = -1;
- tdep->num_zmm_regs = 0;
- tdep->num_ymm_avx512_regs = 0;
- tdep->num_xmm_avx512_regs = 0;
-
- /* No PKEYS registers */
- tdep->pkru_regnum = -1;
- tdep->num_pkeys_regs = 0;
-
- /* No segment base registers. */
- tdep->fsbase_regnum = -1;
-
tdesc_arch_data_up tdesc_data = tdesc_data_alloc ();
set_gdbarch_relocate_instruction (gdbarch, i386_relocate_instruction);
@@ -8949,30 +9125,30 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
-/* Return the target description for a specified XSAVE feature mask. */
+/* See i386-tdep.h. */
const struct target_desc *
-i386_target_description (uint64_t xcr0, bool segments)
+i386_target_description (uint64_t xstate_bv, bool segments)
{
static target_desc *i386_tdescs \
- [2/*SSE*/][2/*AVX*/][2/*AVX512*/][2/*PKRU*/][2/*segments*/] = {};
+ [2/*SSE*/][2/*AVX*/][2/*AVX512*/][2/*PKRU*/][2/*CET_U*/] \
+ [2/*segments*/] = {};
target_desc **tdesc;
- tdesc = &i386_tdescs[(xcr0 & X86_XSTATE_SSE) ? 1 : 0]
- [(xcr0 & X86_XSTATE_AVX) ? 1 : 0]
- [(xcr0 & X86_XSTATE_AVX512) ? 1 : 0]
- [(xcr0 & X86_XSTATE_PKRU) ? 1 : 0]
+ tdesc = &i386_tdescs[(xstate_bv & X86_XSTATE_SSE) ? 1 : 0]
+ [(xstate_bv & X86_XSTATE_AVX) ? 1 : 0]
+ [(xstate_bv & X86_XSTATE_AVX512) ? 1 : 0]
+ [(xstate_bv & X86_XSTATE_PKRU) ? 1 : 0]
+ [(xstate_bv & X86_XSTATE_CET_U) ? 1 : 0]
[segments ? 1 : 0];
if (*tdesc == NULL)
- *tdesc = i386_create_target_description (xcr0, false, segments);
+ *tdesc = i386_create_target_description (xstate_bv, false, segments);
return *tdesc;
}
-void _initialize_i386_tdep ();
-void
-_initialize_i386_tdep ()
+INIT_GDB_FILE (i386_tdep)
{
gdbarch_register (bfd_arch_i386, i386_gdbarch_init);
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index 680eb02..cfe0d73 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for the i386.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -69,56 +69,57 @@ struct i386_gdbarch_tdep : gdbarch_tdep_base
size_t sizeof_fpregset = 0;
/* Register number for %st(0). The register numbers for the other
- registers follow from this one. Set this to -1 to indicate the
- absence of an FPU. */
- int st0_regnum = 0;
+ registers follow from this one. Set this to a value >= 0 if FPU is
+ present. */
+ int st0_regnum = -1;
/* Number of MMX registers. */
int num_mmx_regs = 0;
- /* Register number for %mm0. Set this to -1 to indicate the absence
- of MMX support. */
- int mm0_regnum = 0;
+ /* Register number for %mm0. Set this to a value >= 0 if MMX is
+ supported. */
+ int mm0_regnum = -1;
/* Number of pseudo YMM registers. */
int num_ymm_regs = 0;
- /* Register number for %ymm0. Set this to -1 to indicate the absence
- of pseudo YMM register support. */
- int ymm0_regnum = 0;
+ /* Register number for %ymm0. Set this to a value >= 0 if pseudo YMM
+ registers are supported. */
+ int ymm0_regnum = -1;
/* Number of AVX512 OpMask registers (K-registers) */
int num_k_regs = 0;
- /* Register number for %k0. Set this to -1 to indicate the absence
- of AVX512 OpMask register support. */
- int k0_regnum = 0;
+ /* Register number for %k0. Set this to a value >= 0 if AVX512 OpMask
+ is supported. */
+ int k0_regnum = -1;
/* Number of pseudo ZMM registers ($zmm0-$zmm31). */
int num_zmm_regs = 0;
- /* Register number for %zmm0. Set this to -1 to indicate the absence
- of pseudo ZMM register support. */
- int zmm0_regnum = 0;
+ /* Register number for %zmm0. Set this to a value >= 0 if pseudo ZMM
+ registers are supported. */
+ int zmm0_regnum = -1;
/* Number of byte registers. */
int num_byte_regs = 0;
- /* Register pseudo number for %al. */
- int al_regnum = 0;
+ /* Register pseudo number for %al. If supported, set this to a
+ value >= 0. */
+ int al_regnum = -1;
/* Number of pseudo word registers. */
int num_word_regs = 0;
- /* Register number for %ax. */
- int ax_regnum = 0;
+ /* Register number for %ax. If supported, set this to a value >= 0. */
+ int ax_regnum = -1;
/* Number of pseudo dword registers. */
int num_dword_regs = 0;
- /* Register number for %eax. Set this to -1 to indicate the absence
- of pseudo dword register support. */
- int eax_regnum = 0;
+ /* Register number for %eax. Set this to a value >= 0 if pseudo dword
+ registers are supported. */
+ int eax_regnum = -1;
/* Number of core registers. */
int num_core_regs = 0;
@@ -129,14 +130,16 @@ struct i386_gdbarch_tdep : gdbarch_tdep_base
/* Number of SSE registers added in AVX512. */
int num_xmm_avx512_regs = 0;
- /* Register number of XMM16, the first XMM register added in AVX512. */
- int xmm16_regnum = 0;
+ /* Register number of XMM16, the first XMM register added in AVX512.
+ Set this to a value >= 0 if XMM registers are supported. */
+ int xmm16_regnum = -1;
/* Number of YMM registers added in AVX512. */
int num_ymm_avx512_regs = 0;
- /* Register number of YMM16, the first YMM register added in AVX512. */
- int ymm16_regnum = 0;
+ /* Register number of YMM16, the first YMM register added in AVX512.
+ Set this to a value >= 0 if YMM registers are supported. */
+ int ymm16_regnum = -1;
/* Bits of the extended control register 0 (the XFEATURE_ENABLED_MASK
register), excluding the x87 bit, which are supported by this GDB. */
@@ -152,23 +155,23 @@ struct i386_gdbarch_tdep : gdbarch_tdep_base
/* Register names. */
const char * const *register_names = nullptr;
- /* Register number for %ymm0h. Set this to -1 to indicate the absence
- of upper YMM register support. */
- int ymm0h_regnum = 0;
+ /* Register number for %ymm0h. Set this to a value >= 0 if they are
+ supported. */
+ int ymm0h_regnum = -1;
/* Upper YMM register names. Only used for tdesc_numbered_register. */
const char * const *ymmh_register_names = nullptr;
- /* Register number for %ymm16h. Set this to -1 to indicate the absence
- of support for YMM16-31. */
- int ymm16h_regnum = 0;
+ /* Register number for %ymm16h. Set this to a value >= 0 if they are
+ supported. */
+ int ymm16h_regnum = -1;
/* YMM16-31 register names. Only used for tdesc_numbered_register. */
const char * const *ymm16h_register_names = nullptr;
- /* Register number for %zmm0h. Set this to -1 to indicate the absence
- of ZMM_HI256 register support. */
- int zmm0h_regnum = 0;
+ /* Register number for %zmm0h. Set this to a value >= 0 if ZMM_HI256
+ registers are supported. */
+ int zmm0h_regnum = -1;
/* OpMask register names. */
const char * const *k_register_names = nullptr;
@@ -185,15 +188,20 @@ struct i386_gdbarch_tdep : gdbarch_tdep_base
/* Number of PKEYS registers. */
int num_pkeys_regs = 0;
- /* Register number for PKRU register. */
- int pkru_regnum = 0;
+ /* Register number for PKRU register. If supported, set this to a value
+ >= 0. */
+ int pkru_regnum = -1;
/* PKEYS register names. */
const char * const *pkeys_register_names = nullptr;
- /* Register number for %fsbase. Set this to -1 to indicate the
- absence of segment base registers. */
- int fsbase_regnum = 0;
+ /* Register number for the shadow stack pointer register. If supported,
+ set this to a value >= 0. */
+ int ssp_regnum = -1;
+
+ /* Register number for %fsbase. If supported, set this to a value
+ >= 0. */
+ int fsbase_regnum = -1;
/* Target description. */
const struct target_desc *tdesc = nullptr;
@@ -293,8 +301,16 @@ enum i386_regnum
I386_ZMM0H_REGNUM, /* %zmm0h */
I386_ZMM7H_REGNUM = I386_ZMM0H_REGNUM + 7,
I386_PKRU_REGNUM,
+ I386_PL3_SSP_REGNUM,
I386_FSBASE_REGNUM,
- I386_GSBASE_REGNUM
+ I386_GSBASE_REGNUM,
+
+ I386_NUM_REGS, /* Calculated from last *_REGNUM entry. */
+ I386_SSE_NUM_REGS = I386_MXCSR_REGNUM + 1,
+ I386_AVX_NUM_REGS = I386_YMM7H_REGNUM + 1,
+ I386_AVX512_NUM_REGS = I386_ZMM7H_REGNUM + 1,
+ I386_PKEYS_NUM_REGS = I386_PKRU_REGNUM + 1
+ /* STOP! New *_REGNUM entries should be added before I386_NUM_REGS. */
};
/* Register numbers of RECORD_REGMAP. */
@@ -331,12 +347,6 @@ enum record_i386_regnum
#define I386_NUM_GREGS 16
#define I386_NUM_XREGS 9
-#define I386_SSE_NUM_REGS (I386_MXCSR_REGNUM + 1)
-#define I386_AVX_NUM_REGS (I386_YMM7H_REGNUM + 1)
-#define I386_AVX512_NUM_REGS (I386_ZMM7H_REGNUM + 1)
-#define I386_PKEYS_NUM_REGS (I386_PKRU_REGNUM + 1)
-#define I386_NUM_REGS (I386_GSBASE_REGNUM + 1)
-
/* Size of the largest register. */
#define I386_MAX_REGISTER_SIZE 64
@@ -450,8 +460,11 @@ extern int i386_svr4_reg_to_regnum (struct gdbarch *gdbarch, int reg);
extern int i386_process_record (struct gdbarch *gdbarch,
struct regcache *regcache, CORE_ADDR addr);
-extern const struct target_desc *i386_target_description (uint64_t xcr0,
- bool segments);
+
+/* Return the target description for the specified xsave features as
+ defined in XSTATE_BV and SEGMENTS. */
+extern const struct target_desc *i386_target_description
+ (uint64_t xstate_bv, bool segments);
/* Functions and variables exported from i386-bsd-tdep.c. */
diff --git a/gdb/i386-windows-nat.c b/gdb/i386-windows-nat.c
index ec6077f..f878727 100644
--- a/gdb/i386-windows-nat.c
+++ b/gdb/i386-windows-nat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -82,9 +82,7 @@ i386_windows_segment_register_p (int regnum)
return regnum >= I386_CS_REGNUM && regnum <= I386_GS_REGNUM;
}
-void _initialize_i386_windows_nat ();
-void
-_initialize_i386_windows_nat ()
+INIT_GDB_FILE (i386_windows_nat)
{
#ifndef __x86_64__
x86_set_debug_register_length (4);
diff --git a/gdb/i386-windows-tdep.c b/gdb/i386-windows-tdep.c
index b3a96d7..892ecd4 100644
--- a/gdb/i386-windows-tdep.c
+++ b/gdb/i386-windows-tdep.c
@@ -1,7 +1,7 @@
/* Target-dependent code for Windows (including Cygwin) running on i386's,
for GDB.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -229,9 +229,7 @@ i386_cygwin_core_osabi_sniffer (bfd *abfd)
return GDB_OSABI_UNKNOWN;
}
-void _initialize_i386_windows_tdep ();
-void
-_initialize_i386_windows_tdep ()
+INIT_GDB_FILE (i386_windows_tdep)
{
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
i386_windows_osabi_sniffer);
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index 35a039e..977edeb 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -1,6 +1,6 @@
/* Intel 387 floating point stuff.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/i387-tdep.h b/gdb/i387-tdep.h
index bee8a08..ed4df1d 100644
--- a/gdb/i387-tdep.h
+++ b/gdb/i387-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for the i387.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ia64-libunwind-tdep.c b/gdb/ia64-libunwind-tdep.c
index 72e4fae..6d3b265 100644
--- a/gdb/ia64-libunwind-tdep.c
+++ b/gdb/ia64-libunwind-tdep.c
@@ -1,6 +1,6 @@
/* Frame unwinder for ia64 frames using the libunwind library.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
Written by Jeff Johnston, contributed by Red Hat Inc.
@@ -574,9 +574,7 @@ libunwind_is_initialized (void)
return libunwind_initialized;
}
-void _initialize_libunwind_frame ();
-void
-_initialize_libunwind_frame ()
+INIT_GDB_FILE (libunwind_frame)
{
libunwind_initialized = libunwind_load ();
}
diff --git a/gdb/ia64-libunwind-tdep.h b/gdb/ia64-libunwind-tdep.h
index 9d35864..cf83b6a 100644
--- a/gdb/ia64-libunwind-tdep.h
+++ b/gdb/ia64-libunwind-tdep.h
@@ -1,6 +1,6 @@
/* Frame unwinder for ia64 frames with libunwind frame information.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
Contributed by Jeff Johnston.
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index fd78632..e833f9d 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -1,7 +1,7 @@
/* Functions specific to running gdb native on IA-64 running
GNU/Linux.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -914,9 +914,7 @@ ia64_linux_nat_target::low_status_is_event (int status)
|| WSTOPSIG (status) == SIGILL);
}
-void _initialize_ia64_linux_nat ();
-void
-_initialize_ia64_linux_nat ()
+INIT_GDB_FILE (ia64_linux_nat)
{
/* Register the target. */
linux_target = &the_ia64_linux_nat_target;
diff --git a/gdb/ia64-linux-tdep.c b/gdb/ia64-linux-tdep.c
index da06f91..8b4e1f9 100644
--- a/gdb/ia64-linux-tdep.c
+++ b/gdb/ia64-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the IA-64 for GDB, the GNU debugger.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -26,9 +26,9 @@
#include "solib-svr4.h"
#include "symtab.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
#include "regset.h"
-#include <ctype.h>
/* The sigtramp code is in a non-readable (executable-only) region
of memory called the ``gate page''. The addresses in question
@@ -127,9 +127,9 @@ ia64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
static int
ia64_linux_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
- return ((isdigit (*s) && s[1] == '[' && s[2] == 'r') /* Displacement. */
+ return ((c_isdigit (*s) && s[1] == '[' && s[2] == 'r') /* Displacement. */
|| *s == 'r' /* Register value. */
- || isdigit (*s)); /* Literal number. */
+ || c_isdigit (*s)); /* Literal number. */
}
/* Core file support. */
@@ -235,8 +235,7 @@ ia64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_lp64_svr4_solib_ops);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
@@ -257,9 +256,7 @@ ia64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
ia64_linux_stap_is_single_operand);
}
-void _initialize_ia64_linux_tdep ();
-void
-_initialize_ia64_linux_tdep ()
+INIT_GDB_FILE (ia64_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_ia64, 0, GDB_OSABI_LINUX,
ia64_linux_init_abi);
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 11375d5..370973a 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the IA-64 for GDB, the GNU debugger.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -596,7 +596,7 @@ fetch_instruction (CORE_ADDR addr, ia64_instruction_type *it, long long *instr)
If we would like to store the whole bundle to SHADOW_CONTENTS we would have
to store already the base address (`address & ~0x0f') into PLACED_ADDRESS.
In such case there is no other place where to store
- SLOTNUM (`adress & 0x0f', value in the range <0..2>). We need to know
+ SLOTNUM (`address & 0x0f', value in the range <0..2>). We need to know
SLOTNUM in ia64_memory_remove_breakpoint.
There is one special case where we need to be extra careful:
@@ -2861,13 +2861,13 @@ ia64_get_dyn_info_list (unw_addr_space_t as,
if (!libunwind_is_initialized ())
return -UNW_ENOINFO;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
void *buf = NULL;
- text_sec = objfile->sections + SECT_OFF_TEXT (objfile);
+ text_sec = objfile.sections + SECT_OFF_TEXT ((&objfile));
ip = text_sec->addr ();
- ret = ia64_find_unwind_table (objfile, ip, &di, &buf);
+ ret = ia64_find_unwind_table (&objfile, ip, &di, &buf);
if (ret >= 0)
{
addr = libunwind_find_dyn_list (as, &di, arg);
@@ -2880,7 +2880,7 @@ ia64_get_dyn_info_list (unw_addr_space_t as,
gdb_printf (gdb_stdlog,
"dynamic unwind table in objfile %s "
"at %s (gp=%s)\n",
- bfd_get_filename (objfile->obfd),
+ bfd_get_filename (objfile.obfd),
hex_string (addr), hex_string (di.gp));
*dilap = addr;
return 0;
@@ -3111,7 +3111,7 @@ static const struct frame_unwind_legacy ia64_libunwind_sigtramp_frame_unwind (
ia64_libunwind_sigtramp_frame_sniffer
);
-/* Set of libunwind callback acccessor functions. */
+/* Set of libunwind callback accessor functions. */
unw_accessors_t ia64_unw_accessors =
{
ia64_find_proc_info_x,
@@ -3124,7 +3124,7 @@ unw_accessors_t ia64_unw_accessors =
/* get_proc_name */
};
-/* Set of special libunwind callback acccessor functions specific for accessing
+/* Set of special libunwind callback accessor functions specific for accessing
the rse registers. At the top of the stack, we want libunwind to figure out
how to read r32 - r127. Though usually they are found sequentially in
memory starting from $bof, this is not always true. */
@@ -3415,7 +3415,7 @@ slot_alignment_is_next_even (struct type *t)
/* Attempt to find (and return) the global pointer for the given
function.
- This is a rather nasty bit of code searchs for the .dynamic section
+ This rather nasty bit of code searches for the .dynamic section
in the objfile corresponding to the pc of the function we're trying
to call. Once it finds the addresses at which the .dynamic section
lives in the child process, it scans the Elf64_Dyn entries for a
@@ -3432,12 +3432,12 @@ ia64_find_global_pointer_from_dynamic_section (struct gdbarch *gdbarch,
faddr_sect = find_pc_section (faddr);
if (faddr_sect != NULL)
{
- for (obj_section *osect : faddr_sect->objfile->sections ())
+ for (obj_section &osect : faddr_sect->objfile->sections ())
{
- if (strcmp (osect->the_bfd_section->name, ".dynamic") == 0)
+ if (strcmp (osect.the_bfd_section->name, ".dynamic") == 0)
{
- CORE_ADDR addr = osect->addr ();
- CORE_ADDR endaddr = osect->endaddr ();
+ CORE_ADDR addr = osect.addr ();
+ CORE_ADDR endaddr = osect.endaddr ();
while (addr < endaddr)
{
@@ -3513,12 +3513,12 @@ find_extant_func_descr (struct gdbarch *gdbarch, CORE_ADDR faddr)
if (faddr_sect != NULL)
{
- for (obj_section *osect : faddr_sect->objfile->sections ())
+ for (obj_section &osect : faddr_sect->objfile->sections ())
{
- if (strcmp (osect->the_bfd_section->name, ".opd") == 0)
+ if (strcmp (osect.the_bfd_section->name, ".opd") == 0)
{
- CORE_ADDR addr = osect->addr ();
- CORE_ADDR endaddr = osect->endaddr ();
+ CORE_ADDR addr = osect.addr ();
+ CORE_ADDR endaddr = osect.endaddr ();
while (addr < endaddr)
{
@@ -4014,9 +4014,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_ia64_tdep ();
-void
-_initialize_ia64_tdep ()
+INIT_GDB_FILE (ia64_tdep)
{
gdbarch_register (bfd_arch_ia64, ia64_gdbarch_init, NULL);
}
diff --git a/gdb/ia64-tdep.h b/gdb/ia64-tdep.h
index 9a8acff..d386ea7 100644
--- a/gdb/ia64-tdep.h
+++ b/gdb/ia64-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for the ia64.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ia64-vms-tdep.c b/gdb/ia64-vms-tdep.c
index 20308c7..32fe5d4 100644
--- a/gdb/ia64-vms-tdep.c
+++ b/gdb/ia64-vms-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for OpenVMS IA-64.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -118,7 +118,7 @@ ia64_vms_get_dyn_info_list (unw_addr_space_t as,
return -UNW_ENOINFO;
}
-/* Set of libunwind callback acccessor functions. */
+/* Set of libunwind callback accessor functions. */
static unw_accessors_t ia64_vms_unw_accessors;
static unw_accessors_t ia64_vms_unw_rse_accessors;
@@ -153,9 +153,7 @@ ia64_openvms_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
#endif
}
-void _initialize_ia64_vms_tdep ();
-void
-_initialize_ia64_vms_tdep ()
+INIT_GDB_FILE (ia64_vms_tdep)
{
gdbarch_register_osabi (bfd_arch_ia64, 0, GDB_OSABI_OPENVMS,
ia64_openvms_init_abi);
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index b6b3750f..57ad0b4 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -1,6 +1,6 @@
/* Base/prototype target for default child (native) targets.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -322,11 +322,11 @@ inf_child_target::fileio_fstat (int fd, struct stat *sb, fileio_error *target_er
return ret;
}
-/* Implementation of to_fileio_stat. */
+/* Implementation of to_fileio_lstat. */
int
-inf_child_target::fileio_stat (struct inferior *inf, const char *filename,
- struct stat *sb, fileio_error *target_errno)
+inf_child_target::fileio_lstat (struct inferior *inf, const char *filename,
+ struct stat *sb, fileio_error *target_errno)
{
int ret;
diff --git a/gdb/inf-child.h b/gdb/inf-child.h
index 7e49424..70de393 100644
--- a/gdb/inf-child.h
+++ b/gdb/inf-child.h
@@ -1,6 +1,6 @@
/* Base/prototype target for default child (native) targets.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -81,8 +81,8 @@ public:
int fileio_pread (int fd, gdb_byte *read_buf, int len,
ULONGEST offset, fileio_error *target_errno) override;
int fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno) override;
- int fileio_stat (struct inferior *inf, const char *filename,
- struct stat *sb, fileio_error *target_errno) override;
+ int fileio_lstat (struct inferior *inf, const char *filename,
+ struct stat *sb, fileio_error *target_errno) override;
int fileio_close (int fd, fileio_error *target_errno) override;
int fileio_unlink (struct inferior *inf,
const char *filename,
diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c
index ec0c059..0134c77 100644
--- a/gdb/inf-loop.c
+++ b/gdb/inf-loop.c
@@ -1,5 +1,5 @@
/* Handling of inferior events for the event loop for GDB, the GNU debugger.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
This file is part of GDB.
@@ -74,7 +74,7 @@ inferior_event_handler (enum inferior_event_type event_type)
{
/* If the user was running a foreground execution
command, then propagate the error so that the prompt
- can be reenabled. Otherwise, the user already has
+ can be re-enabled. Otherwise, the user already has
the prompt and is typing some unrelated command, so
just inform the user and swallow the exception. */
if (current_ui->prompt_state == PROMPT_BLOCKED)
diff --git a/gdb/inf-loop.h b/gdb/inf-loop.h
index 2bf29fa..f3dfac1 100644
--- a/gdb/inf-loop.h
+++ b/gdb/inf-loop.h
@@ -1,5 +1,5 @@
/* Interface to the inferior event handling code for GDB, the GNU debugger.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
This file is part of GDB.
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 56ff2fc..efa269c 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -1,6 +1,6 @@
/* Low-level child interface to ptrace.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/inf-ptrace.h b/gdb/inf-ptrace.h
index 901f7e9..aa63f90 100644
--- a/gdb/inf-ptrace.h
+++ b/gdb/inf-ptrace.h
@@ -1,6 +1,6 @@
/* Low level child interface to ptrace.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 6399278..c4b4c8f 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -1,6 +1,6 @@
/* Perform an inferior function call, for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -887,9 +887,9 @@ run_inferior_call (std::unique_ptr<call_thread_fsm> sm,
call async_enable_stdin. This changes the prompt state to
PROMPT_NEEDED.
- If the previous prompt state was PROMPT_NEEDED, then as
- async_enable_stdin has already been called, nothing additional
- needs to be done here. */
+ If the previous prompt state was PROMPT_NEEDED, then async_enable_stdin
+ may or may not have been called, so do the same changes as in
+ async_enable_stdin. */
if (current_ui->prompt_state == PROMPT_BLOCKED)
{
if (call_thread->thread_fsm ()->finished_p ())
@@ -897,6 +897,12 @@ run_inferior_call (std::unique_ptr<call_thread_fsm> sm,
else
async_enable_stdin ();
}
+ else if (current_ui->prompt_state == PROMPT_NEEDED)
+ {
+ /* Copied from async_enable_stdin. */
+ target_terminal::ours ();
+ current_ui->register_file_handler ();
+ }
/* If the infcall does NOT succeed, normal_stop will have already
finished the thread states. However, on success, normal_stop
@@ -1276,7 +1282,7 @@ call_function_by_hand_dummy (struct value *function,
/* A call dummy always consists of just a single breakpoint, so
its address is the same as the address of the dummy.
- The actual breakpoint is inserted separatly so there is no need to
+ The actual breakpoint is inserted separately so there is no need to
write that out. */
bp_addr = dummy_addr;
break;
@@ -1448,10 +1454,16 @@ call_function_by_hand_dummy (struct value *function,
/* Create the dummy stack frame. Pass in the call dummy address as,
presumably, the ABI code knows where, in the call dummy, the
return address should be pointed. */
- sp = gdbarch_push_dummy_call (gdbarch, function,
- get_thread_regcache (inferior_thread ()),
- bp_addr, args.size (), args.data (),
- sp, return_method, struct_addr);
+ regcache *regcache = get_thread_regcache (inferior_thread ());
+ sp = gdbarch_push_dummy_call (gdbarch, function, regcache, bp_addr,
+ args.size (), args.data (), sp,
+ return_method, struct_addr);
+
+ /* Push the return address of the inferior (bp_addr) to the shadow stack
+ and update the shadow stack pointer. As we don't execute a call
+ instruction to call the function we need to handle this manually. */
+ if (gdbarch_shadow_stack_push_p (gdbarch))
+ gdbarch_shadow_stack_push (gdbarch, bp_addr, regcache);
/* Set up a frame ID for the dummy frame so we can pass it to
set_momentary_breakpoint. We need to give the breakpoint a frame
@@ -1870,9 +1882,7 @@ When the function is done executing, GDB will silently stop."),
gdb_assert_not_reached ("... should not be here");
}
-void _initialize_infcall ();
-void
-_initialize_infcall ()
+INIT_GDB_FILE (infcall)
{
add_setshow_boolean_cmd ("may-call-functions", no_class,
&may_call_functions_p, _("\
diff --git a/gdb/infcall.h b/gdb/infcall.h
index eccf133..3b02f45 100644
--- a/gdb/infcall.h
+++ b/gdb/infcall.h
@@ -1,6 +1,6 @@
/* Perform an inferior function call, for GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 7ab98df..e4b3e5b 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1,6 +1,6 @@
/* Memory-access and commands for "inferior" process, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -25,6 +25,7 @@
#include "inferior.h"
#include "infrun.h"
#include "gdbsupport/environ.h"
+#include "gdbsupport/common-inferior.h"
#include "value.h"
#include "cli/cli-cmds.h"
#include "cli/cli-style.h"
@@ -39,7 +40,6 @@
#include "reggroups.h"
#include "block.h"
#include "solib.h"
-#include <ctype.h>
#include "observable.h"
#include "target-descriptions.h"
#include "user-regs.h"
@@ -111,13 +111,9 @@ static void
show_inferior_tty_command (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- /* Note that we ignore the passed-in value in favor of computing it
- directly. */
- const std::string &inferior_tty = current_inferior ()->tty ();
-
gdb_printf (file,
_("Terminal for future runs of program being debugged "
- "is \"%s\".\n"), inferior_tty.c_str ());
+ "is \"%s\".\n"), value);
}
/* Store the new value passed to 'set args'. */
@@ -142,11 +138,9 @@ static void
show_args_command (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- /* Ignore the passed in value, pull the argument directly from the
- inferior. However, these should always be the same. */
gdb_printf (file, _("\
Argument list to give program being debugged when it is started is \"%s\".\n"),
- current_inferior ()->args ().c_str ());
+ value);
}
/* See gdbsupport/common-inferior.h. */
@@ -171,9 +165,7 @@ static void
show_cwd_command (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- const std::string &cwd = current_inferior ()->cwd ();
-
- if (cwd.empty ())
+ if (strlen (value) == 0)
gdb_printf (file,
_("\
You have not set the inferior's current working directory.\n\
@@ -183,7 +175,7 @@ server's cwd if remote debugging.\n"));
gdb_printf (file,
_("Current working directory that will be used "
"when starting the inferior is \"%s\".\n"),
- cwd.c_str ());
+ value);
}
@@ -209,7 +201,7 @@ strip_bg_char (const char *args, int *bg_char_p)
if (p[-1] == '&')
{
p--;
- while (p > args && isspace (p[-1]))
+ while (p > args && c_isspace (p[-1]))
p--;
*bg_char_p = 1;
@@ -224,14 +216,11 @@ strip_bg_char (const char *args, int *bg_char_p)
return make_unique_xstrdup (args);
}
-/* Common actions to take after creating any sort of inferior, by any
- means (running, attaching, connecting, et cetera). The target
- should be stopped. */
+/* See inferior.h. */
void
-post_create_inferior (int from_tty)
+post_create_inferior (int from_tty, bool set_pspace_solib_ops)
{
-
/* Be sure we own the terminal in case write operations are performed. */
target_terminal::ours_for_output ();
@@ -261,6 +250,11 @@ post_create_inferior (int from_tty)
throw;
}
+ if (set_pspace_solib_ops)
+ current_program_space->set_solib_ops
+ (gdbarch_make_solib_ops (current_inferior ()->arch (),
+ current_program_space));
+
if (current_program_space->exec_bfd ())
{
const unsigned solib_add_generation
@@ -482,7 +476,7 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how)
/* Pass zero for FROM_TTY, because at this point the "run" command
has done its thing; now we are setting up the running program. */
- post_create_inferior (0);
+ post_create_inferior (0, true);
/* Queue a pending event so that the program stops immediately. */
if (run_how == RUN_STOP_AT_FIRST_INSN)
@@ -493,6 +487,11 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how)
thr->set_pending_waitstatus (ws);
}
+ /* Still call clear_proceed_status; in schedule multiple mode the proceed
+ can resume threads from other inferiors, which might need clearing
+ prior to a proceed call. */
+ clear_proceed_status (0);
+
/* Start the target running. Do not use -1 continuation as it would skip
breakpoint right at the entry point. */
proceed (regcache_read_pc (get_thread_regcache (inferior_thread ())),
@@ -988,7 +987,7 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm)
if (inline_skipped_frames (tp) > 0)
{
const symbol *sym = inline_skipped_symbol (tp);
- if (sym->aclass () == LOC_BLOCK)
+ if (sym->loc_class () == LOC_BLOCK)
{
const block *block = sym->value_block ();
if (block->end () < tp->control.step_range_end)
@@ -1196,20 +1195,20 @@ signal_command (const char *signum_exp, int from_tty)
thread_info *current = inferior_thread ();
- for (thread_info *tp : all_non_exited_threads (resume_target, resume_ptid))
+ for (thread_info &tp : all_non_exited_threads (resume_target, resume_ptid))
{
- if (tp == current)
+ if (&tp == current)
continue;
- if (tp->stop_signal () != GDB_SIGNAL_0
- && signal_pass_state (tp->stop_signal ()))
+ if (tp.stop_signal () != GDB_SIGNAL_0
+ && signal_pass_state (tp.stop_signal ()))
{
if (!must_confirm)
gdb_printf (_("Note:\n"));
gdb_printf (_(" Thread %s previously stopped with signal %s, %s.\n"),
- print_thread_id (tp),
- gdb_signal_to_name (tp->stop_signal ()),
- gdb_signal_to_string (tp->stop_signal ()));
+ print_thread_id (&tp),
+ gdb_signal_to_name (tp.stop_signal ()),
+ gdb_signal_to_string (tp.stop_signal ()));
must_confirm = 1;
}
}
@@ -2306,12 +2305,12 @@ registers_info (const char *addr_exp, int fpregs)
resembling a register following it. */
if (addr_exp[0] == '$')
addr_exp++;
- if (isspace ((*addr_exp)) || (*addr_exp) == '\0')
+ if (c_isspace ((*addr_exp)) || (*addr_exp) == '\0')
error (_("Missing register name"));
/* Find the start/end of this register name/num/group. */
start = addr_exp;
- while ((*addr_exp) != '\0' && !isspace ((*addr_exp)))
+ while ((*addr_exp) != '\0' && !c_isspace ((*addr_exp)))
addr_exp++;
end = addr_exp;
@@ -2472,12 +2471,12 @@ proceed_after_attach (inferior *inf)
/* Backup current thread and selected frame. */
scoped_restore_current_thread restore_thread;
- for (thread_info *thread : inf->non_exited_threads ())
- if (!thread->executing ()
- && !thread->stop_requested
- && thread->stop_signal () == GDB_SIGNAL_0)
+ for (thread_info &thread : inf->non_exited_threads ())
+ if (!thread.executing ()
+ && !thread.stop_requested
+ && thread.stop_signal () == GDB_SIGNAL_0)
{
- switch_to_thread (thread);
+ switch_to_thread (&thread);
clear_proceed_status (0);
proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT);
}
@@ -2506,7 +2505,7 @@ setup_inferior (int from_tty)
/* Take any necessary post-attaching actions for this platform. */
target_post_attach (inferior_ptid.pid ());
- post_create_inferior (from_tty);
+ post_create_inferior (from_tty, true);
}
/* What to do after the first program stops after attaching. */
@@ -2581,10 +2580,10 @@ attach_post_wait (int from_tty, enum attach_post_wait_mode mode)
stop. For consistency, always select the thread with
lowest GDB number, which should be the main thread, if it
still exists. */
- for (thread_info *thread : current_inferior ()->non_exited_threads ())
- if (thread->inf->num < lowest->inf->num
- || thread->per_inf_num < lowest->per_inf_num)
- lowest = thread;
+ for (thread_info &thread : current_inferior ()->non_exited_threads ())
+ if (thread.inf->num < lowest->inf->num
+ || thread.per_inf_num < lowest->per_inf_num)
+ lowest = &thread;
switch_to_thread (lowest);
}
@@ -3080,9 +3079,7 @@ use \"set args\" without arguments.\n\
\n\
To start the inferior without using a shell, use \"set startup-with-shell off\"."
-void _initialize_infcmd ();
-void
-_initialize_infcmd ()
+INIT_GDB_FILE (infcmd)
{
static struct cmd_list_element *info_proc_cmdlist;
struct cmd_list_element *c = nullptr;
diff --git a/gdb/inferior-iter.h b/gdb/inferior-iter.h
index 05ddfca..2a0d5c3 100644
--- a/gdb/inferior-iter.h
+++ b/gdb/inferior-iter.h
@@ -1,6 +1,6 @@
/* Inferior iterators and ranges for GDB, the GNU debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 6472d49..77626be 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -1,6 +1,6 @@
/* Multi-process control for GDB, the GNU debugger.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -19,6 +19,7 @@
#include "exec.h"
#include "inferior.h"
+#include "gdbsupport/common-inferior.h"
#include "target.h"
#include "command.h"
#include "completer.h"
@@ -103,8 +104,8 @@ inferior::unpush_target (struct target_ops *t)
{
process_stratum_target *proc_target = as_process_stratum_target (t);
- for (thread_info *thread : this->non_exited_threads ())
- proc_target->maybe_remove_resumed_with_pending_wait_status (thread);
+ for (thread_info &thread : this->non_exited_threads ())
+ proc_target->maybe_remove_resumed_with_pending_wait_status (&thread);
}
return m_target_stack.unpush (t);
@@ -457,7 +458,7 @@ number_of_live_inferiors (process_stratum_target *proc_target)
for (inferior *inf : all_non_exited_inferiors (proc_target))
if (inf->has_execution ())
- for (thread_info *tp ATTRIBUTE_UNUSED : inf->non_exited_threads ())
+ for (thread_info &tp ATTRIBUTE_UNUSED : inf->non_exited_threads ())
{
/* Found a live thread in this inferior, go to the next
inferior. */
@@ -633,6 +634,13 @@ print_inferior (struct ui_out *uiout, const char *requested_inferiors)
uiout->text (_("\n\tis vfork parent of inferior "));
uiout->field_signed ("vfork-child", inf->vfork_child->num);
}
+ if (get_inferior_core_bfd (inf) != nullptr)
+ {
+ uiout->text (_("\n\tcore file "));
+ uiout->field_string ("core-file",
+ bfd_get_filename (get_inferior_core_bfd (inf)),
+ file_name_style.style ());
+ }
uiout->text ("\n");
}
@@ -879,6 +887,19 @@ switch_to_inferior_and_push_target (inferior *new_inf,
symbols. */
switch_to_inferior_no_thread (new_inf);
+ /* If the user didn't specify '-no-connection', and the ORG_INF has a
+ process stratum target, but that target cannot be shared, or cannot
+ start a new inferior, then don't try to share the target. */
+ if (!no_connection && proc_target != nullptr
+ && (!proc_target->is_shareable ()
+ || !proc_target->can_create_inferior ()))
+ {
+ warning (_("can't share connection %d (%s) between inferiors"),
+ proc_target->connection_number,
+ make_target_connection_string (proc_target).c_str ());
+ proc_target = nullptr;
+ }
+
/* Reuse the target for new inferior. */
if (!no_connection && proc_target != NULL)
{
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 327a474..5b499a2 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -1,7 +1,7 @@
/* Variables that describe the inferior process running under GDB:
Where it is, why it stopped, and how to step it.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -54,10 +54,8 @@ struct thread_info;
#include "symfile-add-flags.h"
#include "gdbsupport/refcounted-object.h"
#include "gdbsupport/forward-scope-exit.h"
-#include "gdbsupport/gdb_unique_ptr.h"
#include "gdbsupport/intrusive_list.h"
-#include "gdbsupport/common-inferior.h"
#include "gdbthread.h"
#include "process-stratum-target.h"
@@ -213,7 +211,14 @@ extern ptid_t gdb_startup_inferior (pid_t pid, int num_traps);
extern void setup_inferior (int from_tty);
-extern void post_create_inferior (int from_tty);
+/* Common actions to take after creating any sort of inferior, by any
+ means (running, attaching, connecting, et cetera). The target
+ should be stopped.
+
+ If SET_PSPACE_SOLIB_OPS is true, initialize the program space's solib
+ provider using the current inferior's architecture. */
+
+extern void post_create_inferior (int from_tty, bool set_pspace_solib_ops);
extern void attach_command (const char *, int);
@@ -464,31 +469,45 @@ public:
/* Returns a range adapter covering the inferior's threads,
including exited threads. Used like this:
- for (thread_info *thr : inf->threads ())
+ for (thread_info &thr : inf->threads ())
{ .... }
*/
inf_threads_range threads ()
- { return inf_threads_range (this->thread_list.begin ()); }
+ {
+ inf_threads_iterator begin (this->thread_list.begin ());
+
+ return inf_threads_range (std::move (begin));
+ }
/* Returns a range adapter covering the inferior's non-exited
threads. Used like this:
- for (thread_info *thr : inf->non_exited_threads ())
+ for (thread_info &thr : inf->non_exited_threads ())
{ .... }
*/
inf_non_exited_threads_range non_exited_threads ()
- { return inf_non_exited_threads_range (this->thread_list.begin ()); }
+ {
+ inf_threads_iterator begin (this->thread_list.begin ());
+ inf_non_exited_threads_iterator filtered_begin (std::move (begin));
+
+ return inf_non_exited_threads_range (std::move (filtered_begin));
+ }
/* Like inferior::threads(), but returns a range adapter that can be
used with range-for, safely. I.e., it is safe to delete the
currently-iterated thread, like this:
- for (thread_info *t : inf->threads_safe ())
+ for (thread_info &t : inf->threads_safe ())
if (some_condition ())
- delete f;
+ delete &f;
*/
inline safe_inf_threads_range threads_safe ()
- { return safe_inf_threads_range (this->thread_list.begin ()); }
+ {
+ inf_threads_iterator begin (this->thread_list.begin ());
+ safe_inf_threads_iterator safe_begin (std::move (begin));
+
+ return safe_inf_threads_range (std::move (safe_begin));
+ }
/* Find (non-exited) thread PTID of this inferior. */
thread_info *find_thread (ptid_t ptid);
@@ -815,7 +834,10 @@ extern intrusive_list<inferior> inferior_list;
inline all_inferiors_safe_range
all_inferiors_safe ()
{
- return all_inferiors_safe_range (nullptr, inferior_list);
+ all_inferiors_iterator begin (nullptr, inferior_list);
+ all_inferiors_safe_iterator safe_begin (std::move (begin));
+
+ return all_inferiors_safe_range (std::move (safe_begin));
}
/* Returns a range representing all inferiors, suitable to use with
@@ -828,7 +850,9 @@ all_inferiors_safe ()
inline all_inferiors_range
all_inferiors (process_stratum_target *proc_target = nullptr)
{
- return all_inferiors_range (proc_target, inferior_list);
+ all_inferiors_iterator begin (proc_target, inferior_list);
+
+ return all_inferiors_range (std::move (begin));
}
/* Return a range that can be used to walk over all inferiors with PID
@@ -837,7 +861,10 @@ all_inferiors (process_stratum_target *proc_target = nullptr)
inline all_non_exited_inferiors_range
all_non_exited_inferiors (process_stratum_target *proc_target = nullptr)
{
- return all_non_exited_inferiors_range (proc_target, inferior_list);
+ all_inferiors_iterator begin (proc_target, inferior_list);
+ all_non_exited_inferiors_iterator filtered_begin (std::move (begin));
+
+ return all_non_exited_inferiors_range (std::move (filtered_begin));
}
/* Prune away automatically added inferiors that aren't required
@@ -851,9 +878,10 @@ extern struct inferior *add_inferior_with_spaces (void);
/* Print the current selected inferior. */
extern void print_selected_inferior (struct ui_out *uiout);
-/* Switch to inferior NEW_INF, a new inferior, and unless
- NO_CONNECTION is true, push the process_stratum_target of ORG_INF
- to NEW_INF. */
+/* Switch to inferior NEW_INF, a new inferior, and unless NO_CONNECTION is
+ true, or the process_stratum_target of ORG_INF is not shareable, or the
+ process_stratum_target cannot start new inferiors, push the
+ process_stratum_target of ORG_INF to NEW_INF. */
extern void switch_to_inferior_and_push_target
(inferior *new_inf, bool no_connection, inferior *org_inf);
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 773ac0b..ccab019 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -1,5 +1,5 @@
/* Low level interface to ptrace, for GDB when running under Unix.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -55,6 +55,20 @@ static void child_terminal_ours_1 (target_terminal_state);
static struct serial *stdin_serial;
+/* See terminal.h. */
+
+scoped_gdb_ttystate::scoped_gdb_ttystate ()
+{
+ m_ttystate = serial_get_tty_state (stdin_serial);
+}
+
+/* See terminal.h. */
+
+scoped_gdb_ttystate::~scoped_gdb_ttystate ()
+{
+ serial_set_tty_state (stdin_serial, m_ttystate);
+}
+
/* Terminal related info we need to keep track of. Each inferior
holds an instance of this structure --- we save it whenever the
corresponding inferior stops, and restore it to the terminal when
@@ -163,6 +177,15 @@ set_initial_gdb_ttystate (void)
}
}
+/* See terminal.h. */
+
+void
+restore_initial_gdb_ttystate ()
+{
+ if (initial_gdb_ttystate != nullptr)
+ serial_set_tty_state (stdin_serial, initial_gdb_ttystate);
+}
+
/* Does GDB have a terminal (on stdin)? */
static int
@@ -523,15 +546,15 @@ child_interrupt (struct target_ops *self)
{
/* Interrupt the first inferior that has a resumed thread. */
thread_info *resumed = NULL;
- for (thread_info *thr : all_non_exited_threads ())
+ for (thread_info &thr : all_non_exited_threads ())
{
- if (thr->executing ())
+ if (thr.executing ())
{
- resumed = thr;
+ resumed = &thr;
break;
}
- if (thr->has_pending_waitstatus ())
- resumed = thr;
+ if (thr.has_pending_waitstatus ())
+ resumed = &thr;
}
if (resumed != NULL)
@@ -944,9 +967,7 @@ initialize_stdin_serial (void)
stdin_serial = serial_fdopen (0);
}
-void _initialize_inflow ();
-void
-_initialize_inflow ()
+INIT_GDB_FILE (inflow)
{
add_info ("terminal", info_terminal_command,
_("Print inferior's saved terminal status."));
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 9f5b3d4..b3c408f 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1,7 +1,7 @@
/* Target-struct-independent code to start (run) and stop an inferior
process.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,7 +22,6 @@
#include "cli/cli-style.h"
#include "displaced-stepping.h"
#include "infrun.h"
-#include <ctype.h>
#include "exceptions.h"
#include "symtab.h"
#include "frame.h"
@@ -58,7 +57,6 @@
#include "target-descriptions.h"
#include "target-dcache.h"
#include "terminal.h"
-#include "solist.h"
#include "gdbsupport/event-loop.h"
#include "thread-fsm.h"
#include "gdbsupport/enum-flags.h"
@@ -68,7 +66,6 @@
#include "gdbsupport/scope-exit.h"
#include "gdbsupport/forward-scope-exit.h"
#include "gdbsupport/gdb_select.h"
-#include <unordered_map>
#include "async-event.h"
#include "gdbsupport/selftest.h"
#include "scoped-mock-context.h"
@@ -473,6 +470,7 @@ holding the child stopped. Try \"set %ps\" or \"%ps\".\n"),
inferior *parent_inf = current_inferior ();
inferior *child_inf = nullptr;
+ bool child_has_new_pspace = false;
gdb_assert (parent_inf->thread_waiting_for_vfork_done == nullptr);
@@ -537,6 +535,7 @@ holding the child stopped. Try \"set %ps\" or \"%ps\".\n"),
else
{
child_inf->pspace = new program_space (new_address_space ());
+ child_has_new_pspace = true;
child_inf->aspace = child_inf->pspace->aspace;
child_inf->removable = true;
clone_program_space (child_inf->pspace, parent_inf->pspace);
@@ -626,6 +625,7 @@ holding the child stopped. Try \"set %ps\" or \"%ps\".\n"),
else
{
child_inf->pspace = new program_space (new_address_space ());
+ child_has_new_pspace = true;
child_inf->aspace = child_inf->pspace->aspace;
child_inf->removable = true;
child_inf->symfile_flags = SYMFILE_NO_READ;
@@ -723,8 +723,9 @@ holding the child stopped. Try \"set %ps\" or \"%ps\".\n"),
if (!follow_child && !sched_multi)
maybe_restore.emplace ();
- switch_to_thread (*child_inf->threads ().begin ());
- post_create_inferior (0);
+ switch_to_thread (&*child_inf->threads ().begin ());
+
+ post_create_inferior (0, child_has_new_pspace);
}
return false;
@@ -777,23 +778,23 @@ follow_fork ()
switch back to it, to tell the target to follow it (in either
direction). We'll afterwards refuse to resume, and inform
the user what happened. */
- for (thread_info *tp : all_non_exited_threads (resume_target,
+ for (thread_info &tp : all_non_exited_threads (resume_target,
resume_ptid))
{
- if (tp == cur_thr)
+ if (&tp == cur_thr)
continue;
/* follow_fork_inferior clears tp->pending_follow, and below
we'll need the value after the follow_fork_inferior
call. */
- target_waitkind kind = tp->pending_follow.kind ();
+ target_waitkind kind = tp.pending_follow.kind ();
if (kind != TARGET_WAITKIND_SPURIOUS)
{
infrun_debug_printf ("need to follow-fork [%s] first",
- tp->ptid.to_string ().c_str ());
+ tp.ptid.to_string ().c_str ());
- switch_to_thread (tp);
+ switch_to_thread (&tp);
/* Set up inferior(s) as specified by the caller, and
tell the target to do whatever is necessary to follow
@@ -1143,8 +1144,8 @@ handle_vfork_child_exec_or_exit (int exec)
infrun_debug_printf ("resuming vfork parent process %d",
resume_parent->pid);
- for (thread_info *thread : resume_parent->threads ())
- proceed_after_vfork_done (thread);
+ for (thread_info &thread : resume_parent->threads ())
+ proceed_after_vfork_done (&thread);
}
}
}
@@ -1269,9 +1270,9 @@ follow_exec (ptid_t ptid, const char *exec_file_target)
them. Deleting them now rather than at the next user-visible
stop provides a nicer sequence of events for user and MI
notifications. */
- for (thread_info *th : all_threads_safe ())
- if (th->ptid.pid () == pid && th->ptid != ptid)
- delete_thread (th);
+ for (thread_info &th : all_threads_safe ())
+ if (th.ptid.pid () == pid && th.ptid != ptid)
+ delete_thread (&th);
/* We also need to clear any left over stale state for the
leader/event thread. E.g., if there was any step-resume
@@ -1322,6 +1323,7 @@ follow_exec (ptid_t ptid, const char *exec_file_target)
we don't want those to be satisfied by the libraries of the
previous incarnation of this process. */
no_shared_libraries (current_program_space);
+ current_program_space->unset_solib_ops ();
inferior *execing_inferior = current_inferior ();
inferior *following_inferior;
@@ -1378,6 +1380,9 @@ follow_exec (ptid_t ptid, const char *exec_file_target)
registers. */
target_find_description ();
+ following_inferior->pspace->set_solib_ops
+ (gdbarch_make_solib_ops (following_inferior->arch (),
+ following_inferior->pspace));
gdb::observers::inferior_execd.notify (execing_inferior, following_inferior);
breakpoint_re_set ();
@@ -1663,8 +1668,8 @@ infrun_inferior_execd (inferior *exec_inf, inferior *follow_inf)
stepping buffer bytes. */
follow_inf->displaced_step_state.reset ();
- for (thread_info *thread : follow_inf->threads ())
- thread->displaced_step_state.reset ();
+ for (thread_info &thread : follow_inf->threads ())
+ thread.displaced_step_state.reset ();
/* Since an in-line step is done with everything else stopped, if there was
one in progress at the time of the exec, it must have been the exec'ing
@@ -1968,10 +1973,10 @@ static bool
any_thread_needs_target_thread_events (process_stratum_target *target,
ptid_t resume_ptid)
{
- for (thread_info *tp : all_non_exited_threads (target, resume_ptid))
- if (displaced_step_in_progress_thread (tp)
- || schedlock_applies (tp)
- || tp->thread_fsm () != nullptr)
+ for (thread_info &tp : all_non_exited_threads (target, resume_ptid))
+ if (displaced_step_in_progress_thread (&tp)
+ || schedlock_applies (&tp)
+ || tp.thread_fsm () != nullptr)
return true;
return false;
}
@@ -2179,14 +2184,14 @@ start_step_over (void)
thread_step_over_list_safe_range range
= make_thread_step_over_list_safe_range (threads_to_step);
- for (thread_info *tp : range)
+ for (thread_info &tp : range)
{
step_over_what step_what;
int must_be_in_line;
- gdb_assert (!tp->stop_requested);
+ gdb_assert (!tp.stop_requested);
- if (tp->inf->displaced_step_state.unavailable)
+ if (tp.inf->displaced_step_state.unavailable)
{
/* The arch told us to not even try preparing another displaced step
for this inferior. Just leave the thread in THREADS_TO_STEP, it
@@ -2194,7 +2199,7 @@ start_step_over (void)
continue;
}
- if (tp->inf->thread_waiting_for_vfork_done != nullptr)
+ if (tp.inf->thread_waiting_for_vfork_done != nullptr)
{
/* When we stop all threads, handling a vfork, any thread in the step
over chain remains there. A user could also try to continue a
@@ -2210,36 +2215,36 @@ start_step_over (void)
step over chain indefinitely if something goes wrong when resuming it
If the error is intermittent and it still needs a step over, it will
get enqueued again when we try to resume it normally. */
- threads_to_step.erase (threads_to_step.iterator_to (*tp));
+ threads_to_step.erase (threads_to_step.iterator_to (tp));
- step_what = thread_still_needs_step_over (tp);
+ step_what = thread_still_needs_step_over (&tp);
must_be_in_line = ((step_what & STEP_OVER_WATCHPOINT)
|| ((step_what & STEP_OVER_BREAKPOINT)
- && !use_displaced_stepping (tp)));
+ && !use_displaced_stepping (&tp)));
/* We currently stop all threads of all processes to step-over
in-line. If we need to start a new in-line step-over, let
any pending displaced steps finish first. */
if (must_be_in_line && displaced_step_in_progress_any_thread ())
{
- global_thread_step_over_chain_enqueue (tp);
+ global_thread_step_over_chain_enqueue (&tp);
continue;
}
- if (tp->control.trap_expected
- || tp->resumed ()
- || tp->executing ())
+ if (tp.control.trap_expected
+ || tp.resumed ()
+ || tp.executing ())
{
internal_error ("[%s] has inconsistent state: "
"trap_expected=%d, resumed=%d, executing=%d\n",
- tp->ptid.to_string ().c_str (),
- tp->control.trap_expected,
- tp->resumed (),
- tp->executing ());
+ tp.ptid.to_string ().c_str (),
+ tp.control.trap_expected,
+ tp.resumed (),
+ tp.executing ());
}
infrun_debug_printf ("resuming [%s] for step-over",
- tp->ptid.to_string ().c_str ());
+ tp.ptid.to_string ().c_str ());
/* keep_going_pass_signal skips the step-over if the breakpoint
is no longer inserted. In all-stop, we want to keep looking
@@ -2250,8 +2255,8 @@ start_step_over (void)
if (!target_is_non_stop_p () && !step_what)
continue;
- switch_to_thread (tp);
- execution_control_state ecs (tp);
+ switch_to_thread (&tp);
+ execution_control_state ecs (&tp);
keep_going_pass_signal (&ecs);
if (!ecs.wait_some_more)
@@ -2259,23 +2264,23 @@ start_step_over (void)
/* If the thread's step over could not be initiated because no buffers
were available, it was re-added to the global step over chain. */
- if (tp->resumed ())
+ if (tp.resumed ())
{
infrun_debug_printf ("[%s] was resumed.",
- tp->ptid.to_string ().c_str ());
- gdb_assert (!thread_is_in_step_over_chain (tp));
+ tp.ptid.to_string ().c_str ());
+ gdb_assert (!thread_is_in_step_over_chain (&tp));
}
else
{
infrun_debug_printf ("[%s] was NOT resumed.",
- tp->ptid.to_string ().c_str ());
- gdb_assert (thread_is_in_step_over_chain (tp));
+ tp.ptid.to_string ().c_str ());
+ gdb_assert (thread_is_in_step_over_chain (&tp));
}
/* If we started a new in-line step-over, we're done. */
if (step_over_info_valid_p ())
{
- gdb_assert (tp->control.trap_expected);
+ gdb_assert (tp.control.trap_expected);
started = true;
break;
}
@@ -2284,8 +2289,8 @@ start_step_over (void)
{
/* On all-stop, shouldn't have resumed unless we needed a
step over. */
- gdb_assert (tp->control.trap_expected
- || tp->step_after_step_resume_breakpoint);
+ gdb_assert (tp.control.trap_expected
+ || tp.step_after_step_resume_breakpoint);
/* With remote targets (at least), in all-stop, we can't
issue any further remote commands until the program stops
@@ -2365,7 +2370,7 @@ maybe_software_singlestep (struct gdbarch *gdbarch)
bool hw_step = true;
if (execution_direction == EXEC_FORWARD
- && gdbarch_software_single_step_p (gdbarch))
+ && gdbarch_get_next_pcs_p (gdbarch))
hw_step = !insert_single_step_breakpoints (gdbarch);
return hw_step;
@@ -2612,10 +2617,10 @@ do_target_resume (ptid_t resume_ptid, bool step, enum gdb_signal sig)
if (resume_ptid != inferior_ptid && target_supports_set_thread_options (0))
{
process_stratum_target *resume_target = tp->inf->process_target ();
- for (thread_info *thr_iter : all_non_exited_threads (resume_target,
+ for (thread_info &thr_iter : all_non_exited_threads (resume_target,
resume_ptid))
- if (thr_iter != tp)
- thr_iter->set_thread_options (0);
+ if (&thr_iter != tp)
+ thr_iter.set_thread_options (0);
}
infrun_debug_printf ("resume_ptid=%s, step=%d, sig=%s",
@@ -3124,8 +3129,8 @@ clear_proceed_status (int step)
/* In all-stop mode, delete the per-thread status of all threads
we're about to resume, implicitly and explicitly. */
- for (thread_info *tp : all_non_exited_threads (resume_target, resume_ptid))
- clear_proceed_status_thread (tp);
+ for (thread_info &tp : all_non_exited_threads (resume_target, resume_ptid))
+ clear_proceed_status_thread (&tp);
}
if (inferior_ptid != null_ptid)
@@ -3706,25 +3711,25 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
threads. */
if (!non_stop && !schedlock_applies (cur_thr))
{
- for (thread_info *tp : all_non_exited_threads (resume_target,
+ for (thread_info &tp : all_non_exited_threads (resume_target,
resume_ptid))
{
- switch_to_thread_no_regs (tp);
+ switch_to_thread_no_regs (&tp);
/* Ignore the current thread here. It's handled
afterwards. */
- if (tp == cur_thr)
+ if (&tp == cur_thr)
continue;
- if (!thread_still_needs_step_over (tp))
+ if (!thread_still_needs_step_over (&tp))
continue;
- gdb_assert (!thread_is_in_step_over_chain (tp));
+ gdb_assert (!thread_is_in_step_over_chain (&tp));
infrun_debug_printf ("need to step-over [%s] first",
- tp->ptid.to_string ().c_str ());
+ tp.ptid.to_string ().c_str ());
- global_thread_step_over_chain_enqueue (tp);
+ global_thread_step_over_chain_enqueue (&tp);
}
switch_to_thread (cur_thr);
@@ -3764,11 +3769,11 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
/* In all-stop, but the target is always in non-stop mode.
Start all other threads that are implicitly resumed too. */
- for (thread_info *tp : all_non_exited_threads (resume_target,
+ for (thread_info &tp : all_non_exited_threads (resume_target,
resume_ptid))
{
- switch_to_thread_no_regs (tp);
- proceed_resume_thread_checked (tp);
+ switch_to_thread_no_regs (&tp);
+ proceed_resume_thread_checked (&tp);
}
}
else
@@ -3819,7 +3824,7 @@ start_remote (int from_tty)
/* Now that the inferior has stopped, do any bookkeeping like
loading shared libraries. We want to do this before normal_stop,
so that the displayed frame is up to date. */
- post_create_inferior (from_tty);
+ post_create_inferior (from_tty, true);
normal_stop ();
}
@@ -3871,33 +3876,33 @@ infrun_thread_stop_requested (ptid_t ptid)
but the user/frontend doesn't know about that yet (e.g., the
thread had been temporarily paused for some step-over), set up
for reporting the stop now. */
- for (thread_info *tp : all_threads (curr_target, ptid))
+ for (thread_info &tp : all_threads (curr_target, ptid))
{
- if (tp->state != THREAD_RUNNING)
+ if (tp.state != THREAD_RUNNING)
continue;
- if (tp->executing ())
+ if (tp.executing ())
continue;
/* Remove matching threads from the step-over queue, so
start_step_over doesn't try to resume them
automatically. */
- if (thread_is_in_step_over_chain (tp))
- global_thread_step_over_chain_remove (tp);
+ if (thread_is_in_step_over_chain (&tp))
+ global_thread_step_over_chain_remove (&tp);
/* If the thread is stopped, but the user/frontend doesn't
know about that yet, queue a pending event, as if the
thread had just stopped now. Unless the thread already had
a pending event. */
- if (!tp->has_pending_waitstatus ())
+ if (!tp.has_pending_waitstatus ())
{
target_waitstatus ws;
ws.set_stopped (GDB_SIGNAL_0);
- tp->set_pending_waitstatus (ws);
+ tp.set_pending_waitstatus (ws);
}
/* Clear the inline-frame state, since we're re-processing the
stop. */
- clear_inline_frame_state (tp);
+ clear_inline_frame_state (&tp);
/* If this thread was paused because some other thread was
doing an inline-step over, let that finish first. Once
@@ -3909,7 +3914,7 @@ infrun_thread_stop_requested (ptid_t ptid)
/* Otherwise we can process the (new) pending event now. Set
it so this pending event is considered by
do_target_wait. */
- tp->set_resumed (true);
+ tp.set_resumed (true);
}
}
@@ -3945,8 +3950,8 @@ for_each_just_stopped_thread (for_each_just_stopped_thread_callback_func func)
else
{
/* In all-stop mode, all threads have stopped. */
- for (thread_info *tp : all_non_exited_threads ())
- func (tp);
+ for (thread_info &tp : all_non_exited_threads ())
+ func (&tp);
}
}
@@ -3972,7 +3977,8 @@ delete_just_stopped_threads_single_step_breakpoints (void)
void
print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid,
- const struct target_waitstatus &ws)
+ const struct target_waitstatus &ws,
+ process_stratum_target *proc_target)
{
infrun_debug_printf ("target_wait (%s [%s], status) =",
waiton_ptid.to_string ().c_str (),
@@ -3981,6 +3987,20 @@ print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid,
result_ptid.to_string ().c_str (),
target_pid_to_str (result_ptid).c_str ());
infrun_debug_printf (" %s", ws.to_string ().c_str ());
+
+ if (proc_target != nullptr)
+ infrun_debug_printf (" from target %d (%s)",
+ proc_target->connection_number,
+ proc_target->shortname ());
+}
+
+/* Wrapper for print_target_wait_results above for convenience. */
+
+static void
+print_target_wait_results (ptid_t waiton_ptid,
+ const execution_control_state &ecs)
+{
+ print_target_wait_results (waiton_ptid, ecs.ptid, ecs.ws, ecs.target);
}
/* Select a thread at random, out of those which are resumed and have
@@ -4264,12 +4284,12 @@ prepare_for_detach (void)
thread_step_over_list_safe_range range
= make_thread_step_over_list_safe_range (global_thread_step_over_list);
- for (thread_info *tp : range)
- if (tp->inf == inf)
+ for (thread_info &tp : range)
+ if (tp.inf == inf)
{
infrun_debug_printf ("removing thread %s from global step over chain",
- tp->ptid.to_string ().c_str ());
- global_thread_step_over_chain_remove (tp);
+ tp.ptid.to_string ().c_str ());
+ global_thread_step_over_chain_remove (&tp);
}
/* If we were already in the middle of an inline step-over, and the
@@ -4307,20 +4327,20 @@ prepare_for_detach (void)
/* Stop threads currently displaced stepping, aborting it. */
- for (thread_info *thr : inf->non_exited_threads ())
+ for (thread_info &thr : inf->non_exited_threads ())
{
- if (thr->displaced_step_state.in_progress ())
+ if (thr.displaced_step_state.in_progress ())
{
- if (thr->executing ())
+ if (thr.executing ())
{
- if (!thr->stop_requested)
+ if (!thr.stop_requested)
{
- target_stop (thr->ptid);
- thr->stop_requested = true;
+ target_stop (thr.ptid);
+ thr.stop_requested = true;
}
}
else
- thr->set_resumed (false);
+ thr.set_resumed (false);
}
}
@@ -4332,7 +4352,8 @@ prepare_for_detach (void)
event.ptid = do_target_wait_1 (inf, pid_ptid, &event.ws, 0);
if (debug_infrun)
- print_target_wait_results (pid_ptid, event.ptid, event.ws);
+ print_target_wait_results (pid_ptid, event.ptid, event.ws,
+ event.target);
handle_one (event);
}
@@ -4372,6 +4393,11 @@ wait_for_inferior (inferior *inf)
scoped_finish_thread_state finish_state
(inf->process_target (), minus_one_ptid);
+ /* The commit_resumed_state of INF should already be false at this point
+ as INF will be a newly started remote target. This might not be true
+ for other targets but this will be handled in stop_all_threads. */
+ gdb_assert (!inf->process_target ()->commit_resumed_state);
+
while (1)
{
execution_control_state ecs;
@@ -4388,7 +4414,7 @@ wait_for_inferior (inferior *inf)
ecs.target = inf->process_target ();
if (debug_infrun)
- print_target_wait_results (minus_one_ptid, ecs.ptid, ecs.ws);
+ print_target_wait_results (minus_one_ptid, ecs);
/* Now figure out what to do with the result of the result. */
handle_inferior_event (&ecs);
@@ -4456,18 +4482,18 @@ clean_up_just_stopped_threads_fsms (struct execution_control_state *ecs)
{
scoped_restore_current_thread restore_thread;
- for (thread_info *thr : all_threads_safe ())
+ for (thread_info &thr : all_threads_safe ())
{
- if (thr->state == THREAD_EXITED)
+ if (thr.state == THREAD_EXITED)
continue;
- if (thr == ecs->event_thread)
+ if (&thr == ecs->event_thread)
continue;
- if (thr->thread_fsm () != nullptr)
+ if (thr.thread_fsm () != nullptr)
{
- switch_to_thread (thr);
- thr->thread_fsm ()->clean_up (thr);
+ switch_to_thread (&thr);
+ thr.thread_fsm ()->clean_up (&thr);
}
/* As we are cancelling the command/FSM of this thread,
@@ -4475,10 +4501,10 @@ clean_up_just_stopped_threads_fsms (struct execution_control_state *ecs)
exited event to the user, that reason is gone. Delete
the thread, so that the user doesn't see it in the thread
list, the next proceed doesn't try to resume it, etc. */
- if (thr->has_pending_waitstatus ()
- && (thr->pending_waitstatus ().kind ()
+ if (thr.has_pending_waitstatus ()
+ && (thr.pending_waitstatus ().kind ()
== TARGET_WAITKIND_THREAD_EXITED))
- delete_thread (thr);
+ delete_thread (&thr);
}
}
}
@@ -4669,7 +4695,7 @@ fetch_inferior_event ()
switch_to_target_no_thread (ecs.target);
if (debug_infrun)
- print_target_wait_results (minus_one_ptid, ecs.ptid, ecs.ws);
+ print_target_wait_results (minus_one_ptid, ecs);
/* If an error happens while handling the event, propagate GDB's
knowledge of the executing state to the frontend/user running
@@ -5232,7 +5258,8 @@ poll_one_curr_target (struct target_waitstatus *ws)
event_ptid = target_wait (minus_one_ptid, ws, TARGET_WNOHANG);
if (debug_infrun)
- print_target_wait_results (minus_one_ptid, event_ptid, *ws);
+ print_target_wait_results (minus_one_ptid, event_ptid, *ws,
+ current_inferior ()->process_target ());
return event_ptid;
}
@@ -5431,9 +5458,9 @@ handle_one (const wait_one_event &event)
{
int pid = event.ptid.pid ();
inferior *inf = find_inferior_pid (event.target, pid);
- for (thread_info *tp : inf->non_exited_threads ())
+ for (thread_info &tp : inf->non_exited_threads ())
{
- t = tp;
+ t = &tp;
break;
}
@@ -5677,6 +5704,8 @@ stop_all_threads (const char *reason, inferior *inf)
debug_prefixed_printf ("infrun", "stop_all_threads", "done");
};
+ scoped_disable_commit_resumed disable_commit_resumed ("stop all threads");
+
/* Request threads to stop, and then wait for the stops. Because
threads we already know about can spawn more threads while we're
trying to stop them, and we only learn about new threads when we
@@ -5700,9 +5729,9 @@ stop_all_threads (const char *reason, inferior *inf)
/* Go through all threads looking for threads that we need
to tell the target to stop. */
- for (thread_info *t : all_non_exited_threads ())
+ for (thread_info &t : all_non_exited_threads ())
{
- if (inf != nullptr && t->inf != inf)
+ if (inf != nullptr && t.inf != inf)
continue;
/* For a single-target setting with an all-stop target,
@@ -5712,38 +5741,38 @@ stop_all_threads (const char *reason, inferior *inf)
targets' threads. This should be fine due to the
protection of 'check_multi_target_resumption'. */
- switch_to_thread_no_regs (t);
+ switch_to_thread_no_regs (&t);
if (!target_is_non_stop_p ())
continue;
- if (t->executing ())
+ if (t.executing ())
{
/* If already stopping, don't request a stop again.
We just haven't seen the notification yet. */
- if (!t->stop_requested)
+ if (!t.stop_requested)
{
infrun_debug_printf (" %s executing, need stop",
- t->ptid.to_string ().c_str ());
- target_stop (t->ptid);
- t->stop_requested = true;
+ t.ptid.to_string ().c_str ());
+ target_stop (t.ptid);
+ t.stop_requested = true;
}
else
{
infrun_debug_printf (" %s executing, already stopping",
- t->ptid.to_string ().c_str ());
+ t.ptid.to_string ().c_str ());
}
- if (t->stop_requested)
+ if (t.stop_requested)
waits_needed++;
}
else
{
infrun_debug_printf (" %s not executing",
- t->ptid.to_string ().c_str ());
+ t.ptid.to_string ().c_str ());
/* The thread may be not executing, but still be
resumed with a pending status to process. */
- t->set_resumed (false);
+ t.set_resumed (false);
}
}
@@ -5857,21 +5886,21 @@ handle_no_resumed (struct execution_control_state *ecs)
whether to report it to the user. */
bool ignore_event = false;
- for (thread_info *thread : all_non_exited_threads ())
+ for (thread_info &thread : all_non_exited_threads ())
{
- if (swap_terminal && thread->executing ())
+ if (swap_terminal && thread.executing ())
{
- if (thread->inf != curr_inf)
+ if (thread.inf != curr_inf)
{
target_terminal::ours ();
- switch_to_thread (thread);
+ switch_to_thread (&thread);
target_terminal::inferior ();
}
swap_terminal = false;
}
- if (!ignore_event && thread->resumed ())
+ if (!ignore_event && thread.resumed ())
{
/* Either there were no unwaited-for children left in the
target at some point, but there are now, or some target
@@ -6030,8 +6059,8 @@ handle_thread_exited (execution_control_state *ecs)
thread. */
return handle_as_no_resumed ();
}
- thread_info *non_exited_thread = *range.begin ();
- switch_to_thread (non_exited_thread);
+ thread_info &non_exited_thread = *range.begin ();
+ switch_to_thread (&non_exited_thread);
insert_breakpoints ();
resume (GDB_SIGNAL_0);
}
@@ -6586,83 +6615,83 @@ restart_threads (struct thread_info *event_thread, inferior *inf)
/* In case the instruction just stepped spawned a new thread. */
update_thread_list ();
- for (thread_info *tp : all_non_exited_threads ())
+ for (thread_info &tp : all_non_exited_threads ())
{
- if (inf != nullptr && tp->inf != inf)
+ if (inf != nullptr && tp.inf != inf)
continue;
- if (tp->inf->detaching)
+ if (tp.inf->detaching)
{
infrun_debug_printf ("restart threads: [%s] inferior detaching",
- tp->ptid.to_string ().c_str ());
+ tp.ptid.to_string ().c_str ());
continue;
}
- switch_to_thread_no_regs (tp);
+ switch_to_thread_no_regs (&tp);
- if (tp == event_thread)
+ if (&tp == event_thread)
{
infrun_debug_printf ("restart threads: [%s] is event thread",
- tp->ptid.to_string ().c_str ());
+ tp.ptid.to_string ().c_str ());
continue;
}
- if (!(tp->state == THREAD_RUNNING || tp->control.in_infcall))
+ if (!(tp.state == THREAD_RUNNING || tp.control.in_infcall))
{
infrun_debug_printf ("restart threads: [%s] not meant to be running",
- tp->ptid.to_string ().c_str ());
+ tp.ptid.to_string ().c_str ());
continue;
}
- if (tp->resumed ())
+ if (tp.resumed ())
{
infrun_debug_printf ("restart threads: [%s] resumed",
- tp->ptid.to_string ().c_str ());
- gdb_assert (tp->executing () || tp->has_pending_waitstatus ());
+ tp.ptid.to_string ().c_str ());
+ gdb_assert (tp.executing () || tp.has_pending_waitstatus ());
continue;
}
- if (thread_is_in_step_over_chain (tp))
+ if (thread_is_in_step_over_chain (&tp))
{
infrun_debug_printf ("restart threads: [%s] needs step-over",
- tp->ptid.to_string ().c_str ());
- gdb_assert (!tp->resumed ());
+ tp.ptid.to_string ().c_str ());
+ gdb_assert (!tp.resumed ());
continue;
}
- if (tp->has_pending_waitstatus ())
+ if (tp.has_pending_waitstatus ())
{
infrun_debug_printf ("restart threads: [%s] has pending status",
- tp->ptid.to_string ().c_str ());
- tp->set_resumed (true);
+ tp.ptid.to_string ().c_str ());
+ tp.set_resumed (true);
continue;
}
- gdb_assert (!tp->stop_requested);
+ gdb_assert (!tp.stop_requested);
/* If some thread needs to start a step-over at this point, it
should still be in the step-over queue, and thus skipped
above. */
- if (thread_still_needs_step_over (tp))
+ if (thread_still_needs_step_over (&tp))
{
internal_error ("thread [%s] needs a step-over, but not in "
"step-over queue\n",
- tp->ptid.to_string ().c_str ());
+ tp.ptid.to_string ().c_str ());
}
- if (currently_stepping (tp))
+ if (currently_stepping (&tp))
{
infrun_debug_printf ("restart threads: [%s] was stepping",
- tp->ptid.to_string ().c_str ());
- keep_going_stepped_thread (tp);
+ tp.ptid.to_string ().c_str ());
+ keep_going_stepped_thread (&tp);
}
else
{
infrun_debug_printf ("restart threads: [%s] continuing",
- tp->ptid.to_string ().c_str ());
- execution_control_state ecs (tp);
- switch_to_thread (tp);
+ tp.ptid.to_string ().c_str ());
+ execution_control_state ecs (&tp);
+ switch_to_thread (&tp);
keep_going_pass_signal (&ecs);
}
}
@@ -6816,7 +6845,8 @@ notify_normal_stop (bpstat *bs, int print_frame)
/* See infrun.h. */
-void notify_user_selected_context_changed (user_selected_what selection)
+void
+notify_user_selected_context_changed (user_selected_what selection)
{
interps_notify_user_selected_context_changed (selection);
gdb::observers::user_selected_context_changed.notify (selection);
@@ -8419,51 +8449,51 @@ restart_stepped_thread (process_stratum_target *resume_target,
if (start_step_over ())
return true;
- for (thread_info *tp : all_threads_safe ())
+ for (thread_info &tp : all_threads_safe ())
{
- if (tp->state == THREAD_EXITED)
+ if (tp.state == THREAD_EXITED)
continue;
- if (tp->has_pending_waitstatus ())
+ if (tp.has_pending_waitstatus ())
continue;
/* Ignore threads of processes the caller is not
resuming. */
if (!sched_multi
- && (tp->inf->process_target () != resume_target
- || tp->inf->pid != resume_ptid.pid ()))
+ && (tp.inf->process_target () != resume_target
+ || tp.inf->pid != resume_ptid.pid ()))
continue;
- if (tp->control.trap_expected)
+ if (tp.control.trap_expected)
{
infrun_debug_printf ("switching back to stepped thread (step-over)");
- if (keep_going_stepped_thread (tp))
+ if (keep_going_stepped_thread (&tp))
return true;
}
}
- for (thread_info *tp : all_threads_safe ())
+ for (thread_info &tp : all_threads_safe ())
{
- if (tp->state == THREAD_EXITED)
+ if (tp.state == THREAD_EXITED)
continue;
- if (tp->has_pending_waitstatus ())
+ if (tp.has_pending_waitstatus ())
continue;
/* Ignore threads of processes the caller is not
resuming. */
if (!sched_multi
- && (tp->inf->process_target () != resume_target
- || tp->inf->pid != resume_ptid.pid ()))
+ && (tp.inf->process_target () != resume_target
+ || tp.inf->pid != resume_ptid.pid ()))
continue;
/* Did we find the stepping thread? */
- if (tp->control.step_range_end)
+ if (tp.control.step_range_end)
{
infrun_debug_printf ("switching back to stepped thread (stepping)");
- if (keep_going_stepped_thread (tp))
+ if (keep_going_stepped_thread (&tp))
return true;
}
}
@@ -8486,20 +8516,20 @@ restart_after_all_stop_detach (process_stratum_target *proc_target)
resumed. With the remote target (in all-stop), it's even
impossible to issue another resumption if the target is already
resumed, until the target reports a stop. */
- for (thread_info *thr : all_threads (proc_target))
+ for (thread_info &thr : all_threads (proc_target))
{
- if (thr->state != THREAD_RUNNING)
+ if (thr.state != THREAD_RUNNING)
continue;
/* If we have any thread that is already executing, then we
don't need to resume the target -- it is already been
resumed. */
- if (thr->executing ())
+ if (thr.executing ())
return;
/* If we have a pending event to process, skip resuming the
target and go straight to processing it. */
- if (thr->resumed () && thr->has_pending_waitstatus ())
+ if (thr.resumed () && thr.has_pending_waitstatus ())
return;
}
@@ -8510,13 +8540,13 @@ restart_after_all_stop_detach (process_stratum_target *proc_target)
/* Otherwise, find the first THREAD_RUNNING thread and resume
it. */
- for (thread_info *thr : all_threads (proc_target))
+ for (thread_info &thr : all_threads (proc_target))
{
- if (thr->state != THREAD_RUNNING)
+ if (thr.state != THREAD_RUNNING)
continue;
- execution_control_state ecs (thr);
- switch_to_thread (thr);
+ execution_control_state ecs (&thr);
+ switch_to_thread (&thr);
keep_going (&ecs);
return;
}
@@ -9444,7 +9474,7 @@ struct stop_context
ptid_t ptid;
- /* If stopp for a thread event, this is the thread that caused the
+ /* If stopped for a thread event, this is the thread that caused the
stop. */
thread_info_ref thread;
@@ -9503,6 +9533,7 @@ normal_stop ()
here, so do this before any filtered output. */
ptid_t finish_ptid = null_ptid;
+ process_stratum_target *finish_target = nullptr;
if (!non_stop)
finish_ptid = minus_one_ptid;
@@ -9515,17 +9546,30 @@ normal_stop ()
linux-fork.c automatically switches to another fork from
within target_mourn_inferior. */
if (inferior_ptid != null_ptid)
- finish_ptid = ptid_t (inferior_ptid.pid ());
+ {
+ finish_ptid = ptid_t (inferior_ptid.pid ());
+ finish_target = current_inferior ()->process_target ();
+ }
}
else if (last.kind () != TARGET_WAITKIND_NO_RESUMED
&& last.kind () != TARGET_WAITKIND_THREAD_EXITED)
- finish_ptid = inferior_ptid;
+ {
+ finish_ptid = inferior_ptid;
+ finish_target = current_inferior ()->process_target ();
+ }
std::optional<scoped_finish_thread_state> maybe_finish_thread_state;
if (finish_ptid != null_ptid)
{
- maybe_finish_thread_state.emplace
- (user_visible_resume_target (finish_ptid), finish_ptid);
+ /* It might be tempting to use user_visible_resume_target to compute
+ FINISH_TARGET from FINISH_PTID, however, that is the wrong choice
+ in this case.
+
+ When resuming, we only resume the current target unless
+ schedule-multiple is in effect. However, when handling a stop, if
+ FINISH_PTID is minus_one_ptid, then we really do want to look for
+ stop events from _any_ target. */
+ maybe_finish_thread_state.emplace (finish_target, finish_ptid);
}
/* As we're presenting a stop, and potentially removing breakpoints,
@@ -9539,7 +9583,38 @@ normal_stop ()
update_thread_list ();
if (last.kind () == TARGET_WAITKIND_STOPPED && stopped_by_random_signal)
- notify_signal_received (inferior_thread ()->stop_signal ());
+ {
+ gdb_assert (inferior_ptid != null_ptid);
+
+ /* Calling update_thread_list pulls information from the target. For
+ native targets we can be (reasonably) sure that the information we
+ get back is sane, but for remote targets, we cannot reply on the
+ returned thread list to be correct.
+
+ Specifically, a remote target (not gdbserver), has been seen to
+ prematurely remove threads from the thread list after sending a
+ signal stop event. The consequence of this, is that the thread
+ might now be exited. This is bad as, trying to calling
+ notify_signal_received will cause GDB to read registers for the
+ current thread, but requesting the regcache for an exited thread
+ will trigger an assertion.
+
+ Check for the exited thread case here, and convert the stop reason
+ to a spurious stop event. The thread exiting will have already
+ been reported (when the thread list was parsed), so making this a
+ spurious stop will cause GDB to drop back to the prompt. */
+ if (inferior_thread ()->state != THREAD_EXITED)
+ notify_signal_received (inferior_thread ()->stop_signal ());
+ else
+ {
+ warning (_("command aborted, %s unexpectedly exited after signal stop event"),
+ target_pid_to_str (inferior_thread ()->ptid).c_str ());
+
+ /* Mark this as a spurious stop. GDB will return to the
+ prompt. The warning above tells the user why. */
+ last.set_spurious ();
+ }
+ }
/* As with the notification of thread events, we want to delay
notifying the user that we've switched thread context until
@@ -9820,7 +9895,7 @@ handle_command (const char *args, int from_tty)
for (char *arg : built_argv)
{
wordlen = strlen (arg);
- for (digits = 0; isdigit (arg[digits]); digits++)
+ for (digits = 0; c_isdigit (arg[digits]); digits++)
{;
}
allsigs = 0;
@@ -10515,9 +10590,7 @@ infrun_thread_ptid_changed ()
#endif /* GDB_SELF_TEST */
-void _initialize_infrun ();
-void
-_initialize_infrun ()
+INIT_GDB_FILE (infrun)
{
struct cmd_list_element *c;
diff --git a/gdb/infrun.h b/gdb/infrun.h
index 4574874..c7c8555 100644
--- a/gdb/infrun.h
+++ b/gdb/infrun.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1986-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -65,13 +65,13 @@ infrun_debug_show_threads (const char *title, ThreadRange threads)
INFRUN_SCOPED_DEBUG_ENTER_EXIT;
infrun_debug_printf ("%s:", title);
- for (thread_info *thread : threads)
+ for (thread_info &thread : threads)
infrun_debug_printf (" thread %s, executing = %d, resumed = %d, "
"state = %s",
- thread->ptid.to_string ().c_str (),
- thread->executing (),
- thread->resumed (),
- thread_state_string (thread->state));
+ thread.ptid.to_string ().c_str (),
+ thread.executing (),
+ thread.resumed (),
+ thread_state_string (thread.state));
}
}
@@ -256,7 +256,8 @@ extern void print_stop_event (struct ui_out *uiout, bool displays = true);
/* Pretty print the results of target_wait, for debugging purposes. */
extern void print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid,
- const struct target_waitstatus &ws);
+ const struct target_waitstatus &ws,
+ process_stratum_target *proc_target);
extern int signal_stop_state (int);
diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c
index 088cbfc..2191282 100644
--- a/gdb/inline-frame.c
+++ b/gdb/inline-frame.c
@@ -1,6 +1,6 @@
/* Inline frame unwinder for GDB.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -615,9 +615,7 @@ maintenance_info_inline_frames (const char *arg, int from_tty)
-void _initialize_inline_frame ();
-void
-_initialize_inline_frame ()
+INIT_GDB_FILE (inline_frame)
{
add_cmd ("inline-frames", class_maintenance, maintenance_info_inline_frames,
_("\
diff --git a/gdb/inline-frame.h b/gdb/inline-frame.h
index 26858ca..031caa7 100644
--- a/gdb/inline-frame.h
+++ b/gdb/inline-frame.h
@@ -1,6 +1,6 @@
/* Definitions for inline frame support.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/interps.c b/gdb/interps.c
index 8b8b578..b4de3c7 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -1,6 +1,6 @@
/* Manages interpreters for GDB, the GNU debugger.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Written by Jim Ingham <jingham@apple.com> of Apple Computer, Inc.
@@ -575,9 +575,7 @@ interps_notify_memory_changed (inferior *inf, CORE_ADDR addr, ssize_t len,
}
/* This just adds the "interpreter-exec" command. */
-void _initialize_interpreter ();
-void
-_initialize_interpreter ()
+INIT_GDB_FILE (interpreter)
{
struct cmd_list_element *c;
diff --git a/gdb/interps.h b/gdb/interps.h
index 2dcf244..c74495b 100644
--- a/gdb/interps.h
+++ b/gdb/interps.h
@@ -1,6 +1,6 @@
/* Manages interpreters for GDB, the GNU debugger.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Written by Jim Ingham <jingham@apple.com> of Apple Computer, Inc.
@@ -23,6 +23,7 @@
#define GDB_INTERPS_H
#include "gdbsupport/intrusive_list.h"
+#include "gdbsupport/event-loop.h"
struct bpstat;
struct ui_out;
@@ -78,6 +79,13 @@ public:
virtual void pre_command_loop ()
{}
+ /* Service one event.
+ This gives the interpreter a chance to handle its own private
+ events that cannot be fed into the gdb event mechanism.
+ In all cases, this should call gdb_do_one_event at some point. */
+ virtual int do_one_event (int mstimeout = -1)
+ { return gdb_do_one_event (mstimeout); }
+
/* Returns true if this interpreter supports using the readline
library; false if it uses GDB's own simplified readline
emulation. */
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index 094f627..58a4dfb 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -1,7 +1,7 @@
/* Target-dependent code for the IQ2000 architecture, for GDB, the GNU
Debugger.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Red Hat.
@@ -348,7 +348,7 @@ iq2000_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* Found a line number, use it as end of prologue. */
return sal.end;
- /* No useable line symbol. Use prologue parsing method. */
+ /* No usable line symbol. Use prologue parsing method. */
iq2000_init_frame_cache (&cache);
return iq2000_scan_prologue (gdbarch, func_addr, func_end, NULL, &cache);
}
@@ -840,9 +840,7 @@ iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
Initializer function for the iq2000 module.
Called by gdb at start-up. */
-void _initialize_iq2000_tdep ();
-void
-_initialize_iq2000_tdep ()
+INIT_GDB_FILE (iq2000_tdep)
{
gdbarch_register (bfd_arch_iq2000, iq2000_gdbarch_init);
}
diff --git a/gdb/jit-reader.in b/gdb/jit-reader.in
index 3dc8a5b..0ebf149 100644
--- a/gdb/jit-reader.in
+++ b/gdb/jit-reader.in
@@ -1,6 +1,6 @@
/* JIT declarations for GDB, the GNU Debugger.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/jit.c b/gdb/jit.c
index d55e371..ca817e8 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -1,6 +1,6 @@
/* Handle JIT code generation in the inferior for GDB, the GNU Debugger.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -80,9 +80,9 @@ maint_info_jit_cmd (const char *args, int from_tty)
std::optional<ui_out_emit_table> table_emitter;
/* Print a line for each JIT-ed objfile. */
- for (objfile *obj : inf->pspace->objfiles ())
+ for (objfile &obj : inf->pspace->objfiles ())
{
- if (obj->jited_data == nullptr)
+ if (obj.jited_data == nullptr)
continue;
if (!printed_header)
@@ -91,7 +91,7 @@ maint_info_jit_cmd (const char *args, int from_tty)
/* The +2 allows for the leading '0x', then one character for
every 4-bits. */
- int addr_width = 2 + (gdbarch_ptr_bit (obj->arch ()) / 4);
+ int addr_width = 2 + (gdbarch_ptr_bit (obj.arch ()) / 4);
/* The std::max here selects between the width of an address (as
a string) and the width of the column header string. */
@@ -109,12 +109,12 @@ maint_info_jit_cmd (const char *args, int from_tty)
ui_out_emit_tuple tuple_emitter (current_uiout, "jit-objfile");
- current_uiout->field_core_addr ("jit_code_entry-address", obj->arch (),
- obj->jited_data->addr);
- current_uiout->field_core_addr ("symfile-address", obj->arch (),
- obj->jited_data->symfile_addr);
+ current_uiout->field_core_addr ("jit_code_entry-address", obj.arch (),
+ obj.jited_data->addr);
+ current_uiout->field_core_addr ("symfile-address", obj.arch (),
+ obj.jited_data->symfile_addr);
current_uiout->field_unsigned ("symfile-size",
- obj->jited_data->symfile_size);
+ obj.jited_data->symfile_size);
current_uiout->text ("\n");
}
}
@@ -517,7 +517,6 @@ jit_symtab_close_impl (struct gdb_symbol_callbacks *cb,
static void
finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
{
- struct compunit_symtab *cust;
size_t blockvector_size;
CORE_ADDR begin, end;
struct blockvector *bv;
@@ -533,9 +532,11 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
return a.end > b.end;
});
- cust = allocate_compunit_symtab (objfile, stab->file_name.c_str ());
+ auto cusymtab = std::make_unique<compunit_symtab> (objfile,
+ stab->file_name.c_str ());
+ compunit_symtab *cust
+ = add_compunit_symtab_to_objfile (std::move (cusymtab));
symtab *filetab = allocate_symtab (cust, stab->file_name.c_str ());
- add_compunit_symtab_to_objfile (cust);
/* JIT compilers compile in memory. */
cust->set_dirname (nullptr);
@@ -584,7 +585,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
/* The name. */
block_name->set_domain (FUNCTION_DOMAIN);
- block_name->set_aclass_index (LOC_BLOCK);
+ block_name->set_loc_class_index (LOC_BLOCK);
block_name->set_symtab (filetab);
block_name->set_type (lookup_function_type (block_type));
block_name->set_value_block (new_block);
@@ -833,10 +834,10 @@ jit_register_code (struct gdbarch *gdbarch,
static struct objfile *
jit_find_objf_with_entry_addr (CORE_ADDR entry_addr)
{
- for (objfile *objf : current_program_space->objfiles ())
+ for (objfile &objf : current_program_space->objfiles ())
{
- if (objf->jited_data != nullptr && objf->jited_data->addr == entry_addr)
- return objf;
+ if (objf.jited_data != nullptr && objf.jited_data->addr == entry_addr)
+ return &objf;
}
return NULL;
@@ -853,9 +854,9 @@ jit_breakpoint_deleted (struct breakpoint *b)
for (bp_location &iter : b->locations ())
{
- for (objfile *objf : iter.pspace->objfiles ())
+ for (objfile &objf : iter.pspace->objfiles ())
{
- jiter_objfile_data *jiter_data = objf->jiter_data.get ();
+ jiter_objfile_data *jiter_data = objf.jiter_data.get ();
if (jiter_data != nullptr
&& jiter_data->jit_breakpoint == iter.owner)
@@ -873,44 +874,44 @@ jit_breakpoint_deleted (struct breakpoint *b)
static void
jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace)
{
- for (objfile *the_objfile : pspace->objfiles ())
+ for (objfile &the_objfile : pspace->objfiles ())
{
/* Skip separate debug objects. */
- if (the_objfile->separate_debug_objfile_backlink != nullptr)
+ if (the_objfile.separate_debug_objfile_backlink != nullptr)
continue;
- if (the_objfile->skip_jit_symbol_lookup)
+ if (the_objfile.skip_jit_symbol_lookup)
continue;
/* Lookup the registration symbol. If it is missing, then we
assume we are not attached to a JIT. */
bound_minimal_symbol reg_symbol
- = lookup_minimal_symbol_text (pspace, jit_break_name, the_objfile);
+ = lookup_minimal_symbol_text (pspace, jit_break_name, &the_objfile);
if (reg_symbol.minsym == NULL
|| reg_symbol.value_address () == 0)
{
/* No need to repeat the lookup the next time. */
- the_objfile->skip_jit_symbol_lookup = true;
+ the_objfile.skip_jit_symbol_lookup = true;
continue;
}
bound_minimal_symbol desc_symbol
= lookup_minimal_symbol_linkage (jit_descriptor_name,
- the_objfile, true);
+ &the_objfile, true);
if (desc_symbol.minsym == NULL
|| desc_symbol.value_address () == 0)
{
/* No need to repeat the lookup the next time. */
- the_objfile->skip_jit_symbol_lookup = true;
+ the_objfile.skip_jit_symbol_lookup = true;
continue;
}
jiter_objfile_data *objf_data
- = get_jiter_objfile_data (the_objfile);
+ = get_jiter_objfile_data (&the_objfile);
objf_data->register_code = reg_symbol.minsym;
objf_data->descriptor = desc_symbol.minsym;
- CORE_ADDR addr = objf_data->register_code->value_address (the_objfile);
+ CORE_ADDR addr = objf_data->register_code->value_address (&the_objfile);
jit_debug_printf ("breakpoint_addr = %s", paddress (gdbarch, addr));
/* Check if we need to re-create the breakpoint. */
@@ -1176,14 +1177,14 @@ jit_inferior_init (inferior *inf)
jit_breakpoint_re_set_internal (gdbarch, pspace);
- for (objfile *jiter : pspace->objfiles ())
+ for (objfile &jiter : pspace->objfiles ())
{
- if (jiter->jiter_data == nullptr)
+ if (jiter.jiter_data == nullptr)
continue;
/* Read the descriptor so we can check the version number and load
any already JITed functions. */
- if (!jit_read_descriptor (gdbarch, &descriptor, jiter))
+ if (!jit_read_descriptor (gdbarch, &descriptor, &jiter))
continue;
/* Check that the version number agrees with that we support. */
@@ -1248,10 +1249,10 @@ jit_breakpoint_re_set (void)
static void
jit_inferior_exit_hook (struct inferior *inf)
{
- for (objfile *objf : current_program_space->objfiles_safe ())
+ for (objfile &objf : current_program_space->objfiles_safe ())
{
- if (objf->jited_data != nullptr && objf->jited_data->addr != 0)
- objf->unlink ();
+ if (objf.jited_data != nullptr && objf.jited_data->addr != 0)
+ objf.unlink ();
}
}
@@ -1313,9 +1314,7 @@ show_jit_reader_directory (const char *args, int from_tty)
jit_reader_dir.c_str ()));
}
-void _initialize_jit ();
-void
-_initialize_jit ()
+INIT_GDB_FILE (jit)
{
jit_reader_dir = relocate_gdb_directory (JIT_READER_DIR,
JIT_READER_DIR_RELOCATABLE);
diff --git a/gdb/jit.h b/gdb/jit.h
index 59ad900..43d3054 100644
--- a/gdb/jit.h
+++ b/gdb/jit.h
@@ -1,6 +1,6 @@
/* JIT declarations for GDB, the GNU Debugger.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/language.c b/gdb/language.c
index 4208c23..c070169 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -1,6 +1,6 @@
/* Multiple source language support for GDB.
- Copyright (C) 1991-2024 Free Software Foundation, Inc.
+ Copyright (C) 1991-2025 Free Software Foundation, Inc.
Contributed by the Department of Computer Science at the State University
of New York at Buffalo.
@@ -28,7 +28,6 @@
return data out of a "language-specific" struct pointer that is set
whenever the working language changes. That would be a lot faster. */
-#include <ctype.h>
#include "symtab.h"
#include "gdbtypes.h"
#include "value.h"
@@ -976,7 +975,7 @@ language_arch_info::type_and_symbol::alloc_type_symbol
symbol->set_section_index (0);
symbol->set_type (type);
symbol->set_domain (TYPE_DOMAIN);
- symbol->set_aclass_index (LOC_TYPEDEF);
+ symbol->set_loc_class_index (LOC_TYPEDEF);
return symbol;
}
@@ -1095,9 +1094,7 @@ language_lookup_primitive_type_as_symbol (const struct language_defn *la,
/* Initialize the language routines. */
-void _initialize_language ();
-void
-_initialize_language ()
+INIT_GDB_FILE (language)
{
static const char *const type_or_range_names[]
= { "on", "off", "warn", "auto", NULL };
diff --git a/gdb/language.h b/gdb/language.h
index 5e9599d..9e9e7f0 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -1,6 +1,6 @@
/* Source-language-related definitions for GDB.
- Copyright (C) 1991-2024 Free Software Foundation, Inc.
+ Copyright (C) 1991-2025 Free Software Foundation, Inc.
Contributed by the Department of Computer Science at the State University
of New York at Buffalo.
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 5eef96c..7489af0 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1,6 +1,6 @@
/* Parser for linespec for the GNU debugger, GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -35,7 +35,6 @@
#include "interps.h"
#include "target.h"
#include "arch-utils.h"
-#include <ctype.h>
#include "cli/cli-utils.h"
#include "filenames.h"
#include "ada-lang.h"
@@ -230,7 +229,7 @@ collect_info::add_symbol (block_symbol *bsym)
{
/* In list mode, add all matching symbols, regardless of class.
This allows the user to type "list a_global_variable". */
- if (bsym->symbol->aclass () == LOC_BLOCK || this->state->list_mode)
+ if (bsym->symbol->loc_class () == LOC_BLOCK || this->state->list_mode)
this->result.symbols->push_back (*bsym);
/* Continue iterating. */
@@ -459,7 +458,7 @@ linespec_lexer_lex_number (linespec_parser *parser, linespec_token *tokenp)
++(parser->lexer.stream);
}
- while (isdigit (*parser->lexer.stream))
+ while (c_isdigit (*parser->lexer.stream))
{
++tokenp->data.string.length;
++(parser->lexer.stream);
@@ -468,7 +467,7 @@ linespec_lexer_lex_number (linespec_parser *parser, linespec_token *tokenp)
/* If the next character in the input buffer is not a space, comma,
quote, or colon, this input does not represent a number. */
if (*parser->lexer.stream != '\0'
- && !isspace (*parser->lexer.stream) && *parser->lexer.stream != ','
+ && !c_isspace (*parser->lexer.stream) && *parser->lexer.stream != ','
&& *parser->lexer.stream != ':'
&& !strchr (linespec_quote_characters, *parser->lexer.stream))
{
@@ -512,7 +511,7 @@ linespec_lexer_lex_keyword (const char *p)
if (i == FORCE_KEYWORD_INDEX && p[len] == '\0')
return linespec_keywords[i];
- if (!isspace (p[len]))
+ if (!c_isspace (p[len]))
continue;
if (i == FORCE_KEYWORD_INDEX)
@@ -524,7 +523,7 @@ linespec_lexer_lex_keyword (const char *p)
int nextlen = strlen (linespec_keywords[j]);
if (strncmp (p, linespec_keywords[j], nextlen) == 0
- && isspace (p[nextlen]))
+ && c_isspace (p[nextlen]))
return linespec_keywords[i];
}
}
@@ -538,7 +537,7 @@ linespec_lexer_lex_keyword (const char *p)
int nextlen = strlen (linespec_keywords[j]);
if (strncmp (p, linespec_keywords[j], nextlen) == 0
- && isspace (p[nextlen]))
+ && c_isspace (p[nextlen]))
return NULL;
}
}
@@ -763,7 +762,7 @@ linespec_lexer_lex_string (linespec_parser *parser)
while (1)
{
- if (isspace (*parser->lexer.stream))
+ if (c_isspace (*parser->lexer.stream))
{
p = skip_spaces (parser->lexer.stream);
/* When we get here we know we've found something followed by
@@ -841,14 +840,14 @@ linespec_lexer_lex_string (linespec_parser *parser)
{
const char *op = parser->lexer.stream;
- while (op > start && isspace (op[-1]))
+ while (op > start && c_isspace (op[-1]))
op--;
if (op - start >= CP_OPERATOR_LEN)
{
op -= CP_OPERATOR_LEN;
if (strncmp (op, CP_OPERATOR_STR, CP_OPERATOR_LEN) == 0
&& (op == start
- || !(isalnum (op[-1]) || op[-1] == '_')))
+ || !(c_isalnum (op[-1]) || op[-1] == '_')))
{
/* This is an operator name. Keep going. */
++(parser->lexer.stream);
@@ -1016,7 +1015,7 @@ linespec_lexer_consume_token (linespec_parser *parser)
if (*parser->lexer.stream != '\0')
{
parser->completion_quote_char = '\0';
- parser->completion_quote_end = NULL;;
+ parser->completion_quote_end = NULL;
}
}
@@ -1074,6 +1073,12 @@ add_sal_to_sals (struct linespec_state *self,
struct symtab_and_line *sal,
const char *symname, bool literal_canonical)
{
+ /* We don't want two SALs with the same PC from the
+ same program space. */
+ for (const auto &s : *sals)
+ if (sal->pc == s.pc && sal->pspace == s.pspace)
+ return;
+
sals->push_back (*sal);
if (self->canonical)
@@ -1132,14 +1137,9 @@ iterate_over_all_matching_symtabs
set_current_program_space (pspace);
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
- objfile->expand_symtabs_matching (NULL, &lookup_name, NULL, NULL,
- (SEARCH_GLOBAL_BLOCK
- | SEARCH_STATIC_BLOCK),
- domain);
-
- for (compunit_symtab *cu : objfile->compunits ())
+ auto expand_callback = [&] (compunit_symtab *cu)
{
struct symtab *symtab = cu->primary_filetab ();
@@ -1166,7 +1166,12 @@ iterate_over_all_matching_symtabs
});
}
}
- }
+
+ return true;
+ };
+
+ objfile.search (nullptr, &lookup_name, nullptr, expand_callback,
+ SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK, domain);
}
}
}
@@ -1636,7 +1641,7 @@ linespec_parse_line_offset (const char *string)
else
line_offset.sign = LINE_OFFSET_NONE;
- if (*string != '\0' && !isdigit (*string))
+ if (*string != '\0' && !c_isdigit (*string))
error (_("malformed line offset: \"%s\""), start);
/* Right now, we only allow base 10 for offsets. */
@@ -2123,7 +2128,7 @@ create_sals_line_offset (struct linespec_state *self,
line 16 will also result in a breakpoint in main, at line 17. */
if (!was_exact
&& sym != nullptr
- && sym->aclass () == LOC_BLOCK
+ && sym->loc_class () == LOC_BLOCK
&& sal.pc == sym->value_block ()->entry_pc ()
&& val.line < sym->line ())
continue;
@@ -2218,7 +2223,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
if (state->funfirstline
&& !ls->minimal_symbols.empty ()
- && sym.symbol->aclass () == LOC_BLOCK)
+ && sym.symbol->loc_class () == LOC_BLOCK)
{
const CORE_ADDR addr
= sym.symbol->value_block ()->entry_pc ();
@@ -3355,7 +3360,7 @@ decode_compound_collector::operator () (block_symbol *bsym)
struct type *t;
struct symbol *sym = bsym->symbol;
- if (sym->aclass () != LOC_TYPEDEF)
+ if (sym->loc_class () != LOC_TYPEDEF)
return true; /* Continue iterating. */
t = sym->type ();
@@ -3407,30 +3412,52 @@ lookup_prefix_sym (struct linespec_state *state,
return collector.release_symbols ();
}
-/* A std::sort comparison function for symbols. The resulting order does
- not actually matter; we just need to be able to sort them so that
- symbols with the same program space end up next to each other. */
+/* Compare pspace A and B based on program space ID. Return 0 if equal,
+ 1 if A->num > B->num, -1 otherwise (modeled on strcmp). */
-static bool
-compare_symbols (const block_symbol &a, const block_symbol &b)
+static int
+compare_pspace (const struct program_space *a, const struct program_space *b)
{
- uintptr_t uia, uib;
+ if (a->num > b->num)
+ return 1;
- uia = (uintptr_t) a.symbol->symtab ()->compunit ()->objfile ()->pspace ();
- uib = (uintptr_t) b.symbol->symtab ()->compunit ()->objfile ()->pspace ();
+ if (a->num < b->num)
+ return -1;
- if (uia < uib)
- return true;
- if (uia > uib)
- return false;
+ return 0;
+}
+
+/* An std::sort comparison function for pointers. Don't use this if stable
+ sorting results are required. */
- uia = (uintptr_t) a.symbol;
- uib = (uintptr_t) b.symbol;
+static bool
+compare_pointers (void *a, void *b)
+{
+ return (uintptr_t)a < (uintptr_t)b;
+}
- if (uia < uib)
+/* An std::sort comparison function for symbols. The requirement is that
+ symbols with the same program space end up next to each other. This is for
+ the purpose of iterating over the symbols and doing something once for each
+ program space. */
+
+static bool
+compare_symbols (const block_symbol &a, const block_symbol &b)
+{
+ /* To check for same program space, we could just use a pointer comparison,
+ which gives unstable sorting results. While the assumption is that this
+ doesn't matter, play it safe and compare program space IDs instead. */
+ int cmp
+ = compare_pspace (a.symbol->symtab ()->compunit ()->objfile ()->pspace (),
+ b.symbol->symtab ()->compunit ()->objfile ()->pspace ());
+ if (cmp == -1)
return true;
+ if (cmp == 1)
+ return false;
- return false;
+ /* This gives unstable sorting results. We assume that this doesn't
+ matter. */
+ return compare_pointers (a.symbol, b.symbol);
}
/* Like compare_symbols but for minimal symbols. */
@@ -3438,23 +3465,16 @@ compare_symbols (const block_symbol &a, const block_symbol &b)
static bool
compare_msymbols (const bound_minimal_symbol &a, const bound_minimal_symbol &b)
{
- uintptr_t uia, uib;
-
- uia = (uintptr_t) a.objfile->pspace ();
- uib = (uintptr_t) a.objfile->pspace ();
-
- if (uia < uib)
+ /* See comment in compare_symbols for use of compare_pspace. */
+ int cmp = compare_pspace (a.objfile->pspace (), a.objfile->pspace ());
+ if (cmp == -1)
return true;
- if (uia > uib)
+ if (cmp == 1)
return false;
- uia = (uintptr_t) a.minsym;
- uib = (uintptr_t) b.minsym;
-
- if (uia < uib)
- return true;
-
- return false;
+ /* This gives unstable sorting results. We assume that this doesn't
+ matter. */
+ return compare_pointers (a.minsym, b.minsym);
}
/* Look for all the matching instances of each symbol in NAMES. Only
@@ -3582,43 +3602,6 @@ find_method (struct linespec_state *self,
-namespace {
-
-/* This function object is a callback for iterate_over_symtabs, used
- when collecting all matching symtabs. */
-
-class symtab_collector
-{
-public:
- symtab_collector () = default;
-
- DISABLE_COPY_AND_ASSIGN (symtab_collector);
-
- /* Callable as a symbol_found_callback_ftype callback. */
- bool operator () (struct symtab *symtab)
- {
- if (m_symtab_table.insert (symtab).second)
- m_symtabs.push_back (symtab);
-
- return false;
- }
-
- /* Return an rvalue reference to the collected symtabs. */
- std::vector<symtab *> &&release_symtabs ()
- {
- return std::move (m_symtabs);
- }
-
-private:
- /* The result vector of symtabs. */
- std::vector<symtab *> m_symtabs;
-
- /* This is used to ensure the symtabs are unique. */
- gdb::unordered_set<const symtab *> m_symtab_table;
-};
-
-} // namespace
-
/* Given a file name, return a list of all matching symtabs. If
SEARCH_PSPACE is not NULL, the search is restricted to just that
program space. */
@@ -3627,7 +3610,17 @@ static std::vector<symtab *>
collect_symtabs_from_filename (const char *file,
struct program_space *search_pspace)
{
- symtab_collector collector;
+ /* The result vector of symtabs. */
+ std::vector<symtab *> symtabs;
+ /* This is used to ensure the symtabs are unique. */
+ gdb::unordered_set<const symtab *> symtab_table;
+
+ auto collector = [&] (struct symtab *symtab)
+ {
+ if (symtab_table.insert (symtab).second)
+ symtabs.push_back (symtab);
+ return false;
+ };
/* Find that file's data. */
if (search_pspace == NULL)
@@ -3643,7 +3636,10 @@ collect_symtabs_from_filename (const char *file,
else
iterate_over_symtabs (search_pspace, file, collector);
- return collector.release_symtabs ();
+ /* It is tempting to use the unordered_dense 'extract' method here,
+ and remove the separate vector -- but it's unclear if ordering
+ matters. */
+ return symtabs;
}
/* Return all the symtabs associated to the FILENAME. If SEARCH_PSPACE is
@@ -3747,7 +3743,7 @@ find_linespec_symbols (struct linespec_state *state,
if (canon != nullptr)
lookup_name = canon.get ();
- /* It's important to not call expand_symtabs_matching unnecessarily
+ /* It's important to not call search unnecessarily
as it can really slow things down (by unnecessarily expanding
potentially 1000s of symtabs, which when debugging some apps can
cost 100s of seconds). Avoid this to some extent by *first* calling
@@ -4078,7 +4074,7 @@ minsym_found (struct linespec_state *self, struct objfile *objfile,
symtab_and_line sal;
if (is_function && want_start_sal)
- sal = find_function_start_sal (func_addr, NULL, self->funfirstline);
+ sal = find_function_start_sal (func_addr, self->funfirstline);
else
{
sal.objfile = objfile;
@@ -4092,7 +4088,12 @@ minsym_found (struct linespec_state *self, struct objfile *objfile,
sal.pspace = current_program_space;
}
- sal.section = msymbol->obj_section (objfile);
+ /* Don't use the section from the msymbol, the code above might have
+ adjusted FUNC_ADDR, in which case the msymbol's section might not be
+ the section containing FUNC_ADDR. It might not even be in the same
+ objfile. As the section is primarily to assist with overlay
+ debugging, it should reflect the SAL's pc value. */
+ sal.section = find_pc_overlay (sal.pc);
if (self->maybe_add_address (objfile->pspace (), sal.pc))
add_sal_to_sals (self, result, &sal, msymbol->natural_name (), false);
@@ -4151,12 +4152,12 @@ search_minsyms_for_name (struct collect_info *info,
set_current_program_space (pspace);
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
- iterate_over_minimal_symbols (objfile, name,
+ iterate_over_minimal_symbols (&objfile, name,
[&] (struct minimal_symbol *msym)
{
- add_minsym (msym, objfile, nullptr,
+ add_minsym (msym, &objfile, nullptr,
info->state->list_mode,
&minsyms);
return false;
@@ -4295,14 +4296,14 @@ static bool
symbol_to_sal (struct symtab_and_line *result,
bool funfirstline, struct symbol *sym)
{
- if (sym->aclass () == LOC_BLOCK)
+ if (sym->loc_class () == LOC_BLOCK)
{
*result = find_function_start_sal (sym, funfirstline);
return true;
}
else
{
- if (sym->aclass () == LOC_LABEL && sym->value_address () != 0)
+ if (sym->loc_class () == LOC_LABEL && sym->value_address () != 0)
{
*result = {};
result->symtab = sym->symtab ();
diff --git a/gdb/linespec.h b/gdb/linespec.h
index 86eb36b..c5cb127 100644
--- a/gdb/linespec.h
+++ b/gdb/linespec.h
@@ -1,5 +1,5 @@
/* Header for GDB line completion.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 52fd7d9..48732b7 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -1,6 +1,6 @@
/* GNU/Linux native-dependent code for debugging multiple forks.
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -37,7 +37,6 @@
#include "gdbsupport/eintr.h"
#include "target/waitstatus.h"
#include <dirent.h>
-#include <ctype.h>
#include <list>
@@ -421,7 +420,7 @@ fork_save_infrun_state (struct fork_info *fp)
/* Now find actual file positions. */
rewinddir (d);
while ((de = readdir (d)) != NULL)
- if (isdigit (de->d_name[0]))
+ if (c_isdigit (de->d_name[0]))
{
tmp = strtol (&de->d_name[0], NULL, 10);
fp->filepos[tmp] = call_lseek (tmp, 0, SEEK_CUR);
@@ -971,7 +970,7 @@ inf_has_multiple_threads ()
/* Return true as soon as we see the second thread of the current
inferior. */
- for (thread_info *tp ATTRIBUTE_UNUSED : current_inferior ()->threads ())
+ for (thread_info &tp ATTRIBUTE_UNUSED : current_inferior ()->threads ())
if (++count > 1)
return true;
@@ -1115,9 +1114,7 @@ restart_command (const char *args, int from_tty)
linux_fork_context (fp, from_tty, inf);
}
-void _initialize_linux_fork ();
-void
-_initialize_linux_fork ()
+INIT_GDB_FILE (linux_fork)
{
/* Checkpoint command: create a fork of the inferior process
and set it aside for later debugging. */
diff --git a/gdb/linux-fork.h b/gdb/linux-fork.h
index c3b403b..f69674f 100644
--- a/gdb/linux-fork.h
+++ b/gdb/linux-fork.h
@@ -1,6 +1,6 @@
/* GNU/Linux native-dependent code for debugging multiple forks.
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/linux-nat-trad.c b/gdb/linux-nat-trad.c
index b2c982d..b09173e 100644
--- a/gdb/linux-nat-trad.c
+++ b/gdb/linux-nat-trad.c
@@ -1,6 +1,6 @@
/* Generic GNU/Linux target using traditional ptrace register access.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/linux-nat-trad.h b/gdb/linux-nat-trad.h
index c1c031e..1905d25 100644
--- a/gdb/linux-nat-trad.h
+++ b/gdb/linux-nat-trad.h
@@ -1,6 +1,6 @@
/* Generic GNU/Linux target using traditional ptrace register access.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 1727a06..af081fc 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1,6 +1,6 @@
/* GNU/Linux native-dependent code common to multiple platforms.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -42,7 +42,6 @@
#include "elf-bfd.h"
#include "gregset.h"
#include "gdbcore.h"
-#include <ctype.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "inf-loop.h"
@@ -51,17 +50,13 @@
#include <pwd.h>
#include <sys/types.h>
#include <dirent.h>
-#include "xml-support.h"
#include <sys/vfs.h>
-#include "solib.h"
#include "nat/linux-osdata.h"
#include "linux-tdep.h"
-#include "symfile.h"
#include "gdbsupport/agent.h"
#include "tracepoint.h"
#include "target-descriptions.h"
#include "gdbsupport/filestuff.h"
-#include "objfiles.h"
#include "nat/linux-namespaces.h"
#include "gdbsupport/block-signals.h"
#include "gdbsupport/fileio.h"
@@ -133,7 +128,7 @@ process things as in sync mode, except that the we never block in
sigsuspend.
While processing an event, we may end up momentarily blocked in
-waitpid calls. Those waitpid calls, while blocking, are guarantied to
+waitpid calls. Those waitpid calls, while blocking, are guaranteed to
return quickly. E.g., in all-stop mode, before reporting to the core
that an LWP hit a breakpoint, all LWPs are stopped by sending them
SIGSTOP, and synchronously waiting for the SIGSTOP to be reported.
@@ -486,8 +481,8 @@ num_lwps (int pid)
{
int count = 0;
- for (const lwp_info *lp ATTRIBUTE_UNUSED : all_lwps ())
- if (lp->ptid.pid () == pid)
+ for (const lwp_info &lp : all_lwps ())
+ if (lp.ptid.pid () == pid)
count++;
return count;
@@ -553,8 +548,8 @@ linux_nat_target::follow_fork (inferior *child_inf, ptid_t child_ptid,
/* Note that we consult the parent's architecture instead of
the child's because there's no inferior for the child at
this point. */
- if (!gdbarch_software_single_step_p (target_thread_architecture
- (parent_ptid)))
+ if (!gdbarch_get_next_pcs_p (target_thread_architecture
+ (parent_ptid)))
{
int status;
@@ -702,7 +697,7 @@ lwp_lwpid_htab_add_lwp (struct lwp_info *lp)
/* Head of doubly-linked list of known LWPs. Sorted by reverse
creation order. This order is assumed in some cases. E.g.,
- reaping status after killing alls lwps of a process: the leader LWP
+ reaping status after killing all lwps of a process: the leader LWP
must be reaped last. */
static intrusive_list<lwp_info> lwp_list;
@@ -712,7 +707,9 @@ static intrusive_list<lwp_info> lwp_list;
lwp_info_range
all_lwps ()
{
- return lwp_info_range (lwp_list.begin ());
+ lwp_info_iterator begin (lwp_list.begin ());
+
+ return lwp_info_range (std::move (begin));
}
/* See linux-nat.h. */
@@ -720,7 +717,7 @@ all_lwps ()
lwp_info_safe_range
all_lwps_safe ()
{
- return lwp_info_safe_range (lwp_list.begin ());
+ return lwp_info_safe_range (all_lwps ());
}
/* Add LP to sorted-by-reverse-creation-order doubly-linked list. */
@@ -935,12 +932,12 @@ struct lwp_info *
iterate_over_lwps (ptid_t filter,
gdb::function_view<iterate_over_lwps_ftype> callback)
{
- for (lwp_info *lp : all_lwps_safe ())
+ for (lwp_info &lp : all_lwps_safe ())
{
- if (lp->ptid.matches (filter))
+ if (lp.ptid.matches (filter))
{
- if (callback (lp) != 0)
- return lp;
+ if (callback (&lp) != 0)
+ return &lp;
}
}
@@ -2129,7 +2126,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
open_proc_mem_file (lp->ptid);
ourstatus->set_execd
- (make_unique_xstrdup (linux_proc_pid_to_exec_file (pid)));
+ (make_unique_xstrdup (linux_target->pid_to_exec_file (pid)));
/* The thread that execed must have been resumed, but, when a
thread execs, it changes its tid to the tgid, and the old
@@ -2146,9 +2143,9 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
PTRACE_GETEVENTMSG, we'd still need to lookup the
corresponding LWP object, and it would be an extra ptrace
syscall, so this way may even be more efficient. */
- for (lwp_info *other_lp : all_lwps_safe ())
- if (other_lp != lp && other_lp->ptid.pid () == lp->ptid.pid ())
- exit_lwp (other_lp);
+ for (lwp_info &other_lp : all_lwps_safe ())
+ if (&other_lp != lp && other_lp.ptid.pid () == lp->ptid.pid ())
+ exit_lwp (&other_lp);
return 0;
}
@@ -3861,11 +3858,11 @@ linux_proc_xfer_memory_partial (int pid, gdb_byte *readbuf,
static lwp_info *
find_stopped_lwp (int pid)
{
- for (lwp_info *lp : all_lwps ())
- if (lp->ptid.pid () == pid
- && lp->stopped
- && !is_lwp_marked_dead (lp))
- return lp;
+ for (lwp_info &lp : all_lwps ())
+ if (lp.ptid.pid () == pid
+ && lp.stopped
+ && !is_lwp_marked_dead (&lp))
+ return &lp;
return nullptr;
}
@@ -3967,13 +3964,13 @@ linux_nat_target::update_thread_list ()
/* Update the processor core that each lwp/thread was last seen
running on. */
- for (lwp_info *lwp : all_lwps ())
+ for (lwp_info &lwp : all_lwps ())
{
/* Avoid accessing /proc if the thread hasn't run since we last
time we fetched the thread's core. Accessing /proc becomes
noticeably expensive when we have thousands of LWPs. */
- if (lwp->core == -1)
- lwp->core = linux_common_core_of_thread (lwp->ptid);
+ if (lwp.core == -1)
+ lwp.core = linux_common_core_of_thread (lwp.ptid);
}
}
@@ -4000,7 +3997,14 @@ linux_nat_target::thread_name (struct thread_info *thr)
const char *
linux_nat_target::pid_to_exec_file (int pid)
{
- return linux_proc_pid_to_exec_file (pid);
+ /* If there's no sysroot. Or the sysroot is just 'target:' and the
+ inferior is in the same mount namespce, then we can consider the
+ filesystem local. */
+ bool local_fs = (gdb_sysroot.empty ()
+ || (gdb_sysroot == TARGET_SYSROOT_PREFIX
+ && linux_ns_same (pid, LINUX_NS_MNT)));
+
+ return linux_proc_pid_to_exec_file (pid, local_fs);
}
/* Object representing an /proc/PID/mem open file. We keep one such
@@ -4585,6 +4589,20 @@ linux_nat_target::fileio_open (struct inferior *inf, const char *filename,
return fd;
}
+/* Implementation of to_fileio_lstat. */
+
+int
+linux_nat_target::fileio_lstat (struct inferior *inf, const char *filename,
+ struct stat *sb, fileio_error *target_errno)
+{
+ int r = linux_mntns_lstat (linux_nat_fileio_pid_of (inf), filename, sb);
+
+ if (r == -1)
+ *target_errno = host_to_fileio_error (errno);
+
+ return r;
+}
+
/* Implementation of to_fileio_readlink. */
std::optional<std::string>
@@ -4680,8 +4698,8 @@ maintenance_info_lwps (const char *arg, int from_tty)
figure out the widest ptid string. We'll use this to build our
output table below. */
size_t ptid_width = 8;
- for (lwp_info *lp : all_lwps ())
- ptid_width = std::max (ptid_width, lp->ptid.to_string ().size ());
+ for (lwp_info &lp : all_lwps ())
+ ptid_width = std::max (ptid_width, lp.ptid.to_string ().size ());
/* Setup the table headers. */
struct ui_out *uiout = current_uiout;
@@ -4691,13 +4709,13 @@ maintenance_info_lwps (const char *arg, int from_tty)
uiout->table_body ();
/* Display one table row for each lwp_info. */
- for (lwp_info *lp : all_lwps ())
+ for (lwp_info &lp : all_lwps ())
{
ui_out_emit_tuple tuple_emitter (uiout, "lwp-entry");
- thread_info *th = linux_target->find_thread (lp->ptid);
+ thread_info *th = linux_target->find_thread (lp.ptid);
- uiout->field_string ("lwp-ptid", lp->ptid.to_string ().c_str ());
+ uiout->field_string ("lwp-ptid", lp.ptid.to_string ().c_str ());
if (th == nullptr)
uiout->field_string ("thread-info", "None");
else
@@ -4707,9 +4725,7 @@ maintenance_info_lwps (const char *arg, int from_tty)
}
}
-void _initialize_linux_nat ();
-void
-_initialize_linux_nat ()
+INIT_GDB_FILE (linux_nat)
{
add_setshow_boolean_cmd ("linux-nat", class_maintenance,
&debug_linux_nat, _("\
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
index b630b85..70d1241 100644
--- a/gdb/linux-nat.h
+++ b/gdb/linux-nat.h
@@ -1,6 +1,6 @@
/* Native debugging support for GNU/Linux (LWP layer).
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -108,6 +108,9 @@ public:
const char *filename,
fileio_error *target_errno) override;
+ int fileio_lstat (struct inferior *inf, const char *filename,
+ struct stat *sb, fileio_error *target_errno) override;
+
int fileio_unlink (struct inferior *inf,
const char *filename,
fileio_error *target_errno) override;
@@ -134,6 +137,10 @@ public:
std::vector<static_tracepoint_marker>
static_tracepoint_markers_by_strid (const char *id) override;
+ /* Linux ptrace targets are shareable. */
+ bool is_shareable () override final
+ { return true; }
+
/* Methods that are meant to overridden by the concrete
arch-specific target instance. */
@@ -276,12 +283,12 @@ struct lwp_info : intrusive_list_node<lwp_info>
will be recorded here, while 'status == 0' is ambiguous. */
struct target_waitstatus waitstatus;
- /* Signal whether we are in a SYSCALL_ENTRY or
- in a SYSCALL_RETURN event.
- Values:
- - TARGET_WAITKIND_SYSCALL_ENTRY
- - TARGET_WAITKIND_SYSCALL_RETURN */
- enum target_waitkind syscall_state;
+ /* Signal whether we are in a SYSCALL_ENTRY or SYSCALL_RETURN event.
+
+ Valid values are TARGET_WAITKIND_SYSCALL_ENTRY,
+ TARGET_WAITKIND_SYSCALL_RETURN, or TARGET_WAITKIND_SYSCALL_IGNORE, when
+ not stopped at a syscall. */
+ target_waitkind syscall_state = TARGET_WAITKIND_IGNORE;
/* The processor core this LWP was last seen on. */
int core = -1;
@@ -292,8 +299,7 @@ struct lwp_info : intrusive_list_node<lwp_info>
/* lwp_info iterator and range types. */
-using lwp_info_iterator
- = reference_to_pointer_iterator<intrusive_list<lwp_info>::iterator>;
+using lwp_info_iterator = intrusive_list<lwp_info>::iterator;
using lwp_info_range = iterator_range<lwp_info_iterator>;
using lwp_info_safe_range = basic_safe_range<lwp_info_range>;
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index 2f66337..8ceb3f6 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -1,6 +1,6 @@
/* Process record and replay target code for GNU/Linux.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/linux-record.h b/gdb/linux-record.h
index 6656106..86cfd18 100644
--- a/gdb/linux-record.h
+++ b/gdb/linux-record.h
@@ -1,6 +1,6 @@
/* Process record and replay target code for GNU/Linux.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index fec6a63..77557d5 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux, architecture independent.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -46,7 +46,7 @@
#include "cli/cli-style.h"
#include "gdbsupport/unordered_map.h"
-#include <ctype.h>
+#include <algorithm>
/* This enum represents the values that the user can choose when
informing the Linux kernel about which memory mappings will be
@@ -96,6 +96,10 @@ struct smaps_vmflags
/* Memory map has memory tagging enabled. */
unsigned int memory_tagging : 1;
+
+ /* Memory map used for shadow stack. */
+
+ unsigned int shadow_stack_memory : 1;
};
/* Data structure that holds the information contained in the
@@ -483,7 +487,7 @@ read_mapping (const char *line)
p = skip_spaces (p);
const char *permissions_start = p;
- while (*p && !isspace (*p))
+ while (*p && !c_isspace (*p))
p++;
mapping.permissions = std::string (permissions_start,
(size_t) (p - permissions_start));
@@ -492,7 +496,7 @@ read_mapping (const char *line)
p = skip_spaces (p);
const char *device_start = p;
- while (*p && !isspace (*p))
+ while (*p && !c_isspace (*p))
p++;
mapping.device = {device_start, (size_t) (p - device_start)};
@@ -537,6 +541,8 @@ decode_vmflags (char *p, struct smaps_vmflags *v)
v->shared_mapping = 1;
else if (strcmp (s, "mt") == 0)
v->memory_tagging = 1;
+ else if (strcmp (s, "ss") == 0)
+ v->shadow_stack_memory = 1;
}
}
@@ -630,9 +636,9 @@ mapping_is_anonymous_p (const char *filename)
return 0;
}
-/* Return 0 if the memory mapping (which is related to FILTERFLAGS, V,
- MAYBE_PRIVATE_P, MAPPING_ANONYMOUS_P, ADDR and OFFSET) should not
- be dumped, or greater than 0 if it should.
+/* Return false if the memory mapping represented by MAP should not be
+ dumped, or true if it should. FILTERFLAGS guides which mappings
+ should be dumped.
In a nutshell, this is the logic that we follow in order to decide
if a mapping should be dumped or not.
@@ -677,11 +683,14 @@ mapping_is_anonymous_p (const char *filename)
header (of a DSO or an executable, for example). If it is, and
if the user is interested in dump it, then we should dump it. */
-static int
-dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
- int maybe_private_p, int mapping_anon_p, int mapping_file_p,
- const char *filename, ULONGEST addr, ULONGEST offset)
+static bool
+dump_mapping_p (filter_flags filterflags, const smaps_data &map)
{
+ /* Older Linux kernels did not support the "Anonymous:" counter.
+ If it is missing, we can't be sure what to dump, so dump everything. */
+ if (!map.has_anonymous)
+ return true;
+
/* Initially, we trust in what we received from our caller. This
value may not be very precise (i.e., it was probably gathered
from the permission line in the /proc/PID/smaps list, which
@@ -689,41 +698,42 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
what we have until we take a look at the "VmFlags:" field
(assuming that the version of the Linux kernel being used
supports it, of course). */
- int private_p = maybe_private_p;
- int dump_p;
+ int private_p = map.priv;
/* We always dump vDSO and vsyscall mappings, because it's likely that
there'll be no file to read the contents from at core load time.
The kernel does the same. */
- if (strcmp ("[vdso]", filename) == 0
- || strcmp ("[vsyscall]", filename) == 0)
- return 1;
+ if (map.filename == "[vdso]" || map.filename == "[vsyscall]")
+ return true;
- if (v->initialized_p)
+ if (map.vmflags.initialized_p)
{
/* We never dump I/O mappings. */
- if (v->io_page)
- return 0;
+ if (map.vmflags.io_page)
+ return false;
/* Check if we should exclude this mapping. */
- if (!dump_excluded_mappings && v->exclude_coredump)
- return 0;
+ if (!dump_excluded_mappings && map.vmflags.exclude_coredump)
+ return false;
/* Update our notion of whether this mapping is shared or
private based on a trustworthy value. */
- private_p = !v->shared_mapping;
+ private_p = !map.vmflags.shared_mapping;
/* HugeTLB checking. */
- if (v->uses_huge_tlb)
+ if (map.vmflags.uses_huge_tlb)
{
if ((private_p && (filterflags & COREFILTER_HUGETLB_PRIVATE))
|| (!private_p && (filterflags & COREFILTER_HUGETLB_SHARED)))
- return 1;
+ return true;
- return 0;
+ return false;
}
}
+ int mapping_anon_p = map.mapping_anon_p;
+ int mapping_file_p = map.mapping_file_p;
+ bool dump_p;
if (private_p)
{
if (mapping_anon_p && mapping_file_p)
@@ -763,7 +773,7 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
A mapping contains an ELF header if it is a private mapping, its
offset is zero, and its first word is ELFMAG. */
- if (!dump_p && private_p && offset == 0
+ if (!dump_p && private_p && map.offset == 0
&& (filterflags & COREFILTER_ELF_HEADERS) != 0)
{
/* Useful define specifying the size of the ELF magical
@@ -774,7 +784,7 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
/* Let's check if we have an ELF header. */
gdb_byte h[SELFMAG];
- if (target_read_memory (addr, h, SELFMAG) == 0)
+ if (target_read_memory (map.start_address, h, SELFMAG) == 0)
{
/* The EI_MAG* and ELFMAG* constants come from
<elf/common.h>. */
@@ -783,7 +793,7 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
{
/* This mapping contains an ELF header, so we
should dump it. */
- dump_p = 1;
+ dump_p = true;
}
}
}
@@ -794,20 +804,24 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
/* As above, but return true only when we should dump the NT_FILE
entry. */
-static int
-dump_note_entry_p (filter_flags filterflags, const struct smaps_vmflags *v,
- int maybe_private_p, int mapping_anon_p, int mapping_file_p,
- const char *filename, ULONGEST addr, ULONGEST offset)
+static bool
+dump_note_entry_p (filter_flags filterflags, const smaps_data &map)
{
- /* vDSO and vsyscall mappings will end up in the core file. Don't
- put them in the NT_FILE note. */
- if (strcmp ("[vdso]", filename) == 0
- || strcmp ("[vsyscall]", filename) == 0)
- return 0;
+ /* No NT_FILE entry for mappings with no filename. */
+ if (map.filename.length () == 0)
+ return false;
+
+ /* Special kernel mappings, those with names like '[vdso]' and
+ '[vsyscall]' will be placed in the core file, but shouldn't get an
+ NT_FILE entry. These special mappings all have a zero inode. */
+ if (map.inode == 0
+ && map.filename.front () == '['
+ && map.filename.back () == ']')
+ return false;
/* Otherwise, any other file-based mapping should be placed in the
note. */
- return 1;
+ return true;
}
/* Implement the "info proc" command. */
@@ -828,7 +842,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
char filename[100];
fileio_error target_errno;
- if (args && isdigit (args[0]))
+ if (args && c_isdigit (args[0]))
{
char *tem;
@@ -1073,7 +1087,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
gdb_printf (_("Ignored signals bitmap: %s\n"),
hex_string (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("Catched signals bitmap: %s\n"),
+ gdb_printf (_("Caught signals bitmap: %s\n"),
hex_string (strtoulst (p, &p, 10)));
if (*p)
gdb_printf (_("wchan (system call): %s\n"),
@@ -1139,8 +1153,8 @@ linux_read_core_file_mappings
}
gdb::byte_vector contents (note_size);
- if (!bfd_get_section_contents (current_program_space->core_bfd (), section,
- contents.data (), 0, note_size))
+ if (!bfd_get_section_contents (cbfd, section, contents.data (), 0,
+ note_size))
{
warning (_("could not get core note contents"));
return;
@@ -1155,13 +1169,10 @@ linux_read_core_file_mappings
return;
}
- ULONGEST count = bfd_get (addr_size_bits, current_program_space->core_bfd (),
- descdata);
+ ULONGEST count = bfd_get (addr_size_bits, cbfd, descdata);
descdata += addr_size;
- ULONGEST page_size = bfd_get (addr_size_bits,
- current_program_space->core_bfd (),
- descdata);
+ ULONGEST page_size = bfd_get (addr_size_bits, cbfd, descdata);
descdata += addr_size;
if (note_size < 2 * addr_size + count * 3 * addr_size)
@@ -1208,12 +1219,11 @@ linux_read_core_file_mappings
for (int i = 0; i < count; i++)
{
- ULONGEST start = bfd_get (addr_size_bits, current_program_space->core_bfd (), descdata);
+ ULONGEST start = bfd_get (addr_size_bits, cbfd, descdata);
descdata += addr_size;
- ULONGEST end = bfd_get (addr_size_bits, current_program_space->core_bfd (), descdata);
+ ULONGEST end = bfd_get (addr_size_bits, cbfd, descdata);
descdata += addr_size;
- ULONGEST file_ofs
- = bfd_get (addr_size_bits, current_program_space->core_bfd (), descdata) * page_size;
+ ULONGEST file_ofs = bfd_get (addr_size_bits, cbfd, descdata) * page_size;
descdata += addr_size;
char * filename = filenames;
filenames += strlen ((char *) filenames) + 1;
@@ -1227,14 +1237,15 @@ linux_read_core_file_mappings
}
}
-/* Implement "info proc mappings" for a corefile. */
+/* Implement "info proc mappings" for corefile CBFD. */
static void
-linux_core_info_proc_mappings (struct gdbarch *gdbarch, const char *args)
+linux_core_info_proc_mappings (struct gdbarch *gdbarch, struct bfd *cbfd,
+ const char *args)
{
std::optional<ui_out_emit_table> emitter;
- linux_read_core_file_mappings (gdbarch, current_program_space->core_bfd (),
+ linux_read_core_file_mappings (gdbarch, cbfd,
[&] (ULONGEST count)
{
gdb_printf (_("Mapped address spaces:\n\n"));
@@ -1263,19 +1274,18 @@ linux_core_info_proc_mappings (struct gdbarch *gdbarch, const char *args)
});
}
-/* Implement "info proc" for a corefile. */
+/* Implement "info proc" for corefile CBFD. */
static void
-linux_core_info_proc (struct gdbarch *gdbarch, const char *args,
- enum info_proc_what what)
+linux_core_info_proc (struct gdbarch *gdbarch, struct bfd *cbfd,
+ const char *args, enum info_proc_what what)
{
int exe_f = (what == IP_MINIMAL || what == IP_EXE || what == IP_ALL);
int mappings_f = (what == IP_MAPPINGS || what == IP_ALL);
if (exe_f)
{
- const char *exe
- = bfd_core_file_failing_command (current_program_space->core_bfd ());
+ const char *exe = bfd_core_file_failing_command (cbfd);
if (exe != NULL)
gdb_printf ("exe = '%s'\n", exe);
@@ -1284,7 +1294,7 @@ linux_core_info_proc (struct gdbarch *gdbarch, const char *args,
}
if (mappings_f)
- linux_core_info_proc_mappings (gdbarch, args);
+ linux_core_info_proc_mappings (gdbarch, cbfd, args);
if (!exe_f && !mappings_f)
error (_("unable to handle request"));
@@ -1296,39 +1306,30 @@ linux_core_info_proc (struct gdbarch *gdbarch, const char *args,
interface. */
static LONGEST
-linux_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf,
- ULONGEST offset, ULONGEST len)
+linux_core_xfer_siginfo (struct gdbarch *gdbarch, struct bfd &cbfd,
+ gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
{
thread_section_name section_name (".note.linuxcore.siginfo", inferior_ptid);
- asection *section
- = bfd_get_section_by_name (current_program_space->core_bfd (),
- section_name.c_str ());
- if (section == NULL)
+ asection *section = bfd_get_section_by_name (&cbfd, section_name.c_str ());
+ if (section == nullptr)
return -1;
- if (!bfd_get_section_contents (current_program_space->core_bfd (), section,
- readbuf, offset, len))
+ if (!bfd_get_section_contents (&cbfd, section, readbuf, offset, len))
return -1;
return len;
}
typedef int linux_find_memory_region_ftype (ULONGEST vaddr, ULONGEST size,
- ULONGEST offset, ULONGEST inode,
- int read, int write,
- int exec, int modified,
+ ULONGEST offset,
+ bool read, bool write,
+ bool exec, bool modified,
bool memory_tagged,
- const char *filename,
+ const std::string &filename,
void *data);
-typedef int linux_dump_mapping_p_ftype (filter_flags filterflags,
- const struct smaps_vmflags *v,
- int maybe_private_p,
- int mapping_anon_p,
- int mapping_file_p,
- const char *filename,
- ULONGEST addr,
- ULONGEST offset);
+typedef bool linux_dump_mapping_p_ftype (filter_flags filterflags,
+ const smaps_data &map);
/* Helper function to parse the contents of /proc/<pid>/smaps into a data
structure, for easy access.
@@ -1510,12 +1511,13 @@ linux_process_address_in_memtag_page (CORE_ADDR address)
static bool
linux_core_file_address_in_memtag_page (CORE_ADDR address)
{
- if (current_program_space->core_bfd () == nullptr)
+ bfd *cbfd = get_inferior_core_bfd (current_inferior ());
+
+ if (cbfd == nullptr)
return false;
memtag_section_info info;
- return get_next_core_memtag_section (current_program_space->core_bfd (),
- nullptr, address, info);
+ return get_next_core_memtag_section (cbfd, nullptr, address, info);
}
/* See linux-tdep.h. */
@@ -1590,35 +1592,15 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch,
for (const struct smaps_data &map : smaps)
{
- int should_dump_p = 0;
-
- if (map.has_anonymous)
- {
- should_dump_p
- = should_dump_mapping_p (filterflags, &map.vmflags,
- map.priv,
- map.mapping_anon_p,
- map.mapping_file_p,
- map.filename.c_str (),
- map.start_address,
- map.offset);
- }
- else
- {
- /* Older Linux kernels did not support the "Anonymous:" counter.
- If it is missing, we can't be sure - dump all the pages. */
- should_dump_p = 1;
- }
-
/* Invoke the callback function to create the corefile segment. */
- if (should_dump_p)
+ if (should_dump_mapping_p (filterflags, map))
{
func (map.start_address, map.end_address - map.start_address,
- map.offset, map.inode, map.read, map.write, map.exec,
- 1, /* MODIFIED is true because we want to dump
+ map.offset, map.read, map.write, map.exec,
+ true, /* MODIFIED is true because we want to dump
the mapping. */
map.vmflags.memory_tagging != 0,
- map.filename.c_str (), obfd);
+ map.filename, obfd);
}
}
@@ -1644,10 +1626,10 @@ struct linux_find_memory_regions_data
static int
linux_find_memory_regions_thunk (ULONGEST vaddr, ULONGEST size,
- ULONGEST offset, ULONGEST inode,
- int read, int write, int exec, int modified,
- bool memory_tagged,
- const char *filename, void *arg)
+ ULONGEST offset,
+ bool read, bool write, bool exec,
+ bool modified, bool memory_tagged,
+ const std::string &filename, void *arg)
{
struct linux_find_memory_regions_data *data
= (struct linux_find_memory_regions_data *) arg;
@@ -1693,8 +1675,6 @@ struct linux_make_mappings_data
struct type *long_type;
};
-static linux_find_memory_region_ftype linux_make_mappings_callback;
-
/* A callback for linux_find_memory_regions_full that updates the
mappings data for linux_make_mappings_corefile_notes.
@@ -1703,17 +1683,16 @@ static linux_find_memory_region_ftype linux_make_mappings_callback;
static int
linux_make_mappings_callback (ULONGEST vaddr, ULONGEST size,
- ULONGEST offset, ULONGEST inode,
- int read, int write, int exec, int modified,
+ ULONGEST offset,
+ bool read, bool write, bool exec, bool modified,
bool memory_tagged,
- const char *filename, void *data)
+ const std::string &filename, void *data)
{
struct linux_make_mappings_data *map_data
= (struct linux_make_mappings_data *) data;
gdb_byte buf[sizeof (ULONGEST)];
- if (*filename == '\0' || inode == 0)
- return 0;
+ gdb_assert (filename.length () > 0);
++map_data->file_count;
@@ -1724,7 +1703,7 @@ linux_make_mappings_callback (ULONGEST vaddr, ULONGEST size,
pack_long (buf, map_data->long_type, offset);
obstack_grow (map_data->data_obstack, buf, map_data->long_type->length ());
- obstack_grow_str0 (map_data->filename_obstack, filename);
+ obstack_grow_str0 (map_data->filename_obstack, filename.c_str ());
return 0;
}
@@ -2248,7 +2227,7 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
specifically under the entry of `/proc/[pid]/stat'. */
/* Getting rid of the PID, since we already have it. */
- while (isdigit (*proc_stat))
+ while (c_isdigit (*proc_stat))
++proc_stat;
proc_stat = skip_spaces (proc_stat);
@@ -2320,10 +2299,10 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
{
/* Advancing the pointer to the beginning of the UID. */
tmpstr += sizeof ("Uid:");
- while (*tmpstr != '\0' && !isdigit (*tmpstr))
+ while (*tmpstr != '\0' && !c_isdigit (*tmpstr))
++tmpstr;
- if (isdigit (*tmpstr))
+ if (c_isdigit (*tmpstr))
p->pr_uid = strtol (tmpstr, &tmpstr, 10);
}
@@ -2333,10 +2312,10 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
{
/* Advancing the pointer to the beginning of the GID. */
tmpstr += sizeof ("Gid:");
- while (*tmpstr != '\0' && !isdigit (*tmpstr))
+ while (*tmpstr != '\0' && !c_isdigit (*tmpstr))
++tmpstr;
- if (isdigit (*tmpstr))
+ if (c_isdigit (*tmpstr))
p->pr_gid = strtol (tmpstr, &tmpstr, 10);
}
@@ -2399,9 +2378,9 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
target_thread_architecture (signalled_thr->ptid),
obfd, note_data, note_size, stop_signal);
}
- for (thread_info *thr : current_inferior ()->non_exited_threads ())
+ for (thread_info &thr : current_inferior ()->non_exited_threads ())
{
- if (thr == signalled_thr)
+ if (&thr == signalled_thr)
continue;
/* On some architectures, like AArch64, each thread can have a distinct
@@ -2410,7 +2389,7 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
Fetch each thread's gdbarch and pass it down to the lower layers so
we can dump the right set of registers. */
- linux_corefile_thread (thr, target_thread_architecture (thr->ptid),
+ linux_corefile_thread (&thr, target_thread_architecture (thr.ptid),
obfd, note_data, note_size, stop_signal);
}
@@ -2715,15 +2694,14 @@ linux_vsyscall_range_raw (struct gdbarch *gdbarch, struct mem_range *range)
long phdrs_size;
int num_phdrs, i;
- phdrs_size
- = bfd_get_elf_phdr_upper_bound (current_program_space->core_bfd ());
+ bfd *cbfd = get_inferior_core_bfd (current_inferior ());
+ phdrs_size = bfd_get_elf_phdr_upper_bound (cbfd);
if (phdrs_size == -1)
return 0;
gdb::unique_xmalloc_ptr<Elf_Internal_Phdr>
phdrs ((Elf_Internal_Phdr *) xmalloc (phdrs_size));
- num_phdrs = bfd_get_elf_phdrs (current_program_space->core_bfd (),
- phdrs.get ());
+ num_phdrs = bfd_get_elf_phdrs (cbfd, phdrs.get ());
if (num_phdrs == -1)
return 0;
@@ -2749,7 +2727,7 @@ linux_vsyscall_range_raw (struct gdbarch *gdbarch, struct mem_range *range)
in the output, which requires scanning every thread in the thread
group to check whether a VMA is actually a thread's stack. With
Linux 4.4 on an Intel i7-4810MQ @ 2.80GHz, with an inferior with
- a few thousand threads, (1) takes a few miliseconds, while (2)
+ a few thousand threads, (1) takes a few milliseconds, while (2)
takes several seconds. Also note that "smaps", what we read for
determining core dump mappings, is even slower than "maps". */
xsnprintf (filename, sizeof filename, "/proc/%ld/task/%ld/maps", pid, pid);
@@ -3057,6 +3035,46 @@ show_dump_excluded_mappings (struct ui_file *file, int from_tty,
" flag is %s.\n"), value);
}
+/* See linux-tdep.h. */
+
+bool
+linux_address_in_shadow_stack_mem_range
+ (CORE_ADDR addr, std::pair<CORE_ADDR, CORE_ADDR> *range)
+{
+ if (!target_has_execution () || current_inferior ()->fake_pid_p)
+ return false;
+
+ const int pid = current_inferior ()->pid;
+
+ std::string smaps_file = string_printf ("/proc/%d/smaps", pid);
+
+ gdb::unique_xmalloc_ptr<char> data
+ = target_fileio_read_stralloc (nullptr, smaps_file.c_str ());
+
+ if (data == nullptr)
+ return false;
+
+ const std::vector<smaps_data> smaps
+ = parse_smaps_data (data.get (), std::move (smaps_file));
+
+ auto find_addr_mem_range = [&addr] (const smaps_data &map)
+ {
+ bool addr_in_mem_range
+ = (addr >= map.start_address && addr < map.end_address);
+ return (addr_in_mem_range && map.vmflags.shadow_stack_memory);
+ };
+ auto it = std::find_if (smaps.begin (), smaps.end (), find_addr_mem_range);
+
+ if (it != smaps.end ())
+ {
+ range->first = it->start_address;
+ range->second = it->end_address;
+ return true;
+ }
+
+ return false;
+}
+
/* To be called from the various GDB_OSABI_LINUX handlers for the
various GNU/Linux architectures and machine types.
@@ -3102,9 +3120,7 @@ linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
linux_corefile_parse_exec_context);
}
-void _initialize_linux_tdep ();
-void
-_initialize_linux_tdep ()
+INIT_GDB_FILE (linux_tdep)
{
/* Observers used to invalidate the cache when needed. */
gdb::observers::inferior_exit.attach (invalidate_linux_cache_inf,
@@ -3137,65 +3153,5 @@ VM_DONTDUMP flag (\"dd\" in /proc/PID/smaps) when generating the corefile. For\
more information about this file, refer to the manpage of proc(5) and core(5)."),
NULL, show_dump_excluded_mappings,
&setlist, &showlist);
-}
-
-/* Fetch (and possibly build) an appropriate `link_map_offsets' for
- ILP32/LP64 Linux systems which don't have the r_ldsomap field. */
-
-link_map_offsets *
-linux_ilp32_fetch_link_map_offsets ()
-{
- static link_map_offsets lmo;
- static link_map_offsets *lmp = nullptr;
-
- if (lmp == nullptr)
- {
- lmp = &lmo;
-
- lmo.r_version_offset = 0;
- lmo.r_version_size = 4;
- lmo.r_map_offset = 4;
- lmo.r_brk_offset = 8;
- lmo.r_ldsomap_offset = -1;
- lmo.r_next_offset = 20;
-
- /* Everything we need is in the first 20 bytes. */
- lmo.link_map_size = 20;
- lmo.l_addr_offset = 0;
- lmo.l_name_offset = 4;
- lmo.l_ld_offset = 8;
- lmo.l_next_offset = 12;
- lmo.l_prev_offset = 16;
- }
-
- return lmp;
-}
-
-link_map_offsets *
-linux_lp64_fetch_link_map_offsets ()
-{
- static link_map_offsets lmo;
- static link_map_offsets *lmp = nullptr;
-
- if (lmp == nullptr)
- {
- lmp = &lmo;
-
- lmo.r_version_offset = 0;
- lmo.r_version_size = 4;
- lmo.r_map_offset = 8;
- lmo.r_brk_offset = 16;
- lmo.r_ldsomap_offset = -1;
- lmo.r_next_offset = 40;
-
- /* Everything we need is in the first 40 bytes. */
- lmo.link_map_size = 40;
- lmo.l_addr_offset = 0;
- lmo.l_name_offset = 8;
- lmo.l_ld_offset = 16;
- lmo.l_next_offset = 24;
- lmo.l_prev_offset = 32;
- }
- return lmp;
}
diff --git a/gdb/linux-tdep.h b/gdb/linux-tdep.h
index bf4220b..a4f0f53 100644
--- a/gdb/linux-tdep.h
+++ b/gdb/linux-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux, architecture independent.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,10 +22,22 @@
#include "bfd.h"
#include "displaced-stepping.h"
+#include "solib.h"
struct inferior;
struct regcache;
+#ifndef SEGV_CPERR
+#define SEGV_CPERR 10 /* Control protection error. */
+#endif
+
+/* Flag which enables shadow stack in PR_SET_SHADOW_STACK_STATUS prctl. */
+#ifndef PR_SHADOW_STACK_ENABLE
+#define PR_SHADOW_STACK_ENABLE (1UL << 0)
+#define PR_SHADOW_STACK_WRITE (1UL << 1)
+#define PR_SHADOW_STACK_PUSH (1UL << 2)
+#endif
+
/* Enum used to define the extra fields of the siginfo type used by an
architecture. */
enum linux_siginfo_extra_field_values
@@ -112,9 +124,11 @@ extern CORE_ADDR linux_get_hwcap2 (const std::optional<gdb::byte_vector> &auxv,
extern CORE_ADDR linux_get_hwcap2 ();
-/* Fetch (and possibly build) an appropriate `struct link_map_offsets'
- for ILP32 and LP64 Linux systems. */
-extern struct link_map_offsets *linux_ilp32_fetch_link_map_offsets ();
-extern struct link_map_offsets *linux_lp64_fetch_link_map_offsets ();
+/* Returns true if ADDR belongs to a shadow stack memory range. If this
+ is the case, assign the shadow stack memory range to RANGE
+ [start_address, end_address). */
+
+extern bool linux_address_in_shadow_stack_mem_range
+ (CORE_ADDR addr, std::pair<CORE_ADDR, CORE_ADDR> *range);
#endif /* GDB_LINUX_TDEP_H */
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index f946c2a..f00e3b5 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -1,6 +1,6 @@
/* libthread_db assisted debugging support, generic parts.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -43,7 +43,6 @@
#include "auto-load.h"
#include "cli/cli-utils.h"
#include <signal.h>
-#include <ctype.h>
#include "nat/linux-namespaces.h"
#include <algorithm>
#include "gdbsupport/pathstuff.h"
@@ -919,9 +918,9 @@ try_thread_db_load_1 (struct thread_db_info *info)
linux_stop_and_wait_all_lwps ();
- for (const lwp_info *lp : all_lwps ())
- if (lp->ptid.pid () == pid)
- thread_from_lwp (curr_thread, lp->ptid);
+ for (const lwp_info &lp : all_lwps ())
+ if (lp.ptid.pid () == pid)
+ thread_from_lwp (curr_thread, lp.ptid);
linux_unstop_all_lwps ();
}
@@ -1075,17 +1074,17 @@ try_thread_db_load_from_pdir (const char *subdir)
if (!auto_load_thread_db)
return false;
- for (objfile *obj : current_program_space->objfiles ())
- if (libpthread_objfile_p (obj))
+ for (objfile &obj : current_program_space->objfiles ())
+ if (libpthread_objfile_p (&obj))
{
- if (try_thread_db_load_from_pdir_1 (obj, subdir))
+ if (try_thread_db_load_from_pdir_1 (&obj, subdir))
return true;
/* We may have found the separate-debug-info version of
libpthread, and it may live in a directory without a matching
libthread_db. */
- if (obj->separate_debug_objfile_backlink != NULL)
- return try_thread_db_load_from_pdir_1 (obj->separate_debug_objfile_backlink,
+ if (obj.separate_debug_objfile_backlink != NULL)
+ return try_thread_db_load_from_pdir_1 (obj.separate_debug_objfile_backlink,
subdir);
return false;
@@ -1184,8 +1183,8 @@ thread_db_load_search (void)
static bool
has_libpthread (void)
{
- for (objfile *obj : current_program_space->objfiles ())
- if (libpthread_objfile_p (obj))
+ for (objfile &obj : current_program_space->objfiles ())
+ if (libpthread_objfile_p (&obj))
return true;
return false;
@@ -1216,7 +1215,8 @@ thread_db_load (void)
return false;
/* Don't attempt to use thread_db for remote targets. */
- if (!(target_can_run () || current_program_space->core_bfd () != nullptr))
+ if (!(target_can_run ()
+ || get_inferior_core_bfd (current_inferior ()) != nullptr))
return false;
if (thread_db_load_search ())
@@ -1707,12 +1707,12 @@ thread_db_target::thread_handle_to_thread_info (const gdb_byte *thread_handle,
error (_("Thread handle size mismatch: %d vs %zu (from libthread_db)"),
handle_len, sizeof (handle_tid));
- for (thread_info *tp : inf->non_exited_threads ())
+ for (thread_info &tp : inf->non_exited_threads ())
{
- thread_db_thread_info *priv = get_thread_db_thread_info (tp);
+ thread_db_thread_info *priv = get_thread_db_thread_info (&tp);
if (priv != NULL && handle_tid == priv->tid)
- return tp;
+ return &tp;
}
return NULL;
@@ -1981,9 +1981,7 @@ maintenance_check_libthread_db (const char *args, int from_tty)
check_thread_db (info, true);
}
-void _initialize_thread_db ();
-void
-_initialize_thread_db ()
+INIT_GDB_FILE (thread_db)
{
/* Defer loading of libthread_db.so until inferior is running.
This allows gdb to load correct libthread_db for a given
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index c94aef4..cee2e51 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -1,7 +1,7 @@
/* Target-dependent code for Lattice Mico32 processor, for GDB.
Contributed by Jon Beniston <jon@beniston.com>
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -536,9 +536,7 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_lm32_tdep ();
-void
-_initialize_lm32_tdep ()
+INIT_GDB_FILE (lm32_tdep)
{
gdbarch_register (bfd_arch_lm32, lm32_gdbarch_init);
}
diff --git a/gdb/location.c b/gdb/location.c
index 1b40991..197c47b 100644
--- a/gdb/location.c
+++ b/gdb/location.c
@@ -1,5 +1,5 @@
/* Data structures and API for location specs in GDB.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -26,7 +26,6 @@
#include "probe.h"
#include "cp-support.h"
-#include <ctype.h>
#include <string.h>
static std::string
@@ -408,15 +407,15 @@ explicit_location_spec_lex_one (const char **inp,
whitespace or comma. */
if (*start == '-' || *start == '+')
{
- while (*inp[0] != '\0' && *inp[0] != ',' && !isspace (*inp[0]))
+ while (*inp[0] != '\0' && *inp[0] != ',' && !c_isspace (*inp[0]))
++(*inp);
}
else
{
/* Handle numbers first, stopping at the next whitespace or ','. */
- while (isdigit (*inp[0]))
+ while (c_isdigit (*inp[0]))
++(*inp);
- if (*inp[0] == '\0' || isspace (*inp[0]) || *inp[0] == ',')
+ if (*inp[0] == '\0' || c_isspace (*inp[0]) || *inp[0] == ',')
return gdb::unique_xmalloc_ptr<char> (savestring (start,
*inp - start));
@@ -425,7 +424,7 @@ explicit_location_spec_lex_one (const char **inp,
*inp = start;
while ((*inp)[0]
&& (*inp)[0] != ','
- && !(isspace ((*inp)[0])
+ && !(c_isspace ((*inp)[0])
|| linespec_lexer_lex_keyword (&(*inp)[1])))
{
/* Special case: C++ operator,. */
@@ -454,14 +453,14 @@ is_cp_operator (const char *start, const char *comma)
{
const char *p = comma;
- while (p > start && isspace (p[-1]))
+ while (p > start && c_isspace (p[-1]))
p--;
if (p - start >= CP_OPERATOR_LEN)
{
p -= CP_OPERATOR_LEN;
if (strncmp (p, CP_OPERATOR_STR, CP_OPERATOR_LEN) == 0
&& (p == start
- || !(isalnum (p[-1]) || p[-1] == '_')))
+ || !(c_isalnum (p[-1]) || p[-1] == '_')))
{
return true;
}
@@ -624,7 +623,7 @@ string_to_explicit_location_spec (const char **argp,
if (argp == NULL
|| *argp == NULL
|| *argp[0] != '-'
- || !isalpha ((*argp)[1])
+ || !c_isalpha ((*argp)[1])
|| ((*argp)[0] == '-' && (*argp)[1] == 'p'))
return NULL;
@@ -728,7 +727,7 @@ string_to_explicit_location_spec (const char **argp,
}
/* Only emit an "invalid argument" error for options
that look like option strings. */
- else if (opt.get ()[0] == '-' && !isdigit (opt.get ()[1]))
+ else if (opt.get ()[0] == '-' && !c_isdigit (opt.get ()[1]))
{
if (completion_info == NULL)
error (_("invalid explicit location argument, \"%s\""), opt.get ());
diff --git a/gdb/location.h b/gdb/location.h
index 7772d10..09f25f1 100644
--- a/gdb/location.h
+++ b/gdb/location.h
@@ -1,5 +1,5 @@
/* Data structures and API for location specs in GDB.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/loongarch-linux-nat.c b/gdb/loongarch-linux-nat.c
index bef88ca..1360acf 100644
--- a/gdb/loongarch-linux-nat.c
+++ b/gdb/loongarch-linux-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux on LoongArch processors.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
Contributed by Loongson Ltd.
This file is part of GDB.
@@ -72,8 +72,6 @@ public:
struct expression *cond) override;
int remove_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type type,
struct expression *cond) override;
- bool watchpoint_addr_within_range (CORE_ADDR addr, CORE_ADDR start,
- int length) override;
/* Add our hardware breakpoint and watchpoint implementation. */
bool stopped_by_watchpoint () override;
@@ -581,15 +579,6 @@ loongarch_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len,
}
-bool
-loongarch_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr,
- CORE_ADDR start,
- int length)
-{
- return start <= addr && start + length - 1 >= addr;
-}
-
-
/* Implement the "stopped_data_address" target_ops method. */
bool
@@ -751,9 +740,7 @@ loongarch_linux_nat_target::low_forget_process (pid_t pid)
/* Initialize LoongArch Linux native support. */
-void _initialize_loongarch_linux_nat ();
-void
-_initialize_loongarch_linux_nat ()
+INIT_GDB_FILE (loongarch_linux_nat)
{
linux_target = &the_loongarch_linux_nat_target;
add_inf_child_target (&the_loongarch_linux_nat_target);
diff --git a/gdb/loongarch-linux-tdep.c b/gdb/loongarch-linux-tdep.c
index 031031b..3766338 100644
--- a/gdb/loongarch-linux-tdep.c
+++ b/gdb/loongarch-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux on LoongArch processors.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
Contributed by Loongson Ltd.
This file is part of GDB.
@@ -25,6 +25,7 @@
#include "inferior.h"
#include "linux-record.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
#include "loongarch-tdep.h"
#include "record-full.h"
#include "regset.h"
@@ -938,7 +939,7 @@ loongarch_record_all_but_pc_registers (struct regcache *regcache)
return 0;
}
-/* Handler for LoongArch architechture system call instruction recording. */
+/* Handler for LoongArch architecture system call instruction recording. */
static int
loongarch_linux_syscall_record (struct regcache *regcache,
@@ -1145,10 +1146,9 @@ loongarch_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
linux_init_abi (info, gdbarch, 0);
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- info.bfd_arch_info->bits_per_address == 32
- ? linux_ilp32_fetch_link_map_offsets
- : linux_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, (info.bfd_arch_info->bits_per_address == 32
+ ? make_linux_ilp32_svr4_solib_ops
+ : make_linux_lp64_svr4_solib_ops));
/* GNU/Linux uses SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
@@ -1183,9 +1183,7 @@ loongarch_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Initialize LoongArch Linux target support. */
-void _initialize_loongarch_linux_tdep ();
-void
-_initialize_loongarch_linux_tdep ()
+INIT_GDB_FILE (loongarch_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_loongarch, bfd_mach_loongarch32,
GDB_OSABI_LINUX, loongarch_linux_init_abi);
diff --git a/gdb/loongarch-tdep.c b/gdb/loongarch-tdep.c
index 00c72d1..e94b88b 100644
--- a/gdb/loongarch-tdep.c
+++ b/gdb/loongarch-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the LoongArch architecture, for GDB.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,10 +22,12 @@
#include "dwarf2/frame.h"
#include "elf-bfd.h"
#include "extract-store-integer.h"
+#include "frame-base.h"
#include "frame-unwind.h"
#include "gdbcore.h"
#include "linux-record.h"
#include "loongarch-tdep.h"
+#include "prologue-value.h"
#include "record.h"
#include "record-full.h"
#include "reggroups.h"
@@ -34,6 +36,33 @@
#include "trad-frame.h"
#include "user-regs.h"
+/* LoongArch frame cache structure. */
+struct loongarch_frame_cache
+{
+ /* The program counter at the start of the function. It is used to
+ identify this frame as a prologue frame. */
+ CORE_ADDR func;
+
+ /* The stack pointer at the time this frame was created; i.e. the
+ caller's stack pointer when this function was called. It is used
+ to identify this frame. */
+ CORE_ADDR prev_sp;
+
+ CORE_ADDR pc;
+
+ int available_p;
+
+ /* This register stores the frame base of the frame. */
+ int framebase_reg;
+
+ /* The framebase_offset is the distance from frame base to the prev_sp,
+ so the value of framebase_reg is just prev_sp - framebase_offset. */
+ int framebase_offset;
+
+ /* Saved register offsets. */
+ trad_frame_saved_reg *saved_regs;
+};
+
/* Fetch the instruction at PC. */
static insn_t
@@ -74,7 +103,9 @@ loongarch_insn_is_cond_branch (insn_t insn)
|| (insn & 0xfc000000) == 0x68000000 /* bltu */
|| (insn & 0xfc000000) == 0x6c000000 /* bgeu */
|| (insn & 0xfc000000) == 0x40000000 /* beqz */
- || (insn & 0xfc000000) == 0x44000000) /* bnez */
+ || (insn & 0xfc000000) == 0x44000000 /* bnez */
+ || (insn & 0xfc000300) == 0x48000000 /* bceqz */
+ || (insn & 0xfc000300) == 0x48000100) /* bcnez */
return true;
return false;
}
@@ -96,7 +127,9 @@ static bool
loongarch_insn_is_ll (insn_t insn)
{
if ((insn & 0xff000000) == 0x20000000 /* ll.w */
- || (insn & 0xff000000) == 0x22000000) /* ll.d */
+ || (insn & 0xff000000) == 0x22000000 /* ll.d */
+ || (insn & 0xfffffc00) == 0x38578000 /* llacq.w */
+ || (insn & 0xfffffc00) == 0x38578800) /* llacq.d */
return true;
return false;
}
@@ -107,7 +140,10 @@ static bool
loongarch_insn_is_sc (insn_t insn)
{
if ((insn & 0xff000000) == 0x21000000 /* sc.w */
- || (insn & 0xff000000) == 0x23000000) /* sc.d */
+ || (insn & 0xff000000) == 0x23000000 /* sc.d */
+ || (insn & 0xffff8000) == 0x38570000 /* sc.q */
+ || (insn & 0xfffffc00) == 0x38578400 /* screl.w */
+ || (insn & 0xfffffc00) == 0x38578c00) /* screl.d */
return true;
return false;
}
@@ -118,13 +154,23 @@ loongarch_insn_is_sc (insn_t insn)
static CORE_ADDR
loongarch_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
CORE_ADDR limit_pc, const frame_info_ptr &this_frame,
- struct trad_frame_cache *this_cache)
+ struct loongarch_frame_cache *this_cache)
{
CORE_ADDR cur_pc = start_pc, prologue_end = 0;
int32_t sp = LOONGARCH_SP_REGNUM;
int32_t fp = LOONGARCH_FP_REGNUM;
+ int32_t ra = LOONGARCH_RA_REGNUM;
int32_t reg_value[32] = {0};
int32_t reg_used[32] = {1, 0};
+ int i;
+
+ /* Track 32 GPR, ORIG_A0, PC, BADV in prologue. */
+ pv_t regs[LOONGARCH_USED_NUM_GREGSET];
+
+ for (i = 0; i < LOONGARCH_USED_NUM_GREGSET; i++)
+ regs[i] = pv_register (i, 0);
+
+ pv_area stack (LOONGARCH_SP_REGNUM, gdbarch_addr_bit (gdbarch));
while (cur_pc < limit_pc)
{
@@ -134,27 +180,40 @@ loongarch_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
int32_t rj = loongarch_decode_imm ("5:5", insn, 0);
int32_t rk = loongarch_decode_imm ("10:5", insn, 0);
int32_t si12 = loongarch_decode_imm ("10:12", insn, 1);
+ int32_t si14 = loongarch_decode_imm ("10:14", insn, 1);
int32_t si20 = loongarch_decode_imm ("5:20", insn, 1);
if ((insn & 0xffc00000) == 0x02c00000 /* addi.d sp,sp,si12 */
&& rd == sp && rj == sp && si12 < 0)
{
prologue_end = cur_pc + insn_len;
+ regs[rd] = pv_add_constant (regs[rj], si12);
}
else if ((insn & 0xffc00000) == 0x02c00000 /* addi.d fp,sp,si12 */
&& rd == fp && rj == sp && si12 > 0)
{
prologue_end = cur_pc + insn_len;
+ regs[rd] = pv_add_constant (regs[rj], si12);
}
else if ((insn & 0xffc00000) == 0x29c00000 /* st.d rd,sp,si12 */
&& rj == sp)
{
prologue_end = cur_pc + insn_len;
+ /* ra, fp, s0~s8 are saved by callee with sp as a base */
+ if ((rd >= fp && rd <= fp + 9) || rd == ra)
+ {
+ stack.store (pv_add_constant (regs[sp], si12), register_size (gdbarch, rd), regs[rd]);
+ }
}
else if ((insn & 0xff000000) == 0x27000000 /* stptr.d rd,sp,si14 */
&& rj == sp)
{
prologue_end = cur_pc + insn_len;
+ /* ra, fp, s0~s8 are saved by callee with sp as a base */
+ if ((rd >= fp && rd <= fp + 9) || rd == ra)
+ {
+ stack.store (pv_add_constant (regs[sp], si14), register_size (gdbarch, rd), regs[rd]);
+ }
}
else if ((insn & 0xfe000000) == 0x14000000) /* lu12i.w rd,si20 */
{
@@ -189,6 +248,38 @@ loongarch_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
if (prologue_end == 0)
prologue_end = cur_pc;
+ if (this_cache == NULL)
+ return prologue_end;
+
+ if (pv_is_register (regs[LOONGARCH_FP_REGNUM], LOONGARCH_SP_REGNUM))
+ {
+ /* Frame pointer is fp. */
+ this_cache->framebase_reg = LOONGARCH_FP_REGNUM;
+ this_cache->framebase_offset = -regs[LOONGARCH_FP_REGNUM].k;
+ }
+ else if (pv_is_register (regs[LOONGARCH_SP_REGNUM], LOONGARCH_SP_REGNUM))
+ {
+ /* Try the stack pointer. */
+ this_cache->framebase_reg = LOONGARCH_SP_REGNUM;
+ this_cache->framebase_offset = -regs[LOONGARCH_SP_REGNUM].k;
+ }
+ else
+ {
+ /* We're just out of luck. We don't know where the frame is. */
+ this_cache->framebase_reg = -1;
+ this_cache->framebase_offset = 0;
+ }
+
+ for (i = 0; i < LOONGARCH_USED_NUM_GREGSET; i++)
+ {
+ CORE_ADDR offset;
+
+ if (stack.find_reg (gdbarch, i, &offset))
+ {
+ this_cache->saved_regs[i].set_addr (offset);
+ }
+ }
+
return prologue_end;
}
@@ -314,6 +405,20 @@ loongarch_next_pc (struct regcache *regcache, CORE_ADDR cur_pc)
if (rj != 0)
next_pc = cur_pc + loongarch_decode_imm ("0:5|10:16<<2", insn, 1);
}
+ else if ((insn & 0xfc000300) == 0x48000000) /* bceqz cj, offs21 */
+ {
+ LONGEST cj = regcache_raw_get_signed (regcache,
+ loongarch_decode_imm ("5:3", insn, 0) + LOONGARCH_FIRST_FCC_REGNUM);
+ if (cj == 0)
+ next_pc = cur_pc + loongarch_decode_imm ("0:5|10:16<<2", insn, 1);
+ }
+ else if ((insn & 0xfc000300) == 0x48000100) /* bcnez cj, offs21 */
+ {
+ LONGEST cj = regcache_raw_get_signed (regcache,
+ loongarch_decode_imm ("5:3", insn, 0) + LOONGARCH_FIRST_FCC_REGNUM);
+ if (cj != 0)
+ next_pc = cur_pc + loongarch_decode_imm ("0:5|10:16<<2", insn, 1);
+ }
else if ((insn & 0xffff8000) == 0x002b0000) /* syscall */
{
if (tdep->syscall_next_pc != nullptr)
@@ -323,13 +428,50 @@ loongarch_next_pc (struct regcache *regcache, CORE_ADDR cur_pc)
return next_pc;
}
+/* Calculate the destination address of a condition branch instruction under an
+ assumed true condition */
+
+static CORE_ADDR
+cond_branch_destination_address (CORE_ADDR cur_pc, insn_t insn)
+{
+ size_t insn_len = loongarch_insn_length (insn);
+ CORE_ADDR next_pc = cur_pc + insn_len;
+
+ if ((insn & 0xfc000000) == 0x58000000) /* beq rj, rd, offs16 */
+ next_pc = cur_pc + loongarch_decode_imm ("10:16<<2", insn, 1);
+ else if ((insn & 0xfc000000) == 0x5c000000) /* bne rj, rd, offs16 */
+ next_pc = cur_pc + loongarch_decode_imm ("10:16<<2", insn, 1);
+ else if ((insn & 0xfc000000) == 0x60000000) /* blt rj, rd, offs16 */
+ next_pc = cur_pc + loongarch_decode_imm ("10:16<<2", insn, 1);
+ else if ((insn & 0xfc000000) == 0x64000000) /* bge rj, rd, offs16 */
+ next_pc = cur_pc + loongarch_decode_imm ("10:16<<2", insn, 1);
+ else if ((insn & 0xfc000000) == 0x68000000) /* bltu rj, rd, offs16 */
+ next_pc = cur_pc + loongarch_decode_imm ("10:16<<2", insn, 1);
+ else if ((insn & 0xfc000000) == 0x6c000000) /* bgeu rj, rd, offs16 */
+ next_pc = cur_pc + loongarch_decode_imm ("10:16<<2", insn, 1);
+ else if ((insn & 0xfc000000) == 0x40000000) /* beqz rj, offs21 */
+ next_pc = cur_pc + loongarch_decode_imm ("0:5|10:16<<2", insn, 1);
+ else if ((insn & 0xfc000000) == 0x44000000) /* bnez rj, offs21 */
+ next_pc = cur_pc + loongarch_decode_imm ("0:5|10:16<<2", insn, 1);
+ else if ((insn & 0xfc000300) == 0x48000000) /* bceqz cj, offs21 */
+ next_pc = cur_pc + loongarch_decode_imm ("0:5|10:16<<2", insn, 1);
+ else if ((insn & 0xfc000300) == 0x48000100) /* bcnez cj, offs21 */
+ next_pc = cur_pc + loongarch_decode_imm ("0:5|10:16<<2", insn, 1);
+
+ return next_pc;
+}
+
/* We can't put a breakpoint in the middle of a ll/sc atomic sequence,
- so look for the end of the sequence and put the breakpoint there. */
+ so a breakpoint should be outside of atomic sequence in any case,
+ just look for the start and end of the sequence, and then restrict
+ the breakpoint outside of the atomic sequence. */
static std::vector<CORE_ADDR>
loongarch_deal_with_atomic_sequence (struct regcache *regcache, CORE_ADDR cur_pc)
{
CORE_ADDR next_pc;
+ CORE_ADDR ll_insn_addr;
+ CORE_ADDR sc_insn_addr;
std::vector<CORE_ADDR> next_pcs;
insn_t insn = loongarch_fetch_instruction (cur_pc);
size_t insn_len = loongarch_insn_length (insn);
@@ -340,6 +482,30 @@ loongarch_deal_with_atomic_sequence (struct regcache *regcache, CORE_ADDR cur_pc
if (!loongarch_insn_is_ll (insn))
return {};
+ /* Record the address of a Load Linked instruction */
+ ll_insn_addr = cur_pc;
+
+ for (int insn_count = 0; insn_count < atomic_sequence_length; ++insn_count)
+ {
+ cur_pc += insn_len;
+ insn = loongarch_fetch_instruction (cur_pc);
+
+ if (loongarch_insn_is_sc (insn))
+ {
+ /* Record the address of a Store Conditional instruction */
+ sc_insn_addr = cur_pc;
+ found_atomic_sequence_endpoint = true;
+ break;
+ }
+ }
+
+ /* We didn't find a closing Store Conditional instruction, fallback to the standard code. */
+ if (!found_atomic_sequence_endpoint)
+ return {};
+
+ /* Restore current PC with the address of a Load Linked instruction */
+ cur_pc = ll_insn_addr;
+
/* Assume that no atomic sequence is longer than "atomic_sequence_length" instructions. */
for (int insn_count = 0; insn_count < atomic_sequence_length; ++insn_count)
{
@@ -355,24 +521,20 @@ loongarch_deal_with_atomic_sequence (struct regcache *regcache, CORE_ADDR cur_pc
which is outside of the ll/sc atomic instruction sequence. */
else if (loongarch_insn_is_cond_branch (insn))
{
- next_pc = loongarch_next_pc (regcache, cur_pc);
- if (next_pc != cur_pc + insn_len)
+ next_pc = cond_branch_destination_address (cur_pc, insn);
+ /* Restrict the breakpoint outside of the atomic sequence. */
+ if (next_pc < ll_insn_addr || next_pc > sc_insn_addr)
next_pcs.push_back (next_pc);
}
/* Look for a Store Conditional instruction which closes the atomic sequence. */
else if (loongarch_insn_is_sc (insn))
{
- found_atomic_sequence_endpoint = true;
next_pc = cur_pc + insn_len;
next_pcs.push_back (next_pc);
break;
}
}
- /* We didn't find a closing Store Conditional instruction, fallback to the standard code. */
- if (!found_atomic_sequence_endpoint)
- return {};
-
return next_pcs;
}
@@ -410,38 +572,157 @@ loongarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
return align_down (addr, 16);
}
+/* Analyze the function prologue for THIS_FRAME and populate the frame
+ cache CACHE. */
+
+static void
+loongarch_analyze_prologue (const frame_info_ptr &this_frame,
+ struct loongarch_frame_cache *cache)
+{
+ CORE_ADDR block_addr = get_frame_address_in_block (this_frame);
+ CORE_ADDR prologue_start = 0;
+ CORE_ADDR prologue_end = 0;
+ CORE_ADDR pc = get_frame_pc (this_frame);
+ struct gdbarch *gdbarch = get_frame_arch (this_frame);
+
+ cache->pc = pc;
+
+ /* Assume we do not find a frame. */
+ cache->framebase_reg = -1;
+ cache->framebase_offset = 0;
+
+
+ if (find_pc_partial_function (block_addr, NULL, &prologue_start,
+ &prologue_end))
+ {
+ struct symtab_and_line sal = find_pc_line (prologue_start, 0);
+
+ if (sal.line == 0)
+ {
+ /* No line info so use the current PC. */
+ prologue_end = pc;
+ }
+ else if (sal.end < prologue_end)
+ {
+ if (sal.symtab != NULL && sal.symtab->language () == language_asm)
+ {
+ /* This sal.end usually cannot point to prologue_end correctly
+ in asm file. */
+ prologue_end = pc;
+ }
+ else
+ {
+ /* The next line begins after the prologue_end. */
+ prologue_end = sal.end;
+ }
+ }
+
+ }
+ else
+ {
+ /* We're in the boondocks: we have no idea where the start of the
+ function is. */
+ return;
+ }
+
+ prologue_end = std::min (prologue_end, pc);
+ loongarch_scan_prologue (gdbarch, prologue_start, prologue_end, nullptr, cache);
+}
+
+/* Fill in *CACHE with information about the prologue of *THIS_FRAME. */
+
+static void
+loongarch_frame_cache_1 (const frame_info_ptr &this_frame,
+ struct loongarch_frame_cache *cache)
+{
+ CORE_ADDR unwound_fp;
+ int reg;
+
+ loongarch_analyze_prologue (this_frame, cache);
+
+ if (cache->framebase_reg == -1)
+ return;
+
+ unwound_fp = get_frame_register_unsigned (this_frame, cache->framebase_reg);
+ if (unwound_fp == 0)
+ return;
+
+ cache->prev_sp = unwound_fp;
+ cache->prev_sp += cache->framebase_offset;
+
+ /* Calculate actual addresses of saved registers using offsets
+ determined by loongarch_scan_prologue. */
+ for (reg = 0; reg < gdbarch_num_regs (get_frame_arch (this_frame)); reg++)
+ if (cache->saved_regs[reg].is_addr ())
+ cache->saved_regs[reg].set_addr (cache->saved_regs[reg].addr ()
+ + cache->prev_sp);
+
+ cache->func = get_frame_func (this_frame);
+
+ cache->available_p = 1;
+}
+
/* Generate, or return the cached frame cache for frame unwinder. */
-static struct trad_frame_cache *
+static struct loongarch_frame_cache *
loongarch_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
{
- struct trad_frame_cache *cache;
- CORE_ADDR pc;
+ struct loongarch_frame_cache *cache;
- if (*this_cache != nullptr)
- return (struct trad_frame_cache *) *this_cache;
+ if (*this_cache != NULL)
+ return (struct loongarch_frame_cache *) *this_cache;
- cache = trad_frame_cache_zalloc (this_frame);
+ cache = FRAME_OBSTACK_ZALLOC (struct loongarch_frame_cache);
+ cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
*this_cache = cache;
- trad_frame_set_reg_realreg (cache, LOONGARCH_PC_REGNUM, LOONGARCH_RA_REGNUM);
-
- pc = get_frame_address_in_block (this_frame);
- trad_frame_set_id (cache, frame_id_build_unavailable_stack (pc));
+ try
+ {
+ loongarch_frame_cache_1 (this_frame, cache);
+ }
+ catch (const gdb_exception_error &ex)
+ {
+ if (ex.error != NOT_AVAILABLE_ERROR)
+ throw;
+ }
return cache;
}
+/* Implement the "stop_reason" frame_unwind method. */
+
+static enum unwind_stop_reason
+loongarch_frame_unwind_stop_reason (const frame_info_ptr &this_frame,
+ void **this_cache)
+{
+ struct loongarch_frame_cache *cache
+ = loongarch_frame_cache (this_frame, this_cache);
+
+ if (!cache->available_p)
+ return UNWIND_UNAVAILABLE;
+
+ /* We've hit a wall, stop. */
+ if (cache->prev_sp == 0)
+ return UNWIND_OUTERMOST;
+
+ return UNWIND_NO_REASON;
+}
+
/* Implement the this_id callback for frame unwinder. */
static void
loongarch_frame_this_id (const frame_info_ptr &this_frame, void **prologue_cache,
struct frame_id *this_id)
{
- struct trad_frame_cache *info;
+ struct loongarch_frame_cache *cache
+ = loongarch_frame_cache (this_frame, prologue_cache);
- info = loongarch_frame_cache (this_frame, prologue_cache);
- trad_frame_get_id (info, this_id);
+ /* Our frame ID for a normal frame is the current function's starting
+ PC and the caller's SP when we were called. */
+ if (!cache->available_p)
+ *this_id = frame_id_build_unavailable_stack (cache->func);
+ else
+ *this_id = frame_id_build (cache->prev_sp, cache->func);
}
/* Implement the prev_register callback for frame unwinder. */
@@ -450,17 +731,55 @@ static struct value *
loongarch_frame_prev_register (const frame_info_ptr &this_frame,
void **prologue_cache, int regnum)
{
- struct trad_frame_cache *info;
+ struct loongarch_frame_cache *cache
+ = loongarch_frame_cache (this_frame, prologue_cache);
+
+ /* If we are asked to unwind the PC, then we need to return the RA
+ instead. The prologue may save PC, but it will point into this
+ frame's prologue, not the previou frame's resume location. */
+ if (regnum == LOONGARCH_PC_REGNUM)
+ {
+ CORE_ADDR ra;
+ ra = frame_unwind_register_unsigned (this_frame, LOONGARCH_RA_REGNUM);
+
+ return frame_unwind_got_constant (this_frame, regnum, ra);
+ }
+
+ /* SP is generally not saved to the stack, but this frame is
+ identified by the next frame's stack pointer at the time of the
+ call. The value was already reconstructed into PREV_SP. */
+ /*
+ addi.d $sp, $sp, -32
+ st.d $ra, $sp, 24
+ st.d $fp, $sp, 16
+ addi.d $fp, $sp, 32
+
+ +->+----------+
+ | | saved ra |
+ | | saved fp |
+ | | |
+ | | |
+ | +----------+ <- Previous SP == FP
+ | | saved ra |
+ +--| saved fp |
+ | |
+ | |
+ +----------+ <- SP
+ */
+
+ if (regnum == LOONGARCH_SP_REGNUM)
+ return frame_unwind_got_constant (this_frame, regnum, cache->prev_sp);
+
+ return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
- info = loongarch_frame_cache (this_frame, prologue_cache);
- return trad_frame_get_register (info, this_frame, regnum);
}
+/* LoongArch prologue unwinder. */
static const struct frame_unwind_legacy loongarch_frame_unwind (
"loongarch prologue",
/*.type =*/NORMAL_FRAME,
/*.unwinder_class=*/FRAME_UNWIND_ARCH,
- /*.stop_reason =*/default_frame_unwind_stop_reason,
+ /*.stop_reason =*/loongarch_frame_unwind_stop_reason,
/*.this_id =*/loongarch_frame_this_id,
/*.prev_register =*/loongarch_frame_prev_register,
/*.unwind_data =*/nullptr,
@@ -469,6 +788,26 @@ static const struct frame_unwind_legacy loongarch_frame_unwind (
/*.prev_arch =*/nullptr
);
+/* Return the frame base address of *THIS_FRAME. */
+
+static CORE_ADDR
+loongarch_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)
+{
+ struct loongarch_frame_cache *cache
+ = loongarch_frame_cache (this_frame, this_cache);
+
+ return cache->prev_sp - cache->framebase_offset;
+}
+
+/* LoongArch default frame base information. */
+static frame_base loongarch_frame_base =
+{
+ &loongarch_frame_unwind,
+ loongarch_frame_base_address,
+ loongarch_frame_base_address,
+ loongarch_frame_base_address
+};
+
/* Write the contents of buffer VAL into the general-purpose argument
register defined by GAR in REGCACHE. GAR indicates the available
general-purpose argument registers which should be a value in the
@@ -1879,7 +2218,7 @@ loongarch_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_align (gdbarch, loongarch_frame_align);
/* Breakpoint manipulation. */
- set_gdbarch_software_single_step (gdbarch, loongarch_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, loongarch_software_single_step);
set_gdbarch_breakpoint_kind_from_pc (gdbarch, loongarch_breakpoint::kind_from_pc);
set_gdbarch_sw_breakpoint_from_kind (gdbarch, loongarch_breakpoint::bp_from_kind);
set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
@@ -1889,6 +2228,8 @@ loongarch_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
dwarf2_append_unwinders (gdbarch);
frame_unwind_append_unwinder (gdbarch, &loongarch_frame_unwind);
+ frame_base_set_default (gdbarch, &loongarch_frame_base);
+
/* Hook in OS ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
set_gdbarch_register_reggroup_p (gdbarch, loongarch_register_reggroup_p);
@@ -2405,9 +2746,7 @@ loongarch_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
return ret;
}
-void _initialize_loongarch_tdep ();
-void
-_initialize_loongarch_tdep ()
+INIT_GDB_FILE (loongarch_tdep)
{
gdbarch_register (bfd_arch_loongarch, loongarch_gdbarch_init, nullptr);
}
diff --git a/gdb/loongarch-tdep.h b/gdb/loongarch-tdep.h
index 48e2635..ef965c8 100644
--- a/gdb/loongarch-tdep.h
+++ b/gdb/loongarch-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent header for the LoongArch architecture, for GDB.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/m2-exp.h b/gdb/m2-exp.h
index ce773cb..43f9561 100644
--- a/gdb/m2-exp.h
+++ b/gdb/m2-exp.h
@@ -1,6 +1,6 @@
/* Definitions for Modula-2 expressions
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index 0201f84..55d5f2e 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -1,5 +1,5 @@
/* YACC grammar for Modula-2 expressions, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
Generated from expread.y (now c-exp.y) and contributed by the Department
of Computer Science at the State University of New York at Buffalo, 1991.
@@ -507,7 +507,7 @@ fblock : block COLONCOLON BLOCKNAME
{ struct symbol *tem
= lookup_symbol (copy_name ($3).c_str (), $1,
SEARCH_VFT, 0).symbol;
- if (!tem || tem->aclass () != LOC_BLOCK)
+ if (!tem || tem->loc_class () != LOC_BLOCK)
error (_("No function \"%s\" in specified context."),
copy_name ($3).c_str ());
$$ = tem;
@@ -928,7 +928,7 @@ yylex (void)
sym = lookup_symbol (tmp.c_str (), pstate->expression_context_block,
SEARCH_VFT, 0).symbol;
- if (sym && sym->aclass () == LOC_BLOCK)
+ if (sym && sym->loc_class () == LOC_BLOCK)
return BLOCKNAME;
if (lookup_typename (pstate->language (),
tmp.c_str (), pstate->expression_context_block, 1))
@@ -936,7 +936,7 @@ yylex (void)
if(sym)
{
- switch(sym->aclass ())
+ switch(sym->loc_class ())
{
case LOC_STATIC:
case LOC_REGISTER:
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 5e9faa6..3533c6a 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -1,6 +1,6 @@
/* Modula 2 language support routines for GDB, the GNU debugger.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/m2-lang.h b/gdb/m2-lang.h
index 1551d7e..753fbbe 100644
--- a/gdb/m2-lang.h
+++ b/gdb/m2-lang.h
@@ -1,6 +1,6 @@
/* Modula 2 language support definitions for GDB, the GNU debugger.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c
index 42583b4..12d3120 100644
--- a/gdb/m2-typeprint.c
+++ b/gdb/m2-typeprint.c
@@ -1,5 +1,5 @@
/* Support for printing Modula 2 types for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index 62bfec9..d7d1c73 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -1,6 +1,6 @@
/* Support for printing Modula 2 values for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index 376b362..8d99839 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -1,6 +1,6 @@
/* Renesas M32C target-dependent code for GDB, the GNU debugger.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -2653,9 +2653,7 @@ m32c_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_m32c_tdep ();
-void
-_initialize_m32c_tdep ()
+INIT_GDB_FILE (m32c_tdep)
{
gdbarch_register (bfd_arch_m32c, m32c_gdbarch_init);
diff --git a/gdb/m32r-linux-nat.c b/gdb/m32r-linux-nat.c
index bb86675..c186693 100644
--- a/gdb/m32r-linux-nat.c
+++ b/gdb/m32r-linux-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux m32r.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -234,9 +234,7 @@ m32r_linux_nat_target::store_registers (struct regcache *regcache, int regno)
internal_error (_("Got request to store bad register number %d."), regno);
}
-void _initialize_m32r_linux_nat ();
-void
-_initialize_m32r_linux_nat ()
+INIT_GDB_FILE (m32r_linux_nat)
{
/* Register the target. */
linux_target = &the_m32r_linux_nat_target;
diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c
index 72c1833..03000cc 100644
--- a/gdb/m32r-linux-tdep.c
+++ b/gdb/m32r-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux m32r.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -36,6 +36,7 @@
#include "m32r-tdep.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
#include "gdbarch.h"
@@ -461,8 +462,7 @@ m32r_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU/Linux uses SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
/* Core file support. */
set_gdbarch_iterate_over_regset_sections
@@ -473,9 +473,7 @@ m32r_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
svr4_fetch_objfile_link_map);
}
-void _initialize_m32r_linux_tdep ();
-void
-_initialize_m32r_linux_tdep ()
+INIT_GDB_FILE (m32r_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_m32r, 0, GDB_OSABI_LINUX,
m32r_linux_init_abi);
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index 8300528..4ac08fd 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Renesas M32R, for GDB.
- Copyright (C) 1996-2024 Free Software Foundation, Inc.
+ Copyright (C) 1996-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -908,9 +908,7 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_m32r_tdep ();
-void
-_initialize_m32r_tdep ()
+INIT_GDB_FILE (m32r_tdep)
{
gdbarch_register (bfd_arch_m32r, m32r_gdbarch_init);
}
diff --git a/gdb/m32r-tdep.h b/gdb/m32r-tdep.h
index 1cc0de3..3e94c0e 100644
--- a/gdb/m32r-tdep.h
+++ b/gdb/m32r-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for Renesas M32R, for GDB.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 234edcf..5389fee 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Motorola 68HC11 & 68HC12
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
Contributed by Stephane Carrez, stcarrez@nerim.fr
@@ -1527,9 +1527,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
return gdbarch;
}
-void _initialize_m68hc11_tdep ();
-void
-_initialize_m68hc11_tdep ()
+INIT_GDB_FILE (m68hc11_tdep)
{
gdbarch_register (bfd_arch_m68hc11, m68hc11_gdbarch_init);
gdbarch_register (bfd_arch_m68hc12, m68hc11_gdbarch_init);
diff --git a/gdb/m68k-bsd-nat.c b/gdb/m68k-bsd-nat.c
index 1fb0c20..ae8fa4d 100644
--- a/gdb/m68k-bsd-nat.c
+++ b/gdb/m68k-bsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for Motorola 68000 BSD's.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -225,9 +225,7 @@ m68kbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
return 1;
}
-void _initialize_m68kbsd_nat ();
-void
-_initialize_m68kbsd_nat ()
+INIT_GDB_FILE (m68kbsd_nat)
{
add_inf_child_target (&the_m68k_bsd_nat_target);
diff --git a/gdb/m68k-bsd-tdep.c b/gdb/m68k-bsd-tdep.c
index faec471..37c1464 100644
--- a/gdb/m68k-bsd-tdep.c
+++ b/gdb/m68k-bsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Motorola 68000 BSD's.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -147,13 +147,10 @@ m68kbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->struct_return = pcc_struct_return;
/* NetBSD ELF uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
}
-void _initialize_m68kbsd_tdep ();
-void
-_initialize_m68kbsd_tdep ()
+INIT_GDB_FILE (m68kbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_m68k, 0, GDB_OSABI_NETBSD,
m68kbsd_init_abi);
diff --git a/gdb/m68k-linux-nat.c b/gdb/m68k-linux-nat.c
index 7ea5847..02286ff 100644
--- a/gdb/m68k-linux-nat.c
+++ b/gdb/m68k-linux-nat.c
@@ -1,6 +1,6 @@
/* Motorola m68k native support for GNU/Linux.
- Copyright (C) 1996-2024 Free Software Foundation, Inc.
+ Copyright (C) 1996-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -508,9 +508,7 @@ ps_get_thread_area (struct ps_prochandle *ph,
return PS_OK;
}
-void _initialize_m68k_linux_nat ();
-void
-_initialize_m68k_linux_nat ()
+INIT_GDB_FILE (m68k_linux_nat)
{
/* Register the target. */
linux_target = &the_m68k_linux_nat_target;
diff --git a/gdb/m68k-linux-tdep.c b/gdb/m68k-linux-tdep.c
index f7388d9..bd2a14a 100644
--- a/gdb/m68k-linux-tdep.c
+++ b/gdb/m68k-linux-tdep.c
@@ -1,6 +1,6 @@
/* Motorola m68k target-dependent support for GNU/Linux.
- Copyright (C) 1996-2024 Free Software Foundation, Inc.
+ Copyright (C) 1996-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -35,6 +35,7 @@
#include "observable.h"
#include "elf/common.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
#include "regset.h"
/* Offsets (in target ints) into jmp_buf. */
@@ -407,8 +408,7 @@ m68k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Shared library handling. */
/* GNU/Linux uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
/* GNU/Linux uses the dynamic linker included in the GNU C Library. */
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
@@ -424,9 +424,7 @@ m68k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
svr4_fetch_objfile_link_map);
}
-void _initialize_m68k_linux_tdep ();
-void
-_initialize_m68k_linux_tdep ()
+INIT_GDB_FILE (m68k_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_m68k, 0, GDB_OSABI_LINUX,
m68k_linux_init_abi);
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 4318484..94bfddb 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the Motorola 68000 series.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1365,9 +1365,7 @@ m68k_osabi_sniffer (bfd *abfd)
return osabi;
}
-void _initialize_m68k_tdep ();
-void
-_initialize_m68k_tdep ()
+INIT_GDB_FILE (m68k_tdep)
{
gdbarch_register (bfd_arch_m68k, m68k_gdbarch_init, m68k_dump_tdep);
diff --git a/gdb/m68k-tdep.h b/gdb/m68k-tdep.h
index ad56993..e996958 100644
--- a/gdb/m68k-tdep.h
+++ b/gdb/m68k-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for the Motorola 68000 series.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/machoread.c b/gdb/machoread.c
index ac764c0..30d376c 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -1,5 +1,5 @@
/* Darwin support for GDB, the GNU debugger.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
Contributed by AdaCore.
@@ -164,7 +164,7 @@ macho_symtab_read (minimal_symbol_reader &reader,
S_NO_SO,
/* First SO read. Introduce an SO section, and may be followed by a second
- SO. The SO section should contain onl debugging symbols. */
+ SO. The SO section should contain only debugging symbols. */
S_FIRST_SO,
/* Second non-null SO found, just after the first one. Means that the first
@@ -901,13 +901,13 @@ macho_symfile_offsets (struct objfile *objfile,
for (i = 0; i < addrs.size (); i++)
{
- for (obj_section *osect : objfile->sections ())
+ for (obj_section &osect : objfile->sections ())
{
- const char *bfd_sect_name = osect->the_bfd_section->name;
+ const char *bfd_sect_name = osect.the_bfd_section->name;
if (bfd_sect_name == addrs[i].name)
{
- osect->set_offset (addrs[i].addr);
+ osect.set_offset (addrs[i].addr);
break;
}
}
@@ -915,10 +915,10 @@ macho_symfile_offsets (struct objfile *objfile,
objfile->sect_index_text = 0;
- for (obj_section *osect : objfile->sections ())
+ for (obj_section &osect : objfile->sections ())
{
- const char *bfd_sect_name = osect->the_bfd_section->name;
- int sect_index = osect - objfile->sections_start;
+ const char *bfd_sect_name = osect.the_bfd_section->name;
+ int sect_index = &osect - objfile->sections_start;
if (startswith (bfd_sect_name, "LC_SEGMENT."))
bfd_sect_name += 11;
@@ -940,9 +940,7 @@ static const struct sym_fns macho_sym_fns = {
NULL, /* sym_get_probes */
};
-void _initialize_machoread ();
-void
-_initialize_machoread ()
+INIT_GDB_FILE (machoread)
{
add_symtab_fns (bfd_target_mach_o_flavour, &macho_sym_fns);
diff --git a/gdb/macrocmd.c b/gdb/macrocmd.c
index 2da5a5b..d805f3d 100644
--- a/gdb/macrocmd.c
+++ b/gdb/macrocmd.c
@@ -1,5 +1,5 @@
/* C preprocessor macro expansion commands for GDB.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GDB.
@@ -57,11 +57,11 @@ macro_expand_command (const char *exp, int from_tty)
" expression you\n"
"want to expand."));
- gdb::unique_xmalloc_ptr<macro_scope> ms = default_macro_scope ();
+ macro_scope ms = default_macro_scope ();
- if (ms != nullptr)
+ if (ms.is_valid ())
{
- gdb::unique_xmalloc_ptr<char> expanded = macro_expand (exp, *ms);
+ gdb::unique_xmalloc_ptr<char> expanded = macro_expand (exp, ms);
gdb_puts ("expands to: ");
gdb_puts (expanded.get ());
@@ -85,11 +85,11 @@ macro_expand_once_command (const char *exp, int from_tty)
" the expression\n"
"you want to expand."));
- gdb::unique_xmalloc_ptr<macro_scope> ms = default_macro_scope ();
+ macro_scope ms = default_macro_scope ();
- if (ms != nullptr)
+ if (ms.is_valid ())
{
- gdb::unique_xmalloc_ptr<char> expanded = macro_expand_once (exp, *ms);
+ gdb::unique_xmalloc_ptr<char> expanded = macro_expand_once (exp, ms);
gdb_puts ("expands to: ");
gdb_puts (expanded.get ());
@@ -169,7 +169,6 @@ print_macro_definition (const char *name,
static void
info_macro_command (const char *args, int from_tty)
{
- gdb::unique_xmalloc_ptr<struct macro_scope> ms;
const char *name;
int show_all_macros_named = 0;
const char *arg_start = args;
@@ -201,15 +200,15 @@ info_macro_command (const char *args, int from_tty)
" of the macro\n"
"whose definition you want to see."));
- ms = default_macro_scope ();
+ macro_scope ms = default_macro_scope ();
- if (! ms)
+ if (!ms.is_valid ())
macro_inform_no_debuginfo ();
else if (show_all_macros_named)
- macro_for_each (ms->file->table, [&] (const char *macro_name,
- const macro_definition *macro,
- macro_source_file *source,
- int line)
+ macro_for_each (ms.file->table, [&] (const char *macro_name,
+ const macro_definition *macro,
+ macro_source_file *source,
+ int line)
{
if (strcmp (name, macro_name) == 0)
print_macro_definition (name, macro, source, line);
@@ -218,12 +217,12 @@ info_macro_command (const char *args, int from_tty)
{
struct macro_definition *d;
- d = macro_lookup_definition (ms->file, ms->line, name);
+ d = macro_lookup_definition (ms.file, ms.line, name);
if (d)
{
int line;
struct macro_source_file *file
- = macro_definition_location (ms->file, ms->line, name, &line);
+ = macro_definition_location (ms.file, ms.line, name, &line);
print_macro_definition (name, d, file, line);
}
@@ -232,7 +231,7 @@ info_macro_command (const char *args, int from_tty)
gdb_printf ("The symbol `%s' has no definition as a C/C++"
" preprocessor macro\n"
"at ", name);
- show_pp_source_pos (gdb_stdout, ms->file, ms->line);
+ show_pp_source_pos (gdb_stdout, ms.file, ms.line);
}
}
}
@@ -241,7 +240,7 @@ info_macro_command (const char *args, int from_tty)
static void
info_macros_command (const char *args, int from_tty)
{
- gdb::unique_xmalloc_ptr<struct macro_scope> ms;
+ macro_scope ms;
if (args == NULL)
ms = default_macro_scope ();
@@ -254,10 +253,10 @@ info_macros_command (const char *args, int from_tty)
ms = sal_macro_scope (sals[0]);
}
- if (! ms || ! ms->file || ! ms->file->table)
+ if (!ms.is_valid () || ms.file->table == nullptr)
macro_inform_no_debuginfo ();
else
- macro_for_each_in_scope (ms->file, ms->line, print_macro_definition);
+ macro_for_each_in_scope (ms.file, ms.line, print_macro_definition);
}
@@ -409,9 +408,7 @@ macro_list_command (const char *exp, int from_tty)
/* Initializing the `macrocmd' module. */
-void _initialize_macrocmd ();
-void
-_initialize_macrocmd ()
+INIT_GDB_FILE (macrocmd)
{
/* We introduce a new command prefix, `macro', under which we'll put
the various commands for working with preprocessor macros. */
diff --git a/gdb/macroexp.c b/gdb/macroexp.c
index bcae7ec..0ada15f 100644
--- a/gdb/macroexp.c
+++ b/gdb/macroexp.c
@@ -1,5 +1,5 @@
/* C preprocessor macro expansion for GDB.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GDB.
diff --git a/gdb/macroexp.h b/gdb/macroexp.h
index 6fd5dc2..0d39629 100644
--- a/gdb/macroexp.h
+++ b/gdb/macroexp.h
@@ -1,5 +1,5 @@
/* Interface to C preprocessor macro expansion for GDB.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GDB.
diff --git a/gdb/macroscope.c b/gdb/macroscope.c
index c1b2238..a8b78c9 100644
--- a/gdb/macroscope.c
+++ b/gdb/macroscope.c
@@ -1,5 +1,5 @@
/* Functions for deciding which macros are currently in scope.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GDB.
@@ -34,28 +34,29 @@
struct macro_table *macro_user_macros;
-gdb::unique_xmalloc_ptr<struct macro_scope>
+macro_scope
sal_macro_scope (struct symtab_and_line sal)
{
+ macro_scope result;
struct macro_source_file *main_file, *inclusion;
struct compunit_symtab *cust;
if (sal.symtab == NULL)
- return NULL;
+ return result;
cust = sal.symtab->compunit ();
if (cust->macro_table () == NULL)
- return NULL;
+ return result;
- gdb::unique_xmalloc_ptr<struct macro_scope> ms (XNEW (struct macro_scope));
+ macro_scope ms;
main_file = macro_main (cust->macro_table ());
inclusion = macro_lookup_inclusion (main_file, sal.symtab->filename_for_id);
if (inclusion)
{
- ms->file = inclusion;
- ms->line = sal.line;
+ ms.file = inclusion;
+ ms.line = sal.line;
}
else
{
@@ -73,8 +74,8 @@ sal_macro_scope (struct symtab_and_line sal)
For the time being, though, we'll just treat these as
occurring at the end of the main source file. */
- ms->file = main_file;
- ms->line = -1;
+ ms.file = main_file;
+ ms.line = -1;
complaint (_("symtab found for `%s', but that file\n"
"is not covered in the compilation unit's macro information"),
@@ -85,27 +86,23 @@ sal_macro_scope (struct symtab_and_line sal)
}
-gdb::unique_xmalloc_ptr<struct macro_scope>
-user_macro_scope (void)
+macro_scope
+user_macro_scope ()
{
- gdb::unique_xmalloc_ptr<struct macro_scope> ms (XNEW (struct macro_scope));
- ms->file = macro_main (macro_user_macros);
- ms->line = -1;
- return ms;
+ return { macro_main (macro_user_macros), -1 };
}
-gdb::unique_xmalloc_ptr<struct macro_scope>
-default_macro_scope (void)
+macro_scope
+default_macro_scope ()
{
struct symtab_and_line sal;
- gdb::unique_xmalloc_ptr<struct macro_scope> ms;
frame_info_ptr frame;
- CORE_ADDR pc;
+ std::optional<CORE_ADDR> pc;
/* If there's a selected frame, use its PC. */
frame = deprecated_safe_get_selected_frame ();
- if (frame && get_frame_pc_if_available (frame, &pc))
- sal = find_pc_line (pc, 0);
+ if (frame && (pc = get_frame_pc_if_available (frame)))
+ sal = find_pc_line (*pc, 0);
/* Fall back to the current listing position. */
else
@@ -128,8 +125,8 @@ default_macro_scope (void)
sal.line = cursal.line;
}
- ms = sal_macro_scope (sal);
- if (! ms)
+ macro_scope ms = sal_macro_scope (sal);
+ if (!ms.is_valid ())
ms = user_macro_scope ();
return ms;
@@ -152,9 +149,7 @@ standard_macro_lookup (const char *name, const macro_scope &ms)
return result;
}
-void _initialize_macroscope ();
-void
-_initialize_macroscope ()
+INIT_GDB_FILE (macroscope)
{
macro_user_macros = new_macro_table (NULL, NULL, NULL);
macro_set_main (macro_user_macros, "<user-defined>");
diff --git a/gdb/macroscope.h b/gdb/macroscope.h
index ce9ae33..2cb6a0f 100644
--- a/gdb/macroscope.h
+++ b/gdb/macroscope.h
@@ -1,5 +1,5 @@
/* Interface to functions for deciding which macros are currently in scope.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GDB.
@@ -31,21 +31,25 @@ extern struct macro_table *macro_user_macros;
in scope: a source file (either a main source file or an
#inclusion), and a line number in that file. */
struct macro_scope {
- struct macro_source_file *file;
- int line;
+ struct macro_source_file *file = nullptr;
+ int line = 0;
+
+ /* Return true if this scope is valid. */
+ bool is_valid () const
+ {
+ return file != nullptr;
+ }
};
/* Return a `struct macro_scope' object corresponding to the symtab
and line given in SAL. If we have no macro information for that
- location, or if SAL's pc is zero, return zero. */
-gdb::unique_xmalloc_ptr<struct macro_scope> sal_macro_scope
- (struct symtab_and_line sal);
-
+ location, or if SAL's pc is zero, return an invalid scope. */
+macro_scope sal_macro_scope (struct symtab_and_line sal);
/* Return a `struct macro_scope' object representing just the
user-defined macros. */
-gdb::unique_xmalloc_ptr<struct macro_scope> user_macro_scope (void);
+macro_scope user_macro_scope ();
/* Return a `struct macro_scope' object describing the scope the `macro
expand' and `macro expand-once' commands should use for looking up
@@ -54,7 +58,7 @@ gdb::unique_xmalloc_ptr<struct macro_scope> user_macro_scope (void);
If we have no macro information for the current location, return
the user macro scope. */
-gdb::unique_xmalloc_ptr<struct macro_scope> default_macro_scope (void);
+macro_scope default_macro_scope ();
/* Look up the definition of the macro named NAME in scope at the source
location given by MS. */
diff --git a/gdb/macrotab.c b/gdb/macrotab.c
index 37ae0f2..06f5307 100644
--- a/gdb/macrotab.c
+++ b/gdb/macrotab.c
@@ -1,5 +1,5 @@
/* C preprocessor macro tables for GDB.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GDB.
diff --git a/gdb/macrotab.h b/gdb/macrotab.h
index 1263ba6..43bbe4e 100644
--- a/gdb/macrotab.h
+++ b/gdb/macrotab.h
@@ -1,5 +1,5 @@
/* Interface to C preprocessor macro tables for GDB.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GDB.
diff --git a/gdb/main.c b/gdb/main.c
index b173eb6..3b861fb 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -1,6 +1,6 @@
/* Top level stuff for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -19,6 +19,7 @@
#include "annotate.h"
#include "exceptions.h"
+#include "gdbsupport/common-inferior.h"
#include "top.h"
#include "ui.h"
#include "target.h"
@@ -29,7 +30,6 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <ctype.h>
#include "gdbsupport/event-loop.h"
#include "ui-out.h"
@@ -59,6 +59,7 @@
#include "serial.h"
#include "cli-out.h"
#include "bt-utils.h"
+#include "terminal.h"
/* The selected interpreter. */
std::string interpreter_p;
@@ -399,7 +400,7 @@ start_event_loop ()
try
{
- result = gdb_do_one_event ();
+ result = current_interpreter ()->do_one_event ();
}
catch (const gdb_exception_forced_quit &ex)
{
@@ -420,6 +421,7 @@ start_event_loop ()
get around to resetting the prompt, which leaves readline
in a messed-up state. Reset it here. */
current_ui->prompt_state = PROMPT_NEEDED;
+ current_ui->line_buffer.clear ();
top_level_interpreter ()->on_command_error ();
/* This call looks bizarre, but it is required. If the user
entered a command that caused an error,
@@ -616,9 +618,20 @@ captured_main_1 (struct captured_main_args *context)
char **argv = context->argv;
static int quiet = 0;
- static int set_args = 0;
static int inhibit_home_gdbinit = 0;
+ /* Has the user passed inferior arguments on the command line. */
+ enum {
+ /* No arguments passed. */
+ NO_ARGS,
+
+ /* Arguments passed with --args. */
+ SET_ESC_ARGS,
+
+ /* Arguments passed with --no-escape-args. */
+ SET_NO_ESC_ARGS
+ } set_args = NO_ARGS;
+
/* Pointers to various arguments from command line. */
char *symarg = NULL;
char *execarg = NULL;
@@ -672,6 +685,8 @@ captured_main_1 (struct captured_main_args *context)
/* Ensure stderr is unbuffered. A Cygwin pty or pipe is implemented
as a Windows pipe, and Windows buffers on pipes. */
setvbuf (stderr, NULL, _IONBF, BUFSIZ);
+
+ windows_initialize_console ();
#endif
/* Note: `error' cannot be called before this point, because the
@@ -766,7 +781,12 @@ captured_main_1 (struct captured_main_args *context)
OPT_EIX,
OPT_EIEX,
OPT_READNOW,
- OPT_READNEVER
+ OPT_READNEVER,
+ OPT_SET_ESC_ARGS,
+ OPT_SET_NO_ESC_ARGS,
+#ifdef USE_WIN32API
+ OPT_BINARY_OUTPUT,
+#endif
};
/* This struct requires int* in the struct, but write_files is a bool.
So use this temporary int that we write back after argument parsing. */
@@ -839,9 +859,13 @@ captured_main_1 (struct captured_main_args *context)
{"windows", no_argument, NULL, OPT_WINDOWS},
{"statistics", no_argument, 0, OPT_STATISTICS},
{"write", no_argument, &write_files_1, 1},
- {"args", no_argument, &set_args, 1},
+ {"args", no_argument, nullptr, OPT_SET_ESC_ARGS},
+ {"no-escape-args", no_argument, nullptr, OPT_SET_NO_ESC_ARGS},
{"l", required_argument, 0, 'l'},
{"return-child-result", no_argument, &return_child_result, 1},
+#ifdef USE_WIN32API
+ {"binary-output", no_argument, 0, OPT_BINARY_OUTPUT},
+#endif
{0, no_argument, 0, 0}
};
@@ -849,9 +873,14 @@ captured_main_1 (struct captured_main_args *context)
{
int option_index;
+ /* If the previous argument was --args or --no-escape-args, then
+ stop argument processing. */
+ if (set_args != NO_ARGS)
+ break;
+
c = getopt_long_only (argc, argv, "",
long_options, &option_index);
- if (c == EOF || set_args)
+ if (c == EOF)
break;
/* Long option that takes an argument. */
@@ -932,6 +961,12 @@ captured_main_1 (struct captured_main_args *context)
case OPT_EIEX:
cmdarg_vec.emplace_back (CMDARG_EARLYINIT_COMMAND, optarg);
break;
+ case OPT_SET_ESC_ARGS:
+ set_args = SET_ESC_ARGS;
+ break;
+ case OPT_SET_NO_ESC_ARGS:
+ set_args = SET_NO_ESC_ARGS;
+ break;
case 'B':
batch_flag = batch_silent = 1;
gdb_stdout = new null_file ();
@@ -1015,6 +1050,12 @@ captured_main_1 (struct captured_main_args *context)
}
break;
+#ifdef USE_WIN32API
+ case OPT_BINARY_OUTPUT:
+ set_output_translation_mode_binary ();
+ break;
+#endif
+
case '?':
error (_("Use `%s --help' for a complete list of options."),
gdb_program_name);
@@ -1065,7 +1106,7 @@ captured_main_1 (struct captured_main_args *context)
/* Now that gdb_init has created the initial inferior, we're in
position to set args for that inferior. */
- if (set_args)
+ if (set_args != NO_ARGS)
{
/* The remaining options are the command-line options for the
inferior. The first one is the sym/exec file, and the rest
@@ -1077,10 +1118,9 @@ captured_main_1 (struct captured_main_args *context)
symarg = argv[optind];
execarg = argv[optind];
++optind;
- current_inferior ()->set_args
- (gdb::array_view<char * const> (&argv[optind], argc - optind),
- startup_with_shell);
- }
+ gdb::array_view<char * const> arg_view (&argv[optind], argc - optind);
+ current_inferior ()->set_args (arg_view, (set_args == SET_ESC_ARGS));
+ }
else
{
/* OK, that's all the options. */
@@ -1124,7 +1164,7 @@ captured_main_1 (struct captured_main_args *context)
/* Do these (and anything which might call wrap_here or *_filtered)
after initialize_all_files() but before the interpreter has been
- installed. Otherwize the help/version messages will be eaten by
+ installed. Otherwise the help/version messages will be eaten by
the interpreter's output handler. */
if (print_version)
@@ -1250,7 +1290,7 @@ captured_main_1 (struct captured_main_args *context)
If pid_or_core_arg's first character is a digit, try attach
first and then corefile. Otherwise try just corefile. */
- if (isdigit (pid_or_core_arg[0]))
+ if (c_isdigit (pid_or_core_arg[0]))
{
ret = catch_command_errors (attach_command, pid_or_core_arg,
!batch_flag);
@@ -1302,8 +1342,8 @@ captured_main_1 (struct captured_main_args *context)
We wait until now because it is common to add to the source search
path in local_gdbinit. */
global_auto_load = save_auto_load;
- for (objfile *objfile : current_program_space->objfiles ())
- load_auto_scripts_for_objfile (objfile);
+ for (objfile &objfile : current_program_space->objfiles ())
+ load_auto_scripts_for_objfile (&objfile);
/* Process '-x' and '-ex' options. */
execute_cmdargs (&cmdarg_vec, CMDARG_FILE, CMDARG_COMMAND, &ret);
@@ -1327,10 +1367,8 @@ captured_main_1 (struct captured_main_args *context)
}
static void
-captured_main (void *data)
+captured_main (captured_main_args *context)
{
- struct captured_main_args *context = (struct captured_main_args *) data;
-
captured_main_1 (context);
/* NOTE: cagney/1999-11-07: There is probably no reason for not
@@ -1399,7 +1437,8 @@ This is the GNU debugger. Usage:\n\n\
gdb_puts (_("\
Selection of debuggee and its files:\n\n\
--args Arguments after executable-file are passed to inferior.\n\
- --core=COREFILE Analyze the core dump COREFILE.\n\
+ --no-escape-args Like --args, but arguments are not escaped.\n \
+ --core=COREFILE Analyze the core dump COREFILE.\n \
--exec=EXECFILE Use EXECFILE as the executable.\n\
--pid=PID Attach to running process PID.\n\
--directory=DIR Search for source files in DIR.\n\
@@ -1456,8 +1495,13 @@ Remote debugging options:\n\n\
Other options:\n\n\
--cd=DIR Change current directory to DIR.\n\
--data-directory=DIR, -D\n\
- Set GDB's data-directory to DIR.\n\
-"), stream);
+ Set GDB's data-directory to DIR.\n"
+#ifdef USE_WIN32API
+"\
+ --binary-output Set the translation mode of stdout/stderr to binary,\n\
+ disabling CRLF translation.\n"
+#endif
+), stream);
gdb_puts (_("\n\
At startup, GDB reads the following early init files and executes their\n\
commands:\n\
diff --git a/gdb/main.h b/gdb/main.h
index 35dfe9d..0f50b71 100644
--- a/gdb/main.h
+++ b/gdb/main.h
@@ -1,6 +1,6 @@
/* Main interface for GDB, the GNU debugger.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -44,6 +44,9 @@ extern std::string interpreter_p;
return value is in malloc'ed storage. */
extern char *windows_get_absolute_argv0 (const char *argv0);
+/* Initialize Windows console settings. */
+extern void windows_initialize_console ();
+
extern void set_gdb_data_directory (const char *new_data_dir);
#endif /* GDB_MAIN_H */
diff --git a/gdb/maint-test-options.c b/gdb/maint-test-options.c
index da9765e..97236c9 100644
--- a/gdb/maint-test-options.c
+++ b/gdb/maint-test-options.c
@@ -1,6 +1,6 @@
/* Maintenance commands for testing the options framework.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -429,9 +429,7 @@ maintenance_test_options_unknown_is_operand_command_completer
static cmd_list_element *maintenance_test_options_list;
-void _initialize_maint_test_options ();
-void
-_initialize_maint_test_options ()
+INIT_GDB_FILE (maint_test_options)
{
cmd_list_element *cmd;
diff --git a/gdb/maint-test-settings.c b/gdb/maint-test-settings.c
index 1aaacc2..c7b12c6 100644
--- a/gdb/maint-test-settings.c
+++ b/gdb/maint-test-settings.c
@@ -1,6 +1,6 @@
/* Maintenance commands for testing the settings framework.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -78,9 +78,7 @@ maintenance_show_test_settings_value_cmd
}
-void _initialize_maint_test_settings ();
-void
-_initialize_maint_test_settings ()
+INIT_GDB_FILE (maint_test_settings)
{
maintenance_test_settings_filename = "/foo/bar";
diff --git a/gdb/maint.c b/gdb/maint.c
index 48de207..8484793 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -1,6 +1,6 @@
/* Support for GDB maintenance commands.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
Written by Fred Fish at Cygnus Support.
@@ -21,15 +21,12 @@
#include "arch-utils.h"
-#include <ctype.h>
#include <cmath>
#include <signal.h>
#include "command.h"
#include "symtab.h"
#include "block.h"
#include "gdbtypes.h"
-#include "demangle.h"
-#include "gdbcore.h"
#include "expression.h"
#include "language.h"
#include "symfile.h"
@@ -41,6 +38,8 @@
#include "inferior.h"
#include "gdbsupport/thread-pool.h"
#include "event-top.h"
+#include "cp-support.h"
+#include "gdbcore.h"
#include "cli/cli-decode.h"
#include "cli/cli-utils.h"
@@ -110,6 +109,18 @@ maintenance_demangle (const char *args, int from_tty)
styled_string (command_style.style (), "demangle"));
}
+/* Print the canonical form of a name. */
+
+static void
+maintenance_canonicalize (const char *args, int from_tty)
+{
+ gdb::unique_xmalloc_ptr<char> canon = cp_canonicalize_string (args);
+ if (canon == nullptr)
+ gdb_printf ("No change.\n");
+ else
+ gdb_printf ("canonical = %s\n", canon.get ());
+}
+
static void
maintenance_time_display (const char *args, int from_tty)
{
@@ -454,19 +465,19 @@ maintenance_info_sections (const char *arg, int from_tty)
gdb::option::process_options
(&arg, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, group);
- for (objfile *ofile : current_program_space->objfiles ())
+ for (objfile &ofile : current_program_space->objfiles ())
{
- if (ofile->obfd == current_program_space->exec_bfd ())
- maint_print_all_sections (_("Exec file: "), ofile->obfd.get (),
- ofile, arg);
+ if (ofile.obfd == current_program_space->exec_bfd ())
+ maint_print_all_sections (_("Exec file: "), ofile.obfd.get (),
+ &ofile, arg);
else if (opts.all_objects)
- maint_print_all_sections (_("Object file: "), ofile->obfd.get (),
- ofile, arg);
+ maint_print_all_sections (_("Object file: "), ofile.obfd.get (),
+ &ofile, arg);
}
- if (current_program_space->core_bfd () != nullptr)
- maint_print_all_sections (_("Core file: "),
- current_program_space->core_bfd (), nullptr, arg);
+ bfd *cbfd = get_inferior_core_bfd (current_inferior ());
+ if (cbfd != nullptr)
+ maint_print_all_sections (_("Core file: "), cbfd, nullptr, arg);
}
/* Implement the "maintenance info target-sections" command. */
@@ -560,9 +571,9 @@ maintenance_translate_address (const char *arg, int from_tty)
sect = NULL;
p = arg;
- if (!isdigit (*p))
+ if (!c_isdigit (*p))
{ /* See if we have a valid section name. */
- while (*p && !isspace (*p)) /* Find end of section name. */
+ while (*p && !c_isspace (*p)) /* Find end of section name. */
p++;
if (*p == '\000') /* End of command? */
error (_("Need to specify section name and address"));
@@ -570,10 +581,10 @@ maintenance_translate_address (const char *arg, int from_tty)
int arg_len = p - arg;
p = skip_spaces (p + 1);
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section *iter : objfile->sections ())
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &iter : objfile.sections ())
{
- if (strncmp (iter->the_bfd_section->name, arg, arg_len) == 0)
+ if (strncmp (iter.the_bfd_section->name, arg, arg_len) == 0)
goto found;
}
@@ -909,9 +920,9 @@ maintenance_show_worker_threads (struct ui_file *file, int from_tty,
}
-/* If true, display time usage both at startup and for each command. */
+/* See maint.h. */
-static bool per_command_time;
+bool per_command_time;
/* If true, display space usage both at startup and for each command. */
@@ -959,14 +970,14 @@ count_symtabs_and_blocks (int *nr_symtabs_ptr, int *nr_compunit_symtabs_ptr,
current_program_space may be NULL. */
if (current_program_space != NULL)
{
- for (objfile *o : current_program_space->objfiles ())
+ for (objfile &o : current_program_space->objfiles ())
{
- for (compunit_symtab *cu : o->compunits ())
+ for (compunit_symtab &cu : o.compunits ())
{
++nr_compunit_symtabs;
- nr_blocks += cu->blockvector ()->num_blocks ();
- nr_symtabs += std::distance (cu->filetabs ().begin (),
- cu->filetabs ().end ());
+ nr_blocks += cu.blockvector ()->num_blocks ();
+ nr_symtabs += std::distance (cu.filetabs ().begin (),
+ cu.filetabs ().end ());
}
}
}
@@ -1140,6 +1151,72 @@ set_per_command_cmd (const char *args, int from_tty)
}
}
+/* Handle "mt set per-command time". Warn if per-thread run time
+ information is not possible. */
+
+static void
+maintenance_set_command_time_cmd (const char *args, int from_tty,
+ cmd_list_element *c)
+{
+ /* No point warning if this platform can't use multiple threads at
+ all. */
+#if CXX_STD_THREAD
+ static bool already_warned = false;
+ if (per_command_time
+ && !get_run_time_thread_scope_available ()
+ && !already_warned)
+ {
+ warning (_("\
+per-thread run time information not available on this platform"));
+ already_warned = true;
+ }
+#endif
+}
+
+/* See maint.h. */
+
+scoped_time_it::scoped_time_it (const char *what, bool enabled)
+ : m_enabled (enabled),
+ m_what (what),
+ m_start_wall (m_enabled
+ ? std::chrono::steady_clock::now ()
+ : std::chrono::steady_clock::time_point ())
+{
+ if (m_enabled)
+ get_run_time (m_start_user, m_start_sys, run_time_scope::thread);
+}
+
+/* See maint.h. */
+
+scoped_time_it::~scoped_time_it ()
+{
+ if (!m_enabled)
+ return;
+
+ namespace chr = std::chrono;
+ auto end_wall = chr::steady_clock::now ();
+
+ user_cpu_time_clock::time_point end_user;
+ system_cpu_time_clock::time_point end_sys;
+ get_run_time (end_user, end_sys, run_time_scope::thread);
+
+ auto user = end_user - m_start_user;
+ auto sys = end_sys - m_start_sys;
+ auto wall = end_wall - m_start_wall;
+ auto user_ms = chr::duration_cast<chr::milliseconds> (user).count ();
+ auto sys_ms = chr::duration_cast<chr::milliseconds> (sys).count ();
+ auto wall_ms = chr::duration_cast<chr::milliseconds> (wall).count ();
+ auto user_plus_sys_ms = user_ms + sys_ms;
+
+ auto str
+ = string_printf ("Time for \"%s\": wall %.03f, user %.03f, sys %.03f, "
+ "user+sys %.03f, %.01f %% CPU\n",
+ m_what, wall_ms / 1000.0, user_ms / 1000.0,
+ sys_ms / 1000.0, user_plus_sys_ms / 1000.0,
+ user_plus_sys_ms * 100.0 / wall_ms);
+ gdb_stdlog->write_async_safe (str.data (), str.size ());
+}
+
/* Options affecting the "maintenance selftest" command. */
struct maintenance_selftest_options
@@ -1224,9 +1301,7 @@ Selftests have been disabled for this build.\n"));
}
-void _initialize_maint_cmds ();
-void
-_initialize_maint_cmds ()
+INIT_GDB_FILE (maint_cmds)
{
struct cmd_list_element *cmd;
@@ -1345,6 +1420,12 @@ This command has been moved to \"demangle\"."),
&maintenancelist);
deprecate_cmd (cmd, "demangle");
+ cmd = add_cmd ("canonicalize", class_maintenance, maintenance_canonicalize,
+ _("\
+Show the canonical form of a C++ name.\n\
+Usage: maintenance canonicalize NAME"),
+ &maintenancelist);
+
add_prefix_cmd ("per-command", class_maintenance, set_per_command_cmd, _("\
Per-command statistics settings."),
&per_command_setlist,
@@ -1362,7 +1443,7 @@ Show whether to display per-command execution time."),
_("\
If enabled, the execution time for each command will be\n\
displayed following the command's output."),
- NULL, NULL,
+ maintenance_set_command_time_cmd, NULL,
&per_command_setlist, &per_command_showlist);
add_setshow_boolean_cmd ("space", class_maintenance,
diff --git a/gdb/maint.h b/gdb/maint.h
index 5529d8a..6930018 100644
--- a/gdb/maint.h
+++ b/gdb/maint.h
@@ -1,5 +1,5 @@
/* Support for GDB maintenance commands.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,6 +22,9 @@
#include "gdbsupport/run-time-clock.h"
#include <chrono>
+struct obj_section;
+struct objfile;
+
extern void set_per_command_time (int);
extern void set_per_command_space (int);
@@ -58,7 +61,9 @@ class scoped_command_stats
bool m_symtab_enabled : 1;
run_time_clock::time_point m_start_cpu_time;
std::chrono::steady_clock::time_point m_start_wall_time;
+#ifdef HAVE_USEFUL_SBRK
long m_start_space;
+#endif
/* Total number of symtabs (over all objfiles). */
int m_start_nr_symtabs;
/* A count of the compunits. */
@@ -67,6 +72,37 @@ class scoped_command_stats
int m_start_nr_blocks;
};
+/* If true, display time usage both at startup and for each command. */
+
+extern bool per_command_time;
+
+/* RAII structure used to measure the time spent by the current thread in a
+ given scope. */
+
+struct scoped_time_it
+{
+ /* WHAT is the prefix to show when the summary line is printed. */
+ scoped_time_it (const char *what, bool enabled = per_command_time);
+
+ DISABLE_COPY_AND_ASSIGN (scoped_time_it);
+ ~scoped_time_it ();
+
+private:
+ bool m_enabled;
+
+ /* Summary line prefix. */
+ const char *m_what;
+
+ /* User time at the start of execution. */
+ user_cpu_time_clock::time_point m_start_user;
+
+ /* System time at the start of execution. */
+ system_cpu_time_clock::time_point m_start_sys;
+
+ /* Wall-clock time at the start of execution. */
+ std::chrono::steady_clock::time_point m_start_wall;
+};
+
extern obj_section *maint_obj_section_from_bfd_section (bfd *abfd,
asection *asection,
objfile *ofile);
diff --git a/gdb/make-init-c b/gdb/make-init-c
index 3458333..6834b43 100755
--- a/gdb/make-init-c
+++ b/gdb/make-init-c
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
@@ -25,12 +25,13 @@
#
# Where SOURCE-FILES is the list of source files to extract init functions from.
#
-# Formatting conventions: The name of the initialization routines must begin
-# with `_initialize_`, must start in column zero, and be followed with exactly
-# ` ()`. For example:
+
+# An initialization function is introduced using the "INIT_GDB_FILE"
+# macro. In ordinary code this expands to a function declaration (to
+# avoid a warning) and then the start of a definition. In the
+# generated init.c, though, it is expanded differently. For example:
#
-# void
-# _initialize_foo ()
+# INIT_GDB_FILE (foo)
# {
# ...
# }
@@ -43,19 +44,21 @@ echo "/* Do not modify this file. */"
echo "/* It is created automatically by the Makefile. */"
echo "#include <algorithm>"
echo ""
-sed -n -e 's/^\(_initialize_[a-zA-Z0-9_]*\) ()$/\1/p' "$@" | while read -r name; do
- echo "extern initialize_file_ftype $name;"
-done
+echo "#undef INIT_GDB_FILE"
+echo "#define INIT_GDB_FILE(NAME) extern void _initialize_ ## NAME ();"
+grep -h '^[ ]*INIT_GDB_FILE\b' "$@"
echo ""
echo "void initialize_all_files ();"
echo "void"
echo "initialize_all_files ()"
echo "{"
+echo " typedef void initialize_file_ftype (void);"
+echo ""
echo " std::vector<initialize_file_ftype *> functions ="
echo " {"
-sed -n -e 's/^\(_initialize_[a-zA-Z0-9_]*\) ()$/\1/p' "$@" | while read -r name; do
- echo " $name,"
-done
+echo "#undef INIT_GDB_FILE"
+echo "#define INIT_GDB_FILE(NAME) _initialize_ ## NAME,"
+grep -h '^[ ]*INIT_GDB_FILE\b' "$@"
echo " };"
echo ""
echo " /* If GDB_REVERSE_INIT_FUNCTIONS is set (any value), reverse the"
diff --git a/gdb/make-target-delegates.py b/gdb/make-target-delegates.py
index fc69cb3..17babab 100755
--- a/gdb/make-target-delegates.py
+++ b/gdb/make-target-delegates.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index d5a0740..9504e5e 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -1,6 +1,6 @@
/* Read a symbol table in ECOFF format (Third-Eye).
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
Original version contributed by Alessandro Forin (af@cs.cmu.edu) at
CMU. Major work by Per Bothner, John Gilmore and Ian Lance Taylor
@@ -248,7 +248,7 @@ static struct type *parse_type (int, union aux_ext *, unsigned int, int *,
int, const char *);
static struct symbol *mylookup_symbol (const char *, const struct block *,
- domain_enum, enum address_class);
+ domain_enum, location_class);
static void sort_blocks (struct symtab *);
@@ -329,7 +329,7 @@ fdr_name (FDR *f)
/* Read in and parse the symtab of the file OBJFILE. Symbols from
different sections are relocated via the SECTION_OFFSETS. */
-void
+static void
mdebug_build_psymtabs (minimal_symbol_reader &reader,
struct objfile *objfile,
const struct ecoff_debug_swap *swap,
@@ -550,7 +550,7 @@ static const struct symbol_register_ops mdebug_register_funcs = {
mdebug_reg_to_regnum
};
-/* The "aclass" indices for computed symbols. */
+/* The "loc_class" indices for computed symbols. */
static int mdebug_register_index;
static int mdebug_regparm_index;
@@ -559,11 +559,11 @@ static int mdebug_regparm_index;
static void
add_data_symbol (SYMR *sh, union aux_ext *ax, int bigend,
- struct symbol *s, int aclass_index, struct block *b,
+ struct symbol *s, int loc_class_index, struct block *b,
struct objfile *objfile, const char *name)
{
s->set_domain (VAR_DOMAIN);
- s->set_aclass_index (aclass_index);
+ s->set_loc_class_index (loc_class_index);
add_symbol (s, top_stack->cur_st, b);
/* Type could be missing if file is compiled without debugging info. */
@@ -688,19 +688,19 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
{
case scRegister:
/* Pass by value in register. */
- s->set_aclass_index (mdebug_register_index);
+ s->set_loc_class_index (mdebug_register_index);
break;
case scVar:
/* Pass by reference on stack. */
- s->set_aclass_index (LOC_REF_ARG);
+ s->set_loc_class_index (LOC_REF_ARG);
break;
case scVarRegister:
/* Pass by reference in register. */
- s->set_aclass_index (mdebug_regparm_index);
+ s->set_loc_class_index (mdebug_regparm_index);
break;
default:
/* Pass by value on stack. */
- s->set_aclass_index (LOC_ARG);
+ s->set_loc_class_index (LOC_ARG);
break;
}
s->set_value_longest (svalue);
@@ -711,7 +711,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
case stLabel: /* label, goes into current block. */
s = new_symbol (name);
s->set_domain (LABEL_DOMAIN); /* So that it can be used */
- s->set_aclass_index (LOC_LABEL); /* but not misused. */
+ s->set_loc_class_index (LOC_LABEL); /* but not misused. */
s->set_section_index (section_index);
s->set_value_address (sh->value);
s->set_type (builtin_type (objfile)->builtin_int);
@@ -753,7 +753,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
}
s = new_symbol (name);
s->set_domain (FUNCTION_DOMAIN);
- s->set_aclass_index (LOC_BLOCK);
+ s->set_loc_class_index (LOC_BLOCK);
s->set_section_index (section_index);
/* Type of the return value. */
if (SC_IS_UNDEF (sh->sc) || sh->sc == scNil)
@@ -1034,7 +1034,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
t->set_code (type_code);
t->set_length (sh->value);
t->alloc_fields (nfields);
- f = t->fields();
+ f = t->fields ().data ();
if (type_code == TYPE_CODE_ENUM)
{
@@ -1074,7 +1074,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
enum_sym->set_linkage_name
(obstack_strdup (&mdebugread_objfile->objfile_obstack,
f->name ()));
- enum_sym->set_aclass_index (LOC_CONST);
+ enum_sym->set_loc_class_index (LOC_CONST);
enum_sym->set_type (t);
enum_sym->set_domain (VAR_DOMAIN);
enum_sym->set_value_longest (tsym.value);
@@ -1107,7 +1107,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
s = new_symbol (name);
s->set_domain (STRUCT_DOMAIN);
- s->set_aclass_index (LOC_TYPEDEF);
+ s->set_loc_class_index (LOC_TYPEDEF);
s->set_value_longest (0);
s->set_type (t);
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
@@ -1119,7 +1119,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
case_stBlock_code:
found_ecoff_debugging_info = 1;
- /* Beginnning of (code) block. Value of symbol
+ /* Beginning of (code) block. Value of symbol
is the displacement from procedure start. */
push_parse_stack ();
@@ -1164,7 +1164,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
/* Make up special symbol to contain procedure specific info. */
s = new_symbol (MDEBUG_EFI_SYMBOL_NAME);
s->set_domain (LABEL_DOMAIN);
- s->set_aclass_index (LOC_CONST);
+ s->set_loc_class_index (LOC_CONST);
s->set_type (builtin_type (mdebugread_objfile)->builtin_void);
e = OBSTACK_ZALLOC (&mdebugread_objfile->objfile_obstack,
mdebug_extra_func_info);
@@ -1297,7 +1297,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
break;
s = new_symbol (name);
s->set_domain (TYPE_DOMAIN);
- s->set_aclass_index (LOC_TYPEDEF);
+ s->set_loc_class_index (LOC_TYPEDEF);
s->set_value_block (top_stack->cur_block);
s->set_type (t);
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
@@ -2122,7 +2122,7 @@ parse_external (EXTR *es, int bigend, const section_offsets &section_offsets,
/* There is no need to parse the external procedure symbols.
If they are from objects compiled without -g, their index will
be indexNil, and the symbol definition from the minimal symbol
- is preferrable (yielding a function returning int instead of int).
+ is preferable (yielding a function returning int instead of int).
If the index points to a local procedure symbol, the local
symbol already provides the correct type.
Note that the index of the external procedure symbol points
@@ -2488,7 +2488,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
switch (ext_in->asym.st)
{
case stProc:
- /* Beginnning of Procedure */
+ /* Beginning of Procedure */
break;
case stStaticProc:
/* Load time only static procs */
@@ -2938,7 +2938,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
name SOs. */
/* Some other compilers (C++ ones in particular) emit
- useless SOs for non-existant .c files. We ignore
+ useless SOs for non-existent .c files. We ignore
all subsequent SOs that immediately follow the
first. */
@@ -3369,7 +3369,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
for (cur_sdx = 0; cur_sdx < fh->csym;)
{
char *sym_name;
- enum address_class theclass;
+ location_class loc_class;
unrelocated_addr minsym_value;
int section = -1;
@@ -3526,7 +3526,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
reader.record_with_info (sym_name, minsym_value,
mst_file_bss,
SECT_OFF_BSS (objfile));
- theclass = LOC_STATIC;
+ loc_class = LOC_STATIC;
break;
case stIndirect: /* Irix5 forward declaration */
@@ -3538,11 +3538,11 @@ parse_partial_symbols (minimal_symbol_reader &reader,
structs from alpha and mips cc. */
if (sh.iss == 0 || has_opaque_xref (fh, &sh))
goto skip;
- theclass = LOC_TYPEDEF;
+ loc_class = LOC_TYPEDEF;
break;
case stConstant: /* Constant decl */
- theclass = LOC_CONST;
+ loc_class = LOC_CONST;
break;
case stUnion:
@@ -3600,7 +3600,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
}
/* Use this gdb symbol. */
pst->add_psymbol (sym_name, true,
- VAR_DOMAIN, theclass, section,
+ VAR_DOMAIN, loc_class, section,
psymbol_placement::STATIC,
unrelocated_addr (sh.value),
psymtab_language,
@@ -3616,7 +3616,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
PST_PRIVATE (save_pst)->extern_tab = ext_ptr;
for (; --cur_sdx >= 0; ext_ptr++)
{
- enum address_class theclass;
+ location_class loc_class;
SYMR *psh;
CORE_ADDR svalue;
int section;
@@ -3663,7 +3663,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
Ignore them, as parse_external will ignore them too. */
continue;
case stLabel:
- theclass = LOC_LABEL;
+ loc_class = LOC_LABEL;
break;
default:
unknown_ext_complaint (debug_info->ssext + psh->iss);
@@ -3675,12 +3675,12 @@ parse_partial_symbols (minimal_symbol_reader &reader,
if (SC_IS_COMMON (psh->sc))
continue;
- theclass = LOC_STATIC;
+ loc_class = LOC_STATIC;
break;
}
char *sym_name = debug_info->ssext + psh->iss;
pst->add_psymbol (sym_name, true,
- VAR_DOMAIN, theclass,
+ VAR_DOMAIN, loc_class,
section,
psymbol_placement::GLOBAL,
unrelocated_addr (svalue),
@@ -3991,7 +3991,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
struct symbol *s = new_symbol (MDEBUG_EFI_SYMBOL_NAME);
s->set_domain (LABEL_DOMAIN);
- s->set_aclass_index (LOC_CONST);
+ s->set_loc_class_index (LOC_CONST);
s->set_type (builtin_type (objfile)->builtin_void);
s->set_value_bytes ((gdb_byte *) e);
e->pdr.framereg = -1;
@@ -4464,7 +4464,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
static struct symbol *
mylookup_symbol (const char *name, const struct block *block,
- domain_enum domain, enum address_class theclass)
+ domain_enum domain, location_class loc_class)
{
int inc;
@@ -4473,14 +4473,14 @@ mylookup_symbol (const char *name, const struct block *block,
{
if (sym->linkage_name ()[0] == inc
&& sym->domain () == domain
- && sym->aclass () == theclass
+ && sym->loc_class () == loc_class
&& strcmp (sym->linkage_name (), name) == 0)
return sym;
}
block = block->superblock ();
if (block)
- return mylookup_symbol (name, block, domain, theclass);
+ return mylookup_symbol (name, block, domain, loc_class);
return 0;
}
@@ -4623,12 +4623,13 @@ sort_blocks (struct symtab *s)
static struct compunit_symtab *
new_symtab (const char *name, int maxlines, struct objfile *objfile)
{
- struct compunit_symtab *cust = allocate_compunit_symtab (objfile, name);
+ auto cusymtab = std::make_unique<compunit_symtab> (objfile, name);
struct symtab *symtab;
struct blockvector *bv;
enum language lang;
- add_compunit_symtab_to_objfile (cust);
+ struct compunit_symtab *cust
+ = add_compunit_symtab_to_objfile (std::move (cusymtab));
symtab = allocate_symtab (cust, name);
symtab->set_linetable (new_linetable (maxlines));
@@ -4792,9 +4793,28 @@ elfmdebug_build_psymtabs (struct objfile *objfile,
reader.install ();
}
-void _initialize_mdebugread ();
+/* see mdebugread.h. */
+
void
-_initialize_mdebugread ()
+mipsmdebug_build_psymtabs (struct objfile *objfile,
+ const struct ecoff_debug_swap *swap,
+ struct ecoff_debug_info *info)
+{
+ bfd *abfd = objfile->obfd.get ();
+
+ minimal_symbol_reader reader (objfile);
+
+ if (!(*swap->read_debug_info) (abfd, nullptr,
+ info))
+ error (_("Error reading ECOFF debugging information: %s"),
+ bfd_errmsg (bfd_get_error ()));
+
+ mdebug_build_psymtabs (reader, objfile, swap, info);
+
+ reader.install ();
+}
+
+INIT_GDB_FILE (mdebugread)
{
mdebug_register_index
= register_symbol_register_impl (LOC_REGISTER, &mdebug_register_funcs);
diff --git a/gdb/mdebugread.h b/gdb/mdebugread.h
index 4f43422..f7e9f98 100644
--- a/gdb/mdebugread.h
+++ b/gdb/mdebugread.h
@@ -1,6 +1,6 @@
/* Read a symbol table in ECOFF format (Third-Eye).
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -37,13 +37,38 @@ struct mdebug_extra_func_info
#define MDEBUG_EFI_SYMBOL_NAME "__GDB_EFI_INFO__"
-extern void mdebug_build_psymtabs (minimal_symbol_reader &,
- struct objfile *,
- const struct ecoff_debug_swap *,
- struct ecoff_debug_info *);
+#if defined(MDEBUG_FORMAT_AVAILABLE)
extern void elfmdebug_build_psymtabs (struct objfile *,
const struct ecoff_debug_swap *,
asection *);
+/* Read ECOFF debugging information from a BFD section. This is
+ called from mipsread.c. It parses the section into a
+ ecoff_debug_info struct, and then lets the rest of the file handle
+ it as normal. */
+extern void mipsmdebug_build_psymtabs (struct objfile *,
+ const struct ecoff_debug_swap *,
+ struct ecoff_debug_info *);
+
+#else /* MDEBUG_FORMAT_AVAILABLE */
+
+static inline void
+elfmdebug_build_psymtabs (struct objfile *,
+ const struct ecoff_debug_swap *,
+ asection *)
+{
+ warning (_("No mdebug support available"));
+}
+
+static inline void
+mipsmdebug_build_psymtabs (struct objfile *,
+ const struct ecoff_debug_swap *,
+ struct ecoff_debug_info *)
+{
+ warning (_("No mdebug support available"));
+}
+
+#endif /* MDEBUG_FORMAT_AVAILABLE */
+
#endif /* GDB_MDEBUGREAD_H */
diff --git a/gdb/mem-break.c b/gdb/mem-break.c
index 712ad00..25baa03 100644
--- a/gdb/mem-break.c
+++ b/gdb/mem-break.c
@@ -1,6 +1,6 @@
/* Simulate breakpoints by patching locations in the target system, for GDB.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by John Gilmore.
diff --git a/gdb/memattr.c b/gdb/memattr.c
index 3499929..9d26d31 100644
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -1,6 +1,6 @@
/* Memory attributes support, for GDB.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -592,9 +592,7 @@ delete_mem_command (const char *args, int from_tty)
static struct cmd_list_element *mem_set_cmdlist;
static struct cmd_list_element *mem_show_cmdlist;
-void _initialize_mem ();
-void
-_initialize_mem ()
+INIT_GDB_FILE (mem)
{
add_com ("mem", class_vars, mem_command, _("\
Define or reset attributes for memory regions.\n\
diff --git a/gdb/memattr.h b/gdb/memattr.h
index a6c9e6d..0cf3b3e 100644
--- a/gdb/memattr.h
+++ b/gdb/memattr.h
@@ -1,6 +1,6 @@
/* Memory attributes support, for GDB.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/memory-map.c b/gdb/memory-map.c
index 26c49db..7d4d305 100644
--- a/gdb/memory-map.c
+++ b/gdb/memory-map.c
@@ -1,6 +1,6 @@
/* Routines for handling XML memory maps provided by target.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/memory-map.h b/gdb/memory-map.h
index 59fcd4a..ccfad4f 100644
--- a/gdb/memory-map.h
+++ b/gdb/memory-map.h
@@ -1,6 +1,6 @@
/* Routines for handling XML memory maps provided by target.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/memrange.c b/gdb/memrange.c
index 58749b7..70ea234 100644
--- a/gdb/memrange.c
+++ b/gdb/memrange.c
@@ -1,6 +1,6 @@
/* Memory ranges
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/memrange.h b/gdb/memrange.h
index 1891269..5f35a8c 100644
--- a/gdb/memrange.h
+++ b/gdb/memrange.h
@@ -1,6 +1,6 @@
/* The memory range data structure, and associated utilities.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/memtag.c b/gdb/memtag.c
index 54bdc0a..c747f3c 100644
--- a/gdb/memtag.c
+++ b/gdb/memtag.c
@@ -1,6 +1,6 @@
/* GDB generic memory tagging functions.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/memtag.h b/gdb/memtag.h
index 600b4b9..a5eceeb 100644
--- a/gdb/memtag.h
+++ b/gdb/memtag.h
@@ -1,5 +1,5 @@
/* GDB generic memory tagging definitions.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index 9b6f491..30a6018 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the Toshiba MeP for GDB, the GNU debugger.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
@@ -2459,9 +2459,7 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_mep_tdep ();
-void
-_initialize_mep_tdep ()
+INIT_GDB_FILE (mep_tdep)
{
mep_csr_reggroup = reggroup_new ("csr", USER_REGGROUP);
mep_cr_reggroup = reggroup_new ("cr", USER_REGGROUP);
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index b44d676..1cb8435 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -1,5 +1,5 @@
/* MI Command Set - breakpoint and watchpoint commands.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
This file is part of GDB.
@@ -28,7 +28,6 @@
#include "language.h"
#include "location.h"
#include "linespec.h"
-#include <ctype.h>
#include "tracepoint.h"
enum
@@ -133,7 +132,7 @@ mi_argv_to_format (const char *const *argv, int argc)
result += "\\\"";
break;
default:
- if (isprint (argv[0][i]))
+ if (c_isprint (argv[0][i]))
result += argv[0][i];
else
{
diff --git a/gdb/mi/mi-cmd-break.h b/gdb/mi/mi-cmd-break.h
index 160c578..89f25d3 100644
--- a/gdb/mi/mi-cmd-break.h
+++ b/gdb/mi/mi-cmd-break.h
@@ -1,5 +1,5 @@
/* MI Command Set - breakpoint and watchpoint commands.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
Contributed by Intel Corporation.
diff --git a/gdb/mi/mi-cmd-catch.c b/gdb/mi/mi-cmd-catch.c
index 6cba316..8c0d230 100644
--- a/gdb/mi/mi-cmd-catch.c
+++ b/gdb/mi/mi-cmd-catch.c
@@ -1,5 +1,5 @@
/* MI Command Set - catch commands.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
Contributed by Intel Corporation.
diff --git a/gdb/mi/mi-cmd-disas.c b/gdb/mi/mi-cmd-disas.c
index cbae0e2..cb839e7 100644
--- a/gdb/mi/mi-cmd-disas.c
+++ b/gdb/mi/mi-cmd-disas.c
@@ -1,5 +1,5 @@
/* MI Command Set - disassemble commands.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
This file is part of GDB.
diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c
index 53077e9..bc2fe77 100644
--- a/gdb/mi/mi-cmd-env.c
+++ b/gdb/mi/mi-cmd-env.c
@@ -1,5 +1,5 @@
/* MI Command Set - environment commands.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Red Hat Inc.
@@ -236,9 +236,7 @@ mi_cmd_inferior_tty_show (const char *command, const char *const *argv,
current_uiout->field_string ("inferior_tty_terminal", inferior_tty);
}
-void _initialize_mi_cmd_env ();
-void
-_initialize_mi_cmd_env ()
+INIT_GDB_FILE (mi_cmd_env)
{
const char *env;
diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c
index 5119e21..cf7991f 100644
--- a/gdb/mi/mi-cmd-file.c
+++ b/gdb/mi/mi-cmd-file.c
@@ -1,5 +1,5 @@
/* MI Command Set - file commands.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
This file is part of GDB.
@@ -25,7 +25,6 @@
#include "symtab.h"
#include "source.h"
#include "solib.h"
-#include "solist.h"
/* Return to the client the absolute path and line number of the
current file being executed. */
@@ -163,10 +162,10 @@ mi_cmd_file_list_shared_libraries (const char *command,
for (const solib &so : current_program_space->solibs ())
{
- if (so.so_name.empty ())
+ if (so.name.empty ())
continue;
- if (pattern != nullptr && !re_exec (so.so_name.c_str ()))
+ if (pattern != nullptr && !re_exec (so.name.c_str ()))
continue;
ui_out_emit_tuple tuple_emitter (uiout, NULL);
diff --git a/gdb/mi/mi-cmd-info.c b/gdb/mi/mi-cmd-info.c
index 628891b..4fc884e 100644
--- a/gdb/mi/mi-cmd-info.c
+++ b/gdb/mi/mi-cmd-info.c
@@ -1,5 +1,5 @@
/* MI Command Set - information commands.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 05bc0ff..52ae11b 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -1,5 +1,5 @@
/* MI Command Set - stack commands.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
This file is part of GDB.
@@ -29,10 +29,8 @@
#include "valprint.h"
#include "mi-getopt.h"
#include "extension.h"
-#include <ctype.h>
#include "mi-parse.h"
#include <optional>
-#include "gdbsupport/gdb-safe-ctype.h"
#include "inferior.h"
enum what_to_list { locals, arguments, all };
@@ -604,7 +602,7 @@ list_args_or_locals (const frame_print_options &fp_opts,
{
int print_me = 0;
- switch (sym->aclass ())
+ switch (sym->loc_class ())
{
default:
case LOC_UNDEF: /* catches errors */
diff --git a/gdb/mi/mi-cmd-target.c b/gdb/mi/mi-cmd-target.c
index fbc6d6c..22bc43e 100644
--- a/gdb/mi/mi-cmd-target.c
+++ b/gdb/mi/mi-cmd-target.c
@@ -1,5 +1,5 @@
/* MI Command Set - target commands.
- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+ Copyright (C) 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index d889329..09d6107 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -1,5 +1,5 @@
/* MI Command Set - varobj commands.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
@@ -25,7 +25,6 @@
#include "varobj.h"
#include "language.h"
#include "value.h"
-#include <ctype.h>
#include "mi-getopt.h"
#include "gdbthread.h"
#include "mi-parse.h"
@@ -109,7 +108,7 @@ mi_cmd_var_create (const char *command, const char *const *argv, int argc)
gen_name = varobj_gen_name ();
name = gen_name.c_str ();
}
- else if (!isalpha (name[0]))
+ else if (!c_isalpha (name[0]))
error (_("-var-create: name of object must begin with a letter"));
if (strcmp (frame, "*") == 0)
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index 6f39989..abd3fb9 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -1,5 +1,5 @@
/* MI Command Set for GDB, the GNU debugger.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
@@ -369,9 +369,7 @@ mi_cmd_lookup (const char *command)
return it->second.get ();
}
-void _initialize_mi_cmds ();
-void
-_initialize_mi_cmds ()
+INIT_GDB_FILE (mi_cmds)
{
add_builtin_mi_commands ();
}
diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h
index 2059202..990ff75 100644
--- a/gdb/mi/mi-cmds.h
+++ b/gdb/mi/mi-cmds.h
@@ -1,6 +1,6 @@
/* MI Command Set for GDB, the GNU debugger.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
diff --git a/gdb/mi/mi-common.c b/gdb/mi/mi-common.c
index 699ead2..bc01371 100644
--- a/gdb/mi/mi-common.c
+++ b/gdb/mi/mi-common.c
@@ -1,5 +1,5 @@
/* Interface for common GDB/MI data
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/mi/mi-common.h b/gdb/mi/mi-common.h
index 4c3951c..c37cbc1 100644
--- a/gdb/mi/mi-common.h
+++ b/gdb/mi/mi-common.h
@@ -1,5 +1,5 @@
/* Interface for common GDB/MI data
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/mi/mi-console.c b/gdb/mi/mi-console.c
index 1f8d731..991ad7e 100644
--- a/gdb/mi/mi-console.c
+++ b/gdb/mi/mi-console.c
@@ -1,6 +1,6 @@
/* MI Console code.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
diff --git a/gdb/mi/mi-console.h b/gdb/mi/mi-console.h
index 89e0f4d..935529c 100644
--- a/gdb/mi/mi-console.h
+++ b/gdb/mi/mi-console.h
@@ -1,5 +1,5 @@
/* MI Command Set - MI Console.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
This file is part of GDB.
diff --git a/gdb/mi/mi-getopt.c b/gdb/mi/mi-getopt.c
index 143c5b9..2c8615a 100644
--- a/gdb/mi/mi-getopt.c
+++ b/gdb/mi/mi-getopt.c
@@ -1,5 +1,5 @@
/* MI Command Set - MI Option Parser.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
This file is part of GDB.
diff --git a/gdb/mi/mi-getopt.h b/gdb/mi/mi-getopt.h
index 5bc35aa..e3b0c3e 100644
--- a/gdb/mi/mi-getopt.h
+++ b/gdb/mi/mi-getopt.h
@@ -1,5 +1,5 @@
/* MI Option Parser.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
This file is part of GDB.
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 8de3e47..e88190d 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -1,6 +1,6 @@
/* MI Interpreter Definitions and Commands for GDB, the GNU debugger.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -34,7 +34,7 @@
#include "mi-common.h"
#include "observable.h"
#include "gdbthread.h"
-#include "solist.h"
+#include "solib.h"
#include "objfiles.h"
#include "tracepoint.h"
#include "cli-out.h"
@@ -682,8 +682,8 @@ mi_on_resume_1 (struct mi_interp *mi,
&& !multiple_inferiors_p ())
gdb_printf (mi->raw_stdout, "*running,thread-id=\"all\"\n");
else
- for (thread_info *tp : all_non_exited_threads (targ, ptid))
- mi_output_running (tp);
+ for (thread_info &tp : all_non_exited_threads (targ, ptid))
+ mi_output_running (&tp);
if (!mi->running_result_record_printed && mi->mi_proceeded)
{
@@ -726,9 +726,9 @@ mi_output_solib_attribs_1 (ui_out *uiout, const solib &solib,
{
gdbarch *gdbarch = current_inferior ()->arch ();
- uiout->field_string ("id", solib.so_original_name);
- uiout->field_string ("target-name", solib.so_original_name);
- uiout->field_string ("host-name", solib.so_name);
+ uiout->field_string ("id", solib.original_name);
+ uiout->field_string ("target-name", solib.original_name);
+ uiout->field_string ("host-name", solib.name);
if (include_symbols_loaded_p)
uiout->field_signed ("symbols-loaded", solib.symbols_loaded);
if (!gdbarch_has_global_solist (current_inferior ()->arch ()))
@@ -935,9 +935,7 @@ mi_interp_factory (const char *name)
return new mi_interp (name);
}
-void _initialize_mi_interp ();
-void
-_initialize_mi_interp ()
+INIT_GDB_FILE (mi_interp)
{
/* The various interpreter levels. */
interp_factory_register (INTERP_MI2, mi_interp_factory);
diff --git a/gdb/mi/mi-interp.h b/gdb/mi/mi-interp.h
index 2f1bef9..c9211ba 100644
--- a/gdb/mi/mi-interp.h
+++ b/gdb/mi/mi-interp.h
@@ -1,6 +1,6 @@
/* MI Interpreter Definitions and Commands for GDB, the GNU debugger.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 1ae54d0..bf10700 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1,6 +1,6 @@
/* MI Command Set.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
@@ -52,7 +52,6 @@
#include <optional>
#include "gdbsupport/byte-vector.h"
-#include <ctype.h>
#include "gdbsupport/run-time-clock.h"
#include <chrono>
#include "progspace-and-thread.h"
@@ -557,13 +556,13 @@ mi_cmd_thread_list_ids (const char *command, const char *const *argv, int argc)
{
ui_out_emit_tuple tuple_emitter (current_uiout, "thread-ids");
- for (thread_info *tp : all_non_exited_threads ())
+ for (thread_info &tp : all_non_exited_threads ())
{
- if (tp->ptid == inferior_ptid)
- current_thread = tp->global_num;
+ if (tp.ptid == inferior_ptid)
+ current_thread = tp.global_num;
num++;
- current_uiout->field_signed ("thread-id", tp->global_num);
+ current_uiout->field_signed ("thread-id", tp.global_num);
}
}
@@ -2218,7 +2217,7 @@ timestamp (struct mi_timestamp *tv)
using namespace std::chrono;
tv->wallclock = steady_clock::now ();
- run_time_clock::now (tv->utime, tv->stime);
+ get_run_time (tv->utime, tv->stime, run_time_scope::process);
}
static void
@@ -2768,9 +2767,7 @@ mi_parse_thread_group_id (const char *id)
return (int) num;
}
-void _initialize_mi_main ();
-void
-_initialize_mi_main ()
+INIT_GDB_FILE (mi_main)
{
set_show_commands mi_async_cmds
= add_setshow_boolean_cmd ("mi-async", class_run,
diff --git a/gdb/mi/mi-main.h b/gdb/mi/mi-main.h
index af67029..a857d33 100644
--- a/gdb/mi/mi-main.h
+++ b/gdb/mi/mi-main.h
@@ -1,6 +1,6 @@
/* MI Internal Functions for GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c
index a704535..6adf108 100644
--- a/gdb/mi/mi-out.c
+++ b/gdb/mi/mi-out.c
@@ -1,6 +1,6 @@
/* MI Command Set - output generating routines.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
diff --git a/gdb/mi/mi-out.h b/gdb/mi/mi-out.h
index c6aad00..ec3de74 100644
--- a/gdb/mi/mi-out.h
+++ b/gdb/mi/mi-out.h
@@ -1,5 +1,5 @@
/* MI Command Set - MI output generating routines for GDB.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
This file is part of GDB.
diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c
index 3ef9da5..58bdf4a 100644
--- a/gdb/mi/mi-parse.c
+++ b/gdb/mi/mi-parse.c
@@ -1,6 +1,6 @@
/* MI Command Set - MI parser.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
@@ -22,7 +22,6 @@
#include "mi-cmds.h"
#include "mi-parse.h"
-#include <ctype.h>
#include "cli/cli-utils.h"
#include "language.h"
@@ -61,7 +60,7 @@ mi_parse_escape (const char **string_ptr)
while (++count < 3)
{
c = (**string_ptr);
- if (isdigit (c) && c != '8' && c != '9')
+ if (c_isdigit (c) && c != '8' && c != '9')
{
(*string_ptr)++;
i *= 8;
@@ -162,7 +161,7 @@ mi_parse::parse_argv ()
return;
}
/* Insist on trailing white space. */
- if (chp[1] != '\0' && !isspace (chp[1]))
+ if (chp[1] != '\0' && !c_isspace (chp[1]))
{
freeargv (argv);
return;
@@ -193,7 +192,7 @@ mi_parse::parse_argv ()
int len;
const char *start = chp;
- while (*chp != '\0' && !isspace (*chp))
+ while (*chp != '\0' && !c_isspace (*chp))
{
chp++;
}
@@ -313,7 +312,7 @@ mi_parse::mi_parse (const char *cmd, std::string *token)
{
const char *tmp = chp + 1; /* discard ``-'' */
- for (; *chp && !isspace (*chp); chp++)
+ for (; *chp && !c_isspace (*chp); chp++)
;
this->command = make_unique_xstrndup (tmp, chp - tmp);
}
@@ -391,7 +390,7 @@ mi_parse::mi_parse (const char *cmd, std::string *token)
else
break;
- if (*chp != '\0' && !isspace (*chp))
+ if (*chp != '\0' && !c_isspace (*chp))
error (_("Invalid value for the '%s' option"), option);
chp = skip_spaces (chp);
}
diff --git a/gdb/mi/mi-parse.h b/gdb/mi/mi-parse.h
index 22d1018..73d39b8 100644
--- a/gdb/mi/mi-parse.h
+++ b/gdb/mi/mi-parse.h
@@ -1,5 +1,5 @@
/* MI Command Set - MI Command Parser.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
This file is part of GDB.
diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c
index e4d890f..4f5562d 100644
--- a/gdb/mi/mi-symbol-cmds.c
+++ b/gdb/mi/mi-symbol-cmds.c
@@ -1,5 +1,5 @@
/* MI Command Set - symbol commands.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
index 49cdfc6..0fdda18 100644
--- a/gdb/microblaze-linux-tdep.c
+++ b/gdb/microblaze-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Xilinx MicroBlaze.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -35,6 +35,7 @@
#include "frame-unwind.h"
#include "tramp-frame.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
static int
microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
@@ -49,6 +50,9 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
/* Determine appropriate breakpoint contents and size for this address. */
bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
+ /* Make sure we see the memory breakpoints. */
+ scoped_restore restore_memory
+ = make_scoped_restore_show_memory_breakpoints (1);
val = target_read_memory (addr, old_contents, bplen);
/* If our breakpoint is no longer at the address, this means that the
@@ -122,17 +126,14 @@ microblaze_linux_init_abi (struct gdbarch_info info,
microblaze_linux_memory_remove_breakpoint);
/* Shared library handling. */
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
/* Trampolines. */
tramp_frame_prepend_unwinder (gdbarch,
&microblaze_linux_sighandler_tramp_frame);
}
-void _initialize_microblaze_linux_tdep ();
-void
-_initialize_microblaze_linux_tdep ()
+INIT_GDB_FILE (microblaze_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX,
microblaze_linux_init_abi);
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 99c0fc5..404e4cd 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Xilinx MicroBlaze.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -590,6 +590,98 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
return (type->length () == 16);
}
+/* Return next pc values : next in sequence and/or branch/return target. */
+
+static std::vector<CORE_ADDR>
+microblaze_get_next_pcs (regcache *regcache)
+{
+ CORE_ADDR pc = regcache_read_pc (regcache);
+ unsigned long insn = microblaze_fetch_instruction (pc);
+
+ enum microblaze_instr_type insn_type;
+ short delay_slots;
+ bool isunsignednum;
+
+ /* If the current instruction is an imm, look at the inst after. */
+
+ get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots);
+
+ int imm;
+ bool immfound = false;
+
+ if (insn_type == immediate_inst)
+ {
+ int rd, ra, rb;
+ immfound = true;
+ microblaze_decode_insn (insn, &rd, &ra, &rb, &imm);
+ pc += INST_WORD_SIZE;
+ insn = microblaze_fetch_instruction (pc);
+ get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots);
+ }
+
+ std::optional<CORE_ADDR> next_pc, branch_or_return_pc;
+
+ /* Compute next instruction address - skip delay slots if any. */
+
+ if (insn_type != return_inst)
+ next_pc = pc + INST_WORD_SIZE + (delay_slots * INST_WORD_SIZE);
+
+ microblaze_debug ("single-step insn_type=0x%x pc=%s insn=0x%lx",
+ insn_type, core_addr_to_string_nz (pc), insn);
+
+ /* Compute target instruction address for branch or return instruction. */
+ if (insn_type == branch_inst || insn_type == return_inst)
+ {
+ int limm;
+ int lrd, lra, lrb;
+ bool targetvalid;
+ bool unconditionalbranch;
+
+ microblaze_decode_insn (insn, &lrd, &lra, &lrb, &limm);
+
+ ULONGEST ra = regcache_raw_get_unsigned (regcache, lra);
+ ULONGEST rb = regcache_raw_get_unsigned (regcache, lrb);
+
+ branch_or_return_pc
+ = microblaze_get_target_address (insn, immfound,
+ imm, pc, ra, rb, &targetvalid,
+ &unconditionalbranch);
+
+ microblaze_debug ("single-step uncondbr=%d targetvalid=%d target=%s",
+ unconditionalbranch, targetvalid,
+ core_addr_to_string_nz (*branch_or_return_pc));
+
+ /* Can't reach next address. */
+ if (unconditionalbranch)
+ next_pc.reset ();
+
+ /* Can't reach a distinct (not here) target address. */
+ if (!targetvalid
+ || branch_or_return_pc == pc
+ || (next_pc.has_value () && (branch_or_return_pc == next_pc)))
+ branch_or_return_pc.reset ();
+ } /* if (branch or return instruction). */
+
+ /* Create next_pcs vector to return. */
+
+ std::vector<CORE_ADDR> next_pcs;
+
+ if (next_pc.has_value ())
+ {
+ next_pcs.push_back (*next_pc);
+ microblaze_debug ("push_back next_pc(%s)",
+ core_addr_to_string_nz (*next_pc));
+ }
+
+ if (branch_or_return_pc.has_value ())
+ {
+ next_pcs.push_back (*branch_or_return_pc);
+ microblaze_debug ("push_back branch_or_return_pc(%s)",
+ core_addr_to_string_nz (*branch_or_return_pc));
+ }
+
+ return next_pcs;
+}
static int dwarf2_to_reg_map[78] =
{ 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
@@ -715,6 +807,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_sw_breakpoint_from_kind (gdbarch,
microblaze_breakpoint::bp_from_kind);
+ set_gdbarch_get_next_pcs (gdbarch, microblaze_get_next_pcs);
+
set_gdbarch_frame_args_skip (gdbarch, 8);
set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc);
@@ -736,9 +830,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_microblaze_tdep ();
-void
-_initialize_microblaze_tdep ()
+INIT_GDB_FILE (microblaze_tdep)
{
gdbarch_register (bfd_arch_microblaze, microblaze_gdbarch_init);
diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
index 7b5924e..852c9eb 100644
--- a/gdb/microblaze-tdep.h
+++ b/gdb/microblaze-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for Xilinx MicroBlaze.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -118,6 +118,6 @@ struct microblaze_frame_cache
/* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
Only used for native debugging. */
-#define MICROBLAZE_BREAKPOINT {0xb9, 0xcc, 0x00, 0x60}
+#define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18}
#endif /* GDB_MICROBLAZE_TDEP_H */
diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
index 53815b2..f24d2f5 100644
--- a/gdb/mingw-hdep.c
+++ b/gdb/mingw-hdep.c
@@ -1,6 +1,6 @@
/* Host support routines for MinGW, for GDB, the GNU debugger.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,6 +22,10 @@
#include "gdbsupport/event-loop.h"
#include "gdbsupport/gdb_select.h"
#include "inferior.h"
+#include "cli/cli-style.h"
+#include "command.h"
+#include "cli/cli-cmds.h"
+#include "terminal.h"
#include <windows.h>
#include <signal.h>
@@ -212,7 +216,30 @@ static int mingw_console_initialized;
static HANDLE hstdout = INVALID_HANDLE_VALUE;
/* Text attribute to use for normal text (the "none" pseudo-color). */
-static SHORT norm_attr;
+static SHORT norm_attr;
+
+/* Initialize settings related to the console. */
+
+void
+windows_initialize_console ()
+{
+ hstdout = (HANDLE)_get_osfhandle (fileno (stdout));
+ DWORD cmode;
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+ if (hstdout != INVALID_HANDLE_VALUE
+ && GetConsoleMode (hstdout, &cmode) != 0
+ && GetConsoleScreenBufferInfo (hstdout, &csbi))
+ {
+ norm_attr = csbi.wAttributes;
+ mingw_console_initialized = 1;
+ }
+ else if (hstdout != INVALID_HANDLE_VALUE)
+ mingw_console_initialized = -1; /* valid, but not a console device */
+
+ if (mingw_console_initialized > 0)
+ no_emojis ();
+}
/* The most recently applied style. */
static ui_file_style last_style;
@@ -223,22 +250,6 @@ static ui_file_style last_style;
int
gdb_console_fputs (const char *linebuf, FILE *fstream)
{
- if (!mingw_console_initialized)
- {
- hstdout = (HANDLE)_get_osfhandle (fileno (fstream));
- DWORD cmode;
- CONSOLE_SCREEN_BUFFER_INFO csbi;
-
- if (hstdout != INVALID_HANDLE_VALUE
- && GetConsoleMode (hstdout, &cmode) != 0
- && GetConsoleScreenBufferInfo (hstdout, &csbi))
- {
- norm_attr = csbi.wAttributes;
- mingw_console_initialized = 1;
- }
- else if (hstdout != INVALID_HANDLE_VALUE)
- mingw_console_initialized = -1; /* valid, but not a console device */
- }
/* If our stdout is not a console device, let the default 'fputs'
handle the task. */
if (mingw_console_initialized <= 0)
@@ -437,3 +448,12 @@ install_sigint_handler (c_c_handler_ftype *fn)
current_handler = fn;
return result;
}
+
+/* See terminal.h. */
+
+void
+set_output_translation_mode_binary ()
+{
+ setmode (fileno (stdout), O_BINARY);
+ setmode (fileno (stderr), O_BINARY);
+}
diff --git a/gdb/minidebug.c b/gdb/minidebug.c
index b3a1f12..668c55c 100644
--- a/gdb/minidebug.c
+++ b/gdb/minidebug.c
@@ -1,6 +1,6 @@
/* Read MiniDebugInfo data from an objfile.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 7b03e38..194a016 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1,5 +1,5 @@
/* GDB routines for manipulating the minimal symbol tables.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules.
This file is part of GDB.
@@ -36,7 +36,7 @@
to figure out what full symbol table entries need to be read in. */
-#include <ctype.h>
+#include "maint.h"
#include "symtab.h"
#include "bfd.h"
#include "filenames.h"
@@ -51,14 +51,10 @@
#include "cli/cli-utils.h"
#include "gdbsupport/symbol.h"
#include <algorithm>
-#include "gdbsupport/gdb-safe-ctype.h"
+#include "gdbsupport/cxx-thread.h"
#include "gdbsupport/parallel-for.h"
#include "inferior.h"
-#if CXX_STD_THREAD
-#include <mutex>
-#endif
-
/* Return true if MINSYM is a cold clone symbol.
Recognize f.i. these symbols (mangled/demangled):
- _ZL3foov.cold
@@ -376,23 +372,23 @@ lookup_minimal_symbol (program_space *pspace, const char *name, objfile *objf,
lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
if (found.external_symbol.minsym != NULL)
break;
- if (objf == NULL || objf == objfile
- || objf == objfile->separate_debug_objfile_backlink)
+ if (objf == NULL || objf == &objfile
+ || objf == objfile.separate_debug_objfile_backlink)
{
symbol_lookup_debug_printf ("lookup_minimal_symbol (%s, %s, %s, %s)",
host_address_to_string (pspace),
name, sfile != NULL ? sfile : "NULL",
- objfile_debug_name (objfile));
+ objfile_debug_name (&objfile));
/* Do two passes: the first over the ordinary hash table,
and the second over the demangled hash table. */
- lookup_minimal_symbol_mangled (name, sfile, objfile,
- objfile->per_bfd->msymbol_hash,
+ lookup_minimal_symbol_mangled (name, sfile, &objfile,
+ objfile.per_bfd->msymbol_hash,
mangled_hash, mangled_cmp, found);
/* If not found, try the demangled hash table. */
@@ -402,7 +398,7 @@ lookup_minimal_symbol (program_space *pspace, const char *name, objfile *objf,
table (usually just zero or one languages). */
for (unsigned iter = 0; iter < nr_languages; ++iter)
{
- if (!objfile->per_bfd->demangled_hash_languages.test (iter))
+ if (!objfile.per_bfd->demangled_hash_languages.test (iter))
continue;
enum language lang = (enum language) iter;
@@ -414,9 +410,9 @@ lookup_minimal_symbol (program_space *pspace, const char *name, objfile *objf,
= language_def (lang)->get_symbol_name_matcher
(lookup_name);
struct minimal_symbol **msymbol_demangled_hash
- = objfile->per_bfd->msymbol_demangled_hash;
+ = objfile.per_bfd->msymbol_demangled_hash;
- lookup_minimal_symbol_demangled (lookup_name, sfile, objfile,
+ lookup_minimal_symbol_demangled (lookup_name, sfile, &objfile,
msymbol_demangled_hash,
hash, match, found);
@@ -591,16 +587,16 @@ bound_minimal_symbol
lookup_minimal_symbol_linkage (program_space *pspace, const char *name,
bool match_static_type, bool only_main)
{
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
- if (objfile->separate_debug_objfile_backlink != nullptr)
+ if (objfile.separate_debug_objfile_backlink != nullptr)
continue;
- if (only_main && (objfile->flags & OBJF_MAINLINE) == 0)
+ if (only_main && (objfile.flags & OBJF_MAINLINE) == 0)
continue;
bound_minimal_symbol minsym
- = lookup_minimal_symbol_linkage (name, objfile, match_static_type);
+ = lookup_minimal_symbol_linkage (name, &objfile, match_static_type);
if (minsym.minsym != nullptr)
return minsym;
}
@@ -648,11 +644,11 @@ lookup_minimal_symbol_text (program_space *pspace, const char *name,
if (objf == nullptr)
{
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
if (found_symbol.minsym != NULL)
break;
- search (objfile);
+ search (&objfile);
}
}
else
@@ -683,16 +679,16 @@ lookup_minimal_symbol_by_pc_name (CORE_ADDR pc, const char *name,
unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- if (objf == NULL || objf == objfile
- || objf == objfile->separate_debug_objfile_backlink)
+ if (objf == NULL || objf == &objfile
+ || objf == objfile.separate_debug_objfile_backlink)
{
- for (msymbol = objfile->per_bfd->msymbol_hash[hash];
+ for (msymbol = objfile.per_bfd->msymbol_hash[hash];
msymbol != NULL;
msymbol = msymbol->hash_next)
{
- if (msymbol->value_address (objfile) == pc
+ if (msymbol->value_address (&objfile) == pc
&& strcmp (msymbol->linkage_name (), name) == 0)
return msymbol;
}
@@ -711,11 +707,11 @@ static int
frob_address (struct objfile *objfile, CORE_ADDR pc,
unrelocated_addr *unrel_addr)
{
- for (obj_section *iter : objfile->sections ())
+ for (obj_section &iter : objfile->sections ())
{
- if (iter->contains (pc))
+ if (iter.contains (pc))
{
- *unrel_addr = unrelocated_addr (pc - iter->offset ());
+ *unrel_addr = unrelocated_addr (pc - iter.offset ());
return 1;
}
}
@@ -1391,6 +1387,79 @@ build_minimal_symbol_hash_tables
}
}
+/* gdb::parallel_for_each worker to compute minimal symbol names and hashes. */
+
+class minimal_symbol_install_worker
+{
+public:
+ minimal_symbol_install_worker
+ (minimal_symbol *msymbols,
+ gdb::array_view<computed_hash_values> hash_values,
+ objfile_per_bfd_storage *per_bfd,
+ gdb::mutex &demangled_mutex)
+ : m_time_it ("minsym install worker"),
+ m_msymbols (msymbols),
+ m_hash_values (hash_values),
+ m_per_bfd (per_bfd),
+ m_demangled_mutex (demangled_mutex)
+ {}
+
+ void operator() (iterator_range<minimal_symbol *> msym_range) noexcept
+ {
+ for (minimal_symbol &msym : msym_range)
+ {
+ size_t idx = &msym - m_msymbols;
+ m_hash_values[idx].name_length = strlen (msym.linkage_name ());
+
+ if (!msym.name_set)
+ {
+ /* This will be freed later, by compute_and_set_names. */
+ gdb::unique_xmalloc_ptr<char> demangled_name
+ = symbol_find_demangled_name (&msym, msym.linkage_name ());
+ msym.set_demangled_name (demangled_name.release (),
+ &m_per_bfd->storage_obstack);
+ msym.name_set = 1;
+ }
+
+ /* This mangled_name_hash computation has to be outside of
+ the name_set check, or compute_and_set_names below will
+ be called with an invalid hash value. */
+ m_hash_values[idx].mangled_name_hash
+ = fast_hash (msym.linkage_name (), m_hash_values[idx].name_length);
+ m_hash_values[idx].minsym_hash = msymbol_hash (msym.linkage_name ());
+
+ /* We only use this hash code if the search name differs
+ from the linkage name. See the code in
+ build_minimal_symbol_hash_tables. */
+ if (msym.search_name () != msym.linkage_name ())
+ m_hash_values[idx].minsym_demangled_hash
+ = search_name_hash (msym.language (), msym.search_name ());
+ }
+
+ {
+ /* To limit how long we hold the lock, we only acquire it here
+ and not while we demangle the names above. */
+ gdb::lock_guard<gdb::mutex> guard (m_demangled_mutex);
+ for (minimal_symbol &msym : msym_range)
+ {
+ size_t idx = &msym - m_msymbols;
+ std::string_view name (msym.linkage_name (),
+ m_hash_values[idx].name_length);
+ hashval_t hashval = m_hash_values[idx].mangled_name_hash;
+
+ msym.compute_and_set_names (name, false, m_per_bfd, hashval);
+ }
+ }
+ }
+
+private:
+ scoped_time_it m_time_it;
+ minimal_symbol *m_msymbols;
+ gdb::array_view<computed_hash_values> m_hash_values;
+ objfile_per_bfd_storage *m_per_bfd;
+ gdb::mutex &m_demangled_mutex;
+};
+
/* Add the minimal symbols in the existing bunches to the objfile's official
minimal symbol table. In most cases there is no minimal symbol table yet
for this objfile, and the existing bunches are used to create one. Once
@@ -1468,66 +1537,19 @@ minimal_symbol_reader::install ()
m_objfile->per_bfd->minimal_symbol_count = mcount;
m_objfile->per_bfd->msymbols = std::move (msym_holder);
-#if CXX_STD_THREAD
/* Mutex that is used when modifying or accessing the demangled
hash table. */
- std::mutex demangled_mutex;
-#endif
+ gdb::mutex demangled_mutex;
std::vector<computed_hash_values> hash_values (mcount);
msymbols = m_objfile->per_bfd->msymbols.get ();
- /* Arbitrarily require at least 10 elements in a thread. */
- gdb::parallel_for_each (10, &msymbols[0], &msymbols[mcount],
- [&] (minimal_symbol *start, minimal_symbol *end)
- {
- for (minimal_symbol *msym = start; msym < end; ++msym)
- {
- size_t idx = msym - msymbols;
- hash_values[idx].name_length = strlen (msym->linkage_name ());
- if (!msym->name_set)
- {
- /* This will be freed later, by compute_and_set_names. */
- gdb::unique_xmalloc_ptr<char> demangled_name
- = symbol_find_demangled_name (msym, msym->linkage_name ());
- msym->set_demangled_name
- (demangled_name.release (),
- &m_objfile->per_bfd->storage_obstack);
- msym->name_set = 1;
- }
- /* This mangled_name_hash computation has to be outside of
- the name_set check, or compute_and_set_names below will
- be called with an invalid hash value. */
- hash_values[idx].mangled_name_hash
- = fast_hash (msym->linkage_name (),
- hash_values[idx].name_length);
- hash_values[idx].minsym_hash
- = msymbol_hash (msym->linkage_name ());
- /* We only use this hash code if the search name differs
- from the linkage name. See the code in
- build_minimal_symbol_hash_tables. */
- if (msym->search_name () != msym->linkage_name ())
- hash_values[idx].minsym_demangled_hash
- = search_name_hash (msym->language (), msym->search_name ());
- }
- {
- /* To limit how long we hold the lock, we only acquire it here
- and not while we demangle the names above. */
-#if CXX_STD_THREAD
- std::lock_guard<std::mutex> guard (demangled_mutex);
-#endif
- for (minimal_symbol *msym = start; msym < end; ++msym)
- {
- size_t idx = msym - msymbols;
- msym->compute_and_set_names
- (std::string_view (msym->linkage_name (),
- hash_values[idx].name_length),
- false,
- m_objfile->per_bfd,
- hash_values[idx].mangled_name_hash);
- }
- }
- });
+
+ gdb::parallel_for_each<1000, minimal_symbol *, minimal_symbol_install_worker>
+ (&msymbols[0], &msymbols[mcount], msymbols,
+ gdb::array_view<computed_hash_values> (hash_values),
+ m_objfile->per_bfd,
+ demangled_mutex);
build_minimal_symbol_hash_tables (m_objfile, hash_values);
}
@@ -1567,9 +1589,9 @@ find_solib_trampoline_target (const frame_info_ptr &frame, CORE_ADDR pc)
if (tsymbol != NULL)
{
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
/* Also handle minimal symbols pointing to function
descriptors. */
@@ -1584,7 +1606,7 @@ find_solib_trampoline_target (const frame_info_ptr &frame, CORE_ADDR pc)
/* Ignore data symbols that are not function
descriptors. */
- if (msymbol_is_function (objfile, msymbol, &func))
+ if (msymbol_is_function (&objfile, msymbol, &func))
return func;
}
}
@@ -1688,7 +1710,8 @@ find_minsym_type_and_address (minimal_symbol *msymbol,
{
/* Skip translation if caller does not need the address. */
if (address_p != NULL)
- *address_p = target_translate_tls_address (objfile, addr);
+ *address_p = target_translate_tls_address
+ (objfile, addr, bound_msym.minsym->print_name ());
return builtin_type (objfile)->nodebug_tls_symbol;
}
diff --git a/gdb/minsyms.h b/gdb/minsyms.h
index 2327a1b..dcab475 100644
--- a/gdb/minsyms.h
+++ b/gdb/minsyms.h
@@ -1,6 +1,6 @@
/* Minimal symbol table definitions for GDB.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -195,7 +195,7 @@ unsigned int msymbol_hash_iw (const char *);
requirements. */
#define SYMBOL_HASH_NEXT(hash, c) \
- ((hash) * 67 + TOLOWER ((unsigned char) (c)) - 113)
+ ((hash) * 67 + c_tolower (c) - 113)
diff --git a/gdb/mips-fbsd-nat.c b/gdb/mips-fbsd-nat.c
index b4d4104..8d97849 100644
--- a/gdb/mips-fbsd-nat.c
+++ b/gdb/mips-fbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for FreeBSD/mips.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -125,9 +125,7 @@ mips_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
}
}
-void _initialize_mips_fbsd_nat ();
-void
-_initialize_mips_fbsd_nat ()
+INIT_GDB_FILE (mips_fbsd_nat)
{
add_inf_child_target (&the_mips_fbsd_nat_target);
}
diff --git a/gdb/mips-fbsd-tdep.c b/gdb/mips-fbsd-tdep.c
index 7736078..dc549b5 100644
--- a/gdb/mips-fbsd-tdep.c
+++ b/gdb/mips-fbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for FreeBSD/mips.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -476,12 +476,30 @@ mips_fbsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
return fbsd_skip_solib_resolver (gdbarch, pc);
}
-/* FreeBSD/mips uses a slightly different `struct link_map' than the
- other FreeBSD platforms as it includes an additional `l_off'
- member. */
+/* solib_ops for ILP32 FreeBSD/MIPS systems. */
-static struct link_map_offsets *
-mips_fbsd_ilp32_fetch_link_map_offsets (void)
+struct mips_fbsd_ilp32_solib_ops : public svr4_solib_ops
+{
+ using svr4_solib_ops::svr4_solib_ops;
+
+ /* FreeBSD/MIPS uses a slightly different `struct link_map' than the
+ other FreeBSD platforms as it includes an additional `l_off' member. */
+
+ link_map_offsets *fetch_link_map_offsets () const override;
+};
+
+/* Return a new solib_ops for ILP32 FreeBSD/MIPS systems. */
+
+static solib_ops_up
+make_mips_fbsd_ilp32_solib_ops (program_space *pspace)
+{
+ return std::make_unique<mips_fbsd_ilp32_solib_ops> (pspace);
+}
+
+/* See mips_fbsd_ilp32_solib_ops. */
+
+link_map_offsets *
+mips_fbsd_ilp32_solib_ops::fetch_link_map_offsets () const
{
static struct link_map_offsets lmo;
static struct link_map_offsets *lmp = NULL;
@@ -508,8 +526,30 @@ mips_fbsd_ilp32_fetch_link_map_offsets (void)
return lmp;
}
-static struct link_map_offsets *
-mips_fbsd_lp64_fetch_link_map_offsets (void)
+/* solib_ops for LP64 FreeBSD/MIPS systems. */
+
+struct mips_fbsd_lp64_solib_ops : public svr4_solib_ops
+{
+ using svr4_solib_ops::svr4_solib_ops;
+
+ /* FreeBSD/MIPS uses a slightly different `struct link_map' than the
+ other FreeBSD platforms as it includes an additional `l_off' member. */
+
+ link_map_offsets *fetch_link_map_offsets () const override;
+};
+
+/* Return a new solib_ops for LP64 FreeBSD/MIPS systems. */
+
+static solib_ops_up
+make_mips_fbsd_lp64_solib_ops (program_space *pspace)
+{
+ return std::make_unique<mips_fbsd_lp64_solib_ops> (pspace);
+}
+
+/* See mips_fbsd_lp64_solib_ops. */
+
+link_map_offsets *
+mips_fbsd_lp64_solib_ops::fetch_link_map_offsets () const
{
static struct link_map_offsets lmo;
static struct link_map_offsets *lmp = NULL;
@@ -544,7 +584,7 @@ mips_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Generic FreeBSD support. */
fbsd_init_abi (info, gdbarch);
- set_gdbarch_software_single_step (gdbarch, mips_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, mips_software_single_step);
switch (abi)
{
@@ -565,15 +605,12 @@ mips_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_skip_solib_resolver (gdbarch, mips_fbsd_skip_solib_resolver);
/* FreeBSD/mips has SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, (gdbarch_ptr_bit (gdbarch) == 32 ?
- mips_fbsd_ilp32_fetch_link_map_offsets :
- mips_fbsd_lp64_fetch_link_map_offsets));
+ set_solib_svr4_ops (gdbarch, (gdbarch_ptr_bit (gdbarch) == 32
+ ? make_mips_fbsd_ilp32_solib_ops
+ : make_mips_fbsd_lp64_solib_ops));
}
-void _initialize_mips_fbsd_tdep ();
-void
-_initialize_mips_fbsd_tdep ()
+INIT_GDB_FILE (mips_fbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_mips, 0, GDB_OSABI_FREEBSD,
mips_fbsd_init_abi);
diff --git a/gdb/mips-fbsd-tdep.h b/gdb/mips-fbsd-tdep.h
index 201b1e5..5ae580a 100644
--- a/gdb/mips-fbsd-tdep.h
+++ b/gdb/mips-fbsd-tdep.h
@@ -1,6 +1,6 @@
/* Common target dependent code for GDB on MIPS systems running FreeBSD.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index 3d072ea..e22e904 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux on MIPS processors.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -784,9 +784,7 @@ mips_linux_nat_target::close ()
linux_nat_trad_target::close ();
}
-void _initialize_mips_linux_nat ();
-void
-_initialize_mips_linux_nat ()
+INIT_GDB_FILE (mips_linux_nat)
{
add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
&show_debug_regs, _("\
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index b076d24..b668bcb 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux on MIPS processors.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -30,13 +30,13 @@
#include "gdbtypes.h"
#include "objfiles.h"
#include "solib.h"
-#include "solist.h"
#include "symtab.h"
#include "target-descriptions.h"
#include "regset.h"
#include "mips-linux-tdep.h"
#include "glibc-tdep.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
#include "xml-syscall.h"
#include "gdbsupport/gdb_signals.h"
#include "inferior.h"
@@ -46,8 +46,6 @@
#include "features/mips64-linux.c"
#include "features/mips64-dsp-linux.c"
-static solib_ops mips_svr4_so_ops;
-
/* This enum represents the signals' numbers on the MIPS
architecture. It just contains the signal definitions which are
different from the generic implementation.
@@ -667,24 +665,59 @@ mips_linux_in_dynsym_stub (CORE_ADDR pc)
return 1;
}
-/* Return non-zero iff PC belongs to the dynamic linker resolution
- code, a PLT entry, or a lazy binding stub. */
+/* Mix-in class to add Linux/MIPS-specific methods to a base solib_ops
+ class. */
-static int
-mips_linux_in_dynsym_resolve_code (CORE_ADDR pc)
+template <typename Base>
+struct mips_linux_svr4_solib_ops : public Base
+{
+ using Base::Base;
+
+ bool in_dynsym_resolve_code (CORE_ADDR pc) const override;
+};
+
+template <typename Base>
+bool
+mips_linux_svr4_solib_ops<Base>::in_dynsym_resolve_code (CORE_ADDR pc) const
{
/* Check whether PC is in the dynamic linker. This also checks
whether it is in the .plt section, used by non-PIC executables. */
- if (svr4_in_dynsym_resolve_code (pc))
- return 1;
+ if (Base::in_dynsym_resolve_code (pc))
+ return true;
/* Likewise for the stubs. They live in the .MIPS.stubs section these
days, so we check if the PC is within, than fall back to a pattern
match. */
if (mips_linux_in_dynsym_stub (pc))
- return 1;
+ return true;
+
+ return false;
+}
+
+/* solib_ops for ILP32 Linux/MIPS systems. */
+
+using mips_linux_ilp32_svr4_solib_ops
+ = mips_linux_svr4_solib_ops<linux_ilp32_svr4_solib_ops>;
- return 0;
+/* Return a new solib_ops for ILP32 Linux/MIPS systems. */
+
+static solib_ops_up
+make_mips_linux_ilp32_svr4_solib_ops (program_space *pspace)
+{
+ return std::make_unique<mips_linux_ilp32_svr4_solib_ops> (pspace);
+}
+
+/* solib_ops for LP64 Linux/MIPS systems. */
+
+using mips_linux_lp64_svr4_solib_ops
+ = mips_linux_svr4_solib_ops<linux_lp64_svr4_solib_ops>;
+
+/* Return a new solib_ops for LP64 Linux/MIPS systems. */
+
+static solib_ops_up
+make_mips_linux_lp64_svr4_solib_ops (program_space *pspace)
+{
+ return std::make_unique<mips_linux_lp64_svr4_solib_ops> (pspace);
}
/* See the comments for SKIP_SOLIB_RESOLVER at the top of infrun.c,
@@ -1538,8 +1571,7 @@ mips_linux_init_abi (struct gdbarch_info info,
case MIPS_ABI_O32:
set_gdbarch_get_longjmp_target (gdbarch,
mips_linux_get_longjmp_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_mips_linux_ilp32_svr4_solib_ops);
tramp_frame_prepend_unwinder (gdbarch, &micromips_linux_o32_sigframe);
tramp_frame_prepend_unwinder (gdbarch,
&micromips_linux_o32_rt_sigframe);
@@ -1550,8 +1582,7 @@ mips_linux_init_abi (struct gdbarch_info info,
case MIPS_ABI_N32:
set_gdbarch_get_longjmp_target (gdbarch,
mips_linux_get_longjmp_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_mips_linux_ilp32_svr4_solib_ops);
set_gdbarch_long_double_bit (gdbarch, 128);
set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
tramp_frame_prepend_unwinder (gdbarch,
@@ -1562,8 +1593,7 @@ mips_linux_init_abi (struct gdbarch_info info,
case MIPS_ABI_N64:
set_gdbarch_get_longjmp_target (gdbarch,
mips64_linux_get_longjmp_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_mips_linux_lp64_svr4_solib_ops);
set_gdbarch_long_double_bit (gdbarch, 128);
set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
tramp_frame_prepend_unwinder (gdbarch,
@@ -1577,22 +1607,12 @@ mips_linux_init_abi (struct gdbarch_info info,
set_gdbarch_skip_solib_resolver (gdbarch, mips_linux_skip_resolver);
- set_gdbarch_software_single_step (gdbarch, mips_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, mips_software_single_step);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
- /* Initialize this lazily, to avoid an initialization order
- dependency on solib-svr4.c's _initialize routine. */
- if (mips_svr4_so_ops.in_dynsym_resolve_code == NULL)
- {
- mips_svr4_so_ops = svr4_so_ops;
- mips_svr4_so_ops.in_dynsym_resolve_code
- = mips_linux_in_dynsym_resolve_code;
- }
- set_gdbarch_so_ops (gdbarch, &mips_svr4_so_ops);
-
set_gdbarch_write_pc (gdbarch, mips_linux_write_pc);
set_gdbarch_core_read_description (gdbarch,
@@ -1629,9 +1649,7 @@ mips_linux_init_abi (struct gdbarch_info info,
}
}
-void _initialize_mips_linux_tdep ();
-void
-_initialize_mips_linux_tdep ()
+INIT_GDB_FILE (mips_linux_tdep)
{
const struct bfd_arch_info *arch_info;
diff --git a/gdb/mips-linux-tdep.h b/gdb/mips-linux-tdep.h
index 8670c0b..362c148 100644
--- a/gdb/mips-linux-tdep.h
+++ b/gdb/mips-linux-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux on MIPS processors.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/mips-netbsd-nat.c b/gdb/mips-netbsd-nat.c
index 3576c09..91b870b 100644
--- a/gdb/mips-netbsd-nat.c
+++ b/gdb/mips-netbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for MIPS systems running NetBSD.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -115,9 +115,7 @@ mips_nbsd_nat_target::store_registers (struct regcache *regcache, int regno)
}
}
-void _initialize_mipsnbsd_nat ();
-void
-_initialize_mipsnbsd_nat ()
+INIT_GDB_FILE (mipsnbsd_nat)
{
add_inf_child_target (&the_mips_nbsd_nat_target);
}
diff --git a/gdb/mips-netbsd-tdep.c b/gdb/mips-netbsd-tdep.c
index b8134a6..3c54c32 100644
--- a/gdb/mips-netbsd-tdep.c
+++ b/gdb/mips-netbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for NetBSD/mips.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Wasabi Systems, Inc.
@@ -288,13 +288,29 @@ mipsnbsd_cannot_store_register (struct gdbarch *gdbarch, int regno)
|| regno == mips_regnum (gdbarch)->fp_implementation_revision);
}
-/* Shared library support. */
+/* solib_ops for ILP32 NetBSD/MIPS systems. */
-/* NetBSD/mips uses a slightly different `struct link_map' than the
- other NetBSD platforms. */
+struct mips_nbsd_ilp32_svr4_solib_ops : public svr4_solib_ops
+{
+ using svr4_solib_ops::svr4_solib_ops;
+
+ /* NetBSD/MIPS uses a slightly different `struct link_map' than the
+ other NetBSD platforms. */
+ link_map_offsets *fetch_link_map_offsets () const override;
+};
+
+/* Return a new solib_ops for ILP32 NetBSD/MIPS systems. */
+
+static solib_ops_up
+make_mips_nbsd_ilp32_svr4_solib_ops (program_space *pspace)
+{
+ return std::make_unique<mips_nbsd_ilp32_svr4_solib_ops> (pspace);
+}
+
+/* See mips_nbsd_ilp32_svr4_solib_ops. */
-static struct link_map_offsets *
-mipsnbsd_ilp32_fetch_link_map_offsets (void)
+link_map_offsets *
+mips_nbsd_ilp32_svr4_solib_ops::fetch_link_map_offsets () const
{
static struct link_map_offsets lmo;
static struct link_map_offsets *lmp = NULL;
@@ -322,8 +338,29 @@ mipsnbsd_ilp32_fetch_link_map_offsets (void)
return lmp;
}
-static struct link_map_offsets *
-mipsnbsd_lp64_fetch_link_map_offsets (void)
+/* solib_ops for LP64 NetBSD/MIPS systems. */
+
+struct mips_nbsd_lp64_svr4_solib_ops : public svr4_solib_ops
+{
+ using svr4_solib_ops::svr4_solib_ops;
+
+ /* NetBSD/MIPS uses a slightly different `struct link_map' than the
+ other NetBSD platforms. */
+ link_map_offsets *fetch_link_map_offsets () const override;
+};
+
+/* Return a new solib_ops for LP64 NetBSD/MIPS systems. */
+
+static solib_ops_up
+make_mips_nbsd_lp64_svr4_solib_ops (program_space *pspace)
+{
+ return std::make_unique<mips_nbsd_lp64_svr4_solib_ops> (pspace);
+}
+
+/* See mips_nbsd_lp64_svr4_solib_ops. */
+
+link_map_offsets *
+mips_nbsd_lp64_svr4_solib_ops::fetch_link_map_offsets () const
{
static struct link_map_offsets lmo;
static struct link_map_offsets *lmp = NULL;
@@ -366,18 +403,15 @@ mipsnbsd_init_abi (struct gdbarch_info info,
set_gdbarch_cannot_fetch_register (gdbarch, mipsnbsd_cannot_fetch_register);
set_gdbarch_cannot_store_register (gdbarch, mipsnbsd_cannot_store_register);
- set_gdbarch_software_single_step (gdbarch, mips_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, mips_software_single_step);
/* NetBSD/mips has SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, (gdbarch_ptr_bit (gdbarch) == 32 ?
- mipsnbsd_ilp32_fetch_link_map_offsets :
- mipsnbsd_lp64_fetch_link_map_offsets));
+ set_solib_svr4_ops (gdbarch, (gdbarch_ptr_bit (gdbarch) == 32
+ ? make_mips_nbsd_ilp32_svr4_solib_ops
+ : make_mips_nbsd_lp64_svr4_solib_ops));
}
-void _initialize_mipsnbsd_tdep ();
-void
-_initialize_mipsnbsd_tdep ()
+INIT_GDB_FILE (mipsnbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_mips, 0, GDB_OSABI_NETBSD,
mipsnbsd_init_abi);
diff --git a/gdb/mips-netbsd-tdep.h b/gdb/mips-netbsd-tdep.h
index e9544f0..5680661 100644
--- a/gdb/mips-netbsd-tdep.h
+++ b/gdb/mips-netbsd-tdep.h
@@ -1,6 +1,6 @@
/* Common target dependent code for GDB on MIPS systems running NetBSD.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/mips-sde-tdep.c b/gdb/mips-sde-tdep.c
index 783e6fd..5278afb 100644
--- a/gdb/mips-sde-tdep.c
+++ b/gdb/mips-sde-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for SDE on MIPS processors.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -254,9 +254,7 @@ mips_sde_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
frame_base_append_sniffer (gdbarch, mips_sde_frame_base_sniffer);
}
-void _initialize_mips_sde_tdep ();
-void
-_initialize_mips_sde_tdep ()
+INIT_GDB_FILE (mips_sde_tdep)
{
gdbarch_register_osabi_sniffer (bfd_arch_mips,
bfd_target_elf_flavour,
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 3613f9b..d072b9a 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the MIPS architecture, for GDB, the GNU Debugger.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
@@ -487,7 +487,7 @@ msymbol_is_micromips (struct minimal_symbol *msym)
static void
mips_make_symbol_special (struct symbol *sym, struct objfile *objfile)
{
- if (sym->aclass () == LOC_BLOCK)
+ if (sym->loc_class () == LOC_BLOCK)
{
/* We are in symbol reading so it is OK to cast away constness. */
struct block *block = (struct block *) sym->value_block ();
@@ -7027,7 +7027,7 @@ gdb_print_insn_mips (bfd_vma memaddr, struct disassemble_info *info)
/* FIXME: cagney/2003-06-26: Is this even necessary? The
disassembler needs to be able to locally determine the ISA, and
- not rely on GDB. Otherwize the stand-alone 'objdump -d' will not
+ not rely on GDB. Otherwise the stand-alone 'objdump -d' will not
work. */
if (mips_pc_is_mips16 (gdbarch, memaddr))
info->mach = bfd_mach_mips16;
@@ -8972,9 +8972,7 @@ mips_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
mips_fpu_type_str (mips_get_fpu_type (gdbarch)));
}
-void _initialize_mips_tdep ();
-void
-_initialize_mips_tdep ()
+INIT_GDB_FILE (mips_tdep)
{
static struct cmd_list_element *mipsfpulist = NULL;
diff --git a/gdb/mips-tdep.h b/gdb/mips-tdep.h
index df589cf..f9effb0 100644
--- a/gdb/mips-tdep.h
+++ b/gdb/mips-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent header for the MIPS architecture, for GDB, the GNU Debugger.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/mips64-obsd-nat.c b/gdb/mips64-obsd-nat.c
index ced3ffb..d77c77e 100644
--- a/gdb/mips64-obsd-nat.c
+++ b/gdb/mips64-obsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for OpenBSD/mips64.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -114,9 +114,7 @@ mips64_obsd_nat_target::store_registers (struct regcache *regcache, int regnum)
perror_with_name (_("Couldn't write registers"));
}
-void _initialize_mips64obsd_nat ();
-void
-_initialize_mips64obsd_nat ()
+INIT_GDB_FILE (mips64obsd_nat)
{
add_inf_child_target (&the_mips64_obsd_nat_target);
}
diff --git a/gdb/mips64-obsd-tdep.c b/gdb/mips64-obsd-tdep.c
index 543938b..b9a6fe5 100644
--- a/gdb/mips64-obsd-tdep.c
+++ b/gdb/mips64-obsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for OpenBSD/mips64.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -150,13 +150,10 @@ mips64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
obsd_init_abi(info, gdbarch);
/* OpenBSD/mips64 has SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_lp64_solib_ops);
}
-void _initialize_mips64obsd_tdep ();
-void
-_initialize_mips64obsd_tdep ()
+INIT_GDB_FILE (mips64obsd_tdep)
{
gdbarch_register_osabi (bfd_arch_mips, 0, GDB_OSABI_OPENBSD,
mips64obsd_init_abi);
diff --git a/gdb/mipsread.c b/gdb/mipsread.c
index 53def12..1d76b8f 100644
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -1,6 +1,6 @@
/* Read a symbol table in MIPS' format (Third-Eye).
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
Contributed by Alessandro Forin (af@cs.cmu.edu) at CMU. Major work
by Per Bothner, John Gilmore and Ian Lance Taylor at Cygnus Support.
@@ -66,20 +66,16 @@ mipscoff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
{
bfd *abfd = objfile->obfd.get ();
- minimal_symbol_reader reader (objfile);
-
/* Now that the executable file is positioned at symbol table,
process it and define symbols accordingly. */
- if (!((*ecoff_backend (abfd)->debug_swap.read_debug_info)
- (abfd, NULL, &ecoff_data (abfd)->debug_info)))
- error (_("Error reading symbol table: %s"), bfd_errmsg (bfd_get_error ()));
-
- mdebug_build_psymtabs (reader, objfile, &ecoff_backend (abfd)->debug_swap,
- &ecoff_data (abfd)->debug_info);
+ mipsmdebug_build_psymtabs (objfile, &ecoff_backend (abfd)->debug_swap,
+ &ecoff_data (abfd)->debug_info);
/* Add alpha coff dynamic symbols. */
+ minimal_symbol_reader reader (objfile);
+
read_alphacoff_dynamic_symtab (reader, objfile);
/* Install any minimal symbols that have been collected as the current
@@ -374,9 +370,7 @@ static const struct sym_fns ecoff_sym_fns =
NULL, /* sym_probe_fns */
};
-void _initialize_mipsread ();
-void
-_initialize_mipsread ()
+INIT_GDB_FILE (mipsread)
{
add_symtab_fns (bfd_target_ecoff_flavour, &ecoff_sym_fns);
}
diff --git a/gdb/mn10300-linux-tdep.c b/gdb/mn10300-linux-tdep.c
index 8eb59d2..6c31241 100644
--- a/gdb/mn10300-linux-tdep.c
+++ b/gdb/mn10300-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the Matsushita MN10300 for GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -29,6 +29,7 @@
#include "trad-frame.h"
#include "tramp-frame.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
#include "gdbarch.h"
/* Transliterated from <asm-mn10300/elf.h>... */
@@ -707,16 +708,13 @@ am33_linux_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_iterate_over_regset_sections
(gdbarch, am33_iterate_over_regset_sections);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
tramp_frame_prepend_unwinder (gdbarch, &am33_linux_sigframe);
tramp_frame_prepend_unwinder (gdbarch, &am33_linux_rt_sigframe);
}
-void _initialize_mn10300_linux_tdep ();
-void
-_initialize_mn10300_linux_tdep ()
+INIT_GDB_FILE (mn10300_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_mn10300, 0,
GDB_OSABI_LINUX, am33_linux_init_osabi);
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index f989bd6..fbaeacf 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the Matsushita MN10300 for GDB, the GNU debugger.
- Copyright (C) 1996-2024 Free Software Foundation, Inc.
+ Copyright (C) 1996-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1413,9 +1413,7 @@ mn10300_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
tdep->am33_mode);
}
-void _initialize_mn10300_tdep ();
-void
-_initialize_mn10300_tdep ()
+INIT_GDB_FILE (mn10300_tdep)
{
gdbarch_register (bfd_arch_mn10300, mn10300_gdbarch_init, mn10300_dump_tdep);
}
diff --git a/gdb/mn10300-tdep.h b/gdb/mn10300-tdep.h
index bec5f04..71d07b2 100644
--- a/gdb/mn10300-tdep.h
+++ b/gdb/mn10300-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent interface for Matsushita MN10300 for GDB, the GNU debugger.
- Copyright (C) 1996-2024 Free Software Foundation, Inc.
+ Copyright (C) 1996-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index f69810f..bb48877 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Moxie.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -240,7 +240,7 @@ moxie_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
return sal.end;
}
}
- /* No useable line symbol. Use result of prologue parsing
+ /* No usable line symbol. Use result of prologue parsing
method. */
return plg_end;
}
@@ -1088,7 +1088,7 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
frame_unwind_append_unwinder (gdbarch, &moxie_frame_unwind);
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, moxie_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, moxie_software_single_step);
/* Support simple overlay manager. */
set_gdbarch_overlay_update (gdbarch, simple_overlay_update);
@@ -1101,9 +1101,7 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Register this machine's init routine. */
-void _initialize_moxie_tdep ();
-void
-_initialize_moxie_tdep ()
+INIT_GDB_FILE (moxie_tdep)
{
gdbarch_register (bfd_arch_moxie, moxie_gdbarch_init);
}
diff --git a/gdb/moxie-tdep.h b/gdb/moxie-tdep.h
index 329d997..8088de5 100644
--- a/gdb/moxie-tdep.h
+++ b/gdb/moxie-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for Moxie
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index 17ebddf..7ac26b9 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -1,7 +1,7 @@
/* Target-dependent code for the Texas Instruments MSP430 for GDB, the
GNU debugger.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
@@ -996,9 +996,7 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Register the initialization routine. */
-void _initialize_msp430_tdep ();
-void
-_initialize_msp430_tdep ()
+INIT_GDB_FILE (msp430_tdep)
{
gdbarch_register (bfd_arch_msp430, msp430_gdbarch_init);
}
diff --git a/gdb/namespace.c b/gdb/namespace.c
index 5a9a99d..52eb1ea 100644
--- a/gdb/namespace.c
+++ b/gdb/namespace.c
@@ -1,5 +1,5 @@
/* Code dealing with "using" directives for GDB.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/namespace.h b/gdb/namespace.h
index ca949aa..97df06a 100644
--- a/gdb/namespace.h
+++ b/gdb/namespace.h
@@ -1,5 +1,5 @@
/* Code dealing with "using" directives for GDB.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/aarch64-hw-point.c b/gdb/nat/aarch64-hw-point.c
index 8ab91fe..8c0854b 100644
--- a/gdb/nat/aarch64-hw-point.c
+++ b/gdb/nat/aarch64-hw-point.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -710,10 +710,8 @@ aarch64_stopped_data_address (const struct aarch64_debug_reg_state *state,
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;
+ RK3399 SOC). But it also can be p (observed on M1 SOC). */
+ const CORE_ADDR max_access_size = 16;
const CORE_ADDR addr_watch_base = addr_watch_aligned -
(max_access_size - AARCH64_HWP_MAX_LEN_PER_REG);
if (!(addr_trap >= addr_watch_base
diff --git a/gdb/nat/aarch64-hw-point.h b/gdb/nat/aarch64-hw-point.h
index 9f9c85e..f8ab55f 100644
--- a/gdb/nat/aarch64-hw-point.h
+++ b/gdb/nat/aarch64-hw-point.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c
index 43e04fe..3f0c8b9 100644
--- a/gdb/nat/aarch64-linux-hw-point.c
+++ b/gdb/nat/aarch64-linux-hw-point.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.
diff --git a/gdb/nat/aarch64-linux-hw-point.h b/gdb/nat/aarch64-linux-hw-point.h
index 618f79f..8cbe6c5 100644
--- a/gdb/nat/aarch64-linux-hw-point.h
+++ b/gdb/nat/aarch64-linux-hw-point.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.
diff --git a/gdb/nat/aarch64-linux.c b/gdb/nat/aarch64-linux.c
index 5a95f22..23158bc 100644
--- a/gdb/nat/aarch64-linux.c
+++ b/gdb/nat/aarch64-linux.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.
diff --git a/gdb/nat/aarch64-linux.h b/gdb/nat/aarch64-linux.h
index 969bb52..be32f6d 100644
--- a/gdb/nat/aarch64-linux.h
+++ b/gdb/nat/aarch64-linux.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.
diff --git a/gdb/nat/aarch64-mte-linux-ptrace.c b/gdb/nat/aarch64-mte-linux-ptrace.c
index f215588..308bc9a 100644
--- a/gdb/nat/aarch64-mte-linux-ptrace.c
+++ b/gdb/nat/aarch64-mte-linux-ptrace.c
@@ -1,6 +1,6 @@
/* Common Linux native ptrace code for AArch64 MTE.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/aarch64-mte-linux-ptrace.h b/gdb/nat/aarch64-mte-linux-ptrace.h
index e02a081..7c496a9 100644
--- a/gdb/nat/aarch64-mte-linux-ptrace.h
+++ b/gdb/nat/aarch64-mte-linux-ptrace.h
@@ -1,6 +1,6 @@
/* Common native Linux definitions for AArch64 MTE.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/aarch64-scalable-linux-ptrace.c b/gdb/nat/aarch64-scalable-linux-ptrace.c
index 1d226b4..ec8ee33 100644
--- a/gdb/nat/aarch64-scalable-linux-ptrace.c
+++ b/gdb/nat/aarch64-scalable-linux-ptrace.c
@@ -1,6 +1,6 @@
/* Common native Linux code for the AArch64 scalable extensions: SVE and SME.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/aarch64-scalable-linux-ptrace.h b/gdb/nat/aarch64-scalable-linux-ptrace.h
index 2c6d899..f9dbf00 100644
--- a/gdb/nat/aarch64-scalable-linux-ptrace.h
+++ b/gdb/nat/aarch64-scalable-linux-ptrace.h
@@ -1,7 +1,7 @@
/* Common native Linux definitions for the AArch64 scalable
extensions: SVE and SME.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/aarch64-scalable-linux-sigcontext.h b/gdb/nat/aarch64-scalable-linux-sigcontext.h
index bfda9be..a588b64 100644
--- a/gdb/nat/aarch64-scalable-linux-sigcontext.h
+++ b/gdb/nat/aarch64-scalable-linux-sigcontext.h
@@ -1,7 +1,7 @@
/* Linux Kernel sigcontext definitions for AArch64 Scalable Extensions
(SVE/SME).
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
Contributed by Arm Ltd.
This file is part of GDB.
diff --git a/gdb/nat/amd64-linux-siginfo.c b/gdb/nat/amd64-linux-siginfo.c
index f5e9994..9200721 100644
--- a/gdb/nat/amd64-linux-siginfo.c
+++ b/gdb/nat/amd64-linux-siginfo.c
@@ -1,6 +1,6 @@
/* Low-level siginfo manipulation for amd64.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/amd64-linux-siginfo.h b/gdb/nat/amd64-linux-siginfo.h
index 1e102ae..298574f 100644
--- a/gdb/nat/amd64-linux-siginfo.h
+++ b/gdb/nat/amd64-linux-siginfo.h
@@ -1,6 +1,6 @@
/* Low-level siginfo manipulation for amd64.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/fork-inferior.c b/gdb/nat/fork-inferior.c
index 46fe897..b6cf410 100644
--- a/gdb/nat/fork-inferior.c
+++ b/gdb/nat/fork-inferior.c
@@ -1,6 +1,6 @@
/* Fork a Unix child process, and set up to debug it, for GDB and GDBserver.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/fork-inferior.h b/gdb/nat/fork-inferior.h
index 41dad71..d52aa44 100644
--- a/gdb/nat/fork-inferior.h
+++ b/gdb/nat/fork-inferior.h
@@ -1,6 +1,6 @@
/* Functions and data responsible for forking the inferior process.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/gdb_ptrace.h b/gdb/nat/gdb_ptrace.h
index 1785884..dee6e58 100644
--- a/gdb/nat/gdb_ptrace.h
+++ b/gdb/nat/gdb_ptrace.h
@@ -1,6 +1,6 @@
/* Portable <sys/ptrace.h>
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/gdb_thread_db.h b/gdb/nat/gdb_thread_db.h
index 446b921..4560064 100644
--- a/gdb/nat/gdb_thread_db.h
+++ b/gdb/nat/gdb_thread_db.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/i386-linux.c b/gdb/nat/i386-linux.c
index 64605be..7a09862 100644
--- a/gdb/nat/i386-linux.c
+++ b/gdb/nat/i386-linux.c
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux i386.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/i386-linux.h b/gdb/nat/i386-linux.h
index f222d51..d80e0f9 100644
--- a/gdb/nat/i386-linux.h
+++ b/gdb/nat/i386-linux.h
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux i386.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index 3dc5da7..9eadd46 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -1,6 +1,6 @@
/* Linux-dependent part of branch trace support for GDB, and GDBserver.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h
index 6fd8107..01d1efa 100644
--- a/gdb/nat/linux-btrace.h
+++ b/gdb/nat/linux-btrace.h
@@ -1,6 +1,6 @@
/* Linux-dependent part of branch trace support for GDB, and GDBserver.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
diff --git a/gdb/nat/linux-namespaces.c b/gdb/nat/linux-namespaces.c
index 19a05ee..2a65fb0 100644
--- a/gdb/nat/linux-namespaces.c
+++ b/gdb/nat/linux-namespaces.c
@@ -1,6 +1,6 @@
/* Linux namespaces(7) support.
- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+ Copyright (C) 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -233,6 +233,12 @@ enum mnsh_msg_type
MNSH_RET_INT. */
MNSH_REQ_SETNS,
+ /* A request that the helper call lstat. The single
+ argument (the filename) should be passed in BUF, and
+ should include a terminating NUL character. The helper
+ should respond with a MNSH_RET_INTSTR. */
+ MNSH_REQ_LSTAT,
+
/* A request that the helper call open. Arguments should
be passed in BUF, INT1 and INT2. The filename (in BUF)
should include a terminating NUL character. The helper
@@ -265,62 +271,69 @@ enum mnsh_msg_type
MNSH_RET_INTSTR,
};
-/* Print a string representation of a message using debug_printf.
- This function is not async-signal-safe so should never be
- called from the helper. */
+/* Return a string representation of a message. This function is not
+ async-signal-safe so should never be called from the helper. */
-static void
+static std::string
mnsh_debug_print_message (enum mnsh_msg_type type,
int fd, int int1, int int2,
const void *buf, int bufsiz)
{
+ std::string res;
+
gdb_byte *c = (gdb_byte *) buf;
gdb_byte *cl = c + bufsiz;
switch (type)
{
case MNSH_MSG_ERROR:
- debug_printf ("ERROR");
+ res += "ERROR";
+ break;
+
+ case MNSH_REQ_LSTAT:
+ res += "LSTAT";
break;
case MNSH_REQ_SETNS:
- debug_printf ("SETNS");
+ res += "SETNS";
break;
case MNSH_REQ_OPEN:
- debug_printf ("OPEN");
+ res += "OPEN";
break;
case MNSH_REQ_UNLINK:
- debug_printf ("UNLINK");
+ res += "UNLINK";
break;
case MNSH_REQ_READLINK:
- debug_printf ("READLINK");
+ res += "READLINK";
break;
case MNSH_RET_INT:
- debug_printf ("INT");
+ res += "INT";
break;
case MNSH_RET_FD:
- debug_printf ("FD");
+ res += "FD";
break;
case MNSH_RET_INTSTR:
- debug_printf ("INTSTR");
+ res += "INTSTR";
break;
default:
- debug_printf ("unknown-packet-%d", type);
+ res += string_printf ("unknown-packet-%d", type);
}
- debug_printf (" %d %d %d \"", fd, int1, int2);
+ res += string_printf (" %d %d %d \"", fd, int1, int2);
for (; c < cl; c++)
- debug_printf (*c >= ' ' && *c <= '~' ? "%c" : "\\%o", *c);
+ res += string_printf (*c >= ' ' && *c <= '~' ? "%c" : "\\%o", *c);
- debug_printf ("\"");
+ res += "\"";
+
+ return res;
}
/* Forward declaration. */
@@ -390,12 +403,10 @@ mnsh_send_message (int sock, enum mnsh_msg_type type,
if (size < 0)
mnsh_maybe_mourn_peer ();
- if (debug_linux_namespaces)
- {
- debug_printf ("mnsh: send: ");
- mnsh_debug_print_message (type, fd, int1, int2, buf, bufsiz);
- debug_printf (" -> %s\n", pulongest (size));
- }
+ linux_namespaces_debug_printf
+ ("send: %s -> %s",
+ mnsh_debug_print_message (type, fd, int1, int2, buf, bufsiz).c_str (),
+ pulongest (size));
return size;
}
@@ -445,9 +456,8 @@ mnsh_recv_message (int sock, enum mnsh_msg_type *type,
size = recvmsg (sock, &msg, MSG_CMSG_CLOEXEC);
if (size < 0)
{
- if (debug_linux_namespaces)
- debug_printf ("namespace-helper: recv failed (%s)\n",
- pulongest (size));
+ linux_namespaces_debug_printf
+ ("namespace-helper: recv failed (%s)", pulongest (size));
mnsh_maybe_mourn_peer ();
@@ -457,9 +467,9 @@ mnsh_recv_message (int sock, enum mnsh_msg_type *type,
/* Check for truncation. */
if (size < fixed_size || (msg.msg_flags & (MSG_TRUNC | MSG_CTRUNC)))
{
- if (debug_linux_namespaces)
- debug_printf ("namespace-helper: recv truncated (%s 0x%x)\n",
- pulongest (size), msg.msg_flags);
+ linux_namespaces_debug_printf
+ ("namespace-helper: recv truncated (%s 0x%x)",
+ pulongest (size), msg.msg_flags);
mnsh_maybe_mourn_peer ();
@@ -477,13 +487,10 @@ mnsh_recv_message (int sock, enum mnsh_msg_type *type,
else
*fd = -1;
- if (debug_linux_namespaces)
- {
- debug_printf ("mnsh: recv: ");
- mnsh_debug_print_message (*type, *fd, *int1, *int2, buf,
- size - fixed_size);
- debug_printf ("\n");
- }
+ linux_namespaces_debug_printf
+ ("recv: %s",
+ mnsh_debug_print_message (*type, *fd, *int1, *int2, buf,
+ size - fixed_size).c_str ());
/* Return the number of bytes of data in BUF. */
return size - fixed_size;
@@ -514,6 +521,20 @@ mnsh_handle_setns (int sock, int fd, int nstype)
return mnsh_return_int (sock, result, errno);
}
+
+/* Handle a MNSH_REQ_LSTAT message. Must be async-signal-safe. */
+
+static ssize_t
+mnsh_handle_lstat (int sock, const char *filename)
+{
+ struct stat sb;
+ int stat_ok = lstat (filename, &sb);
+
+ return mnsh_return_intstr (sock, stat_ok, &sb,
+ stat_ok == -1 ? 0 : sizeof (sb),
+ errno);
+}
+
/* Handle a MNSH_REQ_OPEN message. Must be async-signal-safe. */
static ssize_t
@@ -574,6 +595,11 @@ mnsh_main (int sock)
response = mnsh_handle_setns (sock, fd, int1);
break;
+ case MNSH_REQ_LSTAT:
+ if (size > 0 && buf[size - 1] == '\0')
+ response = mnsh_handle_lstat (sock, buf);
+ break;
+
case MNSH_REQ_OPEN:
if (size > 0 && buf[size - 1] == '\0')
response = mnsh_handle_open (sock, buf, int1, int2);
@@ -673,7 +699,7 @@ linux_mntns_get_helper (void)
mnsh_creator_pid = helper_creator;
/* Debug printing isn't async-signal-safe. */
- debug_linux_namespaces = 0;
+ debug_linux_namespaces = false;
mnsh_main (sv[1]);
}
@@ -685,9 +711,8 @@ linux_mntns_get_helper (void)
helper->sock = sv[0];
helper->nsid = ns->id;
- if (debug_linux_namespaces)
- debug_printf ("Started mount namespace helper process %d\n",
- helper->pid);
+ linux_namespaces_debug_printf
+ ("Started mount namespace helper process %d", helper->pid);
}
return helper;
@@ -765,6 +790,10 @@ mnsh_maybe_mourn_peer (void)
mnsh_send_message (helper->sock, MNSH_REQ_OPEN, -1, flags, mode, \
filename, strlen (filename) + 1)
+#define mnsh_send_lstat(helper, filename) \
+ mnsh_send_message (helper->sock, MNSH_REQ_LSTAT, -1, 0, 0, \
+ filename, strlen (filename) + 1)
+
#define mnsh_send_unlink(helper, filename) \
mnsh_send_message (helper->sock, MNSH_REQ_UNLINK, -1, 0, 0, \
filename, strlen (filename) + 1)
@@ -884,7 +913,7 @@ linux_mntns_access_fs (pid_t pid)
struct stat sb;
struct linux_mnsh *helper;
ssize_t size;
- int fd;
+ int fd, fd_user = -1;
if (pid == getpid ())
return MNSH_FS_DIRECT;
@@ -901,6 +930,8 @@ linux_mntns_access_fs (pid_t pid)
{
int save_errno = errno;
close (fd);
+ if (fd_user >= 0)
+ close (fd_user);
errno = save_errno;
};
@@ -910,6 +941,13 @@ linux_mntns_access_fs (pid_t pid)
if (sb.st_ino == ns->id)
return MNSH_FS_DIRECT;
+ struct linux_ns *ns_user = linux_ns_get_namespace (LINUX_NS_USER);
+ if (ns_user != nullptr)
+ {
+ const char *ns_filename = linux_ns_filename (ns_user, pid);
+ fd_user = gdb_open_cloexec (ns_filename, O_RDONLY, 0).release ();
+ }
+
helper = linux_mntns_get_helper ();
if (helper == NULL)
return MNSH_FS_ERROR;
@@ -918,6 +956,19 @@ linux_mntns_access_fs (pid_t pid)
{
int result, error;
+ /* Try to enter the user namespace first. The current user might
+ have elevated privileges within the user namespace, which would
+ then allow the attempt to enter the mount namespace to succeed. */
+ if (fd_user >= 0)
+ {
+ size = mnsh_send_setns (helper, fd_user, 0);
+ if (size < 0)
+ return MNSH_FS_ERROR;
+
+ if (mnsh_recv_int (helper, &result, &error) != 0)
+ return MNSH_FS_ERROR;
+ }
+
size = mnsh_send_setns (helper, fd, 0);
if (size < 0)
return MNSH_FS_ERROR;
@@ -948,6 +999,42 @@ linux_mntns_access_fs (pid_t pid)
/* See nat/linux-namespaces.h. */
int
+linux_mntns_lstat (pid_t pid, const char *filename,
+ struct stat *sb)
+{
+ enum mnsh_fs_code access = linux_mntns_access_fs (pid);
+
+ if (access == MNSH_FS_ERROR)
+ return -1;
+
+ if (access == MNSH_FS_DIRECT)
+ return lstat (filename, sb);
+
+ gdb_assert (access == MNSH_FS_HELPER);
+
+ struct linux_mnsh *helper = linux_mntns_get_helper ();
+
+ ssize_t size = mnsh_send_lstat (helper, filename);
+ if (size < 0)
+ return -1;
+
+ int stat_ok, error;
+ size = mnsh_recv_intstr (helper, &stat_ok, &error, sb, sizeof (*sb));
+
+ if (size < 0)
+ {
+ stat_ok = -1;
+ errno = error;
+ }
+ else
+ gdb_assert (stat_ok == -1 || size == sizeof (*sb));
+
+ return stat_ok;
+}
+
+/* See nat/linux-namespaces.h. */
+
+int
linux_mntns_open_cloexec (pid_t pid, const char *filename,
int flags, mode_t mode)
{
diff --git a/gdb/nat/linux-namespaces.h b/gdb/nat/linux-namespaces.h
index 4327292..a9a99f1 100644
--- a/gdb/nat/linux-namespaces.h
+++ b/gdb/nat/linux-namespaces.h
@@ -1,6 +1,6 @@
/* Linux namespaces(7) support.
- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+ Copyright (C) 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -24,6 +24,12 @@
extern bool debug_linux_namespaces;
+/* Print a "linux-namespaces" debug statement. */
+
+#define linux_namespaces_debug_printf(fmt, ...) \
+ debug_prefixed_printf_cond (debug_linux_namespaces, "linux-namespaces", \
+ fmt, ##__VA_ARGS__)
+
/* Enumeration of Linux namespace types. */
enum linux_ns_type
@@ -58,6 +64,11 @@ enum linux_ns_type
extern int linux_ns_same (pid_t pid, enum linux_ns_type type);
+/* Like lstat(2), but in the mount namespace of process PID. */
+
+extern int linux_mntns_lstat (pid_t pid, const char *filename,
+ struct stat *sb);
+
/* Like gdb_open_cloexec, but in the mount namespace of process
PID. */
diff --git a/gdb/nat/linux-nat.h b/gdb/nat/linux-nat.h
index f85d072..59bbd1b 100644
--- a/gdb/nat/linux-nat.h
+++ b/gdb/nat/linux-nat.h
@@ -1,6 +1,6 @@
/* Code for native debugging support for GNU/Linux (LWP layer).
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c
index 3a62150..0a309b8 100644
--- a/gdb/nat/linux-osdata.c
+++ b/gdb/nat/linux-osdata.c
@@ -1,6 +1,6 @@
/* Linux-specific functions to retrieve OS data.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,7 +21,6 @@
#include <sys/types.h>
#include <sys/sysinfo.h>
-#include <ctype.h>
#include <utmp.h>
#include <time.h>
#include <unistd.h>
@@ -205,7 +204,7 @@ get_cores_used_by_process (PID_T pid, int *cores, const int num_cores)
PID_T tid;
int core;
- if (!isdigit (dp->d_name[0])
+ if (!c_isdigit (dp->d_name[0])
|| NAMELEN (dp) > MAX_PID_T_STRLEN)
continue;
@@ -310,7 +309,7 @@ linux_xfer_osdata_processes ()
std::string cores_str;
int i;
- if (!isdigit (dp->d_name[0])
+ if (!c_isdigit (dp->d_name[0])
|| NAMELEN (dp) > MAX_PID_T_STRLEN)
continue;
@@ -419,7 +418,7 @@ linux_xfer_osdata_processgroups ()
{
PID_T pid, pgid;
- if (!isdigit (dp->d_name[0])
+ if (!c_isdigit (dp->d_name[0])
|| NAMELEN (dp) > MAX_PID_T_STRLEN)
continue;
@@ -483,7 +482,7 @@ linux_xfer_osdata_threads ()
struct stat statbuf;
char procentry[sizeof ("/proc/4294967295")];
- if (!isdigit (dp->d_name[0])
+ if (!c_isdigit (dp->d_name[0])
|| NAMELEN (dp) > sizeof ("4294967295") - 1)
continue;
@@ -513,7 +512,7 @@ linux_xfer_osdata_threads ()
PID_T tid;
int core;
- if (!isdigit (dp2->d_name[0])
+ if (!c_isdigit (dp2->d_name[0])
|| NAMELEN (dp2) > sizeof ("4294967295") - 1)
continue;
@@ -633,7 +632,7 @@ linux_xfer_osdata_fds ()
struct stat statbuf;
char procentry[sizeof ("/proc/4294967295")];
- if (!isdigit (dp->d_name[0])
+ if (!c_isdigit (dp->d_name[0])
|| NAMELEN (dp) > sizeof ("4294967295") - 1)
continue;
@@ -662,7 +661,7 @@ linux_xfer_osdata_fds ()
char buf[1000];
ssize_t rslt;
- if (!isdigit (dp2->d_name[0]))
+ if (!c_isdigit (dp2->d_name[0]))
continue;
std::string fdname
diff --git a/gdb/nat/linux-osdata.h b/gdb/nat/linux-osdata.h
index b688116..6b263c5 100644
--- a/gdb/nat/linux-osdata.h
+++ b/gdb/nat/linux-osdata.h
@@ -1,6 +1,6 @@
/* Linux-specific functions to retrieve OS data.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/linux-personality.c b/gdb/nat/linux-personality.c
index a406c73..1f91477 100644
--- a/gdb/nat/linux-personality.c
+++ b/gdb/nat/linux-personality.c
@@ -1,6 +1,6 @@
/* Disable address space randomization based on inferior personality.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/linux-personality.h b/gdb/nat/linux-personality.h
index ab67270..630d493 100644
--- a/gdb/nat/linux-personality.h
+++ b/gdb/nat/linux-personality.h
@@ -1,6 +1,6 @@
/* Disable address space randomization based on inferior personality.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/linux-procfs.c b/gdb/nat/linux-procfs.c
index d762713..d4f9af3 100644
--- a/gdb/nat/linux-procfs.c
+++ b/gdb/nat/linux-procfs.c
@@ -1,5 +1,5 @@
/* Linux-specific PROCFS manipulation routines.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -424,7 +424,7 @@ linux_proc_task_list_dir_exists (pid_t pid)
/* See linux-procfs.h. */
const char *
-linux_proc_pid_to_exec_file (int pid)
+linux_proc_pid_to_exec_file (int pid, bool is_local_fs)
{
static char buf[PATH_MAX];
char name[PATH_MAX];
@@ -437,9 +437,31 @@ linux_proc_pid_to_exec_file (int pid)
else
buf[len] = '\0';
- /* Use /proc/PID/exe if the actual file can't be read, but /proc/PID/exe
- can be. */
- if (access (buf, R_OK) != 0 && access (name, R_OK) == 0)
+ /* If the inferior and GDB can see the same filesystem, and NAME
+ cannot be read, maybe the file has been deleted, then we can
+ potentially use /proc/PID/exe instead.
+
+ GDB always interprets the results of this function within the
+ current sysroot (which is 'target:' by default). This means
+ that, if we return /proc/PID/exe, GDB will try to find this file
+ within the sysroot.
+
+ This doesn't make sense if GDB is using a sysroot like:
+ '/some/random/directory/', not only is it possible that NAME
+ could be found within the sysroot, it is unlikely that
+ /proc/PID/exe will exist within the sysroot.
+
+ Similarly, if the sysroot is 'target:', but the inferior is
+ running within a separate MNT namespace, then it is more than
+ likely that the inferior will also be running in a separate PID
+ namespace, in this case PID is the pid on the host system,
+ /proc/PID/exe will not be correct within the inferiors MNT/PID
+ namespace.
+
+ So, we can fallback to use /proc/PID/exe only if IS_LOCAL_FS is
+ true, this indicates that GDB and the inferior are using the same
+ MNT namespace, and GDB's sysroot is either empty, or 'target:'. */
+ if (is_local_fs && access (buf, R_OK) != 0 && access (name, R_OK) == 0)
strcpy (buf, name);
return buf;
diff --git a/gdb/nat/linux-procfs.h b/gdb/nat/linux-procfs.h
index d484cc8..4b02d31 100644
--- a/gdb/nat/linux-procfs.h
+++ b/gdb/nat/linux-procfs.h
@@ -1,5 +1,5 @@
/* Linux-specific PROCFS manipulation routines.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -87,9 +87,19 @@ extern int linux_proc_task_list_dir_exists (pid_t pid);
/* Return the full absolute name of the executable file that was run
to create the process PID. The returned value persists until this
- function is next called. */
+ function is next called.
-extern const char *linux_proc_pid_to_exec_file (int pid);
+ LOCAL_FS should be true if the file returned from the function will
+ be searched for in the same filesystem as GDB itself is running.
+ In practice, this means LOCAL_FS should be true if PID and GDB are
+ running in the same MNT namespace and GDB's sysroot is either the
+ empty string, or is 'target:'.
+
+ When used from gdbserver, where there is no sysroot, the only check
+ that matters is that PID and gdbserver are running in the same MNT
+ namespace. */
+
+extern const char *linux_proc_pid_to_exec_file (int pid, bool local_fs);
/* Display possible problems on this system. Display them only once
per GDB execution. */
diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
index f90183b..7df85c1 100644
--- a/gdb/nat/linux-ptrace.c
+++ b/gdb/nat/linux-ptrace.c
@@ -1,5 +1,5 @@
/* Linux-specific ptrace manipulation routines.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -23,12 +23,47 @@
#include <sys/procfs.h>
#endif
#include "gdbsupport/eintr.h"
+#include "gdbsupport/signals-state-save-restore.h"
+#include "gdbsupport/gdb_file.h"
/* Stores the ptrace options supported by the running kernel.
A value of -1 means we did not check for features yet. A value
of 0 means there are no supported features. */
static int supported_ptrace_options = -1;
+/* The file from which the kernel.yama.ptrace_scope setting is read. */
+
+static constexpr char ptrace_scope_filename[]
+ = "/proc/sys/kernel/yama/ptrace_scope";
+
+/* Reads the yama ptrace_scope value from /proc. Returns the integer value
+ of ptrace_scope (0, 1, 2, or 3) or -1 if the file cannot be read (e.g.,
+ yama is not enabled). */
+
+static int
+get_ptrace_scope ()
+{
+ int ptrace_scope = -1;
+
+ /* The /proc file that contains the system-wide ptrace scope setting. */
+ gdb_file_up fp (fopen (ptrace_scope_filename, "r"));
+ if (fp != nullptr)
+ {
+ if (fscanf (fp.get (), "%d", &ptrace_scope) != 1)
+ {
+ /* If fscanf fails then we couldn't parse the number. But just
+ to be safe, set the scope back to -1 to indicate no value is
+ available. */
+ ptrace_scope = -1;
+ }
+ }
+
+ /* If fp is NULL, it's likely because the yama security module is not
+ active. In this case, we return -1 to indicate that the scope is
+ unknown or not applicable. */
+ return ptrace_scope;
+}
+
/* Find all possible reasons we could fail to attach PID and return these
as a string. An empty string is returned if we didn't find any reason. */
@@ -43,6 +78,13 @@ linux_ptrace_attach_fail_reason (pid_t pid)
_("process %d is already traced by process %d"),
(int) pid, (int) tracerpid);
+ int ptrace_scope = get_ptrace_scope ();
+ if (ptrace_scope > 0)
+ string_appendf (result,
+ _("the %s setting of %d might prevent attaching, "
+ "see 'man 2 ptrace'"),
+ ptrace_scope_filename, ptrace_scope);
+
if (linux_proc_pid_is_zombie_nowarn (pid))
string_appendf (result,
_("process %d is a zombie - the process has already "
@@ -148,6 +190,9 @@ linux_ptrace_test_ret_to_nx (void)
return;
case 0:
+ /* Set signal handlers to their default because it doesn't make sense
+ to call GDB-specific handlers any more in the child process. */
+ restore_original_signals_state ();
l = ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) NULL,
(PTRACE_TYPE_ARG4) NULL);
if (l != 0)
diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h
index c7d4023..725ff9f 100644
--- a/gdb/nat/linux-ptrace.h
+++ b/gdb/nat/linux-ptrace.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/linux-waitpid.c b/gdb/nat/linux-waitpid.c
index f4ae612..8ee7d97 100644
--- a/gdb/nat/linux-waitpid.c
+++ b/gdb/nat/linux-waitpid.c
@@ -1,6 +1,6 @@
/* Wrapper implementation for waitpid for GNU/Linux (LWP layer).
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/linux-waitpid.h b/gdb/nat/linux-waitpid.h
index b75782d..238dc2a 100644
--- a/gdb/nat/linux-waitpid.h
+++ b/gdb/nat/linux-waitpid.h
@@ -1,6 +1,6 @@
/* Wrapper for waitpid for GNU/Linux (LWP layer).
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/loongarch-hw-point.c b/gdb/nat/loongarch-hw-point.c
index af954c6..93c4462 100644
--- a/gdb/nat/loongarch-hw-point.c
+++ b/gdb/nat/loongarch-hw-point.c
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux on LoongArch processors.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
Contributed by Loongson Ltd.
This file is part of GDB.
diff --git a/gdb/nat/loongarch-hw-point.h b/gdb/nat/loongarch-hw-point.h
index 3d3d2c1..90926ef 100644
--- a/gdb/nat/loongarch-hw-point.h
+++ b/gdb/nat/loongarch-hw-point.h
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux on LoongArch processors.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
Contributed by Loongson Ltd.
This file is part of GDB.
diff --git a/gdb/nat/loongarch-linux-hw-point.c b/gdb/nat/loongarch-linux-hw-point.c
index 26a88ee..f41fa1b 100644
--- a/gdb/nat/loongarch-linux-hw-point.c
+++ b/gdb/nat/loongarch-linux-hw-point.c
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux on LoongArch processors.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
Contributed by Loongson Ltd.
This file is part of GDB.
diff --git a/gdb/nat/loongarch-linux-hw-point.h b/gdb/nat/loongarch-linux-hw-point.h
index d8b8feb..9c244a4 100644
--- a/gdb/nat/loongarch-linux-hw-point.h
+++ b/gdb/nat/loongarch-linux-hw-point.h
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux on LoongArch processors.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
Contributed by Loongson Ltd.
This file is part of GDB.
diff --git a/gdb/nat/loongarch-linux.c b/gdb/nat/loongarch-linux.c
index 9486785..89c83bc 100644
--- a/gdb/nat/loongarch-linux.c
+++ b/gdb/nat/loongarch-linux.c
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux on LoongArch processors.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
Contributed by Loongson Ltd.
This file is part of GDB.
diff --git a/gdb/nat/loongarch-linux.h b/gdb/nat/loongarch-linux.h
index 0505bf3..2d17ae0 100644
--- a/gdb/nat/loongarch-linux.h
+++ b/gdb/nat/loongarch-linux.h
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux on LoongArch processors.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
Contributed by Loongson Ltd.
This file is part of GDB.
diff --git a/gdb/nat/mips-linux-watch.c b/gdb/nat/mips-linux-watch.c
index 7d105e8..b9be3a0 100644
--- a/gdb/nat/mips-linux-watch.c
+++ b/gdb/nat/mips-linux-watch.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/mips-linux-watch.h b/gdb/nat/mips-linux-watch.h
index b18b009..3cada37 100644
--- a/gdb/nat/mips-linux-watch.h
+++ b/gdb/nat/mips-linux-watch.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/netbsd-nat.c b/gdb/nat/netbsd-nat.c
index 713ed6a..a6d9b14 100644
--- a/gdb/nat/netbsd-nat.c
+++ b/gdb/nat/netbsd-nat.c
@@ -1,6 +1,6 @@
/* Internal interfaces for the NetBSD code.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/netbsd-nat.h b/gdb/nat/netbsd-nat.h
index 1ffd705..99208cb 100644
--- a/gdb/nat/netbsd-nat.h
+++ b/gdb/nat/netbsd-nat.h
@@ -1,6 +1,6 @@
/* Internal interfaces for the NetBSD code.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/ppc-linux.c b/gdb/nat/ppc-linux.c
index d64ed33..e48455e 100644
--- a/gdb/nat/ppc-linux.c
+++ b/gdb/nat/ppc-linux.c
@@ -1,4 +1,4 @@
-/*Copyright (C) 2015-2024 Free Software Foundation, Inc.
+/*Copyright (C) 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/ppc-linux.h b/gdb/nat/ppc-linux.h
index 3efc1b9..9779274 100644
--- a/gdb/nat/ppc-linux.h
+++ b/gdb/nat/ppc-linux.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/riscv-linux-tdesc.c b/gdb/nat/riscv-linux-tdesc.c
index 0cd3843..254a25c 100644
--- a/gdb/nat/riscv-linux-tdesc.c
+++ b/gdb/nat/riscv-linux-tdesc.c
@@ -1,5 +1,5 @@
/* GNU/Linux/RISC-V native target description support for GDB.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/riscv-linux-tdesc.h b/gdb/nat/riscv-linux-tdesc.h
index 875135e..de10d91 100644
--- a/gdb/nat/riscv-linux-tdesc.h
+++ b/gdb/nat/riscv-linux-tdesc.h
@@ -1,5 +1,5 @@
/* GNU/Linux/RISC-V native target description support for GDB.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c
index 6f1ce81..7b0fbc5 100644
--- a/gdb/nat/windows-nat.c
+++ b/gdb/nat/windows-nat.c
@@ -1,5 +1,5 @@
/* Internal interfaces for the Windows code
- Copyright (C) 1995-2024 Free Software Foundation, Inc.
+ Copyright (C) 1995-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h
index c01f58f..2f50742 100644
--- a/gdb/nat/windows-nat.h
+++ b/gdb/nat/windows-nat.h
@@ -1,5 +1,5 @@
/* Internal interfaces for the Windows code
- Copyright (C) 1995-2024 Free Software Foundation, Inc.
+ Copyright (C) 1995-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/x86-cpuid.h b/gdb/nat/x86-cpuid.h
index 02a204c..6889f56 100644
--- a/gdb/nat/x86-cpuid.h
+++ b/gdb/nat/x86-cpuid.h
@@ -1,5 +1,5 @@
/* C API for x86 cpuid insn.
- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+ Copyright (C) 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/x86-dregs.c b/gdb/nat/x86-dregs.c
index 7ea9f49..4119214 100644
--- a/gdb/nat/x86-dregs.c
+++ b/gdb/nat/x86-dregs.c
@@ -1,6 +1,6 @@
/* Debug register code for x86 (i386 and x86-64).
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/x86-dregs.h b/gdb/nat/x86-dregs.h
index 3dcbf8e..c7f38f6 100644
--- a/gdb/nat/x86-dregs.h
+++ b/gdb/nat/x86-dregs.h
@@ -1,6 +1,6 @@
/* Debug register code for x86 (i386 and x86-64).
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/x86-gcc-cpuid.h b/gdb/nat/x86-gcc-cpuid.h
index b0f2d23..9e27fd8 100644
--- a/gdb/nat/x86-gcc-cpuid.h
+++ b/gdb/nat/x86-gcc-cpuid.h
@@ -1,5 +1,5 @@
/*
- * Helper cpuid.h file copied from gcc-6.0.0. Code in gdb should not
+ * Helper cpuid.h file copied from gcc-14.2.0. Code in gdb should not
* include this directly, but pull in x86-cpuid.h and use that func.
*/
@@ -7,7 +7,7 @@
#define GDB_NAT_X86_GCC_CPUID_H
/*
- * Copyright (C) 2007-2024 Free Software Foundation, Inc.
+ * Copyright (C) 2007-2025 Free Software Foundation, Inc.
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -55,7 +55,7 @@
#define bit_SSE (1 << 25)
#define bit_SSE2 (1 << 26)
-/* Extended Features */
+/* Extended Features (%eax == 0x80000001) */
/* %ecx */
#define bit_LAHF_LM (1 << 0)
#define bit_ABM (1 << 5)
@@ -68,29 +68,28 @@
#define bit_MWAITX (1 << 29)
/* %edx */
-#define bit_AVX5124VNNIW (1 << 2)
-#define bit_AVX5124FMAPS (1 << 3)
#define bit_MMXEXT (1 << 22)
#define bit_LM (1 << 29)
#define bit_3DNOWP (1 << 30)
-#define bit_3DNOW (1 << 31)
+#define bit_3DNOW (1u << 31)
-/* %ebx. */
+/* %ebx */
#define bit_CLZERO (1 << 0)
+#define bit_WBNOINVD (1 << 9)
-/* Extended Features (%eax == 7) */
+/* Extended Features Leaf (%eax == 7, %ecx == 0) */
/* %ebx */
#define bit_FSGSBASE (1 << 0)
-#define bit_BMI (1 << 3)
-#define bit_HLE (1 << 4)
+#define bit_SGX (1 << 2)
+#define bit_BMI (1 << 3)
+#define bit_HLE (1 << 4)
#define bit_AVX2 (1 << 5)
#define bit_BMI2 (1 << 8)
-#define bit_RTM (1 << 11)
-#define bit_MPX (1 << 14)
+#define bit_RTM (1 << 11)
#define bit_AVX512F (1 << 16)
#define bit_AVX512DQ (1 << 17)
#define bit_RDSEED (1 << 18)
-#define bit_ADX (1 << 19)
+#define bit_ADX (1 << 19)
#define bit_AVX512IFMA (1 << 21)
#define bit_CLFLUSHOPT (1 << 23)
#define bit_CLWB (1 << 24)
@@ -99,23 +98,85 @@
#define bit_AVX512CD (1 << 28)
#define bit_SHA (1 << 29)
#define bit_AVX512BW (1 << 30)
-#define bit_AVX512VL (1 << 31)
+#define bit_AVX512VL (1u << 31)
/* %ecx */
-#define bit_PREFETCHWT1 (1 << 0)
+#define bit_PREFETCHWT1 (1 << 0)
#define bit_AVX512VBMI (1 << 1)
-#define bit_PKU (1 << 3)
+#define bit_PKU (1 << 3)
#define bit_OSPKE (1 << 4)
+#define bit_WAITPKG (1 << 5)
+#define bit_AVX512VBMI2 (1 << 6)
+#define bit_SHSTK (1 << 7)
+#define bit_GFNI (1 << 8)
+#define bit_VAES (1 << 9)
+#define bit_VPCLMULQDQ (1 << 10)
+#define bit_AVX512VNNI (1 << 11)
+#define bit_AVX512BITALG (1 << 12)
+#define bit_AVX512VPOPCNTDQ (1 << 14)
+#define bit_RDPID (1 << 22)
+#define bit_KL (1 << 23)
+#define bit_CLDEMOTE (1 << 25)
+#define bit_MOVDIRI (1 << 27)
+#define bit_MOVDIR64B (1 << 28)
+#define bit_ENQCMD (1 << 29)
-/* XFEATURE_ENABLED_MASK register bits (%eax == 13, %ecx == 0) */
-#define bit_BNDREGS (1 << 3)
-#define bit_BNDCSR (1 << 4)
+/* %edx */
+#define bit_AVX5124VNNIW (1 << 2)
+#define bit_AVX5124FMAPS (1 << 3)
+#define bit_UINTR (1 << 5)
+#define bit_AVX512VP2INTERSECT (1 << 8)
+#define bit_SERIALIZE (1 << 14)
+#define bit_TSXLDTRK (1 << 16)
+#define bit_PCONFIG (1 << 18)
+#define bit_IBT (1 << 20)
+#define bit_AMX_BF16 (1 << 22)
+#define bit_AVX512FP16 (1 << 23)
+#define bit_AMX_TILE (1 << 24)
+#define bit_AMX_INT8 (1 << 25)
+
+/* Extended Features Sub-leaf (%eax == 7, %ecx == 1) */
+/* %eax */
+#define bit_SHA512 (1 << 0)
+#define bit_SM3 (1 << 1)
+#define bit_SM4 (1 << 2)
+#define bit_RAOINT (1 << 3)
+#define bit_AVXVNNI (1 << 4)
+#define bit_AVX512BF16 (1 << 5)
+#define bit_CMPCCXADD (1 << 7)
+#define bit_AMX_COMPLEX (1 << 8)
+#define bit_AMX_FP16 (1 << 21)
+#define bit_HRESET (1 << 22)
+#define bit_AVXIFMA (1 << 23)
-/* Extended State Enumeration Sub-leaf (%eax == 13, %ecx == 1) */
+/* %edx */
+#define bit_AVXVNNIINT8 (1 << 4)
+#define bit_AVXNECONVERT (1 << 5)
+#define bit_AVXVNNIINT16 (1 << 10)
+#define bit_PREFETCHI (1 << 14)
+#define bit_USER_MSR (1 << 15)
+#define bit_AVX10 (1 << 19)
+#define bit_APX_F (1 << 21)
+
+/* Extended State Enumeration Sub-leaf (%eax == 0xd, %ecx == 1) */
#define bit_XSAVEOPT (1 << 0)
#define bit_XSAVEC (1 << 1)
#define bit_XSAVES (1 << 3)
+/* PT sub leaf (%eax == 0x14, %ecx == 0) */
+/* %ebx */
+#define bit_PTWRITE (1 << 4)
+
+/* Keylocker leaf (%eax == 0x19) */
+/* %ebx */
+#define bit_AESKLE ( 1<<0 )
+#define bit_WIDEKL ( 1<<2 )
+
+/* AVX10 sub leaf (%eax == 0x24) */
+/* %ebx */
+#define bit_AVX10_256 (1 << 17)
+#define bit_AVX10_512 (1 << 18)
+
/* Signatures for different CPU implementations as returned in uses
of cpuid with level 0. */
#define signature_AMD_ebx 0x68747541
@@ -170,19 +231,40 @@
#define signature_VORTEX_ecx 0x436f5320
#define signature_VORTEX_edx 0x36387865
-#define __cpuid(level, a, b, c, d) \
- __asm__ ("cpuid\n\t" \
- : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
- : "0" (level))
+#define signature_SHANGHAI_ebx 0x68532020
+#define signature_SHANGHAI_ecx 0x20206961
+#define signature_SHANGHAI_edx 0x68676e61
-#define __cpuid_count(level, count, a, b, c, d) \
- __asm__ ("cpuid\n\t" \
- : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
- : "0" (level), "2" (count))
+#ifndef __x86_64__
+/* At least one cpu (Winchip 2) does not set %ebx and %ecx
+ for cpuid leaf 1. Forcibly zero the two registers before
+ calling cpuid as a precaution. */
+#define __cpuid(level, a, b, c, d) \
+ do { \
+ if (__builtin_constant_p (level) && (level) != 1) \
+ __asm__ __volatile__ ("cpuid\n\t" \
+ : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
+ : "0" (level)); \
+ else \
+ __asm__ __volatile__ ("cpuid\n\t" \
+ : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
+ : "0" (level), "1" (0), "2" (0)); \
+ } while (0)
+#else
+#define __cpuid(level, a, b, c, d) \
+ __asm__ __volatile__ ("cpuid\n\t" \
+ : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
+ : "0" (level))
+#endif
+
+#define __cpuid_count(level, count, a, b, c, d) \
+ __asm__ __volatile__ ("cpuid\n\t" \
+ : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
+ : "0" (level), "2" (count))
/* Return highest supported input value for cpuid instruction. ext can
- be either 0x0 or 0x8000000 to return highest supported value for
+ be either 0x0 or 0x80000000 to return highest supported value for
basic or extended cpuid information. Function returns 0 if cpuid
is not supported or whatever cpuid returns in eax register. If sig
pointer is non-null, then first four bytes of the signature
@@ -225,7 +307,7 @@ __get_cpuid_max (unsigned int __ext, unsigned int *__sig)
: "i" (0x00200000));
#endif
- if (!((__eax ^ __ebx) & 0x00200000))
+ if (__builtin_expect (!((__eax ^ __ebx) & 0x00200000), 0))
return 0;
#endif
@@ -249,8 +331,9 @@ __get_cpuid (unsigned int __leaf,
unsigned int *__ecx, unsigned int *__edx)
{
unsigned int __ext = __leaf & 0x80000000;
+ unsigned int __maxlevel = __get_cpuid_max (__ext, 0);
- if (__get_cpuid_max (__ext, 0) < __leaf)
+ if (__maxlevel == 0 || __maxlevel < __leaf)
return 0;
__cpuid (__leaf, *__eax, *__ebx, *__ecx, *__edx);
@@ -265,12 +348,20 @@ __get_cpuid_count (unsigned int __leaf, unsigned int __subleaf,
unsigned int *__ecx, unsigned int *__edx)
{
unsigned int __ext = __leaf & 0x80000000;
+ unsigned int __maxlevel = __get_cpuid_max (__ext, 0);
- if (__get_cpuid_max (__ext, 0) < __leaf)
+ if (__builtin_expect (__maxlevel == 0, 0) || __maxlevel < __leaf)
return 0;
__cpuid_count (__leaf, __subleaf, *__eax, *__ebx, *__ecx, *__edx);
return 1;
}
+static __inline void
+__cpuidex (int __cpuid_info[4], int __leaf, int __subleaf)
+{
+ __cpuid_count (__leaf, __subleaf, __cpuid_info[0], __cpuid_info[1],
+ __cpuid_info[2], __cpuid_info[3]);
+}
+
#endif /* GDB_NAT_X86_GCC_CPUID_H */
diff --git a/gdb/nat/x86-linux-dregs.c b/gdb/nat/x86-linux-dregs.c
index a6c0ea6..2953932 100644
--- a/gdb/nat/x86-linux-dregs.c
+++ b/gdb/nat/x86-linux-dregs.c
@@ -1,6 +1,6 @@
/* Low-level debug register code for GNU/Linux x86 (i386 and x86-64).
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/x86-linux-dregs.h b/gdb/nat/x86-linux-dregs.h
index 6f6a6e3..4c3bcfb 100644
--- a/gdb/nat/x86-linux-dregs.h
+++ b/gdb/nat/x86-linux-dregs.h
@@ -1,6 +1,6 @@
/* Low-level debug register code for GNU/Linux x86 (i386 and x86-64).
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/x86-linux-tdesc.c b/gdb/nat/x86-linux-tdesc.c
index 1824f57..5bc36b6 100644
--- a/gdb/nat/x86-linux-tdesc.c
+++ b/gdb/nat/x86-linux-tdesc.c
@@ -1,6 +1,6 @@
/* Target description related code for GNU/Linux x86 (i386 and x86-64).
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -43,7 +43,7 @@
/* See nat/x86-linux-tdesc.h. */
const target_desc *
-x86_linux_tdesc_for_tid (int tid, uint64_t *xcr0_storage,
+x86_linux_tdesc_for_tid (int tid, uint64_t *xstate_bv_storage,
x86_xsave_layout *xsave_layout_storage)
{
#ifdef __x86_64__
@@ -96,30 +96,34 @@ x86_linux_tdesc_for_tid (int tid, uint64_t *xcr0_storage,
these bits being set we generate a completely empty tdesc for
i386 which will be rejected by GDB. */
have_ptrace_getregset = TRIBOOL_FALSE;
- *xcr0_storage = X86_XSTATE_SSE_MASK;
+ *xstate_bv_storage = X86_XSTATE_SSE_MASK;
}
else
{
have_ptrace_getregset = TRIBOOL_TRUE;
/* Get XCR0 from XSAVE extended state. */
- *xcr0_storage = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET
+ uint64_t xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET
/ sizeof (uint64_t))];
*xsave_layout_storage
- = x86_fetch_xsave_layout (*xcr0_storage, x86_xsave_length ());
+ = x86_fetch_xsave_layout (xcr0, x86_xsave_length ());
+
+ *xstate_bv_storage = xcr0;
+ if (x86_check_ssp_support (tid))
+ *xstate_bv_storage |= X86_XSTATE_CET_U;
}
}
- /* Use cached xcr0 value. */
- uint64_t xcr0_features_bits = *xcr0_storage & X86_XSTATE_ALL_MASK;
+ /* Use cached XSTATE_BV_STORAGE value. */
+ uint64_t xstate_bv_features_bits = *xstate_bv_storage & X86_XSTATE_ALL_MASK;
#ifdef __x86_64__
if (is_64bit)
- return amd64_linux_read_description (xcr0_features_bits, is_x32);
+ return amd64_linux_read_description (xstate_bv_features_bits, is_x32);
else
#endif
- return i386_linux_read_description (xcr0_features_bits);
+ return i386_linux_read_description (xstate_bv_features_bits);
}
#endif /* !IN_PROCESS_AGENT */
diff --git a/gdb/nat/x86-linux-tdesc.h b/gdb/nat/x86-linux-tdesc.h
index 2a2d869..19aa84f 100644
--- a/gdb/nat/x86-linux-tdesc.h
+++ b/gdb/nat/x86-linux-tdesc.h
@@ -1,6 +1,6 @@
/* Target description related code for GNU/Linux x86 (i386 and x86-64).
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -27,9 +27,9 @@ struct x86_xsave_layout;
/* Return the target description for Linux thread TID.
- The storage pointed to by XCR0_STORAGE and XSAVE_LAYOUT_STORAGE must
+ The storage pointed to by XSTATE_BV_STORAGE and XSAVE_LAYOUT_STORAGE must
exist until the program (GDB or gdbserver) terminates, this storage is
- used to cache the xcr0 and xsave layout values. The values pointed to
+ used to cache the xstate_bv and xsave layout values. The values pointed to
by these arguments are only updated at most once, the first time this
function is called if the have_ptrace_getregset global is set to
TRIBOOL_UNKNOWN.
@@ -45,6 +45,7 @@ struct x86_xsave_layout;
returned. */
extern const target_desc *x86_linux_tdesc_for_tid
- (int tid, uint64_t *xcr0_storage, x86_xsave_layout *xsave_layout_storage);
+ (int tid, uint64_t *xstate_bv_storage,
+ x86_xsave_layout *xsave_layout_storage);
#endif /* GDB_NAT_X86_LINUX_TDESC_H */
diff --git a/gdb/nat/x86-linux.c b/gdb/nat/x86-linux.c
index ad3ed3c..5515826 100644
--- a/gdb/nat/x86-linux.c
+++ b/gdb/nat/x86-linux.c
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux x86 (i386 and x86-64).
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,6 +17,12 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "elf/common.h"
+#include "gdbsupport/common-defs.h"
+#include "nat/gdb_ptrace.h"
+#include "nat/linux-ptrace.h"
+#include "nat/x86-cpuid.h"
+#include <sys/uio.h>
#include "x86-linux.h"
#include "x86-linux-dregs.h"
#include "nat/gdb_ptrace.h"
@@ -126,3 +132,56 @@ x86_linux_ptrace_get_arch_size (int tid)
return x86_linux_arch_size (false, false);
#endif
}
+
+/* See nat/x86-linux.h. */
+
+bool
+x86_check_ssp_support (const int tid)
+{
+ /* It's not enough to check shadow stack support with the ptrace call
+ below only, as we cannot distinguish between shadow stack not enabled
+ for the current thread and shadow stack is not supported by HW. In
+ both scenarios the ptrace call fails with ENODEV. In case shadow
+ stack is not enabled for the current thread, we still want to return
+ true. */
+ unsigned int eax, ebx, ecx, edx;
+ eax = ebx = ecx = edx = 0;
+
+ if (!__get_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx))
+ return false;
+
+ if ((ecx & bit_SHSTK) == 0)
+ return false;
+
+ /* Further check for NT_X86_SHSTK kernel support. */
+ uint64_t ssp;
+ iovec iov {&ssp, sizeof (ssp) };
+
+ errno = 0;
+ int res = ptrace (PTRACE_GETREGSET, tid, NT_X86_SHSTK, &iov);
+ if (res < 0)
+ {
+ if (errno == EINVAL)
+ {
+ /* The errno EINVAL for a PTRACE_GETREGSET call indicates that
+ kernel support is not available. */
+ return false;
+ }
+ else if (errno == ENODEV)
+ {
+ /* At this point, since we already checked CPUID, the errno
+ ENODEV for a PTRACE_GETREGSET call indicates that shadow
+ stack is not enabled for the current thread. As it could be
+ enabled later, we still want to return true here. */
+ return true;
+ }
+ else
+ {
+ warning (_("Unknown ptrace error for NT_X86_SHSTK: %s"),
+ safe_strerror (errno));
+ return false;
+ }
+ }
+
+ return true;
+}
diff --git a/gdb/nat/x86-linux.h b/gdb/nat/x86-linux.h
index 7c0ac77..1783aae 100644
--- a/gdb/nat/x86-linux.h
+++ b/gdb/nat/x86-linux.h
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux x86 (i386 and x86-64).
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -75,4 +75,8 @@ private:
extern x86_linux_arch_size x86_linux_ptrace_get_arch_size (int tid);
+/* Check shadow stack hardware and kernel support. */
+
+extern bool x86_check_ssp_support (const int tid);
+
#endif /* GDB_NAT_X86_LINUX_H */
diff --git a/gdb/nat/x86-xstate.c b/gdb/nat/x86-xstate.c
index ca6fbbf..6f2dfde 100644
--- a/gdb/nat/x86-xstate.c
+++ b/gdb/nat/x86-xstate.c
@@ -1,6 +1,6 @@
/* x86 XSAVE extended state functions.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nat/x86-xstate.h b/gdb/nat/x86-xstate.h
index 14b58cd..0046ab8 100644
--- a/gdb/nat/x86-xstate.h
+++ b/gdb/nat/x86-xstate.h
@@ -1,6 +1,6 @@
/* x86 XSAVE extended state functions.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
index e08ead2..9180cd0 100644
--- a/gdb/nds32-tdep.c
+++ b/gdb/nds32-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the NDS32 architecture, for GDB.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
Contributed by Andes Technology Corporation.
This file is part of GDB.
@@ -1935,7 +1935,7 @@ nds32_validate_tdesc_p (const struct target_desc *tdesc,
}
/* Initialize the current architecture based on INFO. If possible,
- re-use an architecture from ARCHES, which is a list of
+ reuse an architecture from ARCHES, which is a list of
architectures already created during this debugging session.
Called e.g. at program startup, when reading a core file, and when
@@ -2086,9 +2086,7 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_nds32_tdep ();
-void
-_initialize_nds32_tdep ()
+INIT_GDB_FILE (nds32_tdep)
{
/* Initialize gdbarch. */
gdbarch_register (bfd_arch_nds32, nds32_gdbarch_init);
diff --git a/gdb/nds32-tdep.h b/gdb/nds32-tdep.h
index 18c360d..0b812d3 100644
--- a/gdb/nds32-tdep.h
+++ b/gdb/nds32-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for the NDS32 architecture, for GDB.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
Contributed by Andes Technology Corporation.
This file is part of GDB.
diff --git a/gdb/netbsd-nat.c b/gdb/netbsd-nat.c
index 5005cb8..3e54f07 100644
--- a/gdb/netbsd-nat.c
+++ b/gdb/netbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for NetBSD.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -260,7 +260,7 @@ nbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
Pass MODIFIED as true, we do not know the real modification state. */
func (kve->kve_start, size, kve->kve_protection & KVME_PROT_READ,
kve->kve_protection & KVME_PROT_WRITE,
- kve->kve_protection & KVME_PROT_EXEC, 1, false, data);
+ kve->kve_protection & KVME_PROT_EXEC, true, false, data);
}
return 0;
}
@@ -318,7 +318,7 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
if (pid == 0)
error (_("No current process: you must name one."));
}
- else if (built_argv.count () == 1 && isdigit (built_argv[0][0]))
+ else if (built_argv.count () == 1 && c_isdigit (built_argv[0][0]))
pid = strtol (built_argv[0], NULL, 10);
else
error (_("Invalid arguments."));
@@ -476,7 +476,7 @@ nbsd_resume(nbsd_nat_target *target, ptid_t ptid, int step,
/* If ptid is a specific LWP, suspend all other LWPs in the process. */
inferior *inf = find_inferior_ptid (target, ptid);
- for (thread_info *tp : inf->non_exited_threads ())
+ for (thread_info &tp : inf->non_exited_threads ())
{
if (tp->ptid.lwp () == ptid.lwp ())
request = PT_RESUME;
@@ -491,20 +491,20 @@ nbsd_resume(nbsd_nat_target *target, ptid_t ptid, int step,
{
/* If ptid is a wildcard, resume all matching threads (they won't run
until the process is continued however). */
- for (thread_info *tp : all_non_exited_threads (target, ptid))
+ for (thread_info &tp : all_non_exited_threads (target, ptid))
if (ptrace (PT_RESUME, tp->ptid.pid (), NULL, tp->ptid.lwp ()) == -1)
perror_with_name (("ptrace"));
}
if (step)
{
- for (thread_info *tp : all_non_exited_threads (target, ptid))
+ for (thread_info &tp : all_non_exited_threads (target, ptid))
if (ptrace (PT_SETSTEP, tp->ptid.pid (), NULL, tp->ptid.lwp ()) == -1)
perror_with_name (("ptrace"));
}
else
{
- for (thread_info *tp : all_non_exited_threads (target, ptid))
+ for (thread_info &tp : all_non_exited_threads (target, ptid))
if (ptrace (PT_CLEARSTEP, tp->ptid.pid (), NULL, tp->ptid.lwp ()) == -1)
perror_with_name (("ptrace"));
}
diff --git a/gdb/netbsd-nat.h b/gdb/netbsd-nat.h
index 87e076f..86cb0e6 100644
--- a/gdb/netbsd-nat.h
+++ b/gdb/netbsd-nat.h
@@ -1,6 +1,6 @@
/* Native-dependent code for NetBSD.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/netbsd-tdep.c b/gdb/netbsd-tdep.c
index 415a743..3793bd2 100644
--- a/gdb/netbsd-tdep.c
+++ b/gdb/netbsd-tdep.c
@@ -1,6 +1,6 @@
/* Common target-dependent code for NetBSD systems.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Wasabi Systems, Inc.
diff --git a/gdb/netbsd-tdep.h b/gdb/netbsd-tdep.h
index 2e2993e..9e68ad8 100644
--- a/gdb/netbsd-tdep.h
+++ b/gdb/netbsd-tdep.h
@@ -1,5 +1,5 @@
/* Common target-dependent definitions for NetBSD systems.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Wasabi Systems, Inc.
This file is part of GDB.
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 58aca29..e70dc12 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -1,6 +1,6 @@
/* Objective-C language support routines for GDB, the GNU debugger.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Apple Computer, Inc.
Written by Michael Snyder.
@@ -46,7 +46,6 @@
#include "cli/cli-utils.h"
#include "c-exp.h"
-#include <ctype.h>
#include <algorithm>
struct objc_object {
@@ -602,9 +601,9 @@ info_selectors_command (const char *regexp, int from_tty)
}
/* First time through is JUST to get max length and count. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
QUIT;
name = msymbol->natural_name ();
@@ -642,9 +641,9 @@ info_selectors_command (const char *regexp, int from_tty)
sym_arr = XALLOCAVEC (struct symbol *, matches);
matches = 0;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
QUIT;
name = msymbol->natural_name ();
@@ -756,9 +755,9 @@ info_classes_command (const char *regexp, int from_tty)
}
/* First time through is JUST to get max length and count. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
QUIT;
name = msymbol->natural_name ();
@@ -783,9 +782,9 @@ info_classes_command (const char *regexp, int from_tty)
regexp ? regexp : "*");
sym_arr = XALLOCAVEC (struct symbol *, matches);
matches = 0;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
QUIT;
name = msymbol->natural_name ();
@@ -850,9 +849,9 @@ parse_selector (char *method, char **selector)
for (;;)
{
- if (isalnum (*s2) || (*s2 == '_') || (*s2 == ':'))
+ if (c_isalnum (*s2) || (*s2 == '_') || (*s2 == ':'))
*s1++ = *s2;
- else if (isspace (*s2))
+ else if (c_isspace (*s2))
;
else if ((*s2 == '\0') || (*s2 == '\''))
break;
@@ -914,7 +913,7 @@ parse_method (char *method, char *type, char **theclass,
s1++;
nclass = s1;
- while (isalnum (*s1) || (*s1 == '_'))
+ while (c_isalnum (*s1) || (*s1 == '_'))
s1++;
s2 = s1;
@@ -925,7 +924,7 @@ parse_method (char *method, char *type, char **theclass,
s2++;
s2 = skip_spaces (s2);
ncategory = s2;
- while (isalnum (*s2) || (*s2 == '_'))
+ while (c_isalnum (*s2) || (*s2 == '_'))
s2++;
*s2++ = '\0';
}
@@ -938,9 +937,9 @@ parse_method (char *method, char *type, char **theclass,
for (;;)
{
- if (isalnum (*s2) || (*s2 == '_') || (*s2 == ':'))
+ if (c_isalnum (*s2) || (*s2 == '_') || (*s2 == ':'))
*s1++ = *s2;
- else if (isspace (*s2))
+ else if (c_isspace (*s2))
;
else if (*s2 == ']')
break;
@@ -989,7 +988,7 @@ find_methods (char type, const char *theclass, const char *category,
gdb_assert (symbol_names != NULL);
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
unsigned int *objc_csym;
@@ -1000,12 +999,12 @@ find_methods (char type, const char *theclass, const char *category,
unsigned int objfile_csym = 0;
- objc_csym = objc_objfile_data.get (objfile);
+ objc_csym = objc_objfile_data.get (&objfile);
if (objc_csym != NULL && *objc_csym == 0)
/* There are no ObjC symbols in this objfile. Skip it entirely. */
continue;
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
QUIT;
@@ -1052,7 +1051,7 @@ find_methods (char type, const char *theclass, const char *category,
}
if (objc_csym == NULL)
- objc_csym = objc_objfile_data.emplace (objfile, objfile_csym);
+ objc_csym = objc_objfile_data.emplace (&objfile, objfile_csym);
else
/* Count of ObjC methods in this objfile should be constant. */
gdb_assert (*objc_csym == objfile_csym);
@@ -1327,9 +1326,7 @@ find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc)
return 0;
}
-void _initialize_objc_language ();
-void
-_initialize_objc_language ()
+INIT_GDB_FILE (objc_language)
{
add_info ("selectors", info_selectors_command,
_("All Objective-C selectors, or those matching REGEXP."));
diff --git a/gdb/objc-lang.h b/gdb/objc-lang.h
index 6a8dc39..ec6fbe7 100644
--- a/gdb/objc-lang.h
+++ b/gdb/objc-lang.h
@@ -1,6 +1,6 @@
/* Objective-C language support definitions for GDB, the GNU debugger.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
Contributed by Apple Computer, Inc.
diff --git a/gdb/objfile-flags.h b/gdb/objfile-flags.h
index e0a84bc..ab2c746 100644
--- a/gdb/objfile-flags.h
+++ b/gdb/objfile-flags.h
@@ -1,6 +1,6 @@
/* Definition of objfile flags.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 006e1bdb..bc909db 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -1,6 +1,6 @@
/* GDB routines for manipulating objfiles.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules.
@@ -189,7 +189,7 @@ objfile_lookup_static_link (struct objfile *objfile,
static void
add_to_objfile_sections (struct bfd *abfd, struct bfd_section *asect,
- struct objfile *objfile, int force)
+ struct objfile *objfile, int force)
{
struct obj_section *section;
@@ -472,8 +472,6 @@ objfile::~objfile ()
/* It still may reference data modules have associated with the objfile and
the symbol file data. */
forget_cached_source_info ();
- for (compunit_symtab *cu : compunits ())
- cu->finalize ();
breakpoint_free_objfile (this);
btrace_free_objfile (this);
@@ -521,8 +519,8 @@ relocate_one_symbol (struct symbol *sym, struct objfile *objfile,
any symbols in STRUCT_DOMAIN or UNDEF_DOMAIN.
But I'm leaving out that test, on the theory that
they can't possibly pass the tests below. */
- if ((sym->aclass () == LOC_LABEL
- || sym->aclass () == LOC_STATIC)
+ if ((sym->loc_class () == LOC_LABEL
+ || sym->loc_class () == LOC_STATIC)
&& sym->section_index () >= 0)
sym->set_value_address (sym->value_address ()
+ delta[sym->section_index ()]);
@@ -550,9 +548,9 @@ objfile_relocate1 (struct objfile *objfile,
return 0;
/* OK, get all the symtabs. */
- for (compunit_symtab *cust : objfile->compunits ())
+ for (compunit_symtab &cust : objfile->compunits ())
{
- struct blockvector *bv = cust->blockvector ();
+ struct blockvector *bv = cust.blockvector ();
int block_line_section = SECT_OFF_TEXT (objfile);
if (bv->map () != nullptr)
@@ -587,12 +585,12 @@ objfile_relocate1 (struct objfile *objfile,
get_objfile_pspace_data (objfile->pspace ())->section_map_dirty = 1;
/* Update the table in exec_ops, used to read memory. */
- for (obj_section *s : objfile->sections ())
+ for (obj_section &s : objfile->sections ())
{
- int idx = s - objfile->sections_start;
+ int idx = &s - objfile->sections_start;
exec_set_section_address (bfd_get_filename (objfile->obfd.get ()), idx,
- s->addr ());
+ s.addr ());
}
/* Data changed. */
@@ -673,18 +671,18 @@ objfile_rebase (struct objfile *objfile, CORE_ADDR slide)
/* See objfiles.h. */
bool
-objfile_has_full_symbols (objfile *objfile)
+objfile::has_full_symbols ()
{
- return objfile->compunit_symtabs != nullptr;
+ return !this->compunit_symtabs.empty ();
}
/* See objfiles.h. */
bool
-objfile_has_symbols (objfile *objfile)
+objfile::has_symbols ()
{
- for (::objfile *o : objfile->separate_debug_objfiles ())
- if (o->has_partial_symbols () || objfile_has_full_symbols (o))
+ for (::objfile *o : this->separate_debug_objfiles ())
+ if (o->has_partial_symbols () || o->has_full_symbols ())
return true;
return false;
@@ -695,8 +693,8 @@ objfile_has_symbols (objfile *objfile)
bool
have_partial_symbols (program_space *pspace)
{
- for (objfile *ofp : pspace->objfiles ())
- if (ofp->has_partial_symbols ())
+ for (objfile &ofp : pspace->objfiles ())
+ if (ofp.has_partial_symbols ())
return true;
return false;
@@ -707,8 +705,8 @@ have_partial_symbols (program_space *pspace)
bool
have_full_symbols (program_space *pspace)
{
- for (objfile *ofp : pspace->objfiles ())
- if (objfile_has_full_symbols (ofp))
+ for (objfile &ofp : pspace->objfiles ())
+ if (ofp.has_full_symbols ())
return true;
return false;
@@ -720,13 +718,13 @@ have_full_symbols (program_space *pspace)
void
objfile_purge_solibs (program_space *pspace)
{
- for (objfile *objf : pspace->objfiles_safe ())
+ for (objfile &objf : pspace->objfiles_safe ())
{
/* We assume that the solib package has been purged already, or will
be soon. */
- if (!(objf->flags & OBJF_USERLOADED) && (objf->flags & OBJF_SHARED))
- objf->unlink ();
+ if (!(objf.flags & OBJF_USERLOADED) && (objf.flags & OBJF_SHARED))
+ objf.unlink ();
}
}
@@ -735,8 +733,8 @@ objfile_purge_solibs (program_space *pspace)
bool
have_minimal_symbols (program_space *pspace)
{
- for (objfile *ofp : pspace->objfiles ())
- if (ofp->per_bfd->minimal_symbol_count > 0)
+ for (objfile &ofp : pspace->objfiles ())
+ if (ofp.per_bfd->minimal_symbol_count > 0)
return true;
return false;
@@ -790,10 +788,10 @@ sort_cmp (const struct obj_section *sect1, const obj_section *sect2)
second case shouldn't occur during normal use, but std::sort
does check that '!(a < a)' when compiled in debug mode. */
- for (const obj_section *osect : objfile1->sections ())
- if (osect == sect2)
+ for (const obj_section &osect : objfile1->sections ())
+ if (&osect == sect2)
return false;
- else if (osect == sect1)
+ else if (&osect == sect1)
return true;
/* We should have found one of the sections before getting here. */
@@ -803,10 +801,10 @@ sort_cmp (const struct obj_section *sect1, const obj_section *sect2)
{
/* Sort on sequence number of the objfile in the chain. */
- for (objfile *objfile : current_program_space->objfiles ())
- if (objfile == objfile1)
+ for (objfile &objfile : current_program_space->objfiles ())
+ if (&objfile == objfile1)
return true;
- else if (objfile == objfile2)
+ else if (&objfile == objfile2)
return false;
/* We should have found one of the objfiles before getting here. */
@@ -993,9 +991,9 @@ update_section_map (struct program_space *pspace,
xfree (map);
alloc_size = 0;
- for (objfile *objfile : pspace->objfiles ())
- for (obj_section *s : objfile->sections ())
- if (insert_section_p (objfile->obfd.get (), s->the_bfd_section))
+ for (objfile &objfile : pspace->objfiles ())
+ for (obj_section &s : objfile.sections ())
+ if (insert_section_p (objfile.obfd.get (), s.the_bfd_section))
alloc_size += 1;
/* This happens on detach/attach (e.g. in gdb.base/attach.exp). */
@@ -1009,10 +1007,10 @@ update_section_map (struct program_space *pspace,
map = XNEWVEC (struct obj_section *, alloc_size);
i = 0;
- for (objfile *objfile : pspace->objfiles ())
- for (obj_section *s : objfile->sections ())
- if (insert_section_p (objfile->obfd.get (), s->the_bfd_section))
- map[i++] = s;
+ for (objfile &objfile : pspace->objfiles ())
+ for (obj_section &s : objfile.sections ())
+ if (insert_section_p (objfile.obfd.get (), s.the_bfd_section))
+ map[i++] = &s;
std::sort (map, map + alloc_size, sort_cmp);
map_size = filter_debuginfo_sections(map, alloc_size);
@@ -1127,12 +1125,12 @@ is_addr_in_objfile (CORE_ADDR addr, const struct objfile *objfile)
if (objfile == NULL)
return false;
- for (obj_section *osect : objfile->sections ())
+ for (obj_section &osect : objfile->sections ())
{
- if (section_is_overlay (osect) && !section_is_mapped (osect))
+ if (section_is_overlay (&osect) && !section_is_mapped (&osect))
continue;
- if (osect->contains (addr))
+ if (osect.contains (addr))
return true;
}
return false;
@@ -1144,34 +1142,16 @@ bool
shared_objfile_contains_address_p (struct program_space *pspace,
CORE_ADDR address)
{
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
- if ((objfile->flags & OBJF_SHARED) != 0
- && is_addr_in_objfile (address, objfile))
+ if ((objfile.flags & OBJF_SHARED) != 0
+ && is_addr_in_objfile (address, &objfile))
return true;
}
return false;
}
-/* The default implementation for the "iterate_over_objfiles_in_search_order"
- gdbarch method. It is equivalent to use the objfiles iterable,
- searching the objfiles in the order they are stored internally,
- ignoring CURRENT_OBJFILE.
-
- On most platforms, it should be close enough to doing the best
- we can without some knowledge specific to the architecture. */
-
-void
-default_iterate_over_objfiles_in_search_order
- (gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
- objfile *current_objfile)
-{
- for (objfile *objfile : current_program_space->objfiles ())
- if (cb (objfile))
- return;
-}
-
/* See objfiles.h. */
const char *
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 05e1e01..9566acf 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -1,6 +1,6 @@
/* Definitions for symbol file management in GDB.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -33,6 +33,7 @@
#include "quick-symbol.h"
#include <forward_list>
#include "gdbsupport/unordered_map.h"
+#include "gdbsupport/owning_intrusive_list.h"
struct htab;
struct objfile_data;
@@ -382,6 +383,12 @@ struct obj_section
return bfd_section_vma (this->the_bfd_section) + this->offset ();
}
+ /* As addr, but returns an unrelocated address. */
+ unrelocated_addr addr_unrel () const
+ {
+ return unrelocated_addr (bfd_section_vma (this->the_bfd_section));
+ }
+
/* The one-passed-the-end memory address of the section
(vma + size + offset). */
CORE_ADDR endaddr () const
@@ -389,13 +396,27 @@ struct obj_section
return this->addr () + bfd_section_size (this->the_bfd_section);
}
+ /* As endaddr, but returns an unrelocated address. */
+ unrelocated_addr endaddr_unrel () const
+ {
+ return this->addr_unrel () + bfd_section_size (this->the_bfd_section);
+ }
+
/* True if ADDR is in this obj_section, false otherwise. */
bool contains (CORE_ADDR addr) const
{
return addr >= this->addr () && addr < endaddr ();
}
- /* BFD section pointer */
+ /* As contains (CORE_ADDR), but for an unrelocated address. */
+ bool contains (unrelocated_addr addr) const
+ {
+ return addr >= this->addr_unrel () && addr < endaddr_unrel ();
+ }
+
+ /* BFD section pointer. This is nullptr if the corresponding BFD section is
+ not allocatable (!SEC_ALLOC), in which case this obj_section can be
+ considered NULL / empty. */
struct bfd_section *the_bfd_section;
/* Objfile this section is part of. */
@@ -451,12 +472,18 @@ public:
/* Return the program space associated with this objfile. */
program_space *pspace () { return m_pspace; }
+ using compunit_symtab_iterator
+ = owning_intrusive_list<compunit_symtab>::iterator;
+ using compunit_symtab_range = iterator_range<compunit_symtab_iterator>;
+
/* A range adapter that makes it possible to iterate over all
compunits in one objfile. */
compunit_symtab_range compunits ()
{
- return compunit_symtab_range (compunit_symtabs);
+ auto begin = compunit_symtab_iterator (compunit_symtabs.begin ());
+ auto end = compunit_symtab_iterator (compunit_symtabs.end ());
+ return compunit_symtab_range (std::move (begin), std::move (end));
}
/* A range adapter that makes it possible to iterate over all
@@ -515,10 +542,16 @@ public:
return per_bfd->gdbarch;
}
- /* Return true if OBJFILE has partial symbols. */
-
+ /* Return true if this objfile has partial symbols. */
bool has_partial_symbols ();
+ /* Return true if this objfile has full symbols. */
+ bool has_full_symbols ();
+
+ /* Return true if this objfile has full or partial symbols, either directly
+ or through a separate debug file. */
+ bool has_symbols ();
+
/* Look for a separate debug symbol file for this objfile, make use of
build-id, debug-link, and debuginfod as necessary. If a suitable
separate debug symbol file is found then it is loaded using a call to
@@ -577,10 +610,6 @@ public:
/* See quick_symbol_functions. */
void dump ();
- /* Find all the symbols in OBJFILE named FUNC_NAME, and ensure that
- the corresponding symbol tables are loaded. */
- void expand_symtabs_for_function (const char *func_name);
-
/* See quick_symbol_functions. */
void expand_all_symtabs ();
@@ -592,14 +621,14 @@ public:
void expand_symtabs_with_fullname (const char *fullname);
/* See quick_symbol_functions. */
- bool expand_symtabs_matching
- (expand_symtabs_file_matcher file_matcher,
+ bool search
+ (search_symtabs_file_matcher file_matcher,
const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
+ search_symtabs_symbol_matcher symbol_matcher,
+ search_symtabs_expansion_listener listener,
block_search_flags search_flags,
domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher = nullptr);
+ search_symtabs_lang_matcher lang_matcher = nullptr);
/* See quick_symbol_functions. */
struct compunit_symtab *
@@ -649,61 +678,18 @@ public:
this->section_offsets[idx] = offset;
}
- class section_iterator
+ /* Filter function for section_iterator. */
+ struct filter_out_null_bfd_section
{
- public:
- section_iterator (const section_iterator &) = default;
- section_iterator (section_iterator &&) = default;
- section_iterator &operator= (const section_iterator &) = default;
- section_iterator &operator= (section_iterator &&) = default;
-
- typedef section_iterator self_type;
- typedef obj_section *value_type;
-
- value_type operator* ()
- { return m_iter; }
-
- section_iterator &operator++ ()
- {
- ++m_iter;
- skip_null ();
- return *this;
- }
-
- bool operator== (const section_iterator &other) const
- { return m_iter == other.m_iter && m_end == other.m_end; }
-
- bool operator!= (const section_iterator &other) const
- { return !(*this == other); }
-
- private:
-
- friend class objfile;
-
- section_iterator (obj_section *iter, obj_section *end)
- : m_iter (iter),
- m_end (end)
- {
- skip_null ();
- }
-
- void skip_null ()
- {
- while (m_iter < m_end && m_iter->the_bfd_section == nullptr)
- ++m_iter;
- }
-
- value_type m_iter;
- value_type m_end;
+ bool operator() (const obj_section &sec) const noexcept
+ { return sec.the_bfd_section != nullptr; }
};
- iterator_range<section_iterator> sections ()
- {
- return (iterator_range<section_iterator>
- (section_iterator (sections_start, sections_end),
- section_iterator (sections_end, sections_end)));
- }
+ using section_iterator = filtered_iterator<obj_section *, filter_out_null_bfd_section>;
+ /* Return an iterable that yields the "non-null" sections of this objfile.
+ That is, the sections for which obj_section::the_bfd_section is
+ non-nullptr. */
iterator_range<section_iterator> sections () const
{
return (iterator_range<section_iterator>
@@ -736,7 +722,7 @@ public:
/* List of compunits.
These are used to do symbol lookups and file/line-number lookups. */
- struct compunit_symtab *compunit_symtabs = nullptr;
+ owning_intrusive_list<compunit_symtab> compunit_symtabs;
/* The object file's BFD. Can be null if the objfile contains only
minimal symbols (e.g. the run time common symbols for SunOS4) or
@@ -938,15 +924,6 @@ extern void free_objfile_separate_debug (struct objfile *);
extern void objfile_relocate (struct objfile *, const section_offsets &);
extern void objfile_rebase (struct objfile *, CORE_ADDR);
-/* Return true if OBJFILE has full symbols. */
-
-extern bool objfile_has_full_symbols (objfile *objfile);
-
-/* Return true if OBJFILE has full or partial symbols, either directly
- or through a separate debug file. */
-
-extern bool objfile_has_symbols (objfile *objfile);
-
/* Return true if any objfile of PSPACE has partial symbols. */
extern bool have_partial_symbols (program_space *pspace);
@@ -992,10 +969,10 @@ extern struct obj_section *find_pc_section (CORE_ADDR pc);
/* Return true if PC is in a section called NAME. */
extern bool pc_in_section (CORE_ADDR, const char *);
-/* Return non-zero if PC is in a SVR4-style procedure linkage table
+/* Return true if PC is in a SVR4-style procedure linkage table
section. */
-static inline int
+static inline bool
in_plt_section (CORE_ADDR pc)
{
return (pc_in_section (pc, ".plt")
@@ -1013,10 +990,6 @@ in_plt_section (CORE_ADDR pc)
extern scoped_restore_tmpl<int> inhibit_section_map_updates
(struct program_space *pspace);
-extern void default_iterate_over_objfiles_in_search_order
- (gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
- objfile *current_objfile);
-
/* Reset the per-BFD storage area on OBJ. */
void set_objfile_per_bfd (struct objfile *obj);
diff --git a/gdb/obsd-nat.c b/gdb/obsd-nat.c
index 701a365..2a47568 100644
--- a/gdb/obsd-nat.c
+++ b/gdb/obsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for OpenBSD.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/obsd-nat.h b/gdb/obsd-nat.h
index 35ee212..ef82c6e 100644
--- a/gdb/obsd-nat.h
+++ b/gdb/obsd-nat.h
@@ -1,6 +1,6 @@
/* Native-dependent code for OpenBSD.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/obsd-tdep.c b/gdb/obsd-tdep.c
index 00de5c0..bf72f8c 100644
--- a/gdb/obsd-tdep.c
+++ b/gdb/obsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for OpenBSD.
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/obsd-tdep.h b/gdb/obsd-tdep.h
index c018513..fd7accc 100644
--- a/gdb/obsd-tdep.h
+++ b/gdb/obsd-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for OpenBSD.
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/observable.c b/gdb/observable.c
index cc1b01d..8439f11 100644
--- a/gdb/observable.c
+++ b/gdb/observable.c
@@ -1,6 +1,6 @@
/* GDB Notifications to Observers.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -76,6 +76,7 @@ DEFINE_OBSERVABLE (target_post_wait);
DEFINE_OBSERVABLE (new_program_space);
DEFINE_OBSERVABLE (free_program_space);
DEFINE_OBSERVABLE (tui_enabled);
+DEFINE_OBSERVABLE (core_file_changed);
} /* namespace observers */
} /* namespace gdb */
@@ -87,9 +88,7 @@ show_observer_debug (struct ui_file *file, int from_tty,
gdb_printf (file, _("Observer debugging is %s.\n"), value);
}
-void _initialize_observer ();
-void
-_initialize_observer ()
+INIT_GDB_FILE (observer)
{
add_setshow_boolean_cmd ("observer", class_maintenance,
&gdb::observers::observer_debug, _("\
diff --git a/gdb/observable.h b/gdb/observable.h
index c50891e..5f064cf 100644
--- a/gdb/observable.h
+++ b/gdb/observable.h
@@ -1,6 +1,6 @@
/* Observers
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -260,6 +260,12 @@ extern observable <program_space */* pspace */> free_program_space;
extern observable<bool /* enabled */> tui_enabled;
+/* The core file loaded into the program space inferior INF has changed.
+ The process of changing has completed, i.e. when unloading, the unload
+ is now complete. When loading a new core file, the load is complete,
+ shared libraries have been loaded, registers and threads read in, etc. */
+extern observable<inferior */* inf */> core_file_changed;
+
} /* namespace observers */
} /* namespace gdb */
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index 939757d..b3286ff 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -1,5 +1,5 @@
/* OpenCL language support for GDB, the GNU debugger.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
Contributed by Ken Werner <ken.werner@de.ibm.com>.
diff --git a/gdb/or1k-linux-nat.c b/gdb/or1k-linux-nat.c
index e6cc9c7..cc682ea 100644
--- a/gdb/or1k-linux-nat.c
+++ b/gdb/or1k-linux-nat.c
@@ -1,5 +1,5 @@
/* Native-dependent code for GNU/Linux OpenRISC.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -199,9 +199,7 @@ or1k_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
/* Initialize OpenRISC Linux native support. */
-void _initialize_or1k_linux_nat ();
-void
-_initialize_or1k_linux_nat ()
+INIT_GDB_FILE (or1k_linux_nat)
{
/* Register the target. */
linux_target = &the_or1k_linux_nat_target;
diff --git a/gdb/or1k-linux-tdep.c b/gdb/or1k-linux-tdep.c
index 00045a3..9fbf75f 100644
--- a/gdb/or1k-linux-tdep.c
+++ b/gdb/or1k-linux-tdep.c
@@ -1,5 +1,5 @@
/* Target-dependent code for GNU/Linux on OpenRISC processors.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,6 +20,7 @@
#include "osabi.h"
#include "glibc-tdep.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
#include "solib-svr4.h"
#include "regset.h"
#include "tramp-frame.h"
@@ -144,8 +145,7 @@ or1k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
linux_init_abi (info, gdbarch, 0);
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
/* GNU/Linux uses SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
@@ -153,7 +153,7 @@ or1k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU/Linux uses the dynamic linker included in the GNU C Library. */
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
- set_gdbarch_software_single_step (gdbarch, or1k_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, or1k_software_single_step);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
@@ -167,9 +167,7 @@ or1k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Initialize OpenRISC Linux target support. */
-void _initialize_or1k_linux_tdep ();
-void
-_initialize_or1k_linux_tdep ()
+INIT_GDB_FILE (or1k_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_or1k, 0, GDB_OSABI_LINUX,
or1k_linux_init_abi);
diff --git a/gdb/or1k-linux-tdep.h b/gdb/or1k-linux-tdep.h
index b510f32..f85cf51 100644
--- a/gdb/or1k-linux-tdep.h
+++ b/gdb/or1k-linux-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux on OpenRISC.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c
index bdfad9b..2db207d 100644
--- a/gdb/or1k-tdep.c
+++ b/gdb/or1k-tdep.c
@@ -1,5 +1,5 @@
/* Target-dependent code for the 32-bit OpenRISC 1000, for the GDB.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -29,7 +29,6 @@
#include "gdbtypes.h"
#include "target.h"
#include "regcache.h"
-#include "gdbsupport/gdb-safe-ctype.h"
#include "reggroups.h"
#include "arch-utils.h"
#include "frame-unwind.h"
@@ -1286,9 +1285,7 @@ or1k_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
}
-void _initialize_or1k_tdep ();
-void
-_initialize_or1k_tdep ()
+INIT_GDB_FILE (or1k_tdep)
{
/* Register this architecture. */
gdbarch_register (bfd_arch_or1k, or1k_gdbarch_init, or1k_dump_tdep);
diff --git a/gdb/or1k-tdep.h b/gdb/or1k-tdep.h
index f307257..12cb2cd 100644
--- a/gdb/or1k-tdep.h
+++ b/gdb/or1k-tdep.h
@@ -1,5 +1,5 @@
/* Definitions to target GDB to OpenRISC 1000 32-bit targets.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/osabi.c b/gdb/osabi.c
index 236d425..1459368 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -1,6 +1,6 @@
/* OS ABI variant handling for GDB.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -609,9 +609,7 @@ show_osabi (struct ui_file *file, int from_tty, struct cmd_list_element *c,
gdbarch_osabi_name (GDB_OSABI_DEFAULT));
}
-void _initialize_gdb_osabi ();
-void
-_initialize_gdb_osabi ()
+INIT_GDB_FILE (gdb_osabi)
{
/* Register a generic sniffer for ELF flavoured files. */
gdbarch_register_osabi_sniffer (bfd_arch_unknown,
diff --git a/gdb/osabi.h b/gdb/osabi.h
index 982c7a7..2f359a1 100644
--- a/gdb/osabi.h
+++ b/gdb/osabi.h
@@ -1,5 +1,5 @@
/* OS ABI variant handling for GDB.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/osdata.c b/gdb/osdata.c
index e22c249..788dd2a 100644
--- a/gdb/osdata.c
+++ b/gdb/osdata.c
@@ -1,6 +1,6 @@
/* Routines for handling XML generic OS data provided by target.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -287,9 +287,7 @@ info_osdata_command (const char *arg, int from_tty)
info_osdata (arg);
}
-void _initialize_osdata ();
-void
-_initialize_osdata ()
+INIT_GDB_FILE (osdata)
{
add_info ("os", info_osdata_command,
_("Show OS data ARG."));
diff --git a/gdb/osdata.h b/gdb/osdata.h
index 9de443a..c102246 100644
--- a/gdb/osdata.h
+++ b/gdb/osdata.h
@@ -1,6 +1,6 @@
/* Routines for handling XML generic OS data provided by target.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index 938d3cf..a68443a 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -1,5 +1,5 @@
/* YACC parser for Pascal expressions, for GDB.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -43,7 +43,6 @@
Probably also lots of other problems, less well defined PM. */
%{
-#include <ctype.h>
#include "expression.h"
#include "value.h"
#include "parser-defs.h"
@@ -765,7 +764,7 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
= lookup_struct (copy_name ($2).c_str (),
pstate->expression_context_block);
}
- /* "const" and "volatile" are curently ignored. A type qualifier
+ /* "const" and "volatile" are currently ignored. A type qualifier
after the type is handled in the ptype rule. I think these could
be too. */
;
@@ -817,13 +816,13 @@ parse_number (struct parser_state *par_state,
{
/* Handle suffixes: 'f' for float, 'l' for long double.
FIXME: This appears to be an extension -- do we want this? */
- if (len >= 1 && tolower (p[len - 1]) == 'f')
+ if (len >= 1 && c_tolower (p[len - 1]) == 'f')
{
putithere->typed_val_float.type
= parse_type (par_state)->builtin_float;
len--;
}
- else if (len >= 1 && tolower (p[len - 1]) == 'l')
+ else if (len >= 1 && c_tolower (p[len - 1]) == 'l')
{
putithere->typed_val_float.type
= parse_type (par_state)->builtin_long_double;
@@ -1089,9 +1088,9 @@ yylex (void)
if (explen > 2)
for (const auto &token : tokentab3)
if (strncasecmp (tokstart, token.oper, 3) == 0
- && (!isalpha (token.oper[0]) || explen == 3
- || (!isalpha (tokstart[3])
- && !isdigit (tokstart[3]) && tokstart[3] != '_')))
+ && (!c_isalpha (token.oper[0]) || explen == 3
+ || (!c_isalpha (tokstart[3])
+ && !c_isdigit (tokstart[3]) && tokstart[3] != '_')))
{
pstate->lexptr += 3;
yylval.opcode = token.opcode;
@@ -1102,9 +1101,9 @@ yylex (void)
if (explen > 1)
for (const auto &token : tokentab2)
if (strncasecmp (tokstart, token.oper, 2) == 0
- && (!isalpha (token.oper[0]) || explen == 2
- || (!isalpha (tokstart[2])
- && !isdigit (tokstart[2]) && tokstart[2] != '_')))
+ && (!c_isalpha (token.oper[0]) || explen == 2
+ || (!c_isalpha (tokstart[2])
+ && !c_isdigit (tokstart[2]) && tokstart[2] != '_')))
{
pstate->lexptr += 2;
yylval.opcode = token.opcode;
@@ -1519,7 +1518,7 @@ yylex (void)
/* Call lookup_symtab, not lookup_partial_symtab, in case there are
no psymtabs (coff, xcoff, or some future change to blow away the
psymtabs once once symbols are read). */
- if ((sym && sym->aclass () == LOC_BLOCK)
+ if ((sym && sym->loc_class () == LOC_BLOCK)
|| lookup_symtab (current_program_space, tmp.c_str ()))
{
yylval.ssym.sym.symbol = sym;
@@ -1528,7 +1527,7 @@ yylex (void)
free (uptokstart);
return BLOCKNAME;
}
- if (sym && sym->aclass () == LOC_TYPEDEF)
+ if (sym && sym->loc_class () == LOC_TYPEDEF)
{
#if 1
/* Despite the following flaw, we need to keep this code enabled.
@@ -1597,7 +1596,7 @@ yylex (void)
SEARCH_VFT, NULL).symbol;
if (cur_sym)
{
- if (cur_sym->aclass () == LOC_TYPEDEF)
+ if (cur_sym->loc_class () == LOC_TYPEDEF)
{
best_sym = cur_sym;
pstate->lexptr = p;
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 4c5d4dd..1dc1a34 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -1,6 +1,6 @@
/* Pascal language support routines for GDB, the GNU debugger.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -30,7 +30,6 @@
#include "p-lang.h"
#include "valprint.h"
#include "value.h"
-#include <ctype.h>
#include "c-lang.h"
#include "gdbarch.h"
#include "cli/cli-style.h"
diff --git a/gdb/p-lang.h b/gdb/p-lang.h
index abb981a..87430ba 100644
--- a/gdb/p-lang.h
+++ b/gdb/p-lang.h
@@ -1,6 +1,6 @@
/* Pascal language support definitions for GDB, the GNU debugger.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
index f9e1d7c..8b5f2b5 100644
--- a/gdb/p-typeprint.c
+++ b/gdb/p-typeprint.c
@@ -1,5 +1,5 @@
/* Support for printing Pascal types for GDB, the GNU debugger.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -30,7 +30,6 @@
#include "p-lang.h"
#include "typeprint.h"
#include "gdb-demangle.h"
-#include <ctype.h>
#include "cli/cli-style.h"
/* See language.h. */
@@ -138,13 +137,13 @@ pascal_language::type_print_method_args (const char *physname,
{
gdb_puts (" (", stream);
/* We must demangle this. */
- while (isdigit (physname[0]))
+ while (c_isdigit (physname[0]))
{
int len = 0;
int i, j;
char *argname;
- while (isdigit (physname[len]))
+ while (c_isdigit (physname[len]))
{
len++;
}
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index aa7f1a9..8228ca0 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -1,6 +1,6 @@
/* Support for printing Pascal values for GDB, the GNU debugger.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -860,9 +860,7 @@ pascal_object_print_static_field (struct value *val,
common_val_print (val, stream, recurse, &opts, current_language);
}
-void _initialize_pascal_valprint ();
-void
-_initialize_pascal_valprint ()
+INIT_GDB_FILE (pascal_valprint)
{
add_setshow_boolean_cmd ("pascal_static-members", class_support,
&user_print_options.pascal_static_field_print, _("\
diff --git a/gdb/pager.h b/gdb/pager.h
index aa9b24e..b5425d4 100644
--- a/gdb/pager.h
+++ b/gdb/pager.h
@@ -1,5 +1,5 @@
/* Output pager for gdb
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -50,7 +50,6 @@ public:
}
void emit_style_escape (const ui_file_style &style) override;
- void reset_style () override;
void flush () override;
@@ -69,6 +68,16 @@ private:
/* Flush the wrap buffer to STREAM, if necessary. */
void flush_wrap_buffer ();
+ /* Set the style of m_stream to STYLE. */
+ void set_stream_style (const ui_file_style &style)
+ {
+ if (m_stream->can_emit_style_escape () && m_stream_style != style)
+ {
+ m_stream->puts (style.to_ansi ().c_str ());
+ m_stream_style = style;
+ }
+ }
+
/* Contains characters which are waiting to be output (they have
already been counted in chars_printed). */
std::string m_wrap_buffer;
@@ -83,6 +92,12 @@ private:
/* The style applied at the time that wrap_here was called. */
ui_file_style m_wrap_style;
+ /* The style currently applied to m_stream. While m_applied_style is the
+ style that is applied to new content added to m_wrap_buffer, the
+ m_stream_style reflects changes that have been flushed to the managed
+ stream. */
+ ui_file_style m_stream_style;
+
/* This is temporarily set when paging. This will cause some
methods to change their behavior to ignore the wrap buffer. */
bool m_paging = false;
diff --git a/gdb/parse.c b/gdb/parse.c
index ffefe6f..e24a0d0 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1,6 +1,6 @@
/* Parse expressions for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
Modified from expread.y by the Department of Computer Science at the
State University of New York at Buffalo, 1991.
@@ -29,7 +29,6 @@
during the process of parsing; the lower levels of the tree always
come first in the result. */
-#include <ctype.h>
#include "arch-utils.h"
#include "symtab.h"
#include "gdbtypes.h"
@@ -60,8 +59,8 @@ show_expressiondebug (struct ui_file *file, int from_tty,
}
-/* True if an expression parser should set yydebug. */
-static bool parser_debug;
+/* See parser-defs.h. */
+bool parser_debug;
static void
show_parserdebug (struct ui_file *file, int from_tty,
@@ -617,9 +616,7 @@ parser_fprintf (FILE *x, const char *y, ...)
va_end (args);
}
-void _initialize_parse ();
-void
-_initialize_parse ()
+INIT_GDB_FILE (parse)
{
add_setshow_zuinteger_cmd ("expression", class_maintenance,
&expressiondebug,
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index eaa3c41..f5618f3 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -1,6 +1,6 @@
/* Parser definitions for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
Modified from expread.y by the Department of Computer Science at the
State University of New York at Buffalo.
@@ -389,4 +389,7 @@ extern bool fits_in_type (int n_sign, const gdb_mpz &n, int type_bits,
extern void parser_fprintf (FILE *, const char *, ...) ATTRIBUTE_PRINTF (2, 3);
+/* True if an expression parser should set yydebug. */
+extern bool parser_debug;
+
#endif /* GDB_PARSER_DEFS_H */
diff --git a/gdb/posix-hdep.c b/gdb/posix-hdep.c
index d7d17e6..0f9d9d0 100644
--- a/gdb/posix-hdep.c
+++ b/gdb/posix-hdep.c
@@ -1,6 +1,6 @@
/* Host support routines for MinGW, for GDB, the GNU debugger.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ppc-fbsd-nat.c b/gdb/ppc-fbsd-nat.c
index b3b20ff..e59791d 100644
--- a/gdb/ppc-fbsd-nat.c
+++ b/gdb/ppc-fbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for PowerPC's running FreeBSD, for GDB.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -200,9 +200,7 @@ ppcfbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
return 1;
}
-void _initialize_ppcfbsd_nat ();
-void
-_initialize_ppcfbsd_nat ()
+INIT_GDB_FILE (ppcfbsd_nat)
{
add_inf_child_target (&the_ppc_fbsd_nat_target);
diff --git a/gdb/ppc-fbsd-tdep.c b/gdb/ppc-fbsd-tdep.c
index 0403b56..a666509 100644
--- a/gdb/ppc-fbsd-tdep.c
+++ b/gdb/ppc-fbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for PowerPC systems running FreeBSD.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -332,8 +332,7 @@ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_return_value (gdbarch, ppcfbsd_return_value);
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
frame_unwind_append_unwinder (gdbarch, &ppcfbsd_sigtramp_frame_unwind);
set_gdbarch_gcore_bfd_target (gdbarch, "elf32-powerpc");
@@ -347,8 +346,7 @@ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
ppc64_elf_make_msymbol_special);
set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code);
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_lp64_solib_ops);
set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpc");
}
@@ -361,9 +359,7 @@ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
ppcfbsd_get_thread_local_address);
}
-void _initialize_ppcfbsd_tdep ();
-void
-_initialize_ppcfbsd_tdep ()
+INIT_GDB_FILE (ppcfbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc, GDB_OSABI_FREEBSD,
ppcfbsd_init_abi);
diff --git a/gdb/ppc-fbsd-tdep.h b/gdb/ppc-fbsd-tdep.h
index 93ba904..364d7d9 100644
--- a/gdb/ppc-fbsd-tdep.h
+++ b/gdb/ppc-fbsd-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for GDB on PowerPC systems running FreeBSD.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 40a5665..568202a 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1,6 +1,6 @@
/* PPC GNU/Linux native support.
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -3232,9 +3232,7 @@ ppc_linux_nat_target::get_arch_lwp_info (struct lwp_info *lp)
return lwp_arch_private_info (lp);
}
-void _initialize_ppc_linux_nat ();
-void
-_initialize_ppc_linux_nat ()
+INIT_GDB_FILE (ppc_linux_nat)
{
linux_target = &the_ppc_linux_nat_target;
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index a9f43c4..b5f8bbf 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -32,7 +32,6 @@
#include "regset.h"
#include "solib-svr4.h"
#include "solib.h"
-#include "solist.h"
#include "ppc-tdep.h"
#include "ppc64-tdep.h"
#include "ppc-linux-tdep.h"
@@ -49,6 +48,8 @@
#include "arch-utils.h"
#include "xml-syscall.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
+#include "svr4-tls-tdep.h"
#include "linux-record.h"
#include "record-full.h"
#include "infrun.h"
@@ -60,7 +61,6 @@
#include "cli/cli-utils.h"
#include "parser-defs.h"
#include "user-regs.h"
-#include <ctype.h>
#include "elf-bfd.h"
#include "producer.h"
#include "target-float.h"
@@ -86,8 +86,6 @@
#include "features/rs6000/powerpc-e500l.c"
#include "dwarf2/frame.h"
-/* Shared library operations for PowerPC-Linux. */
-static solib_ops powerpc_so_ops;
/* The syscall's XML filename for PPC and PPC64. */
#define XML_SYSCALL_FILENAME_PPC "syscalls/ppc-linux.xml"
@@ -306,26 +304,45 @@ static const struct ppc_insn_pattern powerpc32_plt_stub_so_2[] =
/* The max number of insns we check using ppc_insns_match_pattern. */
#define POWERPC32_PLT_CHECK_LEN (ARRAY_SIZE (powerpc32_plt_stub) - 1)
-/* Check if PC is in PLT stub. For non-secure PLT, stub is in .plt
- section. For secure PLT, stub is in .text and we need to check
- instruction patterns. */
+/* solib_ops for ILP32 PowerPC/Linux systems. */
-static int
-powerpc_linux_in_dynsym_resolve_code (CORE_ADDR pc)
+struct ppc_linux_ilp32_svr4_solib_ops : public linux_ilp32_svr4_solib_ops
+{
+ using linux_ilp32_svr4_solib_ops::linux_ilp32_svr4_solib_ops;
+
+ /* Check if PC is in PLT stub. For non-secure PLT, stub is in .plt
+ section. For secure PLT, stub is in .text and we need to check
+ instruction patterns. */
+
+ bool in_dynsym_resolve_code (CORE_ADDR pc) const override;
+};
+
+/* Return a new solib_ops for ILP32 PowerPC/Linux systems. */
+
+static solib_ops_up
+make_ppc_linux_ilp32_svr4_solib_ops (program_space *pspace)
+{
+ return std::make_unique<ppc_linux_ilp32_svr4_solib_ops> (pspace);
+}
+
+/* See ppc_linux_ilp32_svr4_solib_ops. */
+
+bool
+ppc_linux_ilp32_svr4_solib_ops::in_dynsym_resolve_code (CORE_ADDR pc) const
{
/* Check whether PC is in the dynamic linker. This also checks
whether it is in the .plt section, used by non-PIC executables. */
- if (svr4_in_dynsym_resolve_code (pc))
- return 1;
+ if (linux_ilp32_svr4_solib_ops::in_dynsym_resolve_code (pc))
+ return true;
/* Check if we are in the resolver. */
bound_minimal_symbol sym = lookup_minimal_symbol_by_pc (pc);
- if (sym.minsym != NULL
- && (strcmp (sym.minsym->linkage_name (), "__glink") == 0
- || strcmp (sym.minsym->linkage_name (), "__glink_PLTresolve") == 0))
- return 1;
- return 0;
+ if (sym.minsym == nullptr)
+ return false;
+
+ return (strcmp (sym.minsym->linkage_name (), "__glink") == 0
+ || strcmp (sym.minsym->linkage_name (), "__glink_PLTresolve") == 0);
}
/* Follow PLT stub to actual routine.
@@ -1694,10 +1711,10 @@ static int
ppc_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
return (*s == 'i' /* Literal number. */
- || (isdigit (*s) && s[1] == '('
- && isdigit (s[2])) /* Displacement. */
- || (*s == '(' && isdigit (s[1])) /* Register indirection. */
- || isdigit (*s)); /* Register value. */
+ || (c_isdigit (*s) && s[1] == '('
+ && c_isdigit (s[2])) /* Displacement. */
+ || (*s == '(' && c_isdigit (s[1])) /* Register indirection. */
+ || c_isdigit (*s)); /* Register value. */
}
/* Implementation of `gdbarch_stap_parse_special_token', as defined in
@@ -1707,7 +1724,7 @@ static expr::operation_up
ppc_stap_parse_special_token (struct gdbarch *gdbarch,
struct stap_parse_info *p)
{
- if (isdigit (*p->arg))
+ if (c_isdigit (*p->arg))
{
/* This temporary pointer is needed because we have to do a lookahead.
We could be dealing with a register displacement, and in such case
@@ -1716,7 +1733,7 @@ ppc_stap_parse_special_token (struct gdbarch *gdbarch,
char *regname;
int len;
- while (isdigit (*s))
+ while (c_isdigit (*s))
++s;
if (*s == '(')
@@ -2071,6 +2088,63 @@ ppc64_linux_gcc_target_options (struct gdbarch *gdbarch)
return "";
}
+/* Fetch and return the TLS DTV (dynamic thread vector) address for PTID.
+ Throw a suitable TLS error if something goes wrong. */
+
+static CORE_ADDR
+ppc64_linux_get_tls_dtv_addr (struct gdbarch *gdbarch, ptid_t ptid,
+ enum svr4_tls_libc libc)
+{
+ /* On ppc64, the thread pointer is found in r13. Fetch this
+ register. */
+ regcache *regcache
+ = get_thread_arch_regcache (current_inferior (), ptid, gdbarch);
+ int thread_pointer_regnum = PPC_R0_REGNUM + 13;
+ target_fetch_registers (regcache, thread_pointer_regnum);
+ ULONGEST thr_ptr;
+ if (regcache->cooked_read (thread_pointer_regnum, &thr_ptr) != REG_VALID)
+ throw_error (TLS_GENERIC_ERROR, _("Unable to fetch thread pointer"));
+
+ /* The thread pointer (r13) is an address that is 0x7000 ahead of
+ the *end* of the TCB (thread control block). The field
+ holding the DTV address is at the very end of the TCB.
+ Therefore, the DTV pointer address can be found by
+ subtracting (0x7000+8) from the thread pointer. Compute the
+ address of the DTV pointer, fetch it, and convert it to an
+ address. */
+ CORE_ADDR dtv_ptr_addr = thr_ptr - 0x7000 - 8;
+ gdb::byte_vector buf (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
+ if (target_read_memory (dtv_ptr_addr, buf.data (), buf.size ()) != 0)
+ throw_error (TLS_GENERIC_ERROR, _("Unable to fetch DTV address"));
+
+ const struct builtin_type *builtin = builtin_type (gdbarch);
+ CORE_ADDR dtv_addr = gdbarch_pointer_to_address
+ (gdbarch, builtin->builtin_data_ptr, buf.data ());
+ return dtv_addr;
+}
+
+/* For internal TLS lookup, return the DTP offset, which is the offset
+ to subtract from a DTV entry, in order to obtain the address of the
+ TLS block. */
+
+static ULONGEST
+ppc_linux_get_tls_dtp_offset (struct gdbarch *gdbarch, ptid_t ptid,
+ svr4_tls_libc libc)
+{
+ if (libc == svr4_tls_libc_musl)
+ {
+ /* This value is DTP_OFFSET, which represents the value to
+ subtract from the DTV entry. For PPC, it can be found in
+ MUSL's arch/powerpc64/pthread_arch.h and
+ arch/powerpc32/pthread_arch.h. (Both values are the same.)
+ It represents the value to subtract from the DTV entry, once
+ it has been fetched from the DTV array. */
+ return 0x8000;
+ }
+ else
+ return 0;
+}
+
static displaced_step_prepare_status
ppc_linux_displaced_step_prepare (gdbarch *arch, thread_info *thread,
CORE_ADDR &displaced_pc)
@@ -2208,8 +2282,6 @@ ppc_linux_init_abi (struct gdbarch_info info,
/* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, ppc_skip_trampoline_code);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
/* Setting the correct XML syscall filename. */
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_PPC);
@@ -2226,14 +2298,7 @@ ppc_linux_init_abi (struct gdbarch_info info,
else
set_gdbarch_gcore_bfd_target (gdbarch, "elf32-powerpc");
- if (powerpc_so_ops.in_dynsym_resolve_code == NULL)
- {
- powerpc_so_ops = svr4_so_ops;
- /* Override dynamic resolve function. */
- powerpc_so_ops.in_dynsym_resolve_code =
- powerpc_linux_in_dynsym_resolve_code;
- }
- set_gdbarch_so_ops (gdbarch, &powerpc_so_ops);
+ set_solib_svr4_ops (gdbarch, make_ppc_linux_ilp32_svr4_solib_ops);
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
}
@@ -2260,8 +2325,7 @@ ppc_linux_init_abi (struct gdbarch_info info,
/* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_lp64_svr4_solib_ops);
/* Setting the correct XML syscall filename. */
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_PPC64);
@@ -2284,6 +2348,11 @@ ppc_linux_init_abi (struct gdbarch_info info,
set_gdbarch_gnu_triplet_regexp (gdbarch, ppc64_gnu_triplet_regexp);
/* Set GCC target options. */
set_gdbarch_gcc_target_options (gdbarch, ppc64_linux_gcc_target_options);
+ /* Internal thread local address support. */
+ set_gdbarch_get_thread_local_address (gdbarch,
+ svr4_tls_get_thread_local_address);
+ svr4_tls_register_tls_methods (info, gdbarch, ppc64_linux_get_tls_dtv_addr,
+ ppc_linux_get_tls_dtp_offset);
}
set_gdbarch_core_read_description (gdbarch, ppc_linux_core_read_description);
@@ -2330,9 +2399,7 @@ ppc_linux_init_abi (struct gdbarch_info info,
}
-void _initialize_ppc_linux_tdep ();
-void
-_initialize_ppc_linux_tdep ()
+INIT_GDB_FILE (ppc_linux_tdep)
{
/* Register for all sub-families of the POWER/PowerPC: 32-bit and
64-bit PowerPC, and the older rs6k. */
diff --git a/gdb/ppc-linux-tdep.h b/gdb/ppc-linux-tdep.h
index a1db503..2c4e39e 100644
--- a/gdb/ppc-linux-tdep.h
+++ b/gdb/ppc-linux-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for GDB, the GNU debugger.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ppc-netbsd-nat.c b/gdb/ppc-netbsd-nat.c
index a384944..dfb855a 100644
--- a/gdb/ppc-netbsd-nat.c
+++ b/gdb/ppc-netbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for NetBSD/powerpc.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Wasabi Systems, Inc.
@@ -183,9 +183,7 @@ ppcnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
return 1;
}
-void _initialize_ppcnbsd_nat ();
-void
-_initialize_ppcnbsd_nat ()
+INIT_GDB_FILE (ppcnbsd_nat)
{
/* Support debugging kernel virtual memory images. */
bsd_kvm_add_target (ppcnbsd_supply_pcb);
diff --git a/gdb/ppc-netbsd-tdep.c b/gdb/ppc-netbsd-tdep.c
index b412030..9913592 100644
--- a/gdb/ppc-netbsd-tdep.c
+++ b/gdb/ppc-netbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for NetBSD/powerpc.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Wasabi Systems, Inc.
@@ -179,8 +179,7 @@ ppcnbsd_init_abi (struct gdbarch_info info,
set_gdbarch_return_value (gdbarch, ppcnbsd_return_value);
/* NetBSD uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
set_gdbarch_iterate_over_regset_sections
(gdbarch, ppcnbsd_iterate_over_regset_sections);
@@ -189,9 +188,7 @@ ppcnbsd_init_abi (struct gdbarch_info info,
tramp_frame_prepend_unwinder (gdbarch, &ppcnbsd2_sigtramp);
}
-void _initialize_ppcnbsd_tdep ();
-void
-_initialize_ppcnbsd_tdep ()
+INIT_GDB_FILE (ppcnbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_NETBSD,
ppcnbsd_init_abi);
diff --git a/gdb/ppc-netbsd-tdep.h b/gdb/ppc-netbsd-tdep.h
index 47a8b25..1d3c356 100644
--- a/gdb/ppc-netbsd-tdep.h
+++ b/gdb/ppc-netbsd-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for NetBSD/powerpc.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ppc-obsd-nat.c b/gdb/ppc-obsd-nat.c
index 66e7b93..48df9d7 100644
--- a/gdb/ppc-obsd-nat.c
+++ b/gdb/ppc-obsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for OpenBSD/powerpc.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -186,9 +186,7 @@ ppcobsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
return 1;
}
-void _initialize_ppcobsd_nat ();
-void
-_initialize_ppcobsd_nat ()
+INIT_GDB_FILE (ppcobsd_nat)
{
add_inf_child_target (&the_ppc_obsd_nat_target);
diff --git a/gdb/ppc-obsd-tdep.c b/gdb/ppc-obsd-tdep.c
index 37be2d1..18f4d79 100644
--- a/gdb/ppc-obsd-tdep.c
+++ b/gdb/ppc-obsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for OpenBSD/powerpc.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -254,8 +254,7 @@ ppcobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_return_value (gdbarch, ppc_sysv_abi_broken_return_value);
/* OpenBSD uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
set_gdbarch_iterate_over_regset_sections
(gdbarch, ppcobsd_iterate_over_regset_sections);
@@ -263,9 +262,7 @@ ppcobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
frame_unwind_append_unwinder (gdbarch, &ppcobsd_sigtramp_frame_unwind);
}
-void _initialize_ppcobsd_tdep ();
-void
-_initialize_ppcobsd_tdep ()
+INIT_GDB_FILE (ppcobsd_tdep)
{
gdbarch_register_osabi (bfd_arch_rs6000, 0, GDB_OSABI_OPENBSD,
ppcobsd_init_abi);
diff --git a/gdb/ppc-obsd-tdep.h b/gdb/ppc-obsd-tdep.h
index 7f5e7b9..20dc45b 100644
--- a/gdb/ppc-obsd-tdep.h
+++ b/gdb/ppc-obsd-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for OpenBSD/powerpc.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ppc-ravenscar-thread.c b/gdb/ppc-ravenscar-thread.c
index fd44a9a..88008d9 100644
--- a/gdb/ppc-ravenscar-thread.c
+++ b/gdb/ppc-ravenscar-thread.c
@@ -1,6 +1,6 @@
/* Ravenscar PowerPC target support.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ppc-ravenscar-thread.h b/gdb/ppc-ravenscar-thread.h
index c03fbd2..52fe4a0 100644
--- a/gdb/ppc-ravenscar-thread.h
+++ b/gdb/ppc-ravenscar-thread.h
@@ -1,6 +1,6 @@
/* Ravenscar PowerPC target support.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index f317c94..f872f73 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1,7 +1,7 @@
/* Target-dependent code for PowerPC systems using the SVR4 ABI
for GDB, the GNU debugger.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -2060,10 +2060,12 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
}
/* Small character arrays are returned, right justified, in r3. */
- if (valtype->code () == TYPE_CODE_ARRAY
+ if (tdep->elf_abi == POWERPC_ELF_V1
+ && valtype->code () == TYPE_CODE_ARRAY
&& !valtype->is_vector ()
&& valtype->length () <= 8
- && valtype->target_type ()->code () == TYPE_CODE_INT
+ && (valtype->target_type ()->code () == TYPE_CODE_INT
+ || valtype->target_type ()->code () == TYPE_CODE_CHAR)
&& valtype->target_type ()->length () == 1)
{
int regnum = tdep->ppc_gp0_regnum + 3;
@@ -2112,6 +2114,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
/* In the ELFv2 ABI, aggregate types of up to 16 bytes are
returned in registers r3:r4. */
if (tdep->elf_abi == POWERPC_ELF_V2
+ && !TYPE_HAS_DYNAMIC_LENGTH (valtype)
&& valtype->length () <= 16
&& (valtype->code () == TYPE_CODE_STRUCT
|| valtype->code () == TYPE_CODE_UNION
diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h
index 3176c15..bf0e82a 100644
--- a/gdb/ppc-tdep.h
+++ b/gdb/ppc-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for GDB, the GNU debugger.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ppc64-tdep.c b/gdb/ppc64-tdep.c
index 5e75800..a8dcf6f 100644
--- a/gdb/ppc64-tdep.c
+++ b/gdb/ppc64-tdep.c
@@ -1,6 +1,6 @@
/* Common target-dependent code for ppc64 GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ppc64-tdep.h b/gdb/ppc64-tdep.h
index 5ad8841..893ae8a 100644
--- a/gdb/ppc64-tdep.h
+++ b/gdb/ppc64-tdep.h
@@ -1,6 +1,6 @@
/* Common target-dependent code for ppc64.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 3cd8420..e27ccd0 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1,6 +1,6 @@
/* Print values for GNU debugger GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -54,7 +54,6 @@
#include "source.h"
#include "gdbsupport/byte-vector.h"
#include <optional>
-#include "gdbsupport/gdb-safe-ctype.h"
#include "inferior.h"
/* Chain containing all defined memory-tag subcommands. */
@@ -753,10 +752,10 @@ pc_prefix (CORE_ADDR addr)
if (has_stack_frames ())
{
frame_info_ptr frame;
- CORE_ADDR pc;
+ std::optional<CORE_ADDR> pc;
frame = get_selected_frame (NULL);
- if (get_frame_pc_if_available (frame, &pc) && pc == addr)
+ if ((pc = get_frame_pc_if_available (frame)) && *pc == addr)
return "=> ";
}
return " ";
@@ -1290,7 +1289,9 @@ should_validate_memtags (gdbarch *gdbarch, struct value *value)
return false;
/* We do. Check whether it includes any tags. */
- return target_is_address_tagged (gdbarch, value_as_address (value));
+ struct type *val_type = value->type ();
+ const gdb_byte *data = value->contents ().data ();
+ return target_is_address_tagged (gdbarch, unpack_pointer (val_type, data));
}
/* Helper for parsing arguments for print_command_1. */
@@ -1320,7 +1321,9 @@ process_print_command_args (const char *args, value_print_options *print_opts,
value, so invert it for parse_expression. */
parser_flags flags = 0;
if (!voidprint)
- flags = PARSER_VOID_CONTEXT;
+ flags |= PARSER_VOID_CONTEXT;
+ if (parser_debug)
+ flags |= PARSER_DEBUG;
expression_up expr = parse_expression (exp, nullptr, flags);
return expr->evaluate ();
}
@@ -1489,28 +1492,28 @@ info_symbol_command (const char *arg, int from_tty)
error_no_arg (_("address"));
addr = parse_and_eval_address (arg);
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section *osect : objfile->sections ())
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &osect : objfile.sections ())
{
/* Only process each object file once, even if there's a separate
debug file. */
- if (objfile->separate_debug_objfile_backlink)
+ if (objfile.separate_debug_objfile_backlink)
continue;
- sect_addr = overlay_mapped_address (addr, osect);
+ sect_addr = overlay_mapped_address (addr, &osect);
- if (osect->contains (sect_addr)
+ if (osect.contains (sect_addr)
&& (msymbol
= lookup_minimal_symbol_by_pc_section (sect_addr,
- osect).minsym))
+ &osect).minsym))
{
const char *obj_name, *mapped, *sec_name, *msym_name;
const char *loc_string;
matches = 1;
- offset = sect_addr - msymbol->value_address (objfile);
- mapped = section_is_mapped (osect) ? _("mapped") : _("unmapped");
- sec_name = osect->the_bfd_section->name;
+ offset = sect_addr - msymbol->value_address (&objfile);
+ mapped = section_is_mapped (&osect) ? _("mapped") : _("unmapped");
+ sec_name = osect.the_bfd_section->name;
msym_name = msymbol->print_name ();
/* Don't print the offset if it is zero.
@@ -1524,12 +1527,12 @@ info_symbol_command (const char *arg, int from_tty)
else
loc_string = msym_name;
- gdb_assert (osect->objfile && objfile_name (osect->objfile));
- obj_name = objfile_name (osect->objfile);
+ gdb_assert (osect.objfile && objfile_name (osect.objfile));
+ obj_name = objfile_name (osect.objfile);
if (current_program_space->multi_objfile_p ())
- if (pc_in_unmapped_range (addr, osect))
- if (section_is_overlay (osect))
+ if (pc_in_unmapped_range (addr, &osect))
+ if (section_is_overlay (&osect))
gdb_printf (_("%s in load address range of "
"%s overlay section %s of %s\n"),
loc_string, mapped, sec_name, obj_name);
@@ -1538,15 +1541,15 @@ info_symbol_command (const char *arg, int from_tty)
"section %s of %s\n"),
loc_string, sec_name, obj_name);
else
- if (section_is_overlay (osect))
+ if (section_is_overlay (&osect))
gdb_printf (_("%s in %s overlay section %s of %s\n"),
loc_string, mapped, sec_name, obj_name);
else
gdb_printf (_("%s in section %s of %s\n"),
loc_string, sec_name, obj_name);
else
- if (pc_in_unmapped_range (addr, osect))
- if (section_is_overlay (osect))
+ if (pc_in_unmapped_range (addr, &osect))
+ if (section_is_overlay (&osect))
gdb_printf (_("%s in load address range of %s overlay "
"section %s\n"),
loc_string, mapped, sec_name);
@@ -1555,7 +1558,7 @@ info_symbol_command (const char *arg, int from_tty)
(_("%s in load address range of section %s\n"),
loc_string, sec_name);
else
- if (section_is_overlay (osect))
+ if (section_is_overlay (&osect))
gdb_printf (_("%s in %s overlay section %s\n"),
loc_string, mapped, sec_name);
else
@@ -1651,7 +1654,7 @@ info_address_command (const char *exp, int from_tty)
return;
}
- switch (sym->aclass ())
+ switch (sym->loc_class ())
{
case LOC_CONST:
case LOC_CONST_BYTES:
@@ -2392,7 +2395,7 @@ printf_c_string (struct ui_file *stream, const char *format,
}
else
{
- CORE_ADDR tem = value_as_address (value);;
+ CORE_ADDR tem = value_as_address (value);
if (tem == 0)
{
@@ -2700,7 +2703,6 @@ ui_printf (const char *arg, struct ui_file *stream)
{
int nargs_wanted;
int i;
- const char *current_substring;
nargs_wanted = 0;
for (auto &&piece : fpieces)
@@ -2729,7 +2731,8 @@ ui_printf (const char *arg, struct ui_file *stream)
i = 0;
for (auto &&piece : fpieces)
{
- current_substring = piece.string;
+ const char *current_substring = fpieces.piece_str (piece);
+
switch (piece.argclass)
{
case string_arg:
@@ -2883,7 +2886,7 @@ static void
printf_command (const char *arg, int from_tty)
{
ui_printf (arg, gdb_stdout);
- gdb_stdout->reset_style ();
+ gdb_stdout->emit_style_escape (ui_file_style ());
gdb_stdout->wrap_here (0);
gdb_stdout->flush ();
}
@@ -3181,9 +3184,7 @@ memory_tag_check_command (const char *args, int from_tty)
}
}
-void _initialize_printcmd ();
-void
-_initialize_printcmd ()
+INIT_GDB_FILE (printcmd)
{
struct cmd_list_element *c;
diff --git a/gdb/probe.c b/gdb/probe.c
index b13baf0..4533a08 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -1,6 +1,6 @@
/* Generic static probe support for GDB.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -33,7 +33,6 @@
#include "ax.h"
#include "ax-gdb.h"
#include "location.h"
-#include <ctype.h>
#include <algorithm>
#include <optional>
@@ -72,19 +71,19 @@ parse_probes_in_pspace (const static_probe_ops *spops,
const char *name,
std::vector<symtab_and_line> *result)
{
- for (objfile *objfile : search_pspace->objfiles ())
+ for (objfile &objfile : search_pspace->objfiles ())
{
- if (!objfile->sf || !objfile->sf->sym_probe_fns)
+ if (!objfile.sf || !objfile.sf->sym_probe_fns)
continue;
if (objfile_namestr
- && FILENAME_CMP (objfile_name (objfile), objfile_namestr) != 0
- && FILENAME_CMP (lbasename (objfile_name (objfile)),
+ && FILENAME_CMP (objfile_name (&objfile), objfile_namestr) != 0
+ && FILENAME_CMP (lbasename (objfile_name (&objfile)),
objfile_namestr) != 0)
continue;
const std::vector<std::unique_ptr<probe>> &probes
- = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
+ = objfile.sf->sym_probe_fns->sym_get_probes (&objfile);
for (auto &p : probes)
{
@@ -98,12 +97,12 @@ parse_probes_in_pspace (const static_probe_ops *spops,
continue;
symtab_and_line sal;
- sal.pc = p->get_relocated_address (objfile);
+ sal.pc = p->get_relocated_address (&objfile);
sal.explicit_pc = 1;
sal.section = find_pc_overlay (sal.pc);
sal.pspace = search_pspace;
sal.prob = p.get ();
- sal.objfile = objfile;
+ sal.objfile = &objfile;
result->push_back (std::move (sal));
}
@@ -246,19 +245,19 @@ find_probe_by_pc (CORE_ADDR pc)
result.objfile = NULL;
result.prob = NULL;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- if (!objfile->sf || !objfile->sf->sym_probe_fns
- || objfile->sect_index_text == -1)
+ if (!objfile.sf || !objfile.sf->sym_probe_fns
+ || objfile.sect_index_text == -1)
continue;
/* If this proves too inefficient, we can replace with a hash. */
const std::vector<std::unique_ptr<probe>> &probes
- = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
+ = objfile.sf->sym_probe_fns->sym_get_probes (&objfile);
for (auto &p : probes)
- if (p->get_relocated_address (objfile) == pc)
+ if (p->get_relocated_address (&objfile) == pc)
{
- result.objfile = objfile;
+ result.objfile = &objfile;
result.prob = p.get ();
return result;
}
@@ -291,19 +290,19 @@ collect_probes (const std::string &objname, const std::string &provider,
obj_pat.emplace (objname.c_str (), REG_NOSUB,
_("Invalid object file regexp"));
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- if (! objfile->sf || ! objfile->sf->sym_probe_fns)
+ if (! objfile.sf || ! objfile.sf->sym_probe_fns)
continue;
if (obj_pat)
{
- if (obj_pat->exec (objfile_name (objfile), 0, NULL, 0) != 0)
+ if (obj_pat->exec (objfile_name (&objfile), 0, NULL, 0) != 0)
continue;
}
const std::vector<std::unique_ptr<probe>> &probes
- = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
+ = objfile.sf->sym_probe_fns->sym_get_probes (&objfile);
for (auto &p : probes)
{
@@ -318,7 +317,7 @@ collect_probes (const std::string &objname, const std::string &provider,
&& probe_pat->exec (p->get_name ().c_str (), 0, NULL, 0) != 0)
continue;
- result.emplace_back (p.get (), objfile);
+ result.emplace_back (p.get (), &objfile);
}
}
@@ -826,7 +825,7 @@ probe_is_linespec_by_keyword (const char **linespecp, const char *const *keyword
const char *keyword = *csp;
size_t len = strlen (keyword);
- if (strncmp (s, keyword, len) == 0 && isspace (s[len]))
+ if (strncmp (s, keyword, len) == 0 && c_isspace (s[len]))
{
*linespecp += len + 1;
return 1;
@@ -973,9 +972,7 @@ static const struct internalvar_funcs probe_funcs =
std::vector<const static_probe_ops *> all_static_probe_ops;
-void _initialize_probe ();
-void
-_initialize_probe ()
+INIT_GDB_FILE (probe)
{
all_static_probe_ops.push_back (&any_static_probe_ops);
diff --git a/gdb/probe.h b/gdb/probe.h
index 00b3f90..446ec18 100644
--- a/gdb/probe.h
+++ b/gdb/probe.h
@@ -1,6 +1,6 @@
/* Generic SDT probe support for GDB.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/proc-api.c b/gdb/proc-api.c
index 55e3919..f3d4e14 100644
--- a/gdb/proc-api.c
+++ b/gdb/proc-api.c
@@ -1,6 +1,6 @@
/* Machine independent support for Solaris /proc (process file system) for GDB.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
Written by Michael Snyder at Cygnus Solutions.
Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
@@ -413,9 +413,7 @@ proc_prettyfprint_status (long flags, int why, int what, int thread)
}
}
-void _initialize_proc_api ();
-void
-_initialize_proc_api ()
+INIT_GDB_FILE (proc_api)
{
add_setshow_boolean_cmd ("procfs-trace", no_class, &procfs_trace, _("\
Set tracing for /proc api calls."), _("\
diff --git a/gdb/proc-events.c b/gdb/proc-events.c
index 55b7363..c6ed1f4 100644
--- a/gdb/proc-events.c
+++ b/gdb/proc-events.c
@@ -1,6 +1,6 @@
/* Machine-independent support for Solaris /proc (process file system)
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
Written by Michael Snyder at Cygnus Solutions.
Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
@@ -759,9 +759,7 @@ proc_prettyprint_actionset (struct sigaction *actions, int verbose)
{
}
-void _initialize_proc_events ();
-void
-_initialize_proc_events ()
+INIT_GDB_FILE (proc_events)
{
init_syscall_table ();
}
diff --git a/gdb/proc-flags.c b/gdb/proc-flags.c
index 33075e9..522c142 100644
--- a/gdb/proc-flags.c
+++ b/gdb/proc-flags.c
@@ -1,5 +1,5 @@
/* Machine independent support for Solaris /proc (process file system) for GDB.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
Written by Michael Snyder at Cygnus Solutions.
Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
diff --git a/gdb/proc-service.c b/gdb/proc-service.c
index ce2d69a..4f2be0f 100644
--- a/gdb/proc-service.c
+++ b/gdb/proc-service.c
@@ -1,6 +1,6 @@
/* <proc_service.h> implementation.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -206,9 +206,7 @@ ps_getpid (struct ps_prochandle *ph)
return ph->thread->ptid.pid ();
}
-void _initialize_proc_service ();
-void
-_initialize_proc_service ()
+INIT_GDB_FILE (proc_service)
{
/* This function solely exists to make sure this module is linked
into the final binary. */
diff --git a/gdb/proc-service.list b/gdb/proc-service.list
index 5fdb45a..102b2b3 100644
--- a/gdb/proc-service.list
+++ b/gdb/proc-service.list
@@ -1,6 +1,6 @@
/* -Wl,--dynamic-list symbols exported for libthread_db.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/proc-utils.h b/gdb/proc-utils.h
index 5f8fe39..85a6f40 100644
--- a/gdb/proc-utils.h
+++ b/gdb/proc-utils.h
@@ -1,5 +1,5 @@
/* Machine independent support for SVR4 /proc (process file system) for GDB.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/proc-why.c b/gdb/proc-why.c
index ec8987d..2e8d33c 100644
--- a/gdb/proc-why.c
+++ b/gdb/proc-why.c
@@ -1,6 +1,6 @@
/* Machine-independent support for Solaris /proc (process file system)
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
Written by Michael Snyder at Cygnus Solutions.
Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
diff --git a/gdb/process-stratum-target.c b/gdb/process-stratum-target.c
index e827f74..329589d 100644
--- a/gdb/process-stratum-target.c
+++ b/gdb/process-stratum-target.c
@@ -1,6 +1,6 @@
/* Abstract base class inherited by all process_stratum targets
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/process-stratum-target.h b/gdb/process-stratum-target.h
index 5ca433a..b646c11 100644
--- a/gdb/process-stratum-target.h
+++ b/gdb/process-stratum-target.h
@@ -1,6 +1,6 @@
/* Abstract base class inherited by all process_stratum targets
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -79,6 +79,11 @@ public:
target_waitkind fork_kind, bool follow_child,
bool detach_on_fork) override;
+ /* Assume sub-classes are not shareable. Those that are need to mark
+ themselves as such. */
+ bool is_shareable () override
+ { return false; }
+
/* True if any thread is, or may be executing. We need to track
this separately because until we fully sync the thread list, we
won't know whether the target is fully stopped, even if we see
diff --git a/gdb/procfs.c b/gdb/procfs.c
index be95a35..49a0ff5 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -1,6 +1,6 @@
/* Machine independent support for Solaris /proc (process file system) for GDB.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
Written by Michael Snyder at Cygnus Solutions.
Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
@@ -38,7 +38,6 @@
#include <sys/syscall.h>
#include "gdbsupport/gdb_wait.h"
#include <signal.h>
-#include <ctype.h>
#include "gdb_bfd.h"
#include "auxv.h"
#include "procfs.h"
@@ -3169,7 +3168,7 @@ find_memory_regions_callback (struct prmap *map,
(map->pr_mflags & MA_READ) != 0,
(map->pr_mflags & MA_WRITE) != 0,
(map->pr_mflags & MA_EXEC) != 0,
- 1, /* MODIFIED is unknown, pass it as true. */
+ true, /* MODIFIED is unknown, pass it as true. */
false,
data);
}
@@ -3304,7 +3303,7 @@ procfs_target::info_proc (const char *args, enum info_proc_what what)
gdb_argv built_argv (args);
for (char *arg : built_argv)
{
- if (isdigit (arg[0]))
+ if (c_isdigit (arg[0]))
{
pid = strtoul (arg, &tmp, 10);
if (*tmp == '/')
@@ -3415,7 +3414,7 @@ proc_trace_syscalls (const char *args, int from_tty, int entry_or_exit, int mode
error_no_arg (_("system call to trace"));
pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
- if (isdigit (args[0]))
+ if (c_isdigit (args[0]))
{
const int syscallnum = atoi (args);
@@ -3447,9 +3446,7 @@ proc_untrace_sysexit_cmd (const char *args, int from_tty)
proc_trace_syscalls (args, from_tty, PR_SYSEXIT, FLAG_RESET);
}
-void _initialize_procfs ();
-void
-_initialize_procfs ()
+INIT_GDB_FILE (procfs)
{
add_com ("proc-trace-entry", no_class, proc_trace_sysentry_cmd,
_("Give a trace of entries into the syscall."));
@@ -3550,21 +3547,17 @@ procfs_corefile_thread_callback (procinfo *pi, procinfo *thread, void *data)
return 0;
}
-static int
-find_signalled_thread (struct thread_info *info, void *data)
+static bool
+find_signalled_thread (struct thread_info *info)
{
- if (info->stop_signal () != GDB_SIGNAL_0
- && info->ptid.pid () == inferior_ptid.pid ())
- return 1;
-
- return 0;
+ return (info->stop_signal () != GDB_SIGNAL_0
+ && info->ptid.pid () == inferior_ptid.pid ());
}
static enum gdb_signal
find_stop_signal (void)
{
- struct thread_info *info =
- iterate_over_threads (find_signalled_thread, NULL);
+ struct thread_info *info = iterate_over_threads (find_signalled_thread);
if (info)
return info->stop_signal ();
diff --git a/gdb/procfs.h b/gdb/procfs.h
index 0dafb9a..65d68f0 100644
--- a/gdb/procfs.h
+++ b/gdb/procfs.h
@@ -1,6 +1,6 @@
/* Native debugging support for procfs targets.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/producer.c b/gdb/producer.c
index ad3a354..71e1b92 100644
--- a/gdb/producer.c
+++ b/gdb/producer.c
@@ -1,6 +1,6 @@
/* Producer string parsers for GDB.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -66,9 +66,9 @@ producer_is_gcc (const char *producer, int *major, int *minor)
"GNU Fortran 4.8.2 20140120 (Red Hat 4.8.2-16) -mtune=generic ..."
"GNU C++14 5.0.0 20150123 (experimental)"
*/
- while (*cs && !isspace (*cs))
+ while (*cs && !c_isspace (*cs))
cs++;
- if (*cs && isspace (*cs))
+ if (*cs && c_isspace (*cs))
cs++;
if (sscanf (cs, "%d.%d", major, minor) == 2)
return 1;
@@ -335,9 +335,7 @@ Version 18.0 Beta";
}
#endif
-void _initialize_producer ();
-void
-_initialize_producer ()
+INIT_GDB_FILE (producer)
{
#if defined GDB_SELF_TEST
selftests::register_test
diff --git a/gdb/producer.h b/gdb/producer.h
index 1f85bda..f5bf807 100644
--- a/gdb/producer.h
+++ b/gdb/producer.h
@@ -1,6 +1,6 @@
/* Producer string parsers for GDB.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/progspace-and-thread.c b/gdb/progspace-and-thread.c
index e78e56d..ec90850 100644
--- a/gdb/progspace-and-thread.c
+++ b/gdb/progspace-and-thread.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/progspace-and-thread.h b/gdb/progspace-and-thread.h
index 52c493b..838102b 100644
--- a/gdb/progspace-and-thread.h
+++ b/gdb/progspace-and-thread.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 0734b44..4017d0f 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -1,6 +1,6 @@
/* Program and address space management, for GDB, the GNU debugger.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,7 +21,6 @@
#include "objfiles.h"
#include "gdbcore.h"
#include "solib.h"
-#include "solist.h"
#include "gdbthread.h"
#include "inferior.h"
#include <algorithm>
@@ -147,6 +146,31 @@ program_space::free_all_objfiles ()
/* See progspace.h. */
void
+program_space::iterate_over_objfiles_in_search_order
+ (iterate_over_objfiles_in_search_order_cb_ftype cb, objfile *current_objfile)
+{
+ if (m_solib_ops != nullptr)
+ return m_solib_ops->iterate_over_objfiles_in_search_order
+ (cb, current_objfile);
+
+ for (auto &objfile : this->objfiles ())
+ if (cb (&objfile))
+ return;
+}
+
+/* See progspace.h. */
+
+void
+program_space::map_symbol_filenames (symbol_filename_listener fun,
+ bool need_fullname)
+{
+ for (objfile &objfile : objfiles ())
+ objfile.map_symbol_filenames (fun, need_fullname);
+}
+
+/* See progspace.h. */
+
+void
program_space::add_objfile (std::unique_ptr<objfile> &&objfile,
struct objfile *before)
{
@@ -183,13 +207,13 @@ program_space::remove_objfile (struct objfile *objfile)
struct objfile *
program_space::objfile_for_address (CORE_ADDR address)
{
- for (auto iter : objfiles ())
+ for (auto &iter : objfiles ())
{
/* Don't check separate debug objfiles. */
- if (iter->separate_debug_objfile_backlink != nullptr)
+ if (iter.separate_debug_objfile_backlink != nullptr)
continue;
- if (is_addr_in_objfile (address, iter))
- return iter;
+ if (is_addr_in_objfile (address, &iter))
+ return &iter;
}
return nullptr;
}
@@ -202,12 +226,14 @@ program_space::exec_close ()
if (ebfd != nullptr)
{
/* Removing target sections may close the exec_ops target.
- Clear ebfd before doing so to prevent recursion. */
- bfd *saved_ebfd = ebfd.get ();
+ Clear ebfd before doing so to prevent recursion. We
+ move it to another ref_ptr instead of saving it to a raw
+ pointer to avoid it looking like possible use-after-free. */
+ gdb_bfd_ref_ptr saved_ebfd = std::move (ebfd);
ebfd.reset (nullptr);
ebfd_mtime = 0;
- remove_target_sections (saved_ebfd);
+ remove_target_sections (saved_ebfd.get ());
m_exec_filename.reset ();
}
@@ -287,11 +313,10 @@ print_program_space (struct ui_out *uiout, int requested)
/* There should always be at least one. */
gdb_assert (count > 0);
- ui_out_emit_table table_emitter (uiout, 4, count, "pspaces");
+ ui_out_emit_table table_emitter (uiout, 3, count, "pspaces");
uiout->table_header (1, ui_left, "current", "");
uiout->table_header (4, ui_left, "id", "Id");
uiout->table_header (longest_exec_name, ui_left, "exec", "Executable");
- uiout->table_header (17, ui_left, "core", "Core File");
uiout->table_body ();
for (struct program_space *pspace : program_spaces)
@@ -316,12 +341,6 @@ print_program_space (struct ui_out *uiout, int requested)
else
uiout->field_skip ("exec");
- if (pspace->cbfd != nullptr)
- uiout->field_string ("core", bfd_get_filename (pspace->cbfd.get ()),
- file_name_style.style ());
- else
- uiout->field_skip ("core");
-
/* Print extra info that doesn't really fit in tabular form.
Currently, we print the list of inferiors bound to a pspace.
There can be more than one inferior bound to the same pspace,
diff --git a/gdb/progspace.h b/gdb/progspace.h
index 7de970b..498a5b4 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -1,6 +1,6 @@
/* Program and address space management, for GDB, the GNU debugger.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,12 +21,14 @@
#ifndef GDB_PROGSPACE_H
#define GDB_PROGSPACE_H
+#include "solib.h"
#include "target.h"
#include "gdb_bfd.h"
+#include "quick-symbol.h"
#include "registry.h"
-#include "solist.h"
#include "gdbsupport/safe-iterator.h"
#include "gdbsupport/intrusive_list.h"
+#include "gdbsupport/owning_intrusive_list.h"
#include "gdbsupport/refcounted-object.h"
#include "gdbsupport/gdb_ref_ptr.h"
#include <vector>
@@ -183,17 +185,18 @@ struct program_space
a program space. */
~program_space ();
- using objfiles_iterator
- = reference_to_pointer_iterator<intrusive_list<objfile>::iterator>;
+ using objfiles_iterator = intrusive_list<objfile>::iterator;
using objfiles_range = iterator_range<objfiles_iterator>;
/* Return an iterable object that can be used to iterate over all
objfiles. The basic use is in a foreach, like:
- for (objfile *objf : pspace->objfiles ()) { ... } */
+ for (objfile &objf : pspace->objfiles ()) { ... } */
objfiles_range objfiles ()
{
- return objfiles_range (objfiles_iterator (m_objfiles_list.begin ()));
+ objfiles_iterator begin (m_objfiles_list.begin ());
+
+ return objfiles_range (std::move (begin));
}
using objfiles_safe_range = basic_safe_range<objfiles_range>;
@@ -201,16 +204,33 @@ struct program_space
/* An iterable object that can be used to iterate over all objfiles.
The basic use is in a foreach, like:
- for (objfile *objf : pspace->objfiles_safe ()) { ... }
+ for (objfile &objf : pspace->objfiles_safe ()) { ... }
This variant uses a basic_safe_iterator so that objfiles can be
deleted during iteration. */
objfiles_safe_range objfiles_safe ()
{
- return objfiles_safe_range
- (objfiles_range (objfiles_iterator (m_objfiles_list.begin ())));
+ return objfiles_safe_range (this->objfiles ());
}
+ /* Iterate over all objfiles of the program space in the order that makes the
+ most sense to make global symbol searches.
+
+ CB is a callback function passed an objfile to be searched. The iteration stops
+ if this function returns true.
+
+ If not nullptr, CURRENT_OBJFILE corresponds to the objfile being
+ inspected when the symbol search was requested. */
+ void iterate_over_objfiles_in_search_order
+ (iterate_over_objfiles_in_search_order_cb_ftype cb,
+ objfile *current_objfile);
+
+ /* Wrapper around the quick_symbol_functions map_symbol_filenames
+ "method". Map function FUN over every file, in every objfile in
+ this program space. See
+ quick_symbol_functions.map_symbol_filenames for details. */
+ void map_symbol_filenames (symbol_filename_listener fun, bool need_fullname);
+
/* Add OBJFILE to the list of objfiles, putting it just before
BEFORE. If BEFORE is nullptr, it will go at the end of the
list. */
@@ -231,9 +251,30 @@ struct program_space
is outside all objfiles in this progspace. */
struct objfile *objfile_for_address (CORE_ADDR address);
- /* Return the list of all the solibs in this program space. */
+ /* Set this program space's solib provider.
+
+ The solib provider must be unset prior to calling this method. */
+ void set_solib_ops (solib_ops_up ops)
+ {
+ gdb_assert (m_solib_ops == nullptr);
+ m_solib_ops = std::move (ops);
+ };
+
+ /* Unset and free this program space's solib provider. */
+ void unset_solib_ops ()
+ { m_solib_ops = nullptr; }
+
+ /* Unset and return this program space's solib provider. */
+ solib_ops_up release_solib_ops ()
+ { return std::move (m_solib_ops); }
+
+ /* Get this program space's solib provider. */
+ const struct solib_ops *solib_ops () const
+ { return m_solib_ops.get (); }
+
+ /* Return the list of all the solibs in this program space. */
owning_intrusive_list<solib> &solibs ()
- { return so_list; }
+ { return m_solib_list; }
/* Similar to `bfd_get_filename (exec_bfd ())` but in original form given
by user, without symbolic links and pathname resolved. It is not nullptr
@@ -258,9 +299,6 @@ struct program_space
ebfd = std::move (abfd);
}
- bfd *core_bfd () const
- { return cbfd.get (); }
-
/* Reset saved solib data at the start of an solib event. This lets
us properly collect the data when calling solib_add, so it can then
later be printed. */
@@ -305,9 +343,6 @@ struct program_space
/* The last-modified time, from when the exec was brought in. */
long ebfd_mtime = 0;
- /* Binary file diddling handle for the core file. */
- gdb_bfd_ref_ptr cbfd;
-
/* The address space attached to this program space. More than one
program space may be bound to the same address space. In the
traditional unix-like debugging scenario, this will usually
@@ -337,10 +372,6 @@ struct program_space
(e.g. the argument to the "symbol-file" or "file" command). */
struct objfile *symfile_object_file = NULL;
- /* List of shared objects mapped into this space. Managed by
- solib.c. */
- owning_intrusive_list<solib> so_list;
-
/* Number of calls to solib_add. */
unsigned int solib_add_generation = 0;
@@ -359,6 +390,13 @@ private:
/* All known objfiles are kept in a linked list. */
owning_intrusive_list<objfile> m_objfiles_list;
+ /* solib_ops implementation used to provide solibs in this program space. */
+ solib_ops_up m_solib_ops;
+
+ /* List of shared objects mapped into this space. Managed by
+ solib.c. */
+ owning_intrusive_list<solib> m_solib_list;
+
/* The set of target sections matching the sections mapped into
this program space. Managed by both exec_ops and solib.c. */
std::vector<target_section> m_target_sections;
diff --git a/gdb/prologue-value.c b/gdb/prologue-value.c
index 2c0ce52..85483c0 100644
--- a/gdb/prologue-value.c
+++ b/gdb/prologue-value.c
@@ -1,5 +1,5 @@
/* Prologue value handling for GDB.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/prologue-value.h b/gdb/prologue-value.h
index 39235d5..3f1cf33 100644
--- a/gdb/prologue-value.h
+++ b/gdb/prologue-value.h
@@ -1,5 +1,5 @@
/* Interface to prologue value handling for GDB.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 28455ba..413212d 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1,6 +1,6 @@
/* Partial symbol tables.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -228,7 +228,7 @@ find_pc_sect_psymbol (struct objfile *objfile,
for (const partial_symbol *p : psymtab->global_psymbols)
{
if (p->domain == VAR_DOMAIN
- && p->aclass == LOC_BLOCK
+ && p->loc_class == LOC_BLOCK
&& pc >= p->address (objfile)
&& (p->address (objfile) > best_pc
|| (psymtab->text_low (objfile) == 0
@@ -248,7 +248,7 @@ find_pc_sect_psymbol (struct objfile *objfile,
for (const partial_symbol *p : psymtab->static_psymbols)
{
if (p->domain == VAR_DOMAIN
- && p->aclass == LOC_BLOCK
+ && p->loc_class == LOC_BLOCK
&& pc >= p->address (objfile)
&& (p->address (objfile) > best_pc
|| (psymtab->text_low (objfile) == 0
@@ -537,7 +537,7 @@ print_partial_symbols (struct gdbarch *gdbarch, struct objfile *objfile,
gdb_puts ("<invalid domain>, ", outfile);
break;
}
- switch (p->aclass)
+ switch (p->loc_class)
{
case LOC_UNDEF:
gdb_puts ("undefined", outfile);
@@ -790,7 +790,7 @@ psymtab_to_fullname (struct partial_symtab *ps)
return ps->fullname;
}
-/* A helper for psym_expand_symtabs_matching that handles searching
+/* A helper for psymbol_functions::search that handles searching
included psymtabs. This returns true if a symbol is found, and
false otherwise. It also updates the 'searched_flag' on the
various psymtabs that it searches. */
@@ -800,7 +800,7 @@ recursively_search_psymtabs (partial_symtab *ps, objfile *objfile,
block_search_flags search_flags,
domain_search_flags domain,
const lookup_name_info &lookup_name,
- expand_symtabs_symbol_matcher sym_matcher)
+ search_symtabs_symbol_matcher sym_matcher)
{
int keep_going = 1;
enum psymtab_search_status result = PST_SEARCHED_AND_NOT_FOUND;
@@ -885,19 +885,19 @@ recursively_search_psymtabs (partial_symtab *ps, objfile *objfile,
return result == PST_SEARCHED_AND_FOUND;
}
-/* Psymtab version of expand_symtabs_matching. See its definition in
+/* Psymtab version of search. See its definition in
the definition of quick_symbol_functions in symfile.h. */
bool
-psymbol_functions::expand_symtabs_matching
+psymbol_functions::search
(struct objfile *objfile,
- expand_symtabs_file_matcher file_matcher,
+ search_symtabs_file_matcher file_matcher,
const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
+ search_symtabs_symbol_matcher symbol_matcher,
+ search_symtabs_expansion_listener listener,
block_search_flags search_flags,
domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher ATTRIBUTE_UNUSED)
+ search_symtabs_lang_matcher lang_matcher ATTRIBUTE_UNUSED)
{
/* Clear the search flags. */
for (partial_symtab *ps : partial_symbols (objfile))
@@ -914,9 +914,6 @@ psymbol_functions::expand_symtabs_matching
{
QUIT;
- if (ps->readin_p (objfile))
- continue;
-
if (file_matcher)
{
bool match;
@@ -944,8 +941,8 @@ psymbol_functions::expand_symtabs_matching
{
compunit_symtab *cust = psymtab_to_symtab (objfile, ps);
- if (cust != nullptr && expansion_notify != nullptr)
- if (!expansion_notify (cust))
+ if (cust != nullptr && listener != nullptr)
+ if (!listener (cust))
return false;
}
}
@@ -1022,12 +1019,12 @@ psymbol_bcache::hash (const void *addr, int length)
struct partial_symbol *psymbol = (struct partial_symbol *) addr;
unsigned int lang = psymbol->ginfo.language ();
unsigned int domain = psymbol->domain;
- unsigned int theclass = psymbol->aclass;
+ unsigned int loc_class = psymbol->loc_class;
h = fast_hash (&psymbol->ginfo.m_value, sizeof (psymbol->ginfo.m_value), h);
h = fast_hash (&lang, sizeof (unsigned int), h);
h = fast_hash (&domain, sizeof (unsigned int), h);
- h = fast_hash (&theclass, sizeof (unsigned int), h);
+ h = fast_hash (&loc_class, sizeof (unsigned int), h);
/* Note that psymbol names are interned via compute_and_set_names, so
there's no need to hash the contents of the name here. */
h = fast_hash (&psymbol->ginfo.m_name, sizeof (psymbol->ginfo.m_name), h);
@@ -1047,7 +1044,7 @@ psymbol_bcache::compare (const void *addr1, const void *addr2, int length)
sizeof (sym1->ginfo.m_value)) == 0
&& sym1->ginfo.language () == sym2->ginfo.language ()
&& sym1->domain == sym2->domain
- && sym1->aclass == sym2->aclass
+ && sym1->loc_class == sym2->loc_class
/* Note that psymbol names are interned via
compute_and_set_names, so there's no need to compare the
contents of the name here. */
@@ -1085,7 +1082,7 @@ partial_symtab::add_psymbol (const partial_symbol &psymbol,
void
partial_symtab::add_psymbol (std::string_view name, bool copy_name,
domain_enum domain,
- enum address_class theclass,
+ location_class loc_class,
int section,
psymbol_placement where,
unrelocated_addr coreaddr,
@@ -1099,7 +1096,7 @@ partial_symtab::add_psymbol (std::string_view name, bool copy_name,
psymbol.set_unrelocated_address (coreaddr);
psymbol.ginfo.set_section_index (section);
psymbol.domain = domain;
- psymbol.aclass = theclass;
+ psymbol.loc_class = loc_class;
psymbol.ginfo.set_language (language, partial_symtabs->obstack ());
psymbol.ginfo.compute_and_set_names (name, copy_name, objfile->per_bfd);
@@ -1262,7 +1259,7 @@ maintenance_print_psymbols (const char *args, int from_tty)
}
found = 0;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
int printed_objfile_header = 0;
int print_for_objfile = 1;
@@ -1270,12 +1267,12 @@ maintenance_print_psymbols (const char *args, int from_tty)
QUIT;
if (objfile_arg != NULL)
print_for_objfile
- = compare_filenames_for_search (objfile_name (objfile),
+ = compare_filenames_for_search (objfile_name (&objfile),
objfile_arg);
if (!print_for_objfile)
continue;
- for (const auto &iter : objfile->qf)
+ for (const auto &iter : objfile.qf)
{
psymbol_functions *psf
= dynamic_cast<psymbol_functions *> (iter.get ());
@@ -1289,22 +1286,22 @@ maintenance_print_psymbols (const char *args, int from_tty)
/* We don't assume each pc has a unique objfile (this is for
debugging). */
struct partial_symtab *ps
- = psf->find_pc_sect_psymtab (objfile, pc, section, msymbol);
+ = psf->find_pc_sect_psymtab (&objfile, pc, section, msymbol);
if (ps != NULL)
{
if (!printed_objfile_header)
{
outfile->printf ("\nPartial symtabs for objfile %s\n",
- objfile_name (objfile));
+ objfile_name (&objfile));
printed_objfile_header = 1;
}
- dump_psymtab (objfile, ps, outfile);
+ dump_psymtab (&objfile, ps, outfile);
found = 1;
}
}
else
{
- for (partial_symtab *ps : psf->partial_symbols (objfile))
+ for (partial_symtab *ps : psf->partial_symbols (&objfile))
{
int print_for_source = 0;
@@ -1321,10 +1318,10 @@ maintenance_print_psymbols (const char *args, int from_tty)
if (!printed_objfile_header)
{
outfile->printf ("\nPartial symtabs for objfile %s\n",
- objfile_name (objfile));
+ objfile_name (&objfile));
printed_objfile_header = 1;
}
- dump_psymtab (objfile, ps, outfile);
+ dump_psymtab (&objfile, ps, outfile);
}
}
}
@@ -1349,21 +1346,21 @@ maintenance_info_psymtabs (const char *regexp, int from_tty)
re_comp (regexp);
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
- struct gdbarch *gdbarch = objfile->arch ();
+ struct gdbarch *gdbarch = objfile.arch ();
/* We don't want to print anything for this objfile until we
actually find a symtab whose name matches. */
int printed_objfile_start = 0;
- for (const auto &iter : objfile->qf)
+ for (const auto &iter : objfile.qf)
{
psymbol_functions *psf
= dynamic_cast<psymbol_functions *> (iter.get ());
if (psf == nullptr)
continue;
- for (partial_symtab *psymtab : psf->partial_symbols (objfile))
+ for (partial_symtab *psymtab : psf->partial_symbols (&objfile))
{
QUIT;
@@ -1372,10 +1369,10 @@ maintenance_info_psymtabs (const char *regexp, int from_tty)
{
if (! printed_objfile_start)
{
- gdb_printf ("{ objfile %s ", objfile_name (objfile));
+ gdb_printf ("{ objfile %s ", objfile_name (&objfile));
gdb_stdout->wrap_here (2);
gdb_printf ("((struct objfile *) %s)\n",
- host_address_to_string (objfile));
+ host_address_to_string (&objfile));
printed_objfile_start = 1;
}
@@ -1385,16 +1382,16 @@ maintenance_info_psymtabs (const char *regexp, int from_tty)
host_address_to_string (psymtab));
gdb_printf (" readin %s\n",
- psymtab->readin_p (objfile) ? "yes" : "no");
+ psymtab->readin_p (&objfile) ? "yes" : "no");
gdb_printf (" fullname %s\n",
psymtab->fullname
? psymtab->fullname : "(null)");
gdb_printf (" text addresses ");
gdb_puts (paddress (gdbarch,
- psymtab->text_low (objfile)));
+ psymtab->text_low (&objfile)));
gdb_printf (" -- ");
gdb_puts (paddress (gdbarch,
- psymtab->text_high (objfile)));
+ psymtab->text_high (&objfile)));
gdb_printf ("\n");
gdb_printf (" globals ");
if (!psymtab->global_psymbols.empty ())
@@ -1458,33 +1455,33 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
const struct blockvector *bv;
const struct block *b;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (const auto &iter : objfile->qf)
+ for (const auto &iter : objfile.qf)
{
psymbol_functions *psf
= dynamic_cast<psymbol_functions *> (iter.get ());
if (psf == nullptr)
continue;
- for (partial_symtab *ps : psf->partial_symbols (objfile))
+ for (partial_symtab *ps : psf->partial_symbols (&objfile))
{
- struct gdbarch *gdbarch = objfile->arch ();
+ struct gdbarch *gdbarch = objfile.arch ();
/* We don't call psymtab_to_symtab here because that may cause symtab
expansion. When debugging a problem it helps if checkers leave
things unchanged. */
- cust = ps->get_compunit_symtab (objfile);
+ cust = ps->get_compunit_symtab (&objfile);
/* First do some checks that don't require the associated symtab. */
- if (ps->text_high (objfile) < ps->text_low (objfile))
+ if (ps->text_high (&objfile) < ps->text_low (&objfile))
{
gdb_printf ("Psymtab ");
gdb_puts (ps->filename);
gdb_printf (" covers bad range ");
- gdb_puts (paddress (gdbarch, ps->text_low (objfile)));
+ gdb_puts (paddress (gdbarch, ps->text_low (&objfile)));
gdb_printf (" - ");
- gdb_puts (paddress (gdbarch, ps->text_high (objfile)));
+ gdb_puts (paddress (gdbarch, ps->text_high (&objfile)));
gdb_printf ("\n");
continue;
}
@@ -1498,7 +1495,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
{
/* Skip symbols for inlined functions without address. These may
or may not have a match in the full symtab. */
- if (psym->aclass == LOC_BLOCK
+ if (psym->loc_class == LOC_BLOCK
&& psym->ginfo.value_address () == 0)
continue;
@@ -1532,15 +1529,15 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
}
}
if (ps->unrelocated_text_high () != unrelocated_addr (0)
- && (ps->text_low (objfile) < b->start ()
- || ps->text_high (objfile) > b->end ()))
+ && (ps->text_low (&objfile) < b->start ()
+ || ps->text_high (&objfile) > b->end ()))
{
gdb_printf ("Psymtab ");
gdb_puts (ps->filename);
gdb_printf (" covers ");
- gdb_puts (paddress (gdbarch, ps->text_low (objfile)));
+ gdb_puts (paddress (gdbarch, ps->text_low (&objfile)));
gdb_printf (" - ");
- gdb_puts (paddress (gdbarch, ps->text_high (objfile)));
+ gdb_puts (paddress (gdbarch, ps->text_high (&objfile)));
gdb_printf (" but symtab covers only ");
gdb_puts (paddress (gdbarch, b->start ()));
gdb_printf (" - ");
@@ -1552,9 +1549,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
}
}
-void _initialize_psymtab ();
-void
-_initialize_psymtab ()
+INIT_GDB_FILE (psymtab)
{
add_cmd ("psymbols", class_maintenance, maintenance_print_psymbols, _("\
Print dump of current partial symbol definitions.\n\
diff --git a/gdb/psymtab.h b/gdb/psymtab.h
index 129f66e..ab4173d 100644
--- a/gdb/psymtab.h
+++ b/gdb/psymtab.h
@@ -1,6 +1,6 @@
/* Public partial symbol table definitions.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -111,7 +111,9 @@ public:
partial_symtab_range range ()
{
- return partial_symtab_range (psymtabs);
+ next_iterator<partial_symtab> begin (psymtabs);
+
+ return partial_symtab_range (std::move (begin));
}
@@ -184,10 +186,10 @@ struct partial_symbol
ENUM_BITFIELD(domain_enum) domain : SYMBOL_DOMAIN_BITS;
/* Address class (for info_symbols). Note that we don't allow
- synthetic "aclass" values here at present, simply because there's
+ synthetic "loc_class" values here at present, simply because there's
no need. */
- ENUM_BITFIELD(address_class) aclass : SYMBOL_ACLASS_BITS;
+ ENUM_BITFIELD(location_class) loc_class : SYMBOL_LOC_CLASS_BITS;
};
/* A convenience enum to give names to some constants used when
@@ -333,7 +335,7 @@ struct partial_symtab
If COPY_NAME is true, make a copy of NAME, otherwise use the passed
reference.
- THECLASS is the type of symbol.
+ LOC_CLASS is the type of symbol.
SECTION is the index of the section of OBJFILE in which the symbol is found.
@@ -348,7 +350,7 @@ struct partial_symtab
void add_psymbol (std::string_view name,
bool copy_name, domain_enum domain,
- enum address_class theclass,
+ location_class loc_class,
int section,
psymbol_placement where,
unrelocated_addr coreaddr,
@@ -626,15 +628,15 @@ struct psymbol_functions : public quick_symbol_functions
void expand_all_symtabs (struct objfile *objfile) override;
- bool expand_symtabs_matching
+ bool search
(struct objfile *objfile,
- expand_symtabs_file_matcher file_matcher,
+ search_symtabs_file_matcher file_matcher,
const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
+ search_symtabs_symbol_matcher symbol_matcher,
+ search_symtabs_expansion_listener listener,
block_search_flags search_flags,
domain_search_flags kind,
- expand_symtabs_lang_matcher lang_matcher) override;
+ search_symtabs_lang_matcher lang_matcher) override;
struct compunit_symtab *find_pc_sect_compunit_symtab
(struct objfile *objfile, bound_minimal_symbol msymbol, CORE_ADDR pc,
diff --git a/gdb/pyproject.toml b/gdb/pyproject.toml
index 4469f1c..144c489 100644
--- a/gdb/pyproject.toml
+++ b/gdb/pyproject.toml
@@ -3,3 +3,6 @@ include = "\\.py(\\.in)?$"
[tool.pyright]
typeCheckingMode = "strict"
+
+[tool.isort]
+profile = "black"
diff --git a/gdb/python/lib/gdb/FrameDecorator.py b/gdb/python/lib/gdb/FrameDecorator.py
index 43efe8a..fa6effa 100644
--- a/gdb/python/lib/gdb/FrameDecorator.py
+++ b/gdb/python/lib/gdb/FrameDecorator.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/FrameIterator.py b/gdb/python/lib/gdb/FrameIterator.py
index 75176c3..54534fe 100644
--- a/gdb/python/lib/gdb/FrameIterator.py
+++ b/gdb/python/lib/gdb/FrameIterator.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py
index 146a963..d635b94 100644
--- a/gdb/python/lib/gdb/__init__.py
+++ b/gdb/python/lib/gdb/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,17 +19,31 @@ import sys
import threading
import traceback
from contextlib import contextmanager
+from importlib import reload
-# Python 3 moved "reload"
-if sys.version_info >= (3, 4):
- from importlib import reload
-else:
- from imp import reload
-
-import _gdb
-
+# The star import imports _gdb names. When the names are used locally, they
+# trigger F405 warnings unless added to the explicit import list.
# Note that two indicators are needed here to silence flake8.
from _gdb import * # noqa: F401,F403
+from _gdb import (
+ COMMAND_NONE,
+ INTENSITY_BOLD,
+ INTENSITY_DIM,
+ INTENSITY_NORMAL,
+ PARAM_COLOR,
+ PARAM_ENUM,
+ STDERR,
+ STDOUT,
+ Color,
+ Command,
+ Parameter,
+ Style,
+ execute,
+ flush,
+ parameter,
+ selected_inferior,
+ write,
+)
# isort: split
@@ -60,14 +74,14 @@ class _GdbFile(object):
self.write(line)
def flush(self):
- _gdb.flush(stream=self.stream)
+ flush(stream=self.stream)
def write(self, s):
- _gdb.write(s, stream=self.stream)
+ write(s, stream=self.stream)
-sys.stdout = _GdbFile(_gdb.STDOUT)
-sys.stderr = _GdbFile(_gdb.STDERR)
+sys.stdout = _GdbFile(STDOUT)
+sys.stderr = _GdbFile(STDERR)
# Default prompt hook does nothing.
prompt_hook = None
@@ -189,7 +203,7 @@ def GdbSetPythonDirectory(dir):
def current_progspace():
"Return the current Progspace."
- return _gdb.selected_inferior().progspace
+ return selected_inferior().progspace
def objfiles():
@@ -226,14 +240,14 @@ def set_parameter(name, value):
value = "on"
else:
value = "off"
- _gdb.execute("set " + name + " " + str(value), to_string=True)
+ execute("set " + name + " " + str(value), to_string=True)
@contextmanager
def with_parameter(name, value):
"""Temporarily set the GDB parameter NAME to VALUE.
Note that this is a context manager."""
- old_value = _gdb.parameter(name)
+ old_value = parameter(name)
set_parameter(name, value)
try:
# Nothing that useful to return.
@@ -392,3 +406,330 @@ def _handle_missing_objfile(pspace, buildid, filename):
return _handle_missing_files(
pspace, "objfile", lambda h: h(pspace, buildid, filename)
)
+
+
+class ParameterPrefix:
+ # A wrapper around gdb.Command for creating set/show prefixes.
+ #
+ # When creating a gdb.Parameter sub-classes, it is sometimes necessary
+ # to first create a gdb.Command object in order to create the needed
+ # command prefix. However, for parameters, we actually need two
+ # prefixes, a 'set' prefix, and a 'show' prefix. With this helper
+ # class, a single instance of this class will create both prefixes at
+ # once.
+ #
+ # It is important that this class-level documentation not be a __doc__
+ # string. Users are expected to sub-class this ParameterPrefix class
+ # and add their own documentation. If they don't, then GDB will
+ # generate a suitable doc string. But, if this (parent) class has a
+ # __doc__ string of its own, then sub-classes will inherit that __doc__
+ # string, and GDB will not understand that it needs to generate one.
+
+ class _PrefixCommand(Command):
+ """A gdb.Command used to implement both the set and show prefixes.
+
+ This documentation string is not used as the prefix command
+ documentation as it is overridden in the __init__ method below."""
+
+ # This private method is connected to the 'invoke' attribute within
+ # this _PrefixCommand object if the containing ParameterPrefix
+ # object has an invoke_set or invoke_show method.
+ #
+ # This method records within self.__delegate which _PrefixCommand
+ # object is currently active, and then calls the correct invoke
+ # method on the delegat object (the ParameterPrefix sub-class
+ # object).
+ #
+ # Recording the currently active _PrefixCommand object is important;
+ # if from the invoke method the user calls dont_repeat, then this is
+ # forwarded to the currently active _PrefixCommand object.
+ def __invoke(self, args, from_tty):
+
+ # A helper class for use as part of a Python 'with' block.
+ # Records which gdb.Command object is currently running its
+ # invoke method.
+ class MarkActiveCallback:
+ # The CMD is a _PrefixCommand object, and the DELEGATE is
+ # the ParameterPrefix class, or sub-class object. At this
+ # point we simple record both of these within the
+ # MarkActiveCallback object.
+ def __init__(self, cmd, delegate):
+ self.__cmd = cmd
+ self.__delegate = delegate
+
+ # Record the currently active _PrefixCommand object within
+ # the outer ParameterPrefix sub-class object.
+ def __enter__(self):
+ self.__delegate.active_prefix = self.__cmd
+
+ # Once the invoke method has completed, then clear the
+ # _PrefixCommand object that was stored into the outer
+ # ParameterPrefix sub-class object.
+ def __exit__(self, exception_type, exception_value, traceback):
+ self.__delegate.active_prefix = None
+
+ # The self.__cb attribute is set when the _PrefixCommand object
+ # is created, and is either invoke_set or invoke_show within the
+ # ParameterPrefix sub-class object.
+ assert callable(self.__cb)
+
+ # Record the currently active _PrefixCommand object within the
+ # ParameterPrefix sub-class object, then call the relevant
+ # invoke method within the ParameterPrefix sub-class object.
+ with MarkActiveCallback(self, self.__delegate):
+ self.__cb(args, from_tty)
+
+ @staticmethod
+ def __find_callback(delegate, mode):
+ """The MODE is either 'set' or 'show'. Look for an invoke_MODE method
+ on DELEGATE, if a suitable method is found, then return it, otherwise,
+ return None.
+ """
+ cb = getattr(delegate, "invoke_" + mode, None)
+ if callable(cb):
+ return cb
+ return None
+
+ def __init__(self, mode, name, cmd_class, delegate, doc=None):
+ """Setup this gdb.Command. Mode is a string, either 'set' or 'show'.
+ NAME is the name for this prefix command, that is, the
+ words that appear after both 'set' and 'show' in the
+ command name. CMD_CLASS is the usual enum. And DELEGATE
+ is the gdb.ParameterPrefix object this prefix is part of.
+ """
+ assert mode == "set" or mode == "show"
+ if doc is None:
+ self.__doc__ = delegate.__doc__
+ else:
+ self.__doc__ = doc
+ self.__cb = self.__find_callback(delegate, mode)
+ self.__delegate = delegate
+ if self.__cb is not None:
+ self.invoke = self.__invoke
+ super().__init__(mode + " " + name, cmd_class, prefix=True)
+
+ def __init__(self, name, cmd_class, doc=None):
+ """Create a _PrefixCommand for both the set and show prefix commands.
+ NAME is the command name without either the leading 'set ' or
+ 'show ' strings, and CMD_CLASS is the usual enum value.
+ """
+ self.active_prefix = None
+ self._set_prefix_cmd = self._PrefixCommand("set", name, cmd_class, self, doc)
+ self._show_prefix_cmd = self._PrefixCommand("show", name, cmd_class, self, doc)
+
+ # When called from within an invoke method the self.active_prefix
+ # attribute should be set to a gdb.Command sub-class (a _PrefixCommand
+ # object, see above). Forward the dont_repeat call to this object to
+ # register the actual command as none repeating.
+ def dont_repeat(self):
+ if self.active_prefix is not None:
+ self.active_prefix.dont_repeat()
+
+
+class StyleParameterSet:
+ """Create new style parameters.
+
+ A style parameter is a set of parameters that start with 'set style ...'
+ and 'show style ...'. For example 'filename' is a style parameter, and
+ 'disassembler symbol' is another style parameter.
+
+ The name of the style parameter is really a prefix command. Under this
+ we must have two commands 'foreground' and 'background', which are color
+ parameters. A third, optional command 'intensity', is an enum with
+ values 'normal', 'bold', and 'dim'.
+
+ A StyleParameterSet is initialised with a name, e.g. 'filename' or
+ 'disassembler symbol'. The StyleParameterSet creates the prefix
+ commands in the 'set style' and 'show style' name space, and then adds
+ the 'foreground', 'background', and optionally, the 'intensity'
+ commands.
+
+ If you want a whole new style group, similar to 'disassembler',
+ then you need to add this yourself first, then StyleParameterSet
+ can be used to create styles within the new prefix group.
+
+ The 'value' attribute on this object can be used to get and set a
+ gdb.Style object which controls all aspects of this style.
+
+ For readability, the alias 'style' is the same as 'value'.
+ """
+
+ def __init__(self, name, add_intensity=True, doc=None):
+ # The STYLE_NAME is something like 'filename' is 'set style
+ # filename ...', and PARAM_NAME is one of 'foreground',
+ # 'background', or 'intensity'. The DESC_TEXT is the long
+ # form used in help text, like 'foreground color' or 'display
+ # intensity'. The DEFAULT_VALUE is used to set the SELF.value
+ # attribute. And PARAM_TYPE is a gdb.PARAM_* constant. The
+ # ARGS is used for gdb.PARAM_ENUM, which ARGS should be the
+ # enum value list.
+ class style_parameter(Parameter):
+ def __init__(
+ self,
+ style_name,
+ parent_obj,
+ param_name,
+ desc_text,
+ default_value,
+ param_type,
+ *args
+ ):
+ # Setup documentation must be done before calling
+ # parent's __init__ method, as the __init__ reads (and
+ # copies) these values.
+ self.show_doc = "Show the " + desc_text + " for this property."
+ self.set_doc = "Set the " + desc_text + " for this property."
+ self.__doc__ = ""
+
+ # Call the parent's __init__ method to actually create
+ # the parameter.
+ super().__init__(
+ "style " + style_name + " " + param_name,
+ COMMAND_NONE,
+ param_type,
+ *args
+ )
+
+ # Store information we need in other methods.
+ self._style_name = style_name
+ self._desc_text = desc_text
+ self._parent = parent_obj
+
+ # Finally, setup the default value.
+ self.value = default_value
+
+ # Return the 'show style <style-name> <attribute>' string,
+ # which has styling applied.
+ def get_show_string(self, value):
+ s = self._parent.style
+ return (
+ "The "
+ + s.apply('"' + self._style_name + '" style')
+ + " "
+ + self._desc_text
+ + " is: "
+ + value
+ )
+
+ class style_foreground_parameter(style_parameter):
+ def __init__(self, name, parent):
+ super().__init__(
+ name,
+ parent,
+ "foreground",
+ "foreground color",
+ Color(),
+ PARAM_COLOR,
+ )
+
+ class style_background_parameter(style_parameter):
+ def __init__(self, name, parent):
+ super().__init__(
+ name,
+ parent,
+ "background",
+ "background color",
+ Color(),
+ PARAM_COLOR,
+ )
+
+ class style_intensity_parameter(style_parameter):
+ def __init__(self, name, parent):
+ super().__init__(
+ name,
+ parent,
+ "intensity",
+ "display intensity",
+ "normal",
+ PARAM_ENUM,
+ ["normal", "bold", "dim"],
+ )
+
+ if doc is None:
+ doc = (
+ "The "
+ + name
+ + " display styling.\nConfigure "
+ + name
+ + " colors and display intensity."
+ )
+
+ ParameterPrefix("style " + name, COMMAND_NONE, doc)
+ self._foreground = style_foreground_parameter(name, self)
+ self._background = style_background_parameter(name, self)
+ if add_intensity:
+ self._intensity = style_intensity_parameter(name, self)
+ self._name = name
+ self._style = None
+
+ @property
+ def value(self):
+ """Return the gdb.Style object for this parameter set."""
+ if self._style is None:
+ self._style = Style(self._name)
+ return self._style
+
+ @property
+ def style(self):
+ """Return the gdb.Style object for this parameter set.
+
+ This is an alias for self.value."""
+ return self.value
+
+ @value.setter
+ def value(self, new_value):
+ """Set this parameter set to NEW_VALUE, a gdb.Style object.
+
+ The attributes of NEW_VALUE are used to update the current settings
+ of this parameter set. If this parameter set was created without
+ an intensity setting, then the intensity of NEW_VALUE is ignored."""
+ if not isinstance(new_value, Style):
+ raise TypeError("value must be gdb.Style, not %s" % type(new_value))
+ self._foreground.value = new_value.foreground
+ self._background.value = new_value.background
+ if hasattr(self, "_intensity"):
+ intensity_value = new_value.intensity
+ if intensity_value == INTENSITY_BOLD:
+ intensity_string = "bold"
+ elif intensity_value == INTENSITY_DIM:
+ intensity_string = "dim"
+ elif intensity_value == INTENSITY_NORMAL:
+ intensity_string = "normal"
+ else:
+ raise ValueError(
+ "unknown intensity value %d from Style" % intensity_value
+ )
+
+ self._intensity.value = intensity_string
+
+ @style.setter
+ def style(self, new_value):
+ """Set this parameter set to NEW_VALUE, a gdb.Style object.
+
+ This is an alias for self.value."""
+ self.value = new_value
+
+ def apply(self, *args, **kwargs):
+ """Apply this style to the arguments.
+
+ Forwards all arguments to self.style.apply(). The arguments should be a string,
+ to which this style is applied. This function returns the same string with
+ escape sequences added to apply this style.
+
+ If styling is globally disabled ('set style enabled off') then no escape sequences
+ will be added, the input string is returned."""
+ return self.style.apply(*args, **kwargs)
+
+ def __repr__(self):
+ """A string representation of SELF."""
+
+ def full_typename(obj):
+ module = type(obj).__module__
+ qualname = type(obj).__qualname__
+
+ if module is None or module == "builtins":
+ return qualname
+ else:
+ return module + "." + qualname
+
+ return "<" + full_typename(self) + " name='" + self._name + "'>"
diff --git a/gdb/python/lib/gdb/command/__init__.py b/gdb/python/lib/gdb/command/__init__.py
index f1b13bd..3688152 100644
--- a/gdb/python/lib/gdb/command/__init__.py
+++ b/gdb/python/lib/gdb/command/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/command/explore.py b/gdb/python/lib/gdb/command/explore.py
index e359fa5..6107338 100644
--- a/gdb/python/lib/gdb/command/explore.py
+++ b/gdb/python/lib/gdb/command/explore.py
@@ -1,5 +1,5 @@
# GDB 'explore' command.
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/command/frame_filters.py b/gdb/python/lib/gdb/command/frame_filters.py
index 4e1b320..3b7cd03 100644
--- a/gdb/python/lib/gdb/command/frame_filters.py
+++ b/gdb/python/lib/gdb/command/frame_filters.py
@@ -1,5 +1,5 @@
# Frame-filter commands.
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,8 +16,6 @@
"""GDB commands for working with frame-filters."""
-import sys
-
import gdb
import gdb.frames
@@ -68,7 +66,11 @@ class InfoFrameFilter(gdb.Command):
return 0
print(title)
- print(" Priority Enabled Name")
+ style = gdb.Style("title")
+ print(
+ " %s %s %s"
+ % (style.apply("Priority"), style.apply("Enabled"), style.apply("Name"))
+ )
for frame_filter in sorted_frame_filters:
name = frame_filter[0]
try:
@@ -77,9 +79,8 @@ class InfoFrameFilter(gdb.Command):
self.enabled_string(gdb.frames.get_enabled(frame_filter[1]))
)
print(" %s %s %s" % (priority, enabled, name))
- except Exception:
- e = sys.exc_info()[1]
- print(" Error printing filter '" + name + "': " + str(e))
+ except Exception as e:
+ gdb.warning("Error printing filter '" + name + "': " + str(e))
if blank_line:
print("")
return 1
@@ -87,14 +88,20 @@ class InfoFrameFilter(gdb.Command):
def invoke(self, arg, from_tty):
any_printed = self.print_list("global frame-filters:", gdb.frame_filters, True)
+ file_style = gdb.Style("filename")
cp = gdb.current_progspace()
+ cp_filename = cp.filename
+ if cp_filename is None:
+ cp_filename = "<no-file>"
+ else:
+ cp_filename = file_style.apply(cp_filename)
any_printed += self.print_list(
- "progspace %s frame-filters:" % cp.filename, cp.frame_filters, True
+ "progspace %s frame-filters:" % cp_filename, cp.frame_filters, True
)
for objfile in gdb.objfiles():
any_printed += self.print_list(
- "objfile %s frame-filters:" % objfile.filename,
+ "objfile %s frame-filters:" % file_style.apply(objfile.filename),
objfile.frame_filters,
False,
)
diff --git a/gdb/python/lib/gdb/command/missing_files.py b/gdb/python/lib/gdb/command/missing_files.py
index 463853b..b2477ce 100644
--- a/gdb/python/lib/gdb/command/missing_files.py
+++ b/gdb/python/lib/gdb/command/missing_files.py
@@ -1,6 +1,6 @@
# Missing debug and objfile related commands.
#
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -118,10 +118,16 @@ class InfoMissingFileHandlers(gdb.Command):
def invoke(self, arg, from_tty):
locus_re, name_re = parse_missing_file_command_args(arg)
+ file_style = gdb.Style("filename")
if locus_re.match("progspace") and locus_re.pattern != "":
cp = gdb.current_progspace()
+ cp_filename = cp.filename
+ if cp.filename is None:
+ cp_filename = "<no-file>"
+ else:
+ cp_filename = file_style.apply(cp_filename)
self.list_handlers(
- "Progspace %s:" % cp.filename, cp.missing_file_handlers, name_re
+ "Progspace %s:" % cp_filename, cp.missing_file_handlers, name_re
)
for progspace in gdb.progspaces():
@@ -133,7 +139,7 @@ class InfoMissingFileHandlers(gdb.Command):
else:
msg = "Progspace <no-file>:"
else:
- msg = "Progspace %s:" % filename
+ msg = "Progspace %s:" % file_style.apply(filename)
self.list_handlers(
msg,
progspace.missing_file_handlers,
diff --git a/gdb/python/lib/gdb/command/pretty_printers.py b/gdb/python/lib/gdb/command/pretty_printers.py
index cb9b9f3..cdf9054 100644
--- a/gdb/python/lib/gdb/command/pretty_printers.py
+++ b/gdb/python/lib/gdb/command/pretty_printers.py
@@ -1,5 +1,5 @@
# Pretty-printer commands.
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -161,9 +161,15 @@ class InfoPrettyPrinter(gdb.Command):
name_re,
subname_re,
)
+ file_style = gdb.Style("filename")
cp = gdb.current_progspace()
+ cp_filename = cp.filename
+ if cp_filename is None:
+ cp_filename = "<no-file>"
+ else:
+ cp_filename = file_style.apply(cp_filename)
self.invoke1(
- "progspace %s pretty-printers:" % cp.filename,
+ "progspace %s pretty-printers:" % cp_filename,
cp.pretty_printers,
"progspace",
object_re,
@@ -172,7 +178,7 @@ class InfoPrettyPrinter(gdb.Command):
)
for objfile in gdb.objfiles():
self.invoke1(
- "objfile %s pretty-printers:" % objfile.filename,
+ "objfile %s pretty-printers:" % file_style.apply(objfile.filename),
objfile.pretty_printers,
objfile.filename,
object_re,
diff --git a/gdb/python/lib/gdb/command/prompt.py b/gdb/python/lib/gdb/command/prompt.py
index 2cfb25d..6574c83 100644
--- a/gdb/python/lib/gdb/command/prompt.py
+++ b/gdb/python/lib/gdb/command/prompt.py
@@ -1,5 +1,5 @@
# Extended prompt.
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/command/type_printers.py b/gdb/python/lib/gdb/command/type_printers.py
index a2be226..9fc654c 100644
--- a/gdb/python/lib/gdb/command/type_printers.py
+++ b/gdb/python/lib/gdb/command/type_printers.py
@@ -1,5 +1,5 @@
# Type printer commands.
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/command/unwinders.py b/gdb/python/lib/gdb/command/unwinders.py
index b863b33..ffedab8 100644
--- a/gdb/python/lib/gdb/command/unwinders.py
+++ b/gdb/python/lib/gdb/command/unwinders.py
@@ -1,5 +1,5 @@
# Unwinder commands.
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/command/xmethods.py b/gdb/python/lib/gdb/command/xmethods.py
index b33e570..2f87074 100644
--- a/gdb/python/lib/gdb/command/xmethods.py
+++ b/gdb/python/lib/gdb/command/xmethods.py
@@ -1,5 +1,5 @@
# Xmethod commands.
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -101,6 +101,7 @@ def get_method_matchers_in_loci(loci, locus_re, matcher_re):
A dict of matching xmethod matchers. The keys of the dict are the
filenames of the loci the xmethod matchers belong to.
"""
+ file_style = gdb.Style("filename")
xm_dict = {}
for locus in loci:
if isinstance(locus, gdb.Progspace):
@@ -111,7 +112,12 @@ def get_method_matchers_in_loci(loci, locus_re, matcher_re):
if not locus_re.match(locus.filename):
continue
locus_type = "objfile"
- locus_str = "%s %s" % (locus_type, locus.filename)
+ filename = locus.filename
+ if filename is None:
+ filename = "<no-file>"
+ else:
+ filename = file_style.apply(filename)
+ locus_str = "%s %s" % (locus_type, filename)
xm_dict[locus_str] = [m for m in locus.xmethods if matcher_re.match(m.name)]
return xm_dict
diff --git a/gdb/python/lib/gdb/dap/__init__.py b/gdb/python/lib/gdb/dap/__init__.py
index 08ca33f..1c3cf8e 100644
--- a/gdb/python/lib/gdb/dap/__init__.py
+++ b/gdb/python/lib/gdb/dap/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -96,5 +96,4 @@ def pre_command_loop():
# These are handy for bug reports.
startup.exec_and_log("show version")
startup.exec_and_log("show configuration")
- global server
startup.start_dap(server.main_loop)
diff --git a/gdb/python/lib/gdb/dap/breakpoint.py b/gdb/python/lib/gdb/dap/breakpoint.py
index 5fd0c1f..3d1cfef 100644
--- a/gdb/python/lib/gdb/dap/breakpoint.py
+++ b/gdb/python/lib/gdb/dap/breakpoint.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -51,7 +51,6 @@ def suppress_new_breakpoint_event():
@in_gdb_thread
def _bp_modified(event):
- global _suppress_bp
if not _suppress_bp:
send_event(
"breakpoint",
@@ -64,7 +63,6 @@ def _bp_modified(event):
@in_gdb_thread
def _bp_created(event):
- global _suppress_bp
if not _suppress_bp:
send_event(
"breakpoint",
@@ -77,7 +75,6 @@ def _bp_created(event):
@in_gdb_thread
def _bp_deleted(event):
- global _suppress_bp
if not _suppress_bp:
send_event(
"breakpoint",
@@ -150,8 +147,7 @@ def _remove_entries(table, *names):
# specifications and a callback function to do the work of creating
# the breakpoint.
@in_gdb_thread
-def _set_breakpoints_callback(kind, specs, creator):
- global breakpoint_map
+def _set_breakpoints(kind, specs, creator):
# Try to reuse existing breakpoints if possible.
if kind in breakpoint_map:
saved_map = breakpoint_map[kind]
@@ -258,13 +254,6 @@ def _set_one_breakpoint(*, logMessage=None, **args):
return gdb.Breakpoint(**args)
-# Helper function to set ordinary breakpoints according to a list of
-# specifications.
-@in_gdb_thread
-def _set_breakpoints(kind, specs):
- return _set_breakpoints_callback(kind, specs, _set_one_breakpoint)
-
-
# A helper function that rewrites a SourceBreakpoint into the internal
# form passed to the creator. This function also allows for
# type-checking of each SourceBreakpoint.
@@ -306,7 +295,7 @@ def set_breakpoint(*, source, breakpoints: Sequence = (), **args):
# Be sure to include the path in the key, so that we only
# clear out breakpoints coming from this same source.
key = "source:" + source["path"]
- result = _set_breakpoints(key, specs)
+ result = _set_breakpoints(key, specs, _set_one_breakpoint)
return {
"breakpoints": result,
}
@@ -330,12 +319,12 @@ def _rewrite_fn_breakpoint(
}
-@request("setFunctionBreakpoints")
+@request("setFunctionBreakpoints", expect_stopped=False)
@capability("supportsFunctionBreakpoints")
def set_fn_breakpoint(*, breakpoints: Sequence, **args):
specs = [_rewrite_fn_breakpoint(**bp) for bp in breakpoints]
return {
- "breakpoints": _set_breakpoints("function", specs),
+ "breakpoints": _set_breakpoints("function", specs, _set_one_breakpoint),
}
@@ -363,24 +352,26 @@ def _rewrite_insn_breakpoint(
}
-@request("setInstructionBreakpoints")
+@request("setInstructionBreakpoints", expect_stopped=False)
@capability("supportsInstructionBreakpoints")
def set_insn_breakpoints(
*, breakpoints: Sequence, offset: Optional[int] = None, **args
):
specs = [_rewrite_insn_breakpoint(**bp) for bp in breakpoints]
return {
- "breakpoints": _set_breakpoints("instruction", specs),
+ "breakpoints": _set_breakpoints("instruction", specs, _set_one_breakpoint),
}
@in_gdb_thread
def _catch_exception(filterId, **args):
if filterId in ("assert", "exception", "throw", "rethrow", "catch"):
- cmd = "-catch-" + filterId
+ cmd = ["-catch-" + filterId]
else:
raise DAPException("Invalid exception filterID: " + str(filterId))
- result = exec_mi_and_log(cmd)
+ if "exception" in args and args["exception"] is not None:
+ cmd += ["-e", args["exception"]]
+ result = exec_mi_and_log(*cmd)
# While the Ada catchpoints emit a "bkptno" field here, the C++
# ones do not. So, instead we look at the "number" field.
num = result["bkpt"]["number"]
@@ -392,11 +383,6 @@ def _catch_exception(filterId, **args):
raise Exception("Could not find catchpoint after creating")
-@in_gdb_thread
-def _set_exception_catchpoints(filter_options):
- return _set_breakpoints_callback("exception", filter_options, _catch_exception)
-
-
# A helper function that rewrites an ExceptionFilterOptions into the
# internal form passed to the creator. This function also allows for
# type-checking of each ExceptionFilterOptions.
@@ -408,13 +394,20 @@ def _rewrite_exception_breakpoint(
# Note that exception breakpoints do not support a hit count.
**args,
):
+ if filterId == "exception":
+ # Treat Ada exceptions specially -- in particular the
+ # condition is just an exception name, not an expression.
+ return {
+ "filterId": filterId,
+ "exception": condition,
+ }
return {
"filterId": filterId,
"condition": condition,
}
-@request("setExceptionBreakpoints")
+@request("setExceptionBreakpoints", expect_stopped=False)
@capability("supportsExceptionFilterOptions")
@capability(
"exceptionBreakpointFilters",
@@ -453,6 +446,4 @@ def set_exception_breakpoints(
options = [{"filterId": filter} for filter in filters]
options.extend(filterOptions)
options = [_rewrite_exception_breakpoint(**bp) for bp in options]
- return {
- "breakpoints": _set_exception_catchpoints(options),
- }
+ return {"breakpoints": _set_breakpoints("exception", options, _catch_exception)}
diff --git a/gdb/python/lib/gdb/dap/bt.py b/gdb/python/lib/gdb/dap/bt.py
index 0fefa69..41c7d00 100644
--- a/gdb/python/lib/gdb/dap/bt.py
+++ b/gdb/python/lib/gdb/dap/bt.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/dap/completions.py b/gdb/python/lib/gdb/dap/completions.py
index 85acc43..e5003ff 100644
--- a/gdb/python/lib/gdb/dap/completions.py
+++ b/gdb/python/lib/gdb/dap/completions.py
@@ -39,8 +39,11 @@ def completions(
line = 1
else:
line = import_line(line)
- text = text.splitlines()[line - 1]
- text = text[: column - 1]
+ if text:
+ text = text.splitlines()[line - 1]
+ text = text[: column - 1]
+ else:
+ text = ""
mi_result = exec_mi_and_log("-complete", text)
result = []
completion = None
diff --git a/gdb/python/lib/gdb/dap/disassemble.py b/gdb/python/lib/gdb/dap/disassemble.py
index 3c0d517..42cad3e 100644
--- a/gdb/python/lib/gdb/dap/disassemble.py
+++ b/gdb/python/lib/gdb/dap/disassemble.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/dap/evaluate.py b/gdb/python/lib/gdb/dap/evaluate.py
index 34843f4..fcbcc99 100644
--- a/gdb/python/lib/gdb/dap/evaluate.py
+++ b/gdb/python/lib/gdb/dap/evaluate.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -69,7 +69,7 @@ def _repl(command, frame_id):
}
-@request("evaluate")
+@request("evaluate", defer_events=False)
@capability("supportsEvaluateForHovers")
@capability("supportsValueFormattingOptions")
def eval_request(
@@ -110,7 +110,7 @@ def variables(
@capability("supportsSetExpression")
-@request("setExpression")
+@request("setExpression", defer_events=False)
def set_expression(
*, expression: str, value: str, frameId: Optional[int] = None, format=None, **args
):
@@ -126,7 +126,7 @@ def set_expression(
@capability("supportsSetVariable")
-@request("setVariable")
+@request("setVariable", defer_events=False)
def set_variable(
*, variablesReference: int, name: str, value: str, format=None, **args
):
diff --git a/gdb/python/lib/gdb/dap/events.py b/gdb/python/lib/gdb/dap/events.py
index 2e6fe98..778acc5 100644
--- a/gdb/python/lib/gdb/dap/events.py
+++ b/gdb/python/lib/gdb/dap/events.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,12 +17,12 @@ import gdb
from .modules import is_module, make_module
from .scopes import set_finish_value
-from .server import send_event, send_event_maybe_later
+from .server import send_event
from .startup import exec_and_log, in_gdb_thread, log
# True when the inferior is thought to be running, False otherwise.
# This may be accessed from any thread, which can be racy. However,
-# this unimportant because this global is only used for the
+# this is unimportant because this global is only used for the
# 'notStopped' response, which itself is inherently racy.
inferior_running = False
@@ -161,7 +161,7 @@ _expected_pause = False
@in_gdb_thread
-def exec_and_expect_stop(cmd, expected_pause=False, propagate_exception=False):
+def exec_and_expect_stop(cmd, expected_pause=False):
"""A wrapper for exec_and_log that sets the continue-suppression flag.
When EXPECTED_PAUSE is True, a stop that looks like a pause (e.g.,
@@ -174,7 +174,7 @@ def exec_and_expect_stop(cmd, expected_pause=False, propagate_exception=False):
# continuing.
_suppress_cont = not expected_pause
# FIXME if the call fails should we clear _suppress_cont?
- exec_and_log(cmd, propagate_exception)
+ exec_and_log(cmd)
# Map from gdb stop reasons to DAP stop reasons. Some of these can't
@@ -238,10 +238,9 @@ def _on_stop(event):
):
obj["reason"] = "pause"
else:
- global stop_reason_map
obj["reason"] = stop_reason_map[event.details["reason"]]
_expected_pause = False
- send_event_maybe_later("stopped", obj)
+ send_event("stopped", obj)
# This keeps a bit of state between the start of an inferior call and
diff --git a/gdb/python/lib/gdb/dap/frames.py b/gdb/python/lib/gdb/dap/frames.py
index 770a177..4dacb87 100644
--- a/gdb/python/lib/gdb/dap/frames.py
+++ b/gdb/python/lib/gdb/dap/frames.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -53,12 +53,11 @@ gdb.events.cont.connect(_clear_frame_ids)
@in_gdb_thread
def frame_for_id(id):
"""Given a frame identifier ID, return the corresponding frame."""
- global thread_ids
if id in thread_ids:
thread_id = thread_ids[id]
if thread_id != gdb.selected_thread().global_num:
set_thread(thread_id)
- global _all_frames
+
return _all_frames[id]
@@ -103,10 +102,8 @@ def _frame_id_generator():
# Helper function to assign an ID to a frame.
def get_id(frame):
- global _all_frames
num = len(_all_frames)
_all_frames.append(frame)
- global thread_ids
thread_ids[num] = gdb.selected_thread().global_num
return num
@@ -128,7 +125,6 @@ def _frame_id_generator():
@in_gdb_thread
def _get_frame_iterator():
thread_id = gdb.selected_thread().global_num
- global _iter_map
if thread_id not in _iter_map:
_iter_map[thread_id] = _MemoizingIterator(_frame_id_generator())
return _iter_map[thread_id]
diff --git a/gdb/python/lib/gdb/dap/globalvars.py b/gdb/python/lib/gdb/dap/globalvars.py
index bd9c53a..9d64d28 100644
--- a/gdb/python/lib/gdb/dap/globalvars.py
+++ b/gdb/python/lib/gdb/dap/globalvars.py
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -78,7 +78,6 @@ def get_global_scope(frame):
except RuntimeError:
return None
- global _id_to_scope
block = block.static_block
if block in _id_to_scope:
return _id_to_scope[block]
diff --git a/gdb/python/lib/gdb/dap/io.py b/gdb/python/lib/gdb/dap/io.py
index 03031a7..45890da 100644
--- a/gdb/python/lib/gdb/dap/io.py
+++ b/gdb/python/lib/gdb/dap/io.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/dap/launch.py b/gdb/python/lib/gdb/dap/launch.py
index fc1890c..8ac4c77 100644
--- a/gdb/python/lib/gdb/dap/launch.py
+++ b/gdb/python/lib/gdb/dap/launch.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -164,7 +164,6 @@ def attach(
@request("configurationDone", on_dap_thread=True)
def config_done(**args):
# Handle the launch or attach.
- global _launch_or_attach_promise
if _launch_or_attach_promise is None:
raise DAPException("launch or attach not specified")
# Resolve the launch or attach, but only after the
diff --git a/gdb/python/lib/gdb/dap/locations.py b/gdb/python/lib/gdb/dap/locations.py
index 1ef5a34..fffc038 100644
--- a/gdb/python/lib/gdb/dap/locations.py
+++ b/gdb/python/lib/gdb/dap/locations.py
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/dap/memory.py b/gdb/python/lib/gdb/dap/memory.py
index 4aa4996..d0f8825 100644
--- a/gdb/python/lib/gdb/dap/memory.py
+++ b/gdb/python/lib/gdb/dap/memory.py
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/dap/modules.py b/gdb/python/lib/gdb/dap/modules.py
index 69e5a40..b06f771 100644
--- a/gdb/python/lib/gdb/dap/modules.py
+++ b/gdb/python/lib/gdb/dap/modules.py
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/dap/next.py b/gdb/python/lib/gdb/dap/next.py
index 7e06b1b..993e9d2 100644
--- a/gdb/python/lib/gdb/dap/next.py
+++ b/gdb/python/lib/gdb/dap/next.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,8 +16,8 @@
import gdb
from .events import exec_and_expect_stop
-from .server import capability, request, send_gdb, send_gdb_with_response
-from .startup import in_gdb_thread
+from .server import capability, request
+from .startup import DAPException, exec_and_log, in_gdb_thread
from .state import set_thread
@@ -36,11 +36,9 @@ def _handle_thread_step(thread_id, single_thread, select=False):
result = False
arg = "off"
try:
- # This can fail, depending on the target, so catch the error
- # and report to our caller. We can't use exec_and_log because
- # that does not propagate exceptions.
- gdb.execute("set scheduler-locking " + arg, from_tty=True, to_string=True)
- except gdb.error:
+ # This can fail, depending on the target, so catch any error.
+ exec_and_log("set scheduler-locking " + arg)
+ except DAPException:
result = False
# Other DAP code may select a frame, and the "finish" command uses
# the selected frame.
@@ -73,19 +71,14 @@ def step_in(
exec_and_expect_stop(cmd)
-@request("stepOut", defer_stop_events=True)
+@request("stepOut")
def step_out(*, threadId: int, singleThread: bool = False, **args):
_handle_thread_step(threadId, singleThread, True)
- exec_and_expect_stop("finish &", propagate_exception=True)
+ exec_and_expect_stop("finish &")
-# This is a server-side request because it is funny: it wants to
-# 'continue' but also return a result, which precludes using
-# response=False. Using 'continue &' would mostly work ok, but this
-# yields races when a stop occurs before the response is sent back to
-# the client.
-@request("continue", on_dap_thread=True)
+@request("continue")
def continue_request(*, threadId: int, singleThread: bool = False, **args):
- locked = send_gdb_with_response(lambda: _handle_thread_step(threadId, singleThread))
- send_gdb(lambda: exec_and_expect_stop("continue"))
+ locked = _handle_thread_step(threadId, singleThread)
+ exec_and_expect_stop("continue &")
return {"allThreadsContinued": not locked}
diff --git a/gdb/python/lib/gdb/dap/pause.py b/gdb/python/lib/gdb/dap/pause.py
index d874a60..c254e45 100644
--- a/gdb/python/lib/gdb/dap/pause.py
+++ b/gdb/python/lib/gdb/dap/pause.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/dap/scopes.py b/gdb/python/lib/gdb/dap/scopes.py
index 1b98c4f..7ce3a7f 100644
--- a/gdb/python/lib/gdb/dap/scopes.py
+++ b/gdb/python/lib/gdb/dap/scopes.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ from .sources import make_source
from .startup import in_gdb_thread
from .varref import BaseReference
-# Map DAP frame IDs to scopes. This ensures that scopes are re-used.
+# Map DAP frame IDs to scopes. This ensures that scopes are reused.
frame_to_scope = {}
@@ -120,7 +120,6 @@ class _FinishScopeReference(_ScopeReference):
def fetch_one_child(self, idx):
assert idx == 0
- global _last_return_value
return ("(return)", _last_return_value)
@@ -145,8 +144,6 @@ class _RegisterReference(_ScopeReference):
@request("scopes")
def scopes(*, frameId: int, **extra):
- global _last_return_value
- global frame_to_scope
if frameId in frame_to_scope:
scopes = frame_to_scope[frameId]
else:
diff --git a/gdb/python/lib/gdb/dap/server.py b/gdb/python/lib/gdb/dap/server.py
index 7139c79..98a8084 100644
--- a/gdb/python/lib/gdb/dap/server.py
+++ b/gdb/python/lib/gdb/dap/server.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -74,6 +74,13 @@ class DeferredRequest:
self._result = result
@in_dap_thread
+ def defer_events(self):
+ """Return True if events should be deferred during execution.
+
+ This may be overridden by subclasses."""
+ return True
+
+ @in_dap_thread
def invoke(self):
"""Implement the deferred request.
@@ -95,7 +102,10 @@ class DeferredRequest:
"""
with _server.canceller.current_request(self._req):
+ if self.defer_events():
+ _server.set_defer_events()
_server.invoke_request(self._req, self._result, self.invoke)
+ _server.emit_pending_events()
# A subclass of Exception that is used solely for reporting that a
@@ -230,7 +240,7 @@ class Server:
self._out_stream = out_stream
self._child_stream = child_stream
self._delayed_fns_lock = threading.Lock()
- self.defer_stop_events = False
+ self._defer_events = False
self._delayed_fns = []
# This queue accepts JSON objects that are then sent to the
# DAP client. Writing is done in a separate thread to avoid
@@ -307,7 +317,6 @@ class Server:
args = {}
def fn():
- global _commands
return _commands[params["command"]](**args)
self.invoke_request(req, result, fn)
@@ -317,7 +326,7 @@ class Server:
def _read_inferior_output(self):
while True:
line = self._child_stream.readline()
- self.send_event(
+ self.send_event_maybe_later(
"output",
{
"category": "stdout",
@@ -357,6 +366,17 @@ class Server:
self._read_queue.put(None)
@in_dap_thread
+ def emit_pending_events(self):
+ """Emit any pending events."""
+ fns = None
+ with self._delayed_fns_lock:
+ fns = self._delayed_fns
+ self._delayed_fns = []
+ self._defer_events = False
+ for fn in fns:
+ fn()
+
+ @in_dap_thread
def main_loop(self):
"""The main loop of the DAP server."""
# Before looping, start the thread that writes JSON to the
@@ -372,28 +392,22 @@ class Server:
req = cmd["seq"]
with self.canceller.current_request(req):
self._handle_command(cmd)
- fns = None
- with self._delayed_fns_lock:
- fns = self._delayed_fns
- self._delayed_fns = []
- self.defer_stop_events = False
- for fn in fns:
- fn()
+ self.emit_pending_events()
# Got the terminate request. This is handled by the
# JSON-writing thread, so that we can ensure that all
# responses are flushed to the client before exiting.
self._write_queue.put(None)
json_writer.join()
- send_gdb("quit")
+ send_gdb(lambda: exec_and_log("quit"))
@in_dap_thread
- def send_event_later(self, event, body=None):
- """Send a DAP event back to the client, but only after the
- current request has completed."""
+ def set_defer_events(self):
+ """Defer any events until the current request has completed."""
with self._delayed_fns_lock:
- self._delayed_fns.append(lambda: self.send_event(event, body))
+ self._defer_events = True
- @in_gdb_thread
+ # Note that this does not need to be run in any particular thread,
+ # because it uses locks for thread-safety.
def send_event_maybe_later(self, event, body=None):
"""Send a DAP event back to the client, but if a request is in-flight
within the dap thread and that request is configured to delay the event,
@@ -402,10 +416,10 @@ class Server:
with self.canceller.lock:
if self.canceller.in_flight_dap_thread:
with self._delayed_fns_lock:
- if self.defer_stop_events:
- self._delayed_fns.append(lambda: self.send_event(event, body))
+ if self._defer_events:
+ self._delayed_fns.append(lambda: self._send_event(event, body))
return
- self.send_event(event, body)
+ self._send_event(event, body)
@in_dap_thread
def call_function_later(self, fn):
@@ -416,7 +430,7 @@ class Server:
# Note that this does not need to be run in any particular thread,
# because it just creates an object and writes it to a thread-safe
# queue.
- def send_event(self, event, body=None):
+ def _send_event(self, event, body=None):
"""Send an event to the DAP client.
EVENT is the name of the event, a string.
BODY is the body of the event, an arbitrary object."""
@@ -440,22 +454,11 @@ def send_event(event, body=None):
"""Send an event to the DAP client.
EVENT is the name of the event, a string.
BODY is the body of the event, an arbitrary object."""
- global _server
- _server.send_event(event, body)
-
-
-def send_event_maybe_later(event, body=None):
- """Send a DAP event back to the client, but if a request is in-flight
- within the dap thread and that request is configured to delay the event,
- wait until the response has been sent until the event is sent back to
- the client."""
- global _server
_server.send_event_maybe_later(event, body)
def call_function_later(fn):
"""Call FN later -- after the current request's response has been sent."""
- global _server
_server.call_function_later(fn)
@@ -480,7 +483,7 @@ def request(
response: bool = True,
on_dap_thread: bool = False,
expect_stopped: bool = True,
- defer_stop_events: bool = False
+ defer_events: bool = True
):
"""A decorator for DAP requests.
@@ -502,9 +505,9 @@ def request(
inferior is running. When EXPECT_STOPPED is False, the request
will proceed regardless of the inferior's state.
- If DEFER_STOP_EVENTS is True, then make sure any stop events sent
- during the request processing are not sent to the client until the
- response has been sent.
+ If DEFER_EVENTS is True, then make sure any events sent during the
+ request processing are not sent to the client until the response
+ has been sent.
"""
# Validate the parameters.
@@ -527,27 +530,33 @@ def request(
# Verify that the function is run on the correct thread.
if on_dap_thread:
- cmd = in_dap_thread(func)
+ check_cmd = in_dap_thread(func)
else:
func = in_gdb_thread(func)
if response:
- if defer_stop_events:
- global _server
- if _server is not None:
- with _server.delayed_events_lock:
- _server.defer_stop_events = True
def sync_call(**args):
return send_gdb_with_response(lambda: func(**args))
- cmd = sync_call
+ check_cmd = sync_call
else:
def non_sync_call(**args):
return send_gdb(lambda: func(**args))
- cmd = non_sync_call
+ check_cmd = non_sync_call
+
+ if defer_events:
+
+ def deferring(**args):
+ _server.set_defer_events()
+ return check_cmd(**args)
+
+ cmd = deferring
+
+ else:
+ cmd = check_cmd
# If needed, check that the inferior is not running. This
# wrapping is done last, so the check is done first, before
@@ -555,7 +564,6 @@ def request(
if expect_stopped:
cmd = _check_not_running(cmd)
- global _commands
assert name not in _commands
_commands[name] = cmd
return cmd
@@ -568,7 +576,6 @@ def capability(name, value=True):
the DAP capability NAME."""
def wrap(func):
- global _capabilities
assert name not in _capabilities
_capabilities[name] = value
return func
@@ -581,7 +588,6 @@ def client_bool_capability(name, default=False):
If the capability was not specified, or did not have boolean type,
DEFAULT is returned. DEFAULT defaults to False."""
- global _server
if name in _server.config and isinstance(_server.config[name], bool):
return _server.config[name]
return default
@@ -589,9 +595,8 @@ def client_bool_capability(name, default=False):
@request("initialize", on_dap_thread=True)
def initialize(**args):
- global _server, _capabilities
_server.config = args
- _server.send_event_later("initialized")
+ _server.send_event_maybe_later("initialized")
global _lines_start_at_1
_lines_start_at_1 = client_bool_capability("linesStartAt1", True)
global _columns_start_at_1
@@ -609,7 +614,7 @@ def terminate(**args):
@capability("supportTerminateDebuggee")
def disconnect(*, terminateDebuggee: bool = False, **args):
if terminateDebuggee:
- send_gdb_with_response("kill")
+ send_gdb_with_response(lambda: exec_and_log("kill"))
_server.shutdown()
@@ -628,18 +633,6 @@ def cancel(**args):
return None
-class Invoker(object):
- """A simple class that can invoke a gdb command."""
-
- def __init__(self, cmd):
- self._cmd = cmd
-
- # This is invoked in the gdb thread to run the command.
- @in_gdb_thread
- def __call__(self):
- exec_and_log(self._cmd)
-
-
class Cancellable(object):
def __init__(self, fn, result_q=None):
@@ -672,25 +665,16 @@ class Cancellable(object):
def send_gdb(cmd):
"""Send CMD to the gdb thread.
- CMD can be either a function or a string.
- If it is a string, it is passed to gdb.execute."""
- if isinstance(cmd, str):
- cmd = Invoker(cmd)
-
+ CMD is a function."""
# Post the event and don't wait for the result.
gdb.post_event(Cancellable(cmd))
def send_gdb_with_response(fn):
"""Send FN to the gdb thread and return its result.
- If FN is a string, it is passed to gdb.execute and None is
- returned as the result.
If FN throws an exception, this function will throw the
same exception in the calling thread.
"""
- if isinstance(fn, str):
- fn = Invoker(fn)
-
# Post the event and wait for the result in result_q.
result_q = DAPQueue()
gdb.post_event(Cancellable(fn, result_q))
@@ -705,7 +689,6 @@ def export_line(line: int) -> int:
"""Rewrite LINE according to client capability.
This applies the linesStartAt1 capability as needed,
when sending a line number from gdb to the client."""
- global _lines_start_at_1
if not _lines_start_at_1:
# In gdb, lines start at 1, so we only need to change this if
# the client starts at 0.
@@ -717,7 +700,6 @@ def import_line(line: int) -> int:
"""Rewrite LINE according to client capability.
This applies the linesStartAt1 capability as needed,
when the client sends a line number to gdb."""
- global _lines_start_at_1
if not _lines_start_at_1:
# In gdb, lines start at 1, so we only need to change this if
# the client starts at 0.
diff --git a/gdb/python/lib/gdb/dap/sources.py b/gdb/python/lib/gdb/dap/sources.py
index a9f4ea6..efcd799 100644
--- a/gdb/python/lib/gdb/dap/sources.py
+++ b/gdb/python/lib/gdb/dap/sources.py
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,6 @@ def make_source(fullname, filename=None):
FILENAME is the base name; if None (the default), then it is
computed from FULLNAME.
"""
- global _source_map
if fullname in _source_map:
result = _source_map[fullname]
else:
@@ -53,7 +52,6 @@ def make_source(fullname, filename=None):
global _next_source
result["sourceReference"] = _next_source
- global _id_map
_id_map[_next_source] = result
_next_source += 1
@@ -66,12 +64,11 @@ def decode_source(source):
"""Decode a Source object.
Finds and returns the filename of a given Source object."""
- if "path" in source:
- return source["path"]
- if "sourceReference" not in source:
+ if "sourceReference" not in source or source["sourceReference"] <= 0:
+ if "path" in source:
+ return source["path"]
raise DAPException("either 'path' or 'sourceReference' must appear in Source")
ref = source["sourceReference"]
- global _id_map
if ref not in _id_map:
raise DAPException("no sourceReference " + str(ref))
return _id_map[ref]["path"]
diff --git a/gdb/python/lib/gdb/dap/startup.py b/gdb/python/lib/gdb/dap/startup.py
index a3f048b..0c95ada 100644
--- a/gdb/python/lib/gdb/dap/startup.py
+++ b/gdb/python/lib/gdb/dap/startup.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -204,7 +204,7 @@ def log_stack(level=LogLevel.DEFAULT):
@in_gdb_thread
-def exec_and_log(cmd, propagate_exception=False):
+def exec_and_log(cmd):
"""Execute the gdb command CMD.
If logging is enabled, log the command and its output."""
log("+++ " + cmd)
@@ -213,10 +213,10 @@ def exec_and_log(cmd, propagate_exception=False):
if output != "":
log(">>> " + output)
except gdb.error as e:
- if propagate_exception:
- raise DAPException(str(e)) from e
- else:
- log_stack()
+ # Don't normally want to see this, as it interferes with the
+ # test suite.
+ log_stack(LogLevel.FULL)
+ raise DAPException(str(e)) from e
@in_gdb_thread
diff --git a/gdb/python/lib/gdb/dap/state.py b/gdb/python/lib/gdb/dap/state.py
index 57ae355..5fdfbb2 100644
--- a/gdb/python/lib/gdb/dap/state.py
+++ b/gdb/python/lib/gdb/dap/state.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/dap/threads.py b/gdb/python/lib/gdb/dap/threads.py
index e65495b..89046a8 100644
--- a/gdb/python/lib/gdb/dap/threads.py
+++ b/gdb/python/lib/gdb/dap/threads.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,27 +16,32 @@
import gdb
from .server import request
+from .startup import in_gdb_thread
+@in_gdb_thread
def _thread_name(thr):
if thr.name is not None:
return thr.name
if thr.details is not None:
return thr.details
- return None
+ # Always return a name, as the protocol doesn't allow for nameless
+ # threads. Use the local thread number here... it doesn't matter
+ # without multi-inferior but in that case it might make more
+ # sense.
+ return f"Thread #{thr.num}"
-@request("threads")
+@request("threads", expect_stopped=False)
def threads(**args):
result = []
for thr in gdb.selected_inferior().threads():
- one_result = {
- "id": thr.global_num,
- }
- name = _thread_name(thr)
- if name is not None:
- one_result["name"] = name
- result.append(one_result)
+ result.append(
+ {
+ "id": thr.global_num,
+ "name": _thread_name(thr),
+ }
+ )
return {
"threads": result,
}
diff --git a/gdb/python/lib/gdb/dap/typecheck.py b/gdb/python/lib/gdb/dap/typecheck.py
index 55896cc..1496b67 100644
--- a/gdb/python/lib/gdb/dap/typecheck.py
+++ b/gdb/python/lib/gdb/dap/typecheck.py
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/dap/varref.py b/gdb/python/lib/gdb/dap/varref.py
index b1d8ef7..d18197b 100644
--- a/gdb/python/lib/gdb/dap/varref.py
+++ b/gdb/python/lib/gdb/dap/varref.py
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -69,7 +69,6 @@ class BaseReference(ABC):
NAME is a string or None. None means this does not have a
name, e.g., the result of expression evaluation."""
- global all_variables
all_variables.append(self)
self._ref = len(all_variables)
self._name = name
@@ -147,6 +146,10 @@ class BaseReference(ABC):
if self._children is None:
self._children = [None] * self.child_count()
for idx in range(start, start + count):
+ if idx >= len(self._children):
+ raise DAPException(
+ f"requested child {idx} outside range of variable {self._ref}"
+ )
if self._children[idx] is None:
(name, value) = self.fetch_one_child(idx)
name = self._compute_name(name)
@@ -243,7 +246,11 @@ class VariableReference(BaseReference):
# changed DAP to allow memory references for any of the
# variable response requests, and to lift the restriction
# to pointer-to-function from Variable.
- if self._value.type.strip_typedefs().code == gdb.TYPE_CODE_PTR:
+ if (
+ self._value.type.strip_typedefs().code == gdb.TYPE_CODE_PTR
+ and not self._value.is_optimized_out
+ and not self._value.is_unavailable
+ ):
result["memoryReference"] = hex(int(self._value))
if client_bool_capability("supportsVariableType"):
result["type"] = str(self._value.type)
@@ -267,7 +274,7 @@ class VariableReference(BaseReference):
@in_gdb_thread
def find_variable(ref):
"""Given a variable reference, return the corresponding variable object."""
- global all_variables
+
# Variable references are offset by 1.
ref = ref - 1
if ref < 0 or ref > len(all_variables):
diff --git a/gdb/python/lib/gdb/disassembler.py b/gdb/python/lib/gdb/disassembler.py
index 5df0485..5956678 100644
--- a/gdb/python/lib/gdb/disassembler.py
+++ b/gdb/python/lib/gdb/disassembler.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -155,9 +155,21 @@ class maint_info_py_disassemblers_cmd(gdb.Command):
# Now print the dictionary of registered disassemblers out to
# the user.
match_tag = "\t(Matches current architecture)"
- fmt_len = max(longest_arch_name, len("Architecture"))
- format_string = "{:" + str(fmt_len) + "s} {:s}"
- print(format_string.format("Architecture", "Disassember Name"))
+ arch_title = "Architecture"
+ fmt_len = max(longest_arch_name, len(arch_title))
+ format_string = "{:" + str(fmt_len) + "s} {:s}"
+ padding_string = " " * (fmt_len - len(arch_title))
+ title_style = gdb.Style("title")
+ # We cannot use FORMAT_STRING to layout the title line, as
+ # Python is unable to calculate the length of a styled string.
+ # Instead use PADDING_STRING to manually layout the columns.
+ print(
+ "{:s}{:s} {:s}".format(
+ title_style.apply(arch_title),
+ padding_string,
+ title_style.apply("Disassember Name"),
+ )
+ )
for architecture in _disassemblers_dict:
if architecture is not None:
name = _disassemblers_dict[architecture].name
diff --git a/gdb/python/lib/gdb/frames.py b/gdb/python/lib/gdb/frames.py
index a3be80c7..96174e9 100644
--- a/gdb/python/lib/gdb/frames.py
+++ b/gdb/python/lib/gdb/frames.py
@@ -1,5 +1,5 @@
# Frame-filter commands.
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/function/__init__.py b/gdb/python/lib/gdb/function/__init__.py
index 4b64bc3..62b6422 100644
--- a/gdb/python/lib/gdb/function/__init__.py
+++ b/gdb/python/lib/gdb/function/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/function/as_string.py b/gdb/python/lib/gdb/function/as_string.py
index a255fff..ff1304f 100644
--- a/gdb/python/lib/gdb/function/as_string.py
+++ b/gdb/python/lib/gdb/function/as_string.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/function/caller_is.py b/gdb/python/lib/gdb/function/caller_is.py
index bacd8c0..3687e4c 100644
--- a/gdb/python/lib/gdb/function/caller_is.py
+++ b/gdb/python/lib/gdb/function/caller_is.py
@@ -1,5 +1,5 @@
# Caller-is functions.
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/function/strfns.py b/gdb/python/lib/gdb/function/strfns.py
index 90c9cea..a620f4f 100644
--- a/gdb/python/lib/gdb/function/strfns.py
+++ b/gdb/python/lib/gdb/function/strfns.py
@@ -1,5 +1,5 @@
# Useful gdb string convenience functions.
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/missing_debug.py b/gdb/python/lib/gdb/missing_debug.py
index 2c2ceba..b03aaad 100644
--- a/gdb/python/lib/gdb/missing_debug.py
+++ b/gdb/python/lib/gdb/missing_debug.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/missing_files.py b/gdb/python/lib/gdb/missing_files.py
index 5f2df88c..9f24db7 100644
--- a/gdb/python/lib/gdb/missing_files.py
+++ b/gdb/python/lib/gdb/missing_files.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/missing_objfile.py b/gdb/python/lib/gdb/missing_objfile.py
index ace0e13..3d06bdd 100644
--- a/gdb/python/lib/gdb/missing_objfile.py
+++ b/gdb/python/lib/gdb/missing_objfile.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/printer/__init__.py b/gdb/python/lib/gdb/printer/__init__.py
index 6692044..854ff3a 100644
--- a/gdb/python/lib/gdb/printer/__init__.py
+++ b/gdb/python/lib/gdb/printer/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/printing.py b/gdb/python/lib/gdb/printing.py
index 0635993..f1ac19d 100644
--- a/gdb/python/lib/gdb/printing.py
+++ b/gdb/python/lib/gdb/printing.py
@@ -1,5 +1,5 @@
# Pretty-printer utilities.
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -415,10 +415,21 @@ def make_visualizer(value):
result = NoOpArrayPrinter(ty, value)
elif ty.code in (gdb.TYPE_CODE_STRUCT, gdb.TYPE_CODE_UNION):
result = NoOpStructPrinter(ty, value)
- elif ty.code in (
- gdb.TYPE_CODE_PTR,
- gdb.TYPE_CODE_REF,
- gdb.TYPE_CODE_RVALUE_REF,
+ elif (
+ ty.code
+ in (
+ gdb.TYPE_CODE_PTR,
+ gdb.TYPE_CODE_REF,
+ gdb.TYPE_CODE_RVALUE_REF,
+ )
+ # Avoid "void *" here because those pointers can't be
+ # dereferenced without a cast.
+ and ty.target().code != gdb.TYPE_CODE_VOID
+ # An optimized-out or unavailable pointer should just be
+ # treated as a scalar, since there's no way to dereference
+ # it.
+ and not value.is_optimized_out
+ and not value.is_unavailable
):
result = NoOpPointerReferencePrinter(value)
else:
diff --git a/gdb/python/lib/gdb/prompt.py b/gdb/python/lib/gdb/prompt.py
index 497ab83..060474c 100644
--- a/gdb/python/lib/gdb/prompt.py
+++ b/gdb/python/lib/gdb/prompt.py
@@ -1,5 +1,5 @@
# Extended prompt utilities.
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/ptwrite.py b/gdb/python/lib/gdb/ptwrite.py
index 3be65fe..fcc72de 100644
--- a/gdb/python/lib/gdb/ptwrite.py
+++ b/gdb/python/lib/gdb/ptwrite.py
@@ -1,5 +1,5 @@
# Ptwrite utilities.
-# Copyright (C) 2023 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/styling.py b/gdb/python/lib/gdb/styling.py
index 1c5394e..60c470f 100644
--- a/gdb/python/lib/gdb/styling.py
+++ b/gdb/python/lib/gdb/styling.py
@@ -1,5 +1,5 @@
# Styling related hooks.
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@ try:
from pygments import formatters, highlight, lexers
from pygments.filters import TokenMergeFilter
from pygments.token import Comment, Error, Text
+ from pygments.util import ClassNotFound
_formatter = None
@@ -31,10 +32,13 @@ try:
_formatter = formatters.TerminalFormatter()
return _formatter
- def colorize(filename, contents):
+ def colorize(filename, contents, lang):
# Don't want any errors.
try:
- lexer = lexers.get_lexer_for_filename(filename, stripnl=False)
+ try:
+ lexer = lexers.get_lexer_by_name(lang, stripnl=False)
+ except ClassNotFound:
+ lexer = lexers.get_lexer_for_filename(filename, stripnl=False)
formatter = get_formatter()
return highlight(contents, lexer, formatter).encode(
gdb.host_charset(), "backslashreplace"
@@ -76,7 +80,6 @@ try:
# ignore.
pass
- global _asm_lexers
if lexer_type not in _asm_lexers:
_asm_lexers[lexer_type] = lexers.get_lexer_by_name(lexer_type)
_asm_lexers[lexer_type].add_filter(HandleNasmComments())
@@ -94,7 +97,7 @@ try:
except ImportError:
- def colorize(filename, contents):
+ def colorize(filename, contents, lang):
return None
def colorize_disasm(content, gdbarch):
diff --git a/gdb/python/lib/gdb/types.py b/gdb/python/lib/gdb/types.py
index b4af59c..bac1fb9 100644
--- a/gdb/python/lib/gdb/types.py
+++ b/gdb/python/lib/gdb/types.py
@@ -1,5 +1,5 @@
# Type utilities.
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/unwinder.py b/gdb/python/lib/gdb/unwinder.py
index bb0db79..3e1f756 100644
--- a/gdb/python/lib/gdb/unwinder.py
+++ b/gdb/python/lib/gdb/unwinder.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/lib/gdb/xmethod.py b/gdb/python/lib/gdb/xmethod.py
index e12d51c..310585a 100644
--- a/gdb/python/lib/gdb/xmethod.py
+++ b/gdb/python/lib/gdb/xmethod.py
@@ -1,5 +1,5 @@
# Python side of the support for xmethods.
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/py-all-events.def b/gdb/python/py-all-events.def
index f315e75..c20bb36 100644
--- a/gdb/python/py-all-events.def
+++ b/gdb/python/py-all-events.def
@@ -1,6 +1,6 @@
/* Python event definitions -*- c++ -*-
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-auto-load.c b/gdb/python/py-auto-load.c
index 7dc3a7b..f65b979 100644
--- a/gdb/python/py-auto-load.c
+++ b/gdb/python/py-auto-load.c
@@ -1,6 +1,6 @@
/* GDB routines for supporting auto-loaded scripts.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c
index fa7dd19..66ccad7 100644
--- a/gdb/python/py-block.c
+++ b/gdb/python/py-block.c
@@ -356,6 +356,9 @@ block_to_block_object (const struct block *block, struct objfile *objfile)
}
result = PyObject_New (block_object, &block_object_type);
+ if (result == nullptr)
+ return nullptr;
+
result->block = block;
result->objfile = objfile;
diff --git a/gdb/python/py-bpevent.c b/gdb/python/py-bpevent.c
index 5982a26..ddf5066 100644
--- a/gdb/python/py-bpevent.c
+++ b/gdb/python/py-bpevent.c
@@ -1,6 +1,6 @@
/* Python interface to inferior breakpoint stop events.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 882b825..9ce8671 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -1,6 +1,6 @@
/* Python interface to breakpoints
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -948,7 +948,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
else
{
PyErr_SetString (PyExc_RuntimeError,
- _("Line keyword should be an integer or a string. "));
+ _("Line keyword should be an integer or a string."));
return -1;
}
}
@@ -1537,9 +1537,7 @@ PyTypeObject breakpoint_object_type =
0, /* tp_alloc */
};
-void _initialize_py_breakpoint ();
-void
-_initialize_py_breakpoint ()
+INIT_GDB_FILE (py_breakpoint)
{
add_setshow_boolean_cmd
("py-breakpoint", class_maintenance, &pybp_debug,
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index 2bb9b82..dc5e270 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -1,6 +1,6 @@
/* gdb commands implemented in Python
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -105,19 +105,17 @@ cmdpy_function (const char *args, int from_tty, cmd_list_element *command)
gdbpy_enter enter_py;
- if (! obj)
+ if (obj == nullptr)
error (_("Invalid invocation of Python command object."));
- if (! PyObject_HasAttr ((PyObject *) obj, invoke_cst))
- {
- if (obj->command->is_prefix ())
- {
- /* A prefix command does not need an invoke method. */
- return;
- }
- error (_("Python command object missing 'invoke' method."));
- }
- if (! args)
+ /* If we get here for a prefix command then the prefix command had an
+ 'invoke' method when it was created. If the 'invoke' method is now
+ missing, then the user has done something weird (like deleting the
+ invoke method, yuck!). */
+ if (!PyObject_HasAttr ((PyObject *) obj, invoke_cst))
+ error (_("Python command object missing 'invoke' method."));
+
+ if (args == nullptr)
args = "";
gdbpy_ref<> argobj (PyUnicode_Decode (args, strlen (args), host_charset (),
NULL));
@@ -336,24 +334,30 @@ cmdpy_completer (struct cmd_list_element *command,
name of the new command. All earlier words must be existing prefix
commands.
- *BASE_LIST is set to the final prefix command's list of
- *sub-commands.
+ *BASE_LIST is set to the final prefix command's list of sub-commands.
START_LIST is the list in which the search starts.
+ When PREFIX_CMD is not NULL then *PREFIX_CMD is set to the prefix
+ command itself, or NULL, if there is no prefix command.
+
This function returns the name of the new command. On error sets the Python
error and returns NULL. */
gdb::unique_xmalloc_ptr<char>
gdbpy_parse_command_name (const char *name,
struct cmd_list_element ***base_list,
- struct cmd_list_element **start_list)
+ struct cmd_list_element **start_list,
+ struct cmd_list_element **prefix_cmd)
{
struct cmd_list_element *elt;
int len = strlen (name);
int i, lastchar;
const char *prefix_text2;
+ if (prefix_cmd != nullptr)
+ *prefix_cmd = nullptr;
+
/* Skip trailing whitespace. */
for (i = len - 1; i >= 0 && (name[i] == ' ' || name[i] == '\t'); --i)
;
@@ -368,9 +372,8 @@ gdbpy_parse_command_name (const char *name,
for (; i > 0 && valid_cmd_char_p (name[i - 1]); --i)
;
- gdb::unique_xmalloc_ptr<char> result ((char *) xmalloc (lastchar - i + 2));
- memcpy (result.get (), &name[i], lastchar - i + 1);
- result.get ()[lastchar - i + 1] = '\0';
+ gdb::unique_xmalloc_ptr<char> result
+ = make_unique_xstrndup (&name[i], lastchar - i + 1);
/* Skip whitespace again. */
for (--i; i >= 0 && (name[i] == ' ' || name[i] == '\t'); --i)
@@ -385,7 +388,7 @@ gdbpy_parse_command_name (const char *name,
prefix_text2 = prefix_text.c_str ();
elt = lookup_cmd_1 (&prefix_text2, *start_list, NULL, NULL, 1);
- if (elt == NULL || elt == CMD_LIST_AMBIGUOUS)
+ if (elt == nullptr || elt == CMD_LIST_AMBIGUOUS || *prefix_text2 != '\0')
{
PyErr_Format (PyExc_RuntimeError, _("Could not find command prefix %s."),
prefix_text.c_str ());
@@ -395,6 +398,8 @@ gdbpy_parse_command_name (const char *name,
if (elt->is_prefix ())
{
*base_list = elt->subcommands;
+ if (prefix_cmd != nullptr)
+ *prefix_cmd = elt;
return result;
}
@@ -469,8 +474,9 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
return -1;
}
+ cmd_list_element *prefix_cmd = nullptr;
gdb::unique_xmalloc_ptr<char> cmd_name
- = gdbpy_parse_command_name (name, &cmd_list, &cmdlist);
+ = gdbpy_parse_command_name (name, &cmd_list, &cmdlist, &prefix_cmd);
if (cmd_name == nullptr)
return -1;
@@ -507,26 +513,64 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
if (is_prefix)
{
- int allow_unknown;
-
- /* If we have our own "invoke" method, then allow unknown
- sub-commands. */
- allow_unknown = PyObject_HasAttr (self, invoke_cst);
- cmd = add_prefix_cmd (cmd_name.get (),
- (enum command_class) cmdtype,
- NULL, docstring.release (), &obj->sub_list,
- allow_unknown, cmd_list);
+ bool has_invoke = PyObject_HasAttr (self, invoke_cst) == 1;
+ if (has_invoke)
+ {
+ /* If there's an 'invoke' method, then create the prefix
+ command, but call cmdpy_function to dispatch to the invoke
+ method when the user runs the prefix with no sub-command. */
+ cmd = add_prefix_cmd (cmd_name.get (),
+ (enum command_class) cmdtype,
+ nullptr,
+ docstring.release (), &obj->sub_list,
+ 1 /* allow_unknown */, cmd_list);
+ cmd->func = cmdpy_function;
+ }
+ else
+ {
+ /* If there is no 'invoke' method, then create the prefix
+ using the standard prefix callbacks. This means that for
+ 'set prefix' the user will get the help text listing all
+ of the sub-commands, and for 'show prefix', the user will
+ see all of the sub-command values. */
+ if (prefix_cmd != nullptr)
+ {
+ while (prefix_cmd->prefix != nullptr)
+ prefix_cmd = prefix_cmd->prefix;
+ }
+
+ bool is_show = (prefix_cmd != nullptr
+ && prefix_cmd->subcommands == &showlist);
+
+ if (is_show)
+ cmd = add_show_prefix_cmd (cmd_name.get (),
+ (enum command_class) cmdtype,
+ docstring.release (),
+ &obj->sub_list,
+ 0 /* allow_unknown */, cmd_list);
+ else
+ cmd = add_basic_prefix_cmd (cmd_name.get (),
+ (enum command_class) cmdtype,
+ docstring.release (),
+ &obj->sub_list,
+ 0 /* allow_unknown */, cmd_list);
+ }
}
else
- cmd = add_cmd (cmd_name.get (), (enum command_class) cmdtype,
- docstring.release (), cmd_list);
+ {
+ /* For non-prefix commands, arrange to call cmdpy_function, which
+ invokes the Python 'invoke' method, or raises an exception if
+ the 'invoke' method is missing. */
+ cmd = add_cmd (cmd_name.get (), (enum command_class) cmdtype,
+ docstring.release (), cmd_list);
+ cmd->func = cmdpy_function;
+ }
/* If successful, the above takes ownership of the name, since we set
name_allocated, so release it. */
cmd_name.release ();
- /* There appears to be no API to set this. */
- cmd->func = cmdpy_function;
+ /* There appears to be no API to set these member variables. */
cmd->destroyer = cmdpy_destroyer;
cmd->doc_allocated = 1;
cmd->name_allocated = 1;
diff --git a/gdb/python/py-color.c b/gdb/python/py-color.c
index 3a90b62..3bbd22d 100644
--- a/gdb/python/py-color.c
+++ b/gdb/python/py-color.c
@@ -1,6 +1,6 @@
/* Python interface to ui_file_style::color objects.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,6 +21,7 @@
#include "python-internal.h"
#include "py-color.h"
#include "cli/cli-decode.h"
+#include "cli/cli-style.h"
/* Colorspace constants and their values. */
static struct {
@@ -64,7 +65,8 @@ create_color_object (const ui_file_style::color &color)
bool
gdbpy_is_color (PyObject *obj)
{
- return PyObject_IsInstance (obj, (PyObject *) &colorpy_object_type);
+ gdb_assert (obj != nullptr);
+ return PyObject_TypeCheck (obj, &colorpy_object_type) != 0;
}
/* See py-color.h. */
@@ -80,33 +82,33 @@ gdbpy_get_color (PyObject *obj)
static PyObject *
get_attr (PyObject *obj, PyObject *attr_name)
{
- if (! PyUnicode_Check (attr_name))
+ if (!PyUnicode_Check (attr_name))
return PyObject_GenericGetAttr (obj, attr_name);
colorpy_object *self = (colorpy_object *) obj;
const ui_file_style::color &color = self->color;
- if (! PyUnicode_CompareWithASCIIString (attr_name, "colorspace"))
+ if (!PyUnicode_CompareWithASCIIString (attr_name, "colorspace"))
{
int value = static_cast<int> (color.colorspace ());
return gdb_py_object_from_longest (value).release ();
}
- if (! PyUnicode_CompareWithASCIIString (attr_name, "is_none"))
+ if (!PyUnicode_CompareWithASCIIString (attr_name, "is_none"))
return PyBool_FromLong (color.is_none ());
- if (! PyUnicode_CompareWithASCIIString (attr_name, "is_indexed"))
+ if (!PyUnicode_CompareWithASCIIString (attr_name, "is_indexed"))
return PyBool_FromLong (color.is_indexed ());
- if (! PyUnicode_CompareWithASCIIString (attr_name, "is_direct"))
+ if (!PyUnicode_CompareWithASCIIString (attr_name, "is_direct"))
return PyBool_FromLong (color.is_direct ());
if (color.is_indexed ()
- && ! PyUnicode_CompareWithASCIIString (attr_name, "index"))
+ && !PyUnicode_CompareWithASCIIString (attr_name, "index"))
return gdb_py_object_from_longest (color.get_value ()).release ();
if (color.is_direct ()
- && ! PyUnicode_CompareWithASCIIString (attr_name, "components"))
+ && !PyUnicode_CompareWithASCIIString (attr_name, "components"))
{
uint8_t rgb[3];
color.get_rgb (rgb);
@@ -135,25 +137,29 @@ get_attr (PyObject *obj, PyObject *attr_name)
/* Implementation of Color.escape_sequence (self, is_fg) -> str. */
static PyObject *
-colorpy_escape_sequence (PyObject *self, PyObject *is_fg_obj)
+colorpy_escape_sequence (PyObject *self, PyObject *args, PyObject *kwargs)
{
- if (!gdbpy_is_color (self))
- {
- PyErr_SetString (PyExc_RuntimeError,
- _("Object is not gdb.Color."));
- return nullptr;
- }
+ static const char *keywords[] = { "is_foreground", nullptr };
+ PyObject *is_fg_obj;
+
+ /* Parse method arguments. */
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kwargs, "O!", keywords,
+ &PyBool_Type, &is_fg_obj))
+ return nullptr;
- if (! PyBool_Check (is_fg_obj))
+ /* Python ensures the type of SELF. */
+ gdb_assert (gdbpy_is_color (self));
+
+ /* The argument parsing ensures we have a bool. */
+ gdb_assert (PyBool_Check (is_fg_obj));
+
+ std::string s;
+ if (term_cli_styling ())
{
- PyErr_SetString (PyExc_RuntimeError,
- _("A boolean argument is required."));
- return nullptr;
+ bool is_fg = is_fg_obj == Py_True;
+ s = gdbpy_get_color (self).to_ansi (is_fg);
}
- bool is_fg = is_fg_obj == Py_True;
- std::string s = gdbpy_get_color (self).to_ansi (is_fg);
-
return host_string_to_python_string (s.c_str ()).release ();
}
@@ -175,17 +181,20 @@ colorpy_init (PyObject *self, PyObject *args, PyObject *kwds)
PyObject *colorspace_obj = nullptr;
color_space colorspace = color_space::MONOCHROME;
- if (! PyArg_ParseTuple (args, "|OO", &value_obj, &colorspace_obj))
+ static const char *keywords[] = { "value", "color_space", nullptr };
+
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kwds, "|OO", keywords,
+ &value_obj, &colorspace_obj))
return -1;
try
{
- if (colorspace_obj)
+ if (colorspace_obj != nullptr)
{
if (PyLong_Check (colorspace_obj))
{
long colorspace_id = -1;
- if (! gdb_py_int_as_long (colorspace_obj, &colorspace_id))
+ if (!gdb_py_int_as_long (colorspace_obj, &colorspace_id))
return -1;
if (!color_space_safe_cast (&colorspace, colorspace_id))
error (_("colorspace %ld is out of range."), colorspace_id);
@@ -201,11 +210,11 @@ colorpy_init (PyObject *self, PyObject *args, PyObject *kwds)
else if (PyLong_Check (value_obj))
{
long value = -1;
- if (! gdb_py_int_as_long (value_obj, &value))
+ if (!gdb_py_int_as_long (value_obj, &value))
return -1;
if (value < 0 || value > INT_MAX)
error (_("value %ld is out of range."), value);
- if (colorspace_obj)
+ if (colorspace_obj != nullptr)
obj->color = ui_file_style::color (colorspace, value);
else
obj->color = ui_file_style::color (value);
@@ -256,7 +265,6 @@ colorpy_init (PyObject *self, PyObject *args, PyObject *kwds)
return gdbpy_handle_gdb_exception (-1, except);
}
- Py_INCREF (self);
return 0;
}
@@ -272,10 +280,10 @@ colorpy_str (PyObject *self)
static int
gdbpy_initialize_color (void)
{
- for (auto & pair : colorspace_constants)
- if (PyModule_AddIntConstant (gdb_module, pair.name,
- static_cast<long> (pair.value)) < 0)
- return -1;
+ for (auto &pair : colorspace_constants)
+ if (PyModule_AddIntConstant (gdb_module, pair.name,
+ static_cast<long> (pair.value)) < 0)
+ return -1;
colorpy_object_type.tp_new = PyType_GenericNew;
return gdbpy_type_ready (&colorpy_object_type, gdb_module);
@@ -285,7 +293,8 @@ gdbpy_initialize_color (void)
static PyMethodDef color_methods[] =
{
- { "escape_sequence", colorpy_escape_sequence, METH_O,
+ { "escape_sequence", (PyCFunction) colorpy_escape_sequence,
+ METH_VARARGS | METH_KEYWORDS,
"escape_sequence (is_foreground) -> str.\n\
Return the ANSI escape sequence for this color.\n\
IS_FOREGROUND indicates whether this is a foreground or background color."},
@@ -313,7 +322,7 @@ PyTypeObject colorpy_object_type =
get_attr, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
"GDB color object", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
diff --git a/gdb/python/py-color.h b/gdb/python/py-color.h
index a3e5e41..d94baa2 100644
--- a/gdb/python/py-color.h
+++ b/gdb/python/py-color.h
@@ -1,6 +1,6 @@
/* Python interface to ui_file_style::color objects.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-connection.c b/gdb/python/py-connection.c
index d2cd10d..a6d9ad0 100644
--- a/gdb/python/py-connection.c
+++ b/gdb/python/py-connection.c
@@ -1,6 +1,6 @@
/* Python interface to inferiors.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -428,9 +428,7 @@ connpy_send_packet (PyObject *self, PyObject *args, PyObject *kw)
/* Global initialization for this file. */
-void _initialize_py_connection ();
-void
-_initialize_py_connection ()
+INIT_GDB_FILE (py_connection)
{
gdb::observers::connection_removed.attach (connpy_connection_removed,
"py-connection");
diff --git a/gdb/python/py-continueevent.c b/gdb/python/py-continueevent.c
index c859b1e..500b5da 100644
--- a/gdb/python/py-continueevent.c
+++ b/gdb/python/py-continueevent.c
@@ -1,6 +1,6 @@
/* Python interface to inferior continue events.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-corefile.c b/gdb/python/py-corefile.c
new file mode 100644
index 0000000..97f4242
--- /dev/null
+++ b/gdb/python/py-corefile.c
@@ -0,0 +1,684 @@
+/* Python interface to core files.
+
+ Copyright (C) 2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "python-internal.h"
+#include "progspace.h"
+#include "observable.h"
+#include "inferior.h"
+#include "gdbcore.h"
+#include "gdbsupport/rsp-low.h"
+
+/* A gdb.Corefile object. */
+
+struct corefile_object
+{
+ PyObject_HEAD
+
+ /* The inferior this core file is attached to. This will be set to NULL
+ when the inferior is deleted, or if a different core file is loaded
+ for the inferior. When this is NULL the gdb.Corefile object is
+ considered invalid.*/
+ struct inferior *inferior;
+
+ /* Dictionary holding user-added attributes. This is the __dict__
+ attribute of the object. This is an owning reference. */
+ PyObject *dict;
+
+ /* A Tuple of gdb.CorefileMappedFile objects. This tuple is only created
+ the first time the user calls gdb.Corefile.mapped_files(), the result
+ is cached here. If this pointer is not NULL then this is an owning
+ pointer (i.e. this owns a reference to the Tuple). */
+ PyObject *mapped_files;
+};
+
+extern PyTypeObject corefile_object_type
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("corefile_object");
+
+/* A gdb.CorefileMapped object. */
+
+struct corefile_mapped_file_object
+{
+ PyObject_HEAD
+
+ /* The name of a file that was mapped when the core file was created.
+ This is a 'str' object. */
+ PyObject *filename;
+
+ /* The build-id of a file that was mapped when the core file was
+ created. This is either a 'str' if the file had a build-id, or
+ 'None' if there was no build-id for this file. */
+ PyObject *build_id;
+
+ /* A List of gdb.CorefileMappedFileRegion objects. */
+ PyObject *regions;
+
+ /* True if this represents the main executable from which the core file
+ was created. */
+ bool is_main_exec_p;
+};
+
+extern PyTypeObject corefile_mapped_file_object_type
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("corefile_mapped_file_object");
+
+/* A gdb.CorefileMappedFileRegion object. */
+
+struct corefile_mapped_file_region_object
+{
+ PyObject_HEAD
+
+ /* The start and end addresses for this mapping, these are addresses
+ within the inferior's address space. */
+ CORE_ADDR start;
+ CORE_ADDR end;
+
+ /* The offset within the mapped file for this mapping. */
+ ULONGEST file_offset;
+};
+
+extern PyTypeObject corefile_mapped_file_region_object_type
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("corefile_mapped_file_region_object");
+
+/* Clear the inferior pointer in a Corefile object OBJ when an inferior is
+ deleted. */
+
+struct inferior_corefile_deleter
+{
+ void operator() (corefile_object *obj)
+ {
+ if (!gdb_python_initialized)
+ return;
+
+ gdbpy_enter enter_py;
+
+ /* When OBJECT goes out of scope this will Py_DECREF on OBJ. */
+ gdbpy_ref<corefile_object> object (obj);
+
+ /* Clearing the inferior pointer marks the gdb.Corefile as invalid. */
+ object->inferior = nullptr;
+ }
+};
+
+/* Store a gdb.Corefile object in an inferior's registry. */
+
+static const registry<inferior>::key<corefile_object,
+ inferior_corefile_deleter>
+ cfpy_inferior_corefile_data_key;
+
+/* See python-internal.h. */
+
+gdbpy_ref<>
+gdbpy_core_file_from_inferior (inferior *inf)
+{
+ gdb_assert (inf != nullptr);
+ gdb_assert (inf->pspace != nullptr);
+
+ if (get_inferior_core_bfd (inf) == nullptr)
+ return gdbpy_ref<>::new_reference (Py_None);
+
+ PyObject *result = (PyObject *) cfpy_inferior_corefile_data_key.get (inf);
+ if (result == nullptr)
+ {
+ gdbpy_ref<corefile_object> object
+ (PyObject_New (corefile_object, &corefile_object_type));
+ if (object == nullptr)
+ return nullptr;
+
+ /* Ensure the 'inferior' field is set to NULL. If the PyDict_New
+ call fails then the gdb.Corefile will be discarded and
+ cfpy_dealloc will be called, which requires that the 'inferior' be
+ set to NULL. */
+ object->inferior = nullptr;
+ object->mapped_files = nullptr;
+ object->dict = PyDict_New ();
+ if (object->dict == nullptr)
+ return nullptr;
+
+ /* Now that the gdb.Corefile has been successfully initialised and we
+ know that it is going to be passed back to the user, move it out
+ of the invalid state by setting the 'inferior' field to a non NULL
+ value. */
+ object->inferior = inf;
+ cfpy_inferior_corefile_data_key.set (inf, object.get ());
+ result = (PyObject *) object.release ();
+ }
+
+ return gdbpy_ref<>::new_reference (result);
+}
+
+/* Return true if OBJ is valid. */
+
+static bool
+cfpy_corefile_object_is_valid (const corefile_object *obj)
+{
+ if (obj->inferior == nullptr)
+ return false;
+
+ return get_inferior_core_bfd (obj->inferior) != nullptr;
+}
+
+/* Require that COREFILE_OBJ be a valid core file. A valid core file
+ object has a valid program space, and the program space has a core file
+ loaded into it. */
+#define CFPY_REQUIRE_VALID(corefile_obj) \
+ do { \
+ if (!cfpy_corefile_object_is_valid (corefile_obj)) \
+ { \
+ PyErr_SetString (PyExc_RuntimeError, \
+ _("Corefile no longer exists.")); \
+ return nullptr; \
+ } \
+ } while (0)
+
+/* Read the gdb.Corefile.filename attribute. */
+
+static PyObject *
+cfpy_get_filename (PyObject *self, void *closure)
+{
+ corefile_object *obj = (corefile_object *) self;
+
+ CFPY_REQUIRE_VALID (obj);
+
+ /* If the program space's core file had been cleared, then this Corefile
+ object would have been invalidated. */
+ bfd *abfd = get_inferior_core_bfd (obj->inferior);
+ gdb_assert (abfd != nullptr);
+
+ return host_string_to_python_string (bfd_get_filename (abfd)).release ();
+}
+
+/* Implementation of gdb.Corefile.is_valid (self) -> Boolean.
+ Returns True if this core file object is associated with a program space
+ that still exists, an the program space still has a core file loaded. */
+
+static PyObject *
+cfpy_is_valid (PyObject *self, PyObject *args)
+{
+ corefile_object *obj = (corefile_object *) self;
+
+ if (!cfpy_corefile_object_is_valid (obj))
+ Py_RETURN_FALSE;
+
+ Py_RETURN_TRUE;
+}
+
+/* Implement gdb.Corefile.mapped_files (). Return a List of
+ gdb.CorefileMappedFile objects. The list is created the first time
+ this method is called, and then cached within the gdb.Corefile object,
+ future calls just return a reference to the same list. */
+
+static PyObject *
+cfpy_mapped_files (PyObject *self, PyObject *args)
+{
+ corefile_object *obj = (corefile_object *) self;
+
+ CFPY_REQUIRE_VALID (obj);
+
+ /* If we have already created the List then just return another reference
+ to the existing list. */
+ if (obj->mapped_files != nullptr)
+ {
+ Py_INCREF (obj->mapped_files);
+ return obj->mapped_files;
+ }
+
+ /* Get all the mapping data from GDB. */
+ std::vector<core_mapped_file> mapped_files;
+ try
+ {
+ mapped_files
+ = gdb_read_core_file_mappings (obj->inferior->arch (),
+ get_inferior_core_bfd (obj->inferior));
+ }
+ catch (const gdb_exception &except)
+ {
+ return gdbpy_handle_gdb_exception (nullptr, except);
+ }
+
+ /* Create a new list to hold the results. */
+ gdbpy_ref<> tuple (PyTuple_New (mapped_files.size ()));
+ if (tuple == nullptr)
+ return nullptr;
+
+ /* Create each gdb.CorefileMappedFile object. */
+ Py_ssize_t tuple_idx = 0;
+ for (const core_mapped_file &file : mapped_files)
+ {
+ /* The filename 'str' object. */
+ gdbpy_ref<> filename
+ = host_string_to_python_string (file.filename.c_str ());
+ if (filename == nullptr)
+ return nullptr;
+
+ /* The build-id object. Either a 'str' or 'None'. */
+ gdbpy_ref<> build_id;
+ if (file.build_id != nullptr)
+ {
+ std::string hex_form = bin2hex (file.build_id->data,
+ file.build_id->size);
+
+ build_id
+ = host_string_to_python_string (hex_form.c_str ());
+ if (build_id == nullptr)
+ return nullptr;
+ }
+ else
+ build_id = gdbpy_ref<>::new_reference (Py_None);
+
+ /* List to hold all the gdb.CorefileMappedFileRegion objects. */
+ gdbpy_ref<> regions (PyTuple_New (file.regions.size ()));
+ if (regions == nullptr)
+ return nullptr;
+
+ /* Create all the gdb.CorefileMappedFileRegion objects. */
+ Py_ssize_t regions_idx = 0;
+ for (const core_mapped_file::region &r : file.regions)
+ {
+ /* Actually create the object. */
+ gdbpy_ref<corefile_mapped_file_region_object> region_obj
+ (PyObject_New (corefile_mapped_file_region_object,
+ &corefile_mapped_file_region_object_type));
+ if (region_obj == nullptr)
+ return nullptr;
+
+ /* Initialise the object. */
+ region_obj->start = r.start;
+ region_obj->end = r.end;
+ region_obj->file_offset = r.file_ofs;
+
+ /* Add to the gdb.CorefileMappedFileRegion list. */
+ if (PyTuple_SetItem (regions.get (), regions_idx++,
+ (PyObject *) region_obj.release ()) < 0)
+ return nullptr;
+ }
+
+ /* Actually create the gdb.CorefileMappedFile object. */
+ gdbpy_ref<corefile_mapped_file_object> entry
+ (PyObject_New (corefile_mapped_file_object,
+ &corefile_mapped_file_object_type));
+ if (entry == nullptr)
+ return nullptr;
+
+ /* Initialise the object. */
+ entry->filename = filename.release ();
+ entry->build_id = build_id.release ();
+ entry->regions = regions.release ();
+ entry->is_main_exec_p = file.is_main_exec;
+
+ /* Add to the gdb.CorefileMappedFile list. */
+ if (PyTuple_SetItem (tuple.get (), tuple_idx++,
+ (PyObject *) entry.release ()) < 0)
+ return nullptr;
+ }
+
+ /* No errors. Move the reference currently in LIST into the Corefile
+ object itself. Then create a new reference and hand this back to the
+ user. */
+ obj->mapped_files = tuple.release ();
+ Py_INCREF (obj->mapped_files);
+ return obj->mapped_files;
+}
+
+/* Callback from gdb::observers::core_file_changed. The core file in
+ PSPACE has been changed. */
+
+static void
+cfpy_corefile_changed (inferior *inf)
+{
+ cfpy_inferior_corefile_data_key.clear (inf);
+}
+
+/* Called when a gdb.Corefile is destroyed. */
+
+static void
+cfpy_dealloc (PyObject *obj)
+{
+ corefile_object *corefile = (corefile_object *) obj;
+
+ /* Every gdb.Corefile is cached in an inferior's registry. The only way
+ for a gdb.Corefile to be deallocated is to remove the object reference
+ from the registry (and dec its ref count), but before we do that, we
+ set the object's inferior pointer to NULL. */
+ gdb_assert (corefile->inferior == nullptr);
+
+ Py_XDECREF (corefile->dict);
+ Py_XDECREF (corefile->mapped_files);
+
+ Py_TYPE (obj)->tp_free (obj);
+}
+
+/* __repr__ implementation for gdb.Corefile. */
+
+static PyObject *
+cfpy_repr (PyObject *self)
+{
+ corefile_object *obj = (corefile_object *) self;
+
+ if (!cfpy_corefile_object_is_valid (obj))
+ return gdb_py_invalid_object_repr (self);
+
+ bfd *core_bfd = get_inferior_core_bfd (obj->inferior);
+ gdb_assert (core_bfd != nullptr);
+ return PyUnicode_FromFormat ("<%s inferior=%d filename='%s'>",
+ Py_TYPE (self)->tp_name,
+ obj->inferior->num,
+ bfd_get_filename (core_bfd));
+}
+
+
+
+/* Called when a gdb.CorefileMappedFile is destroyed. */
+
+static void
+cfmfpy_dealloc (PyObject *obj)
+{
+ corefile_mapped_file_object *mapped_file
+ = (corefile_mapped_file_object *) obj;
+
+ Py_XDECREF (mapped_file->filename);
+ Py_XDECREF (mapped_file->build_id);
+ Py_XDECREF (mapped_file->regions);
+
+ Py_TYPE (obj)->tp_free (obj);
+}
+
+/* Read the gdb.CorefileMappedFile.filename attribute. */
+
+static PyObject *
+cfmfpy_get_filename (PyObject *self, void *closure)
+{
+ corefile_mapped_file_object *obj
+ = (corefile_mapped_file_object *) self;
+
+ gdb_assert (obj->filename != nullptr);
+
+ Py_INCREF (obj->filename);
+ return obj->filename;
+}
+
+/* Read the gdb.CorefileMappedFile.build_id attribute. */
+
+static PyObject *
+cfmfpy_get_build_id (PyObject *self, void *closure)
+{
+ corefile_mapped_file_object *obj
+ = (corefile_mapped_file_object *) self;
+
+ gdb_assert (obj->build_id != nullptr);
+
+ Py_INCREF (obj->build_id);
+ return obj->build_id;
+}
+
+/* Read the gdb.CorefileMappedFile.regions attribute. */
+
+static PyObject *
+cfmfpy_get_regions (PyObject *self, void *closure)
+{
+ corefile_mapped_file_object *obj
+ = (corefile_mapped_file_object *) self;
+
+ gdb_assert (obj->regions != nullptr);
+
+ Py_INCREF (obj->regions);
+ return obj->regions;
+}
+
+/* Read the gdb.CorefileMappedFile.is_main_executable attribute. */
+
+static PyObject *
+cfmf_is_main_exec (PyObject *self, void *closure)
+{
+ corefile_mapped_file_object *obj
+ = (corefile_mapped_file_object *) self;
+
+ if (obj->is_main_exec_p)
+ Py_RETURN_TRUE;
+ else
+ Py_RETURN_FALSE;
+}
+
+
+
+/* Read the gdb.CorefileMappedFileRegion.start attribute. */
+
+static PyObject *
+cfmfrpy_get_start (PyObject *self, void *closure)
+{
+ corefile_mapped_file_region_object *obj
+ = (corefile_mapped_file_region_object *) self;
+
+ return gdb_py_object_from_ulongest (obj->start).release ();
+}
+
+/* Read the gdb.CorefileMappedFileRegion.end attribute. */
+
+static PyObject *
+cfmfrpy_get_end (PyObject *self, void *closure)
+{
+ corefile_mapped_file_region_object *obj
+ = (corefile_mapped_file_region_object *) self;
+
+ return gdb_py_object_from_ulongest (obj->end).release ();
+}
+
+/* Read the gdb.CorefileMappedFileRegion.file_offset attribute. */
+
+static PyObject *
+cfmfrpy_get_file_offset (PyObject *self, void *closure)
+{
+ corefile_mapped_file_region_object *obj
+ = (corefile_mapped_file_region_object *) self;
+
+ return gdb_py_object_from_ulongest (obj->file_offset).release ();
+}
+
+
+
+static int
+gdbpy_initialize_corefile ()
+{
+ gdb::observers::core_file_changed.attach (cfpy_corefile_changed,
+ "py-corefile");
+
+ if (gdbpy_type_ready (&corefile_object_type) < 0)
+ return -1;
+
+ if (gdbpy_type_ready (&corefile_mapped_file_object_type) < 0)
+ return -1;
+
+ if (gdbpy_type_ready (&corefile_mapped_file_region_object_type) < 0)
+ return -1;
+
+ return 0;
+}
+
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_corefile);
+
+
+
+static gdb_PyGetSetDef corefile_getset[] =
+{
+ { "__dict__", gdb_py_generic_dict, nullptr,
+ "The __dict__ for the gdb.Corefile.", &corefile_object_type },
+ { "filename", cfpy_get_filename, nullptr,
+ "The filename of a valid Corefile object.", nullptr },
+ { nullptr }
+};
+
+static PyMethodDef corefile_object_methods[] =
+{
+ { "is_valid", cfpy_is_valid, METH_NOARGS,
+ "is_valid () -> Boolean.\n\
+Return true if this Corefile is valid, false if not." },
+ { "mapped_files", cfpy_mapped_files, METH_NOARGS,
+ "mapped_files () -> List of mapping tuples.\n\
+Return a list of tuples. Each tuple represents a mapping from the\
+core file." },
+ { nullptr }
+};
+
+PyTypeObject corefile_object_type =
+{
+ PyVarObject_HEAD_INIT (nullptr, 0)
+ "gdb.Corefile", /*tp_name*/
+ sizeof (corefile_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ cfpy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ cfpy_repr, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB corefile object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ corefile_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ corefile_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ offsetof (corefile_object, dict), /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
+};
+
+static gdb_PyGetSetDef corefile_mapped_file_object_getset[] =
+{
+ { "filename", cfmfpy_get_filename, nullptr,
+ "The filename of a CorefileMappedFile object.", nullptr },
+ { "build_id", cfmfpy_get_build_id, nullptr,
+ "The build-id of a CorefileMappedFile object or None.", nullptr },
+ { "regions", cfmfpy_get_regions, nullptr,
+ "The list of regions from a CorefileMappedFile object.", nullptr },
+ { "is_main_executable", cfmf_is_main_exec, nullptr,
+ "True for the main executable mapping, otherwise False.", nullptr },
+ { nullptr }
+};
+
+PyTypeObject corefile_mapped_file_object_type =
+{
+ PyVarObject_HEAD_INIT (NULL, 0)
+ "gdb.CorefileMappedFile", /*tp_name*/
+ sizeof (corefile_mapped_file_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ cfmfpy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB corefile mapped file object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ corefile_mapped_file_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
+};
+
+static gdb_PyGetSetDef corefile_mapped_file_region_object_getset[] =
+{
+ { "start", cfmfrpy_get_start, nullptr,
+ "The start address of a CorefileMappedFileRegion object.", nullptr },
+ { "end", cfmfrpy_get_end, nullptr,
+ "The end address of a CorefileMappedFileRegion object.", nullptr },
+ { "file_offset", cfmfrpy_get_file_offset, nullptr,
+ "The file offset of a CorefileMappedFileRegion object.", nullptr },
+ { nullptr }
+};
+
+PyTypeObject corefile_mapped_file_region_object_type =
+{
+ PyVarObject_HEAD_INIT (NULL, 0)
+ "gdb.CorefileMappedFileRegion", /*tp_name*/
+ sizeof (corefile_mapped_file_region_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ 0, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB corefile mapped file region object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ corefile_mapped_file_region_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
+};
diff --git a/gdb/python/py-dap.c b/gdb/python/py-dap.c
index d5555c9..9a9875a 100644
--- a/gdb/python/py-dap.c
+++ b/gdb/python/py-dap.c
@@ -1,6 +1,6 @@
/* Python DAP interpreter
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -110,9 +110,7 @@ dap_interp::pre_command_loop ()
call_dap_fn ("pre_command_loop");
}
-void _initialize_py_interp ();
-void
-_initialize_py_interp ()
+INIT_GDB_FILE (py_interp)
{
/* The dap code uses module typing, available starting python 3.5. */
#if PY_VERSION_HEX >= 0x03050000
diff --git a/gdb/python/py-disasm.c b/gdb/python/py-disasm.c
index 22d2ac7..47ae99c 100644
--- a/gdb/python/py-disasm.c
+++ b/gdb/python/py-disasm.c
@@ -1,6 +1,6 @@
/* Python interface to instruction disassembly.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -254,15 +254,15 @@ disasm_info_object_is_valid (disasm_info_object *obj)
/* Fill in OBJ with all the other arguments. */
static void
-disasm_info_fill (disasm_info_object *obj, struct gdbarch *gdbarch,
+disasm_info_fill (disasm_info_object &obj, struct gdbarch *gdbarch,
program_space *progspace, bfd_vma address,
disassemble_info *di, disasm_info_object *next)
{
- obj->gdbarch = gdbarch;
- obj->program_space = progspace;
- obj->address = address;
- obj->gdb_info = di;
- obj->next = next;
+ obj.gdbarch = gdbarch;
+ obj.program_space = progspace;
+ obj.address = address;
+ obj.gdb_info = di;
+ obj.next = next;
}
/* Implement DisassembleInfo.__init__. Takes a single argument that must
@@ -281,7 +281,7 @@ disasm_info_init (PyObject *self, PyObject *args, PyObject *kwargs)
disasm_info_object *other = (disasm_info_object *) info_obj;
disasm_info_object *info = (disasm_info_object *) self;
- disasm_info_fill (info, other->gdbarch, other->program_space,
+ disasm_info_fill (*info, other->gdbarch, other->program_space,
other->address, other->gdb_info, other->next);
other->next = info;
@@ -1156,19 +1156,18 @@ gdbpy_disassembler::gdbpy_disassembler (disasm_info_object *obj)
happens when gdbpy_print_insn returns. This class is responsible for
marking the DisassembleInfo as invalid in its destructor. */
-struct scoped_disasm_info_object
+struct scoped_invalidate_disasm_info
{
- /* Constructor. */
- scoped_disasm_info_object (struct gdbarch *gdbarch, CORE_ADDR memaddr,
- disassemble_info *info)
- : m_disasm_info (allocate_disasm_info_object ())
+ /* Constructor. Just cache DISASM_INFO for use in the destructor. */
+ scoped_invalidate_disasm_info
+ (gdbpy_ref<disasm_info_object> disasm_info)
+ : m_disasm_info (std::move (disasm_info))
{
- disasm_info_fill (m_disasm_info.get (), gdbarch, current_program_space,
- memaddr, info, nullptr);
+ /* Nothing. */
}
/* Upon destruction mark m_disasm_info as invalid. */
- ~scoped_disasm_info_object ()
+ ~scoped_invalidate_disasm_info ()
{
/* Invalidate the original DisassembleInfo object as well as any copies
that the user might have made. */
@@ -1178,30 +1177,15 @@ struct scoped_disasm_info_object
obj->gdb_info = nullptr;
}
- /* Return a pointer to the underlying disasm_info_object instance. */
- disasm_info_object *
- get () const
- {
- return m_disasm_info.get ();
- }
-
private:
- /* Wrapper around the call to PyObject_New, this wrapper function can be
- called from the constructor initialization list, while PyObject_New, a
- macro, can't. */
- static disasm_info_object *
- allocate_disasm_info_object ()
- {
- return (disasm_info_object *) PyObject_New (disasm_info_object,
- &disasm_info_object_type);
- }
-
/* A reference to a gdb.disassembler.DisassembleInfo object. When this
- containing instance goes out of scope this reference is released,
- however, the user might be holding other references to the
- DisassembleInfo object in Python code, so the underlying object might
- not be deleted. */
+ object goes out of scope this reference is released, however, the user
+ might be holding other references to the DisassembleInfo (either
+ directly, or via copies of this object), in which case the underlying
+ object will not be deleted. The destructor of this class ensures
+ that this DisassembleInfo object, and any copies, are all marked
+ invalid. */
gdbpy_ref<disasm_info_object> m_disasm_info;
};
@@ -1242,17 +1226,30 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
return {};
}
- /* Create the new DisassembleInfo object we will pass into Python. This
- object will be marked as invalid when we leave this scope. */
- scoped_disasm_info_object scoped_disasm_info (gdbarch, memaddr, info);
- disasm_info_object *disasm_info = scoped_disasm_info.get ();
+ /* Create the new DisassembleInfo object we will pass into Python. */
+ gdbpy_ref<disasm_info_object> disasm_info
+ ((disasm_info_object *) PyObject_New (disasm_info_object,
+ &disasm_info_object_type));
+ if (disasm_info == nullptr)
+ {
+ gdbpy_print_stack ();
+ return {};
+ }
+
+ /* Initialise the DisassembleInfo object. */
+ disasm_info_fill (*disasm_info.get (), gdbarch, current_program_space,
+ memaddr, info, nullptr);
+
+ /* Ensure the DisassembleInfo, along with any copies the user makes, are
+ marked as invalid when we leave this scope. */
+ scoped_invalidate_disasm_info invalidate_disasm (disasm_info);
/* Call into the registered disassembler to (possibly) perform the
disassembly. */
- PyObject *insn_disas_obj = (PyObject *) disasm_info;
- gdbpy_ref<> result (PyObject_CallFunctionObjArgs (hook.get (),
- insn_disas_obj,
- nullptr));
+ gdbpy_ref<> result
+ (PyObject_CallFunctionObjArgs (hook.get (),
+ (PyObject *) disasm_info.get (),
+ nullptr));
if (result == nullptr)
{
@@ -1311,12 +1308,13 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
return {};
}
- /* Check the result is a DisassemblerResult (or a sub-class). */
- if (!PyObject_IsInstance (result.get (),
- (PyObject *) &disasm_result_object_type))
+ /* Check the result is a DisassemblerResult. */
+ if (!PyObject_TypeCheck (result.get (), &disasm_result_object_type))
{
- PyErr_SetString (PyExc_TypeError,
- _("Result is not a DisassemblerResult."));
+ PyErr_Format
+ (PyExc_TypeError,
+ _("Result from Disassembler must be gdb.DisassemblerResult, not %s."),
+ Py_TYPE (result.get ())->tp_name);
gdbpy_print_stack ();
return std::optional<int> (-1);
}
diff --git a/gdb/python/py-event-types.def b/gdb/python/py-event-types.def
index e22f042..83167f3 100644
--- a/gdb/python/py-event-types.def
+++ b/gdb/python/py-event-types.def
@@ -1,6 +1,6 @@
/* Python event definitions -*- c++ -*-
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -54,7 +54,7 @@ GDB_PY_DEFINE_EVENT_TYPE (new_thread,
GDB_PY_DEFINE_EVENT_TYPE (thread_exited,
"ThreadExitedEvent",
"GDB thread exited event object",
- event_object_type);
+ thread_event_object_type);
GDB_PY_DEFINE_EVENT_TYPE (new_inferior,
"NewInferiorEvent",
diff --git a/gdb/python/py-event.c b/gdb/python/py-event.c
index a918136..da3b52c 100644
--- a/gdb/python/py-event.c
+++ b/gdb/python/py-event.c
@@ -1,6 +1,6 @@
/* Python interface to inferior events.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-event.h b/gdb/python/py-event.h
index e4491db..3938368 100644
--- a/gdb/python/py-event.h
+++ b/gdb/python/py-event.h
@@ -1,6 +1,6 @@
/* Python interface to inferior events.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-events.h b/gdb/python/py-events.h
index b44c437..d9df3ab 100644
--- a/gdb/python/py-events.h
+++ b/gdb/python/py-events.h
@@ -1,6 +1,6 @@
/* Python interface to inferior events.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-evtregistry.c b/gdb/python/py-evtregistry.c
index 7ae3997..2166f75 100644
--- a/gdb/python/py-evtregistry.c
+++ b/gdb/python/py-evtregistry.c
@@ -1,6 +1,6 @@
/* Python interface to inferior thread event registries.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-evts.c b/gdb/python/py-evts.c
index 4e966e1..c905926 100644
--- a/gdb/python/py-evts.c
+++ b/gdb/python/py-evts.c
@@ -1,6 +1,6 @@
/* Python interface to inferior events.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-exitedevent.c b/gdb/python/py-exitedevent.c
index 4837468..dfe8a8f 100644
--- a/gdb/python/py-exitedevent.c
+++ b/gdb/python/py-exitedevent.c
@@ -1,6 +1,6 @@
/* Python interface to inferior exit events.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index bc53d4e..70e1684 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -1,6 +1,6 @@
/* Python interface to finish breakpoints
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -175,7 +175,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
struct frame_id frame_id;
PyObject *internal = NULL;
int internal_bp = 0;
- CORE_ADDR pc;
+ std::optional<CORE_ADDR> pc;
if (!gdb_PyArg_ParseTupleAndKeywords (args, kwargs, "|OO", keywords,
&frame_obj, &internal))
@@ -249,9 +249,9 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
try
{
- if (get_frame_pc_if_available (frame, &pc))
+ if ((pc = get_frame_pc_if_available (frame)))
{
- struct symbol *function = find_pc_function (pc);
+ struct symbol *function = find_pc_function (*pc);
if (function != nullptr)
{
struct type *ret_type =
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index 88646ee..722a952 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -1,6 +1,6 @@
/* Python interface to stack frames
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index 88252b0..db8c274 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -1,6 +1,6 @@
/* Python frame filters
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -168,7 +168,7 @@ mi_should_print (struct symbol *sym, enum mi_print_types type)
{
int print_me = 0;
- switch (sym->aclass ())
+ switch (sym->loc_class ())
{
default:
case LOC_UNDEF: /* catches errors */
diff --git a/gdb/python/py-function.c b/gdb/python/py-function.c
index 2b65d8b..86a2f30 100644
--- a/gdb/python/py-function.c
+++ b/gdb/python/py-function.c
@@ -1,6 +1,6 @@
/* Convenience functions implemented in Python.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-gdb-readline.c b/gdb/python/py-gdb-readline.c
index dd0ee45..70ceebb 100644
--- a/gdb/python/py-gdb-readline.c
+++ b/gdb/python/py-gdb-readline.c
@@ -1,6 +1,6 @@
/* Readline support for Python.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -29,11 +29,7 @@
static char *
gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
-#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 4
const char *prompt)
-#else
- char *prompt)
-#endif
{
int n;
const char *p = NULL;
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index 356961c..d926923 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -1,6 +1,6 @@
/* Python interface to inferiors.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -973,6 +973,22 @@ infpy_get_main_name (PyObject *self, void *closure)
return host_string_to_python_string (name).release ();
}
+/* Implement the Inferior.corefile getter. Returns a gdb.Corefile
+ object, or None. */
+
+static PyObject *
+infpy_get_core_file (PyObject *self, void *closure)
+{
+ inferior_object *inf = (inferior_object *) self;
+
+ INFPY_REQUIRE_VALID (inf);
+
+ inferior *inferior = inf->inferior;
+ gdb_assert (inferior != nullptr);
+
+ return gdbpy_core_file_from_inferior (inferior).release ();
+}
+
static void
infpy_dealloc (PyObject *obj)
{
@@ -1062,6 +1078,8 @@ static gdb_PyGetSetDef inferior_object_getset[] =
{ "progspace", infpy_get_progspace, NULL, "Program space of this inferior" },
{ "main_name", infpy_get_main_name, nullptr,
"Name of 'main' function, if known.", nullptr },
+ { "corefile", infpy_get_core_file, nullptr,
+ "The corefile loaded in to this inferior, or None.", nullptr },
{ NULL }
};
diff --git a/gdb/python/py-infevents.c b/gdb/python/py-infevents.c
index f53d589..f74fb01 100644
--- a/gdb/python/py-infevents.c
+++ b/gdb/python/py-infevents.c
@@ -1,6 +1,6 @@
/* Python interface to inferior function events.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -40,7 +40,7 @@ create_inferior_call_event_object (inferior_call_kind flag, ptid_t ptid,
gdb_assert_not_reached ("invalid inferior_call_kind");
}
- gdbpy_ref<> ptid_obj (gdbpy_create_ptid_object (ptid));
+ gdbpy_ref<> ptid_obj = gdbpy_create_ptid_object (ptid);
if (ptid_obj == NULL)
return NULL;
diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c
index 4340666..08533fe 100644
--- a/gdb/python/py-infthread.c
+++ b/gdb/python/py-infthread.c
@@ -1,6 +1,6 @@
/* Python interface to inferior threads.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -190,7 +190,7 @@ thpy_get_ptid (PyObject *self, void *closure)
THPY_REQUIRE_VALID (thread_obj);
- return gdbpy_create_ptid_object (thread_obj->thread->ptid);
+ return gdbpy_create_ptid_object (thread_obj->thread->ptid).release ();
}
/* Implement gdb.InferiorThread.ptid_string attribute. */
@@ -361,23 +361,14 @@ thpy_repr (PyObject *self)
target_pid_to_str (thr->ptid).c_str ());
}
-/* Return a reference to a new Python object representing a ptid_t.
- The object is a tuple containing (pid, lwp, tid). */
-PyObject *
+/* See python-internal.h. */
+
+gdbpy_ref<>
gdbpy_create_ptid_object (ptid_t ptid)
{
- int pid;
- long lwp;
- ULONGEST tid;
- PyObject *ret;
-
- ret = PyTuple_New (3);
- if (!ret)
- return NULL;
-
- pid = ptid.pid ();
- lwp = ptid.lwp ();
- tid = ptid.tid ();
+ int pid = ptid.pid ();
+ long lwp = ptid.lwp ();
+ ULONGEST tid = ptid.tid ();
gdbpy_ref<> pid_obj = gdb_py_object_from_longest (pid);
if (pid_obj == nullptr)
@@ -389,10 +380,14 @@ gdbpy_create_ptid_object (ptid_t ptid)
if (tid_obj == nullptr)
return nullptr;
+ gdbpy_ref<> ret (PyTuple_New (3));
+ if (ret == nullptr)
+ return nullptr;
+
/* Note that these steal references, hence the use of 'release'. */
- PyTuple_SET_ITEM (ret, 0, pid_obj.release ());
- PyTuple_SET_ITEM (ret, 1, lwp_obj.release ());
- PyTuple_SET_ITEM (ret, 2, tid_obj.release ());
+ PyTuple_SET_ITEM (ret.get (), 0, pid_obj.release ());
+ PyTuple_SET_ITEM (ret.get (), 1, lwp_obj.release ());
+ PyTuple_SET_ITEM (ret.get (), 2, tid_obj.release ());
return ret;
}
diff --git a/gdb/python/py-instruction.c b/gdb/python/py-instruction.c
index 7d77572..60cd561 100644
--- a/gdb/python/py-instruction.c
+++ b/gdb/python/py-instruction.c
@@ -1,6 +1,6 @@
/* Python interface to instruction objects.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-instruction.h b/gdb/python/py-instruction.h
index efbdda8..8baf9cb 100644
--- a/gdb/python/py-instruction.h
+++ b/gdb/python/py-instruction.h
@@ -1,6 +1,6 @@
/* Python interface to instruction objects.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-lazy-string.c b/gdb/python/py-lazy-string.c
index d75f861..265f34a 100644
--- a/gdb/python/py-lazy-string.c
+++ b/gdb/python/py-lazy-string.c
@@ -1,6 +1,6 @@
/* Python interface to lazy strings.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-linetable.c b/gdb/python/py-linetable.c
index fc57f36..90cba09 100644
--- a/gdb/python/py-linetable.c
+++ b/gdb/python/py-linetable.c
@@ -1,6 +1,6 @@
/* Python interface to line tables.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-membuf.c b/gdb/python/py-membuf.c
index 25ebc99..817dfba 100644
--- a/gdb/python/py-membuf.c
+++ b/gdb/python/py-membuf.c
@@ -1,6 +1,6 @@
/* Python memory buffer interface for reading inferior memory.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-mi.c b/gdb/python/py-mi.c
index cf75a18..b2ab4e2 100644
--- a/gdb/python/py-mi.c
+++ b/gdb/python/py-mi.c
@@ -1,6 +1,6 @@
/* Python interface to MI commands
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -218,11 +218,11 @@ py_object_to_mi_key (PyObject *key_obj)
{
gdb_assert (name != nullptr);
- if (*name == '\0' || !isalpha (*name))
+ if (*name == '\0' || !c_isalpha (*name))
return false;
for (; *name != '\0'; ++name)
- if (!isalnum (*name) && *name != '_' && *name != '-')
+ if (!c_isalnum (*name) && *name != '_' && *name != '-')
return false;
return true;
@@ -363,7 +363,7 @@ gdbpy_notify_mi (PyObject *self, PyObject *args, PyObject *kwargs)
}
for (int i = 0; i < name_len; i++)
{
- if (!isalnum (name[i]) && name[i] != '-')
+ if (!c_isalnum (name[i]) && name[i] != '-')
{
PyErr_Format
(PyExc_ValueError,
diff --git a/gdb/python/py-micmd.c b/gdb/python/py-micmd.c
index e051b90..07db0cc 100644
--- a/gdb/python/py-micmd.c
+++ b/gdb/python/py-micmd.c
@@ -1,6 +1,6 @@
/* MI Command Set for GDB, the GNU debugger.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -350,7 +350,7 @@ micmdpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
PyErr_SetString (PyExc_ValueError, _("MI command name is empty."));
return -1;
}
- else if ((name_len < 2) || (name[0] != '-') || !isalnum (name[1]))
+ else if ((name_len < 2) || (name[0] != '-') || !c_isalnum (name[1]))
{
PyErr_SetString (PyExc_ValueError,
_("MI command name does not start with '-'"
@@ -361,7 +361,7 @@ micmdpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
{
for (int i = 2; i < name_len; i++)
{
- if (!isalnum (name[i]) && name[i] != '-')
+ if (!c_isalnum (name[i]) && name[i] != '-')
{
PyErr_Format
(PyExc_ValueError,
@@ -578,9 +578,7 @@ PyTypeObject micmdpy_object_type = {
0, /* tp_alloc */
};
-void _initialize_py_micmd ();
-void
-_initialize_py_micmd ()
+INIT_GDB_FILE (py_micmd)
{
add_setshow_boolean_cmd
("py-micmd", class_maintenance, &pymicmd_debug,
diff --git a/gdb/python/py-newobjfileevent.c b/gdb/python/py-newobjfileevent.c
index deaee70..b2071f96 100644
--- a/gdb/python/py-newobjfileevent.c
+++ b/gdb/python/py-newobjfileevent.c
@@ -1,6 +1,6 @@
/* Python interface to new object file loading events.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
index 6ce58a1..a9f5754 100644
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -1,6 +1,6 @@
/* Python interface to objfiles.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -556,7 +556,7 @@ objfpy_build_id_ok (const char *string)
return 0;
for (i = 0; i < n; ++i)
{
- if (!isxdigit (string[i]))
+ if (!c_isxdigit (string[i]))
return 0;
}
return 1;
@@ -619,9 +619,8 @@ gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw)
struct objfile *objfile = nullptr;
if (by_build_id)
- gdbarch_iterate_over_objfiles_in_search_order
- (current_inferior ()->arch (),
- [&objfile, name] (struct objfile *obj)
+ current_program_space->iterate_over_objfiles_in_search_order
+ ([&objfile, name] (struct objfile *obj)
{
/* Don't return separate debug files. */
if (obj->separate_debug_objfile_backlink != nullptr)
@@ -642,9 +641,8 @@ gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw)
return 1;
}, gdbpy_current_objfile);
else
- gdbarch_iterate_over_objfiles_in_search_order
- (current_inferior ()->arch (),
- [&objfile, name] (struct objfile *obj)
+ current_program_space->iterate_over_objfiles_in_search_order
+ ([&objfile, name] (struct objfile *obj)
{
/* Don't return separate debug files. */
if (obj->separate_debug_objfile_backlink != nullptr)
diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c
index 0e79d21..06237b6 100644
--- a/gdb/python/py-param.c
+++ b/gdb/python/py-param.c
@@ -1,6 +1,6 @@
/* GDB parameters implemented in Python
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -495,7 +495,11 @@ get_doc_string (PyObject *object, enum doc_string_type doc_type,
}
}
- if (result == nullptr)
+ /* For the set/show docs, if these strings are empty then we set then to
+ a non-empty string. This ensures that the command has some sane
+ documentation for its 'help' text. */
+ if (result == nullptr
+ || (doc_type != doc_string_description && *result == '\0'))
{
if (doc_type == doc_string_description)
result.reset (xstrdup (_("This command is not documented.")));
@@ -904,6 +908,18 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
show_doc = get_doc_string (self, doc_string_show, name);
doc = get_doc_string (self, doc_string_description, cmd_name.get ());
+ /* The set/show docs should always be a non-empty string. */
+ gdb_assert (set_doc != nullptr && *set_doc != '\0');
+ gdb_assert (show_doc != nullptr && *show_doc != '\0');
+
+ /* For the DOC string only, if it is the empty string, then we convert it
+ to NULL. This means GDB will not even display a blank line for this
+ part of the help text, instead the set/show line is all the user will
+ get. */
+ gdb_assert (doc != nullptr);
+ if (*doc == '\0')
+ doc = nullptr;
+
Py_INCREF (self);
try
diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c
index e061ea1..e2bfd6b 100644
--- a/gdb/python/py-prettyprint.c
+++ b/gdb/python/py-prettyprint.c
@@ -1,6 +1,6 @@
/* Python pretty-printing
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -98,9 +98,9 @@ search_pp_list (PyObject *list, PyObject *value)
static PyObject *
find_pretty_printer_from_objfiles (PyObject *value)
{
- for (objfile *obj : current_program_space->objfiles ())
+ for (objfile &obj : current_program_space->objfiles ())
{
- gdbpy_ref<> objf = objfile_to_objfile_object (obj);
+ gdbpy_ref<> objf = objfile_to_objfile_object (&obj);
if (objf == NULL)
{
/* Ignore the error and continue. */
diff --git a/gdb/python/py-progspace.c b/gdb/python/py-progspace.c
index 4dbe18e..9f3e45c 100644
--- a/gdb/python/py-progspace.c
+++ b/gdb/python/py-progspace.c
@@ -1,6 +1,6 @@
/* Python interface to program spaces.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -431,9 +431,9 @@ pspy_get_objfiles (PyObject *self_, PyObject *args)
if (self->pspace != NULL)
{
- for (objfile *objf : self->pspace->objfiles ())
+ for (objfile &objf : self->pspace->objfiles ())
{
- gdbpy_ref<> item = objfile_to_objfile_object (objf);
+ gdbpy_ref<> item = objfile_to_objfile_object (&objf);
if (item == nullptr
|| PyList_Append (list.get (), item.get ()) == -1)
diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c
index bdfebf1..620f033 100644
--- a/gdb/python/py-record-btrace.c
+++ b/gdb/python/py-record-btrace.c
@@ -1,6 +1,6 @@
/* Python interface to btrace instruction history.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-record-btrace.h b/gdb/python/py-record-btrace.h
index 30465bb..e5a1b10 100644
--- a/gdb/python/py-record-btrace.h
+++ b/gdb/python/py-record-btrace.h
@@ -1,6 +1,6 @@
/* Python interface to btrace record targets.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-record-full.c b/gdb/python/py-record-full.c
index b6623a6..dd23055 100644
--- a/gdb/python/py-record-full.c
+++ b/gdb/python/py-record-full.c
@@ -1,6 +1,6 @@
/* Python interface to btrace instruction history.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-record-full.h b/gdb/python/py-record-full.h
index df95776..aa07b3a 100644
--- a/gdb/python/py-record-full.h
+++ b/gdb/python/py-record-full.h
@@ -1,6 +1,6 @@
/* Python interface to full record targets.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-record.c b/gdb/python/py-record.c
index 2995dc1..89c2e77 100644
--- a/gdb/python/py-record.c
+++ b/gdb/python/py-record.c
@@ -1,6 +1,6 @@
/* Python interface to record targets.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -696,6 +696,9 @@ gdbpy_current_recording (PyObject *self, PyObject *args)
Py_RETURN_NONE;
ret = PyObject_New (recpy_record_object, &recpy_record_type);
+ if (ret == nullptr)
+ return nullptr;
+
ret->thread = inferior_thread ();
ret->method = target_record_method (ret->thread->ptid);
diff --git a/gdb/python/py-record.h b/gdb/python/py-record.h
index 1492de6..98e4863 100644
--- a/gdb/python/py-record.h
+++ b/gdb/python/py-record.h
@@ -1,6 +1,6 @@
/* Python interface to record targets.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-ref.h b/gdb/python/py-ref.h
index 938068e..04e8b82 100644
--- a/gdb/python/py-ref.h
+++ b/gdb/python/py-ref.h
@@ -1,6 +1,6 @@
/* Python reference-holding class
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-registers.c b/gdb/python/py-registers.c
index 75f99e5..9be2e3c 100644
--- a/gdb/python/py-registers.c
+++ b/gdb/python/py-registers.c
@@ -1,6 +1,6 @@
/* Python interface to register, and register group information.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -403,8 +403,7 @@ gdbpy_parse_register_id (struct gdbarch *gdbarch, PyObject *pyo_reg_id,
PyErr_SetString (PyExc_ValueError, "Bad register");
}
/* The register could be a gdb.RegisterDescriptor object. */
- else if (PyObject_IsInstance (pyo_reg_id,
- (PyObject *) &register_descriptor_object_type))
+ else if (PyObject_TypeCheck (pyo_reg_id, &register_descriptor_object_type))
{
register_descriptor_object *reg
= (register_descriptor_object *) pyo_reg_id;
diff --git a/gdb/python/py-signalevent.c b/gdb/python/py-signalevent.c
index bf51106..5d58aa1 100644
--- a/gdb/python/py-signalevent.c
+++ b/gdb/python/py-signalevent.c
@@ -1,6 +1,6 @@
/* Python interface to inferior signal stop events.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-stopevent.c b/gdb/python/py-stopevent.c
index 485bbb1..e49f240 100644
--- a/gdb/python/py-stopevent.c
+++ b/gdb/python/py-stopevent.c
@@ -1,6 +1,6 @@
/* Python interface to inferior stop events.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-stopevent.h b/gdb/python/py-stopevent.h
index 450d8c2..fbfa87e 100644
--- a/gdb/python/py-stopevent.h
+++ b/gdb/python/py-stopevent.h
@@ -1,6 +1,6 @@
/* Python interface to inferior events.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-style.c b/gdb/python/py-style.c
new file mode 100644
index 0000000..b10a45f
--- /dev/null
+++ b/gdb/python/py-style.c
@@ -0,0 +1,818 @@
+/* Python interface to ui_file_style objects.
+
+ Copyright (C) 2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "python-internal.h"
+#include "ui-style.h"
+#include "py-color.h"
+#include "cli/cli-decode.h"
+#include "cli/cli-style.h"
+#include "top.h"
+
+/* Intensity constants and their values. */
+static struct {
+ const char *name;
+ ui_file_style::intensity value;
+} intensity_constants[] =
+{
+ { "INTENSITY_NORMAL", ui_file_style::NORMAL },
+ { "INTENSITY_DIM", ui_file_style::DIM },
+ { "INTENSITY_BOLD", ui_file_style::BOLD }
+};
+
+/* A style. */
+struct style_object
+{
+ PyObject_HEAD
+
+ /* Underlying style, only valid when STYLE_NAME is NULL. */
+ ui_file_style style;
+
+ /* The name of the style. Can be NULL, in which case STYLE holds the
+ style value. */
+ char *style_name;
+};
+
+extern PyTypeObject style_object_type;
+
+/* Initialize the 'style' module. */
+
+static int
+gdbpy_initialize_style ()
+{
+ for (auto &pair : intensity_constants)
+ if (PyModule_AddIntConstant (gdb_module, pair.name,
+ static_cast<long> (pair.value)) < 0)
+ return -1;
+
+ return gdbpy_type_ready (&style_object_type, gdb_module);
+}
+
+/* Free any resources help by SELF, and reset points to NULL. */
+
+static void
+stylepy_free_resources (PyObject *self)
+{
+ style_object *style = (style_object *) self;
+
+ xfree (style->style_name);
+ style->style_name = nullptr;
+}
+
+/* gdb.Style deallocation method. */
+
+static void
+stylepy_dealloc (PyObject *self)
+{
+ stylepy_free_resources (self);
+ Py_TYPE (self)->tp_free (self);
+}
+
+/* Find style NAME and return it. If NAME cannot be found then an empty
+ optional is returned, and a Python error will be set.
+
+ If HAS_INTENSITY_PTR is not NULL, then, if NAME is found,
+ *HAS_INTENSITY_PTR will be set true if NAME has an "intensity"
+ sub-command, and set false otherwise. If NAME is not found then
+ *HAS_INTENSITY_PTR is left unchanged.
+
+ If FOUND_CMD_PTR is not NULL, then, if NAME is found, *FOUND_CMD_PTR is
+ set to point to the prefix command matching NAME. If NAME is a
+ multi-word style name (e.g. 'disassembler comment') then *FOUND_CMD_PTR
+ will point to the prefix command for the last word (e.g. 'comment'). */
+
+static std::optional<ui_file_style>
+stylepy_style_from_name (const char *name, bool *has_intensity_ptr = nullptr,
+ const cmd_list_element **found_cmd_ptr = nullptr)
+{
+ std::string cmd_str = std::string ("show style ") + name;
+
+ struct cmd_list_element *cmd = nullptr;
+ struct cmd_list_element *alias = nullptr;
+ int found;
+ try
+ {
+ struct cmd_list_element *prefix;
+ found = lookup_cmd_composition (cmd_str.c_str (), &alias, &prefix, &cmd);
+ }
+ catch (const gdb_exception &ex)
+ {
+ PyErr_Format (PyExc_RuntimeError,
+ _("style '%s' cannot be found."), name);
+ return {};
+ }
+
+ gdb_assert (!found || cmd != nullptr);
+
+ if (!found || cmd == CMD_LIST_AMBIGUOUS || !cmd->is_prefix ())
+ {
+ PyErr_Format (PyExc_RuntimeError,
+ _("style '%s' cannot be found."), name);
+ return {};
+ }
+
+ ui_file_style style;
+ bool has_fg = false;
+ bool has_bg = false;
+ bool has_intensity = false;
+ for (cmd_list_element *sub = *cmd->subcommands;
+ sub != nullptr;
+ sub = sub->next)
+ {
+ if (!sub->var.has_value ())
+ continue;
+
+ if (strcmp (sub->name, "foreground") == 0)
+ {
+ const ui_file_style::color &color
+ = sub->var->get<ui_file_style::color> ();
+ style.set_fg (color);
+ has_fg = true;
+ }
+ else if (strcmp (sub->name, "background") == 0)
+ {
+ const ui_file_style::color &color
+ = sub->var->get<ui_file_style::color> ();
+ style.set_bg (color);
+ has_bg = true;
+ }
+ else if (strcmp (sub->name, "intensity") == 0
+ && sub->var->type () == var_enum)
+ {
+ const char *intensity_str = sub->var->get<const char *> ();
+ ui_file_style::intensity intensity = ui_file_style::NORMAL;
+ if (strcmp (intensity_str, "bold") == 0)
+ intensity = ui_file_style::BOLD;
+ else if (strcmp (intensity_str, "dim") == 0)
+ intensity = ui_file_style::DIM;
+ style.set_intensity (intensity);
+ has_intensity = true;
+ }
+ }
+
+ /* All styles should have a foreground and background, but the intensity
+ is optional. */
+ if (!has_fg || !has_bg)
+ {
+ PyErr_Format (PyExc_RuntimeError,
+ _("style '%s' missing '%s' component."), name,
+ (has_fg ? "background" : "foreground"));
+ return {};
+ }
+
+ if (has_intensity_ptr != nullptr)
+ *has_intensity_ptr = has_intensity;
+
+ /* If NAME identified an alias then use that instead of CMD, this means
+ the style's cached name will better match the string the user used to
+ initialise the style. */
+ if (found_cmd_ptr != nullptr)
+ *found_cmd_ptr = alias != nullptr ? alias : cmd;
+
+ return style;
+}
+
+/* Initialise a gdb.Style object from a named style. We only store the
+ style name within SELF, each time the style is used, we look up its
+ current value, this allows the style to change if the user adjusts the
+ settings. */
+
+static int
+stylepy_init_from_style_name (PyObject *self, const char *style_name)
+{
+ style_object *style = (style_object *) self;
+ gdb_assert (style->style_name == nullptr);
+
+ gdb_assert (style_name != nullptr);
+
+ const cmd_list_element *cmd = nullptr;
+ std::optional<ui_file_style> maybe_style
+ = stylepy_style_from_name (style_name, nullptr, &cmd);
+ if (!maybe_style.has_value ())
+ return -1;
+
+ /* If we found a style then we must have found a prefix command. */
+ gdb_assert (cmd != nullptr);
+ gdb_assert (cmd->is_prefix ());
+
+ /* Get the components of this command. */
+ std::vector<std::string> components = cmd->command_components ();
+ gdb_assert (components.size () > 2);
+ gdb_assert (components[0] == "show");
+ gdb_assert (components[1] == "style");
+
+ /* And build the components into a string, but without the 'show style'
+ part at the start. */
+ std::string expanded_style_name (components[2]);
+ for (int i = 3; i < components.size (); ++i)
+ expanded_style_name += " " + components[i];
+
+ style->style_name = xstrdup (expanded_style_name.c_str ());
+
+ return 0;
+}
+
+/* Convert INTENSITY_VALUE to a valid intensity enum value, if possible,
+ and return the enum value. If INTENSITY_VALUE is not a valid intensity
+ value then set a Python error, and return an empty optional. */
+
+static std::optional<ui_file_style::intensity>
+stylepy_long_to_intensity (long intensity_value)
+{
+ switch (intensity_value)
+ {
+ case ui_file_style::NORMAL:
+ case ui_file_style::DIM:
+ case ui_file_style::BOLD:
+ return static_cast<ui_file_style::intensity> (intensity_value);
+
+ default:
+ PyErr_Format
+ (PyExc_ValueError, _("invalid 'intensity' value %d."),
+ intensity_value);
+ return {};
+ }
+}
+
+/* Initialise a gdb.Style object from a foreground and background
+ gdb.Color object, and an intensity. */
+
+static int
+stylepy_init_from_parts (PyObject *self, PyObject *fg, PyObject *bg,
+ int intensity_value)
+{
+ style_object *style = (style_object *) self;
+ gdb_assert (style->style_name == nullptr);
+
+ if (fg == Py_None)
+ fg = nullptr;
+
+ if (bg == Py_None)
+ bg = nullptr;
+
+ if (fg != nullptr && !gdbpy_is_color (fg))
+ {
+ PyErr_Format
+ (PyExc_TypeError,
+ _("'foreground' argument must be gdb.Color or None, not %s."),
+ Py_TYPE (fg)->tp_name);
+ return -1;
+ }
+
+ if (bg != nullptr && !gdbpy_is_color (bg))
+ {
+ PyErr_Format
+ (PyExc_TypeError,
+ _("'background' argument must be gdb.Color or None, not %s."),
+ Py_TYPE (bg)->tp_name);
+ return -1;
+ }
+
+ if (fg != nullptr)
+ style->style.set_fg (gdbpy_get_color (fg));
+ else
+ style->style.set_fg (ui_file_style::color (ui_file_style::NONE));
+
+ if (bg != nullptr)
+ style->style.set_bg (gdbpy_get_color (bg));
+ else
+ style->style.set_bg (ui_file_style::color (ui_file_style::NONE));
+
+ /* Convert INTENSITY_VALUE into the enum. */
+ std::optional<ui_file_style::intensity> intensity
+ = stylepy_long_to_intensity (intensity_value);
+ if (!intensity.has_value ())
+ return -1;
+ style->style.set_intensity (intensity.value ());
+
+ return 0;
+}
+
+/* gdb.Style object initializer. Either:
+ gdb.Style.__init__("style name")
+ gdb.Style.__init__(fg, bg, intensity)
+
+ This init function supports two possible sets of arguments. Both
+ options are different enough that we can distinguish the two by the
+ argument types. Dispatch to one of the two stylepy_init_from_*
+ functions above. */
+
+static int
+stylepy_init (PyObject *self, PyObject *args, PyObject *kwargs)
+{
+ /* If this object was previously initialised, then clear it out now. */
+ stylepy_free_resources (self);
+
+ /* Try to parse the incoming arguments as a string, this is a style
+ name. */
+ const char *style_name = nullptr;
+ static const char *keywords_style[] = { "style", nullptr };
+ if (gdb_PyArg_ParseTupleAndKeywords (args, kwargs, "s", keywords_style,
+ &style_name))
+ return stylepy_init_from_style_name (self, style_name);
+
+ /* That didn't work, discard any errors. */
+ PyErr_Clear ();
+
+ /* Try to parse the incoming arguments as a list of parts, this is an
+ unnamed style. */
+ PyObject *foreground_color = nullptr;
+ PyObject *background_color = nullptr;
+ int intensity_value = static_cast<int> (ui_file_style::NORMAL);
+ static const char *keywords_parts[]
+ = { "foreground", "background", "intensity", nullptr };
+ if (gdb_PyArg_ParseTupleAndKeywords (args, kwargs, "|OOi", keywords_parts,
+ &foreground_color,
+ &background_color,
+ &intensity_value))
+ return stylepy_init_from_parts (self, foreground_color,
+ background_color, intensity_value);
+
+ /* Return the error gdb_PyArg_ParseTupleAndKeywords set. */
+ return -1;
+}
+
+
+
+/* See python-internal.h. */
+
+bool
+gdbpy_is_style (PyObject *obj)
+{
+ gdb_assert (obj != nullptr);
+ return PyObject_TypeCheck (obj, &style_object_type);
+}
+
+/* Return the ui_file_style for STYLEPY. If the style cannot be found,
+ then return an empty optional, and set a Python error. */
+
+static std::optional<ui_file_style>
+stylepy_to_style (style_object *stylepy)
+{
+ std::optional<ui_file_style> style;
+
+ if (stylepy->style_name != nullptr)
+ style = stylepy_style_from_name (stylepy->style_name);
+ else
+ style.emplace (stylepy->style);
+
+ return style;
+}
+
+/* See python-internal.h. */
+
+std::optional<ui_file_style>
+gdbpy_style_object_to_ui_file_style (PyObject *obj)
+{
+ gdb_assert (obj != nullptr);
+ gdb_assert (gdbpy_is_style (obj));
+
+ style_object *style_obj = (style_object *) obj;
+ return stylepy_to_style (style_obj);
+}
+
+/* Implementation of gdb.Style.escape_sequence(). Return the escape
+ sequence to apply Style. If styling is turned off, then this returns
+ the empty string. Can raise an exception if a named style can no longer
+ be read. */
+
+static PyObject *
+stylepy_escape_sequence (PyObject *self, PyObject *args)
+{
+ style_object *style_obj = (style_object *) self;
+
+ std::optional<ui_file_style> style = stylepy_to_style (style_obj);
+ if (!style.has_value ())
+ return nullptr;
+
+ std::string style_str;
+ if (term_cli_styling ())
+ style_str = style->to_ansi ();
+
+ return host_string_to_python_string (style_str.c_str ()).release ();
+}
+
+/* Implement gdb.Style.apply(STR). Return a new string which is STR with
+ escape sequences added so that STR is formatted in this style. A
+ trailing escape sequence is added to restore the default style.
+
+ If styling is currently disabled ('set style enabled off'), then no
+ escape sequences are added, but all the checks for the validity of the
+ current style are still performed, and a new string, a copy of the
+ input string is returned.
+
+ Can raise a Python exception and return NULL if the argument types are
+ wrong, or if a named style can no longer be read. */
+
+static PyObject *
+stylepy_apply (PyObject *self, PyObject *args, PyObject *kw)
+{
+ style_object *style_obj = (style_object *) self;
+
+ static const char *keywords[] = { "string", nullptr };
+ PyObject *input_obj;
+
+ /* Grab the incoming string as a Python object. In the case where
+ styling is not being applied we can just return this object with the
+ reference count incremented. */
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "O!", keywords,
+ &PyUnicode_Type, &input_obj))
+ return nullptr;
+
+ std::optional<ui_file_style> style = stylepy_to_style (style_obj);
+ if (!style.has_value ())
+ return nullptr;
+
+ if (gdb_stdout->can_emit_style_escape ())
+ {
+ gdb_assert (gdbpy_is_string (input_obj));
+ gdb::unique_xmalloc_ptr<char>
+ input (python_string_to_host_string (input_obj));
+
+ std::string output
+ = style->to_ansi () + input.get () + ui_file_style ().to_ansi ();
+
+ return host_string_to_python_string (output.c_str ()).release ();
+ }
+ else
+ {
+ /* Return an unmodified "copy" of INPUT_OBJ by just incrementing the
+ reference count. */
+ Py_INCREF (input_obj);
+ return input_obj;
+ }
+}
+
+
+
+/* Implement reading the gdb.Style.foreground attribute. */
+
+static PyObject *
+stylepy_get_foreground (PyObject *self, void *closure)
+{
+ style_object *style_obj = (style_object *) self;
+
+ std::optional<ui_file_style> style = stylepy_to_style (style_obj);
+ if (!style.has_value ())
+ return nullptr;
+
+ gdbpy_ref<> color = create_color_object (style->get_foreground ());
+ if (color == nullptr)
+ return nullptr;
+
+ return color.release ();
+}
+
+/* Implement writing the gdb.Style.foreground attribute. */
+
+static int
+stylepy_set_foreground (PyObject *self, PyObject *newvalue, void *closure)
+{
+ if (!gdbpy_is_color (newvalue))
+ {
+ PyErr_Format (PyExc_TypeError, _("value must be gdb.Color, not %s"),
+ Py_TYPE (newvalue)->tp_name);
+ return -1;
+ }
+
+ style_object *style_obj = (style_object *) self;
+
+ /* Handle unnamed styles. This is easy, just update the embedded style
+ object. */
+ if (style_obj->style_name == nullptr)
+ {
+ style_obj->style.set_fg (gdbpy_get_color (newvalue));
+ return 0;
+ }
+
+ /* Handle named styles. This is harder, we need to write to the actual
+ parameter. */
+ std::string cmd_string
+ = string_printf ("set style %s foreground %s",
+ style_obj->style_name,
+ gdbpy_get_color (newvalue).to_string ().c_str ());
+ try
+ {
+ execute_command (cmd_string.c_str (), 0);
+ }
+ catch (const gdb_exception &except)
+ {
+ return gdbpy_handle_gdb_exception (-1, except);
+ }
+
+ return 0;
+}
+
+/* Implement reading the gdb.Style.background attribute. */
+
+static PyObject *
+stylepy_get_background (PyObject *self, void *closure)
+{
+ style_object *style_obj = (style_object *) self;
+
+ std::optional<ui_file_style> style = stylepy_to_style (style_obj);
+ if (!style.has_value ())
+ return nullptr;
+
+ gdbpy_ref<> color = create_color_object (style->get_background ());
+ if (color == nullptr)
+ return nullptr;
+
+ return color.release ();
+}
+
+/* Implement writing the gdb.Style.background attribute. */
+
+static int
+stylepy_set_background (PyObject *self, PyObject *newvalue, void *closure)
+{
+ if (!gdbpy_is_color (newvalue))
+ {
+ PyErr_Format (PyExc_TypeError, _("value must be gdb.Color, not %s"),
+ Py_TYPE (newvalue)->tp_name);
+ return -1;
+ }
+
+ style_object *style_obj = (style_object *) self;
+
+ /* Handle unnamed styles. This is easy, just update the embedded style
+ object. */
+ if (style_obj->style_name == nullptr)
+ {
+ style_obj->style.set_bg (gdbpy_get_color (newvalue));
+ return 0;
+ }
+
+ /* Handle named styles. This is harder, we need to write to the actual
+ parameter. */
+ std::string cmd_string
+ = string_printf ("set style %s background %s",
+ style_obj->style_name,
+ gdbpy_get_color (newvalue).to_string ().c_str ());
+ try
+ {
+ execute_command (cmd_string.c_str (), 0);
+ }
+ catch (const gdb_exception &except)
+ {
+ return gdbpy_handle_gdb_exception (-1, except);
+ }
+
+ return 0;
+}
+
+/* Implement reading the gdb.Style.intensity attribute. */
+
+static PyObject *
+stylepy_get_intensity (PyObject *self, void *closure)
+{
+ style_object *style_obj = (style_object *) self;
+
+ std::optional<ui_file_style> style = stylepy_to_style (style_obj);
+ if (!style.has_value ())
+ return nullptr;
+
+ ui_file_style::intensity intensity = style->get_intensity ();
+ return PyLong_FromLong (static_cast<long> (intensity));
+}
+
+/* Return a string representing INTENSITY. */
+
+static const char *
+stylepy_intensity_to_string (ui_file_style::intensity intensity)
+{
+ const char *intensity_str = nullptr;
+ switch (intensity)
+ {
+ case ui_file_style::NORMAL:
+ intensity_str = "normal";
+ break;
+ case ui_file_style::BOLD:
+ intensity_str = "bold";
+ break;
+ case ui_file_style::DIM:
+ intensity_str = "dim";
+ break;
+ }
+
+ gdb_assert (intensity_str != nullptr);
+ return intensity_str;
+}
+
+/* Implement writing the gdb.Style.intensity attribute. */
+
+static int
+stylepy_set_intensity (PyObject *self, PyObject *newvalue, void *closure)
+{
+ style_object *style_obj = (style_object *) self;
+
+ if (!PyLong_Check (newvalue))
+ {
+ PyErr_Format
+ (PyExc_TypeError,
+ _("value must be a Long (a gdb.INTENSITY constant), not %s"),
+ Py_TYPE (newvalue)->tp_name);
+ return -1;
+ }
+
+ /* Convert the Python object to a value we can use. */
+ long intensity_value;
+ if (!gdb_py_int_as_long (newvalue, &intensity_value))
+ return -1;
+
+ std::optional<ui_file_style::intensity> intensity
+ = stylepy_long_to_intensity (intensity_value);
+ if (!intensity.has_value ())
+ return -1;
+
+ /* Handle unnamed styles. This is easy, just update the embedded style
+ object. */
+ if (style_obj->style_name == nullptr)
+ {
+ style_obj->style.set_intensity (intensity.value ());
+ return 0;
+ }
+
+ /* Handle named styles. This is harder, we need to write to the actual
+ parameter. First though, look up the named style to see if it has an
+ intensity. HAS_INTENSITY will be set true only if the style exists,
+ and has an 'intensity' setting. */
+ bool has_intensity = false;
+ std::optional<ui_file_style> style
+ = stylepy_style_from_name (style_obj->style_name, &has_intensity);
+ if (!style.has_value ())
+ return -1;
+ if (!has_intensity)
+ {
+ PyErr_Format
+ (PyExc_ValueError, "the intensity of style '%s' is not writable.",
+ style_obj->style_name);
+ return -1;
+ }
+
+ const char *intensity_str = stylepy_intensity_to_string (intensity.value ());
+ gdb_assert (intensity_str != nullptr);
+
+ std::string cmd_string
+ = string_printf ("set style %s intensity %s",
+ style_obj->style_name, intensity_str);
+ try
+ {
+ execute_command (cmd_string.c_str (), 0);
+ }
+ catch (const gdb_exception &except)
+ {
+ return gdbpy_handle_gdb_exception (-1, except);
+ }
+
+ return 0;
+}
+
+
+
+/* Call FETCH_ATTR, passing in SELF, to get a PyObject*, then convert it to
+ a Python string, and finally into a C++ managed string. Will return
+ nullptr and set a Python error if something goes wrong.
+
+ The FETCH_ATTR function will be a function that returns an attribute
+ from SELF. */
+
+static gdb::unique_xmalloc_ptr<char>
+stylepy_attribute_to_string
+ (PyObject *self,
+ gdb::function_view<PyObject * (PyObject *, void *)> fetch_attr)
+{
+ PyObject *attr_obj = fetch_attr (self, nullptr);
+ if (attr_obj == nullptr)
+ return nullptr;
+
+ PyObject *str_obj = PyObject_Str (attr_obj);
+ if (str_obj == nullptr)
+ return nullptr;
+
+ return python_string_to_host_string (str_obj);
+}
+
+/* __repr__ implementation for gdb.Style. */
+
+static PyObject *
+stylepy_repr (PyObject *self)
+{
+ style_object *style_obj = (style_object *) self;
+
+ gdb::unique_xmalloc_ptr<char> fg_str
+ (stylepy_attribute_to_string (self, stylepy_get_foreground));
+ gdb::unique_xmalloc_ptr<char> bg_str
+ (stylepy_attribute_to_string (self, stylepy_get_background));
+
+ PyObject *intensity_obj = stylepy_get_intensity (self, nullptr);
+ if (intensity_obj == nullptr)
+ return nullptr;
+ gdb_assert (PyLong_Check (intensity_obj));
+ long intensity_value;
+ if (!gdb_py_int_as_long (intensity_obj, &intensity_value))
+ return nullptr;
+ std::optional<ui_file_style::intensity> intensity
+ = stylepy_long_to_intensity (intensity_value);
+ if (!intensity.has_value ())
+ return nullptr;
+ const char *intensity_str = stylepy_intensity_to_string (intensity.value ());
+ gdb_assert (intensity_str != nullptr);
+
+ if (style_obj->style_name == nullptr)
+ return PyUnicode_FromFormat ("<%s fg=%s, bg=%s, intensity=%s>",
+ Py_TYPE (self)->tp_name,
+ fg_str.get (), bg_str.get (),
+ intensity_str);
+ else
+ return PyUnicode_FromFormat ("<%s name='%s', fg=%s, bg=%s, intensity=%s>",
+ Py_TYPE (self)->tp_name,
+ style_obj->style_name, fg_str.get (),
+ bg_str.get (), intensity_str);
+}
+
+
+
+/* Style methods. */
+
+static PyMethodDef stylepy_methods[] =
+{
+ { "escape_sequence", stylepy_escape_sequence, METH_NOARGS,
+ "escape_sequence () -> str.\n\
+Return the ANSI escape sequence for this style."},
+ { "apply", (PyCFunction) stylepy_apply, METH_VARARGS | METH_KEYWORDS,
+ "apply(String) -> String.\n\
+Apply this style to the input string. Return an updated string."},
+ {nullptr}
+};
+
+/* Attribute get/set Python definitions. */
+
+static gdb_PyGetSetDef style_object_getset[] = {
+ { "foreground", stylepy_get_foreground, stylepy_set_foreground,
+ "The gdb.Color for the foreground of this style.", NULL },
+ { "background", stylepy_get_background, stylepy_set_background,
+ "The gdb.Color for the background of this style.", NULL },
+ { "intensity", stylepy_get_intensity, stylepy_set_intensity,
+ "The Str for the intensity of this style.", NULL },
+ { nullptr } /* Sentinel. */
+};
+
+PyTypeObject style_object_type =
+{
+ PyVarObject_HEAD_INIT (nullptr, 0)
+ "gdb.Style", /*tp_name*/
+ sizeof (style_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ stylepy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ stylepy_repr, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB style object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ stylepy_methods, /* tp_methods */
+ 0, /* tp_members */
+ style_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ stylepy_init, /* tp_init */
+ 0, /* tp_alloc */
+ PyType_GenericNew /* tp_new */
+};
+
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_style);
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 3028a30..b95071f 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -126,7 +126,7 @@ sympy_get_addr_class (PyObject *self, void *closure)
SYMPY_REQUIRE_VALID (self, symbol);
- return gdb_py_object_from_longest (symbol->aclass ()).release ();
+ return gdb_py_object_from_longest (symbol->loc_class ()).release ();
}
/* Implement gdb.Symbol.domain attribute. Return the domain as an
@@ -156,42 +156,39 @@ static PyObject *
sympy_is_constant (PyObject *self, void *closure)
{
struct symbol *symbol = NULL;
- enum address_class theclass;
SYMPY_REQUIRE_VALID (self, symbol);
- theclass = symbol->aclass ();
+ location_class loc_class = symbol->loc_class ();
- return PyBool_FromLong (theclass == LOC_CONST || theclass == LOC_CONST_BYTES);
+ return PyBool_FromLong (loc_class == LOC_CONST || loc_class == LOC_CONST_BYTES);
}
static PyObject *
sympy_is_function (PyObject *self, void *closure)
{
struct symbol *symbol = NULL;
- enum address_class theclass;
SYMPY_REQUIRE_VALID (self, symbol);
- theclass = symbol->aclass ();
+ location_class loc_class = symbol->loc_class ();
- return PyBool_FromLong (theclass == LOC_BLOCK);
+ return PyBool_FromLong (loc_class == LOC_BLOCK);
}
static PyObject *
sympy_is_variable (PyObject *self, void *closure)
{
struct symbol *symbol = NULL;
- enum address_class theclass;
SYMPY_REQUIRE_VALID (self, symbol);
- theclass = symbol->aclass ();
+ location_class loc_class = symbol->loc_class ();
return PyBool_FromLong (!symbol->is_argument ()
- && (theclass == LOC_LOCAL || theclass == LOC_REGISTER
- || theclass == LOC_STATIC || theclass == LOC_COMPUTED
- || theclass == LOC_OPTIMIZED_OUT));
+ && (loc_class == LOC_LOCAL || loc_class == LOC_REGISTER
+ || loc_class == LOC_STATIC || loc_class == LOC_COMPUTED
+ || loc_class == LOC_OPTIMIZED_OUT));
}
/* Implementation of Symbol.is_artificial. */
@@ -279,7 +276,7 @@ sympy_value (PyObject *self, PyObject *args)
}
SYMPY_REQUIRE_VALID (self, symbol);
- if (symbol->aclass () == LOC_TYPEDEF)
+ if (symbol->loc_class () == LOC_TYPEDEF)
{
PyErr_SetString (PyExc_TypeError, "cannot get the value of a typedef");
return NULL;
@@ -605,17 +602,15 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw)
/* Expand any symtabs that contain potentially matching symbols. */
lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
- expand_symtabs_matching (NULL, lookup_name, NULL, NULL,
- SEARCH_STATIC_BLOCK, flags);
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *cust : objfile->compunits ())
+ auto callback = [&] (compunit_symtab *cust)
{
/* Skip included compunits to prevent including compunits from
being searched twice. */
if (cust->user != nullptr)
- continue;
+ return true;
const struct blockvector *bv = cust->blockvector ();
const struct block *block = bv->static_block ();
@@ -628,13 +623,18 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw)
if (symbol != nullptr)
{
PyObject *sym_obj = symbol_to_symbol_object (symbol);
- if (sym_obj == nullptr)
- return nullptr;
- if (PyList_Append (return_list.get (), sym_obj) == -1)
- return nullptr;
+ if (sym_obj == nullptr
+ || PyList_Append (return_list.get (), sym_obj) == -1)
+ return false;
}
}
- }
+
+ return true;
+ };
+
+ if (!objfile.search (nullptr, &lookup_name, nullptr, callback,
+ SEARCH_STATIC_BLOCK, flags))
+ return nullptr;
}
}
catch (const gdb_exception &except)
diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c
index 2381e4d..9f7bdb0 100644
--- a/gdb/python/py-symtab.c
+++ b/gdb/python/py-symtab.c
@@ -1,6 +1,6 @@
/* Python interface to symbol tables.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-threadevent.c b/gdb/python/py-threadevent.c
index 557f2b7..f0a16a1 100644
--- a/gdb/python/py-threadevent.c
+++ b/gdb/python/py-threadevent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-tui.c b/gdb/python/py-tui.c
index 09f0a60..23a713e 100644
--- a/gdb/python/py-tui.c
+++ b/gdb/python/py-tui.c
@@ -1,6 +1,6 @@
/* TUI windows implemented in Python
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 24e754d..65753fd 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -1,6 +1,6 @@
/* Python interface to types.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -158,7 +158,7 @@ convert_field (struct type *type, int field)
}
else
{
- if (type->field (field).loc_kind () == FIELD_LOC_KIND_DWARF_BLOCK)
+ if (type->field (field).loc_is_dwarf_block ())
arg = gdbpy_ref<>::new_reference (Py_None);
else
arg = gdb_py_object_from_longest (type->field (field).loc_bitpos ());
@@ -842,11 +842,11 @@ typy_lookup_typename (const char *type_name, const struct block *block)
try
{
if (startswith (type_name, "struct "))
- type = lookup_struct (type_name + 7, NULL);
+ type = lookup_struct (type_name + 7, block);
else if (startswith (type_name, "union "))
- type = lookup_union (type_name + 6, NULL);
+ type = lookup_union (type_name + 6, block);
else if (startswith (type_name, "enum "))
- type = lookup_enum (type_name + 5, NULL);
+ type = lookup_enum (type_name + 5, block);
else
type = lookup_typename (current_language,
type_name, block, 0);
@@ -1045,9 +1045,9 @@ typy_template_argument (PyObject *self, PyObject *args)
}
sym = TYPE_TEMPLATE_ARGUMENT (type, argno);
- if (sym->aclass () == LOC_TYPEDEF)
+ if (sym->loc_class () == LOC_TYPEDEF)
return type_to_type_object (sym->type ());
- else if (sym->aclass () == LOC_OPTIMIZED_OUT)
+ else if (sym->loc_class () == LOC_OPTIMIZED_OUT)
{
PyErr_Format (PyExc_RuntimeError,
_("Template argument is optimized out"));
@@ -1312,10 +1312,9 @@ static PyObject *
typy_has_key (PyObject *self, PyObject *args)
{
struct type *type = ((type_object *) self)->type;
- const char *field;
- int i;
+ const char *field_name;
- if (!PyArg_ParseTuple (args, "s", &field))
+ if (!PyArg_ParseTuple (args, "s", &field_name))
return NULL;
/* We want just fields of this type, not of base types, so instead of
@@ -1326,11 +1325,11 @@ typy_has_key (PyObject *self, PyObject *args)
if (type == NULL)
return NULL;
- for (i = 0; i < type->num_fields (); i++)
+ for (const auto &field : type->fields ())
{
- const char *t_field_name = type->field (i).name ();
+ const char *t_field_name = field.name ();
- if (t_field_name && (strcmp_iw (t_field_name, field) == 0))
+ if (t_field_name && (strcmp_iw (t_field_name, field_name) == 0))
Py_RETURN_TRUE;
}
Py_RETURN_FALSE;
diff --git a/gdb/python/py-uiout.h b/gdb/python/py-uiout.h
index 5f8c530..f6fbd83 100644
--- a/gdb/python/py-uiout.h
+++ b/gdb/python/py-uiout.h
@@ -1,6 +1,6 @@
/* Python implementation of ui_out
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index af8ee98..43125bb 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -1,6 +1,6 @@
/* Python frame unwinder interface.
- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+ Copyright (C) 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -287,6 +287,8 @@ pyuw_create_unwind_info (PyObject *pyo_pending_frame,
unwind_info_object *unwind_info
= PyObject_New (unwind_info_object, &unwind_info_object_type);
+ if (unwind_info == nullptr)
+ return nullptr;
unwind_info->frame_id = frame_id;
Py_INCREF (pyo_pending_frame);
@@ -929,9 +931,9 @@ frame_unwind_python::sniff (const frame_info_ptr &this_frame,
/* Received UnwindInfo, cache data. */
PyObject *pyo_unwind_info = PyTuple_GET_ITEM (pyo_execute_ret.get (), 0);
- if (PyObject_IsInstance (pyo_unwind_info,
- (PyObject *) &unwind_info_object_type) <= 0)
- error (_("A Unwinder should return gdb.UnwindInfo instance."));
+ if (!PyObject_TypeCheck (pyo_unwind_info, &unwind_info_object_type))
+ error (_("an Unwinder should return gdb.UnwindInfo, not %s."),
+ Py_TYPE (pyo_unwind_info)->tp_name);
{
unwind_info_object *unwind_info =
@@ -1029,9 +1031,7 @@ gdbpy_initialize_unwind (void)
return 0;
}
-void _initialize_py_unwind ();
-void
-_initialize_py_unwind ()
+INIT_GDB_FILE (py_unwind)
{
add_setshow_boolean_cmd
("py-unwind", class_maintenance, &pyuw_debug,
diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c
index 0bc18a6..df8b888 100644
--- a/gdb/python/py-utils.c
+++ b/gdb/python/py-utils.c
@@ -1,6 +1,6 @@
/* General utility routines for GDB/Python.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index cf1e3ea..5d8fab9 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -1,6 +1,6 @@
/* Python interface to values.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -478,6 +478,9 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
type = value_rtti_type (val, NULL, NULL, NULL);
else
type = val->type ();
+
+ if (type == nullptr)
+ type = val->type ();
}
catch (const gdb_exception &except)
{
@@ -1096,8 +1099,7 @@ valpy_getitem (PyObject *self, PyObject *key)
res_val = value_struct_elt (&tmp, {}, field.get (), NULL,
"struct/class/union");
else if (bitpos >= 0)
- res_val = value_struct_elt_bitpos (&tmp, bitpos, field_type,
- "struct/class/union");
+ res_val = value_struct_elt_bitpos (tmp, bitpos, field_type);
else if (base_class_type != NULL)
{
struct type *val_type;
@@ -1289,6 +1291,30 @@ valpy_get_is_optimized_out (PyObject *self, void *closure)
Py_RETURN_FALSE;
}
+/* Implements gdb.Value.is_unavailable. Return true if any part of the
+ value is unavailable. */
+
+static PyObject *
+valpy_get_is_unavailable (PyObject *self, void *closure)
+{
+ struct value *value = ((value_object *) self)->value;
+ bool entirely_available = false;
+
+ try
+ {
+ entirely_available = value->entirely_available ();
+ }
+ catch (const gdb_exception &except)
+ {
+ return gdbpy_handle_gdb_exception (nullptr, except);
+ }
+
+ if (!entirely_available)
+ Py_RETURN_TRUE;
+
+ Py_RETURN_FALSE;
+}
+
/* Implements gdb.Value.is_lazy. */
static PyObject *
valpy_get_is_lazy (PyObject *self, void *closure)
@@ -1843,7 +1869,7 @@ valpy_long (PyObject *self)
{
struct value *value = ((value_object *) self)->value;
struct type *type = value->type ();
- LONGEST l = 0;
+ PyObject *result;
try
{
@@ -1859,17 +1885,57 @@ valpy_long (PyObject *self)
&& type->code () != TYPE_CODE_PTR)
error (_("Cannot convert value to long."));
- l = value_as_long (value);
+ gdb::array_view<const gdb_byte> contents = value->contents ();
+#if PY_VERSION_HEX >= 0x030d0000
+ int flags = (type_byte_order (type) == BFD_ENDIAN_BIG
+ ? Py_ASNATIVEBYTES_BIG_ENDIAN
+ : Py_ASNATIVEBYTES_LITTLE_ENDIAN);
+ if (type->is_unsigned ())
+ flags |= Py_ASNATIVEBYTES_UNSIGNED_BUFFER;
+ result = PyLong_FromNativeBytes (contents.data (), contents.size (),
+ flags);
+#else
+ /* Here we construct a call to "int.from_bytes", passing in the
+ appropriate arguments. We need a somewhat roundabout
+ approach because int.from_bytes requires "signed" to be a
+ keyword arg. */
+
+ /* PyObject_Call requires a tuple argument. */
+ gdbpy_ref<> empty_tuple (PyTuple_New (0));
+ if (empty_tuple == nullptr)
+ return nullptr;
+
+ /* Since we need a dictionary anyway, we pass all arguments as
+ keywords, building the dictionary here. */
+ gdbpy_ref<> args
+ (Py_BuildValue ("{sy#sssO}",
+ "bytes", contents.data (),
+ (Py_ssize_t) contents.size (),
+ "byteorder",
+ (type_byte_order (type) == BFD_ENDIAN_BIG
+ ? "big" : "little"),
+ "signed",
+ type->is_unsigned ()
+ ? Py_False : Py_True));
+ if (args == nullptr)
+ return nullptr;
+
+ /* Find the "int.from_bytes" callable. */
+ gdbpy_ref<> callable (PyObject_GetAttrString ((PyObject *) &PyLong_Type,
+ "from_bytes"));
+ if (callable == nullptr)
+ return nullptr;
+
+ result = PyObject_Call (callable.get (), empty_tuple.get (),
+ args.get ());
+#endif
}
catch (const gdb_exception &except)
{
return gdbpy_handle_gdb_exception (nullptr, except);
}
- if (type->is_unsigned ())
- return gdb_py_object_from_ulongest (l).release ();
- else
- return gdb_py_object_from_longest (l).release ();
+ return result;
}
/* Implements conversion to float. */
@@ -2195,6 +2261,9 @@ static gdb_PyGetSetDef value_object_getset[] = {
"Boolean telling whether the value is optimized "
"out (i.e., not available).",
NULL },
+ { "is_unavailable", valpy_get_is_unavailable, nullptr,
+ "Boolean telling whether the value is unavailable.",
+ nullptr },
{ "type", valpy_get_type, NULL, "Type of the value.", NULL },
{ "dynamic_type", valpy_get_dynamic_type, NULL,
"Dynamic type of the value.", NULL },
diff --git a/gdb/python/py-varobj.c b/gdb/python/py-varobj.c
index cbfea26..2d36091 100644
--- a/gdb/python/py-varobj.c
+++ b/gdb/python/py-varobj.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/python/py-xmethods.c b/gdb/python/py-xmethods.c
index 2fae043..c10ac5d 100644
--- a/gdb/python/py-xmethods.c
+++ b/gdb/python/py-xmethods.c
@@ -1,6 +1,6 @@
/* Support for debug methods in Python.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -141,9 +141,9 @@ gdbpy_get_matching_xmethod_workers
/* Gather debug method matchers registered with the object files.
This could be done differently by iterating over each objfile's matcher
list individually, but there's no data yet to show it's needed. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- gdbpy_ref<> py_objfile = objfile_to_objfile_object (objfile);
+ gdbpy_ref<> py_objfile = objfile_to_objfile_object (&objfile);
if (py_objfile == NULL)
{
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 3f1a206..51ace13 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -1,6 +1,6 @@
/* Gdb/Python header for private use by Python module.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -88,6 +88,8 @@
#include <frameobject.h>
#include "py-ref.h"
+static_assert (PY_VERSION_HEX >= 0x03040000);
+
#define Py_TPFLAGS_CHECKTYPES 0
/* If Python.h does not define WITH_THREAD, then the various
@@ -135,17 +137,6 @@ typedef unsigned long gdb_py_ulongest;
#endif /* HAVE_LONG_LONG */
-#if PY_VERSION_HEX < 0x03020000
-typedef long Py_hash_t;
-#endif
-
-/* PyMem_RawMalloc appeared in Python 3.4. For earlier versions, we can just
- fall back to PyMem_Malloc. */
-
-#if PY_VERSION_HEX < 0x03040000
-#define PyMem_RawMalloc PyMem_Malloc
-#endif
-
/* A template variable holding the format character (as for
Py_BuildValue) for a given type. */
template<typename T>
@@ -512,14 +503,20 @@ PyObject *gdbpy_create_lazy_string_object (CORE_ADDR address, long length,
const char *encoding,
struct type *type);
PyObject *gdbpy_inferiors (PyObject *unused, PyObject *unused2);
-PyObject *gdbpy_create_ptid_object (ptid_t ptid);
+
+/* Return a reference to a new Python Tuple object representing a ptid_t.
+ The object is a tuple containing (pid, lwp, tid). */
+
+extern gdbpy_ref<> gdbpy_create_ptid_object (ptid_t ptid);
+
PyObject *gdbpy_selected_thread (PyObject *self, PyObject *args);
PyObject *gdbpy_selected_inferior (PyObject *self, PyObject *args);
PyObject *gdbpy_string_to_argv (PyObject *self, PyObject *args);
PyObject *gdbpy_parameter_value (const setting &var);
gdb::unique_xmalloc_ptr<char> gdbpy_parse_command_name
(const char *name, struct cmd_list_element ***base_list,
- struct cmd_list_element **start_list);
+ struct cmd_list_element **start_list,
+ struct cmd_list_element **prefix_cmd = nullptr);
PyObject *gdbpy_register_tui_window (PyObject *self, PyObject *args,
PyObject *kw);
@@ -573,6 +570,20 @@ struct symtab_and_line *sal_object_to_symtab_and_line (PyObject *obj);
frame_info_ptr frame_object_to_frame_info (PyObject *frame_obj);
struct gdbarch *arch_object_to_gdbarch (PyObject *obj);
+/* Return true if OBJ is a gdb.Style object. OBJ must not be NULL. */
+
+extern bool gdbpy_is_style (PyObject *obj);
+
+/* Return the ui_file_style from OBJ, a gdb.Style object. OBJ must not be
+ NULL.
+
+ It is possible that OBJ is a gdb.Style object, but the underlying style
+ cannot be fetched for some reason. If this happens then a Python error
+ is set and an empty optional is returned. */
+
+extern std::optional<ui_file_style>
+ gdbpy_style_object_to_ui_file_style (PyObject *obj);
+
extern PyObject *gdbpy_execute_mi_command (PyObject *self, PyObject *args,
PyObject *kw);
@@ -1116,6 +1127,14 @@ extern std::optional<int> gdbpy_print_insn (struct gdbarch *gdbarch,
CORE_ADDR address,
disassemble_info *info);
+/* Return the gdb.Corefile object representing the core file loaded into
+ the program space of INF, or None if there is no core file loaded. INF
+ must not be NULL. If an error occurs then NULL is returned, and a
+ suitable Python error will be set. */
+
+extern gdbpy_ref<> gdbpy_core_file_from_inferior (inferior *inf);
+
+
/* A wrapper for PyType_Ready that also automatically registers the
type in the appropriate module. Returns 0 on success, -1 on error.
If MOD is supplied, then the type is added to that module. If MOD
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 2aaa30c..51e7a0a 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1,6 +1,6 @@
/* General python/gdb code
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -31,7 +31,6 @@
#include "python.h"
#include "extension-priv.h"
#include "cli/cli-utils.h"
-#include <ctype.h>
#include "location.h"
#include "run-on-main-thread.h"
#include "observable.h"
@@ -128,7 +127,8 @@ static bool gdbpy_check_quit_flag (const struct extension_language_defn *);
static enum ext_lang_rc gdbpy_before_prompt_hook
(const struct extension_language_defn *, const char *current_gdb_prompt);
static std::optional<std::string> gdbpy_colorize
- (const std::string &filename, const std::string &contents);
+ (const std::string &filename, const std::string &contents,
+ enum language lang);
static std::optional<std::string> gdbpy_colorize_disasm
(const std::string &content, gdbarch *gdbarch);
static ext_lang_missing_file_result gdbpy_handle_missing_debuginfo
@@ -1201,15 +1201,22 @@ gdbpy_post_event (PyObject *self, PyObject *args)
static PyObject *
gdbpy_interrupt (PyObject *self, PyObject *args)
{
+#ifdef __MINGW32__
{
- /* Make sure the interrupt isn't delivered immediately somehow.
- This probably is not truly needed, but at the same time it
- seems more clear to be explicit about the intent. */
gdbpy_allow_threads temporarily_exit_python;
scoped_disable_cooperative_sigint_handling no_python_sigint;
set_quit_flag ();
}
+#else
+ {
+ /* For targets with support kill() just send SIGINT. This will be
+ handled as if the user hit Ctrl+C. This isn't exactly the same as
+ the above, which directly sets the quit flag. Consider, for
+ example, every place that install_sigint_handler is called. */
+ kill (getpid (), SIGINT);
+ }
+#endif
Py_RETURN_NONE;
}
@@ -1295,7 +1302,8 @@ gdbpy_before_prompt_hook (const struct extension_language_defn *extlang,
/* This is the extension_language_ops.colorize "method". */
static std::optional<std::string>
-gdbpy_colorize (const std::string &filename, const std::string &contents)
+gdbpy_colorize (const std::string &filename, const std::string &contents,
+ enum language lang)
{
if (!gdb_python_initialized)
return {};
@@ -1329,6 +1337,13 @@ gdbpy_colorize (const std::string &filename, const std::string &contents)
return {};
}
+ gdbpy_ref<> lang_arg (PyUnicode_FromString (language_str (lang)));
+ if (lang_arg == nullptr)
+ {
+ gdbpy_print_stack ();
+ return {};
+ }
+
/* The pygments library, which is what we currently use for applying
styling, is happy to take input as a bytes object, and to figure out
the encoding for itself. This removes the need for us to figure out
@@ -1349,6 +1364,7 @@ gdbpy_colorize (const std::string &filename, const std::string &contents)
gdbpy_ref<> result (PyObject_CallFunctionObjArgs (hook.get (),
fname_arg.get (),
contents_arg.get (),
+ lang_arg.get (),
nullptr));
if (result == nullptr)
{
@@ -1551,29 +1567,49 @@ static PyObject *
gdbpy_write (PyObject *self, PyObject *args, PyObject *kw)
{
const char *arg;
- static const char *keywords[] = { "text", "stream", NULL };
+ static const char *keywords[] = { "text", "stream", "style", nullptr };
int stream_type = 0;
+ PyObject *style_obj = Py_None;
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &arg,
- &stream_type))
- return NULL;
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|iO", keywords, &arg,
+ &stream_type, &style_obj))
+ return nullptr;
+
+ if (style_obj != Py_None && !gdbpy_is_style (style_obj))
+ {
+ PyErr_Format
+ (PyExc_TypeError,
+ _("'style' argument must be gdb.Style or None, not %s."),
+ Py_TYPE (style_obj)->tp_name);
+ return nullptr;
+ }
try
{
+ ui_file *stream;
switch (stream_type)
{
case 1:
- {
- gdb_printf (gdb_stderr, "%s", arg);
- break;
- }
+ stream = gdb_stderr;
+ break;
case 2:
- {
- gdb_printf (gdb_stdlog, "%s", arg);
- break;
- }
+ stream = gdb_stdlog;
+ break;
default:
- gdb_printf (gdb_stdout, "%s", arg);
+ stream = gdb_stdout;
+ break;
+ }
+
+ if (style_obj == Py_None)
+ gdb_puts (arg, stream);
+ else
+ {
+ std::optional<ui_file_style> style
+ = gdbpy_style_object_to_ui_file_style (style_obj);
+ if (!style.has_value ())
+ return nullptr;
+
+ fputs_styled (arg, style.value (), stream);
}
}
catch (const gdb_exception &except)
@@ -1602,16 +1638,53 @@ gdbpy_flush (PyObject *self, PyObject *args, PyObject *kw)
{
case 1:
{
- gdb_flush (gdb_stderr);
+ if (gdb_stderr != nullptr)
+ gdb_flush (gdb_stderr);
break;
}
case 2:
{
- gdb_flush (gdb_stdlog);
+ if (gdb_stdlog != nullptr)
+ gdb_flush (gdb_stdlog);
break;
}
default:
- gdb_flush (gdb_stdout);
+ if (gdb_stdout != nullptr)
+ gdb_flush (gdb_stdout);
+ }
+
+ Py_RETURN_NONE;
+}
+
+/* Implement gdb.warning(). Takes a single text string argument and emit a
+ warning using GDB's 'warning' function. The input text string must not
+ be empty. */
+
+static PyObject *
+gdbpy_warning (PyObject *self, PyObject *args, PyObject *kw)
+{
+ const char *text;
+ static const char *keywords[] = { "text", nullptr };
+
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s", keywords, &text))
+ return nullptr;
+
+ if (strlen (text) == 0)
+ {
+ PyErr_SetString (PyExc_ValueError,
+ _("Empty text string passed to gdb.warning"));
+ return nullptr;
+ }
+
+ try
+ {
+ warning ("%s", text);
+ }
+ catch (const gdb_exception &ex)
+ {
+ /* The warning() call probably cannot throw an exception. But just
+ in case it ever does. */
+ return gdbpy_handle_gdb_exception (nullptr, ex);
}
Py_RETURN_NONE;
@@ -2433,7 +2506,7 @@ py_initialize ()
/foo/lib/pythonX.Y/...
This must be done before calling Py_Initialize. */
gdb::unique_xmalloc_ptr<char> progname
- (concat (ldirname (python_libdir.c_str ()).c_str (), SLASH_STRING, "bin",
+ (concat (gdb_ldirname (python_libdir.c_str ()).c_str (), SLASH_STRING, "bin",
SLASH_STRING, "python", (char *) NULL));
{
@@ -2670,9 +2743,7 @@ test_python ()
/* See python.h. */
cmd_list_element *python_cmd_element = nullptr;
-void _initialize_python ();
-void
-_initialize_python ()
+INIT_GDB_FILE (python)
{
cmd_list_element *python_interactive_cmd
= add_com ("python-interactive", class_obscure,
@@ -3111,6 +3182,12 @@ Return the current print options." },
METH_VARARGS | METH_KEYWORDS,
"notify_mi (name, data) -> None\n\
Output async record to MI channels if any." },
+
+ { "warning", (PyCFunction) gdbpy_warning,
+ METH_VARARGS | METH_KEYWORDS,
+ "warning (text) -> None\n\
+Print a warning." },
+
{NULL, NULL, 0, NULL}
};
diff --git a/gdb/python/python.h b/gdb/python/python.h
index e803285..f564af7 100644
--- a/gdb/python/python.h
+++ b/gdb/python/python.h
@@ -1,6 +1,6 @@
/* Python/gdb header for generic use in gdb
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/quick-symbol.h b/gdb/quick-symbol.h
index 32090db..b5308dc 100644
--- a/gdb/quick-symbol.h
+++ b/gdb/quick-symbol.h
@@ -1,6 +1,6 @@
/* "Quick" symbol functions
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -37,30 +37,29 @@ DEF_ENUM_FLAGS_TYPE (enum block_search_flag_values, block_search_flags);
using symbol_filename_listener
= gdb::function_view<void (const char *filename, const char *fullname)>;
-/* Callback for quick_symbol_functions::expand_symtabs_matching
- to match a file name. */
+/* Callback for quick_symbol_functions::search to match a file
+ name. */
-using expand_symtabs_file_matcher
+using search_symtabs_file_matcher
= gdb::function_view<bool (const char *filename, bool basenames)>;
-/* Callback for quick_symbol_functions::expand_symtabs_matching
- to match a symbol name. */
+/* Callback for quick_symbol_functions::search to match a symbol
+ name. */
-using expand_symtabs_symbol_matcher
+using search_symtabs_symbol_matcher
= gdb::function_view<bool (const char *name)>;
-/* Callback for quick_symbol_functions::expand_symtabs_matching
- to match a language. */
+/* Callback for quick_symbol_functions::search to match a
+ language. */
-using expand_symtabs_lang_matcher
+using search_symtabs_lang_matcher
= gdb::function_view<bool (enum language lang)>;
-/* Callback for quick_symbol_functions::expand_symtabs_matching
- to be called after a symtab has been expanded. If this returns
- true, more symtabs are checked; if it returns false, iteration
- stops. */
+/* Callback for quick_symbol_functions::search to be called when
+ symtab matches (perhaps expanding it first). If this returns true,
+ more symtabs are checked; if it returns false, iteration stops. */
-using expand_symtabs_expansion_listener
+using search_symtabs_expansion_listener
= gdb::function_view<bool (compunit_symtab *symtab)>;
/* The "quick" symbol functions exist so that symbol readers can
@@ -71,13 +70,6 @@ using expand_symtabs_expansion_listener
The quick symbol functions are generally opaque: the underlying
representation is hidden from the caller.
- In general, these functions should only look at whatever special
- index the symbol reader creates -- looking through the symbol
- tables themselves is handled by generic code. If a function is
- defined as returning a "symbol table", this means that the function
- should only return a newly-created symbol table; it should not
- examine pre-existing ones.
-
The exact list of functions here was determined in an ad hoc way
based on gdb's history. */
@@ -130,11 +122,11 @@ struct quick_symbol_functions
/* Read all symbol tables associated with OBJFILE. */
virtual void expand_all_symtabs (struct objfile *objfile) = 0;
- /* Expand all symbol tables in OBJFILE matching some criteria.
+ /* Search all symbol tables in OBJFILE matching some criteria.
- If LANG_MATCHER returns false, expansion of the symbol table may be
- skipped. It may also not be skipped, which the caller needs to take into
- account.
+ If LANG_MATCHER returns false, search of the symbol table may be
+ skipped. It may also not be skipped, which the caller needs to
+ take into account.
FILE_MATCHER is called for each file in OBJFILE. The file name
is passed to it. If the matcher returns false, the file is
@@ -144,7 +136,7 @@ struct quick_symbol_functions
part).
If the file is not skipped, and SYMBOL_MATCHER and LOOKUP_NAME are NULL,
- the symbol table is expanded.
+ the symbol table is searched.
Otherwise, individual symbols are considered.
@@ -156,19 +148,23 @@ struct quick_symbol_functions
Note that if SYMBOL_MATCHER is non-NULL, then LOOKUP_NAME must
also be provided.
- Otherwise, the symbol's symbol table is expanded and EXPANSION_NOTIFY is
- called. If EXPANSION_NOTIFY returns false, execution stops and this method
- returns false. Otherwise, more files are considered. This method returns
- true if all calls to EXPANSION_NOTIFY return true. */
- virtual bool expand_symtabs_matching
+ Otherwise, the symbol's symbol table is expanded if needed.
+
+ Then (regardless of whether the symbol table was already
+ expanded, or just expanded in response to this search), LISTENER
+ is called. If LISTENER returns false, execution stops and this
+ method returns false. Otherwise, more files are considered.
+ This method returns true if all calls to LISTENER return
+ true. */
+ virtual bool search
(struct objfile *objfile,
- expand_symtabs_file_matcher file_matcher,
+ search_symtabs_file_matcher file_matcher,
const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
+ search_symtabs_symbol_matcher symbol_matcher,
+ search_symtabs_expansion_listener listener,
block_search_flags search_flags,
domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher = nullptr) = 0;
+ search_symtabs_lang_matcher lang_matcher = nullptr) = 0;
/* Return the comp unit from OBJFILE that contains PC and
SECTION. Return NULL if there is no such compunit. This
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index dae6917..4d79b3d 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -1,6 +1,6 @@
/* Ada Ravenscar thread support.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -503,7 +503,7 @@ ravenscar_thread_target::pid_to_str (ptid_t ptid)
return beneath ()->pid_to_str (ptid);
return string_printf ("Ravenscar Thread 0x%s",
- phex_nz (ptid.tid (), sizeof (ULONGEST)));
+ phex_nz (ptid.tid ()));
}
CORE_ADDR
@@ -921,9 +921,7 @@ Support for Ravenscar task/thread switching is disabled\n"));
/* Module startup initialization function, automagically called by
init.c. */
-void _initialize_ravenscar ();
-void
-_initialize_ravenscar ()
+INIT_GDB_FILE (ravenscar)
{
/* Notice when the inferior is created in order to push the
ravenscar ops if needed. */
diff --git a/gdb/ravenscar-thread.h b/gdb/ravenscar-thread.h
index 046b357..875d1e5 100644
--- a/gdb/ravenscar-thread.h
+++ b/gdb/ravenscar-thread.h
@@ -1,6 +1,6 @@
/* Ada Ravenscar thread support.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index d9f3e91..5112181 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -1,6 +1,6 @@
/* Branch trace support for GDB, the GNU debugger.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
@@ -132,10 +132,7 @@ public:
bool can_execute_reverse () override;
bool stopped_by_sw_breakpoint () override;
- bool supports_stopped_by_sw_breakpoint () override;
-
bool stopped_by_hw_breakpoint () override;
- bool supports_stopped_by_hw_breakpoint () override;
enum exec_direction_kind execution_direction () override;
void prepare_to_generate_core () override;
@@ -396,12 +393,12 @@ record_btrace_target_open (const char *args, int from_tty)
if (!target_has_execution ())
error (_("The program is not being run."));
- for (thread_info *tp : current_inferior ()->non_exited_threads ())
- if (args == NULL || *args == 0 || number_is_in_list (args, tp->global_num))
+ for (thread_info &tp : current_inferior ()->non_exited_threads ())
+ if (args == NULL || *args == 0 || number_is_in_list (args, tp.global_num))
{
- btrace_enable (tp, &record_btrace_conf);
+ btrace_enable (&tp, &record_btrace_conf);
- btrace_disable.add_thread (tp);
+ btrace_disable.add_thread (&tp);
}
record_btrace_push_target ();
@@ -418,9 +415,9 @@ record_btrace_target::stop_recording ()
record_btrace_auto_disable ();
- for (thread_info *tp : current_inferior ()->non_exited_threads ())
- if (tp->btrace.target != NULL)
- btrace_disable (tp);
+ for (thread_info &tp : current_inferior ()->non_exited_threads ())
+ if (tp.btrace.target != NULL)
+ btrace_disable (&tp);
}
/* The disconnect method of target record-btrace. */
@@ -452,8 +449,8 @@ record_btrace_target::close ()
/* We should have already stopped recording.
Tear down btrace in case we have not. */
- for (thread_info *tp : current_inferior ()->non_exited_threads ())
- btrace_teardown (tp);
+ for (thread_info &tp : current_inferior ()->non_exited_threads ())
+ btrace_teardown (&tp);
}
/* The async method of target record-btrace. */
@@ -1461,8 +1458,8 @@ bool
record_btrace_target::record_is_replaying (ptid_t ptid)
{
process_stratum_target *proc_target = current_inferior ()->process_target ();
- for (thread_info *tp : all_non_exited_threads (proc_target, ptid))
- if (btrace_is_replaying (tp))
+ for (thread_info &tp : all_non_exited_threads (proc_target, ptid))
+ if (btrace_is_replaying (&tp))
return true;
return false;
@@ -2222,18 +2219,18 @@ record_btrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
{
gdb_assert (inferior_ptid.matches (ptid));
- for (thread_info *tp : all_non_exited_threads (proc_target, ptid))
+ for (thread_info &tp : all_non_exited_threads (proc_target, ptid))
{
- if (tp->ptid.matches (inferior_ptid))
- record_btrace_resume_thread (tp, flag);
+ if (tp.ptid.matches (inferior_ptid))
+ record_btrace_resume_thread (&tp, flag);
else
- record_btrace_resume_thread (tp, cflag);
+ record_btrace_resume_thread (&tp, cflag);
}
}
else
{
- for (thread_info *tp : all_non_exited_threads (proc_target, ptid))
- record_btrace_resume_thread (tp, flag);
+ for (thread_info &tp : all_non_exited_threads (proc_target, ptid))
+ record_btrace_resume_thread (&tp, flag);
}
/* Async support. */
@@ -2581,7 +2578,7 @@ record_btrace_maybe_mark_async_event
const std::vector<thread_info *> &no_history)
{
bool more_moving = !moving.empty ();
- bool more_no_history = !no_history.empty ();;
+ bool more_no_history = !no_history.empty ();
if (!more_moving && !more_no_history)
return;
@@ -2619,9 +2616,9 @@ record_btrace_target::wait (ptid_t ptid, struct target_waitstatus *status,
/* Keep a work list of moving threads. */
process_stratum_target *proc_target = current_inferior ()->process_target ();
- for (thread_info *tp : all_non_exited_threads (proc_target, ptid))
- if ((tp->btrace.flags & (BTHR_MOVE | BTHR_STOP)) != 0)
- moving.push_back (tp);
+ for (thread_info &tp : all_non_exited_threads (proc_target, ptid))
+ if ((tp.btrace.flags & (BTHR_MOVE | BTHR_STOP)) != 0)
+ moving.push_back (&tp);
if (moving.empty ())
{
@@ -2702,8 +2699,8 @@ record_btrace_target::wait (ptid_t ptid, struct target_waitstatus *status,
/* Stop all other threads. */
if (!target_is_non_stop_p ())
{
- for (thread_info *tp : current_inferior ()->non_exited_threads ())
- record_btrace_cancel_resume (tp);
+ for (thread_info &tp : current_inferior ()->non_exited_threads ())
+ record_btrace_cancel_resume (&tp);
}
/* In async mode, we need to announce further events. */
@@ -2742,10 +2739,10 @@ record_btrace_target::stop (ptid_t ptid)
process_stratum_target *proc_target
= current_inferior ()->process_target ();
- for (thread_info *tp : all_non_exited_threads (proc_target, ptid))
+ for (thread_info &tp : all_non_exited_threads (proc_target, ptid))
{
- tp->btrace.flags &= ~BTHR_MOVE;
- tp->btrace.flags |= BTHR_STOP;
+ tp.btrace.flags &= ~BTHR_MOVE;
+ tp.btrace.flags |= BTHR_STOP;
}
}
}
@@ -2773,18 +2770,6 @@ record_btrace_target::stopped_by_sw_breakpoint ()
return this->beneath ()->stopped_by_sw_breakpoint ();
}
-/* The supports_stopped_by_sw_breakpoint method of target
- record-btrace. */
-
-bool
-record_btrace_target::supports_stopped_by_sw_breakpoint ()
-{
- if (record_is_replaying (minus_one_ptid))
- return true;
-
- return this->beneath ()->supports_stopped_by_sw_breakpoint ();
-}
-
/* The stopped_by_sw_breakpoint method of target record-btrace. */
bool
@@ -2800,18 +2785,6 @@ record_btrace_target::stopped_by_hw_breakpoint ()
return this->beneath ()->stopped_by_hw_breakpoint ();
}
-/* The supports_stopped_by_hw_breakpoint method of target
- record-btrace. */
-
-bool
-record_btrace_target::supports_stopped_by_hw_breakpoint ()
-{
- if (record_is_replaying (minus_one_ptid))
- return true;
-
- return this->beneath ()->supports_stopped_by_hw_breakpoint ();
-}
-
/* The update_thread_list method of target record-btrace. */
void
@@ -2945,8 +2918,8 @@ record_btrace_target::goto_record (ULONGEST insn_number)
void
record_btrace_target::record_stop_replaying ()
{
- for (thread_info *tp : current_inferior ()->non_exited_threads ())
- record_btrace_stop_replaying (tp);
+ for (thread_info &tp : current_inferior ()->non_exited_threads ())
+ record_btrace_stop_replaying (&tp);
}
/* The execution_direction target method. */
@@ -3213,9 +3186,7 @@ set_record_pt_event_tracing_value (const char *args, int from_tty,
/* Initialize btrace commands. */
-void _initialize_record_btrace ();
-void
-_initialize_record_btrace ()
+INIT_GDB_FILE (record_btrace)
{
cmd_list_element *record_btrace_cmd
= add_prefix_cmd ("btrace", class_obscure, cmd_record_btrace_start,
diff --git a/gdb/record-btrace.h b/gdb/record-btrace.h
index 5ab3208..cd9eb64 100644
--- a/gdb/record-btrace.h
+++ b/gdb/record-btrace.h
@@ -1,6 +1,6 @@
/* Branch trace support for GDB, the GNU debugger.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <tim.wiederhake@intel.com>
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 6d05651..396ba32 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -1,6 +1,6 @@
/* Process record and replay target for GDB, the GNU debugger.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -908,7 +908,7 @@ record_full_exec_insn (struct regcache *regcache,
}
}
-static void record_full_restore (void);
+static void record_full_restore (struct bfd &cbfd);
/* Asynchronous signal handle registered as event loop source for when
we have pending events ready to be passed to the core. */
@@ -921,10 +921,11 @@ record_full_async_inferior_event_handler (gdb_client_data data)
inferior_event_handler (INF_REG_EVENT);
}
-/* Open the process record target for 'core' files. */
+/* Open the process record target for 'core' files. CBFD is the core file
+ containing the record information. */
static void
-record_full_core_open_1 ()
+record_full_core_open_1 (struct bfd &cbfd)
{
regcache *regcache = get_thread_regcache (inferior_thread ());
int regnum = gdbarch_num_regs (regcache->arch ());
@@ -937,11 +938,10 @@ record_full_core_open_1 ()
for (i = 0; i < regnum; i ++)
record_full_core_regbuf->raw_supply (i, *regcache);
- record_full_core_sections
- = build_section_table (current_program_space->core_bfd ());
+ record_full_core_sections = build_section_table (&cbfd);
current_inferior ()->push_target (&record_full_core_ops);
- record_full_restore ();
+ record_full_restore (cbfd);
}
/* Open the process record target for 'live' processes. */
@@ -987,8 +987,9 @@ record_full_open (const char *args, int from_tty)
record_full_list = &record_full_first;
record_full_list->next = NULL;
- if (current_program_space->core_bfd ())
- record_full_core_open_1 ();
+ bfd *cbfd = get_inferior_core_bfd (current_inferior ());
+ if (cbfd != nullptr)
+ record_full_core_open_1 (*cbfd);
else
record_full_open_1 ();
@@ -1084,14 +1085,15 @@ record_full_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
if (!RECORD_FULL_IS_REPLAY)
{
- struct gdbarch *gdbarch = target_thread_architecture (ptid);
+ struct regcache *regcache = get_thread_regcache (inferior_thread ());
+ struct gdbarch *gdbarch = regcache->arch ();
- record_full_message (get_thread_regcache (inferior_thread ()), signal);
+ record_full_message (regcache, signal);
if (!step)
{
/* This is not hard single step. */
- if (!gdbarch_software_single_step_p (gdbarch))
+ if (!gdbarch_get_next_pcs_p (gdbarch))
{
/* This is a normal continue. */
step = 1;
@@ -1116,8 +1118,8 @@ record_full_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
all executed instructions, so we can record them all. */
process_stratum_target *proc_target
= current_inferior ()->process_target ();
- for (thread_info *thread : all_non_exited_threads (proc_target, ptid))
- thread->control.may_range_step = 0;
+ for (thread_info &thread : all_non_exited_threads (proc_target, ptid))
+ thread.control.may_range_step = 0;
this->beneath ()->resume (ptid, step, signal);
}
@@ -1212,8 +1214,8 @@ record_full_wait_1 (struct target_ops *ops,
return ret;
}
- for (thread_info *tp : all_non_exited_threads ())
- delete_single_step_breakpoints (tp);
+ for (thread_info &tp : all_non_exited_threads ())
+ delete_single_step_breakpoints (&tp);
if (record_full_resume_step)
return ret;
@@ -1266,7 +1268,7 @@ record_full_wait_1 (struct target_ops *ops,
process_stratum_target *proc_target
= current_inferior ()->process_target ();
- if (gdbarch_software_single_step_p (gdbarch))
+ if (gdbarch_get_next_pcs_p (gdbarch))
{
/* Try to insert the software single step breakpoint.
If insert success, set step to 0. */
@@ -1647,7 +1649,7 @@ record_full_target::store_registers (struct regcache *regcache, int regno)
/* "xfer_partial" method. Behavior is conditional on
RECORD_FULL_IS_REPLAY.
- In replay mode, we cannot write memory unles we are willing to
+ In replay mode, we cannot write memory unless we are willing to
invalidate the record/replay log from this point forward. */
enum target_xfer_status
@@ -2332,9 +2334,10 @@ netorder32 (uint32_t input)
return ret;
}
-/* Restore the execution log from a core_bfd file. */
+/* Restore the execution log from core file CBFD. */
+
static void
-record_full_restore (void)
+record_full_restore (struct bfd &cbfd)
{
uint32_t magic;
struct record_full_entry *rec;
@@ -2342,11 +2345,6 @@ record_full_restore (void)
uint32_t osec_size;
int bfd_offset = 0;
- /* We restore the execution log from the open core bfd,
- if there is one. */
- if (current_program_space->core_bfd () == nullptr)
- return;
-
/* "record_full_restore" can only be called when record list is empty. */
gdb_assert (record_full_first.next == NULL);
@@ -2354,7 +2352,7 @@ record_full_restore (void)
gdb_printf (gdb_stdlog, "Restoring recording from core file.\n");
/* Now need to find our special note section. */
- osec = bfd_get_section_by_name (current_program_space->core_bfd (), "null0");
+ osec = bfd_get_section_by_name (&cbfd, "null0");
if (record_debug)
gdb_printf (gdb_stdlog, "Find precord section %s.\n",
osec ? "succeeded" : "failed");
@@ -2365,11 +2363,10 @@ record_full_restore (void)
gdb_printf (gdb_stdlog, "%s", bfd_section_name (osec));
/* Check the magic code. */
- bfdcore_read (current_program_space->core_bfd (), osec, &magic,
- sizeof (magic), &bfd_offset);
+ bfdcore_read (&cbfd, osec, &magic, sizeof (magic), &bfd_offset);
if (magic != RECORD_FULL_FILE_MAGIC)
- error (_("Version mis-match or file format error in core file %s."),
- bfd_get_filename (current_program_space->core_bfd ()));
+ error (_("Version mismatch or file format error in core file %s."),
+ bfd_get_filename (&cbfd));
if (record_debug)
gdb_printf (gdb_stdlog,
" Reading 4-byte magic cookie "
@@ -2395,23 +2392,21 @@ record_full_restore (void)
/* We are finished when offset reaches osec_size. */
if (bfd_offset >= osec_size)
break;
- bfdcore_read (current_program_space->core_bfd (), osec, &rectype,
- sizeof (rectype), &bfd_offset);
+ bfdcore_read (&cbfd, osec, &rectype, sizeof (rectype), &bfd_offset);
switch (rectype)
{
case record_full_reg: /* reg */
/* Get register number to regnum. */
- bfdcore_read (current_program_space->core_bfd (), osec, &regnum,
- sizeof (regnum), &bfd_offset);
+ bfdcore_read (&cbfd, osec, &regnum, sizeof (regnum),
+ &bfd_offset);
regnum = netorder32 (regnum);
rec = record_full_reg_alloc (regcache, regnum);
/* Get val. */
- bfdcore_read (current_program_space->core_bfd (), osec,
- record_full_get_loc (rec), rec->u.reg.len,
- &bfd_offset);
+ bfdcore_read (&cbfd, osec, record_full_get_loc (rec),
+ rec->u.reg.len, &bfd_offset);
if (record_debug)
gdb_printf (gdb_stdlog,
@@ -2424,21 +2419,18 @@ record_full_restore (void)
case record_full_mem: /* mem */
/* Get len. */
- bfdcore_read (current_program_space->core_bfd (), osec, &len,
- sizeof (len), &bfd_offset);
+ bfdcore_read (&cbfd, osec, &len, sizeof (len), &bfd_offset);
len = netorder32 (len);
/* Get addr. */
- bfdcore_read (current_program_space->core_bfd (), osec, &addr,
- sizeof (addr), &bfd_offset);
+ bfdcore_read (&cbfd, osec, &addr, sizeof (addr), &bfd_offset);
addr = netorder64 (addr);
rec = record_full_mem_alloc (addr, len);
/* Get val. */
- bfdcore_read (current_program_space->core_bfd (), osec,
- record_full_get_loc (rec), rec->u.mem.len,
- &bfd_offset);
+ bfdcore_read (&cbfd, osec, record_full_get_loc (rec),
+ rec->u.mem.len, &bfd_offset);
if (record_debug)
gdb_printf (gdb_stdlog,
@@ -2456,14 +2448,13 @@ record_full_restore (void)
record_full_insn_num ++;
/* Get signal value. */
- bfdcore_read (current_program_space->core_bfd (), osec, &signal,
- sizeof (signal), &bfd_offset);
+ bfdcore_read (&cbfd, osec, &signal, sizeof (signal),
+ &bfd_offset);
signal = netorder32 (signal);
rec->u.end.sigval = (enum gdb_signal) signal;
/* Get insn count. */
- bfdcore_read (current_program_space->core_bfd (), osec, &count,
- sizeof (count), &bfd_offset);
+ bfdcore_read (&cbfd, osec, &count, sizeof (count), &bfd_offset);
count = netorder32 (count);
rec->u.end.insn_num = count;
record_full_insn_count = count + 1;
@@ -2479,7 +2470,7 @@ record_full_restore (void)
default:
error (_("Bad entry type in core file %s."),
- bfd_get_filename (current_program_space->core_bfd ()));
+ bfd_get_filename (&cbfd));
break;
}
@@ -2509,7 +2500,7 @@ record_full_restore (void)
/* Succeeded. */
gdb_printf (_("Restored records from core file %s.\n"),
- bfd_get_filename (current_program_space->core_bfd ()));
+ bfd_get_filename (&cbfd));
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
}
@@ -2877,9 +2868,7 @@ maintenance_print_record_instruction (const char *args, int from_tty)
}
}
-void _initialize_record_full ();
-void
-_initialize_record_full ()
+INIT_GDB_FILE (record_full)
{
struct cmd_list_element *c;
diff --git a/gdb/record-full.h b/gdb/record-full.h
index 0852d2a..7be48eb 100644
--- a/gdb/record-full.h
+++ b/gdb/record-full.h
@@ -1,6 +1,6 @@
/* Process record and replay target for GDB, the GNU debugger.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/record.c b/gdb/record.c
index 97a4e46..de1a7a8 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -1,6 +1,6 @@
/* Process record and replay target for GDB, the GNU debugger.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -28,7 +28,6 @@
#include "interps.h"
#include "top.h"
-#include <ctype.h>
/* This is the debug switch for process record. */
unsigned int record_debug = 0;
@@ -423,7 +422,7 @@ get_insn_number (const char **arg)
begin = *arg;
pos = skip_spaces (begin);
- if (!isdigit (*pos))
+ if (!c_isdigit (*pos))
error (_("Expected positive number, got: %s."), pos);
number = strtoulst (pos, &end, 10);
@@ -443,7 +442,7 @@ get_context_size (const char **arg)
pos = skip_spaces (*arg);
- if (!isdigit (*pos))
+ if (!c_isdigit (*pos))
error (_("Expected positive number, got: %s."), pos);
long result = strtol (pos, &end, 10);
@@ -483,7 +482,7 @@ get_insn_history_modifiers (const char **arg)
for (; *args; ++args)
{
- if (isspace (*args))
+ if (c_isspace (*args))
break;
if (*args == '/')
@@ -627,7 +626,7 @@ get_call_history_modifiers (const char **arg)
for (; *args; ++args)
{
- if (isspace (*args))
+ if (c_isspace (*args))
break;
if (*args == '/')
@@ -769,9 +768,7 @@ set_record_call_history_size (const char *args, int from_tty,
&record_call_history_size);
}
-void _initialize_record ();
-void
-_initialize_record ()
+INIT_GDB_FILE (record)
{
struct cmd_list_element *c;
diff --git a/gdb/record.h b/gdb/record.h
index 049477c..c8594cc 100644
--- a/gdb/record.h
+++ b/gdb/record.h
@@ -1,6 +1,6 @@
/* Process record and replay target for GDB, the GNU debugger.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/regcache-dump.c b/gdb/regcache-dump.c
index 2719c92..c6ef552 100644
--- a/gdb/regcache-dump.c
+++ b/gdb/regcache-dump.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1986-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -346,9 +346,7 @@ maintenance_print_remote_registers (const char *args, int from_tty)
"maintenance print remote-registers");
}
-void _initialize_regcache_dump ();
-void
-_initialize_regcache_dump ()
+INIT_GDB_FILE (regcache_dump)
{
add_cmd ("registers", class_maintenance, maintenance_print_registers,
_("Print the internal register configuration.\n"
diff --git a/gdb/regcache.c b/gdb/regcache.c
index ad72429..cf4c5dd 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1,6 +1,6 @@
/* Cache and manage the values of registers for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1841,9 +1841,10 @@ reg_buffer_raw_compare_zero_len_test ()
const regcache *regcache
= get_thread_arch_regcache (&inf, ptid_t (1, 1), inf.arch ());
- /* The buffer address is irrelevant since we end up comparing 0 bytes, we just
- need to pass something. */
- gdb_byte buf;
+ /* The buffer address is irrelevant since we end up comparing 0 bytes, we
+ just need to pass something. The variable needs to be initialized to
+ avoid compiler warnings about uninitialized values. */
+ gdb_byte buf = 0;
SELF_CHECK (regcache->raw_compare (0, &buf, register_size (inf.arch (), 0)));
}
@@ -2213,9 +2214,7 @@ regcache_thread_ptid_changed ()
} /* namespace selftests */
#endif /* GDB_SELF_TEST */
-void _initialize_regcache ();
-void
-_initialize_regcache ()
+INIT_GDB_FILE (regcache)
{
struct cmd_list_element *c;
diff --git a/gdb/regcache.h b/gdb/regcache.h
index bbb17c8..7eb49b3 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -1,6 +1,6 @@
/* Cache and manage the values of registers for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/regformats/regdat.sh b/gdb/regformats/regdat.sh
index 49aa02a..7392bc8 100755
--- a/gdb/regformats/regdat.sh
+++ b/gdb/regformats/regdat.sh
@@ -1,7 +1,7 @@
#!/bin/sh -u
# Register protocol definitions for GDB, the GNU debugger.
-# Copyright (C) 2001-2024 Free Software Foundation, Inc.
+# Copyright (C) 2001-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/regformats/regdef.h b/gdb/regformats/regdef.h
index 8715229..944e577 100644
--- a/gdb/regformats/regdef.h
+++ b/gdb/regformats/regdef.h
@@ -1,5 +1,5 @@
/* Register protocol definition structures for the GNU Debugger
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/reggroups.c b/gdb/reggroups.c
index c28e19a..596b336 100644
--- a/gdb/reggroups.c
+++ b/gdb/reggroups.c
@@ -1,6 +1,6 @@
/* Register groupings for GDB, the GNU debugger.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Red Hat.
@@ -259,9 +259,7 @@ const reggroup *const all_reggroup = &all_group;
const reggroup *const save_reggroup = &save_group;
const reggroup *const restore_reggroup = &restore_group;
-void _initialize_reggroup ();
-void
-_initialize_reggroup ()
+INIT_GDB_FILE (reggroup)
{
add_cmd ("reggroups", class_maintenance,
maintenance_print_reggroups, _("\
diff --git a/gdb/reggroups.h b/gdb/reggroups.h
index 24f81e4..b89bcc0 100644
--- a/gdb/reggroups.h
+++ b/gdb/reggroups.h
@@ -1,6 +1,6 @@
/* Register groupings for GDB, the GNU debugger.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Red Hat.
diff --git a/gdb/registry.h b/gdb/registry.h
index 3221654..944d02c 100644
--- a/gdb/registry.h
+++ b/gdb/registry.h
@@ -1,6 +1,6 @@
/* Macros for general registry objects.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/regset.h b/gdb/regset.h
index 44eaf14..f161640 100644
--- a/gdb/regset.h
+++ b/gdb/regset.h
@@ -1,6 +1,6 @@
/* Manage register sets.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index fe6ac17..7f80de8 100644
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -1,6 +1,6 @@
/* Remote File-I/O communications
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/remote-fileio.h b/gdb/remote-fileio.h
index d406895..dbb295f 100644
--- a/gdb/remote-fileio.h
+++ b/gdb/remote-fileio.h
@@ -1,6 +1,6 @@
/* Remote File-I/O communications
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/remote-notif.c b/gdb/remote-notif.c
index d16f8d7..da1b578 100644
--- a/gdb/remote-notif.c
+++ b/gdb/remote-notif.c
@@ -1,6 +1,6 @@
/* Remote notification in GDB protocol
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -234,9 +234,7 @@ remote_notif_state::~remote_notif_state ()
delete_async_event_handler (&get_pending_events_token);
}
-void _initialize_notif ();
-void
-_initialize_notif ()
+INIT_GDB_FILE (notif)
{
add_setshow_boolean_cmd ("notification", no_class, &notif_debug,
_("\
diff --git a/gdb/remote-notif.h b/gdb/remote-notif.h
index cca26b0..bca5bd8 100644
--- a/gdb/remote-notif.h
+++ b/gdb/remote-notif.h
@@ -1,6 +1,6 @@
/* Remote notification in GDB protocol
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 8e2a54f..a325ffa 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -1,6 +1,6 @@
/* Generic remote debugging interface for simulators.
- Copyright (C) 1993-2024 Free Software Foundation, Inc.
+ Copyright (C) 1993-2025 Free Software Foundation, Inc.
Contributed by Cygnus Support.
Steve Chamberlain (sac@cygnus.com).
@@ -25,7 +25,6 @@
#include "inferior.h"
#include "infrun.h"
#include "value.h"
-#include <ctype.h>
#include <fcntl.h>
#include <signal.h>
#include <setjmp.h>
@@ -1284,9 +1283,7 @@ gdbsim_target::memory_map ()
return result;
}
-void _initialize_remote_sim ();
-void
-_initialize_remote_sim ()
+INIT_GDB_FILE (remote_sim)
{
struct cmd_list_element *c;
diff --git a/gdb/remote.c b/gdb/remote.c
index 66c58c8..858076b 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1,6 +1,6 @@
/* Remote target communications for serial-line targets in custom GDB protocol
- Copyright (C) 1988-2024 Free Software Foundation, Inc.
+ Copyright (C) 1988-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -19,9 +19,9 @@
/* See the GDB User Guide for details of the GDB remote protocol. */
-#include <ctype.h>
#include <fcntl.h>
#include "exceptions.h"
+#include "gdbsupport/common-inferior.h"
#include "inferior.h"
#include "infrun.h"
#include "bfd.h"
@@ -80,6 +80,8 @@
#include "async-event.h"
#include "gdbsupport/selftest.h"
#include "cli/cli-style.h"
+#include "gdbsupport/remote-args.h"
+#include "gdbsupport/gdb_argv_vec.h"
/* The remote target. */
@@ -250,6 +252,7 @@ enum {
PACKET_vFile_readlink,
PACKET_vFile_fstat,
PACKET_vFile_stat,
+ PACKET_vFile_lstat,
PACKET_qXfer_auxv,
PACKET_qXfer_features,
PACKET_qXfer_exec_file,
@@ -399,6 +402,13 @@ enum {
errors, and so they should not need to check for this feature. */
PACKET_accept_error_message,
+ /* Not really a packet; this indicates support for sending the vRun
+ inferior arguments as a single string. */
+ PACKET_vRun_single_argument,
+
+ /* Support the qExecAndArgs packet. */
+ PACKET_qExecAndArgs,
+
PACKET_MAX
};
@@ -824,6 +834,11 @@ struct remote_features
bool remote_memory_tagging_p () const
{ return packet_support (PACKET_memory_tagging_feature) == PACKET_ENABLE; }
+ /* Returns true if there is support for sending vRun inferior arguments
+ as a single string. */
+ bool remote_vrun_single_arg_p () const
+ { return packet_support (PACKET_vRun_single_argument) == PACKET_ENABLE; }
+
/* Reset all packets back to "unknown support". Called when opening a
new connection to a remote target. */
void reset_all_packet_configs_support ();
@@ -843,6 +858,84 @@ struct remote_features
packet_config m_protocol_packets[PACKET_MAX];
};
+/* Data structure used to hold the results of the qExecAndArgs packet. */
+
+struct remote_exec_and_args_info
+{
+ /* The result state reflects whether the packet is supported by the
+ remote target, and then which bits of state the remote target actually
+ returned to GDB . */
+ enum class state
+ {
+ /* The remote does not support the qExecAndArgs packet. GDB
+ should not make assumptions about the remote target's executable
+ and arguments. */
+ UNKNOWN,
+
+ /* The remote does understand the qExecAndArgs, no executable
+ (and/or arguments) were set at the remote end. If GDB wants the
+ remote to start an inferior it will need to provide this information. */
+ UNSET,
+
+ /* The remote does understand the qExecAndArgs, an executable
+ and/or arguments were set at the remote end and this information is
+ held within this object. */
+ SET
+ };
+
+ /* Create an empty instance, STATE should be state::UNKNOWN or
+ state::UNSET only. */
+ explicit remote_exec_and_args_info (state state = state::UNKNOWN)
+ : m_state (state)
+ {
+ gdb_assert (m_state != state::SET);
+ }
+
+ /* Create an instance in state::SET, move EXEC and ARGS into this
+ instance. */
+ explicit remote_exec_and_args_info (std::string &&exec, std::string &&args)
+ : m_state (state::SET),
+ m_exec (std::move (exec)),
+ m_args (std::move (args))
+ { /* Nothing. */ }
+
+ /* Is this object in state::SET? */
+ bool is_set () const
+ {
+ return m_state == state::SET;
+ }
+
+ /* Is this object in state::UNSET? */
+ bool is_unset () const
+ {
+ return m_state == state::UNSET;
+ }
+
+ /* Return the argument string. Only call when is_set returns true. */
+ const std::string &args () const
+ {
+ gdb_assert (m_state == state::SET);
+ return m_args;
+ }
+
+ /* Return the executable string. Only call when is_set returns true. */
+ const std::string &exec () const
+ {
+ gdb_assert (m_state == state::SET);
+ return m_exec;
+ }
+
+private:
+ /* The state of this instance. */
+ state m_state = state::UNKNOWN;
+
+ /* The executable path returned from the remote target. */
+ std::string m_exec;
+
+ /* The argument string returned from the remote target. */
+ std::string m_args;
+};
+
class remote_target : public process_stratum_target
{
public:
@@ -1022,8 +1115,8 @@ public:
int fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno) override;
- int fileio_stat (struct inferior *inf, const char *filename,
- struct stat *sb, fileio_error *target_errno) override;
+ int fileio_lstat (struct inferior *inf, const char *filename,
+ struct stat *sb, fileio_error *target_errno) override;
int fileio_close (int fd, fileio_error *target_errno) override;
@@ -1155,6 +1248,12 @@ public:
bool is_address_tagged (gdbarch *gdbarch, CORE_ADDR address) override;
+ /* A remote target can be shared if it is able to create new inferiors. */
+ bool is_shareable () override final
+ {
+ return true;
+ }
+
public: /* Remote specific methods. */
void remote_download_command_source (int num, ULONGEST addr,
@@ -1385,7 +1484,8 @@ public: /* Remote specific methods. */
void remote_kill_k ();
void extended_remote_disable_randomization (int val);
- int extended_remote_run (const std::string &args);
+ int extended_remote_run (const std::string &remote_exec_file,
+ const std::string &args);
void send_environment_packet (const char *action,
const char *packet,
@@ -1416,6 +1516,9 @@ public: /* Remote specific methods. */
private:
+ /* Fetch the executable filename and argument string from the remote. */
+ remote_exec_and_args_info fetch_remote_executable_and_arguments ();
+
bool start_remote_1 (int from_tty, int extended_p);
/* The remote state. Don't reference this directly. Use the
@@ -1512,15 +1615,72 @@ remote_register_is_expedited (int regnum)
return rs->last_seen_expedited_registers.count (regnum) > 0;
}
+/* An enum used to track where the per-program-space remote exec-file data
+ came from. This is useful when deciding which warnings to give to the
+ user. */
+
+enum class remote_exec_source
+{
+ /* The remote exec-file has it's default (empty string) value, neither
+ the user, nor the remote target have tried to set the value yet. */
+ DEFAULT_VALUE,
+
+ /* The remote exec-file value was set based on information fetched from
+ the remote target. We warn the user if we are replacing a value they
+ supplied with one fetched from the remote target. */
+ VALUE_FROM_REMOTE,
+
+ /* The remote exec-file value was set either directly by the user, or by
+ GDB after the inferior performed an exec. */
+ VALUE_FROM_GDB,
+
+ /* The remote exec-file has it's default (empty string) value, but this
+ is because the user hasn't supplied a value yet, and the remote target
+ has specifically told GDB that it has no default executable available. */
+ UNSET_VALUE,
+};
+
+/* Data held per program space for each remote target. */
+
+struct remote_per_progspace
+{
+ /* The following represents the remote exec-file filename. This value
+ can be set directly by the user with 'set remote exec-file', but can
+ also be set automatically when connecting to a remote target. We
+ track both the filename value, and also the source of this value, as
+ where the value came from determines when the filename value can be
+ auto-generated from other sources, or when a remote target can
+ override the current value. See show_remote_exec_file for details. */
+ struct exec_info
+ {
+ /* The 'remote exec-file' filename value. This will start empty. This
+ is set either with the 'set remote exec-file' command, or
+ automatically by GDB when connecting to a remote target. */
+ std::string filename;
+
+ /* An enum that indicates where FILENAME came from, or what an empty
+ VALUE means. */
+ remote_exec_source source = remote_exec_source::DEFAULT_VALUE;
+ } exec_info;
+};
+
/* Per-program-space data key. */
-static const registry<program_space>::key<char, gdb::xfree_deleter<char>>
+static const registry<program_space>::key<remote_per_progspace>
remote_pspace_data;
-/* The variable registered as the control variable used by the
- remote exec-file commands. While the remote exec-file setting is
- per-program-space, the set/show machinery uses this as the
- location of the remote exec-file value. */
-static std::string remote_exec_file_var;
+/* Retrieve the remote_per_progspace object for PSPACE. If no such object
+ yet exists then create a new one using the default constructor and
+ return that. */
+
+static remote_per_progspace &
+get_remote_progspace_info (program_space *pspace)
+{
+ remote_per_progspace *info = remote_pspace_data.get (pspace);
+ if (info == nullptr)
+ info = remote_pspace_data.emplace (pspace);
+ gdb_assert (info != nullptr);
+ return *info;
+}
/* The size to align memory write packets, when practical. The protocol
does not guarantee any alignment, and gdb will generate short
@@ -1850,47 +2010,55 @@ remote_target::get_remote_state ()
/* Fetch the remote exec-file from the current program space. */
-static const char *
-get_remote_exec_file (void)
+static const std::string &
+get_remote_exec_file ()
{
- char *remote_exec_file;
-
- remote_exec_file = remote_pspace_data.get (current_program_space);
- if (remote_exec_file == NULL)
- return "";
-
- return remote_exec_file;
+ const remote_per_progspace &info
+ = get_remote_progspace_info (current_program_space);
+ return info.exec_info.filename;
}
-/* Set the remote exec file for PSPACE. */
+/* Set the remote exec file for PSPACE. FILENAME is the new exec file
+ value, and SOURCE describes where FILENAME came from. */
static void
set_pspace_remote_exec_file (struct program_space *pspace,
- const char *remote_exec_file)
+ const std::string &filename,
+ remote_exec_source source)
{
- char *old_file = remote_pspace_data.get (pspace);
-
- xfree (old_file);
- remote_pspace_data.set (pspace, xstrdup (remote_exec_file));
+ remote_per_progspace &info = get_remote_progspace_info (pspace);
+ info.exec_info.filename = filename;
+ info.exec_info.source = source;
}
-/* The "set/show remote exec-file" set command hook. */
+/* The "set remote exec-file" callback. */
static void
-set_remote_exec_file (const char *ignored, int from_tty,
- struct cmd_list_element *c)
+set_remote_exec_file_cb (const std::string &filename)
{
- set_pspace_remote_exec_file (current_program_space,
- remote_exec_file_var.c_str ());
+ set_pspace_remote_exec_file (current_program_space, filename,
+ remote_exec_source::VALUE_FROM_GDB);
}
-/* The "set/show remote exec-file" show command hook. */
+/* Implement the "show remote exec-file" command. */
static void
show_remote_exec_file (struct ui_file *file, int from_tty,
struct cmd_list_element *cmd, const char *value)
{
- gdb_printf (file, "%s\n", get_remote_exec_file ());
+ const struct remote_per_progspace::exec_info &info
+ = get_remote_progspace_info (current_program_space).exec_info;
+
+ if (info.source == remote_exec_source::DEFAULT_VALUE)
+ gdb_printf (file, _("The remote exec-file is unset, the default "
+ "remote executable will be used.\n"));
+ else if (info.source == remote_exec_source::UNSET_VALUE)
+ gdb_printf (file, _("The remote exec-file is unset, the remote has "
+ "no default executable set.\n"));
+ else
+ gdb_printf (file, _("The remote exec-file is \"%ps\".\n"),
+ styled_string (file_name_style.style (),
+ info.filename.c_str ()));
}
static int
@@ -2556,7 +2724,7 @@ packet_check_result (const char *buf)
/* The stub recognized the packet request. Check that the
operation succeeded. */
if (buf[0] == 'E'
- && isxdigit (buf[1]) && isxdigit (buf[2])
+ && c_isxdigit (buf[1]) && c_isxdigit (buf[2])
&& buf[3] == '\0')
/* "Enn" - definitely an error. */
return packet_result::make_numeric_error (buf + 1);
@@ -2901,6 +3069,10 @@ remote_target::remote_add_inferior (bool fake_pid_p, int pid, int attached,
inf = add_inferior_with_spaces ();
}
switch_to_inferior_no_thread (inf);
+
+ /* Clear any data left by previous executions. */
+ target_pre_inferior ();
+
inf->push_target (this);
inferior_appeared (inf, pid);
}
@@ -3026,6 +3198,12 @@ remote_target::remote_notice_new_inferior (ptid_t currthread, bool executing)
inf = remote_add_inferior (fake_pid_p,
currthread.pid (), -1, 1);
+
+ /* Fetch the target description for this inferior. Make sure to
+ leave the currently selected inferior unchanged. */
+ scoped_restore_current_thread restore_thread;
+ switch_to_inferior_no_thread (inf);
+ target_find_description ();
}
/* This is really a new thread. Add it. */
@@ -4283,7 +4461,7 @@ static bool
has_single_non_exited_thread (inferior *inf)
{
int count = 0;
- for (thread_info *tp ATTRIBUTE_UNUSED : inf->non_exited_threads ())
+ for (thread_info &tp ATTRIBUTE_UNUSED : inf->non_exited_threads ())
if (++count > 1)
break;
return count == 1;
@@ -4321,19 +4499,19 @@ remote_target::update_thread_list ()
/* CONTEXT now holds the current thread list on the remote
target end. Delete GDB-side threads no longer found on the
target. */
- for (thread_info *tp : all_threads_safe ())
+ for (thread_info &tp : all_threads_safe ())
{
- if (tp->inf->process_target () != this)
+ if (tp.inf->process_target () != this)
continue;
- if (!context.contains_thread (tp->ptid))
+ if (!context.contains_thread (tp.ptid))
{
/* Do not remove the thread if it is the last thread in
the inferior. This situation happens when we have a
pending exit process status to process. Otherwise we
may end up with a seemingly live inferior (i.e. pid
!= 0) that has no threads. */
- if (has_single_non_exited_thread (tp->inf))
+ if (has_single_non_exited_thread (tp.inf))
continue;
/* Do not remove the thread if we've requested to be
@@ -4342,11 +4520,11 @@ remote_target::update_thread_list ()
exit event, and displaced stepping info is recorded
in the thread object. If we deleted the thread now,
we'd lose that info. */
- if ((tp->thread_options () & GDB_THREAD_OPTION_EXIT) != 0)
+ if ((tp.thread_options () & GDB_THREAD_OPTION_EXIT) != 0)
continue;
/* Not found. */
- delete_thread (tp);
+ delete_thread (&tp);
}
}
@@ -4656,8 +4834,6 @@ remote_target::get_offsets ()
if (bss_addr != data_addr)
warning (_("Target reported unsupported offsets: %s"), buf);
}
- else
- lose = 1;
}
else if (startswith (ptr, "TextSeg="))
{
@@ -4866,7 +5042,11 @@ remote_target::add_current_inferior_and_thread (const char *wait_status)
fake_pid_p = true;
}
- remote_add_inferior (fake_pid_p, curr_ptid.pid (), -1, 1);
+ const auto inf = remote_add_inferior (fake_pid_p, curr_ptid.pid (), -1, 1);
+ switch_to_inferior_no_thread (inf);
+
+ /* Fetch the target description for this inferior. */
+ target_find_description ();
/* Add the main thread and switch to it. Don't try reading
registers yet, since we haven't fetched the target description
@@ -4943,7 +5123,7 @@ remote_target::process_initial_stop_replies (int from_tty)
event_ptid = target_wait (waiton_ptid, &ws, TARGET_WNOHANG);
if (remote_debug)
- print_target_wait_results (waiton_ptid, event_ptid, ws);
+ print_target_wait_results (waiton_ptid, event_ptid, ws, this);
switch (ws.kind ())
{
@@ -5005,6 +5185,24 @@ remote_target::process_initial_stop_replies (int from_tty)
the inferiors. */
if (!non_stop)
{
+ /* Ensure changes to the thread state are propagated to the
+ frontend. In non-stop mode only the current inferior will be
+ stopped, but in all-stop mode, all inferiors will change, and
+ the frontend will need updating. */
+ process_stratum_target *finish_target;
+ ptid_t finish_ptid;
+ if (non_stop)
+ {
+ finish_target = current_inferior ()->process_target ();
+ finish_ptid = ptid_t (current_inferior ()->pid);
+ }
+ else
+ {
+ finish_target = nullptr;
+ finish_ptid = minus_one_ptid;
+ }
+ scoped_finish_thread_state finish_state (finish_target, finish_ptid);
+
{
/* At this point, the remote target is not async. It needs to be for
the poll in stop_all_threads to consider events from it, so enable
@@ -5031,26 +5229,26 @@ remote_target::process_initial_stop_replies (int from_tty)
/* Now go over all threads that are stopped, and print their current
frame. If all-stop, then if there's a signalled thread, pick
that as current. */
- for (thread_info *thread : all_non_exited_threads (this))
+ for (thread_info &thread : all_non_exited_threads (this))
{
if (first == NULL)
- first = thread;
+ first = &thread;
if (!non_stop)
- thread->set_running (false);
- else if (thread->state != THREAD_STOPPED)
+ thread.set_running (false);
+ else if (thread.state != THREAD_STOPPED)
continue;
- if (selected == nullptr && thread->has_pending_waitstatus ())
- selected = thread;
+ if (selected == nullptr && thread.has_pending_waitstatus ())
+ selected = &thread;
if (lowest_stopped == NULL
- || thread->inf->num < lowest_stopped->inf->num
- || thread->per_inf_num < lowest_stopped->per_inf_num)
- lowest_stopped = thread;
+ || thread.inf->num < lowest_stopped->inf->num
+ || thread.per_inf_num < lowest_stopped->per_inf_num)
+ lowest_stopped = &thread;
if (non_stop)
- print_one_stopped_thread (thread);
+ print_one_stopped_thread (&thread);
}
/* In all-stop, we only print the status of one thread, and leave
@@ -5115,6 +5313,93 @@ as_stop_reply_up (notif_event_up event)
return stop_reply_up (stop_reply);
}
+/* Read, decode, and return a hex-encoded string from *PTR. Update *PTR to
+ point at the first character past the end of the string that was read
+ in. */
+
+static std::string
+get_semicolon_delimited_hex_as_string (const char **ptr)
+{
+ const char *end = *ptr;
+
+ for (; *end != ';' && *end != '\0'; ++end)
+ ;
+
+ std::string str = hex2str (*ptr, (end - *ptr) / 2);
+ *ptr = end;
+ return str;
+}
+
+/* See declaration in class above. */
+
+remote_exec_and_args_info
+remote_target::fetch_remote_executable_and_arguments ()
+{
+ /* Setup some constants. This helps keep the return lines shorter in the
+ rest of this function. */
+ constexpr remote_exec_and_args_info::state UNKNOWN
+ = remote_exec_and_args_info::state::UNKNOWN;
+ constexpr remote_exec_and_args_info::state UNSET
+ = remote_exec_and_args_info::state::UNSET;
+
+ if (m_features.packet_support (PACKET_qExecAndArgs) == PACKET_DISABLE)
+ return remote_exec_and_args_info (UNKNOWN);
+
+ struct remote_state *rs = get_remote_state ();
+
+ putpkt ("qExecAndArgs");
+ getpkt (&rs->buf, 0);
+
+ packet_result result
+ = m_features.packet_ok (rs->buf, PACKET_qExecAndArgs);
+ switch (result.status ())
+ {
+ case PACKET_ERROR:
+ warning (_("Remote error: %s"), result.err_msg ());
+ [[fallthrough]];
+ case PACKET_UNKNOWN:
+ return remote_exec_and_args_info (UNKNOWN);
+ case PACKET_OK:
+ break;
+ }
+
+ /* First character should be 'U', to indicate no information is set in
+ the server, or 'S' followed by the filename and arguments. We treat
+ anything that is not a 'S' as if it were 'U'. */
+ if (rs->buf[0] != 'S')
+ return remote_exec_and_args_info (UNSET);
+
+ if (rs->buf[1] != ';')
+ {
+ warning (_("missing first ';' in qExecAndArgs reply"));
+ return remote_exec_and_args_info (UNSET);
+ }
+
+ std::string filename, args;
+
+ try
+ {
+ const char *ptr = &rs->buf[2];
+ filename = get_semicolon_delimited_hex_as_string (&ptr);
+
+ /* PTR now points either at a semicolon, or at the end of the incoming
+ buffer data. If we are looking at a semicolon, then skip it. */
+ if (*ptr == ';')
+ ++ptr;
+
+ /* We'll collect the inferior arguments in ARGS. */
+ args = get_semicolon_delimited_hex_as_string (&ptr);
+ }
+ catch (const gdb_exception_error &ex)
+ {
+ warning (_("unable to decode qExecAndArgs reply: %s"),
+ ex.what ());
+ return remote_exec_and_args_info (UNKNOWN);
+ }
+
+ return remote_exec_and_args_info (std::move (filename), std::move (args));
+}
+
/* Helper for remote_target::start_remote, start the remote connection and
sync state. Return true if everything goes OK, otherwise, return false.
This function exists so that the scoped_restore created within it will
@@ -5200,6 +5485,41 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
rs->noack_mode = 1;
}
+ remote_exec_and_args_info exec_and_args
+ = fetch_remote_executable_and_arguments ();
+
+ /* Update the inferior with the executable and argument string from the
+ target, these will be used when restarting the inferior, and also
+ allow the user to view this state. */
+ if (exec_and_args.is_set ())
+ {
+ current_inferior ()->set_args (exec_and_args.args ());
+ if (!exec_and_args.exec ().empty ())
+ {
+ struct remote_per_progspace::exec_info &info
+ = get_remote_progspace_info (current_program_space).exec_info;
+ if (info.source == remote_exec_source::VALUE_FROM_GDB
+ && info.filename != exec_and_args.exec ())
+ warning (_("updating 'remote exec-file' to '%ps' to match "
+ "remote target"),
+ styled_string (file_name_style.style (),
+ exec_and_args.exec ().c_str ()));
+ info.filename = exec_and_args.exec ();
+ info.source = remote_exec_source::VALUE_FROM_REMOTE;
+ }
+ }
+ else if (exec_and_args.is_unset ())
+ {
+ struct remote_per_progspace::exec_info &info
+ = get_remote_progspace_info (current_program_space).exec_info;
+ if (info.source == remote_exec_source::DEFAULT_VALUE
+ || info.source == remote_exec_source::VALUE_FROM_REMOTE)
+ {
+ info.filename.clear ();
+ info.source = remote_exec_source::UNSET_VALUE;
+ }
+ }
+
if (extended_p)
{
/* Tell the remote that we are using the extended protocol. */
@@ -5318,10 +5638,10 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
remote_debug_printf ("warning: couldn't determine remote "
"current thread; picking first in list.");
- for (thread_info *tp : all_non_exited_threads (this,
+ for (thread_info &tp : all_non_exited_threads (this,
minus_one_ptid))
{
- switch_to_thread (tp);
+ switch_to_thread (&tp);
break;
}
}
@@ -5862,6 +6182,8 @@ static const struct protocol_feature remote_protocol_features[] = {
{ "error-message", PACKET_ENABLE, remote_supported_packet,
PACKET_accept_error_message },
{ "binary-upload", PACKET_DISABLE, remote_supported_packet, PACKET_x },
+ { "single-inf-arg", PACKET_DISABLE, remote_supported_packet,
+ PACKET_vRun_single_argument },
};
static char *remote_support_xml;
@@ -5973,6 +6295,10 @@ remote_target::remote_query_supported ()
!= AUTO_BOOLEAN_FALSE)
remote_query_supported_append (&q, "memory-tagging+");
+ if (m_features.packet_set_cmd_state (PACKET_vRun_single_argument)
+ != AUTO_BOOLEAN_FALSE)
+ remote_query_supported_append (&q, "single-inf-arg+");
+
/* Keep this one last to work around a gdbserver <= 7.10 bug in
the qSupported:xmlRegisters=i386 handling. */
if (remote_support_xml != NULL
@@ -6164,10 +6490,29 @@ remote_unpush_target (remote_target *target)
/* We have to unpush the target from all inferiors, even those that
aren't running. */
scoped_restore_current_inferior restore_current_inferior;
+ scoped_restore_current_program_space restore_program_space;
for (inferior *inf : all_inferiors (target))
{
switch_to_inferior_no_thread (inf);
+
+ /* If this remote told INF specifically, that there was no inferior
+ currently set, then reset this state back to GDB being in the
+ default state.
+
+ If however, the INF was set, either from the GDB side, or even
+ from the remote side, then we retain the current setting. The
+ assumption is that the user is, or will, be debugging the same
+ executable again in the future, so clearing an existing value
+ would be unhelpful. */
+ struct remote_per_progspace::exec_info &exec_info
+ = get_remote_progspace_info (inf->pspace).exec_info;
+ if (exec_info.source == remote_exec_source::UNSET_VALUE)
+ {
+ gdb_assert (exec_info.filename.empty ());
+ exec_info.source = remote_exec_source::DEFAULT_VALUE;
+ }
+
inf->pop_all_targets_at_and_above (process_stratum);
generic_mourn_inferior ();
}
@@ -6485,9 +6830,9 @@ remote_target::remote_detach_1 (inferior *inf, int from_tty)
/* See if any thread of the inferior we are detaching has a pending fork
status. In that case, we must detach from the child resulting from
that fork. */
- for (thread_info *thread : inf->non_exited_threads ())
+ for (thread_info &thread : inf->non_exited_threads ())
{
- const target_waitstatus *ws = thread_pending_fork_status (thread);
+ const target_waitstatus *ws = thread_pending_fork_status (&thread);
if (ws == nullptr)
continue;
@@ -6601,7 +6946,8 @@ remote_target::follow_exec (inferior *follow_inf, ptid_t ptid,
if (is_target_filename (execd_pathname))
execd_pathname += strlen (TARGET_SYSROOT_PREFIX);
- set_pspace_remote_exec_file (follow_inf->pspace, execd_pathname);
+ set_pspace_remote_exec_file (follow_inf->pspace, execd_pathname,
+ remote_exec_source::VALUE_FROM_GDB);
}
/* Same as remote_detach, but don't send the "D" packet; just disconnect. */
@@ -6890,14 +7236,14 @@ char *
remote_target::append_pending_thread_resumptions (char *p, char *endp,
ptid_t ptid)
{
- for (thread_info *thread : all_non_exited_threads (this, ptid))
- if (inferior_ptid != thread->ptid
- && thread->stop_signal () != GDB_SIGNAL_0)
+ for (thread_info &thread : all_non_exited_threads (this, ptid))
+ if (inferior_ptid != thread.ptid
+ && thread.stop_signal () != GDB_SIGNAL_0)
{
- p = append_resumption (p, endp, thread->ptid,
- 0, thread->stop_signal ());
- thread->set_stop_signal (GDB_SIGNAL_0);
- resume_clear_thread_private_info (thread);
+ p = append_resumption (p, endp, thread.ptid,
+ 0, thread.stop_signal ());
+ thread.set_stop_signal (GDB_SIGNAL_0);
+ resume_clear_thread_private_info (&thread);
}
return p;
@@ -6923,8 +7269,8 @@ remote_target::remote_resume_with_hc (ptid_t ptid, int step,
else
set_continue_thread (ptid);
- for (thread_info *thread : all_non_exited_threads (this))
- resume_clear_thread_private_info (thread);
+ for (thread_info &thread : all_non_exited_threads (this))
+ resume_clear_thread_private_info (&thread);
buf = rs->buf.data ();
if (::execution_direction == EXEC_REVERSE)
@@ -7086,8 +7432,8 @@ remote_target::resume (ptid_t scope_ptid, int step, enum gdb_signal siggnal)
remote_resume_with_hc (scope_ptid, step, siggnal);
/* Update resumed state tracked by the remote target. */
- for (thread_info *tp : all_non_exited_threads (this, scope_ptid))
- get_remote_thread_info (tp)->set_resumed ();
+ for (thread_info &tp : all_non_exited_threads (this, scope_ptid))
+ get_remote_thread_info (&tp)->set_resumed ();
/* We've just told the target to resume. The remote server will
wait for the inferior to stop, and then send a stop reply. In
@@ -7299,15 +7645,15 @@ remote_target::commit_resumed ()
bool any_pending_vcont_resume = false;
- for (thread_info *tp : all_non_exited_threads (this))
+ for (thread_info &tp : all_non_exited_threads (this))
{
- remote_thread_info *priv = get_remote_thread_info (tp);
+ remote_thread_info *priv = get_remote_thread_info (&tp);
/* If a thread of a process is not meant to be resumed, then we
can't wildcard that process. */
if (priv->get_resume_state () == resume_state::NOT_RESUMED)
{
- get_remote_inferior (tp->inf)->may_wildcard_vcont = false;
+ get_remote_inferior (tp.inf)->may_wildcard_vcont = false;
/* And if we can't wildcard a process, we can't wildcard
everything either. */
@@ -7321,7 +7667,7 @@ remote_target::commit_resumed ()
/* If a thread is the parent of an unfollowed fork/vfork/clone,
then we can't do a global wildcard, as that would resume the
pending child. */
- if (thread_pending_child_status (tp) != nullptr)
+ if (thread_pending_child_status (&tp) != nullptr)
may_global_wildcard_vcont = false;
}
@@ -7338,9 +7684,9 @@ remote_target::commit_resumed ()
struct vcont_builder vcont_builder (this);
/* Threads first. */
- for (thread_info *tp : all_non_exited_threads (this))
+ for (thread_info &tp : all_non_exited_threads (this))
{
- remote_thread_info *remote_thr = get_remote_thread_info (tp);
+ remote_thread_info *remote_thr = get_remote_thread_info (&tp);
/* If the thread was previously vCont-resumed, no need to send a specific
action for it. If we didn't receive a resume request for it, don't
@@ -7348,14 +7694,14 @@ remote_target::commit_resumed ()
if (remote_thr->get_resume_state () != resume_state::RESUMED_PENDING_VCONT)
continue;
- gdb_assert (!thread_is_in_step_over_chain (tp));
+ gdb_assert (!thread_is_in_step_over_chain (&tp));
/* We should never be commit-resuming a thread that has a stop reply.
Otherwise, we would end up reporting a stop event for a thread while
it is running on the remote target. */
remote_state *rs = get_remote_state ();
for (const auto &stop_reply : rs->stop_reply_queue)
- gdb_assert (stop_reply->ptid != tp->ptid);
+ gdb_assert (stop_reply->ptid != tp.ptid);
const resumed_pending_vcont_info &info
= remote_thr->resumed_pending_vcont_info ();
@@ -7363,8 +7709,8 @@ remote_target::commit_resumed ()
/* Check if we need to send a specific action for this thread. If not,
it will be included in a wildcard resume instead. */
if (info.step || info.sig != GDB_SIGNAL_0
- || !get_remote_inferior (tp->inf)->may_wildcard_vcont)
- vcont_builder.push_action (tp->ptid, info.step, info.sig);
+ || !get_remote_inferior (tp.inf)->may_wildcard_vcont)
+ vcont_builder.push_action (tp.ptid, info.step, info.sig);
remote_thr->set_resumed ();
}
@@ -7447,9 +7793,9 @@ remote_target::remote_stop_ns (ptid_t ptid)
whether the thread wasn't resumed with a signal. Generating a
phony stop in that case would result in losing the signal. */
bool needs_commit = false;
- for (thread_info *tp : all_non_exited_threads (this, ptid))
+ for (thread_info &tp : all_non_exited_threads (this, ptid))
{
- remote_thread_info *remote_thr = get_remote_thread_info (tp);
+ remote_thread_info *remote_thr = get_remote_thread_info (&tp);
if (remote_thr->get_resume_state ()
== resume_state::RESUMED_PENDING_VCONT)
@@ -7470,17 +7816,17 @@ remote_target::remote_stop_ns (ptid_t ptid)
if (needs_commit)
commit_resumed ();
else
- for (thread_info *tp : all_non_exited_threads (this, ptid))
+ for (thread_info &tp : all_non_exited_threads (this, ptid))
{
- remote_thread_info *remote_thr = get_remote_thread_info (tp);
+ remote_thread_info *remote_thr = get_remote_thread_info (&tp);
if (remote_thr->get_resume_state ()
== resume_state::RESUMED_PENDING_VCONT)
{
remote_debug_printf ("Enqueueing phony stop reply for thread pending "
- "vCont-resume (%d, %ld, %s)", tp->ptid.pid(),
- tp->ptid.lwp (),
- pulongest (tp->ptid.tid ()));
+ "vCont-resume (%d, %ld, %s)", tp.ptid.pid(),
+ tp.ptid.lwp (),
+ pulongest (tp.ptid.tid ()));
/* Check that the thread wasn't resumed with a signal.
Generating a phony stop would result in losing the
@@ -7490,10 +7836,10 @@ remote_target::remote_stop_ns (ptid_t ptid)
gdb_assert (info.sig == GDB_SIGNAL_0);
stop_reply_up sr = std::make_unique<stop_reply> ();
- sr->ptid = tp->ptid;
+ sr->ptid = tp.ptid;
sr->rs = rs;
sr->ws.set_stopped (GDB_SIGNAL_0);
- sr->arch = tp->inf->arch ();
+ sr->arch = tp.inf->arch ();
sr->stop_reason = TARGET_STOPPED_BY_NO_REASON;
sr->watch_data_address = 0;
sr->core = 0;
@@ -7789,9 +8135,9 @@ remote_target::remove_new_children (threads_listing_context *context)
/* For any threads stopped at a (v)fork/clone event, remove the
corresponding child threads from the CONTEXT list. */
- for (thread_info *thread : all_non_exited_threads (this))
+ for (thread_info &thread : all_non_exited_threads (this))
{
- const target_waitstatus *ws = thread_pending_child_status (thread);
+ const target_waitstatus *ws = thread_pending_child_status (&thread);
if (ws == nullptr)
continue;
@@ -8486,17 +8832,17 @@ remote_target::select_thread_for_ambiguous_stop_reply
/* Consider all non-exited threads of the target, find the first resumed
one. */
- for (thread_info *thr : all_non_exited_threads (this))
+ for (thread_info &thr : all_non_exited_threads (this))
{
- remote_thread_info *remote_thr = get_remote_thread_info (thr);
+ remote_thread_info *remote_thr = get_remote_thread_info (&thr);
if (remote_thr->get_resume_state () != resume_state::RESUMED)
continue;
if (first_resumed_thread == nullptr)
- first_resumed_thread = thr;
+ first_resumed_thread = &thr;
else if (!process_wide_stop
- || first_resumed_thread->ptid.pid () != thr->ptid.pid ())
+ || first_resumed_thread->ptid.pid () != thr.ptid.pid ())
ambiguous = true;
}
@@ -8606,8 +8952,8 @@ remote_target::process_stop_reply (stop_reply_up stop_reply,
{
/* If the target works in all-stop mode, a stop-reply indicates that
all the target's threads stopped. */
- for (thread_info *tp : all_non_exited_threads (this))
- get_remote_thread_info (tp)->set_not_resumed ();
+ for (thread_info &tp : all_non_exited_threads (this))
+ get_remote_thread_info (&tp)->set_not_resumed ();
}
}
@@ -8675,9 +9021,9 @@ remote_target::wait_ns (ptid_t ptid, struct target_waitstatus *status,
static ptid_t
first_remote_resumed_thread (remote_target *target)
{
- for (thread_info *tp : all_non_exited_threads (target, minus_one_ptid))
- if (tp->resumed ())
- return tp->ptid;
+ for (thread_info &tp : all_non_exited_threads (target, minus_one_ptid))
+ if (tp.resumed ())
+ return tp.ptid;
return null_ptid;
}
@@ -9035,7 +9381,7 @@ remote_target::process_g_packet (struct regcache *regcache)
/* Reply describes registers byte by byte, each byte encoded as two
hex characters. Suck them all up, then supply them to the
- register cacheing/storage mechanism. */
+ register caching/storage mechanism. */
p = rs->buf.data ();
for (i = 0; i < rsa->sizeof_g_packet; i++)
@@ -10602,9 +10948,9 @@ remote_target::kill_new_fork_children (inferior *inf)
/* Kill the fork child threads of any threads in inferior INF that are stopped
at a fork event. */
- for (thread_info *thread : inf->non_exited_threads ())
+ for (thread_info &thread : inf->non_exited_threads ())
{
- const target_waitstatus *ws = thread_pending_fork_status (thread);
+ const target_waitstatus *ws = thread_pending_fork_status (&thread);
if (ws == nullptr)
continue;
@@ -10814,11 +11160,11 @@ remote_target::extended_remote_disable_randomization (int val)
}
int
-remote_target::extended_remote_run (const std::string &args)
+remote_target::extended_remote_run (const std::string &remote_exec_file,
+ const std::string &args)
{
struct remote_state *rs = get_remote_state ();
int len;
- const char *remote_exec_file = get_remote_exec_file ();
/* If the user has disabled vRun support, or we have detected that
support is not available, do not try it. */
@@ -10828,23 +11174,27 @@ remote_target::extended_remote_run (const std::string &args)
strcpy (rs->buf.data (), "vRun;");
len = strlen (rs->buf.data ());
- if (strlen (remote_exec_file) * 2 + len >= get_remote_packet_size ())
+ if (remote_exec_file.size () * 2 + len >= get_remote_packet_size ())
error (_("Remote file name too long for run packet"));
- len += 2 * bin2hex ((gdb_byte *) remote_exec_file, rs->buf.data () + len,
- strlen (remote_exec_file));
+ len += 2 * bin2hex ((gdb_byte *) remote_exec_file.data (),
+ rs->buf.data () + len,
+ remote_exec_file.size ());
if (!args.empty ())
{
- int i;
+ std::vector<std::string> split_args;
+ if (!m_features.remote_vrun_single_arg_p ())
+ split_args = gdb::remote_args::split (args);
+ else
+ split_args.push_back (args);
- gdb_argv argv (args.c_str ());
- for (i = 0; argv[i] != NULL; i++)
+ for (const auto &a : split_args)
{
- if (strlen (argv[i]) * 2 + 1 + len >= get_remote_packet_size ())
+ if (a.size () * 2 + 1 + len >= get_remote_packet_size ())
error (_("Argument list too long for run packet"));
rs->buf[len++] = ';';
- len += 2 * bin2hex ((gdb_byte *) argv[i], rs->buf.data () + len,
- strlen (argv[i]));
+ len += 2 * bin2hex ((gdb_byte *) a.c_str (), rs->buf.data () + len,
+ a.size ());
}
}
@@ -10872,7 +11222,7 @@ remote_target::extended_remote_run (const std::string &args)
"try \"set remote exec-file\"?"));
else
error (_("Running \"%s\" on the remote target failed"),
- remote_exec_file);
+ remote_exec_file.c_str ());
default:
gdb_assert_not_reached ("bad switch");
}
@@ -10992,7 +11342,7 @@ extended_remote_target::create_inferior (const char *exec_file,
int run_worked;
char *stop_reply;
struct remote_state *rs = get_remote_state ();
- const char *remote_exec_file = get_remote_exec_file ();
+ const std::string &remote_exec_file = get_remote_exec_file ();
/* If running asynchronously, register the target file descriptor
with the event loop. */
@@ -11022,7 +11372,7 @@ Remote replied unexpectedly while setting startup-with-shell: %s"),
extended_remote_set_inferior_cwd ();
/* Now restart the remote server. */
- run_worked = extended_remote_run (args) != -1;
+ run_worked = extended_remote_run (remote_exec_file, args) != -1;
if (!run_worked)
{
/* vRun was not supported. Fail if we need it to do what the
@@ -11650,7 +12000,7 @@ remote_target::remote_write_qxfer (const char *object_name,
i = snprintf (rs->buf.data (), max_size,
"qXfer:%s:write:%s:%s:",
object_name, annex ? annex : "",
- phex_nz (offset, sizeof offset));
+ phex_nz (offset));
max_size -= (i + 1);
/* Escape as much data as fits into rs->buf. */
@@ -11715,8 +12065,8 @@ remote_target::remote_read_qxfer (const char *object_name,
snprintf (rs->buf.data (), get_remote_packet_size () - 4,
"qXfer:%s:read:%s:%s,%s",
object_name, annex ? annex : "",
- phex_nz (offset, sizeof offset),
- phex_nz (n, sizeof n));
+ phex_nz (offset),
+ phex_nz (n));
i = putpkt (rs->buf);
if (i < 0)
return TARGET_XFER_E_IO;
@@ -11935,7 +12285,7 @@ remote_target::xfer_partial (enum target_object object,
while (annex[i] && (i < (get_remote_packet_size () - 8)))
{
/* Bad caller may have sent forbidden characters. */
- gdb_assert (isprint (annex[i]) && annex[i] != '$' && annex[i] != '#');
+ gdb_assert (c_isprint (annex[i]) && annex[i] != '$' && annex[i] != '#');
*p2++ = annex[i];
i++;
}
@@ -12014,7 +12364,7 @@ remote_target::search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
i = snprintf (rs->buf.data (), max_size,
"qSearch:memory:%s;%s;",
phex_nz (start_addr, addr_size),
- phex_nz (search_space_len, sizeof (search_space_len)));
+ phex_nz (search_space_len));
max_size -= (i + 1);
/* Escape as much data as fits into rs->buf. */
@@ -12185,7 +12535,7 @@ private:
for (int i = 0; i < buf.size (); ++i)
{
gdb_byte c = buf[i];
- if (isprint (c))
+ if (c_isprint (c))
gdb_putc (c, &stb);
else
gdb_printf (&stb, "\\x%02x", (unsigned char) c);
@@ -12232,6 +12582,51 @@ cli_packet_command (const char *args, int from_tty)
send_remote_packet (view, &cb);
}
+/* Implement 'maint test-remote-args' command.
+
+ Treat ARGS as an argument string. Split the remote arguments using
+ gdb::remote_args::split, and then join using gdb::remote_args::join.
+ The split and joined arguments are printed out. Additionally, the
+ joined arguments are split and joined a second time, and compared to the
+ result of the first join, this provides some basic validation that GDB
+ sess the joined arguments as equivalent to the original argument
+ string. */
+
+static void
+test_remote_args_command (const char *args, int from_tty)
+{
+ std::vector<std::string> split_args = gdb::remote_args::split (args);
+
+ gdb_printf ("Input (%s)\n", args);
+ for (const std::string &a : split_args)
+ gdb_printf (" (%s)\n", a.c_str ());
+
+ gdb::argv_vec tmp_split_args;
+ for (const std::string &a : split_args)
+ tmp_split_args.emplace_back (xstrdup (a.c_str ()));
+
+ std::string joined_args = gdb::remote_args::join (tmp_split_args.get ());
+
+ gdb_printf ("Output (%s)\n", joined_args.c_str ());
+
+ std::vector<std::string> resplit = gdb::remote_args::split (joined_args);
+
+ tmp_split_args.clear ();
+ for (const std::string &a : resplit)
+ tmp_split_args.emplace_back (xstrdup (a.c_str ()));
+
+ std::string rejoined = gdb::remote_args::join (tmp_split_args.get ());
+
+ if (joined_args != rejoined || split_args != resplit)
+ {
+ gdb_printf ("FAILURE ON REJOINING\n");
+ gdb_printf ("Resplit args:\n");
+ for (const auto & a : resplit)
+ gdb_printf (" (%s)\n", a.c_str ());
+ gdb_printf ("Rejoined (%s)\n", rejoined.c_str ());
+ }
+}
+
#if 0
/* --------- UNIT_TEST for THREAD oriented PACKETS ------------------- */
@@ -13149,7 +13544,7 @@ remote_target::fileio_readlink (struct inferior *inf, const char *filename,
return ret;
}
-/* Helper function to handle ::fileio_fstat and ::fileio_stat result
+/* Helper function to handle ::fileio_fstat and ::fileio_lstat result
processing. When this function is called the remote syscall has been
performed and we know we didn't get an error back.
@@ -13160,10 +13555,10 @@ remote_target::fileio_readlink (struct inferior *inf, const char *filename,
data) is to be placed in ST. */
static int
-fileio_process_fstat_and_stat_reply (const char *attachment,
- int attachment_len,
- int expected_len,
- struct stat *st)
+fileio_process_fstat_and_lstat_reply (const char *attachment,
+ int attachment_len,
+ int expected_len,
+ struct stat *st)
{
struct fio_stat fst;
@@ -13225,15 +13620,15 @@ remote_target::fileio_fstat (int fd, struct stat *st, fileio_error *remote_errno
return 0;
}
- return fileio_process_fstat_and_stat_reply (attachment, attachment_len,
- ret, st);
+ return fileio_process_fstat_and_lstat_reply (attachment, attachment_len,
+ ret, st);
}
-/* Implementation of to_fileio_stat. */
+/* Implementation of to_fileio_lstat. */
int
-remote_target::fileio_stat (struct inferior *inf, const char *filename,
- struct stat *st, fileio_error *remote_errno)
+remote_target::fileio_lstat (struct inferior *inf, const char *filename,
+ struct stat *st, fileio_error *remote_errno)
{
struct remote_state *rs = get_remote_state ();
char *p = rs->buf.data ();
@@ -13242,14 +13637,14 @@ remote_target::fileio_stat (struct inferior *inf, const char *filename,
if (remote_hostio_set_filesystem (inf, remote_errno) != 0)
return {};
- remote_buffer_add_string (&p, &left, "vFile:stat:");
+ remote_buffer_add_string (&p, &left, "vFile:lstat:");
remote_buffer_add_bytes (&p, &left, (const gdb_byte *) filename,
strlen (filename));
int attachment_len;
const char *attachment;
- int ret = remote_hostio_send_command (p - rs->buf.data (), PACKET_vFile_stat,
+ int ret = remote_hostio_send_command (p - rs->buf.data (), PACKET_vFile_lstat,
remote_errno, &attachment,
&attachment_len);
@@ -13258,8 +13653,8 @@ remote_target::fileio_stat (struct inferior *inf, const char *filename,
if (ret < 0)
return ret;
- return fileio_process_fstat_and_stat_reply (attachment, attachment_len,
- ret, st);
+ return fileio_process_fstat_and_lstat_reply (attachment, attachment_len,
+ ret, st);
}
/* Implementation of to_filesystem_is_local. */
@@ -13763,7 +14158,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
encode_actions_rsp (loc, &tdp_actions, &stepping_actions);
tpaddr = loc->address;
- strcpy (addrbuf, phex (tpaddr, sizeof (CORE_ADDR)));
+ strcpy (addrbuf, phex (tpaddr));
ret = snprintf (buf.data (), buf.size (), "QTDP:%x:%s:%c:%lx:%x",
b->number, addrbuf, /* address */
(b->enable_state == bp_enabled ? 'E' : 'D'),
@@ -14027,7 +14422,7 @@ remote_target::enable_tracepoint (struct bp_location *location)
xsnprintf (rs->buf.data (), get_remote_packet_size (), "QTEnable:%x:%s",
location->owner->number,
- phex (location->address, sizeof (CORE_ADDR)));
+ phex (location->address));
putpkt (rs->buf);
remote_get_noisy_reply ();
if (rs->buf[0] == '\0')
@@ -14043,7 +14438,7 @@ remote_target::disable_tracepoint (struct bp_location *location)
xsnprintf (rs->buf.data (), get_remote_packet_size (), "QTDisable:%x:%s",
location->owner->number,
- phex (location->address, sizeof (CORE_ADDR)));
+ phex (location->address));
putpkt (rs->buf);
remote_get_noisy_reply ();
if (rs->buf[0] == '\0')
@@ -15083,10 +15478,10 @@ remote_target::remote_btrace_maybe_reopen ()
if (m_features.packet_support (PACKET_qXfer_btrace_conf) != PACKET_ENABLE)
return;
- for (thread_info *tp : all_non_exited_threads (this))
+ for (thread_info &tp : all_non_exited_threads (this))
{
memset (&rs->btrace_config, 0x00, sizeof (struct btrace_config));
- btrace_read_config (tp, &rs->btrace_config);
+ btrace_read_config (&tp, &rs->btrace_config);
if (rs->btrace_config.format == BTRACE_FORMAT_NONE)
continue;
@@ -15116,8 +15511,7 @@ remote_target::remote_btrace_maybe_reopen ()
btrace_format_string (rs->btrace_config.format));
}
- tp->btrace.target
- = new btrace_target_info { tp->ptid, rs->btrace_config };
+ tp.btrace.target = new btrace_target_info { tp.ptid, rs->btrace_config };
}
}
@@ -15353,18 +15747,18 @@ remote_target::thread_handle_to_thread_info (const gdb_byte *thread_handle,
int handle_len,
inferior *inf)
{
- for (thread_info *tp : all_non_exited_threads (this))
+ for (thread_info &tp : all_non_exited_threads (this))
{
- remote_thread_info *priv = get_remote_thread_info (tp);
+ remote_thread_info *priv = get_remote_thread_info (&tp);
- if (tp->inf == inf && priv != NULL)
+ if (tp.inf == inf && priv != NULL)
{
if (handle_len != priv->thread_handle.size ())
error (_("Thread handle size mismatch: %d vs %zu (from remote)"),
handle_len, priv->thread_handle.size ());
if (memcmp (thread_handle, priv->thread_handle.data (),
handle_len) == 0)
- return tp;
+ return &tp;
}
}
@@ -15551,9 +15945,9 @@ remote_target::commit_requested_thread_options ()
/* Now set non-zero options for threads that need them. We don't
bother with the case of all threads of a process wanting the same
non-zero options as that's not an expected scenario. */
- for (thread_info *tp : all_non_exited_threads (this))
+ for (thread_info &tp : all_non_exited_threads (this))
{
- gdb_thread_options options = tp->thread_options ();
+ gdb_thread_options options = tp.thread_options ();
if (options == 0)
continue;
@@ -15569,11 +15963,11 @@ remote_target::commit_requested_thread_options ()
*obuf_p++ = ';';
obuf_p += xsnprintf (obuf_p, obuf_endp - obuf_p, "%s",
- phex_nz (options, sizeof (options)));
- if (tp->ptid != magic_null_ptid)
+ phex_nz (options));
+ if (tp.ptid != magic_null_ptid)
{
*obuf_p++ = ':';
- obuf_p = write_ptid (obuf_p, obuf_endp, tp->ptid);
+ obuf_p = write_ptid (obuf_p, obuf_endp, tp.ptid);
}
size_t osize = obuf_p - obuf;
@@ -15808,8 +16202,8 @@ create_fetch_memtags_request (gdb::char_vector &packet, CORE_ADDR address,
std::string request = string_printf ("qMemTags:%s,%s:%s",
phex_nz (address, addr_size),
- phex_nz (len, sizeof (len)),
- phex_nz (type, sizeof (type)));
+ phex_nz (len),
+ phex_nz (type));
strcpy (packet.data (), request.c_str ());
}
@@ -15843,8 +16237,8 @@ create_store_memtags_request (gdb::char_vector &packet, CORE_ADDR address,
/* Put together the main packet, address and length. */
std::string request = string_printf ("QMemTags:%s,%s:%s:",
phex_nz (address, addr_size),
- phex_nz (len, sizeof (len)),
- phex_nz (type, sizeof (type)));
+ phex_nz (len),
+ phex_nz (type));
request += bin2hex (tags.data (), tags.size ());
/* Check if we have exceeded the maximum packet size. */
@@ -16161,9 +16555,7 @@ test_packet_check_result ()
} /* namespace selftests */
#endif /* GDB_SELF_TEST */
-void _initialize_remote ();
-void
-_initialize_remote ()
+INIT_GDB_FILE (remote)
{
add_target (remote_target_info, remote_target::open);
add_target (extended_remote_target_info, extended_remote_target::open);
@@ -16422,6 +16814,8 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL,
add_packet_config_cmd (PACKET_vFile_stat, "vFile:stat", "hostio-stat", 0);
+ add_packet_config_cmd (PACKET_vFile_lstat, "vFile:lstat", "hostio-lstat", 0);
+
add_packet_config_cmd (PACKET_vAttach, "vAttach", "attach", 0);
add_packet_config_cmd (PACKET_vRun, "vRun", "run", 0);
@@ -16539,6 +16933,13 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL,
add_packet_config_cmd (PACKET_accept_error_message,
"error-message", "error-message", 0);
+ add_packet_config_cmd (PACKET_vRun_single_argument,
+ "single-inferior-argument-feature",
+ "single-inferior-argument-feature", 0);
+
+ add_packet_config_cmd (PACKET_qExecAndArgs, "qExecAndArgs",
+ "fetch-exec-and-args", 0);
+
/* Assert that we've registered "set remote foo-packet" commands
for all packet configs. */
{
@@ -16608,10 +17009,15 @@ Transfer files to and from the remote target system."),
&remote_cmdlist);
add_setshow_string_noescape_cmd ("exec-file", class_files,
- &remote_exec_file_var, _("\
-Set the remote pathname for \"run\"."), _("\
-Show the remote pathname for \"run\"."), NULL,
- set_remote_exec_file,
+ _("\
+Set the remote file name for starting inferiors."), _("\
+Show the remote file name for starting inferiors."), _("\
+This is the file name, on the remote target, used when starting an\n\
+inferior, for example with the \"run\", \"start\", or \"starti\"\n\
+commands. This setting is only useful when debugging a remote target,\n\
+otherwise, this setting is not used."),
+ set_remote_exec_file_cb,
+ get_remote_exec_file,
show_remote_exec_file,
&remote_set_cmdlist,
&remote_show_cmdlist);
@@ -16671,6 +17077,20 @@ from the target."),
/* Eventually initialize fileio. See fileio.c */
initialize_remote_fileio (&remote_set_cmdlist, &remote_show_cmdlist);
+ add_cmd ("test-remote-args", class_maintenance,
+ test_remote_args_command, _("\
+Test remote argument splitting and joining.\n \
+ maintenance test-remote-args ARGS\n\
+For remote targets that don't support passing inferior arguments as a\n\
+single string, GDB needs to split the inferior arguments before passing\n\
+them, and gdbserver needs to join the arguments it receives.\n\
+This command splits ARGS just as GDB would before passing them to a\n\
+remote target, and prints the result. This command then joins the\n\
+arguments just as gdbserver would, and prints the results.\n\
+This command is useful in diagnosing problems when passing arguments\n\
+between GDB and a remote target."),
+ &maintenancelist);
+
#if GDB_SELF_TEST
selftests::register_test ("remote_memory_tagging",
selftests::test_memory_tagging_functions);
diff --git a/gdb/remote.h b/gdb/remote.h
index e0335df..ba1b8db 100644
--- a/gdb/remote.h
+++ b/gdb/remote.h
@@ -1,5 +1,5 @@
/* Remote target communications for serial-line targets in custom GDB protocol
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/reply_mig_hack.awk b/gdb/reply_mig_hack.awk
index 156fcc86..9857ee0 100644
--- a/gdb/reply_mig_hack.awk
+++ b/gdb/reply_mig_hack.awk
@@ -1,6 +1,6 @@
# Reply server mig-output massager
#
-# Copyright (C) 1995-2024 Free Software Foundation, Inc.
+# Copyright (C) 1995-2025 Free Software Foundation, Inc.
#
# Written by Miles Bader <miles@gnu.ai.mit.edu>
#
diff --git a/gdb/reverse.c b/gdb/reverse.c
index ca11f83..dc35bca 100644
--- a/gdb/reverse.c
+++ b/gdb/reverse.c
@@ -1,6 +1,6 @@
/* Reverse execution and reverse debugging.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -277,9 +277,7 @@ info_bookmarks_command (const char *args, int from_tty)
}
}
-void _initialize_reverse ();
-void
-_initialize_reverse ()
+INIT_GDB_FILE (reverse)
{
cmd_list_element *reverse_step_cmd
= add_com ("reverse-step", class_run, reverse_step, _("\
diff --git a/gdb/riscv-fbsd-nat.c b/gdb/riscv-fbsd-nat.c
index bc9d613..2908d9f 100644
--- a/gdb/riscv-fbsd-nat.c
+++ b/gdb/riscv-fbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for FreeBSD/riscv.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -65,9 +65,7 @@ riscv_fbsd_nat_target::store_registers (struct regcache *regcache,
PT_SETFPREGS, &riscv_fbsd_fpregset);
}
-void _initialize_riscv_fbsd_nat ();
-void
-_initialize_riscv_fbsd_nat ()
+INIT_GDB_FILE (riscv_fbsd_nat)
{
add_inf_child_target (&the_riscv_fbsd_nat_target);
}
diff --git a/gdb/riscv-fbsd-tdep.c b/gdb/riscv-fbsd-tdep.c
index 4761edc..7999bd3 100644
--- a/gdb/riscv-fbsd-tdep.c
+++ b/gdb/riscv-fbsd-tdep.c
@@ -1,5 +1,5 @@
/* Target-dependent code for FreeBSD on RISC-V processors.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -189,12 +189,11 @@ riscv_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Generic FreeBSD support. */
fbsd_init_abi (info, gdbarch);
- set_gdbarch_software_single_step (gdbarch, riscv_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, riscv_software_single_step);
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- (riscv_isa_xlen (gdbarch) == 4
- ? svr4_ilp32_fetch_link_map_offsets
- : svr4_lp64_fetch_link_map_offsets));
+ set_solib_svr4_ops (gdbarch, (riscv_isa_xlen (gdbarch) == 4
+ ? make_svr4_ilp32_solib_ops
+ : make_svr4_lp64_solib_ops));
tramp_frame_prepend_unwinder (gdbarch, &riscv_fbsd_sigframe);
@@ -207,9 +206,7 @@ riscv_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
riscv_fbsd_get_thread_local_address);
}
-void _initialize_riscv_fbsd_tdep ();
-void
-_initialize_riscv_fbsd_tdep ()
+INIT_GDB_FILE (riscv_fbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_riscv, 0, GDB_OSABI_FREEBSD,
riscv_fbsd_init_abi);
diff --git a/gdb/riscv-fbsd-tdep.h b/gdb/riscv-fbsd-tdep.h
index 22ae08d..618b8e5 100644
--- a/gdb/riscv-fbsd-tdep.h
+++ b/gdb/riscv-fbsd-tdep.h
@@ -1,6 +1,6 @@
/* FreeBSD/riscv target support, prototypes.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/riscv-linux-canonicalize-syscall-gen.c b/gdb/riscv-linux-canonicalize-syscall-gen.c
new file mode 100644
index 0000000..9ba8b3f
--- /dev/null
+++ b/gdb/riscv-linux-canonicalize-syscall-gen.c
@@ -0,0 +1,361 @@
+/* DO NOT EDIT: Autogenerated by riscv-linux-canonicalize-syscall-gen.py
+
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "defs.h"
+#include "riscv-linux-tdep.h"
+
+/* riscv_linux_canonicalize_syscall maps from the native RISC-V Linux set
+ of syscall ids into a canonical set of syscall ids used by
+ process record. */
+
+enum gdb_syscall
+riscv_linux_canonicalize_syscall (int syscall)
+{
+ switch (syscall)
+ {
+ case 0: return gdb_sys_io_setup;
+ case 1: return gdb_sys_io_destroy;
+ case 2: return gdb_sys_io_submit;
+ case 3: return gdb_sys_io_cancel;
+ case 4: return gdb_sys_io_getevents;
+ case 5: return gdb_sys_setxattr;
+ case 6: return gdb_sys_lsetxattr;
+ case 7: return gdb_sys_fsetxattr;
+ case 8: return gdb_sys_getxattr;
+ case 9: return gdb_sys_lgetxattr;
+ case 10: return gdb_sys_fgetxattr;
+ case 11: return gdb_sys_listxattr;
+ case 12: return gdb_sys_llistxattr;
+ case 13: return gdb_sys_flistxattr;
+ case 14: return gdb_sys_removexattr;
+ case 15: return gdb_sys_lremovexattr;
+ case 16: return gdb_sys_fremovexattr;
+ case 17: return gdb_sys_getcwd;
+ case 18: return gdb_sys_lookup_dcookie;
+ case 19: return gdb_sys_eventfd2;
+ case 20: return gdb_sys_epoll_create1;
+ case 21: return gdb_sys_epoll_ctl;
+ case 22: return gdb_sys_epoll_pwait;
+ case 23: return gdb_sys_dup;
+ case 24: return gdb_sys_dup3;
+ case 25: return gdb_sys_fcntl;
+ case 26: return gdb_sys_inotify_init1;
+ case 27: return gdb_sys_inotify_add_watch;
+ case 28: return gdb_sys_inotify_rm_watch;
+ case 29: return gdb_sys_ioctl;
+ case 30: return gdb_sys_ioprio_set;
+ case 31: return gdb_sys_ioprio_get;
+ case 32: return gdb_sys_flock;
+ case 33: return gdb_sys_mknodat;
+ case 34: return gdb_sys_mkdirat;
+ case 35: return gdb_sys_unlinkat;
+ case 36: return gdb_sys_symlinkat;
+ case 37: return gdb_sys_linkat;
+ /* case 39: return gdb_sys_umount2; */
+ case 40: return gdb_sys_mount;
+ case 41: return gdb_sys_pivot_root;
+ case 42: return gdb_sys_nfsservctl;
+ case 43: return gdb_sys_statfs;
+ case 44: return gdb_sys_fstatfs;
+ case 45: return gdb_sys_truncate;
+ case 46: return gdb_sys_ftruncate;
+ case 47: return gdb_sys_fallocate;
+ case 48: return gdb_sys_faccessat;
+ case 49: return gdb_sys_chdir;
+ case 50: return gdb_sys_fchdir;
+ case 51: return gdb_sys_chroot;
+ case 52: return gdb_sys_fchmod;
+ case 53: return gdb_sys_fchmodat;
+ case 54: return gdb_sys_fchownat;
+ case 55: return gdb_sys_fchown;
+ case 56: return gdb_sys_openat;
+ case 57: return gdb_sys_close;
+ case 58: return gdb_sys_vhangup;
+ case 59: return gdb_sys_pipe2;
+ case 60: return gdb_sys_quotactl;
+ case 61: return gdb_sys_getdents64;
+ case 62: return gdb_sys_lseek;
+ case 63: return gdb_sys_read;
+ case 64: return gdb_sys_write;
+ case 65: return gdb_sys_readv;
+ case 66: return gdb_sys_writev;
+ case 67: return gdb_sys_pread64;
+ case 68: return gdb_sys_pwrite64;
+ /* case 69: return gdb_sys_preadv; */
+ /* case 70: return gdb_sys_pwritev; */
+ case 71: return gdb_sys_sendfile;
+ case 72: return gdb_sys_pselect6;
+ case 73: return gdb_sys_ppoll;
+ /* case 74: return gdb_sys_signalfd4; */
+ case 75: return gdb_sys_vmsplice;
+ case 76: return gdb_sys_splice;
+ case 77: return gdb_sys_tee;
+ case 78: return gdb_sys_readlinkat;
+ case 79: return gdb_sys_newfstatat;
+ case 80: return gdb_sys_fstat;
+ case 81: return gdb_sys_sync;
+ case 82: return gdb_sys_fsync;
+ case 83: return gdb_sys_fdatasync;
+ case 84: return gdb_sys_sync_file_range;
+ /* case 85: return gdb_sys_timerfd_create; */
+ /* case 86: return gdb_sys_timerfd_settime; */
+ /* case 87: return gdb_sys_timerfd_gettime; */
+ /* case 88: return gdb_sys_utimensat; */
+ case 89: return gdb_sys_acct;
+ case 90: return gdb_sys_capget;
+ case 91: return gdb_sys_capset;
+ case 92: return gdb_sys_personality;
+ case 93: return gdb_sys_exit;
+ case 94: return gdb_sys_exit_group;
+ case 95: return gdb_sys_waitid;
+ case 96: return gdb_sys_set_tid_address;
+ case 97: return gdb_sys_unshare;
+ case 98: return gdb_sys_futex;
+ case 99: return gdb_sys_set_robust_list;
+ case 100: return gdb_sys_get_robust_list;
+ case 101: return gdb_sys_nanosleep;
+ case 102: return gdb_sys_getitimer;
+ case 103: return gdb_sys_setitimer;
+ case 104: return gdb_sys_kexec_load;
+ case 105: return gdb_sys_init_module;
+ case 106: return gdb_sys_delete_module;
+ case 107: return gdb_sys_timer_create;
+ case 108: return gdb_sys_timer_gettime;
+ case 109: return gdb_sys_timer_getoverrun;
+ case 110: return gdb_sys_timer_settime;
+ case 111: return gdb_sys_timer_delete;
+ case 112: return gdb_sys_clock_settime;
+ case 113: return gdb_sys_clock_gettime;
+ case 114: return gdb_sys_clock_getres;
+ case 115: return gdb_sys_clock_nanosleep;
+ case 116: return gdb_sys_syslog;
+ case 117: return gdb_sys_ptrace;
+ case 118: return gdb_sys_sched_setparam;
+ case 119: return gdb_sys_sched_setscheduler;
+ case 120: return gdb_sys_sched_getscheduler;
+ case 121: return gdb_sys_sched_getparam;
+ case 122: return gdb_sys_sched_setaffinity;
+ case 123: return gdb_sys_sched_getaffinity;
+ case 124: return gdb_sys_sched_yield;
+ case 125: return gdb_sys_sched_get_priority_max;
+ case 126: return gdb_sys_sched_get_priority_min;
+ case 127: return gdb_sys_sched_rr_get_interval;
+ case 128: return gdb_sys_restart_syscall;
+ case 129: return gdb_sys_kill;
+ case 130: return gdb_sys_tkill;
+ case 131: return gdb_sys_tgkill;
+ case 132: return gdb_sys_sigaltstack;
+ case 133: return gdb_sys_rt_sigsuspend;
+ case 134: return gdb_sys_rt_sigaction;
+ case 135: return gdb_sys_rt_sigprocmask;
+ case 136: return gdb_sys_rt_sigpending;
+ case 137: return gdb_sys_rt_sigtimedwait;
+ case 138: return gdb_sys_rt_sigqueueinfo;
+ case 139: return gdb_sys_rt_sigreturn;
+ case 140: return gdb_sys_setpriority;
+ case 141: return gdb_sys_getpriority;
+ case 142: return gdb_sys_reboot;
+ case 143: return gdb_sys_setregid;
+ case 144: return gdb_sys_setgid;
+ case 145: return gdb_sys_setreuid;
+ case 146: return gdb_sys_setuid;
+ case 147: return gdb_sys_setresuid;
+ case 148: return gdb_sys_getresuid;
+ case 149: return gdb_sys_setresgid;
+ case 150: return gdb_sys_getresgid;
+ case 151: return gdb_sys_setfsuid;
+ case 152: return gdb_sys_setfsgid;
+ case 153: return gdb_sys_times;
+ case 154: return gdb_sys_setpgid;
+ case 155: return gdb_sys_getpgid;
+ case 156: return gdb_sys_getsid;
+ case 157: return gdb_sys_setsid;
+ case 158: return gdb_sys_getgroups;
+ case 159: return gdb_sys_setgroups;
+ case 160: return gdb_sys_uname;
+ case 161: return gdb_sys_sethostname;
+ case 162: return gdb_sys_setdomainname;
+ case 163: return gdb_sys_getrlimit;
+ case 164: return gdb_sys_setrlimit;
+ case 165: return gdb_sys_getrusage;
+ case 166: return gdb_sys_umask;
+ case 167: return gdb_sys_prctl;
+ case 168: return gdb_sys_getcpu;
+ case 169: return gdb_sys_gettimeofday;
+ case 170: return gdb_sys_settimeofday;
+ case 171: return gdb_sys_adjtimex;
+ case 172: return gdb_sys_getpid;
+ case 173: return gdb_sys_getppid;
+ case 174: return gdb_sys_getuid;
+ case 175: return gdb_sys_geteuid;
+ case 176: return gdb_sys_getgid;
+ case 177: return gdb_sys_getegid;
+ case 178: return gdb_sys_gettid;
+ case 179: return gdb_sys_sysinfo;
+ case 180: return gdb_sys_mq_open;
+ case 181: return gdb_sys_mq_unlink;
+ case 182: return gdb_sys_mq_timedsend;
+ case 183: return gdb_sys_mq_timedreceive;
+ case 184: return gdb_sys_mq_notify;
+ case 185: return gdb_sys_mq_getsetattr;
+ case 186: return gdb_sys_msgget;
+ case 187: return gdb_sys_msgctl;
+ case 188: return gdb_sys_msgrcv;
+ case 189: return gdb_sys_msgsnd;
+ case 190: return gdb_sys_semget;
+ case 191: return gdb_sys_semctl;
+ case 192: return gdb_sys_semtimedop;
+ case 193: return gdb_sys_semop;
+ case 194: return gdb_sys_shmget;
+ case 195: return gdb_sys_shmctl;
+ case 196: return gdb_sys_shmat;
+ case 197: return gdb_sys_shmdt;
+ case 198: return gdb_sys_socket;
+ case 199: return gdb_sys_socketpair;
+ case 200: return gdb_sys_bind;
+ case 201: return gdb_sys_listen;
+ case 202: return gdb_sys_accept;
+ case 203: return gdb_sys_connect;
+ case 204: return gdb_sys_getsockname;
+ case 205: return gdb_sys_getpeername;
+ case 206: return gdb_sys_sendto;
+ case 207: return gdb_sys_recvfrom;
+ case 208: return gdb_sys_setsockopt;
+ case 209: return gdb_sys_getsockopt;
+ case 210: return gdb_sys_shutdown;
+ case 211: return gdb_sys_sendmsg;
+ case 212: return gdb_sys_recvmsg;
+ case 213: return gdb_sys_readahead;
+ case 214: return gdb_sys_brk;
+ case 215: return gdb_sys_munmap;
+ case 216: return gdb_sys_mremap;
+ case 217: return gdb_sys_add_key;
+ case 218: return gdb_sys_request_key;
+ case 219: return gdb_sys_keyctl;
+ case 220: return gdb_sys_clone;
+ case 221: return gdb_sys_execve;
+ case 222: return gdb_sys_old_mmap;
+ case 223: return gdb_sys_fadvise64;
+ case 224: return gdb_sys_swapon;
+ case 225: return gdb_sys_swapoff;
+ case 226: return gdb_sys_mprotect;
+ case 227: return gdb_sys_msync;
+ case 228: return gdb_sys_mlock;
+ case 229: return gdb_sys_munlock;
+ case 230: return gdb_sys_mlockall;
+ case 231: return gdb_sys_munlockall;
+ case 232: return gdb_sys_mincore;
+ case 233: return gdb_sys_madvise;
+ case 234: return gdb_sys_remap_file_pages;
+ case 235: return gdb_sys_mbind;
+ case 236: return gdb_sys_get_mempolicy;
+ case 237: return gdb_sys_set_mempolicy;
+ case 238: return gdb_sys_migrate_pages;
+ case 239: return gdb_sys_move_pages;
+ /* case 240: return gdb_sys_rt_tgsigqueueinfo; */
+ /* case 241: return gdb_sys_perf_event_open; */
+ case 242: return gdb_sys_accept4;
+ /* case 243: return gdb_sys_recvmmsg; */
+ /* case 258: return gdb_sys_riscv_hwprobe; */
+ /* case 259: return gdb_sys_riscv_flush_icache; */
+ case 260: return gdb_sys_wait4;
+ /* case 261: return gdb_sys_prlimit64; */
+ /* case 262: return gdb_sys_fanotify_init; */
+ /* case 263: return gdb_sys_fanotify_mark; */
+ /* case 264: return gdb_sys_name_to_handle_at; */
+ /* case 265: return gdb_sys_open_by_handle_at; */
+ /* case 266: return gdb_sys_clock_adjtime; */
+ /* case 267: return gdb_sys_syncfs; */
+ /* case 268: return gdb_sys_setns; */
+ /* case 269: return gdb_sys_sendmmsg; */
+ /* case 270: return gdb_sys_process_vm_readv; */
+ /* case 271: return gdb_sys_process_vm_writev; */
+ /* case 272: return gdb_sys_kcmp; */
+ /* case 273: return gdb_sys_finit_module; */
+ /* case 274: return gdb_sys_sched_setattr; */
+ /* case 275: return gdb_sys_sched_getattr; */
+ /* case 276: return gdb_sys_renameat2; */
+ /* case 277: return gdb_sys_seccomp; */
+ case 278: return gdb_sys_getrandom;
+ /* case 279: return gdb_sys_memfd_create; */
+ /* case 280: return gdb_sys_bpf; */
+ /* case 281: return gdb_sys_execveat; */
+ /* case 282: return gdb_sys_userfaultfd; */
+ /* case 283: return gdb_sys_membarrier; */
+ /* case 284: return gdb_sys_mlock2; */
+ /* case 285: return gdb_sys_copy_file_range; */
+ /* case 286: return gdb_sys_preadv2; */
+ /* case 287: return gdb_sys_pwritev2; */
+ /* case 288: return gdb_sys_pkey_mprotect; */
+ /* case 289: return gdb_sys_pkey_alloc; */
+ /* case 290: return gdb_sys_pkey_free; */
+ case 291: return gdb_sys_statx;
+ /* case 292: return gdb_sys_io_pgetevents; */
+ /* case 293: return gdb_sys_rseq; */
+ /* case 294: return gdb_sys_kexec_file_load; */
+ /* case 424: return gdb_sys_pidfd_send_signal; */
+ /* case 425: return gdb_sys_io_uring_setup; */
+ /* case 426: return gdb_sys_io_uring_enter; */
+ /* case 427: return gdb_sys_io_uring_register; */
+ /* case 428: return gdb_sys_open_tree; */
+ /* case 429: return gdb_sys_move_mount; */
+ /* case 430: return gdb_sys_fsopen; */
+ /* case 431: return gdb_sys_fsconfig; */
+ /* case 432: return gdb_sys_fsmount; */
+ /* case 433: return gdb_sys_fspick; */
+ /* case 434: return gdb_sys_pidfd_open; */
+ /* case 435: return gdb_sys_clone3; */
+ /* case 436: return gdb_sys_close_range; */
+ /* case 437: return gdb_sys_openat2; */
+ /* case 438: return gdb_sys_pidfd_getfd; */
+ /* case 439: return gdb_sys_faccessat2; */
+ /* case 440: return gdb_sys_process_madvise; */
+ /* case 441: return gdb_sys_epoll_pwait2; */
+ /* case 442: return gdb_sys_mount_setattr; */
+ /* case 443: return gdb_sys_quotactl_fd; */
+ /* case 444: return gdb_sys_landlock_create_ruleset; */
+ /* case 445: return gdb_sys_landlock_add_rule; */
+ /* case 446: return gdb_sys_landlock_restrict_self; */
+ /* case 447: return gdb_sys_memfd_secret; */
+ /* case 448: return gdb_sys_process_mrelease; */
+ /* case 449: return gdb_sys_futex_waitv; */
+ /* case 450: return gdb_sys_set_mempolicy_home_node; */
+ /* case 451: return gdb_sys_cachestat; */
+ /* case 452: return gdb_sys_fchmodat2; */
+ /* case 453: return gdb_sys_map_shadow_stack; */
+ /* case 454: return gdb_sys_futex_wake; */
+ /* case 455: return gdb_sys_futex_wait; */
+ /* case 456: return gdb_sys_futex_requeue; */
+ /* case 457: return gdb_sys_statmount; */
+ /* case 458: return gdb_sys_listmount; */
+ /* case 459: return gdb_sys_lsm_get_self_attr; */
+ /* case 460: return gdb_sys_lsm_set_self_attr; */
+ /* case 461: return gdb_sys_lsm_list_modules; */
+ /* case 462: return gdb_sys_mseal; */
+ /* case 463: return gdb_sys_setxattrat; */
+ /* case 464: return gdb_sys_getxattrat; */
+ /* case 465: return gdb_sys_listxattrat; */
+ /* case 466: return gdb_sys_removexattrat; */
+ /* case 467: return gdb_sys_open_tree_attr; */
+ /* case 468: return gdb_sys_file_getattr; */
+ /* case 469: return gdb_sys_file_setattr; */
+ default:
+ return gdb_sys_no_syscall;
+ }
+}
diff --git a/gdb/riscv-linux-nat.c b/gdb/riscv-linux-nat.c
index a5507e8..89f1ddc 100644
--- a/gdb/riscv-linux-nat.c
+++ b/gdb/riscv-linux-nat.c
@@ -1,5 +1,5 @@
/* Native-dependent code for GNU/Linux RISC-V.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -329,9 +329,7 @@ riscv_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
/* Initialize RISC-V Linux native support. */
-void _initialize_riscv_linux_nat ();
-void
-_initialize_riscv_linux_nat ()
+INIT_GDB_FILE (riscv_linux_nat)
{
/* Register the target. */
linux_target = &the_riscv_linux_nat_target;
diff --git a/gdb/riscv-linux-tdep.c b/gdb/riscv-linux-tdep.c
index ff478cf..05f92f8 100644
--- a/gdb/riscv-linux-tdep.c
+++ b/gdb/riscv-linux-tdep.c
@@ -1,5 +1,5 @@
/* Target-dependent code for GNU/Linux on RISC-V processors.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,11 +20,19 @@
#include "osabi.h"
#include "glibc-tdep.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
+#include "svr4-tls-tdep.h"
#include "solib-svr4.h"
#include "regset.h"
#include "tramp-frame.h"
#include "trad-frame.h"
#include "gdbarch.h"
+#include "record-full.h"
+#include "linux-record.h"
+#include "riscv-linux-tdep.h"
+#include "inferior.h"
+
+extern unsigned int record_debug;
/* The following value is derived from __NR_rt_sigreturn in
<include/uapi/asm-generic/unistd.h> from the Linux source tree. */
@@ -173,6 +181,348 @@ riscv_linux_syscall_next_pc (const frame_info_ptr &frame)
return pc + 4 /* Length of the ECALL insn. */;
}
+/* RISC-V process record-replay constructs: syscall, signal etc. */
+
+static linux_record_tdep riscv_linux_record_tdep;
+
+using regnum_type = int;
+
+/* Record registers from first to last for process-record. */
+
+static bool
+save_registers (struct regcache *regcache, regnum_type first, regnum_type last)
+{
+ gdb_assert (regcache != nullptr);
+
+ for (regnum_type i = first; i != last; ++i)
+ if (record_full_arch_list_add_reg (regcache, i))
+ return false;
+ return true;
+};
+
+/* Record all registers but PC register for process-record. */
+
+static bool
+riscv_all_but_pc_registers_record (struct regcache *regcache)
+{
+ gdb_assert (regcache != nullptr);
+
+ struct gdbarch *gdbarch = regcache->arch ();
+ riscv_gdbarch_tdep *tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
+ const struct riscv_gdbarch_features &features = tdep->isa_features;
+
+ if (!save_registers (regcache, RISCV_ZERO_REGNUM + 1, RISCV_PC_REGNUM))
+ return false;
+
+ if (features.flen
+ && !save_registers (regcache, RISCV_FIRST_FP_REGNUM,
+ RISCV_LAST_FP_REGNUM + 1))
+ return false;
+
+ return true;
+}
+
+/* Handler for riscv system call instruction recording. */
+
+static int
+riscv_linux_syscall_record (struct regcache *regcache,
+ unsigned long svc_number)
+{
+ gdb_assert (regcache != nullptr);
+
+ enum gdb_syscall syscall_gdb = riscv_linux_canonicalize_syscall (svc_number);
+
+ if (record_debug > 1)
+ gdb_printf (gdb_stdlog, "Made syscall %s.\n", plongest (svc_number));
+
+ if (syscall_gdb == gdb_sys_no_syscall)
+ {
+ warning (_("Process record and replay target doesn't "
+ "support syscall number %s\n"), plongest (svc_number));
+ return -1;
+ }
+
+ if (syscall_gdb == gdb_sys_sigreturn || syscall_gdb == gdb_sys_rt_sigreturn)
+ {
+ if (!riscv_all_but_pc_registers_record (regcache))
+ return -1;
+ return 0;
+ }
+
+ int ret = record_linux_system_call (syscall_gdb, regcache,
+ &riscv_linux_record_tdep);
+ if (ret != 0)
+ return ret;
+
+ /* Record the return value of the system call. */
+ if (record_full_arch_list_add_reg (regcache, RISCV_A0_REGNUM))
+ return -1;
+
+ return 0;
+}
+
+/* Initialize the riscv_linux_record_tdep. */
+
+static void
+riscv_linux_record_tdep_init (struct gdbarch *gdbarch,
+ struct linux_record_tdep &riscv_linux_record_tdep)
+{
+ gdb_assert (gdbarch != nullptr);
+
+ /* These values are the size of the type that
+ will be used in a system call. */
+ riscv_linux_record_tdep.size_pointer
+ = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
+ riscv_linux_record_tdep.size__old_kernel_stat = 48;
+ riscv_linux_record_tdep.size_tms = 32;
+ riscv_linux_record_tdep.size_loff_t = 8;
+ riscv_linux_record_tdep.size_flock = 32;
+ riscv_linux_record_tdep.size_oldold_utsname = 45;
+ riscv_linux_record_tdep.size_ustat = 32;
+ riscv_linux_record_tdep.size_old_sigaction = 32;
+ riscv_linux_record_tdep.size_old_sigset_t = 8;
+ riscv_linux_record_tdep.size_rlimit = 16;
+ riscv_linux_record_tdep.size_rusage = 144;
+ riscv_linux_record_tdep.size_timeval = 8;
+ riscv_linux_record_tdep.size_timezone = 8;
+ riscv_linux_record_tdep.size_old_gid_t = 2;
+ riscv_linux_record_tdep.size_old_uid_t = 2;
+ riscv_linux_record_tdep.size_fd_set = 128;
+ riscv_linux_record_tdep.size_old_dirent = 268;
+ riscv_linux_record_tdep.size_statfs = 120;
+ riscv_linux_record_tdep.size_statfs64 = 120;
+ riscv_linux_record_tdep.size_sockaddr = 16;
+ riscv_linux_record_tdep.size_int
+ = gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT;
+ riscv_linux_record_tdep.size_long
+ = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
+ riscv_linux_record_tdep.size_ulong
+ = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
+ riscv_linux_record_tdep.size_msghdr = 104;
+ riscv_linux_record_tdep.size_itimerval = 16;
+ riscv_linux_record_tdep.size_stat = 128;
+ riscv_linux_record_tdep.size_old_utsname = 325;
+ riscv_linux_record_tdep.size_sysinfo = 112;
+ riscv_linux_record_tdep.size_msqid_ds = 104;
+ riscv_linux_record_tdep.size_shmid_ds = 88;
+ riscv_linux_record_tdep.size_new_utsname = 390;
+ riscv_linux_record_tdep.size_timex = 188;
+ riscv_linux_record_tdep.size_mem_dqinfo = 72;
+ riscv_linux_record_tdep.size_if_dqblk = 68;
+ riscv_linux_record_tdep.size_fs_quota_stat = 64;
+ riscv_linux_record_tdep.size_timespec = 16;
+ riscv_linux_record_tdep.size_pollfd = 8;
+ riscv_linux_record_tdep.size_NFS_FHSIZE = 32;
+ riscv_linux_record_tdep.size_knfsd_fh = 36;
+ riscv_linux_record_tdep.size_TASK_COMM_LEN = 4;
+ riscv_linux_record_tdep.size_sigaction = 24;
+ riscv_linux_record_tdep.size_sigset_t = 8;
+ riscv_linux_record_tdep.size_siginfo_t = 128;
+ riscv_linux_record_tdep.size_cap_user_data_t = 8;
+ riscv_linux_record_tdep.size_stack_t = 24;
+ riscv_linux_record_tdep.size_off_t = riscv_linux_record_tdep.size_long;
+ riscv_linux_record_tdep.size_stat64 = 136;
+ riscv_linux_record_tdep.size_gid_t = 4;
+ riscv_linux_record_tdep.size_uid_t = 4;
+ riscv_linux_record_tdep.size_PAGE_SIZE = 4096;
+ riscv_linux_record_tdep.size_flock64 = 32;
+ riscv_linux_record_tdep.size_user_desc = 37;
+ riscv_linux_record_tdep.size_io_event = 32;
+ riscv_linux_record_tdep.size_iocb = 64;
+ riscv_linux_record_tdep.size_epoll_event = 16;
+ riscv_linux_record_tdep.size_itimerspec
+ = riscv_linux_record_tdep.size_timespec * 2;
+ riscv_linux_record_tdep.size_mq_attr = 64;
+ riscv_linux_record_tdep.size_termios = 36;
+ riscv_linux_record_tdep.size_termios2 = 44;
+ riscv_linux_record_tdep.size_pid_t = 4;
+ riscv_linux_record_tdep.size_winsize = 8;
+ riscv_linux_record_tdep.size_serial_struct = 72;
+ riscv_linux_record_tdep.size_serial_icounter_struct = 80;
+ riscv_linux_record_tdep.size_hayes_esp_config = 12;
+ riscv_linux_record_tdep.size_size_t = 8;
+ riscv_linux_record_tdep.size_iovec = 16;
+ riscv_linux_record_tdep.size_time_t = 8;
+
+ /* These values are the second argument of system call "sys_ioctl".
+ They are obtained from Linux Kernel source. */
+ riscv_linux_record_tdep.ioctl_TCGETS = 0x5401;
+ riscv_linux_record_tdep.ioctl_TCSETS = 0x5402;
+ riscv_linux_record_tdep.ioctl_TCSETSW = 0x5403;
+ riscv_linux_record_tdep.ioctl_TCSETSF = 0x5404;
+ riscv_linux_record_tdep.ioctl_TCGETA = 0x5405;
+ riscv_linux_record_tdep.ioctl_TCSETA = 0x5406;
+ riscv_linux_record_tdep.ioctl_TCSETAW = 0x5407;
+ riscv_linux_record_tdep.ioctl_TCSETAF = 0x5408;
+ riscv_linux_record_tdep.ioctl_TCSBRK = 0x5409;
+ riscv_linux_record_tdep.ioctl_TCXONC = 0x540a;
+ riscv_linux_record_tdep.ioctl_TCFLSH = 0x540b;
+ riscv_linux_record_tdep.ioctl_TIOCEXCL = 0x540c;
+ riscv_linux_record_tdep.ioctl_TIOCNXCL = 0x540d;
+ riscv_linux_record_tdep.ioctl_TIOCSCTTY = 0x540e;
+ riscv_linux_record_tdep.ioctl_TIOCGPGRP = 0x540f;
+ riscv_linux_record_tdep.ioctl_TIOCSPGRP = 0x5410;
+ riscv_linux_record_tdep.ioctl_TIOCOUTQ = 0x5411;
+ riscv_linux_record_tdep.ioctl_TIOCSTI = 0x5412;
+ riscv_linux_record_tdep.ioctl_TIOCGWINSZ = 0x5413;
+ riscv_linux_record_tdep.ioctl_TIOCSWINSZ = 0x5414;
+ riscv_linux_record_tdep.ioctl_TIOCMGET = 0x5415;
+ riscv_linux_record_tdep.ioctl_TIOCMBIS = 0x5416;
+ riscv_linux_record_tdep.ioctl_TIOCMBIC = 0x5417;
+ riscv_linux_record_tdep.ioctl_TIOCMSET = 0x5418;
+ riscv_linux_record_tdep.ioctl_TIOCGSOFTCAR = 0x5419;
+ riscv_linux_record_tdep.ioctl_TIOCSSOFTCAR = 0x541a;
+ riscv_linux_record_tdep.ioctl_FIONREAD = 0x541b;
+ riscv_linux_record_tdep.ioctl_TIOCINQ
+ = riscv_linux_record_tdep.ioctl_FIONREAD;
+ riscv_linux_record_tdep.ioctl_TIOCLINUX = 0x541c;
+ riscv_linux_record_tdep.ioctl_TIOCCONS = 0x541d;
+ riscv_linux_record_tdep.ioctl_TIOCGSERIAL = 0x541e;
+ riscv_linux_record_tdep.ioctl_TIOCSSERIAL = 0x541f;
+ riscv_linux_record_tdep.ioctl_TIOCPKT = 0x5420;
+ riscv_linux_record_tdep.ioctl_FIONBIO = 0x5421;
+ riscv_linux_record_tdep.ioctl_TIOCNOTTY = 0x5422;
+ riscv_linux_record_tdep.ioctl_TIOCSETD = 0x5423;
+ riscv_linux_record_tdep.ioctl_TIOCGETD = 0x5424;
+ riscv_linux_record_tdep.ioctl_TCSBRKP = 0x5425;
+ riscv_linux_record_tdep.ioctl_TIOCTTYGSTRUCT = 0x5426;
+ riscv_linux_record_tdep.ioctl_TIOCSBRK = 0x5427;
+ riscv_linux_record_tdep.ioctl_TIOCCBRK = 0x5428;
+ riscv_linux_record_tdep.ioctl_TIOCGSID = 0x5429;
+ riscv_linux_record_tdep.ioctl_TCGETS2 = 0x802c542a;
+ riscv_linux_record_tdep.ioctl_TCSETS2 = 0x402c542b;
+ riscv_linux_record_tdep.ioctl_TCSETSW2 = 0x402c542c;
+ riscv_linux_record_tdep.ioctl_TCSETSF2 = 0x402c542d;
+ riscv_linux_record_tdep.ioctl_TIOCGPTN = 0x80045430;
+ riscv_linux_record_tdep.ioctl_TIOCSPTLCK = 0x40045431;
+ riscv_linux_record_tdep.ioctl_FIONCLEX = 0x5450;
+ riscv_linux_record_tdep.ioctl_FIOCLEX = 0x5451;
+ riscv_linux_record_tdep.ioctl_FIOASYNC = 0x5452;
+ riscv_linux_record_tdep.ioctl_TIOCSERCONFIG = 0x5453;
+ riscv_linux_record_tdep.ioctl_TIOCSERGWILD = 0x5454;
+ riscv_linux_record_tdep.ioctl_TIOCSERSWILD = 0x5455;
+ riscv_linux_record_tdep.ioctl_TIOCGLCKTRMIOS = 0x5456;
+ riscv_linux_record_tdep.ioctl_TIOCSLCKTRMIOS = 0x5457;
+ riscv_linux_record_tdep.ioctl_TIOCSERGSTRUCT = 0x5458;
+ riscv_linux_record_tdep.ioctl_TIOCSERGETLSR = 0x5459;
+ riscv_linux_record_tdep.ioctl_TIOCSERGETMULTI = 0x545a;
+ riscv_linux_record_tdep.ioctl_TIOCSERSETMULTI = 0x545b;
+ riscv_linux_record_tdep.ioctl_TIOCMIWAIT = 0x545c;
+ riscv_linux_record_tdep.ioctl_TIOCGICOUNT = 0x545d;
+ riscv_linux_record_tdep.ioctl_TIOCGHAYESESP = 0x545e;
+ riscv_linux_record_tdep.ioctl_TIOCSHAYESESP = 0x545f;
+ riscv_linux_record_tdep.ioctl_FIOQSIZE = 0x5460;
+
+ /* These values are the second argument of system call "sys_fcntl"
+ and "sys_fcntl64". They are obtained from Linux Kernel source. */
+ riscv_linux_record_tdep.fcntl_F_GETLK = 5;
+ riscv_linux_record_tdep.fcntl_F_GETLK64 = 12;
+ riscv_linux_record_tdep.fcntl_F_SETLK64 = 13;
+ riscv_linux_record_tdep.fcntl_F_SETLKW64 = 14;
+
+ riscv_linux_record_tdep.arg1 = RISCV_A0_REGNUM;
+ riscv_linux_record_tdep.arg2 = RISCV_A1_REGNUM;
+ riscv_linux_record_tdep.arg3 = RISCV_A2_REGNUM;
+ riscv_linux_record_tdep.arg4 = RISCV_A3_REGNUM;
+ riscv_linux_record_tdep.arg5 = RISCV_A4_REGNUM;
+ riscv_linux_record_tdep.arg6 = RISCV_A5_REGNUM;
+}
+
+/* Fetch and return the TLS DTV (dynamic thread vector) address for PTID.
+ Throw a suitable TLS error if something goes wrong. */
+
+static CORE_ADDR
+riscv_linux_get_tls_dtv_addr (struct gdbarch *gdbarch, ptid_t ptid,
+ svr4_tls_libc libc)
+{
+ /* On RISC-V, the thread pointer is found in TP. */
+ regcache *regcache
+ = get_thread_arch_regcache (current_inferior (), ptid, gdbarch);
+ int thread_pointer_regnum = RISCV_TP_REGNUM;
+ target_fetch_registers (regcache, thread_pointer_regnum);
+ ULONGEST thr_ptr;
+ if (regcache->cooked_read (thread_pointer_regnum, &thr_ptr) != REG_VALID)
+ throw_error (TLS_GENERIC_ERROR, _("Unable to fetch thread pointer"));
+
+ CORE_ADDR dtv_ptr_addr;
+ switch (libc)
+ {
+ case svr4_tls_libc_musl:
+ /* MUSL: The DTV pointer is found at the very end of the pthread
+ struct which is located *before* the thread pointer. I.e.
+ the thread pointer will be just beyond the end of the struct,
+ so the address of the DTV pointer is found one pointer-size
+ before the thread pointer. */
+ dtv_ptr_addr
+ = thr_ptr - (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
+ break;
+ case svr4_tls_libc_glibc:
+ /* GLIBC: The thread pointer (TP) points just beyond the end of
+ the TCB (thread control block). On RISC-V, this struct
+ (tcbhead_t) is defined to contain two pointers. The first is
+ a pointer to the DTV and the second is a pointer to private
+ data. So the DTV pointer address is 16 bytes (i.e. the size of
+ two pointers) before thread pointer. */
+
+ dtv_ptr_addr
+ = thr_ptr - 2 * (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
+ break;
+ default:
+ throw_error (TLS_GENERIC_ERROR, _("Unknown RISC-V C library"));
+ break;
+ }
+
+ gdb::byte_vector buf (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
+ if (target_read_memory (dtv_ptr_addr, buf.data (), buf.size ()) != 0)
+ throw_error (TLS_GENERIC_ERROR, _("Unable to fetch DTV address"));
+
+ const struct builtin_type *builtin = builtin_type (gdbarch);
+ CORE_ADDR dtv_addr = gdbarch_pointer_to_address
+ (gdbarch, builtin->builtin_data_ptr, buf.data ());
+ return dtv_addr;
+}
+
+/* For internal TLS lookup, return the DTP offset, which is the offset
+ to subtract from a DTV entry, in order to obtain the address of the
+ TLS block. */
+
+static ULONGEST
+riscv_linux_get_tls_dtp_offset (struct gdbarch *gdbarch, ptid_t ptid,
+ svr4_tls_libc libc)
+{
+ if (libc == svr4_tls_libc_musl)
+ {
+ /* This value is DTP_OFFSET in MUSL's arch/riscv64/pthread_arch.h.
+ It represents the value to subtract from the DTV entry, once
+ it has been loaded. */
+ return 0x800;
+ }
+ else
+ return 0;
+}
+
+/* Function to extract syscall number. */
+
+static LONGEST
+riscv_linux_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
+{
+ struct regcache *regcache = get_thread_regcache (thread);
+ LONGEST ret;
+
+ /* Getting the system call number from the register.
+ When dealing with riscv architecture, this information
+ is stored in $a7 register. */
+ if (regcache->cooked_read (RISCV_A7_REGNUM, &ret)
+ != register_status::REG_VALID)
+ {
+ warning (_ ("Can not read a7 register"));
+ return -1;
+ }
+
+ /* The result. */
+ return ret;
+}
+
/* Initialize RISC-V Linux ABI info. */
static void
@@ -182,12 +532,11 @@ riscv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
linux_init_abi (info, gdbarch, 0);
- set_gdbarch_software_single_step (gdbarch, riscv_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, riscv_software_single_step);
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- (riscv_isa_xlen (gdbarch) == 4
- ? linux_ilp32_fetch_link_map_offsets
- : linux_lp64_fetch_link_map_offsets));
+ set_solib_svr4_ops (gdbarch, (riscv_isa_xlen (gdbarch) == 4
+ ? make_linux_ilp32_svr4_solib_ops
+ : make_linux_lp64_svr4_solib_ops));
/* GNU/Linux uses SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
@@ -198,6 +547,10 @@ riscv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
+ set_gdbarch_get_thread_local_address (gdbarch,
+ svr4_tls_get_thread_local_address);
+ svr4_tls_register_tls_methods (info, gdbarch, riscv_linux_get_tls_dtv_addr,
+ riscv_linux_get_tls_dtp_offset);
set_gdbarch_iterate_over_regset_sections
(gdbarch, riscv_linux_iterate_over_regset_sections);
@@ -205,13 +558,18 @@ riscv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tramp_frame_prepend_unwinder (gdbarch, &riscv_linux_sigframe);
tdep->syscall_next_pc = riscv_linux_syscall_next_pc;
+ tdep->riscv_syscall_record = riscv_linux_syscall_record;
+
+ riscv_linux_record_tdep_init (gdbarch, riscv_linux_record_tdep);
+
+ /* Functions for 'catch syscall'. */
+ set_gdbarch_xml_syscall_file (gdbarch, "syscalls/riscv-linux.xml");
+ set_gdbarch_get_syscall_number (gdbarch, riscv_linux_get_syscall_number);
}
/* Initialize RISC-V Linux target support. */
-void _initialize_riscv_linux_tdep ();
-void
-_initialize_riscv_linux_tdep ()
+INIT_GDB_FILE (riscv_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_riscv, 0, GDB_OSABI_LINUX,
riscv_linux_init_abi);
diff --git a/gdb/riscv-linux-tdep.h b/gdb/riscv-linux-tdep.h
new file mode 100644
index 0000000..9f0d95b
--- /dev/null
+++ b/gdb/riscv-linux-tdep.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 2024-2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef GDB_RISCV_LINUX_TDEP_H
+#define GDB_RISCV_LINUX_TDEP_H
+
+#include "linux-record.h"
+
+/* riscv_linux_canonicalize_syscall maps from the native riscv Linux
+ set of syscall ids into a canonical set of syscall ids used by
+ process record. */
+
+extern enum gdb_syscall riscv_linux_canonicalize_syscall (int syscall);
+
+#endif /* GDB_RISCV_LINUX_TDEP_H */
diff --git a/gdb/riscv-none-tdep.c b/gdb/riscv-none-tdep.c
index e98c699..ad32057 100644
--- a/gdb/riscv-none-tdep.c
+++ b/gdb/riscv-none-tdep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2020-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -163,9 +163,7 @@ riscv_none_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Initialize RISC-V bare-metal target support. */
-void _initialize_riscv_none_tdep ();
-void
-_initialize_riscv_none_tdep ()
+INIT_GDB_FILE (riscv_none_tdep)
{
gdbarch_register_osabi (bfd_arch_riscv, 0, GDB_OSABI_NONE,
riscv_none_init_abi);
diff --git a/gdb/riscv-ravenscar-thread.c b/gdb/riscv-ravenscar-thread.c
index 291b1db..e9829ec 100644
--- a/gdb/riscv-ravenscar-thread.c
+++ b/gdb/riscv-ravenscar-thread.c
@@ -1,6 +1,6 @@
/* Ravenscar RISC-V target support.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/riscv-ravenscar-thread.h b/gdb/riscv-ravenscar-thread.h
index 8773043..de3af94 100644
--- a/gdb/riscv-ravenscar-thread.h
+++ b/gdb/riscv-ravenscar-thread.h
@@ -1,6 +1,6 @@
/* Ravenscar RISC-V target support.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 6eeb1c1..697071b 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the RISC-V architecture, for GDB.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -54,8 +54,10 @@
#include "observable.h"
#include "prologue-value.h"
#include "arch/riscv.h"
+#include "record-full.h"
#include "riscv-ravenscar-thread.h"
-#include "gdbsupport/gdb-safe-ctype.h"
+
+#include <vector>
/* The stack must be 16-byte aligned. */
#define SP_ALIGNMENT 16
@@ -1669,6 +1671,11 @@ public:
int imm_signed () const
{ return m_imm.s; }
+ /* Fetch instruction from target memory at ADDR, return the content of
+ the instruction, and update LEN with the instruction length. */
+ static ULONGEST fetch_instruction (struct gdbarch *gdbarch,
+ CORE_ADDR addr, int *len);
+
private:
/* Extract 5 bit register field at OFFSET from instruction OPCODE. */
@@ -1814,11 +1821,6 @@ private:
m_rs2 = decode_register_index_short (ival, OP_SH_CRS2S);
}
- /* Fetch instruction from target memory at ADDR, return the content of
- the instruction, and update LEN with the instruction length. */
- static ULONGEST fetch_instruction (struct gdbarch *gdbarch,
- CORE_ADDR addr, int *len);
-
/* The length of the instruction in bytes. Should be 2 or 4. */
int m_length;
@@ -4160,15 +4162,29 @@ riscv_gnu_triplet_regexp (struct gdbarch *gdbarch)
return "riscv(32|64)?";
}
+/* Implement the "print_insn" gdbarch method. */
+
+static int
+riscv_print_insn (bfd_vma addr, struct disassemble_info *info)
+{
+ /* Initialize the BFD section to enable ISA string detection depending on the
+ object in scope. */
+ struct obj_section *s = find_pc_section (addr);
+ if (s != nullptr)
+ info->section = s->the_bfd_section;
+
+ return default_print_insn (addr, info);
+}
+
/* Implementation of `gdbarch_stap_is_single_operand', as defined in
gdbarch.h. */
static int
riscv_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
- return (ISDIGIT (*s) /* Literal number. */
+ return (c_isdigit (*s) /* Literal number. */
|| *s == '(' /* Register indirection. */
- || ISALPHA (*s)); /* Register value. */
+ || c_isalpha (*s)); /* Register value. */
}
/* String that appears before a register name in a SystemTap register
@@ -4188,7 +4204,7 @@ static const char *const stap_register_indirection_suffixes[] =
};
/* Initialize the current architecture based on INFO. If possible,
- re-use an architecture from ARCHES, which is a list of
+ reuse an architecture from ARCHES, which is a list of
architectures already created during this debugging session.
Called e.g. at program startup, when reading a core file, and when
@@ -4426,6 +4442,9 @@ riscv_gdbarch_init (struct gdbarch_info info,
disassembler_options_riscv ());
set_gdbarch_disassembler_options (gdbarch, &riscv_disassembler_options);
+ /* Disassembler print_insn. */
+ set_gdbarch_print_insn (gdbarch, riscv_print_insn);
+
/* SystemTap Support. */
set_gdbarch_stap_is_single_operand (gdbarch, riscv_stap_is_single_operand);
set_gdbarch_stap_register_indirection_prefixes
@@ -4433,6 +4452,9 @@ riscv_gdbarch_init (struct gdbarch_info info,
set_gdbarch_stap_register_indirection_suffixes
(gdbarch, stap_register_indirection_suffixes);
+ /* Process record-replay */
+ set_gdbarch_process_record (gdbarch, riscv_process_record);
+
/* Hook in OS ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
@@ -4772,9 +4794,7 @@ riscv_supply_regset (const struct regset *regset,
}
}
-void _initialize_riscv_tdep ();
-void
-_initialize_riscv_tdep ()
+INIT_GDB_FILE (riscv_tdep)
{
riscv_init_reggroups ();
@@ -4866,3 +4886,705 @@ equivalent change in the disassembler output."),
&setriscvcmdlist,
&showriscvcmdlist);
}
+
+/* A wrapper to read register under number regnum to address addr.
+ Returns false if error happened and makes warning. */
+
+static bool
+try_read (struct regcache *regcache, int regnum, ULONGEST &addr)
+{
+ gdb_assert (regcache != nullptr);
+
+ if (regcache->raw_read (regnum, &addr)
+ != register_status::REG_VALID)
+ {
+ warning (_("Can not read at address %s"), hex_string (addr));
+ return false;
+ }
+ return true;
+}
+
+/* Helper class to record instruction. */
+
+class riscv_recorded_insn final
+{
+public:
+ /* Type for saved register. */
+ using regnum_type = int;
+ /* Type for saved memory. First is address, second is length. */
+ using memory_type = std::pair<CORE_ADDR, int>;
+
+ /* Enum class that represents which type does recording belong to. */
+ enum class record_type
+ {
+ UNKNOWN,
+ ORDINARY,
+
+ /* Corner cases. */
+ ECALL,
+ EBREAK,
+ SRET,
+ MRET,
+ };
+
+private:
+ /* Type for set of registers that need to be saved. */
+ using recorded_regs = std::vector<regnum_type>;
+ /* Type for set of memory records that need to be saved. */
+ using recorded_mems = std::vector<memory_type>;
+
+ /* Type for memory address, extracted from memory_type. */
+ using mem_addr = decltype (std::declval<memory_type> ().first);
+ /* Type for memory length, extracted from memory_type. */
+ using mem_len = decltype (std::declval<memory_type> ().second);
+
+ /* Record type of current instruction. */
+ record_type m_record_type = record_type::UNKNOWN;
+
+ /* Flag that represents was there an error in current recording. */
+ bool m_error_occured = false;
+
+ /* Set of registers that need to be recorded. */
+ recorded_regs m_regs;
+ /* Set of memory chunks that need to be recorded. */
+ recorded_mems m_mems;
+
+ /* Width in bytes of the general purpose registers for GDBARCH,
+ where recording is happening. */
+ int m_xlen = 0;
+
+ /* Helper for decode 16-bit instruction RS1. */
+ static regnum_type
+ decode_crs1_short (ULONGEST opcode) noexcept
+ {
+ return ((opcode >> OP_SH_CRS1S) & OP_MASK_CRS1S) + 8;
+ }
+
+ /* Helper for decode 16-bit instruction RS2. */
+ static regnum_type
+ decode_crs2_short (ULONGEST opcode) noexcept
+ {
+ return ((opcode >> OP_SH_CRS2S) & OP_MASK_CRS2S) + 8;
+ }
+
+ /* Helper for decode 16-bit instruction CRS1. */
+ static regnum_type
+ decode_crs1 (ULONGEST opcode) noexcept
+ {
+ return ((opcode >> OP_SH_RD) & OP_MASK_RD);
+ }
+
+ /* Helper for decode 16-bit instruction CRS2. */
+ static regnum_type
+ decode_crs2 (ULONGEST opcode) noexcept
+ {
+ return ((opcode >> OP_SH_CRS2) & OP_MASK_CRS2);
+ }
+
+ /* Helper for decode 32-bit instruction RD. */
+ static regnum_type
+ decode_rd (ULONGEST ival) noexcept
+ {
+ return (ival >> OP_SH_RD) & OP_MASK_RD;
+ }
+
+ /* Helper for decode 32-bit instruction RS1. */
+ static regnum_type
+ decode_rs1 (ULONGEST ival) noexcept
+ {
+ return (ival >> OP_SH_RS1) & OP_MASK_RS1;
+ }
+
+ /* Helper for decode 32-bit instruction RS2. */
+ static regnum_type
+ decode_rs2 (ULONGEST ival) noexcept
+ {
+ return (ival >> OP_SH_RS2) & OP_MASK_RS2;
+ }
+
+ /* Helper for decode 32-bit instruction CSR. */
+ static regnum_type
+ decode_csr (ULONGEST ival) noexcept
+ {
+ return (ival >> OP_SH_CSR) & OP_MASK_CSR;
+ }
+
+ /* Set any record type. Always returns true. */
+ bool
+ set_record_type (record_type type) noexcept
+ {
+ m_record_type = type;
+ return true;
+ }
+
+ /* Set ordinary record type. Always returns true. */
+ bool
+ set_ordinary_record_type () noexcept
+ {
+ m_record_type = record_type::ORDINARY;
+ return true;
+ }
+
+ /* Set error happened. Always returns false. */
+ bool
+ set_error () noexcept
+ {
+ m_error_occured = true;
+ return false;
+ }
+
+ /* Check if current recording has an error. */
+ bool
+ has_error () const noexcept
+ {
+ return m_error_occured;
+ }
+
+ /* Reads register. Sets error and returns false if error happened. */
+ bool
+ read_reg (struct regcache *regcache, regnum_type reg,
+ ULONGEST &addr) noexcept
+ {
+ gdb_assert (regcache != nullptr);
+
+ if (!try_read (regcache, reg, addr))
+ return set_error ();
+ return true;
+ }
+
+ /* Save register. Returns true or aborts if exception happened. */
+ bool
+ save_reg (regnum_type regnum) noexcept
+ {
+ m_regs.emplace_back (regnum);
+ return true;
+ }
+
+ /* Save memory chunk. Returns true or aborts if exception happened. */
+ bool
+ save_mem (mem_addr addr, mem_len len) noexcept
+ {
+ m_mems.emplace_back (addr, len);
+ return true;
+ }
+
+ /* Returns true if instruction needs only saving pc. */
+ static bool
+ need_save_pc (ULONGEST ival) noexcept
+ {
+ return (is_beq_insn (ival) || is_bne_insn (ival) || is_blt_insn (ival)
+ || is_bge_insn (ival) || is_bltu_insn (ival) || is_bgeu_insn (ival)
+ || is_fence_insn (ival) || is_pause_insn (ival)
+ || is_fence_i_insn (ival) || is_wfi_insn (ival)
+ || is_sfence_vma_insn (ival));
+ }
+
+ /* Returns true if instruction is classified. */
+ bool
+ try_save_pc (ULONGEST ival) noexcept
+ {
+ if (!need_save_pc (ival))
+ return false;
+
+ return set_ordinary_record_type ();
+ }
+
+ /* Returns true if instruction needs only saving pc and rd. */
+ static bool
+ need_save_pc_rd (ULONGEST ival) noexcept
+ {
+ return (is_lui_insn (ival) || is_auipc_insn (ival) || is_jal_insn (ival)
+ || is_jalr_insn (ival) || is_lb_insn (ival) || is_lh_insn (ival)
+ || is_lw_insn (ival) || is_lbu_insn (ival) || is_lhu_insn (ival)
+ || is_addi_insn (ival) || is_slti_insn (ival)
+ || is_sltiu_insn (ival) || is_xori_insn (ival) || is_ori_insn (ival)
+ || is_andi_insn (ival) || is_slli_rv32_insn (ival)
+ || is_srli_rv32_insn (ival) || is_srai_rv32_insn (ival)
+ || is_add_insn (ival) || is_sub_insn (ival) || is_sll_insn (ival)
+ || is_slt_insn (ival) || is_sltu_insn (ival) || is_xor_insn (ival)
+ || is_srl_insn (ival) || is_sra_insn (ival) || is_or_insn (ival)
+ || is_and_insn (ival) || is_lwu_insn (ival) || is_ld_insn (ival)
+ || is_slli_insn (ival) || is_srli_insn (ival) || is_srai_insn (ival)
+ || is_addiw_insn (ival) || is_slliw_insn (ival)
+ || is_srliw_insn (ival) || is_sraiw_insn (ival)
+ || is_addw_insn (ival) || is_subw_insn (ival) || is_sllw_insn (ival)
+ || is_srlw_insn (ival) || is_sraw_insn (ival) || is_mul_insn (ival)
+ || is_mulh_insn (ival) || is_mulhsu_insn (ival)
+ || is_mulhu_insn (ival) || is_div_insn (ival) || is_divu_insn (ival)
+ || is_rem_insn (ival) || is_remu_insn (ival) || is_mulw_insn (ival)
+ || is_divw_insn (ival) || is_divuw_insn (ival)
+ || is_remw_insn (ival) || is_remuw_insn (ival)
+ || is_lr_w_insn (ival) || is_lr_d_insn (ival)
+ || is_fcvt_w_s_insn (ival) || is_fcvt_wu_s_insn (ival)
+ || is_fmv_x_s_insn (ival) || is_feq_s_insn (ival)
+ || is_flt_s_insn (ival) || is_fle_s_insn (ival)
+ || is_fclass_s_insn (ival) || is_fcvt_l_s_insn (ival)
+ || is_fcvt_lu_s_insn (ival) || is_feq_d_insn (ival)
+ || is_flt_d_insn (ival) || is_fle_d_insn (ival)
+ || is_fclass_d_insn (ival) || is_fcvt_w_d_insn (ival)
+ || is_fcvt_wu_d_insn (ival) || is_fcvt_l_d_insn (ival)
+ || is_fcvt_lu_d_insn (ival) || is_fmv_x_d_insn (ival));
+ }
+
+ /* Returns true if instruction is classified. This function can set
+ m_error_occured. */
+ bool
+ try_save_pc_rd (ULONGEST ival) noexcept
+ {
+ if (!need_save_pc_rd (ival))
+ return false;
+
+ return (!save_reg (decode_rd (ival)) || set_ordinary_record_type ());
+ }
+
+ /* Returns true if instruction needs only saving pc and
+ floating point rd. */
+ static bool
+ need_save_pc_fprd (ULONGEST ival) noexcept
+ {
+ return (is_flw_insn (ival) || is_fmadd_s_insn (ival)
+ || is_fmsub_s_insn (ival) || is_fnmsub_s_insn (ival)
+ || is_fnmadd_s_insn (ival) || is_fadd_s_insn (ival)
+ || is_fsub_s_insn (ival) || is_fmul_s_insn (ival)
+ || is_fdiv_s_insn (ival) || is_fsqrt_s_insn (ival)
+ || is_fsgnj_s_insn (ival) || is_fsgnjn_s_insn (ival)
+ || is_fsgnjx_s_insn (ival) || is_fmin_s_insn (ival)
+ || is_fmax_s_insn (ival) || is_fcvt_s_w_insn (ival)
+ || is_fcvt_s_wu_insn (ival) || is_fmv_s_x_insn (ival)
+ || is_fcvt_s_l_insn (ival) || is_fcvt_s_lu_insn (ival)
+ || is_fld_insn (ival) || is_fmadd_d_insn (ival)
+ || is_fmsub_d_insn (ival) || is_fnmsub_d_insn (ival)
+ || is_fnmadd_d_insn (ival) || is_fadd_d_insn (ival)
+ || is_fsub_d_insn (ival) || is_fmul_d_insn (ival)
+ || is_fdiv_d_insn (ival) || is_fsqrt_d_insn (ival)
+ || is_fsgnj_d_insn (ival) || is_fsgnjn_d_insn (ival)
+ || is_fsgnjx_d_insn (ival) || is_fmin_d_insn (ival)
+ || is_fmax_d_insn (ival) || is_fcvt_s_d_insn (ival)
+ || is_fcvt_d_s_insn (ival) || is_fcvt_d_w_insn (ival)
+ || is_fcvt_d_wu_insn (ival) || is_fcvt_d_l_insn (ival)
+ || is_fcvt_d_lu_insn (ival) || is_fmv_d_x_insn (ival));
+ }
+
+ /* Returns true if instruction is classified. This function can set
+ m_error_occured. */
+ bool
+ try_save_pc_fprd (ULONGEST ival) noexcept
+ {
+ if (!need_save_pc_fprd (ival))
+ return false;
+
+ return (!save_reg (RISCV_FIRST_FP_REGNUM + decode_rd (ival))
+ || set_ordinary_record_type ());
+ }
+
+ /* Returns true if instruction needs only saving pc, rd and csr. */
+ static bool
+ need_save_pc_rd_csr (ULONGEST ival) noexcept
+ {
+ return (is_csrrw_insn (ival) || is_csrrs_insn (ival) || is_csrrc_insn (ival)
+ || is_csrrwi_insn (ival) || is_csrrsi_insn (ival)
+ || is_csrrci_insn (ival));
+ }
+
+ /* Returns true if instruction is classified. This function can set
+ m_error_occured. */
+ bool
+ try_save_pc_rd_csr (ULONGEST ival) noexcept
+ {
+ if (!need_save_pc_rd_csr (ival))
+ return false;
+
+ return (!save_reg (decode_rd (ival))
+ || !save_reg (RISCV_FIRST_CSR_REGNUM + decode_csr (ival))
+ || set_ordinary_record_type ());
+ }
+
+ /* Returns the size of the memory chunk that needs to be saved if the
+ instruction belongs to the group that needs only saving pc and memory.
+ Otherwise returns 0. */
+ static mem_len
+ need_save_pc_mem (ULONGEST ival) noexcept
+ {
+ if (is_sb_insn (ival))
+ return 1;
+ if (is_sh_insn (ival))
+ return 2;
+ if (is_sw_insn (ival) || is_fsw_insn (ival))
+ return 4;
+ if (is_sd_insn (ival) || is_fsd_insn (ival))
+ return 8;
+ return 0;
+ }
+
+ /* Returns true if instruction is classified. This function can set
+ m_error_occured. */
+ bool
+ try_save_pc_mem (ULONGEST ival, struct regcache *regcache) noexcept
+ {
+ gdb_assert (regcache != nullptr);
+
+ mem_addr addr = mem_addr{};
+ mem_len len = need_save_pc_mem (ival);
+ if (len <= 0)
+ return false;
+
+ mem_len offset = EXTRACT_STYPE_IMM (ival);
+ return (!read_reg (regcache, decode_rs1 (ival), addr)
+ || !save_mem (addr + offset, len) || set_ordinary_record_type ());
+ }
+
+ /* Returns the size of the memory chunk that needs to be saved if the
+ instruction belongs to the group that needs only saving pc, rd and memory.
+ Otherwise returns 0. */
+ static mem_len
+ need_save_pc_rd_mem (ULONGEST ival) noexcept
+ {
+ if (is_sc_w_insn (ival) || is_amoswap_w_insn (ival)
+ || is_amoadd_w_insn (ival) || is_amoxor_w_insn (ival)
+ || is_amoand_w_insn (ival) || is_amoor_w_insn (ival)
+ || is_amomin_w_insn (ival) || is_amomax_w_insn (ival)
+ || is_amominu_w_insn (ival) || is_amomaxu_w_insn (ival))
+ return 4;
+ if (is_sc_d_insn (ival) || is_amoswap_d_insn (ival)
+ || is_amoadd_d_insn (ival) || is_amoxor_d_insn (ival)
+ || is_amoand_d_insn (ival) || is_amoor_d_insn (ival)
+ || is_amomin_d_insn (ival) || is_amomax_d_insn (ival)
+ || is_amominu_d_insn (ival) || is_amomaxu_d_insn (ival))
+ return 8;
+ return 0;
+ }
+
+ /* Returns true if instruction is classified. This function can set
+ m_error_occured. */
+ bool
+ try_save_pc_rd_mem (ULONGEST ival, struct regcache *regcache) noexcept
+ {
+ gdb_assert (regcache != nullptr);
+
+ mem_len len = need_save_pc_rd_mem (ival);
+ mem_addr addr = 0;
+ if (len <= 0)
+ return false;
+
+ return (!read_reg (regcache, decode_rs1 (ival), addr)
+ || !save_mem (addr, len) || !save_reg (decode_rd (ival))
+ || set_ordinary_record_type ());
+ }
+
+ /* Returns true if instruction is successfully recordered. The length of
+ the instruction must be equal 4 bytes. */
+ bool
+ record_insn_len4 (ULONGEST ival, struct regcache *regcache) noexcept
+ {
+ gdb_assert (regcache != nullptr);
+
+ if (is_ecall_insn (ival))
+ {
+ return set_record_type (record_type::ECALL);
+ }
+
+ if (is_ebreak_insn (ival))
+ {
+ return set_record_type (record_type::EBREAK);
+ }
+
+ if (is_sret_insn (ival))
+ {
+ return (!save_reg (RISCV_CSR_SSTATUS_REGNUM)
+ || !save_reg (RISCV_CSR_MEPC_REGNUM)
+ || set_record_type (record_type::SRET));
+ }
+
+ if (is_mret_insn (ival))
+ {
+ return (!save_reg (RISCV_CSR_MSTATUS_REGNUM)
+ || !save_reg (RISCV_CSR_MEPC_REGNUM)
+ || set_record_type (record_type::MRET));
+ }
+
+ if (try_save_pc (ival) || try_save_pc_rd (ival) || try_save_pc_fprd (ival)
+ || try_save_pc_rd_csr (ival) || try_save_pc_mem (ival, regcache)
+ || try_save_pc_rd_mem (ival, regcache))
+ return !has_error ();
+
+ warning (_("Currently this instruction with len 4(%s) is unsupported"),
+ hex_string (ival));
+ return false;
+ }
+
+ /* Returns true if instruction is successfully recordered. The length of
+ the instruction must be equal 2 bytes. */
+ bool
+ record_insn_len2 (ULONGEST ival, struct regcache *regcache) noexcept
+ {
+ gdb_assert (regcache != nullptr);
+
+ mem_addr addr = mem_addr{};
+
+ /* The order here is very important, because
+ opcodes of some instructions may be the same. */
+
+ if (is_c_addi4spn_insn (ival) || is_c_lw_insn (ival)
+ || (m_xlen == 8 && is_c_ld_insn (ival)))
+ return (!save_reg (decode_crs2_short (ival))
+ || set_ordinary_record_type ());
+
+ if (is_c_fld_insn (ival) || (m_xlen == 4 && is_c_flw_insn (ival)))
+ return (!save_reg (RISCV_FIRST_FP_REGNUM + decode_crs2_short (ival))
+ || set_ordinary_record_type ());
+
+ if (is_c_fsd_insn (ival) || (m_xlen == 8 && is_c_sd_insn (ival)))
+ {
+ ULONGEST offset = ULONGEST{EXTRACT_CLTYPE_LD_IMM (ival)};
+ return (!read_reg (regcache, decode_crs1_short (ival), addr)
+ || !save_mem (addr + offset, 8) || set_ordinary_record_type ());
+ }
+
+ if ((m_xlen == 4 && is_c_fsw_insn (ival)) || is_c_sw_insn (ival))
+ {
+ ULONGEST offset = ULONGEST{EXTRACT_CLTYPE_LW_IMM (ival)};
+ return (!read_reg (regcache, decode_crs1_short (ival), addr)
+ || !save_mem (addr + offset, 4) || set_ordinary_record_type ());
+ }
+
+ if (is_c_nop_insn (ival))
+ return set_ordinary_record_type ();
+
+ if (is_c_addi_insn (ival))
+ return (!save_reg (decode_crs1 (ival)) || set_ordinary_record_type ());
+
+ if (m_xlen == 4 && is_c_jal_insn (ival))
+ return (!save_reg (RISCV_RA_REGNUM) || set_ordinary_record_type ());
+
+ if ((m_xlen == 8 && is_c_addiw_insn (ival)) || is_c_li_insn (ival))
+ return (!save_reg (decode_crs1 (ival)) || set_ordinary_record_type ());
+
+ if (is_c_addi16sp_insn (ival))
+ return (!save_reg (RISCV_SP_REGNUM) || set_ordinary_record_type ());
+
+ if (is_c_lui_insn (ival))
+ return (!save_reg (decode_crs1 (ival)) || set_ordinary_record_type ());
+
+ if (is_c_srli_insn (ival) || is_c_srai_insn (ival) || is_c_andi_insn (ival)
+ || is_c_sub_insn (ival) || is_c_xor_insn (ival) || is_c_or_insn (ival)
+ || is_c_and_insn (ival) || (m_xlen == 8 && is_c_subw_insn (ival))
+ || (m_xlen == 8 && is_c_addw_insn (ival)))
+ return (!save_reg (decode_crs1_short (ival))
+ || set_ordinary_record_type ());
+
+ if (is_c_j_insn (ival) || is_c_beqz_insn (ival) || is_c_bnez_insn (ival))
+ return set_ordinary_record_type ();
+
+ if (is_c_slli_insn (ival))
+ return (!save_reg (decode_crs1 (ival)) || set_ordinary_record_type ());
+
+ if (is_c_fldsp_insn (ival) || (m_xlen == 4 && is_c_flwsp_insn (ival)))
+ return (!save_reg (RISCV_FIRST_FP_REGNUM + decode_crs1 (ival))
+ || set_ordinary_record_type ());
+
+ if (is_c_lwsp_insn (ival) || (m_xlen == 8 && is_c_ldsp_insn (ival)))
+ return (!save_reg (decode_crs1 (ival)) || set_ordinary_record_type ());
+
+ if (is_c_jr_insn (ival))
+ return set_ordinary_record_type ();
+
+ if (is_c_mv_insn (ival))
+ return (!save_reg (decode_crs1 (ival)) || set_ordinary_record_type ());
+
+ if (is_c_ebreak_insn (ival))
+ {
+ return set_record_type (record_type::EBREAK);
+ }
+
+ if (is_c_jalr_insn (ival))
+ return (!save_reg (RISCV_RA_REGNUM) || set_ordinary_record_type ());
+
+ if (is_c_add_insn (ival))
+ return (!save_reg (decode_crs1 (ival)) || set_ordinary_record_type ());
+
+ if (is_c_fsdsp_insn (ival) || (m_xlen == 8 && is_c_sdsp_insn (ival)))
+ {
+ ULONGEST offset = ULONGEST{EXTRACT_CSSTYPE_SDSP_IMM (ival)};
+ return (!read_reg (regcache, RISCV_SP_REGNUM, addr)
+ || !save_mem (addr + offset, 8) || set_ordinary_record_type ());
+ }
+
+ if (is_c_swsp_insn (ival) || (m_xlen == 4 && is_c_fswsp_insn (ival)))
+ {
+ ULONGEST offset = ULONGEST{EXTRACT_CSSTYPE_SWSP_IMM (ival)};
+ return (!read_reg (regcache, RISCV_SP_REGNUM, addr)
+ || !save_mem (addr + offset, 4) || set_ordinary_record_type ());
+ }
+
+ warning (_("Currently this instruction with len 2(%s) is unsupported"),
+ hex_string (ival));
+ return false;
+ }
+
+public:
+ /* Iterator for registers that need to be recorded. */
+ using regs_iter = recorded_regs::const_iterator;
+ /* Iterator for memory chunks that need to be recorded. */
+ using mems_iter = recorded_mems::const_iterator;
+
+ /* Record instruction at address addr. Returns false if error happened. */
+ bool
+ record (gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr) noexcept
+ {
+ gdb_assert (gdbarch != nullptr);
+ gdb_assert (regcache != nullptr);
+
+ int m_length = 0;
+ ULONGEST ival = 0;
+ m_xlen = riscv_isa_xlen (gdbarch);
+
+ /* Since fetch_instruction can throw an exception,
+ it must be wrapped in a try-catch block. */
+ try
+ {
+ ival = riscv_insn::fetch_instruction (gdbarch, addr, &m_length);
+ }
+ catch (const gdb_exception_error &ex)
+ {
+ warning ("%s", ex.what ());
+ return false;
+ }
+ if (!save_reg (RISCV_PC_REGNUM))
+ return false;
+
+ if (m_length == 4)
+ return record_insn_len4 (ival, regcache);
+
+ if (m_length == 2)
+ return record_insn_len2 (ival, regcache);
+
+ /* 6 bytes or more. If the instruction is longer than 8 bytes, we don't
+ have full instruction bits in ival. At least, such long instructions
+ are not defined yet, so just ignore it. */
+ gdb_assert (m_length > 0 && m_length % 2 == 0);
+
+ warning (_("Can not record unknown instruction (opcode = %s)"),
+ hex_string (ival));
+ return false;
+ }
+
+ /* Get record type of instruction. */
+ record_type
+ get_record_type () const noexcept
+ {
+ return m_record_type;
+ }
+
+ /* Returns an iterator to the beginning of the registers that need
+ to be saved. */
+ regs_iter
+ regs_begin () const noexcept
+ {
+ return m_regs.begin ();
+ }
+
+ /* Returns an iterator to the end of the registers that need
+ to be saved. */
+ regs_iter
+ regs_end () const noexcept
+ {
+ return m_regs.end ();
+ }
+
+ /* Returns an iterator to the beginning of the memory chunks that need
+ to be saved. */
+ mems_iter
+ mems_begin () const noexcept
+ {
+ return m_mems.begin ();
+ }
+
+ /* Returns an iterator to the end of the memory chunks that need
+ to be saved. */
+ mems_iter
+ mems_end () const noexcept
+ {
+ return m_mems.end ();
+ }
+};
+
+/* A helper function to record instruction using record API. */
+
+static int
+riscv_record_insn_details (struct gdbarch *gdbarch, struct regcache *regcache,
+ const riscv_recorded_insn &insn)
+{
+ gdb_assert (gdbarch != nullptr);
+ gdb_assert (regcache != nullptr);
+
+ riscv_gdbarch_tdep *tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
+ auto regs_begin = insn.regs_begin ();
+ auto regs_end = insn.regs_end ();
+ if (std::any_of (regs_begin,
+ regs_end,
+ [&regcache] (auto &&reg_it)
+ {
+ return record_full_arch_list_add_reg (regcache, reg_it);
+ }))
+ return -1;
+
+ auto mems_begin = insn.mems_begin ();
+ auto mems_end = insn.mems_end ();
+ if (std::any_of (mems_begin,
+ mems_end,
+ [] (auto &&mem_it)
+ {
+ return record_full_arch_list_add_mem (mem_it.first,
+ mem_it.second);
+ }))
+ return -1;
+
+ switch (insn.get_record_type ())
+ {
+ case riscv_recorded_insn::record_type::ORDINARY:
+ case riscv_recorded_insn::record_type::EBREAK:
+ case riscv_recorded_insn::record_type::SRET:
+ case riscv_recorded_insn::record_type::MRET:
+ break;
+
+ case riscv_recorded_insn::record_type::ECALL:
+ {
+ if (!tdep->riscv_syscall_record)
+ {
+ warning (_("Syscall record is not supported"));
+ return -1;
+ }
+ ULONGEST reg_val = ULONGEST{};
+ if (!try_read (regcache, RISCV_A7_REGNUM, reg_val))
+ return -1;
+ return tdep->riscv_syscall_record (regcache, reg_val);
+ }
+
+ default:
+ return -1;
+ }
+ return 0;
+}
+
+/* Parse the current instruction and record the values of the registers and
+ memory that will be changed in current instruction to record_arch_list.
+ Return -1 if something is wrong. */
+
+int
+riscv_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
+ CORE_ADDR addr)
+{
+ gdb_assert (gdbarch != nullptr);
+ gdb_assert (regcache != nullptr);
+
+ riscv_recorded_insn insn;
+ if (!insn.record (gdbarch, regcache, addr))
+ return -1;
+
+ int ret_val = riscv_record_insn_details (gdbarch, regcache, insn);
+
+ if (record_full_arch_list_add_end ())
+ return -1;
+
+ return ret_val;
+}
diff --git a/gdb/riscv-tdep.h b/gdb/riscv-tdep.h
index 15c2c4c..2903aef 100644
--- a/gdb/riscv-tdep.h
+++ b/gdb/riscv-tdep.h
@@ -1,7 +1,7 @@
/* Target-dependent header for the RISC-V architecture, for GDB, the
GNU Debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -35,7 +35,11 @@ enum
RISCV_FP_REGNUM = 8, /* Frame Pointer. */
RISCV_A0_REGNUM = 10, /* First argument. */
RISCV_A1_REGNUM = 11, /* Second argument. */
- RISCV_A7_REGNUM = 17, /* Seventh argument. */
+ RISCV_A2_REGNUM = 12, /* Third argument. */
+ RISCV_A3_REGNUM = 13, /* Forth argument. */
+ RISCV_A4_REGNUM = 14, /* Fifth argument. */
+ RISCV_A5_REGNUM = 15, /* Sixth argument. */
+ RISCV_A7_REGNUM = 17, /* Register to pass syscall number. */
RISCV_PC_REGNUM = 32, /* Program Counter. */
RISCV_NUM_INTEGER_REGS = 32,
@@ -113,6 +117,10 @@ struct riscv_gdbarch_tdep : gdbarch_tdep_base
/* Return the expected next PC assuming FRAME is stopped at a syscall
instruction. */
CORE_ADDR (*syscall_next_pc) (const frame_info_ptr &frame) = nullptr;
+
+ /* Syscall record. */
+ int (*riscv_syscall_record) (struct regcache *regcache,
+ unsigned long svc_number) = nullptr;
};
@@ -177,6 +185,12 @@ extern void riscv_supply_regset (const struct regset *regset,
struct regcache *regcache, int regnum,
const void *regs, size_t len);
+/* Parse the current instruction, and record the values of the
+ registers and memory that will be changed by the current
+ instruction. Returns -1 if something goes wrong, 0 otherwise. */
+extern int riscv_process_record (struct gdbarch *gdbarch,
+ struct regcache *regcache, CORE_ADDR addr);
+
/* The names of the RISC-V target description features. */
extern const char *riscv_feature_name_csr;
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index f4aecce..5c49d1f 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the Renesas RL78 for GDB, the GNU debugger.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
@@ -1488,9 +1488,7 @@ rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Register the above initialization routine. */
-void _initialize_rl78_tdep ();
-void
-_initialize_rl78_tdep ()
+INIT_GDB_FILE (rl78_tdep)
{
gdbarch_register (bfd_arch_rl78, rl78_gdbarch_init);
}
diff --git a/gdb/rs6000-aix-nat.c b/gdb/rs6000-aix-nat.c
index 674189b..213f197 100644
--- a/gdb/rs6000-aix-nat.c
+++ b/gdb/rs6000-aix-nat.c
@@ -1,6 +1,6 @@
/* IBM RS/6000 native-dependent code for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1062,9 +1062,7 @@ rs6000_nat_target::xfer_shared_libraries
}
}
-void _initialize_rs6000_nat ();
-void
-_initialize_rs6000_nat ()
+INIT_GDB_FILE (rs6000_nat)
{
add_inf_child_target (&the_rs6000_nat_target);
}
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index e6255b1..536f647 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -1,6 +1,6 @@
/* Native support code for PPC AIX, for GDB the GNU debugger.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
Free Software Foundation, Inc.
@@ -1330,6 +1330,7 @@ rs6000_aix_ld_info_to_xml (struct gdbarch *gdbarch, const gdb_byte *ldi_buf,
static ULONGEST
rs6000_aix_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
+ struct bfd &cbfd,
gdb_byte *readbuf,
ULONGEST offset,
ULONGEST len)
@@ -1337,8 +1338,7 @@ rs6000_aix_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
struct bfd_section *ldinfo_sec;
int ldinfo_size;
- ldinfo_sec = bfd_get_section_by_name (current_program_space->core_bfd (),
- ".ldinfo");
+ ldinfo_sec = bfd_get_section_by_name (&cbfd, ".ldinfo");
if (ldinfo_sec == NULL)
error (_("cannot find .ldinfo section from core file: %s"),
bfd_errmsg (bfd_get_error ()));
@@ -1346,8 +1346,7 @@ rs6000_aix_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
gdb::byte_vector ldinfo_buf (ldinfo_size);
- if (! bfd_get_section_contents (current_program_space->core_bfd (),
- ldinfo_sec, ldinfo_buf.data (), 0,
+ if (! bfd_get_section_contents (&cbfd, ldinfo_sec, ldinfo_buf.data (), 0,
ldinfo_size))
error (_("unable to read .ldinfo section from core file: %s"),
bfd_errmsg (bfd_get_error ()));
@@ -1362,7 +1361,7 @@ rs6000_aix_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
/* RS6000/AIX does not support PT_STEP. Has to be simulated. */
- set_gdbarch_software_single_step (gdbarch, rs6000_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, rs6000_software_single_step);
/* Displaced stepping is currently not supported in combination with
software single-stepping. These override the values set by
@@ -1411,13 +1410,11 @@ rs6000_aix_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_wchar_signed (gdbarch, 0);
set_gdbarch_auto_wide_charset (gdbarch, rs6000_aix_auto_wide_charset);
- set_gdbarch_so_ops (gdbarch, &solib_aix_so_ops);
+ set_gdbarch_make_solib_ops (gdbarch, make_aix_solib_ops);
frame_unwind_append_unwinder (gdbarch, &aix_sighandle_frame_unwind);
}
-void _initialize_rs6000_aix_tdep ();
-void
-_initialize_rs6000_aix_tdep ()
+INIT_GDB_FILE (rs6000_aix_tdep)
{
gdbarch_register_osabi_sniffer (bfd_arch_rs6000,
bfd_target_xcoff_flavour,
diff --git a/gdb/rs6000-aix-tdep.h b/gdb/rs6000-aix-tdep.h
index 5e4f786..da3623d 100644
--- a/gdb/rs6000-aix-tdep.h
+++ b/gdb/rs6000-aix-tdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/rs6000-lynx178-tdep.c b/gdb/rs6000-lynx178-tdep.c
index a5a6bb9..d0d9a53 100644
--- a/gdb/rs6000-lynx178-tdep.c
+++ b/gdb/rs6000-lynx178-tdep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -407,9 +407,7 @@ rs6000_lynx178_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
}
-void _initialize_rs6000_lynx178_tdep ();
-void
-_initialize_rs6000_lynx178_tdep ()
+INIT_GDB_FILE (rs6000_lynx178_tdep)
{
gdbarch_register_osabi_sniffer (bfd_arch_rs6000,
bfd_target_xcoff_flavour,
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 0d1c89b..75079b9 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -6951,7 +6951,7 @@ ppc_process_record_prefix_store_vsx_ds_form (struct gdbarch *gdbarch,
}
/* Record the prefixed VSX, form D, instructions. The arguments are the
- instruction address for PC-relative addresss (addr), the first 32-bits of
+ instruction address for PC-relative address (addr), the first 32-bits of
the instruction (insn_prefix) and the following 32-bits of the instruction
(insn_suffix). Return 0 on success. */
@@ -7583,7 +7583,7 @@ ppc64_update_call_site_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
return pc + 4;
}
-/* Initialize the current architecture based on INFO. If possible, re-use an
+/* Initialize the current architecture based on INFO. If possible, reuse an
architecture from ARCHES, which is a list of architectures already created
during this debugging session.
@@ -8458,7 +8458,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_sofun_address_maybe_missing (gdbarch, 1);
/* Handles single stepping of atomic sequences. */
- set_gdbarch_software_single_step (gdbarch, ppc_deal_with_atomic_sequence);
+ set_gdbarch_get_next_pcs (gdbarch, ppc_deal_with_atomic_sequence);
/* Not sure on this. FIXMEmgo */
set_gdbarch_frame_args_skip (gdbarch, 8);
@@ -8722,9 +8722,7 @@ ppc_insn_prefix_dform (unsigned int insn1, unsigned int insn2)
/* Initialization code. */
-void _initialize_rs6000_tdep ();
-void
-_initialize_rs6000_tdep ()
+INIT_GDB_FILE (rs6000_tdep)
{
gdbarch_register (bfd_arch_rs6000, rs6000_gdbarch_init, rs6000_dump_tdep);
gdbarch_register (bfd_arch_powerpc, rs6000_gdbarch_init, rs6000_dump_tdep);
diff --git a/gdb/run-on-main-thread.c b/gdb/run-on-main-thread.c
index 746ea35..d68811b 100644
--- a/gdb/run-on-main-thread.c
+++ b/gdb/run-on-main-thread.c
@@ -1,5 +1,5 @@
/* Run a function on the main thread
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,10 +18,8 @@
#include "run-on-main-thread.h"
#include "ser-event.h"
-#if CXX_STD_THREAD
-#include <thread>
-#include <mutex>
-#endif
+#include "gdbsupport/cleanups.h"
+#include "gdbsupport/cxx-thread.h"
#include "gdbsupport/event-loop.h"
/* The serial event used when posting runnables. */
@@ -32,17 +30,13 @@ static struct serial_event *runnable_event;
static std::vector<std::function<void ()>> runnables;
-#if CXX_STD_THREAD
-
/* Mutex to hold when handling RUNNABLE_EVENT or RUNNABLES. */
-static std::mutex runnable_mutex;
+static gdb::mutex runnable_mutex;
/* The main thread's thread id. */
-static std::thread::id main_thread_id;
-
-#endif
+static gdb::thread::id main_thread_id;
/* Run all the queued runnables. */
@@ -54,9 +48,7 @@ run_events (int error, gdb_client_data client_data)
/* Hold the lock while changing the globals, but not while running
the runnables. */
{
-#if CXX_STD_THREAD
- std::lock_guard<std::mutex> lock (runnable_mutex);
-#endif
+ gdb::lock_guard<gdb::mutex> lock (runnable_mutex);
/* Clear the event fd. Do this before flushing the events list,
so that any new event post afterwards is sure to re-awaken the
@@ -83,7 +75,7 @@ run_events (int error, gdb_client_data client_data)
}
catch (const gdb_exception_quit &e)
{
- /* Should cancelation of a runnable event cancel the execution of
+ /* Should cancellation of a runnable event cancel the execution of
the following one? The answer is not clear, so keep doing what
we've done so far: ignore this exception. */
}
@@ -99,49 +91,38 @@ run_events (int error, gdb_client_data client_data)
void
run_on_main_thread (std::function<void ()> &&func)
{
-#if CXX_STD_THREAD
- std::lock_guard<std::mutex> lock (runnable_mutex);
-#endif
+ gdb::lock_guard<gdb::mutex> lock (runnable_mutex);
runnables.emplace_back (std::move (func));
serial_event_set (runnable_event);
}
-#if CXX_STD_THREAD
static bool main_thread_id_initialized = false;
-#endif
/* See run-on-main-thread.h. */
bool
is_main_thread ()
{
-#if CXX_STD_THREAD
/* Initialize main_thread_id on first use of is_main_thread. */
if (!main_thread_id_initialized)
{
main_thread_id_initialized = true;
- main_thread_id = std::this_thread::get_id ();
+ main_thread_id = gdb::this_thread::get_id ();
}
- return std::this_thread::get_id () == main_thread_id;
-#else
- return true;
-#endif
+ return gdb::this_thread::get_id () == main_thread_id;
}
-void _initialize_run_on_main_thread ();
-void
-_initialize_run_on_main_thread ()
+INIT_GDB_FILE (run_on_main_thread)
{
-#if CXX_STD_THREAD
/* The variable main_thread_id should be initialized when entering main, or
at an earlier use, so it should already be initialized here. */
gdb_assert (main_thread_id_initialized);
/* Assume that we execute this in the main thread. */
gdb_assert (is_main_thread ());
-#endif
+
runnable_event = make_serial_event ();
add_file_handler (serial_event_fd (runnable_event), run_events, nullptr,
"run-on-main-thread");
@@ -151,9 +132,7 @@ _initialize_run_on_main_thread ()
languages are shut down. */
add_final_cleanup ([] ()
{
-#if CXX_STD_THREAD
- std::lock_guard lock (runnable_mutex);
-#endif
+ gdb::lock_guard<gdb::mutex> lock (runnable_mutex);
runnables.clear ();
});
}
diff --git a/gdb/run-on-main-thread.h b/gdb/run-on-main-thread.h
index 4f370dd..edbd87d 100644
--- a/gdb/run-on-main-thread.h
+++ b/gdb/run-on-main-thread.h
@@ -1,5 +1,5 @@
/* Run a function on the main thread
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/rust-exp.h b/gdb/rust-exp.h
index e0496e1..3185242 100644
--- a/gdb/rust-exp.h
+++ b/gdb/rust-exp.h
@@ -1,6 +1,6 @@
/* Definitions for Rust expressions
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -33,14 +33,6 @@ extern struct value *eval_op_rust_array (struct type *expect_type,
enum exp_opcode opcode,
struct value *ncopies,
struct value *elt);
-extern struct value *rust_subscript (struct type *expect_type,
- struct expression *exp,
- enum noside noside, bool for_addr,
- struct value *lhs, struct value *rhs);
-extern struct value *rust_range (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum range_flag kind,
- struct value *low, struct value *high);
namespace expr
{
@@ -75,22 +67,26 @@ public:
struct expression *exp,
enum noside noside) override
{
- value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
- value *arg2 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
- return rust_subscript (expect_type, exp, noside, false, arg1, arg2);
+ return subscript (exp, noside, false);
}
value *slice (struct type *expect_type,
struct expression *exp,
enum noside noside)
{
- value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
- value *arg2 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
- return rust_subscript (expect_type, exp, noside, true, arg1, arg2);
+ return subscript (exp, noside, true);
}
enum exp_opcode opcode () const override
{ return BINOP_SUBSCRIPT; }
+
+private:
+
+ /* Helper function that does the work of evaluation. FOR_ADDR is
+ true if we're evaluating a slice. */
+ value *subscript (struct expression *exp, enum noside noside,
+ bool for_addr);
+
};
class rust_unop_addr_operation
@@ -126,17 +122,7 @@ public:
value *evaluate (struct type *expect_type,
struct expression *exp,
- enum noside noside) override
- {
- auto kind = std::get<0> (m_storage);
- value *low = nullptr;
- if (std::get<1> (m_storage) != nullptr)
- low = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
- value *high = nullptr;
- if (std::get<2> (m_storage) != nullptr)
- high = std::get<2> (m_storage)->evaluate (nullptr, exp, noside);
- return rust_range (expect_type, exp, noside, kind, low, high);
- }
+ enum noside noside) override;
enum exp_opcode opcode () const override
{ return OP_RANGE; }
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 8bec934..4626685 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -1,6 +1,6 @@
/* Rust language support routines for GDB, the GNU debugger.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include <ctype.h>
#include "block.h"
#include "c-lang.h"
@@ -116,7 +115,8 @@ rust_tuple_type_p (struct type *type)
}
/* Return true if all non-static fields of a structlike type are in a
- sequence like __0, __1, __2. */
+ sequence like 0, 1, 2. "__" prefixes are also accepted -- rustc
+ emits "__0" but gccrs emits "0". */
static bool
rust_underscore_fields (struct type *type)
@@ -125,14 +125,18 @@ rust_underscore_fields (struct type *type)
if (type->code () != TYPE_CODE_STRUCT)
return false;
- for (int i = 0; i < type->num_fields (); ++i)
+ for (const auto &field : type->fields ())
{
- if (!type->field (i).is_static ())
+ if (!field.is_static ())
{
char buf[20];
- xsnprintf (buf, sizeof (buf), "__%d", field_number);
- if (strcmp (buf, type->field (i).name ()) != 0)
+ xsnprintf (buf, sizeof (buf), "%d", field_number);
+
+ const char *field_name = field.name ();
+ if (startswith (field_name, "__"))
+ field_name += 2;
+ if (strcmp (buf, field_name) != 0)
return false;
field_number++;
}
@@ -371,11 +375,11 @@ rust_array_like_element_type (struct type *type)
{
/* Caller must check this. */
gdb_assert (rust_slice_type_p (type));
- for (int i = 0; i < type->num_fields (); ++i)
+ for (const auto &field : type->fields ())
{
- if (strcmp (type->field (i).name (), "data_ptr") == 0)
+ if (strcmp (field.name (), "data_ptr") == 0)
{
- struct type *base_type = type->field (i).type ()->target_type ();
+ struct type *base_type = field.type ()->target_type ();
if (rewrite_slice_type (base_type, nullptr, 0, nullptr))
return nullptr;
return base_type;
@@ -1012,9 +1016,9 @@ rust_internal_print_type (struct type *type, const char *varstring,
}
gdb_puts ("{\n", stream);
- for (int i = 0; i < type->num_fields (); ++i)
+ for (const auto &field : type->fields ())
{
- const char *name = type->field (i).name ();
+ const char *name = field.name ();
QUIT;
@@ -1137,13 +1141,22 @@ rust_slice_type (const char *name, struct type *elt_type,
-/* A helper for rust_evaluate_subexp that handles OP_RANGE. */
+namespace expr
+{
struct value *
-rust_range (struct type *expect_type, struct expression *exp,
- enum noside noside, enum range_flag kind,
- struct value *low, struct value *high)
+rust_range_operation::evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside)
{
+ auto kind = std::get<0> (m_storage);
+ value *low = nullptr;
+ if (std::get<1> (m_storage) != nullptr)
+ low = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
+ value *high = nullptr;
+ if (std::get<2> (m_storage) != nullptr)
+ high = std::get<2> (m_storage)->evaluate (nullptr, exp, noside);
+
struct value *addrval, *result;
CORE_ADDR addr;
struct type *range_type;
@@ -1220,6 +1233,8 @@ rust_range (struct type *expect_type, struct expression *exp,
return result;
}
+} /* namespace expr */
+
/* A helper function to compute the range and kind given a range
value. TYPE is the type of the range value. RANGE is the range
value. LOW, HIGH, and KIND are out parameters. The LOW and HIGH
@@ -1261,13 +1276,16 @@ rust_compute_range (struct type *type, struct value *range,
}
}
-/* A helper for rust_evaluate_subexp that handles BINOP_SUBSCRIPT. */
+namespace expr
+{
struct value *
-rust_subscript (struct type *expect_type, struct expression *exp,
- enum noside noside, bool for_addr,
- struct value *lhs, struct value *rhs)
+rust_subscript_operation::subscript (struct expression *exp,
+ enum noside noside, bool for_addr)
{
+ value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
+ value *rhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
+
struct value *result;
struct type *rhstype;
LONGEST low, high_bound;
@@ -1408,9 +1426,6 @@ rust_subscript (struct type *expect_type, struct expression *exp,
return result;
}
-namespace expr
-{
-
struct value *
rust_unop_ind_operation::evaluate (struct type *expect_type,
struct expression *exp,
@@ -1476,7 +1491,7 @@ rust_struct_anon::evaluate (struct type *expect_type,
value *lhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
int field_number = std::get<0> (m_storage);
- struct type *type = lhs->type ();
+ struct type *type = check_typedef (lhs->type ());
if (type->code () == TYPE_CODE_STRUCT)
{
@@ -1772,7 +1787,7 @@ rust_language::emitchar (int ch, struct type *chtype,
gdb_puts ("\\t", stream);
else if (ch == '\0')
gdb_puts ("\\0", stream);
- else if (ch >= 32 && ch <= 127 && isprint (ch))
+ else if (ch >= 32 && ch <= 127 && c_isprint (ch))
gdb_putc (ch, stream);
else if (ch <= 255)
gdb_printf (stream, "\\x%02x", ch);
diff --git a/gdb/rust-lang.h b/gdb/rust-lang.h
index c3369a0..b35968e 100644
--- a/gdb/rust-lang.h
+++ b/gdb/rust-lang.h
@@ -1,6 +1,6 @@
/* Rust language support definitions for GDB, the GNU debugger.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/rust-parse.c b/gdb/rust-parse.c
index e25ae54..6ad6542 100644
--- a/gdb/rust-parse.c
+++ b/gdb/rust-parse.c
@@ -1,6 +1,6 @@
/* Rust expression parsing for GDB, the GNU debugger.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -335,7 +335,7 @@ struct rust_parser
return std::string (current_string_val.ptr, current_string_val.length);
}
- /* A pointer to this is installed globally. */
+ /* Storage for use while parsing. */
auto_obstack obstack;
/* The parser state gdb gave us. */
@@ -1232,14 +1232,14 @@ rust_parser::name_to_operation (const std::string &name)
struct block_symbol sym = lookup_symbol (name.c_str (),
pstate->expression_context_block,
SEARCH_VFT);
- if (sym.symbol != nullptr && sym.symbol->aclass () != LOC_TYPEDEF)
+ if (sym.symbol != nullptr && sym.symbol->loc_class () != LOC_TYPEDEF)
return make_operation<var_value_operation> (sym);
struct type *type = nullptr;
if (sym.symbol != nullptr)
{
- gdb_assert (sym.symbol->aclass () == LOC_TYPEDEF);
+ gdb_assert (sym.symbol->loc_class () == LOC_TYPEDEF);
type = sym.symbol->type ();
}
if (type == nullptr)
@@ -2421,9 +2421,7 @@ rust_lex_tests (void)
-void _initialize_rust_exp ();
-void
-_initialize_rust_exp ()
+INIT_GDB_FILE (rust_exp)
{
int code = regcomp (&number_regex, number_regex_text, REG_EXTENDED);
/* If the regular expression was incorrect, it was a programming
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 18d1848..7b110ce 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the Renesas RX for GDB, the GNU debugger.
- Copyright (C) 2008-2024 Free Software Foundation, Inc.
+ Copyright (C) 2008-2025 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
@@ -1063,9 +1063,7 @@ rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Register the above initialization routine. */
-void _initialize_rx_tdep ();
-void
-_initialize_rx_tdep ()
+INIT_GDB_FILE (rx_tdep)
{
gdbarch_register (bfd_arch_rx, rx_gdbarch_init);
initialize_tdesc_rx ();
diff --git a/gdb/s12z-tdep.c b/gdb/s12z-tdep.c
index faef1a4..0d49f98 100644
--- a/gdb/s12z-tdep.c
+++ b/gdb/s12z-tdep.c
@@ -1,5 +1,5 @@
/* Target-dependent code for the S12Z, for the GDB.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -516,7 +516,7 @@ s12z_print_ccw_info (struct gdbarch *gdbarch,
gdb_putc (ccw_bits[b], file);
}
else
- gdb_putc (tolower (ccw_bits[b]), file);
+ gdb_putc (c_tolower (ccw_bits[b]), file);
}
gdb_putc ('\n', file);
}
@@ -662,9 +662,7 @@ s12z_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_s12z_tdep ();
-void
-_initialize_s12z_tdep ()
+INIT_GDB_FILE (s12z_tdep)
{
gdbarch_register (bfd_arch_s12z, s12z_gdbarch_init, NULL);
}
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index 0726536..5b723b1 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -1,5 +1,5 @@
/* S390 native-dependent code for GDB, the GNU debugger.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
for IBM Deutschland Entwicklung GmbH, IBM Corporation.
@@ -1051,9 +1051,7 @@ s390_linux_nat_target::read_description ()
tdesc_s390_linux32);
}
-void _initialize_s390_nat ();
-void
-_initialize_s390_nat ()
+INIT_GDB_FILE (s390_nat)
{
/* Register the target. */
linux_target = &the_s390_linux_nat_target;
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 96d6d44..66e571d 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux on s390.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
for IBM Deutschland Entwicklung GmbH, IBM Corporation.
@@ -29,6 +29,8 @@
#include "gdbcore.h"
#include "linux-record.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
+#include "svr4-tls-tdep.h"
#include "objfiles.h"
#include "osabi.h"
#include "regcache.h"
@@ -40,6 +42,7 @@
#include "target.h"
#include "trad-frame.h"
#include "xml-syscall.h"
+#include "inferior.h"
#include "features/s390-linux32v1.c"
#include "features/s390-linux32v2.c"
@@ -1124,6 +1127,45 @@ s390_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
record_tdep->ioctl_FIOQSIZE = 0x545e;
}
+/* Fetch and return the TLS DTV (dynamic thread vector) address for PTID.
+ Throw a suitable TLS error if something goes wrong. */
+
+static CORE_ADDR
+s390_linux_get_tls_dtv_addr (struct gdbarch *gdbarch, ptid_t ptid,
+ enum svr4_tls_libc libc)
+{
+ /* On S390, the thread pointer is found in two registers A0 and A1
+ (or, using gdb naming, acr0 and acr1) A0 contains the top 32
+ bits of the address and A1 contains the bottom 32 bits. */
+ regcache *regcache
+ = get_thread_arch_regcache (current_inferior (), ptid, gdbarch);
+ target_fetch_registers (regcache, S390_A0_REGNUM);
+ target_fetch_registers (regcache, S390_A1_REGNUM);
+ ULONGEST thr_ptr_lo, thr_ptr_hi, thr_ptr;
+ if (regcache->cooked_read (S390_A0_REGNUM, &thr_ptr_hi) != REG_VALID
+ || regcache->cooked_read (S390_A1_REGNUM, &thr_ptr_lo) != REG_VALID)
+ throw_error (TLS_GENERIC_ERROR, _("Unable to fetch thread pointer"));
+ thr_ptr = (thr_ptr_hi << 32) + thr_ptr_lo;
+
+ /* The thread pointer points at the TCB (thread control block). The
+ first two members of this struct are both pointers, where the
+ first will be a pointer to the TCB (i.e. it points at itself)
+ and the second will be a pointer to the DTV (dynamic thread
+ vector). There are many other fields too, but the one we care
+ about here is the DTV pointer. Compute the address of the DTV
+ pointer, fetch it, and convert it to an address. */
+ CORE_ADDR dtv_ptr_addr
+ = thr_ptr + gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
+ gdb::byte_vector buf (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
+ if (target_read_memory (dtv_ptr_addr, buf.data (), buf.size ()) != 0)
+ throw_error (TLS_GENERIC_ERROR, _("Unable to fetch DTV address"));
+
+ const struct builtin_type *builtin = builtin_type (gdbarch);
+ CORE_ADDR dtv_addr = gdbarch_pointer_to_address
+ (gdbarch, builtin->builtin_data_ptr, buf.data ());
+ return dtv_addr;
+}
+
/* Initialize OSABI common for GNU/Linux on 31- and 64-bit systems. */
static void
@@ -1152,6 +1194,9 @@ s390_linux_init_abi_any (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
+ set_gdbarch_get_thread_local_address (gdbarch,
+ svr4_tls_get_thread_local_address);
+ svr4_tls_register_tls_methods (info, gdbarch, s390_linux_get_tls_dtv_addr);
/* Support reverse debugging. */
set_gdbarch_process_record_signal (gdbarch, s390_linux_record_signal);
@@ -1170,8 +1215,7 @@ s390_linux_init_abi_31 (struct gdbarch_info info, struct gdbarch *gdbarch)
s390_linux_init_abi_any (info, gdbarch);
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_S390);
}
@@ -1186,14 +1230,11 @@ s390_linux_init_abi_64 (struct gdbarch_info info, struct gdbarch *gdbarch)
s390_linux_init_abi_any (info, gdbarch);
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- linux_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_lp64_svr4_solib_ops);
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_S390X);
}
-void _initialize_s390_linux_tdep ();
-void
-_initialize_s390_linux_tdep ()
+INIT_GDB_FILE (s390_linux_tdep)
{
/* Hook us into the OSABI mechanism. */
gdbarch_register_osabi (bfd_arch_s390, bfd_mach_s390_31, GDB_OSABI_LINUX,
diff --git a/gdb/s390-linux-tdep.h b/gdb/s390-linux-tdep.h
index b2efb5b..05ef893 100644
--- a/gdb/s390-linux-tdep.h
+++ b/gdb/s390-linux-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux on s390.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 41faf93..0cef5f4 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for s390.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -41,6 +41,8 @@
#include "value.h"
#include "inferior.h"
#include "dwarf2/loc.h"
+#include "gdbsupport/selftest.h"
+#include "gdb/disasm-selftests.h"
#include "features/s390-linux32.c"
#include "features/s390x-linux64.c"
@@ -2488,7 +2490,7 @@ s390_prologue_frame_unwind_cache (const frame_info_ptr &this_frame,
size zero. This is only possible if the next frame is a sentinel
frame, a dummy frame, or a signal trampoline frame. */
/* FIXME: cagney/2004-05-01: This sanity check shouldn't be
- needed, instead the code should simpliy rely on its
+ needed, instead the code should simply rely on its
analysis. */
next_frame = get_next_frame (this_frame);
while (next_frame && get_frame_type (next_frame) == INLINE_FRAME)
@@ -2537,7 +2539,7 @@ s390_prologue_frame_unwind_cache (const frame_info_ptr &this_frame,
code at a point where the frame pointer has already been restored.
This can only happen in an innermost frame. */
/* FIXME: cagney/2004-05-01: This sanity check shouldn't be needed,
- instead the code should simpliy rely on its analysis. */
+ instead the code should simply rely on its analysis. */
next_frame = get_next_frame (this_frame);
while (next_frame && get_frame_type (next_frame) == INLINE_FRAME)
next_frame = get_next_frame (next_frame);
@@ -7055,10 +7057,10 @@ s390_gnu_triplet_regexp (struct gdbarch *gdbarch)
static int
s390_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
- return ((isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement
+ return ((c_isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement
or indirection. */
|| *s == '%' /* Register access. */
- || isdigit (*s)); /* Literal number. */
+ || c_isdigit (*s)); /* Literal number. */
}
/* gdbarch init. */
@@ -7298,7 +7300,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
s390_displaced_step_copy_insn);
set_gdbarch_displaced_step_fixup (gdbarch, s390_displaced_step_fixup);
set_gdbarch_displaced_step_hw_singlestep (gdbarch, s390_displaced_step_hw_singlestep);
- set_gdbarch_software_single_step (gdbarch, s390_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, s390_software_single_step);
set_gdbarch_max_insn_length (gdbarch, S390_MAX_INSTR_SIZE);
/* Prologue analysis. */
@@ -7468,13 +7470,61 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_s390_tdep ();
-void
-_initialize_s390_tdep ()
+#if GDB_SELF_TEST
+namespace selftests {
+
+/* Return bfd_arch_info representing s390x. */
+
+static const bfd_arch_info *
+bfd_arch_info_s390x ()
+{
+ return bfd_lookup_arch (bfd_arch_s390, bfd_mach_s390_64);
+}
+
+/* Return gdbarch representing s390x. */
+
+static gdbarch *
+gdbarch_s390x ()
+{
+ struct gdbarch_info info;
+ info.bfd_arch_info = bfd_arch_info_s390x ();
+ if (info.bfd_arch_info == nullptr)
+ return nullptr;
+
+ info.osabi = GDB_OSABI_NONE;
+ return gdbarch_find_by_info (info);
+}
+
+/* Check disassembly of s390x instructions. */
+
+static void
+disassemble_s390x ()
+{
+ gdbarch *gdbarch = gdbarch_s390x ();
+ if (gdbarch == nullptr)
+ return;
+
+ scoped_restore disassembler_options_restore
+ = make_scoped_restore (&s390_disassembler_options, "zarch");
+
+ gdb::byte_vector insn = { 0xb9, 0x68, 0x00, 0x03 };
+ disassemble_insn (gdbarch, insn, "clzg\t%r0,%r3");
+}
+
+} /* namespace selftests */
+
+#endif /* GDB_SELF_TEST */
+
+INIT_GDB_FILE (s390_tdep)
{
/* Hook us into the gdbarch mechanism. */
gdbarch_register (bfd_arch_s390, s390_gdbarch_init);
initialize_tdesc_s390_linux32 ();
initialize_tdesc_s390x_linux64 ();
+
+#if GDB_SELF_TEST
+ selftests::register_test ("disassemble-s390x",
+ selftests::disassemble_s390x);
+#endif /* GDB_SELF_TEST */
}
diff --git a/gdb/s390-tdep.h b/gdb/s390-tdep.h
index d8f5fd5..80ca3b4 100644
--- a/gdb/s390-tdep.h
+++ b/gdb/s390-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for s390.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/sanitize.m4 b/gdb/sanitize.m4
index 21c8730..71624e9 100644
--- a/gdb/sanitize.m4
+++ b/gdb/sanitize.m4
@@ -1,5 +1,5 @@
dnl Sanitization-related configure macro for GDB
-dnl Copyright (C) 2018-2024 Free Software Foundation, Inc.
+dnl Copyright (C) 2018-2025 Free Software Foundation, Inc.
dnl
dnl This file is part of GDB.
dnl
diff --git a/gdb/scoped-mock-context.h b/gdb/scoped-mock-context.h
index 9173ecb..e581e10 100644
--- a/gdb/scoped-mock-context.h
+++ b/gdb/scoped-mock-context.h
@@ -1,6 +1,6 @@
/* RAII type to create a temporary mock context.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/selftest-arch.c b/gdb/selftest-arch.c
index 79889c0..452258c 100644
--- a/gdb/selftest-arch.c
+++ b/gdb/selftest-arch.c
@@ -1,5 +1,5 @@
/* GDB self-test for each gdbarch.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/selftest-arch.h b/gdb/selftest-arch.h
index c6a85fa..6d214a2 100644
--- a/gdb/selftest-arch.h
+++ b/gdb/selftest-arch.h
@@ -1,5 +1,5 @@
/* GDB self-test for each gdbarch.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/sentinel-frame.c b/gdb/sentinel-frame.c
index c809259..410a6f4 100644
--- a/gdb/sentinel-frame.c
+++ b/gdb/sentinel-frame.c
@@ -1,6 +1,6 @@
/* Code dealing with register stack frames, for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/sentinel-frame.h b/gdb/sentinel-frame.h
index b2d4d75..61decb1 100644
--- a/gdb/sentinel-frame.h
+++ b/gdb/sentinel-frame.h
@@ -1,6 +1,6 @@
/* Code dealing with register stack frames, for GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ser-base.c b/gdb/ser-base.c
index 838560e..1c085cd 100644
--- a/gdb/ser-base.c
+++ b/gdb/ser-base.c
@@ -1,6 +1,6 @@
/* Generic serial interface functions.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ser-base.h b/gdb/ser-base.h
index ecb7c99..524278d 100644
--- a/gdb/ser-base.h
+++ b/gdb/ser-base.h
@@ -1,6 +1,6 @@
/* Generic serial interface functions.
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ser-event.c b/gdb/ser-event.c
index b039e86..7473ed1 100644
--- a/gdb/ser-event.c
+++ b/gdb/ser-event.c
@@ -1,5 +1,5 @@
/* Serial interface for a selectable event.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ser-event.h b/gdb/ser-event.h
index 08fc62b..96720b9 100644
--- a/gdb/ser-event.h
+++ b/gdb/ser-event.h
@@ -1,5 +1,5 @@
/* Serial interface for a selectable event.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c
index 2802a44..6e60569 100644
--- a/gdb/ser-go32.c
+++ b/gdb/ser-go32.c
@@ -1,5 +1,5 @@
/* Remote serial interface for local (hardwired) serial ports for GO32.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
Contributed by Nigel Stephens, Algorithmics Ltd. (nigel@algor.co.uk).
@@ -914,9 +914,7 @@ info_serial_command (const char *arg, int from_tty)
#endif
}
-void _initialize_ser_dos ();
-void
-_initialize_ser_dos ()
+INIT_GDB_FILE (ser_dos)
{
serial_add_interface (&dos_ops);
diff --git a/gdb/ser-mingw.c b/gdb/ser-mingw.c
index 2603bb8..086919a 100644
--- a/gdb/ser-mingw.c
+++ b/gdb/ser-mingw.c
@@ -1,6 +1,6 @@
/* Serial interface for local (hardwired) serial ports on Windows systems
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -281,10 +281,10 @@ ser_windows_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
cleared, and we get a duplicated event, if the last batch
of characters included at least two arriving close together. */
if (!SetCommMask (h, 0))
- warning (_("ser_windows_wait_handle: reseting mask failed"));
+ warning (_("ser_windows_wait_handle: resetting mask failed"));
if (!SetCommMask (h, EV_RXCHAR))
- warning (_("ser_windows_wait_handle: reseting mask failed (2)"));
+ warning (_("ser_windows_wait_handle: resetting mask failed (2)"));
/* There's a potential race condition here; we must check cbInQue
and not wait if that's nonzero. */
@@ -1338,9 +1338,7 @@ static const struct serial_ops tcp_ops =
net_windows_done_wait_handle
};
-void _initialize_ser_windows ();
-void
-_initialize_ser_windows ()
+INIT_GDB_FILE (ser_windows)
{
WSADATA wsa_data;
diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c
index 4931203..bdf3602 100644
--- a/gdb/ser-pipe.c
+++ b/gdb/ser-pipe.c
@@ -1,5 +1,5 @@
/* Serial interface for a pipe to a separate program
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
@@ -236,9 +236,7 @@ static const struct serial_ops pipe_ops =
ser_unix_write_prim
};
-void _initialize_ser_pipe ();
-void
-_initialize_ser_pipe ()
+INIT_GDB_FILE (ser_pipe)
{
serial_add_interface (&pipe_ops);
}
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index 18d9123..589b23d 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -1,6 +1,6 @@
/* Serial interface for raw TCP connections on Un*x like systems.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -465,9 +465,7 @@ static const struct serial_ops tcp_ops =
#endif /* USE_WIN32API */
-void _initialize_ser_tcp ();
-void
-_initialize_ser_tcp ()
+INIT_GDB_FILE (ser_tcp)
{
#ifdef USE_WIN32API
/* Do nothing; the TCP serial operations will be initialized in
diff --git a/gdb/ser-tcp.h b/gdb/ser-tcp.h
index a1ebcf3..988fc0f 100644
--- a/gdb/ser-tcp.h
+++ b/gdb/ser-tcp.h
@@ -1,6 +1,6 @@
/* Serial interface for raw TCP connections on Un*x like systems.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ser-uds.c b/gdb/ser-uds.c
index 8da4c7a..2a45a90 100644
--- a/gdb/ser-uds.c
+++ b/gdb/ser-uds.c
@@ -1,6 +1,6 @@
/* Serial interface for local domain connections on Un*x like systems.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -110,9 +110,7 @@ static const struct serial_ops uds_ops =
uds_write_prim
};
-void _initialize_ser_socket ();
-void
-_initialize_ser_socket ()
+INIT_GDB_FILE (ser_socket)
{
serial_add_interface (&uds_ops);
}
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
index 02845aa..553220e 100644
--- a/gdb/ser-unix.c
+++ b/gdb/ser-unix.c
@@ -1,6 +1,6 @@
/* Serial interface for local (hardwired) serial ports on Un*x like systems
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -30,9 +30,33 @@
#include "gdbsupport/gdb_select.h"
#include "cli/cli-cmds.h"
#include "gdbsupport/filestuff.h"
-#include <termios.h>
+
+#ifdef HAVE_SYS_IOCTL_H
+# include <sys/ioctl.h>
+#endif
+
+#if HAVE_IOKIT_SERIAL_IOSS_H
+# include <IOKit/serial/ioss.h>
+#endif
+
+#if HAVE_ASM_TERMIOS_H
+/* Workaround to resolve conflicting declarations of termios
+ in <asm/termbits.h> and <termios.h>. */
+# define termios asmtermios
+# include <asm/termbits.h>
+# undef termios
+#endif
+
+#ifdef HAVE_TERMIOS_H
+# include <termios.h>
+#endif
+
#include "gdbsupport/scoped_ignore_sigttou.h"
+#if defined(HAVE_SYS_IOCTL_H) && (defined(BOTHER) || defined(IOSSIOSPEED))
+# define HAVE_CUSTOM_BAUDRATE_SUPPORT 1
+#endif
+
struct hardwire_ttystate
{
struct termios termios;
@@ -289,14 +313,32 @@ baudtab[] =
4800, B4800
}
,
+#ifdef B7200
+ {
+ 7200, B7200
+ }
+ ,
+#endif
{
9600, B9600
}
,
+#ifdef B14400
+ {
+ 14400, B14400
+ }
+ ,
+#endif
{
19200, B19200
}
,
+#ifdef B28800
+ {
+ 28800, B28800
+ }
+ ,
+#endif
{
38400, B38400
}
@@ -307,6 +349,12 @@ baudtab[] =
}
,
#endif
+#ifdef B76800
+ {
+ 76800, B76800
+ }
+ ,
+#endif
#ifdef B115200
{
115200, B115200
@@ -404,7 +452,7 @@ rate_to_code (int rate)
for (i = 0; baudtab[i].rate != -1; i++)
{
- /* test for perfect macth. */
+ /* test for perfect match. */
if (rate == baudtab[i].rate)
return baudtab[i].code;
else
@@ -412,6 +460,7 @@ rate_to_code (int rate)
/* check if it is in between valid values. */
if (rate < baudtab[i].rate)
{
+#if !HAVE_CUSTOM_BAUDRATE_SUPPORT
if (i)
{
error (_("Invalid baud rate %d. "
@@ -423,29 +472,126 @@ rate_to_code (int rate)
error (_("Invalid baud rate %d. Minimum value is %d."),
rate, baudtab[0].rate);
}
+#else
+ return -1;
+#endif
}
}
}
-
+
+#if !HAVE_CUSTOM_BAUDRATE_SUPPORT
/* The requested speed was too large. */
error (_("Invalid baud rate %d. Maximum value is %d."),
rate, baudtab[i - 1].rate);
+#else
+ return -1;
+#endif
}
+/* Set baud rate using B_code from termios.h. */
+
static void
-hardwire_setbaudrate (struct serial *scb, int rate)
+set_baudcode_baudrate (struct serial *scb, int baud_code)
{
struct hardwire_ttystate state;
- int baud_code = rate_to_code (rate);
-
+
if (get_tty_state (scb, &state))
- perror_with_name ("could not get tty state");
+ perror_with_name (_("could not get tty state"));
cfsetospeed (&state.termios, baud_code);
cfsetispeed (&state.termios, baud_code);
if (set_tty_state (scb, &state))
- perror_with_name ("could not set tty state");
+ perror_with_name (_("could not set tty state"));
+}
+
+#if HAVE_CUSTOM_BAUDRATE_SUPPORT && defined(BOTHER)
+
+/* Set a custom baud rate using the termios BOTHER. */
+
+static void
+set_custom_baudrate_linux (int fd, int rate)
+{
+#ifdef TCGETS2
+ struct termios2 tio;
+ const unsigned long req_get = TCGETS2;
+ const unsigned long req_set = TCSETS2;
+#else
+ struct termios tio;
+ const unsigned long req_get = TCGETS;
+ const unsigned long req_set = TCSETS;
+#endif
+
+ if (ioctl (fd, req_get, &tio) < 0)
+ perror_with_name (_("Can not get current baud rate"));
+
+ /* Clear the current output baud rate and fill a new value. */
+ tio.c_cflag &= ~CBAUD;
+ tio.c_cflag |= BOTHER;
+ tio.c_ospeed = rate;
+
+ /* Clear the current input baud rate and fill a new value. */
+ tio.c_cflag &= ~(CBAUD << IBSHIFT);
+ tio.c_cflag |= BOTHER << IBSHIFT;
+ tio.c_ispeed = rate;
+
+ if (ioctl (fd, req_set, &tio) < 0)
+ perror_with_name (_("Can not set custom baud rate"));
+}
+
+#elif HAVE_CUSTOM_BAUDRATE_SUPPORT && defined(IOSSIOSPEED)
+
+/* Set a custom baud rate using the IOSSIOSPEED ioctl call. */
+
+static void
+set_custom_baudrate_darwin (int fd, int rate)
+{
+
+ if (ioctl (fd, IOSSIOSPEED, &rate) < 0)
+ perror_with_name (_("Can not set custom baud rate"));
+}
+
+#endif /* HAVE_CUSTOM_BAUDRATE_SUPPORT
+ && (defined(BOTHER) || defined(IOSSIOSPEED)) */
+
+#if HAVE_CUSTOM_BAUDRATE_SUPPORT
+
+/* Set a baud rate that differs from the OS B_codes.
+ This is possible if one of the following macros is available:
+ - BOTHER (Linux).
+ - IOSSIOSPEED (Darwin). */
+
+static void
+set_custom_baudrate (int fd, int rate)
+{
+#if defined(BOTHER)
+ set_custom_baudrate_linux (fd, rate);
+#elif defined(IOSSIOSPEED)
+ set_custom_baudrate_darwin (fd, rate);
+#endif
+}
+
+#endif /* HAVE_CUSTOM_BAUDRATE_SUPPORT */
+
+/* Set the baud rate for the serial communication. */
+
+static void
+hardwire_setbaudrate (struct serial *scb, int rate)
+{
+ int baud_code = rate_to_code (rate);
+
+ if (baud_code < 0)
+ {
+#if HAVE_CUSTOM_BAUDRATE_SUPPORT
+ set_custom_baudrate (scb->fd, rate);
+#else
+ /* An error should already have been thrown by rate_to_code().
+ Add an additional error in case execution somehow reaches this line. */
+ gdb_assert_not_reached ("Serial baud rate was not found in B_codes");
+#endif
+ }
+ else
+ set_baudcode_baudrate (scb, baud_code);
}
static int
@@ -551,9 +697,7 @@ static const struct serial_ops hardwire_ops =
ser_unix_write_prim
};
-void _initialize_ser_hardwire ();
-void
-_initialize_ser_hardwire ()
+INIT_GDB_FILE (ser_hardwire)
{
serial_add_interface (&hardwire_ops);
diff --git a/gdb/ser-unix.h b/gdb/ser-unix.h
index 487921f..048ab84 100644
--- a/gdb/ser-unix.h
+++ b/gdb/ser-unix.h
@@ -1,6 +1,6 @@
/* Serial interface for UN*X file-descriptor based connection.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/serial.c b/gdb/serial.c
index f96668a..d047fdf 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -1,6 +1,6 @@
/* Generic serial interface routines
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include <ctype.h>
#include "serial.h"
#include "cli/cli-cmds.h"
#include "cli/cli-utils.h"
@@ -116,7 +115,7 @@ serial_logchar (struct ui_file *stream, int ch_type, int ch, int timeout)
break;
default:
gdb_printf (stream,
- isprint (ch) ? "%c" : "\\x%02x", ch & 0xFF);
+ c_isprint (ch) ? "%c" : "\\x%02x", ch & 0xFF);
break;
}
}
@@ -642,9 +641,7 @@ set_parity (const char *ignore_args, int from_tty, struct cmd_list_element *c)
serial_parity = GDBPARITY_NONE;
}
-void _initialize_serial ();
-void
-_initialize_serial ()
+INIT_GDB_FILE (serial)
{
#if 0
add_com ("connect", class_obscure, connect_command, _("\
diff --git a/gdb/serial.h b/gdb/serial.h
index 017b890..1f26dc6 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -1,5 +1,5 @@
/* Remote serial support interface definitions for GDB, the GNU Debugger.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/setup.cfg b/gdb/setup.cfg
index d33058e..2e83eb5 100644
--- a/gdb/setup.cfg
+++ b/gdb/setup.cfg
@@ -7,6 +7,3 @@
# E701: Multiple statements on one line (colon)
# W503: line break before binary operator
ignore = E203,E501,E701,W503
-
-[isort]
-profile = black
diff --git a/gdb/sh-linux-tdep.c b/gdb/sh-linux-tdep.c
index affbf55..2578192 100644
--- a/gdb/sh-linux-tdep.c
+++ b/gdb/sh-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux Super-H.
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -28,6 +28,7 @@
#include "glibc-tdep.h"
#include "sh-tdep.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
#include "gdbarch.h"
#define REGSx16(base) \
@@ -187,8 +188,7 @@ sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU/Linux uses SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
set_gdbarch_fetch_tls_load_module_address (gdbarch,
@@ -207,9 +207,7 @@ sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tramp_frame_prepend_unwinder (gdbarch, &sh_linux_rt_sigreturn_tramp_frame);
}
-void _initialize_sh_linux_tdep ();
-void
-_initialize_sh_linux_tdep ()
+INIT_GDB_FILE (sh_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_LINUX, sh_linux_init_abi);
}
diff --git a/gdb/sh-netbsd-nat.c b/gdb/sh-netbsd-nat.c
index c3c31e9..d36dba5 100644
--- a/gdb/sh-netbsd-nat.c
+++ b/gdb/sh-netbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for NetBSD/sh.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Wasabi Systems, Inc.
@@ -98,9 +98,7 @@ sh_nbsd_nat_target::store_registers (struct regcache *regcache, int regno)
}
}
-void _initialize_shnbsd_nat ();
-void
-_initialize_shnbsd_nat ()
+INIT_GDB_FILE (shnbsd_nat)
{
add_inf_child_target (&the_sh_nbsd_nat_target);
}
diff --git a/gdb/sh-netbsd-tdep.c b/gdb/sh-netbsd-tdep.c
index fec6a2e..4b0181b 100644
--- a/gdb/sh-netbsd-tdep.c
+++ b/gdb/sh-netbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for NetBSD/sh.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Wasabi Systems, Inc.
@@ -68,13 +68,10 @@ shnbsd_init_abi (struct gdbarch_info info,
tdep->core_gregmap = (struct sh_corefile_regmap *)regmap;
tdep->sizeof_gregset = 84;
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
}
-void _initialize_shnbsd_tdep ();
-void
-_initialize_shnbsd_tdep ()
+INIT_GDB_FILE (shnbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_NETBSD,
shnbsd_init_abi);
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 375b796..6bd4fd3 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Renesas Super-H, for GDB.
- Copyright (C) 1993-2024 Free Software Foundation, Inc.
+ Copyright (C) 1993-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -2394,9 +2394,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_sh_tdep ();
-void
-_initialize_sh_tdep ()
+INIT_GDB_FILE (sh_tdep)
{
gdbarch_register (bfd_arch_sh, sh_gdbarch_init, NULL);
diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h
index dd52440..073f06d 100644
--- a/gdb/sh-tdep.h
+++ b/gdb/sh-tdep.h
@@ -1,5 +1,5 @@
/* Target-specific definition for a Renesas Super-H.
- Copyright (C) 1993-2024 Free Software Foundation, Inc.
+ Copyright (C) 1993-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/sim-regno.h b/gdb/sim-regno.h
index 76ecfea..f8ebbc1 100644
--- a/gdb/sim-regno.h
+++ b/gdb/sim-regno.h
@@ -1,6 +1,6 @@
/* Generic remote debugging interface for simulators.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
diff --git a/gdb/skip.c b/gdb/skip.c
index aaa0785..a9ee223 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -1,6 +1,6 @@
/* Skipping uninteresting files and functions while stepping.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -657,9 +657,7 @@ complete_skip_number (cmd_list_element *cmd,
}
}
-void _initialize_step_skip ();
-void
-_initialize_step_skip ()
+INIT_GDB_FILE (step_skip)
{
static struct cmd_list_element *skiplist = NULL;
struct cmd_list_element *c;
diff --git a/gdb/skip.h b/gdb/skip.h
index 5625a79..50d79b4 100644
--- a/gdb/skip.h
+++ b/gdb/skip.h
@@ -1,6 +1,6 @@
/* Header for skipping over uninteresting files and functions when debugging.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index d07377f..0aa4595 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -1,6 +1,6 @@
/* Solaris threads debugging interface.
- Copyright (C) 1996-2024 Free Software Foundation, Inc.
+ Copyright (C) 1996-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -605,7 +605,8 @@ check_for_thread_db (void)
ptid_t ptid;
/* Don't attempt to use thread_db for remote targets. */
- if (!(target_can_run () || current_program_space->core_bfd () != nullptr))
+ if (!(target_can_run ()
+ || get_inferior_core_bfd(current_inferior ()) != nullptr))
return;
/* Do nothing if we couldn't load libthread_db.so.1. */
@@ -1111,19 +1112,21 @@ info_solthreads (const char *args, int from_tty)
ptid_t
sol_thread_target::get_ada_task_ptid (long lwp, ULONGEST thread)
{
- struct thread_info *thread_info
- = iterate_over_threads ([&] (struct thread_info *thread)
+ auto thread_db_find_thread_from_tid
+ = [&] (struct thread_info *iter)
{
- return thread->ptid.tid () == thread;
- });
+ return iter->ptid.tid () == thread;
+ };
+
+ struct thread_info *thread_info
+ = iterate_over_threads (thread_db_find_thread_from_tid);
if (thread_info == NULL)
{
/* The list of threads is probably not up to date. Find any
thread that is missing from the list, and try again. */
update_thread_list ();
- thread_info = iterate_over_threads (thread_db_find_thread_from_tid,
- &thread);
+ thread_info = iterate_over_threads (thread_db_find_thread_from_tid);
}
gdb_assert (thread_info != NULL);
@@ -1131,9 +1134,7 @@ sol_thread_target::get_ada_task_ptid (long lwp, ULONGEST thread)
return (thread_info->ptid);
}
-void _initialize_sol_thread ();
-void
-_initialize_sol_thread ()
+INIT_GDB_FILE (sol_thread)
{
void *dlhandle;
diff --git a/gdb/sol2-tdep.c b/gdb/sol2-tdep.c
index 0beab74..cfad8f2 100644
--- a/gdb/sol2-tdep.c
+++ b/gdb/sol2-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Solaris.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/sol2-tdep.h b/gdb/sol2-tdep.h
index 8e505d3..c042639 100644
--- a/gdb/sol2-tdep.h
+++ b/gdb/sol2-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for Solaris.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index 926f1ed..308ff80 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,7 +17,6 @@
#include "solib-aix.h"
#include "solib.h"
-#include "solist.h"
#include "inferior.h"
#include "gdb_bfd.h"
#include "objfiles.h"
@@ -25,6 +24,26 @@
#include "xcoffread.h"
#include "observable.h"
+/* solib_ops for AIX systems. */
+
+struct aix_solib_ops : public solib_ops
+{
+ using solib_ops::solib_ops;
+
+ void relocate_section_addresses (solib &so, target_section *) const override;
+ void create_inferior_hook (int from_tty) const override;
+ owning_intrusive_list<solib> current_sos () const override;
+ gdb_bfd_ref_ptr bfd_open (const char *pathname) const override;
+};
+
+/* See solib-aix.h. */
+
+solib_ops_up
+make_aix_solib_ops (program_space *pspace)
+{
+ return std::make_unique<aix_solib_ops> (pspace);
+}
+
/* Our private data in struct solib. */
struct lm_info_aix final : public lm_info
@@ -307,10 +326,9 @@ solib_aix_bss_data_overlap (bfd *abfd)
return 0;
}
-/* Implement the "relocate_section_addresses" solib_ops method. */
-
-static void
-solib_aix_relocate_section_addresses (solib &so, target_section *sec)
+void
+aix_solib_ops::relocate_section_addresses (solib &so,
+ target_section *sec) const
{
struct bfd_section *bfd_sect = sec->the_bfd_section;
bfd *abfd = bfd_sect->owner;
@@ -411,10 +429,8 @@ solib_aix_get_section_offsets (struct objfile *objfile,
return offsets;
}
-/* Implement the "solib_create_inferior_hook" solib_ops method. */
-
-static void
-solib_aix_solib_create_inferior_hook (int from_tty)
+void
+aix_solib_ops::create_inferior_hook (int from_tty) const
{
const char *warning_msg = "unable to relocate main executable";
@@ -442,10 +458,8 @@ solib_aix_solib_create_inferior_hook (int from_tty)
}
}
-/* Implement the "current_sos" solib_ops method. */
-
-static owning_intrusive_list<solib>
-solib_aix_current_sos ()
+owning_intrusive_list<solib>
+aix_solib_ops::current_sos () const
{
std::optional<std::vector<lm_info_aix>> &library_list
= solib_aix_get_library_list (current_inferior (), NULL);
@@ -481,35 +495,15 @@ solib_aix_current_sos ()
}
/* Add it to the list. */
- auto &new_solib = sos.emplace_back ();
- new_solib.so_original_name = so_name;
- new_solib.so_name = so_name;
- new_solib.lm_info = std::make_unique<lm_info_aix> (info);
+ sos.emplace_back (std::make_unique<lm_info_aix> (info), so_name, so_name,
+ *this);
}
return sos;
}
-/* Implement the "open_symbol_file_object" solib_ops method. */
-
-static int
-solib_aix_open_symbol_file_object (int from_tty)
-{
- return 0;
-}
-
-/* Implement the "in_dynsym_resolve_code" solib_ops method. */
-
-static int
-solib_aix_in_dynsym_resolve_code (CORE_ADDR pc)
-{
- return 0;
-}
-
-/* Implement the "bfd_open" solib_ops method. */
-
-static gdb_bfd_ref_ptr
-solib_aix_bfd_open (const char *pathname)
+gdb_bfd_ref_ptr
+aix_solib_ops::bfd_open (const char *pathname) const
{
/* The pathname is actually a synthetic filename with the following
form: "/path/to/sharedlib(member.o)" (double-quotes excluded).
@@ -523,7 +517,7 @@ solib_aix_bfd_open (const char *pathname)
int found_file;
if (pathname[path_len - 1] != ')')
- return solib_bfd_open (pathname);
+ return solib_ops::bfd_open (pathname);
/* Search for the associated parens. */
sep = strrchr (pathname, '(');
@@ -533,7 +527,7 @@ solib_aix_bfd_open (const char *pathname)
to open pathname without decoding, possibly leading to
a failure), rather than triggering an assert failure). */
warning (_("missing '(' in shared object pathname: %s"), pathname);
- return solib_bfd_open (pathname);
+ return solib_ops::bfd_open (pathname);
}
filename_len = sep - pathname;
@@ -626,9 +620,9 @@ solib_aix_bfd_open (const char *pathname)
static struct obj_section *
data_obj_section_from_objfile (struct objfile *objfile)
{
- for (obj_section *osect : objfile->sections ())
- if (strcmp (bfd_section_name (osect->the_bfd_section), ".data") == 0)
- return osect;
+ for (obj_section &osect : objfile->sections ())
+ if (strcmp (bfd_section_name (osect.the_bfd_section), ".data") == 0)
+ return &osect;
return NULL;
}
@@ -676,27 +670,7 @@ solib_aix_normal_stop_observer (struct bpstat *unused_1, int unused_2)
data->library_list.reset ();
}
-/* The solib_ops for AIX targets. */
-const solib_ops solib_aix_so_ops =
-{
- solib_aix_relocate_section_addresses,
- nullptr,
- nullptr,
- solib_aix_solib_create_inferior_hook,
- solib_aix_current_sos,
- solib_aix_open_symbol_file_object,
- solib_aix_in_dynsym_resolve_code,
- solib_aix_bfd_open,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- default_find_solib_addr,
-};
-
-void _initialize_solib_aix ();
-void
-_initialize_solib_aix ()
+INIT_GDB_FILE (solib_aix)
{
gdb::observers::normal_stop.attach (solib_aix_normal_stop_observer,
"solib-aix");
diff --git a/gdb/solib-aix.h b/gdb/solib-aix.h
index 79cad4d..887487d 100644
--- a/gdb/solib-aix.h
+++ b/gdb/solib-aix.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,9 +18,12 @@
#ifndef GDB_SOLIB_AIX_H
#define GDB_SOLIB_AIX_H
-struct solib_ops;
-extern const solib_ops solib_aix_so_ops;
+#include "solib.h"
extern CORE_ADDR solib_aix_get_toc_value (CORE_ADDR pc);
+/* Return a new solib_ops for AIX systems. */
+
+solib_ops_up make_aix_solib_ops (program_space *pspace);
+
#endif /* GDB_SOLIB_AIX_H */
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index cbd89b1..a6f5504 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -1,6 +1,6 @@
/* Handle Darwin shared libraries for GDB, the GNU Debugger.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -27,12 +27,33 @@
#include "regcache.h"
#include "gdb_bfd.h"
-#include "solist.h"
+#include "solib.h"
#include "solib-darwin.h"
#include "mach-o.h"
#include "mach-o/external.h"
+/* solib_ops for Darwin systems. */
+
+struct darwin_solib_ops : public solib_ops
+{
+ using solib_ops::solib_ops;
+
+ void relocate_section_addresses (solib &so, target_section *) const override;
+ void clear_solib (program_space *pspace) const override;
+ void create_inferior_hook (int from_tty) const override;
+ owning_intrusive_list<solib> current_sos () const override;
+ gdb_bfd_ref_ptr bfd_open (const char *pathname) const override;
+};
+
+/* See solib-darwin.h. */
+
+solib_ops_up
+make_darwin_solib_ops (program_space *pspace)
+{
+ return std::make_unique<darwin_solib_ops> (pspace);
+}
+
struct gdb_dyld_image_info
{
/* Base address (which corresponds to the Mach-O header). */
@@ -133,12 +154,16 @@ darwin_load_image_infos (struct darwin_info *info)
(buf + 8 + ptr_type->length (), ptr_type);
}
-/* Link map info to include in an allocated so_list entry. */
+/* Link map info to include in an allocated solib entry. */
struct lm_info_darwin final : public lm_info
{
+ explicit lm_info_darwin (CORE_ADDR lm_addr)
+ : lm_addr (lm_addr)
+ {}
+
/* The target location of lm. */
- CORE_ADDR lm_addr = 0;
+ CORE_ADDR lm_addr;
};
/* Lookup the value for a specific symbol. */
@@ -188,20 +213,8 @@ find_program_interpreter (void)
return buf;
}
-/* Not used. I don't see how the main symbol file can be found: the
- interpreter name is needed and it is known from the executable file.
- Note that darwin-nat.c implements pid_to_exec_file. */
-
-static int
-open_symbol_file_object (int from_tty)
-{
- return 0;
-}
-
-/* Build a list of currently loaded shared objects. See solib-svr4.c. */
-
-static owning_intrusive_list<solib>
-darwin_current_sos ()
+owning_intrusive_list<solib>
+darwin_solib_ops::current_sos () const
{
type *ptr_type
= builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
@@ -260,15 +273,8 @@ darwin_current_sos ()
break;
/* Create and fill the new struct solib element. */
- auto &newobj = sos.emplace_back ();
-
- auto li = std::make_unique<lm_info_darwin> ();
-
- newobj.so_name = file_path.get ();
- newobj.so_original_name = newobj.so_name;
- li->lm_addr = load_addr;
-
- newobj.lm_info = std::move (li);
+ sos.emplace_back (std::make_unique<lm_info_darwin> (load_addr),
+ file_path.get (), file_path.get (), *this);
}
return sos;
@@ -363,15 +369,6 @@ darwin_read_exec_load_addr_at_init (struct darwin_info *info)
return darwin_validate_exec_header (load_addr);
}
-/* Return 1 if PC lies in the dynamic symbol resolution code of the
- run time loader. */
-
-static int
-darwin_in_dynsym_resolve_code (CORE_ADDR pc)
-{
- return 0;
-}
-
/* A wrapper for bfd_mach_o_fat_extract that handles reference
counting properly. This will either return NULL, or return a new
reference to a BFD. */
@@ -476,10 +473,8 @@ darwin_solib_read_all_image_info_addr (struct darwin_info *info)
info->all_image_addr = extract_unsigned_integer (buf, len, BFD_ENDIAN_BIG);
}
-/* Shared library startup support. See documentation in solib-svr4.c. */
-
-static void
-darwin_solib_create_inferior_hook (int from_tty)
+void
+darwin_solib_ops::create_inferior_hook (int from_tty) const
{
/* Everything below only makes sense if we have a running inferior. */
if (!target_has_execution ())
@@ -579,8 +574,8 @@ darwin_solib_create_inferior_hook (int from_tty)
create_solib_event_breakpoint (current_inferior ()->arch (), notifier);
}
-static void
-darwin_clear_solib (program_space *pspace)
+void
+darwin_solib_ops::clear_solib (program_space *pspace) const
{
darwin_info *info = get_darwin_info (pspace);
@@ -591,8 +586,9 @@ darwin_clear_solib (program_space *pspace)
/* The section table is built from bfd sections using bfd VMAs.
Relocate these VMAs according to solib info. */
-static void
-darwin_relocate_section_addresses (solib &so, target_section *sec)
+void
+darwin_solib_ops::relocate_section_addresses (solib &so,
+ target_section *sec) const
{
auto *li = gdb::checked_static_cast<lm_info_darwin *> (so.lm_info.get ());
@@ -611,9 +607,9 @@ darwin_relocate_section_addresses (solib &so, target_section *sec)
if (sec->addr < so.addr_low)
so.addr_low = sec->addr;
}
-
-static gdb_bfd_ref_ptr
-darwin_bfd_open (const char *pathname)
+
+gdb_bfd_ref_ptr
+darwin_solib_ops::bfd_open (const char *pathname) const
{
int found_file;
@@ -641,20 +637,3 @@ darwin_bfd_open (const char *pathname)
return res;
}
-
-const solib_ops darwin_so_ops =
-{
- darwin_relocate_section_addresses,
- nullptr,
- darwin_clear_solib,
- darwin_solib_create_inferior_hook,
- darwin_current_sos,
- open_symbol_file_object,
- darwin_in_dynsym_resolve_code,
- darwin_bfd_open,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- default_find_solib_addr,
-};
diff --git a/gdb/solib-darwin.h b/gdb/solib-darwin.h
index d62d680..fc28b2c 100644
--- a/gdb/solib-darwin.h
+++ b/gdb/solib-darwin.h
@@ -1,6 +1,6 @@
/* Handle shared libraries for GDB, the GNU Debugger.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,8 +20,10 @@
#ifndef GDB_SOLIB_DARWIN_H
#define GDB_SOLIB_DARWIN_H
-struct solib_ops;
+#include "solib.h"
-extern const solib_ops darwin_so_ops;
+/* Return a new solib_ops for Darwin systems. */
+
+extern solib_ops_up make_darwin_solib_ops (program_space *pspace);
#endif /* GDB_SOLIB_DARWIN_H */
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 360aede..883164e 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -1,5 +1,5 @@
/* Handle TIC6X (DSBT) shared libraries for GDB, the GNU Debugger.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -19,9 +19,7 @@
#include "extract-store-integer.h"
#include "inferior.h"
-#include "gdbcore.h"
#include "solib.h"
-#include "solist.h"
#include "objfiles.h"
#include "symtab.h"
#include "command.h"
@@ -29,6 +27,7 @@
#include "solib-dsbt.h"
#include "elf/common.h"
#include "cli/cli-cmds.h"
+#include "gdbcore.h"
#define GOT_MODULE_OFFSET 4
@@ -121,17 +120,44 @@ struct dbst_ext_link_map
ext_ptr l_next, l_prev; /* struct link_map *l_next, *l_prev; */
};
-/* Link map info to include in an allocated so_list entry */
+/* solib_ops for DSBT systems. */
+
+struct dsbt_solib_ops : public solib_ops
+{
+ using solib_ops::solib_ops;
+
+ void relocate_section_addresses (solib &so, target_section *) const override;
+ void clear_solib (program_space *pspace) const override;
+ void create_inferior_hook (int from_tty) const override;
+ owning_intrusive_list<solib> current_sos () const override;
+ bool in_dynsym_resolve_code (CORE_ADDR pc) const override;
+};
+
+/* See solib-dsbt.h. */
+
+solib_ops_up
+make_dsbt_solib_ops (program_space *pspace)
+{
+ return std::make_unique<dsbt_solib_ops> (pspace);
+}
+
+/* Link map info to include in an allocated solib entry */
struct lm_info_dsbt final : public lm_info
{
+ explicit lm_info_dsbt (int_elf32_dsbt_loadmap *map)
+ : map (map)
+ {}
+
+ DISABLE_COPY_AND_ASSIGN (lm_info_dsbt);
+
~lm_info_dsbt ()
{
xfree (this->map);
}
/* The loadmap, digested into an easier to use form. */
- int_elf32_dsbt_loadmap *map = NULL;
+ int_elf32_dsbt_loadmap *map;
};
/* Per pspace dsbt specific data. */
@@ -393,15 +419,6 @@ fetch_loadmap (CORE_ADDR ldmaddr)
static void dsbt_relocate_main_executable (void);
static int enable_break (void);
-/* See solist.h. */
-
-static int
-open_symbol_file_object (int from_tty)
-{
- /* Unimplemented. */
- return 0;
-}
-
/* Given a loadmap and an address, return the displacement needed
to relocate the address. */
@@ -512,8 +529,8 @@ lm_base (void)
themselves. The declaration of `struct solib' says which fields
we provide values for. */
-static owning_intrusive_list<solib>
-dsbt_current_sos (void)
+owning_intrusive_list<solib>
+dsbt_solib_ops::current_sos () const
{
bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
CORE_ADDR lm_addr;
@@ -533,7 +550,7 @@ dsbt_current_sos (void)
solib_create_inferior_hook. (See post_create_inferior in
infcmd.c.) */
if (info->main_executable_lm_info == 0
- && current_program_space->core_bfd () != nullptr)
+ && get_inferior_core_bfd (current_inferior ()) != nullptr)
dsbt_relocate_main_executable ();
/* Locate the address of the first link map struct. */
@@ -594,9 +611,6 @@ dsbt_current_sos (void)
break;
}
- auto &sop = sos.emplace_back ();
- auto li = std::make_unique<lm_info_dsbt> ();
- li->map = loadmap;
/* Fetch the name. */
addr = extract_unsigned_integer (lm_buf.l_name,
sizeof (lm_buf.l_name),
@@ -611,12 +625,12 @@ dsbt_current_sos (void)
if (solib_dsbt_debug)
gdb_printf (gdb_stdlog, "current_sos: name = %s\n",
name_buf.get ());
-
- sop.so_name = name_buf.get ();
- sop.so_original_name = sop.so_name;
}
- sop.lm_info = std::move (li);
+ sos.emplace_back (std::make_unique<lm_info_dsbt> (loadmap),
+ name_buf != nullptr ? name_buf.get () : "",
+ name_buf != nullptr ? name_buf.get () : "",
+ *this);
}
else
{
@@ -630,11 +644,11 @@ dsbt_current_sos (void)
return sos;
}
-/* Return 1 if PC lies in the dynamic symbol resolution code of the
+/* Return true if PC lies in the dynamic symbol resolution code of the
run time loader. */
-static int
-dsbt_in_dynsym_resolve_code (CORE_ADDR pc)
+bool
+dsbt_solib_ops::in_dynsym_resolve_code (CORE_ADDR pc) const
{
dsbt_info *info = get_dsbt_info (current_program_space);
@@ -799,23 +813,22 @@ dsbt_relocate_main_executable (void)
ldm = info->exec_loadmap;
delete info->main_executable_lm_info;
- info->main_executable_lm_info = new lm_info_dsbt;
- info->main_executable_lm_info->map = ldm;
+ info->main_executable_lm_info = new lm_info_dsbt (ldm);
objfile *objf = current_program_space->symfile_object_file;
section_offsets new_offsets (objf->section_offsets.size ());
changed = 0;
- for (obj_section *osect : objf->sections ())
+ for (obj_section &osect : objf->sections ())
{
CORE_ADDR orig_addr, addr, offset;
int osect_idx;
int seg;
- osect_idx = osect - objf->sections_start;
+ osect_idx = &osect - objf->sections_start;
/* Current address of section. */
- addr = osect->addr ();
+ addr = osect.addr ();
/* Offset from where this section started. */
offset = objf->section_offsets[osect_idx];
/* Original address prior to any past relocations. */
@@ -850,8 +863,8 @@ dsbt_relocate_main_executable (void)
For the DSBT shared library, the main executable needs to be relocated.
The shared library breakpoints also need to be enabled. */
-static void
-dsbt_solib_create_inferior_hook (int from_tty)
+void
+dsbt_solib_ops::create_inferior_hook (int from_tty) const
{
/* Relocate main executable. */
dsbt_relocate_main_executable ();
@@ -864,8 +877,8 @@ dsbt_solib_create_inferior_hook (int from_tty)
}
}
-static void
-dsbt_clear_solib (program_space *pspace)
+void
+dsbt_solib_ops::clear_solib (program_space *pspace) const
{
dsbt_info *info = get_dsbt_info (pspace);
@@ -876,8 +889,9 @@ dsbt_clear_solib (program_space *pspace)
info->main_executable_lm_info = NULL;
}
-static void
-dsbt_relocate_section_addresses (solib &so, target_section *sec)
+void
+dsbt_solib_ops::relocate_section_addresses (solib &so,
+ target_section *sec) const
{
int seg;
auto *li = gdb::checked_static_cast<lm_info_dsbt *> (so.lm_info.get ());
@@ -903,26 +917,7 @@ show_dsbt_debug (struct ui_file *file, int from_tty,
gdb_printf (file, _("solib-dsbt debugging is %s.\n"), value);
}
-const solib_ops dsbt_so_ops =
-{
- dsbt_relocate_section_addresses,
- nullptr,
- dsbt_clear_solib,
- dsbt_solib_create_inferior_hook,
- dsbt_current_sos,
- open_symbol_file_object,
- dsbt_in_dynsym_resolve_code,
- solib_bfd_open,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- default_find_solib_addr,
-};
-
-void _initialize_dsbt_solib ();
-void
-_initialize_dsbt_solib ()
+INIT_GDB_FILE (dsbt_solib)
{
/* Debug this file's internals. */
add_setshow_zuinteger_cmd ("solib-dsbt", class_maintenance,
diff --git a/gdb/solib-dsbt.h b/gdb/solib-dsbt.h
index 2777939..00f7791 100644
--- a/gdb/solib-dsbt.h
+++ b/gdb/solib-dsbt.h
@@ -1,6 +1,6 @@
/* Handle shared libraries for GDB, the GNU Debugger.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,8 +20,10 @@
#ifndef GDB_SOLIB_DSBT_H
#define GDB_SOLIB_DSBT_H
-struct solib_ops;
+#include "solib.h"
-extern const solib_ops dsbt_so_ops;
+/* Return a new solib_ops for DSBT systems. */
+
+solib_ops_up make_dsbt_solib_ops (program_space *pspace);
#endif /* GDB_SOLIB_DSBT_H */
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index 25873e6..beb8802 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -1,5 +1,5 @@
/* Handle FR-V (FDPIC) shared libraries for GDB, the GNU Debugger.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,15 +18,36 @@
#include "extract-store-integer.h"
-#include "gdbcore.h"
#include "solib.h"
-#include "solist.h"
#include "frv-tdep.h"
#include "objfiles.h"
#include "symtab.h"
#include "elf/frv.h"
#include "gdb_bfd.h"
#include "inferior.h"
+#include "solib-frv.h"
+#include "gdbcore.h"
+
+/* solib_ops for FR-V systems. */
+
+struct frv_solib_ops : public solib_ops
+{
+ using solib_ops::solib_ops;
+
+ void relocate_section_addresses (solib &so, target_section *) const override;
+ void clear_solib (program_space *pspace) const override;
+ void create_inferior_hook (int from_tty) const override;
+ owning_intrusive_list<solib> current_sos () const override;
+ bool in_dynsym_resolve_code (CORE_ADDR pc) const override;
+};
+
+/* See solib-frv.h. */
+
+solib_ops_up
+make_frv_solib_ops (program_space *pspace)
+{
+ return std::make_unique<frv_solib_ops> (pspace);
+}
/* FR-V pointers are four bytes wide. */
enum { FRV_PTR_SIZE = 4 };
@@ -194,10 +215,17 @@ struct ext_link_map
ext_ptr l_next, l_prev; /* struct link_map *l_next, *l_prev; */
};
-/* Link map info to include in an allocated so_list entry. */
+/* Link map info to include in an allocated solib entry. */
struct lm_info_frv final : public lm_info
{
+ lm_info_frv (int_elf32_fdpic_loadmap *map, CORE_ADDR got_value,
+ CORE_ADDR lm_addr)
+ : map (map), got_value (got_value), lm_addr (lm_addr)
+ {}
+
+ DISABLE_COPY_AND_ASSIGN (lm_info_frv);
+
~lm_info_frv ()
{
xfree (this->map);
@@ -206,11 +234,11 @@ struct lm_info_frv final : public lm_info
}
/* The loadmap, digested into an easier to use form. */
- int_elf32_fdpic_loadmap *map = NULL;
+ int_elf32_fdpic_loadmap *map;
/* The GOT address for this link map entry. */
- CORE_ADDR got_value = 0;
+ CORE_ADDR got_value;
/* The link map address, needed for frv_fetch_objfile_link_map(). */
- CORE_ADDR lm_addr = 0;
+ CORE_ADDR lm_addr;
/* Cached dynamic symbol table and dynamic relocs initialized and
used only by find_canonical_descriptor_in_load_object().
@@ -237,15 +265,6 @@ static void frv_relocate_main_executable (void);
static CORE_ADDR main_got (void);
static int enable_break2 (void);
-/* Implement the "open_symbol_file_object" solib_ops method. */
-
-static int
-open_symbol_file_object (int from_tty)
-{
- /* Unimplemented. */
- return 0;
-}
-
/* Cached value for lm_base(), below. */
static CORE_ADDR lm_base_cache = 0;
@@ -303,11 +322,8 @@ lm_base (void)
return lm_base_cache;
}
-
-/* Implement the "current_sos" solib_ops method. */
-
-static owning_intrusive_list<solib>
-frv_current_sos ()
+owning_intrusive_list<solib>
+frv_solib_ops::current_sos () const
{
bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ());
CORE_ADDR lm_addr, mgot;
@@ -326,7 +342,7 @@ frv_current_sos ()
solib_create_inferior_hook(). (See post_create_inferior() in
infcmd.c.) */
if (main_executable_lm_info == 0
- && current_program_space->core_bfd () != nullptr)
+ && get_inferior_core_bfd (current_inferior ()) != nullptr)
frv_relocate_main_executable ();
/* Fetch the GOT corresponding to the main executable. */
@@ -377,13 +393,6 @@ frv_current_sos ()
break;
}
- auto &sop = sos.emplace_back ();
- auto li = std::make_unique<lm_info_frv> ();
- li->map = loadmap;
- li->got_value = got_addr;
- li->lm_addr = lm_addr;
- sop.lm_info = std::move (li);
-
/* Fetch the name. */
addr = extract_unsigned_integer (lm_buf.l_name,
sizeof (lm_buf.l_name),
@@ -395,11 +404,12 @@ frv_current_sos ()
if (name_buf == nullptr)
warning (_("Can't read pathname for link map entry."));
- else
- {
- sop.so_name = name_buf.get ();
- sop.so_original_name = sop.so_name;
- }
+
+ sos.emplace_back (std::make_unique<lm_info_frv> (loadmap, got_addr,
+ lm_addr),
+ name_buf != nullptr ? name_buf.get () : "",
+ name_buf != nullptr ? name_buf.get () : "",
+ *this);
}
else
{
@@ -424,8 +434,8 @@ static CORE_ADDR interp_text_sect_high;
static CORE_ADDR interp_plt_sect_low;
static CORE_ADDR interp_plt_sect_high;
-static int
-frv_in_dynsym_resolve_code (CORE_ADDR pc)
+bool
+frv_solib_ops::in_dynsym_resolve_code (CORE_ADDR pc) const
{
return ((pc >= interp_text_sect_low && pc < interp_text_sect_high)
|| (pc >= interp_plt_sect_low && pc < interp_plt_sect_high)
@@ -735,23 +745,22 @@ frv_relocate_main_executable (void)
error (_("Unable to load the executable's loadmap."));
delete main_executable_lm_info;
- main_executable_lm_info = new lm_info_frv;
- main_executable_lm_info->map = ldm;
+ main_executable_lm_info = new lm_info_frv (ldm, 0, 0);
objfile *objf = current_program_space->symfile_object_file;
section_offsets new_offsets (objf->section_offsets.size ());
changed = 0;
- for (obj_section *osect : objf->sections ())
+ for (obj_section &osect : objf->sections ())
{
CORE_ADDR orig_addr, addr, offset;
int osect_idx;
int seg;
-
- osect_idx = osect - objf->sections_start;
+
+ osect_idx = &osect - objf->sections_start;
/* Current address of section. */
- addr = osect->addr ();
+ addr = osect.addr ();
/* Offset from where this section started. */
offset = objf->section_offsets[osect_idx];
/* Original address prior to any past relocations. */
@@ -786,8 +795,8 @@ frv_relocate_main_executable (void)
to be relocated. The shared library breakpoints also need to be
enabled. */
-static void
-frv_solib_create_inferior_hook (int from_tty)
+void
+frv_solib_ops::create_inferior_hook (int from_tty) const
{
/* Relocate main executable. */
frv_relocate_main_executable ();
@@ -800,8 +809,8 @@ frv_solib_create_inferior_hook (int from_tty)
}
}
-static void
-frv_clear_solib (program_space *pspace)
+void
+frv_solib_ops::clear_solib (program_space *pspace) const
{
lm_base_cache = 0;
enable_break2_done = 0;
@@ -811,8 +820,9 @@ frv_clear_solib (program_space *pspace)
main_executable_lm_info = NULL;
}
-static void
-frv_relocate_section_addresses (solib &so, target_section *sec)
+void
+frv_solib_ops::relocate_section_addresses (solib &so,
+ target_section *sec) const
{
int seg;
auto *li = gdb::checked_static_cast<lm_info_frv *> (so.lm_info.get ());
@@ -1073,20 +1083,3 @@ frv_fetch_objfile_link_map (struct objfile *objfile)
/* Not found! */
return 0;
}
-
-const solib_ops frv_so_ops =
-{
- frv_relocate_section_addresses,
- nullptr,
- frv_clear_solib,
- frv_solib_create_inferior_hook,
- frv_current_sos,
- open_symbol_file_object,
- frv_in_dynsym_resolve_code,
- solib_bfd_open,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- default_find_solib_addr,
-};
diff --git a/gdb/solib-frv.h b/gdb/solib-frv.h
new file mode 100644
index 0000000..33d156c
--- /dev/null
+++ b/gdb/solib-frv.h
@@ -0,0 +1,28 @@
+/* Handle FR-V (FDPIC) shared libraries for GDB, the GNU Debugger.
+ Copyright (C) 2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef GDB_SOLIB_FRV_H
+#define GDB_SOLIB_FRV_H
+
+#include "solib.h"
+
+/* Return a new solib_ops for FR-V systems. */
+
+solib_ops_up make_frv_solib_ops (program_space *pspace);
+
+#endif /* GDB_SOLIB_FRV_H */
diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c
index 156b36a..3b121e6 100644
--- a/gdb/solib-rocm.c
+++ b/gdb/solib-rocm.c
@@ -1,6 +1,6 @@
/* Handle ROCm Code Objects for GDB, the GNU Debugger.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -26,10 +26,10 @@
#include "event-top.h"
#include "gdbsupport/fileio.h"
#include "inferior.h"
+#include "linux-tdep.h"
#include "observable.h"
#include "solib.h"
#include "solib-svr4.h"
-#include "solist.h"
#include "symfile.h"
#include <unordered_map>
@@ -154,7 +154,77 @@ struct solib_info
/* Per-inferior data key. */
static const registry<inferior>::key<solib_info> rocm_solib_data;
-static solib_ops rocm_solib_ops;
+/* solib_ops for ROCm systems. */
+
+struct rocm_solib_ops : public solib_ops
+{
+ /* HOST_OPS is the host solib_ops that rocm_solib_ops hijacks / wraps,
+ in order to provide support for ROCm code objects. */
+ explicit rocm_solib_ops (program_space *pspace, solib_ops_up host_ops)
+ : solib_ops (pspace), m_host_ops (std::move (host_ops))
+ {
+ }
+
+ /* The methods implemented by rocm_solib_ops. */
+ owning_intrusive_list<solib> current_sos () const override;
+ void create_inferior_hook (int from_tty) const override;
+ gdb_bfd_ref_ptr bfd_open (const char *pathname) const override;
+ void relocate_section_addresses (solib &so, target_section *) const override;
+ void handle_event () const override;
+
+ /* Implement the following methods just to forward the calls to the host
+ solib_ops. We currently need to implement all the methods that
+ svr4_solib_ops implements. */
+ void clear_so (const solib &so) const override
+ { return m_host_ops->clear_so (so); }
+
+ void clear_solib (program_space *pspace) const override
+ { return m_host_ops->clear_solib (pspace); }
+
+ bool open_symbol_file_object (int from_tty) const override
+ { return m_host_ops->open_symbol_file_object (from_tty); }
+
+ bool in_dynsym_resolve_code (CORE_ADDR pc) const override
+ { return m_host_ops->in_dynsym_resolve_code (pc); }
+
+ bool same (const solib &gdb, const solib &inferior) const override
+ { return m_host_ops->same (gdb, inferior); }
+
+ bool keep_data_in_core (CORE_ADDR vaddr, unsigned long size) const override
+ { return m_host_ops->keep_data_in_core (vaddr, size); }
+
+ void update_breakpoints () const override
+ { return m_host_ops->update_breakpoints (); }
+
+ std::optional<CORE_ADDR> find_solib_addr (solib &so) const override
+ { return m_host_ops->find_solib_addr (so); }
+
+ bool supports_namespaces () const override
+ { return true; }
+
+ int find_solib_ns (const solib &so) const override
+ { return m_host_ops->find_solib_ns (so); }
+
+ int num_active_namespaces () const override
+ { return m_host_ops->num_active_namespaces (); }
+
+ std::vector<const solib *> get_solibs_in_ns (int nsid) const override
+ { return m_host_ops->get_solibs_in_ns (nsid); }
+
+ void iterate_over_objfiles_in_search_order
+ (iterate_over_objfiles_in_search_order_cb_ftype cb,
+ objfile *current_objfile) const override
+ {
+ return m_host_ops->iterate_over_objfiles_in_search_order
+ (cb, current_objfile);
+ }
+
+private:
+ owning_intrusive_list<solib>
+ solibs_from_rocm_sos (const std::vector<rocm_so> &sos) const;
+
+ solib_ops_up m_host_ops;
+};
/* Fetch the solib_info data for INF. */
@@ -171,13 +241,13 @@ get_solib_info (inferior *inf)
/* Relocate section addresses. */
-static void
-rocm_solib_relocate_section_addresses (solib &so,
- struct target_section *sec)
+void
+rocm_solib_ops::relocate_section_addresses (solib &so,
+ struct target_section *sec) const
{
if (!is_amdgpu_arch (gdbarch_from_bfd (so.abfd.get ())))
{
- svr4_so_ops.relocate_section_addresses (so, sec);
+ m_host_ops->relocate_section_addresses (so, sec);
return;
}
@@ -188,35 +258,30 @@ rocm_solib_relocate_section_addresses (solib &so,
static void rocm_update_solib_list ();
-static void
-rocm_solib_handle_event ()
+void
+rocm_solib_ops::handle_event () const
{
- /* Since we sit on top of svr4_so_ops, we might get called following an event
- concerning host libraries. We must therefore forward the call. If the
- event was for a ROCm code object, it will be a no-op. On the other hand,
+ /* Since we sit on top of a host solib_ops, we might get called following an
+ event concerning host libraries. We must therefore forward the call. If
+ the event was for a ROCm code object, it will be a no-op. On the other hand
if the event was for host libraries, rocm_update_solib_list will be
essentially be a no-op (it will reload the same code object list as was
previously loaded). */
- svr4_so_ops.handle_event ();
+ m_host_ops->handle_event ();
rocm_update_solib_list ();
}
-/* Create so_list objects from rocm_so objects in SOS. */
+/* Create solib objects from rocm_so objects in SOS. */
-static owning_intrusive_list<solib>
-so_list_from_rocm_sos (const std::vector<rocm_so> &sos)
+owning_intrusive_list<solib>
+rocm_solib_ops::solibs_from_rocm_sos (const std::vector<rocm_so> &sos) const
{
owning_intrusive_list<solib> dst;
for (const rocm_so &so : sos)
- {
- auto &newobj = dst.emplace_back ();
-
- newobj.lm_info = std::make_unique<lm_info_svr4> (*so.lm_info);
- newobj.so_name = so.name;
- newobj.so_original_name = so.unique_name;
- }
+ dst.emplace_back (std::make_unique<lm_info_svr4> (*so.lm_info),
+ so.unique_name, so.name, *this);
return dst;
}
@@ -224,11 +289,11 @@ so_list_from_rocm_sos (const std::vector<rocm_so> &sos)
/* Build a list of `struct solib' objects describing the shared
objects currently loaded in the inferior. */
-static owning_intrusive_list<solib>
-rocm_solib_current_sos ()
+owning_intrusive_list<solib>
+rocm_solib_ops::current_sos () const
{
/* First, retrieve the host-side shared library list. */
- owning_intrusive_list<solib> sos = svr4_so_ops.current_sos ();
+ owning_intrusive_list<solib> sos = m_host_ops->current_sos ();
/* Then, the device-side shared library list. */
std::vector<rocm_so> &dev_sos = get_solib_info (current_inferior ())->solib_list;
@@ -236,13 +301,13 @@ rocm_solib_current_sos ()
if (dev_sos.empty ())
return sos;
- owning_intrusive_list<solib> dev_so_list = so_list_from_rocm_sos (dev_sos);
+ owning_intrusive_list<solib> dev_solibs = solibs_from_rocm_sos (dev_sos);
if (sos.empty ())
- return dev_so_list;
+ return dev_solibs;
/* Append our libraries to the end of the list. */
- sos.splice (std::move (dev_so_list));
+ sos.splice (std::move (dev_solibs));
return sos;
}
@@ -403,7 +468,7 @@ protected:
/* Snapshot of the original ELF image taken during load. This is done to
support the situation where an inferior uses an in-memory image, and
- releases or re-uses this memory before GDB is done using it. */
+ releases or reuses this memory before GDB is done using it. */
gdb::byte_vector m_objfile_image;
LONGEST size () override
@@ -441,7 +506,7 @@ rocm_bfd_iovec_open (bfd *abfd, inferior *inferior)
protocol_end += protocol_delim.length ();
std::transform (protocol.begin (), protocol.end (), protocol.begin (),
- [] (unsigned char c) { return std::tolower (c); });
+ [] (unsigned char c) { return c_tolower (c); });
std::string_view path;
size_t path_end = uri.find_first_of ("#?", protocol_end);
@@ -456,8 +521,8 @@ rocm_bfd_iovec_open (bfd *abfd, inferior *inferior)
for (size_t i = 0; i < path.length (); ++i)
if (path[i] == '%'
&& i < path.length () - 2
- && std::isxdigit (path[i + 1])
- && std::isxdigit (path[i + 2]))
+ && c_isxdigit (path[i + 1])
+ && c_isxdigit (path[i + 2]))
{
std::string_view hex_digits = path.substr (i + 1, 2);
decoded_path += std::stoi (std::string (hex_digits), 0, 16);
@@ -580,12 +645,12 @@ rocm_bfd_iovec_open (bfd *abfd, inferior *inferior)
}
}
-static gdb_bfd_ref_ptr
-rocm_solib_bfd_open (const char *pathname)
+gdb_bfd_ref_ptr
+rocm_solib_ops::bfd_open (const char *pathname) const
{
/* Handle regular files with SVR4 open. */
if (strstr (pathname, "://") == nullptr)
- return svr4_so_ops.bfd_open (pathname);
+ return m_host_ops->bfd_open (pathname);
auto open = [] (bfd *nbfd) -> gdb_bfd_iovec_base *
{
@@ -669,12 +734,12 @@ rocm_solib_bfd_open (const char *pathname)
return abfd;
}
-static void
-rocm_solib_create_inferior_hook (int from_tty)
+void
+rocm_solib_ops::create_inferior_hook (int from_tty) const
{
get_solib_info (current_inferior ())->solib_list.clear ();
- svr4_so_ops.solib_create_inferior_hook (from_tty);
+ m_host_ops->create_inferior_hook (from_tty);
}
static void
@@ -704,6 +769,9 @@ rocm_update_solib_list ()
return;
}
+ gdb::unique_xmalloc_ptr<amd_dbgapi_code_object_id_t> code_object_list_holder
+ (code_object_list);
+
for (size_t i = 0; i < count; ++i)
{
CORE_ADDR l_addr;
@@ -723,7 +791,8 @@ rocm_update_solib_list ()
gdb::unique_xmalloc_ptr<char> uri_bytes_holder (uri_bytes);
- lm_info_svr4_up li = std::make_unique<lm_info_svr4> ();
+ /* Pass a dummy debug base. */
+ lm_info_svr4_up li = std::make_unique<lm_info_svr4> (-1);
li->l_addr = l_addr;
/* Generate a unique name so that code objects with the same URI but
@@ -734,24 +803,6 @@ rocm_update_solib_list ()
sos.emplace_back (uri_bytes, std::move (unique_name), std::move (li));
}
-
- xfree (code_object_list);
-
- if (rocm_solib_ops.current_sos == NULL)
- {
- /* Override what we need to. */
- rocm_solib_ops = svr4_so_ops;
- rocm_solib_ops.current_sos = rocm_solib_current_sos;
- rocm_solib_ops.solib_create_inferior_hook
- = rocm_solib_create_inferior_hook;
- rocm_solib_ops.bfd_open = rocm_solib_bfd_open;
- rocm_solib_ops.relocate_section_addresses
- = rocm_solib_relocate_section_addresses;
- rocm_solib_ops.handle_event = rocm_solib_handle_event;
-
- /* Engage the ROCm so_ops. */
- set_gdbarch_so_ops (current_inferior ()->arch (), &rocm_solib_ops);
- }
}
static void
@@ -759,6 +810,11 @@ rocm_solib_target_inferior_created (inferior *inf)
{
get_solib_info (inf)->solib_list.clear ();
+ auto prev_ops = inf->pspace->release_solib_ops ();
+ auto rocm_ops
+ = std::make_unique<rocm_solib_ops> (inf->pspace, std::move (prev_ops));
+ inf->pspace->set_solib_ops (std::move (rocm_ops));
+
rocm_update_solib_list ();
/* Force GDB to reload the solibs. */
@@ -766,11 +822,24 @@ rocm_solib_target_inferior_created (inferior *inf)
solib_add (nullptr, 0, auto_solib_add);
}
-/* -Wmissing-prototypes */
-extern initialize_file_ftype _initialize_rocm_solib;
+static void
+rocm_solib_target_inferior_execd (inferior *exec_inf, inferior *follow_inf)
+{
+ /* Engage the ROCm so_ops, but only if dbgapi is attached to the inferior
+ (avoiding remote inferiors and core file debugging). */
+ if (get_amd_dbgapi_process_id (follow_inf) == AMD_DBGAPI_PROCESS_NONE)
+ return;
-void
-_initialize_rocm_solib ()
+ auto pspace = follow_inf->pspace;
+ auto prev_ops = pspace->release_solib_ops ();
+ auto rocm_ops
+ = std::make_unique<rocm_solib_ops> (pspace, std::move (prev_ops));
+ pspace->set_solib_ops (std::move (rocm_ops));
+
+ get_solib_info (exec_inf)->solib_list.clear ();
+}
+
+INIT_GDB_FILE (rocm_solib)
{
/* The dependency on the amd-dbgapi exists because solib-rocm's
inferior_created observer needs amd-dbgapi to have attached the process,
@@ -779,4 +848,8 @@ _initialize_rocm_solib ()
(rocm_solib_target_inferior_created,
"solib-rocm",
{ &get_amd_dbgapi_target_inferior_created_observer_token () });
+
+ gdb::observers::inferior_execd.attach
+ (rocm_solib_target_inferior_execd, "solib-rocm",
+ { &get_amd_dbgapi_target_inferior_execd_observer_token () });
}
diff --git a/gdb/solib-svr4-linux.c b/gdb/solib-svr4-linux.c
new file mode 100644
index 0000000..fe82e5d
--- /dev/null
+++ b/gdb/solib-svr4-linux.c
@@ -0,0 +1,98 @@
+/* Target-dependent code for GNU/Linux using SVR4-style libraries.
+
+ Copyright (C) 2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "solib-svr4-linux.h"
+
+/* See solib-svr4-linux.h. */
+
+solib_ops_up
+make_linux_ilp32_svr4_solib_ops (program_space *pspace)
+{
+ return std::make_unique<linux_ilp32_svr4_solib_ops> (pspace);
+}
+
+/* See solib-svr4-linux.h. */
+
+link_map_offsets *
+linux_ilp32_svr4_solib_ops::fetch_link_map_offsets () const
+{
+ static link_map_offsets lmo;
+ static link_map_offsets *lmp = nullptr;
+
+ if (lmp == nullptr)
+ {
+ lmp = &lmo;
+
+ lmo.r_version_offset = 0;
+ lmo.r_version_size = 4;
+ lmo.r_map_offset = 4;
+ lmo.r_brk_offset = 8;
+ lmo.r_ldsomap_offset = -1;
+ lmo.r_next_offset = 20;
+
+ /* Everything we need is in the first 20 bytes. */
+ lmo.link_map_size = 20;
+ lmo.l_addr_offset = 0;
+ lmo.l_name_offset = 4;
+ lmo.l_ld_offset = 8;
+ lmo.l_next_offset = 12;
+ lmo.l_prev_offset = 16;
+ }
+
+ return lmp;
+}
+
+/* See solib-svr4-linux.h. */
+
+solib_ops_up
+make_linux_lp64_svr4_solib_ops (program_space *pspace)
+{
+ return std::make_unique<linux_lp64_svr4_solib_ops> (pspace);
+}
+
+/* See linux-tdep.h. */
+
+link_map_offsets *
+linux_lp64_svr4_solib_ops::fetch_link_map_offsets () const
+{
+ static link_map_offsets lmo;
+ static link_map_offsets *lmp = nullptr;
+
+ if (lmp == nullptr)
+ {
+ lmp = &lmo;
+
+ lmo.r_version_offset = 0;
+ lmo.r_version_size = 4;
+ lmo.r_map_offset = 8;
+ lmo.r_brk_offset = 16;
+ lmo.r_ldsomap_offset = -1;
+ lmo.r_next_offset = 40;
+
+ /* Everything we need is in the first 40 bytes. */
+ lmo.link_map_size = 40;
+ lmo.l_addr_offset = 0;
+ lmo.l_name_offset = 8;
+ lmo.l_ld_offset = 16;
+ lmo.l_next_offset = 24;
+ lmo.l_prev_offset = 32;
+ }
+
+ return lmp;
+}
diff --git a/gdb/solib-svr4-linux.h b/gdb/solib-svr4-linux.h
new file mode 100644
index 0000000..af040ff
--- /dev/null
+++ b/gdb/solib-svr4-linux.h
@@ -0,0 +1,51 @@
+/* Target-dependent code for GNU/Linux using SVR4-style libraries.
+
+ Copyright (C) 2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef GDB_SOLIB_SVR4_LINUX_H
+#define GDB_SOLIB_SVR4_LINUX_H
+
+#include "solib-svr4.h"
+
+/* solib_ops for ILP32 Linux systems. */
+
+struct linux_ilp32_svr4_solib_ops : public svr4_solib_ops
+{
+ using svr4_solib_ops::svr4_solib_ops;
+
+ link_map_offsets *fetch_link_map_offsets () const override;
+};
+
+/* solib_ops for LP64 Linux systems. */
+
+struct linux_lp64_svr4_solib_ops : public svr4_solib_ops
+{
+ using svr4_solib_ops::svr4_solib_ops;
+
+ link_map_offsets *fetch_link_map_offsets () const override;
+};
+
+/* Return a new solib_ops for ILP32 Linux systems. */
+
+extern solib_ops_up make_linux_ilp32_svr4_solib_ops (program_space *pspace);
+
+/* Return a new solib_ops for LP64 Linux systems. */
+
+extern solib_ops_up make_linux_lp64_svr4_solib_ops (program_space *pspace);
+
+#endif /* GDB_SOLIB_SVR4_LINUX_H */
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 398123f..c91e0b2 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1,6 +1,6 @@
/* Handle SVR4 shared libraries for GDB, the GNU Debugger.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -35,7 +35,6 @@
#include "regcache.h"
#include "observable.h"
-#include "solist.h"
#include "solib.h"
#include "solib-svr4.h"
@@ -48,14 +47,8 @@
#include <map>
-static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
-static int svr4_have_link_map_offsets (void);
static void svr4_relocate_main_executable (void);
static void probes_table_remove_objfile_probes (struct objfile *objfile);
-static void svr4_iterate_over_objfiles_in_search_order
- (gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
- objfile *current_objfile);
-
/* On SVR4 systems, a list of symbols in the dynamic linker where
GDB can try to place a breakpoint to monitor shared library
@@ -91,27 +84,6 @@ static const char * const main_name_list[] =
NULL
};
-/* What to do when a probe stop occurs. */
-
-enum probe_action
-{
- /* Something went seriously wrong. Stop using probes and
- revert to using the older interface. */
- PROBES_INTERFACE_FAILED,
-
- /* No action is required. The shared object list is still
- valid. */
- DO_NOTHING,
-
- /* The shared object list should be reloaded entirely. */
- FULL_RELOAD,
-
- /* Attempt to incrementally update the shared object list. If
- the update fails or is not possible, fall back to reloading
- the list in full. */
- UPDATE_OR_RELOAD,
-};
-
/* A probe's name and its associated action. */
struct probe_info
@@ -140,11 +112,17 @@ static const struct probe_info probe_info[] =
#define NUM_PROBES ARRAY_SIZE (probe_info)
-/* Return non-zero if GDB_SO_NAME and INFERIOR_SO_NAME represent
- the same shared library. */
+static lm_info_svr4 &
+get_lm_info_svr4 (const solib &solib)
+{
+ return gdb::checked_static_cast<lm_info_svr4 &> (*solib.lm_info);
+}
-static int
-svr4_same_1 (const char *gdb_so_name, const char *inferior_so_name)
+/* Return true if GDB_SO_NAME and INFERIOR_SO_NAME represent the same shared
+ library. */
+
+static bool
+svr4_same_name (const char *gdb_so_name, const char *inferior_so_name)
{
if (strcmp (gdb_so_name, inferior_so_name) == 0)
return 1;
@@ -177,31 +155,35 @@ svr4_same (const char *gdb_name, const char *inferior_name,
const lm_info_svr4 &gdb_lm_info,
const lm_info_svr4 &inferior_lm_info)
{
- if (!svr4_same_1 (gdb_name, inferior_name))
+ /* There may be different instances of the same library, in different
+ namespaces. Each instance is typically loaded at a different address
+ so its relocation offset would be different. */
+ if (gdb_lm_info.l_addr_inferior != inferior_lm_info.l_addr_inferior)
return false;
- /* There may be different instances of the same library, in different
- namespaces. Each instance, however, must have been loaded at a
- different address so its relocation offset would be different. */
- return gdb_lm_info.l_addr_inferior == inferior_lm_info.l_addr_inferior;
+ /* There may be multiple entries for the same dynamic linker instance (at
+ the same address) visible in different namespaces. Those are considered
+ different instances. */
+ if (gdb_lm_info.debug_base != inferior_lm_info.debug_base)
+ return false;
+
+ return svr4_same_name (gdb_name, inferior_name);
}
-static int
-svr4_same (const solib &gdb, const solib &inferior)
+bool
+svr4_solib_ops::same (const solib &gdb, const solib &inferior) const
{
- auto *lmg
- = gdb::checked_static_cast<const lm_info_svr4 *> (gdb.lm_info.get ());
- auto *lmi
- = gdb::checked_static_cast<const lm_info_svr4 *> (inferior.lm_info.get ());
+ auto &lmg = get_lm_info_svr4 (gdb);
+ auto &lmi = get_lm_info_svr4 (inferior);
- return svr4_same (gdb.so_original_name.c_str (),
- inferior.so_original_name.c_str (), *lmg, *lmi);
+ return svr4_same (gdb.original_name.c_str (),
+ inferior.original_name.c_str (), lmg, lmi);
}
-static lm_info_svr4_up
-lm_info_read (CORE_ADDR lm_addr)
+lm_info_svr4_up
+svr4_solib_ops::read_lm_info (CORE_ADDR lm_addr, CORE_ADDR debug_base) const
{
- struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
+ link_map_offsets *lmo = this->fetch_link_map_offsets ();
lm_info_svr4_up lm_info;
gdb::byte_vector lm (lmo->link_map_size);
@@ -214,7 +196,7 @@ lm_info_read (CORE_ADDR lm_addr)
type *ptr_type
= builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
- lm_info = std::make_unique<lm_info_svr4> ();
+ lm_info = std::make_unique<lm_info_svr4> (debug_base);
lm_info->lm_addr = lm_addr;
lm_info->l_addr_inferior = extract_typed_address (&lm[lmo->l_addr_offset],
@@ -231,30 +213,30 @@ lm_info_read (CORE_ADDR lm_addr)
return lm_info;
}
-static int
-has_lm_dynamic_from_link_map (void)
+int
+svr4_solib_ops::has_lm_dynamic_from_link_map () const
{
- struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
+ link_map_offsets *lmo = this->fetch_link_map_offsets ();
return lmo->l_ld_offset >= 0;
}
-static CORE_ADDR
-lm_addr_check (const solib &so, bfd *abfd)
+CORE_ADDR
+svr4_solib_ops::lm_addr_check (const solib &so, bfd *abfd) const
{
- auto *li = gdb::checked_static_cast<lm_info_svr4 *> (so.lm_info.get ());
+ auto &li = get_lm_info_svr4 (so);
- if (!li->l_addr_p)
+ if (!li.l_addr_p)
{
struct bfd_section *dyninfo_sect;
CORE_ADDR l_addr, l_dynaddr, dynaddr;
- l_addr = li->l_addr_inferior;
+ l_addr = li.l_addr_inferior;
- if (! abfd || ! has_lm_dynamic_from_link_map ())
+ if (!abfd || !this->has_lm_dynamic_from_link_map ())
goto set_addr;
- l_dynaddr = li->l_ld;
+ l_dynaddr = li.l_ld;
dyninfo_sect = bfd_get_section_by_name (abfd, ".dynamic");
if (dyninfo_sect == NULL)
@@ -317,7 +299,7 @@ lm_addr_check (const solib &so, bfd *abfd)
gdb_printf (_("Using PIC (Position Independent Code) "
"prelink displacement %s for \"%s\".\n"),
paddress (current_inferior ()->arch (), l_addr),
- so.so_name.c_str ());
+ so.name.c_str ());
}
else
{
@@ -333,16 +315,16 @@ lm_addr_check (const solib &so, bfd *abfd)
warning (_(".dynamic section for \"%s\" "
"is not at the expected address "
"(wrong library or version mismatch?)"),
- so.so_name.c_str ());
+ so.name.c_str ());
}
}
set_addr:
- li->l_addr = l_addr;
- li->l_addr_p = 1;
+ li.l_addr = l_addr;
+ li.l_addr_p = 1;
}
- return li->l_addr;
+ return li.l_addr;
}
struct svr4_so
@@ -359,8 +341,11 @@ struct svr4_so
struct svr4_info
{
- /* Base of dynamic linker structures in default namespace. */
- CORE_ADDR debug_base = 0;
+ /* Base of dynamic linker structures in default namespace.
+
+ The value is fetched from the inferior every time we need it. This field
+ represents the last known value. */
+ CORE_ADDR default_debug_base = 0;
/* Validity flag for debug_loader_offset. */
int debug_loader_offset_p = 0;
@@ -369,7 +354,7 @@ struct svr4_info
CORE_ADDR debug_loader_offset = 0;
/* Name of the dynamic linker, valid if debug_loader_offset_p. */
- char *debug_loader_name = nullptr;
+ std::string debug_loader_name;
/* Load map address for the main executable in default namespace. */
CORE_ADDR main_lm_addr = 0;
@@ -405,23 +390,74 @@ struct svr4_info
The special entry zero is reserved for a linear list to support
gdbstubs that do not support namespaces. */
std::map<CORE_ADDR, std::vector<svr4_so>> solib_lists;
+
+ /* Mapping between r_debug[_ext] addresses and a user-friendly
+ identifier for the namespace. A vector is used to make it
+ easy to assign new internal IDs to namespaces.
+
+ For gdbservers that don't support namespaces, the first (and only)
+ entry of the vector will be 0.
+
+ A note on consistency. We can't make the IDs be consistent before
+ and after the initial relocation of the inferior (when the global
+ _r_debug is relocated, as mentioned in the previous comment). It is
+ likely that this is a non-issue, since the inferior can't have called
+ dlmopen yet, but I think it is worth noting.
+
+ The only issue I am aware at this point is that, if when parsing an
+ XML file, we read an LMID that given by an XML file (and read in
+ library_list_start_library) is the identifier obtained with dlinfo
+ instead of the address of r_debug[_ext], and after attaching the
+ inferior adds another SO to that namespace, we might double-count it
+ since we won't have access to the LMID later on. However, this is
+ already a problem with the existing solib_lists code. */
+ std::vector<CORE_ADDR> namespace_id;
+
+ /* This identifies which namespaces are active. A namespace is considered
+ active when there is at least one shared object loaded into it. */
+ std::set<size_t> active_namespaces;
+
+ /* This flag indicates whether initializations related to the
+ GLIBC TLS module id tracking code have been performed. */
+ bool glibc_tls_slots_inited = false;
+
+ /* A vector of link map addresses for GLIBC TLS slots. See comment
+ for tls_maybe_fill_slot for more information. */
+ std::vector<CORE_ADDR> glibc_tls_slots;
};
/* Per-program-space data key. */
static const registry<program_space>::key<svr4_info> solib_svr4_pspace_data;
+/* Check if the lmid address is already assigned an ID in the svr4_info,
+ and if not, assign it one and add it to the list of known namespaces. */
+static void
+svr4_maybe_add_namespace (svr4_info *info, CORE_ADDR lmid)
+{
+ int i;
+ for (i = 0; i < info->namespace_id.size (); i++)
+ {
+ if (info->namespace_id[i] == lmid)
+ break;
+ }
+ if (i == info->namespace_id.size ())
+ info->namespace_id.push_back (lmid);
+
+ info->active_namespaces.insert (i);
+}
+
/* Return whether DEBUG_BASE is the default namespace of INFO. */
static bool
svr4_is_default_namespace (const svr4_info *info, CORE_ADDR debug_base)
{
- return (debug_base == info->debug_base);
+ return debug_base == info->default_debug_base;
}
/* Free the probes table. */
-static void
-free_probes_table (struct svr4_info *info)
+void
+svr4_solib_ops::free_probes_table (svr4_info *info) const
{
info->probes_table.reset (nullptr);
}
@@ -586,10 +622,10 @@ read_program_header (int type, int *p_arch_size, CORE_ADDR *base_addr)
return buf;
}
+/* See solib-svr4.h. */
-/* Return program interpreter string. */
-static std::optional<gdb::byte_vector>
-find_program_interpreter (void)
+std::optional<gdb::byte_vector>
+svr4_find_program_interpreter ()
{
/* If we have a current exec_bfd, use its section table. */
if (current_program_space->exec_bfd ()
@@ -680,8 +716,8 @@ scan_dyntag_auxv (const int desired_dyntag, CORE_ADDR *ptr,
return 0;
}
-/* Locate the base address of dynamic linker structs for SVR4 elf
- targets.
+/* Locate the base address the dynamic linker structure for the default
+ namespace.
For SVR4 elf targets the address of the dynamic linker's runtime
structure is contained within the dynamic info section in the
@@ -690,16 +726,16 @@ scan_dyntag_auxv (const int desired_dyntag, CORE_ADDR *ptr,
real address before starting the inferior, we have to read in the
dynamic info section from the inferior address space.
If there are any errors while trying to find the address, we
- silently return 0, otherwise the found address is returned. */
+ silently return 0, otherwise the found address is returned.
+
+ If we try to read the address before the dynamic linker had a change to
+ fill in the real address, this will also typically return 0. */
static CORE_ADDR
-elf_locate_base (void)
+locate_default_debug_base ()
{
CORE_ADDR dyn_ptr, dyn_ptr_addr;
- if (!svr4_have_link_map_offsets ())
- return 0;
-
/* Look for DT_MIPS_RLD_MAP first. MIPS executables use this
instead of DT_DEBUG, although they sometimes contain an unused
DT_DEBUG. */
@@ -760,6 +796,38 @@ elf_locate_base (void)
return 0;
}
+/* See solib-svr4.h. */
+
+CORE_ADDR
+svr4_solib_ops::default_debug_base (svr4_info *info, bool *changed) const
+{
+ CORE_ADDR default_debug_base = locate_default_debug_base ();
+
+ if (changed != nullptr)
+ *changed = default_debug_base != info->default_debug_base;
+
+ if (default_debug_base != info->default_debug_base)
+ {
+ /* Update the debug base value for existing solibs. The only known case
+ where this is required is when a struct solib was created for the
+ dynamic linker itself by svr4_solib_ops::default_sos, before the
+ default debug base was known. */
+ for (const auto &solib : m_pspace->solibs ())
+ {
+ if (&solib.ops () != this)
+ continue;
+
+ if (auto &li = get_lm_info_svr4 (solib);
+ li.debug_base == info->default_debug_base)
+ li.debug_base = default_debug_base;
+ }
+
+ info->default_debug_base = default_debug_base;
+ }
+
+ return info->default_debug_base;
+}
+
/* Find the first element in the inferior's dynamic link map, and
return its address in the inferior. Return zero if the address
could not be determined.
@@ -768,10 +836,10 @@ elf_locate_base (void)
checking r_version for a known version number, or r_state for
RT_CONSISTENT. */
-static CORE_ADDR
-solib_svr4_r_map (CORE_ADDR debug_base)
+CORE_ADDR
+svr4_solib_ops::read_r_map (CORE_ADDR debug_base) const
{
- struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
+ link_map_offsets *lmo = this->fetch_link_map_offsets ();
type *ptr_type
= builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
CORE_ADDR addr = 0;
@@ -791,35 +859,40 @@ solib_svr4_r_map (CORE_ADDR debug_base)
/* Find r_brk from the inferior's debug base. */
-static CORE_ADDR
-solib_svr4_r_brk (struct svr4_info *info)
+CORE_ADDR
+svr4_solib_ops::find_r_brk (svr4_info *info) const
{
- struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
+ link_map_offsets *lmo = this->fetch_link_map_offsets ();
type *ptr_type
= builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
- return read_memory_typed_address (info->debug_base + lmo->r_brk_offset,
- ptr_type);
+ gdb_assert (info->default_debug_base != 0);
+
+ return read_memory_typed_address ((info->default_debug_base
+ + lmo->r_brk_offset), ptr_type);
}
/* Find the link map for the dynamic linker (if it is not in the
normal list of loaded shared objects). */
-static CORE_ADDR
-solib_svr4_r_ldsomap (struct svr4_info *info)
+CORE_ADDR
+svr4_solib_ops::find_r_ldsomap (svr4_info *info) const
{
- struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
+ link_map_offsets *lmo = this->fetch_link_map_offsets ();
type *ptr_type
= builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
enum bfd_endian byte_order = type_byte_order (ptr_type);
ULONGEST version = 0;
+ gdb_assert (info->default_debug_base != 0);
+
try
{
/* Check version, and return zero if `struct r_debug' doesn't have
the r_ldsomap member. */
version
- = read_memory_unsigned_integer (info->debug_base + lmo->r_version_offset,
+ = read_memory_unsigned_integer ((info->default_debug_base
+ + lmo->r_version_offset),
lmo->r_version_size, byte_order);
}
catch (const gdb_exception_error &ex)
@@ -830,16 +903,17 @@ solib_svr4_r_ldsomap (struct svr4_info *info)
if (version < 2 || lmo->r_ldsomap_offset == -1)
return 0;
- return read_memory_typed_address (info->debug_base + lmo->r_ldsomap_offset,
+ return read_memory_typed_address ((info->default_debug_base
+ + lmo->r_ldsomap_offset),
ptr_type);
}
/* Find the next namespace from the r_next field. */
-static CORE_ADDR
-solib_svr4_r_next (CORE_ADDR debug_base)
+CORE_ADDR
+svr4_solib_ops::read_r_next (CORE_ADDR debug_base) const
{
- link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
+ link_map_offsets *lmo = this->fetch_link_map_offsets ();
type *ptr_type
= builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
bfd_endian byte_order = type_byte_order (ptr_type);
@@ -871,36 +945,37 @@ solib_svr4_r_next (CORE_ADDR debug_base)
memory areas containing the l_name string are saved in the core
file. */
-static int
-svr4_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
+bool
+svr4_solib_ops::keep_data_in_core (CORE_ADDR vaddr, unsigned long size) const
{
struct svr4_info *info;
CORE_ADDR ldsomap;
CORE_ADDR name_lm;
info = get_svr4_info (current_program_space);
+ CORE_ADDR default_debug_base = this->default_debug_base (info);
- info->debug_base = elf_locate_base ();
- if (info->debug_base == 0)
- return 0;
+ if (default_debug_base == 0)
+ return false;
- ldsomap = solib_svr4_r_ldsomap (info);
+ ldsomap = this->find_r_ldsomap (info);
if (!ldsomap)
- return 0;
+ return false;
- std::unique_ptr<lm_info_svr4> li = lm_info_read (ldsomap);
+ std::unique_ptr<lm_info_svr4> li
+ = this->read_lm_info (ldsomap, info->default_debug_base);
name_lm = li != NULL ? li->l_name : 0;
return (name_lm >= vaddr && name_lm < vaddr + size);
}
-/* See solist.h. */
+/* See solib.h. */
-static int
-open_symbol_file_object (int from_tty)
+bool
+svr4_solib_ops::open_symbol_file_object (int from_tty) const
{
CORE_ADDR lm, l_name;
- struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
+ link_map_offsets *lmo = this->fetch_link_map_offsets ();
type *ptr_type
= builtin_type (current_inferior ()->arch ())->builtin_data_ptr;
int l_name_size = ptr_type->length ();
@@ -913,17 +988,17 @@ open_symbol_file_object (int from_tty)
if (current_program_space->symfile_object_file)
if (!query (_("Attempt to reload symbols from process? ")))
- return 0;
+ return false;
+
+ CORE_ADDR default_debug_base = this->default_debug_base (info);
- /* Always locate the debug struct, in case it has moved. */
- info->debug_base = elf_locate_base ();
- if (info->debug_base == 0)
- return 0; /* failed somehow... */
+ if (default_debug_base == 0)
+ return false; /* failed somehow... */
/* First link map member should be the executable. */
- lm = solib_svr4_r_map (info->debug_base);
+ lm = this->read_r_map (default_debug_base);
if (lm == 0)
- return 0; /* failed somehow... */
+ return false; /* failed somehow... */
/* Read address of name from target memory to GDB. */
read_memory (lm + lmo->l_name_offset, l_name_buf.data (), l_name_size);
@@ -932,7 +1007,7 @@ open_symbol_file_object (int from_tty)
l_name = extract_typed_address (l_name_buf.data (), ptr_type);
if (l_name == 0)
- return 0; /* No filename. */
+ return false; /* No filename. */
/* Now fetch the filename from target memory. */
gdb::unique_xmalloc_ptr<char> filename
@@ -941,13 +1016,13 @@ open_symbol_file_object (int from_tty)
if (filename == nullptr)
{
warning (_("failed to read exec filename from attached file"));
- return 0;
+ return false;
}
/* Have a pathname: read the symbol file. */
symbol_file_add_main (filename.get (), add_flags);
- return 1;
+ return true;
}
/* Data exchange structure for the XML parser as returned by
@@ -980,30 +1055,22 @@ svr4_free_objfile_observer (struct objfile *objfile)
/* Implement solib_ops.clear_so. */
-static void
-svr4_clear_so (const solib &so)
+void
+svr4_solib_ops::clear_so (const solib &so) const
{
- auto *li = gdb::checked_static_cast<lm_info_svr4 *> (so.lm_info.get ());
-
- if (li != NULL)
- li->l_addr_p = 0;
+ get_lm_info_svr4 (so).l_addr_p = 0;
}
-/* Create the so_list objects equivalent to the svr4_sos in SOS. */
+/* Create the solib objects equivalent to the svr4_sos in SOS. */
-static owning_intrusive_list<solib>
-so_list_from_svr4_sos (const std::vector<svr4_so> &sos)
+owning_intrusive_list<solib>
+svr4_solib_ops::solibs_from_svr4_sos (const std::vector<svr4_so> &sos) const
{
owning_intrusive_list<solib> dst;
for (const svr4_so &so : sos)
- {
- auto &newobj = dst.emplace_back ();
-
- newobj.so_name = so.name;
- newobj.so_original_name = so.name;
- newobj.lm_info = std::make_unique<lm_info_svr4> (*so.lm_info);
- }
+ dst.emplace_back (std::make_unique<lm_info_svr4> (*so.lm_info), so.name,
+ so.name, *this);
return dst;
}
@@ -1031,24 +1098,33 @@ library_list_start_library (struct gdb_xml_parser *parser,
ULONGEST *l_ldp
= (ULONGEST *) xml_find_attribute (attributes, "l_ld")->value.get ();
- lm_info_svr4_up li = std::make_unique<lm_info_svr4> ();
- li->lm_addr = *lmp;
- li->l_addr_inferior = *l_addrp;
- li->l_ld = *l_ldp;
-
std::vector<svr4_so> *solist;
/* Older versions did not supply lmid. Put the element into the flat
list of the special namespace zero in that case. */
gdb_xml_value *at_lmid = xml_find_attribute (attributes, "lmid");
+ svr4_info *info = get_svr4_info (current_program_space);
+ ULONGEST lmid;
+
if (at_lmid == nullptr)
- solist = list->cur_list;
+ {
+ solist = list->cur_list;
+ svr4_maybe_add_namespace (info, 0);
+ lmid = 0;
+ }
else
{
- ULONGEST lmid = *(ULONGEST *) at_lmid->value.get ();
+ lmid = *(ULONGEST *) at_lmid->value.get ();
solist = &list->solib_lists[lmid];
+ svr4_maybe_add_namespace (info, lmid);
}
+ lm_info_svr4_up li = std::make_unique<lm_info_svr4> (lmid);
+
+ li->lm_addr = *lmp;
+ li->l_addr_inferior = *l_addrp;
+ li->l_ld = *l_ldp;
+
solist->emplace_back (name, std::move (li));
}
@@ -1087,7 +1163,7 @@ static const struct gdb_xml_attribute svr4_library_attributes[] =
{ "lm", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
{ "l_addr", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
{ "l_ld", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { "lmid", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { "lmid", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
{ NULL, GDB_XML_AF_NONE, NULL, NULL }
};
@@ -1115,11 +1191,10 @@ static const struct gdb_xml_element svr4_library_list_elements[] =
{ NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
};
-/* Parse qXfer:libraries:read packet into *SO_LIST_RETURN. Return 1 if
+/* Parse qXfer:libraries:read packet into *LIST.
- Return 0 if packet not supported, *SO_LIST_RETURN is not modified in such
- case. Return 1 if *SO_LIST_RETURN contains the library list, it may be
- empty, caller is responsible for freeing all its entries. */
+ Return 0 if packet not supported, *LIST is not modified in such case.
+ Return 1 if *LIST contains the library list. */
static int
svr4_parse_libraries (const char *document, struct svr4_library_list *list)
@@ -1141,11 +1216,11 @@ svr4_parse_libraries (const char *document, struct svr4_library_list *list)
return 0;
}
-/* Attempt to get so_list from target via qXfer:libraries-svr4:read packet.
+/* Attempt to get the shared object list from target via
+ qXfer:libraries-svr4:read packet.
- Return 0 if packet not supported, *SO_LIST_RETURN is not modified in such
- case. Return 1 if *SO_LIST_RETURN contains the library list, it may be
- empty, caller is responsible for freeing all its entries.
+ Return 0 if packet not supported, *LIST is not modified in such case.
+ Return 1 if *LIST contains the library list.
Note that ANNEX must be NULL if the remote does not explicitly allow
qXfer:libraries-svr4:read packets with non-empty annexes. Support for
@@ -1182,24 +1257,21 @@ svr4_current_sos_via_xfer_libraries (struct svr4_library_list *list,
/* If no shared library information is available from the dynamic
linker, build a fallback list from other sources. */
-static owning_intrusive_list<solib>
-svr4_default_sos (svr4_info *info)
+owning_intrusive_list<solib>
+svr4_solib_ops::default_sos (svr4_info *info) const
{
if (!info->debug_loader_offset_p)
return {};
- auto li = std::make_unique<lm_info_svr4> ();
+ auto li = std::make_unique<lm_info_svr4> (0);
/* Nothing will ever check the other fields if we set l_addr_p. */
li->l_addr = li->l_addr_inferior = info->debug_loader_offset;
li->l_addr_p = 1;
owning_intrusive_list<solib> sos;
- auto &newobj = sos.emplace_back ();
-
- newobj.lm_info = std::move (li);
- newobj.so_name = info->debug_loader_name;
- newobj.so_original_name = newobj.so_name;
+ sos.emplace_back (std::move (li), info->debug_loader_name,
+ info->debug_loader_name, *this);
return sos;
}
@@ -1211,16 +1283,17 @@ svr4_default_sos (svr4_info *info)
is returned the entries stored to LINK_PTR_PTR are still valid although they may
represent only part of the inferior library list. */
-static int
-svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
- std::vector<svr4_so> &sos, int ignore_first)
+int
+svr4_solib_ops::read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
+ CORE_ADDR debug_base, std::vector<svr4_so> &sos,
+ int ignore_first) const
{
CORE_ADDR first_l_name = 0;
CORE_ADDR next_lm;
for (; lm != 0; prev_lm = lm, lm = next_lm)
{
- lm_info_svr4_up li = lm_info_read (lm);
+ lm_info_svr4_up li = this->read_lm_info (lm, debug_base);
if (li == NULL)
return 0;
@@ -1276,8 +1349,8 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
stored by the probes interface. Handle special cases relating
to the first elements of the list in default namespace. */
-static void
-svr4_current_sos_direct (struct svr4_info *info)
+void
+svr4_solib_ops::current_sos_direct (svr4_info *info) const
{
CORE_ADDR lm;
bool ignore_first;
@@ -1286,6 +1359,8 @@ svr4_current_sos_direct (struct svr4_info *info)
/* Remove any old libraries. We're going to read them back in again. */
info->solib_lists.clear ();
+ info->active_namespaces.clear ();
+
/* Fall back to manual examination of the target if the packet is not
supported or gdbserver failed to find DT_DEBUG. gdb.server/solib-list.exp
tests a case where gdbserver cannot find the shared libraries list while
@@ -1319,8 +1394,9 @@ svr4_current_sos_direct (struct svr4_info *info)
/* If we can't find the dynamic linker's base structure, this
must not be a dynamically linked executable. Hmm. */
- info->debug_base = elf_locate_base ();
- if (info->debug_base == 0)
+ CORE_ADDR default_debug_base = this->default_debug_base (info);
+
+ if (default_debug_base == 0)
return;
/* Assume that everything is a library if the dynamic loader was loaded
@@ -1333,18 +1409,25 @@ svr4_current_sos_direct (struct svr4_info *info)
ignore_first = true;
auto cleanup = make_scope_exit ([info] ()
- { info->solib_lists.clear (); });
+ {
+ info->solib_lists.clear ();
+ info->active_namespaces.clear ();
+ });
/* Collect the sos in each namespace. */
- CORE_ADDR debug_base = info->debug_base;
+ CORE_ADDR debug_base = default_debug_base;
+
for (; debug_base != 0;
- ignore_first = false, debug_base = solib_svr4_r_next (debug_base))
+ ignore_first = false, debug_base = this->read_r_next (debug_base))
{
/* Walk the inferior's link map list, and build our so_list list. */
- lm = solib_svr4_r_map (debug_base);
+ lm = this->read_r_map (debug_base);
if (lm != 0)
- svr4_read_so_list (info, lm, 0, info->solib_lists[debug_base],
- ignore_first);
+ {
+ svr4_maybe_add_namespace (info, debug_base);
+ this->read_so_list (info, lm, 0, debug_base,
+ info->solib_lists[debug_base], ignore_first);
+ }
}
/* On Solaris, the dynamic linker is not in the normal list of
@@ -1356,13 +1439,16 @@ svr4_current_sos_direct (struct svr4_info *info)
r_debug object. If we added it to the default namespace (as it was),
we would probably run into inconsistencies with the load map's
prev/next links (I wonder if we did). */
- debug_base = solib_svr4_r_ldsomap (info);
+ debug_base = this->find_r_ldsomap (info);
if (debug_base != 0)
{
/* Add the dynamic linker's namespace unless we already did. */
if (info->solib_lists.find (debug_base) == info->solib_lists.end ())
- svr4_read_so_list (info, debug_base, 0, info->solib_lists[debug_base],
- 0);
+ {
+ svr4_maybe_add_namespace (info, debug_base);
+ this->read_so_list (info, debug_base, 0, debug_base,
+ info->solib_lists[debug_base], 0);
+ }
}
cleanup.release ();
@@ -1370,15 +1456,15 @@ svr4_current_sos_direct (struct svr4_info *info)
/* Collect sos read and stored by the probes interface. */
-static owning_intrusive_list<solib>
-svr4_collect_probes_sos (svr4_info *info)
+owning_intrusive_list<solib>
+svr4_solib_ops::collect_probes_sos (svr4_info *info) const
{
owning_intrusive_list<solib> res;
for (const auto &tuple : info->solib_lists)
{
const std::vector<svr4_so> &sos = tuple.second;
- res.splice (so_list_from_svr4_sos (sos));
+ res.splice (this->solibs_from_svr4_sos (sos));
}
return res;
@@ -1387,26 +1473,26 @@ svr4_collect_probes_sos (svr4_info *info)
/* Implement the main part of the "current_sos" solib_ops
method. */
-static owning_intrusive_list<solib>
-svr4_current_sos_1 (svr4_info *info)
+owning_intrusive_list<solib>
+svr4_solib_ops::current_sos_1 (svr4_info *info) const
{
owning_intrusive_list<solib> sos;
/* If we're using the probes interface, we can use the cache as it will
be maintained by probe update/reload actions. */
if (info->probes_table != nullptr)
- sos = svr4_collect_probes_sos (info);
+ sos = this->collect_probes_sos (info);
/* If we're not using the probes interface or if we didn't cache
anything, read the sos to fill the cache, then collect them from the
cache. */
if (sos.empty ())
{
- svr4_current_sos_direct (info);
+ this->current_sos_direct (info);
- sos = svr4_collect_probes_sos (info);
+ sos = this->collect_probes_sos (info);
if (sos.empty ())
- sos = svr4_default_sos (info);
+ sos = this->default_sos (info);
}
return sos;
@@ -1414,11 +1500,20 @@ svr4_current_sos_1 (svr4_info *info)
/* Implement the "current_sos" solib_ops method. */
-static owning_intrusive_list<solib>
-svr4_current_sos ()
+owning_intrusive_list<solib>
+svr4_solib_ops::current_sos () const
{
svr4_info *info = get_svr4_info (current_program_space);
- owning_intrusive_list<solib> sos = svr4_current_sos_1 (info);
+
+ /* Call this for the side-effect of updating the debug base in existing
+ solibs' lm_info_svr4, if needed. It is possible for the core to have
+ an solib with a stale lm_info_svr4::debug_base. In that case, we are
+ about to return the same solib, but with an updated debug_base. If we
+ didn't do this call, then it would appear as two different libraries to
+ the core, and it would appear as a spurious unload / load. */
+ this->default_debug_base (info);
+
+ owning_intrusive_list<solib> sos = this->current_sos_1 (info);
struct mem_range vsyscall_range;
/* Filter out the vDSO module, if present. Its symbol file would
@@ -1471,9 +1566,9 @@ svr4_current_sos ()
[ 9] .dynamic DYNAMIC ffffffffff700580 000580 0000f0
*/
- auto *li = gdb::checked_static_cast<lm_info_svr4 *> (so->lm_info.get ());
+ const auto &li = get_lm_info_svr4 (*so);
- if (vsyscall_range.contains (li->l_ld))
+ if (vsyscall_range.contains (li.l_ld))
{
so = sos.erase (so);
break;
@@ -1505,17 +1600,215 @@ svr4_fetch_objfile_link_map (struct objfile *objfile)
of shared libraries. */
for (const solib &so : current_program_space->solibs ())
if (so.objfile == objfile)
- {
- auto *li
- = gdb::checked_static_cast<lm_info_svr4 *> (so.lm_info.get ());
-
- return li->lm_addr;
- }
+ return get_lm_info_svr4 (so).lm_addr;
/* Not found! */
return 0;
}
+/* Return true if bfd section BFD_SECT is a thread local section
+ (i.e. either named ".tdata" or ".tbss"), and false otherwise. */
+
+static bool
+is_thread_local_section (struct bfd_section *bfd_sect)
+{
+ return ((strcmp (bfd_sect->name, ".tdata") == 0
+ || strcmp (bfd_sect->name, ".tbss") == 0)
+ && bfd_sect->size != 0);
+}
+
+/* Return true if objfile OBJF contains a thread local section, and
+ false otherwise. */
+
+static bool
+has_thread_local_section (const objfile *objf)
+{
+ for (obj_section &objsec : objf->sections ())
+ if (is_thread_local_section (objsec.the_bfd_section))
+ return true;
+ return false;
+}
+
+/* Return true if solib SO contains a thread local section, and false
+ otherwise. */
+
+static bool
+has_thread_local_section (const solib &so)
+{
+ for (const target_section &p : so.sections)
+ if (is_thread_local_section (p.the_bfd_section))
+ return true;
+ return false;
+}
+
+/* For the MUSL C library, given link map address LM_ADDR, return the
+ corresponding TLS module id, or 0 if not found.
+
+ Background: Unlike the mechanism used by glibc (see below), the
+ scheme used by the MUSL C library is pretty simple. If the
+ executable contains TLS variables it gets module id 1. Otherwise,
+ the first shared object loaded which contains TLS variables is
+ assigned to module id 1. TLS-containing shared objects are then
+ assigned consecutive module ids, based on the order that they are
+ loaded. When unloaded via dlclose, module ids are reassigned as if
+ that module had never been loaded. */
+
+int
+musl_link_map_to_tls_module_id (CORE_ADDR lm_addr)
+{
+ /* When lm_addr is zero, the program is statically linked. Any TLS
+ variables will be in module id 1. */
+ if (lm_addr == 0)
+ return 1;
+
+ int mod_id = 0;
+ if (has_thread_local_section (current_program_space->symfile_object_file))
+ mod_id++;
+
+ struct svr4_info *info = get_svr4_info (current_program_space);
+
+ /* Cause svr4_current_sos() to be run if it hasn't been already. */
+ if (info->main_lm_addr == 0)
+ solib_add (NULL, 0, auto_solib_add);
+
+ /* Handle case where lm_addr corresponds to the main program.
+ Return value is either 0, when there are no TLS variables, or 1,
+ when there are. */
+ if (lm_addr == info->main_lm_addr)
+ return mod_id;
+
+ /* Iterate through the shared objects, possibly incrementing the
+ module id, and returning mod_id should a match be found. */
+ for (const solib &so : current_program_space->solibs ())
+ {
+ if (has_thread_local_section (so))
+ mod_id++;
+
+ const auto &li = get_lm_info_svr4 (so);
+
+ if (li.lm_addr == lm_addr)
+ return mod_id;
+ }
+ return 0;
+}
+
+/* For GLIBC, given link map address LM_ADDR, return the corresponding TLS
+ module id, or 0 if not found. */
+
+int
+glibc_link_map_to_tls_module_id (CORE_ADDR lm_addr)
+{
+ /* When lm_addr is zero, the program is statically linked. Any TLS
+ variables will be in module id 1. */
+ if (lm_addr == 0)
+ return 1;
+
+ /* Look up lm_addr in the TLS slot data structure. */
+ struct svr4_info *info = get_svr4_info (current_program_space);
+ auto it = std::find (info->glibc_tls_slots.begin (),
+ info->glibc_tls_slots.end (),
+ lm_addr);
+ if (it == info->glibc_tls_slots.end ())
+ return 0;
+ else
+ return 1 + it - info->glibc_tls_slots.begin ();
+}
+
+/* Conditionally, based on whether the shared object, SO, contains TLS
+ variables, assign a link map address to a TLS module id slot. This
+ code is GLIBC-specific and may only work for specific GLIBC
+ versions. That said, it is known to work for (at least) GLIBC
+ versions 2.27 thru 2.40.
+
+ Background: In order to implement internal TLS address lookup
+ code, it is necessary to find the module id that has been
+ associated with a specific link map address. In GLIBC, the TLS
+ module id is stored in struct link_map, in the member
+ 'l_tls_modid'. While the first several members of struct link_map
+ are part of the SVR4 ABI, the offset to l_tls_modid definitely is
+ not. Therefore, since we don't know the offset to l_tls_modid, we
+ cannot simply look it up - which is a shame, because things would
+ be so much more easy and obviously accurate, if we could access
+ l_tls_modid.
+
+ GLIBC has a concept of TLS module id slots. These slots are
+ allocated consecutively as shared objects containing TLS variables
+ are loaded. When unloaded (e.g. via dlclose()), the corresponding
+ slot is marked as unused, but may be used again when later loading
+ a shared object.
+
+ The functions tls_maybe_fill_slot and tls_maybe_erase_slot are
+ associated with the observers 'solib_loaded' and 'solib_unloaded'.
+ They (attempt to) track use of TLS module id slots in the same way
+ that GLIBC does, which will hopefully provide an accurate module id
+ when asked to provide it via glibc_link_map_to_tls_module_id(),
+ above. */
+
+static void
+tls_maybe_fill_slot (solib &so)
+{
+ auto *li = dynamic_cast<lm_info_svr4 *> (so.lm_info.get ());
+ if (li == nullptr)
+ return;
+
+ struct svr4_info *info = get_svr4_info (current_program_space);
+ if (!info->glibc_tls_slots_inited)
+ {
+ /* Cause svr4_current_sos() to be run if it hasn't been already. */
+ if (info->main_lm_addr == 0)
+ {
+ auto &ops
+ = gdb::checked_static_cast<const svr4_solib_ops &> (so.ops ());
+ ops.current_sos_direct (info);
+ }
+
+ /* Quit early when main_lm_addr is still 0. */
+ if (info->main_lm_addr == 0)
+ return;
+
+ /* Also quit early when symfile_object_file is not yet known. */
+ if (current_program_space->symfile_object_file == nullptr)
+ return;
+
+ if (has_thread_local_section (current_program_space->symfile_object_file))
+ info->glibc_tls_slots.push_back (info->main_lm_addr);
+ info->glibc_tls_slots_inited = true;
+ }
+
+ if (has_thread_local_section (so))
+ {
+ auto it = std::find (info->glibc_tls_slots.begin (),
+ info->glibc_tls_slots.end (),
+ 0);
+ if (it == info->glibc_tls_slots.end ())
+ info->glibc_tls_slots.push_back (li->lm_addr);
+ else
+ *it = li->lm_addr;
+ }
+}
+
+/* Remove a link map address from the TLS module slot data structure.
+ As noted above, this code is GLIBC-specific. */
+
+static void
+tls_maybe_erase_slot (program_space *pspace, const solib &so,
+ bool still_in_use, bool silent)
+{
+ if (still_in_use)
+ return;
+
+ auto *li = dynamic_cast<lm_info_svr4 *> (so.lm_info.get ());
+ if (li == nullptr)
+ return;
+
+ struct svr4_info *info = get_svr4_info (pspace);
+ auto it = std::find (info->glibc_tls_slots.begin (),
+ info->glibc_tls_slots.end (),
+ li->lm_addr);
+ if (it != info->glibc_tls_slots.end ())
+ *it = 0;
+}
+
/* On some systems, the only way to recognize the link map entry for
the main executable file is by looking at its name. Return
non-zero iff SONAME matches one of the known main executable names. */
@@ -1534,11 +1827,11 @@ match_main (const char *soname)
return (0);
}
-/* Return 1 if PC lies in the dynamic symbol resolution code of the
+/* Return true if PC lies in the dynamic symbol resolution code of the
SVR4 run time loader. */
-int
-svr4_in_dynsym_resolve_code (CORE_ADDR pc)
+bool
+svr4_solib_ops::in_dynsym_resolve_code (CORE_ADDR pc) const
{
struct svr4_info *info = get_svr4_info (current_program_space);
@@ -1737,12 +2030,10 @@ solib_event_probe_action (struct probe_and_action *pa)
shared objects from the inferior. Handle special cases relating
to the first elements of the list. Returns nonzero on success. */
-static int
-solist_update_full (struct svr4_info *info)
+void
+svr4_solib_ops::update_full (svr4_info *info) const
{
- svr4_current_sos_direct (info);
-
- return 1;
+ this->current_sos_direct (info);
}
/* Update the shared object list starting from the link-map entry
@@ -1750,9 +2041,9 @@ solist_update_full (struct svr4_info *info)
nonzero if the list was successfully updated, or zero to indicate
failure. */
-static int
-solist_update_incremental (svr4_info *info, CORE_ADDR debug_base,
- CORE_ADDR lm)
+int
+svr4_solib_ops::update_incremental (svr4_info *info, CORE_ADDR debug_base,
+ CORE_ADDR lm) const
{
/* Fall back to a full update if we are using a remote target
that does not support incremental transfers. */
@@ -1778,6 +2069,10 @@ solist_update_incremental (svr4_info *info, CORE_ADDR debug_base,
return 0;
prev_lm = 0;
+
+ /* If the list is empty, we are seeing a new namespace for the
+ first time, so assign it an internal ID. */
+ svr4_maybe_add_namespace (info, debug_base);
}
else
prev_lm = solist.back ().lm_info->lm_addr;
@@ -1790,9 +2085,9 @@ solist_update_incremental (svr4_info *info, CORE_ADDR debug_base,
/* Unknown key=value pairs are ignored by the gdbstub. */
xsnprintf (annex, sizeof (annex), "lmid=%s;start=%s;prev=%s",
- phex_nz (debug_base, sizeof (debug_base)),
- phex_nz (lm, sizeof (lm)),
- phex_nz (prev_lm, sizeof (prev_lm)));
+ phex_nz (debug_base),
+ phex_nz (lm),
+ phex_nz (prev_lm));
if (!svr4_current_sos_via_xfer_libraries (&library_list, annex))
return 0;
@@ -1826,7 +2121,7 @@ solist_update_incremental (svr4_info *info, CORE_ADDR debug_base,
above check and deferral to solist_update_full ensures
that this call to svr4_read_so_list will never see the
first element. */
- if (!svr4_read_so_list (info, lm, prev_lm, solist, 0))
+ if (!this->read_so_list (info, lm, prev_lm, debug_base, solist, 0))
return 0;
}
@@ -1837,22 +2132,24 @@ solist_update_incremental (svr4_info *info, CORE_ADDR debug_base,
original interface. We don't reset the breakpoints as the
ones set up for the probes-based interface are adequate. */
-static void
-disable_probes_interface (svr4_info *info)
+void
+svr4_solib_ops::disable_probes_interface (svr4_info *info) const
{
warning (_("Probes-based dynamic linker interface failed.\n"
"Reverting to original interface."));
free_probes_table (info);
info->solib_lists.clear ();
+ info->namespace_id.clear ();
+ info->active_namespaces.clear ();
}
/* Update the solib list as appropriate when using the
probes-based linker interface. Do nothing if using the
standard interface. */
-static void
-svr4_handle_solib_event (void)
+void
+svr4_solib_ops::handle_event () const
{
struct svr4_info *info = get_svr4_info (current_program_space);
struct probe_and_action *pa;
@@ -1877,9 +2174,9 @@ svr4_handle_solib_event (void)
/* If anything goes wrong we revert to the original linker
interface. */
- auto cleanup = make_scope_exit ([info] ()
+ auto cleanup = make_scope_exit ([this, info] ()
{
- disable_probes_interface (info);
+ this->disable_probes_interface (info);
});
action = solib_event_probe_action (pa);
@@ -1923,17 +2220,14 @@ svr4_handle_solib_event (void)
if (debug_base == 0)
return;
- /* If the global _r_debug object moved, we need to reload everything
- since we cannot identify namespaces (by the location of their
- r_debug_ext object) anymore. */
- CORE_ADDR global_debug_base = elf_locate_base ();
- if (global_debug_base != info->debug_base)
- {
- info->debug_base = global_debug_base;
- action = FULL_RELOAD;
- }
+ bool default_debug_base_changed;
+ CORE_ADDR default_debug_base
+ = this->default_debug_base (info, &default_debug_base_changed);
- if (info->debug_base == 0)
+ if (default_debug_base_changed)
+ action = FULL_RELOAD;
+
+ if (default_debug_base == 0)
{
/* It's possible for the reloc_complete probe to be triggered before
the linker has set the DT_DEBUG pointer (for example, when the
@@ -1981,15 +2275,12 @@ svr4_handle_solib_event (void)
if (action == UPDATE_OR_RELOAD)
{
- if (!solist_update_incremental (info, debug_base, lm))
+ if (!this->update_incremental (info, debug_base, lm))
action = FULL_RELOAD;
}
if (action == FULL_RELOAD)
- {
- if (!solist_update_full (info))
- return;
- }
+ this->update_full (info);
cleanup.release ();
}
@@ -2036,8 +2327,8 @@ svr4_update_solib_event_breakpoint (struct breakpoint *b)
/* Enable or disable optional solib event breakpoints as appropriate.
Called whenever stop_on_solib_events is changed. */
-static void
-svr4_update_solib_event_breakpoints (void)
+void
+svr4_solib_ops::update_breakpoints () const
{
for (breakpoint &bp : all_breakpoints_safe ())
svr4_update_solib_event_breakpoint (&bp);
@@ -2048,10 +2339,10 @@ svr4_update_solib_event_breakpoints (void)
solib event breakpoint will be created and registered for each
probe. */
-static void
-svr4_create_probe_breakpoints (svr4_info *info, struct gdbarch *gdbarch,
- const std::vector<probe *> *probes,
- struct objfile *objfile)
+void
+svr4_solib_ops::create_probe_breakpoints (svr4_info *info, gdbarch *gdbarch,
+ const std::vector<probe *> *probes,
+ objfile *objfile) const
{
for (int i = 0; i < NUM_PROBES; i++)
{
@@ -2069,17 +2360,17 @@ svr4_create_probe_breakpoints (svr4_info *info, struct gdbarch *gdbarch,
}
}
- svr4_update_solib_event_breakpoints ();
+ this->update_breakpoints ();
}
/* Find all the glibc named probes. Only if all of the probes are found, then
create them and return true. Otherwise return false. If WITH_PREFIX is set
then add "rtld" to the front of the probe names. */
-static bool
-svr4_find_and_create_probe_breakpoints (svr4_info *info,
- struct gdbarch *gdbarch,
- struct obj_section *os,
- bool with_prefix)
+bool
+svr4_solib_ops::find_and_create_probe_breakpoints (svr4_info *info,
+ gdbarch *gdbarch,
+ obj_section *os,
+ bool with_prefix) const
{
SOLIB_SCOPED_DEBUG_START_END ("objfile=%s, with_prefix=%d",
os->objfile->original_name, with_prefix);
@@ -2157,7 +2448,7 @@ svr4_find_and_create_probe_breakpoints (svr4_info *info,
/* All probes found. Now create them. */
solib_debug_printf ("using probes interface");
- svr4_create_probe_breakpoints (info, gdbarch, probes, os->objfile);
+ this->create_probe_breakpoints (info, gdbarch, probes, os->objfile);
return true;
}
@@ -2173,15 +2464,16 @@ svr4_find_and_create_probe_breakpoints (svr4_info *info,
probes aren't found, a single breakpoint is set on the original
marker function. */
-static void
-svr4_create_solib_event_breakpoints (svr4_info *info, struct gdbarch *gdbarch,
- CORE_ADDR address)
+void
+svr4_solib_ops::create_event_breakpoints (svr4_info *info, gdbarch *gdbarch,
+ CORE_ADDR address) const
{
struct obj_section *os = find_pc_section (address);
if (os == nullptr
- || (!svr4_find_and_create_probe_breakpoints (info, gdbarch, os, false)
- && !svr4_find_and_create_probe_breakpoints (info, gdbarch, os, true)))
+ || (!this->find_and_create_probe_breakpoints (info, gdbarch, os, false)
+ && !this->find_and_create_probe_breakpoints (info, gdbarch, os,
+ true)))
{
solib_debug_printf ("falling back to r_brk breakpoint: addr=%s",
paddress (gdbarch, address));
@@ -2221,12 +2513,11 @@ svr4_create_solib_event_breakpoints (svr4_info *info, struct gdbarch *gdbarch,
depending upon whether or not the library is being mapped or unmapped,
and then set to RT_CONSISTENT after the library is mapped/unmapped. */
-static int
-enable_break (struct svr4_info *info, int from_tty)
+int
+svr4_solib_ops::enable_break (svr4_info *info, int from_tty) const
{
const char * const *bkpt_namep;
asection *interp_sect;
- CORE_ADDR sym_addr;
info->interp_text_sect_low = info->interp_text_sect_high = 0;
info->interp_plt_sect_low = info->interp_plt_sect_high = 0;
@@ -2237,9 +2528,12 @@ enable_break (struct svr4_info *info, int from_tty)
is the object containing r_brk. */
solib_add (NULL, from_tty, auto_solib_add);
- sym_addr = 0;
- if (info->debug_base && solib_svr4_r_map (info->debug_base) != 0)
- sym_addr = solib_svr4_r_brk (info);
+
+ CORE_ADDR sym_addr = 0;
+ CORE_ADDR default_debug_base = this->default_debug_base (info);
+
+ if (default_debug_base != 0 && this->read_r_map (default_debug_base) != 0)
+ sym_addr = this->find_r_brk (info);
if (sym_addr != 0)
{
@@ -2298,8 +2592,8 @@ enable_break (struct svr4_info *info, int from_tty)
= info->interp_plt_sect_low + bfd_section_size (interp_sect);
}
- svr4_create_solib_event_breakpoints
- (info, current_inferior ()->arch (), sym_addr);
+ this->create_event_breakpoints (info, current_inferior ()->arch (),
+ sym_addr);
return 1;
}
}
@@ -2307,7 +2601,7 @@ enable_break (struct svr4_info *info, int from_tty)
/* Find the program interpreter; if not found, warn the user and drop
into the old breakpoint at symbol code. */
std::optional<gdb::byte_vector> interp_name_holder
- = find_program_interpreter ();
+ = svr4_find_program_interpreter ();
if (interp_name_holder)
{
const char *interp_name = (const char *) interp_name_holder->data ();
@@ -2347,11 +2641,11 @@ enable_break (struct svr4_info *info, int from_tty)
address from the shared library table. */
for (const solib &so : current_program_space->solibs ())
{
- if (svr4_same_1 (interp_name, so.so_original_name.c_str ()))
+ if (svr4_same_name (interp_name, so.original_name.c_str ()))
{
load_addr_found = 1;
loader_found_in_list = 1;
- load_addr = lm_addr_check (so, tmp_bfd.get ());
+ load_addr = this->lm_addr_check (so, tmp_bfd.get ());
break;
}
}
@@ -2407,7 +2701,7 @@ enable_break (struct svr4_info *info, int from_tty)
if (!loader_found_in_list)
{
- info->debug_loader_name = xstrdup (interp_name);
+ info->debug_loader_name = interp_name;
info->debug_loader_offset_p = 1;
info->debug_loader_offset = load_addr;
solib_add (NULL, from_tty, auto_solib_add);
@@ -2458,9 +2752,8 @@ enable_break (struct svr4_info *info, int from_tty)
if (sym_addr != 0)
{
- svr4_create_solib_event_breakpoints (info,
- current_inferior ()->arch (),
- load_addr + sym_addr);
+ this->create_event_breakpoints (info, current_inferior ()->arch (),
+ load_addr + sym_addr);
return 1;
}
@@ -2468,8 +2761,8 @@ enable_break (struct svr4_info *info, int from_tty)
linker. Warn and drop into the old code. */
bkpt_at_symbol:
warning (_("Unable to find dynamic linker breakpoint function.\n"
- "GDB will be unable to debug shared library initializers\n"
- "and track explicitly loaded dynamic code."));
+ "GDB will be unable to debug shared library initializers\n"
+ "and track explicitly loaded dynamic code."));
}
/* Scan through the lists of symbols, trying to look up the symbol and
@@ -2487,9 +2780,8 @@ enable_break (struct svr4_info *info, int from_tty)
sym_addr = gdbarch_convert_from_func_ptr_addr
(current_inferior ()->arch (), sym_addr,
current_inferior ()->top_target ());
- svr4_create_solib_event_breakpoints (info,
- current_inferior ()->arch (),
- sym_addr);
+ this->create_event_breakpoints (info, current_inferior ()->arch (),
+ sym_addr);
return 1;
}
}
@@ -2507,8 +2799,9 @@ enable_break (struct svr4_info *info, int from_tty)
sym_addr = gdbarch_convert_from_func_ptr_addr
(current_inferior ()->arch (), sym_addr,
current_inferior ()->top_target ());
- svr4_create_solib_event_breakpoints
- (info, current_inferior ()->arch (), sym_addr);
+ this->create_event_breakpoints (info,
+ current_inferior ()->arch (),
+ sym_addr);
return 1;
}
}
@@ -3032,16 +3325,18 @@ svr4_relocate_main_executable (void)
addresses, and saving sufficient information about them to allow
their symbols to be read at a later time. */
-static void
-svr4_solib_create_inferior_hook (int from_tty)
+void
+svr4_solib_ops::create_inferior_hook (int from_tty) const
{
struct svr4_info *info;
info = get_svr4_info (current_program_space);
/* Clear the probes-based interface's state. */
- free_probes_table (info);
+ this->free_probes_table (info);
info->solib_lists.clear ();
+ info->namespace_id.clear ();
+ info->active_namespaces.clear ();
/* Relocate the main executable if necessary. */
svr4_relocate_main_executable ();
@@ -3051,22 +3346,18 @@ svr4_solib_create_inferior_hook (int from_tty)
if (!target_has_execution ())
return;
- if (!svr4_have_link_map_offsets ())
- return;
-
- if (!enable_break (info, from_tty))
+ if (!this->enable_break (info, from_tty))
return;
}
-static void
-svr4_clear_solib (program_space *pspace)
+void
+svr4_solib_ops::clear_solib (program_space *pspace) const
{
svr4_info *info = get_svr4_info (pspace);
- info->debug_base = 0;
+ info->default_debug_base = 0;
info->debug_loader_offset_p = 0;
info->debug_loader_offset = 0;
- xfree (info->debug_loader_name);
- info->debug_loader_name = NULL;
+ info->debug_loader_name.clear ();
}
/* Clear any bits of ADDR that wouldn't fit in a target-format
@@ -3123,15 +3414,15 @@ find_loadable_elf_internal_phdr (bfd *abfd, bfd_section *asect)
return nullptr;
}
-/* Implement solib_ops::relocate_section_addresses() for svr4 targets. */
-
-static void
-svr4_relocate_section_addresses (solib &so, target_section *sec)
+void
+svr4_solib_ops::relocate_section_addresses (solib &so,
+ target_section *sec) const
{
bfd *abfd = sec->the_bfd_section->owner;
- sec->addr = svr4_truncate_ptr (sec->addr + lm_addr_check (so, abfd));
- sec->endaddr = svr4_truncate_ptr (sec->endaddr + lm_addr_check (so, abfd));
+ sec->addr = svr4_truncate_ptr (sec->addr + this->lm_addr_check (so, abfd));
+ sec->endaddr
+ = svr4_truncate_ptr (sec->endaddr + this->lm_addr_check (so, abfd));
struct bfd_section *asect = sec->the_bfd_section;
gdb_assert (asect != nullptr);
@@ -3201,69 +3492,23 @@ svr4_relocate_section_addresses (solib &so, target_section *sec)
}
}
}
-
-/* Architecture-specific operations. */
-
-struct solib_svr4_ops
-{
- /* Return a description of the layout of `struct link_map'. */
- struct link_map_offsets *(*fetch_link_map_offsets)(void) = nullptr;
-};
-
-/* Per-architecture data key. */
-static const registry<gdbarch>::key<struct solib_svr4_ops> solib_svr4_data;
-
-/* Return a default for the architecture-specific operations. */
-
-static struct solib_svr4_ops *
-get_ops (struct gdbarch *gdbarch)
-{
- struct solib_svr4_ops *ops = solib_svr4_data.get (gdbarch);
- if (ops == nullptr)
- ops = solib_svr4_data.emplace (gdbarch);
- return ops;
-}
-
-/* Set the architecture-specific `struct link_map_offsets' fetcher for
- GDBARCH to FLMO. Also, install SVR4 solib_ops into GDBARCH. */
+/* See solib-svr4.h. */
void
-set_solib_svr4_fetch_link_map_offsets (struct gdbarch *gdbarch,
- struct link_map_offsets *(*flmo) (void))
+set_solib_svr4_ops (gdbarch *gdbarch, gdbarch_make_solib_ops_ftype make_solib_ops)
{
- struct solib_svr4_ops *ops = get_ops (gdbarch);
-
- ops->fetch_link_map_offsets = flmo;
-
- set_gdbarch_so_ops (gdbarch, &svr4_so_ops);
- set_gdbarch_iterate_over_objfiles_in_search_order
- (gdbarch, svr4_iterate_over_objfiles_in_search_order);
+ set_gdbarch_make_solib_ops (gdbarch, make_solib_ops);
}
-/* Fetch a link_map_offsets structure using the architecture-specific
- `struct link_map_offsets' fetcher. */
+/* See solib-svr4.h. */
-static struct link_map_offsets *
-svr4_fetch_link_map_offsets (void)
+solib_ops_up
+make_svr4_ilp32_solib_ops (program_space *pspace)
{
- struct solib_svr4_ops *ops = get_ops (current_inferior ()->arch ());
-
- gdb_assert (ops->fetch_link_map_offsets);
- return ops->fetch_link_map_offsets ();
+ return std::make_unique<ilp32_svr4_solib_ops> (pspace);
}
-/* Return 1 if a link map offset fetcher has been defined, 0 otherwise. */
-
-static int
-svr4_have_link_map_offsets (void)
-{
- struct solib_svr4_ops *ops = get_ops (current_inferior ()->arch ());
-
- return (ops->fetch_link_map_offsets != NULL);
-}
-
-
/* Most OS'es that have SVR4-style ELF dynamic libraries define a
`struct r_debug' and a `struct link_map' that are binary compatible
with the original SVR4 implementation. */
@@ -3271,8 +3516,8 @@ svr4_have_link_map_offsets (void)
/* Fetch (and possibly build) an appropriate `struct link_map_offsets'
for an ILP32 SVR4 system. */
-struct link_map_offsets *
-svr4_ilp32_fetch_link_map_offsets (void)
+link_map_offsets *
+ilp32_svr4_solib_ops::fetch_link_map_offsets () const
{
static struct link_map_offsets lmo;
static struct link_map_offsets *lmp = NULL;
@@ -3300,11 +3545,28 @@ svr4_ilp32_fetch_link_map_offsets (void)
return lmp;
}
+/* solib_ops for LP64 SVR4 systems. */
+
+struct lp64_svr4_solib_ops : public svr4_solib_ops
+{
+ using svr4_solib_ops::svr4_solib_ops;
+
+ link_map_offsets *fetch_link_map_offsets () const override;
+};
+
+/* See solib-svr4.h. */
+
+solib_ops_up
+make_svr4_lp64_solib_ops (program_space *pspace)
+{
+ return std::make_unique<lp64_svr4_solib_ops> (pspace);
+}
+
/* Fetch (and possibly build) an appropriate `struct link_map_offsets'
for an LP64 SVR4 system. */
-struct link_map_offsets *
-svr4_lp64_fetch_link_map_offsets (void)
+link_map_offsets *
+lp64_svr4_solib_ops::fetch_link_map_offsets () const
{
static struct link_map_offsets lmo;
static struct link_map_offsets *lmp = NULL;
@@ -3366,24 +3628,15 @@ find_debug_base_for_solib (const solib *solib)
if (solib == nullptr)
return 0;
- svr4_info *info = get_svr4_info (current_program_space);
- gdb_assert (info != nullptr);
-
- auto *lm_info
- = gdb::checked_static_cast<const lm_info_svr4 *> (solib->lm_info.get ());
+ /* This is always called for solibs with an associated objfile. */
+ gdb_assert (solib->objfile != nullptr);
- for (const auto &tuple : info->solib_lists)
- {
- CORE_ADDR debug_base = tuple.first;
- const std::vector<svr4_so> &sos = tuple.second;
+ svr4_info *info = get_svr4_info (solib->objfile->pspace ());
+ gdb_assert (info != nullptr);
- for (const svr4_so &so : sos)
- if (svr4_same (solib->so_original_name.c_str (), so.name.c_str (),
- *lm_info, *so.lm_info))
- return debug_base;
- }
+ auto &lm_info = get_lm_info_svr4 (*solib);
- return 0;
+ return lm_info.debug_base;
}
/* Search order for ELF DSOs linked with -Bsymbolic. Those DSOs have a
@@ -3392,10 +3645,10 @@ find_debug_base_for_solib (const solib *solib)
stay in the same namespace as that file. Otherwise, we only consider
the initial namespace. */
-static void
-svr4_iterate_over_objfiles_in_search_order
- (gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
- objfile *current_objfile)
+void
+svr4_solib_ops::iterate_over_objfiles_in_search_order
+ (iterate_over_objfiles_in_search_order_cb_ftype cb,
+ objfile *current_objfile) const
{
bool checked_current_objfile = false;
if (current_objfile != nullptr)
@@ -3405,11 +3658,14 @@ svr4_iterate_over_objfiles_in_search_order
if (current_objfile->separate_debug_objfile_backlink != nullptr)
current_objfile = current_objfile->separate_debug_objfile_backlink;
- if (current_objfile == current_program_space->symfile_object_file)
- abfd = current_program_space->exec_bfd ();
+ if (current_objfile == m_pspace->symfile_object_file)
+ abfd = m_pspace->exec_bfd ();
else
abfd = current_objfile->obfd.get ();
+ /* gdb_bfd_scan_elf_dyntag relies on the current program space. */
+ gdb_assert (m_pspace == current_program_space);
+
if (abfd != nullptr
&& gdb_bfd_scan_elf_dyntag (DT_SYMBOLIC, abfd, nullptr, nullptr) == 1)
{
@@ -3419,17 +3675,21 @@ svr4_iterate_over_objfiles_in_search_order
}
}
+ /* elf_locate_base relies on the current program space. */
+ gdb_assert (m_pspace == current_program_space);
+
/* The linker namespace to iterate identified by the address of its
r_debug object, defaulting to the initial namespace. */
- CORE_ADDR initial = elf_locate_base ();
+ svr4_info *info = get_svr4_info (current_program_space);
+ CORE_ADDR default_debug_base = this->default_debug_base (info);
const solib *curr_solib = find_solib_for_objfile (current_objfile);
CORE_ADDR debug_base = find_debug_base_for_solib (curr_solib);
if (debug_base == 0)
- debug_base = initial;
+ debug_base = default_debug_base;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : m_pspace->objfiles ())
{
- if (checked_current_objfile && objfile == current_objfile)
+ if (checked_current_objfile && &objfile == current_objfile)
continue;
/* Try to determine the namespace into which objfile was loaded.
@@ -3437,50 +3697,98 @@ svr4_iterate_over_objfiles_in_search_order
If we fail, e.g. for manually added symbol files or for the main
executable, we assume that they were added to the initial
namespace. */
- const solib *solib = find_solib_for_objfile (objfile);
+ const solib *solib = find_solib_for_objfile (&objfile);
CORE_ADDR solib_base = find_debug_base_for_solib (solib);
if (solib_base == 0)
- solib_base = initial;
+ solib_base = default_debug_base;
/* Ignore objfiles that were added to a different namespace. */
if (solib_base != debug_base)
continue;
- if (cb (objfile))
+ if (cb (&objfile))
return;
}
}
-/* See solib_ops::find_solib_addr in solist.h. */
+std::optional<CORE_ADDR>
+svr4_solib_ops::find_solib_addr (solib &so) const
+{
+ return get_lm_info_svr4 (so).l_addr_inferior;
+}
-static std::optional<CORE_ADDR>
-svr4_find_solib_addr (solib &so)
+int
+svr4_solib_ops::find_solib_ns (const solib &so) const
{
- auto *li = gdb::checked_static_cast<lm_info_svr4 *> (so.lm_info.get ());
- return li->l_addr_inferior;
+ CORE_ADDR debug_base = find_debug_base_for_solib (&so);
+ svr4_info *info = get_svr4_info (current_program_space);
+ for (int i = 0; i < info->namespace_id.size (); i++)
+ {
+ if (info->namespace_id[i] == debug_base)
+ {
+ gdb_assert (info->active_namespaces.count (i) == 1);
+ return i;
+ }
+ }
+ error (_("No namespace found"));
}
-const struct solib_ops svr4_so_ops =
+int
+svr4_solib_ops::num_active_namespaces () const
{
- svr4_relocate_section_addresses,
- svr4_clear_so,
- svr4_clear_solib,
- svr4_solib_create_inferior_hook,
- svr4_current_sos,
- open_symbol_file_object,
- svr4_in_dynsym_resolve_code,
- solib_bfd_open,
- svr4_same,
- svr4_keep_data_in_core,
- svr4_update_solib_event_breakpoints,
- svr4_handle_solib_event,
- svr4_find_solib_addr,
-};
+ svr4_info *info = get_svr4_info (current_program_space);
+ return info->active_namespaces.size ();
+}
-void _initialize_svr4_solib ();
-void
-_initialize_svr4_solib ()
+std::vector<const solib *>
+svr4_solib_ops::get_solibs_in_ns (int nsid) const
+{
+ std::vector<const solib*> ns_solibs;
+ svr4_info *info = get_svr4_info (current_program_space);
+
+ /* If the namespace ID is inactive, there will be no active
+ libraries, so we can have an early exit, as a treat. */
+ if (info->active_namespaces.count (nsid) != 1)
+ return ns_solibs;
+
+ /* Since we only have the names of solibs in a given namespace,
+ we'll need to walk through the solib list of the inferior and
+ find which solib objects correspond to which svr4_so. We create
+ an unordered map with the names and lm_info to check things
+ faster, and to be able to remove SOs from the map, to avoid
+ returning the dynamic linker multiple times. */
+ CORE_ADDR debug_base = info->namespace_id[nsid];
+ std::unordered_map<std::string, const lm_info_svr4 *> namespace_solibs;
+ for (svr4_so &so : info->solib_lists[debug_base])
+ namespace_solibs[so.name] = so.lm_info.get ();
+
+ for (const solib &so: current_program_space->solibs ())
+ {
+ auto &lm_inferior = get_lm_info_svr4 (so);
+
+ /* This is inspired by the svr4_same, by finding the svr4_so object
+ in the map, and then double checking if the lm_info is considered
+ the same. */
+ if (namespace_solibs.count (so.original_name) > 0
+ && (namespace_solibs[so.original_name]->l_addr_inferior
+ == lm_inferior.l_addr_inferior))
+ {
+ ns_solibs.push_back (&so);
+ /* Remove the SO from the map, so that we don't end up
+ printing the dynamic linker multiple times. */
+ namespace_solibs.erase (so.original_name);
+ }
+ }
+
+ return ns_solibs;
+}
+
+INIT_GDB_FILE (svr4_solib)
{
gdb::observers::free_objfile.attach (svr4_free_objfile_observer,
"solib-svr4");
+
+ /* Set up observers for tracking GLIBC TLS module id slots. */
+ gdb::observers::solib_loaded.attach (tls_maybe_fill_slot, "solib-svr4");
+ gdb::observers::solib_unloaded.attach (tls_maybe_erase_slot, "solib-svr4");
}
diff --git a/gdb/solib-svr4.h b/gdb/solib-svr4.h
index 37cdaff..7b38ff4 100644
--- a/gdb/solib-svr4.h
+++ b/gdb/solib-svr4.h
@@ -1,6 +1,6 @@
/* Handle shared libraries for GDB, the GNU Debugger.
- Copyright (C) 2000-2024 Free Software Foundation, Inc.
+ Copyright (C) 2000-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,17 +20,24 @@
#ifndef GDB_SOLIB_SVR4_H
#define GDB_SOLIB_SVR4_H
-#include "solist.h"
+#include "gdbarch.h"
+#include "solib.h"
struct objfile;
-struct solib_ops;
+struct link_map_offsets;
+struct probe_and_action;
+struct svr4_info;
+struct svr4_library_list;
+struct svr4_so;
-extern const solib_ops svr4_so_ops;
-
-/* Link map info to include in an allocated so_list entry. */
+/* Link map info to include in an allocated solib entry. */
struct lm_info_svr4 final : public lm_info
{
+ explicit lm_info_svr4 (CORE_ADDR debug_base)
+ : debug_base (debug_base)
+ {}
+
/* Amount by which addresses in the binary should be relocated to
match the inferior. The direct inferior value is L_ADDR_INFERIOR.
When prelinking is involved and the prelink base address changes,
@@ -46,10 +53,121 @@ struct lm_info_svr4 final : public lm_info
/* Values read in from inferior's fields of the same name. */
CORE_ADDR l_ld = 0, l_next = 0, l_prev = 0, l_name = 0;
+
+ /* The address of the dynamic linker structure (r_debug) this solib comes
+ from. This identifies which namespace this library is in.
+
+ This field can be 0 in the following situations:
+
+ - we receive the libraries through XML from an old gdbserver that
+ doesn't include the "lmid" field
+ - the default debug base is not yet known
+
+ In other cases, this field should have a sensible value. */
+ CORE_ADDR debug_base;
};
using lm_info_svr4_up = std::unique_ptr<lm_info_svr4>;
+/* What to do when a probe stop occurs. */
+
+enum probe_action
+{
+ /* Something went seriously wrong. Stop using probes and
+ revert to using the older interface. */
+ PROBES_INTERFACE_FAILED,
+
+ /* No action is required. The shared object list is still
+ valid. */
+ DO_NOTHING,
+
+ /* The shared object list should be reloaded entirely. */
+ FULL_RELOAD,
+
+ /* Attempt to incrementally update the shared object list. If
+ the update fails or is not possible, fall back to reloading
+ the list in full. */
+ UPDATE_OR_RELOAD,
+};
+
+/* solib_ops for SVR4 systems. */
+
+struct svr4_solib_ops : public solib_ops
+{
+ using solib_ops::solib_ops;
+
+ void relocate_section_addresses (solib &so, target_section *) const override;
+ void clear_so (const solib &so) const override;
+ void clear_solib (program_space *pspace) const override;
+ void create_inferior_hook (int from_tty) const override;
+ owning_intrusive_list<solib> current_sos () const override;
+ bool open_symbol_file_object (int from_tty) const override;
+ bool in_dynsym_resolve_code (CORE_ADDR pc) const override;
+ bool same (const solib &gdb, const solib &inferior) const override;
+ bool keep_data_in_core (CORE_ADDR vaddr, unsigned long size) const override;
+ void update_breakpoints () const override;
+ void handle_event () const override;
+ std::optional<CORE_ADDR> find_solib_addr (solib &so) const override;
+ bool supports_namespaces () const override { return true; }
+ int find_solib_ns (const solib &so) const override;
+ int num_active_namespaces () const override;
+ std::vector<const solib *> get_solibs_in_ns (int nsid) const override;
+ void iterate_over_objfiles_in_search_order
+ (iterate_over_objfiles_in_search_order_cb_ftype cb,
+ objfile *current_objfile) const override;
+
+ /* Return the appropriate link map offsets table for the architecture. */
+ virtual link_map_offsets *fetch_link_map_offsets () const = 0;
+
+ /* This needs to be public because it's accessed from an observer. */
+ void current_sos_direct (svr4_info *info) const;
+
+private:
+ void create_probe_breakpoints (svr4_info *info, gdbarch *gdbarch,
+ const std::vector<probe *> *probes,
+ objfile *objfile) const;
+ bool find_and_create_probe_breakpoints (svr4_info *info, gdbarch *gdbarch,
+ obj_section *os,
+ bool with_prefix) const;
+ void create_event_breakpoints (svr4_info *info, gdbarch *gdbarch,
+ CORE_ADDR address) const;
+ int enable_break (svr4_info *info, int from_tty) const;
+ void free_probes_table (svr4_info *info) const;
+ CORE_ADDR find_r_brk (svr4_info *info) const;
+ CORE_ADDR find_r_ldsomap (svr4_info *info) const;
+ owning_intrusive_list<solib> default_sos (svr4_info *info) const;
+ int read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
+ CORE_ADDR debug_base, std::vector<svr4_so> &sos,
+ int ignore_first) const;
+ lm_info_svr4_up read_lm_info (CORE_ADDR lm_addr, CORE_ADDR debug_base) const;
+ int has_lm_dynamic_from_link_map () const;
+ CORE_ADDR lm_addr_check (const solib &so, bfd *abfd) const;
+ CORE_ADDR read_r_next (CORE_ADDR debug_base) const;
+ CORE_ADDR read_r_map (CORE_ADDR debug_base) const;
+ owning_intrusive_list<solib> collect_probes_sos (svr4_info *info) const;
+ owning_intrusive_list<solib> current_sos_1 (svr4_info *info) const;
+ owning_intrusive_list<solib> solibs_from_svr4_sos
+ (const std::vector<svr4_so> &sos) const;
+ void disable_probes_interface (svr4_info *info) const;
+ void update_full (svr4_info *info) const;
+ int update_incremental (svr4_info *info, CORE_ADDR debug_base,
+ CORE_ADDR lm) const;
+ bool update_event_breakpoint (breakpoint *b) const;
+
+ /* Return the base address of the dynamic linker structure for the default
+ namespace. */
+ CORE_ADDR default_debug_base (svr4_info *info, bool *changed = nullptr) const;
+};
+
+/* solib_ops for ILP32 SVR4 systems. */
+
+struct ilp32_svr4_solib_ops : public svr4_solib_ops
+{
+ using svr4_solib_ops::svr4_solib_ops;
+
+ link_map_offsets *fetch_link_map_offsets () const override;
+};
+
/* Critical offsets and sizes which describe struct r_debug and
struct link_map on SVR4-like targets. All offsets and sizes are
in bytes unless otherwise specified. */
@@ -91,25 +209,33 @@ struct link_map_offsets
int l_name_offset;
};
-/* set_solib_svr4_fetch_link_map_offsets() is intended to be called by
- a <arch>_gdbarch_init() function. It is used to establish an
- architecture specific link_map_offsets fetcher for the architecture
- being defined. */
+/* Set the gdbarch methods for SVR4 systems. */
-extern void set_solib_svr4_fetch_link_map_offsets
- (struct gdbarch *gdbarch, struct link_map_offsets *(*func) (void));
+extern void set_solib_svr4_ops (gdbarch *gdbarch,
+ gdbarch_make_solib_ops_ftype make_solib_ops);
/* This function is called by thread_db.c. Return the address of the
link map for the given objfile. */
extern CORE_ADDR svr4_fetch_objfile_link_map (struct objfile *objfile);
-/* Fetch (and possibly build) an appropriate `struct link_map_offsets'
- for ILP32 and LP64 SVR4 systems. */
-extern struct link_map_offsets *svr4_ilp32_fetch_link_map_offsets (void);
-extern struct link_map_offsets *svr4_lp64_fetch_link_map_offsets (void);
+/* Return a new solib_ops for ILP32 SVR4 systems. */
+
+extern solib_ops_up make_svr4_ilp32_solib_ops (program_space *pspace);
+
+/* Return a new solib_ops for LP64 SVR4 systems. */
+
+extern solib_ops_up make_svr4_lp64_solib_ops (program_space *pspace);
+
+/* For the MUSL C library, given link map address LM_ADDR, return the
+ corresponding TLS module id, or 0 if not found. */
+int musl_link_map_to_tls_module_id (CORE_ADDR lm_addr);
+
+/* For GLIBC, given link map address LM_ADDR, return the corresponding TLS
+ module id, or 0 if not found. */
+int glibc_link_map_to_tls_module_id (CORE_ADDR lm_addr);
+
+/* Return program interpreter string. */
-/* Return 1 if PC lies in the dynamic symbol resolution code of the
- SVR4 run time loader. */
-int svr4_in_dynsym_resolve_code (CORE_ADDR pc);
+std::optional<gdb::byte_vector> svr4_find_program_interpreter ();
#endif /* GDB_SOLIB_SVR4_H */
diff --git a/gdb/solib-target.c b/gdb/solib-target.c
index 8f73d5d..2ae25a8 100644
--- a/gdb/solib-target.c
+++ b/gdb/solib-target.c
@@ -1,6 +1,6 @@
/* Definitions for targets which report shared library events.
- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+ Copyright (C) 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "objfiles.h"
-#include "solist.h"
+#include "solib.h"
#include "symtab.h"
#include "symfile.h"
#include "target.h"
@@ -29,10 +29,6 @@
/* Private data for each loaded library. */
struct lm_info_target final : public lm_info
{
- /* The library's name. The name is normally kept in the struct
- so_list; it is only here during XML parsing. */
- std::string name;
-
/* The target can either specify segment bases or section bases, not
both. */
@@ -51,9 +47,18 @@ struct lm_info_target final : public lm_info
using lm_info_target_up = std::unique_ptr<lm_info_target>;
+/* Type used to convey the information about one target library while parsing
+ the XML. */
+
+struct target_library
+{
+ std::string name;
+ lm_info_target_up info;
+};
+
#if !defined(HAVE_LIBEXPAT)
-static std::vector<lm_info_target_up>
+static std::vector<target_library>
solib_target_parse_libraries (const char *library)
{
static int have_warned;
@@ -80,17 +85,17 @@ library_list_start_segment (struct gdb_xml_parser *parser,
void *user_data,
std::vector<gdb_xml_value> &attributes)
{
- auto *list = (std::vector<lm_info_target_up> *) user_data;
- lm_info_target *last = list->back ().get ();
+ const auto list = static_cast<std::vector<target_library> *> (user_data);
+ target_library &last = list->back ();
ULONGEST *address_p
= (ULONGEST *) xml_find_attribute (attributes, "address")->value.get ();
CORE_ADDR address = (CORE_ADDR) *address_p;
- if (!last->section_bases.empty ())
+ if (!last.info->section_bases.empty ())
gdb_xml_error (parser,
_("Library list with both segments and sections"));
- last->segment_bases.push_back (address);
+ last.info->segment_bases.push_back (address);
}
static void
@@ -99,17 +104,17 @@ library_list_start_section (struct gdb_xml_parser *parser,
void *user_data,
std::vector<gdb_xml_value> &attributes)
{
- auto *list = (std::vector<lm_info_target_up> *) user_data;
- lm_info_target *last = list->back ().get ();
+ const auto list = static_cast<std::vector<target_library> *> (user_data);
+ target_library &last = list->back ();
ULONGEST *address_p
= (ULONGEST *) xml_find_attribute (attributes, "address")->value.get ();
CORE_ADDR address = (CORE_ADDR) *address_p;
- if (!last->segment_bases.empty ())
+ if (!last.info->segment_bases.empty ())
gdb_xml_error (parser,
_("Library list with both segments and sections"));
- last->section_bases.push_back (address);
+ last.info->section_bases.push_back (address);
}
/* Handle the start of a <library> element. */
@@ -120,12 +125,12 @@ library_list_start_library (struct gdb_xml_parser *parser,
void *user_data,
std::vector<gdb_xml_value> &attributes)
{
- auto *list = (std::vector<lm_info_target_up> *) user_data;
- lm_info_target *item = new lm_info_target;
- item->name
+ const auto list = static_cast<std::vector<target_library> *> (user_data);
+ std::string name
= (const char *) xml_find_attribute (attributes, "name")->value.get ();
- list->emplace_back (item);
+ list->emplace_back (target_library { std::move (name),
+ std::make_unique<lm_info_target> () });
}
static void
@@ -133,10 +138,10 @@ library_list_end_library (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
void *user_data, const char *body_text)
{
- auto *list = (std::vector<lm_info_target_up> *) user_data;
- lm_info_target *lm_info = list->back ().get ();
+ const auto list = static_cast<std::vector<target_library> *> (user_data);
+ target_library &last = list->back ();
- if (lm_info->segment_bases.empty () && lm_info->section_bases.empty ())
+ if (last.info->segment_bases.empty () && last.info->section_bases.empty ())
gdb_xml_error (parser, _("No segment or section bases defined"));
}
@@ -209,10 +214,10 @@ static const struct gdb_xml_element library_list_elements[] = {
{ NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
};
-static std::vector<lm_info_target_up>
+static std::vector<target_library>
solib_target_parse_libraries (const char *library)
{
- std::vector<lm_info_target_up> result;
+ std::vector<target_library> result;
if (gdb_xml_parse_quick (_("target library list"), "library-list.dtd",
library_list_elements, library, &result) == 0)
@@ -226,8 +231,8 @@ solib_target_parse_libraries (const char *library)
}
#endif
-static owning_intrusive_list<solib>
-solib_target_current_sos (void)
+owning_intrusive_list<solib>
+target_solib_ops::current_sos () const
{
owning_intrusive_list<solib> sos;
@@ -239,31 +244,20 @@ solib_target_current_sos (void)
return {};
/* Parse the list. */
- std::vector<lm_info_target_up> library_list
+ std::vector<target_library> library_list
= solib_target_parse_libraries (library_document->data ());
/* Build a struct solib for each entry on the list. */
- for (lm_info_target_up &info : library_list)
- {
- auto &new_solib = sos.emplace_back ();
-
- /* We don't need a copy of the name in INFO anymore. */
- new_solib.so_name = std::move (info->name);
- new_solib.so_original_name = new_solib.so_name;
- new_solib.lm_info = std::move (info);
- }
+ for (auto &library : library_list)
+ sos.emplace_back (std::move (library.info), library.name, library.name,
+ *this);
return sos;
}
-static void
-solib_target_solib_create_inferior_hook (int from_tty)
-{
- /* Nothing needed. */
-}
-
-static void
-solib_target_relocate_section_addresses (solib &so, target_section *sec)
+void
+target_solib_ops::relocate_section_addresses (solib &so,
+ target_section *sec) const
{
CORE_ADDR offset;
auto *li = gdb::checked_static_cast<lm_info_target *> (so.lm_info.get ());
@@ -291,7 +285,7 @@ solib_target_relocate_section_addresses (solib &so, target_section *sec)
if (num_alloc_sections != li->section_bases.size ())
warning (_("\
Could not relocate shared library \"%s\": wrong number of ALLOC sections"),
- so.so_name.c_str ());
+ so.name.c_str ());
else
{
int bases_index = 0;
@@ -334,7 +328,7 @@ Could not relocate shared library \"%s\": wrong number of ALLOC sections"),
if (data == NULL)
warning (_("\
-Could not relocate shared library \"%s\": no segments"), so.so_name.c_str ());
+Could not relocate shared library \"%s\": no segments"), so.name.c_str ());
else
{
ULONGEST orig_delta;
@@ -345,7 +339,7 @@ Could not relocate shared library \"%s\": no segments"), so.so_name.c_str ());
li->segment_bases.size (),
li->segment_bases.data ()))
warning (_("\
-Could not relocate shared library \"%s\": bad offsets"), so.so_name.c_str ());
+Could not relocate shared library \"%s\": bad offsets"), so.name.c_str ());
/* Find the range of addresses to report for this library in
"info sharedlibrary". Report any consecutive segments
@@ -382,16 +376,8 @@ Could not relocate shared library \"%s\": bad offsets"), so.so_name.c_str ());
sec->endaddr += offset;
}
-static int
-solib_target_open_symbol_file_object (int from_tty)
-{
- /* We can't locate the main symbol file based on the target's
- knowledge; the user has to specify it. */
- return 0;
-}
-
-static int
-solib_target_in_dynsym_resolve_code (CORE_ADDR pc)
+bool
+target_solib_ops::in_dynsym_resolve_code (CORE_ADDR pc) const
{
/* We don't have a range of addresses for the dynamic linker; there
may not be one in the program's address space. So only report
@@ -399,19 +385,10 @@ solib_target_in_dynsym_resolve_code (CORE_ADDR pc)
return in_plt_section (pc);
}
-const solib_ops solib_target_so_ops =
+/* See solib-target.h. */
+
+solib_ops_up
+make_target_solib_ops (program_space *pspace)
{
- solib_target_relocate_section_addresses,
- nullptr,
- nullptr,
- solib_target_solib_create_inferior_hook,
- solib_target_current_sos,
- solib_target_open_symbol_file_object,
- solib_target_in_dynsym_resolve_code,
- solib_bfd_open,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- default_find_solib_addr,
-};
+ return std::make_unique<target_solib_ops> (pspace);
+}
diff --git a/gdb/solib-target.h b/gdb/solib-target.h
index f03e221..4b8f2d6 100644
--- a/gdb/solib-target.h
+++ b/gdb/solib-target.h
@@ -1,6 +1,6 @@
/* Handle shared libraries for GDB, the GNU Debugger.
- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+ Copyright (C) 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,7 +20,21 @@
#ifndef GDB_SOLIB_TARGET_H
#define GDB_SOLIB_TARGET_H
-struct solib_ops;
-extern const solib_ops solib_target_so_ops;
+#include "solib.h"
+
+/* solib_ops for systems fetching solibs from the target. */
+
+struct target_solib_ops : solib_ops
+{
+ using solib_ops::solib_ops;
+
+ void relocate_section_addresses (solib &so, target_section *) const override;
+ owning_intrusive_list<solib> current_sos () const override;
+ bool in_dynsym_resolve_code (CORE_ADDR pc) const override;
+};
+
+/* Return a new solib_ops for systems fetching solibs from the target. */
+
+solib_ops_up make_target_solib_ops (program_space *pspace);
#endif /* GDB_SOLIB_TARGET_H */
diff --git a/gdb/solib.c b/gdb/solib.c
index 0bbcb02..e790ef0 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1,6 +1,6 @@
/* Handle shared libraries for GDB, the GNU Debugger.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -37,7 +37,6 @@
#include "elf/common.h"
#include "filenames.h"
#include "exec.h"
-#include "solist.h"
#include "observable.h"
#include "readline/tilde.h"
#include "solib.h"
@@ -63,12 +62,12 @@ show_solib_search_path (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _ ("The search path for loading non-absolute "
- "shared library symbol files is %s.\n"),
+ _("The search path for loading non-absolute "
+ "shared library symbol files is %s.\n"),
value);
}
-/* Same as HAVE_DOS_BASED_FILE_SYSTEM, but useable as an rvalue. */
+/* Same as HAVE_DOS_BASED_FILE_SYSTEM, but usable as an rvalue. */
#if (HAVE_DOS_BASED_FILE_SYSTEM)
#define DOS_BASED_FILE_SYSTEM 1
#else
@@ -421,7 +420,7 @@ solib_bfd_fopen (const char *pathname, int fd)
if (abfd == NULL)
{
/* Arrange to free PATHNAME when the error is thrown. */
- error (_ ("Could not open `%s' as an executable file: %s"), pathname,
+ error (_("Could not open `%s' as an executable file: %s"), pathname,
bfd_errmsg (bfd_get_error ()));
}
@@ -454,20 +453,38 @@ solib_bfd_open (const char *pathname)
/* Check bfd format. */
if (!bfd_check_format (abfd.get (), bfd_object))
- error (_ ("`%s': not in executable format: %s"),
+ error (_("`%s': not in executable format: %s"),
bfd_get_filename (abfd.get ()), bfd_errmsg (bfd_get_error ()));
/* Check bfd arch. */
b = gdbarch_bfd_arch_info (current_inferior ()->arch ());
if (!b->compatible (b, bfd_get_arch_info (abfd.get ())))
- error (_ ("`%s': Shared library architecture %s is not compatible "
- "with target architecture %s."),
+ error (_("`%s': Shared library architecture %s is not compatible "
+ "with target architecture %s."),
bfd_get_filename (abfd.get ()),
bfd_get_arch_info (abfd.get ())->printable_name, b->printable_name);
return abfd;
}
+gdb_bfd_ref_ptr
+solib_ops::bfd_open (const char *pathname) const
+{
+ return solib_bfd_open (pathname);
+}
+
+/* See solib.h. */
+
+void
+solib_ops::iterate_over_objfiles_in_search_order
+ (iterate_over_objfiles_in_search_order_cb_ftype cb,
+ objfile *current_objfile) const
+{
+ for (objfile &objfile : m_pspace->objfiles ())
+ if (cb (&objfile))
+ return;
+}
+
/* Given a pointer to one of the shared objects in our list of mapped
objects, use the recorded name to open a bfd descriptor for the
object, build a section table, relocate all the section addresses
@@ -483,10 +500,8 @@ solib_bfd_open (const char *pathname)
static int
solib_map_sections (solib &so)
{
- const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
-
- gdb::unique_xmalloc_ptr<char> filename (tilde_expand (so.so_name.c_str ()));
- gdb_bfd_ref_ptr abfd (ops->bfd_open (filename.get ()));
+ gdb::unique_xmalloc_ptr<char> filename (tilde_expand (so.name.c_str ()));
+ gdb_bfd_ref_ptr abfd (so.ops ().bfd_open (filename.get ()));
/* If we have a core target then the core target might have some helpful
information (i.e. build-ids) about the shared libraries we are trying
@@ -496,9 +511,9 @@ solib_map_sections (solib &so)
If we don't have a core target then this will return an empty struct
with no hint information, we then lookup the shared library based on
its filename. */
- std::optional<CORE_ADDR> solib_addr = ops->find_solib_addr (so);
+ std::optional<CORE_ADDR> solib_addr = so.ops ().find_solib_addr (so);
std::optional <const core_target_mapped_file_info> mapped_file_info
- = core_target_find_mapped_file (so.so_name.c_str (), solib_addr);
+ = core_target_find_mapped_file (so.name.c_str (), solib_addr);
/* If we already know the build-id of this solib from a core file, verify
it matches ABFD's build-id. If there is a mismatch or the solib wasn't
@@ -520,18 +535,18 @@ solib_map_sections (solib &so)
However, if it was good enough during the mapped file
processing, we assume it's good enough now. */
if (!mapped_file_info->filename ().empty ())
- abfd = ops->bfd_open (mapped_file_info->filename ().c_str ());
+ abfd = so.ops ().bfd_open (mapped_file_info->filename ().c_str ());
else
abfd = nullptr;
if (abfd == nullptr)
abfd = find_objfile_by_build_id (current_program_space,
mapped_file_info->build_id (),
- so.so_name.c_str ());
+ so.name.c_str ());
if (abfd == nullptr && mismatch)
{
- warning (_ ("Build-id of %ps does not match core file."),
+ warning (_("Build-id of %ps does not match core file."),
styled_string (file_name_style.style (),
filename.get ()));
abfd = nullptr;
@@ -545,14 +560,14 @@ solib_map_sections (solib &so)
/* Leave bfd open, core_xfer_memory and "info files" need it. */
so.abfd = std::move (abfd);
- /* Copy the full path name into so_name, allowing symbol_file_add
+ /* Copy the full path name into `so.name`, allowing symbol_file_add
to find it later. This also affects the =library-loaded GDB/MI
event, and in particular the part of that notification providing
the library's host-side path. If we let the target dictate
that objfile's path, and the target is different from the host,
GDB/MI will not provide the correct host-side path. */
- so.so_name = bfd_get_filename (so.abfd.get ());
+ so.name = bfd_get_filename (so.abfd.get ());
so.sections = build_section_table (so.abfd.get ());
for (target_section &p : so.sections)
@@ -560,7 +575,7 @@ solib_map_sections (solib &so)
/* Relocate the section binding addresses as recorded in the shared
object's file by the base address to which the object was actually
mapped. */
- ops->relocate_section_addresses (so, &p);
+ so.ops ().relocate_section_addresses (so, &p);
/* If the target didn't provide information about the address
range of the shared object, assume we want the location of
@@ -582,13 +597,11 @@ solib_map_sections (solib &so)
return 1;
}
-/* See solist.h. */
+/* See solib.h. */
void
solib::clear ()
{
- const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
-
this->sections.clear ();
this->abfd = nullptr;
@@ -600,11 +613,10 @@ solib::clear ()
/* Restore the target-supplied file name. SO_NAME may be the path
of the symbol file. */
- this->so_name = this->so_original_name;
+ this->name = this->original_name;
/* Do the same for target-specific data. */
- if (ops->clear_so != NULL)
- ops->clear_so (*this);
+ this->ops ().clear_so (*this);
}
lm_info::~lm_info () = default;
@@ -632,23 +644,20 @@ solib_read_symbols (solib &so, symfile_add_flags flags)
{
/* Have we already loaded this shared object? */
so.objfile = nullptr;
- for (objfile *objfile : current_program_space->objfiles ())
- {
- if (filename_cmp (objfile_name (objfile), so.so_name.c_str ())
- == 0
- && objfile->addr_low == so.addr_low)
- {
- so.objfile = objfile;
- break;
- }
- }
+ for (objfile &objfile : current_program_space->objfiles ())
+ if (objfile.addr_low == so.addr_low)
+ {
+ so.objfile = &objfile;
+ break;
+ }
+
if (so.objfile == NULL)
{
section_addr_info sap
= build_section_addr_info_from_section_table (so.sections);
gdb_bfd_ref_ptr tmp_bfd = so.abfd;
so.objfile
- = symbol_file_add_from_bfd (tmp_bfd, so.so_name.c_str (),
+ = symbol_file_add_from_bfd (tmp_bfd, so.name.c_str (),
flags, &sap, OBJF_SHARED, nullptr);
so.objfile->addr_low = so.addr_low;
}
@@ -658,9 +667,9 @@ solib_read_symbols (solib &so, symfile_add_flags flags)
catch (const gdb_exception_error &e)
{
exception_fprintf (gdb_stderr, e,
- _ ("Error while reading shared"
- " library symbols for %s:\n"),
- so.so_name.c_str ());
+ _("Error while reading shared"
+ " library symbols for %s:\n"),
+ so.name.c_str ());
}
return true;
@@ -712,7 +721,10 @@ notify_solib_unloaded (program_space *pspace, const solib &so,
void
update_solib_list (int from_tty)
{
- const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
+ const solib_ops *ops = current_program_space->solib_ops ();
+
+ if (ops == nullptr)
+ return;
/* We can reach here due to changing solib-search-path or the
sysroot, before having any inferior. */
@@ -724,7 +736,7 @@ update_solib_list (int from_tty)
have not opened a symbol file, we may be able to get its
symbols now! */
if (inf->attach_flag
- && current_program_space->symfile_object_file == NULL)
+ && current_program_space->symfile_object_file == nullptr)
{
try
{
@@ -765,27 +777,16 @@ update_solib_list (int from_tty)
owning_intrusive_list<solib> inferior = ops->current_sos ();
owning_intrusive_list<solib>::iterator gdb_iter
- = current_program_space->so_list.begin ();
- while (gdb_iter != current_program_space->so_list.end ())
+ = current_program_space->solibs ().begin ();
+ while (gdb_iter != current_program_space->solibs ().end ())
{
intrusive_list<solib>::iterator inferior_iter = inferior.begin ();
/* Check to see whether the shared object *gdb also appears in
the inferior's current list. */
for (; inferior_iter != inferior.end (); ++inferior_iter)
- {
- if (ops->same)
- {
- if (ops->same (*gdb_iter, *inferior_iter))
- break;
- }
- else
- {
- if (!filename_cmp (gdb_iter->so_original_name.c_str (),
- inferior_iter->so_original_name.c_str ()))
- break;
- }
- }
+ if (ops->same (*gdb_iter, *inferior_iter))
+ break;
/* If the shared object appears on the inferior's list too, then
it's still loaded, so we don't need to do anything. Delete
@@ -814,13 +815,13 @@ update_solib_list (int from_tty)
&& !still_in_use)
gdb_iter->objfile->unlink ();
- current_program_space->deleted_solibs.push_back (gdb_iter->so_name);
+ current_program_space->deleted_solibs.push_back (gdb_iter->name);
/* Some targets' section tables might be referring to
sections from so.abfd; remove them. */
current_program_space->remove_target_sections (&*gdb_iter);
- gdb_iter = current_program_space->so_list.erase (gdb_iter);
+ gdb_iter = current_program_space->solibs ().erase (gdb_iter);
}
}
@@ -844,15 +845,15 @@ update_solib_list (int from_tty)
{
not_found++;
if (not_found_filename == NULL)
- not_found_filename = new_so.so_original_name.c_str ();
+ not_found_filename = new_so.original_name.c_str ();
}
}
catch (const gdb_exception_error &e)
{
exception_fprintf (gdb_stderr, e,
- _ ("Error while mapping shared "
- "library sections:\n"));
+ _("Error while mapping shared "
+ "library sections:\n"));
}
/* Notify any observer that the shared object has been
@@ -861,7 +862,7 @@ update_solib_list (int from_tty)
}
/* Add the new shared objects to GDB's list. */
- current_program_space->so_list.splice (std::move (inferior));
+ current_program_space->solibs ().splice (std::move (inferior));
/* If a library was not found, issue an appropriate warning
message. We have to use a single call to warning in case the
@@ -871,15 +872,15 @@ update_solib_list (int from_tty)
stand out well. */
if (not_found == 1)
- warning (_ ("Could not load shared library symbols for %ps.\n"
- "Do you need \"%ps\" or \"%ps\"?"),
+ warning (_("Could not load shared library symbols for %ps.\n"
+ "Do you need \"%ps\" or \"%ps\"?"),
styled_string (file_name_style.style (),
not_found_filename),
styled_string (command_style.style (),
"set solib-search-path"),
styled_string (command_style.style (), "set sysroot"));
else if (not_found > 1)
- warning (_ ("\
+ warning (_("\
Could not load shared library symbols for %d libraries, e.g. %ps.\n\
Use the \"%ps\" command to see the complete listing.\n\
Do you need \"%ps\" or \"%ps\"?"),
@@ -918,7 +919,7 @@ libpthread_name_p (const char *name)
static bool
libpthread_solib_p (const solib &so)
{
- return libpthread_name_p (so.so_name.c_str ());
+ return libpthread_name_p (so.name.c_str ());
}
/* Read in symbolic information for any shared objects whose names
@@ -937,11 +938,11 @@ solib_add (const char *pattern, int from_tty, int readsyms)
{
if (pattern != NULL)
{
- gdb_printf (_ ("Loading symbols for shared libraries: %s\n"),
+ gdb_printf (_("Loading symbols for shared libraries: %s\n"),
pattern);
}
else
- gdb_printf (_ ("Loading symbols for shared libraries.\n"));
+ gdb_printf (_("Loading symbols for shared libraries.\n"));
}
current_program_space->solib_add_generation++;
@@ -951,7 +952,7 @@ solib_add (const char *pattern, int from_tty, int readsyms)
char *re_err = re_comp (pattern);
if (re_err)
- error (_ ("Invalid regexp: %s"), re_err);
+ error (_("Invalid regexp: %s"), re_err);
}
update_solib_list (from_tty);
@@ -968,7 +969,7 @@ solib_add (const char *pattern, int from_tty, int readsyms)
add_flags |= SYMFILE_VERBOSE;
for (solib &gdb : current_program_space->solibs ())
- if (!pattern || re_exec (gdb.so_name.c_str ()))
+ if (!pattern || re_exec (gdb.name.c_str ()))
{
/* Normally, we would read the symbols from that library
only if READSYMS is set. However, we're making a small
@@ -985,9 +986,9 @@ solib_add (const char *pattern, int from_tty, int readsyms)
/* If no pattern was given, be quiet for shared
libraries we have already loaded. */
if (pattern && (from_tty || info_verbose))
- gdb_printf (_ ("Symbols already loaded for %ps\n"),
+ gdb_printf (_("Symbols already loaded for %ps\n"),
styled_string (file_name_style.style (),
- gdb.so_name.c_str ()));
+ gdb.name.c_str ()));
}
else if (solib_read_symbols (gdb, add_flags))
loaded_any_symbols = true;
@@ -1010,72 +1011,66 @@ solib_add (const char *pattern, int from_tty, int readsyms)
}
}
-/* Implement the "info sharedlibrary" command. Walk through the
- shared library list and print information about each attached
- library matching PATTERN. If PATTERN is elided, print them
- all. */
+/* Helper function for "info sharedlibrary" and "info namespace".
+ This receives a list of solibs to be printed, and prints a table
+ with all the relevant data. If PRINT_NAMESPACE is true, figure out
+ the solib_ops of the current gdbarch, to calculate the namespace
+ that contains an solib.
+ Returns true if one or more solibs are missing debug information,
+ false otherwise. */
static void
-info_sharedlibrary_command (const char *pattern, int from_tty)
+print_solib_list_table (std::vector<const solib *> solib_list,
+ bool print_namespace)
{
- bool so_missing_debug_info = false;
- int addr_width;
- int nr_libs;
gdbarch *gdbarch = current_inferior ()->arch ();
- struct ui_out *uiout = current_uiout;
-
- if (pattern)
- {
- char *re_err = re_comp (pattern);
-
- if (re_err)
- error (_ ("Invalid regexp: %s"), re_err);
- }
-
/* "0x", a little whitespace, and two hex digits per byte of pointers. */
- addr_width = 4 + (gdbarch_ptr_bit (gdbarch) / 4);
+ int addr_width = 4 + (gdbarch_ptr_bit (gdbarch) / 4);
+ const solib_ops *ops = current_program_space->solib_ops ();
+ struct ui_out *uiout = current_uiout;
+ bool so_missing_debug_info = false;
- update_solib_list (from_tty);
+ if (ops == nullptr)
+ return;
- /* ui_out_emit_table table_emitter needs to know the number of rows,
- so we need to make two passes over the libs. */
+ /* There are 3 conditions for this command to print solib namespaces,
+ first PRINT_NAMESPACE has to be true, second the solib_ops has to
+ support multiple namespaces, and third there must be more than one
+ active namespace. Fold all these into the PRINT_NAMESPACE condition. */
+ print_namespace = (print_namespace
+ && ops != nullptr
+ && ops->supports_namespaces ()
+ && ops->num_active_namespaces () > 1);
- nr_libs = 0;
- for (const solib &so : current_program_space->solibs ())
- {
- if (!so.so_name.empty ())
- {
- if (pattern && !re_exec (so.so_name.c_str ()))
- continue;
- ++nr_libs;
- }
- }
+ int num_cols = 4;
+ if (print_namespace)
+ num_cols++;
{
- ui_out_emit_table table_emitter (uiout, 4, nr_libs, "SharedLibraryTable");
+ ui_out_emit_table table_emitter (uiout, num_cols, solib_list.size (),
+ "SharedLibraryTable");
/* The "- 1" is because ui_out adds one space between columns. */
uiout->table_header (addr_width - 1, ui_left, "from", "From");
uiout->table_header (addr_width - 1, ui_left, "to", "To");
+ if (print_namespace)
+ uiout->table_header (9, ui_left, "namespace", "Linker NS");
uiout->table_header (12 - 1, ui_left, "syms-read", "Syms Read");
uiout->table_header (0, ui_noalign, "name", "Shared Object Library");
uiout->table_body ();
- for (const solib &so : current_program_space->solibs ())
+ for (const solib *so : solib_list)
{
- if (so.so_name.empty ())
- continue;
-
- if (pattern && !re_exec (so.so_name.c_str ()))
+ if (so->name.empty ())
continue;
ui_out_emit_tuple tuple_emitter (uiout, "lib");
- if (so.addr_high != 0)
+ if (so->addr_high != 0)
{
- uiout->field_core_addr ("from", gdbarch, so.addr_low);
- uiout->field_core_addr ("to", gdbarch, so.addr_high);
+ uiout->field_core_addr ("from", gdbarch, so->addr_low);
+ uiout->field_core_addr ("to", gdbarch, so->addr_high);
}
else
{
@@ -1083,33 +1078,167 @@ info_sharedlibrary_command (const char *pattern, int from_tty)
uiout->field_skip ("to");
}
+ if (print_namespace)
+ {
+ try
+ {
+ uiout->field_fmt ("namespace", "%d", ops->find_solib_ns (*so));
+ }
+ catch (const gdb_exception_error &er)
+ {
+ uiout->field_skip ("namespace");
+ }
+ }
+
if (!top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ()
- && so.symbols_loaded && !objfile_has_symbols (so.objfile))
+ && so->symbols_loaded && !so->objfile->has_symbols ())
{
so_missing_debug_info = true;
uiout->field_string ("syms-read", "Yes (*)");
}
else
- uiout->field_string ("syms-read", so.symbols_loaded ? "Yes" : "No");
+ uiout->field_string ("syms-read", so->symbols_loaded ? "Yes" : "No");
- uiout->field_string ("name", so.so_name, file_name_style.style ());
+ uiout->field_string ("name", so->name, file_name_style.style ());
uiout->text ("\n");
}
}
- if (nr_libs == 0)
+ if (so_missing_debug_info)
+ uiout->message (_("(*): Shared library is missing "
+ "debugging information.\n"));
+}
+
+/* Implement the "info sharedlibrary" command. Walk through the
+ shared library list and print information about each attached
+ library matching PATTERN. If PATTERN is elided, print them
+ all. */
+
+static void
+info_sharedlibrary_command (const char *pattern, int from_tty)
+{
+ struct ui_out *uiout = current_uiout;
+
+ if (pattern)
+ {
+ char *re_err = re_comp (pattern);
+
+ if (re_err)
+ error (_("Invalid regexp: %s"), re_err);
+ }
+
+ update_solib_list (from_tty);
+
+ /* ui_out_emit_table table_emitter needs to know the number of rows,
+ so we need to make two passes over the libs. */
+
+ std::vector<const solib *> print_libs;
+ for (const solib &so : current_program_space->solibs ())
+ {
+ if (!so.name.empty ())
+ {
+ if (pattern && !re_exec (so.name.c_str ()))
+ continue;
+ print_libs.push_back (&so);
+ }
+ }
+
+ print_solib_list_table (print_libs, true);
+
+ if (print_libs.size () == 0)
{
if (pattern)
- uiout->message (_ ("No shared libraries matched.\n"));
+ uiout->message (_("No shared libraries matched.\n"));
else
- uiout->message (_ ("No shared libraries loaded at this time.\n"));
+ uiout->message (_("No shared libraries loaded at this time.\n"));
+ }
+}
+
+/* Implement the "info linker-namespaces" command. If the current
+ gdbarch's solib_ops object does not support multiple namespaces,
+ this command would just look like "info sharedlibrary", so point
+ the user to that command instead.
+ If solib_ops does support multiple namespaces, this command
+ will group the libraries by linker namespace, or only print the
+ libraries in the supplied namespace. */
+static void
+info_linker_namespace_command (const char *pattern, int from_tty)
+{
+ const solib_ops *ops = current_program_space->solib_ops ();
+
+ /* This command only really makes sense for inferiors that support
+ linker namespaces, so we can leave early. */
+ if (ops == nullptr || !ops->supports_namespaces ())
+ error (_("Current inferior does not support linker namespaces. "
+ "Use \"info sharedlibrary\" instead."));
+
+ struct ui_out *uiout = current_uiout;
+ std::vector<std::pair<int, std::vector<const solib *>>> all_solibs_to_print;
+
+ pattern = skip_spaces (pattern);
+
+ if (pattern == nullptr || pattern[0] == '\0')
+ {
+ uiout->message (_("There are %d linker namespaces loaded.\n"),
+ ops->num_active_namespaces ());
+
+ int printed = 0;
+ for (int i = 0; printed < ops->num_active_namespaces (); i++)
+ {
+ std::vector<const solib *> solibs_to_print
+ = ops->get_solibs_in_ns (i);
+ if (solibs_to_print.size () > 0)
+ {
+ all_solibs_to_print.push_back (std::make_pair
+ (i, solibs_to_print));
+ printed++;
+ }
+ }
}
else
{
- if (so_missing_debug_info)
- uiout->message (_ ("(*): Shared library is missing "
- "debugging information.\n"));
+ int ns;
+ /* Check if the pattern includes the optional [[ and ]] decorators.
+ To match multiple occurrences, '+' needs to be escaped, and every
+ escape sequence must be doubled to survive the compiler pass. */
+ re_comp ("^\\[\\[[0-9]\\+\\]\\]$");
+ if (re_exec (pattern))
+ ns = strtol (pattern + 2, nullptr, 10);
+ else
+ {
+ char *end = nullptr;
+ ns = strtol (pattern, &end, 10);
+ if (end[0] != '\0')
+ error (_("Invalid linker namespace identifier: %s"), pattern);
+ }
+
+ all_solibs_to_print.push_back
+ (std::make_pair (ns, ops->get_solibs_in_ns (ns)));
+ }
+
+ for (const auto &[ns, solibs_to_print] : all_solibs_to_print)
+ {
+ uiout->message ("\n");
+
+ if (solibs_to_print.size () == 0)
+ {
+ uiout->message (_("Linker namespace %d is not active.\n"), ns);
+ /* If we got here, a specific namespace was requested, so there
+ will only be one vector. We can leave early. */
+ break;
+ }
+
+ if (solibs_to_print.size () == 1)
+ uiout->message
+ (_("1 library loaded in linker namespace %d:\n"), ns);
+ else
+ uiout->message
+ (_("%zu libraries loaded in linker namespace %d:\n"),
+ solibs_to_print.size (), ns);
+
+
+ print_solib_list_table (solibs_to_print, false);
}
}
@@ -1139,24 +1268,28 @@ solib_contains_address_p (const solib &solib, CORE_ADDR address)
const char *
solib_name_from_address (struct program_space *pspace, CORE_ADDR address)
{
- for (const solib &so : pspace->so_list)
+ for (const solib &so : pspace->solibs ())
if (solib_contains_address_p (so, address))
- return so.so_name.c_str ();
+ return so.name.c_str ();
return nullptr;
}
+bool
+solib_ops::same (const solib &a, const solib &b) const
+{
+ return (filename_cmp (a.original_name.c_str (), b.original_name.c_str ())
+ == 0);
+}
+
/* See solib.h. */
bool
solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
{
- const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
+ const solib_ops *ops = current_program_space->solib_ops ();
- if (ops->keep_data_in_core)
- return ops->keep_data_in_core (vaddr, size) != 0;
- else
- return false;
+ return ops != nullptr && ops->keep_data_in_core (vaddr, size);
}
/* See solib.h. */
@@ -1164,9 +1297,7 @@ solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
void
clear_solib (program_space *pspace)
{
- const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
-
- for (solib &so : pspace->so_list)
+ for (solib &so : pspace->solibs ())
{
bool still_in_use
= (so.objfile != nullptr && solib_used (pspace, so));
@@ -1175,9 +1306,10 @@ clear_solib (program_space *pspace)
pspace->remove_target_sections (&so);
};
- pspace->so_list.clear ();
+ pspace->solibs ().clear ();
- if (ops->clear_solib != nullptr)
+ if (const solib_ops *ops = pspace->solib_ops ();
+ ops != nullptr)
ops->clear_solib (pspace);
}
@@ -1189,9 +1321,9 @@ clear_solib (program_space *pspace)
void
solib_create_inferior_hook (int from_tty)
{
- const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
-
- ops->solib_create_inferior_hook (from_tty);
+ if (const solib_ops *ops = current_program_space->solib_ops ();
+ ops != nullptr)
+ ops->create_inferior_hook (from_tty);
}
/* See solib.h. */
@@ -1199,9 +1331,9 @@ solib_create_inferior_hook (int from_tty)
bool
in_solib_dynsym_resolve_code (CORE_ADDR pc)
{
- const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
+ const solib_ops *ops = current_program_space->solib_ops ();
- return ops->in_dynsym_resolve_code (pc) != 0;
+ return ops != nullptr && ops->in_dynsym_resolve_code (pc);
}
/* Implements the "sharedlibrary" command. */
@@ -1243,9 +1375,9 @@ no_shared_libraries_command (const char *ignored, int from_tty)
void
update_solib_breakpoints (void)
{
- const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
+ const solib_ops *ops = current_program_space->solib_ops ();
- if (ops->update_breakpoints != NULL)
+ if (ops != nullptr)
ops->update_breakpoints ();
}
@@ -1254,9 +1386,8 @@ update_solib_breakpoints (void)
void
handle_solib_event (void)
{
- const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
-
- if (ops->handle_event != NULL)
+ if (const solib_ops *ops = current_program_space->solib_ops ();
+ ops != nullptr)
ops->handle_event ();
current_inferior ()->pspace->clear_solib_cache ();
@@ -1276,7 +1407,7 @@ static void
reload_shared_libraries_1 (int from_tty)
{
if (print_symbol_loading_p (from_tty, 0, 0))
- gdb_printf (_ ("Loading symbols for shared libraries.\n"));
+ gdb_printf (_("Loading symbols for shared libraries.\n"));
for (solib &so : current_program_space->solibs ())
{
@@ -1288,8 +1419,9 @@ reload_shared_libraries_1 (int from_tty)
add_flags |= SYMFILE_VERBOSE;
gdb::unique_xmalloc_ptr<char> filename (
- tilde_expand (so.so_original_name.c_str ()));
- gdb_bfd_ref_ptr abfd (solib_bfd_open (filename.get ()));
+ tilde_expand (so.original_name.c_str ()));
+
+ gdb_bfd_ref_ptr abfd = so.ops ().bfd_open (filename.get ());
if (abfd != NULL)
found_pathname = bfd_get_filename (abfd.get ());
@@ -1297,7 +1429,7 @@ reload_shared_libraries_1 (int from_tty)
symbol file, close that. */
if ((found_pathname == NULL && was_loaded)
|| (found_pathname != NULL
- && filename_cmp (found_pathname, so.so_name.c_str ()) != 0))
+ && filename_cmp (found_pathname, so.name.c_str ()) != 0))
{
if (so.objfile && !(so.objfile->flags & OBJF_USERLOADED)
&& !solib_used (current_program_space, so))
@@ -1310,7 +1442,7 @@ reload_shared_libraries_1 (int from_tty)
file, open it. */
if (found_pathname != NULL
&& (!was_loaded
- || filename_cmp (found_pathname, so.so_name.c_str ()) != 0))
+ || filename_cmp (found_pathname, so.name.c_str ()) != 0))
{
bool got_error = false;
@@ -1322,8 +1454,8 @@ reload_shared_libraries_1 (int from_tty)
catch (const gdb_exception_error &e)
{
exception_fprintf (gdb_stderr, e,
- _ ("Error while mapping "
- "shared library sections:\n"));
+ _("Error while mapping "
+ "shared library sections:\n"));
got_error = true;
}
@@ -1340,8 +1472,6 @@ reload_shared_libraries (const char *ignored, int from_tty,
{
reload_shared_libraries_1 (from_tty);
- const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
-
/* Creating inferior hooks here has two purposes. First, if we reload
shared libraries then the address of solib breakpoint we've computed
previously might be no longer valid. For example, if we forgot to set
@@ -1354,8 +1484,9 @@ reload_shared_libraries (const char *ignored, int from_tty,
if (target_has_execution ())
{
/* Reset or free private data structures not associated with
- so_list entries. */
- if (ops->clear_solib != nullptr)
+ solib entries. */
+ if (const solib_ops *ops = current_program_space->solib_ops ();
+ ops != nullptr)
ops->clear_solib (current_program_space);
/* Remove any previous solib event breakpoint. This is usually
@@ -1404,9 +1535,9 @@ gdb_sysroot_changed (const char *ignored, int from_tty,
if (!warning_issued)
{
- warning (_ ("\"%s\" is deprecated, use \"%s\" instead."), old_prefix,
+ warning (_("\"%s\" is deprecated, use \"%s\" instead."), old_prefix,
new_prefix);
- warning (_ ("sysroot set to \"%s\"."), gdb_sysroot.c_str ());
+ warning (_("sysroot set to \"%s\"."), gdb_sysroot.c_str ());
warning_issued = true;
}
@@ -1419,7 +1550,7 @@ static void
show_auto_solib_add (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _ ("Autoloading of shared library symbols is %s.\n"),
+ gdb_printf (file, _("Autoloading of shared library symbols is %s.\n"),
value);
}
@@ -1617,8 +1748,8 @@ gdb_bfd_read_elf_soname (const char *filename)
if symbol is not found. */
static CORE_ADDR
-bfd_lookup_symbol_from_dyn_symtab (
- bfd *abfd, gdb::function_view<bool (const asymbol *)> match_sym)
+bfd_lookup_symbol_from_dyn_symtab
+ (bfd *abfd, gdb::function_view<bool (const asymbol *)> match_sym)
{
long storage_needed = bfd_get_dynamic_symtab_upper_bound (abfd);
CORE_ADDR symaddr = 0;
@@ -1682,18 +1813,71 @@ remove_user_added_objfile (struct objfile *objfile)
}
}
-/* See solist.h. */
+/* See solib.h. */
-std::optional<CORE_ADDR>
-default_find_solib_addr (solib &so)
+int
+solib_linker_namespace_count (program_space *pspace)
{
- return {};
+ if (const auto ops = pspace->solib_ops (); ops != nullptr
+ && ops->supports_namespaces ())
+ return ops->num_active_namespaces ();
+
+ return 0;
}
-void _initialize_solib ();
+/* Implementation of the linker_namespace convenience variable.
-void
-_initialize_solib ()
+ This returns the GDB internal identifier of the linker namespace,
+ for the selected frame, as an integer. If the inferior doesn't support
+ linker namespaces, this always returns 0. */
+
+static value *
+linker_namespace_make_value (gdbarch *gdbarch, internalvar *var,
+ void *ignore)
+{
+ int nsid = 0;
+ CORE_ADDR curr_pc = get_frame_pc (get_selected_frame ());
+
+ for (const solib &so : current_program_space->solibs ())
+ if (solib_contains_address_p (so, curr_pc))
+ {
+ if (so.ops ().supports_namespaces ())
+ nsid = so.ops ().find_solib_ns (so);
+
+ break;
+ }
+
+ /* If the PC is not in an SO, or the solib_ops doesn't support
+ linker namespaces, the inferior is in the default namespace. */
+ return value_from_longest (builtin_type (gdbarch)->builtin_int, nsid);
+}
+
+/* Implementation of `$_linker_namespace' variable. */
+
+static const struct internalvar_funcs linker_namespace_funcs =
+{
+ linker_namespace_make_value,
+ nullptr,
+};
+
+static value *
+linker_namespace_count_make_value (gdbarch *gdbarch, internalvar *var,
+ void *ignore)
+{
+ return value_from_longest
+ (builtin_type (gdbarch)->builtin_int,
+ solib_linker_namespace_count (current_program_space));
+}
+
+/* Implementation of `$_linker_namespace_count' variable. */
+
+static const struct internalvar_funcs linker_namespace_count_funcs =
+{
+ linker_namespace_count_make_value,
+ nullptr,
+};
+
+INIT_GDB_FILE (solib)
{
gdb::observers::free_objfile.attach (remove_user_added_objfile, "solib");
gdb::observers::inferior_execd.attach (
@@ -1702,22 +1886,33 @@ _initialize_solib ()
},
"solib");
+ /* Convenience variables for debugging linker namespaces. These are
+ set here, even if the solib_ops doesn't support them,
+ for consistency. */
+ create_internalvar_type_lazy ("_linker_namespace",
+ &linker_namespace_funcs, nullptr);
+ create_internalvar_type_lazy ("_linker_namespace_count",
+ &linker_namespace_count_funcs, nullptr);
+
add_com (
"sharedlibrary", class_files, sharedlibrary_command,
- _ ("Load shared object library symbols for files matching REGEXP."));
+ _("Load shared object library symbols for files matching REGEXP."));
cmd_list_element *info_sharedlibrary_cmd
= add_info ("sharedlibrary", info_sharedlibrary_command,
- _ ("Status of loaded shared object libraries."));
+ _("Status of loaded shared object libraries."));
add_info_alias ("dll", info_sharedlibrary_cmd, 1);
add_com ("nosharedlibrary", class_files, no_shared_libraries_command,
- _ ("Unload all shared object library symbols."));
+ _("Unload all shared object library symbols."));
+
+ add_info ("linker-namespaces", info_linker_namespace_command,
+ _("Get information about linker namespaces in the inferior."));
add_setshow_boolean_cmd ("auto-solib-add", class_support, &auto_solib_add,
- _ ("\
+ _("\
Set autoloading of shared library symbols."),
- _ ("\
+ _("\
Show autoloading of shared library symbols."),
- _ ("\
+ _("\
If \"on\", symbols from all shared object libraries will be loaded\n\
automatically when the inferior begins execution, when the dynamic linker\n\
informs gdb that a new library has been loaded, or when attaching to the\n\
@@ -1727,11 +1922,11 @@ inferior. Otherwise, symbols must be loaded manually, using \
set_show_commands sysroot_cmds
= add_setshow_optional_filename_cmd ("sysroot", class_support,
- &gdb_sysroot, _ ("\
+ &gdb_sysroot, _("\
Set an alternate system root."),
- _ ("\
+ _("\
Show the current system root."),
- _ ("\
+ _("\
The system root is used to load absolute shared library symbol files.\n\
For other (relative) files, you can add directories using\n\
`set solib-search-path'."),
@@ -1744,22 +1939,22 @@ For other (relative) files, you can add directories using\n\
&showlist);
add_setshow_optional_filename_cmd ("solib-search-path", class_support,
- &solib_search_path, _ ("\
+ &solib_search_path, _("\
Set the search path for loading non-absolute shared library symbol files."),
- _ ("\
+ _("\
Show the search path for loading non-absolute shared library symbol files."),
- _ ("\
+ _("\
This takes precedence over the environment variables \
PATH and LD_LIBRARY_PATH."),
reload_shared_libraries,
show_solib_search_path, &setlist,
&showlist);
- add_setshow_boolean_cmd ("solib", class_maintenance, &debug_solib, _ ("\
+ add_setshow_boolean_cmd ("solib", class_maintenance, &debug_solib, _("\
Set solib debugging."),
- _ ("\
+ _("\
Show solib debugging."),
- _ ("\
+ _("\
When true, solib-related debugging output is enabled."),
nullptr, nullptr, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/solib.h b/gdb/solib.h
index 577bcae..85ea667 100644
--- a/gdb/solib.h
+++ b/gdb/solib.h
@@ -1,6 +1,6 @@
/* Shared library declarations for GDB, the GNU Debugger.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,15 +20,14 @@
#ifndef GDB_SOLIB_H
#define GDB_SOLIB_H
-/* Forward decl's for prototypes */
-struct solib;
-struct target_ops;
-struct solib_ops;
-struct program_space;
-
#include "gdb_bfd.h"
-#include "symfile-add-flags.h"
#include "gdbsupport/function-view.h"
+#include "gdbsupport/intrusive_list.h"
+#include "gdbsupport/owning_intrusive_list.h"
+#include "symfile-add-flags.h"
+#include "target-section.h"
+
+struct program_space;
/* Value of the 'set debug solib' configuration variable. */
@@ -42,6 +41,275 @@ extern bool debug_solib;
#define SOLIB_SCOPED_DEBUG_START_END(fmt, ...) \
scoped_debug_start_end (debug_solib, "solib", fmt, ##__VA_ARGS__)
+#define SO_NAME_MAX_PATH_SIZE 512 /* FIXME: Should be dynamic */
+
+/* Base class for target-specific link map information. */
+
+struct lm_info
+{
+ lm_info () = default;
+ lm_info (const lm_info &) = default;
+ virtual ~lm_info () = 0;
+};
+
+using lm_info_up = std::unique_ptr<lm_info>;
+
+struct solib_ops;
+
+struct solib : intrusive_list_node<solib>
+{
+ /* Constructor
+
+ OPS is the solib_ops implementation providing this solib. */
+ explicit solib (lm_info_up lm_info, std::string original_name,
+ std::string name, const solib_ops &ops)
+ : lm_info (std::move (lm_info)),
+ original_name (std::move (original_name)),
+ name (std::move (name)),
+ m_ops (&ops)
+ {}
+
+ /* Return the solib_ops implementation providing this solib. */
+ const solib_ops &ops () const
+ { return *m_ops; }
+
+ /* Free symbol-file related contents of SO and reset for possible reloading
+ of SO. If we have opened a BFD for SO, close it. If we have placed SO's
+ sections in some target's section table, the caller is responsible for
+ removing them.
+
+ This function doesn't mess with objfiles at all. If there is an
+ objfile associated with SO that needs to be removed, the caller is
+ responsible for taking care of that. */
+ void clear () ;
+
+ /* The following fields of the structure come directly from the
+ dynamic linker's tables in the inferior, and are initialized by
+ current_sos. */
+
+ /* A pointer to target specific link map information. Often this
+ will be a copy of struct link_map from the user process, but
+ it need not be; it can be any collection of data needed to
+ traverse the dynamic linker's data structures. */
+ lm_info_up lm_info;
+
+ /* Shared object file name, exactly as it appears in the
+ inferior's link map. This may be a relative path, or something
+ which needs to be looked up in LD_LIBRARY_PATH, etc. We use it
+ to tell which entries in the inferior's dynamic linker's link
+ map we've already loaded. */
+ std::string original_name;
+
+ /* Shared object file name, expanded to something GDB can open. */
+ std::string name;
+
+ /* The following fields of the structure are built from
+ information gathered from the shared object file itself, and
+ are set when we actually add it to our symbol tables.
+
+ current_sos must initialize these fields to 0. */
+
+ gdb_bfd_ref_ptr abfd;
+
+ /* True if symbols have been read in. */
+ bool symbols_loaded = false;
+
+ /* objfile with symbols for a loaded library. Target memory is read from
+ ABFD. OBJFILE may be NULL either before symbols have been loaded, if
+ the file cannot be found or after the command "nosharedlibrary". */
+ struct objfile *objfile = nullptr;
+
+ std::vector<target_section> sections;
+
+ /* Record the range of addresses belonging to this shared library.
+ There may not be just one (e.g. if two segments are relocated
+ differently). This is used for "info sharedlibrary" and
+ the MI command "-file-list-shared-libraries". The latter has a format
+ that supports outputting multiple segments once the related code
+ supports them. */
+ CORE_ADDR addr_low = 0, addr_high = 0;
+
+private:
+ /* The solib_ops responsible for this solib. */
+ const solib_ops *m_ops;
+};
+
+/* A unique pointer to an solib. */
+using solib_up = std::unique_ptr<solib>;
+
+/* Callback type for the 'iterate_over_objfiles_in_search_order'
+ methods. */
+
+using iterate_over_objfiles_in_search_order_cb_ftype
+ = gdb::function_view<bool (objfile *)>;
+
+struct solib_ops
+{
+ explicit solib_ops (program_space *pspace)
+ : m_pspace (pspace)
+ {}
+
+ virtual ~solib_ops () = default;
+
+ /* Adjust the section binding addresses by the base address at
+ which the object was actually mapped. */
+ virtual void relocate_section_addresses (solib &so, target_section *) const
+ = 0;
+
+ /* Reset private data structures associated with SO.
+ This is called when SO is about to be reloaded.
+ It is also called when SO is about to be freed.
+
+ Defaults to no-op. */
+ virtual void clear_so (const solib &so) const {}
+
+ /* Free private data structures associated to PSPACE. This method
+ should not free resources associated to individual solib entries,
+ those are cleared by the clear_so method.
+
+ Defaults to no-op. */
+ virtual void clear_solib (program_space *pspace) const {}
+
+ /* Target dependent code to run after child process fork.
+
+ Defaults to no-op. */
+ virtual void create_inferior_hook (int from_tty) const {};
+
+ /* Construct a list of the currently loaded shared objects. This
+ list does not include an entry for the main executable file.
+
+ Note that we only gather information directly available from the
+ inferior --- we don't examine any of the shared library files
+ themselves. The declaration of `struct solib' says which fields
+ we provide values for. */
+ virtual owning_intrusive_list<solib> current_sos () const = 0;
+
+ /* Find, open, and read the symbols for the main executable. If
+ FROM_TTY is non-zero, allow messages to be printed.
+
+ Return true if this was done successfully. Defaults to false. */
+ virtual bool open_symbol_file_object (int from_tty) const { return false; }
+
+ /* Determine if PC lies in the dynamic symbol resolution code of
+ the run time loader.
+
+ Defaults to false. */
+ virtual bool in_dynsym_resolve_code (CORE_ADDR pc) const
+ { return false; };
+
+ /* Find and open shared library binary file. */
+ virtual gdb_bfd_ref_ptr bfd_open (const char *pathname) const;
+
+ /* Given two solib objects, GDB from the GDB thread list and INFERIOR from the
+ list returned by current_sos, return true if they represent the same library.
+
+ Defaults to comparing the solib original names using filename_cmp. */
+ virtual bool same (const solib &gdb, const solib &inferior) const;
+
+ /* Return whether a region of memory must be kept in a core file
+ for shared libraries loaded before "gcore" is used to be
+ handled correctly when the core file is loaded. This only
+ applies when the section would otherwise not be kept in the
+ core file (in particular, for readonly sections).
+
+ Defaults to false. */
+ virtual bool keep_data_in_core (CORE_ADDR vaddr, unsigned long size) const
+ { return false; };
+
+ /* Enable or disable optional solib event breakpoints as appropriate. This
+ should be called whenever stop_on_solib_events is changed.
+
+ Defaults to no-op. */
+ virtual void update_breakpoints () const {};
+
+ /* Target-specific processing of solib events that will be performed before
+ solib_add is called.
+
+ Defaults to no-op. */
+ virtual void handle_event () const {};
+
+ /* Return an address within the inferior's address space which is known
+ to be part of SO. If there is no such address, or GDB doesn't know
+ how to figure out such an address then an empty optional is
+ returned.
+
+ The returned address can be used when loading the shared libraries
+ for a core file. GDB knows the build-ids for (some) files mapped
+ into the inferior's address space, and knows the address ranges which
+ those mapped files cover. If GDB can figure out a representative
+ address for the library then this can be used to match a library to a
+ mapped file, and thus to a build-id. GDB can then use this
+ information to help locate the shared library objfile, if the objfile
+ is not in the expected place (as defined by the shared libraries file
+ name).
+
+ The default implementation of returns an empty option, indicating GDB is
+ unable to find an address within the library SO. */
+ virtual std::optional<CORE_ADDR> find_solib_addr (solib &so) const
+ { return {}; };
+
+ /* Return true if the linker or libc supports linkage namespaces.
+
+ Defaults to false. */
+ virtual bool supports_namespaces () const { return false; }
+
+ /* Return which linker namespace contains SO.
+
+ The supports_namespaces method must return true for this to be
+ called.
+
+ Throw an error if the namespace can not be determined (such as when we're
+ stepping though the dynamic linker). */
+ virtual int find_solib_ns (const solib &so) const
+ { gdb_assert_not_reached ("namespaces not supported"); }
+
+ /* Returns the number of active namespaces in the inferior.
+
+ The supports_namespaces method must return true for this to be called. */
+ virtual int num_active_namespaces () const
+ { gdb_assert_not_reached ("namespaces not supported"); }
+
+ /* Returns all solibs for a given namespace. If the namespace is not
+ active, returns an empty vector.
+
+ The supports_namespaces method must return true for this to be called. */
+ virtual std::vector<const solib *> get_solibs_in_ns (int ns) const
+ { gdb_assert_not_reached ("namespaces not supported"); }
+
+ /* Iterate over all objfiles of the program space in the order that makes the
+ most sense for the architecture to make global symbol searches.
+
+ CB is a callback function passed an objfile to be searched. The iteration
+ stops if this function returns true.
+
+ If not nullptr, CURRENT_OBJFILE corresponds to the objfile being inspected
+ when the symbol search was requested. */
+ virtual void iterate_over_objfiles_in_search_order
+ (iterate_over_objfiles_in_search_order_cb_ftype cb,
+ objfile *current_objfile) const;
+
+protected:
+ /* The program space for which this solib_ops was created. */
+ program_space *m_pspace;
+};
+
+/* A unique pointer to an solib_ops. */
+using solib_ops_up = std::unique_ptr<solib_ops>;
+
+/* Find main executable binary file. */
+extern gdb::unique_xmalloc_ptr<char> exec_file_find (const char *in_pathname,
+ int *fd);
+
+/* Find shared library binary file. */
+extern gdb::unique_xmalloc_ptr<char> solib_find (const char *in_pathname,
+ int *fd);
+
+/* Open BFD for shared library file. */
+extern gdb_bfd_ref_ptr solib_bfd_fopen (const char *pathname, int fd);
+
+/* Find solib binary file and open it. */
+extern gdb_bfd_ref_ptr solib_bfd_open (const char *in_pathname);
+
/* Called when we free all symtabs of PSPACE, to free the shared library
information as well. */
@@ -89,7 +357,8 @@ extern void no_shared_libraries (program_space *pspace);
Extract the list of currently loaded shared objects from the
inferior, and compare it with the list of shared objects in the
current program space's list of shared libraries. Edit
- so_list_head to bring it in sync with the inferior's new list.
+ the current program space's solib list to bring it in sync with the
+ inferior's new list.
If we notice that the inferior has unloaded some shared objects,
free any symbolic info GDB had read about those shared objects.
@@ -136,4 +405,8 @@ extern void update_solib_breakpoints (void);
extern void handle_solib_event (void);
+/* Calculate the number of linker namespaces active in PSPACE. */
+
+extern int solib_linker_namespace_count (program_space *pspace);
+
#endif /* GDB_SOLIB_H */
diff --git a/gdb/solist.h b/gdb/solist.h
deleted file mode 100644
index 9a157a4..0000000
--- a/gdb/solist.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/* Shared library declarations for GDB, the GNU Debugger.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef GDB_SOLIST_H
-#define GDB_SOLIST_H
-
-#define SO_NAME_MAX_PATH_SIZE 512 /* FIXME: Should be dynamic */
-
-/* For domain_enum domain. */
-#include "symtab.h"
-#include "gdb_bfd.h"
-#include "gdbsupport/owning_intrusive_list.h"
-#include "target-section.h"
-
-/* Base class for target-specific link map information. */
-
-struct lm_info
-{
- lm_info () = default;
- lm_info (const lm_info &) = default;
- virtual ~lm_info () = 0;
-};
-
-using lm_info_up = std::unique_ptr<lm_info>;
-
-struct solib : intrusive_list_node<solib>
-{
- /* Free symbol-file related contents of SO and reset for possible reloading
- of SO. If we have opened a BFD for SO, close it. If we have placed SO's
- sections in some target's section table, the caller is responsible for
- removing them.
-
- This function doesn't mess with objfiles at all. If there is an
- objfile associated with SO that needs to be removed, the caller is
- responsible for taking care of that. */
- void clear () ;
-
- /* The following fields of the structure come directly from the
- dynamic linker's tables in the inferior, and are initialized by
- current_sos. */
-
- /* A pointer to target specific link map information. Often this
- will be a copy of struct link_map from the user process, but
- it need not be; it can be any collection of data needed to
- traverse the dynamic linker's data structures. */
- lm_info_up lm_info;
-
- /* Shared object file name, exactly as it appears in the
- inferior's link map. This may be a relative path, or something
- which needs to be looked up in LD_LIBRARY_PATH, etc. We use it
- to tell which entries in the inferior's dynamic linker's link
- map we've already loaded. */
- std::string so_original_name;
-
- /* Shared object file name, expanded to something GDB can open. */
- std::string so_name;
-
- /* The following fields of the structure are built from
- information gathered from the shared object file itself, and
- are set when we actually add it to our symbol tables.
-
- current_sos must initialize these fields to 0. */
-
- gdb_bfd_ref_ptr abfd;
-
- /* True if symbols have been read in. */
- bool symbols_loaded = false;
-
- /* objfile with symbols for a loaded library. Target memory is read from
- ABFD. OBJFILE may be NULL either before symbols have been loaded, if
- the file cannot be found or after the command "nosharedlibrary". */
- struct objfile *objfile = nullptr;
-
- std::vector<target_section> sections;
-
- /* Record the range of addresses belonging to this shared library.
- There may not be just one (e.g. if two segments are relocated
- differently). This is used for "info sharedlibrary" and
- the MI command "-file-list-shared-libraries". The latter has a format
- that supports outputting multiple segments once the related code
- supports them. */
- CORE_ADDR addr_low = 0, addr_high = 0;
-};
-
-struct solib_ops
-{
- /* Adjust the section binding addresses by the base address at
- which the object was actually mapped. */
- void (*relocate_section_addresses) (solib &so, target_section *);
-
- /* Reset private data structures associated with SO.
- This is called when SO is about to be reloaded.
- It is also called when SO is about to be freed. */
- void (*clear_so) (const solib &so);
-
- /* Free private data structures associated to PSPACE. This method
- should not free resources associated to individual so_list entries,
- those are cleared by the clear_so method. */
- void (*clear_solib) (program_space *pspace);
-
- /* Target dependent code to run after child process fork. */
- void (*solib_create_inferior_hook) (int from_tty);
-
- /* Construct a list of the currently loaded shared objects. This
- list does not include an entry for the main executable file.
-
- Note that we only gather information directly available from the
- inferior --- we don't examine any of the shared library files
- themselves. The declaration of `struct solib' says which fields
- we provide values for. */
- owning_intrusive_list<solib> (*current_sos) ();
-
- /* Find, open, and read the symbols for the main executable. If
- FROM_TTY is non-zero, allow messages to be printed. */
- int (*open_symbol_file_object) (int from_ttyp);
-
- /* Determine if PC lies in the dynamic symbol resolution code of
- the run time loader. */
- int (*in_dynsym_resolve_code) (CORE_ADDR pc);
-
- /* Find and open shared library binary file. */
- gdb_bfd_ref_ptr (*bfd_open) (const char *pathname);
-
- /* Given two so_list objects, one from the GDB thread list
- and another from the list returned by current_sos, return 1
- if they represent the same library.
- Falls back to using strcmp on so_original_name field when set
- to NULL. */
- int (*same) (const solib &gdb, const solib &inferior);
-
- /* Return whether a region of memory must be kept in a core file
- for shared libraries loaded before "gcore" is used to be
- handled correctly when the core file is loaded. This only
- applies when the section would otherwise not be kept in the
- core file (in particular, for readonly sections). */
- int (*keep_data_in_core) (CORE_ADDR vaddr,
- unsigned long size);
-
- /* Enable or disable optional solib event breakpoints as
- appropriate. This should be called whenever
- stop_on_solib_events is changed. This pointer can be
- NULL, in which case no enabling or disabling is necessary
- for this target. */
- void (*update_breakpoints) (void);
-
- /* Target-specific processing of solib events that will be
- performed before solib_add is called. This pointer can be
- NULL, in which case no specific preprocessing is necessary
- for this target. */
- void (*handle_event) (void);
-
- /* Return an address within the inferior's address space which is known
- to be part of SO. If there is no such address, or GDB doesn't know
- how to figure out such an address then an empty optional is
- returned.
-
- The returned address can be used when loading the shared libraries
- for a core file. GDB knows the build-ids for (some) files mapped
- into the inferior's address space, and knows the address ranges which
- those mapped files cover. If GDB can figure out a representative
- address for the library then this can be used to match a library to a
- mapped file, and thus to a build-id. GDB can then use this
- information to help locate the shared library objfile, if the objfile
- is not in the expected place (as defined by the shared libraries file
- name). */
-
- std::optional<CORE_ADDR> (*find_solib_addr) (solib &so);
-};
-
-/* A unique pointer to a so_list. */
-using solib_up = std::unique_ptr<solib>;
-
-/* Find main executable binary file. */
-extern gdb::unique_xmalloc_ptr<char> exec_file_find (const char *in_pathname,
- int *fd);
-
-/* Find shared library binary file. */
-extern gdb::unique_xmalloc_ptr<char> solib_find (const char *in_pathname,
- int *fd);
-
-/* Open BFD for shared library file. */
-extern gdb_bfd_ref_ptr solib_bfd_fopen (const char *pathname, int fd);
-
-/* Find solib binary file and open it. */
-extern gdb_bfd_ref_ptr solib_bfd_open (const char *in_pathname);
-
-/* A default implementation of the solib_ops::find_solib_addr callback.
- This just returns an empty std::optional<CORE_ADDR> indicating GDB is
- unable to find an address within the library SO. */
-extern std::optional<CORE_ADDR> default_find_solib_addr (solib &so);
-
-#endif /* GDB_SOLIST_H */
diff --git a/gdb/source-cache.c b/gdb/source-cache.c
index 30c9e61..9d5151a 100644
--- a/gdb/source-cache.c
+++ b/gdb/source-cache.c
@@ -1,5 +1,5 @@
/* Cache of styled source file text
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -364,7 +364,8 @@ source_cache::ensure (struct symtab *s)
if (!styled_p)
{
std::optional<std::string> ext_contents;
- ext_contents = ext_lang_colorize (fullname, contents);
+ ext_contents = ext_lang_colorize (fullname, contents,
+ s->language ());
if (ext_contents.has_value ())
{
contents = std::move (*ext_contents);
@@ -510,9 +511,7 @@ static void extract_lines_test ()
}
#endif
-void _initialize_source_cache ();
-void
-_initialize_source_cache ()
+INIT_GDB_FILE (source_cache)
{
add_cmd ("source-cache", class_maintenance, source_cache_flush_command,
_("Force gdb to flush its source code cache."),
diff --git a/gdb/source-cache.h b/gdb/source-cache.h
index c7d204b..5b3b922 100644
--- a/gdb/source-cache.h
+++ b/gdb/source-cache.h
@@ -1,5 +1,5 @@
/* Cache of styled source file text
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/source.c b/gdb/source.c
index 0d6523c..1018d2c 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1,5 +1,5 @@
/* List lines of source files for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -354,11 +354,11 @@ select_source_symtab ()
struct symtab *new_symtab = nullptr;
- for (objfile *ofp : current_program_space->objfiles ())
+ for (objfile &ofp : current_program_space->objfiles ())
{
- for (compunit_symtab *cu : ofp->compunits ())
+ for (compunit_symtab &cu : ofp.compunits ())
{
- for (symtab *symtab : cu->filetabs ())
+ for (symtab *symtab : cu.filetabs ())
{
const char *name = symtab->filename;
int len = strlen (name);
@@ -374,9 +374,9 @@ select_source_symtab ()
if (new_symtab != nullptr)
return;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- symtab *s = objfile->find_last_source_symtab ();
+ symtab *s = objfile.find_last_source_symtab ();
if (s)
new_symtab = s;
}
@@ -437,8 +437,8 @@ void
forget_cached_source_info (void)
{
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
- objfile->forget_cached_source_info ();
+ for (objfile &objfile : pspace->objfiles ())
+ objfile.forget_cached_source_info ();
g_source_cache.clear ();
last_source_visited = NULL;
@@ -774,9 +774,9 @@ prepare_path_for_appending (const char *path)
If FILENAME_OPENED is non-null, set it to a newly allocated string naming
the actual file opened (this string will always start with a "/"). We
- have to take special pains to avoid doubling the "/" between the directory
- and the file, sigh! Emacs gets confuzzed by this when we print the
- source file name!!!
+ have to ensure that we avoid doubling the "/" between the directory and the
+ file, because Emacs has special treatment of double slashes.
+ See "(emacs) Minibuffer File".
If OPTS has OPF_RETURN_REALPATH set return FILENAME_OPENED resolved by
gdb_realpath. Even without OPF_RETURN_REALPATH this function still returns
@@ -1312,14 +1312,12 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
int nlines = stopline - line;
struct ui_out *uiout = current_uiout;
- /* Regardless of whether we can open the file, set current_source_symtab. */
+ /* Regardless of whether we can open the file, we'll want to set
+ current_source_symtab, but not if throw an error, or return without
+ printing any source lines. */
current_source_location *loc
= get_source_location (current_program_space);
- loc->set (s, line);
- first_line_listed = line;
- last_line_listed = line;
-
/* If printing of source lines is disabled, just print file and line
number. */
if (uiout->test_flags (ui_source_list) && source_open)
@@ -1380,6 +1378,10 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
uiout->text ("\n");
}
+ loc->set (s, line);
+ first_line_listed = line;
+ last_line_listed = line;
+
return;
}
@@ -1399,12 +1401,9 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
}
const char *iter = lines.c_str ();
- int new_lineno = loc->line ();
- while (nlines-- > 0 && *iter != '\0')
+ int new_lineno = line;
+ for (; nlines-- > 0 && *iter != '\0'; ++new_lineno)
{
- char buf[20];
-
- last_line_listed = loc->line ();
if (flags & PRINT_SOURCE_LINES_FILENAME)
{
uiout->message ("%ps",
@@ -1415,7 +1414,6 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
uiout->message ("%ps\t", styled_string (line_number_style.style (),
pulongest (new_lineno)));
- ++new_lineno;
while (*iter != '\0')
{
@@ -1457,6 +1455,8 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
}
else if (*iter > 0 && *iter < 040)
{
+ char buf[20];
+
xsnprintf (buf, sizeof (buf), "^%c", *iter + 0100);
uiout->text (buf);
++iter;
@@ -1470,7 +1470,11 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
uiout->text ("\n");
}
- loc->set (loc->symtab (), new_lineno);
+ /* As NEW_LINENO was incremented after displaying the last source line,
+ the last line shown was the one before NEW_LINENO. */
+ first_line_listed = line;
+ last_line_listed = new_lineno - 1;
+ loc->set (s, new_lineno);
}
@@ -1910,9 +1914,7 @@ source_lines_range::source_lines_range (int startline,
}
-void _initialize_source ();
-void
-_initialize_source ()
+INIT_GDB_FILE (source)
{
init_source_path ();
diff --git a/gdb/source.h b/gdb/source.h
index 8ff1ebd..8a7d258 100644
--- a/gdb/source.h
+++ b/gdb/source.h
@@ -1,5 +1,5 @@
/* List lines of source files for GDB, the GNU debugger.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/sparc-linux-nat.c b/gdb/sparc-linux-nat.c
index 0b3a692..18db599 100644
--- a/gdb/sparc-linux-nat.c
+++ b/gdb/sparc-linux-nat.c
@@ -1,5 +1,5 @@
/* Native-dependent code for GNU/Linux SPARC.
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -65,9 +65,7 @@ fill_fpregset (const struct regcache *regcache,
sparc32_collect_fpregset (sparc_fpregmap, regcache, regnum, fpregs);
}
-void _initialize_sparc_linux_nat ();
-void
-_initialize_sparc_linux_nat ()
+INIT_GDB_FILE (sparc_linux_nat)
{
sparc_fpregmap = &sparc32_bsd_fpregmap;
diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c
index 2cf83eb..6e23fdd 100644
--- a/gdb/sparc-linux-tdep.c
+++ b/gdb/sparc-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux SPARC.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -33,6 +33,7 @@
#include "tramp-frame.h"
#include "xml-syscall.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
/* The syscall's XML filename for sparc 32-bit. */
#define XML_SYSCALL_FILENAME_SPARC32 "syscalls/sparc-linux.xml"
@@ -436,8 +437,7 @@ sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU/Linux has SVR4-style shared libraries... */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
/* ...which means that we need some special handling when doing
prologue analysis. */
@@ -466,9 +466,7 @@ sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
sparc32_linux_gdb_signal_to_target);
}
-void _initialize_sparc_linux_tdep ();
-void
-_initialize_sparc_linux_tdep ()
+INIT_GDB_FILE (sparc_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_LINUX,
sparc32_linux_init_abi);
diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
index 74156a8..1219612 100644
--- a/gdb/sparc-nat.c
+++ b/gdb/sparc-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for SPARC.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -309,9 +309,7 @@ sparc_xfer_wcookie (enum target_object object,
}
-void _initialize_sparc_nat ();
-void
-_initialize_sparc_nat ()
+INIT_GDB_FILE (sparc_nat)
{
/* Default to using SunOS 4 register sets. */
if (sparc_gregmap == NULL)
diff --git a/gdb/sparc-nat.h b/gdb/sparc-nat.h
index 712c9d0..7cef734 100644
--- a/gdb/sparc-nat.h
+++ b/gdb/sparc-nat.h
@@ -1,6 +1,6 @@
/* Native-dependent code for SPARC.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/sparc-netbsd-nat.c b/gdb/sparc-netbsd-nat.c
index 82592cc..54cba0b 100644
--- a/gdb/sparc-netbsd-nat.c
+++ b/gdb/sparc-netbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for NetBSD/sparc.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -56,9 +56,7 @@ sparc32nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
static sparc_target<inf_ptrace_target> the_sparc_nbsd_nat_target;
-void _initialize_sparcnbsd_nat ();
-void
-_initialize_sparcnbsd_nat ()
+INIT_GDB_FILE (sparcnbsd_nat)
{
sparc_gregmap = &sparc32nbsd_gregmap;
sparc_fpregmap = &sparc32_bsd_fpregmap;
diff --git a/gdb/sparc-netbsd-tdep.c b/gdb/sparc-netbsd-tdep.c
index bc058dc..8e8a1ba 100644
--- a/gdb/sparc-netbsd-tdep.c
+++ b/gdb/sparc-netbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for NetBSD/sparc.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Wasabi Systems, Inc.
This file is part of GDB.
@@ -313,13 +313,10 @@ sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
frame_unwind_append_unwinder (gdbarch, &sparc32nbsd_sigcontext_frame_unwind);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
}
-void _initialize_sparcnbsd_tdep ();
-void
-_initialize_sparcnbsd_tdep ()
+INIT_GDB_FILE (sparcnbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_NETBSD,
sparc32nbsd_init_abi);
diff --git a/gdb/sparc-obsd-tdep.c b/gdb/sparc-obsd-tdep.c
index 2bc944e..ff6e915 100644
--- a/gdb/sparc-obsd-tdep.c
+++ b/gdb/sparc-obsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for OpenBSD/sparc.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -147,7 +147,7 @@ static const struct frame_unwind_legacy sparc32obsd_sigtramp_frame_unwind (
-/* Offset wthin the thread structure where we can find %fp and %i7. */
+/* Offset within the thread structure where we can find %fp and %i7. */
#define SPARC32OBSD_UTHREAD_FP_OFFSET 128
#define SPARC32OBSD_UTHREAD_PC_OFFSET 132
@@ -254,9 +254,7 @@ sparc32obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
bsd_uthread_set_collect_uthread (gdbarch, sparc32obsd_collect_uthread);
}
-void _initialize_sparc32obsd_tdep ();
-void
-_initialize_sparc32obsd_tdep ()
+INIT_GDB_FILE (sparc32obsd_tdep)
{
gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_OPENBSD,
sparc32obsd_init_abi);
diff --git a/gdb/sparc-ravenscar-thread.c b/gdb/sparc-ravenscar-thread.c
index 82f68e1..7e0f2e5 100644
--- a/gdb/sparc-ravenscar-thread.c
+++ b/gdb/sparc-ravenscar-thread.c
@@ -1,6 +1,6 @@
/* Ravenscar SPARC target support.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/sparc-ravenscar-thread.h b/gdb/sparc-ravenscar-thread.h
index 5f2749f..7cccd66 100644
--- a/gdb/sparc-ravenscar-thread.h
+++ b/gdb/sparc-ravenscar-thread.h
@@ -1,6 +1,6 @@
/* Ravenscar SPARC target support.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/sparc-sol2-nat.c b/gdb/sparc-sol2-nat.c
index 8f9607f..88f6178 100644
--- a/gdb/sparc-sol2-nat.c
+++ b/gdb/sparc-sol2-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for Solaris SPARC.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -26,7 +26,7 @@
#include "target.h"
#include "procfs.h"
-/* This file provids the (temporary) glue between the Solaris SPARC
+/* This file provides the (temporary) glue between the Solaris SPARC
target dependent code and the machine independent SVR4 /proc
support. */
diff --git a/gdb/sparc-sol2-tdep.c b/gdb/sparc-sol2-tdep.c
index b6ac801..8de7439 100644
--- a/gdb/sparc-sol2-tdep.c
+++ b/gdb/sparc-sol2-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Solaris SPARC.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -207,22 +207,19 @@ sparc32_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Solaris has SVR4-style shared libraries... */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
/* ...which means that we need some special handling when doing
prologue analysis. */
tdep->plt_entry_size = 12;
/* Solaris has kernel-assisted single-stepping support. */
- set_gdbarch_software_single_step (gdbarch, NULL);
+ set_gdbarch_get_next_pcs (gdbarch, NULL);
frame_unwind_append_unwinder (gdbarch, &sparc32_sol2_sigtramp_frame_unwind);
}
-void _initialize_sparc_sol2_tdep ();
-void
-_initialize_sparc_sol2_tdep ()
+INIT_GDB_FILE (sparc_sol2_tdep)
{
gdbarch_register_osabi (bfd_arch_sparc, 0,
GDB_OSABI_SOLARIS, sparc32_sol2_init_abi);
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 5fab313..914a568 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for SPARC.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1874,7 +1874,7 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_args_skip (gdbarch, 8);
- set_gdbarch_software_single_step (gdbarch, sparc_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, sparc_software_single_step);
set_gdbarch_write_pc (gdbarch, sparc_write_pc);
set_gdbarch_dummy_id (gdbarch, sparc_dummy_id);
@@ -2264,9 +2264,7 @@ const struct sparc_fpregmap sparc32_bsd_fpregmap =
32 * 4, /* %fsr */
};
-void _initialize_sparc_tdep ();
-void
-_initialize_sparc_tdep ()
+INIT_GDB_FILE (sparc_tdep)
{
gdbarch_register (bfd_arch_sparc, sparc32_gdbarch_init);
}
diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h
index 4fd7e6b..f4444d0 100644
--- a/gdb/sparc-tdep.h
+++ b/gdb/sparc-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for SPARC.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/sparc64-fbsd-nat.c b/gdb/sparc64-fbsd-nat.c
index c10d55f..d697841 100644
--- a/gdb/sparc64-fbsd-nat.c
+++ b/gdb/sparc64-fbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for FreeBSD/sparc64.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -61,9 +61,7 @@ sparc64fbsd_kvm_supply_pcb (struct regcache *regcache, struct pcb *pcb)
/* Add some extra features to the generic SPARC target. */
static sparc_target<fbsd_nat_target> the_sparc64_fbsd_nat_target;
-void _initialize_sparc64fbsd_nat ();
-void
-_initialize_sparc64fbsd_nat ()
+INIT_GDB_FILE (sparc64fbsd_nat)
{
add_inf_child_target (&the_sparc64_fbsd_nat_target);
diff --git a/gdb/sparc64-fbsd-tdep.c b/gdb/sparc64-fbsd-tdep.c
index 6630a9b..ba04a71 100644
--- a/gdb/sparc64-fbsd-tdep.c
+++ b/gdb/sparc64-fbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for FreeBSD/sparc64.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -238,13 +238,10 @@ sparc64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* FreeBSD/sparc64 has SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_lp64_solib_ops);
}
-void _initialize_sparc64fbsd_tdep ();
-void
-_initialize_sparc64fbsd_tdep ()
+INIT_GDB_FILE (sparc64fbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
GDB_OSABI_FREEBSD, sparc64fbsd_init_abi);
diff --git a/gdb/sparc64-linux-nat.c b/gdb/sparc64-linux-nat.c
index bd9aafd..2884faa 100644
--- a/gdb/sparc64-linux-nat.c
+++ b/gdb/sparc64-linux-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux UltraSPARC.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -87,9 +87,7 @@ fill_fpregset (const struct regcache *regcache,
sparc64_collect_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
}
-void _initialize_sparc64_linux_nat ();
-void
-_initialize_sparc64_linux_nat ()
+INIT_GDB_FILE (sparc64_linux_nat)
{
sparc_fpregmap = &sparc64_bsd_fpregmap;
diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c
index de44465..373dfb6 100644
--- a/gdb/sparc64-linux-tdep.c
+++ b/gdb/sparc64-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux UltraSPARC.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -32,6 +32,7 @@
#include "tramp-frame.h"
#include "xml-syscall.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
/* ADI specific si_code */
#ifndef SEGV_ACCADI
@@ -383,8 +384,7 @@ sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU/Linux has SVR4-style shared libraries... */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_lp64_svr4_solib_ops);
/* ...which means that we need some special handling when doing
prologue analysis. */
@@ -409,9 +409,7 @@ sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_report_signal_info (gdbarch, sparc64_linux_report_signal_info);
}
-void _initialize_sparc64_linux_tdep ();
-void
-_initialize_sparc64_linux_tdep ()
+INIT_GDB_FILE (sparc64_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
GDB_OSABI_LINUX, sparc64_linux_init_abi);
diff --git a/gdb/sparc64-nat.c b/gdb/sparc64-nat.c
index aa07bf5..66451a0 100644
--- a/gdb/sparc64-nat.c
+++ b/gdb/sparc64-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux UltraSPARC.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -68,9 +68,7 @@ sparc64_fpregset_supplies_p (struct gdbarch *gdbarch, int regnum)
return 0;
}
-void _initialize_sparc64_nat ();
-void
-_initialize_sparc64_nat ()
+INIT_GDB_FILE (sparc64_nat)
{
sparc_supply_gregset = sparc64_supply_gregset;
sparc_collect_gregset = sparc64_collect_gregset;
diff --git a/gdb/sparc64-netbsd-nat.c b/gdb/sparc64-netbsd-nat.c
index 111a45d..1036160 100644
--- a/gdb/sparc64-netbsd-nat.c
+++ b/gdb/sparc64-netbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for NetBSD/sparc64.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -169,9 +169,7 @@ sparc64nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
/* We've got nothing to add to the generic SPARC target. */
static sparc_target<inf_ptrace_target> the_sparc64_nbsd_nat_target;
-void _initialize_sparc64nbsd_nat ();
-void
-_initialize_sparc64nbsd_nat ()
+INIT_GDB_FILE (sparc64nbsd_nat)
{
sparc_supply_gregset = sparc64nbsd_supply_gregset;
sparc_collect_gregset = sparc64nbsd_collect_gregset;
diff --git a/gdb/sparc64-netbsd-tdep.c b/gdb/sparc64-netbsd-tdep.c
index 53c49fe..0227ec4 100644
--- a/gdb/sparc64-netbsd-tdep.c
+++ b/gdb/sparc64-netbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for NetBSD/sparc64.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Based on code contributed by Wasabi Systems, Inc.
This file is part of GDB.
@@ -266,13 +266,10 @@ sparc64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* NetBSD/sparc64 has SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_lp64_solib_ops);
}
-void _initialize_sparc64nbsd_tdep ();
-void
-_initialize_sparc64nbsd_tdep ()
+INIT_GDB_FILE (sparc64nbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
GDB_OSABI_NETBSD, sparc64nbsd_init_abi);
diff --git a/gdb/sparc64-obsd-nat.c b/gdb/sparc64-obsd-nat.c
index 71589d1..60dd188 100644
--- a/gdb/sparc64-obsd-nat.c
+++ b/gdb/sparc64-obsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for OpenBSD/sparc64.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -108,9 +108,7 @@ sparc64obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
/* Add some extra features to the generic SPARC target. */
static sparc_target<obsd_nat_target> the_sparc64_obsd_nat_target;
-void _initialize_sparc64obsd_nat ();
-void
-_initialize_sparc64obsd_nat ()
+INIT_GDB_FILE (sparc64obsd_nat)
{
sparc_supply_gregset = sparc64_supply_gregset;
sparc_collect_gregset = sparc64_collect_gregset;
diff --git a/gdb/sparc64-obsd-tdep.c b/gdb/sparc64-obsd-tdep.c
index 8596d2f..83cc9c0 100644
--- a/gdb/sparc64-obsd-tdep.c
+++ b/gdb/sparc64-obsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for OpenBSD/sparc64.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -318,7 +318,7 @@ static const struct frame_unwind_legacy sparc64obsd_trapframe_unwind (
/* Threads support. */
-/* Offset wthin the thread structure where we can find %fp and %i7. */
+/* Offset within the thread structure where we can find %fp and %i7. */
#define SPARC64OBSD_UTHREAD_FP_OFFSET 232
#define SPARC64OBSD_UTHREAD_PC_OFFSET 240
@@ -440,8 +440,7 @@ sparc64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
obsd_init_abi (info, gdbarch);
/* OpenBSD/sparc64 has SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_lp64_solib_ops);
set_gdbarch_skip_solib_resolver (gdbarch, obsd_skip_solib_resolver);
/* OpenBSD provides a user-level threads implementation. */
@@ -449,9 +448,7 @@ sparc64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
bsd_uthread_set_collect_uthread (gdbarch, sparc64obsd_collect_uthread);
}
-void _initialize_sparc64obsd_tdep ();
-void
-_initialize_sparc64obsd_tdep ()
+INIT_GDB_FILE (sparc64obsd_tdep)
{
gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
GDB_OSABI_OPENBSD, sparc64obsd_init_abi);
diff --git a/gdb/sparc64-sol2-tdep.c b/gdb/sparc64-sol2-tdep.c
index cadbf49..cb3ba6b 100644
--- a/gdb/sparc64-sol2-tdep.c
+++ b/gdb/sparc64-sol2-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Solaris UltraSPARC.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -214,20 +214,17 @@ sparc64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Solaris has SVR4-style shared libraries... */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_lp64_solib_ops);
/* ...which means that we need some special handling when doing
prologue analysis. */
tdep->plt_entry_size = 16;
/* Solaris has kernel-assisted single-stepping support. */
- set_gdbarch_software_single_step (gdbarch, NULL);
+ set_gdbarch_get_next_pcs (gdbarch, NULL);
}
-void _initialize_sparc64_sol2_tdep ();
-void
-_initialize_sparc64_sol2_tdep ()
+INIT_GDB_FILE (sparc64_sol2_tdep)
{
gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
GDB_OSABI_SOLARIS, sparc64_sol2_init_abi);
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 7810b81..6846421 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for UltraSPARC.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -529,9 +529,7 @@ adi_assign_command (const char *args, int from_tty)
do_assign (next_address, cnt, version);
}
-void _initialize_sparc64_adi_tdep ();
-void
-_initialize_sparc64_adi_tdep ()
+INIT_GDB_FILE (sparc64_adi_tdep)
{
add_basic_prefix_cmd ("adi", class_support,
_("ADI version related commands."),
diff --git a/gdb/sparc64-tdep.h b/gdb/sparc64-tdep.h
index a19af4a..1199938 100644
--- a/gdb/sparc64-tdep.h
+++ b/gdb/sparc64-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for UltraSPARC.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/split-name.c b/gdb/split-name.c
index f296080..dc09dec 100644
--- a/gdb/split-name.c
+++ b/gdb/split-name.c
@@ -1,6 +1,6 @@
/* Split a symbol name.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/split-name.h b/gdb/split-name.h
index 5f7ebb2..b2403bf 100644
--- a/gdb/split-name.h
+++ b/gdb/split-name.h
@@ -1,6 +1,6 @@
/* Split a symbol name.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index fcc226e..733fc9e 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -1,6 +1,6 @@
/* Support routines for decoding "stabs" debugging information format.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -46,7 +46,6 @@
#include "c-lang.h"
#include "cp-abi.h"
#include "cp-support.h"
-#include <ctype.h>
#include "block.h"
#include "filenames.h"
@@ -472,7 +471,7 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs,
a N_GSYM stab for it, but no regular (C_EXT) symbol. */
sym = new (&objfile->objfile_obstack) symbol;
sym->set_domain (VAR_DOMAIN);
- sym->set_aclass_index (LOC_OPTIMIZED_OUT);
+ sym->set_loc_class_index (LOC_OPTIMIZED_OUT);
sym->set_linkage_name
(obstack_strndup (&objfile->objfile_obstack, name, pp - name));
pp += 2;
@@ -891,7 +890,7 @@ read_ofile_symtab (struct objfile *objfile, legacy_psymtab *pst)
symnum < max_symnum;
symnum++)
{
- QUIT; /* Allow this to be interruptable. */
+ QUIT; /* Allow this to be interruptible. */
if (symbuf_idx == symbuf_end)
fill_symbuf (abfd, objfile);
bufp = &symbuf[symbuf_idx++];
@@ -1301,7 +1300,7 @@ read_stabs_symtab_1 (minimal_symbol_reader &reader,
for (symnum = 0; symnum < DBX_SYMCOUNT (objfile); symnum++)
{
/* Get the symbol for this run and pull out some info. */
- QUIT; /* Allow this to be interruptable. */
+ QUIT; /* Allow this to be interruptible. */
if (symbuf_idx == symbuf_end)
fill_symbuf (abfd, objfile);
bufp = &symbuf[symbuf_idx++];
@@ -1540,7 +1539,7 @@ read_stabs_symtab_1 (minimal_symbol_reader &reader,
}
/* Some other compilers (C++ ones in particular) emit useless
- SOs for non-existant .c files. We ignore all subsequent SOs
+ SOs for non-existent .c files. We ignore all subsequent SOs
that immediately follow the first. */
if (!pst)
@@ -3067,7 +3066,7 @@ process_reference (const char **string)
p = *string + 1;
/* Read number as reference id. */
- while (*p && isdigit (*p))
+ while (*p && c_isdigit (*p))
{
refnum = refnum * 10 + *p - '0';
p++;
@@ -3123,7 +3122,7 @@ static const struct symbol_register_ops stab_register_funcs = {
stab_reg_to_regnum
};
-/* The "aclass" indices for computed symbols. */
+/* The "loc_class" indices for computed symbols. */
static int stab_register_index;
static int stab_regparm_index;
@@ -3251,7 +3250,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
deftypes we know how to handle is a local. */
if (!strchr ("cfFGpPrStTvVXCR", *p))
#else
- if (isdigit (*p) || *p == '(' || *p == '-')
+ if (c_isdigit (*p) || *p == '(' || *p == '-')
#endif
deftype = 'l';
else
@@ -3268,7 +3267,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
(where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;"). */
if (*p != '=')
{
- sym->set_aclass_index (LOC_CONST);
+ sym->set_loc_class_index (LOC_CONST);
sym->set_type (error_type (&p, objfile));
sym->set_domain (VAR_DOMAIN);
add_symbol_to_list (sym, get_file_symbols ());
@@ -3291,7 +3290,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
sym->set_type (dbl_type);
sym->set_value_bytes (dbl_valu);
- sym->set_aclass_index (LOC_CONST_BYTES);
+ sym->set_loc_class_index (LOC_CONST_BYTES);
}
break;
case 'i':
@@ -3305,7 +3304,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
sym->set_type (builtin_type (objfile)->builtin_long);
sym->set_value_longest (atoi (p));
- sym->set_aclass_index (LOC_CONST);
+ sym->set_loc_class_index (LOC_CONST);
}
break;
@@ -3313,7 +3312,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
{
sym->set_type (builtin_type (objfile)->builtin_char);
sym->set_value_longest (atoi (p));
- sym->set_aclass_index (LOC_CONST);
+ sym->set_loc_class_index (LOC_CONST);
}
break;
@@ -3327,7 +3326,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
if (quote != '\'' && quote != '"')
{
- sym->set_aclass_index (LOC_CONST);
+ sym->set_loc_class_index (LOC_CONST);
sym->set_type (error_type (&p, objfile));
sym->set_domain (VAR_DOMAIN);
add_symbol_to_list (sym, get_file_symbols ());
@@ -3352,7 +3351,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
}
if (*p != quote)
{
- sym->set_aclass_index (LOC_CONST);
+ sym->set_loc_class_index (LOC_CONST);
sym->set_type (error_type (&p, objfile));
sym->set_domain (VAR_DOMAIN);
add_symbol_to_list (sym, get_file_symbols ());
@@ -3375,7 +3374,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
p++;
sym->set_value_bytes (string_value);
- sym->set_aclass_index (LOC_CONST_BYTES);
+ sym->set_loc_class_index (LOC_CONST_BYTES);
}
break;
@@ -3385,7 +3384,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
e.g. "b:c=e6,0" for "const b = blob1"
(where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;"). */
{
- sym->set_aclass_index (LOC_CONST);
+ sym->set_loc_class_index (LOC_CONST);
sym->set_type (read_type (&p, objfile));
if (*p != ',')
@@ -3406,7 +3405,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
break;
default:
{
- sym->set_aclass_index (LOC_CONST);
+ sym->set_loc_class_index (LOC_CONST);
sym->set_type (error_type (&p, objfile));
}
}
@@ -3417,7 +3416,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
case 'C':
/* The name of a caught exception. */
sym->set_type (read_type (&p, objfile));
- sym->set_aclass_index (LOC_LABEL);
+ sym->set_loc_class_index (LOC_LABEL);
sym->set_domain (VAR_DOMAIN);
sym->set_value_address (valu);
add_symbol_to_list (sym, get_local_symbols ());
@@ -3426,7 +3425,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
case 'f':
/* A static function definition. */
sym->set_type (read_type (&p, objfile));
- sym->set_aclass_index (LOC_BLOCK);
+ sym->set_loc_class_index (LOC_BLOCK);
sym->set_domain (FUNCTION_DOMAIN);
add_symbol_to_list (sym, get_file_symbols ());
/* fall into process_function_types. */
@@ -3497,7 +3496,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
case 'F':
/* A global function definition. */
sym->set_type (read_type (&p, objfile));
- sym->set_aclass_index (LOC_BLOCK);
+ sym->set_loc_class_index (LOC_BLOCK);
sym->set_domain (FUNCTION_DOMAIN);
add_symbol_to_list (sym, get_global_symbols ());
goto process_function_types;
@@ -3508,10 +3507,10 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
corresponding linker definition to find the value.
These definitions appear at the end of the namelist. */
sym->set_type (read_type (&p, objfile));
- sym->set_aclass_index (LOC_STATIC);
+ sym->set_loc_class_index (LOC_STATIC);
sym->set_domain (VAR_DOMAIN);
/* Don't add symbol references to global_sym_chain.
- Symbol references don't have valid names and wont't match up with
+ Symbol references don't have valid names and won't match up with
minimal symbols when the global_sym_chain is relocated.
We'll fixup symbol references when we fixup the defining symbol. */
if (sym->linkage_name () && sym->linkage_name ()[0] != '#')
@@ -3529,7 +3528,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
case 's':
case 'l':
sym->set_type (read_type (&p, objfile));
- sym->set_aclass_index (LOC_LOCAL);
+ sym->set_loc_class_index (LOC_LOCAL);
sym->set_value_longest (valu);
sym->set_domain (VAR_DOMAIN);
add_symbol_to_list (sym, get_local_symbols ());
@@ -3549,7 +3548,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
else
sym->set_type (read_type (&p, objfile));
- sym->set_aclass_index (LOC_ARG);
+ sym->set_loc_class_index (LOC_ARG);
sym->set_value_longest (valu);
sym->set_domain (VAR_DOMAIN);
sym->set_is_argument (1);
@@ -3598,7 +3597,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
case 'R':
/* Parameter which is in a register. */
sym->set_type (read_type (&p, objfile));
- sym->set_aclass_index (stab_register_index);
+ sym->set_loc_class_index (stab_register_index);
sym->set_is_argument (1);
sym->set_value_longest (valu);
sym->set_domain (VAR_DOMAIN);
@@ -3608,7 +3607,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
case 'r':
/* Register variable (either global or local). */
sym->set_type (read_type (&p, objfile));
- sym->set_aclass_index (stab_register_index);
+ sym->set_loc_class_index (stab_register_index);
sym->set_value_longest (valu);
sym->set_domain (VAR_DOMAIN);
if (within_function)
@@ -3640,12 +3639,12 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
struct symbol *prev_sym;
prev_sym = local_symbols->symbol[local_symbols->nsyms - 1];
- if ((prev_sym->aclass () == LOC_REF_ARG
- || prev_sym->aclass () == LOC_ARG)
+ if ((prev_sym->loc_class () == LOC_REF_ARG
+ || prev_sym->loc_class () == LOC_ARG)
&& strcmp (prev_sym->linkage_name (),
sym->linkage_name ()) == 0)
{
- prev_sym->set_aclass_index (stab_register_index);
+ prev_sym->set_loc_class_index (stab_register_index);
/* Use the type from the LOC_REGISTER; that is the type
that is actually in that register. */
prev_sym->set_type (sym->type ());
@@ -3663,7 +3662,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
case 'S':
/* Static symbol at top level of file. */
sym->set_type (read_type (&p, objfile));
- sym->set_aclass_index (LOC_STATIC);
+ sym->set_loc_class_index (LOC_STATIC);
sym->set_value_address (valu);
sym->set_domain (VAR_DOMAIN);
add_symbol_to_list (sym, get_file_symbols ());
@@ -3694,7 +3693,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
if (nameless)
return NULL;
- sym->set_aclass_index (LOC_TYPEDEF);
+ sym->set_loc_class_index (LOC_TYPEDEF);
sym->set_value_longest (valu);
sym->set_domain (TYPE_DOMAIN);
/* C++ vagaries: we may have a type which is derived from
@@ -3771,7 +3770,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
struct symbol *struct_sym = new (&objfile->objfile_obstack) symbol;
*struct_sym = *sym;
- struct_sym->set_aclass_index (LOC_TYPEDEF);
+ struct_sym->set_loc_class_index (LOC_TYPEDEF);
struct_sym->set_value_longest (valu);
struct_sym->set_domain (STRUCT_DOMAIN);
if (sym->type ()->name () == 0)
@@ -3798,7 +3797,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
if (nameless)
return NULL;
- sym->set_aclass_index (LOC_TYPEDEF);
+ sym->set_loc_class_index (LOC_TYPEDEF);
sym->set_value_longest (valu);
sym->set_domain (STRUCT_DOMAIN);
if (sym->type ()->name () == 0)
@@ -3813,7 +3812,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
struct symbol *typedef_sym = new (&objfile->objfile_obstack) symbol;
*typedef_sym = *sym;
- typedef_sym->set_aclass_index (LOC_TYPEDEF);
+ typedef_sym->set_loc_class_index (LOC_TYPEDEF);
typedef_sym->set_value_longest (valu);
typedef_sym->set_domain (TYPE_DOMAIN);
if (sym->type ()->name () == 0)
@@ -3827,7 +3826,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
case 'V':
/* Static symbol of local scope. */
sym->set_type (read_type (&p, objfile));
- sym->set_aclass_index (LOC_STATIC);
+ sym->set_loc_class_index (LOC_STATIC);
sym->set_value_address (valu);
sym->set_domain (VAR_DOMAIN);
add_symbol_to_list (sym, get_local_symbols ());
@@ -3836,7 +3835,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
case 'v':
/* Reference parameter */
sym->set_type (read_type (&p, objfile));
- sym->set_aclass_index (LOC_REF_ARG);
+ sym->set_loc_class_index (LOC_REF_ARG);
sym->set_is_argument (1);
sym->set_value_longest (valu);
sym->set_domain (VAR_DOMAIN);
@@ -3846,7 +3845,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
case 'a':
/* Reference parameter which is in a register. */
sym->set_type (read_type (&p, objfile));
- sym->set_aclass_index (stab_regparm_index);
+ sym->set_loc_class_index (stab_regparm_index);
sym->set_is_argument (1);
sym->set_value_longest (valu);
sym->set_domain (VAR_DOMAIN);
@@ -3859,7 +3858,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
that Pascal uses it too, but when I tried it Pascal used
"x:3" (local symbol) instead. */
sym->set_type (read_type (&p, objfile));
- sym->set_aclass_index (LOC_LOCAL);
+ sym->set_loc_class_index (LOC_LOCAL);
sym->set_value_longest (valu);
sym->set_domain (VAR_DOMAIN);
add_symbol_to_list (sym, get_local_symbols ());
@@ -3867,7 +3866,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
default:
sym->set_type (error_type (&p, objfile));
- sym->set_aclass_index (LOC_CONST);
+ sym->set_loc_class_index (LOC_CONST);
sym->set_value_longest (0);
sym->set_domain (VAR_DOMAIN);
add_symbol_to_list (sym, get_file_symbols ());
@@ -3883,12 +3882,12 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
{
/* We have to convert LOC_REGISTER to LOC_REGPARM_ADDR (for
variables passed in a register). */
- if (sym->aclass () == LOC_REGISTER)
- sym->set_aclass_index (LOC_REGPARM_ADDR);
+ if (sym->loc_class () == LOC_REGISTER)
+ sym->set_loc_class_index (LOC_REGPARM_ADDR);
/* Likewise for converting LOC_ARG to LOC_REF_ARG (for the 7th
and subsequent arguments on SPARC, for example). */
- else if (sym->aclass () == LOC_ARG)
- sym->set_aclass_index (LOC_REF_ARG);
+ else if (sym->loc_class () == LOC_ARG)
+ sym->set_loc_class_index (LOC_REF_ARG);
}
return sym;
@@ -4139,7 +4138,7 @@ again:
{
struct symbol *sym = ppt->symbol[i];
- if (sym->aclass () == LOC_TYPEDEF
+ if (sym->loc_class () == LOC_TYPEDEF
&& sym->domain () == STRUCT_DOMAIN
&& (sym->type ()->code () == code)
&& strcmp (sym->linkage_name (), type_name) == 0)
@@ -4340,7 +4339,7 @@ again:
break;
case '@':
- if (isdigit (**pp) || **pp == '(' || **pp == '-')
+ if (c_isdigit (**pp) || **pp == '(' || **pp == '-')
{ /* Member (class & variable) type */
/* FIXME -- we should be doing smash_to_XXX types here. */
@@ -4431,8 +4430,9 @@ again:
if (args == NULL)
return error_type (pp, objfile);
type = dbx_alloc_type (typenums, objfile);
- smash_to_method_type (type, domain, return_type, args,
- nargs, varargs);
+ smash_to_method_type (type, domain, return_type,
+ gdb::make_array_view (args, nargs),
+ varargs);
}
break;
@@ -4907,7 +4907,7 @@ read_member_functions (struct stab_field_info *fip, const char **pp,
int nbits;
/* virtual member function, followed by index.
The sign bit is set to distinguish pointers-to-methods
- from virtual function indicies. Since the array is
+ from virtual function indices. Since the array is
in words, the quantity must be shifted left by 1
on 16 bit machine, and by 2 on 32 bit machine, forcing
the sign bit out, and usable as a valid index into
@@ -6059,7 +6059,7 @@ read_enum_type (const char **pp, struct type *type,
sym->set_linkage_name (name);
sym->set_language (get_current_subfile ()->language,
&objfile->objfile_obstack);
- sym->set_aclass_index (LOC_CONST);
+ sym->set_loc_class_index (LOC_CONST);
sym->set_domain (VAR_DOMAIN);
sym->set_value_longest (n);
if (n < 0)
@@ -6726,7 +6726,7 @@ common_block_end (struct objfile *objfile)
sym = new (&objfile->objfile_obstack) symbol;
/* Note: common_block_name already saved on objfile_obstack. */
sym->set_linkage_name (common_block_name);
- sym->set_aclass_index (LOC_BLOCK);
+ sym->set_loc_class_index (LOC_BLOCK);
/* Now we copy all the symbols which have been defined since the BCOMM. */
@@ -6934,7 +6934,7 @@ cleanup_undefined_types_1 (void)
{
struct symbol *sym = ppt->symbol[i];
- if (sym->aclass () == LOC_TYPEDEF
+ if (sym->loc_class () == LOC_TYPEDEF
&& sym->domain () == STRUCT_DOMAIN
&& (sym->type ()->code () == (*type)->code ())
&& ((*type)->instance_flags ()
@@ -7044,7 +7044,7 @@ scan_file_globals (struct objfile *objfile)
the same symbol if there are multiple references. */
if (sym)
{
- if (sym->aclass () == LOC_BLOCK)
+ if (sym->loc_class () == LOC_BLOCK)
fix_common_block
(sym, msymbol->value_address (resolve_objfile),
msymbol->section_index ());
@@ -7090,8 +7090,8 @@ scan_file_globals (struct objfile *objfile)
prev->set_value_address (0);
/* Complain about unresolved common block symbols. */
- if (prev->aclass () == LOC_STATIC)
- prev->set_aclass_index (LOC_UNRESOLVED);
+ if (prev->loc_class () == LOC_STATIC)
+ prev->set_loc_class_index (LOC_UNRESOLVED);
else
complaint (_("%s: common block `%s' from "
"global_sym_chain unresolved"),
@@ -7200,9 +7200,7 @@ hashname (const char *name)
/* Initializer for this module. */
-void _initialize_stabsread ();
-void
-_initialize_stabsread ()
+INIT_GDB_FILE (stabsread)
{
undef_types_allocated = 20;
undef_types_length = 0;
diff --git a/gdb/stabsread.h b/gdb/stabsread.h
index 273ceaa..15f7326 100644
--- a/gdb/stabsread.h
+++ b/gdb/stabsread.h
@@ -1,5 +1,5 @@
/* Include file for stabs debugging format support functions.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -131,7 +131,7 @@ struct header_file
/* The actual length of HEADER_FILES. */
#define N_HEADER_FILES(OBJFILE) (DBX_SYMFILE_INFO (OBJFILE)->n_header_files)
-/* The allocated lengh of HEADER_FILES. */
+/* The allocated length of HEADER_FILES. */
#define N_ALLOCATED_HEADER_FILES(OBJFILE) \
(DBX_SYMFILE_INFO (OBJFILE)->n_allocated_header_files)
diff --git a/gdb/stack.c b/gdb/stack.c
index 6f986aa..add1c54 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1,6 +1,6 @@
/* Print and select stack frames for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -758,7 +758,7 @@ print_frame_args (const frame_print_options &fp_opts,
break;
}
- switch (sym->aclass ())
+ switch (sym->loc_class ())
{
case LOC_ARG:
case LOC_REF_ARG:
@@ -813,7 +813,7 @@ print_frame_args (const frame_print_options &fp_opts,
nsym = lookup_symbol_search_name (sym->search_name (),
b, SEARCH_VAR_DOMAIN).symbol;
gdb_assert (nsym != NULL);
- if (nsym->aclass () == LOC_REGISTER
+ if (nsym->loc_class () == LOC_REGISTER
&& !nsym->is_argument ())
{
/* There is a LOC_ARG/LOC_REGISTER pair. This means
@@ -827,7 +827,7 @@ print_frame_args (const frame_print_options &fp_opts,
(1) Because find_saved_registers may be slow for
remote debugging.
- (2) Because registers are often re-used and stack
+ (2) Because registers are often reused and stack
slots rarely (never?) are. Therefore using
the stack slot is much less likely to print
garbage.
@@ -1165,10 +1165,10 @@ do_print_frame_info (struct ui_out *uiout, const frame_print_options &fp_opts,
if (set_current_sal)
{
- CORE_ADDR pc;
+ std::optional<CORE_ADDR> pc;
- if (get_frame_pc_if_available (frame, &pc))
- last_displayed_symtab_info.set (sal.pspace, pc, sal.symtab, sal.line);
+ if ((pc = get_frame_pc_if_available (frame)))
+ last_displayed_symtab_info.set (sal.pspace, *pc, sal.symtab, sal.line);
else
last_displayed_symtab_info.invalidate ();
}
@@ -1325,16 +1325,15 @@ print_frame (struct ui_out *uiout,
enum language funlang = language_unknown;
struct value_print_options opts;
struct symbol *func;
- CORE_ADDR pc = 0;
- int pc_p;
+ std::optional <CORE_ADDR> pc;
- pc_p = get_frame_pc_if_available (frame, &pc);
+ pc = get_frame_pc_if_available (frame);
gdb::unique_xmalloc_ptr<char> funname
= find_frame_funname (frame, &funlang, &func);
annotate_frame_begin (print_level ? frame_relative_level (frame) : 0,
- gdbarch, pc);
+ gdbarch, pc.value_or (0));
{
ui_out_emit_tuple tuple_emitter (uiout, "frame");
@@ -1352,8 +1351,8 @@ print_frame (struct ui_out *uiout,
|| print_what == LOC_AND_ADDRESS)
{
annotate_frame_address ();
- if (pc_p)
- print_pc (uiout, gdbarch, frame, pc);
+ if (pc.has_value ())
+ print_pc (uiout, gdbarch, frame, *pc);
else
uiout->field_string ("addr", "<unavailable>",
metadata_style.style ());
@@ -1422,7 +1421,7 @@ print_frame (struct ui_out *uiout,
}
if (print_what != SHORT_LOCATION
- && pc_p && (funname == NULL || sal.symtab == NULL))
+ && pc.has_value () && (funname == NULL || sal.symtab == NULL))
{
const char *lib
= solib_name_from_address (get_frame_program_space (frame),
@@ -1481,8 +1480,7 @@ info_frame_command_core (const frame_info_ptr &fi, bool selected_frame_p)
enum language funlang = language_unknown;
const char *pc_regname;
struct gdbarch *gdbarch;
- CORE_ADDR frame_pc;
- int frame_pc_p;
+ std::optional<CORE_ADDR> frame_pc;
/* Initialize it to avoid "may be used uninitialized" warning. */
CORE_ADDR caller_pc = 0;
int caller_pc_p = 0;
@@ -1503,7 +1501,7 @@ info_frame_command_core (const frame_info_ptr &fi, bool selected_frame_p)
get_frame_pc(). */
pc_regname = "pc";
- frame_pc_p = get_frame_pc_if_available (fi, &frame_pc);
+ frame_pc = get_frame_pc_if_available (fi);
func = get_frame_function (fi);
symtab_and_line sal = find_frame_sal (fi);
s = sal.symtab;
@@ -1525,9 +1523,9 @@ info_frame_command_core (const frame_info_ptr &fi, bool selected_frame_p)
funname = func_only.get ();
}
}
- else if (frame_pc_p)
+ else if (frame_pc.has_value ())
{
- bound_minimal_symbol msymbol = lookup_minimal_symbol_by_pc (frame_pc);
+ bound_minimal_symbol msymbol = lookup_minimal_symbol_by_pc (*frame_pc);
if (msymbol.minsym != NULL)
{
funname = msymbol.minsym->print_name ();
@@ -1548,7 +1546,7 @@ info_frame_command_core (const frame_info_ptr &fi, bool selected_frame_p)
gdb_puts (paddress (gdbarch, get_frame_base (fi)));
gdb_printf (":\n");
gdb_printf (" %s = ", pc_regname);
- if (frame_pc_p)
+ if (frame_pc.has_value ())
gdb_puts (paddress (gdbarch, get_frame_pc (fi)));
else
fputs_styled ("<unavailable>", metadata_style.style (), gdb_stdout);
@@ -2218,7 +2216,7 @@ iterate_over_block_locals (const struct block *b,
{
for (struct symbol *sym : block_iterator_range (b))
{
- switch (sym->aclass ())
+ switch (sym->loc_class ())
{
case LOC_CONST:
case LOC_CONST_BYTES:
@@ -2337,9 +2335,9 @@ print_frame_local_vars (const frame_info_ptr &frame,
{
struct print_variable_and_value_data cb_data;
const struct block *block;
- CORE_ADDR pc;
+ std::optional<CORE_ADDR> pc;
- if (!get_frame_pc_if_available (frame, &pc))
+ if (!(pc = get_frame_pc_if_available (frame)))
{
if (!quiet)
gdb_printf (stream,
@@ -2499,11 +2497,11 @@ print_frame_arg_vars (const frame_info_ptr &frame,
{
struct print_variable_and_value_data cb_data;
struct symbol *func;
- CORE_ADDR pc;
+ std::optional<CORE_ADDR> pc;
std::optional<compiled_regex> preg;
std::optional<compiled_regex> treg;
- if (!get_frame_pc_if_available (frame, &pc))
+ if (!(pc = get_frame_pc_if_available (frame)))
{
if (!quiet)
gdb_printf (stream,
@@ -3066,7 +3064,7 @@ frame_apply_level_cmd_completer (struct cmd_list_element *ignore,
/* Check if we're past a valid LEVEL already. */
if (levels.finished ()
- && cmd > text && !isspace (cmd[-1]))
+ && cmd > text && !c_isspace (cmd[-1]))
return;
/* We're past LEVELs, advance word point. */
@@ -3100,7 +3098,7 @@ frame_apply_cmd_completer (struct cmd_list_element *ignore,
return;
/* Check if we're past a valid COUNT already. */
- if (cmd > text && !isspace (cmd[-1]))
+ if (cmd > text && !c_isspace (cmd[-1]))
return;
/* We're past COUNT, advance word point. */
@@ -3262,9 +3260,7 @@ static struct cmd_list_element *select_frame_cmd_list = NULL;
/* Commands with a prefix of `info frame'. */
static struct cmd_list_element *info_frame_cmd_list = NULL;
-void _initialize_stack ();
-void
-_initialize_stack ()
+INIT_GDB_FILE (stack)
{
struct cmd_list_element *cmd;
diff --git a/gdb/stack.h b/gdb/stack.h
index e87ba32..6b2efb8 100644
--- a/gdb/stack.h
+++ b/gdb/stack.h
@@ -1,6 +1,6 @@
/* Stack manipulation commands, for GDB the GNU Debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index b312b38..6c15bce 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -1,6 +1,6 @@
/* SystemTap probe support for GDB.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -39,7 +39,6 @@
#include "expop.h"
#include "gdbsupport/unordered_map.h"
-#include <ctype.h>
/* The name of the SystemTap section where we will find information about
the probes. */
@@ -575,14 +574,14 @@ stap_is_integer_prefix (struct gdbarch *gdbarch, const char *s,
if (r != NULL)
*r = "";
- return isdigit (*s) > 0;
+ return c_isdigit (*s) > 0;
}
for (p = t; *p != NULL; ++p)
{
size_t len = strlen (*p);
- if ((len == 0 && isdigit (*s))
+ if ((len == 0 && c_isdigit (*s))
|| (len > 0 && strncasecmp (s, *p, len) == 0))
{
/* Integers may or may not have a prefix. The "len == 0"
@@ -732,7 +731,7 @@ stap_parse_register_operand (struct stap_parse_info *p)
struct type *long_type = builtin_type (gdbarch)->builtin_long;
operation_up disp_op;
- if (isdigit (*p->arg))
+ if (c_isdigit (*p->arg))
{
/* The value of the displacement. */
long displacement;
@@ -767,14 +766,14 @@ stap_parse_register_operand (struct stap_parse_info *p)
start = p->arg;
/* We assume the register name is composed by letters and numbers. */
- while (isalnum (*p->arg))
+ while (c_isalnum (*p->arg))
++p->arg;
std::string regname (start, p->arg - start);
/* We only add the GDB's register prefix/suffix if we are dealing with
a numeric register. */
- if (isdigit (*start))
+ if (c_isdigit (*start))
{
if (gdb_reg_prefix != NULL)
regname = gdb_reg_prefix + regname;
@@ -921,7 +920,7 @@ stap_parse_single_operand (struct stap_parse_info *p)
if (p->inside_paren_p)
tmp = skip_spaces (tmp);
- while (isdigit (*tmp))
+ while (c_isdigit (*tmp))
{
/* We skip the digit here because we are only interested in
knowing what kind of unary operation this is. The digit
@@ -959,7 +958,7 @@ stap_parse_single_operand (struct stap_parse_info *p)
(std::move (result)));
}
}
- else if (isdigit (*p->arg))
+ else if (c_isdigit (*p->arg))
{
/* A temporary variable, needed for lookahead. */
const char *tmp = p->arg;
@@ -1042,7 +1041,7 @@ stap_parse_argument_conditionally (struct stap_parse_info *p)
expr::operation_up result;
if (*p->arg == '-' || *p->arg == '~' || *p->arg == '+' || *p->arg == '!'
- || isdigit (*p->arg)
+ || c_isdigit (*p->arg)
|| gdbarch_stap_is_single_operand (p->gdbarch, p->arg))
result = stap_parse_single_operand (p);
else if (*p->arg == '(')
@@ -1111,7 +1110,7 @@ stap_parse_argument_1 (struct stap_parse_info *p,
This loop shall continue until we run out of characters in the input,
or until we find a close-parenthesis, which means that we've reached
the end of a sub-expression. */
- while (*p->arg != '\0' && *p->arg != ')' && !isspace (*p->arg))
+ while (*p->arg != '\0' && *p->arg != ')' && !c_isspace (*p->arg))
{
const char *tmp_exp_buf;
enum exp_opcode opcode;
@@ -1225,7 +1224,7 @@ stap_parse_argument (const char **arg, struct type *atype,
{
/* We need to initialize the expression buffer, in order to begin
our parsing efforts. We use language_c here because we may need
- to do pointer arithmetics. */
+ to do pointer arithmetic. */
struct stap_parse_info p (*arg, atype, language_def (language_c),
gdbarch);
@@ -1270,8 +1269,8 @@ stap_probe::parse_arguments (struct gdbarch *gdbarch)
Where `N' can be [+,-][1,2,4,8]. This is not mandatory, so
we check it here. If we don't find it, go to the next
state. */
- if ((cur[0] == '-' && isdigit (cur[1]) && cur[2] == '@')
- || (isdigit (cur[0]) && cur[1] == '@'))
+ if ((cur[0] == '-' && c_isdigit (cur[1]) && cur[2] == '@')
+ || (c_isdigit (cur[0]) && cur[1] == '@'))
{
if (*cur == '-')
{
@@ -1748,9 +1747,7 @@ info_probes_stap_command (const char *arg, int from_tty)
info_probes_for_spops (arg, from_tty, &stap_static_probe_ops);
}
-void _initialize_stap_probe ();
-void
-_initialize_stap_probe ()
+INIT_GDB_FILE (stap_probe)
{
all_static_probe_ops.push_back (&stap_static_probe_ops);
diff --git a/gdb/stap-probe.h b/gdb/stap-probe.h
index e757d80..2819a5b 100644
--- a/gdb/stap-probe.h
+++ b/gdb/stap-probe.h
@@ -1,6 +1,6 @@
/* SystemTap probe support for GDB.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/std-operator.def b/gdb/std-operator.def
index 296d9fa..d12421e 100644
--- a/gdb/std-operator.def
+++ b/gdb/std-operator.def
@@ -1,6 +1,6 @@
/* Standard language operator definitions for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/std-regs.c b/gdb/std-regs.c
index 3539d8a..9940cb0 100644
--- a/gdb/std-regs.c
+++ b/gdb/std-regs.c
@@ -1,6 +1,6 @@
/* Builtin frame register, for GDB, the GNU debugger.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Red Hat.
@@ -93,9 +93,7 @@ value_of_builtin_frame_ps_reg (const frame_info_ptr &frame, const void *baton)
error (_("Standard register ``$ps'' is not available for this target"));
}
-void _initialize_frame_reg ();
-void
-_initialize_frame_reg ()
+INIT_GDB_FILE (frame_reg)
{
/* Frame based $fp, $pc, $sp and $ps. These only come into play
when the target does not define its own version of these
diff --git a/gdb/stub-termcap.c b/gdb/stub-termcap.c
index ff0ef99..f7b7005 100644
--- a/gdb/stub-termcap.c
+++ b/gdb/stub-termcap.c
@@ -1,6 +1,6 @@
/* A very minimal do-nothing termcap emulation stub.
- Copyright (C) 2005-2024 Free Software Foundation, Inc.
+ Copyright (C) 2005-2025 Free Software Foundation, Inc.
Contributed by CodeSourcery, LLC.
diff --git a/gdb/stubs/buildvms.com b/gdb/stubs/buildvms.com
index eecdf72..d36d5d3 100644
--- a/gdb/stubs/buildvms.com
+++ b/gdb/stubs/buildvms.com
@@ -1,6 +1,6 @@
$! Command to build the gdb stub
-$! Copyright (C) 2012-2024 Free Software Foundation, Inc.
+$! Copyright (C) 2012-2025 Free Software Foundation, Inc.
$!
$! This file is part of GDB.
$!
diff --git a/gdb/stubs/ia64vms-stub.c b/gdb/stubs/ia64vms-stub.c
index 7e08119..549e7f5 100644
--- a/gdb/stubs/ia64vms-stub.c
+++ b/gdb/stubs/ia64vms-stub.c
@@ -1,5 +1,5 @@
/* GDB stub for Itanium OpenVMS
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
Contributed by Tristan Gingold, AdaCore.
diff --git a/gdb/stubs/z80-stub.c b/gdb/stubs/z80-stub.c
index 745688c..37007c2 100644
--- a/gdb/stubs/z80-stub.c
+++ b/gdb/stubs/z80-stub.c
@@ -1,6 +1,6 @@
/* Debug stub for Z80.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/svr4-tls-tdep.c b/gdb/svr4-tls-tdep.c
new file mode 100644
index 0000000..1f36d57
--- /dev/null
+++ b/gdb/svr4-tls-tdep.c
@@ -0,0 +1,254 @@
+/* Target-dependent code for GNU/Linux, architecture independent.
+
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "svr4-tls-tdep.h"
+#include "solib-svr4.h"
+#include "inferior.h"
+#include "objfiles.h"
+#include "cli/cli-cmds.h"
+#include <optional>
+
+struct svr4_tls_gdbarch_data
+{
+ /* Method for looking up TLS DTV. */
+ get_tls_dtv_addr_ftype *get_tls_dtv_addr = nullptr;
+
+ /* Method for looking up the TLS DTP offset. */
+ get_tls_dtp_offset_ftype *get_tls_dtp_offset = nullptr;
+
+ /* Cached libc value for TLS lookup purposes. */
+ enum svr4_tls_libc libc = svr4_tls_libc_unknown;
+};
+
+static const registry<gdbarch>::key<svr4_tls_gdbarch_data>
+ svr4_tls_gdbarch_data_handle;
+
+static struct svr4_tls_gdbarch_data *
+get_svr4_tls_gdbarch_data (struct gdbarch *gdbarch)
+{
+ struct svr4_tls_gdbarch_data *result = svr4_tls_gdbarch_data_handle.get (gdbarch);
+ if (result == nullptr)
+ result = svr4_tls_gdbarch_data_handle.emplace (gdbarch);
+ return result;
+}
+
+/* When true, force internal TLS address lookup instead of lookup via
+ the thread stratum. */
+
+static bool force_internal_tls_address_lookup = false;
+
+/* For TLS lookup purposes, use heuristics to decide whether program
+ was linked against MUSL or GLIBC. */
+
+static enum svr4_tls_libc
+libc_tls_sniffer (struct gdbarch *gdbarch)
+{
+ /* Check for cached libc value. */
+ svr4_tls_gdbarch_data *gdbarch_data = get_svr4_tls_gdbarch_data (gdbarch);
+ if (gdbarch_data->libc != svr4_tls_libc_unknown)
+ return gdbarch_data->libc;
+
+ svr4_tls_libc libc = svr4_tls_libc_unknown;
+
+ /* Fetch the program interpreter. */
+ std::optional<gdb::byte_vector> interp_name_holder
+ = svr4_find_program_interpreter ();
+ if (interp_name_holder)
+ {
+ /* A dynamically linked program linked against MUSL will have a
+ "ld-musl-" in its interpreter name. (Two examples of MUSL
+ interpreter names are "/lib/ld-musl-x86_64.so.1" and
+ "lib/ld-musl-aarch64.so.1".) If it's not found, assume GLIBC. */
+ const char *interp_name = (const char *) interp_name_holder->data ();
+ if (strstr (interp_name, "/ld-musl-") != nullptr)
+ libc = svr4_tls_libc_musl;
+ else
+ libc = svr4_tls_libc_glibc;
+ gdbarch_data->libc = libc;
+ return libc;
+ }
+
+ /* If there is no interpreter name, it's statically linked. For
+ programs with TLS data, a program statically linked against MUSL
+ will have the symbols 'main_tls' and 'builtin_tls'. If both of
+ these are present, assume that it was statically linked against
+ MUSL, otherwise assume GLIBC. */
+ if (lookup_minimal_symbol (current_program_space, "main_tls").minsym
+ != nullptr
+ && lookup_minimal_symbol (current_program_space, "builtin_tls").minsym
+ != nullptr)
+ libc = svr4_tls_libc_musl;
+ else
+ libc = svr4_tls_libc_glibc;
+ gdbarch_data->libc = libc;
+ return libc;
+}
+
+/* Implement gdbarch method, get_thread_local_address, for architectures
+ which provide a method for determining the DTV and possibly the DTP
+ offset. */
+
+CORE_ADDR
+svr4_tls_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
+ CORE_ADDR lm_addr, CORE_ADDR offset)
+{
+ svr4_tls_gdbarch_data *gdbarch_data = get_svr4_tls_gdbarch_data (gdbarch);
+
+ /* Use the target's get_thread_local_address method when:
+
+ - No method has been provided for finding the TLS DTV.
+
+ or
+
+ - The thread stratum has been pushed (at some point) onto the
+ target stack, except when 'force_internal_tls_address_lookup'
+ has been set.
+
+ The idea here is to prefer use of of the target's thread_stratum
+ method since it should be more accurate. */
+ if (gdbarch_data->get_tls_dtv_addr == nullptr
+ || (find_target_at (thread_stratum) != nullptr
+ && !force_internal_tls_address_lookup))
+ {
+ struct target_ops *target = current_inferior ()->top_target ();
+ return target->get_thread_local_address (ptid, lm_addr, offset);
+ }
+ else
+ {
+ /* Details, found below, regarding TLS layout is for the GNU C
+ library (glibc) and the MUSL C library (musl), circa 2024.
+ While some of this layout is defined by the TLS ABI, some of
+ it, such as how/where to find the DTV pointer in the TCB, is
+ not. A good source of ABI info for some architectures can be
+ found in "ELF Handling For Thread-Local Storage" by Ulrich
+ Drepper. That document is worth consulting even for
+ architectures not described there, since the general approach
+ and terminology is used regardless.
+
+ Some architectures, such as aarch64, are not described in
+ that document, so some details had to ferreted out using the
+ glibc source code. Likewise, the MUSL source code was
+ consulted for details which differ from GLIBC. */
+ enum svr4_tls_libc libc = libc_tls_sniffer (gdbarch);
+ int mod_id;
+ if (libc == svr4_tls_libc_glibc)
+ mod_id = glibc_link_map_to_tls_module_id (lm_addr);
+ else /* Assume MUSL. */
+ mod_id = musl_link_map_to_tls_module_id (lm_addr);
+ if (mod_id == 0)
+ throw_error (TLS_GENERIC_ERROR, _("Unable to determine TLS module id"));
+
+ /* Use the architecture specific DTV fetcher to obtain the DTV. */
+ CORE_ADDR dtv_addr = gdbarch_data->get_tls_dtv_addr (gdbarch, ptid, libc);
+
+ /* In GLIBC, The DTV (dynamic thread vector) is an array of
+ structs consisting of two fields, the first of which is a
+ pointer to the TLS block of interest. (The second field is a
+ pointer that assists with memory management, but that's not
+ of interest here.) Also, the 0th entry is the generation
+ number, but although it's a single scalar, the 0th entry is
+ padded to be the same size as all the rest. Thus each
+ element of the DTV array is two pointers in size.
+
+ In MUSL, the DTV is simply an array of pointers. The 0th
+ entry is still the generation number, but contains no padding
+ aside from that which is needed to make it pointer sized. */
+ int m; /* Multiplier, for size of DTV entry. */
+ switch (libc)
+ {
+ case svr4_tls_libc_glibc:
+ m = 2;
+ break;
+ default:
+ m = 1;
+ break;
+ }
+
+ /* Obtain TLS block address. Module ids start at 1, so there's
+ no need to adjust it to skip over the 0th entry of the DTV,
+ which is the generation number. */
+ CORE_ADDR dtv_elem_addr
+ = dtv_addr + mod_id * m * (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
+ gdb::byte_vector buf (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
+ if (target_read_memory (dtv_elem_addr, buf.data (), buf.size ()) != 0)
+ throw_error (TLS_GENERIC_ERROR, _("Unable to fetch TLS block address"));
+ const struct builtin_type *builtin = builtin_type (gdbarch);
+ CORE_ADDR tls_block_addr = gdbarch_pointer_to_address
+ (gdbarch, builtin->builtin_data_ptr,
+ buf.data ());
+
+ /* When the TLS block addr is 0 or -1, this usually indicates that
+ the TLS storage hasn't been allocated yet. (In GLIBC, some
+ architectures use 0 while others use -1.) */
+ if (tls_block_addr == 0 || tls_block_addr == (CORE_ADDR) -1)
+ throw_error (TLS_NOT_ALLOCATED_YET_ERROR, _("TLS not allocated yet"));
+
+ /* MUSL (and perhaps other C libraries, though not GLIBC) have
+ TLS implementations for some architectures which, for some
+ reason, have DTV entries which must be negatively offset by
+ DTP_OFFSET in order to obtain the TLS block address.
+ DTP_OFFSET is a constant in the MUSL sources - these offsets,
+ when they're non-zero, seem to be either 0x800 or 0x8000,
+ and are present for riscv[32/64], powerpc[32/64], m68k, and
+ mips.
+
+ Use the architecture specific get_tls_dtp_offset method, if
+ present, to obtain this offset. */
+ ULONGEST dtp_offset
+ = gdbarch_data->get_tls_dtp_offset == nullptr
+ ? 0
+ : gdbarch_data->get_tls_dtp_offset (gdbarch, ptid, libc);
+
+ return tls_block_addr - dtp_offset + offset;
+ }
+}
+
+/* See svr4-tls-tdep.h. */
+
+void
+svr4_tls_register_tls_methods (struct gdbarch_info info, struct gdbarch *gdbarch,
+ get_tls_dtv_addr_ftype *get_tls_dtv_addr,
+ get_tls_dtp_offset_ftype *get_tls_dtp_offset)
+{
+ gdb_assert (get_tls_dtv_addr != nullptr);
+
+ svr4_tls_gdbarch_data *gdbarch_data = get_svr4_tls_gdbarch_data (gdbarch);
+ gdbarch_data->get_tls_dtv_addr = get_tls_dtv_addr;
+ gdbarch_data->get_tls_dtp_offset = get_tls_dtp_offset;
+}
+
+INIT_GDB_FILE (svr4_tls_tdep)
+{
+ add_setshow_boolean_cmd ("force-internal-tls-address-lookup", class_obscure,
+ &force_internal_tls_address_lookup, _("\
+Set to force internal TLS address lookup."), _("\
+Show whether GDB is forced to use internal TLS address lookup."), _("\
+When resolving addresses for TLS (Thread Local Storage) variables,\n\
+GDB will attempt to use facilities provided by the thread library (i.e.\n\
+libthread_db). If those facilities aren't available, GDB will fall\n\
+back to using some internal (to GDB), but possibly less accurate\n\
+mechanisms to resolve the addresses for TLS variables. When this flag\n\
+is set, GDB will force use of the fall-back TLS resolution mechanisms.\n\
+This flag is used by some GDB tests to ensure that the internal fallback\n\
+code is exercised and working as expected. The default is to not force\n\
+the internal fall-back mechanisms to be used."),
+ NULL, NULL,
+ &maintenance_set_cmdlist,
+ &maintenance_show_cmdlist);
+}
diff --git a/gdb/svr4-tls-tdep.h b/gdb/svr4-tls-tdep.h
new file mode 100644
index 0000000..73efc02
--- /dev/null
+++ b/gdb/svr4-tls-tdep.h
@@ -0,0 +1,59 @@
+/* Target-dependent code for GNU/Linux, architecture independent.
+
+ Copyright (C) 2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef GDB_SVR4_TLS_TDEP_H
+#define GDB_SVR4_TLS_TDEP_H
+
+/* C library variants for TLS lookup. */
+
+enum svr4_tls_libc
+{
+ svr4_tls_libc_unknown,
+ svr4_tls_libc_musl,
+ svr4_tls_libc_glibc
+};
+
+/* Function type for "get_tls_dtv_addr" method. */
+
+typedef CORE_ADDR (get_tls_dtv_addr_ftype) (struct gdbarch *gdbarch,
+ ptid_t ptid,
+ enum svr4_tls_libc libc);
+
+/* Function type for "get_tls_dtp_offset" method. */
+
+typedef CORE_ADDR (get_tls_dtp_offset_ftype) (struct gdbarch *gdbarch,
+ ptid_t ptid,
+ enum svr4_tls_libc libc);
+
+/* Register architecture specific methods for fetching the TLS DTV
+ and TLS DTP, used by linux_get_thread_local_address. */
+
+extern void svr4_tls_register_tls_methods
+ (struct gdbarch_info info, struct gdbarch *gdbarch,
+ get_tls_dtv_addr_ftype *get_tls_dtv_addr,
+ get_tls_dtp_offset_ftype *get_tls_dtp_offset = nullptr);
+
+/* Used as a gdbarch method for get_thread_local_address when the tdep
+ file also defines a suitable method for obtaining the TLS DTV.
+ See linux_init_abi(), above. */
+CORE_ADDR
+svr4_tls_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
+ CORE_ADDR lm_addr, CORE_ADDR offset);
+
+#endif /* GDB_SVR4_TLS_TDEP_H */
diff --git a/gdb/sym-domains.def b/gdb/sym-domains.def
index dd5b1b6..4a7f713 100644
--- a/gdb/sym-domains.def
+++ b/gdb/sym-domains.def
@@ -1,6 +1,6 @@
/* Symbol domains -*- c++ -*-
- Copyright (C) 2023 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/symfile-add-flags.h b/gdb/symfile-add-flags.h
index 3db532c..bc074e6 100644
--- a/gdb/symfile-add-flags.h
+++ b/gdb/symfile-add-flags.h
@@ -1,6 +1,6 @@
/* Definition of symfile add flags.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c
index 9378398..b402a87 100644
--- a/gdb/symfile-debug.c
+++ b/gdb/symfile-debug.c
@@ -1,6 +1,6 @@
/* Debug logging for the symbol file functions for the GNU debugger, GDB.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules.
@@ -152,13 +152,81 @@ objfile::forget_cached_source_info ()
gdb_printf (gdb_stdlog, "qf->forget_cached_source_info (%s)\n",
objfile_debug_name (this));
- for (compunit_symtab *cu : compunits ())
- cu->forget_cached_source_info ();
+ for (compunit_symtab &cu : compunits ())
+ cu.forget_cached_source_info ();
for (const auto &iter : qf)
iter->forget_cached_source_info (this);
}
+/* Check for a symtab of a specific name by searching some symtabs.
+
+ If NAME is not absolute, then REAL_PATH is NULL
+ If NAME is absolute, then REAL_PATH is the gdb_realpath form of NAME.
+
+ The return value, NAME, REAL_PATH and CALLBACK are identical to the
+ `map_symtabs_matching_filename' method of quick_symbol_functions.
+
+ CUST indicates which compunit symtab to search. Each symtab within
+ the specified compunit symtab is also searched. */
+
+static bool
+iterate_over_one_compunit_symtab (const char *name,
+ const char *real_path,
+ compunit_symtab *cust,
+ gdb::function_view<bool (symtab *)> callback)
+{
+ const char *base_name = lbasename (name);
+
+ /* Skip included compunits. */
+ if (cust->user != nullptr)
+ return false;
+
+ for (symtab *s : cust->filetabs ())
+ {
+ if (compare_filenames_for_search (s->filename, name))
+ {
+ if (callback (s))
+ return true;
+ continue;
+ }
+
+ /* Before we invoke realpath, which can get expensive when many
+ files are involved, do a quick comparison of the basenames. */
+ if (! basenames_may_differ
+ && FILENAME_CMP (base_name, lbasename (s->filename)) != 0)
+ continue;
+
+ if (compare_filenames_for_search (symtab_to_fullname (s), name))
+ {
+ if (callback (s))
+ return true;
+ continue;
+ }
+
+ /* If the user gave us an absolute path, try to find the file in
+ this symtab and use its absolute path. */
+ if (real_path != NULL)
+ {
+ const char *fullname = symtab_to_fullname (s);
+
+ gdb_assert (IS_ABSOLUTE_PATH (real_path));
+ gdb_assert (IS_ABSOLUTE_PATH (name));
+ gdb::unique_xmalloc_ptr<char> fullname_real_path
+ = gdb_realpath (fullname);
+ fullname = fullname_real_path.get ();
+ if (FILENAME_CMP (real_path, fullname) == 0)
+ {
+ if (callback (s))
+ return true;
+ continue;
+ }
+ }
+ }
+
+ return false;
+}
+
bool
objfile::map_symtabs_matching_filename
(const char *name, const char *real_path,
@@ -172,7 +240,7 @@ objfile::map_symtabs_matching_filename
real_path ? real_path : NULL,
host_address_to_string (&callback));
- bool retval = true;
+ bool retval = false;
const char *name_basename = lbasename (name);
auto match_one_filename = [&] (const char *filename, bool basenames)
@@ -187,33 +255,22 @@ objfile::map_symtabs_matching_filename
return false;
};
- compunit_symtab *last_made = this->compunit_symtabs;
-
- auto on_expansion = [&] (compunit_symtab *symtab)
+ auto listener = [&] (compunit_symtab *symtab)
{
- /* The callback to iterate_over_some_symtabs returns false to keep
- going and true to continue, so we have to invert the result
- here, for expand_symtabs_matching. */
- bool result = !iterate_over_some_symtabs (name, real_path,
- this->compunit_symtabs,
- last_made,
+ /* CALLBACK returns false to keep going and true to continue, so
+ we have to invert the result here, for search. */
+ return !iterate_over_one_compunit_symtab (name, real_path, symtab,
callback);
- last_made = this->compunit_symtabs;
- return result;
};
for (const auto &iter : qf)
{
- if (!iter->expand_symtabs_matching (this,
- match_one_filename,
- nullptr,
- nullptr,
- on_expansion,
- (SEARCH_GLOBAL_BLOCK
- | SEARCH_STATIC_BLOCK),
- SEARCH_ALL_DOMAINS))
+ if (!iter->search (this, match_one_filename, nullptr, nullptr,
+ listener,
+ SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
+ SEARCH_ALL_DOMAINS))
{
- retval = false;
+ retval = true;
break;
}
}
@@ -223,9 +280,7 @@ objfile::map_symtabs_matching_filename
"qf->map_symtabs_matching_filename (...) = %d\n",
retval);
- /* We must re-invert the return value here to match the caller's
- expectations. */
- return !retval;
+ return retval;
}
struct compunit_symtab *
@@ -267,15 +322,11 @@ objfile::lookup_symbol (block_enum kind, const lookup_name_info &name,
for (const auto &iter : qf)
{
- if (!iter->expand_symtabs_matching (this,
- nullptr,
- &name,
- nullptr,
- search_one_symtab,
- kind == GLOBAL_BLOCK
- ? SEARCH_GLOBAL_BLOCK
- : SEARCH_STATIC_BLOCK,
- domain))
+ if (!iter->search (this, nullptr, &name, nullptr, search_one_symtab,
+ kind == GLOBAL_BLOCK
+ ? SEARCH_GLOBAL_BLOCK
+ : SEARCH_STATIC_BLOCK,
+ domain))
break;
}
@@ -311,28 +362,6 @@ objfile::dump ()
}
void
-objfile::expand_symtabs_for_function (const char *func_name)
-{
- if (debug_symfile)
- gdb_printf (gdb_stdlog,
- "qf->expand_symtabs_for_function (%s, \"%s\")\n",
- objfile_debug_name (this), func_name);
-
- lookup_name_info base_lookup (func_name, symbol_name_match_type::FULL);
- lookup_name_info lookup_name = base_lookup.make_ignore_params ();
-
- for (const auto &iter : qf)
- iter->expand_symtabs_matching (this,
- nullptr,
- &lookup_name,
- nullptr,
- nullptr,
- (SEARCH_GLOBAL_BLOCK
- | SEARCH_STATIC_BLOCK),
- SEARCH_FUNCTION_DOMAIN);
-}
-
-void
objfile::expand_all_symtabs ()
{
if (debug_symfile)
@@ -358,43 +387,35 @@ objfile::expand_symtabs_with_fullname (const char *fullname)
};
for (const auto &iter : qf)
- iter->expand_symtabs_matching (this,
- file_matcher,
- nullptr,
- nullptr,
- nullptr,
- (SEARCH_GLOBAL_BLOCK
- | SEARCH_STATIC_BLOCK),
- SEARCH_ALL_DOMAINS);
+ iter->search (this, file_matcher, nullptr, nullptr, nullptr,
+ SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
+ SEARCH_ALL_DOMAINS);
}
bool
-objfile::expand_symtabs_matching
- (expand_symtabs_file_matcher file_matcher,
- const lookup_name_info *lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
- block_search_flags search_flags,
- domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher)
-{
- /* This invariant is documented in quick-functions.h. */
+objfile::search (search_symtabs_file_matcher file_matcher,
+ const lookup_name_info *lookup_name,
+ search_symtabs_symbol_matcher symbol_matcher,
+ search_symtabs_expansion_listener listener,
+ block_search_flags search_flags,
+ domain_search_flags domain,
+ search_symtabs_lang_matcher lang_matcher)
+{
+ /* This invariant is documented in quick-symbol.h. */
gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr);
if (debug_symfile)
gdb_printf (gdb_stdlog,
- "qf->expand_symtabs_matching (%s, %s, %s, %s, %s)\n",
+ "qf->search (%s, %s, %s, %s, %s)\n",
objfile_debug_name (this),
host_address_to_string (&file_matcher),
host_address_to_string (&symbol_matcher),
- host_address_to_string (&expansion_notify),
+ host_address_to_string (&listener),
domain_name (domain).c_str ());
for (const auto &iter : qf)
- if (!iter->expand_symtabs_matching (this, file_matcher, lookup_name,
- symbol_matcher, expansion_notify,
- search_flags, domain,
- lang_matcher))
+ if (!iter->search (this, file_matcher, lookup_name, symbol_matcher,
+ listener, search_flags, domain, lang_matcher))
return false;
return true;
}
@@ -873,17 +894,17 @@ static void
set_debug_symfile (const char *args, int from_tty, struct cmd_list_element *c)
{
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
if (debug_symfile)
{
- if (!symfile_debug_installed (objfile))
- install_symfile_debug_logging (objfile);
+ if (!symfile_debug_installed (&objfile))
+ install_symfile_debug_logging (&objfile);
}
else
{
- if (symfile_debug_installed (objfile))
- uninstall_symfile_debug_logging (objfile);
+ if (symfile_debug_installed (&objfile))
+ uninstall_symfile_debug_logging (&objfile);
}
}
}
@@ -895,9 +916,7 @@ show_debug_symfile (struct ui_file *file, int from_tty,
gdb_printf (file, _("Symfile debugging is %s.\n"), value);
}
-void _initialize_symfile_debug ();
-void
-_initialize_symfile_debug ()
+INIT_GDB_FILE (symfile_debug)
{
add_setshow_boolean_cmd ("symfile", no_class, &debug_symfile, _("\
Set debugging of the symfile functions."), _("\
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index 42569f4..9bf79f7 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -1,6 +1,6 @@
/* Reading symbol files from memory.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -166,8 +166,8 @@ add_vsyscall_page (inferior *inf)
{
struct bfd *bfd;
- if (current_program_space->core_bfd () != nullptr)
- bfd = current_program_space->core_bfd ();
+ if (get_inferior_core_bfd (current_inferior ()) != nullptr)
+ bfd = get_inferior_core_bfd (current_inferior ());
else if (current_program_space->exec_bfd () != nullptr)
bfd = current_program_space->exec_bfd ();
else
@@ -204,9 +204,7 @@ add_vsyscall_page (inferior *inf)
}
}
-void _initialize_symfile_mem ();
-void
-_initialize_symfile_mem ()
+INIT_GDB_FILE (symfile_mem)
{
add_cmd ("add-symbol-file-from-memory", class_files,
add_symbol_file_from_memory_command,
diff --git a/gdb/symfile.c b/gdb/symfile.c
index b0c178a..eb96924 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1,6 +1,6 @@
/* Generic symbol file reading for the GNU debugger, GDB.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules.
@@ -58,7 +58,6 @@
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
-#include <ctype.h>
#include <chrono>
#include <algorithm>
@@ -835,9 +834,9 @@ init_entry_point_info (struct objfile *objfile)
= gdbarch_addr_bits_remove (objfile->arch (), entry_point);
found = 0;
- for (obj_section *osect : objfile->sections ())
+ for (obj_section &osect : objfile->sections ())
{
- struct bfd_section *sect = osect->the_bfd_section;
+ struct bfd_section *sect = osect.the_bfd_section;
if (entry_point >= bfd_section_vma (sect)
&& entry_point < (bfd_section_vma (sect)
@@ -1101,7 +1100,7 @@ symbol_file_add_with_addrs (const gdb_bfd_ref_ptr &abfd, const char *name,
no separate debug file. If there is a separate debug file which
does not have symbols, we'll have emitted this message for that
file, and so printing it twice is just redundant. */
- if (should_print && !objfile_has_symbols (objfile)
+ if (should_print && !objfile->has_symbols ()
&& objfile->separate_debug_objfile == nullptr)
gdb_printf (_("(No debugging symbols found in %ps)\n"),
styled_string (file_name_style.style (), name));
@@ -2323,7 +2322,7 @@ add_symbol_file_command (const char *args, int from_tty)
objf = symbol_file_add (filename.get (), add_flags, &section_addrs,
flags);
- if (!objfile_has_symbols (objf) && objf->per_bfd->minimal_symbol_count <= 0)
+ if (!objf->has_symbols () && objf->per_bfd->minimal_symbol_count <= 0)
warning (_("newly-added symbol file \"%ps\" does not provide any symbols"),
styled_string (file_name_style.style (), filename.get ()));
@@ -2417,14 +2416,14 @@ remove_symbol_file_command (const char *args, int from_tty)
CORE_ADDR addr = parse_and_eval_address (args);
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- if ((objfile->flags & OBJF_USERLOADED) != 0
- && (objfile->flags & OBJF_SHARED) != 0
- && objfile->pspace () == current_program_space
- && is_addr_in_objfile (addr, objfile))
+ if ((objfile.flags & OBJF_USERLOADED) != 0
+ && (objfile.flags & OBJF_SHARED) != 0
+ && objfile.pspace () == current_program_space
+ && is_addr_in_objfile (addr, &objfile))
{
- objf = objfile;
+ objf = &objfile;
break;
}
}
@@ -2435,14 +2434,14 @@ remove_symbol_file_command (const char *args, int from_tty)
if (filename.empty ())
error (_("remove-symbol-file: no symbol file provided"));
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- if ((objfile->flags & OBJF_USERLOADED) != 0
- && (objfile->flags & OBJF_SHARED) != 0
- && objfile->pspace () == current_program_space
- && filename_cmp (filename.c_str (), objfile_name (objfile)) == 0)
+ if ((objfile.flags & OBJF_USERLOADED) != 0
+ && (objfile.flags & OBJF_SHARED) != 0
+ && objfile.pspace () == current_program_space
+ && filename_cmp (filename.c_str (), objfile_name (&objfile)) == 0)
{
- objf = objfile;
+ objf = &objfile;
break;
}
}
@@ -2474,13 +2473,13 @@ reread_symbols (int from_tty)
indicate when the executable was last reloaded. */
reopen_exec_file ();
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- if (objfile->obfd.get () == NULL)
+ if (objfile.obfd.get () == NULL)
continue;
/* Separate debug objfiles are handled in the main objfile. */
- if (objfile->separate_debug_objfile_backlink)
+ if (objfile.separate_debug_objfile_backlink)
continue;
/* When a in-memory BFD is initially created, it's mtime (as
@@ -2492,11 +2491,11 @@ reread_symbols (int from_tty)
about reloading BFDs that changed on disk.
Just skip any in-memory BFD. */
- if (objfile->obfd.get ()->flags & BFD_IN_MEMORY)
+ if (objfile.obfd.get ()->flags & BFD_IN_MEMORY)
continue;
struct stat new_statbuf;
- int res = gdb_bfd_stat (objfile->obfd.get (), &new_statbuf);
+ int res = gdb_bfd_stat (objfile.obfd.get (), &new_statbuf);
if (res != 0)
{
/* If this object is from an archive (what you usually create
@@ -2504,21 +2503,21 @@ reread_symbols (int from_tty)
though a `shared library' on AIX is also an archive), then you
should stat on the archive name, not member name. */
const char *filename;
- if (objfile->obfd->my_archive)
- filename = bfd_get_filename (objfile->obfd->my_archive);
+ if (objfile.obfd->my_archive)
+ filename = bfd_get_filename (objfile.obfd->my_archive);
else
- filename = objfile_name (objfile);
+ filename = objfile_name (&objfile);
warning (_("`%ps' has disappeared; keeping its symbols."),
styled_string (file_name_style.style (), filename));
continue;
}
time_t new_modtime = new_statbuf.st_mtime;
- if (new_modtime != objfile->mtime)
+ if (new_modtime != objfile.mtime)
{
gdb_printf (_("`%ps' has changed; re-reading symbols.\n"),
styled_string (file_name_style.style (),
- objfile_name (objfile)));
+ objfile_name (&objfile)));
/* There are various functions like symbol_file_add,
symfile_bfd_open, syms_from_objfile, etc., which might
@@ -2530,7 +2529,7 @@ reread_symbols (int from_tty)
/* If we get an error, blow away this objfile (not sure if
that is the correct response for things like shared
libraries). */
- scoped_objfile_unlinker objfile_holder (objfile);
+ scoped_objfile_unlinker objfile_holder (&objfile);
/* We need to do this whenever any symbols go away. */
clear_symtab_users_cleanup defer_clear_users (0);
@@ -2539,14 +2538,14 @@ reread_symbols (int from_tty)
/* Free the separate debug objfiles. It will be
automatically recreated by sym_read. */
- free_objfile_separate_debug (objfile);
+ free_objfile_separate_debug (&objfile);
/* Clear the stale source cache. */
forget_cached_source_info ();
/* Remove any references to this objfile in the global
value lists. */
- preserve_values (objfile);
+ preserve_values (&objfile);
/* Nuke all the state that we will re-read. Much of the following
code which sets things to NULL really is necessary to tell
@@ -2554,78 +2553,78 @@ reread_symbols (int from_tty)
Try to keep the freeing order compatible with free_objfile. */
- if (objfile->sf != NULL)
+ if (objfile.sf != NULL)
{
- (*objfile->sf->sym_finish) (objfile);
+ (*objfile.sf->sym_finish) (&objfile);
}
- objfile->registry_fields.clear_registry ();
+ objfile.registry_fields.clear_registry ();
/* Clean up any state BFD has sitting around. */
{
- gdb_bfd_ref_ptr obfd = objfile->obfd;
+ gdb_bfd_ref_ptr obfd = objfile.obfd;
const char *obfd_filename;
- obfd_filename = bfd_get_filename (objfile->obfd.get ());
+ obfd_filename = bfd_get_filename (objfile.obfd.get ());
/* Open the new BFD before freeing the old one, so that
the filename remains live. */
gdb_bfd_ref_ptr temp (gdb_bfd_open (obfd_filename, gnutarget));
- objfile->obfd = std::move (temp);
- if (objfile->obfd == NULL)
+ objfile.obfd = std::move (temp);
+ if (objfile.obfd == NULL)
error (_("Can't open %s to read symbols."), obfd_filename);
}
- std::string original_name = objfile->original_name;
+ std::string original_name = objfile.original_name;
/* bfd_openr sets cacheable to true, which is what we want. */
- if (!bfd_check_format (objfile->obfd.get (), bfd_object))
- error (_("Can't read symbols from %s: %s."), objfile_name (objfile),
+ if (!bfd_check_format (objfile.obfd.get (), bfd_object))
+ error (_("Can't read symbols from %s: %s."), objfile_name (&objfile),
bfd_errmsg (bfd_get_error ()));
/* NB: after this call to obstack_free, objfiles_changed
will need to be called (see discussion below). */
- obstack_free (&objfile->objfile_obstack, 0);
- objfile->sections_start = NULL;
- objfile->section_offsets.clear ();
- objfile->sect_index_bss = -1;
- objfile->sect_index_data = -1;
- objfile->sect_index_rodata = -1;
- objfile->sect_index_text = -1;
- objfile->compunit_symtabs = NULL;
- objfile->template_symbols = NULL;
- objfile->static_links.clear ();
+ obstack_free (&objfile.objfile_obstack, 0);
+ objfile.sections_start = NULL;
+ objfile.section_offsets.clear ();
+ objfile.sect_index_bss = -1;
+ objfile.sect_index_data = -1;
+ objfile.sect_index_rodata = -1;
+ objfile.sect_index_text = -1;
+ objfile.compunit_symtabs.clear ();
+ objfile.template_symbols = NULL;
+ objfile.static_links.clear ();
/* obstack_init also initializes the obstack so it is
empty. We could use obstack_specify_allocation but
gdb_obstack.h specifies the alloc/dealloc functions. */
- obstack_init (&objfile->objfile_obstack);
+ obstack_init (&objfile.objfile_obstack);
/* set_objfile_per_bfd potentially allocates the per-bfd
data on the objfile's obstack (if sharing data across
multiple users is not possible), so it's important to
do it *after* the obstack has been initialized. */
- set_objfile_per_bfd (objfile);
+ set_objfile_per_bfd (&objfile);
- objfile->original_name
- = obstack_strdup (&objfile->objfile_obstack, original_name);
+ objfile.original_name
+ = obstack_strdup (&objfile.objfile_obstack, original_name);
/* Reset the sym_fns pointer. The ELF reader can change it
based on whether .gdb_index is present, and we need it to
start over. PR symtab/15885 */
- objfile_set_sym_fns (objfile, find_sym_fns (objfile->obfd.get ()));
- objfile->qf.clear ();
+ objfile_set_sym_fns (&objfile, find_sym_fns (objfile.obfd.get ()));
+ objfile.qf.clear ();
- build_objfile_section_table (objfile);
+ build_objfile_section_table (&objfile);
/* What the hell is sym_new_init for, anyway? The concept of
distinguishing between the main file and additional files
in this way seems rather dubious. */
- if (objfile == current_program_space->symfile_object_file)
+ if (&objfile == current_program_space->symfile_object_file)
{
- (*objfile->sf->sym_new_init) (objfile);
+ (*objfile.sf->sym_new_init) (&objfile);
}
- (*objfile->sf->sym_init) (objfile);
+ (*objfile.sf->sym_init) (&objfile);
clear_complaints ();
/* We are about to read new symbols and potentially also
@@ -2645,24 +2644,24 @@ reread_symbols (int from_tty)
objfiles_changed (current_program_space);
/* Recompute section offsets and section indices. */
- objfile->sf->sym_offsets (objfile, {});
+ objfile.sf->sym_offsets (&objfile, {});
- read_symbols (objfile, 0);
+ read_symbols (&objfile, 0);
- if ((objfile->flags & OBJF_READNOW))
+ if ((objfile.flags & OBJF_READNOW))
{
- const int mainline = objfile->flags & OBJF_MAINLINE;
+ const int mainline = objfile.flags & OBJF_MAINLINE;
const int should_print = (print_symbol_loading_p (from_tty, mainline, 1)
&& readnow_symbol_files);
if (should_print)
gdb_printf (_("Expanding full symbols from %ps...\n"),
styled_string (file_name_style.style (),
- objfile_name (objfile)));
+ objfile_name (&objfile)));
- objfile->expand_all_symtabs ();
+ objfile.expand_all_symtabs ();
}
- if (!objfile_has_symbols (objfile))
+ if (!objfile.has_symbols ())
{
gdb_stdout->wrap_here (0);
gdb_printf (_("(no debugging symbols found)\n"));
@@ -2684,10 +2683,10 @@ reread_symbols (int from_tty)
/* If the mtime has changed between the time we set new_modtime
and now, we *want* this to be out of date, so don't call stat
again now. */
- objfile->mtime = new_modtime;
- init_entry_point_info (objfile);
+ objfile.mtime = new_modtime;
+ init_entry_point_info (&objfile);
- new_objfiles.push_back (objfile);
+ new_objfiles.push_back (&objfile);
}
}
@@ -2748,7 +2747,7 @@ set_ext_lang_command (const char *args,
error (_("'%s': Filename extension must begin with '.'"), ext_args.c_str ());
/* Find end of first arg. */
- while (*end != '\0' && !isspace (*end))
+ while (*end != '\0' && !c_isspace (*end))
end++;
if (*end == '\0')
@@ -2821,8 +2820,7 @@ deduce_language_from_filename (const char *filename)
return language_unknown;
}
-/* Allocate and initialize a new symbol table.
- CUST is from the result of allocate_compunit_symtab. */
+/* Allocate and initialize a new symbol table. */
struct symtab *
allocate_symtab (struct compunit_symtab *cust, const char *filename,
@@ -2866,41 +2864,15 @@ allocate_symtab (struct compunit_symtab *cust, const char *filename,
return symtab;
}
-/* Allocate and initialize a new compunit.
- NAME is the name of the main source file, if there is one, or some
- descriptive text if there are no source files. */
+/* See symfile.h. */
-struct compunit_symtab *
-allocate_compunit_symtab (struct objfile *objfile, const char *name)
+compunit_symtab *
+add_compunit_symtab_to_objfile (std::unique_ptr<compunit_symtab> cu)
{
- struct compunit_symtab *cu = OBSTACK_ZALLOC (&objfile->objfile_obstack,
- struct compunit_symtab);
- const char *saved_name;
-
- cu->set_objfile (objfile);
-
- /* The name we record here is only for display/debugging purposes.
- Just save the basename to avoid path issues (too long for display,
- relative vs absolute, etc.). */
- saved_name = lbasename (name);
- cu->name = obstack_strdup (&objfile->objfile_obstack, saved_name);
-
- cu->set_debugformat ("unknown");
-
- symtab_create_debug_printf_v ("created compunit symtab %s for %s",
- host_address_to_string (cu),
- cu->name);
-
- return cu;
-}
-
-/* Hook CU to the objfile it comes from. */
-
-void
-add_compunit_symtab_to_objfile (struct compunit_symtab *cu)
-{
- cu->next = cu->objfile ()->compunit_symtabs;
- cu->objfile ()->compunit_symtabs = cu;
+ compunit_symtab *result = cu.get ();
+ struct objfile *objfile = result->objfile ();
+ objfile->compunit_symtabs.push_back (std::move (cu));
+ return result;
}
@@ -3006,10 +2978,10 @@ section_is_overlay (struct obj_section *section)
static void
overlay_invalidate_all (program_space *pspace)
{
- for (objfile *objfile : pspace->objfiles ())
- for (obj_section *sect : objfile->sections ())
- if (section_is_overlay (sect))
- sect->ovly_mapped = -1;
+ for (objfile &objfile : pspace->objfiles ())
+ for (obj_section &sect : objfile.sections ())
+ if (section_is_overlay (&sect))
+ sect.ovly_mapped = -1;
}
/* Function: section_is_mapped (SECTION)
@@ -3035,7 +3007,7 @@ section_is_mapped (struct obj_section *osect)
case ovly_off:
return 0; /* overlay debugging off */
case ovly_auto: /* overlay debugging automatic */
- /* Unles there is a gdbarch_overlay_update function,
+ /* Unless there is a gdbarch_overlay_update function,
there's really nothing useful to do here (can't really go auto). */
gdbarch = osect->objfile->arch ();
if (gdbarch_overlay_update_p (gdbarch))
@@ -3182,19 +3154,19 @@ find_pc_overlay (CORE_ADDR pc)
if (overlay_debugging)
{
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section *osect : objfile->sections ())
- if (section_is_overlay (osect))
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &osect : objfile.sections ())
+ if (section_is_overlay (&osect))
{
- if (pc_in_mapped_range (pc, osect))
+ if (pc_in_mapped_range (pc, &osect))
{
- if (section_is_mapped (osect))
- return osect;
+ if (section_is_mapped (&osect))
+ return &osect;
else
- best_match = osect;
+ best_match = &osect;
}
- else if (pc_in_unmapped_range (pc, osect))
- best_match = osect;
+ else if (pc_in_unmapped_range (pc, &osect))
+ best_match = &osect;
}
}
return best_match;
@@ -3209,10 +3181,10 @@ find_pc_mapped_section (CORE_ADDR pc)
{
if (overlay_debugging)
{
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section *osect : objfile->sections ())
- if (pc_in_mapped_range (pc, osect) && section_is_mapped (osect))
- return osect;
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &osect : objfile.sections ())
+ if (pc_in_mapped_range (pc, &osect) && section_is_mapped (&osect))
+ return &osect;
}
return NULL;
@@ -3228,19 +3200,19 @@ list_overlays_command (const char *args, int from_tty)
if (overlay_debugging)
{
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section *osect : objfile->sections ())
- if (section_is_mapped (osect))
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &osect : objfile.sections ())
+ if (section_is_mapped (&osect))
{
- struct gdbarch *gdbarch = objfile->arch ();
+ struct gdbarch *gdbarch = objfile.arch ();
const char *name;
bfd_vma lma, vma;
int size;
- vma = bfd_section_vma (osect->the_bfd_section);
- lma = bfd_section_lma (osect->the_bfd_section);
- size = bfd_section_size (osect->the_bfd_section);
- name = bfd_section_name (osect->the_bfd_section);
+ vma = bfd_section_vma (osect.the_bfd_section);
+ lma = bfd_section_lma (osect.the_bfd_section);
+ size = bfd_section_size (osect.the_bfd_section);
+ name = bfd_section_name (osect.the_bfd_section);
gdb_printf ("Section %s, loaded at ", name);
gdb_puts (paddress (gdbarch, lma));
@@ -3274,28 +3246,28 @@ map_overlay_command (const char *args, int from_tty)
error (_("Argument required: name of an overlay section"));
/* First, find a section matching the user supplied argument. */
- for (objfile *obj_file : current_program_space->objfiles ())
- for (obj_section *sec : obj_file->sections ())
- if (!strcmp (bfd_section_name (sec->the_bfd_section), args))
+ for (objfile &obj_file : current_program_space->objfiles ())
+ for (obj_section &sec : obj_file.sections ())
+ if (!strcmp (bfd_section_name (sec.the_bfd_section), args))
{
/* Now, check to see if the section is an overlay. */
- if (!section_is_overlay (sec))
+ if (!section_is_overlay (&sec))
continue; /* not an overlay section */
/* Mark the overlay as "mapped". */
- sec->ovly_mapped = 1;
+ sec.ovly_mapped = 1;
/* Next, make a pass and unmap any sections that are
overlapped by this new section: */
- for (objfile *objfile2 : current_program_space->objfiles ())
- for (obj_section *sec2 : objfile2->sections ())
- if (sec2->ovly_mapped && sec != sec2 && sections_overlap (sec,
- sec2))
+ for (objfile &objfile2 : current_program_space->objfiles ())
+ for (obj_section &sec2 : objfile2.sections ())
+ if (sec2.ovly_mapped && &sec != &sec2 && sections_overlap (&sec,
+ &sec2))
{
if (info_verbose)
gdb_printf (_("Note: section %s unmapped by overlap\n"),
- bfd_section_name (sec2->the_bfd_section));
- sec2->ovly_mapped = 0; /* sec2 overlaps sec: unmap sec2. */
+ bfd_section_name (sec2.the_bfd_section));
+ sec2.ovly_mapped = 0; /* sec2 overlaps sec: unmap sec2. */
}
return;
}
@@ -3318,13 +3290,13 @@ unmap_overlay_command (const char *args, int from_tty)
error (_("Argument required: name of an overlay section"));
/* First, find a section matching the user supplied argument. */
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section *sec : objfile->sections ())
- if (!strcmp (bfd_section_name (sec->the_bfd_section), args))
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &sec : objfile.sections ())
+ if (!strcmp (bfd_section_name (sec.the_bfd_section), args))
{
- if (!sec->ovly_mapped)
+ if (!sec.ovly_mapped)
error (_("Section %s is not mapped"), args);
- sec->ovly_mapped = 0;
+ sec.ovly_mapped = 0;
return;
}
error (_("No overlay section called %s"), args);
@@ -3577,18 +3549,18 @@ simple_overlay_update (struct obj_section *osect)
return;
/* Now may as well update all sections, even if only one was requested. */
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section *sect : objfile->sections ())
- if (section_is_overlay (sect))
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &sect : objfile.sections ())
+ if (section_is_overlay (&sect))
{
int i;
- asection *bsect = sect->the_bfd_section;
+ asection *bsect = sect.the_bfd_section;
for (i = 0; i < cache_novlys; i++)
if (cache_ovly_table[i][VMA] == bfd_section_vma (bsect)
&& cache_ovly_table[i][LMA] == bfd_section_lma (bsect))
{ /* obj_section matches i'th entry in ovly_table. */
- sect->ovly_mapped = cache_ovly_table[i][MAPPED];
+ sect.ovly_mapped = cache_ovly_table[i][MAPPED];
break; /* finished with inner for loop: break out. */
}
}
@@ -3756,42 +3728,6 @@ symfile_free_objfile (struct objfile *objfile)
objfile->pspace ()->remove_target_sections (objfile);
}
-/* Wrapper around the quick_symbol_functions expand_symtabs_matching "method".
- Expand all symtabs that match the specified criteria.
- See quick_symbol_functions.expand_symtabs_matching for details. */
-
-bool
-expand_symtabs_matching (expand_symtabs_file_matcher file_matcher,
- const lookup_name_info &lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
- block_search_flags search_flags,
- domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher)
-{
- for (objfile *objfile : current_program_space->objfiles ())
- if (!objfile->expand_symtabs_matching (file_matcher,
- &lookup_name,
- symbol_matcher,
- expansion_notify,
- search_flags,
- domain,
- lang_matcher))
- return false;
- return true;
-}
-
-/* Wrapper around the quick_symbol_functions map_symbol_filenames "method".
- Map function FUN over every file.
- See quick_symbol_functions.map_symbol_filenames for details. */
-
-void
-map_symbol_filenames (symbol_filename_listener fun, bool need_fullname)
-{
- for (objfile *objfile : current_program_space->objfiles ())
- objfile->map_symbol_filenames (fun, need_fullname);
-}
-
#if GDB_SELF_TEST
namespace selftests {
@@ -3849,9 +3785,7 @@ test_set_ext_lang_command ()
#endif /* GDB_SELF_TEST */
-void _initialize_symfile ();
-void
-_initialize_symfile ()
+INIT_GDB_FILE (symfile)
{
struct cmd_list_element *c;
diff --git a/gdb/symfile.h b/gdb/symfile.h
index c2e5142..418e084 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -1,6 +1,6 @@
/* Definitions for reading symbol files into GDB.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -212,11 +212,10 @@ allocate_symtab (struct compunit_symtab *cust, const char *filename)
return allocate_symtab (cust, filename, filename);
}
-extern struct compunit_symtab *allocate_compunit_symtab (struct objfile *,
- const char *)
- ATTRIBUTE_NONNULL (1);
-
-extern void add_compunit_symtab_to_objfile (struct compunit_symtab *cu);
+/* Add CU to its objfile, transferring ownership to the objfile.
+ Returns a pointer to the compunit symtab. */
+extern compunit_symtab *add_compunit_symtab_to_objfile
+ (std::unique_ptr<compunit_symtab> cu);
extern void add_symtab_fns (enum bfd_flavour flavour, const struct sym_fns *);
@@ -345,17 +344,6 @@ symfile_segment_data_up get_symfile_segment_data (bfd *abfd);
extern scoped_restore_tmpl<int> increment_reading_symtab (void);
-bool expand_symtabs_matching
- (expand_symtabs_file_matcher file_matcher,
- const lookup_name_info &lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
- block_search_flags search_flags,
- domain_search_flags kind,
- expand_symtabs_lang_matcher lang_matcher = nullptr);
-
-void map_symbol_filenames (symbol_filename_listener fun, bool need_fullname);
-
/* Target-agnostic function to load the sections of an executable into memory.
ARGS should be in the form "EXECUTABLE [OFFSET]", where OFFSET is an
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 3f06cb1..2ad3620 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -1,6 +1,6 @@
/* Do various things to symbol tables (other than lookup), for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -55,59 +55,59 @@ print_objfile_statistics (void)
int i, linetables, blockvectors;
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
QUIT;
- gdb_printf (_("Statistics for '%s':\n"), objfile_name (objfile));
- if (OBJSTAT (objfile, n_stabs) > 0)
+ gdb_printf (_("Statistics for '%s':\n"), objfile_name (&objfile));
+ if (OBJSTAT ((&objfile), n_stabs) > 0)
gdb_printf (_(" Number of \"stab\" symbols read: %d\n"),
- OBJSTAT (objfile, n_stabs));
- if (objfile->per_bfd->n_minsyms > 0)
+ OBJSTAT ((&objfile), n_stabs));
+ if (objfile.per_bfd->n_minsyms > 0)
gdb_printf (_(" Number of \"minimal\" symbols read: %d\n"),
- objfile->per_bfd->n_minsyms);
- if (OBJSTAT (objfile, n_syms) > 0)
+ objfile.per_bfd->n_minsyms);
+ if (OBJSTAT ((&objfile), n_syms) > 0)
gdb_printf (_(" Number of \"full\" symbols read: %d\n"),
- OBJSTAT (objfile, n_syms));
- if (OBJSTAT (objfile, n_types) > 0)
+ OBJSTAT ((&objfile), n_syms));
+ if (OBJSTAT ((&objfile), n_types) > 0)
gdb_printf (_(" Number of \"types\" defined: %d\n"),
- OBJSTAT (objfile, n_types));
+ OBJSTAT ((&objfile), n_types));
i = linetables = 0;
- for (compunit_symtab *cu : objfile->compunits ())
+ for (compunit_symtab &cu : objfile.compunits ())
{
- for (symtab *s : cu->filetabs ())
+ for (symtab *s : cu.filetabs ())
{
i++;
if (s->linetable () != NULL)
linetables++;
}
}
- blockvectors = std::distance (objfile->compunits ().begin (),
- objfile->compunits ().end ());
+ blockvectors = std::distance (objfile.compunits ().begin (),
+ objfile.compunits ().end ());
gdb_printf (_(" Number of symbol tables: %d\n"), i);
gdb_printf (_(" Number of symbol tables with line tables: %d\n"),
linetables);
gdb_printf (_(" Number of symbol tables with blockvectors: %d\n"),
blockvectors);
- objfile->print_stats (false);
+ objfile.print_stats (false);
- if (OBJSTAT (objfile, sz_strtab) > 0)
+ if (OBJSTAT ((&objfile), sz_strtab) > 0)
gdb_printf (_(" Space used by string tables: %d\n"),
- OBJSTAT (objfile, sz_strtab));
+ OBJSTAT ((&objfile), sz_strtab));
gdb_printf (_(" Total memory used for objfile obstack: %s\n"),
pulongest (obstack_memory_used (&objfile
- ->objfile_obstack)));
+ .objfile_obstack)));
gdb_printf (_(" Total memory used for BFD obstack: %s\n"),
- pulongest (obstack_memory_used (&objfile->per_bfd
+ pulongest (obstack_memory_used (&objfile.per_bfd
->storage_obstack)));
gdb_printf (_(" Total memory used for string cache: %d\n"),
- objfile->per_bfd->string_cache.memory_used ());
+ objfile.per_bfd->string_cache.memory_used ());
gdb_printf (_("Byte cache statistics for '%s':\n"),
- objfile_name (objfile));
- objfile->per_bfd->string_cache.print_statistics ("string cache");
- objfile->print_stats (true);
+ objfile_name (&objfile));
+ objfile.per_bfd->string_cache.print_statistics ("string cache");
+ objfile.print_stats (true);
}
}
@@ -122,23 +122,29 @@ dump_objfile (struct objfile *objfile)
objfile->dump ();
- if (objfile->compunit_symtabs != NULL)
+ bool symtabs_printed = false;
+ for (compunit_symtab &cu : objfile->compunits ())
{
- gdb_printf ("Symtabs:\n");
- for (compunit_symtab *cu : objfile->compunits ())
+ if (!symtabs_printed)
{
- for (symtab *symtab : cu->filetabs ())
- {
- gdb_printf ("%s at %s",
- symtab_to_filename_for_display (symtab),
- host_address_to_string (symtab));
- if (symtab->compunit ()->objfile () != objfile)
- gdb_printf (", NOT ON CHAIN!");
- gdb_printf ("\n");
- }
+ gdb_printf ("Symtabs:\n");
+ symtabs_printed = true;
+ }
+
+ for (symtab *symtab : cu.filetabs ())
+ {
+ gdb_printf ("%s at %s",
+ symtab_to_filename_for_display (symtab),
+ host_address_to_string (symtab));
+ if (symtab->compunit ()->objfile () != objfile)
+ gdb_printf (", NOT ON CHAIN!");
+ gdb_printf ("\n");
}
- gdb_printf ("\n\n");
}
+
+ /* If we printed any symtabs, print some newlines. */
+ if (symtabs_printed)
+ gdb_printf ("\n\n");
}
/* Print minimal symbols from this objfile. */
@@ -451,20 +457,20 @@ maintenance_print_symbols (const char *args, int from_tty)
{
int found = 0;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
int print_for_objfile = 1;
if (objfile_arg != NULL)
print_for_objfile
- = compare_filenames_for_search (objfile_name (objfile),
+ = compare_filenames_for_search (objfile_name (&objfile),
objfile_arg);
if (!print_for_objfile)
continue;
- for (compunit_symtab *cu : objfile->compunits ())
+ for (compunit_symtab &cu : objfile.compunits ())
{
- for (symtab *s : cu->filetabs ())
+ for (symtab *s : cu.filetabs ())
{
int print_for_source = 0;
@@ -537,7 +543,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
}
else
{
- if (symbol->aclass () == LOC_TYPEDEF)
+ if (symbol->loc_class () == LOC_TYPEDEF)
gdb_printf (outfile, "typedef ");
if (symbol->type ())
{
@@ -552,7 +558,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
else
gdb_printf (outfile, "%s ", symbol->print_name ());
- switch (symbol->aclass ())
+ switch (symbol->loc_class ())
{
case LOC_CONST:
gdb_printf (outfile, "const %s (%s)",
@@ -646,7 +652,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
default:
gdb_printf (outfile, "botched symbol class %x",
- symbol->aclass ());
+ symbol->loc_class ());
break;
}
}
@@ -701,12 +707,12 @@ maintenance_print_msymbols (const char *args, int from_tty)
outfile = &arg_outfile;
}
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
QUIT;
if (objfile_arg == NULL
- || compare_filenames_for_search (objfile_name (objfile), objfile_arg))
- dump_msymbols (objfile, outfile);
+ || compare_filenames_for_search (objfile_name (&objfile), objfile_arg))
+ dump_msymbols (&objfile, outfile);
}
}
@@ -719,12 +725,12 @@ maintenance_print_objfiles (const char *regexp, int from_tty)
re_comp (regexp);
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
QUIT;
if (! regexp
- || re_exec (objfile_name (objfile)))
- dump_objfile (objfile);
+ || re_exec (objfile_name (&objfile)))
+ dump_objfile (&objfile);
}
}
@@ -739,17 +745,17 @@ maintenance_info_symtabs (const char *regexp, int from_tty)
re_comp (regexp);
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
/* We don't want to print anything for this objfile until we
actually find a symtab whose name matches. */
int printed_objfile_start = 0;
- for (compunit_symtab *cust : objfile->compunits ())
+ for (compunit_symtab &cust : objfile.compunits ())
{
int printed_compunit_symtab_start = 0;
- for (symtab *symtab : cust->filetabs ())
+ for (symtab *symtab : cust.filetabs ())
{
QUIT;
@@ -758,41 +764,41 @@ maintenance_info_symtabs (const char *regexp, int from_tty)
{
if (! printed_objfile_start)
{
- gdb_printf ("{ objfile %s ", objfile_name (objfile));
+ gdb_printf ("{ objfile %s ", objfile_name (&objfile));
gdb_stdout->wrap_here (2);
gdb_printf ("((struct objfile *) %s)\n",
- host_address_to_string (objfile));
+ host_address_to_string (&objfile));
printed_objfile_start = 1;
}
if (! printed_compunit_symtab_start)
{
gdb_printf (" { ((struct compunit_symtab *) %s)\n",
- host_address_to_string (cust));
+ host_address_to_string (&cust));
gdb_printf (" debugformat %s\n",
- cust->debugformat ());
+ cust.debugformat ());
gdb_printf (" producer %s\n",
- (cust->producer () != nullptr
- ? cust->producer () : "(null)"));
- gdb_printf (" name %s\n", cust->name);
+ (cust.producer () != nullptr
+ ? cust.producer () : "(null)"));
+ gdb_printf (" name %s\n", cust.name);
gdb_printf (" dirname %s\n",
- (cust->dirname () != NULL
- ? cust->dirname () : "(null)"));
+ (cust.dirname () != NULL
+ ? cust.dirname () : "(null)"));
gdb_printf (" blockvector"
" ((struct blockvector *) %s)\n",
host_address_to_string
- (cust->blockvector ()));
+ (cust.blockvector ()));
gdb_printf (" user"
" ((struct compunit_symtab *) %s)\n",
- cust->user != nullptr
- ? host_address_to_string (cust->user)
+ cust.user != nullptr
+ ? host_address_to_string (cust.user)
: "(null)");
- if (cust->includes != nullptr)
+ if (cust.includes != nullptr)
{
gdb_printf (" ( includes\n");
for (int i = 0; ; ++i)
{
struct compunit_symtab *include
- = cust->includes[i];
+ = cust.includes[i];
if (include == nullptr)
break;
const char *addr
@@ -844,20 +850,20 @@ static void
maintenance_check_symtabs (const char *ignore, int from_tty)
{
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
/* We don't want to print anything for this objfile until we
actually find something worth printing. */
int printed_objfile_start = 0;
- for (compunit_symtab *cust : objfile->compunits ())
+ for (compunit_symtab &cust : objfile.compunits ())
{
int found_something = 0;
- struct symtab *symtab = cust->primary_filetab ();
+ struct symtab *symtab = cust.primary_filetab ();
QUIT;
- if (cust->blockvector () == NULL)
+ if (cust.blockvector () == NULL)
found_something = 1;
/* Add more checks here. */
@@ -865,15 +871,15 @@ maintenance_check_symtabs (const char *ignore, int from_tty)
{
if (! printed_objfile_start)
{
- gdb_printf ("{ objfile %s ", objfile_name (objfile));
+ gdb_printf ("{ objfile %s ", objfile_name (&objfile));
gdb_stdout->wrap_here (2);
gdb_printf ("((struct objfile *) %s)\n",
- host_address_to_string (objfile));
+ host_address_to_string (&objfile));
printed_objfile_start = 1;
}
gdb_printf (" { symtab %s\n",
symtab_to_filename_for_display (symtab));
- if (cust->blockvector () == NULL)
+ if (cust.blockvector () == NULL)
gdb_printf (" NULL blockvector\n");
gdb_printf (" }\n");
}
@@ -908,8 +914,8 @@ maintenance_expand_symtabs (const char *args, int from_tty)
if (regexp == nullptr)
{
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
- objfile->expand_all_symtabs ();
+ for (objfile &objfile : pspace->objfiles ())
+ objfile.expand_all_symtabs ();
return;
}
@@ -917,8 +923,8 @@ maintenance_expand_symtabs (const char *args, int from_tty)
re_comp (regexp);
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
- objfile->expand_symtabs_matching
+ for (objfile &objfile : pspace->objfiles ())
+ objfile.search
([&] (const char *filename, bool basenames)
{
/* KISS: Only apply the regexp to the complete file name. */
@@ -1028,11 +1034,11 @@ maintenance_info_line_tables (const char *regexp, int from_tty)
re_comp (regexp);
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
- for (compunit_symtab *cust : objfile->compunits ())
+ for (compunit_symtab &cust : objfile.compunits ())
{
- for (symtab *symtab : cust->filetabs ())
+ for (symtab *symtab : cust.filetabs ())
{
QUIT;
@@ -1051,9 +1057,7 @@ maintenance_info_line_tables (const char *regexp, int from_tty)
/* Do early runtime initializations. */
-void _initialize_symmisc ();
-void
-_initialize_symmisc ()
+INIT_GDB_FILE (symmisc)
{
add_cmd ("symbols", class_maintenance, maintenance_print_symbols, _("\
Print dump of current symbol definitions.\n\
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 06e2cd5..d4089c8 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1,6 +1,6 @@
/* Symbol table lookup for the GNU debugger, GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -56,11 +56,9 @@
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
-#include <ctype.h>
#include "cp-abi.h"
#include "cp-support.h"
#include "observable.h"
-#include "solist.h"
#include "macrotab.h"
#include "macroscope.h"
@@ -124,41 +122,6 @@ struct main_info
static const registry<program_space>::key<main_info> main_progspace_key;
-/* Symbol lookup is not reentrant (though this is not an intrinsic
- restriction). Keep track of whether a symbol lookup is active, to be able
- to detect reentrancy. */
-static bool in_symbol_lookup;
-
-/* Struct to mark that a symbol lookup is active for the duration of its
- lifetime. */
-
-struct enter_symbol_lookup
-{
- enter_symbol_lookup ()
- {
- /* Ensure that the current language has been set. Normally the
- language is set lazily. However, when performing a symbol lookup,
- this could result in a recursive call into the lookup code in some
- cases. Set it now to ensure that this does not happen. */
- get_current_language ();
-
- /* Detect symbol lookup reentrance. */
- gdb_assert (!in_symbol_lookup);
-
- in_symbol_lookup = true;
- }
-
- ~enter_symbol_lookup ()
- {
- /* Sanity check. */
- gdb_assert (in_symbol_lookup);
-
- in_symbol_lookup = false;
- }
-
- DISABLE_COPY_AND_ASSIGN (enter_symbol_lookup);
-};
-
/* The default symbol cache size.
There is no extra cpu cost for large N (except when flushing the cache,
which is rare). The value here is just a first attempt. A better default
@@ -465,7 +428,8 @@ void
compunit_symtab::set_call_site_htab (call_site_htab_t &&call_site_htab)
{
gdb_assert (m_call_site_htab == nullptr);
- m_call_site_htab = new call_site_htab_t (std::move (call_site_htab));
+ m_call_site_htab
+ = std::make_unique<call_site_htab_t> (std::move (call_site_htab));
}
/* See symtab.h. */
@@ -530,11 +494,26 @@ compunit_symtab::forget_cached_source_info ()
/* See symtab.h. */
-void
-compunit_symtab::finalize ()
+compunit_symtab::compunit_symtab (struct objfile *objfile,
+ const char *name_)
+ : m_objfile (objfile),
+ /* The name we record here is only for display/debugging purposes.
+ Just save the basename to avoid path issues (too long for
+ display, relative vs absolute, etc.). */
+ name (obstack_strdup (&objfile->objfile_obstack, lbasename (name_))),
+ m_locations_valid (false),
+ m_epilogue_unwind_valid (false)
+{
+ symtab_create_debug_printf_v ("created compunit symtab %s for %s",
+ host_address_to_string (this),
+ name);
+}
+
+/* See symtab.h. */
+
+compunit_symtab::~compunit_symtab ()
{
this->forget_cached_source_info ();
- delete m_call_site_htab;
}
/* The relocated address of the minimal symbol, using the section
@@ -623,82 +602,6 @@ compare_filenames_for_search (const char *filename, const char *search_name)
&& STRIP_DRIVE_SPEC (filename) == &filename[len - search_len]));
}
-/* Check for a symtab of a specific name by searching some symtabs.
- This is a helper function for callbacks of iterate_over_symtabs.
-
- If NAME is not absolute, then REAL_PATH is NULL
- If NAME is absolute, then REAL_PATH is the gdb_realpath form of NAME.
-
- The return value, NAME, REAL_PATH and CALLBACK are identical to the
- `map_symtabs_matching_filename' method of quick_symbol_functions.
-
- FIRST and AFTER_LAST indicate the range of compunit symtabs to search.
- Each symtab within the specified compunit symtab is also searched.
- AFTER_LAST is one past the last compunit symtab to search; NULL means to
- search until the end of the list. */
-
-bool
-iterate_over_some_symtabs (const char *name,
- const char *real_path,
- struct compunit_symtab *first,
- struct compunit_symtab *after_last,
- gdb::function_view<bool (symtab *)> callback)
-{
- struct compunit_symtab *cust;
- const char* base_name = lbasename (name);
-
- for (cust = first; cust != NULL && cust != after_last; cust = cust->next)
- {
- /* Skip included compunits. */
- if (cust->user != nullptr)
- continue;
-
- for (symtab *s : cust->filetabs ())
- {
- if (compare_filenames_for_search (s->filename, name))
- {
- if (callback (s))
- return true;
- continue;
- }
-
- /* Before we invoke realpath, which can get expensive when many
- files are involved, do a quick comparison of the basenames. */
- if (! basenames_may_differ
- && FILENAME_CMP (base_name, lbasename (s->filename)) != 0)
- continue;
-
- if (compare_filenames_for_search (symtab_to_fullname (s), name))
- {
- if (callback (s))
- return true;
- continue;
- }
-
- /* If the user gave us an absolute path, try to find the file in
- this symtab and use its absolute path. */
- if (real_path != NULL)
- {
- const char *fullname = symtab_to_fullname (s);
-
- gdb_assert (IS_ABSOLUTE_PATH (real_path));
- gdb_assert (IS_ABSOLUTE_PATH (name));
- gdb::unique_xmalloc_ptr<char> fullname_real_path
- = gdb_realpath (fullname);
- fullname = fullname_real_path.get ();
- if (FILENAME_CMP (real_path, fullname) == 0)
- {
- if (callback (s))
- return true;
- continue;
- }
- }
- }
- }
-
- return false;
-}
-
/* See symtab.h. */
void
@@ -715,17 +618,9 @@ iterate_over_symtabs (program_space *pspace, const char *name,
gdb_assert (IS_ABSOLUTE_PATH (real_path.get ()));
}
- for (objfile *objfile : pspace->objfiles ())
- if (iterate_over_some_symtabs (name, real_path.get (),
- objfile->compunit_symtabs, nullptr,
- callback))
- return;
-
- /* Same search rules as above apply here, but now we look through the
- psymtabs. */
- for (objfile *objfile : pspace->objfiles ())
- if (objfile->map_symtabs_matching_filename (name, real_path.get (),
- callback))
+ for (objfile &objfile : pspace->objfiles ())
+ if (objfile.map_symtabs_matching_filename (name, real_path.get (),
+ callback))
return;
}
@@ -1241,10 +1136,10 @@ matching_obj_sections (struct obj_section *obj_first,
/* Otherwise check that they are in corresponding objfiles. */
struct objfile *obj = NULL;
- for (objfile *objfile : current_program_space->objfiles ())
- if (objfile->obfd == first->owner)
+ for (objfile &objfile : current_program_space->objfiles ())
+ if (objfile.obfd == first->owner)
{
- obj = objfile;
+ obj = &objfile;
break;
}
gdb_assert (obj != NULL);
@@ -1781,7 +1676,7 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
index without doing the check that is done by the wrapper macros
like SECT_OFF_TEXT. */
int fallback;
- switch (sym->aclass ())
+ switch (sym->loc_class ())
{
case LOC_STATIC:
fallback = objfile->sect_index_data;
@@ -1847,18 +1742,18 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
this reason, we still attempt a lookup by name prior to doing
a search of the section table. */
- for (obj_section *s : objfile->sections ())
+ for (obj_section &s : objfile->sections ())
{
- if ((bfd_section_flags (s->the_bfd_section) & SEC_ALLOC) == 0)
+ if ((bfd_section_flags (s.the_bfd_section) & SEC_ALLOC) == 0)
continue;
- int idx = s - objfile->sections_start;
+ int idx = &s - objfile->sections_start;
CORE_ADDR offset = objfile->section_offsets[idx];
if (fallback == -1)
fallback = idx;
- if (s->addr () - offset <= addr && addr < s->endaddr () - offset)
+ if (s.addr () - offset <= addr && addr < s.endaddr () - offset)
{
sym->set_section_index (idx);
return;
@@ -2163,13 +2058,6 @@ lookup_symbol_aux (const char *name, symbol_name_match_type match_type,
domain_name (domain).c_str (), language_str (language));
}
- /* Make sure we do something sensible with is_a_field_of_this, since
- the callers that set this parameter to some non-null value will
- certainly use it later. If we don't set it, the contents of
- is_a_field_of_this are undefined. */
- if (is_a_field_of_this != NULL)
- memset (is_a_field_of_this, 0, sizeof (*is_a_field_of_this));
-
langdef = language_def (language);
/* Search specified block and its superiors. Don't search
@@ -2294,8 +2182,6 @@ lookup_symbol_in_block (const char *name, symbol_name_match_type match_type,
const struct block *block,
const domain_search_flags domain)
{
- enter_symbol_lookup tmp;
-
struct symbol *sym;
if (symbol_lookup_debug)
@@ -2331,8 +2217,6 @@ lookup_global_symbol_from_objfile (struct objfile *main_objfile,
const char *name,
const domain_search_flags domain)
{
- enter_symbol_lookup tmp;
-
gdb_assert (block_index == GLOBAL_BLOCK || block_index == STATIC_BLOCK);
for (objfile *objfile : main_objfile->separate_debug_objfiles ())
@@ -2365,44 +2249,26 @@ lookup_symbol_in_objfile_symtabs (struct objfile *objfile,
block_index == GLOBAL_BLOCK ? "GLOBAL_BLOCK" : "STATIC_BLOCK",
name, domain_name (domain).c_str ());
- struct block_symbol other;
- other.symbol = NULL;
- for (compunit_symtab *cust : objfile->compunits ())
+ lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
+ best_symbol_tracker accum;
+ for (compunit_symtab &cust : objfile->compunits ())
{
const struct blockvector *bv;
const struct block *block;
- struct block_symbol result;
- bv = cust->blockvector ();
+ bv = cust.blockvector ();
block = bv->block (block_index);
- result.symbol = block_lookup_symbol_primary (block, name, domain);
- result.block = block;
- if (result.symbol == NULL)
- continue;
- if (best_symbol (result.symbol, domain))
- {
- other = result;
- break;
- }
- if (result.symbol->matches (domain))
- {
- struct symbol *better
- = better_symbol (other.symbol, result.symbol, domain);
- if (better != other.symbol)
- {
- other.symbol = better;
- other.block = block;
- }
- }
+ if (accum.search (&cust, block, lookup_name, domain))
+ break;
}
- if (other.symbol != NULL)
+ if (accum.currently_best.symbol != nullptr)
{
symbol_lookup_debug_printf_v
("lookup_symbol_in_objfile_symtabs (...) = %s (block %s)",
- host_address_to_string (other.symbol),
- host_address_to_string (other.block));
- return other;
+ host_address_to_string (accum.currently_best.symbol),
+ host_address_to_string (accum.currently_best.block));
+ return accum.currently_best;
}
symbol_lookup_debug_printf_v
@@ -2476,11 +2342,6 @@ lookup_symbol_via_quick_fns (struct objfile *objfile,
enum block_enum block_index, const char *name,
const domain_search_flags domain)
{
- struct compunit_symtab *cust;
- const struct blockvector *bv;
- const struct block *block;
- struct block_symbol result;
-
symbol_lookup_debug_printf_v
("lookup_symbol_via_quick_fns (%s, %s, %s, %s)",
objfile_debug_name (objfile),
@@ -2488,27 +2349,36 @@ lookup_symbol_via_quick_fns (struct objfile *objfile,
name, domain_name (domain).c_str ());
lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
- cust = objfile->lookup_symbol (block_index, lookup_name, domain);
- if (cust == NULL)
+ best_symbol_tracker accum;
+ auto searcher = [&] (compunit_symtab *symtab)
+ {
+ const struct blockvector *bv = symtab->blockvector ();
+ const struct block *block = bv->block (block_index);
+ /* If the accumulator finds a best symbol, end the search by
+ returning false; otherwise keep going by returning true. */
+ return !accum.search (symtab, block, lookup_name, domain);
+ };
+
+ objfile->search (nullptr, &lookup_name, nullptr, searcher,
+ block_index == GLOBAL_BLOCK
+ ? SEARCH_GLOBAL_BLOCK
+ : SEARCH_STATIC_BLOCK,
+ domain);
+ if (accum.best_symtab == nullptr)
{
symbol_lookup_debug_printf_v
("lookup_symbol_via_quick_fns (...) = NULL");
return {};
}
-
- bv = cust->blockvector ();
- block = bv->block (block_index);
- result.symbol = block_lookup_symbol (block, lookup_name, domain);
- if (result.symbol == NULL)
- error_in_psymtab_expansion (block_index, name, cust);
+ if (accum.currently_best.symbol == nullptr)
+ error_in_psymtab_expansion (block_index, name, accum.best_symtab);
symbol_lookup_debug_printf_v
("lookup_symbol_via_quick_fns (...) = %s (block %s)",
- host_address_to_string (result.symbol),
- host_address_to_string (block));
+ host_address_to_string (accum.currently_best.symbol),
+ host_address_to_string (accum.currently_best.block));
- result.block = block;
- return result;
+ return accum.currently_best;
}
/* See language.h. */
@@ -2608,24 +2478,12 @@ lookup_symbol_in_objfile (struct objfile *objfile, enum block_enum block_index,
? "GLOBAL_BLOCK" : "STATIC_BLOCK",
name, domain_name (domain).c_str ());
- result = lookup_symbol_in_objfile_symtabs (objfile, block_index,
- name, domain);
- if (result.symbol != NULL)
- {
- symbol_lookup_debug_printf
- ("lookup_symbol_in_objfile (...) = %s (in symtabs)",
- host_address_to_string (result.symbol));
- return result;
- }
-
result = lookup_symbol_via_quick_fns (objfile, block_index,
name, domain);
- symbol_lookup_debug_printf ("lookup_symbol_in_objfile (...) = %s%s",
+ symbol_lookup_debug_printf ("lookup_symbol_in_objfile (...) = %s",
result.symbol != NULL
? host_address_to_string (result.symbol)
- : "NULL",
- result.symbol != NULL ? " (via quick fns)"
- : "");
+ : "NULL");
return result;
}
@@ -2658,13 +2516,10 @@ lookup_global_or_static_symbol (const char *name,
return result;
}
- enter_symbol_lookup tmp;
-
/* Do a global search (of global blocks, heh). */
if (result.symbol == NULL)
- gdbarch_iterate_over_objfiles_in_search_order
- (objfile != NULL ? objfile->arch () : current_inferior ()->arch (),
- [&result, block_index, name, domain] (struct objfile *objfile_iter)
+ current_program_space->iterate_over_objfiles_in_search_order
+ ([&result, block_index, name, domain] (struct objfile *objfile_iter)
{
result = lookup_symbol_in_objfile (objfile_iter, block_index,
name, domain);
@@ -2776,35 +2631,6 @@ basic_lookup_transparent_type_quick (struct objfile *objfile,
return sym->type ();
}
-/* Subroutine of basic_lookup_transparent_type to simplify it.
- Look up the non-opaque definition of NAME in BLOCK_INDEX of OBJFILE.
- BLOCK_INDEX is either GLOBAL_BLOCK or STATIC_BLOCK. */
-
-static struct type *
-basic_lookup_transparent_type_1 (struct objfile *objfile,
- enum block_enum block_index,
- domain_search_flags flags,
- const lookup_name_info &name)
-{
- const struct blockvector *bv;
- const struct block *block;
- const struct symbol *sym;
-
- for (compunit_symtab *cust : objfile->compunits ())
- {
- bv = cust->blockvector ();
- block = bv->block (block_index);
- sym = block_find_symbol (block, name, flags, nullptr);
- if (sym != nullptr)
- {
- gdb_assert (!TYPE_IS_OPAQUE (sym->type ()));
- return sym->type ();
- }
- }
-
- return NULL;
-}
-
/* The standard implementation of lookup_transparent_type. This code
was modeled on lookup_symbol -- the parts not relevant to looking
up types were just left out. In particular it's assumed here that
@@ -2818,45 +2644,20 @@ basic_lookup_transparent_type (const char *name, domain_search_flags flags)
lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
- /* Now search all the global symbols. Do the symtab's first, then
- check the psymtab's. If a psymtab indicates the existence
- of the desired name as a global, then do psymtab-to-symtab
- conversion on the fly and return the found symbol. */
-
- for (objfile *objfile : current_program_space->objfiles ())
- {
- t = basic_lookup_transparent_type_1 (objfile, GLOBAL_BLOCK,
- flags, lookup_name);
- if (t)
- return t;
- }
-
- for (objfile *objfile : current_program_space->objfiles ())
+ /* Search all the global symbols. */
+ for (objfile &objfile : current_program_space->objfiles ())
{
- t = basic_lookup_transparent_type_quick (objfile, GLOBAL_BLOCK,
+ t = basic_lookup_transparent_type_quick (&objfile, GLOBAL_BLOCK,
flags, lookup_name);
if (t)
return t;
}
- /* Now search the static file-level symbols.
- Not strictly correct, but more useful than an error.
- Do the symtab's first, then
- check the psymtab's. If a psymtab indicates the existence
- of the desired name as a file-level static, then do psymtab-to-symtab
- conversion on the fly and return the found symbol. */
-
- for (objfile *objfile : current_program_space->objfiles ())
- {
- t = basic_lookup_transparent_type_1 (objfile, STATIC_BLOCK,
- flags, lookup_name);
- if (t)
- return t;
- }
-
- for (objfile *objfile : current_program_space->objfiles ())
+ /* Now search the static file-level symbols. Not strictly correct,
+ but more useful than an error. */
+ for (objfile &objfile : current_program_space->objfiles ())
{
- t = basic_lookup_transparent_type_quick (objfile, STATIC_BLOCK,
+ t = basic_lookup_transparent_type_quick (&objfile, STATIC_BLOCK,
flags, lookup_name);
if (t)
return t;
@@ -2935,11 +2736,11 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
It also happens for objfiles that have their functions reordered.
For these, the symtab we are looking for is not necessarily read in. */
- for (objfile *obj_file : current_program_space->objfiles ())
+ for (objfile &obj_file : current_program_space->objfiles ())
{
- for (compunit_symtab *cust : obj_file->compunits ())
+ for (compunit_symtab &cust : obj_file.compunits ())
{
- const struct blockvector *bv = cust->blockvector ();
+ const struct blockvector *bv = cust.blockvector ();
const struct block *global_block = bv->global_block ();
CORE_ADDR start = global_block->start ();
CORE_ADDR end = global_block->end ();
@@ -2952,7 +2753,7 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
if (bv->map ()->find (pc) == nullptr)
continue;
- return cust;
+ return &cust;
}
CORE_ADDR range = end - start;
@@ -2968,8 +2769,8 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
stabs and coff debugging info, we continue on if a psymtab
can't be found. */
struct compunit_symtab *result
- = obj_file->find_pc_sect_compunit_symtab (msymbol, pc,
- section, 0);
+ = obj_file.find_pc_sect_compunit_symtab (msymbol, pc,
+ section, 0);
if (result != nullptr)
return result;
@@ -2984,7 +2785,7 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
const struct block *b = bv->block (b_index);
for (struct symbol *sym : block_iterator_range (b))
{
- if (matching_obj_sections (sym->obj_section (obj_file),
+ if (matching_obj_sections (sym->obj_section (&obj_file),
section))
{
found_sym = sym;
@@ -2998,7 +2799,7 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
}
/* Cust is best found so far, save it. */
- best_cust = cust;
+ best_cust = &cust;
best_cust_range = range;
}
}
@@ -3008,10 +2809,10 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
/* Not found in symtabs, search the "quick" symtabs (e.g. psymtabs). */
- for (objfile *objf : current_program_space->objfiles ())
+ for (objfile &objf : current_program_space->objfiles ())
{
struct compunit_symtab *result
- = objf->find_pc_sect_compunit_symtab (msymbol, pc, section, 1);
+ = objf.find_pc_sect_compunit_symtab (msymbol, pc, section, 1);
if (result != NULL)
return result;
}
@@ -3046,7 +2847,7 @@ find_symbol_at_address (CORE_ADDR address)
for (struct symbol *sym : block_iterator_range (b))
{
- if (sym->aclass () == LOC_STATIC
+ if (sym->loc_class () == LOC_STATIC
&& sym->value_address () == addr)
return sym;
}
@@ -3054,15 +2855,15 @@ find_symbol_at_address (CORE_ADDR address)
return nullptr;
};
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
/* If this objfile was read with -readnow, then we need to
search the symtabs directly. */
- if ((objfile->flags & OBJF_READNOW) != 0)
+ if ((objfile.flags & OBJF_READNOW) != 0)
{
- for (compunit_symtab *symtab : objfile->compunits ())
+ for (compunit_symtab &symtab : objfile.compunits ())
{
- struct symbol *sym = search_symtab (symtab, address);
+ struct symbol *sym = search_symtab (&symtab, address);
if (sym != nullptr)
return sym;
}
@@ -3070,7 +2871,7 @@ find_symbol_at_address (CORE_ADDR address)
else
{
struct compunit_symtab *symtab
- = objfile->find_compunit_symtab_by_address (address);
+ = objfile.find_compunit_symtab_by_address (address);
if (symtab != NULL)
{
struct symbol *sym = search_symtab (symtab, address);
@@ -3497,14 +3298,14 @@ find_line_symtab (symtab *sym_tab, int line, int *index)
else
best = 0;
- for (objfile *objfile : current_program_space->objfiles ())
- objfile->expand_symtabs_with_fullname (symtab_to_fullname (sym_tab));
+ for (objfile &objfile : current_program_space->objfiles ())
+ objfile.expand_symtabs_with_fullname (symtab_to_fullname (sym_tab));
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *cu : objfile->compunits ())
+ for (compunit_symtab &cu : objfile.compunits ())
{
- for (symtab *s : cu->filetabs ())
+ for (symtab *s : cu.filetabs ())
{
const struct linetable *l;
int ind;
@@ -3761,11 +3562,10 @@ find_function_start_sal_1 (CORE_ADDR func_addr, obj_section *section,
/* See symtab.h. */
symtab_and_line
-find_function_start_sal (CORE_ADDR func_addr, obj_section *section,
- bool funfirstline)
+find_function_start_sal (CORE_ADDR func_addr, bool funfirstline)
{
symtab_and_line sal
- = find_function_start_sal_1 (func_addr, section, funfirstline);
+ = find_function_start_sal_1 (func_addr, nullptr, funfirstline);
/* find_function_start_sal_1 does a linetable search, so it finds
the symtab and linenumber, but not a symbol. Fill in the
@@ -4318,7 +4118,7 @@ find_function_alias_target (bound_minimal_symbol msymbol)
symbol *sym = find_pc_function (func_addr);
if (sym != NULL
- && sym->aclass () == LOC_BLOCK
+ && sym->loc_class () == LOC_BLOCK
&& sym->value_block ()->entry_pc () == func_addr)
return sym;
@@ -4341,7 +4141,7 @@ operator_chars (const char *p, const char **end)
/* Don't get faked out by `operator' being part of a longer
identifier. */
- if (isalpha (*p) || *p == '_' || *p == '$' || *p == '\0')
+ if (c_isalpha (*p) || *p == '_' || *p == '$' || *p == '\0')
return *end;
/* Allow some whitespace between `operator' and the operator symbol. */
@@ -4350,11 +4150,11 @@ operator_chars (const char *p, const char **end)
/* Recognize 'operator TYPENAME'. */
- if (isalpha (*p) || *p == '_' || *p == '$')
+ if (c_isalpha (*p) || *p == '_' || *p == '$')
{
const char *q = p + 1;
- while (isalnum (*q) || *q == '_' || *q == '$')
+ while (c_isalnum (*q) || *q == '_' || *q == '$')
q++;
*end = q;
return p;
@@ -4499,7 +4299,7 @@ info_sources_filter::matches (const char *fullname) const
switch (m_match_type)
{
case match_on::DIRNAME:
- dirname = ldirname (fullname);
+ dirname = gdb_ldirname (fullname);
to_match = dirname.c_str ();
break;
case match_on::BASENAME:
@@ -4702,19 +4502,19 @@ info_sources_worker (struct ui_out *uiout,
gdb_assert (group_by_objfile || uiout->is_mi_like_p ());
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
if (group_by_objfile)
{
output_tuple.emplace (uiout, nullptr);
- uiout->field_string ("filename", objfile_name (objfile),
+ uiout->field_string ("filename", objfile_name (&objfile),
file_name_style.style ());
uiout->text (":\n");
- bool debug_fully_readin = !objfile->has_unexpanded_symtabs ();
+ bool debug_fully_readin = !objfile.has_unexpanded_symtabs ();
if (uiout->is_mi_like_p ())
{
const char *debug_info_state;
- if (objfile_has_symbols (objfile))
+ if (objfile.has_symbols ())
{
if (debug_fully_readin)
debug_info_state = "fully-read";
@@ -4730,16 +4530,16 @@ info_sources_worker (struct ui_out *uiout,
if (!debug_fully_readin)
uiout->text ("(Full debug information has not yet been read "
"for this file.)\n");
- if (!objfile_has_symbols (objfile))
+ if (!objfile.has_symbols ())
uiout->text ("(Objfile has no debug information.)\n");
uiout->text ("\n");
}
sources_list.emplace (uiout, "sources");
}
- for (compunit_symtab *cu : objfile->compunits ())
+ for (compunit_symtab &cu : objfile.compunits ())
{
- for (symtab *s : cu->filetabs ())
+ for (symtab *s : cu.filetabs ())
{
const char *file = symtab_to_filename_for_display (s);
const char *fullname = symtab_to_fullname (s);
@@ -4749,7 +4549,7 @@ info_sources_worker (struct ui_out *uiout,
if (group_by_objfile)
{
- objfile->map_symbol_filenames (data, true /* need_fullname */);
+ objfile.map_symbol_filenames (data, true /* need_fullname */);
if (data.printed_filename_p ())
uiout->text ("\n\n");
data.reset_output ();
@@ -4761,7 +4561,8 @@ info_sources_worker (struct ui_out *uiout,
if (!group_by_objfile)
{
data.reset_output ();
- map_symbol_filenames (data, true /*need_fullname*/);
+ current_program_space->map_symbol_filenames (data,
+ true /*need_fullname*/);
}
}
@@ -4910,11 +4711,11 @@ global_symbol_searcher::expand_symtabs
{
return file_matches (filename, m_filenames, basenames);
};
- expand_symtabs_file_matcher file_matcher = nullptr;
+ search_symtabs_file_matcher file_matcher = nullptr;
if (!m_filenames.empty ())
file_matcher = do_file_match;
- objfile->expand_symtabs_matching
+ objfile->search
(file_matcher,
&lookup_name_info::match_any (),
[&] (const char *symname)
@@ -4989,9 +4790,9 @@ global_symbol_searcher::add_matching_symbols
domain_search_flags kind = m_kind;
/* Add matching symbols (if not already present). */
- for (compunit_symtab *cust : objfile->compunits ())
+ for (compunit_symtab &cust : objfile->compunits ())
{
- const struct blockvector *bv = cust->blockvector ();
+ const struct blockvector *bv = cust.blockvector ();
for (block_enum block : { GLOBAL_BLOCK, STATIC_BLOCK })
{
@@ -5029,12 +4830,12 @@ global_symbol_searcher::add_matching_symbols
if ((kind & SEARCH_VAR_DOMAIN) != 0)
{
- if (sym->aclass () == LOC_UNRESOLVED
+ if (sym->loc_class () == LOC_UNRESOLVED
/* LOC_CONST can be used for more than
just enums, e.g., c++ static const
members. We only want to skip enums
here. */
- || (sym->aclass () == LOC_CONST
+ || (sym->loc_class () == LOC_CONST
&& (sym->type ()->code () == TYPE_CODE_ENUM)))
continue;
}
@@ -5128,7 +4929,7 @@ global_symbol_searcher::search () const
int fix = -1; /* -1 means ok; otherwise number of
spaces needed. */
- if (isalpha (*opname) || *opname == '_' || *opname == '$')
+ if (c_isalpha (*opname) || *opname == '_' || *opname == '$')
{
/* There should 1 space between 'operator' and 'TYPENAME'. */
if (opname[-1] != ' ' || opname[-2] == ' ')
@@ -5165,17 +4966,17 @@ global_symbol_searcher::search () const
bool found_msymbol = false;
std::set<symbol_search> result_set;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
/* Expand symtabs within objfile that possibly contain matching
symbols. */
- found_msymbol |= expand_symtabs (objfile, preg);
+ found_msymbol |= expand_symtabs (&objfile, preg);
/* Find matching symbols within OBJFILE and add them in to the
RESULT_SET set. Use a set here so that we can easily detect
duplicates as we go, and can therefore track how many unique
matches we have found so far. */
- if (!add_matching_symbols (objfile, preg, treg, &result_set))
+ if (!add_matching_symbols (&objfile, preg, treg, &result_set))
break;
}
@@ -5194,8 +4995,8 @@ global_symbol_searcher::search () const
{
gdb_assert ((m_kind & (SEARCH_VAR_DOMAIN | SEARCH_FUNCTION_DOMAIN))
!= 0);
- for (objfile *objfile : current_program_space->objfiles ())
- if (!add_matching_msymbols (objfile, preg, &result))
+ for (objfile &objfile : current_program_space->objfiles ())
+ if (!add_matching_msymbols (&objfile, preg, &result))
break;
}
@@ -5242,7 +5043,7 @@ symbol_to_info_string (struct symbol *sym, int block)
string_file tmp_stream;
type_print (sym->type (),
- (sym->aclass () == LOC_TYPEDEF
+ (sym->loc_class () == LOC_TYPEDEF
? "" : sym->print_name ()),
&tmp_stream, 0);
@@ -5610,7 +5411,7 @@ rbreak_command (const char *regexp, int from_tty)
if (colon && *(colon + 1) != ':')
{
int colon_index = colon - regexp;
- while (colon_index > 0 && isspace (regexp[colon_index - 1]))
+ while (colon_index > 0 && c_isspace (regexp[colon_index - 1]))
--colon_index;
file_name = make_unique_xstrndup (regexp, colon_index);
@@ -5761,7 +5562,7 @@ completion_list_add_symbol (completion_tracker &tracker,
the msymbol name and removes the msymbol name from the completion
tracker. */
if (sym->language () == language_cplus
- && sym->aclass () == LOC_BLOCK)
+ && sym->loc_class () == LOC_BLOCK)
{
/* The call to canonicalize returns the empty string if the input
string is already in canonical form, thanks to this we don't
@@ -5862,7 +5663,7 @@ language_search_unquoted_string (const char *text, const char *p)
{
for (; p > text; --p)
{
- if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0')
+ if (c_isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0')
continue;
else
{
@@ -5882,7 +5683,7 @@ language_search_unquoted_string (const char *text, const char *p)
Unfortunately we have to find it now to decide. */
while (t > text)
- if (isalnum (t[-1]) || t[-1] == '_' ||
+ if (c_isalnum (t[-1]) || t[-1] == '_' ||
t[-1] == ' ' || t[-1] == ':' ||
t[-1] == '(' || t[-1] == ')')
--t;
@@ -5906,7 +5707,7 @@ completion_list_add_fields (completion_tracker &tracker,
const lookup_name_info &lookup_name,
const char *text, const char *word)
{
- if (sym->aclass () == LOC_TYPEDEF)
+ if (sym->loc_class () == LOC_TYPEDEF)
{
struct type *t = sym->type ();
enum type_code c = t->code ();
@@ -5958,7 +5759,7 @@ symbol_is_function_or_method (minimal_symbol *msymbol)
bound_minimal_symbol
find_gnu_ifunc (const symbol *sym)
{
- if (sym->aclass () != LOC_BLOCK)
+ if (sym->loc_class () != LOC_BLOCK)
return {};
lookup_name_info lookup_name (sym->search_name (),
@@ -6090,7 +5891,7 @@ default_collect_symbol_completion_matches_break_on
which are in symbols. */
while (p > text)
{
- if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0'
+ if (c_isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0'
|| p[-1] == ':' || strchr (break_on, p[-1]) != NULL)
--p;
else
@@ -6109,9 +5910,9 @@ default_collect_symbol_completion_matches_break_on
if (code == TYPE_CODE_UNDEF)
{
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
QUIT;
@@ -6128,27 +5929,22 @@ default_collect_symbol_completion_matches_break_on
}
/* Add completions for all currently loaded symbol tables. */
- for (objfile *objfile : current_program_space->objfiles ())
- {
- for (compunit_symtab *cust : objfile->compunits ())
- add_symtab_completions (cust, tracker, mode, lookup_name,
- sym_text, word, code);
- }
-
- /* Look through the partial symtabs for all symbols which begin by
- matching SYM_TEXT. Expand all CUs that you find to the list. */
- expand_symtabs_matching (NULL,
- lookup_name,
- NULL,
- [&] (compunit_symtab *symtab) /* expansion notify */
- {
- add_symtab_completions (symtab,
- tracker, mode, lookup_name,
- sym_text, word, code);
- return true;
- },
- SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
- SEARCH_ALL_DOMAINS);
+ for (objfile &objfile : current_program_space->objfiles ())
+ {
+ /* Look through the partial symtabs for all symbols which begin by
+ matching SYM_TEXT. Expand all CUs that you find to the list. */
+ objfile.search
+ (nullptr, &lookup_name, nullptr,
+ [&] (compunit_symtab *symtab)
+ {
+ add_symtab_completions (symtab,
+ tracker, mode, lookup_name,
+ sym_text, word, code);
+ return true;
+ },
+ SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
+ SEARCH_ALL_DOMAINS);
+ }
/* Search upwards from currently selected frame (so that we can
complete on local vars). Also catch fields of types defined in
@@ -6206,8 +6002,6 @@ default_collect_symbol_completion_matches_break_on
if (current_language->macro_expansion () == macro_expansion_c
&& code == TYPE_CODE_UNDEF)
{
- gdb::unique_xmalloc_ptr<struct macro_scope> scope;
-
/* This adds a macro's name to the current completion list. */
auto add_macro_name = [&] (const char *macro_name,
const macro_definition *,
@@ -6225,10 +6019,9 @@ default_collect_symbol_completion_matches_break_on
resulting expression will be evaluated at "file:line" -- but
at there does not seem to be a way to detect this at
completion time. */
- scope = default_macro_scope ();
- if (scope)
- macro_for_each_in_scope (scope->file, scope->line,
- add_macro_name);
+ macro_scope scope = default_macro_scope ();
+ if (scope.is_valid ())
+ macro_for_each_in_scope (scope.file, scope.line, add_macro_name);
/* User-defined macros are always visible. */
macro_for_each (macro_user_macros, add_macro_name);
@@ -6413,7 +6206,7 @@ add_partial_filename_data::operator() (const char *filename,
program. */
completion_list
-make_source_files_completion_list (const char *text, const char *word)
+make_source_files_completion_list (const char *text)
{
size_t text_len = strlen (text);
completion_list list;
@@ -6426,11 +6219,11 @@ make_source_files_completion_list (const char *text, const char *word)
filename_seen_cache filenames_seen;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *cu : objfile->compunits ())
+ for (compunit_symtab &cu : objfile.compunits ())
{
- for (symtab *s : cu->filetabs ())
+ for (symtab *s : cu.filetabs ())
{
if (not_interesting_fname (s->filename))
continue;
@@ -6439,7 +6232,7 @@ make_source_files_completion_list (const char *text, const char *word)
{
/* This file matches for a completion; add it to the current
list of matches. */
- add_filename_to_list (s->filename, text, word, &list);
+ add_filename_to_list (s->filename, text, text, &list);
}
else
{
@@ -6451,7 +6244,7 @@ make_source_files_completion_list (const char *text, const char *word)
if (base_name != s->filename
&& !filenames_seen.seen (base_name)
&& filename_ncmp (base_name, text, text_len) == 0)
- add_filename_to_list (base_name, text, word, &list);
+ add_filename_to_list (base_name, text, text, &list);
}
}
}
@@ -6459,10 +6252,10 @@ make_source_files_completion_list (const char *text, const char *word)
datum.filename_seen_cache = &filenames_seen;
datum.text = text;
- datum.word = word;
+ datum.word = text;
datum.text_len = text_len;
datum.list = &list;
- map_symbol_filenames (datum, false /*need_fullname*/);
+ current_program_space->map_symbol_filenames (datum, false /*need_fullname*/);
return list;
}
@@ -6524,15 +6317,15 @@ find_main_name (void)
relies on the order of objfile creation -- which still isn't
guaranteed to get the correct answer, but is just probably more
accurate. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- objfile->compute_main_name ();
+ objfile.compute_main_name ();
- if (objfile->per_bfd->name_of_main != NULL)
+ if (objfile.per_bfd->name_of_main != NULL)
{
set_main_name (pspace,
- objfile->per_bfd->name_of_main,
- objfile->per_bfd->language_of_main);
+ objfile.per_bfd->name_of_main,
+ objfile.per_bfd->language_of_main);
return;
}
}
@@ -6550,7 +6343,7 @@ find_main_name (void)
language. It is easy to guaranty this with Ada, since we use a
special symbol generated only when the main in Ada to find the name
of the main procedure. It is difficult however to see how this can
- be guarantied for languages such as C, for instance. This suggests
+ be guaranteed for languages such as C, for instance. This suggests
that order of call for these methods becomes important, which means
a more complicated approach. */
new_main_name = ada_main_name ();
@@ -6586,9 +6379,8 @@ find_main_name (void)
/* Try to find language for main in psymtabs. */
bool symbol_found_p = false;
- gdbarch_iterate_over_objfiles_in_search_order
- (current_inferior ()->arch (),
- [&symbol_found_p, pspace] (objfile *obj)
+ current_program_space->iterate_over_objfiles_in_search_order
+ ([&symbol_found_p, pspace] (objfile *obj)
{
language lang
= obj->lookup_global_symbol_language ("main",
@@ -6640,13 +6432,13 @@ main_language (void)
/* The next index to hand out in response to a registration request. */
-static int next_aclass_value = LOC_FINAL_VALUE;
+static int next_loc_class_value = LOC_FINAL_VALUE;
-/* The maximum number of "aclass" registrations we support. This is
+/* The maximum number of "loc_class" registrations we support. This is
constant for convenience. */
#define MAX_SYMBOL_IMPLS (LOC_FINAL_VALUE + 11)
-/* The objects representing the various "aclass" values. The elements
+/* The objects representing the various "loc_class" values. The elements
from 0 up to LOC_FINAL_VALUE-1 represent themselves, and subsequent
elements are those registered at gdb initialization time. */
@@ -6659,22 +6451,22 @@ gdb::array_view<const struct symbol_impl> symbol_impls (symbol_impl);
/* Make sure we saved enough room in struct symbol. */
-static_assert (MAX_SYMBOL_IMPLS <= (1 << SYMBOL_ACLASS_BITS));
+static_assert (MAX_SYMBOL_IMPLS <= (1 << SYMBOL_LOC_CLASS_BITS));
-/* Register a computed symbol type. ACLASS must be LOC_COMPUTED. OPS
+/* Register a computed symbol type. LOC_CLASS must be LOC_COMPUTED. OPS
is the ops vector associated with this index. This returns the new
- index, which should be used as the aclass_index field for symbols
+ index, which should be used as the loc_class_index field for symbols
of this type. */
int
-register_symbol_computed_impl (enum address_class aclass,
+register_symbol_computed_impl (location_class loc_class,
const struct symbol_computed_ops *ops)
{
- int result = next_aclass_value++;
+ int result = next_loc_class_value++;
- gdb_assert (aclass == LOC_COMPUTED);
+ gdb_assert (loc_class == LOC_COMPUTED);
gdb_assert (result < MAX_SYMBOL_IMPLS);
- symbol_impl[result].aclass = aclass;
+ symbol_impl[result].loc_class = loc_class;
symbol_impl[result].ops_computed = ops;
/* Sanity check OPS. */
@@ -6687,20 +6479,20 @@ register_symbol_computed_impl (enum address_class aclass,
return result;
}
-/* Register a function with frame base type. ACLASS must be LOC_BLOCK.
+/* Register a function with frame base type. LOC_CLASS must be LOC_BLOCK.
OPS is the ops vector associated with this index. This returns the
- new index, which should be used as the aclass_index field for symbols
+ new index, which should be used as the loc_class_index field for symbols
of this type. */
int
-register_symbol_block_impl (enum address_class aclass,
+register_symbol_block_impl (location_class loc_class,
const struct symbol_block_ops *ops)
{
- int result = next_aclass_value++;
+ int result = next_loc_class_value++;
- gdb_assert (aclass == LOC_BLOCK);
+ gdb_assert (loc_class == LOC_BLOCK);
gdb_assert (result < MAX_SYMBOL_IMPLS);
- symbol_impl[result].aclass = aclass;
+ symbol_impl[result].loc_class = loc_class;
symbol_impl[result].ops_block = ops;
/* Sanity check OPS. */
@@ -6711,35 +6503,33 @@ register_symbol_block_impl (enum address_class aclass,
return result;
}
-/* Register a register symbol type. ACLASS must be LOC_REGISTER or
+/* Register a register symbol type. LOC_CLASS must be LOC_REGISTER or
LOC_REGPARM_ADDR. OPS is the register ops vector associated with
this index. This returns the new index, which should be used as
- the aclass_index field for symbols of this type. */
+ the loc_class_index field for symbols of this type. */
int
-register_symbol_register_impl (enum address_class aclass,
+register_symbol_register_impl (location_class loc_class,
const struct symbol_register_ops *ops)
{
- int result = next_aclass_value++;
+ int result = next_loc_class_value++;
- gdb_assert (aclass == LOC_REGISTER || aclass == LOC_REGPARM_ADDR);
+ gdb_assert (loc_class == LOC_REGISTER || loc_class == LOC_REGPARM_ADDR);
gdb_assert (result < MAX_SYMBOL_IMPLS);
- symbol_impl[result].aclass = aclass;
+ symbol_impl[result].loc_class = loc_class;
symbol_impl[result].ops_register = ops;
return result;
}
/* Initialize elements of 'symbol_impl' for the constants in enum
- address_class. */
+ location_class. */
static void
initialize_ordinary_address_classes (void)
{
- int i;
-
- for (i = 0; i < LOC_FINAL_VALUE; ++i)
- symbol_impl[i].aclass = (enum address_class) i;
+ for (int i = 0; i < LOC_FINAL_VALUE; ++i)
+ symbol_impl[i].loc_class = static_cast<location_class> (i);
}
@@ -6787,7 +6577,7 @@ CORE_ADDR
symbol::get_maybe_copied_address () const
{
gdb_assert (this->maybe_copied);
- gdb_assert (this->aclass () == LOC_STATIC);
+ gdb_assert (this->loc_class () == LOC_STATIC);
const char *linkage_name = this->linkage_name ();
bound_minimal_symbol minsym
@@ -6997,11 +6787,8 @@ info_module_subcommand (bool quiet, const char *module_regexp,
const char *last_filename = "";
const symbol *last_module_symbol = nullptr;
- for (const module_symbol_search &ms : module_symbols)
+ for (const auto &[p, q] : module_symbols)
{
- const symbol_search &p = ms.first;
- const symbol_search &q = ms.second;
-
gdb_assert (q.symbol != nullptr);
if (last_module_symbol != p.symbol)
@@ -7120,9 +6907,7 @@ info_module_var_func_command_completer (struct cmd_list_element *ignore,
-void _initialize_symtab ();
-void
-_initialize_symtab ()
+INIT_GDB_FILE (symtab)
{
cmd_list_element *c;
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 7927380..64028bf 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1,6 +1,6 @@
/* Symbol table definitions for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -145,7 +145,7 @@ private:
std::string m_encoded_name;
/* The decoded lookup name. This is formed by calling ada_decode
- with both 'operators' and 'wide' set to false. */
+ with 'translate' set to false. */
std::string m_decoded_name;
/* Whether the user-provided lookup name was Ada encoded. If so,
@@ -967,9 +967,9 @@ to_scripting_domain (domain_search_flags val)
Throws an exception if VAL is not one of the allowable values. */
extern domain_search_flags from_scripting_domain (int val);
-/* An address-class says where to find the value of a symbol. */
+/* A location class says where to find the value of a symbol. */
-enum address_class
+enum location_class
{
/* Not used; catches errors. */
@@ -1078,14 +1078,14 @@ enum address_class
LOC_FINAL_VALUE
};
-/* The number of bits needed for values in enum address_class, with some
+/* The number of bits needed for values in enum location_class, with some
padding for reasonable growth, and room for run-time registered address
classes. See symtab.c:MAX_SYMBOL_IMPLS.
This is a #define so that we can have a assertion elsewhere to
verify that we have reserved enough space for synthetic address
classes. */
-#define SYMBOL_ACLASS_BITS 5
-static_assert (LOC_FINAL_VALUE <= (1 << SYMBOL_ACLASS_BITS));
+#define SYMBOL_LOC_CLASS_BITS 5
+static_assert (LOC_FINAL_VALUE <= (1 << SYMBOL_LOC_CLASS_BITS));
/* The methods needed to implement LOC_COMPUTED. These methods can
use the symbol's .aux_value for additional per-symbol information.
@@ -1202,7 +1202,7 @@ struct symbol_register_ops
struct symbol_impl
{
- enum address_class aclass;
+ location_class loc_class;
/* Used with LOC_COMPUTED. */
const struct symbol_computed_ops *ops_computed;
@@ -1238,7 +1238,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack<symbol>
symbol ()
/* Class-initialization of bitfields is only allowed in C++20. */
: m_domain (UNDEF_DOMAIN),
- m_aclass_index (0),
+ m_loc_class_index (0),
m_is_objfile_owned (1),
m_is_argument (0),
m_is_inlined (0),
@@ -1262,14 +1262,14 @@ struct symbol : public general_symbol_info, public allocate_on_obstack<symbol>
symbol (const symbol &) = default;
symbol &operator= (const symbol &) = default;
- void set_aclass_index (unsigned int aclass_index)
+ void set_loc_class_index (unsigned int loc_class_index)
{
- m_aclass_index = aclass_index;
+ m_loc_class_index = loc_class_index;
}
const symbol_impl &impl () const
{
- return symbol_impls[this->m_aclass_index];
+ return symbol_impls[this->m_loc_class_index];
}
const symbol_block_ops *block_ops () const
@@ -1287,9 +1287,9 @@ struct symbol : public general_symbol_info, public allocate_on_obstack<symbol>
return this->impl ().ops_register;
}
- address_class aclass () const
+ location_class loc_class () const
{
- return this->impl ().aclass;
+ return this->impl ().loc_class;
}
/* Return true if this symbol's domain matches FLAGS. */
@@ -1480,11 +1480,11 @@ struct symbol : public general_symbol_info, public allocate_on_obstack<symbol>
ENUM_BITFIELD(domain_enum) m_domain : SYMBOL_DOMAIN_BITS;
- /* Address class. This holds an index into the 'symbol_impls'
- table. The actual enum address_class value is stored there,
+ /* Location class. This holds an index into the 'symbol_impls'
+ table. The actual location_class value is stored there,
alongside any per-class ops vectors. */
- unsigned int m_aclass_index : SYMBOL_ACLASS_BITS;
+ unsigned int m_loc_class_index : SYMBOL_LOC_CLASS_BITS;
/* If non-zero then symbol is objfile-owned, use owner.symtab.
Otherwise symbol is arch-owned, use owner.arch. */
@@ -1575,13 +1575,13 @@ symbol::value_block () const
return m_value.block;
}
-extern int register_symbol_computed_impl (enum address_class,
+extern int register_symbol_computed_impl (location_class,
const struct symbol_computed_ops *);
-extern int register_symbol_block_impl (enum address_class aclass,
+extern int register_symbol_block_impl (location_class loc_class,
const struct symbol_block_ops *ops);
-extern int register_symbol_register_impl (enum address_class,
+extern int register_symbol_register_impl (location_class,
const struct symbol_register_ops *);
/* An instance of this type is used to represent a C++ template
@@ -1830,21 +1830,23 @@ using symtab_range = next_range<symtab>;
where "foo.c(cu)" and "bar.c(cu)" are struct compunit_symtab objects,
and the files foo.c, etc. are struct symtab objects. */
-struct compunit_symtab
+struct compunit_symtab : intrusive_list_node<compunit_symtab>
{
+ compunit_symtab (struct objfile *objfile, const char *name);
+ ~compunit_symtab ();
+
+ DISABLE_COPY_AND_ASSIGN (compunit_symtab);
+
struct objfile *objfile () const
{
return m_objfile;
}
- void set_objfile (struct objfile *objfile)
- {
- m_objfile = objfile;
- }
-
symtab_range filetabs () const
{
- return symtab_range (m_filetabs);
+ next_iterator<symtab> begin (m_filetabs);
+
+ return symtab_range (std::move (begin));
}
void add_filetab (symtab *filetab)
@@ -1957,15 +1959,6 @@ struct compunit_symtab
/* Clear any cached source file names. */
void forget_cached_source_info ();
- /* This is called when an objfile is being destroyed and will free
- any resources used by this compunit_symtab. Normally a
- destructor would be used instead, but at the moment
- compunit_symtab objects are allocated on an obstack. */
- void finalize ();
-
- /* Unordered chain of all compunit symtabs of this objfile. */
- struct compunit_symtab *next;
-
/* Object file from which this symtab information was read. */
struct objfile *m_objfile;
@@ -1978,30 +1971,30 @@ struct compunit_symtab
source file (e.g., .c, .cc) is guaranteed to be first.
Each symtab is a file, either the "main" source file (e.g., .c, .cc)
or header (e.g., .h). */
- symtab *m_filetabs;
+ symtab *m_filetabs = nullptr;
/* Last entry in FILETABS list.
Subfiles are added to the end of the list so they accumulate in order,
with the main source subfile living at the front.
The main reason is so that the main source file symtab is at the head
of the list, and the rest appear in order for debugging convenience. */
- symtab *m_last_filetab;
+ symtab *m_last_filetab = nullptr;
/* Non-NULL string that identifies the format of the debugging information,
such as "stabs", "dwarf 1", "dwarf 2", "coff", etc. This is mostly useful
for automated testing of gdb but may also be information that is
useful to the user. */
- const char *m_debugformat;
+ const char *m_debugformat = "unknown";
/* String of producer version information, or NULL if we don't know. */
- const char *m_producer;
+ const char *m_producer = nullptr;
/* Directory in which it was compiled, or NULL if we don't know. */
- const char *m_dirname;
+ const char *m_dirname = nullptr;
/* List of all symbol scope blocks for this symtab. It is shared among
all symtabs in a given compilation unit. */
- struct blockvector *m_blockvector;
+ struct blockvector *m_blockvector = nullptr;
/* Symtab has been compiled with both optimizations and debug info so that
GDB may stop skipping prologues as variables locations are valid already
@@ -2013,13 +2006,13 @@ struct compunit_symtab
unsigned int m_epilogue_unwind_valid : 1;
/* struct call_site entries for this compilation unit or NULL. */
- call_site_htab_t *m_call_site_htab;
+ std::unique_ptr<call_site_htab_t> m_call_site_htab;
/* The macro table for this symtab. Like the blockvector, this
is shared between different symtabs in a given compilation unit.
It's debatable whether it *should* be shared among all the symtabs in
the given compilation unit, but it currently is. */
- struct macro_table *m_macro_table;
+ struct macro_table *m_macro_table = nullptr;
/* If non-NULL, then this points to a NULL-terminated vector of
included compunits. When searching the static or global
@@ -2028,17 +2021,15 @@ struct compunit_symtab
list must be flattened -- the symbol reader is responsible for
ensuring that this vector contains the transitive closure of all
included compunits. */
- struct compunit_symtab **includes;
+ struct compunit_symtab **includes = nullptr;
/* If this is an included compunit, this points to one includer
of the table. This user is considered the canonical compunit
containing this one. An included compunit may itself be
included by another. */
- struct compunit_symtab *user;
+ struct compunit_symtab *user = nullptr;
};
-using compunit_symtab_range = next_range<compunit_symtab>;
-
/* Return true if this symtab is the "main" symtab of its compunit_symtab. */
static inline bool
@@ -2101,17 +2092,17 @@ struct field_of_this_result
symbol was not found in 'this'. If non-NULL, then one of the
other fields will be non-NULL as well. */
- struct type *type;
+ struct type *type = nullptr;
/* If the symbol was found as an ordinary field of 'this', then this
is non-NULL and points to the particular field. */
- struct field *field;
+ struct field *field = nullptr;
/* If the symbol was found as a function field of 'this', then this
is non-NULL and points to the particular field. */
- struct fn_fieldlist *fn_field;
+ struct fn_fieldlist *fn_field = nullptr;
};
/* Find the definition for a specified symbol name NAME
@@ -2482,8 +2473,7 @@ extern void collect_file_symbol_completion_matches
symbol_name_match_type name_match_type,
const char *, const char *, const char *);
-extern completion_list
- make_source_files_completion_list (const char *, const char *);
+extern completion_list make_source_files_completion_list (const char *);
/* Return whether SYM is a function/method, as opposed to a data symbol. */
@@ -2526,10 +2516,8 @@ extern symtab *find_line_symtab (symtab *sym_tab, int line, int *index);
extern symtab_and_line find_function_start_sal (symbol *sym, bool
funfirstline);
-/* Same, but start with a function address/section instead of a
- symbol. */
+/* Same, but start with a function address instead of a symbol. */
extern symtab_and_line find_function_start_sal (CORE_ADDR func_addr,
- obj_section *section,
bool funfirstline);
extern void skip_prologue_sal (struct symtab_and_line *);
@@ -2806,12 +2794,6 @@ bool compare_filenames_for_search (const char *filename,
bool compare_glob_filenames_for_search (const char *filename,
const char *search_name);
-bool iterate_over_some_symtabs (const char *name,
- const char *real_path,
- struct compunit_symtab *first,
- struct compunit_symtab *after_last,
- gdb::function_view<bool (symtab *)> callback);
-
/* Check in PSPACE for a symtab of a specific name; first in symtabs, then in
psymtabs. *If* there is no '/' in the name, a match after a '/' in the
symtab filename will also work.
diff --git a/gdb/syscalls/Makefile b/gdb/syscalls/Makefile
index 0c31f07..3656fcd 100644
--- a/gdb/syscalls/Makefile
+++ b/gdb/syscalls/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This file is part of GDB.
diff --git a/gdb/syscalls/apply-defaults.xsl b/gdb/syscalls/apply-defaults.xsl
index fef45a8..23f89d7 100644
--- a/gdb/syscalls/apply-defaults.xsl
+++ b/gdb/syscalls/apply-defaults.xsl
@@ -1,5 +1,5 @@
<!-- Generate syscall XML files based on defaults template.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/syscalls/freebsd.xml b/gdb/syscalls/freebsd.xml
index d2758c8..5fbe36d 100644
--- a/gdb/syscalls/freebsd.xml
+++ b/gdb/syscalls/freebsd.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?> <!-- THIS FILE IS GENERATED -*- buffer-read-only: t -*- -->
<!-- vi:set ro: -->
-<!-- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2009-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/syscalls/gdb-syscalls.dtd b/gdb/syscalls/gdb-syscalls.dtd
index 0bb93ed..daceb0f 100644
--- a/gdb/syscalls/gdb-syscalls.dtd
+++ b/gdb/syscalls/gdb-syscalls.dtd
@@ -1,4 +1,4 @@
-<!-- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2009-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/syscalls/netbsd.xml b/gdb/syscalls/netbsd.xml
index e1e25d8..f0e3815 100644
--- a/gdb/syscalls/netbsd.xml
+++ b/gdb/syscalls/netbsd.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?> <!-- THIS FILE IS GENERATED -*- buffer-read-only: t -*- -->
<!-- vi:set ro: -->
-<!-- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2020-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/syscalls/riscv-linux-canonicalize-syscall-gen.py b/gdb/syscalls/riscv-linux-canonicalize-syscall-gen.py
new file mode 100755
index 0000000..aaf3943
--- /dev/null
+++ b/gdb/syscalls/riscv-linux-canonicalize-syscall-gen.py
@@ -0,0 +1,153 @@
+#!/usr/bin/env python3
+
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
+# Contributed by Timur Golubovich
+
+# This file is part of GDB.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+# To get help message for this script, run:
+# ./gdb/syscalls/riscv-linux-canonicalize-syscall-gen.py --help
+
+# Execution result:
+
+# usage: riscv-linux-canonicalize-syscall-gen.py [-h]
+#
+# Generate file gdb/riscv-linux-canonicalize-syscall-gen.c from
+# gdb/syscalls/riscv-linux.xml.
+#
+# options:
+# -h, --help show this help message and exit
+
+import argparse
+import re
+import xml.etree.ElementTree as ET
+from pathlib import Path
+
+FILE = Path(__file__).resolve()
+
+HEAD = f"""\
+/* DO NOT EDIT: Autogenerated by {FILE.name}
+
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "defs.h"
+#include "riscv-linux-tdep.h"
+
+/* riscv_linux_canonicalize_syscall maps from the native RISC-V Linux set
+ of syscall ids into a canonical set of syscall ids used by
+ process record. */
+
+enum gdb_syscall
+riscv_linux_canonicalize_syscall (int syscall)
+{{
+ switch (syscall)
+ {{
+"""
+
+TAIL = """\
+ default:
+ return gdb_sys_no_syscall;
+ }
+}
+"""
+
+HELP_MESSAGE = """\
+Generate file gdb/riscv-linux-canonicalize-syscall-gen.c from
+gdb/syscalls/riscv-linux.xml.
+"""
+
+
+class Generator:
+ def _get_gdb_syscalls(self, gdb_syscalls_path: Path) -> set[str]:
+ gdb_syscalls = set[str]()
+ with open(gdb_syscalls_path, "r", encoding="UTF-8") as file:
+ for line in file:
+ match = re.search(r"(gdb_sys_\S+)\s*=", line)
+ if match:
+ gdb_syscalls.add(match[1].strip())
+ return gdb_syscalls
+
+ def _get_arch_syscalls(self, xml_syscalls_path: Path) -> dict[str, int]:
+ arch_syscalls: dict[str, int] = {}
+ syscalls_info = ET.parse(xml_syscalls_path)
+ for syscall in syscalls_info.findall("syscall"):
+ sysname = syscall.attrib["name"]
+ sysno = int(syscall.attrib["number"])
+ arch_syscalls[sysname] = sysno
+ return arch_syscalls
+
+ def _get_canon_syscalls_lines(
+ self,
+ arch_syscalls: dict[str, int],
+ gdb_syscalls: set[str],
+ exceptions: dict[str, str],
+ ) -> list[str]:
+ canon_syscalls: dict[int, str] = {}
+ for sysname, sysno in arch_syscalls.items():
+ if sysname in exceptions:
+ sysname = exceptions[sysname]
+ gdb_sysname = f"gdb_sys_{sysname}"
+ value = f" /* case {sysno}: return {gdb_sysname}; */\n"
+ if gdb_sysname in gdb_syscalls:
+ value = f" case {sysno}: return {gdb_sysname};\n"
+ canon_syscalls[sysno] = value
+ return [canon_syscalls[sysno] for sysno in sorted(canon_syscalls)]
+
+ def generate(self) -> None:
+ repo_path = FILE.parent.parent.parent
+ gdb_path = repo_path / "gdb"
+ xml_syscalls_path = gdb_path / "syscalls" / "riscv-linux.xml"
+ gdb_syscalls_path = gdb_path / "linux-record.h"
+ arch_syscalls_path = gdb_path / "riscv-linux-canonicalize-syscall-gen.c"
+ exceptions = {"mmap": "old_mmap"}
+
+ arch_syscalls = self._get_arch_syscalls(xml_syscalls_path)
+ gdb_syscalls = self._get_gdb_syscalls(gdb_syscalls_path)
+ canon_syscalls_lines = self._get_canon_syscalls_lines(
+ arch_syscalls, gdb_syscalls, exceptions
+ )
+
+ with open(arch_syscalls_path, "w", encoding="UTF-8") as file:
+ file.writelines(HEAD)
+ file.writelines(canon_syscalls_lines)
+ file.writelines(TAIL)
+
+
+def main() -> int:
+ parser = argparse.ArgumentParser(description=HELP_MESSAGE)
+ parser.parse_args()
+ Generator().generate()
+ return 0
+
+
+if __name__ == "__main__":
+ main()
diff --git a/gdb/syscalls/riscv-linux.xml b/gdb/syscalls/riscv-linux.xml
new file mode 100644
index 0000000..3578c3f
--- /dev/null
+++ b/gdb/syscalls/riscv-linux.xml
@@ -0,0 +1,340 @@
+<?xml version="1.0"?>
+<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd">
+<!-- Copyright (C) 2025 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+<!-- This file was generated using the following file:
+
+ <sys/syscall.h>
+
+ The file mentioned above belongs to the Linux Kernel. -->
+<syscalls_info>
+ <syscall name="io_setup" number="0" groups="memory"/>
+ <syscall name="io_destroy" number="1" groups="memory"/>
+ <syscall name="io_submit" number="2"/>
+ <syscall name="io_cancel" number="3"/>
+ <syscall name="io_getevents" number="4"/>
+ <syscall name="setxattr" number="5" groups="file"/>
+ <syscall name="lsetxattr" number="6" groups="file"/>
+ <syscall name="fsetxattr" number="7" groups="descriptor"/>
+ <syscall name="getxattr" number="8" groups="file"/>
+ <syscall name="lgetxattr" number="9" groups="file"/>
+ <syscall name="fgetxattr" number="10" groups="descriptor"/>
+ <syscall name="listxattr" number="11" groups="file"/>
+ <syscall name="llistxattr" number="12" groups="file"/>
+ <syscall name="flistxattr" number="13" groups="descriptor"/>
+ <syscall name="removexattr" number="14" groups="file"/>
+ <syscall name="lremovexattr" number="15" groups="file"/>
+ <syscall name="fremovexattr" number="16" groups="descriptor"/>
+ <syscall name="getcwd" number="17" groups="file"/>
+ <syscall name="lookup_dcookie" number="18"/>
+ <syscall name="eventfd2" number="19" groups="descriptor"/>
+ <syscall name="epoll_create1" number="20" groups="descriptor"/>
+ <syscall name="epoll_ctl" number="21" groups="descriptor"/>
+ <syscall name="epoll_pwait" number="22" groups="descriptor"/>
+ <syscall name="dup" number="23" groups="descriptor"/>
+ <syscall name="dup3" number="24" groups="descriptor"/>
+ <syscall name="fcntl" number="25" groups="descriptor"/>
+ <syscall name="inotify_init1" number="26" groups="descriptor"/>
+ <syscall name="inotify_add_watch" number="27" groups="descriptor,file"/>
+ <syscall name="inotify_rm_watch" number="28" groups="descriptor"/>
+ <syscall name="ioctl" number="29" groups="descriptor"/>
+ <syscall name="ioprio_set" number="30"/>
+ <syscall name="ioprio_get" number="31"/>
+ <syscall name="flock" number="32" groups="descriptor"/>
+ <syscall name="mknodat" number="33" groups="descriptor,file"/>
+ <syscall name="mkdirat" number="34" groups="descriptor,file"/>
+ <syscall name="unlinkat" number="35" groups="descriptor,file"/>
+ <syscall name="symlinkat" number="36" groups="descriptor,file"/>
+ <syscall name="linkat" number="37" groups="descriptor,file"/>
+ <syscall name="umount2" number="39" groups="file"/>
+ <syscall name="mount" number="40" groups="file"/>
+ <syscall name="pivot_root" number="41" groups="file"/>
+ <syscall name="nfsservctl" number="42"/>
+ <syscall name="statfs" number="43" groups="file"/>
+ <syscall name="fstatfs" number="44" groups="descriptor"/>
+ <syscall name="truncate" number="45" groups="file"/>
+ <syscall name="ftruncate" number="46" groups="descriptor"/>
+ <syscall name="fallocate" number="47" groups="descriptor"/>
+ <syscall name="faccessat" number="48" groups="descriptor,file"/>
+ <syscall name="chdir" number="49" groups="file"/>
+ <syscall name="fchdir" number="50" groups="descriptor"/>
+ <syscall name="chroot" number="51" groups="file"/>
+ <syscall name="fchmod" number="52" groups="descriptor"/>
+ <syscall name="fchmodat" number="53" groups="descriptor,file"/>
+ <syscall name="fchownat" number="54" groups="descriptor,file"/>
+ <syscall name="fchown" number="55" groups="descriptor"/>
+ <syscall name="openat" number="56" groups="descriptor,file"/>
+ <syscall name="close" number="57" groups="descriptor"/>
+ <syscall name="vhangup" number="58"/>
+ <syscall name="pipe2" number="59" groups="descriptor"/>
+ <syscall name="quotactl" number="60" groups="file"/>
+ <syscall name="getdents64" number="61" groups="descriptor"/>
+ <syscall name="lseek" number="62" groups="descriptor"/>
+ <syscall name="read" number="63" groups="descriptor"/>
+ <syscall name="write" number="64" groups="descriptor"/>
+ <syscall name="readv" number="65" groups="descriptor"/>
+ <syscall name="writev" number="66" groups="descriptor"/>
+ <syscall name="pread64" number="67" groups="descriptor"/>
+ <syscall name="pwrite64" number="68" groups="descriptor"/>
+ <syscall name="preadv" number="69" groups="descriptor"/>
+ <syscall name="pwritev" number="70" groups="descriptor"/>
+ <syscall name="sendfile" number="71" groups="descriptor,network"/>
+ <syscall name="pselect6" number="72" groups="descriptor"/>
+ <syscall name="ppoll" number="73" groups="descriptor"/>
+ <syscall name="signalfd4" number="74" groups="descriptor,signal"/>
+ <syscall name="vmsplice" number="75" groups="descriptor"/>
+ <syscall name="splice" number="76" groups="descriptor"/>
+ <syscall name="tee" number="77" groups="descriptor"/>
+ <syscall name="readlinkat" number="78" groups="descriptor,file"/>
+ <syscall name="newfstatat" number="79" groups="descriptor,file"/>
+ <syscall name="fstat" number="80" groups="descriptor"/>
+ <syscall name="sync" number="81"/>
+ <syscall name="fsync" number="82" groups="descriptor"/>
+ <syscall name="fdatasync" number="83" groups="descriptor"/>
+ <syscall name="sync_file_range" number="84" groups="descriptor"/>
+ <syscall name="timerfd_create" number="85" groups="descriptor"/>
+ <syscall name="timerfd_settime" number="86" groups="descriptor"/>
+ <syscall name="timerfd_gettime" number="87" groups="descriptor"/>
+ <syscall name="utimensat" number="88" groups="descriptor,file"/>
+ <syscall name="acct" number="89" groups="file"/>
+ <syscall name="capget" number="90"/>
+ <syscall name="capset" number="91"/>
+ <syscall name="personality" number="92"/>
+ <syscall name="exit" number="93" groups="process"/>
+ <syscall name="exit_group" number="94" groups="process"/>
+ <syscall name="waitid" number="95" groups="process"/>
+ <syscall name="set_tid_address" number="96"/>
+ <syscall name="unshare" number="97"/>
+ <syscall name="futex" number="98"/>
+ <syscall name="set_robust_list" number="99"/>
+ <syscall name="get_robust_list" number="100"/>
+ <syscall name="nanosleep" number="101"/>
+ <syscall name="getitimer" number="102"/>
+ <syscall name="setitimer" number="103"/>
+ <syscall name="kexec_load" number="104"/>
+ <syscall name="init_module" number="105"/>
+ <syscall name="delete_module" number="106"/>
+ <syscall name="timer_create" number="107"/>
+ <syscall name="timer_gettime" number="108"/>
+ <syscall name="timer_getoverrun" number="109"/>
+ <syscall name="timer_settime" number="110"/>
+ <syscall name="timer_delete" number="111"/>
+ <syscall name="clock_settime" number="112"/>
+ <syscall name="clock_gettime" number="113"/>
+ <syscall name="clock_getres" number="114"/>
+ <syscall name="clock_nanosleep" number="115"/>
+ <syscall name="syslog" number="116"/>
+ <syscall name="ptrace" number="117"/>
+ <syscall name="sched_setparam" number="118"/>
+ <syscall name="sched_setscheduler" number="119"/>
+ <syscall name="sched_getscheduler" number="120"/>
+ <syscall name="sched_getparam" number="121"/>
+ <syscall name="sched_setaffinity" number="122"/>
+ <syscall name="sched_getaffinity" number="123"/>
+ <syscall name="sched_yield" number="124"/>
+ <syscall name="sched_get_priority_max" number="125"/>
+ <syscall name="sched_get_priority_min" number="126"/>
+ <syscall name="sched_rr_get_interval" number="127"/>
+ <syscall name="restart_syscall" number="128"/>
+ <syscall name="kill" number="129" groups="signal,process"/>
+ <syscall name="tkill" number="130" groups="signal,process"/>
+ <syscall name="tgkill" number="131" groups="signal,process"/>
+ <syscall name="sigaltstack" number="132" groups="signal"/>
+ <syscall name="rt_sigsuspend" number="133" groups="signal"/>
+ <syscall name="rt_sigaction" number="134" groups="signal"/>
+ <syscall name="rt_sigprocmask" number="135" groups="signal"/>
+ <syscall name="rt_sigpending" number="136" groups="signal"/>
+ <syscall name="rt_sigtimedwait" number="137" groups="signal"/>
+ <syscall name="rt_sigqueueinfo" number="138" groups="signal,process"/>
+ <syscall name="rt_sigreturn" number="139" groups="signal"/>
+ <syscall name="setpriority" number="140"/>
+ <syscall name="getpriority" number="141"/>
+ <syscall name="reboot" number="142"/>
+ <syscall name="setregid" number="143"/>
+ <syscall name="setgid" number="144"/>
+ <syscall name="setreuid" number="145"/>
+ <syscall name="setuid" number="146"/>
+ <syscall name="setresuid" number="147"/>
+ <syscall name="getresuid" number="148"/>
+ <syscall name="setresgid" number="149"/>
+ <syscall name="getresgid" number="150"/>
+ <syscall name="setfsuid" number="151"/>
+ <syscall name="setfsgid" number="152"/>
+ <syscall name="times" number="153"/>
+ <syscall name="setpgid" number="154"/>
+ <syscall name="getpgid" number="155"/>
+ <syscall name="getsid" number="156"/>
+ <syscall name="setsid" number="157"/>
+ <syscall name="getgroups" number="158"/>
+ <syscall name="setgroups" number="159"/>
+ <syscall name="uname" number="160"/>
+ <syscall name="sethostname" number="161"/>
+ <syscall name="setdomainname" number="162"/>
+ <syscall name="getrlimit" number="163"/>
+ <syscall name="setrlimit" number="164"/>
+ <syscall name="getrusage" number="165"/>
+ <syscall name="umask" number="166"/>
+ <syscall name="prctl" number="167"/>
+ <syscall name="getcpu" number="168"/>
+ <syscall name="gettimeofday" number="169"/>
+ <syscall name="settimeofday" number="170"/>
+ <syscall name="adjtimex" number="171"/>
+ <syscall name="getpid" number="172"/>
+ <syscall name="getppid" number="173"/>
+ <syscall name="getuid" number="174"/>
+ <syscall name="geteuid" number="175"/>
+ <syscall name="getgid" number="176"/>
+ <syscall name="getegid" number="177"/>
+ <syscall name="gettid" number="178"/>
+ <syscall name="sysinfo" number="179"/>
+ <syscall name="mq_open" number="180" groups="descriptor"/>
+ <syscall name="mq_unlink" number="181"/>
+ <syscall name="mq_timedsend" number="182" groups="descriptor"/>
+ <syscall name="mq_timedreceive" number="183" groups="descriptor"/>
+ <syscall name="mq_notify" number="184" groups="descriptor"/>
+ <syscall name="mq_getsetattr" number="185" groups="descriptor"/>
+ <syscall name="msgget" number="186" groups="ipc"/>
+ <syscall name="msgctl" number="187" groups="ipc"/>
+ <syscall name="msgrcv" number="188" groups="ipc"/>
+ <syscall name="msgsnd" number="189" groups="ipc"/>
+ <syscall name="semget" number="190" groups="ipc"/>
+ <syscall name="semctl" number="191" groups="ipc"/>
+ <syscall name="semtimedop" number="192" groups="ipc"/>
+ <syscall name="semop" number="193" groups="ipc"/>
+ <syscall name="shmget" number="194" groups="ipc"/>
+ <syscall name="shmctl" number="195" groups="ipc"/>
+ <syscall name="shmat" number="196" groups="ipc,memory"/>
+ <syscall name="shmdt" number="197" groups="ipc,memory"/>
+ <syscall name="socket" number="198" groups="network"/>
+ <syscall name="socketpair" number="199" groups="network"/>
+ <syscall name="bind" number="200" groups="network"/>
+ <syscall name="listen" number="201" groups="network"/>
+ <syscall name="accept" number="202" groups="network"/>
+ <syscall name="connect" number="203" groups="network"/>
+ <syscall name="getsockname" number="204" groups="network"/>
+ <syscall name="getpeername" number="205" groups="network"/>
+ <syscall name="sendto" number="206" groups="network"/>
+ <syscall name="recvfrom" number="207" groups="network"/>
+ <syscall name="setsockopt" number="208" groups="network"/>
+ <syscall name="getsockopt" number="209" groups="network"/>
+ <syscall name="shutdown" number="210" groups="network"/>
+ <syscall name="sendmsg" number="211" groups="network"/>
+ <syscall name="recvmsg" number="212" groups="network"/>
+ <syscall name="readahead" number="213" groups="descriptor"/>
+ <syscall name="brk" number="214" groups="memory"/>
+ <syscall name="munmap" number="215" groups="memory"/>
+ <syscall name="mremap" number="216" groups="memory"/>
+ <syscall name="add_key" number="217"/>
+ <syscall name="request_key" number="218"/>
+ <syscall name="keyctl" number="219"/>
+ <syscall name="clone" number="220" groups="process"/>
+ <syscall name="execve" number="221" groups="file,process"/>
+ <syscall name="mmap" number="222" groups="descriptor,memory"/>
+ <syscall name="fadvise64" number="223" groups="descriptor"/>
+ <syscall name="swapon" number="224" groups="file"/>
+ <syscall name="swapoff" number="225" groups="file"/>
+ <syscall name="mprotect" number="226" groups="memory"/>
+ <syscall name="msync" number="227" groups="memory"/>
+ <syscall name="mlock" number="228" groups="memory"/>
+ <syscall name="munlock" number="229" groups="memory"/>
+ <syscall name="mlockall" number="230" groups="memory"/>
+ <syscall name="munlockall" number="231" groups="memory"/>
+ <syscall name="mincore" number="232" groups="memory"/>
+ <syscall name="madvise" number="233" groups="memory"/>
+ <syscall name="remap_file_pages" number="234" groups="memory"/>
+ <syscall name="mbind" number="235" groups="memory"/>
+ <syscall name="get_mempolicy" number="236" groups="memory"/>
+ <syscall name="set_mempolicy" number="237" groups="memory"/>
+ <syscall name="migrate_pages" number="238" groups="memory"/>
+ <syscall name="move_pages" number="239" groups="memory"/>
+ <syscall name="rt_tgsigqueueinfo" number="240" groups="process,signal"/>
+ <syscall name="perf_event_open" number="241" groups="descriptor"/>
+ <syscall name="accept4" number="242" groups="network"/>
+ <syscall name="recvmmsg" number="243" groups="network"/>
+ <syscall name="riscv_hwprobe" number="258"/>
+ <syscall name="riscv_flush_icache" number="259" groups="memory"/>
+ <syscall name="wait4" number="260" groups="process"/>
+ <syscall name="prlimit64" number="261"/>
+ <syscall name="fanotify_init" number="262" groups="descriptor"/>
+ <syscall name="fanotify_mark" number="263" groups="descriptor,file"/>
+ <syscall name="name_to_handle_at" number="264" groups="descriptor,file"/>
+ <syscall name="open_by_handle_at" number="265" groups="descriptor"/>
+ <syscall name="clock_adjtime" number="266"/>
+ <syscall name="syncfs" number="267" groups="descriptor"/>
+ <syscall name="setns" number="268" groups="descriptor"/>
+ <syscall name="sendmmsg" number="269" groups="network"/>
+ <syscall name="process_vm_readv" number="270"/>
+ <syscall name="process_vm_writev" number="271"/>
+ <syscall name="kcmp" number="272"/>
+ <syscall name="finit_module" number="273" groups="descriptor"/>
+ <syscall name="sched_setattr" number="274"/>
+ <syscall name="sched_getattr" number="275"/>
+ <syscall name="renameat2" number="276" groups="descriptor,file"/>
+ <syscall name="seccomp" number="277"/>
+ <syscall name="getrandom" number="278"/>
+ <syscall name="memfd_create" number="279" groups="descriptor"/>
+ <syscall name="bpf" number="280" groups="descriptor"/>
+ <syscall name="execveat" number="281" groups="descriptor,file,process"/>
+ <syscall name="userfaultfd" number="282" groups="descriptor"/>
+ <syscall name="membarrier" number="283"/>
+ <syscall name="mlock2" number="284" groups="memory"/>
+ <syscall name="copy_file_range" number="285" groups="descriptor"/>
+ <syscall name="preadv2" number="286" groups="descriptor"/>
+ <syscall name="pwritev2" number="287" groups="descriptor"/>
+ <syscall name="pkey_mprotect" number="288" groups="memory"/>
+ <syscall name="pkey_alloc" number="289"/>
+ <syscall name="pkey_free" number="290"/>
+ <syscall name="statx" number="291" groups="descriptor,file"/>
+ <syscall name="io_pgetevents" number="292"/>
+ <syscall name="rseq" number="293"/>
+ <syscall name="kexec_file_load" number="294" groups="descriptor"/>
+ <syscall name="pidfd_send_signal" number="424" groups="descriptor,signal,process"/>
+ <syscall name="io_uring_setup" number="425" groups="descriptor"/>
+ <syscall name="io_uring_enter" number="426" groups="descriptor,signal"/>
+ <syscall name="io_uring_register" number="427" groups="descriptor,memory"/>
+ <syscall name="open_tree" number="428" groups="descriptor,file"/>
+ <syscall name="move_mount" number="429" groups="descriptor,file"/>
+ <syscall name="fsopen" number="430" groups="descriptor"/>
+ <syscall name="fsconfig" number="431" groups="descriptor,file"/>
+ <syscall name="fsmount" number="432" groups="descriptor"/>
+ <syscall name="fspick" number="433" groups="descriptor,file"/>
+ <syscall name="pidfd_open" number="434" groups="descriptor"/>
+ <syscall name="clone3" number="435" groups="process"/>
+ <syscall name="close_range" number="436"/>
+ <syscall name="openat2" number="437" groups="descriptor,file"/>
+ <syscall name="pidfd_getfd" number="438" groups="descriptor"/>
+ <syscall name="faccessat2" number="439" groups="descriptor,file"/>
+ <syscall name="process_madvise" number="440" groups="descriptor"/>
+ <syscall name="epoll_pwait2" number="441" groups="descriptor"/>
+ <syscall name="mount_setattr" number="442" groups="descriptor,file"/>
+ <syscall name="quotactl_fd" number="443" groups="descriptor"/>
+ <syscall name="landlock_create_ruleset" number="444" groups="descriptor"/>
+ <syscall name="landlock_add_rule" number="445" groups="descriptor"/>
+ <syscall name="landlock_restrict_self" number="446" groups="descriptor"/>
+ <syscall name="memfd_secret" number="447" groups="descriptor"/>
+ <syscall name="process_mrelease" number="448" groups="descriptor"/>
+ <syscall name="futex_waitv" number="449"/>
+ <syscall name="set_mempolicy_home_node" number="450" groups="memory"/>
+ <syscall name="cachestat" number="451" groups="descriptor"/>
+ <syscall name="fchmodat2" number="452" groups="descriptor,file"/>
+ <syscall name="map_shadow_stack" number="453" groups="memory"/>
+ <syscall name="futex_wake" number="454"/>
+ <syscall name="futex_wait" number="455"/>
+ <syscall name="futex_requeue" number="456"/>
+ <syscall name="statmount" number="457"/>
+ <syscall name="listmount" number="458"/>
+ <syscall name="lsm_get_self_attr" number="459"/>
+ <syscall name="lsm_set_self_attr" number="460"/>
+ <syscall name="lsm_list_modules" number="461"/>
+ <syscall name="mseal" number="462" groups="memory"/>
+ <syscall name="setxattrat" number="463" groups="descriptor,file"/>
+ <syscall name="getxattrat" number="464" groups="descriptor,file"/>
+ <syscall name="listxattrat" number="465" groups="descriptor,file"/>
+ <syscall name="removexattrat" number="466" groups="descriptor,file"/>
+ <syscall name="open_tree_attr" number="467" groups="descriptor,file"/>
+ <syscall name="file_getattr" number="468" groups="descriptor,file"/>
+ <syscall name="file_setattr" number="469" groups="descriptor,file"/>
+</syscalls_info>
diff --git a/gdb/syscalls/riscv-linux.xml.in b/gdb/syscalls/riscv-linux.xml.in
new file mode 100644
index 0000000..17b2b0a
--- /dev/null
+++ b/gdb/syscalls/riscv-linux.xml.in
@@ -0,0 +1,344 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2025 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE feature SYSTEM "gdb-syscalls.dtd">
+
+<!-- This file was generated using the following file:
+
+ <sys/syscall.h>
+
+ The file mentioned above belongs to the Linux Kernel. -->
+
+
+<syscalls_info>
+ <syscall name="io_setup" number="0"/>
+ <syscall name="io_destroy" number="1"/>
+ <syscall name="io_submit" number="2"/>
+ <syscall name="io_cancel" number="3"/>
+ <syscall name="io_getevents" number="4"/>
+ <syscall name="setxattr" number="5"/>
+ <syscall name="lsetxattr" number="6"/>
+ <syscall name="fsetxattr" number="7"/>
+ <syscall name="getxattr" number="8"/>
+ <syscall name="lgetxattr" number="9"/>
+ <syscall name="fgetxattr" number="10"/>
+ <syscall name="listxattr" number="11"/>
+ <syscall name="llistxattr" number="12"/>
+ <syscall name="flistxattr" number="13"/>
+ <syscall name="removexattr" number="14"/>
+ <syscall name="lremovexattr" number="15"/>
+ <syscall name="fremovexattr" number="16"/>
+ <syscall name="getcwd" number="17"/>
+ <syscall name="lookup_dcookie" number="18"/>
+ <syscall name="eventfd2" number="19"/>
+ <syscall name="epoll_create1" number="20"/>
+ <syscall name="epoll_ctl" number="21"/>
+ <syscall name="epoll_pwait" number="22"/>
+ <syscall name="dup" number="23"/>
+ <syscall name="dup3" number="24"/>
+ <syscall name="fcntl" number="25"/>
+ <syscall name="inotify_init1" number="26"/>
+ <syscall name="inotify_add_watch" number="27"/>
+ <syscall name="inotify_rm_watch" number="28"/>
+ <syscall name="ioctl" number="29"/>
+ <syscall name="ioprio_set" number="30"/>
+ <syscall name="ioprio_get" number="31"/>
+ <syscall name="flock" number="32"/>
+ <syscall name="mknodat" number="33"/>
+ <syscall name="mkdirat" number="34"/>
+ <syscall name="unlinkat" number="35"/>
+ <syscall name="symlinkat" number="36"/>
+ <syscall name="linkat" number="37"/>
+ <syscall name="umount2" number="39"/>
+ <syscall name="mount" number="40"/>
+ <syscall name="pivot_root" number="41"/>
+ <syscall name="nfsservctl" number="42"/>
+ <syscall name="statfs" number="43"/>
+ <syscall name="fstatfs" number="44"/>
+ <syscall name="truncate" number="45"/>
+ <syscall name="ftruncate" number="46"/>
+ <syscall name="fallocate" number="47"/>
+ <syscall name="faccessat" number="48"/>
+ <syscall name="chdir" number="49"/>
+ <syscall name="fchdir" number="50"/>
+ <syscall name="chroot" number="51"/>
+ <syscall name="fchmod" number="52"/>
+ <syscall name="fchmodat" number="53"/>
+ <syscall name="fchownat" number="54"/>
+ <syscall name="fchown" number="55"/>
+ <syscall name="openat" number="56"/>
+ <syscall name="close" number="57"/>
+ <syscall name="vhangup" number="58"/>
+ <syscall name="pipe2" number="59"/>
+ <syscall name="quotactl" number="60"/>
+ <syscall name="getdents64" number="61"/>
+ <syscall name="lseek" number="62"/>
+ <syscall name="read" number="63"/>
+ <syscall name="write" number="64"/>
+ <syscall name="readv" number="65"/>
+ <syscall name="writev" number="66"/>
+ <syscall name="pread64" number="67"/>
+ <syscall name="pwrite64" number="68"/>
+ <syscall name="preadv" number="69"/>
+ <syscall name="pwritev" number="70"/>
+ <syscall name="sendfile" number="71"/>
+ <syscall name="pselect6" number="72"/>
+ <syscall name="ppoll" number="73"/>
+ <syscall name="signalfd4" number="74"/>
+ <syscall name="vmsplice" number="75"/>
+ <syscall name="splice" number="76"/>
+ <syscall name="tee" number="77"/>
+ <syscall name="readlinkat" number="78"/>
+ <syscall name="newfstatat" number="79"/>
+ <syscall name="fstat" number="80"/>
+ <syscall name="sync" number="81"/>
+ <syscall name="fsync" number="82"/>
+ <syscall name="fdatasync" number="83"/>
+ <syscall name="sync_file_range" number="84"/>
+ <syscall name="timerfd_create" number="85"/>
+ <syscall name="timerfd_settime" number="86"/>
+ <syscall name="timerfd_gettime" number="87"/>
+ <syscall name="utimensat" number="88"/>
+ <syscall name="acct" number="89"/>
+ <syscall name="capget" number="90"/>
+ <syscall name="capset" number="91"/>
+ <syscall name="personality" number="92"/>
+ <syscall name="exit" number="93"/>
+ <syscall name="exit_group" number="94"/>
+ <syscall name="waitid" number="95"/>
+ <syscall name="set_tid_address" number="96"/>
+ <syscall name="unshare" number="97"/>
+ <syscall name="futex" number="98"/>
+ <syscall name="set_robust_list" number="99"/>
+ <syscall name="get_robust_list" number="100"/>
+ <syscall name="nanosleep" number="101"/>
+ <syscall name="getitimer" number="102"/>
+ <syscall name="setitimer" number="103"/>
+ <syscall name="kexec_load" number="104"/>
+ <syscall name="init_module" number="105"/>
+ <syscall name="delete_module" number="106"/>
+ <syscall name="timer_create" number="107"/>
+ <syscall name="timer_gettime" number="108"/>
+ <syscall name="timer_getoverrun" number="109"/>
+ <syscall name="timer_settime" number="110"/>
+ <syscall name="timer_delete" number="111"/>
+ <syscall name="clock_settime" number="112"/>
+ <syscall name="clock_gettime" number="113"/>
+ <syscall name="clock_getres" number="114"/>
+ <syscall name="clock_nanosleep" number="115"/>
+ <syscall name="syslog" number="116"/>
+ <syscall name="ptrace" number="117"/>
+ <syscall name="sched_setparam" number="118"/>
+ <syscall name="sched_setscheduler" number="119"/>
+ <syscall name="sched_getscheduler" number="120"/>
+ <syscall name="sched_getparam" number="121"/>
+ <syscall name="sched_setaffinity" number="122"/>
+ <syscall name="sched_getaffinity" number="123"/>
+ <syscall name="sched_yield" number="124"/>
+ <syscall name="sched_get_priority_max" number="125"/>
+ <syscall name="sched_get_priority_min" number="126"/>
+ <syscall name="sched_rr_get_interval" number="127"/>
+ <syscall name="restart_syscall" number="128"/>
+ <syscall name="kill" number="129"/>
+ <syscall name="tkill" number="130"/>
+ <syscall name="tgkill" number="131"/>
+ <syscall name="sigaltstack" number="132"/>
+ <syscall name="rt_sigsuspend" number="133"/>
+ <syscall name="rt_sigaction" number="134"/>
+ <syscall name="rt_sigprocmask" number="135"/>
+ <syscall name="rt_sigpending" number="136"/>
+ <syscall name="rt_sigtimedwait" number="137"/>
+ <syscall name="rt_sigqueueinfo" number="138"/>
+ <syscall name="rt_sigreturn" number="139"/>
+ <syscall name="setpriority" number="140"/>
+ <syscall name="getpriority" number="141"/>
+ <syscall name="reboot" number="142"/>
+ <syscall name="setregid" number="143"/>
+ <syscall name="setgid" number="144"/>
+ <syscall name="setreuid" number="145"/>
+ <syscall name="setuid" number="146"/>
+ <syscall name="setresuid" number="147"/>
+ <syscall name="getresuid" number="148"/>
+ <syscall name="setresgid" number="149"/>
+ <syscall name="getresgid" number="150"/>
+ <syscall name="setfsuid" number="151"/>
+ <syscall name="setfsgid" number="152"/>
+ <syscall name="times" number="153"/>
+ <syscall name="setpgid" number="154"/>
+ <syscall name="getpgid" number="155"/>
+ <syscall name="getsid" number="156"/>
+ <syscall name="setsid" number="157"/>
+ <syscall name="getgroups" number="158"/>
+ <syscall name="setgroups" number="159"/>
+ <syscall name="uname" number="160"/>
+ <syscall name="sethostname" number="161"/>
+ <syscall name="setdomainname" number="162"/>
+ <syscall name="getrlimit" number="163"/>
+ <syscall name="setrlimit" number="164"/>
+ <syscall name="getrusage" number="165"/>
+ <syscall name="umask" number="166"/>
+ <syscall name="prctl" number="167"/>
+ <syscall name="getcpu" number="168"/>
+ <syscall name="gettimeofday" number="169"/>
+ <syscall name="settimeofday" number="170"/>
+ <syscall name="adjtimex" number="171"/>
+ <syscall name="getpid" number="172"/>
+ <syscall name="getppid" number="173"/>
+ <syscall name="getuid" number="174"/>
+ <syscall name="geteuid" number="175"/>
+ <syscall name="getgid" number="176"/>
+ <syscall name="getegid" number="177"/>
+ <syscall name="gettid" number="178"/>
+ <syscall name="sysinfo" number="179"/>
+ <syscall name="mq_open" number="180"/>
+ <syscall name="mq_unlink" number="181"/>
+ <syscall name="mq_timedsend" number="182"/>
+ <syscall name="mq_timedreceive" number="183"/>
+ <syscall name="mq_notify" number="184"/>
+ <syscall name="mq_getsetattr" number="185"/>
+ <syscall name="msgget" number="186"/>
+ <syscall name="msgctl" number="187"/>
+ <syscall name="msgrcv" number="188"/>
+ <syscall name="msgsnd" number="189"/>
+ <syscall name="semget" number="190"/>
+ <syscall name="semctl" number="191"/>
+ <syscall name="semtimedop" number="192"/>
+ <syscall name="semop" number="193"/>
+ <syscall name="shmget" number="194"/>
+ <syscall name="shmctl" number="195"/>
+ <syscall name="shmat" number="196"/>
+ <syscall name="shmdt" number="197"/>
+ <syscall name="socket" number="198"/>
+ <syscall name="socketpair" number="199"/>
+ <syscall name="bind" number="200"/>
+ <syscall name="listen" number="201"/>
+ <syscall name="accept" number="202"/>
+ <syscall name="connect" number="203"/>
+ <syscall name="getsockname" number="204"/>
+ <syscall name="getpeername" number="205"/>
+ <syscall name="sendto" number="206"/>
+ <syscall name="recvfrom" number="207"/>
+ <syscall name="setsockopt" number="208"/>
+ <syscall name="getsockopt" number="209"/>
+ <syscall name="shutdown" number="210"/>
+ <syscall name="sendmsg" number="211"/>
+ <syscall name="recvmsg" number="212"/>
+ <syscall name="readahead" number="213"/>
+ <syscall name="brk" number="214"/>
+ <syscall name="munmap" number="215"/>
+ <syscall name="mremap" number="216"/>
+ <syscall name="add_key" number="217"/>
+ <syscall name="request_key" number="218"/>
+ <syscall name="keyctl" number="219"/>
+ <syscall name="clone" number="220"/>
+ <syscall name="execve" number="221"/>
+ <syscall name="mmap" number="222"/>
+ <syscall name="fadvise64" number="223"/>
+ <syscall name="swapon" number="224"/>
+ <syscall name="swapoff" number="225"/>
+ <syscall name="mprotect" number="226"/>
+ <syscall name="msync" number="227"/>
+ <syscall name="mlock" number="228"/>
+ <syscall name="munlock" number="229"/>
+ <syscall name="mlockall" number="230"/>
+ <syscall name="munlockall" number="231"/>
+ <syscall name="mincore" number="232"/>
+ <syscall name="madvise" number="233"/>
+ <syscall name="remap_file_pages" number="234"/>
+ <syscall name="mbind" number="235"/>
+ <syscall name="get_mempolicy" number="236"/>
+ <syscall name="set_mempolicy" number="237"/>
+ <syscall name="migrate_pages" number="238"/>
+ <syscall name="move_pages" number="239"/>
+ <syscall name="rt_tgsigqueueinfo" number="240"/>
+ <syscall name="perf_event_open" number="241"/>
+ <syscall name="accept4" number="242"/>
+ <syscall name="recvmmsg" number="243"/>
+ <syscall name="riscv_hwprobe" number="258"/>
+ <syscall name="riscv_flush_icache" number="259"/>
+ <syscall name="wait4" number="260"/>
+ <syscall name="prlimit64" number="261"/>
+ <syscall name="fanotify_init" number="262"/>
+ <syscall name="fanotify_mark" number="263"/>
+ <syscall name="name_to_handle_at" number="264"/>
+ <syscall name="open_by_handle_at" number="265"/>
+ <syscall name="clock_adjtime" number="266"/>
+ <syscall name="syncfs" number="267"/>
+ <syscall name="setns" number="268"/>
+ <syscall name="sendmmsg" number="269"/>
+ <syscall name="process_vm_readv" number="270"/>
+ <syscall name="process_vm_writev" number="271"/>
+ <syscall name="kcmp" number="272"/>
+ <syscall name="finit_module" number="273"/>
+ <syscall name="sched_setattr" number="274"/>
+ <syscall name="sched_getattr" number="275"/>
+ <syscall name="renameat2" number="276"/>
+ <syscall name="seccomp" number="277"/>
+ <syscall name="getrandom" number="278"/>
+ <syscall name="memfd_create" number="279"/>
+ <syscall name="bpf" number="280"/>
+ <syscall name="execveat" number="281"/>
+ <syscall name="userfaultfd" number="282"/>
+ <syscall name="membarrier" number="283"/>
+ <syscall name="mlock2" number="284"/>
+ <syscall name="copy_file_range" number="285"/>
+ <syscall name="preadv2" number="286"/>
+ <syscall name="pwritev2" number="287"/>
+ <syscall name="pkey_mprotect" number="288"/>
+ <syscall name="pkey_alloc" number="289"/>
+ <syscall name="pkey_free" number="290"/>
+ <syscall name="statx" number="291"/>
+ <syscall name="io_pgetevents" number="292"/>
+ <syscall name="rseq" number="293"/>
+ <syscall name="kexec_file_load" number="294"/>
+ <syscall name="pidfd_send_signal" number="424"/>
+ <syscall name="io_uring_setup" number="425"/>
+ <syscall name="io_uring_enter" number="426"/>
+ <syscall name="io_uring_register" number="427"/>
+ <syscall name="open_tree" number="428"/>
+ <syscall name="move_mount" number="429"/>
+ <syscall name="fsopen" number="430"/>
+ <syscall name="fsconfig" number="431"/>
+ <syscall name="fsmount" number="432"/>
+ <syscall name="fspick" number="433"/>
+ <syscall name="pidfd_open" number="434"/>
+ <syscall name="clone3" number="435"/>
+ <syscall name="close_range" number="436"/>
+ <syscall name="openat2" number="437"/>
+ <syscall name="pidfd_getfd" number="438"/>
+ <syscall name="faccessat2" number="439"/>
+ <syscall name="process_madvise" number="440"/>
+ <syscall name="epoll_pwait2" number="441"/>
+ <syscall name="mount_setattr" number="442"/>
+ <syscall name="quotactl_fd" number="443"/>
+ <syscall name="landlock_create_ruleset" number="444"/>
+ <syscall name="landlock_add_rule" number="445"/>
+ <syscall name="landlock_restrict_self" number="446"/>
+ <syscall name="memfd_secret" number="447"/>
+ <syscall name="process_mrelease" number="448"/>
+ <syscall name="futex_waitv" number="449"/>
+ <syscall name="set_mempolicy_home_node" number="450"/>
+ <syscall name="cachestat" number="451"/>
+ <syscall name="fchmodat2" number="452"/>
+ <syscall name="map_shadow_stack" number="453"/>
+ <syscall name="futex_wake" number="454"/>
+ <syscall name="futex_wait" number="455"/>
+ <syscall name="futex_requeue" number="456"/>
+ <syscall name="statmount" number="457"/>
+ <syscall name="listmount" number="458"/>
+ <syscall name="lsm_get_self_attr" number="459"/>
+ <syscall name="lsm_set_self_attr" number="460"/>
+ <syscall name="lsm_list_modules" number="461"/>
+ <syscall name="mseal" number="462"/>
+ <syscall name="setxattrat" number="463"/>
+ <syscall name="getxattrat" number="464"/>
+ <syscall name="listxattrat" number="465"/>
+ <syscall name="removexattrat" number="466"/>
+ <syscall name="open_tree_attr" number="467"/>
+ <syscall name="file_getattr" number="468"/>
+ <syscall name="file_setattr" number="469"/>
+</syscalls_info>
diff --git a/gdb/syscalls/update-freebsd.sh b/gdb/syscalls/update-freebsd.sh
index 2a54c19..ae1ee80 100755
--- a/gdb/syscalls/update-freebsd.sh
+++ b/gdb/syscalls/update-freebsd.sh
@@ -1,6 +1,6 @@
#! /bin/sh
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/syscalls/update-linux-defaults.sh b/gdb/syscalls/update-linux-defaults.sh
index 92378f0..d374051 100755
--- a/gdb/syscalls/update-linux-defaults.sh
+++ b/gdb/syscalls/update-linux-defaults.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/syscalls/update-linux-from-src.sh b/gdb/syscalls/update-linux-from-src.sh
index 35d7899..26c38f6 100755
--- a/gdb/syscalls/update-linux-from-src.sh
+++ b/gdb/syscalls/update-linux-from-src.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
@@ -325,6 +325,11 @@ regen ()
gen_from_kernel_headers "$f" arm64
return
;;
+ riscv-linux.xml.in)
+ # No syscall.tbl.
+ gen_from_kernel_headers "$f" riscv
+ return
+ ;;
arm-linux.xml.in)
t="arch/arm/tools/syscall.tbl"
h="arch/arm/include/uapi/asm/unistd.h"
diff --git a/gdb/syscalls/update-linux.sh b/gdb/syscalls/update-linux.sh
index 8248a96..cbc8a9d 100755
--- a/gdb/syscalls/update-linux.sh
+++ b/gdb/syscalls/update-linux.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
@@ -40,6 +40,9 @@ case "$f" in
*aarch64-linux.xml.in)
startyear=2015
;;
+ *riscv-linux.xml.in)
+ startyear=2025
+ ;;
esac
year=$(date +%Y)
diff --git a/gdb/syscalls/update-netbsd.sh b/gdb/syscalls/update-netbsd.sh
index 43b2b04..ef50646 100755
--- a/gdb/syscalls/update-netbsd.sh
+++ b/gdb/syscalls/update-netbsd.sh
@@ -1,6 +1,6 @@
#! /bin/sh
-# Copyright (C) 2020-2024 Free Software Foundation, Inc.
+# Copyright (C) 2020-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
@@ -36,7 +36,7 @@ fi
cat > netbsd.xml.tmp <<EOF
<?xml version="1.0"?> <!-- THIS FILE IS GENERATED -*- buffer-read-only: t -*- -->
<!-- vi:set ro: -->
-<!-- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2020-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/system-gdbinit/elinos.py b/gdb/system-gdbinit/elinos.py
index da82687..6a08258 100644
--- a/gdb/system-gdbinit/elinos.py
+++ b/gdb/system-gdbinit/elinos.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/system-gdbinit/wrs-linux.py b/gdb/system-gdbinit/wrs-linux.py
index 952617e..7db36bf 100644
--- a/gdb/system-gdbinit/wrs-linux.py
+++ b/gdb/system-gdbinit/wrs-linux.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/target-connection.c b/gdb/target-connection.c
index d9a529a..02eea05 100644
--- a/gdb/target-connection.c
+++ b/gdb/target-connection.c
@@ -1,6 +1,6 @@
/* List of target connections for GDB.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -149,10 +149,7 @@ info_connections_command (const char *args, int from_tty)
print_connection (current_uiout, args);
}
-void _initialize_target_connection ();
-
-void
-_initialize_target_connection ()
+INIT_GDB_FILE (target_connection)
{
add_info ("connections", info_connections_command,
_("\
diff --git a/gdb/target-connection.h b/gdb/target-connection.h
index 4faae11..67bac5c 100644
--- a/gdb/target-connection.h
+++ b/gdb/target-connection.h
@@ -1,6 +1,6 @@
/* List of target connections for GDB.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/target-dcache.c b/gdb/target-dcache.c
index 6a51bc6..6be1224 100644
--- a/gdb/target-dcache.c
+++ b/gdb/target-dcache.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -161,9 +161,7 @@ maint_flush_dcache_command (const char *command, int from_tty)
gdb_printf (_("The dcache was flushed.\n"));
}
-void _initialize_target_dcache ();
-void
-_initialize_target_dcache ()
+INIT_GDB_FILE (target_dcache)
{
add_setshow_boolean_cmd ("stack-cache", class_support,
&stack_cache_enabled_1, _("\
diff --git a/gdb/target-dcache.h b/gdb/target-dcache.h
index a199a23..1a0d946 100644
--- a/gdb/target-dcache.h
+++ b/gdb/target-dcache.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/target-debug.h b/gdb/target-debug.h
index aee7d17..f7debe4 100644
--- a/gdb/target-debug.h
+++ b/gdb/target-debug.h
@@ -1,6 +1,6 @@
/* GDB target debugging macros
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/target-delegates-gen.c b/gdb/target-delegates-gen.c
index 7d34f80..164ddbb 100644
--- a/gdb/target-delegates-gen.c
+++ b/gdb/target-delegates-gen.c
@@ -3,7 +3,7 @@
/* Boilerplate target methods for GDB
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 1d35e4d..5a5d03e 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1,6 +1,6 @@
/* Target description support for GDB.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
Contributed by CodeSourcery.
@@ -453,10 +453,6 @@ get_arch_data (struct gdbarch *gdbarch)
return result;
}
-/* The string manipulated by the "set tdesc filename ..." command. */
-
-static std::string tdesc_filename_cmd_string;
-
/* Fetch the current target's description, and switch the current
architecture to one which incorporates that description. */
@@ -1208,27 +1204,34 @@ set_tdesc_osabi (struct target_desc *target_desc, enum gdb_osabi osabi)
static struct cmd_list_element *tdesc_set_cmdlist, *tdesc_show_cmdlist;
static struct cmd_list_element *tdesc_unset_cmdlist;
-/* Helper functions for the CLI commands. */
+/* Setter for the "tdesc filename" setting. */
static void
-set_tdesc_filename_cmd (const char *args, int from_tty,
- struct cmd_list_element *c)
+set_tdesc_filename (const std::string &value)
{
target_desc_info *tdesc_info = &current_inferior ()->tdesc_info;
- tdesc_info->filename = tdesc_filename_cmd_string;
+ tdesc_info->filename = value;
target_clear_description ();
target_find_description ();
}
+/* Getter for the "tdesc filename" setting. */
+
+static const std::string &
+get_tdesc_filename ()
+{
+ target_desc_info *tdesc_info = &current_inferior ()->tdesc_info;
+
+ return tdesc_info->filename;
+}
+
static void
show_tdesc_filename_cmd (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
const char *value)
{
- value = current_inferior ()->tdesc_info.filename.data ();
-
if (value != NULL && *value != '\0')
gdb_printf (file,
_("The target description will be read from \"%ps\".\n"),
@@ -1880,9 +1883,7 @@ maintenance_check_xml_descriptions (const char *dir, int from_tty)
(long) selftests::xml_tdesc.size (), failed);
}
-void _initialize_target_descriptions ();
-void
-_initialize_target_descriptions ()
+INIT_GDB_FILE (target_descriptions)
{
cmd_list_element *cmd;
@@ -1898,13 +1899,13 @@ Unset target description specific variables."),
0 /* allow-unknown */, &unsetlist);
add_setshow_filename_cmd ("filename", class_obscure,
- &tdesc_filename_cmd_string,
_("\
Set the file to read for an XML target description."), _("\
Show the file to read for an XML target description."), _("\
When set, GDB will read the target description from a local\n\
file instead of querying the remote target."),
- set_tdesc_filename_cmd,
+ set_tdesc_filename,
+ get_tdesc_filename,
show_tdesc_filename_cmd,
&tdesc_set_cmdlist, &tdesc_show_cmdlist);
diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h
index 5bd7973..7481c87 100644
--- a/gdb/target-descriptions.h
+++ b/gdb/target-descriptions.h
@@ -1,6 +1,6 @@
/* Target description support for GDB.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
Contributed by CodeSourcery.
diff --git a/gdb/target-float.c b/gdb/target-float.c
index 9b1b6b7..9b0376f 100644
--- a/gdb/target-float.c
+++ b/gdb/target-float.c
@@ -1,6 +1,6 @@
/* Floating point routines for GDB, the GNU debugger.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/target-float.h b/gdb/target-float.h
index 0b9cd7a..ab0c848 100644
--- a/gdb/target-float.h
+++ b/gdb/target-float.h
@@ -1,6 +1,6 @@
/* Floating point definitions for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/target-memory.c b/gdb/target-memory.c
index f752769..56fac49 100644
--- a/gdb/target-memory.c
+++ b/gdb/target-memory.c
@@ -1,7 +1,7 @@
/* Parts of target interface that deal with accessing memory and memory-like
objects.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/target-section.h b/gdb/target-section.h
index d7cea4f..30ff663 100644
--- a/gdb/target-section.h
+++ b/gdb/target-section.h
@@ -1,6 +1,6 @@
/* Target sections.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/target.c b/gdb/target.c
index 8d7f168..d8633ca 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -1,6 +1,6 @@
/* Select target systems and architectures at runtime for GDB.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
Contributed by Cygnus Support.
@@ -1186,6 +1186,14 @@ target_stack::push (target_ops *t)
if (m_stack[stratum].get () != nullptr)
unpush (m_stack[stratum].get ());
+ /* If this target can't be shared, then check that the target doesn't
+ already appear on some other target stack. */
+ if (!t->is_shareable ())
+ for (inferior *inf : all_inferiors ())
+ if (inf->target_is_pushed (t))
+ internal_error (_("Attempt to push unshareable target: %s."),
+ t->shortname ());
+
/* Now add the new one. */
m_stack[stratum] = std::move (ref);
@@ -1250,11 +1258,21 @@ generic_tls_error (void)
_("Cannot find thread-local variables on this target"));
}
-/* Using the objfile specified in OBJFILE, find the address for the
- current thread's thread-local storage with offset OFFSET. */
+/* See target.h. */
+
CORE_ADDR
-target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
+target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset,
+ const char *name)
{
+ if (!target_has_registers ())
+ {
+ if (name == nullptr)
+ error (_("Cannot translate TLS address without registers"));
+ else
+ error (_("Cannot find address of TLS symbol `%s' without registers"),
+ name);
+ }
+
volatile CORE_ADDR addr = 0;
struct target_ops *target = current_inferior ()->top_target ();
gdbarch *gdbarch = current_inferior ()->arch ();
@@ -2454,6 +2472,7 @@ target_pre_inferior ()
if (!gdbarch_has_global_solist (current_inferior ()->arch ()))
{
no_shared_libraries (current_program_space);
+ current_program_space->unset_solib_ops ();
invalidate_target_mem_regions ();
@@ -3194,8 +3213,8 @@ target_ops::fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno)
}
int
-target_ops::fileio_stat (struct inferior *inf, const char *filename,
- struct stat *sb, fileio_error *target_errno)
+target_ops::fileio_lstat (struct inferior *inf, const char *filename,
+ struct stat *sb, fileio_error *target_errno)
{
*target_errno = FILEIO_ENOSYS;
return -1;
@@ -3321,17 +3340,17 @@ target_fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno)
/* See target.h. */
int
-target_fileio_stat (struct inferior *inf, const char *filename,
- struct stat *sb, fileio_error *target_errno)
+target_fileio_lstat (struct inferior *inf, const char *filename,
+ struct stat *sb, fileio_error *target_errno)
{
for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ())
{
- int ret = t->fileio_stat (inf, filename, sb, target_errno);
+ int ret = t->fileio_lstat (inf, filename, sb, target_errno);
if (ret == -1 && *target_errno == FILEIO_ENOSYS)
continue;
- target_debug_printf_nofunc ("target_fileio_stat (%s) = %d (%d)",
+ target_debug_printf_nofunc ("target_fileio_lstat (%s) = %d (%d)",
filename, ret,
ret != -1 ? 0 : *target_errno);
return ret;
@@ -3793,11 +3812,11 @@ target_pass_ctrlc (void)
if (proc_target == NULL)
continue;
- for (thread_info *thr : inf->non_exited_threads ())
+ for (thread_info &thr : inf->non_exited_threads ())
{
/* A thread can be THREAD_STOPPED and executing, while
running an infcall. */
- if (thr->state == THREAD_RUNNING || thr->executing ())
+ if (thr.state == THREAD_RUNNING || thr.executing ())
{
/* We can get here quite deep in target layers. Avoid
switching thread context or anything that would
@@ -4492,10 +4511,7 @@ set_write_memory_registers_permission (const char *args, int from_tty,
update_observer_mode ();
}
-void _initialize_target ();
-
-void
-_initialize_target ()
+INIT_GDB_FILE (target)
{
the_debug_target = new debug_target ();
diff --git a/gdb/target.h b/gdb/target.h
index 760d210..3525a43 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1,6 +1,6 @@
/* Interface between GDB and target environments, including files and processes
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by John Gilmore.
@@ -1016,8 +1016,8 @@ struct target_ops
filesystem seen by the debugger (GDB or, for remote targets, the
remote stub). Return 0 on success, or -1 if an error occurs (and
set *TARGET_ERRNO). */
- virtual int fileio_stat (struct inferior *inf, const char *filename,
- struct stat *sb, fileio_error *target_errno);
+ virtual int fileio_lstat (struct inferior *inf, const char *filename,
+ struct stat *sb, fileio_error *target_errno);
/* Close FD on the target. Return 0, or -1 if an error occurs
(and set *TARGET_ERRNO). */
@@ -1399,6 +1399,23 @@ struct target_ops
virtual void displaced_step_restore_all_in_ptid (inferior *parent_inf,
ptid_t child_ptid)
TARGET_DEFAULT_FUNC (default_displaced_step_restore_all_in_ptid);
+
+ /* Return true if an instance of this target can appear on multiple
+ target stacks, or false if an instance of this target can only
+ appear on a single target stack.
+
+ Returning false doesn't mean that GDB can't create multiple
+ instances of this target, just that each instance will only be used
+ by a single inferior.
+
+ The default return value for this function is true indicating
+ targets can be shared. The only non-shareable targets are some of
+ the process_stratum_target sub-classes, as such, this default is
+ changed in process_stratum_target to return false, then those
+ process_stratum_target sub-classes that are shareable set this to
+ true. */
+ virtual bool is_shareable ()
+ { return true; }
};
/* Deleter for std::unique_ptr. See comments in
@@ -2256,8 +2273,8 @@ extern int target_fileio_fstat (int fd, struct stat *sb,
filesystem seen by the debugger (GDB or, for remote targets, the remote
stub). Return 0 on success, or -1 if an error occurs (and set
*TARGET_ERRNO). */
-extern int target_fileio_stat (struct inferior *inf, const char *filename,
- struct stat *sb, fileio_error *target_errno);
+extern int target_fileio_lstat (struct inferior *inf, const char *filename,
+ struct stat *sb, fileio_error *target_errno);
/* Close FD on the target. Return 0, or -1 if an error occurs
(and set *TARGET_ERRNO). */
@@ -2472,8 +2489,14 @@ extern void target_pre_inferior ();
extern void target_preopen (int);
+/* Using the objfile specified in OBJFILE, find the address for the
+ current thread's thread-local storage with offset OFFSET. If it's
+ provided, NAME might be used to indicate the relevant variable
+ in an error message. */
+
extern CORE_ADDR target_translate_tls_address (struct objfile *objfile,
- CORE_ADDR offset);
+ CORE_ADDR offset,
+ const char *name = nullptr);
/* Return the "section" containing the specified address. */
const struct target_section *target_section_by_addr (struct target_ops *target,
diff --git a/gdb/target/resume.h b/gdb/target/resume.h
index 024e39b..00e4e48 100644
--- a/gdb/target/resume.h
+++ b/gdb/target/resume.h
@@ -1,6 +1,6 @@
/* Target resumption definitions and prototypes.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/target/target.c b/gdb/target/target.c
index c84a6ff..c7b0df7 100644
--- a/gdb/target/target.c
+++ b/gdb/target/target.c
@@ -1,6 +1,6 @@
/* String reading
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/target/target.h b/gdb/target/target.h
index 87a3464..b69caf5 100644
--- a/gdb/target/target.h
+++ b/gdb/target/target.h
@@ -1,6 +1,6 @@
/* Declarations for common target functions.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/target/wait.h b/gdb/target/wait.h
index 026a42f..a724a73 100644
--- a/gdb/target/wait.h
+++ b/gdb/target/wait.h
@@ -1,6 +1,6 @@
/* Target wait definitions and prototypes.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/target/waitstatus.c b/gdb/target/waitstatus.c
index 9e9b563..94d129a 100644
--- a/gdb/target/waitstatus.c
+++ b/gdb/target/waitstatus.c
@@ -1,6 +1,6 @@
/* Target waitstatus implementations.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/target/waitstatus.h b/gdb/target/waitstatus.h
index 0ba5b9c..d87988f 100644
--- a/gdb/target/waitstatus.h
+++ b/gdb/target/waitstatus.h
@@ -1,6 +1,6 @@
/* Target waitstatus definitions and prototypes.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
+ Copyright (C) 1990-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/tclint.toml b/gdb/tclint.toml
new file mode 100644
index 0000000..92b8d3d
--- /dev/null
+++ b/gdb/tclint.toml
@@ -0,0 +1,63 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Configuration file for the tclint and tclfmt tools from the tclint package
+# ( https://github.com/nmoroze/tclint ).
+#
+# Eventually we'd like to move these settings to pyproject.toml, but currently
+# that's not possible. See this tclint issue (
+# https://github.com/nmoroze/tclint/issues/120 ).
+#
+# Issues related to using the tclint tool in the gdb testsuite:
+# - tclint does not support expect.
+# https://github.com/nmoroze/tclint/issues/118
+# - tclint doesn't inspect code passed as arguments to gdb testsuite specific
+# commands like with_test_prefix.
+# https://github.com/nmoroze/tclint/issues/121
+# - tclint ignores splat ({*}$foo) when checking number of arguments
+# https://github.com/nmoroze/tclint/issues/122
+
+exclude = [
+# TODO:
+"gdb/testsuite/boards",
+"gdb/testsuite/config",
+# IGNORE (document reason in trailing comment):
+"gdb/testsuite/gdb.stabs", # To be removed.
+"gdb/testsuite/lib/ton.tcl", # Imported.
+]
+
+# A maximum line length of 80 is current policy, but it hasn't been too
+# strictly enforced. It's the most frequent and least harmful violation.
+# Ignore this for now.
+ignore = ["line-length"]
+
+extensions = ["exp", "tcl"]
+
+[style]
+# Used by tclfmt. Doesn't support the mixed TAB and spaces style we use. See
+# this tclint issue ( https://github.com/nmoroze/tclint/issues/109 ).
+indent = 4
+
+# Used by both tclint and tclfmt. Current policy is 80.
+line-length = 80
+
+# Used by tclfmt.
+max-blank-lines = 1
+
+# Used by tclfmt. False conflicts with emacs tcl mode.
+indent-namespace-eval = true
+
+# Used by tclfmt.
+spaces-in-braces = false
diff --git a/gdb/terminal.h b/gdb/terminal.h
index 154b4be..87a1aee 100644
--- a/gdb/terminal.h
+++ b/gdb/terminal.h
@@ -1,5 +1,5 @@
/* Terminal interface definitions for GDB, the GNU Debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -19,6 +19,8 @@
#ifndef GDB_TERMINAL_H
#define GDB_TERMINAL_H
+#include "serial.h"
+
struct inferior;
extern void new_tty_prefork (std::string ttyname);
@@ -43,4 +45,23 @@ extern void gdb_save_tty_state (void);
have had a chance to alter it. */
extern void set_initial_gdb_ttystate (void);
+/* Restore initial tty state. */
+extern void restore_initial_gdb_ttystate (void);
+
+/* An RAII-based object that saves the tty state, and then restores it again
+ when this object is destroyed. */
+class scoped_gdb_ttystate
+{
+public:
+ scoped_gdb_ttystate ();
+ ~scoped_gdb_ttystate ();
+private:
+ serial_ttystate m_ttystate;
+};
+
+#ifdef USE_WIN32API
+/* Set translation mode of stdout/stderr to binary. */
+extern void set_output_translation_mode_binary ();
+#endif
+
#endif /* GDB_TERMINAL_H */
diff --git a/gdb/test-target.c b/gdb/test-target.c
index 4da7a08..d7a7461 100644
--- a/gdb/test-target.c
+++ b/gdb/test-target.c
@@ -1,6 +1,6 @@
/* A mock process_stratum target_ops
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/test-target.h b/gdb/test-target.h
index e29d659..d09131f 100644
--- a/gdb/test-target.h
+++ b/gdb/test-target.h
@@ -1,6 +1,6 @@
/* A mock process_stratum target_ops
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/ChangeLog-1993-2013 b/gdb/testsuite/ChangeLog-1993-2013
index e6d8a49..a54c643 100644
--- a/gdb/testsuite/ChangeLog-1993-2013
+++ b/gdb/testsuite/ChangeLog-1993-2013
@@ -33699,6 +33699,6 @@ Sun Feb 21 10:55:55 1993 Mike Werner (mtw@poseidon.cygnus.com)
;; version-control: never
;; End:
- Copyright 1993-2024 Free Software Foundation, Inc.
+ Copyright 1993-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted provided the copyright notice and this notice are preserved.
diff --git a/gdb/testsuite/ChangeLog-2014-2021 b/gdb/testsuite/ChangeLog-2014-2021
index 6376c70..e0c50c6 100644
--- a/gdb/testsuite/ChangeLog-2014-2021
+++ b/gdb/testsuite/ChangeLog-2014-2021
@@ -24947,6 +24947,6 @@ For older changes see ChangeLog-1993-2013.
;; version-control: never
;; End:
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted provided the copyright notice and this notice are preserved.
diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
index 3235c70..fa2d9eb 100644
--- a/gdb/testsuite/Makefile.in
+++ b/gdb/testsuite/Makefile.in
@@ -1,5 +1,5 @@
# Makefile for regression testing the GNU debugger.
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This file is part of GDB.
@@ -386,7 +386,17 @@ check-all-boards: all $(abs_builddir)/site.exp
${abs_srcdir}/make-check-all.sh --keep-results \
--host-user "$(GDB_HOST_USERNAME)" \
--target-user "$(GDB_TARGET_USERNAME)" \
- "$(TESTS)"
+ "$(TESTS)" \
+ result=$$?; \
+ if test -d check-all; then \
+ $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
+ `find check-all -name gdb.sum -print` > check-all/gdb.sum; \
+ $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
+ `find check-all -name gdb.log -print` > check-all/gdb.log; \
+ sed -n '/=== gdb Summary ===/,$$ p' check-all/gdb.sum; \
+ fi; \
+ exit $$result
+
force:;
@@ -440,14 +450,15 @@ expect-read1 expect-readmore:
# function, making it read one byte at a time. Running the testsuite
# with this catches racy tests.
read1.so: lib/read1.c
- $(ECHO_CC) $(CC) -o $@ ${srcdir}/lib/read1.c -Wall -g -shared -fPIC $(CFLAGS)
+ $(ECHO_CC) $(CC) -o $@ ${srcdir}/lib/read1.c -Wall -g -shared -fPIC \
+ $(filter-out -fsanitize=%,$(CFLAGS))
# Build the readmore.so preload library. This overrides the `read'
# function, making it try harder to read more at a time. Running the
# testsuite with this catches racy tests.
readmore.so: lib/read1.c
$(ECHO_CC) $(CC) -o $@ ${srcdir}/lib/read1.c -Wall -g -shared -fPIC \
- $(CFLAGS) -DREADMORE
+ $(filter-out -fsanitize=%,$(CFLAGS)) -DREADMORE
# Build the read1 machinery.
.PHONY: read1 readmore
diff --git a/gdb/testsuite/analyze-racy-logs.py b/gdb/testsuite/analyze-racy-logs.py
index 3863bd0..f24bea9 100755
--- a/gdb/testsuite/analyze-racy-logs.py
+++ b/gdb/testsuite/analyze-racy-logs.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
@@ -62,7 +62,6 @@ sum_matcher = re.compile("^(.?(PASS|FAIL)): (.*)$")
def parse_sum_line(line: str, dic: dict[str, set[str]]):
"""Parse a single LINE from a sumfile, and store the results in the
dictionary referenced by DIC."""
- global sum_matcher
line = line.rstrip()
m = re.match(sum_matcher, line)
@@ -96,7 +95,6 @@ def read_sum_files(files: list[str]):
"""Read the sumfiles (passed as a list in the FILES variable), and
process each one, filling the FILES_AND_TESTS global dictionary with
information about them."""
- global files_and_tests
for x in files:
with open(x, "r") as f:
@@ -115,7 +113,6 @@ def identify_racy_tests():
This function does that for all sets (PASS, FAIL, KPASS, KFAIL, etc.),
and then print a sorted list (without duplicates) of all the tests
that were found to be racy."""
- global files_and_tests
# First, construct two dictionaries that will hold one set of
# testcases for each state (PASS, FAIL, etc.).
diff --git a/gdb/testsuite/boards/cc-with-debug-names.exp b/gdb/testsuite/boards/cc-with-debug-names.exp
index a4b7b8e..0484422 100644
--- a/gdb/testsuite/boards/cc-with-debug-names.exp
+++ b/gdb/testsuite/boards/cc-with-debug-names.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/cc-with-dwz-5.exp b/gdb/testsuite/boards/cc-with-dwz-5.exp
new file mode 100644
index 0000000..b254f91
--- /dev/null
+++ b/gdb/testsuite/boards/cc-with-dwz-5.exp
@@ -0,0 +1,28 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This file is a dejagnu "board file" and is used to run the testsuite
+# with contrib/cc-with-tweaks.sh -5.
+#
+# NOTE: We assume dwz is in $PATH.
+#
+# Example usage:
+# bash$ cd $objdir
+# bash$ make check-gdb \
+# RUNTESTFLAGS='--target_board=cc-with-dwz-5'
+#
+
+set CC_WITH_TWEAKS_FLAGS "-5"
+load_board_description "cc-with-tweaks"
diff --git a/gdb/testsuite/boards/cc-with-dwz-m.exp b/gdb/testsuite/boards/cc-with-dwz-m.exp
index 8b8387f..ba42704 100644
--- a/gdb/testsuite/boards/cc-with-dwz-m.exp
+++ b/gdb/testsuite/boards/cc-with-dwz-m.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/cc-with-dwz.exp b/gdb/testsuite/boards/cc-with-dwz.exp
index 57dc09c..f83e211 100644
--- a/gdb/testsuite/boards/cc-with-dwz.exp
+++ b/gdb/testsuite/boards/cc-with-dwz.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/cc-with-gdb-index.exp b/gdb/testsuite/boards/cc-with-gdb-index.exp
index 3889df0..d859935 100644
--- a/gdb/testsuite/boards/cc-with-gdb-index.exp
+++ b/gdb/testsuite/boards/cc-with-gdb-index.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/cc-with-gnu-debuglink.exp b/gdb/testsuite/boards/cc-with-gnu-debuglink.exp
index 5688593..b6e8378 100644
--- a/gdb/testsuite/boards/cc-with-gnu-debuglink.exp
+++ b/gdb/testsuite/boards/cc-with-gnu-debuglink.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/cc-with-index-cache.exp b/gdb/testsuite/boards/cc-with-index-cache.exp
index debcaac..60ad1e9 100644
--- a/gdb/testsuite/boards/cc-with-index-cache.exp
+++ b/gdb/testsuite/boards/cc-with-index-cache.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/cc-with-tweaks.exp b/gdb/testsuite/boards/cc-with-tweaks.exp
index 52c93a9..8c079da 100644
--- a/gdb/testsuite/boards/cc-with-tweaks.exp
+++ b/gdb/testsuite/boards/cc-with-tweaks.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/debug-types.exp b/gdb/testsuite/boards/debug-types.exp
index 733510c..970829b 100644
--- a/gdb/testsuite/boards/debug-types.exp
+++ b/gdb/testsuite/boards/debug-types.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/dwarf4-gdb-index.exp b/gdb/testsuite/boards/dwarf4-gdb-index.exp
index cf94a99..a9ac29c 100644
--- a/gdb/testsuite/boards/dwarf4-gdb-index.exp
+++ b/gdb/testsuite/boards/dwarf4-gdb-index.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/dwarf5-fission-debug-types.exp b/gdb/testsuite/boards/dwarf5-fission-debug-types.exp
new file mode 100644
index 0000000..189a591
--- /dev/null
+++ b/gdb/testsuite/boards/dwarf5-fission-debug-types.exp
@@ -0,0 +1,33 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# A board that compiles with DWARF 5, split DWARF (fission) and type units.
+# This results in .dwo files containing one compilation unit and (possibly)
+# multiple type units each.
+
+# This is copied from baseboards/unix.exp.
+# At the moment this only supports things that unix.exp supports.
+load_generic_config "unix"
+process_multilib_options ""
+set_board_info compiler "[find_gcc]"
+
+set_board_info debug_flags \
+ [join { "-gdwarf-5" \
+ "-gsplit-dwarf" \
+ "-fdebug-types-section" }]
+
+# This is needed otherwise dejagnu tries to rsh to host with the board name
+# as its hostname.
+load_board_description "local-board"
diff --git a/gdb/testsuite/boards/dwarf64.exp b/gdb/testsuite/boards/dwarf64.exp
index 161d8cd..1c22cad 100644
--- a/gdb/testsuite/boards/dwarf64.exp
+++ b/gdb/testsuite/boards/dwarf64.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/fission-dwp.exp b/gdb/testsuite/boards/fission-dwp.exp
index c04e819..55de56d 100644
--- a/gdb/testsuite/boards/fission-dwp.exp
+++ b/gdb/testsuite/boards/fission-dwp.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/fission.exp b/gdb/testsuite/boards/fission.exp
index 496fece..bc0ead1 100644
--- a/gdb/testsuite/boards/fission.exp
+++ b/gdb/testsuite/boards/fission.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/gdbserver-base.exp b/gdb/testsuite/boards/gdbserver-base.exp
index 5e16791..717dff9 100644
--- a/gdb/testsuite/boards/gdbserver-base.exp
+++ b/gdb/testsuite/boards/gdbserver-base.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/gold-gdb-index.exp b/gdb/testsuite/boards/gold-gdb-index.exp
index 568a334..b91df71 100644
--- a/gdb/testsuite/boards/gold-gdb-index.exp
+++ b/gdb/testsuite/boards/gold-gdb-index.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/gold.exp b/gdb/testsuite/boards/gold.exp
index b1bcd2f..35dcbe0 100644
--- a/gdb/testsuite/boards/gold.exp
+++ b/gdb/testsuite/boards/gold.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/local-board.exp b/gdb/testsuite/boards/local-board.exp
index c659b80..1d9bb43 100644
--- a/gdb/testsuite/boards/local-board.exp
+++ b/gdb/testsuite/boards/local-board.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/local-remote-host-native.exp b/gdb/testsuite/boards/local-remote-host-native.exp
index 204f646..dd4a437 100644
--- a/gdb/testsuite/boards/local-remote-host-native.exp
+++ b/gdb/testsuite/boards/local-remote-host-native.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/local-remote-host-notty.exp b/gdb/testsuite/boards/local-remote-host-notty.exp
index e515d14..56e0ed3 100644
--- a/gdb/testsuite/boards/local-remote-host-notty.exp
+++ b/gdb/testsuite/boards/local-remote-host-notty.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/local-remote-host.exp b/gdb/testsuite/boards/local-remote-host.exp
index 64c1d83..c342b6f 100644
--- a/gdb/testsuite/boards/local-remote-host.exp
+++ b/gdb/testsuite/boards/local-remote-host.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/native-extended-gdbserver.exp b/gdb/testsuite/boards/native-extended-gdbserver.exp
index ef77acc..22d8782 100644
--- a/gdb/testsuite/boards/native-extended-gdbserver.exp
+++ b/gdb/testsuite/boards/native-extended-gdbserver.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@ proc mi_gdb_start { args } {
global gdbserver_reconnect_p
# Spawn GDB.
- set res [eval extended_gdbserver_mi_gdb_start $args]
+ set res [extended_gdbserver_mi_gdb_start {*}$args]
if { $res } {
return $res
}
diff --git a/gdb/testsuite/boards/native-gdbserver.exp b/gdb/testsuite/boards/native-gdbserver.exp
index 722e23b..a24d7ab 100644
--- a/gdb/testsuite/boards/native-gdbserver.exp
+++ b/gdb/testsuite/boards/native-gdbserver.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/native-stdio-gdbserver.exp b/gdb/testsuite/boards/native-stdio-gdbserver.exp
index 55010e2..b95eec6 100644
--- a/gdb/testsuite/boards/native-stdio-gdbserver.exp
+++ b/gdb/testsuite/boards/native-stdio-gdbserver.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/readnow.exp b/gdb/testsuite/boards/readnow.exp
index c3a28ff..744e929 100644
--- a/gdb/testsuite/boards/readnow.exp
+++ b/gdb/testsuite/boards/readnow.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp b/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp
index 3e223a0..93c584e 100644
--- a/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp
+++ b/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/remote-stdio-gdbserver.exp b/gdb/testsuite/boards/remote-stdio-gdbserver.exp
index 1cc435e..25faa04 100644
--- a/gdb/testsuite/boards/remote-stdio-gdbserver.exp
+++ b/gdb/testsuite/boards/remote-stdio-gdbserver.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/simavr.exp b/gdb/testsuite/boards/simavr.exp
index fb159a2..6e6e309 100644
--- a/gdb/testsuite/boards/simavr.exp
+++ b/gdb/testsuite/boards/simavr.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/stabs.exp b/gdb/testsuite/boards/stabs.exp
index 9cb4c5c..537fd01 100644
--- a/gdb/testsuite/boards/stabs.exp
+++ b/gdb/testsuite/boards/stabs.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/boards/stdio-gdbserver-base.exp b/gdb/testsuite/boards/stdio-gdbserver-base.exp
index 66c773a..509b77e 100644
--- a/gdb/testsuite/boards/stdio-gdbserver-base.exp
+++ b/gdb/testsuite/boards/stdio-gdbserver-base.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/cfdbug.exp b/gdb/testsuite/config/cfdbug.exp
index e6a73ed..71e27dc 100644
--- a/gdb/testsuite/config/cfdbug.exp
+++ b/gdb/testsuite/config/cfdbug.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/d10v.exp b/gdb/testsuite/config/d10v.exp
index aa0cfae..cb099ab 100644
--- a/gdb/testsuite/config/d10v.exp
+++ b/gdb/testsuite/config/d10v.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1997-2024 Free Software Foundation, Inc.
+# Copyright (C) 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/default.exp b/gdb/testsuite/config/default.exp
index 160be8f..751e412 100644
--- a/gdb/testsuite/config/default.exp
+++ b/gdb/testsuite/config/default.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2024 Free Software Foundation, Inc.
+# Copyright (C) 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/dve.exp b/gdb/testsuite/config/dve.exp
index 715751e..b08514b 100644
--- a/gdb/testsuite/config/dve.exp
+++ b/gdb/testsuite/config/dve.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/extended-gdbserver.exp b/gdb/testsuite/config/extended-gdbserver.exp
index d9f3148..00e6b55 100644
--- a/gdb/testsuite/config/extended-gdbserver.exp
+++ b/gdb/testsuite/config/extended-gdbserver.exp
@@ -1,4 +1,4 @@
-# Copyright 2000-2024 Free Software Foundation, Inc.
+# Copyright 2000-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/gdbserver.exp b/gdb/testsuite/config/gdbserver.exp
index cd9fe4c..40298d6 100644
--- a/gdb/testsuite/config/gdbserver.exp
+++ b/gdb/testsuite/config/gdbserver.exp
@@ -1,4 +1,4 @@
-# Copyright 2000-2024 Free Software Foundation, Inc.
+# Copyright 2000-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/i960.exp b/gdb/testsuite/config/i960.exp
index 64f7fcc..b30b7f7 100644
--- a/gdb/testsuite/config/i960.exp
+++ b/gdb/testsuite/config/i960.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/m32r.exp b/gdb/testsuite/config/m32r.exp
index 1004644..2ea691b 100644
--- a/gdb/testsuite/config/m32r.exp
+++ b/gdb/testsuite/config/m32r.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/mips-idt.exp b/gdb/testsuite/config/mips-idt.exp
index 6883ab8..d053ca8 100644
--- a/gdb/testsuite/config/mips-idt.exp
+++ b/gdb/testsuite/config/mips-idt.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1993-2024 Free Software Foundation, Inc.
+# Copyright (C) 1993-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/mips.exp b/gdb/testsuite/config/mips.exp
index 6883ab8..d053ca8 100644
--- a/gdb/testsuite/config/mips.exp
+++ b/gdb/testsuite/config/mips.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1993-2024 Free Software Foundation, Inc.
+# Copyright (C) 1993-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/mn10300-eval.exp b/gdb/testsuite/config/mn10300-eval.exp
index 715751e..b08514b 100644
--- a/gdb/testsuite/config/mn10300-eval.exp
+++ b/gdb/testsuite/config/mn10300-eval.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/monitor.exp b/gdb/testsuite/config/monitor.exp
index d5a589e..7634510 100644
--- a/gdb/testsuite/config/monitor.exp
+++ b/gdb/testsuite/config/monitor.exp
@@ -1,5 +1,5 @@
# Test Framework Driver for GDB driving a ROM monitor (via monitor.c).
-# Copyright 1995-2024 Free Software Foundation, Inc.
+# Copyright 1995-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/proelf.exp b/gdb/testsuite/config/proelf.exp
index 64f7fcc..b30b7f7 100644
--- a/gdb/testsuite/config/proelf.exp
+++ b/gdb/testsuite/config/proelf.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/rom68k.exp b/gdb/testsuite/config/rom68k.exp
index 64f7fcc..b30b7f7 100644
--- a/gdb/testsuite/config/rom68k.exp
+++ b/gdb/testsuite/config/rom68k.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/sh.exp b/gdb/testsuite/config/sh.exp
index 64f7fcc..b30b7f7 100644
--- a/gdb/testsuite/config/sh.exp
+++ b/gdb/testsuite/config/sh.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/sid.exp b/gdb/testsuite/config/sid.exp
index c0fb962..f4a58b9 100644
--- a/gdb/testsuite/config/sid.exp
+++ b/gdb/testsuite/config/sid.exp
@@ -1,5 +1,5 @@
# Test Framework Driver for GDB driving an external simulator
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/sim.exp b/gdb/testsuite/config/sim.exp
index da2780e..b12d7ce 100644
--- a/gdb/testsuite/config/sim.exp
+++ b/gdb/testsuite/config/sim.exp
@@ -1,5 +1,5 @@
# Test Framework Driver for GDB driving a builtin simulator
-# Copyright 1994-2024 Free Software Foundation, Inc.
+# Copyright 1994-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/slite.exp b/gdb/testsuite/config/slite.exp
index d472a63..d4ae98d 100644
--- a/gdb/testsuite/config/slite.exp
+++ b/gdb/testsuite/config/slite.exp
@@ -1,4 +1,4 @@
-# Copyright 1993-2024 Free Software Foundation, Inc.
+# Copyright 1993-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/unix.exp b/gdb/testsuite/config/unix.exp
index 30a9699..5199940 100644
--- a/gdb/testsuite/config/unix.exp
+++ b/gdb/testsuite/config/unix.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1988-2024 Free Software Foundation, Inc.
+# Copyright (C) 1988-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/vr4300.exp b/gdb/testsuite/config/vr4300.exp
index 64f7fcc..b30b7f7 100644
--- a/gdb/testsuite/config/vr4300.exp
+++ b/gdb/testsuite/config/vr4300.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/config/vr5000.exp b/gdb/testsuite/config/vr5000.exp
index 64f7fcc..b30b7f7 100644
--- a/gdb/testsuite/config/vr5000.exp
+++ b/gdb/testsuite/config/vr5000.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/configure.ac b/gdb/testsuite/configure.ac
index 8c0b605..560d7d9 100644
--- a/gdb/testsuite/configure.ac
+++ b/gdb/testsuite/configure.ac
@@ -1,7 +1,7 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/O2_float_param.exp b/gdb/testsuite/gdb.ada/O2_float_param.exp
index 86b67ff..f664c78 100644
--- a/gdb/testsuite/gdb.ada/O2_float_param.exp
+++ b/gdb/testsuite/gdb.ada/O2_float_param.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug optimize=-O2
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/O2_float_param/callee.adb b/gdb/testsuite/gdb.ada/O2_float_param/callee.adb
index aa07b84..595adf4 100644
--- a/gdb/testsuite/gdb.ada/O2_float_param/callee.adb
+++ b/gdb/testsuite/gdb.ada/O2_float_param/callee.adb
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/O2_float_param/callee.ads b/gdb/testsuite/gdb.ada/O2_float_param/callee.ads
index ef81bbc..2440881 100644
--- a/gdb/testsuite/gdb.ada/O2_float_param/callee.ads
+++ b/gdb/testsuite/gdb.ada/O2_float_param/callee.ads
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/O2_float_param/caller.adb b/gdb/testsuite/gdb.ada/O2_float_param/caller.adb
index 0e7bf77..8736917 100644
--- a/gdb/testsuite/gdb.ada/O2_float_param/caller.adb
+++ b/gdb/testsuite/gdb.ada/O2_float_param/caller.adb
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/O2_float_param/caller.ads b/gdb/testsuite/gdb.ada/O2_float_param/caller.ads
index 681b731..fe3ec2e 100644
--- a/gdb/testsuite/gdb.ada/O2_float_param/caller.ads
+++ b/gdb/testsuite/gdb.ada/O2_float_param/caller.ads
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/O2_float_param/foo.adb b/gdb/testsuite/gdb.ada/O2_float_param/foo.adb
index 67cf870..5f97a93 100644
--- a/gdb/testsuite/gdb.ada/O2_float_param/foo.adb
+++ b/gdb/testsuite/gdb.ada/O2_float_param/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/O2_float_param/io.adb b/gdb/testsuite/gdb.ada/O2_float_param/io.adb
index 90b9381..84ece0a 100644
--- a/gdb/testsuite/gdb.ada/O2_float_param/io.adb
+++ b/gdb/testsuite/gdb.ada/O2_float_param/io.adb
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/O2_float_param/io.ads b/gdb/testsuite/gdb.ada/O2_float_param/io.ads
index 319d973..0d553f6 100644
--- a/gdb/testsuite/gdb.ada/O2_float_param/io.ads
+++ b/gdb/testsuite/gdb.ada/O2_float_param/io.ads
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/access_tagged_param.exp b/gdb/testsuite/gdb.ada/access_tagged_param.exp
index f197b0c..12a3512 100644
--- a/gdb/testsuite/gdb.ada/access_tagged_param.exp
+++ b/gdb/testsuite/gdb.ada/access_tagged_param.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/access_tagged_param/foo.adb b/gdb/testsuite/gdb.ada/access_tagged_param/foo.adb
index 112dea0..8bf1e74 100644
--- a/gdb/testsuite/gdb.ada/access_tagged_param/foo.adb
+++ b/gdb/testsuite/gdb.ada/access_tagged_param/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/access_tagged_param/pck.adb b/gdb/testsuite/gdb.ada/access_tagged_param/pck.adb
index b0d1a66..840d5fa 100644
--- a/gdb/testsuite/gdb.ada/access_tagged_param/pck.adb
+++ b/gdb/testsuite/gdb.ada/access_tagged_param/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/access_tagged_param/pck.ads b/gdb/testsuite/gdb.ada/access_tagged_param/pck.ads
index 7731fe2..fdca197 100644
--- a/gdb/testsuite/gdb.ada/access_tagged_param/pck.ads
+++ b/gdb/testsuite/gdb.ada/access_tagged_param/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/access_to_packed_array.exp b/gdb/testsuite/gdb.ada/access_to_packed_array.exp
index 65b5df3..bf75090 100644
--- a/gdb/testsuite/gdb.ada/access_to_packed_array.exp
+++ b/gdb/testsuite/gdb.ada/access_to_packed_array.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/access_to_packed_array/foo.adb b/gdb/testsuite/gdb.ada/access_to_packed_array/foo.adb
index a97f85d..c70e513 100644
--- a/gdb/testsuite/gdb.ada/access_to_packed_array/foo.adb
+++ b/gdb/testsuite/gdb.ada/access_to_packed_array/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/access_to_packed_array/pack.adb b/gdb/testsuite/gdb.ada/access_to_packed_array/pack.adb
index 3709e4a..044946a 100644
--- a/gdb/testsuite/gdb.ada/access_to_packed_array/pack.adb
+++ b/gdb/testsuite/gdb.ada/access_to_packed_array/pack.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/access_to_packed_array/pack.ads b/gdb/testsuite/gdb.ada/access_to_packed_array/pack.ads
index 7b33559..dc10ad1 100644
--- a/gdb/testsuite/gdb.ada/access_to_packed_array/pack.ads
+++ b/gdb/testsuite/gdb.ada/access_to_packed_array/pack.ads
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp b/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp
index fa807c5..13e5a02 100644
--- a/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp
+++ b/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/access_to_unbounded_array/foo.adb b/gdb/testsuite/gdb.ada/access_to_unbounded_array/foo.adb
index 85a7c18..df3e91b 100644
--- a/gdb/testsuite/gdb.ada/access_to_unbounded_array/foo.adb
+++ b/gdb/testsuite/gdb.ada/access_to_unbounded_array/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/access_to_unbounded_array/pack.adb b/gdb/testsuite/gdb.ada/access_to_unbounded_array/pack.adb
index d79bc9d..ce44765 100644
--- a/gdb/testsuite/gdb.ada/access_to_unbounded_array/pack.adb
+++ b/gdb/testsuite/gdb.ada/access_to_unbounded_array/pack.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/access_to_unbounded_array/pack.ads b/gdb/testsuite/gdb.ada/access_to_unbounded_array/pack.ads
index 2c20cb9..e0dbb03 100644
--- a/gdb/testsuite/gdb.ada/access_to_unbounded_array/pack.ads
+++ b/gdb/testsuite/gdb.ada/access_to_unbounded_array/pack.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/addr_arith.exp b/gdb/testsuite/gdb.ada/addr_arith.exp
index 1389454..15c57e5 100644
--- a/gdb/testsuite/gdb.ada/addr_arith.exp
+++ b/gdb/testsuite/gdb.ada/addr_arith.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo_na07_019
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/addr_arith/foo_na07_019.adb b/gdb/testsuite/gdb.ada/addr_arith/foo_na07_019.adb
index 847ca66..40ae890 100644
--- a/gdb/testsuite/gdb.ada/addr_arith/foo_na07_019.adb
+++ b/gdb/testsuite/gdb.ada/addr_arith/foo_na07_019.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/addr_arith/pck.adb b/gdb/testsuite/gdb.ada/addr_arith/pck.adb
index 065383d..530aea7 100644
--- a/gdb/testsuite/gdb.ada/addr_arith/pck.adb
+++ b/gdb/testsuite/gdb.ada/addr_arith/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/addr_arith/pck.ads b/gdb/testsuite/gdb.ada/addr_arith/pck.ads
index 9f666a7..1f9b51d 100644
--- a/gdb/testsuite/gdb.ada/addr_arith/pck.ads
+++ b/gdb/testsuite/gdb.ada/addr_arith/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/aliased_array.exp b/gdb/testsuite/gdb.ada/aliased_array.exp
index 35ac81e..2110cf1 100644
--- a/gdb/testsuite/gdb.ada/aliased_array.exp
+++ b/gdb/testsuite/gdb.ada/aliased_array.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/aliased_array/foo.adb b/gdb/testsuite/gdb.ada/aliased_array/foo.adb
index 648793c..b859ddb 100644
--- a/gdb/testsuite/gdb.ada/aliased_array/foo.adb
+++ b/gdb/testsuite/gdb.ada/aliased_array/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/aliased_array/pck.adb b/gdb/testsuite/gdb.ada/aliased_array/pck.adb
index 9320cf9..459baf4 100644
--- a/gdb/testsuite/gdb.ada/aliased_array/pck.adb
+++ b/gdb/testsuite/gdb.ada/aliased_array/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/aliased_array/pck.ads b/gdb/testsuite/gdb.ada/aliased_array/pck.ads
index 51a9ed4..63817a6 100644
--- a/gdb/testsuite/gdb.ada/aliased_array/pck.ads
+++ b/gdb/testsuite/gdb.ada/aliased_array/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp b/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp
index 4ecb4f8..bb2b1f0 100644
--- a/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp
+++ b/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" \
executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap.adb b/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap.adb
index 7f9b68e..1837b53 100644
--- a/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap.adb
+++ b/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap.ads b/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap.ads
index ba8d952..b449952 100644
--- a/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap.ads
+++ b/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap_main.adb b/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap_main.adb
index a4e1827..7286409 100644
--- a/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap_main.adb
+++ b/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap_main.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/arr_arr.exp b/gdb/testsuite/gdb.ada/arr_arr.exp
index 146e6da..a41d1d4 100644
--- a/gdb/testsuite/gdb.ada/arr_arr.exp
+++ b/gdb/testsuite/gdb.ada/arr_arr.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/arr_arr/foo.adb b/gdb/testsuite/gdb.ada/arr_arr/foo.adb
index 6f944a7..67f09ae 100644
--- a/gdb/testsuite/gdb.ada/arr_arr/foo.adb
+++ b/gdb/testsuite/gdb.ada/arr_arr/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/arr_arr/pck.adb b/gdb/testsuite/gdb.ada/arr_arr/pck.adb
index a175b7b..d29c5da 100644
--- a/gdb/testsuite/gdb.ada/arr_arr/pck.adb
+++ b/gdb/testsuite/gdb.ada/arr_arr/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/arr_arr/pck.ads b/gdb/testsuite/gdb.ada/arr_arr/pck.ads
index 384bf08..02fc1c8 100644
--- a/gdb/testsuite/gdb.ada/arr_arr/pck.ads
+++ b/gdb/testsuite/gdb.ada/arr_arr/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/arr_enum_idx_w_gap.exp b/gdb/testsuite/gdb.ada/arr_enum_idx_w_gap.exp
index 491402b..f90bcf4 100644
--- a/gdb/testsuite/gdb.ada/arr_enum_idx_w_gap.exp
+++ b/gdb/testsuite/gdb.ada/arr_enum_idx_w_gap.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/arr_enum_idx_w_gap/foo_q418_043.adb b/gdb/testsuite/gdb.ada/arr_enum_idx_w_gap/foo_q418_043.adb
index 363e514..d240e48 100644
--- a/gdb/testsuite/gdb.ada/arr_enum_idx_w_gap/foo_q418_043.adb
+++ b/gdb/testsuite/gdb.ada/arr_enum_idx_w_gap/foo_q418_043.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_bounds.exp b/gdb/testsuite/gdb.ada/array_bounds.exp
index 9622327..3b84db5 100644
--- a/gdb/testsuite/gdb.ada/array_bounds.exp
+++ b/gdb/testsuite/gdb.ada/array_bounds.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile bar
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
@@ -28,7 +28,7 @@ clean_restart ${testfile}
set bp_location [gdb_get_line_number "START" ${testdir}/bar.adb]
if {![runto "bar.adb:$bp_location"]} {
return
-}
+}
gdb_test "print itable'first" \
"= 2"
diff --git a/gdb/testsuite/gdb.ada/array_bounds/bar.adb b/gdb/testsuite/gdb.ada/array_bounds/bar.adb
index 9d10c2b..0d2a81f 100644
--- a/gdb/testsuite/gdb.ada/array_bounds/bar.adb
+++ b/gdb/testsuite/gdb.ada/array_bounds/bar.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_char_idx.exp b/gdb/testsuite/gdb.ada/array_char_idx.exp
index 40d91d5..f0919b0 100644
--- a/gdb/testsuite/gdb.ada/array_char_idx.exp
+++ b/gdb/testsuite/gdb.ada/array_char_idx.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/array_char_idx/foo.adb b/gdb/testsuite/gdb.ada/array_char_idx/foo.adb
index a4c10d5..16d1ce4 100644
--- a/gdb/testsuite/gdb.ada/array_char_idx/foo.adb
+++ b/gdb/testsuite/gdb.ada/array_char_idx/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_char_idx/pck.adb b/gdb/testsuite/gdb.ada/array_char_idx/pck.adb
index a64c5e9..54ddf5c 100644
--- a/gdb/testsuite/gdb.ada/array_char_idx/pck.adb
+++ b/gdb/testsuite/gdb.ada/array_char_idx/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_char_idx/pck.ads b/gdb/testsuite/gdb.ada/array_char_idx/pck.ads
index 87fe6ec..5c3cdaf 100644
--- a/gdb/testsuite/gdb.ada/array_char_idx/pck.ads
+++ b/gdb/testsuite/gdb.ada/array_char_idx/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_long_idx.exp b/gdb/testsuite/gdb.ada/array_long_idx.exp
new file mode 100644
index 0000000..13a4d3d
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/array_long_idx.exp
@@ -0,0 +1,36 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test that long array index types work.
+
+load_lib "ada.exp"
+
+require allow_ada_tests
+
+standard_ada_testfile main
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
+ return
+}
+
+clean_restart ${testfile}
+
+set bp_location [gdb_get_line_number STOP ${testdir}/main.adb]
+if {![runto "main.adb:$bp_location"]} {
+ return
+}
+
+gdb_test "print some_regular_access.all" \
+ [string_to_regexp " = (-2147483648 => (-9223372036854775808 => 1, 2, 3), (-9223372036854775808 => 4, 5, 6))"]
diff --git a/gdb/testsuite/gdb.ada/array_long_idx/main.adb b/gdb/testsuite/gdb.ada/array_long_idx/main.adb
new file mode 100644
index 0000000..6c4971f
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/array_long_idx/main.adb
@@ -0,0 +1,31 @@
+-- Copyright 2025 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+with Pck; use Pck;
+
+procedure Main is
+
+ type Shorter_Integer is range -2147483648 .. 2147483647;
+ type Longer_Integer is range -9223372036854775808 .. 9223372036854775807;
+ type My_Array is array (Shorter_Integer range <>,
+ Longer_Integer range <>) of Integer;
+
+ type My_Reg_Acc is access all My_Array;
+
+ Some_Regular_Access : My_Reg_Acc := new My_Array'((1, 2, 3), (4, 5, 6));
+
+begin
+ Do_Nothing (Some_Regular_Access'Address); -- STOP
+end Main;
diff --git a/gdb/testsuite/gdb.ada/array_long_idx/pck.adb b/gdb/testsuite/gdb.ada/array_long_idx/pck.adb
new file mode 100644
index 0000000..54ddf5c
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/array_long_idx/pck.adb
@@ -0,0 +1,21 @@
+-- Copyright 2012-2025 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package body Pck is
+ procedure Do_Nothing (A : System.Address) is
+ begin
+ null;
+ end Do_Nothing;
+end Pck;
diff --git a/gdb/testsuite/gdb.ada/array_long_idx/pck.ads b/gdb/testsuite/gdb.ada/array_long_idx/pck.ads
new file mode 100644
index 0000000..db7c0a8
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/array_long_idx/pck.ads
@@ -0,0 +1,19 @@
+-- Copyright 2012-2025 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+with System;
+package Pck is
+ procedure Do_Nothing (A : System.Address);
+end Pck;
diff --git a/gdb/testsuite/gdb.ada/array_of_symbolic_length.exp b/gdb/testsuite/gdb.ada/array_of_symbolic_length.exp
index 134b448..8e6c32e 100644
--- a/gdb/testsuite/gdb.ada/array_of_symbolic_length.exp
+++ b/gdb/testsuite/gdb.ada/array_of_symbolic_length.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/array_of_symbolic_length/foo.adb b/gdb/testsuite/gdb.ada/array_of_symbolic_length/foo.adb
index 7eb7c82..1f91f08 100644
--- a/gdb/testsuite/gdb.ada/array_of_symbolic_length/foo.adb
+++ b/gdb/testsuite/gdb.ada/array_of_symbolic_length/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_of_symbolic_length/gl.adb b/gdb/testsuite/gdb.ada/array_of_symbolic_length/gl.adb
index 3bae49f..02630c4 100644
--- a/gdb/testsuite/gdb.ada/array_of_symbolic_length/gl.adb
+++ b/gdb/testsuite/gdb.ada/array_of_symbolic_length/gl.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_of_symbolic_length/gl.ads b/gdb/testsuite/gdb.ada/array_of_symbolic_length/gl.ads
index f014dbd..9f72e3e 100644
--- a/gdb/testsuite/gdb.ada/array_of_symbolic_length/gl.ads
+++ b/gdb/testsuite/gdb.ada/array_of_symbolic_length/gl.ads
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_of_symbolic_length/pck.adb b/gdb/testsuite/gdb.ada/array_of_symbolic_length/pck.adb
index 988c2ae..a38bb00 100644
--- a/gdb/testsuite/gdb.ada/array_of_symbolic_length/pck.adb
+++ b/gdb/testsuite/gdb.ada/array_of_symbolic_length/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_of_symbolic_length/pck.ads b/gdb/testsuite/gdb.ada/array_of_symbolic_length/pck.ads
index cca17df..bafc561 100644
--- a/gdb/testsuite/gdb.ada/array_of_symbolic_length/pck.ads
+++ b/gdb/testsuite/gdb.ada/array_of_symbolic_length/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_of_variable_length.exp b/gdb/testsuite/gdb.ada/array_of_variable_length.exp
index 3c68c80..62cbefe 100644
--- a/gdb/testsuite/gdb.ada/array_of_variable_length.exp
+++ b/gdb/testsuite/gdb.ada/array_of_variable_length.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/array_of_variable_length/foo.adb b/gdb/testsuite/gdb.ada/array_of_variable_length/foo.adb
index 76ff073..51c88ed 100644
--- a/gdb/testsuite/gdb.ada/array_of_variable_length/foo.adb
+++ b/gdb/testsuite/gdb.ada/array_of_variable_length/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_of_variable_length/pck.adb b/gdb/testsuite/gdb.ada/array_of_variable_length/pck.adb
index 45c89c6..8ceb14f 100644
--- a/gdb/testsuite/gdb.ada/array_of_variable_length/pck.adb
+++ b/gdb/testsuite/gdb.ada/array_of_variable_length/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_of_variable_length/pck.ads b/gdb/testsuite/gdb.ada/array_of_variable_length/pck.ads
index f610821..681f712 100644
--- a/gdb/testsuite/gdb.ada/array_of_variable_length/pck.ads
+++ b/gdb/testsuite/gdb.ada/array_of_variable_length/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_of_variant.exp b/gdb/testsuite/gdb.ada/array_of_variant.exp
index 8b83f4e..5b95647 100644
--- a/gdb/testsuite/gdb.ada/array_of_variant.exp
+++ b/gdb/testsuite/gdb.ada/array_of_variant.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,11 +20,11 @@ require allow_ada_tests
standard_ada_testfile p
-set old_gcc [gnat_version_compare <= 7]
+set old_gcc [gnat_version_compare < 8]
proc gdb_test_with_xfail { cmd re re_xfail msg } {
global scenario old_gcc
- set have_xfail [expr $old_gcc && [string equal "$scenario" "minimal"]]
+ set have_xfail [expr {$old_gcc && [string equal "$scenario" "minimal"]}]
gdb_test_multiple $cmd $msg {
-re -wrap $re {
@@ -44,7 +44,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/array_of_variant/p.adb b/gdb/testsuite/gdb.ada/array_of_variant/p.adb
index 2a7c3a8..7aecd4c 100644
--- a/gdb/testsuite/gdb.ada/array_of_variant/p.adb
+++ b/gdb/testsuite/gdb.ada/array_of_variant/p.adb
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_of_variant/pck.adb b/gdb/testsuite/gdb.ada/array_of_variant/pck.adb
index fc4840e..95bd90a 100644
--- a/gdb/testsuite/gdb.ada/array_of_variant/pck.adb
+++ b/gdb/testsuite/gdb.ada/array_of_variant/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_of_variant/pck.ads b/gdb/testsuite/gdb.ada/array_of_variant/pck.ads
index 29ab6d6..66e61b5 100644
--- a/gdb/testsuite/gdb.ada/array_of_variant/pck.ads
+++ b/gdb/testsuite/gdb.ada/array_of_variant/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_ptr_renaming.exp b/gdb/testsuite/gdb.ada/array_ptr_renaming.exp
index eadfcb6..42935d2 100644
--- a/gdb/testsuite/gdb.ada/array_ptr_renaming.exp
+++ b/gdb/testsuite/gdb.ada/array_ptr_renaming.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/array_ptr_renaming/foo.adb b/gdb/testsuite/gdb.ada/array_ptr_renaming/foo.adb
index 1ce2772..7639e22 100644
--- a/gdb/testsuite/gdb.ada/array_ptr_renaming/foo.adb
+++ b/gdb/testsuite/gdb.ada/array_ptr_renaming/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_ptr_renaming/pack.ads b/gdb/testsuite/gdb.ada/array_ptr_renaming/pack.ads
index a38878c..07ad545 100644
--- a/gdb/testsuite/gdb.ada/array_ptr_renaming/pack.ads
+++ b/gdb/testsuite/gdb.ada/array_ptr_renaming/pack.ads
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_return.exp b/gdb/testsuite/gdb.ada/array_return.exp
index fa5dc9c..21a75d8 100644
--- a/gdb/testsuite/gdb.ada/array_return.exp
+++ b/gdb/testsuite/gdb.ada/array_return.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [ada_fvar_tracking] } {
}
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $opts] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
@@ -34,7 +34,7 @@ clean_restart ${testfile}
# Start the inferior
if {![runto_main]} {
- return 0
+ return
}
# Create a breakpoint in each function from which we want to test
diff --git a/gdb/testsuite/gdb.ada/array_return/p.adb b/gdb/testsuite/gdb.ada/array_return/p.adb
index 4b7a55c..20b5d8c 100644
--- a/gdb/testsuite/gdb.ada/array_return/p.adb
+++ b/gdb/testsuite/gdb.ada/array_return/p.adb
@@ -1,4 +1,4 @@
--- Copyright 2006-2024 Free Software Foundation, Inc.
+-- Copyright 2006-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_return/pck.adb b/gdb/testsuite/gdb.ada/array_return/pck.adb
index c231770..db1d489 100644
--- a/gdb/testsuite/gdb.ada/array_return/pck.adb
+++ b/gdb/testsuite/gdb.ada/array_return/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2006-2024 Free Software Foundation, Inc.
+-- Copyright 2006-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_return/pck.ads b/gdb/testsuite/gdb.ada/array_return/pck.ads
index c16a6d7..45284aa 100644
--- a/gdb/testsuite/gdb.ada/array_return/pck.ads
+++ b/gdb/testsuite/gdb.ada/array_return/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2006-2024 Free Software Foundation, Inc.
+-- Copyright 2006-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/array_subscript_addr.exp b/gdb/testsuite/gdb.ada/array_subscript_addr.exp
index be6cc00..c679a70 100644
--- a/gdb/testsuite/gdb.ada/array_subscript_addr.exp
+++ b/gdb/testsuite/gdb.ada/array_subscript_addr.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile p
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/array_subscript_addr/p.adb b/gdb/testsuite/gdb.ada/array_subscript_addr/p.adb
index 5bdee8d..057d7a0 100644
--- a/gdb/testsuite/gdb.ada/array_subscript_addr/p.adb
+++ b/gdb/testsuite/gdb.ada/array_subscript_addr/p.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@@ -14,11 +14,12 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
procedure P is
- type Table is array (1 .. 3) of Integer;
+ -- Make this large enough to force it into memory with gnat-llvm.
+ type Table is array (1 .. 15) of Integer;
function Create (I : Integer) return Table is
begin
- return (4 + I, 8 * I, 7 * I + 4);
+ return (4 + I, 8 * I, 7 * I + 4, others => 72);
end Create;
A : Table := Create (7);
diff --git a/gdb/testsuite/gdb.ada/arraydim.exp b/gdb/testsuite/gdb.ada/arraydim.exp
index 02339f2..a732751 100644
--- a/gdb/testsuite/gdb.ada/arraydim.exp
+++ b/gdb/testsuite/gdb.ada/arraydim.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ set cobject [standard_output_file ${cfile}.o]
gdb_compile "${csrcfile}" "${cobject}" object [list debug]
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-largs additional_flags=${cobject} additional_flags=-margs]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/arraydim/foo.adb b/gdb/testsuite/gdb.ada/arraydim/foo.adb
index 5338261..c0609fe 100644
--- a/gdb/testsuite/gdb.ada/arraydim/foo.adb
+++ b/gdb/testsuite/gdb.ada/arraydim/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/arraydim/inc.c b/gdb/testsuite/gdb.ada/arraydim/inc.c
index a6b8926..498b891 100644
--- a/gdb/testsuite/gdb.ada/arraydim/inc.c
+++ b/gdb/testsuite/gdb.ada/arraydim/inc.c
@@ -1,4 +1,4 @@
-/* Copyright 2013-2024 Free Software Foundation, Inc.
+/* Copyright 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.ada/arraydim/pck.adb b/gdb/testsuite/gdb.ada/arraydim/pck.adb
index 6e8bda9..d05dba8 100644
--- a/gdb/testsuite/gdb.ada/arraydim/pck.adb
+++ b/gdb/testsuite/gdb.ada/arraydim/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/arraydim/pck.ads b/gdb/testsuite/gdb.ada/arraydim/pck.ads
index c127246..cfa98d4 100644
--- a/gdb/testsuite/gdb.ada/arraydim/pck.ads
+++ b/gdb/testsuite/gdb.ada/arraydim/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/arrayidx.exp b/gdb/testsuite/gdb.ada/arrayidx.exp
index bc76cd3..6a7188a9 100644
--- a/gdb/testsuite/gdb.ada/arrayidx.exp
+++ b/gdb/testsuite/gdb.ada/arrayidx.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile p
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
set old_gcc [gnat_version_compare <= {4 6}]
@@ -34,7 +34,7 @@ runto "p.adb:$bp_location"
gdb_test_no_output "set print array-indexes off"
-if $old_gcc {
+if {$old_gcc} {
setup_xfail "*-*-*"
}
gdb_test "print one_two_three" \
@@ -57,21 +57,21 @@ gdb_test "print p_one_two_three" \
"= \\(false, true, true\\)" \
"print p_one_two_three, indexes off"
-if $old_gcc {
+if {$old_gcc} {
setup_xfail "*-*-*"
}
gdb_test "print few_reps" \
"= \\(1, 2, 3, 3, 3, 3, 3, 4, 5\\)" \
"print few_reps, indexes off"
-if $old_gcc {
+if {$old_gcc} {
setup_xfail "*-*-*"
}
gdb_test "print many_reps" \
"= \\(1, 2, 3 <repeats 12 times>, 4, 5\\)" \
"print many_reps, indexes off"
-if $old_gcc {
+if {$old_gcc} {
setup_xfail "*-*-*"
}
gdb_test "print empty" \
@@ -82,7 +82,7 @@ gdb_test "print empty" \
gdb_test_no_output "set print array-indexes on"
-if $old_gcc {
+if {$old_gcc} {
setup_xfail "*-*-*"
}
gdb_test "print one_two_three" \
@@ -100,19 +100,19 @@ gdb_test "print u_one_two_three" \
gdb_test "print p_one_two_three" \
"= \\(one => false, two => true, three => true\\)"
-if $old_gcc {
+if {$old_gcc} {
setup_xfail "*-*-*"
}
gdb_test "print few_reps" \
"= \\(1 => 1, 2 => 2, 3 => 3, 4 => 3, 5 => 3, 6 => 3, 7 => 3, 8 => 4, 9 => 5\\)"
-if $old_gcc {
+if {$old_gcc} {
setup_xfail "*-*-*"
}
gdb_test "print many_reps" \
"= \\(1 => 1, 2 => 2, 3 => 3 <repeats 12 times>, 15 => 4, 16 => 5\\)"
-if $old_gcc {
+if {$old_gcc} {
setup_xfail "*-*-*"
}
gdb_test "print empty" \
diff --git a/gdb/testsuite/gdb.ada/arrayidx/p.adb b/gdb/testsuite/gdb.ada/arrayidx/p.adb
index 65fd9f9..aed36c9 100644
--- a/gdb/testsuite/gdb.ada/arrayidx/p.adb
+++ b/gdb/testsuite/gdb.ada/arrayidx/p.adb
@@ -1,4 +1,4 @@
--- Copyright 2005-2024 Free Software Foundation, Inc.
+-- Copyright 2005-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/arrayparam.exp b/gdb/testsuite/gdb.ada/arrayparam.exp
index ef00037..3e2d3b6 100644
--- a/gdb/testsuite/gdb.ada/arrayparam.exp
+++ b/gdb/testsuite/gdb.ada/arrayparam.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/arrayparam/foo.adb b/gdb/testsuite/gdb.ada/arrayparam/foo.adb
index b69aad2..bdd2499 100644
--- a/gdb/testsuite/gdb.ada/arrayparam/foo.adb
+++ b/gdb/testsuite/gdb.ada/arrayparam/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/arrayparam/pck.adb b/gdb/testsuite/gdb.ada/arrayparam/pck.adb
index dbb37aa..794ac34 100644
--- a/gdb/testsuite/gdb.ada/arrayparam/pck.adb
+++ b/gdb/testsuite/gdb.ada/arrayparam/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/arrayparam/pck.ads b/gdb/testsuite/gdb.ada/arrayparam/pck.ads
index 64e63b9..af5c839 100644
--- a/gdb/testsuite/gdb.ada/arrayparam/pck.ads
+++ b/gdb/testsuite/gdb.ada/arrayparam/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/arrayptr.exp b/gdb/testsuite/gdb.ada/arrayptr.exp
index 7998a61..eecc9ae 100644
--- a/gdb/testsuite/gdb.ada/arrayptr.exp
+++ b/gdb/testsuite/gdb.ada/arrayptr.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/arrayptr/foo.adb b/gdb/testsuite/gdb.ada/arrayptr/foo.adb
index 0dbc712..6959059 100644
--- a/gdb/testsuite/gdb.ada/arrayptr/foo.adb
+++ b/gdb/testsuite/gdb.ada/arrayptr/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/arrayptr/pck.adb b/gdb/testsuite/gdb.ada/arrayptr/pck.adb
index 3425f21..4c32dd5 100644
--- a/gdb/testsuite/gdb.ada/arrayptr/pck.adb
+++ b/gdb/testsuite/gdb.ada/arrayptr/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/arrayptr/pck.ads b/gdb/testsuite/gdb.ada/arrayptr/pck.ads
index a1523f1..58305f0 100644
--- a/gdb/testsuite/gdb.ada/arrayptr/pck.ads
+++ b/gdb/testsuite/gdb.ada/arrayptr/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/assign_1.exp b/gdb/testsuite/gdb.ada/assign_1.exp
index 839af8f..622fa96 100644
--- a/gdb/testsuite/gdb.ada/assign_1.exp
+++ b/gdb/testsuite/gdb.ada/assign_1.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/assign_arr.exp b/gdb/testsuite/gdb.ada/assign_arr.exp
index ec0227f..b489718 100644
--- a/gdb/testsuite/gdb.ada/assign_arr.exp
+++ b/gdb/testsuite/gdb.ada/assign_arr.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile main_p324_051
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/assign_arr/main_p324_051.adb b/gdb/testsuite/gdb.ada/assign_arr/main_p324_051.adb
index 641a628..c3737b1 100644
--- a/gdb/testsuite/gdb.ada/assign_arr/main_p324_051.adb
+++ b/gdb/testsuite/gdb.ada/assign_arr/main_p324_051.adb
@@ -1,4 +1,4 @@
--- Copyright 2016-2024 Free Software Foundation, Inc.
+-- Copyright 2016-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/assign_arr/target_wrapper.adb b/gdb/testsuite/gdb.ada/assign_arr/target_wrapper.adb
index 092ff88..8d030d9 100644
--- a/gdb/testsuite/gdb.ada/assign_arr/target_wrapper.adb
+++ b/gdb/testsuite/gdb.ada/assign_arr/target_wrapper.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/assign_arr/target_wrapper.ads b/gdb/testsuite/gdb.ada/assign_arr/target_wrapper.ads
index 71dbf9a..3c925e6 100644
--- a/gdb/testsuite/gdb.ada/assign_arr/target_wrapper.ads
+++ b/gdb/testsuite/gdb.ada/assign_arr/target_wrapper.ads
@@ -1,4 +1,4 @@
--- Copyright 2016-2024 Free Software Foundation, Inc.
+-- Copyright 2016-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/assoc.exp b/gdb/testsuite/gdb.ada/assoc.exp
index 03f25c6..b2a464e 100644
--- a/gdb/testsuite/gdb.ada/assoc.exp
+++ b/gdb/testsuite/gdb.ada/assoc.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile main
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/assoc/main.adb b/gdb/testsuite/gdb.ada/assoc/main.adb
index 2e05b2a..f8779e6 100644
--- a/gdb/testsuite/gdb.ada/assoc/main.adb
+++ b/gdb/testsuite/gdb.ada/assoc/main.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/assoc/pck.ads b/gdb/testsuite/gdb.ada/assoc/pck.ads
index 395705b..e8579d6 100644
--- a/gdb/testsuite/gdb.ada/assoc/pck.ads
+++ b/gdb/testsuite/gdb.ada/assoc/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/assoc/xtra.adb b/gdb/testsuite/gdb.ada/assoc/xtra.adb
index a72d76f..29309de 100644
--- a/gdb/testsuite/gdb.ada/assoc/xtra.adb
+++ b/gdb/testsuite/gdb.ada/assoc/xtra.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/assoc/xtra.ads b/gdb/testsuite/gdb.ada/assoc/xtra.ads
index 94b39ab..2858e20 100644
--- a/gdb/testsuite/gdb.ada/assoc/xtra.ads
+++ b/gdb/testsuite/gdb.ada/assoc/xtra.ads
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/atomic_enum.exp b/gdb/testsuite/gdb.ada/atomic_enum.exp
index fbfaf5c..58838fe 100644
--- a/gdb/testsuite/gdb.ada/atomic_enum.exp
+++ b/gdb/testsuite/gdb.ada/atomic_enum.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnat05 ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/atomic_enum/foo.adb b/gdb/testsuite/gdb.ada/atomic_enum/foo.adb
index 77b491b..8753675 100644
--- a/gdb/testsuite/gdb.ada/atomic_enum/foo.adb
+++ b/gdb/testsuite/gdb.ada/atomic_enum/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/atomic_enum/pck.adb b/gdb/testsuite/gdb.ada/atomic_enum/pck.adb
index d39327f..5d9e042 100644
--- a/gdb/testsuite/gdb.ada/atomic_enum/pck.adb
+++ b/gdb/testsuite/gdb.ada/atomic_enum/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/atomic_enum/pck.ads b/gdb/testsuite/gdb.ada/atomic_enum/pck.ads
index a427f73..e450d65 100644
--- a/gdb/testsuite/gdb.ada/atomic_enum/pck.ads
+++ b/gdb/testsuite/gdb.ada/atomic_enum/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/attr_ref_and_charlit.exp b/gdb/testsuite/gdb.ada/attr_ref_and_charlit.exp
index 27f31b5..87a233a 100644
--- a/gdb/testsuite/gdb.ada/attr_ref_and_charlit.exp
+++ b/gdb/testsuite/gdb.ada/attr_ref_and_charlit.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile "foo"
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/attr_ref_and_charlit/foo.adb b/gdb/testsuite/gdb.ada/attr_ref_and_charlit/foo.adb
index f09acf3..1ed7f40 100644
--- a/gdb/testsuite/gdb.ada/attr_ref_and_charlit/foo.adb
+++ b/gdb/testsuite/gdb.ada/attr_ref_and_charlit/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ax-ada.exp b/gdb/testsuite/gdb.ada/ax-ada.exp
index 3c78801..ee04168 100644
--- a/gdb/testsuite/gdb.ada/ax-ada.exp
+++ b/gdb/testsuite/gdb.ada/ax-ada.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile prog
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/ax-ada/prog.adb b/gdb/testsuite/gdb.ada/ax-ada/prog.adb
index 577a205..f963420 100644
--- a/gdb/testsuite/gdb.ada/ax-ada/prog.adb
+++ b/gdb/testsuite/gdb.ada/ax-ada/prog.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bad-task-bp-keyword.exp b/gdb/testsuite/gdb.ada/bad-task-bp-keyword.exp
index 42e1284..48ff9c1 100644
--- a/gdb/testsuite/gdb.ada/bad-task-bp-keyword.exp
+++ b/gdb/testsuite/gdb.ada/bad-task-bp-keyword.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/bad-task-bp-keyword/foo.adb b/gdb/testsuite/gdb.ada/bad-task-bp-keyword/foo.adb
index a320f2b..f9e4993 100644
--- a/gdb/testsuite/gdb.ada/bad-task-bp-keyword/foo.adb
+++ b/gdb/testsuite/gdb.ada/bad-task-bp-keyword/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2009-2024 Free Software Foundation, Inc.
+-- Copyright 2009-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bias.exp b/gdb/testsuite/gdb.ada/bias.exp
index f2dab41..c9b875f 100644
--- a/gdb/testsuite/gdb.ada/bias.exp
+++ b/gdb/testsuite/gdb.ada/bias.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[ada_minimal_encodings]} {
}
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/bias/bias.adb b/gdb/testsuite/gdb.ada/bias/bias.adb
index 5264eb0..b193189 100644
--- a/gdb/testsuite/gdb.ada/bias/bias.adb
+++ b/gdb/testsuite/gdb.ada/bias/bias.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bias/pck.adb b/gdb/testsuite/gdb.ada/bias/pck.adb
index 6a23d01..a1dfce0 100644
--- a/gdb/testsuite/gdb.ada/bias/pck.adb
+++ b/gdb/testsuite/gdb.ada/bias/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bias/pck.ads b/gdb/testsuite/gdb.ada/bias/pck.ads
index 7e964b5..7a96fea 100644
--- a/gdb/testsuite/gdb.ada/bias/pck.ads
+++ b/gdb/testsuite/gdb.ada/bias/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/big_packed_array.exp b/gdb/testsuite/gdb.ada/big_packed_array.exp
index 6f030f3..96ed9d2 100644
--- a/gdb/testsuite/gdb.ada/big_packed_array.exp
+++ b/gdb/testsuite/gdb.ada/big_packed_array.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
@@ -38,7 +38,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
gdb_test "print good" \
"= \\(false <repeats 196 times>\\)" \
- set have_xfail [expr $old_gcc && [string equal "$scenario" "minimal"]]
+ set have_xfail [expr {$old_gcc && [string equal "$scenario" "minimal"]}]
set re "= \\(false <repeats 196 times>\\)"
set re_xfail "= \\(0 => 0 <repeats 25 times>\\)"
diff --git a/gdb/testsuite/gdb.ada/big_packed_array/foo_ra24_010.adb b/gdb/testsuite/gdb.ada/big_packed_array/foo_ra24_010.adb
index da184fa..53b55c6 100644
--- a/gdb/testsuite/gdb.ada/big_packed_array/foo_ra24_010.adb
+++ b/gdb/testsuite/gdb.ada/big_packed_array/foo_ra24_010.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/big_packed_array/pck.adb b/gdb/testsuite/gdb.ada/big_packed_array/pck.adb
index 64f765d..34162db 100644
--- a/gdb/testsuite/gdb.ada/big_packed_array/pck.adb
+++ b/gdb/testsuite/gdb.ada/big_packed_array/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/big_packed_array/pck.ads b/gdb/testsuite/gdb.ada/big_packed_array/pck.ads
index 3fe382a..baf731d 100644
--- a/gdb/testsuite/gdb.ada/big_packed_array/pck.ads
+++ b/gdb/testsuite/gdb.ada/big_packed_array/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/boolean_expr.exp b/gdb/testsuite/gdb.ada/boolean_expr.exp
index 0b104b5..de6cc4c 100644
--- a/gdb/testsuite/gdb.ada/boolean_expr.exp
+++ b/gdb/testsuite/gdb.ada/boolean_expr.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_c_mixed_case.exp b/gdb/testsuite/gdb.ada/bp_c_mixed_case.exp
index 2286e46..63b6ecb 100644
--- a/gdb/testsuite/gdb.ada/bp_c_mixed_case.exp
+++ b/gdb/testsuite/gdb.ada/bp_c_mixed_case.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ set options [list debug \
additional_flags=${cobject2} \
additional_flags=-margs]
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $options] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/bp_c_mixed_case/bar.c b/gdb/testsuite/gdb.ada/bp_c_mixed_case/bar.c
index f91eb12..55ec6b5 100644
--- a/gdb/testsuite/gdb.ada/bp_c_mixed_case/bar.c
+++ b/gdb/testsuite/gdb.ada/bp_c_mixed_case/bar.c
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.ada/bp_c_mixed_case/foo_h731_021.adb b/gdb/testsuite/gdb.ada/bp_c_mixed_case/foo_h731_021.adb
index 8b4368e..d948498 100644
--- a/gdb/testsuite/gdb.ada/bp_c_mixed_case/foo_h731_021.adb
+++ b/gdb/testsuite/gdb.ada/bp_c_mixed_case/foo_h731_021.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_c_mixed_case/qux.c b/gdb/testsuite/gdb.ada/bp_c_mixed_case/qux.c
index 0ad7ae9..b353448 100644
--- a/gdb/testsuite/gdb.ada/bp_c_mixed_case/qux.c
+++ b/gdb/testsuite/gdb.ada/bp_c_mixed_case/qux.c
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.ada/bp_enum_homonym.exp b/gdb/testsuite/gdb.ada/bp_enum_homonym.exp
index dc9f96a..511b5db 100644
--- a/gdb/testsuite/gdb.ada/bp_enum_homonym.exp
+++ b/gdb/testsuite/gdb.ada/bp_enum_homonym.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile p
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/bp_enum_homonym/p.adb b/gdb/testsuite/gdb.ada/bp_enum_homonym/p.adb
index 74c873d..84cb697 100644
--- a/gdb/testsuite/gdb.ada/bp_enum_homonym/p.adb
+++ b/gdb/testsuite/gdb.ada/bp_enum_homonym/p.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_enum_homonym/pck.adb b/gdb/testsuite/gdb.ada/bp_enum_homonym/pck.adb
index 1b5afab..6ae3fb0 100644
--- a/gdb/testsuite/gdb.ada/bp_enum_homonym/pck.adb
+++ b/gdb/testsuite/gdb.ada/bp_enum_homonym/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_enum_homonym/pck.ads b/gdb/testsuite/gdb.ada/bp_enum_homonym/pck.ads
index 471db68..2f2a7ba 100644
--- a/gdb/testsuite/gdb.ada/bp_enum_homonym/pck.ads
+++ b/gdb/testsuite/gdb.ada/bp_enum_homonym/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_fun_addr.exp b/gdb/testsuite/gdb.ada/bp_fun_addr.exp
index 909907d..82481a9 100644
--- a/gdb/testsuite/gdb.ada/bp_fun_addr.exp
+++ b/gdb/testsuite/gdb.ada/bp_fun_addr.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile bp_fun_addr
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/bp_fun_addr/bp_fun_addr.adb b/gdb/testsuite/gdb.ada/bp_fun_addr/bp_fun_addr.adb
index 38f0bc8..fa6a50e 100644
--- a/gdb/testsuite/gdb.ada/bp_fun_addr/bp_fun_addr.adb
+++ b/gdb/testsuite/gdb.ada/bp_fun_addr/bp_fun_addr.adb
@@ -1,4 +1,4 @@
--- Copyright 2016-2024 Free Software Foundation, Inc.
+-- Copyright 2016-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_inlined_func.exp b/gdb/testsuite/gdb.ada/bp_inlined_func.exp
index db56a11..3bab85a 100644
--- a/gdb/testsuite/gdb.ada/bp_inlined_func.exp
+++ b/gdb/testsuite/gdb.ada/bp_inlined_func.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,13 +20,13 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
if {![runto_main]} {
- return 0
+ return
}
# Check that inserting breakpoint on read_small inlined function inserts
@@ -41,8 +41,10 @@ gdb_test "break read_small" \
for {set i 0} {$i < 4} {incr i} {
with_test_prefix "iteration $i" {
+ # gnat-llvm may emit a call to an out-of-line copy, so allow
+ # for this here.
gdb_test "continue" \
- "Breakpoint $bkptno_num_re, b\\.read_small \\(\\).*" \
+ "Breakpoint $bkptno_num_re, ($hex in )?b\\.read_small \\(\\).*" \
"stopped in read_small"
}
}
diff --git a/gdb/testsuite/gdb.ada/bp_inlined_func/b.adb b/gdb/testsuite/gdb.ada/bp_inlined_func/b.adb
index 172581b..0343515 100644
--- a/gdb/testsuite/gdb.ada/bp_inlined_func/b.adb
+++ b/gdb/testsuite/gdb.ada/bp_inlined_func/b.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_inlined_func/b.ads b/gdb/testsuite/gdb.ada/bp_inlined_func/b.ads
index 64dc4d8..2e93297 100644
--- a/gdb/testsuite/gdb.ada/bp_inlined_func/b.ads
+++ b/gdb/testsuite/gdb.ada/bp_inlined_func/b.ads
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_inlined_func/c.adb b/gdb/testsuite/gdb.ada/bp_inlined_func/c.adb
index d1e82d6..55b9b3f 100644
--- a/gdb/testsuite/gdb.ada/bp_inlined_func/c.adb
+++ b/gdb/testsuite/gdb.ada/bp_inlined_func/c.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_inlined_func/c.ads b/gdb/testsuite/gdb.ada/bp_inlined_func/c.ads
index 48d0dff..b8e7d2a 100644
--- a/gdb/testsuite/gdb.ada/bp_inlined_func/c.ads
+++ b/gdb/testsuite/gdb.ada/bp_inlined_func/c.ads
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_inlined_func/foo.adb b/gdb/testsuite/gdb.ada/bp_inlined_func/foo.adb
index 4a263fa..891bcd3 100644
--- a/gdb/testsuite/gdb.ada/bp_inlined_func/foo.adb
+++ b/gdb/testsuite/gdb.ada/bp_inlined_func/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_on_var.exp b/gdb/testsuite/gdb.ada/bp_on_var.exp
index c402874..78ba4bf 100644
--- a/gdb/testsuite/gdb.ada/bp_on_var.exp
+++ b/gdb/testsuite/gdb.ada/bp_on_var.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
# Test inserting breakpoint on pck.my_global_variable.
diff --git a/gdb/testsuite/gdb.ada/bp_on_var/foo.adb b/gdb/testsuite/gdb.ada/bp_on_var/foo.adb
index 359027b..ce3a94f 100644
--- a/gdb/testsuite/gdb.ada/bp_on_var/foo.adb
+++ b/gdb/testsuite/gdb.ada/bp_on_var/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_on_var/pck.adb b/gdb/testsuite/gdb.ada/bp_on_var/pck.adb
index c3edc8b..2371a1f 100644
--- a/gdb/testsuite/gdb.ada/bp_on_var/pck.adb
+++ b/gdb/testsuite/gdb.ada/bp_on_var/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_on_var/pck.ads b/gdb/testsuite/gdb.ada/bp_on_var/pck.ads
index dbbae20..979207a 100644
--- a/gdb/testsuite/gdb.ada/bp_on_var/pck.ads
+++ b/gdb/testsuite/gdb.ada/bp_on_var/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_range_type.exp b/gdb/testsuite/gdb.ada/bp_range_type.exp
index 2682946..fd9ab98 100644
--- a/gdb/testsuite/gdb.ada/bp_range_type.exp
+++ b/gdb/testsuite/gdb.ada/bp_range_type.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/bp_range_type/foo.adb b/gdb/testsuite/gdb.ada/bp_range_type/foo.adb
index 4ede2a9..22ba15f 100644
--- a/gdb/testsuite/gdb.ada/bp_range_type/foo.adb
+++ b/gdb/testsuite/gdb.ada/bp_range_type/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_range_type/pck.adb b/gdb/testsuite/gdb.ada/bp_range_type/pck.adb
index a64c5e9..54ddf5c 100644
--- a/gdb/testsuite/gdb.ada/bp_range_type/pck.adb
+++ b/gdb/testsuite/gdb.ada/bp_range_type/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_range_type/pck.ads b/gdb/testsuite/gdb.ada/bp_range_type/pck.ads
index bd9fd43..db7c0a8 100644
--- a/gdb/testsuite/gdb.ada/bp_range_type/pck.ads
+++ b/gdb/testsuite/gdb.ada/bp_range_type/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_reset.exp b/gdb/testsuite/gdb.ada/bp_reset.exp
index 440784f..c8a1857 100644
--- a/gdb/testsuite/gdb.ada/bp_reset.exp
+++ b/gdb/testsuite/gdb.ada/bp_reset.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/bp_reset/foo.adb b/gdb/testsuite/gdb.ada/bp_reset/foo.adb
index 3586f51..e5dd868 100644
--- a/gdb/testsuite/gdb.ada/bp_reset/foo.adb
+++ b/gdb/testsuite/gdb.ada/bp_reset/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_reset/io.adb b/gdb/testsuite/gdb.ada/bp_reset/io.adb
index 8455067..708965b 100644
--- a/gdb/testsuite/gdb.ada/bp_reset/io.adb
+++ b/gdb/testsuite/gdb.ada/bp_reset/io.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_reset/io.ads b/gdb/testsuite/gdb.ada/bp_reset/io.ads
index e8482ea..a1a8b2b 100644
--- a/gdb/testsuite/gdb.ada/bp_reset/io.ads
+++ b/gdb/testsuite/gdb.ada/bp_reset/io.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_reset/pck.adb b/gdb/testsuite/gdb.ada/bp_reset/pck.adb
index a3f3e8c..9c0e376 100644
--- a/gdb/testsuite/gdb.ada/bp_reset/pck.adb
+++ b/gdb/testsuite/gdb.ada/bp_reset/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/bp_reset/pck.ads b/gdb/testsuite/gdb.ada/bp_reset/pck.ads
index 19dc2ba..1c6f93f 100644
--- a/gdb/testsuite/gdb.ada/bp_reset/pck.ads
+++ b/gdb/testsuite/gdb.ada/bp_reset/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/break-label.exp b/gdb/testsuite/gdb.ada/break-label.exp
index 23a593f..22fa959 100644
--- a/gdb/testsuite/gdb.ada/break-label.exp
+++ b/gdb/testsuite/gdb.ada/break-label.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile proc
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != ""} {
- return -1
+ return
}
# Ada is case-insensitive, so both of these should work.
diff --git a/gdb/testsuite/gdb.ada/break-label/pck.adb b/gdb/testsuite/gdb.ada/break-label/pck.adb
index 3a9936d..6021faf 100644
--- a/gdb/testsuite/gdb.ada/break-label/pck.adb
+++ b/gdb/testsuite/gdb.ada/break-label/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/break-label/pck.ads b/gdb/testsuite/gdb.ada/break-label/pck.ads
index 504c911..f04f378 100644
--- a/gdb/testsuite/gdb.ada/break-label/pck.ads
+++ b/gdb/testsuite/gdb.ada/break-label/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/break-label/proc.adb b/gdb/testsuite/gdb.ada/break-label/proc.adb
index e1c6157..60b3c47 100644
--- a/gdb/testsuite/gdb.ada/break-label/proc.adb
+++ b/gdb/testsuite/gdb.ada/break-label/proc.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/byte_packed_arr.exp b/gdb/testsuite/gdb.ada/byte_packed_arr.exp
index cc7c655..d3f51d9 100644
--- a/gdb/testsuite/gdb.ada/byte_packed_arr.exp
+++ b/gdb/testsuite/gdb.ada/byte_packed_arr.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile reprod_main
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/byte_packed_arr/array_list_g.ads b/gdb/testsuite/gdb.ada/byte_packed_arr/array_list_g.ads
index cb53a71..6352159 100644
--- a/gdb/testsuite/gdb.ada/byte_packed_arr/array_list_g.ads
+++ b/gdb/testsuite/gdb.ada/byte_packed_arr/array_list_g.ads
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/byte_packed_arr/reprod.adb b/gdb/testsuite/gdb.ada/byte_packed_arr/reprod.adb
index 83ce5b5..c086284 100644
--- a/gdb/testsuite/gdb.ada/byte_packed_arr/reprod.adb
+++ b/gdb/testsuite/gdb.ada/byte_packed_arr/reprod.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/byte_packed_arr/reprod.ads b/gdb/testsuite/gdb.ada/byte_packed_arr/reprod.ads
index 3537afa..fe5efbf 100644
--- a/gdb/testsuite/gdb.ada/byte_packed_arr/reprod.ads
+++ b/gdb/testsuite/gdb.ada/byte_packed_arr/reprod.ads
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/byte_packed_arr/reprod_main.adb b/gdb/testsuite/gdb.ada/byte_packed_arr/reprod_main.adb
index d628b13..a5bee32 100644
--- a/gdb/testsuite/gdb.ada/byte_packed_arr/reprod_main.adb
+++ b/gdb/testsuite/gdb.ada/byte_packed_arr/reprod_main.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/call-no-debug.exp b/gdb/testsuite/gdb.ada/call-no-debug.exp
index 58a3d55..baf8e9b 100644
--- a/gdb/testsuite/gdb.ada/call-no-debug.exp
+++ b/gdb/testsuite/gdb.ada/call-no-debug.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if {[gdb_compile_ada $srcdir/$subdir/$testdir/pck.adb \
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable \
{debug no-force}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/call-no-debug/pck.adb b/gdb/testsuite/gdb.ada/call-no-debug/pck.adb
index df9c73f..c4fb54d 100644
--- a/gdb/testsuite/gdb.ada/call-no-debug/pck.adb
+++ b/gdb/testsuite/gdb.ada/call-no-debug/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/call-no-debug/pck.ads b/gdb/testsuite/gdb.ada/call-no-debug/pck.ads
index 97f0c22..f7e42f8 100644
--- a/gdb/testsuite/gdb.ada/call-no-debug/pck.ads
+++ b/gdb/testsuite/gdb.ada/call-no-debug/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/call-no-debug/prog.adb b/gdb/testsuite/gdb.ada/call-no-debug/prog.adb
index 60aa32d..87604d2 100644
--- a/gdb/testsuite/gdb.ada/call-no-debug/prog.adb
+++ b/gdb/testsuite/gdb.ada/call-no-debug/prog.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/call_pn.exp b/gdb/testsuite/gdb.ada/call_pn.exp
index 9114d30..295e7c79 100644
--- a/gdb/testsuite/gdb.ada/call_pn.exp
+++ b/gdb/testsuite/gdb.ada/call_pn.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
@@ -38,7 +38,7 @@ if {![runto "foo.adb:$bp_location"]} {
gdb_test_no_output {maint expand-symtabs "\(pck\|foo\)\.adb"}
set gcc_major_version [gcc_major_version]
-set have_xfail [expr $gcc_major_version >= 8 && $gcc_major_version <= 9]
+set have_xfail [expr {$gcc_major_version >= 8 && $gcc_major_version <= 9}]
# The xfail is for PR gcc/94469, which occurs with target board
# unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects and gcc-8 and later.
diff --git a/gdb/testsuite/gdb.ada/call_pn/foo.adb b/gdb/testsuite/gdb.ada/call_pn/foo.adb
index fceff8f..7923732 100644
--- a/gdb/testsuite/gdb.ada/call_pn/foo.adb
+++ b/gdb/testsuite/gdb.ada/call_pn/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/call_pn/pck.adb b/gdb/testsuite/gdb.ada/call_pn/pck.adb
index 6624c97..6604aea 100644
--- a/gdb/testsuite/gdb.ada/call_pn/pck.adb
+++ b/gdb/testsuite/gdb.ada/call_pn/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/call_pn/pck.ads b/gdb/testsuite/gdb.ada/call_pn/pck.ads
index 5d73127..f1cc9c2 100644
--- a/gdb/testsuite/gdb.ada/call_pn/pck.ads
+++ b/gdb/testsuite/gdb.ada/call_pn/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/catch_assert_if.exp b/gdb/testsuite/gdb.ada/catch_assert_if.exp
index 48b1c85..eca657f 100644
--- a/gdb/testsuite/gdb.ada/catch_assert_if.exp
+++ b/gdb/testsuite/gdb.ada/catch_assert_if.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests gnat_runtime_has_debug_info
standard_ada_testfile bla
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnata ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
@@ -35,7 +35,7 @@ set sp "\[ \t\]*"
# - continue, the program exits.
if {![runto_main]} {
- return 0
+ return
}
gdb_test "catch assert if Global_Var = 2" \
diff --git a/gdb/testsuite/gdb.ada/catch_assert_if/bla.adb b/gdb/testsuite/gdb.ada/catch_assert_if/bla.adb
index c0cc04b..d862b9b 100644
--- a/gdb/testsuite/gdb.ada/catch_assert_if/bla.adb
+++ b/gdb/testsuite/gdb.ada/catch_assert_if/bla.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/catch_assert_if/pck.ads b/gdb/testsuite/gdb.ada/catch_assert_if/pck.ads
index e74feaa..62409d5 100644
--- a/gdb/testsuite/gdb.ada/catch_assert_if/pck.ads
+++ b/gdb/testsuite/gdb.ada/catch_assert_if/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/catch_ex.exp b/gdb/testsuite/gdb.ada/catch_ex.exp
index 48ace25..34f3202 100644
--- a/gdb/testsuite/gdb.ada/catch_ex.exp
+++ b/gdb/testsuite/gdb.ada/catch_ex.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests gnat_runtime_has_debug_info
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnata ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
@@ -41,7 +41,7 @@ set catch_exception_info \
####################################
if {![runto_main]} {
- return 0
+ return
}
gdb_test "catch exception" \
@@ -79,7 +79,7 @@ gdb_test "continue" \
# - continue, the program exits.
if {![runto_main]} {
- return 0
+ return
}
gdb_test "catch exception Program_Error" \
@@ -139,7 +139,7 @@ gdb_test "continue" \
# the program.
if {![runto_main]} {
- return 0
+ return
}
gdb_test "tcatch exception" \
diff --git a/gdb/testsuite/gdb.ada/catch_ex/foo.adb b/gdb/testsuite/gdb.ada/catch_ex/foo.adb
index 34b9f68..25c545e 100644
--- a/gdb/testsuite/gdb.ada/catch_ex/foo.adb
+++ b/gdb/testsuite/gdb.ada/catch_ex/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/catch_ex_std.exp b/gdb/testsuite/gdb.ada/catch_ex_std.exp
index 2eae854..d1f17f8 100644
--- a/gdb/testsuite/gdb.ada/catch_ex_std.exp
+++ b/gdb/testsuite/gdb.ada/catch_ex_std.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ set outdir [file dirname $binfile]
# Create the shared library.
if {[gdb_compile_shlib $srcfile2 $sofile {ada debug}] != ""} {
- return -1
+ return
}
# Set linkarg such that the executable can find the shared library.
@@ -56,7 +56,7 @@ foreach option [concat $gnatbind_options $gnatlink_options] {
# Create executable.
if {[gdb_compile_ada $srcfile $binfile executable $options] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
@@ -66,7 +66,7 @@ clean_restart ${testfile}
gdb_load_shlib $sofile
if {![runto_main]} {
- return 0
+ return
}
gdb_test "catch exception some_kind_of_error" \
diff --git a/gdb/testsuite/gdb.ada/catch_ex_std/foo.adb b/gdb/testsuite/gdb.ada/catch_ex_std/foo.adb
index 20fa1f0..273fe49 100644
--- a/gdb/testsuite/gdb.ada/catch_ex_std/foo.adb
+++ b/gdb/testsuite/gdb.ada/catch_ex_std/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/catch_ex_std/some_package.adb b/gdb/testsuite/gdb.ada/catch_ex_std/some_package.adb
index 9609f83..f708d41 100644
--- a/gdb/testsuite/gdb.ada/catch_ex_std/some_package.adb
+++ b/gdb/testsuite/gdb.ada/catch_ex_std/some_package.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/catch_ex_std/some_package.ads b/gdb/testsuite/gdb.ada/catch_ex_std/some_package.ads
index c24a67b..fe79a98 100644
--- a/gdb/testsuite/gdb.ada/catch_ex_std/some_package.ads
+++ b/gdb/testsuite/gdb.ada/catch_ex_std/some_package.ads
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/char_enum.exp b/gdb/testsuite/gdb.ada/char_enum.exp
index 5be041c..6fbfb7b 100644
--- a/gdb/testsuite/gdb.ada/char_enum.exp
+++ b/gdb/testsuite/gdb.ada/char_enum.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/char_enum/foo.adb b/gdb/testsuite/gdb.ada/char_enum/foo.adb
index 8919bda..9a9c4a2 100644
--- a/gdb/testsuite/gdb.ada/char_enum/foo.adb
+++ b/gdb/testsuite/gdb.ada/char_enum/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/char_enum/pck.adb b/gdb/testsuite/gdb.ada/char_enum/pck.adb
index de1eb7e..fc67d2f 100644
--- a/gdb/testsuite/gdb.ada/char_enum/pck.adb
+++ b/gdb/testsuite/gdb.ada/char_enum/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/char_enum/pck.ads b/gdb/testsuite/gdb.ada/char_enum/pck.ads
index 3adab44..0293c79 100644
--- a/gdb/testsuite/gdb.ada/char_enum/pck.ads
+++ b/gdb/testsuite/gdb.ada/char_enum/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/char_enum_overload.exp b/gdb/testsuite/gdb.ada/char_enum_overload.exp
index 01b57c4..8a8cc5a 100644
--- a/gdb/testsuite/gdb.ada/char_enum_overload.exp
+++ b/gdb/testsuite/gdb.ada/char_enum_overload.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/char_enum_overload/foo.adb b/gdb/testsuite/gdb.ada/char_enum_overload/foo.adb
index 5fba5f2..4c516b0 100644
--- a/gdb/testsuite/gdb.ada/char_enum_overload/foo.adb
+++ b/gdb/testsuite/gdb.ada/char_enum_overload/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/char_enum_overload/pck.adb b/gdb/testsuite/gdb.ada/char_enum_overload/pck.adb
index f133ab1..56953b1 100644
--- a/gdb/testsuite/gdb.ada/char_enum_overload/pck.adb
+++ b/gdb/testsuite/gdb.ada/char_enum_overload/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/char_enum_overload/pck.ads b/gdb/testsuite/gdb.ada/char_enum_overload/pck.ads
index 4925378..2abe5eb 100644
--- a/gdb/testsuite/gdb.ada/char_enum_overload/pck.ads
+++ b/gdb/testsuite/gdb.ada/char_enum_overload/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/char_enum_unicode.exp b/gdb/testsuite/gdb.ada/char_enum_unicode.exp
index 17ee9a9..33e5aeb 100644
--- a/gdb/testsuite/gdb.ada/char_enum_unicode.exp
+++ b/gdb/testsuite/gdb.ada/char_enum_unicode.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ standard_ada_testfile foo
set flags [list debug additional_flags=-gnatW8]
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/char_enum_unicode/foo.adb b/gdb/testsuite/gdb.ada/char_enum_unicode/foo.adb
index fd7088c..4440f2e 100644
--- a/gdb/testsuite/gdb.ada/char_enum_unicode/foo.adb
+++ b/gdb/testsuite/gdb.ada/char_enum_unicode/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/char_enum_unicode/pck.adb b/gdb/testsuite/gdb.ada/char_enum_unicode/pck.adb
index 2822e77..2bfbe8c 100644
--- a/gdb/testsuite/gdb.ada/char_enum_unicode/pck.adb
+++ b/gdb/testsuite/gdb.ada/char_enum_unicode/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/char_enum_unicode/pck.ads b/gdb/testsuite/gdb.ada/char_enum_unicode/pck.ads
index d6d3d88..9002c74 100644
--- a/gdb/testsuite/gdb.ada/char_enum_unicode/pck.ads
+++ b/gdb/testsuite/gdb.ada/char_enum_unicode/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/char_param.exp b/gdb/testsuite/gdb.ada/char_param.exp
index 6b67c62..1490b71 100644
--- a/gdb/testsuite/gdb.ada/char_param.exp
+++ b/gdb/testsuite/gdb.ada/char_param.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/char_param/foo.adb b/gdb/testsuite/gdb.ada/char_param/foo.adb
index fd86552..b1e4bfd 100644
--- a/gdb/testsuite/gdb.ada/char_param/foo.adb
+++ b/gdb/testsuite/gdb.ada/char_param/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/char_param/pck.adb b/gdb/testsuite/gdb.ada/char_param/pck.adb
index 92458e6..241f9d7 100644
--- a/gdb/testsuite/gdb.ada/char_param/pck.adb
+++ b/gdb/testsuite/gdb.ada/char_param/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/char_param/pck.ads b/gdb/testsuite/gdb.ada/char_param/pck.ads
index 476c583..4caa285 100644
--- a/gdb/testsuite/gdb.ada/char_param/pck.ads
+++ b/gdb/testsuite/gdb.ada/char_param/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/complete.exp b/gdb/testsuite/gdb.ada/complete.exp
index 70d4945..fbdd24c 100644
--- a/gdb/testsuite/gdb.ada/complete.exp
+++ b/gdb/testsuite/gdb.ada/complete.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
@@ -164,7 +164,7 @@ test_gdb_complete "external_ident" \
[multi_line "p external_identical_one" \
"p external_identical_two" ]
-# Complete on the name of package.
+# Complete on the name of package.
test_gdb_complete "pck" \
[multi_line_with_optional \
"(p pck)?" \
diff --git a/gdb/testsuite/gdb.ada/complete/aux_pck.adb b/gdb/testsuite/gdb.ada/complete/aux_pck.adb
index 94481c0..eccde67 100644
--- a/gdb/testsuite/gdb.ada/complete/aux_pck.adb
+++ b/gdb/testsuite/gdb.ada/complete/aux_pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/complete/aux_pck.ads b/gdb/testsuite/gdb.ada/complete/aux_pck.ads
index e7c53ce..86a43b6 100644
--- a/gdb/testsuite/gdb.ada/complete/aux_pck.ads
+++ b/gdb/testsuite/gdb.ada/complete/aux_pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/complete/foo.adb b/gdb/testsuite/gdb.ada/complete/foo.adb
index 50ed6a7..446d054 100644
--- a/gdb/testsuite/gdb.ada/complete/foo.adb
+++ b/gdb/testsuite/gdb.ada/complete/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/complete/pck.adb b/gdb/testsuite/gdb.ada/complete/pck.adb
index 59991bd..cb0e7e8 100644
--- a/gdb/testsuite/gdb.ada/complete/pck.adb
+++ b/gdb/testsuite/gdb.ada/complete/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/complete/pck.ads b/gdb/testsuite/gdb.ada/complete/pck.ads
index 414fe63..932ce62 100644
--- a/gdb/testsuite/gdb.ada/complete/pck.ads
+++ b/gdb/testsuite/gdb.ada/complete/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/cond_lang.exp b/gdb/testsuite/gdb.ada/cond_lang.exp
index a617357..a0db685 100644
--- a/gdb/testsuite/gdb.ada/cond_lang.exp
+++ b/gdb/testsuite/gdb.ada/cond_lang.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ set cobject [standard_output_file ${cfile}.o]
gdb_compile "${csrcfile}" "${cobject}" object [list debug]
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/cond_lang/a.adb b/gdb/testsuite/gdb.ada/cond_lang/a.adb
index 7275b44..8402402 100644
--- a/gdb/testsuite/gdb.ada/cond_lang/a.adb
+++ b/gdb/testsuite/gdb.ada/cond_lang/a.adb
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/cond_lang/foo.c b/gdb/testsuite/gdb.ada/cond_lang/foo.c
index d479fca..aeb28b8 100644
--- a/gdb/testsuite/gdb.ada/cond_lang/foo.c
+++ b/gdb/testsuite/gdb.ada/cond_lang/foo.c
@@ -1,4 +1,4 @@
-/* Copyright 2010-2024 Free Software Foundation, Inc.
+/* Copyright 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.ada/cond_lang/mixed.adb b/gdb/testsuite/gdb.ada/cond_lang/mixed.adb
index 38ba255..1814a44 100644
--- a/gdb/testsuite/gdb.ada/cond_lang/mixed.adb
+++ b/gdb/testsuite/gdb.ada/cond_lang/mixed.adb
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/cond_lang/mixed.ads b/gdb/testsuite/gdb.ada/cond_lang/mixed.ads
index 8cae37e..7c4398b 100644
--- a/gdb/testsuite/gdb.ada/cond_lang/mixed.ads
+++ b/gdb/testsuite/gdb.ada/cond_lang/mixed.ads
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/cond_lang/pck.adb b/gdb/testsuite/gdb.ada/cond_lang/pck.adb
index 6c543be..6be7b5e 100644
--- a/gdb/testsuite/gdb.ada/cond_lang/pck.adb
+++ b/gdb/testsuite/gdb.ada/cond_lang/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/cond_lang/pck.ads b/gdb/testsuite/gdb.ada/cond_lang/pck.ads
index 1934eb0..016add5 100644
--- a/gdb/testsuite/gdb.ada/cond_lang/pck.ads
+++ b/gdb/testsuite/gdb.ada/cond_lang/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/convvar_comp.exp b/gdb/testsuite/gdb.ada/convvar_comp.exp
index e7ff3ba..339fb34 100644
--- a/gdb/testsuite/gdb.ada/convvar_comp.exp
+++ b/gdb/testsuite/gdb.ada/convvar_comp.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile pb16_063
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/convvar_comp/pb16_063.adb b/gdb/testsuite/gdb.ada/convvar_comp/pb16_063.adb
index b79b328..f424419 100644
--- a/gdb/testsuite/gdb.ada/convvar_comp/pb16_063.adb
+++ b/gdb/testsuite/gdb.ada/convvar_comp/pb16_063.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/convvar_comp/pck.adb b/gdb/testsuite/gdb.ada/convvar_comp/pck.adb
index b7bf3ef..ae91a74 100644
--- a/gdb/testsuite/gdb.ada/convvar_comp/pck.adb
+++ b/gdb/testsuite/gdb.ada/convvar_comp/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/convvar_comp/pck.ads b/gdb/testsuite/gdb.ada/convvar_comp/pck.ads
index b73793c..724d902 100644
--- a/gdb/testsuite/gdb.ada/convvar_comp/pck.ads
+++ b/gdb/testsuite/gdb.ada/convvar_comp/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/data-sections.exp b/gdb/testsuite/gdb.ada/data-sections.exp
index 2d9fee1..51844b0 100644
--- a/gdb/testsuite/gdb.ada/data-sections.exp
+++ b/gdb/testsuite/gdb.ada/data-sections.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ standard_ada_testfile main
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable \
{debug additional_flags=-fdata-sections ldflags=-Wl,--gc-sections}] \
!= ""} {
- return -1
+ return
}
# The bug was that the DWARF reader would crash when processing a
diff --git a/gdb/testsuite/gdb.ada/data-sections/main.adb b/gdb/testsuite/gdb.ada/data-sections/main.adb
index de74fc4..9cb51f9 100644
--- a/gdb/testsuite/gdb.ada/data-sections/main.adb
+++ b/gdb/testsuite/gdb.ada/data-sections/main.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/delta-assign.exp b/gdb/testsuite/gdb.ada/delta-assign.exp
index d733952..fbb8767 100644
--- a/gdb/testsuite/gdb.ada/delta-assign.exp
+++ b/gdb/testsuite/gdb.ada/delta-assign.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile main
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/delta-assign/main.adb b/gdb/testsuite/gdb.ada/delta-assign/main.adb
index 75d51cf..7a3ee04 100644
--- a/gdb/testsuite/gdb.ada/delta-assign/main.adb
+++ b/gdb/testsuite/gdb.ada/delta-assign/main.adb
@@ -1,4 +1,4 @@
--- Copyright 2024 Free Software Foundation, Inc.
+-- Copyright 2024-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/delta-assign/pck.adb b/gdb/testsuite/gdb.ada/delta-assign/pck.adb
index 14580e6..7863563 100644
--- a/gdb/testsuite/gdb.ada/delta-assign/pck.adb
+++ b/gdb/testsuite/gdb.ada/delta-assign/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2024 Free Software Foundation, Inc.
+-- Copyright 2024-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/delta-assign/pck.ads b/gdb/testsuite/gdb.ada/delta-assign/pck.ads
index 6f09a8e..f3bc6a8 100644
--- a/gdb/testsuite/gdb.ada/delta-assign/pck.ads
+++ b/gdb/testsuite/gdb.ada/delta-assign/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2024 Free Software Foundation, Inc.
+-- Copyright 2024-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/dgopt.exp b/gdb/testsuite/gdb.ada/dgopt.exp
index 9a74e817..438840f 100644
--- a/gdb/testsuite/gdb.ada/dgopt.exp
+++ b/gdb/testsuite/gdb.ada/dgopt.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ standard_ada_testfile x
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable \
{debug additional_flags=-gnatDG}] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/dgopt/x.adb b/gdb/testsuite/gdb.ada/dgopt/x.adb
index 883b72c..d82e884 100644
--- a/gdb/testsuite/gdb.ada/dgopt/x.adb
+++ b/gdb/testsuite/gdb.ada/dgopt/x.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/disc_arr_bound.exp b/gdb/testsuite/gdb.ada/disc_arr_bound.exp
index 0730e3e..7ea65a8 100644
--- a/gdb/testsuite/gdb.ada/disc_arr_bound.exp
+++ b/gdb/testsuite/gdb.ada/disc_arr_bound.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo_n612_026
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/disc_arr_bound/foo_n612_026.adb b/gdb/testsuite/gdb.ada/disc_arr_bound/foo_n612_026.adb
index ab0d8ec..3d2b269 100644
--- a/gdb/testsuite/gdb.ada/disc_arr_bound/foo_n612_026.adb
+++ b/gdb/testsuite/gdb.ada/disc_arr_bound/foo_n612_026.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/disc_arr_bound/pck.adb b/gdb/testsuite/gdb.ada/disc_arr_bound/pck.adb
index a39b1dc..4e02b5f 100644
--- a/gdb/testsuite/gdb.ada/disc_arr_bound/pck.adb
+++ b/gdb/testsuite/gdb.ada/disc_arr_bound/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/disc_arr_bound/pck.ads b/gdb/testsuite/gdb.ada/disc_arr_bound/pck.ads
index b830142..09380db 100644
--- a/gdb/testsuite/gdb.ada/disc_arr_bound/pck.ads
+++ b/gdb/testsuite/gdb.ada/disc_arr_bound/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/discrete-char.exp b/gdb/testsuite/gdb.ada/discrete-char.exp
index 87c8561..515219a 100644
--- a/gdb/testsuite/gdb.ada/discrete-char.exp
+++ b/gdb/testsuite/gdb.ada/discrete-char.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ require allow_ada_tests
standard_ada_testfile main
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/discrete-char/main.adb b/gdb/testsuite/gdb.ada/discrete-char/main.adb
index 4851a58..5954fb6 100644
--- a/gdb/testsuite/gdb.ada/discrete-char/main.adb
+++ b/gdb/testsuite/gdb.ada/discrete-char/main.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/discrete-char/pck.adb b/gdb/testsuite/gdb.ada/discrete-char/pck.adb
index a175b7b..d29c5da 100644
--- a/gdb/testsuite/gdb.ada/discrete-char/pck.adb
+++ b/gdb/testsuite/gdb.ada/discrete-char/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/discrete-char/pck.ads b/gdb/testsuite/gdb.ada/discrete-char/pck.ads
index 384bf08..02fc1c8 100644
--- a/gdb/testsuite/gdb.ada/discrete-char/pck.ads
+++ b/gdb/testsuite/gdb.ada/discrete-char/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/display_nested.exp b/gdb/testsuite/gdb.ada/display_nested.exp
index 2233700..4316dc9 100644
--- a/gdb/testsuite/gdb.ada/display_nested.exp
+++ b/gdb/testsuite/gdb.ada/display_nested.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/display_nested/foo.adb b/gdb/testsuite/gdb.ada/display_nested/foo.adb
index 8cc186b..df002e6 100644
--- a/gdb/testsuite/gdb.ada/display_nested/foo.adb
+++ b/gdb/testsuite/gdb.ada/display_nested/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/display_nested/pack.adb b/gdb/testsuite/gdb.ada/display_nested/pack.adb
index 6409010..9ba98a1 100644
--- a/gdb/testsuite/gdb.ada/display_nested/pack.adb
+++ b/gdb/testsuite/gdb.ada/display_nested/pack.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/display_nested/pack.ads b/gdb/testsuite/gdb.ada/display_nested/pack.ads
index 2b910b7..78e02c9 100644
--- a/gdb/testsuite/gdb.ada/display_nested/pack.ads
+++ b/gdb/testsuite/gdb.ada/display_nested/pack.ads
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/dot_all.exp b/gdb/testsuite/gdb.ada/dot_all.exp
index 0bd527f..3bae392 100644
--- a/gdb/testsuite/gdb.ada/dot_all.exp
+++ b/gdb/testsuite/gdb.ada/dot_all.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/dot_all/foo.adb b/gdb/testsuite/gdb.ada/dot_all/foo.adb
index 490dc8e..df783d4 100644
--- a/gdb/testsuite/gdb.ada/dot_all/foo.adb
+++ b/gdb/testsuite/gdb.ada/dot_all/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/dot_all/pck.adb b/gdb/testsuite/gdb.ada/dot_all/pck.adb
index e0ec67d..7b1933a 100644
--- a/gdb/testsuite/gdb.ada/dot_all/pck.adb
+++ b/gdb/testsuite/gdb.ada/dot_all/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/dot_all/pck.ads b/gdb/testsuite/gdb.ada/dot_all/pck.ads
index c82b657..90ba348 100644
--- a/gdb/testsuite/gdb.ada/dot_all/pck.ads
+++ b/gdb/testsuite/gdb.ada/dot_all/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/dyn-bit-offset.exp b/gdb/testsuite/gdb.ada/dyn-bit-offset.exp
new file mode 100644
index 0000000..a825d3b
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/dyn-bit-offset.exp
@@ -0,0 +1,79 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib "ada.exp"
+
+require allow_ada_tests
+
+standard_ada_testfile exam
+
+set flags {debug}
+if {[ada_minimal_encodings]} {
+ lappend flags additional_flags=-fgnat-encodings=minimal
+}
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != ""} {
+ return
+}
+
+# GCC needs to have fixes:
+# - 809b46d2ccc ("Partially lift restriction from loc_list_from_tree_1")
+# - d7f24e37d4b ("Fix oversight about big-endian targets in latest change")
+set have_xfail [gnat_version_compare <= {16 1}]
+
+clean_restart ${testfile}
+
+set bp_location [gdb_get_line_number "STOP" ${testdir}/exam.adb]
+runto "exam.adb:$bp_location"
+
+set re_pass \
+ [string_to_regexp \
+ " = (discr => 3, array_field => (-5, -6, -7), field => -5, another_field => -6)"]
+set re_xfail_le \
+ [string_to_regexp \
+ " = (discr => 3, array_field => (-5, -6, -7), field => -4, another_field => -4)"]
+set re_xfail_be \
+ [string_to_regexp \
+ " = (discr => 3, array_field => (-5, -6, -7), field => -6, another_field => -6)"]
+
+gdb_test_multiple "print spr" "" {
+ -re -wrap $re_pass {
+ pass $gdb_test_name
+ }
+ -re -wrap $re_xfail_le|$re_xfail_be {
+ if { $have_xfail } {
+ xfail $gdb_test_name
+ } else {
+ fail $gdb_test_name
+ }
+ }
+}
+
+set re_pass " = -5"
+set re_xfail_le " = -4"
+set re_xfail_be " = -6"
+
+gdb_test_multiple "print spr.field" "" {
+ -re -wrap $re_pass {
+ pass $gdb_test_name
+ }
+ -re -wrap $re_xfail_le|$re_xfail_be {
+ if { $have_xfail } {
+ xfail $gdb_test_name
+ } else {
+ fail $gdb_test_name
+ }
+ }
+}
diff --git a/gdb/testsuite/gdb.ada/dyn-bit-offset/exam.adb b/gdb/testsuite/gdb.ada/dyn-bit-offset/exam.adb
new file mode 100644
index 0000000..5c7f70b
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/dyn-bit-offset/exam.adb
@@ -0,0 +1,45 @@
+-- Copyright 2025 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+procedure Exam is
+ type Small is range -7 .. -4;
+ for Small'Size use 2;
+
+ type Packed_Array is array (Integer range <>) of Small;
+ pragma pack (Packed_Array);
+
+ subtype Range_Int is Natural range 0 .. 7;
+
+ type Some_Packed_Record (Discr : Range_Int := 3) is record
+ Array_Field : Packed_Array (1 .. Discr);
+ Field: Small;
+ case Discr is
+ when 3 =>
+ Another_Field : Small;
+ when others =>
+ null;
+ end case;
+ end record;
+ pragma Pack (Some_Packed_Record);
+ pragma No_Component_Reordering (Some_Packed_Record);
+
+ SPR : Some_Packed_Record := (Discr => 3,
+ Field => -5,
+ Another_Field => -6,
+ Array_Field => (-5, -6, -7));
+
+begin
+ null; -- STOP
+end Exam;
diff --git a/gdb/testsuite/gdb.ada/dyn-range.exp b/gdb/testsuite/gdb.ada/dyn-range.exp
index a7a42ba..a0dabb9 100644
--- a/gdb/testsuite/gdb.ada/dyn-range.exp
+++ b/gdb/testsuite/gdb.ada/dyn-range.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,14 +20,14 @@ require allow_ada_tests
standard_ada_testfile dyn
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
set bp_location [gdb_get_line_number "STOP" ${testdir}/dyn.adb]
if {![runto "dyn.adb:$bp_location"]} {
- return -1
+ return
}
# Accept "dyn." prefix for older versions of GNAT.
diff --git a/gdb/testsuite/gdb.ada/dyn-range/dyn.adb b/gdb/testsuite/gdb.ada/dyn-range/dyn.adb
index dd84ba3..5799ef6 100644
--- a/gdb/testsuite/gdb.ada/dyn-range/dyn.adb
+++ b/gdb/testsuite/gdb.ada/dyn-range/dyn.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/dyn-range/pck.adb b/gdb/testsuite/gdb.ada/dyn-range/pck.adb
index 4fcd42f..77e7094 100644
--- a/gdb/testsuite/gdb.ada/dyn-range/pck.adb
+++ b/gdb/testsuite/gdb.ada/dyn-range/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/dyn-range/pck.ads b/gdb/testsuite/gdb.ada/dyn-range/pck.ads
index 0bfcbb3..8e0d043 100644
--- a/gdb/testsuite/gdb.ada/dyn-range/pck.ads
+++ b/gdb/testsuite/gdb.ada/dyn-range/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/dyn_arrayidx.exp b/gdb/testsuite/gdb.ada/dyn_arrayidx.exp
index d82e54c..f166e2a 100644
--- a/gdb/testsuite/gdb.ada/dyn_arrayidx.exp
+++ b/gdb/testsuite/gdb.ada/dyn_arrayidx.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug additional_flags=-gnat12}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/dyn_arrayidx/foo.adb b/gdb/testsuite/gdb.ada/dyn_arrayidx/foo.adb
index 76ac25c..13ae028 100644
--- a/gdb/testsuite/gdb.ada/dyn_arrayidx/foo.adb
+++ b/gdb/testsuite/gdb.ada/dyn_arrayidx/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/dyn_loc.exp b/gdb/testsuite/gdb.ada/dyn_loc.exp
index 19e89d9..b820764 100644
--- a/gdb/testsuite/gdb.ada/dyn_loc.exp
+++ b/gdb/testsuite/gdb.ada/dyn_loc.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,14 +20,14 @@ require allow_ada_tests
standard_ada_testfile p
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
set bp_location [gdb_get_line_number "BREAK" ${testdir}/pack.adb]
if {![runto "pack.adb:$bp_location"]} {
- return -1
+ return
}
set eol "\r\n"
diff --git a/gdb/testsuite/gdb.ada/dyn_loc/p.adb b/gdb/testsuite/gdb.ada/dyn_loc/p.adb
index 36de9d7..8db230e 100644
--- a/gdb/testsuite/gdb.ada/dyn_loc/p.adb
+++ b/gdb/testsuite/gdb.ada/dyn_loc/p.adb
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/dyn_loc/pack.adb b/gdb/testsuite/gdb.ada/dyn_loc/pack.adb
index 158beb3..9fee9dc 100644
--- a/gdb/testsuite/gdb.ada/dyn_loc/pack.adb
+++ b/gdb/testsuite/gdb.ada/dyn_loc/pack.adb
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/dyn_loc/pack.ads b/gdb/testsuite/gdb.ada/dyn_loc/pack.ads
index 78e6a2c..bdf5c23 100644
--- a/gdb/testsuite/gdb.ada/dyn_loc/pack.ads
+++ b/gdb/testsuite/gdb.ada/dyn_loc/pack.ads
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/dyn_stride.exp b/gdb/testsuite/gdb.ada/dyn_stride.exp
index 8809c3a..95ec606 100644
--- a/gdb/testsuite/gdb.ada/dyn_stride.exp
+++ b/gdb/testsuite/gdb.ada/dyn_stride.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,14 +20,14 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.adb]
if {![runto "foo.adb:$bp_location"]} {
- return -1
+ return
}
gdb_test "print A1(1)" \
diff --git a/gdb/testsuite/gdb.ada/dyn_stride/foo.adb b/gdb/testsuite/gdb.ada/dyn_stride/foo.adb
index 373278d..a677db6 100644
--- a/gdb/testsuite/gdb.ada/dyn_stride/foo.adb
+++ b/gdb/testsuite/gdb.ada/dyn_stride/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/dynamic-iface.exp b/gdb/testsuite/gdb.ada/dynamic-iface.exp
index 94cf219..3e55be9 100644
--- a/gdb/testsuite/gdb.ada/dynamic-iface.exp
+++ b/gdb/testsuite/gdb.ada/dynamic-iface.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ require gnat_runtime_has_debug_info
standard_ada_testfile main
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug additional_flags=-gnat05}] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/dynamic-iface/concrete.adb b/gdb/testsuite/gdb.ada/dynamic-iface/concrete.adb
index c97014e..40e40f4 100644
--- a/gdb/testsuite/gdb.ada/dynamic-iface/concrete.adb
+++ b/gdb/testsuite/gdb.ada/dynamic-iface/concrete.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/dynamic-iface/concrete.ads b/gdb/testsuite/gdb.ada/dynamic-iface/concrete.ads
index 1149b5b..8bebbff 100644
--- a/gdb/testsuite/gdb.ada/dynamic-iface/concrete.ads
+++ b/gdb/testsuite/gdb.ada/dynamic-iface/concrete.ads
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/dynamic-iface/main.adb b/gdb/testsuite/gdb.ada/dynamic-iface/main.adb
index 8fbc311..c5c0230 100644
--- a/gdb/testsuite/gdb.ada/dynamic-iface/main.adb
+++ b/gdb/testsuite/gdb.ada/dynamic-iface/main.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/enum_idx_packed.exp b/gdb/testsuite/gdb.ada/enum_idx_packed.exp
index cf70e9a..e669055 100644
--- a/gdb/testsuite/gdb.ada/enum_idx_packed.exp
+++ b/gdb/testsuite/gdb.ada/enum_idx_packed.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb b/gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb
index 381a884..1f0a1f4 100644
--- a/gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb
+++ b/gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/enum_idx_packed/pck.adb b/gdb/testsuite/gdb.ada/enum_idx_packed/pck.adb
index 9206bb0..bbba128 100644
--- a/gdb/testsuite/gdb.ada/enum_idx_packed/pck.adb
+++ b/gdb/testsuite/gdb.ada/enum_idx_packed/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/enum_idx_packed/pck.ads b/gdb/testsuite/gdb.ada/enum_idx_packed/pck.ads
index 25065c0..0fc06d1 100644
--- a/gdb/testsuite/gdb.ada/enum_idx_packed/pck.ads
+++ b/gdb/testsuite/gdb.ada/enum_idx_packed/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/enum_qual.exp b/gdb/testsuite/gdb.ada/enum_qual.exp
index c386701..e5e57e6 100644
--- a/gdb/testsuite/gdb.ada/enum_qual.exp
+++ b/gdb/testsuite/gdb.ada/enum_qual.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile qual
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/enum_qual/gener.ads b/gdb/testsuite/gdb.ada/enum_qual/gener.ads
index 11ab37a..931a345 100644
--- a/gdb/testsuite/gdb.ada/enum_qual/gener.ads
+++ b/gdb/testsuite/gdb.ada/enum_qual/gener.ads
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/enum_qual/qual.adb b/gdb/testsuite/gdb.ada/enum_qual/qual.adb
index 570e482..c67bf4c 100644
--- a/gdb/testsuite/gdb.ada/enum_qual/qual.adb
+++ b/gdb/testsuite/gdb.ada/enum_qual/qual.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/enums_overload.exp b/gdb/testsuite/gdb.ada/enums_overload.exp
index 61f9cd2..cbb8b5c 100644
--- a/gdb/testsuite/gdb.ada/enums_overload.exp
+++ b/gdb/testsuite/gdb.ada/enums_overload.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile enums_overload_main
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/enums_overload/enums_overload.adb b/gdb/testsuite/gdb.ada/enums_overload/enums_overload.adb
index cc5d94e..264b83f 100644
--- a/gdb/testsuite/gdb.ada/enums_overload/enums_overload.adb
+++ b/gdb/testsuite/gdb.ada/enums_overload/enums_overload.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/enums_overload/enums_overload.ads b/gdb/testsuite/gdb.ada/enums_overload/enums_overload.ads
index bf6fb00..233c840 100644
--- a/gdb/testsuite/gdb.ada/enums_overload/enums_overload.ads
+++ b/gdb/testsuite/gdb.ada/enums_overload/enums_overload.ads
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/enums_overload/enums_overload_main.adb b/gdb/testsuite/gdb.ada/enums_overload/enums_overload_main.adb
index 4def88e..f52cc83 100644
--- a/gdb/testsuite/gdb.ada/enums_overload/enums_overload_main.adb
+++ b/gdb/testsuite/gdb.ada/enums_overload/enums_overload_main.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/excep_handle.exp b/gdb/testsuite/gdb.ada/excep_handle.exp
index 2a99457..40047f4 100644
--- a/gdb/testsuite/gdb.ada/excep_handle.exp
+++ b/gdb/testsuite/gdb.ada/excep_handle.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests gnat_runtime_has_debug_info
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnata ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
@@ -41,7 +41,7 @@ set catchpoint_storage_error_msg \
"Catchpoint $decimal, exception at $hex in foo \\\(\\\).*at .*foo.adb:$decimal$eol$decimal$sp$when Storage_Error =>"
if {![runto_main]} {
- return 0
+ return
}
############################################
diff --git a/gdb/testsuite/gdb.ada/excep_handle/foo.adb b/gdb/testsuite/gdb.ada/excep_handle/foo.adb
index 3a696b4..b07df3c 100644
--- a/gdb/testsuite/gdb.ada/excep_handle/foo.adb
+++ b/gdb/testsuite/gdb.ada/excep_handle/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/excep_handle/pck.ads b/gdb/testsuite/gdb.ada/excep_handle/pck.ads
index 10f5190..a0774f2 100644
--- a/gdb/testsuite/gdb.ada/excep_handle/pck.ads
+++ b/gdb/testsuite/gdb.ada/excep_handle/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/exception-lto.c b/gdb/testsuite/gdb.ada/exception-lto.c
index c5ee69d..c602392 100644
--- a/gdb/testsuite/gdb.ada/exception-lto.c
+++ b/gdb/testsuite/gdb.ada/exception-lto.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/exception-lto.exp b/gdb/testsuite/gdb.ada/exception-lto.exp
index 21059a3..94f0483 100644
--- a/gdb/testsuite/gdb.ada/exception-lto.exp
+++ b/gdb/testsuite/gdb.ada/exception-lto.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ require allow_ada_tests
standard_testfile .c
if {[build_executable "failed to prepare" $testfile $srcfile] == -1} {
- return -1
+ return
}
# Try this test in both the C and Ada language modes.
diff --git a/gdb/testsuite/gdb.ada/exec_changed.exp b/gdb/testsuite/gdb.ada/exec_changed.exp
index 69f386e..b67f6d4 100644
--- a/gdb/testsuite/gdb.ada/exec_changed.exp
+++ b/gdb/testsuite/gdb.ada/exec_changed.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ standard_ada_testfile first
# Build the first test program (note that cygwin needs the $EXEEXT).
if {[gdb_compile_ada "${srcfile}" "${binfile}$EXEEXT" executable {debug}] != ""} {
- return -1
+ return
}
# Build the second test program
@@ -33,7 +33,7 @@ set srcfile2 ${srcdir}/${subdir}/${testdir}/second.adb
set binfile2 [standard_output_file second$EXEEXT]
if {[gdb_compile_ada "${srcfile2}" "${binfile2}" executable {debug}] != ""} {
- return -1
+ return
}
# Start with a fresh gdb.
@@ -52,7 +52,7 @@ gdb_load ${common_binfile}
# Start the program, we should land in the program main procedure
if { [gdb_start_cmd] < 0 } {
fail start
- return -1
+ return
}
gdb_test "" \
@@ -84,7 +84,7 @@ if { [gdb_start_cmd] < 0 } {
# Try again, this time with just changing the file time of first.
-clean_restart "${binfile}$EXEEXT"
+clean_restart "${::testfile}$EXEEXT"
# Ensure we don't accidentally use the main symbol cache.
gdb_test_no_output "mt set symbol-cache-size 0"
diff --git a/gdb/testsuite/gdb.ada/exec_changed/first.adb b/gdb/testsuite/gdb.ada/exec_changed/first.adb
index 7f63108..ef0d7bc 100644
--- a/gdb/testsuite/gdb.ada/exec_changed/first.adb
+++ b/gdb/testsuite/gdb.ada/exec_changed/first.adb
@@ -1,4 +1,4 @@
--- Copyright 2005-2024 Free Software Foundation, Inc.
+-- Copyright 2005-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/exec_changed/second.adb b/gdb/testsuite/gdb.ada/exec_changed/second.adb
index 7792c28..7ce6bc6 100644
--- a/gdb/testsuite/gdb.ada/exec_changed/second.adb
+++ b/gdb/testsuite/gdb.ada/exec_changed/second.adb
@@ -1,4 +1,4 @@
--- Copyright 2005-2024 Free Software Foundation, Inc.
+-- Copyright 2005-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/expr_delims.exp b/gdb/testsuite/gdb.ada/expr_delims.exp
index 1698a21..83e398a 100644
--- a/gdb/testsuite/gdb.ada/expr_delims.exp
+++ b/gdb/testsuite/gdb.ada/expr_delims.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/expr_delims/foo.adb b/gdb/testsuite/gdb.ada/expr_delims/foo.adb
index 61d0798..fc535ea 100644
--- a/gdb/testsuite/gdb.ada/expr_delims/foo.adb
+++ b/gdb/testsuite/gdb.ada/expr_delims/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/expr_delims/pck.adb b/gdb/testsuite/gdb.ada/expr_delims/pck.adb
index ddc76f6..722e523 100644
--- a/gdb/testsuite/gdb.ada/expr_delims/pck.adb
+++ b/gdb/testsuite/gdb.ada/expr_delims/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/expr_delims/pck.ads b/gdb/testsuite/gdb.ada/expr_delims/pck.ads
index 334f6df..abe8bc6 100644
--- a/gdb/testsuite/gdb.ada/expr_delims/pck.ads
+++ b/gdb/testsuite/gdb.ada/expr_delims/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/expr_with_funcall.exp b/gdb/testsuite/gdb.ada/expr_with_funcall.exp
index 581212b..fc06b7a 100644
--- a/gdb/testsuite/gdb.ada/expr_with_funcall.exp
+++ b/gdb/testsuite/gdb.ada/expr_with_funcall.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile expr_r821_013
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/expr_with_funcall/expr_r821_013.adb b/gdb/testsuite/gdb.ada/expr_with_funcall/expr_r821_013.adb
index d6c16a8..8df4b17 100644
--- a/gdb/testsuite/gdb.ada/expr_with_funcall/expr_r821_013.adb
+++ b/gdb/testsuite/gdb.ada/expr_with_funcall/expr_r821_013.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/expr_with_funcall/pck.adb b/gdb/testsuite/gdb.ada/expr_with_funcall/pck.adb
index e1fc963..709592a 100644
--- a/gdb/testsuite/gdb.ada/expr_with_funcall/pck.adb
+++ b/gdb/testsuite/gdb.ada/expr_with_funcall/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/expr_with_funcall/pck.ads b/gdb/testsuite/gdb.ada/expr_with_funcall/pck.ads
index 26f464d..24d5d01 100644
--- a/gdb/testsuite/gdb.ada/expr_with_funcall/pck.ads
+++ b/gdb/testsuite/gdb.ada/expr_with_funcall/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/exprs.exp b/gdb/testsuite/gdb.ada/exprs.exp
index 027ec59..1ff5ed0 100644
--- a/gdb/testsuite/gdb.ada/exprs.exp
+++ b/gdb/testsuite/gdb.ada/exprs.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile p
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/exprs/p.adb b/gdb/testsuite/gdb.ada/exprs/p.adb
index bb85a83..08d2a8a 100644
--- a/gdb/testsuite/gdb.ada/exprs/p.adb
+++ b/gdb/testsuite/gdb.ada/exprs/p.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/extended-access.c b/gdb/testsuite/gdb.ada/extended-access.c
new file mode 100644
index 0000000..9a1b299
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/extended-access.c
@@ -0,0 +1,38 @@
+/* This test program is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int array_data[] = { 23, 24, 25, 26, 27 };
+
+struct bounds
+{
+ int LB0;
+ int UB0;
+};
+
+struct extended_access_ptr
+{
+ int (*P_ARRAY)[];
+ struct bounds BOUNDS;
+};
+
+struct extended_access_ptr the_array = { &array_data, { 93, 97 } };
+
+int
+main (void)
+{
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.ada/extended-access.exp b/gdb/testsuite/gdb.ada/extended-access.exp
new file mode 100644
index 0000000..7c02ad7
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/extended-access.exp
@@ -0,0 +1,29 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+require allow_ada_tests
+
+standard_testfile
+
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
+ return
+}
+
+# The test case is written in C, because it was easy to make the
+# required type there without requiring a new version of GNAT.
+gdb_test_no_output "set lang ada"
+
+gdb_test "print the_array.all" \
+ [string_to_regexp " = (93 => 23, 24, 25, 26, 27)"]
diff --git a/gdb/testsuite/gdb.ada/file-then-restart.exp b/gdb/testsuite/gdb.ada/file-then-restart.exp
index 8019189..40d0959 100644
--- a/gdb/testsuite/gdb.ada/file-then-restart.exp
+++ b/gdb/testsuite/gdb.ada/file-then-restart.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ require !use_gdb_stub
standard_ada_testfile first
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
# Build the second test program
@@ -32,16 +32,16 @@ set srcfile2 ${srcdir}/${subdir}/${testdir}/second.adb
set binfile2 [standard_output_file second]
if {[gdb_compile_ada "${srcfile2}" "${binfile2}" executable {debug}] != ""} {
- return -1
+ return
}
foreach_with_prefix scenario {kill no-kill} {
- clean_restart $binfile
+ clean_restart $::testfile
# Start the program, we should land in the program main procedure
if {[gdb_start_cmd] < 0} {
fail start
- return -1
+ return
}
gdb_test "" \
diff --git a/gdb/testsuite/gdb.ada/file-then-restart/first.adb b/gdb/testsuite/gdb.ada/file-then-restart/first.adb
index 7f63108..ef0d7bc 100644
--- a/gdb/testsuite/gdb.ada/file-then-restart/first.adb
+++ b/gdb/testsuite/gdb.ada/file-then-restart/first.adb
@@ -1,4 +1,4 @@
--- Copyright 2005-2024 Free Software Foundation, Inc.
+-- Copyright 2005-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/file-then-restart/second.adb b/gdb/testsuite/gdb.ada/file-then-restart/second.adb
index 7792c28..7ce6bc6 100644
--- a/gdb/testsuite/gdb.ada/file-then-restart/second.adb
+++ b/gdb/testsuite/gdb.ada/file-then-restart/second.adb
@@ -1,4 +1,4 @@
--- Copyright 2005-2024 Free Software Foundation, Inc.
+-- Copyright 2005-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fin_fun_out.exp b/gdb/testsuite/gdb.ada/fin_fun_out.exp
index b340caf..fcc7b40 100644
--- a/gdb/testsuite/gdb.ada/fin_fun_out.exp
+++ b/gdb/testsuite/gdb.ada/fin_fun_out.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo_o525_013
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/fin_fun_out/bar.adb b/gdb/testsuite/gdb.ada/fin_fun_out/bar.adb
index 98dc657..002eff6 100644
--- a/gdb/testsuite/gdb.ada/fin_fun_out/bar.adb
+++ b/gdb/testsuite/gdb.ada/fin_fun_out/bar.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fin_fun_out/bar.ads b/gdb/testsuite/gdb.ada/fin_fun_out/bar.ads
index d88a94c..c003989 100644
--- a/gdb/testsuite/gdb.ada/fin_fun_out/bar.ads
+++ b/gdb/testsuite/gdb.ada/fin_fun_out/bar.ads
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fin_fun_out/foo_o525_013.adb b/gdb/testsuite/gdb.ada/fin_fun_out/foo_o525_013.adb
index ca80194..101ca82 100644
--- a/gdb/testsuite/gdb.ada/fin_fun_out/foo_o525_013.adb
+++ b/gdb/testsuite/gdb.ada/fin_fun_out/foo_o525_013.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/finish-large.exp b/gdb/testsuite/gdb.ada/finish-large.exp
index 1ba43fd..61e7a79 100644
--- a/gdb/testsuite/gdb.ada/finish-large.exp
+++ b/gdb/testsuite/gdb.ada/finish-large.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if {[ada_fvar_tracking]} {
}
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/finish-large/p.adb b/gdb/testsuite/gdb.ada/finish-large/p.adb
index 5135ff6..74b158b 100644
--- a/gdb/testsuite/gdb.ada/finish-large/p.adb
+++ b/gdb/testsuite/gdb.ada/finish-large/p.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/finish-large/pck.adb b/gdb/testsuite/gdb.ada/finish-large/pck.adb
index cfae0a5..8b44997 100644
--- a/gdb/testsuite/gdb.ada/finish-large/pck.adb
+++ b/gdb/testsuite/gdb.ada/finish-large/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/finish-large/pck.ads b/gdb/testsuite/gdb.ada/finish-large/pck.ads
index 1204eb7..93d1138 100644
--- a/gdb/testsuite/gdb.ada/finish-large/pck.ads
+++ b/gdb/testsuite/gdb.ada/finish-large/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/finish-var-size.exp b/gdb/testsuite/gdb.ada/finish-var-size.exp
index 7b20d7d..4bcd7aa 100644
--- a/gdb/testsuite/gdb.ada/finish-var-size.exp
+++ b/gdb/testsuite/gdb.ada/finish-var-size.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,12 +18,18 @@ load_lib "ada.exp"
require allow_ada_tests
# GCC 12 has the needed fix.
-require {expr [gcc_major_version] >= 12}
+require {expr {[gcc_major_version] >= 12}}
standard_ada_testfile p
-if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != ""} {
- return -1
+set opts {}
+lappend opts debug
+if { [ada_fvar_tracking] } {
+ lappend opts additional_flags=-fvar-tracking
+}
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $opts] != ""} {
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/finish-var-size/p.adb b/gdb/testsuite/gdb.ada/finish-var-size/p.adb
index 58aea2e..9cfec73 100644
--- a/gdb/testsuite/gdb.ada/finish-var-size/p.adb
+++ b/gdb/testsuite/gdb.ada/finish-var-size/p.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/finish-var-size/pck.adb b/gdb/testsuite/gdb.ada/finish-var-size/pck.adb
index d2ae489..e28f623 100644
--- a/gdb/testsuite/gdb.ada/finish-var-size/pck.adb
+++ b/gdb/testsuite/gdb.ada/finish-var-size/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/finish-var-size/pck.ads b/gdb/testsuite/gdb.ada/finish-var-size/pck.ads
index 499b54e..36014e7 100644
--- a/gdb/testsuite/gdb.ada/finish-var-size/pck.ads
+++ b/gdb/testsuite/gdb.ada/finish-var-size/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fixed_cmp.exp b/gdb/testsuite/gdb.ada/fixed_cmp.exp
index dcd4745..0fe52dc 100644
--- a/gdb/testsuite/gdb.ada/fixed_cmp.exp
+++ b/gdb/testsuite/gdb.ada/fixed_cmp.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding gnat_encodings flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${gnat_encodings}" executable $flags] != "" } {
- return -1
+ return
}
clean_restart ${testfile}-${gnat_encodings}
diff --git a/gdb/testsuite/gdb.ada/fixed_cmp/fixed.adb b/gdb/testsuite/gdb.ada/fixed_cmp/fixed.adb
index f5575c1..a451bc8 100644
--- a/gdb/testsuite/gdb.ada/fixed_cmp/fixed.adb
+++ b/gdb/testsuite/gdb.ada/fixed_cmp/fixed.adb
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fixed_cmp/pck.adb b/gdb/testsuite/gdb.ada/fixed_cmp/pck.adb
index d1e115d..3dc26b6 100644
--- a/gdb/testsuite/gdb.ada/fixed_cmp/pck.adb
+++ b/gdb/testsuite/gdb.ada/fixed_cmp/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fixed_cmp/pck.ads b/gdb/testsuite/gdb.ada/fixed_cmp/pck.ads
index e877d00..02e2789 100644
--- a/gdb/testsuite/gdb.ada/fixed_cmp/pck.ads
+++ b/gdb/testsuite/gdb.ada/fixed_cmp/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fixed_points.exp b/gdb/testsuite/gdb.ada/fixed_points.exp
index 19ec1f8..79df7af 100644
--- a/gdb/testsuite/gdb.ada/fixed_points.exp
+++ b/gdb/testsuite/gdb.ada/fixed_points.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ standard_ada_testfile fixed_points
foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
@@ -90,6 +90,10 @@ foreach_gnat_encoding scenario flags {all minimal} {
# This only started working in GCC 11.
if {$scenario == "minimal" && [gnat_version_compare >= 11]} {
gdb_test "print fp5_var" " = 3e-19"
+
+ gdb_test "print Float(Object_Fixed) = Float(Semicircle_Delta * 5)" \
+ " = true" \
+ "examine object_fixed"
}
# This failed before GCC 10.
diff --git a/gdb/testsuite/gdb.ada/fixed_points/fixed_points.adb b/gdb/testsuite/gdb.ada/fixed_points/fixed_points.adb
index b233d05..94a41b9 100644
--- a/gdb/testsuite/gdb.ada/fixed_points/fixed_points.adb
+++ b/gdb/testsuite/gdb.ada/fixed_points/fixed_points.adb
@@ -1,4 +1,4 @@
--- Copyright 2004-2024 Free Software Foundation, Inc.
+-- Copyright 2004-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@@ -64,6 +64,12 @@ procedure Fixed_Points is
for Another_Type'size use 64;
Another_Fixed : Another_Type := Another_Delta * 5;
+ Semicircle_Delta : constant := 1.0/(2**31);
+ type Semicircle_Type is delta Semicircle_Delta range -1.0 .. (1.0 - Semicircle_Delta);
+ for Semicircle_Type'small use Semicircle_Delta;
+ for Semicircle_Type'size use 32;
+ Object_Fixed : Semicircle_Type := Semicircle_Delta * 5;
+
begin
Base_Object := 1.0/16.0; -- Set breakpoint here
Subtype_Object := 1.0/16.0;
@@ -75,4 +81,5 @@ begin
Do_Nothing (FP4_Var'Address);
Do_Nothing (FP5_Var'Address);
Do_Nothing (Another_Fixed'Address);
+ Do_Nothing (Object_Fixed'Address);
end Fixed_Points;
diff --git a/gdb/testsuite/gdb.ada/fixed_points/pck.adb b/gdb/testsuite/gdb.ada/fixed_points/pck.adb
index 0236303..06ff0af 100644
--- a/gdb/testsuite/gdb.ada/fixed_points/pck.adb
+++ b/gdb/testsuite/gdb.ada/fixed_points/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2016-2024 Free Software Foundation, Inc.
+-- Copyright 2016-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fixed_points/pck.ads b/gdb/testsuite/gdb.ada/fixed_points/pck.ads
index 44719ce..74a8144 100644
--- a/gdb/testsuite/gdb.ada/fixed_points/pck.ads
+++ b/gdb/testsuite/gdb.ada/fixed_points/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2016-2024 Free Software Foundation, Inc.
+-- Copyright 2016-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fixed_points_function.exp b/gdb/testsuite/gdb.ada/fixed_points_function.exp
index f950d3d..3b0c78b 100644
--- a/gdb/testsuite/gdb.ada/fixed_points_function.exp
+++ b/gdb/testsuite/gdb.ada/fixed_points_function.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile fixed_points_function
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/fixed_points_function/fixed_points_function.adb b/gdb/testsuite/gdb.ada/fixed_points_function/fixed_points_function.adb
index 287295c..763e15c 100644
--- a/gdb/testsuite/gdb.ada/fixed_points_function/fixed_points_function.adb
+++ b/gdb/testsuite/gdb.ada/fixed_points_function/fixed_points_function.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fixed_points_function/pck.adb b/gdb/testsuite/gdb.ada/fixed_points_function/pck.adb
index 7a18868..cfb13a4 100644
--- a/gdb/testsuite/gdb.ada/fixed_points_function/pck.adb
+++ b/gdb/testsuite/gdb.ada/fixed_points_function/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fixed_points_function/pck.ads b/gdb/testsuite/gdb.ada/fixed_points_function/pck.ads
index a483529..9e4749c 100644
--- a/gdb/testsuite/gdb.ada/fixed_points_function/pck.ads
+++ b/gdb/testsuite/gdb.ada/fixed_points_function/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/float-bits.exp b/gdb/testsuite/gdb.ada/float-bits.exp
index 7fbb1de..f000d5d 100644
--- a/gdb/testsuite/gdb.ada/float-bits.exp
+++ b/gdb/testsuite/gdb.ada/float-bits.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ require allow_ada_tests
standard_ada_testfile prog
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
# Given a floating point EXPRESSION, return the size of the result.
diff --git a/gdb/testsuite/gdb.ada/float-bits/pck.adb b/gdb/testsuite/gdb.ada/float-bits/pck.adb
index a175b7b..d29c5da 100644
--- a/gdb/testsuite/gdb.ada/float-bits/pck.adb
+++ b/gdb/testsuite/gdb.ada/float-bits/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/float-bits/pck.ads b/gdb/testsuite/gdb.ada/float-bits/pck.ads
index 384bf08..02fc1c8 100644
--- a/gdb/testsuite/gdb.ada/float-bits/pck.ads
+++ b/gdb/testsuite/gdb.ada/float-bits/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/float-bits/prog.adb b/gdb/testsuite/gdb.ada/float-bits/prog.adb
index 21a2ae4..bc6b7bc 100644
--- a/gdb/testsuite/gdb.ada/float-bits/prog.adb
+++ b/gdb/testsuite/gdb.ada/float-bits/prog.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/float_param.exp b/gdb/testsuite/gdb.ada/float_param.exp
index df19a6e..8b5fc43 100644
--- a/gdb/testsuite/gdb.ada/float_param.exp
+++ b/gdb/testsuite/gdb.ada/float_param.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/float_param/foo.adb b/gdb/testsuite/gdb.ada/float_param/foo.adb
index 9e5e53e..01c2e3f 100644
--- a/gdb/testsuite/gdb.ada/float_param/foo.adb
+++ b/gdb/testsuite/gdb.ada/float_param/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/float_param/pck.adb b/gdb/testsuite/gdb.ada/float_param/pck.adb
index 3012a48..5143bde 100644
--- a/gdb/testsuite/gdb.ada/float_param/pck.adb
+++ b/gdb/testsuite/gdb.ada/float_param/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/float_param/pck.ads b/gdb/testsuite/gdb.ada/float_param/pck.ads
index 86166fa..fd68b49 100644
--- a/gdb/testsuite/gdb.ada/float_param/pck.ads
+++ b/gdb/testsuite/gdb.ada/float_param/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/formatted_ref.exp b/gdb/testsuite/gdb.ada/formatted_ref.exp
index 6f91154..08e56ce 100644
--- a/gdb/testsuite/gdb.ada/formatted_ref.exp
+++ b/gdb/testsuite/gdb.ada/formatted_ref.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,8 +16,8 @@
# Author: P. N. Hilfinger, AdaCore Inc.
# Note: This test is essentially a transcription of gdb.cp/formatted-ref.exp,
-# and is thus much more wordy than it needs to be. There are fewer
-# tests because only a few parameter types in Ada are required to be
+# and is thus much more wordy than it needs to be. There are fewer
+# tests because only a few parameter types in Ada are required to be
# passed by reference, and there is no equivalent of &(&x) for reference
# values.
# This also tests that some other arithmetic operations on references
@@ -32,7 +32,7 @@ standard_ada_testfile formatted_ref
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
untested formatted-ref.exp
- return -1
+ return
}
proc get_address { var } {
@@ -54,7 +54,7 @@ proc test_p_x { var val addr } {
gdb_test_multiple "$test" $test {
-re "\\$\[0-9\]+ = [string_to_regexp $val].*$gdb_prompt $" {
pass $test
- }
+ }
-re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" {
fail "$test (prints just address)"
}
diff --git a/gdb/testsuite/gdb.ada/formatted_ref/defs.adb b/gdb/testsuite/gdb.ada/formatted_ref/defs.adb
index 274761a..ba994fc 100644
--- a/gdb/testsuite/gdb.ada/formatted_ref/defs.adb
+++ b/gdb/testsuite/gdb.ada/formatted_ref/defs.adb
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/formatted_ref/defs.ads b/gdb/testsuite/gdb.ada/formatted_ref/defs.ads
index 4addf09..6d54ad5 100644
--- a/gdb/testsuite/gdb.ada/formatted_ref/defs.ads
+++ b/gdb/testsuite/gdb.ada/formatted_ref/defs.ads
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/formatted_ref/formatted_ref.adb b/gdb/testsuite/gdb.ada/formatted_ref/formatted_ref.adb
index 838062b..3916a14 100644
--- a/gdb/testsuite/gdb.ada/formatted_ref/formatted_ref.adb
+++ b/gdb/testsuite/gdb.ada/formatted_ref/formatted_ref.adb
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/frame_arg_lang.exp b/gdb/testsuite/gdb.ada/frame_arg_lang.exp
index b629c42..13a317f 100644
--- a/gdb/testsuite/gdb.ada/frame_arg_lang.exp
+++ b/gdb/testsuite/gdb.ada/frame_arg_lang.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
additional_flags=-margs
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/frame_arg_lang/bla.adb b/gdb/testsuite/gdb.ada/frame_arg_lang/bla.adb
index f742987..7e62b4e 100644
--- a/gdb/testsuite/gdb.ada/frame_arg_lang/bla.adb
+++ b/gdb/testsuite/gdb.ada/frame_arg_lang/bla.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/frame_arg_lang/foo.c b/gdb/testsuite/gdb.ada/frame_arg_lang/foo.c
index a054bc3..7c039f3 100644
--- a/gdb/testsuite/gdb.ada/frame_arg_lang/foo.c
+++ b/gdb/testsuite/gdb.ada/frame_arg_lang/foo.c
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.ada/frame_arg_lang/pck.adb b/gdb/testsuite/gdb.ada/frame_arg_lang/pck.adb
index c4d22a6..16e3b4d 100644
--- a/gdb/testsuite/gdb.ada/frame_arg_lang/pck.adb
+++ b/gdb/testsuite/gdb.ada/frame_arg_lang/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/frame_arg_lang/pck.ads b/gdb/testsuite/gdb.ada/frame_arg_lang/pck.ads
index 890b8f5..0428a07 100644
--- a/gdb/testsuite/gdb.ada/frame_arg_lang/pck.ads
+++ b/gdb/testsuite/gdb.ada/frame_arg_lang/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/frame_args.exp b/gdb/testsuite/gdb.ada/frame_args.exp
index c5eb380..9f8badd 100644
--- a/gdb/testsuite/gdb.ada/frame_args.exp
+++ b/gdb/testsuite/gdb.ada/frame_args.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
@@ -32,7 +32,7 @@ set sp "\[ \t\]*"
if {![runto break_me]} {
return
-}
+}
# First, print all the arrays without indexes
diff --git a/gdb/testsuite/gdb.ada/frame_args/foo.adb b/gdb/testsuite/gdb.ada/frame_args/foo.adb
index b71a44c..d32dfed 100644
--- a/gdb/testsuite/gdb.ada/frame_args/foo.adb
+++ b/gdb/testsuite/gdb.ada/frame_args/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/frame_args/pck.adb b/gdb/testsuite/gdb.ada/frame_args/pck.adb
index 330da76..3fddae8 100644
--- a/gdb/testsuite/gdb.ada/frame_args/pck.adb
+++ b/gdb/testsuite/gdb.ada/frame_args/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/frame_args/pck.ads b/gdb/testsuite/gdb.ada/frame_args/pck.ads
index 6594d07..abb380c 100644
--- a/gdb/testsuite/gdb.ada/frame_args/pck.ads
+++ b/gdb/testsuite/gdb.ada/frame_args/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fullname_bp.exp b/gdb/testsuite/gdb.ada/fullname_bp.exp
index 26240d7..7729c63 100644
--- a/gdb/testsuite/gdb.ada/fullname_bp.exp
+++ b/gdb/testsuite/gdb.ada/fullname_bp.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
# Note: We restart the debugger before setting each breakpoint, because
diff --git a/gdb/testsuite/gdb.ada/fullname_bp/dn.adb b/gdb/testsuite/gdb.ada/fullname_bp/dn.adb
index 0ce59b5..2249b0b 100644
--- a/gdb/testsuite/gdb.ada/fullname_bp/dn.adb
+++ b/gdb/testsuite/gdb.ada/fullname_bp/dn.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fullname_bp/dn.ads b/gdb/testsuite/gdb.ada/fullname_bp/dn.ads
index e442972..e1361f6 100644
--- a/gdb/testsuite/gdb.ada/fullname_bp/dn.ads
+++ b/gdb/testsuite/gdb.ada/fullname_bp/dn.ads
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fullname_bp/foo.adb b/gdb/testsuite/gdb.ada/fullname_bp/foo.adb
index 801e0b4..06a0b23 100644
--- a/gdb/testsuite/gdb.ada/fullname_bp/foo.adb
+++ b/gdb/testsuite/gdb.ada/fullname_bp/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fullname_bp/pck.adb b/gdb/testsuite/gdb.ada/fullname_bp/pck.adb
index 579ba23..cf218e2 100644
--- a/gdb/testsuite/gdb.ada/fullname_bp/pck.adb
+++ b/gdb/testsuite/gdb.ada/fullname_bp/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fullname_bp/pck.ads b/gdb/testsuite/gdb.ada/fullname_bp/pck.ads
index 895b24e..f2c7f6d 100644
--- a/gdb/testsuite/gdb.ada/fullname_bp/pck.ads
+++ b/gdb/testsuite/gdb.ada/fullname_bp/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fun_addr.exp b/gdb/testsuite/gdb.ada/fun_addr.exp
index 2c9368a..2d86fd4 100644
--- a/gdb/testsuite/gdb.ada/fun_addr.exp
+++ b/gdb/testsuite/gdb.ada/fun_addr.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/fun_addr/foo.adb b/gdb/testsuite/gdb.ada/fun_addr/foo.adb
index f9d7c0b..0463f94 100644
--- a/gdb/testsuite/gdb.ada/fun_addr/foo.adb
+++ b/gdb/testsuite/gdb.ada/fun_addr/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fun_in_declare.exp b/gdb/testsuite/gdb.ada/fun_in_declare.exp
index a73a91f..edd2318 100644
--- a/gdb/testsuite/gdb.ada/fun_in_declare.exp
+++ b/gdb/testsuite/gdb.ada/fun_in_declare.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,14 +20,14 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
if {![runto_main]} {
return
-}
+}
# Some variables used to simplify the maintenance of some of
# the regular expressions below.
diff --git a/gdb/testsuite/gdb.ada/fun_in_declare/foo.adb b/gdb/testsuite/gdb.ada/fun_in_declare/foo.adb
index fcaf853..afee6d9 100644
--- a/gdb/testsuite/gdb.ada/fun_in_declare/foo.adb
+++ b/gdb/testsuite/gdb.ada/fun_in_declare/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fun_in_declare/pck.adb b/gdb/testsuite/gdb.ada/fun_in_declare/pck.adb
index 1a8f551..b95ea86 100644
--- a/gdb/testsuite/gdb.ada/fun_in_declare/pck.adb
+++ b/gdb/testsuite/gdb.ada/fun_in_declare/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fun_in_declare/pck.ads b/gdb/testsuite/gdb.ada/fun_in_declare/pck.ads
index 7a4b893..3945c34 100644
--- a/gdb/testsuite/gdb.ada/fun_in_declare/pck.ads
+++ b/gdb/testsuite/gdb.ada/fun_in_declare/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fun_overload_menu.exp b/gdb/testsuite/gdb.ada/fun_overload_menu.exp
index 1130d84..7bafd09 100644
--- a/gdb/testsuite/gdb.ada/fun_overload_menu.exp
+++ b/gdb/testsuite/gdb.ada/fun_overload_menu.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "$srcfile" "$binfile" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/fun_overload_menu/foo.adb b/gdb/testsuite/gdb.ada/fun_overload_menu/foo.adb
index d866221..1cc0d71 100644
--- a/gdb/testsuite/gdb.ada/fun_overload_menu/foo.adb
+++ b/gdb/testsuite/gdb.ada/fun_overload_menu/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fun_renaming.exp b/gdb/testsuite/gdb.ada/fun_renaming.exp
index 21f80db..9d84a57 100644
--- a/gdb/testsuite/gdb.ada/fun_renaming.exp
+++ b/gdb/testsuite/gdb.ada/fun_renaming.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile fun_renaming
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/fun_renaming/fun_renaming.adb b/gdb/testsuite/gdb.ada/fun_renaming/fun_renaming.adb
index 00b18da..f95c96f 100644
--- a/gdb/testsuite/gdb.ada/fun_renaming/fun_renaming.adb
+++ b/gdb/testsuite/gdb.ada/fun_renaming/fun_renaming.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fun_renaming/pack.adb b/gdb/testsuite/gdb.ada/fun_renaming/pack.adb
index ee31c76..aca775c 100644
--- a/gdb/testsuite/gdb.ada/fun_renaming/pack.adb
+++ b/gdb/testsuite/gdb.ada/fun_renaming/pack.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/fun_renaming/pack.ads b/gdb/testsuite/gdb.ada/fun_renaming/pack.ads
index b6ca4b3..1909c93 100644
--- a/gdb/testsuite/gdb.ada/fun_renaming/pack.ads
+++ b/gdb/testsuite/gdb.ada/fun_renaming/pack.ads
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/funcall_char.exp b/gdb/testsuite/gdb.ada/funcall_char.exp
index 349f4ed..108fcde 100644
--- a/gdb/testsuite/gdb.ada/funcall_char.exp
+++ b/gdb/testsuite/gdb.ada/funcall_char.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/funcall_char/foo.adb b/gdb/testsuite/gdb.ada/funcall_char/foo.adb
index e096768..39bdb44 100644
--- a/gdb/testsuite/gdb.ada/funcall_char/foo.adb
+++ b/gdb/testsuite/gdb.ada/funcall_char/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/funcall_param.exp b/gdb/testsuite/gdb.ada/funcall_param.exp
index d9711a0..10e5175 100644
--- a/gdb/testsuite/gdb.ada/funcall_param.exp
+++ b/gdb/testsuite/gdb.ada/funcall_param.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/funcall_param/foo.adb b/gdb/testsuite/gdb.ada/funcall_param/foo.adb
index baaaf19..b959769 100644
--- a/gdb/testsuite/gdb.ada/funcall_param/foo.adb
+++ b/gdb/testsuite/gdb.ada/funcall_param/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/funcall_param/pck.adb b/gdb/testsuite/gdb.ada/funcall_param/pck.adb
index 2e73016..7fe4b32 100644
--- a/gdb/testsuite/gdb.ada/funcall_param/pck.adb
+++ b/gdb/testsuite/gdb.ada/funcall_param/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/funcall_param/pck.ads b/gdb/testsuite/gdb.ada/funcall_param/pck.ads
index 72f9dfe..1420569 100644
--- a/gdb/testsuite/gdb.ada/funcall_param/pck.ads
+++ b/gdb/testsuite/gdb.ada/funcall_param/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/funcall_ptr.exp b/gdb/testsuite/gdb.ada/funcall_ptr.exp
index 12304cc..8b93c12 100644
--- a/gdb/testsuite/gdb.ada/funcall_ptr.exp
+++ b/gdb/testsuite/gdb.ada/funcall_ptr.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "$srcfile" "$binfile" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/funcall_ptr/foo.adb b/gdb/testsuite/gdb.ada/funcall_ptr/foo.adb
index 53ab8e9..87767f8 100644
--- a/gdb/testsuite/gdb.ada/funcall_ptr/foo.adb
+++ b/gdb/testsuite/gdb.ada/funcall_ptr/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/funcall_ptr/pck.adb b/gdb/testsuite/gdb.ada/funcall_ptr/pck.adb
index 25d59f8..514a0ea 100644
--- a/gdb/testsuite/gdb.ada/funcall_ptr/pck.adb
+++ b/gdb/testsuite/gdb.ada/funcall_ptr/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/funcall_ptr/pck.ads b/gdb/testsuite/gdb.ada/funcall_ptr/pck.ads
index 16d6bb1..0de5bb9 100644
--- a/gdb/testsuite/gdb.ada/funcall_ptr/pck.ads
+++ b/gdb/testsuite/gdb.ada/funcall_ptr/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/funcall_ref.exp b/gdb/testsuite/gdb.ada/funcall_ref.exp
index 1c28392..8e6bbc6 100644
--- a/gdb/testsuite/gdb.ada/funcall_ref.exp
+++ b/gdb/testsuite/gdb.ada/funcall_ref.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
@@ -81,7 +81,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
}
if { $supported == 0 } {
- return 0
+ return
}
gdb_test "p get(\"Hello world!\")" \
diff --git a/gdb/testsuite/gdb.ada/funcall_ref/foo.adb b/gdb/testsuite/gdb.ada/funcall_ref/foo.adb
index 1299b14..0217082 100644
--- a/gdb/testsuite/gdb.ada/funcall_ref/foo.adb
+++ b/gdb/testsuite/gdb.ada/funcall_ref/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ghost.exp b/gdb/testsuite/gdb.ada/ghost.exp
index b4217cb..1758ea8 100644
--- a/gdb/testsuite/gdb.ada/ghost.exp
+++ b/gdb/testsuite/gdb.ada/ghost.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ standard_ada_testfile main
set flags [list debug additional_flags=-gnata]
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/ghost/gpck.ads b/gdb/testsuite/gdb.ada/ghost/gpck.ads
index 6ccf43f..b373014 100644
--- a/gdb/testsuite/gdb.ada/ghost/gpck.ads
+++ b/gdb/testsuite/gdb.ada/ghost/gpck.ads
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ghost/main.adb b/gdb/testsuite/gdb.ada/ghost/main.adb
index 9c8d0d9..6f14c25 100644
--- a/gdb/testsuite/gdb.ada/ghost/main.adb
+++ b/gdb/testsuite/gdb.ada/ghost/main.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ghost/pck.ads b/gdb/testsuite/gdb.ada/ghost/pck.ads
index 54523d1..cce3eaf 100644
--- a/gdb/testsuite/gdb.ada/ghost/pck.ads
+++ b/gdb/testsuite/gdb.ada/ghost/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/homonym.exp b/gdb/testsuite/gdb.ada/homonym.exp
index 2fef3c6..ac3c22d 100644
--- a/gdb/testsuite/gdb.ada/homonym.exp
+++ b/gdb/testsuite/gdb.ada/homonym.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile homonym_main
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/homonym/homonym.adb b/gdb/testsuite/gdb.ada/homonym/homonym.adb
index fdd51e5..15e9123 100644
--- a/gdb/testsuite/gdb.ada/homonym/homonym.adb
+++ b/gdb/testsuite/gdb.ada/homonym/homonym.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/homonym/homonym.ads b/gdb/testsuite/gdb.ada/homonym/homonym.ads
index 6846940..f25a4b2 100644
--- a/gdb/testsuite/gdb.ada/homonym/homonym.ads
+++ b/gdb/testsuite/gdb.ada/homonym/homonym.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/homonym/homonym_main.adb b/gdb/testsuite/gdb.ada/homonym/homonym_main.adb
index 7f58279..2d71d2d 100644
--- a/gdb/testsuite/gdb.ada/homonym/homonym_main.adb
+++ b/gdb/testsuite/gdb.ada/homonym/homonym_main.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/homonym/pck.adb b/gdb/testsuite/gdb.ada/homonym/pck.adb
index 2822e77..2bfbe8c 100644
--- a/gdb/testsuite/gdb.ada/homonym/pck.adb
+++ b/gdb/testsuite/gdb.ada/homonym/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/homonym/pck.ads b/gdb/testsuite/gdb.ada/homonym/pck.ads
index 7de7794..90f3ced 100644
--- a/gdb/testsuite/gdb.ada/homonym/pck.ads
+++ b/gdb/testsuite/gdb.ada/homonym/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/huge.exp b/gdb/testsuite/gdb.ada/huge.exp
index 7943b83..7bf7003 100644
--- a/gdb/testsuite/gdb.ada/huge.exp
+++ b/gdb/testsuite/gdb.ada/huge.exp
@@ -1,4 +1,4 @@
-# Copyright 2001-2024 Free Software Foundation, Inc.
+# Copyright 2001-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ set opts {}
lappend opts debug
set compilation_succeeded 0
-for { set size $max } { $size >= $min } { set size [expr $size / 2] } {
+for { set size $max } { $size >= $min } { set size [expr {$size / 2}] } {
set try_opts [concat $opts [list additional_flags=-gnateDCRASHGDB=$size]]
# Use gdb_compile_ada_1 to prevent failed compilations from producing a
# FAIL.
@@ -46,7 +46,7 @@ for { set size $max } { $size >= $min } { set size [expr $size / 2] } {
set compilation_succeeded 1
break
}
-require {expr $compilation_succeeded}
+require {expr {$compilation_succeeded}}
foreach_with_prefix varname {Arr Packed_Arr} {
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/huge/foo.adb b/gdb/testsuite/gdb.ada/huge/foo.adb
index 3743b1e..0db6806 100644
--- a/gdb/testsuite/gdb.ada/huge/foo.adb
+++ b/gdb/testsuite/gdb.ada/huge/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/huge/pck.adb b/gdb/testsuite/gdb.ada/huge/pck.adb
index 69d00f4..23e1914 100644
--- a/gdb/testsuite/gdb.ada/huge/pck.adb
+++ b/gdb/testsuite/gdb.ada/huge/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/huge/pck.ads b/gdb/testsuite/gdb.ada/huge/pck.ads
index ec30773..13dadbb 100644
--- a/gdb/testsuite/gdb.ada/huge/pck.ads
+++ b/gdb/testsuite/gdb.ada/huge/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/import.exp b/gdb/testsuite/gdb.ada/import.exp
index 04bb7e1..6011def 100644
--- a/gdb/testsuite/gdb.ada/import.exp
+++ b/gdb/testsuite/gdb.ada/import.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ require allow_ada_tests
# declarations only") is required. The commit makes sure that file-scope
# function and variable declarations are emitted in dwarf. This allows the
# description of imported entries, making them available to the debugger.
-require {expr [gcc_major_version] >= 8}
+require {expr {[gcc_major_version] >= 8}}
standard_ada_testfile prog
@@ -36,7 +36,7 @@ if {[gdb_compile "${csrcfile}" "${cobject}" object debug] != ""} {
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable \
[list debug additional_flags=-largs \
additional_flags=${cobject} additional_flags=-margs]] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
@@ -54,6 +54,9 @@ gdb_test "print pkg.imported_var_ada" " = 42"
gdb_test "print pkg.exported_var_ada" " = 99"
gdb_test "print exported_var_ada" " = 99"
+gdb_breakpoint "local_imported_func" message
+gdb_test "print copy" " = 42"
+
# This passes with gcc 10 but fails with gcc 9. With gcc 9, we have:
# <1><1659>: Abbrev Number: 4 (DW_TAG_subprogram)
# <165a> DW_AT_external : 1
@@ -76,19 +79,16 @@ gdb_test "print exported_var_ada" " = 99"
# The fact that things start to work when adding the DW_AT_declaration is
# consistent with what is described in commit ff9baa5f1c5, so xfail this
# (without pinpointing it to a specific gcc PR or commit).
-if { [gcc_major_version] < 10 } {
- setup_xfail *-*-*
-}
-gdb_breakpoint "pkg.imported_func_ada" message
-gdb_breakpoint "imported_func" message
-if { [gcc_major_version] < 10 } {
- setup_xfail *-*-*
+foreach func {"pkg.imported_func_ada" "imported_func"} {
+ clean_restart $testfile
+ if { [gcc_major_version] < 10 } {
+ setup_xfail *-*-*
+ }
+ gdb_breakpoint $func message
}
-gdb_breakpoint "imported_func_ada" message
-gdb_breakpoint "local_imported_func" message
-gdb_breakpoint "pkg.exported_func_ada" message
-gdb_breakpoint "exported_func_ada" message
-gdb_breakpoint "exported_func" message
-
-gdb_test "print copy" " = 42"
+foreach func {"imported_func_ada" "pkg.exported_func_ada" \
+ "exported_func_ada" "exported_func"} {
+ clean_restart $testfile
+ gdb_breakpoint $func message
+}
diff --git a/gdb/testsuite/gdb.ada/import/inc.c b/gdb/testsuite/gdb.ada/import/inc.c
index 5688ff8..1c6e545 100644
--- a/gdb/testsuite/gdb.ada/import/inc.c
+++ b/gdb/testsuite/gdb.ada/import/inc.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.ada/import/pkg.adb b/gdb/testsuite/gdb.ada/import/pkg.adb
index fc59ee8..74c8b08 100644
--- a/gdb/testsuite/gdb.ada/import/pkg.adb
+++ b/gdb/testsuite/gdb.ada/import/pkg.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/import/pkg.ads b/gdb/testsuite/gdb.ada/import/pkg.ads
index 6bc7d54..3af89a9 100644
--- a/gdb/testsuite/gdb.ada/import/pkg.ads
+++ b/gdb/testsuite/gdb.ada/import/pkg.ads
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/import/prog.adb b/gdb/testsuite/gdb.ada/import/prog.adb
index 130aa72..347c5d4 100644
--- a/gdb/testsuite/gdb.ada/import/prog.adb
+++ b/gdb/testsuite/gdb.ada/import/prog.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/info_addr_mixed_case.exp b/gdb/testsuite/gdb.ada/info_addr_mixed_case.exp
index fb5a269..998a4a9 100644
--- a/gdb/testsuite/gdb.ada/info_addr_mixed_case.exp
+++ b/gdb/testsuite/gdb.ada/info_addr_mixed_case.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/info_addr_mixed_case/foo.adb b/gdb/testsuite/gdb.ada/info_addr_mixed_case/foo.adb
index 4db21c0..afc67ed 100644
--- a/gdb/testsuite/gdb.ada/info_addr_mixed_case/foo.adb
+++ b/gdb/testsuite/gdb.ada/info_addr_mixed_case/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/info_addr_mixed_case/pck.adb b/gdb/testsuite/gdb.ada/info_addr_mixed_case/pck.adb
index 74d0be1..656c81e 100644
--- a/gdb/testsuite/gdb.ada/info_addr_mixed_case/pck.adb
+++ b/gdb/testsuite/gdb.ada/info_addr_mixed_case/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/info_addr_mixed_case/pck.ads b/gdb/testsuite/gdb.ada/info_addr_mixed_case/pck.ads
index 75a725f..af0c2aa 100644
--- a/gdb/testsuite/gdb.ada/info_addr_mixed_case/pck.ads
+++ b/gdb/testsuite/gdb.ada/info_addr_mixed_case/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/info_auto_lang.exp b/gdb/testsuite/gdb.ada/info_auto_lang.exp
index e15232d..ea561e7 100644
--- a/gdb/testsuite/gdb.ada/info_auto_lang.exp
+++ b/gdb/testsuite/gdb.ada/info_auto_lang.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,11 +35,11 @@ set cobject [standard_output_file ${cfile}.o]
if { [gdb_compile "${csrcfile}" "${cobject}" object [list debug]] != "" } {
untested "failed to compile"
- return -1
+ return
}
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
untested "failed to compile"
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/info_auto_lang/global_pack.ads b/gdb/testsuite/gdb.ada/info_auto_lang/global_pack.ads
index 9aa3aa7..54f7a60 100644
--- a/gdb/testsuite/gdb.ada/info_auto_lang/global_pack.ads
+++ b/gdb/testsuite/gdb.ada/info_auto_lang/global_pack.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/info_auto_lang/proc_in_ada.adb b/gdb/testsuite/gdb.ada/info_auto_lang/proc_in_ada.adb
index 01560e6..6a12ac5 100644
--- a/gdb/testsuite/gdb.ada/info_auto_lang/proc_in_ada.adb
+++ b/gdb/testsuite/gdb.ada/info_auto_lang/proc_in_ada.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/info_auto_lang/some_c.c b/gdb/testsuite/gdb.ada/info_auto_lang/some_c.c
index 536e6fa..00755b0 100644
--- a/gdb/testsuite/gdb.ada/info_auto_lang/some_c.c
+++ b/gdb/testsuite/gdb.ada/info_auto_lang/some_c.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/info_exc.exp b/gdb/testsuite/gdb.ada/info_exc.exp
index 997d847..b3ed995 100644
--- a/gdb/testsuite/gdb.ada/info_exc.exp
+++ b/gdb/testsuite/gdb.ada/info_exc.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,13 +20,13 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
if {![runto_main]} {
- return 0
+ return
}
gdb_test "info exceptions" \
diff --git a/gdb/testsuite/gdb.ada/info_exc/const.ads b/gdb/testsuite/gdb.ada/info_exc/const.ads
index 9f525d6..1f48e87 100644
--- a/gdb/testsuite/gdb.ada/info_exc/const.ads
+++ b/gdb/testsuite/gdb.ada/info_exc/const.ads
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/info_exc/foo.adb b/gdb/testsuite/gdb.ada/info_exc/foo.adb
index 7dca0f1..f24cdcf 100644
--- a/gdb/testsuite/gdb.ada/info_exc/foo.adb
+++ b/gdb/testsuite/gdb.ada/info_exc/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/info_locals_renaming.exp b/gdb/testsuite/gdb.ada/info_locals_renaming.exp
index 885d7d9..9c33e94 100644
--- a/gdb/testsuite/gdb.ada/info_locals_renaming.exp
+++ b/gdb/testsuite/gdb.ada/info_locals_renaming.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/info_locals_renaming/foo.adb b/gdb/testsuite/gdb.ada/info_locals_renaming/foo.adb
index 274c460..996fcf2 100644
--- a/gdb/testsuite/gdb.ada/info_locals_renaming/foo.adb
+++ b/gdb/testsuite/gdb.ada/info_locals_renaming/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/info_locals_renaming/pck.adb b/gdb/testsuite/gdb.ada/info_locals_renaming/pck.adb
index 59eb795..b779e2a 100644
--- a/gdb/testsuite/gdb.ada/info_locals_renaming/pck.adb
+++ b/gdb/testsuite/gdb.ada/info_locals_renaming/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/info_locals_renaming/pck.ads b/gdb/testsuite/gdb.ada/info_locals_renaming/pck.ads
index 45074f1..01708e8 100644
--- a/gdb/testsuite/gdb.ada/info_locals_renaming/pck.ads
+++ b/gdb/testsuite/gdb.ada/info_locals_renaming/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/info_types.c b/gdb/testsuite/gdb.ada/info_types.c
index 6f6980f..34c7447 100644
--- a/gdb/testsuite/gdb.ada/info_types.c
+++ b/gdb/testsuite/gdb.ada/info_types.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/info_types.exp b/gdb/testsuite/gdb.ada/info_types.exp
index 80bcec0..24d7c8f 100644
--- a/gdb/testsuite/gdb.ada/info_types.exp
+++ b/gdb/testsuite/gdb.ada/info_types.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ require allow_ada_tests
standard_testfile .c
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
- return -1
+ return
}
# Force the language to Ada. We used a C program because it was trivial
diff --git a/gdb/testsuite/gdb.ada/inline-section-gc.exp b/gdb/testsuite/gdb.ada/inline-section-gc.exp
index 78539aa..5e9105e 100644
--- a/gdb/testsuite/gdb.ada/inline-section-gc.exp
+++ b/gdb/testsuite/gdb.ada/inline-section-gc.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ set options {
additional_flags=-margs
}
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $options] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/inline-section-gc/callee.adb b/gdb/testsuite/gdb.ada/inline-section-gc/callee.adb
index 97e4622..6479158 100644
--- a/gdb/testsuite/gdb.ada/inline-section-gc/callee.adb
+++ b/gdb/testsuite/gdb.ada/inline-section-gc/callee.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/inline-section-gc/callee.ads b/gdb/testsuite/gdb.ada/inline-section-gc/callee.ads
index 9924dce..60ee837 100644
--- a/gdb/testsuite/gdb.ada/inline-section-gc/callee.ads
+++ b/gdb/testsuite/gdb.ada/inline-section-gc/callee.ads
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/inline-section-gc/caller.adb b/gdb/testsuite/gdb.ada/inline-section-gc/caller.adb
index 1c61d9e..aadd002 100644
--- a/gdb/testsuite/gdb.ada/inline-section-gc/caller.adb
+++ b/gdb/testsuite/gdb.ada/inline-section-gc/caller.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/int_deref.exp b/gdb/testsuite/gdb.ada/int_deref.exp
index faff596..c3ecea8 100644
--- a/gdb/testsuite/gdb.ada/int_deref.exp
+++ b/gdb/testsuite/gdb.ada/int_deref.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/int_deref/foo.adb b/gdb/testsuite/gdb.ada/int_deref/foo.adb
index 8bcdad2..e85168a 100644
--- a/gdb/testsuite/gdb.ada/int_deref/foo.adb
+++ b/gdb/testsuite/gdb.ada/int_deref/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/int_deref/pck.ads b/gdb/testsuite/gdb.ada/int_deref/pck.ads
index b8f1b7c..a525c23 100644
--- a/gdb/testsuite/gdb.ada/int_deref/pck.ads
+++ b/gdb/testsuite/gdb.ada/int_deref/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/interface.exp b/gdb/testsuite/gdb.ada/interface.exp
index 704d647..e038c47 100644
--- a/gdb/testsuite/gdb.ada/interface.exp
+++ b/gdb/testsuite/gdb.ada/interface.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ require gnat_runtime_has_debug_info
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnat05 ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/interface/foo.adb b/gdb/testsuite/gdb.ada/interface/foo.adb
index 9516a3b..0c0da6d 100644
--- a/gdb/testsuite/gdb.ada/interface/foo.adb
+++ b/gdb/testsuite/gdb.ada/interface/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/interface/types.adb b/gdb/testsuite/gdb.ada/interface/types.adb
index 9b1eb49..43d54e1 100644
--- a/gdb/testsuite/gdb.ada/interface/types.adb
+++ b/gdb/testsuite/gdb.ada/interface/types.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/interface/types.ads b/gdb/testsuite/gdb.ada/interface/types.ads
index 1918391..e0fdaba 100644
--- a/gdb/testsuite/gdb.ada/interface/types.ads
+++ b/gdb/testsuite/gdb.ada/interface/types.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/iterated-assign.exp b/gdb/testsuite/gdb.ada/iterated-assign.exp
index 76b038f..fcee906 100644
--- a/gdb/testsuite/gdb.ada/iterated-assign.exp
+++ b/gdb/testsuite/gdb.ada/iterated-assign.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile main
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/iterated-assign/main.adb b/gdb/testsuite/gdb.ada/iterated-assign/main.adb
index 239c22c..c6a6254 100644
--- a/gdb/testsuite/gdb.ada/iterated-assign/main.adb
+++ b/gdb/testsuite/gdb.ada/iterated-assign/main.adb
@@ -1,4 +1,4 @@
--- Copyright 2024 Free Software Foundation, Inc.
+-- Copyright 2024-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/iterated-assign/pck.adb b/gdb/testsuite/gdb.ada/iterated-assign/pck.adb
index 14580e6..7863563 100644
--- a/gdb/testsuite/gdb.ada/iterated-assign/pck.adb
+++ b/gdb/testsuite/gdb.ada/iterated-assign/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2024 Free Software Foundation, Inc.
+-- Copyright 2024-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/iterated-assign/pck.ads b/gdb/testsuite/gdb.ada/iterated-assign/pck.ads
index b77af72..ee3705df 100644
--- a/gdb/testsuite/gdb.ada/iterated-assign/pck.ads
+++ b/gdb/testsuite/gdb.ada/iterated-assign/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2024 Free Software Foundation, Inc.
+-- Copyright 2024-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/iwide.exp b/gdb/testsuite/gdb.ada/iwide.exp
index 2f69316..a2a049f 100644
--- a/gdb/testsuite/gdb.ada/iwide.exp
+++ b/gdb/testsuite/gdb.ada/iwide.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ require gnat_runtime_has_debug_info
standard_ada_testfile p
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnat05 ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/iwide/classes.adb b/gdb/testsuite/gdb.ada/iwide/classes.adb
index 10b87be..6c17a9f 100644
--- a/gdb/testsuite/gdb.ada/iwide/classes.adb
+++ b/gdb/testsuite/gdb.ada/iwide/classes.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/iwide/classes.ads b/gdb/testsuite/gdb.ada/iwide/classes.ads
index ce804c2..522fc22 100644
--- a/gdb/testsuite/gdb.ada/iwide/classes.ads
+++ b/gdb/testsuite/gdb.ada/iwide/classes.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/iwide/p.adb b/gdb/testsuite/gdb.ada/iwide/p.adb
index 55c266a..686ed6d 100644
--- a/gdb/testsuite/gdb.ada/iwide/p.adb
+++ b/gdb/testsuite/gdb.ada/iwide/p.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/lang_switch.exp b/gdb/testsuite/gdb.ada/lang_switch.exp
index 7064c1e..70f5d0b 100644
--- a/gdb/testsuite/gdb.ada/lang_switch.exp
+++ b/gdb/testsuite/gdb.ada/lang_switch.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ set cobject [standard_output_file ${cfile}.o]
gdb_compile "${csrcfile}" "${cobject}" object [list debug]
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/lang_switch/foo.c b/gdb/testsuite/gdb.ada/lang_switch/foo.c
index 7842258..512bc15 100644
--- a/gdb/testsuite/gdb.ada/lang_switch/foo.c
+++ b/gdb/testsuite/gdb.ada/lang_switch/foo.c
@@ -1,4 +1,4 @@
-/* Copyright 2008-2024 Free Software Foundation, Inc.
+/* Copyright 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.ada/lang_switch/lang_switch.adb b/gdb/testsuite/gdb.ada/lang_switch/lang_switch.adb
index b303d69..4e9b715 100644
--- a/gdb/testsuite/gdb.ada/lang_switch/lang_switch.adb
+++ b/gdb/testsuite/gdb.ada/lang_switch/lang_switch.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/lazy-string.exp b/gdb/testsuite/gdb.ada/lazy-string.exp
index 553e2b5..2ec5065 100644
--- a/gdb/testsuite/gdb.ada/lazy-string.exp
+++ b/gdb/testsuite/gdb.ada/lazy-string.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ standard_ada_testfile main
setenv LC_ALL C.UTF-8
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/lazy-string/main.adb b/gdb/testsuite/gdb.ada/lazy-string/main.adb
index b5ccd01..8e441a2 100644
--- a/gdb/testsuite/gdb.ada/lazy-string/main.adb
+++ b/gdb/testsuite/gdb.ada/lazy-string/main.adb
@@ -1,4 +1,4 @@
--- Copyright 2024 Free Software Foundation, Inc.
+-- Copyright 2024-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/length_cond.exp b/gdb/testsuite/gdb.ada/length_cond.exp
index f0a07a1..12ccc00 100644
--- a/gdb/testsuite/gdb.ada/length_cond.exp
+++ b/gdb/testsuite/gdb.ada/length_cond.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ require allow_ada_tests
standard_ada_testfile length_cond
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/length_cond/length_cond.adb b/gdb/testsuite/gdb.ada/length_cond/length_cond.adb
index 561dc7a..33687b0 100644
--- a/gdb/testsuite/gdb.ada/length_cond/length_cond.adb
+++ b/gdb/testsuite/gdb.ada/length_cond/length_cond.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/length_cond/pck.adb b/gdb/testsuite/gdb.ada/length_cond/pck.adb
index e4c9ce3..50c6059 100644
--- a/gdb/testsuite/gdb.ada/length_cond/pck.adb
+++ b/gdb/testsuite/gdb.ada/length_cond/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/length_cond/pck.ads b/gdb/testsuite/gdb.ada/length_cond/pck.ads
index 096308c..a7eadc8 100644
--- a/gdb/testsuite/gdb.ada/length_cond/pck.ads
+++ b/gdb/testsuite/gdb.ada/length_cond/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/limited-length.exp b/gdb/testsuite/gdb.ada/limited-length.exp
index d0e912b..3e8b663 100644
--- a/gdb/testsuite/gdb.ada/limited-length.exp
+++ b/gdb/testsuite/gdb.ada/limited-length.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable \
[list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
@@ -70,7 +70,7 @@ with_test_prefix "with standard max-value size" {
# Set the max-value-size so we can only print 33 elements.
set elements 33
set elem_size [get_valueof "/d" "(Large_1d_Array(1)'Size + 7) / 8" "*unknown*"]
-gdb_test_no_output "set max-value-size [expr $elem_size * $elements]"
+gdb_test_no_output "set max-value-size [expr {$elem_size * $elements}]"
with_test_prefix "with reduced max-value size" {
# GNAT historically named this type, but as the array type is
diff --git a/gdb/testsuite/gdb.ada/limited-length/foo.adb b/gdb/testsuite/gdb.ada/limited-length/foo.adb
index f90d4e2..b269ce2 100644
--- a/gdb/testsuite/gdb.ada/limited-length/foo.adb
+++ b/gdb/testsuite/gdb.ada/limited-length/foo.adb
@@ -1,6 +1,6 @@
-- This testcase is part of GDB, the GNU debugger.
--
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/limited-length/pck.adb b/gdb/testsuite/gdb.ada/limited-length/pck.adb
index 33a3e7d..d78fd5a 100644
--- a/gdb/testsuite/gdb.ada/limited-length/pck.adb
+++ b/gdb/testsuite/gdb.ada/limited-length/pck.adb
@@ -1,6 +1,6 @@
-- This testcase is part of GDB, the GNU debugger.
--
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/limited-length/pck.ads b/gdb/testsuite/gdb.ada/limited-length/pck.ads
index 8a2101e..6de0a38 100644
--- a/gdb/testsuite/gdb.ada/limited-length/pck.ads
+++ b/gdb/testsuite/gdb.ada/limited-length/pck.ads
@@ -1,6 +1,6 @@
-- This testcase is part of GDB, the GNU debugger.
--
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/literals.exp b/gdb/testsuite/gdb.ada/literals.exp
index 793ebd2..5be6829 100644
--- a/gdb/testsuite/gdb.ada/literals.exp
+++ b/gdb/testsuite/gdb.ada/literals.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/local-enum.exp b/gdb/testsuite/gdb.ada/local-enum.exp
index b1dfd11..cb071ea 100644
--- a/gdb/testsuite/gdb.ada/local-enum.exp
+++ b/gdb/testsuite/gdb.ada/local-enum.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile local
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/local-enum/pck.adb b/gdb/testsuite/gdb.ada/local-enum/pck.adb
index a175b7b..d29c5da 100644
--- a/gdb/testsuite/gdb.ada/local-enum/pck.adb
+++ b/gdb/testsuite/gdb.ada/local-enum/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/local-enum/pck.ads b/gdb/testsuite/gdb.ada/local-enum/pck.ads
index 384bf08..02fc1c8 100644
--- a/gdb/testsuite/gdb.ada/local-enum/pck.ads
+++ b/gdb/testsuite/gdb.ada/local-enum/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/maint_with_ada.exp b/gdb/testsuite/gdb.ada/maint_with_ada.exp
index 063213d..a03371f 100644
--- a/gdb/testsuite/gdb.ada/maint_with_ada.exp
+++ b/gdb/testsuite/gdb.ada/maint_with_ada.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile var_arr_typedef
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/maint_with_ada/pack.adb b/gdb/testsuite/gdb.ada/maint_with_ada/pack.adb
index 491598b..2f9114a 100644
--- a/gdb/testsuite/gdb.ada/maint_with_ada/pack.adb
+++ b/gdb/testsuite/gdb.ada/maint_with_ada/pack.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/maint_with_ada/pack.ads b/gdb/testsuite/gdb.ada/maint_with_ada/pack.ads
index b777117..2ceb071 100644
--- a/gdb/testsuite/gdb.ada/maint_with_ada/pack.ads
+++ b/gdb/testsuite/gdb.ada/maint_with_ada/pack.ads
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/maint_with_ada/var_arr_typedef.adb b/gdb/testsuite/gdb.ada/maint_with_ada/var_arr_typedef.adb
index af71387..4a7f4cb 100644
--- a/gdb/testsuite/gdb.ada/maint_with_ada/var_arr_typedef.adb
+++ b/gdb/testsuite/gdb.ada/maint_with_ada/var_arr_typedef.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_catch_assert.exp b/gdb/testsuite/gdb.ada/mi_catch_assert.exp
index cff4307..d011ca5 100644
--- a/gdb/testsuite/gdb.ada/mi_catch_assert.exp
+++ b/gdb/testsuite/gdb.ada/mi_catch_assert.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,13 +20,13 @@ require allow_ada_tests gnat_runtime_has_debug_info
standard_ada_testfile bla
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnata ]] != "" } {
- return -1
+ return
}
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
###################################################
# 2. Try catching conditionnal failed assertion. #
@@ -39,7 +39,7 @@ mi_clean_restart $binfile
# - continue, the program exits.
if {[mi_runto_main] < 0} {
- return 0
+ return
}
mi_gdb_test "-catch-assert -c \"Global_Var = 2\"" \
diff --git a/gdb/testsuite/gdb.ada/mi_catch_assert/bla.adb b/gdb/testsuite/gdb.ada/mi_catch_assert/bla.adb
index c0cc04b..d862b9b 100644
--- a/gdb/testsuite/gdb.ada/mi_catch_assert/bla.adb
+++ b/gdb/testsuite/gdb.ada/mi_catch_assert/bla.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_catch_assert/pck.ads b/gdb/testsuite/gdb.ada/mi_catch_assert/pck.ads
index e74feaa..62409d5 100644
--- a/gdb/testsuite/gdb.ada/mi_catch_assert/pck.ads
+++ b/gdb/testsuite/gdb.ada/mi_catch_assert/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_catch_ex.exp b/gdb/testsuite/gdb.ada/mi_catch_ex.exp
index 271f7fb..974da0d 100644
--- a/gdb/testsuite/gdb.ada/mi_catch_ex.exp
+++ b/gdb/testsuite/gdb.ada/mi_catch_ex.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests gnat_runtime_has_debug_info
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnata ]] != "" } {
- return -1
+ return
}
# A global variable used to simplify the maintenance of some of
@@ -30,7 +30,7 @@ set any_nb "\[0-9\]+"
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
####################################
# 1. Try catching all exceptions. #
@@ -38,7 +38,7 @@ mi_clean_restart $binfile
with_test_prefix "scenario 1" {
if {[mi_runto_main] < 0} {
- return 0
+ return
}
}
@@ -59,7 +59,7 @@ proc continue_to_exception { exception_name exception_message test } {
}
timeout {
fail "$test (timeout)"
- return -1
+ return
}
}
@@ -96,7 +96,7 @@ continue_to_exception \
with_test_prefix "scenario 2" {
mi_delete_breakpoints
if {[mi_runto_main] < 0} {
- return 0
+ return
}
}
diff --git a/gdb/testsuite/gdb.ada/mi_catch_ex/foo.adb b/gdb/testsuite/gdb.ada/mi_catch_ex/foo.adb
index d1ac7df..686ab4c 100644
--- a/gdb/testsuite/gdb.ada/mi_catch_ex/foo.adb
+++ b/gdb/testsuite/gdb.ada/mi_catch_ex/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp b/gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp
index 88b761d..f853f6b 100644
--- a/gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp
+++ b/gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,13 +20,13 @@ require allow_ada_tests gnat_runtime_has_debug_info
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnata ]] != "" } {
- return -1
+ return
}
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
#############################################
# 1. Try catching all exceptions handlers. #
@@ -34,7 +34,7 @@ mi_clean_restart $binfile
with_test_prefix "scenario 1" {
if {[mi_runto_main] < 0} {
- return 0
+ return
}
}
@@ -86,7 +86,7 @@ continue_to_exception_handler \
with_test_prefix "scenario 2" {
mi_delete_breakpoints
if {[mi_runto_main] < 0} {
- return 0
+ return
}
}
diff --git a/gdb/testsuite/gdb.ada/mi_catch_ex_hand/foo.adb b/gdb/testsuite/gdb.ada/mi_catch_ex_hand/foo.adb
index 849e5dc..b3af132 100644
--- a/gdb/testsuite/gdb.ada/mi_catch_ex_hand/foo.adb
+++ b/gdb/testsuite/gdb.ada/mi_catch_ex_hand/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_dyn_arr.exp b/gdb/testsuite/gdb.ada/mi_dyn_arr.exp
index c7e9818..6dded25 100644
--- a/gdb/testsuite/gdb.ada/mi_dyn_arr.exp
+++ b/gdb/testsuite/gdb.ada/mi_dyn_arr.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,16 +20,16 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
if {[mi_runto_main] < 0} {
- return 0
+ return
}
set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.adb]
diff --git a/gdb/testsuite/gdb.ada/mi_dyn_arr/foo.adb b/gdb/testsuite/gdb.ada/mi_dyn_arr/foo.adb
index 286a28d..f56a0d3 100644
--- a/gdb/testsuite/gdb.ada/mi_dyn_arr/foo.adb
+++ b/gdb/testsuite/gdb.ada/mi_dyn_arr/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_dyn_arr/pck.adb b/gdb/testsuite/gdb.ada/mi_dyn_arr/pck.adb
index 4dd8c58..5290d25 100644
--- a/gdb/testsuite/gdb.ada/mi_dyn_arr/pck.adb
+++ b/gdb/testsuite/gdb.ada/mi_dyn_arr/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_dyn_arr/pck.ads b/gdb/testsuite/gdb.ada/mi_dyn_arr/pck.ads
index 8935cc0..04f69f3 100644
--- a/gdb/testsuite/gdb.ada/mi_dyn_arr/pck.ads
+++ b/gdb/testsuite/gdb.ada/mi_dyn_arr/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_ex_cond.exp b/gdb/testsuite/gdb.ada/mi_ex_cond.exp
index 4f3aef3..51bea38 100644
--- a/gdb/testsuite/gdb.ada/mi_ex_cond.exp
+++ b/gdb/testsuite/gdb.ada/mi_ex_cond.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests gnat_runtime_has_debug_info
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-bargs additional_flags=-static additional_flags=-margs ]] != "" } {
- return -1
+ return
}
# A global variable used to simplify the maintenance of some of
@@ -30,7 +30,7 @@ set any_nb "\[0-9\]+"
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.ada/mi_ex_cond/foo.adb b/gdb/testsuite/gdb.ada/mi_ex_cond/foo.adb
index 9f7d220..dd4236a 100644
--- a/gdb/testsuite/gdb.ada/mi_ex_cond/foo.adb
+++ b/gdb/testsuite/gdb.ada/mi_ex_cond/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_ex_cond/pck.ads b/gdb/testsuite/gdb.ada/mi_ex_cond/pck.ads
index cb34498..99d4bb7 100644
--- a/gdb/testsuite/gdb.ada/mi_ex_cond/pck.ads
+++ b/gdb/testsuite/gdb.ada/mi_ex_cond/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_exc_info.exp b/gdb/testsuite/gdb.ada/mi_exc_info.exp
index f35fb76..5358fcf 100644
--- a/gdb/testsuite/gdb.ada/mi_exc_info.exp
+++ b/gdb/testsuite/gdb.ada/mi_exc_info.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,16 +20,16 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
if {[mi_runto_main] < 0} {
- return 0
+ return
}
mi_delete_breakpoints
diff --git a/gdb/testsuite/gdb.ada/mi_exc_info/const.ads b/gdb/testsuite/gdb.ada/mi_exc_info/const.ads
index 9f525d6..1f48e87 100644
--- a/gdb/testsuite/gdb.ada/mi_exc_info/const.ads
+++ b/gdb/testsuite/gdb.ada/mi_exc_info/const.ads
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_exc_info/foo.adb b/gdb/testsuite/gdb.ada/mi_exc_info/foo.adb
index 7dca0f1..f24cdcf 100644
--- a/gdb/testsuite/gdb.ada/mi_exc_info/foo.adb
+++ b/gdb/testsuite/gdb.ada/mi_exc_info/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_interface.exp b/gdb/testsuite/gdb.ada/mi_interface.exp
index ff4f769..e638f97 100644
--- a/gdb/testsuite/gdb.ada/mi_interface.exp
+++ b/gdb/testsuite/gdb.ada/mi_interface.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,16 +22,16 @@ require gnat_runtime_has_debug_info
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnat12 ]] != "" } {
- return -1
+ return
}
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
if {[mi_runto_main] < 0} {
- return 0
+ return
}
set bp_location [gdb_get_line_number "BREAK" ${testdir}/foo.adb]
diff --git a/gdb/testsuite/gdb.ada/mi_interface/foo.adb b/gdb/testsuite/gdb.ada/mi_interface/foo.adb
index 352535d..1204eed 100644
--- a/gdb/testsuite/gdb.ada/mi_interface/foo.adb
+++ b/gdb/testsuite/gdb.ada/mi_interface/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_interface/pck.adb b/gdb/testsuite/gdb.ada/mi_interface/pck.adb
index a175b7b..d29c5da 100644
--- a/gdb/testsuite/gdb.ada/mi_interface/pck.adb
+++ b/gdb/testsuite/gdb.ada/mi_interface/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_interface/pck.ads b/gdb/testsuite/gdb.ada/mi_interface/pck.ads
index e3d72c2..53a0db2 100644
--- a/gdb/testsuite/gdb.ada/mi_interface/pck.ads
+++ b/gdb/testsuite/gdb.ada/mi_interface/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_prot.exp b/gdb/testsuite/gdb.ada/mi_prot.exp
index 8525c1f..5e3f160 100644
--- a/gdb/testsuite/gdb.ada/mi_prot.exp
+++ b/gdb/testsuite/gdb.ada/mi_prot.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,16 +22,16 @@ standard_ada_testfile prot
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable \
{debug additional_flags=-gnata}] != ""} {
- return -1
+ return
}
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
if {[mi_runto_main] < 0} {
- return 0
+ return
}
mi_delete_breakpoints
diff --git a/gdb/testsuite/gdb.ada/mi_prot/pkg.adb b/gdb/testsuite/gdb.ada/mi_prot/pkg.adb
index 770f1c1..052236e 100644
--- a/gdb/testsuite/gdb.ada/mi_prot/pkg.adb
+++ b/gdb/testsuite/gdb.ada/mi_prot/pkg.adb
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_prot/pkg.ads b/gdb/testsuite/gdb.ada/mi_prot/pkg.ads
index 58effdd..570cd6e 100644
--- a/gdb/testsuite/gdb.ada/mi_prot/pkg.ads
+++ b/gdb/testsuite/gdb.ada/mi_prot/pkg.ads
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_prot/prot.adb b/gdb/testsuite/gdb.ada/mi_prot/prot.adb
index 6e35bf4..2a843c9 100644
--- a/gdb/testsuite/gdb.ada/mi_prot/prot.adb
+++ b/gdb/testsuite/gdb.ada/mi_prot/prot.adb
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_ref_changeable.exp b/gdb/testsuite/gdb.ada/mi_ref_changeable.exp
index 6b0f235..a2813d4 100644
--- a/gdb/testsuite/gdb.ada/mi_ref_changeable.exp
+++ b/gdb/testsuite/gdb.ada/mi_ref_changeable.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,16 +20,16 @@ require allow_ada_tests
standard_ada_testfile foo_rb20_056
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
if {[mi_runto_main] < 0} {
- return 0
+ return
}
# Continue until STOP_1, and create a varobj for variables "A" and "B".
diff --git a/gdb/testsuite/gdb.ada/mi_ref_changeable/foo_rb20_056.adb b/gdb/testsuite/gdb.ada/mi_ref_changeable/foo_rb20_056.adb
index f19f51f..402b922 100644
--- a/gdb/testsuite/gdb.ada/mi_ref_changeable/foo_rb20_056.adb
+++ b/gdb/testsuite/gdb.ada/mi_ref_changeable/foo_rb20_056.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_ref_changeable/pck.adb b/gdb/testsuite/gdb.ada/mi_ref_changeable/pck.adb
index 1d3bb7b..9e137b1 100644
--- a/gdb/testsuite/gdb.ada/mi_ref_changeable/pck.adb
+++ b/gdb/testsuite/gdb.ada/mi_ref_changeable/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_ref_changeable/pck.ads b/gdb/testsuite/gdb.ada/mi_ref_changeable/pck.ads
index d3bcfd2..9cbfdef 100644
--- a/gdb/testsuite/gdb.ada/mi_ref_changeable/pck.ads
+++ b/gdb/testsuite/gdb.ada/mi_ref_changeable/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_string_access.exp b/gdb/testsuite/gdb.ada/mi_string_access.exp
index 59a7ad6..3a54e94 100644
--- a/gdb/testsuite/gdb.ada/mi_string_access.exp
+++ b/gdb/testsuite/gdb.ada/mi_string_access.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,13 +26,13 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
- mi_clean_restart $binfile-$scenario
+ mi_clean_restart $::testfile-$scenario
if {[mi_runto_main] < 0} {
- return 0
+ return
}
set bp_location [gdb_get_line_number "STOP" ${testdir}/bar.adb]
diff --git a/gdb/testsuite/gdb.ada/mi_string_access/bar.adb b/gdb/testsuite/gdb.ada/mi_string_access/bar.adb
index c3608f0..128bbee 100644
--- a/gdb/testsuite/gdb.ada/mi_string_access/bar.adb
+++ b/gdb/testsuite/gdb.ada/mi_string_access/bar.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_string_access/pck.adb b/gdb/testsuite/gdb.ada/mi_string_access/pck.adb
index 7b68d2a..3ced0c2 100644
--- a/gdb/testsuite/gdb.ada/mi_string_access/pck.adb
+++ b/gdb/testsuite/gdb.ada/mi_string_access/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_string_access/pck.ads b/gdb/testsuite/gdb.ada/mi_string_access/pck.ads
index f39ba81..4e6f44f 100644
--- a/gdb/testsuite/gdb.ada/mi_string_access/pck.ads
+++ b/gdb/testsuite/gdb.ada/mi_string_access/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_task_arg.exp b/gdb/testsuite/gdb.ada/mi_task_arg.exp
index b4b7b49..31ef7d0 100644
--- a/gdb/testsuite/gdb.ada/mi_task_arg.exp
+++ b/gdb/testsuite/gdb.ada/mi_task_arg.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,13 +20,13 @@ require allow_ada_tests
standard_ada_testfile task_switch
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnata ]] != "" } {
- return -1
+ return
}
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
@@ -34,7 +34,7 @@ if {[mi_clean_restart $binfile]} {
mi_gdb_test "-gdb-set debug-file-directory \"\"" ".*"
if {![mi_runto "task_switch.break_me"]} {
- return 0
+ return
}
# Verify that "-stack-list-arguments" does not cause the debugger to
diff --git a/gdb/testsuite/gdb.ada/mi_task_arg/task_switch.adb b/gdb/testsuite/gdb.ada/mi_task_arg/task_switch.adb
index e59c2b8..dd8328b 100644
--- a/gdb/testsuite/gdb.ada/mi_task_arg/task_switch.adb
+++ b/gdb/testsuite/gdb.ada/mi_task_arg/task_switch.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_task_info.exp b/gdb/testsuite/gdb.ada/mi_task_info.exp
index 7cf5a7e..3b1a37e 100644
--- a/gdb/testsuite/gdb.ada/mi_task_info.exp
+++ b/gdb/testsuite/gdb.ada/mi_task_info.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,13 +20,13 @@ require allow_ada_tests
standard_ada_testfile task_switch
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnata ]] != "" } {
- return -1
+ return
}
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
@@ -35,7 +35,7 @@ if {[mi_clean_restart $binfile]} {
####################################
if {![mi_runto "task_switch.break_me"]} {
- return 0
+ return
}
set ada_task_info_hdr \
diff --git a/gdb/testsuite/gdb.ada/mi_task_info/task_switch.adb b/gdb/testsuite/gdb.ada/mi_task_info/task_switch.adb
index e59c2b8..dd8328b 100644
--- a/gdb/testsuite/gdb.ada/mi_task_info/task_switch.adb
+++ b/gdb/testsuite/gdb.ada/mi_task_info/task_switch.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_var_access.exp b/gdb/testsuite/gdb.ada/mi_var_access.exp
index 1448ce3..72a7f36 100644
--- a/gdb/testsuite/gdb.ada/mi_var_access.exp
+++ b/gdb/testsuite/gdb.ada/mi_var_access.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,13 +23,13 @@ load_lib mi-support.exp
set MIFLAGS "-i=mi"
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != "" } {
- return -1
+ return
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
if {[mi_runto_main] < 0} {
- return 0
+ return
}
set bp_location [gdb_get_line_number "STOP" ${testdir}/mi_access.adb]
diff --git a/gdb/testsuite/gdb.ada/mi_var_access/mi_access.adb b/gdb/testsuite/gdb.ada/mi_var_access/mi_access.adb
index cee7f3f..3860a0a 100644
--- a/gdb/testsuite/gdb.ada/mi_var_access/mi_access.adb
+++ b/gdb/testsuite/gdb.ada/mi_var_access/mi_access.adb
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_var_access/pck.adb b/gdb/testsuite/gdb.ada/mi_var_access/pck.adb
index 91dff60..4e4dda4 100644
--- a/gdb/testsuite/gdb.ada/mi_var_access/pck.adb
+++ b/gdb/testsuite/gdb.ada/mi_var_access/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_var_access/pck.ads b/gdb/testsuite/gdb.ada/mi_var_access/pck.ads
index b3f2ecb..da43b7a 100644
--- a/gdb/testsuite/gdb.ada/mi_var_access/pck.ads
+++ b/gdb/testsuite/gdb.ada/mi_var_access/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_var_array.exp b/gdb/testsuite/gdb.ada/mi_var_array.exp
index dd770a1..15a01a5 100644
--- a/gdb/testsuite/gdb.ada/mi_var_array.exp
+++ b/gdb/testsuite/gdb.ada/mi_var_array.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,13 +26,13 @@ foreach_gnat_encoding scenario flags {none all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != "" } {
- return -1
+ return
}
- mi_clean_restart $binfile-$scenario
+ mi_clean_restart $::testfile-$scenario
if {[mi_runto_main] < 0} {
- return 0
+ return
}
set bp_location [gdb_get_line_number "STOP" ${testdir}/bar.adb]
diff --git a/gdb/testsuite/gdb.ada/mi_var_array/bar.adb b/gdb/testsuite/gdb.ada/mi_var_array/bar.adb
index a71934b..a010167 100644
--- a/gdb/testsuite/gdb.ada/mi_var_array/bar.adb
+++ b/gdb/testsuite/gdb.ada/mi_var_array/bar.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_var_array/pck.adb b/gdb/testsuite/gdb.ada/mi_var_array/pck.adb
index 7cdfe48..f62d089 100644
--- a/gdb/testsuite/gdb.ada/mi_var_array/pck.adb
+++ b/gdb/testsuite/gdb.ada/mi_var_array/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_var_array/pck.ads b/gdb/testsuite/gdb.ada/mi_var_array/pck.ads
index ecbc456..e1104fa 100644
--- a/gdb/testsuite/gdb.ada/mi_var_array/pck.ads
+++ b/gdb/testsuite/gdb.ada/mi_var_array/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_var_union.exp b/gdb/testsuite/gdb.ada/mi_var_union.exp
index 64bfe33..9ae020f 100644
--- a/gdb/testsuite/gdb.ada/mi_var_union.exp
+++ b/gdb/testsuite/gdb.ada/mi_var_union.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,13 +28,13 @@ foreach_gnat_encoding scenario flags {none all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != "" } {
- return -1
+ return
}
- mi_clean_restart $binfile-$scenario
+ mi_clean_restart $::testfile-$scenario
if {[mi_runto_main] < 0} {
- return 0
+ return
}
set bp_location [gdb_get_line_number "STOP" ${testdir}/bar.adb]
diff --git a/gdb/testsuite/gdb.ada/mi_var_union/bar.adb b/gdb/testsuite/gdb.ada/mi_var_union/bar.adb
index c6dafc3..a334bff 100644
--- a/gdb/testsuite/gdb.ada/mi_var_union/bar.adb
+++ b/gdb/testsuite/gdb.ada/mi_var_union/bar.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_var_union/pck.adb b/gdb/testsuite/gdb.ada/mi_var_union/pck.adb
index 7b68d2a..3ced0c2 100644
--- a/gdb/testsuite/gdb.ada/mi_var_union/pck.adb
+++ b/gdb/testsuite/gdb.ada/mi_var_union/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_var_union/pck.ads b/gdb/testsuite/gdb.ada/mi_var_union/pck.ads
index f39ba81..4e6f44f 100644
--- a/gdb/testsuite/gdb.ada/mi_var_union/pck.ads
+++ b/gdb/testsuite/gdb.ada/mi_var_union/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_variant.exp b/gdb/testsuite/gdb.ada/mi_variant.exp
index f4be5a0..6622cb1 100644
--- a/gdb/testsuite/gdb.ada/mi_variant.exp
+++ b/gdb/testsuite/gdb.ada/mi_variant.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,13 +27,13 @@ foreach_gnat_encoding scenario flags {none all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
- mi_clean_restart $binfile-$scenario
+ mi_clean_restart $::testfile-$scenario
if {[mi_runto_main] < 0} {
- return 0
+ return
}
set bp_location [gdb_get_line_number "STOP" ${testdir}/pkg.adb]
diff --git a/gdb/testsuite/gdb.ada/mi_variant/pck.ads b/gdb/testsuite/gdb.ada/mi_variant/pck.ads
index 25cc8d4..e01f731 100644
--- a/gdb/testsuite/gdb.ada/mi_variant/pck.ads
+++ b/gdb/testsuite/gdb.ada/mi_variant/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mi_variant/pkg.adb b/gdb/testsuite/gdb.ada/mi_variant/pkg.adb
index 1c3a6b2..4d2a828 100644
--- a/gdb/testsuite/gdb.ada/mi_variant/pkg.adb
+++ b/gdb/testsuite/gdb.ada/mi_variant/pkg.adb
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/minsyms.exp b/gdb/testsuite/gdb.ada/minsyms.exp
index 3e2c50d..2d77f6b 100644
--- a/gdb/testsuite/gdb.ada/minsyms.exp
+++ b/gdb/testsuite/gdb.ada/minsyms.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo_qb07_057
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable ""] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/minsyms/foo_qb07_057.adb b/gdb/testsuite/gdb.ada/minsyms/foo_qb07_057.adb
index e7e5ff8..3608b46 100644
--- a/gdb/testsuite/gdb.ada/minsyms/foo_qb07_057.adb
+++ b/gdb/testsuite/gdb.ada/minsyms/foo_qb07_057.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/minsyms/pck.adb b/gdb/testsuite/gdb.ada/minsyms/pck.adb
index 3db7a19..a6d3bba 100644
--- a/gdb/testsuite/gdb.ada/minsyms/pck.adb
+++ b/gdb/testsuite/gdb.ada/minsyms/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/minsyms/pck.ads b/gdb/testsuite/gdb.ada/minsyms/pck.ads
index 0151436..6c08a19 100644
--- a/gdb/testsuite/gdb.ada/minsyms/pck.ads
+++ b/gdb/testsuite/gdb.ada/minsyms/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/mod_from_name.exp b/gdb/testsuite/gdb.ada/mod_from_name.exp
index 99effb0..7303003 100644
--- a/gdb/testsuite/gdb.ada/mod_from_name.exp
+++ b/gdb/testsuite/gdb.ada/mod_from_name.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
@@ -31,7 +31,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
set bp_location [gdb_get_line_number "START" ${testdir}/foo.adb]
if {![runto "foo.adb:$bp_location"]} {
return
- }
+ }
# GNAT 9 and 10 are known to fail.
if {$scenario == "minimal"
diff --git a/gdb/testsuite/gdb.ada/mod_from_name/foo.adb b/gdb/testsuite/gdb.ada/mod_from_name/foo.adb
index b339404..a8d70d3 100644
--- a/gdb/testsuite/gdb.ada/mod_from_name/foo.adb
+++ b/gdb/testsuite/gdb.ada/mod_from_name/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2009-2024 Free Software Foundation, Inc.
+-- Copyright 2009-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/multiarray.exp b/gdb/testsuite/gdb.ada/multiarray.exp
index 91ba1ec..b56b389 100644
--- a/gdb/testsuite/gdb.ada/multiarray.exp
+++ b/gdb/testsuite/gdb.ada/multiarray.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" \
executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/multiarray/p.adb b/gdb/testsuite/gdb.ada/multiarray/p.adb
index ca568be..7c13221 100644
--- a/gdb/testsuite/gdb.ada/multiarray/p.adb
+++ b/gdb/testsuite/gdb.ada/multiarray/p.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/multiarray/pack.adb b/gdb/testsuite/gdb.ada/multiarray/pack.adb
index 767221f..7bf8395 100644
--- a/gdb/testsuite/gdb.ada/multiarray/pack.adb
+++ b/gdb/testsuite/gdb.ada/multiarray/pack.adb
@@ -1,4 +1,4 @@
--- Copyright 2024 Free Software Foundation, Inc.
+-- Copyright 2024-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/multiarray/pack.ads b/gdb/testsuite/gdb.ada/multiarray/pack.ads
index f6f0ca1..d74eaf1 100644
--- a/gdb/testsuite/gdb.ada/multiarray/pack.ads
+++ b/gdb/testsuite/gdb.ada/multiarray/pack.ads
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/n_arr_bound.exp b/gdb/testsuite/gdb.ada/n_arr_bound.exp
index 4b4a6db..3df5747 100644
--- a/gdb/testsuite/gdb.ada/n_arr_bound.exp
+++ b/gdb/testsuite/gdb.ada/n_arr_bound.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/n_arr_bound/foo.adb b/gdb/testsuite/gdb.ada/n_arr_bound/foo.adb
index 892a93a..7dd68c4 100644
--- a/gdb/testsuite/gdb.ada/n_arr_bound/foo.adb
+++ b/gdb/testsuite/gdb.ada/n_arr_bound/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/n_arr_bound/pck.adb b/gdb/testsuite/gdb.ada/n_arr_bound/pck.adb
index a175b7b..d29c5da 100644
--- a/gdb/testsuite/gdb.ada/n_arr_bound/pck.adb
+++ b/gdb/testsuite/gdb.ada/n_arr_bound/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/n_arr_bound/pck.ads b/gdb/testsuite/gdb.ada/n_arr_bound/pck.ads
index 384bf08..02fc1c8 100644
--- a/gdb/testsuite/gdb.ada/n_arr_bound/pck.ads
+++ b/gdb/testsuite/gdb.ada/n_arr_bound/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/negative-bit-offset.exp b/gdb/testsuite/gdb.ada/negative-bit-offset.exp
new file mode 100644
index 0000000..c5fcae1
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/negative-bit-offset.exp
@@ -0,0 +1,36 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test negative DW_AT_bit_offset.
+
+load_lib "ada.exp"
+
+require allow_ada_tests
+
+standard_ada_testfile prog
+
+# This particular output is only generated with -gdwarf-4.
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable \
+ {debug additional_flags=-gdwarf-4}] != ""} {
+ return
+}
+
+clean_restart ${testfile}
+
+set bp_location [gdb_get_line_number "STOP" ${testdir}/prog.adb]
+runto "prog.adb:$bp_location"
+
+gdb_test "print xp" \
+ [string_to_regexp "(x => 21, y => (-1, -2, -3, -4, -5, -6, -7, -8, -9, -10))"]
diff --git a/gdb/testsuite/gdb.ada/negative-bit-offset/prog.adb b/gdb/testsuite/gdb.ada/negative-bit-offset/prog.adb
new file mode 100644
index 0000000..e3c1775
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/negative-bit-offset/prog.adb
@@ -0,0 +1,36 @@
+-- Copyright 2025 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+procedure Prog is
+
+ type Small is range -32 .. 31;
+ for Small'Size use 6;
+
+ type SomeArray is array (POSITIVE range <>) of Small;
+
+ type SomePackedArray is array (POSITIVE range <>) of Small;
+ pragma Pack (SomePackedArray);
+
+ type SomePackedRecord is record
+ X: Small;
+ Y: SomePackedArray (1 .. 10);
+ end record;
+ pragma Pack (SomePackedRecord);
+
+ XP: SomePackedRecord := (21, (-1, -2, -3, -4, -5, -6, -7, -8, -9, -10));
+
+begin
+ null; -- STOP
+end;
diff --git a/gdb/testsuite/gdb.ada/nested.exp b/gdb/testsuite/gdb.ada/nested.exp
index 9f5cfc4..3e91e68 100644
--- a/gdb/testsuite/gdb.ada/nested.exp
+++ b/gdb/testsuite/gdb.ada/nested.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile hello
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/nested/hello.adb b/gdb/testsuite/gdb.ada/nested/hello.adb
index 437d948..eb6d9a4 100644
--- a/gdb/testsuite/gdb.ada/nested/hello.adb
+++ b/gdb/testsuite/gdb.ada/nested/hello.adb
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/non-ascii-latin-1.exp b/gdb/testsuite/gdb.ada/non-ascii-latin-1.exp
index cc5b506..e5c56b7 100644
--- a/gdb/testsuite/gdb.ada/non-ascii-latin-1.exp
+++ b/gdb/testsuite/gdb.ada/non-ascii-latin-1.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ standard_ada_testfile prog
set flags [list debug additional_flags=-gnati1]
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != ""} {
- return -1
+ return
}
# Restart without an executable so that we can set the encoding early.
diff --git a/gdb/testsuite/gdb.ada/non-ascii-latin-1/pack.adb b/gdb/testsuite/gdb.ada/non-ascii-latin-1/pack.adb
index 63f69ef..603d4ae 100644
--- a/gdb/testsuite/gdb.ada/non-ascii-latin-1/pack.adb
+++ b/gdb/testsuite/gdb.ada/non-ascii-latin-1/pack.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc. -*- coding: iso-latin-1 -*-
+-- Copyright 2022-2025 Free Software Foundation, Inc. -*- coding: iso-latin-1 -*-
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/non-ascii-latin-1/pack.ads b/gdb/testsuite/gdb.ada/non-ascii-latin-1/pack.ads
index fc5f440..6ce993d 100644
--- a/gdb/testsuite/gdb.ada/non-ascii-latin-1/pack.ads
+++ b/gdb/testsuite/gdb.ada/non-ascii-latin-1/pack.ads
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc. -*- coding: iso-latin-1 -*-
+-- Copyright 2022-2025 Free Software Foundation, Inc. -*- coding: iso-latin-1 -*-
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/non-ascii-latin-1/prog.adb b/gdb/testsuite/gdb.ada/non-ascii-latin-1/prog.adb
index 32bcc75..bb01577 100644
--- a/gdb/testsuite/gdb.ada/non-ascii-latin-1/prog.adb
+++ b/gdb/testsuite/gdb.ada/non-ascii-latin-1/prog.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc. -*- coding: iso-latin-1 -*-
+-- Copyright 2022-2025 Free Software Foundation, Inc. -*- coding: iso-latin-1 -*-
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/non-ascii-latin-3.exp b/gdb/testsuite/gdb.ada/non-ascii-latin-3.exp
index c7a3835..37be874 100644
--- a/gdb/testsuite/gdb.ada/non-ascii-latin-3.exp
+++ b/gdb/testsuite/gdb.ada/non-ascii-latin-3.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ standard_ada_testfile prog
set flags [list debug additional_flags=-gnati3]
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != ""} {
- return -1
+ return
}
# Restart without an executable so that we can set the encoding early.
diff --git a/gdb/testsuite/gdb.ada/non-ascii-latin-3/pack.adb b/gdb/testsuite/gdb.ada/non-ascii-latin-3/pack.adb
index bd3ec58..3c92ac5 100644
--- a/gdb/testsuite/gdb.ada/non-ascii-latin-3/pack.adb
+++ b/gdb/testsuite/gdb.ada/non-ascii-latin-3/pack.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc. -*- coding: iso-latin-3 -*-
+-- Copyright 2022-2025 Free Software Foundation, Inc. -*- coding: iso-latin-3 -*-
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/non-ascii-latin-3/pack.ads b/gdb/testsuite/gdb.ada/non-ascii-latin-3/pack.ads
index 6282575..bfc0211 100644
--- a/gdb/testsuite/gdb.ada/non-ascii-latin-3/pack.ads
+++ b/gdb/testsuite/gdb.ada/non-ascii-latin-3/pack.ads
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc. -*- coding: iso-latin-3 -*-
+-- Copyright 2022-2025 Free Software Foundation, Inc. -*- coding: iso-latin-3 -*-
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/non-ascii-latin-3/prog.adb b/gdb/testsuite/gdb.ada/non-ascii-latin-3/prog.adb
index 3fced83..fa766a8 100644
--- a/gdb/testsuite/gdb.ada/non-ascii-latin-3/prog.adb
+++ b/gdb/testsuite/gdb.ada/non-ascii-latin-3/prog.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc. -*- coding: iso-latin-3 -*-
+-- Copyright 2022-2025 Free Software Foundation, Inc. -*- coding: iso-latin-3 -*-
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/non-ascii-utf-8.exp b/gdb/testsuite/gdb.ada/non-ascii-utf-8.exp
index e0ac8f9..25aa2ba 100644
--- a/gdb/testsuite/gdb.ada/non-ascii-utf-8.exp
+++ b/gdb/testsuite/gdb.ada/non-ascii-utf-8.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ standard_ada_testfile prog
set flags [list debug additional_flags=-gnatW8]
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != ""} {
- return -1
+ return
}
# Restart without an executable so that we can set the encoding early.
diff --git a/gdb/testsuite/gdb.ada/non-ascii-utf-8/pack.adb b/gdb/testsuite/gdb.ada/non-ascii-utf-8/pack.adb
index 9b3b116..ffe6ef7 100644
--- a/gdb/testsuite/gdb.ada/non-ascii-utf-8/pack.adb
+++ b/gdb/testsuite/gdb.ada/non-ascii-utf-8/pack.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/non-ascii-utf-8/pack.ads b/gdb/testsuite/gdb.ada/non-ascii-utf-8/pack.ads
index 2941618..9fabc45 100644
--- a/gdb/testsuite/gdb.ada/non-ascii-utf-8/pack.ads
+++ b/gdb/testsuite/gdb.ada/non-ascii-utf-8/pack.ads
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/non-ascii-utf-8/prog.adb b/gdb/testsuite/gdb.ada/non-ascii-utf-8/prog.adb
index 2a0f550..f81de8c 100644
--- a/gdb/testsuite/gdb.ada/non-ascii-utf-8/prog.adb
+++ b/gdb/testsuite/gdb.ada/non-ascii-utf-8/prog.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/notcplusplus.exp b/gdb/testsuite/gdb.ada/notcplusplus.exp
index c65d5f8..8f69a6c 100644
--- a/gdb/testsuite/gdb.ada/notcplusplus.exp
+++ b/gdb/testsuite/gdb.ada/notcplusplus.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/notcplusplus/foo.adb b/gdb/testsuite/gdb.ada/notcplusplus/foo.adb
index 8c639ce..5c2353e 100644
--- a/gdb/testsuite/gdb.ada/notcplusplus/foo.adb
+++ b/gdb/testsuite/gdb.ada/notcplusplus/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/notcplusplus/pck.adb b/gdb/testsuite/gdb.ada/notcplusplus/pck.adb
index 7b68d2a..3ced0c2 100644
--- a/gdb/testsuite/gdb.ada/notcplusplus/pck.adb
+++ b/gdb/testsuite/gdb.ada/notcplusplus/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/notcplusplus/pck.ads b/gdb/testsuite/gdb.ada/notcplusplus/pck.ads
index f39ba81..4e6f44f 100644
--- a/gdb/testsuite/gdb.ada/notcplusplus/pck.ads
+++ b/gdb/testsuite/gdb.ada/notcplusplus/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/notcplusplus/ver.ads b/gdb/testsuite/gdb.ada/notcplusplus/ver.ads
index 19dd27b..befda97 100644
--- a/gdb/testsuite/gdb.ada/notcplusplus/ver.ads
+++ b/gdb/testsuite/gdb.ada/notcplusplus/ver.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/null_array.exp b/gdb/testsuite/gdb.ada/null_array.exp
index b4e218f..04ef573 100644
--- a/gdb/testsuite/gdb.ada/null_array.exp
+++ b/gdb/testsuite/gdb.ada/null_array.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
@@ -30,7 +30,7 @@ runto "foo.adb:$bp_location"
if {[gnat_version_compare <= {4 4}]} {
# Ada array bounds are missing in older GCCs.
- setup_xfail *-*-*
+ setup_xfail *-*-*
}
gdb_test "print my_table" \
"= \\(\\)"
diff --git a/gdb/testsuite/gdb.ada/null_array/foo.adb b/gdb/testsuite/gdb.ada/null_array/foo.adb
index f678efb..9f85c38 100644
--- a/gdb/testsuite/gdb.ada/null_array/foo.adb
+++ b/gdb/testsuite/gdb.ada/null_array/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/null_array/pck.adb b/gdb/testsuite/gdb.ada/null_array/pck.adb
index 9e5cd5f..646a0d4 100644
--- a/gdb/testsuite/gdb.ada/null_array/pck.adb
+++ b/gdb/testsuite/gdb.ada/null_array/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/null_array/pck.ads b/gdb/testsuite/gdb.ada/null_array/pck.ads
index 28e14ed..db8532a 100644
--- a/gdb/testsuite/gdb.ada/null_array/pck.ads
+++ b/gdb/testsuite/gdb.ada/null_array/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/null_overload.exp b/gdb/testsuite/gdb.ada/null_overload.exp
index 664fc42..1b4aebe 100644
--- a/gdb/testsuite/gdb.ada/null_overload.exp
+++ b/gdb/testsuite/gdb.ada/null_overload.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/null_overload/foo.adb b/gdb/testsuite/gdb.ada/null_overload/foo.adb
index c29316c..55d3fd6 100644
--- a/gdb/testsuite/gdb.ada/null_overload/foo.adb
+++ b/gdb/testsuite/gdb.ada/null_overload/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@@ -13,6 +13,8 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+with pck; use pck;
+
procedure Foo is
type R_Type is null record;
@@ -38,5 +40,5 @@ procedure Foo is
U_Ptr : U_P_T := null;
begin
- null; -- START
+ Do_Nothing (U_Ptr'Address); -- START
end Foo;
diff --git a/gdb/testsuite/gdb.ada/null_overload/pck.adb b/gdb/testsuite/gdb.ada/null_overload/pck.adb
new file mode 100644
index 0000000..95bd90a
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/null_overload/pck.adb
@@ -0,0 +1,23 @@
+-- Copyright 2020-2025 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package body Pck is
+
+ procedure Do_Nothing (A : System.Address) is
+ begin
+ null;
+ end Do_Nothing;
+
+end Pck;
diff --git a/gdb/testsuite/gdb.ada/null_overload/pck.ads b/gdb/testsuite/gdb.ada/null_overload/pck.ads
new file mode 100644
index 0000000..114aee0
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/null_overload/pck.ads
@@ -0,0 +1,22 @@
+-- Copyright 2020-2025 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+with System;
+
+package Pck is
+
+ procedure Do_Nothing (A : System.Address);
+
+end Pck;
diff --git a/gdb/testsuite/gdb.ada/null_record.exp b/gdb/testsuite/gdb.ada/null_record.exp
index 4aee479..c9a5f4f 100644
--- a/gdb/testsuite/gdb.ada/null_record.exp
+++ b/gdb/testsuite/gdb.ada/null_record.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile null_record
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/null_record/bar.adb b/gdb/testsuite/gdb.ada/null_record/bar.adb
index 8ad3f1b..897a9ab 100644
--- a/gdb/testsuite/gdb.ada/null_record/bar.adb
+++ b/gdb/testsuite/gdb.ada/null_record/bar.adb
@@ -1,4 +1,4 @@
--- Copyright 2004-2024 Free Software Foundation, Inc.
+-- Copyright 2004-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/null_record/bar.ads b/gdb/testsuite/gdb.ada/null_record/bar.ads
index 49a0e64..c16f71a 100644
--- a/gdb/testsuite/gdb.ada/null_record/bar.ads
+++ b/gdb/testsuite/gdb.ada/null_record/bar.ads
@@ -1,4 +1,4 @@
--- Copyright 2004-2024 Free Software Foundation, Inc.
+-- Copyright 2004-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/null_record/null_record.adb b/gdb/testsuite/gdb.ada/null_record/null_record.adb
index 2dbc113..07bf4d9 100644
--- a/gdb/testsuite/gdb.ada/null_record/null_record.adb
+++ b/gdb/testsuite/gdb.ada/null_record/null_record.adb
@@ -1,4 +1,4 @@
--- Copyright 2004-2024 Free Software Foundation, Inc.
+-- Copyright 2004-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/operator_bp.exp b/gdb/testsuite/gdb.ada/operator_bp.exp
index 2335d49..1bc3d27 100644
--- a/gdb/testsuite/gdb.ada/operator_bp.exp
+++ b/gdb/testsuite/gdb.ada/operator_bp.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile ops_test
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/operator_bp/ops.adb b/gdb/testsuite/gdb.ada/operator_bp/ops.adb
index 3296d97..412824f 100644
--- a/gdb/testsuite/gdb.ada/operator_bp/ops.adb
+++ b/gdb/testsuite/gdb.ada/operator_bp/ops.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/operator_bp/ops.ads b/gdb/testsuite/gdb.ada/operator_bp/ops.ads
index 1deb02d..a5ca7eb 100644
--- a/gdb/testsuite/gdb.ada/operator_bp/ops.ads
+++ b/gdb/testsuite/gdb.ada/operator_bp/ops.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/operator_bp/ops_test.adb b/gdb/testsuite/gdb.ada/operator_bp/ops_test.adb
index 9875f70..f65ea0b 100644
--- a/gdb/testsuite/gdb.ada/operator_bp/ops_test.adb
+++ b/gdb/testsuite/gdb.ada/operator_bp/ops_test.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/operator_call.exp b/gdb/testsuite/gdb.ada/operator_call.exp
index c1df212..8f2a268 100644
--- a/gdb/testsuite/gdb.ada/operator_call.exp
+++ b/gdb/testsuite/gdb.ada/operator_call.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile opcall
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
@@ -71,6 +71,12 @@ proc test_with_menu {command result} {
fail $command
}
}
+ "Argument to arithmetic operation not a number or boolean." {
+ fail $command
+ }
+ -re "No definition of \".*\" in current context." {
+ fail $command
+ }
timeout {
fail "$command (timeout)"
}
diff --git a/gdb/testsuite/gdb.ada/operator_call/opcall.adb b/gdb/testsuite/gdb.ada/operator_call/opcall.adb
index 77c0d11..19fc625 100644
--- a/gdb/testsuite/gdb.ada/operator_call/opcall.adb
+++ b/gdb/testsuite/gdb.ada/operator_call/opcall.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/operator_call/twovecs.adb b/gdb/testsuite/gdb.ada/operator_call/twovecs.adb
index 120df82..2621267 100644
--- a/gdb/testsuite/gdb.ada/operator_call/twovecs.adb
+++ b/gdb/testsuite/gdb.ada/operator_call/twovecs.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/operator_call/twovecs.ads b/gdb/testsuite/gdb.ada/operator_call/twovecs.ads
index 160cd25..96b6968 100644
--- a/gdb/testsuite/gdb.ada/operator_call/twovecs.ads
+++ b/gdb/testsuite/gdb.ada/operator_call/twovecs.ads
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/optim_drec.exp b/gdb/testsuite/gdb.ada/optim_drec.exp
index faf44a7..6256baa 100644
--- a/gdb/testsuite/gdb.ada/optim_drec.exp
+++ b/gdb/testsuite/gdb.ada/optim_drec.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/optim_drec/foo.adb b/gdb/testsuite/gdb.ada/optim_drec/foo.adb
index 80e51df..3a158fc 100644
--- a/gdb/testsuite/gdb.ada/optim_drec/foo.adb
+++ b/gdb/testsuite/gdb.ada/optim_drec/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
index 2adef97..233f786 100644
--- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
+++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug optimize=-O2
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined/bar.adb b/gdb/testsuite/gdb.ada/out_of_line_in_inlined/bar.adb
index 2246620..53f5290 100644
--- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined/bar.adb
+++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined/bar.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined/bar.ads b/gdb/testsuite/gdb.ada/out_of_line_in_inlined/bar.ads
index 7faee6f..c489232 100644
--- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined/bar.ads
+++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined/bar.ads
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined/foo_o224_021.adb b/gdb/testsuite/gdb.ada/out_of_line_in_inlined/foo_o224_021.adb
index 5c3fc86..5802c43 100644
--- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined/foo_o224_021.adb
+++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined/foo_o224_021.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/overload_menu_crash.exp b/gdb/testsuite/gdb.ada/overload_menu_crash.exp
index ea9841e..267ba46 100644
--- a/gdb/testsuite/gdb.ada/overload_menu_crash.exp
+++ b/gdb/testsuite/gdb.ada/overload_menu_crash.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ require allow_ada_tests
standard_ada_testfile main
if {[gdb_compile_ada "$srcfile" "$binfile" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/overload_menu_crash/main.adb b/gdb/testsuite/gdb.ada/overload_menu_crash/main.adb
index f69c37f..69c2296 100644
--- a/gdb/testsuite/gdb.ada/overload_menu_crash/main.adb
+++ b/gdb/testsuite/gdb.ada/overload_menu_crash/main.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/overload_menu_crash/pck.adb b/gdb/testsuite/gdb.ada/overload_menu_crash/pck.adb
index be0994f..fc922ea 100644
--- a/gdb/testsuite/gdb.ada/overload_menu_crash/pck.adb
+++ b/gdb/testsuite/gdb.ada/overload_menu_crash/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/overload_menu_crash/pck.ads b/gdb/testsuite/gdb.ada/overload_menu_crash/pck.ads
index ecb0fdd..0d4542c 100644
--- a/gdb/testsuite/gdb.ada/overload_menu_crash/pck.ads
+++ b/gdb/testsuite/gdb.ada/overload_menu_crash/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/overloads.exp b/gdb/testsuite/gdb.ada/overloads.exp
index 529b72d..32d1b7d 100644
--- a/gdb/testsuite/gdb.ada/overloads.exp
+++ b/gdb/testsuite/gdb.ada/overloads.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile overloads
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/overloads/overloads.adb b/gdb/testsuite/gdb.ada/overloads/overloads.adb
index 734214d..4005a99 100644
--- a/gdb/testsuite/gdb.ada/overloads/overloads.adb
+++ b/gdb/testsuite/gdb.ada/overloads/overloads.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/p-bounds.exp b/gdb/testsuite/gdb.ada/p-bounds.exp
index d075491..ff38612 100644
--- a/gdb/testsuite/gdb.ada/p-bounds.exp
+++ b/gdb/testsuite/gdb.ada/p-bounds.exp
@@ -23,7 +23,7 @@ require allow_ada_tests
standard_ada_testfile main
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/p-bounds/pck.adb b/gdb/testsuite/gdb.ada/p-bounds/pck.adb
index a175b7b..d29c5da 100644
--- a/gdb/testsuite/gdb.ada/p-bounds/pck.adb
+++ b/gdb/testsuite/gdb.ada/p-bounds/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/p-bounds/pck.ads b/gdb/testsuite/gdb.ada/p-bounds/pck.ads
index 5668577..d9c82ba 100644
--- a/gdb/testsuite/gdb.ada/p-bounds/pck.ads
+++ b/gdb/testsuite/gdb.ada/p-bounds/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp
index 14a4b69..6475621 100644
--- a/gdb/testsuite/gdb.ada/packed_array.exp
+++ b/gdb/testsuite/gdb.ada/packed_array.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/packed_array/pa.adb b/gdb/testsuite/gdb.ada/packed_array/pa.adb
index 997912a..657d752 100644
--- a/gdb/testsuite/gdb.ada/packed_array/pa.adb
+++ b/gdb/testsuite/gdb.ada/packed_array/pa.adb
@@ -1,4 +1,4 @@
--- Copyright 2005-2024 Free Software Foundation, Inc.
+-- Copyright 2005-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/packed_array/pck.adb b/gdb/testsuite/gdb.ada/packed_array/pck.adb
index c2c055a..5c0e482 100644
--- a/gdb/testsuite/gdb.ada/packed_array/pck.adb
+++ b/gdb/testsuite/gdb.ada/packed_array/pck.adb
@@ -1,4 +1,4 @@
--- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+-- Copyright (C) 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/packed_array/pck.ads b/gdb/testsuite/gdb.ada/packed_array/pck.ads
index 9475443..cfb8117 100644
--- a/gdb/testsuite/gdb.ada/packed_array/pck.ads
+++ b/gdb/testsuite/gdb.ada/packed_array/pck.ads
@@ -1,4 +1,4 @@
--- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+-- Copyright (C) 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/packed_array_assign.exp b/gdb/testsuite/gdb.ada/packed_array_assign.exp
index 0b7d106..f0d21fd 100644
--- a/gdb/testsuite/gdb.ada/packed_array_assign.exp
+++ b/gdb/testsuite/gdb.ada/packed_array_assign.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile tester
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/packed_array_assign/aggregates.adb b/gdb/testsuite/gdb.ada/packed_array_assign/aggregates.adb
index cb09fe2..93d9050 100644
--- a/gdb/testsuite/gdb.ada/packed_array_assign/aggregates.adb
+++ b/gdb/testsuite/gdb.ada/packed_array_assign/aggregates.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/packed_array_assign/aggregates.ads b/gdb/testsuite/gdb.ada/packed_array_assign/aggregates.ads
index 053218b..588709a 100644
--- a/gdb/testsuite/gdb.ada/packed_array_assign/aggregates.ads
+++ b/gdb/testsuite/gdb.ada/packed_array_assign/aggregates.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/packed_array_assign/pck.adb b/gdb/testsuite/gdb.ada/packed_array_assign/pck.adb
index 5a77a03..b73846c 100644
--- a/gdb/testsuite/gdb.ada/packed_array_assign/pck.adb
+++ b/gdb/testsuite/gdb.ada/packed_array_assign/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/packed_array_assign/pck.ads b/gdb/testsuite/gdb.ada/packed_array_assign/pck.ads
index f482d88..daa880e 100644
--- a/gdb/testsuite/gdb.ada/packed_array_assign/pck.ads
+++ b/gdb/testsuite/gdb.ada/packed_array_assign/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/packed_array_assign/tester.adb b/gdb/testsuite/gdb.ada/packed_array_assign/tester.adb
index 56809be..6b48c43 100644
--- a/gdb/testsuite/gdb.ada/packed_array_assign/tester.adb
+++ b/gdb/testsuite/gdb.ada/packed_array_assign/tester.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/packed_record.exp b/gdb/testsuite/gdb.ada/packed_record.exp
index 043c940..ed156ad 100644
--- a/gdb/testsuite/gdb.ada/packed_record.exp
+++ b/gdb/testsuite/gdb.ada/packed_record.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/packed_record/pck.adb b/gdb/testsuite/gdb.ada/packed_record/pck.adb
index a175b7b..d29c5da 100644
--- a/gdb/testsuite/gdb.ada/packed_record/pck.adb
+++ b/gdb/testsuite/gdb.ada/packed_record/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/packed_record/pck.ads b/gdb/testsuite/gdb.ada/packed_record/pck.ads
index 384bf08..02fc1c8 100644
--- a/gdb/testsuite/gdb.ada/packed_record/pck.ads
+++ b/gdb/testsuite/gdb.ada/packed_record/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/packed_record/pr.adb b/gdb/testsuite/gdb.ada/packed_record/pr.adb
index 621ee1e..f3205a6 100644
--- a/gdb/testsuite/gdb.ada/packed_record/pr.adb
+++ b/gdb/testsuite/gdb.ada/packed_record/pr.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/packed_record_2.exp b/gdb/testsuite/gdb.ada/packed_record_2.exp
new file mode 100644
index 0000000..af2509b
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/packed_record_2.exp
@@ -0,0 +1,61 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib "ada.exp"
+
+require allow_ada_tests
+
+standard_ada_testfile exam
+
+set flags {debug}
+if {[ada_minimal_encodings]} {
+ lappend flags additional_flags=-fgnat-encodings=minimal
+}
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != ""} {
+ return
+}
+
+clean_restart ${testfile}
+
+set bp_location [gdb_get_line_number "STOP" ${testdir}/exam.adb]
+runto "exam.adb:$bp_location"
+
+set spr_contents "discr => 3, field => -4, array_field => \\(-5, -6, -7\\)"
+
+gdb_test "print spr" " = \\($spr_contents\\)"
+
+gdb_test "print spr.discr" " = 3"
+
+# See PR ada/32880 -- gdb should probably print array (1 .. 3) here,
+# but instead shows array (<>). However as this isn't totally
+# relevant to this test, we just accept it.
+gdb_test "ptype spr" \
+ [multi_line \
+ "type = tagged record" \
+ " discr: range 1 .. 8;" \
+ " field: range -7 .. -4;" \
+ " array_field: array \\(<>\\) of exam.small <packed: 2-bit elements>;" \
+ "end record"]
+
+gdb_test_multiple "print sc" "" {
+ -re " \\($spr_contents, outer => 2, another_array => \\(-7, -6\\)\\)" {
+ pass $gdb_test_name
+ }
+ -re " \\($spr_contents, outer => $decimal, another_array => \\(.*\\)\\)" {
+ # Other output is a known GCC bug.
+ xfail $gdb_test_name
+ }
+}
diff --git a/gdb/testsuite/gdb.ada/packed_record_2/exam.adb b/gdb/testsuite/gdb.ada/packed_record_2/exam.adb
new file mode 100644
index 0000000..e528ecf
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/packed_record_2/exam.adb
@@ -0,0 +1,51 @@
+-- Copyright 2025 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+procedure Exam is
+ type Small is range -7 .. -4;
+ for Small'Size use 2;
+
+ type Range_Int is range 1 .. 8;
+ for Range_Int'Size use 3;
+
+ type Packed_Array is array (Range_Int range <>) of Small;
+ pragma pack (Packed_Array);
+
+ type Some_Packed_Record (Discr : Range_Int) is tagged record
+ Field: Small;
+ Array_Field : Packed_Array (1 .. Discr);
+ end record;
+ pragma Pack (Some_Packed_Record);
+
+ type Sub_Class (Inner, Outer : Range_Int)
+ is new Some_Packed_Record (Inner) with
+ record
+ Another_Array : Packed_Array (1 .. Outer);
+ end record;
+ pragma Pack (Sub_Class);
+
+ SPR : Some_Packed_Record := (Discr => 3,
+ Field => -4,
+ Array_Field => (-5, -6, -7));
+
+ SC : Sub_Class := (Inner => 3,
+ Outer => 2,
+ Field => -4,
+ Array_Field => (-5, -6, -7),
+ Another_Array => (-7, -6));
+
+begin
+ null; -- STOP
+end Exam;
diff --git a/gdb/testsuite/gdb.ada/packed_tagged.exp b/gdb/testsuite/gdb.ada/packed_tagged.exp
index 1c9e5a0..de3f089 100644
--- a/gdb/testsuite/gdb.ada/packed_tagged.exp
+++ b/gdb/testsuite/gdb.ada/packed_tagged.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/packed_tagged/comp_bug.adb b/gdb/testsuite/gdb.ada/packed_tagged/comp_bug.adb
index e7f1689..87a6a20 100644
--- a/gdb/testsuite/gdb.ada/packed_tagged/comp_bug.adb
+++ b/gdb/testsuite/gdb.ada/packed_tagged/comp_bug.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/pckd_arr_ren.exp b/gdb/testsuite/gdb.ada/pckd_arr_ren.exp
index 694cc23..cbcaa7c 100644
--- a/gdb/testsuite/gdb.ada/pckd_arr_ren.exp
+++ b/gdb/testsuite/gdb.ada/pckd_arr_ren.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/pckd_arr_ren/foo.adb b/gdb/testsuite/gdb.ada/pckd_arr_ren/foo.adb
index 2e1cc1d..3d5aaa2 100644
--- a/gdb/testsuite/gdb.ada/pckd_arr_ren/foo.adb
+++ b/gdb/testsuite/gdb.ada/pckd_arr_ren/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/pckd_arr_ren/pck.adb b/gdb/testsuite/gdb.ada/pckd_arr_ren/pck.adb
index 60a07e7..d1b5a2b 100644
--- a/gdb/testsuite/gdb.ada/pckd_arr_ren/pck.adb
+++ b/gdb/testsuite/gdb.ada/pckd_arr_ren/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/pckd_arr_ren/pck.ads b/gdb/testsuite/gdb.ada/pckd_arr_ren/pck.ads
index 42694d9..8107f52 100644
--- a/gdb/testsuite/gdb.ada/pckd_arr_ren/pck.ads
+++ b/gdb/testsuite/gdb.ada/pckd_arr_ren/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/pckd_neg.exp b/gdb/testsuite/gdb.ada/pckd_neg.exp
index aa02938..3319bb1 100644
--- a/gdb/testsuite/gdb.ada/pckd_neg.exp
+++ b/gdb/testsuite/gdb.ada/pckd_neg.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo_o508_021
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/pckd_neg/foo_o508_021.adb b/gdb/testsuite/gdb.ada/pckd_neg/foo_o508_021.adb
index f72fe1e..f41ceef 100644
--- a/gdb/testsuite/gdb.ada/pckd_neg/foo_o508_021.adb
+++ b/gdb/testsuite/gdb.ada/pckd_neg/foo_o508_021.adb
@@ -1,4 +1,4 @@
--- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+-- Copyright (C) 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/pckd_neg/pck.adb b/gdb/testsuite/gdb.ada/pckd_neg/pck.adb
index 1b0ab3f..ba14c7c 100644
--- a/gdb/testsuite/gdb.ada/pckd_neg/pck.adb
+++ b/gdb/testsuite/gdb.ada/pckd_neg/pck.adb
@@ -1,4 +1,4 @@
--- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+-- Copyright (C) 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/pckd_neg/pck.ads b/gdb/testsuite/gdb.ada/pckd_neg/pck.ads
index b3a8c08..59c95c2 100644
--- a/gdb/testsuite/gdb.ada/pckd_neg/pck.ads
+++ b/gdb/testsuite/gdb.ada/pckd_neg/pck.ads
@@ -1,4 +1,4 @@
--- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+-- Copyright (C) 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/pkd_arr_elem.exp b/gdb/testsuite/gdb.ada/pkd_arr_elem.exp
index 27d5fef..d589e88 100644
--- a/gdb/testsuite/gdb.ada/pkd_arr_elem.exp
+++ b/gdb/testsuite/gdb.ada/pkd_arr_elem.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile failure
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/pkd_arr_elem/failure.adb b/gdb/testsuite/gdb.ada/pkd_arr_elem/failure.adb
index d966b56..8ccb94d 100644
--- a/gdb/testsuite/gdb.ada/pkd_arr_elem/failure.adb
+++ b/gdb/testsuite/gdb.ada/pkd_arr_elem/failure.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/pkd_arr_elem/pck.adb b/gdb/testsuite/gdb.ada/pkd_arr_elem/pck.adb
index a175b7b..d29c5da 100644
--- a/gdb/testsuite/gdb.ada/pkd_arr_elem/pck.adb
+++ b/gdb/testsuite/gdb.ada/pkd_arr_elem/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/pkd_arr_elem/pck.ads b/gdb/testsuite/gdb.ada/pkd_arr_elem/pck.ads
index 384bf08..02fc1c8 100644
--- a/gdb/testsuite/gdb.ada/pkd_arr_elem/pck.ads
+++ b/gdb/testsuite/gdb.ada/pkd_arr_elem/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/pp-rec-component.exp b/gdb/testsuite/gdb.ada/pp-rec-component.exp
index 6bc4d16..30e362c 100644
--- a/gdb/testsuite/gdb.ada/pp-rec-component.exp
+++ b/gdb/testsuite/gdb.ada/pp-rec-component.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests allow_python_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/pp-rec-component.py b/gdb/testsuite/gdb.ada/pp-rec-component.py
index 3d39812..faddfb3 100644
--- a/gdb/testsuite/gdb.ada/pp-rec-component.py
+++ b/gdb/testsuite/gdb.ada/pp-rec-component.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/pp-rec-component/foo.adb b/gdb/testsuite/gdb.ada/pp-rec-component/foo.adb
index f1e5eac..597e6a0 100644
--- a/gdb/testsuite/gdb.ada/pp-rec-component/foo.adb
+++ b/gdb/testsuite/gdb.ada/pp-rec-component/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/pp-rec-component/pck.adb b/gdb/testsuite/gdb.ada/pp-rec-component/pck.adb
index a175b7b..d29c5da 100644
--- a/gdb/testsuite/gdb.ada/pp-rec-component/pck.adb
+++ b/gdb/testsuite/gdb.ada/pp-rec-component/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/pp-rec-component/pck.ads b/gdb/testsuite/gdb.ada/pp-rec-component/pck.ads
index 5187eac..730c9d7 100644
--- a/gdb/testsuite/gdb.ada/pp-rec-component/pck.ads
+++ b/gdb/testsuite/gdb.ada/pp-rec-component/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/print_chars.exp b/gdb/testsuite/gdb.ada/print_chars.exp
index d01318f..b487772 100644
--- a/gdb/testsuite/gdb.ada/print_chars.exp
+++ b/gdb/testsuite/gdb.ada/print_chars.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnat05 ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/print_chars/foo.adb b/gdb/testsuite/gdb.ada/print_chars/foo.adb
index 2467010..3b42a3a 100644
--- a/gdb/testsuite/gdb.ada/print_chars/foo.adb
+++ b/gdb/testsuite/gdb.ada/print_chars/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/print_chars/pck.adb b/gdb/testsuite/gdb.ada/print_chars/pck.adb
index d1e115d..3dc26b6 100644
--- a/gdb/testsuite/gdb.ada/print_chars/pck.adb
+++ b/gdb/testsuite/gdb.ada/print_chars/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/print_chars/pck.ads b/gdb/testsuite/gdb.ada/print_chars/pck.ads
index e877d00..02e2789 100644
--- a/gdb/testsuite/gdb.ada/print_chars/pck.ads
+++ b/gdb/testsuite/gdb.ada/print_chars/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/print_pc.exp b/gdb/testsuite/gdb.ada/print_pc.exp
index d6e8711..8b2043c 100644
--- a/gdb/testsuite/gdb.ada/print_pc.exp
+++ b/gdb/testsuite/gdb.ada/print_pc.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile dummy start
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/ptr_typedef.exp b/gdb/testsuite/gdb.ada/ptr_typedef.exp
index 08deed9..7bed41c 100644
--- a/gdb/testsuite/gdb.ada/ptr_typedef.exp
+++ b/gdb/testsuite/gdb.ada/ptr_typedef.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/ptr_typedef/foo.adb b/gdb/testsuite/gdb.ada/ptr_typedef/foo.adb
index c730a88..f902431 100644
--- a/gdb/testsuite/gdb.ada/ptr_typedef/foo.adb
+++ b/gdb/testsuite/gdb.ada/ptr_typedef/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ptr_typedef/pck.adb b/gdb/testsuite/gdb.ada/ptr_typedef/pck.adb
index 2822e77..2bfbe8c 100644
--- a/gdb/testsuite/gdb.ada/ptr_typedef/pck.adb
+++ b/gdb/testsuite/gdb.ada/ptr_typedef/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ptr_typedef/pck.ads b/gdb/testsuite/gdb.ada/ptr_typedef/pck.ads
index 7de7794..90f3ced 100644
--- a/gdb/testsuite/gdb.ada/ptr_typedef/pck.ads
+++ b/gdb/testsuite/gdb.ada/ptr_typedef/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ptype-o.exp b/gdb/testsuite/gdb.ada/ptype-o.exp
index 1b6373c..1558dff 100644
--- a/gdb/testsuite/gdb.ada/ptype-o.exp
+++ b/gdb/testsuite/gdb.ada/ptype-o.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/ptype-o/pck.ads b/gdb/testsuite/gdb.ada/ptype-o/pck.ads
index d1d1223..9b363dd 100644
--- a/gdb/testsuite/gdb.ada/ptype-o/pck.ads
+++ b/gdb/testsuite/gdb.ada/ptype-o/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ptype-o/prog.adb b/gdb/testsuite/gdb.ada/ptype-o/prog.adb
index 73e9963..950b80c 100644
--- a/gdb/testsuite/gdb.ada/ptype-o/prog.adb
+++ b/gdb/testsuite/gdb.ada/ptype-o/prog.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ptype_arith_binop.exp b/gdb/testsuite/gdb.ada/ptype_arith_binop.exp
index 60cd2d4..b4f6ee5 100644
--- a/gdb/testsuite/gdb.ada/ptype_arith_binop.exp
+++ b/gdb/testsuite/gdb.ada/ptype_arith_binop.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ptype_array.exp b/gdb/testsuite/gdb.ada/ptype_array.exp
index 9080ea1..b407d76 100644
--- a/gdb/testsuite/gdb.ada/ptype_array.exp
+++ b/gdb/testsuite/gdb.ada/ptype_array.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnat05 ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/ptype_array/foo.adb b/gdb/testsuite/gdb.ada/ptype_array/foo.adb
index b53c1f6..0837399 100644
--- a/gdb/testsuite/gdb.ada/ptype_array/foo.adb
+++ b/gdb/testsuite/gdb.ada/ptype_array/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ptype_array/pck.adb b/gdb/testsuite/gdb.ada/ptype_array/pck.adb
index aaa72db..d44600a 100644
--- a/gdb/testsuite/gdb.ada/ptype_array/pck.adb
+++ b/gdb/testsuite/gdb.ada/ptype_array/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ptype_array/pck.ads b/gdb/testsuite/gdb.ada/ptype_array/pck.ads
index 18605f1..76ee178 100644
--- a/gdb/testsuite/gdb.ada/ptype_array/pck.ads
+++ b/gdb/testsuite/gdb.ada/ptype_array/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ptype_field.exp b/gdb/testsuite/gdb.ada/ptype_field.exp
index 84d55cb..16e5e1d 100644
--- a/gdb/testsuite/gdb.ada/ptype_field.exp
+++ b/gdb/testsuite/gdb.ada/ptype_field.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnat05 ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/ptype_field/foo.adb b/gdb/testsuite/gdb.ada/ptype_field/foo.adb
index 8d3af9b..9beae8d 100644
--- a/gdb/testsuite/gdb.ada/ptype_field/foo.adb
+++ b/gdb/testsuite/gdb.ada/ptype_field/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ptype_field/pck.adb b/gdb/testsuite/gdb.ada/ptype_field/pck.adb
index a15d6f2..801716a 100644
--- a/gdb/testsuite/gdb.ada/ptype_field/pck.adb
+++ b/gdb/testsuite/gdb.ada/ptype_field/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ptype_field/pck.ads b/gdb/testsuite/gdb.ada/ptype_field/pck.ads
index 3fbe09f..001d35e 100644
--- a/gdb/testsuite/gdb.ada/ptype_field/pck.ads
+++ b/gdb/testsuite/gdb.ada/ptype_field/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ptype_tagged_param.exp b/gdb/testsuite/gdb.ada/ptype_tagged_param.exp
index 49d6dc8..389f172 100644
--- a/gdb/testsuite/gdb.ada/ptype_tagged_param.exp
+++ b/gdb/testsuite/gdb.ada/ptype_tagged_param.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
set has_runtime_debug_info [gnat_runtime_has_debug_info]
@@ -28,7 +28,7 @@ set has_runtime_debug_info [gnat_runtime_has_debug_info]
clean_restart ${testfile}
if {![runto "pck.adb:20"]} {
- return -1
+ return
}
# With some versions of the compiler, identifying the runtime type of
diff --git a/gdb/testsuite/gdb.ada/ptype_tagged_param/foo.adb b/gdb/testsuite/gdb.ada/ptype_tagged_param/foo.adb
index 8448c57..5b7f84f 100644
--- a/gdb/testsuite/gdb.ada/ptype_tagged_param/foo.adb
+++ b/gdb/testsuite/gdb.ada/ptype_tagged_param/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ptype_tagged_param/pck.adb b/gdb/testsuite/gdb.ada/ptype_tagged_param/pck.adb
index 5869365..a760e04 100644
--- a/gdb/testsuite/gdb.ada/ptype_tagged_param/pck.adb
+++ b/gdb/testsuite/gdb.ada/ptype_tagged_param/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ptype_tagged_param/pck.ads b/gdb/testsuite/gdb.ada/ptype_tagged_param/pck.ads
index e96ec33..2dd627e 100644
--- a/gdb/testsuite/gdb.ada/ptype_tagged_param/pck.ads
+++ b/gdb/testsuite/gdb.ada/ptype_tagged_param/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ptype_union.c b/gdb/testsuite/gdb.ada/ptype_union.c
index 0c4d96a..d190174 100644
--- a/gdb/testsuite/gdb.ada/ptype_union.c
+++ b/gdb/testsuite/gdb.ada/ptype_union.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ptype_union.exp b/gdb/testsuite/gdb.ada/ptype_union.exp
index a1bdd96..de211cb 100644
--- a/gdb/testsuite/gdb.ada/ptype_union.exp
+++ b/gdb/testsuite/gdb.ada/ptype_union.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ require allow_ada_tests
standard_testfile .c
if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
- return -1
+ return
}
# The test case is written in C, because it was easy to make the
diff --git a/gdb/testsuite/gdb.ada/py_range.exp b/gdb/testsuite/gdb.ada/py_range.exp
index 295eb78..237cf46 100644
--- a/gdb/testsuite/gdb.ada/py_range.exp
+++ b/gdb/testsuite/gdb.ada/py_range.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ require allow_ada_tests allow_python_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/py_range/foo.adb b/gdb/testsuite/gdb.ada/py_range/foo.adb
index d0e7dd6..f610d9f 100644
--- a/gdb/testsuite/gdb.ada/py_range/foo.adb
+++ b/gdb/testsuite/gdb.ada/py_range/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/py_range/pck.adb b/gdb/testsuite/gdb.ada/py_range/pck.adb
index d1e115d..3dc26b6 100644
--- a/gdb/testsuite/gdb.ada/py_range/pck.adb
+++ b/gdb/testsuite/gdb.ada/py_range/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/py_range/pck.ads b/gdb/testsuite/gdb.ada/py_range/pck.ads
index e877d00..02e2789 100644
--- a/gdb/testsuite/gdb.ada/py_range/pck.ads
+++ b/gdb/testsuite/gdb.ada/py_range/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/py_taft.exp b/gdb/testsuite/gdb.ada/py_taft.exp
index a8e2c46..a2d8686 100644
--- a/gdb/testsuite/gdb.ada/py_taft.exp
+++ b/gdb/testsuite/gdb.ada/py_taft.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ require allow_ada_tests allow_python_tests
standard_ada_testfile main
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/py_taft/main.adb b/gdb/testsuite/gdb.ada/py_taft/main.adb
index 0dbf308..273f637 100644
--- a/gdb/testsuite/gdb.ada/py_taft/main.adb
+++ b/gdb/testsuite/gdb.ada/py_taft/main.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/py_taft/pkg.adb b/gdb/testsuite/gdb.ada/py_taft/pkg.adb
index 6d9bcb8..854df10 100644
--- a/gdb/testsuite/gdb.ada/py_taft/pkg.adb
+++ b/gdb/testsuite/gdb.ada/py_taft/pkg.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/py_taft/pkg.ads b/gdb/testsuite/gdb.ada/py_taft/pkg.ads
index 7b93236..c994402 100644
--- a/gdb/testsuite/gdb.ada/py_taft/pkg.ads
+++ b/gdb/testsuite/gdb.ada/py_taft/pkg.ads
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/rdv_wait.exp b/gdb/testsuite/gdb.ada/rdv_wait.exp
index 56c19f3..d6d446e 100644
--- a/gdb/testsuite/gdb.ada/rdv_wait.exp
+++ b/gdb/testsuite/gdb.ada/rdv_wait.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/rdv_wait/foo.adb b/gdb/testsuite/gdb.ada/rdv_wait/foo.adb
index a49542a..bbf70a9 100644
--- a/gdb/testsuite/gdb.ada/rdv_wait/foo.adb
+++ b/gdb/testsuite/gdb.ada/rdv_wait/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/rdv_wait/pck.adb b/gdb/testsuite/gdb.ada/rdv_wait/pck.adb
index bdc30fd..918d3a5 100644
--- a/gdb/testsuite/gdb.ada/rdv_wait/pck.adb
+++ b/gdb/testsuite/gdb.ada/rdv_wait/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/rdv_wait/pck.ads b/gdb/testsuite/gdb.ada/rdv_wait/pck.ads
index 7260947..858f617 100644
--- a/gdb/testsuite/gdb.ada/rdv_wait/pck.ads
+++ b/gdb/testsuite/gdb.ada/rdv_wait/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/rec_comp.exp b/gdb/testsuite/gdb.ada/rec_comp.exp
index 5c5c794..af49495 100644
--- a/gdb/testsuite/gdb.ada/rec_comp.exp
+++ b/gdb/testsuite/gdb.ada/rec_comp.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile bar_o203_012
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/rec_comp/bar_o203_012.adb b/gdb/testsuite/gdb.ada/rec_comp/bar_o203_012.adb
index 43e21e4..faffcf1 100644
--- a/gdb/testsuite/gdb.ada/rec_comp/bar_o203_012.adb
+++ b/gdb/testsuite/gdb.ada/rec_comp/bar_o203_012.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/rec_comp/pck.adb b/gdb/testsuite/gdb.ada/rec_comp/pck.adb
index 9edc10b..d616516 100644
--- a/gdb/testsuite/gdb.ada/rec_comp/pck.adb
+++ b/gdb/testsuite/gdb.ada/rec_comp/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/rec_comp/pck.ads b/gdb/testsuite/gdb.ada/rec_comp/pck.ads
index 9839f35..d852120 100644
--- a/gdb/testsuite/gdb.ada/rec_comp/pck.ads
+++ b/gdb/testsuite/gdb.ada/rec_comp/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/rec_ptype.exp b/gdb/testsuite/gdb.ada/rec_ptype.exp
index fc7bb8b..d6b7aa1 100644
--- a/gdb/testsuite/gdb.ada/rec_ptype.exp
+++ b/gdb/testsuite/gdb.ada/rec_ptype.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/rec_ptype/main.adb b/gdb/testsuite/gdb.ada/rec_ptype/main.adb
index 2eb31ce..7035d41 100644
--- a/gdb/testsuite/gdb.ada/rec_ptype/main.adb
+++ b/gdb/testsuite/gdb.ada/rec_ptype/main.adb
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/rec_ptype/p.ads b/gdb/testsuite/gdb.ada/rec_ptype/p.ads
index b55b228..ea50f91 100644
--- a/gdb/testsuite/gdb.ada/rec_ptype/p.ads
+++ b/gdb/testsuite/gdb.ada/rec_ptype/p.ads
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/rec_return.exp b/gdb/testsuite/gdb.ada/rec_return.exp
index 133c35e..dd94441 100644
--- a/gdb/testsuite/gdb.ada/rec_return.exp
+++ b/gdb/testsuite/gdb.ada/rec_return.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/rec_return/foo.adb b/gdb/testsuite/gdb.ada/rec_return/foo.adb
index cb77586..df93dd5 100644
--- a/gdb/testsuite/gdb.ada/rec_return/foo.adb
+++ b/gdb/testsuite/gdb.ada/rec_return/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/rec_return/pck.adb b/gdb/testsuite/gdb.ada/rec_return/pck.adb
index 83a9d41..1bfdb6c 100644
--- a/gdb/testsuite/gdb.ada/rec_return/pck.adb
+++ b/gdb/testsuite/gdb.ada/rec_return/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/rec_return/pck.ads b/gdb/testsuite/gdb.ada/rec_return/pck.ads
index a097dac..e95fe2c 100644
--- a/gdb/testsuite/gdb.ada/rec_return/pck.ads
+++ b/gdb/testsuite/gdb.ada/rec_return/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/recursive-variant.exp b/gdb/testsuite/gdb.ada/recursive-variant.exp
index ea13f83..6883857 100644
--- a/gdb/testsuite/gdb.ada/recursive-variant.exp
+++ b/gdb/testsuite/gdb.ada/recursive-variant.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile main
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/recursive-variant/main.adb b/gdb/testsuite/gdb.ada/recursive-variant/main.adb
index 93b47e5..d4c3ab6 100644
--- a/gdb/testsuite/gdb.ada/recursive-variant/main.adb
+++ b/gdb/testsuite/gdb.ada/recursive-variant/main.adb
@@ -1,4 +1,4 @@
--- Copyright 2024 Free Software Foundation, Inc.
+-- Copyright 2024-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ref_param.exp b/gdb/testsuite/gdb.ada/ref_param.exp
index 39cee89..b9c0eb9 100644
--- a/gdb/testsuite/gdb.ada/ref_param.exp
+++ b/gdb/testsuite/gdb.ada/ref_param.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,14 +20,14 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
if {![runto pck.adb:20]} {
return
-}
+}
gdb_test_no_output "set print frame-arguments all"
diff --git a/gdb/testsuite/gdb.ada/ref_param/foo.adb b/gdb/testsuite/gdb.ada/ref_param/foo.adb
index faeb645..96a570f 100644
--- a/gdb/testsuite/gdb.ada/ref_param/foo.adb
+++ b/gdb/testsuite/gdb.ada/ref_param/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ref_param/pck.adb b/gdb/testsuite/gdb.ada/ref_param/pck.adb
index 4c6eed4..ec31f3c 100644
--- a/gdb/testsuite/gdb.ada/ref_param/pck.adb
+++ b/gdb/testsuite/gdb.ada/ref_param/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ref_param/pck.ads b/gdb/testsuite/gdb.ada/ref_param/pck.ads
index 1ce26fa..1b4aa8b 100644
--- a/gdb/testsuite/gdb.ada/ref_param/pck.ads
+++ b/gdb/testsuite/gdb.ada/ref_param/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ref_tick_size.exp b/gdb/testsuite/gdb.ada/ref_tick_size.exp
index 2c875c0..18b63ef 100644
--- a/gdb/testsuite/gdb.ada/ref_tick_size.exp
+++ b/gdb/testsuite/gdb.ada/ref_tick_size.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile p
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/ref_tick_size/p.adb b/gdb/testsuite/gdb.ada/ref_tick_size/p.adb
index 36910ca..88b1192 100644
--- a/gdb/testsuite/gdb.ada/ref_tick_size/p.adb
+++ b/gdb/testsuite/gdb.ada/ref_tick_size/p.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ref_tick_size/pck.adb b/gdb/testsuite/gdb.ada/ref_tick_size/pck.adb
index 240377d..1377ef5 100644
--- a/gdb/testsuite/gdb.ada/ref_tick_size/pck.adb
+++ b/gdb/testsuite/gdb.ada/ref_tick_size/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/ref_tick_size/pck.ads b/gdb/testsuite/gdb.ada/ref_tick_size/pck.ads
index a1523f1..58305f0 100644
--- a/gdb/testsuite/gdb.ada/ref_tick_size/pck.ads
+++ b/gdb/testsuite/gdb.ada/ref_tick_size/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/rename_subscript_param.exp b/gdb/testsuite/gdb.ada/rename_subscript_param.exp
index efb29f4..73e58b4 100644
--- a/gdb/testsuite/gdb.ada/rename_subscript_param.exp
+++ b/gdb/testsuite/gdb.ada/rename_subscript_param.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ require {gnat_version_compare >= 8}
standard_ada_testfile pb30_012
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/rename_subscript_param/pb30_012.adb b/gdb/testsuite/gdb.ada/rename_subscript_param/pb30_012.adb
index 6c82e28..a0795dd 100644
--- a/gdb/testsuite/gdb.ada/rename_subscript_param/pb30_012.adb
+++ b/gdb/testsuite/gdb.ada/rename_subscript_param/pb30_012.adb
@@ -1,4 +1,4 @@
--- Copyright 2016-2024 Free Software Foundation, Inc.
+-- Copyright 2016-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/rename_subscript_param/pck.adb b/gdb/testsuite/gdb.ada/rename_subscript_param/pck.adb
index c3d3f59..9a822b9 100644
--- a/gdb/testsuite/gdb.ada/rename_subscript_param/pck.adb
+++ b/gdb/testsuite/gdb.ada/rename_subscript_param/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2016-2024 Free Software Foundation, Inc.
+-- Copyright 2016-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/rename_subscript_param/pck.ads b/gdb/testsuite/gdb.ada/rename_subscript_param/pck.ads
index 30b954e..ca06650 100644
--- a/gdb/testsuite/gdb.ada/rename_subscript_param/pck.ads
+++ b/gdb/testsuite/gdb.ada/rename_subscript_param/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2016-2024 Free Software Foundation, Inc.
+-- Copyright 2016-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/rename_subscript_param/pkg.adb b/gdb/testsuite/gdb.ada/rename_subscript_param/pkg.adb
index 7f00774..8dd75c2 100644
--- a/gdb/testsuite/gdb.ada/rename_subscript_param/pkg.adb
+++ b/gdb/testsuite/gdb.ada/rename_subscript_param/pkg.adb
@@ -1,4 +1,4 @@
--- Copyright 2016-2024 Free Software Foundation, Inc.
+-- Copyright 2016-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/rename_subscript_param/pkg.ads b/gdb/testsuite/gdb.ada/rename_subscript_param/pkg.ads
index 07e5387..d1cac65 100644
--- a/gdb/testsuite/gdb.ada/rename_subscript_param/pkg.ads
+++ b/gdb/testsuite/gdb.ada/rename_subscript_param/pkg.ads
@@ -1,4 +1,4 @@
--- Copyright 2016-2024 Free Software Foundation, Inc.
+-- Copyright 2016-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/repeat_dyn.exp b/gdb/testsuite/gdb.ada/repeat_dyn.exp
index 8f0618d..fb1ecbb 100644
--- a/gdb/testsuite/gdb.ada/repeat_dyn.exp
+++ b/gdb/testsuite/gdb.ada/repeat_dyn.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo_oc22_002
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/repeat_dyn/foo_oc22_002.adb b/gdb/testsuite/gdb.ada/repeat_dyn/foo_oc22_002.adb
index 5a1f1b6..5b8edf4 100644
--- a/gdb/testsuite/gdb.ada/repeat_dyn/foo_oc22_002.adb
+++ b/gdb/testsuite/gdb.ada/repeat_dyn/foo_oc22_002.adb
@@ -1,4 +1,4 @@
--- Copyright 2016-2024 Free Software Foundation, Inc.
+-- Copyright 2016-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/repeat_dyn/pck.adb b/gdb/testsuite/gdb.ada/repeat_dyn/pck.adb
index 11b0029..91dc2e9 100644
--- a/gdb/testsuite/gdb.ada/repeat_dyn/pck.adb
+++ b/gdb/testsuite/gdb.ada/repeat_dyn/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2016-2024 Free Software Foundation, Inc.
+-- Copyright 2016-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/repeat_dyn/pck.ads b/gdb/testsuite/gdb.ada/repeat_dyn/pck.ads
index 11d4a25..0f4dd5d 100644
--- a/gdb/testsuite/gdb.ada/repeat_dyn/pck.ads
+++ b/gdb/testsuite/gdb.ada/repeat_dyn/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2016-2024 Free Software Foundation, Inc.
+-- Copyright 2016-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/return-small-char-array.exp b/gdb/testsuite/gdb.ada/return-small-char-array.exp
new file mode 100644
index 0000000..1f6412e
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/return-small-char-array.exp
@@ -0,0 +1,40 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib "ada.exp"
+
+require allow_ada_tests
+
+standard_ada_testfile proc
+
+if { [gdb_compile_ada $srcfile $binfile executable debug] != "" } {
+ return
+}
+
+clean_restart $testfile
+
+set bp_location [gdb_get_line_number "STOP" $testdir/proc.adb]
+runto "proc.adb:$bp_location"
+
+gdb_test "print Value.Name(My_Value)" \
+ { = "abcd"}
+
+# Step into the function.
+gdb_test "step 2" \
+ "return Of_Value;"
+
+# and finish.
+gdb_test "finish" \
+ { = "abcd"}
diff --git a/gdb/testsuite/gdb.ada/return-small-char-array/proc.adb b/gdb/testsuite/gdb.ada/return-small-char-array/proc.adb
new file mode 100644
index 0000000..b18d9fe
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/return-small-char-array/proc.adb
@@ -0,0 +1,22 @@
+-- Copyright 2025 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+with Value;
+procedure Proc is
+ My_Value : Value.T := "abcd";
+begin
+ null; -- STOP
+ My_Value := Value.Name(My_Value);
+end;
diff --git a/gdb/testsuite/gdb.ada/return-small-char-array/value.adb b/gdb/testsuite/gdb.ada/return-small-char-array/value.adb
new file mode 100644
index 0000000..2dd9faa
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/return-small-char-array/value.adb
@@ -0,0 +1,21 @@
+-- Copyright 2025 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package body Value is
+ function Name (Of_Value : T) return T is
+ begin
+ return Of_Value;
+ end Name;
+end Value;
diff --git a/gdb/testsuite/gdb.ada/return-small-char-array/value.ads b/gdb/testsuite/gdb.ada/return-small-char-array/value.ads
new file mode 100644
index 0000000..16b171e
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/return-small-char-array/value.ads
@@ -0,0 +1,20 @@
+-- Copyright 2025 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package Value is
+ type T is new String (1 .. 4);
+
+ function Name (Of_Value : T) return T;
+end;
diff --git a/gdb/testsuite/gdb.ada/same_component_name.exp b/gdb/testsuite/gdb.ada/same_component_name.exp
index 84a48b4..b245bf9 100644
--- a/gdb/testsuite/gdb.ada/same_component_name.exp
+++ b/gdb/testsuite/gdb.ada/same_component_name.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != "" } {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/same_component_name/foo.adb b/gdb/testsuite/gdb.ada/same_component_name/foo.adb
index e9390ee..3b2a3c8 100644
--- a/gdb/testsuite/gdb.ada/same_component_name/foo.adb
+++ b/gdb/testsuite/gdb.ada/same_component_name/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/same_component_name/pck.adb b/gdb/testsuite/gdb.ada/same_component_name/pck.adb
index ab4801f..29381eb 100644
--- a/gdb/testsuite/gdb.ada/same_component_name/pck.adb
+++ b/gdb/testsuite/gdb.ada/same_component_name/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2010-2024 Free Software Foundation, Inc.
+-- Copyright 2010-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/same_component_name/pck.ads b/gdb/testsuite/gdb.ada/same_component_name/pck.ads
index 99a4476..429284f 100644
--- a/gdb/testsuite/gdb.ada/same_component_name/pck.ads
+++ b/gdb/testsuite/gdb.ada/same_component_name/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/same_enum.exp b/gdb/testsuite/gdb.ada/same_enum.exp
index 70ab326..7e233cd 100644
--- a/gdb/testsuite/gdb.ada/same_enum.exp
+++ b/gdb/testsuite/gdb.ada/same_enum.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile a
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/same_enum/a.adb b/gdb/testsuite/gdb.ada/same_enum/a.adb
index c76de42..427f486 100644
--- a/gdb/testsuite/gdb.ada/same_enum/a.adb
+++ b/gdb/testsuite/gdb.ada/same_enum/a.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/same_enum/pck.adb b/gdb/testsuite/gdb.ada/same_enum/pck.adb
index de1eb7e..fc67d2f 100644
--- a/gdb/testsuite/gdb.ada/same_enum/pck.adb
+++ b/gdb/testsuite/gdb.ada/same_enum/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/same_enum/pck.ads b/gdb/testsuite/gdb.ada/same_enum/pck.ads
index be8008e..efb475b 100644
--- a/gdb/testsuite/gdb.ada/same_enum/pck.ads
+++ b/gdb/testsuite/gdb.ada/same_enum/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/scalar_storage.exp b/gdb/testsuite/gdb.ada/scalar_storage.exp
index 16a184f..a380541 100644
--- a/gdb/testsuite/gdb.ada/scalar_storage.exp
+++ b/gdb/testsuite/gdb.ada/scalar_storage.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,10 +45,30 @@ if {![runto "storage.adb:$bp_location"]} {
return
}
-gdb_test "print V_LE" "= \\(value => 126, another_value => 12, color => green\\)"
+set re "value => 126, another_value => 12, color => green"
# This requires a compiler fix that is in GCC 14.
-if { ![gnat_version_compare >= 14] } {
- setup_kfail "DW_AT_endianity on enum types" *-*-*
+set have_xfail [expr {![gnat_version_compare >= 14]}]
+set re_color "(red|green|blue|$decimal)"
+set re_xfail \
+ "value => $decimal, another_value => $decimal, color => $re_color"
+
+set re_pre [string_to_regexp " = ("]
+set re_post [string_to_regexp ")"]
+set re $re_pre$re$re_post
+set re_xfail $re_pre$re_xfail$re_post
+
+foreach var { V_LE V_BE } {
+ gdb_test_multiple "print $var" "" {
+ -re -wrap $re {
+ pass $gdb_test_name
+ }
+ -re -wrap $re_xfail {
+ if { $have_xfail } {
+ xfail $gdb_test_name
+ } else {
+ fail $gdb_test_name
+ }
+ }
+ }
}
-gdb_test "print V_BE" "= \\(value => 126, another_value => 12, color => green\\)"
diff --git a/gdb/testsuite/gdb.ada/scalar_storage/pck.adb b/gdb/testsuite/gdb.ada/scalar_storage/pck.adb
index 64f765d..34162db 100644
--- a/gdb/testsuite/gdb.ada/scalar_storage/pck.adb
+++ b/gdb/testsuite/gdb.ada/scalar_storage/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/scalar_storage/pck.ads b/gdb/testsuite/gdb.ada/scalar_storage/pck.ads
index 195acda..40563bd 100644
--- a/gdb/testsuite/gdb.ada/scalar_storage/pck.ads
+++ b/gdb/testsuite/gdb.ada/scalar_storage/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/scalar_storage/storage.adb b/gdb/testsuite/gdb.ada/scalar_storage/storage.adb
index 6c63d07..46501b1 100644
--- a/gdb/testsuite/gdb.ada/scalar_storage/storage.adb
+++ b/gdb/testsuite/gdb.ada/scalar_storage/storage.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/scoped_watch.exp b/gdb/testsuite/gdb.ada/scoped_watch.exp
index 9384758..17760f7 100644
--- a/gdb/testsuite/gdb.ada/scoped_watch.exp
+++ b/gdb/testsuite/gdb.ada/scoped_watch.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo_p708_025
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/scoped_watch/foo_p708_025.adb b/gdb/testsuite/gdb.ada/scoped_watch/foo_p708_025.adb
index e6661ac..3748596 100644
--- a/gdb/testsuite/gdb.ada/scoped_watch/foo_p708_025.adb
+++ b/gdb/testsuite/gdb.ada/scoped_watch/foo_p708_025.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/scoped_watch/pck.adb b/gdb/testsuite/gdb.ada/scoped_watch/pck.adb
index 761d13f..3f27053 100644
--- a/gdb/testsuite/gdb.ada/scoped_watch/pck.adb
+++ b/gdb/testsuite/gdb.ada/scoped_watch/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/scoped_watch/pck.ads b/gdb/testsuite/gdb.ada/scoped_watch/pck.ads
index 9bbb3d2..bf129eb 100644
--- a/gdb/testsuite/gdb.ada/scoped_watch/pck.ads
+++ b/gdb/testsuite/gdb.ada/scoped_watch/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/set_pckd_arr_elt.exp b/gdb/testsuite/gdb.ada/set_pckd_arr_elt.exp
index 2979cb9..76070e2 100644
--- a/gdb/testsuite/gdb.ada/set_pckd_arr_elt.exp
+++ b/gdb/testsuite/gdb.ada/set_pckd_arr_elt.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/set_pckd_arr_elt/foo.adb b/gdb/testsuite/gdb.ada/set_pckd_arr_elt/foo.adb
index daa3f3e..ba17ba4 100644
--- a/gdb/testsuite/gdb.ada/set_pckd_arr_elt/foo.adb
+++ b/gdb/testsuite/gdb.ada/set_pckd_arr_elt/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/set_pckd_arr_elt/pck.adb b/gdb/testsuite/gdb.ada/set_pckd_arr_elt/pck.adb
index bca8177..57c8923 100644
--- a/gdb/testsuite/gdb.ada/set_pckd_arr_elt/pck.adb
+++ b/gdb/testsuite/gdb.ada/set_pckd_arr_elt/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/set_pckd_arr_elt/pck.ads b/gdb/testsuite/gdb.ada/set_pckd_arr_elt/pck.ads
index 338ba25..133205b 100644
--- a/gdb/testsuite/gdb.ada/set_pckd_arr_elt/pck.ads
+++ b/gdb/testsuite/gdb.ada/set_pckd_arr_elt/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/set_wstr.exp b/gdb/testsuite/gdb.ada/set_wstr.exp
index b70027c..bac83154 100644
--- a/gdb/testsuite/gdb.ada/set_wstr.exp
+++ b/gdb/testsuite/gdb.ada/set_wstr.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile a
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/set_wstr/a.adb b/gdb/testsuite/gdb.ada/set_wstr/a.adb
index a69b654..6b46c6a 100644
--- a/gdb/testsuite/gdb.ada/set_wstr/a.adb
+++ b/gdb/testsuite/gdb.ada/set_wstr/a.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/set_wstr/pck.adb b/gdb/testsuite/gdb.ada/set_wstr/pck.adb
index a64c5e9..54ddf5c 100644
--- a/gdb/testsuite/gdb.ada/set_wstr/pck.adb
+++ b/gdb/testsuite/gdb.ada/set_wstr/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/set_wstr/pck.ads b/gdb/testsuite/gdb.ada/set_wstr/pck.ads
index bd9fd43..db7c0a8 100644
--- a/gdb/testsuite/gdb.ada/set_wstr/pck.ads
+++ b/gdb/testsuite/gdb.ada/set_wstr/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/small_reg_param.exp b/gdb/testsuite/gdb.ada/small_reg_param.exp
index e1c6a1c..a5dce7d 100644
--- a/gdb/testsuite/gdb.ada/small_reg_param.exp
+++ b/gdb/testsuite/gdb.ada/small_reg_param.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug optimize=-O1]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/small_reg_param/foo.adb b/gdb/testsuite/gdb.ada/small_reg_param/foo.adb
index 2db6918..f7291d0 100644
--- a/gdb/testsuite/gdb.ada/small_reg_param/foo.adb
+++ b/gdb/testsuite/gdb.ada/small_reg_param/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/small_reg_param/pck.adb b/gdb/testsuite/gdb.ada/small_reg_param/pck.adb
index 5ca5af2..9b94955 100644
--- a/gdb/testsuite/gdb.ada/small_reg_param/pck.adb
+++ b/gdb/testsuite/gdb.ada/small_reg_param/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/small_reg_param/pck.ads b/gdb/testsuite/gdb.ada/small_reg_param/pck.ads
index d564dac..0be2081 100644
--- a/gdb/testsuite/gdb.ada/small_reg_param/pck.ads
+++ b/gdb/testsuite/gdb.ada/small_reg_param/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/start.exp b/gdb/testsuite/gdb.ada/start.exp
index 7e78679..14f2490 100644
--- a/gdb/testsuite/gdb.ada/start.exp
+++ b/gdb/testsuite/gdb.ada/start.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ require !use_gdb_stub
standard_ada_testfile dummy
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
@@ -32,7 +32,7 @@ clean_restart ${testfile}
# Verify that "start" lands inside the right procedure.
if { [gdb_start_cmd] < 0 } {
fail "start failed to land inside the right procedure"
- return -1
+ return
}
gdb_test "" \
diff --git a/gdb/testsuite/gdb.ada/start/dummy.adb b/gdb/testsuite/gdb.ada/start/dummy.adb
index fa287ef..5d24e69 100644
--- a/gdb/testsuite/gdb.ada/start/dummy.adb
+++ b/gdb/testsuite/gdb.ada/start/dummy.adb
@@ -1,4 +1,4 @@
--- Copyright 2005-2024 Free Software Foundation, Inc.
+-- Copyright 2005-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/static-link.exp b/gdb/testsuite/gdb.ada/static-link.exp
index cf8fad3..1b05bcd 100644
--- a/gdb/testsuite/gdb.ada/static-link.exp
+++ b/gdb/testsuite/gdb.ada/static-link.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,14 +20,14 @@ require allow_ada_tests
standard_ada_testfile prog
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
set bp_location [gdb_get_line_number "STOP" ${testdir}/prog.adb]
if {![runto "prog.adb:$bp_location"]} {
- return -1
+ return
}
gdb_test "ptype value" [string_to_regexp "type = array (1 .. 3) of integer"]
diff --git a/gdb/testsuite/gdb.ada/static-link/pck.ads b/gdb/testsuite/gdb.ada/static-link/pck.ads
index 4d7618f..1c52820 100644
--- a/gdb/testsuite/gdb.ada/static-link/pck.ads
+++ b/gdb/testsuite/gdb.ada/static-link/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/static-link/prog.adb b/gdb/testsuite/gdb.ada/static-link/prog.adb
index 1b5dbd5..6f97925 100644
--- a/gdb/testsuite/gdb.ada/static-link/prog.adb
+++ b/gdb/testsuite/gdb.ada/static-link/prog.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/str_binop_equal.exp b/gdb/testsuite/gdb.ada/str_binop_equal.exp
index 943e0a6..4de533c 100644
--- a/gdb/testsuite/gdb.ada/str_binop_equal.exp
+++ b/gdb/testsuite/gdb.ada/str_binop_equal.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo_p211_061
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/str_binop_equal/foo_p211_061.adb b/gdb/testsuite/gdb.ada/str_binop_equal/foo_p211_061.adb
index db4d3aa..32a808d 100644
--- a/gdb/testsuite/gdb.ada/str_binop_equal/foo_p211_061.adb
+++ b/gdb/testsuite/gdb.ada/str_binop_equal/foo_p211_061.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/str_binop_equal/pck.adb b/gdb/testsuite/gdb.ada/str_binop_equal/pck.adb
index fd94ccb..32b2b6e 100644
--- a/gdb/testsuite/gdb.ada/str_binop_equal/pck.adb
+++ b/gdb/testsuite/gdb.ada/str_binop_equal/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/str_binop_equal/pck.ads b/gdb/testsuite/gdb.ada/str_binop_equal/pck.ads
index cbe2317..55d5efc 100644
--- a/gdb/testsuite/gdb.ada/str_binop_equal/pck.ads
+++ b/gdb/testsuite/gdb.ada/str_binop_equal/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/str_chars.exp b/gdb/testsuite/gdb.ada/str_chars.exp
index f459e3c..edd82e6 100644
--- a/gdb/testsuite/gdb.ada/str_chars.exp
+++ b/gdb/testsuite/gdb.ada/str_chars.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/str_chars/foo.adb b/gdb/testsuite/gdb.ada/str_chars/foo.adb
index 03eade4..c8c674b 100644
--- a/gdb/testsuite/gdb.ada/str_chars/foo.adb
+++ b/gdb/testsuite/gdb.ada/str_chars/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/str_ref_cmp.exp b/gdb/testsuite/gdb.ada/str_ref_cmp.exp
index 04ec420..a3362bf 100644
--- a/gdb/testsuite/gdb.ada/str_ref_cmp.exp
+++ b/gdb/testsuite/gdb.ada/str_ref_cmp.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
@@ -34,7 +34,7 @@ gdb_test_multiple {print "a" = "a"} $test {
-re " = false\r\n$gdb_prompt $" {
kfail ada/12607 $test
untested ${testdir}.exp
- return 0
+ return
}
-re " = true\r\n$gdb_prompt $" {
pass $test
diff --git a/gdb/testsuite/gdb.ada/str_ref_cmp/foo.adb b/gdb/testsuite/gdb.ada/str_ref_cmp/foo.adb
index 0b22f55..7029070 100644
--- a/gdb/testsuite/gdb.ada/str_ref_cmp/foo.adb
+++ b/gdb/testsuite/gdb.ada/str_ref_cmp/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/str_ref_cmp/pck.ads b/gdb/testsuite/gdb.ada/str_ref_cmp/pck.ads
index d058eac..78152a6 100644
--- a/gdb/testsuite/gdb.ada/str_ref_cmp/pck.ads
+++ b/gdb/testsuite/gdb.ada/str_ref_cmp/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/str_uninit.exp b/gdb/testsuite/gdb.ada/str_uninit.exp
index 1c55534..1157ef8 100644
--- a/gdb/testsuite/gdb.ada/str_uninit.exp
+++ b/gdb/testsuite/gdb.ada/str_uninit.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile parse
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/str_uninit/parse.adb b/gdb/testsuite/gdb.ada/str_uninit/parse.adb
index db5bb78..883f61a 100644
--- a/gdb/testsuite/gdb.ada/str_uninit/parse.adb
+++ b/gdb/testsuite/gdb.ada/str_uninit/parse.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/str_uninit/pck.adb b/gdb/testsuite/gdb.ada/str_uninit/pck.adb
index ff61a8e..700ac43 100644
--- a/gdb/testsuite/gdb.ada/str_uninit/pck.adb
+++ b/gdb/testsuite/gdb.ada/str_uninit/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/str_uninit/pck.ads b/gdb/testsuite/gdb.ada/str_uninit/pck.ads
index 2ef2759..e011ca0 100644
--- a/gdb/testsuite/gdb.ada/str_uninit/pck.ads
+++ b/gdb/testsuite/gdb.ada/str_uninit/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/sub_variant.exp b/gdb/testsuite/gdb.ada/sub_variant.exp
index 8f3dea7..b3c800f 100644
--- a/gdb/testsuite/gdb.ada/sub_variant.exp
+++ b/gdb/testsuite/gdb.ada/sub_variant.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile subv
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/sub_variant/subv.adb b/gdb/testsuite/gdb.ada/sub_variant/subv.adb
index e3dbefd..c1d4828 100644
--- a/gdb/testsuite/gdb.ada/sub_variant/subv.adb
+++ b/gdb/testsuite/gdb.ada/sub_variant/subv.adb
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/sym_print_name.exp b/gdb/testsuite/gdb.ada/sym_print_name.exp
index e2bb7b9..399fede 100644
--- a/gdb/testsuite/gdb.ada/sym_print_name.exp
+++ b/gdb/testsuite/gdb.ada/sym_print_name.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/sym_print_name/foo.adb b/gdb/testsuite/gdb.ada/sym_print_name/foo.adb
index d0eb98e..389515e 100644
--- a/gdb/testsuite/gdb.ada/sym_print_name/foo.adb
+++ b/gdb/testsuite/gdb.ada/sym_print_name/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/sym_print_name/pck.adb b/gdb/testsuite/gdb.ada/sym_print_name/pck.adb
index ba18be9..69773e6 100644
--- a/gdb/testsuite/gdb.ada/sym_print_name/pck.adb
+++ b/gdb/testsuite/gdb.ada/sym_print_name/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/sym_print_name/pck.ads b/gdb/testsuite/gdb.ada/sym_print_name/pck.ads
index e32338f..dfb0194 100644
--- a/gdb/testsuite/gdb.ada/sym_print_name/pck.ads
+++ b/gdb/testsuite/gdb.ada/sym_print_name/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/taft_type.exp b/gdb/testsuite/gdb.ada/taft_type.exp
index b00c290..25d7d56 100644
--- a/gdb/testsuite/gdb.ada/taft_type.exp
+++ b/gdb/testsuite/gdb.ada/taft_type.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile p
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
@@ -28,7 +28,7 @@ clean_restart ${testfile}
set bp_location [gdb_get_line_number "START" ${testdir}/p.adb]
if {![runto "p.adb:$bp_location"]} {
return
-}
+}
gdb_test "print w.e.all" \
"= \\(month => 8, year => 1974\\)"
diff --git a/gdb/testsuite/gdb.ada/taft_type/p.adb b/gdb/testsuite/gdb.ada/taft_type/p.adb
index 6decbd7..be35493 100644
--- a/gdb/testsuite/gdb.ada/taft_type/p.adb
+++ b/gdb/testsuite/gdb.ada/taft_type/p.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/taft_type/pck.adb b/gdb/testsuite/gdb.ada/taft_type/pck.adb
index e6f1edb..a581fc8 100644
--- a/gdb/testsuite/gdb.ada/taft_type/pck.adb
+++ b/gdb/testsuite/gdb.ada/taft_type/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/taft_type/pck.ads b/gdb/testsuite/gdb.ada/taft_type/pck.ads
index 521e100..cac3165 100644
--- a/gdb/testsuite/gdb.ada/taft_type/pck.ads
+++ b/gdb/testsuite/gdb.ada/taft_type/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tagged-lookup.exp b/gdb/testsuite/gdb.ada/tagged-lookup.exp
index f1473aa..726ead2 100644
--- a/gdb/testsuite/gdb.ada/tagged-lookup.exp
+++ b/gdb/testsuite/gdb.ada/tagged-lookup.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/tagged-lookup/foo.adb b/gdb/testsuite/gdb.ada/tagged-lookup/foo.adb
index 35e1aa3..ef8ad95 100644
--- a/gdb/testsuite/gdb.ada/tagged-lookup/foo.adb
+++ b/gdb/testsuite/gdb.ada/tagged-lookup/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tagged-lookup/pck.adb b/gdb/testsuite/gdb.ada/tagged-lookup/pck.adb
index d5f843a..10b240b 100644
--- a/gdb/testsuite/gdb.ada/tagged-lookup/pck.adb
+++ b/gdb/testsuite/gdb.ada/tagged-lookup/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tagged-lookup/pck.ads b/gdb/testsuite/gdb.ada/tagged-lookup/pck.ads
index 7731fe2..fdca197 100644
--- a/gdb/testsuite/gdb.ada/tagged-lookup/pck.ads
+++ b/gdb/testsuite/gdb.ada/tagged-lookup/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tagged-lookup/pck2.adb b/gdb/testsuite/gdb.ada/tagged-lookup/pck2.adb
index 87f77e5..c9f2364 100644
--- a/gdb/testsuite/gdb.ada/tagged-lookup/pck2.adb
+++ b/gdb/testsuite/gdb.ada/tagged-lookup/pck2.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tagged-lookup/pck2.ads b/gdb/testsuite/gdb.ada/tagged-lookup/pck2.ads
index c45962b..bbaee7e 100644
--- a/gdb/testsuite/gdb.ada/tagged-lookup/pck2.ads
+++ b/gdb/testsuite/gdb.ada/tagged-lookup/pck2.ads
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tagged.exp b/gdb/testsuite/gdb.ada/tagged.exp
index eabe015..ef714c6 100644
--- a/gdb/testsuite/gdb.ada/tagged.exp
+++ b/gdb/testsuite/gdb.ada/tagged.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ require gnat_runtime_has_debug_info
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/tagged/foo.adb b/gdb/testsuite/gdb.ada/tagged/foo.adb
index a190033..7177e28 100644
--- a/gdb/testsuite/gdb.ada/tagged/foo.adb
+++ b/gdb/testsuite/gdb.ada/tagged/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tagged/pck.adb b/gdb/testsuite/gdb.ada/tagged/pck.adb
index e0ec67d..7b1933a 100644
--- a/gdb/testsuite/gdb.ada/tagged/pck.adb
+++ b/gdb/testsuite/gdb.ada/tagged/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tagged/pck.ads b/gdb/testsuite/gdb.ada/tagged/pck.ads
index c9ac14b..88095c0 100644
--- a/gdb/testsuite/gdb.ada/tagged/pck.ads
+++ b/gdb/testsuite/gdb.ada/tagged/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tagged_access.exp b/gdb/testsuite/gdb.ada/tagged_access.exp
index 57f7440..4c5319f 100644
--- a/gdb/testsuite/gdb.ada/tagged_access.exp
+++ b/gdb/testsuite/gdb.ada/tagged_access.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" \
executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/tagged_access/p.adb b/gdb/testsuite/gdb.ada/tagged_access/p.adb
index 9a984c6..179bb50 100644
--- a/gdb/testsuite/gdb.ada/tagged_access/p.adb
+++ b/gdb/testsuite/gdb.ada/tagged_access/p.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tagged_access/pack.adb b/gdb/testsuite/gdb.ada/tagged_access/pack.adb
index 7f2197a..1b73829 100644
--- a/gdb/testsuite/gdb.ada/tagged_access/pack.adb
+++ b/gdb/testsuite/gdb.ada/tagged_access/pack.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tagged_access/pack.ads b/gdb/testsuite/gdb.ada/tagged_access/pack.ads
index 8ae4864..f7e2d85 100644
--- a/gdb/testsuite/gdb.ada/tagged_access/pack.ads
+++ b/gdb/testsuite/gdb.ada/tagged_access/pack.ads
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tagged_not_init.exp b/gdb/testsuite/gdb.ada/tagged_not_init.exp
index 7d3c462..ea65300 100644
--- a/gdb/testsuite/gdb.ada/tagged_not_init.exp
+++ b/gdb/testsuite/gdb.ada/tagged_not_init.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/tagged_not_init/foo.adb b/gdb/testsuite/gdb.ada/tagged_not_init/foo.adb
index 65ae86f..8aff7ef 100644
--- a/gdb/testsuite/gdb.ada/tagged_not_init/foo.adb
+++ b/gdb/testsuite/gdb.ada/tagged_not_init/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tagged_not_init/pck.adb b/gdb/testsuite/gdb.ada/tagged_not_init/pck.adb
index 2f05856..0bffc99 100644
--- a/gdb/testsuite/gdb.ada/tagged_not_init/pck.adb
+++ b/gdb/testsuite/gdb.ada/tagged_not_init/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tagged_not_init/pck.ads b/gdb/testsuite/gdb.ada/tagged_not_init/pck.ads
index fc8c215..3faaafb 100644
--- a/gdb/testsuite/gdb.ada/tagged_not_init/pck.ads
+++ b/gdb/testsuite/gdb.ada/tagged_not_init/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/task_bp.exp b/gdb/testsuite/gdb.ada/task_bp.exp
index 4b32a3d..7e9102c 100644
--- a/gdb/testsuite/gdb.ada/task_bp.exp
+++ b/gdb/testsuite/gdb.ada/task_bp.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
# Insert a breakpoint at LOC, and run the program expecting us to
diff --git a/gdb/testsuite/gdb.ada/task_bp/foo.adb b/gdb/testsuite/gdb.ada/task_bp/foo.adb
index e59ef5e..04188a6 100644
--- a/gdb/testsuite/gdb.ada/task_bp/foo.adb
+++ b/gdb/testsuite/gdb.ada/task_bp/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/task_bp/pck.adb b/gdb/testsuite/gdb.ada/task_bp/pck.adb
index 9a9bac6..386a23e 100644
--- a/gdb/testsuite/gdb.ada/task_bp/pck.adb
+++ b/gdb/testsuite/gdb.ada/task_bp/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/task_bp/pck.ads b/gdb/testsuite/gdb.ada/task_bp/pck.ads
index 7408e4b..0c7d590 100644
--- a/gdb/testsuite/gdb.ada/task_bp/pck.ads
+++ b/gdb/testsuite/gdb.ada/task_bp/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/task_switch_in_core.exp b/gdb/testsuite/gdb.ada/task_switch_in_core.exp
index dd63bb8..59fbe11 100644
--- a/gdb/testsuite/gdb.ada/task_switch_in_core.exp
+++ b/gdb/testsuite/gdb.ada/task_switch_in_core.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,12 +15,12 @@
load_lib "ada.exp"
-require allow_ada_tests
+require allow_ada_tests gcore_cmd_available
standard_ada_testfile crash
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
@@ -32,13 +32,13 @@ clean_restart ${testfile}
if {![runto request_for_crash]} {
untested "couldn't run to Request_For_Crash"
- return -1
+ return
}
set corefile [standard_output_file crash.gcore]
set core_supported [gdb_gcore_cmd "$corefile" "save a corefile"]
if {!$core_supported} {
- return -1
+ return
}
# Now that the core file has been created, we can start the real
diff --git a/gdb/testsuite/gdb.ada/task_switch_in_core/crash.adb b/gdb/testsuite/gdb.ada/task_switch_in_core/crash.adb
index 0624a64..d7d0c88 100644
--- a/gdb/testsuite/gdb.ada/task_switch_in_core/crash.adb
+++ b/gdb/testsuite/gdb.ada/task_switch_in_core/crash.adb
@@ -1,4 +1,4 @@
--- Copyright 2017-2024 Free Software Foundation, Inc.
+-- Copyright 2017-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/task_watch.exp b/gdb/testsuite/gdb.ada/task_watch.exp
index 42ad86e..54c9f10 100644
--- a/gdb/testsuite/gdb.ada/task_watch.exp
+++ b/gdb/testsuite/gdb.ada/task_watch.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ require allow_hw_watchpoint_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/task_watch/foo.adb b/gdb/testsuite/gdb.ada/task_watch/foo.adb
index dd3cd4a..25d836e 100644
--- a/gdb/testsuite/gdb.ada/task_watch/foo.adb
+++ b/gdb/testsuite/gdb.ada/task_watch/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2009-2024 Free Software Foundation, Inc.
+-- Copyright 2009-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tasks.exp b/gdb/testsuite/gdb.ada/tasks.exp
index ecbfbd5..4f6fc52 100644
--- a/gdb/testsuite/gdb.ada/tasks.exp
+++ b/gdb/testsuite/gdb.ada/tasks.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/tasks/foo.adb b/gdb/testsuite/gdb.ada/tasks/foo.adb
index e093897..4d3a782 100644
--- a/gdb/testsuite/gdb.ada/tasks/foo.adb
+++ b/gdb/testsuite/gdb.ada/tasks/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2009-2024 Free Software Foundation, Inc.
+-- Copyright 2009-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tick_last_segv.exp b/gdb/testsuite/gdb.ada/tick_last_segv.exp
index faabb5f..5dba9b6 100644
--- a/gdb/testsuite/gdb.ada/tick_last_segv.exp
+++ b/gdb/testsuite/gdb.ada/tick_last_segv.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/tick_last_segv/foo.adb b/gdb/testsuite/gdb.ada/tick_last_segv/foo.adb
index 3505f17..d3df927 100644
--- a/gdb/testsuite/gdb.ada/tick_last_segv/foo.adb
+++ b/gdb/testsuite/gdb.ada/tick_last_segv/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2009-2024 Free Software Foundation, Inc.
+-- Copyright 2009-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tick_length_array_enum_idx.exp b/gdb/testsuite/gdb.ada/tick_length_array_enum_idx.exp
index 533e2e3..0f560b2 100644
--- a/gdb/testsuite/gdb.ada/tick_length_array_enum_idx.exp
+++ b/gdb/testsuite/gdb.ada/tick_length_array_enum_idx.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo_n207_004
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/tick_length_array_enum_idx/foo_n207_004.adb b/gdb/testsuite/gdb.ada/tick_length_array_enum_idx/foo_n207_004.adb
index 9f243ad..9e7a977 100644
--- a/gdb/testsuite/gdb.ada/tick_length_array_enum_idx/foo_n207_004.adb
+++ b/gdb/testsuite/gdb.ada/tick_length_array_enum_idx/foo_n207_004.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tick_length_array_enum_idx/pck.adb b/gdb/testsuite/gdb.ada/tick_length_array_enum_idx/pck.adb
index f60d18f..7cc5dd9 100644
--- a/gdb/testsuite/gdb.ada/tick_length_array_enum_idx/pck.adb
+++ b/gdb/testsuite/gdb.ada/tick_length_array_enum_idx/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/tick_length_array_enum_idx/pck.ads b/gdb/testsuite/gdb.ada/tick_length_array_enum_idx/pck.ads
index b17a2c2..7f0405e 100644
--- a/gdb/testsuite/gdb.ada/tick_length_array_enum_idx/pck.ads
+++ b/gdb/testsuite/gdb.ada/tick_length_array_enum_idx/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2014-2024 Free Software Foundation, Inc.
+-- Copyright 2014-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/type-tick-size.exp b/gdb/testsuite/gdb.ada/type-tick-size.exp
index c696a31..1a5cabc 100644
--- a/gdb/testsuite/gdb.ada/type-tick-size.exp
+++ b/gdb/testsuite/gdb.ada/type-tick-size.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile prog
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/type-tick-size/pck.adb b/gdb/testsuite/gdb.ada/type-tick-size/pck.adb
index ffff1b6..c5b2358 100644
--- a/gdb/testsuite/gdb.ada/type-tick-size/pck.adb
+++ b/gdb/testsuite/gdb.ada/type-tick-size/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2024 Free Software Foundation, Inc.
+-- Copyright 2024-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/type-tick-size/pck.ads b/gdb/testsuite/gdb.ada/type-tick-size/pck.ads
index a3c3cd1..a0372a9 100644
--- a/gdb/testsuite/gdb.ada/type-tick-size/pck.ads
+++ b/gdb/testsuite/gdb.ada/type-tick-size/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2024 Free Software Foundation, Inc.
+-- Copyright 2024-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/type-tick-size/prog.adb b/gdb/testsuite/gdb.ada/type-tick-size/prog.adb
index c911583..a7457fd 100644
--- a/gdb/testsuite/gdb.ada/type-tick-size/prog.adb
+++ b/gdb/testsuite/gdb.ada/type-tick-size/prog.adb
@@ -1,4 +1,4 @@
--- Copyright 2024 Free Software Foundation, Inc.
+-- Copyright 2024-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@@ -50,6 +50,8 @@ procedure Prog is
Rec_Type_Size : Integer := Rec'Object_Size;
begin
+ Do_Nothing (Simple_Val'Address);
+ Do_Nothing (Rec_Val'Address);
Do_Nothing (Static_Blob'Address);
Do_Nothing (Dynamic_Blob'Address);
null; -- STOP
diff --git a/gdb/testsuite/gdb.ada/type-tick-size/support.adb b/gdb/testsuite/gdb.ada/type-tick-size/support.adb
index b694653..ac8bfae 100644
--- a/gdb/testsuite/gdb.ada/type-tick-size/support.adb
+++ b/gdb/testsuite/gdb.ada/type-tick-size/support.adb
@@ -1,4 +1,4 @@
--- Copyright 2024 Free Software Foundation, Inc.
+-- Copyright 2024-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/type-tick-size/support.ads b/gdb/testsuite/gdb.ada/type-tick-size/support.ads
index b86b14e..3a84ad0 100644
--- a/gdb/testsuite/gdb.ada/type-tick-size/support.ads
+++ b/gdb/testsuite/gdb.ada/type-tick-size/support.ads
@@ -1,4 +1,4 @@
--- Copyright 2024 Free Software Foundation, Inc.
+-- Copyright 2024-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/type_coercion.exp b/gdb/testsuite/gdb.ada/type_coercion.exp
index 50b1d7d..11f289f 100644
--- a/gdb/testsuite/gdb.ada/type_coercion.exp
+++ b/gdb/testsuite/gdb.ada/type_coercion.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile assign
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/type_coercion/assign.adb b/gdb/testsuite/gdb.ada/type_coercion/assign.adb
index 5edfa18..698f56f 100644
--- a/gdb/testsuite/gdb.ada/type_coercion/assign.adb
+++ b/gdb/testsuite/gdb.ada/type_coercion/assign.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/type_coercion/ident.adb b/gdb/testsuite/gdb.ada/type_coercion/ident.adb
index 8a22e2e..a53e3c4 100644
--- a/gdb/testsuite/gdb.ada/type_coercion/ident.adb
+++ b/gdb/testsuite/gdb.ada/type_coercion/ident.adb
@@ -1,4 +1,4 @@
--- Copyright 2008-2024 Free Software Foundation, Inc.
+-- Copyright 2008-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp b/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp
index 1512f23..db67715 100644
--- a/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp
+++ b/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec/foo.adb b/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec/foo.adb
index 2406eca..57b771e 100644
--- a/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec/foo.adb
+++ b/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec/pck.adb b/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec/pck.adb
index a64c5e9..54ddf5c 100644
--- a/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec/pck.adb
+++ b/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec/pck.ads b/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec/pck.ads
index bd9fd43..db7c0a8 100644
--- a/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec/pck.ads
+++ b/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/unchecked_union.exp b/gdb/testsuite/gdb.ada/unchecked_union.exp
index 5d3256b..d6dd0f5 100644
--- a/gdb/testsuite/gdb.ada/unchecked_union.exp
+++ b/gdb/testsuite/gdb.ada/unchecked_union.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ proc multi_line_string {str} {
foreach line [split $str \n] {
lappend result [string_to_regexp $line]
}
- return [eval multi_line $result]
+ return [multi_line {*}$result]
}
set inner_string { case ? is
@@ -55,7 +55,7 @@ foreach_gnat_encoding scenario flags {none all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/unchecked_union/pck.adb b/gdb/testsuite/gdb.ada/unchecked_union/pck.adb
index 64f765d..34162db 100644
--- a/gdb/testsuite/gdb.ada/unchecked_union/pck.adb
+++ b/gdb/testsuite/gdb.ada/unchecked_union/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/unchecked_union/pck.ads b/gdb/testsuite/gdb.ada/unchecked_union/pck.ads
index 195acda..40563bd 100644
--- a/gdb/testsuite/gdb.ada/unchecked_union/pck.ads
+++ b/gdb/testsuite/gdb.ada/unchecked_union/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/unchecked_union/unchecked_union.adb b/gdb/testsuite/gdb.ada/unchecked_union/unchecked_union.adb
index b2e97c8..9dce199 100644
--- a/gdb/testsuite/gdb.ada/unchecked_union/unchecked_union.adb
+++ b/gdb/testsuite/gdb.ada/unchecked_union/unchecked_union.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/uninitialized-variable-record.exp b/gdb/testsuite/gdb.ada/uninitialized-variable-record.exp
index 7fc7239..4cec919 100644
--- a/gdb/testsuite/gdb.ada/uninitialized-variable-record.exp
+++ b/gdb/testsuite/gdb.ada/uninitialized-variable-record.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile parse
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
@@ -91,7 +91,7 @@ for { set i 0 } { $i < 256 } { incr i } {
continue
}
- if { [expr $size > $offset_d] } {
+ if {$size > $offset_d} {
# Field d fits in the size.
continue
}
@@ -101,7 +101,7 @@ for { set i 0 } { $i < 256 } { incr i } {
}
}
-require {expr $interesting_discriminator != -1}
+require {expr {$interesting_discriminator != -1}}
foreach lang [gdb_supported_languages] {
with_test_prefix $lang {
diff --git a/gdb/testsuite/gdb.ada/uninitialized-variable-record/parse.adb b/gdb/testsuite/gdb.ada/uninitialized-variable-record/parse.adb
index f00c75c..50c26a3 100644
--- a/gdb/testsuite/gdb.ada/uninitialized-variable-record/parse.adb
+++ b/gdb/testsuite/gdb.ada/uninitialized-variable-record/parse.adb
@@ -1,4 +1,4 @@
--- Copyright 2009-2024 Free Software Foundation, Inc.
+-- Copyright 2009-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/uninitialized_vars.exp b/gdb/testsuite/gdb.ada/uninitialized_vars.exp
index 4c7aa10..9c325ed 100644
--- a/gdb/testsuite/gdb.ada/uninitialized_vars.exp
+++ b/gdb/testsuite/gdb.ada/uninitialized_vars.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ require allow_ada_tests
standard_ada_testfile parse
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/uninitialized_vars/parse.adb b/gdb/testsuite/gdb.ada/uninitialized_vars/parse.adb
index 5488e1f..430466f 100644
--- a/gdb/testsuite/gdb.ada/uninitialized_vars/parse.adb
+++ b/gdb/testsuite/gdb.ada/uninitialized_vars/parse.adb
@@ -1,4 +1,4 @@
--- Copyright 2009-2024 Free Software Foundation, Inc.
+-- Copyright 2009-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/uninitialized_vars/parse_controlled.ads b/gdb/testsuite/gdb.ada/uninitialized_vars/parse_controlled.ads
index 5ae2c99..e3e69c5 100644
--- a/gdb/testsuite/gdb.ada/uninitialized_vars/parse_controlled.ads
+++ b/gdb/testsuite/gdb.ada/uninitialized_vars/parse_controlled.ads
@@ -1,4 +1,4 @@
--- Copyright 2009-2024 Free Software Foundation, Inc.
+-- Copyright 2009-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/unsigned_last.exp b/gdb/testsuite/gdb.ada/unsigned_last.exp
index 0aabf76..3e0b96f 100644
--- a/gdb/testsuite/gdb.ada/unsigned_last.exp
+++ b/gdb/testsuite/gdb.ada/unsigned_last.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ require allow_ada_tests
standard_ada_testfile main
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/unsigned_last/main.adb b/gdb/testsuite/gdb.ada/unsigned_last/main.adb
index db39e6b..07f02dd 100644
--- a/gdb/testsuite/gdb.ada/unsigned_last/main.adb
+++ b/gdb/testsuite/gdb.ada/unsigned_last/main.adb
@@ -1,4 +1,4 @@
--- Copyright 2022-2024 Free Software Foundation, Inc.
+-- Copyright 2022-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/unsigned_range.exp b/gdb/testsuite/gdb.ada/unsigned_range.exp
index 7017d3d..cd72757 100644
--- a/gdb/testsuite/gdb.ada/unsigned_range.exp
+++ b/gdb/testsuite/gdb.ada/unsigned_range.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/unsigned_range/foo.adb b/gdb/testsuite/gdb.ada/unsigned_range/foo.adb
index 64e5f39..9613d9e 100644
--- a/gdb/testsuite/gdb.ada/unsigned_range/foo.adb
+++ b/gdb/testsuite/gdb.ada/unsigned_range/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/unsigned_range/pack.adb b/gdb/testsuite/gdb.ada/unsigned_range/pack.adb
index 691fcd1..c8ae145 100644
--- a/gdb/testsuite/gdb.ada/unsigned_range/pack.adb
+++ b/gdb/testsuite/gdb.ada/unsigned_range/pack.adb
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/unsigned_range/pack.ads b/gdb/testsuite/gdb.ada/unsigned_range/pack.ads
index 4c82471..d22b259 100644
--- a/gdb/testsuite/gdb.ada/unsigned_range/pack.ads
+++ b/gdb/testsuite/gdb.ada/unsigned_range/pack.ads
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/var_arr_attrs.exp b/gdb/testsuite/gdb.ada/var_arr_attrs.exp
index 698fe76..05faf93 100644
--- a/gdb/testsuite/gdb.ada/var_arr_attrs.exp
+++ b/gdb/testsuite/gdb.ada/var_arr_attrs.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo_o115_002
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/var_arr_attrs/foo_o115_002.adb b/gdb/testsuite/gdb.ada/var_arr_attrs/foo_o115_002.adb
index 096cbff..c07c90c 100644
--- a/gdb/testsuite/gdb.ada/var_arr_attrs/foo_o115_002.adb
+++ b/gdb/testsuite/gdb.ada/var_arr_attrs/foo_o115_002.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/var_arr_attrs/pck.adb b/gdb/testsuite/gdb.ada/var_arr_attrs/pck.adb
index 7cdfe48..f62d089 100644
--- a/gdb/testsuite/gdb.ada/var_arr_attrs/pck.adb
+++ b/gdb/testsuite/gdb.ada/var_arr_attrs/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/var_arr_attrs/pck.ads b/gdb/testsuite/gdb.ada/var_arr_attrs/pck.ads
index 6343d1d..0a6e7f6 100644
--- a/gdb/testsuite/gdb.ada/var_arr_attrs/pck.ads
+++ b/gdb/testsuite/gdb.ada/var_arr_attrs/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/var_arr_typedef.exp b/gdb/testsuite/gdb.ada/var_arr_typedef.exp
index 4b8d242..680b9cc 100644
--- a/gdb/testsuite/gdb.ada/var_arr_typedef.exp
+++ b/gdb/testsuite/gdb.ada/var_arr_typedef.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile var_arr_typedef
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/var_arr_typedef/pack.adb b/gdb/testsuite/gdb.ada/var_arr_typedef/pack.adb
index 491598b..80cfac1 100644
--- a/gdb/testsuite/gdb.ada/var_arr_typedef/pack.adb
+++ b/gdb/testsuite/gdb.ada/var_arr_typedef/pack.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@@ -20,6 +20,6 @@ package body Pack is
return I;
end Identity;
- procedure Do_Nothing (A : Array_Type) is null;
+ procedure Do_Nothing (A : System.Address) is null;
end Pack;
diff --git a/gdb/testsuite/gdb.ada/var_arr_typedef/pack.ads b/gdb/testsuite/gdb.ada/var_arr_typedef/pack.ads
index b777117..353ec48 100644
--- a/gdb/testsuite/gdb.ada/var_arr_typedef/pack.ads
+++ b/gdb/testsuite/gdb.ada/var_arr_typedef/pack.ads
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@@ -13,6 +13,8 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+with System; use System;
+
package Pack is
type Rec_Type is record
I : Integer;
@@ -23,7 +25,7 @@ package Pack is
type Array_Type is array (Positive range <>) of Vec_Type;
- procedure Do_Nothing (A : Array_Type);
+ procedure Do_Nothing (A : System.Address);
function Identity (I : Integer) return Integer;
end Pack;
diff --git a/gdb/testsuite/gdb.ada/var_arr_typedef/var_arr_typedef.adb b/gdb/testsuite/gdb.ada/var_arr_typedef/var_arr_typedef.adb
index af71387..86609a8 100644
--- a/gdb/testsuite/gdb.ada/var_arr_typedef/var_arr_typedef.adb
+++ b/gdb/testsuite/gdb.ada/var_arr_typedef/var_arr_typedef.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@@ -24,5 +24,5 @@ procedure Var_Arr_Typedef is
A : constant Array_Type (1 .. Identity (4)) := (VA, VA, VB, VB);
begin
- Do_Nothing (A); -- BREAK
+ Do_Nothing (A'Address); -- BREAK
end Var_Arr_Typedef;
diff --git a/gdb/testsuite/gdb.ada/var_rec_arr.exp b/gdb/testsuite/gdb.ada/var_rec_arr.exp
index 20598ea..73c5f6d 100644
--- a/gdb/testsuite/gdb.ada/var_rec_arr.exp
+++ b/gdb/testsuite/gdb.ada/var_rec_arr.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/var_rec_arr/foo_na09_042.adb b/gdb/testsuite/gdb.ada/var_rec_arr/foo_na09_042.adb
index 21c2775..fe33f2d 100644
--- a/gdb/testsuite/gdb.ada/var_rec_arr/foo_na09_042.adb
+++ b/gdb/testsuite/gdb.ada/var_rec_arr/foo_na09_042.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/var_rec_arr/pck.adb b/gdb/testsuite/gdb.ada/var_rec_arr/pck.adb
index a4611b1..3978554 100644
--- a/gdb/testsuite/gdb.ada/var_rec_arr/pck.adb
+++ b/gdb/testsuite/gdb.ada/var_rec_arr/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/var_rec_arr/pck.ads b/gdb/testsuite/gdb.ada/var_rec_arr/pck.ads
index 567a003..779fd7e 100644
--- a/gdb/testsuite/gdb.ada/var_rec_arr/pck.ads
+++ b/gdb/testsuite/gdb.ada/var_rec_arr/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2015-2024 Free Software Foundation, Inc.
+-- Copyright 2015-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/variant-record.exp b/gdb/testsuite/gdb.ada/variant-record.exp
index 672e12e..338b4fb 100644
--- a/gdb/testsuite/gdb.ada/variant-record.exp
+++ b/gdb/testsuite/gdb.ada/variant-record.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile proc
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/variant-record/proc.adb b/gdb/testsuite/gdb.ada/variant-record/proc.adb
index 7919ec4..598b854 100644
--- a/gdb/testsuite/gdb.ada/variant-record/proc.adb
+++ b/gdb/testsuite/gdb.ada/variant-record/proc.adb
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/variant-record/value.adb b/gdb/testsuite/gdb.ada/variant-record/value.adb
index ba9a6cf..875fca1 100644
--- a/gdb/testsuite/gdb.ada/variant-record/value.adb
+++ b/gdb/testsuite/gdb.ada/variant-record/value.adb
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/variant-record/value.ads b/gdb/testsuite/gdb.ada/variant-record/value.ads
index f462528..87c5c21 100644
--- a/gdb/testsuite/gdb.ada/variant-record/value.ads
+++ b/gdb/testsuite/gdb.ada/variant-record/value.ads
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/variant.exp b/gdb/testsuite/gdb.ada/variant.exp
index 227331c..b1cc728 100644
--- a/gdb/testsuite/gdb.ada/variant.exp
+++ b/gdb/testsuite/gdb.ada/variant.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ foreach_gnat_encoding scenario flags {none all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/variant/pck.ads b/gdb/testsuite/gdb.ada/variant/pck.ads
index 25cc8d4..e01f731 100644
--- a/gdb/testsuite/gdb.ada/variant/pck.ads
+++ b/gdb/testsuite/gdb.ada/variant/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/variant/pkg.adb b/gdb/testsuite/gdb.ada/variant/pkg.adb
index 4560176..15af844 100644
--- a/gdb/testsuite/gdb.ada/variant/pkg.adb
+++ b/gdb/testsuite/gdb.ada/variant/pkg.adb
@@ -1,4 +1,4 @@
--- Copyright 2020-2024 Free Software Foundation, Inc.
+-- Copyright 2020-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/variant_record_field.exp b/gdb/testsuite/gdb.ada/variant_record_field.exp
index ee7a1f3..fb5361d 100644
--- a/gdb/testsuite/gdb.ada/variant_record_field.exp
+++ b/gdb/testsuite/gdb.ada/variant_record_field.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ standard_ada_testfile foo
# making guarantees beyond -Og though, so test that.
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug optimize=-Og]] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/variant_record_field/foo.adb b/gdb/testsuite/gdb.ada/variant_record_field/foo.adb
index 2526a1d..a56b296 100644
--- a/gdb/testsuite/gdb.ada/variant_record_field/foo.adb
+++ b/gdb/testsuite/gdb.ada/variant_record_field/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2024 Free Software Foundation, Inc.
+-- Copyright 2024-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/variant_record_packed_array.exp b/gdb/testsuite/gdb.ada/variant_record_packed_array.exp
index 47446c9..cdfb4f4 100644
--- a/gdb/testsuite/gdb.ada/variant_record_packed_array.exp
+++ b/gdb/testsuite/gdb.ada/variant_record_packed_array.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
- return -1
+ return
}
clean_restart ${testfile}-${scenario}
diff --git a/gdb/testsuite/gdb.ada/variant_record_packed_array/foo.adb b/gdb/testsuite/gdb.ada/variant_record_packed_array/foo.adb
index 9c366f8..97b7d9c 100644
--- a/gdb/testsuite/gdb.ada/variant_record_packed_array/foo.adb
+++ b/gdb/testsuite/gdb.ada/variant_record_packed_array/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2009-2024 Free Software Foundation, Inc.
+-- Copyright 2009-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/variant_record_packed_array/pck.adb b/gdb/testsuite/gdb.ada/variant_record_packed_array/pck.adb
index 8164f50..75e3b15 100644
--- a/gdb/testsuite/gdb.ada/variant_record_packed_array/pck.adb
+++ b/gdb/testsuite/gdb.ada/variant_record_packed_array/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2009-2024 Free Software Foundation, Inc.
+-- Copyright 2009-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/variant_record_packed_array/pck.ads b/gdb/testsuite/gdb.ada/variant_record_packed_array/pck.ads
index 74f26a7..488db7e 100644
--- a/gdb/testsuite/gdb.ada/variant_record_packed_array/pck.ads
+++ b/gdb/testsuite/gdb.ada/variant_record_packed_array/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2009-2024 Free Software Foundation, Inc.
+-- Copyright 2009-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/varsize_limit.exp b/gdb/testsuite/gdb.ada/varsize_limit.exp
index a8920d3..171b2e4 100644
--- a/gdb/testsuite/gdb.ada/varsize_limit.exp
+++ b/gdb/testsuite/gdb.ada/varsize_limit.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile vsizelim
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/varsize_limit/pck.adb b/gdb/testsuite/gdb.ada/varsize_limit/pck.adb
index 5f53b7c..b0ff019 100644
--- a/gdb/testsuite/gdb.ada/varsize_limit/pck.adb
+++ b/gdb/testsuite/gdb.ada/varsize_limit/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/varsize_limit/pck.ads b/gdb/testsuite/gdb.ada/varsize_limit/pck.ads
index 22b2a3a..8850aa9 100644
--- a/gdb/testsuite/gdb.ada/varsize_limit/pck.ads
+++ b/gdb/testsuite/gdb.ada/varsize_limit/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/varsize_limit/vsizelim.adb b/gdb/testsuite/gdb.ada/varsize_limit/vsizelim.adb
index 22ec41c..8773c70 100644
--- a/gdb/testsuite/gdb.ada/varsize_limit/vsizelim.adb
+++ b/gdb/testsuite/gdb.ada/varsize_limit/vsizelim.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/verylong.exp b/gdb/testsuite/gdb.ada/verylong.exp
index c8574f3..e504de7 100644
--- a/gdb/testsuite/gdb.ada/verylong.exp
+++ b/gdb/testsuite/gdb.ada/verylong.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ require {gnat_version_compare >= 11}
standard_ada_testfile prog
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
@@ -41,13 +41,13 @@ gdb_test_multiple "ptype Long_Long_Long_Integer" "" {
}
}
-require {expr $lll_int_size == 8 || $lll_int_size == 16}
+require {expr {$lll_int_size == 8 || $lll_int_size == 16}}
gdb_test "print x" " = $max"
-gdb_test "print x / 2" " = [expr $max / 2]"
-gdb_test "print (x / 4) * 2" " = [expr ($max / 4) * 2]"
+gdb_test "print x / 2" " = [expr {$max / 2}]"
+gdb_test "print (x / 4) * 2" " = [expr {($max / 4) * 2}]"
gdb_test "print x - x" " = 0"
-gdb_test "print x - 99 + 1" " = [expr $max - 99 + 1]"
+gdb_test "print x - 99 + 1" " = [expr {$max - 99 + 1}]"
gdb_test "print -x" " = -$max"
gdb_test "print +x" " = $max"
diff --git a/gdb/testsuite/gdb.ada/verylong/prog.adb b/gdb/testsuite/gdb.ada/verylong/prog.adb
index e3b47f7..4165f3f 100644
--- a/gdb/testsuite/gdb.ada/verylong/prog.adb
+++ b/gdb/testsuite/gdb.ada/verylong/prog.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/vla.exp b/gdb/testsuite/gdb.ada/vla.exp
index 95ab603..144fbd6 100644
--- a/gdb/testsuite/gdb.ada/vla.exp
+++ b/gdb/testsuite/gdb.ada/vla.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile vla
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/vla/vla.adb b/gdb/testsuite/gdb.ada/vla/vla.adb
index cdefe5d..008b58e 100644
--- a/gdb/testsuite/gdb.ada/vla/vla.adb
+++ b/gdb/testsuite/gdb.ada/vla/vla.adb
@@ -1,4 +1,4 @@
--- Copyright 2019-2024 Free Software Foundation, Inc.
+-- Copyright 2019-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/voidctx.exp b/gdb/testsuite/gdb.ada/voidctx.exp
index 014dcf9..c48f51c 100644
--- a/gdb/testsuite/gdb.ada/voidctx.exp
+++ b/gdb/testsuite/gdb.ada/voidctx.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile voidctx
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/voidctx/pck.adb b/gdb/testsuite/gdb.ada/voidctx/pck.adb
index ef03728..2faacf1 100644
--- a/gdb/testsuite/gdb.ada/voidctx/pck.adb
+++ b/gdb/testsuite/gdb.ada/voidctx/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/voidctx/pck.ads b/gdb/testsuite/gdb.ada/voidctx/pck.ads
index 9ac4622..47c5e95 100644
--- a/gdb/testsuite/gdb.ada/voidctx/pck.ads
+++ b/gdb/testsuite/gdb.ada/voidctx/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/voidctx/voidctx.adb b/gdb/testsuite/gdb.ada/voidctx/voidctx.adb
index 18b67be..847bac5 100644
--- a/gdb/testsuite/gdb.ada/voidctx/voidctx.adb
+++ b/gdb/testsuite/gdb.ada/voidctx/voidctx.adb
@@ -1,4 +1,4 @@
--- Copyright 2021-2024 Free Software Foundation, Inc.
+-- Copyright 2021-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/watch_arg.exp b/gdb/testsuite/gdb.ada/watch_arg.exp
index 9df3f46..b1b6ade 100644
--- a/gdb/testsuite/gdb.ada/watch_arg.exp
+++ b/gdb/testsuite/gdb.ada/watch_arg.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile watch
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/watch_arg/pck.adb b/gdb/testsuite/gdb.ada/watch_arg/pck.adb
index 9edc10b..d616516 100644
--- a/gdb/testsuite/gdb.ada/watch_arg/pck.adb
+++ b/gdb/testsuite/gdb.ada/watch_arg/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/watch_arg/pck.ads b/gdb/testsuite/gdb.ada/watch_arg/pck.ads
index 7de7794..90f3ced 100644
--- a/gdb/testsuite/gdb.ada/watch_arg/pck.ads
+++ b/gdb/testsuite/gdb.ada/watch_arg/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/watch_arg/watch.adb b/gdb/testsuite/gdb.ada/watch_arg/watch.adb
index c7b312d..fa09776 100644
--- a/gdb/testsuite/gdb.ada/watch_arg/watch.adb
+++ b/gdb/testsuite/gdb.ada/watch_arg/watch.adb
@@ -1,4 +1,4 @@
--- Copyright 2006-2024 Free Software Foundation, Inc.
+-- Copyright 2006-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/watch_minus_l.exp b/gdb/testsuite/gdb.ada/watch_minus_l.exp
index 9216dcb..08be8bf 100644
--- a/gdb/testsuite/gdb.ada/watch_minus_l.exp
+++ b/gdb/testsuite/gdb.ada/watch_minus_l.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo_ra10_006
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/watch_minus_l/foo_ra10_006.adb b/gdb/testsuite/gdb.ada/watch_minus_l/foo_ra10_006.adb
index e0a09c3..b466aac 100644
--- a/gdb/testsuite/gdb.ada/watch_minus_l/foo_ra10_006.adb
+++ b/gdb/testsuite/gdb.ada/watch_minus_l/foo_ra10_006.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/watch_minus_l/pck.adb b/gdb/testsuite/gdb.ada/watch_minus_l/pck.adb
index 7b68d2a..3ced0c2 100644
--- a/gdb/testsuite/gdb.ada/watch_minus_l/pck.adb
+++ b/gdb/testsuite/gdb.ada/watch_minus_l/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/watch_minus_l/pck.ads b/gdb/testsuite/gdb.ada/watch_minus_l/pck.ads
index 6132c8d..ca98cb8 100644
--- a/gdb/testsuite/gdb.ada/watch_minus_l/pck.ads
+++ b/gdb/testsuite/gdb.ada/watch_minus_l/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2018-2024 Free Software Foundation, Inc.
+-- Copyright 2018-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/whatis_array_val.exp b/gdb/testsuite/gdb.ada/whatis_array_val.exp
index 1ebbf97..0fd48e6 100644
--- a/gdb/testsuite/gdb.ada/whatis_array_val.exp
+++ b/gdb/testsuite/gdb.ada/whatis_array_val.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
@@ -28,7 +28,7 @@ clean_restart ${testfile}
set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.adb]
if {![runto "foo.adb:$bp_location"]} {
return
-}
+}
# Accept "foo." prefix for older versions of GNAT.
gdb_test "whatis full" \
diff --git a/gdb/testsuite/gdb.ada/whatis_array_val/foo.adb b/gdb/testsuite/gdb.ada/whatis_array_val/foo.adb
index bd59bae..7315359 100644
--- a/gdb/testsuite/gdb.ada/whatis_array_val/foo.adb
+++ b/gdb/testsuite/gdb.ada/whatis_array_val/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2012-2024 Free Software Foundation, Inc.
+-- Copyright 2012-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/whatis_array_val/pck.adb b/gdb/testsuite/gdb.ada/whatis_array_val/pck.adb
index 9edc10b..d616516 100644
--- a/gdb/testsuite/gdb.ada/whatis_array_val/pck.adb
+++ b/gdb/testsuite/gdb.ada/whatis_array_val/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/whatis_array_val/pck.ads b/gdb/testsuite/gdb.ada/whatis_array_val/pck.ads
index 7de7794..90f3ced 100644
--- a/gdb/testsuite/gdb.ada/whatis_array_val/pck.ads
+++ b/gdb/testsuite/gdb.ada/whatis_array_val/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/widewide.exp b/gdb/testsuite/gdb.ada/widewide.exp
index f1ce084..722cf41 100644
--- a/gdb/testsuite/gdb.ada/widewide.exp
+++ b/gdb/testsuite/gdb.ada/widewide.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require allow_ada_tests
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/widewide/foo.adb b/gdb/testsuite/gdb.ada/widewide/foo.adb
index 862549b..2d57eeb 100644
--- a/gdb/testsuite/gdb.ada/widewide/foo.adb
+++ b/gdb/testsuite/gdb.ada/widewide/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/widewide/pck.adb b/gdb/testsuite/gdb.ada/widewide/pck.adb
index 43d850e..d696260 100644
--- a/gdb/testsuite/gdb.ada/widewide/pck.adb
+++ b/gdb/testsuite/gdb.ada/widewide/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/widewide/pck.ads b/gdb/testsuite/gdb.ada/widewide/pck.ads
index b4ffe89..27f82d0 100644
--- a/gdb/testsuite/gdb.ada/widewide/pck.ads
+++ b/gdb/testsuite/gdb.ada/widewide/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2011-2024 Free Software Foundation, Inc.
+-- Copyright 2011-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/win_fu_syms.exp b/gdb/testsuite/gdb.ada/win_fu_syms.exp
index 77c636b..8e4f215 100644
--- a/gdb/testsuite/gdb.ada/win_fu_syms.exp
+++ b/gdb/testsuite/gdb.ada/win_fu_syms.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ require ada_shared_link
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-bargs additional_flags=-shared additional_flags=-margs]] != "" } {
- return -1
+ return
}
clean_restart ${testfile}
diff --git a/gdb/testsuite/gdb.ada/win_fu_syms/foo.adb b/gdb/testsuite/gdb.ada/win_fu_syms/foo.adb
index cbc7281..b5bf58f 100644
--- a/gdb/testsuite/gdb.ada/win_fu_syms/foo.adb
+++ b/gdb/testsuite/gdb.ada/win_fu_syms/foo.adb
@@ -1,4 +1,4 @@
--- Copyright 2013-2024 Free Software Foundation, Inc.
+-- Copyright 2013-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/win_fu_syms/pck.adb b/gdb/testsuite/gdb.ada/win_fu_syms/pck.adb
index 63709c0..53fb2bb 100644
--- a/gdb/testsuite/gdb.ada/win_fu_syms/pck.adb
+++ b/gdb/testsuite/gdb.ada/win_fu_syms/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ada/win_fu_syms/pck.ads b/gdb/testsuite/gdb.ada/win_fu_syms/pck.ads
index 8d54929..5d6f631 100644
--- a/gdb/testsuite/gdb.ada/win_fu_syms/pck.ads
+++ b/gdb/testsuite/gdb.ada/win_fu_syms/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2007-2024 Free Software Foundation, Inc.
+-- Copyright 2007-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-atomic-inst.c b/gdb/testsuite/gdb.arch/aarch64-atomic-inst.c
index 658cc06..a9444b8 100644
--- a/gdb/testsuite/gdb.arch/aarch64-atomic-inst.c
+++ b/gdb/testsuite/gdb.arch/aarch64-atomic-inst.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp b/gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp
index e7ad261..fa80a9c 100644
--- a/gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/aarch64-brk-patterns.c b/gdb/testsuite/gdb.arch/aarch64-brk-patterns.c
index 146a9e5..81d2403 100644
--- a/gdb/testsuite/gdb.arch/aarch64-brk-patterns.c
+++ b/gdb/testsuite/gdb.arch/aarch64-brk-patterns.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-brk-patterns.exp b/gdb/testsuite/gdb.arch/aarch64-brk-patterns.exp
index d52df43..c2d944c 100644
--- a/gdb/testsuite/gdb.arch/aarch64-brk-patterns.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-brk-patterns.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.exp b/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.exp
index 07db789..7777175 100644
--- a/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-fp.c b/gdb/testsuite/gdb.arch/aarch64-fp.c
index 9bde0b0..d8e62bb 100644
--- a/gdb/testsuite/gdb.arch/aarch64-fp.c
+++ b/gdb/testsuite/gdb.arch/aarch64-fp.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-fp.exp b/gdb/testsuite/gdb.arch/aarch64-fp.exp
index 6284e41..ab4988c 100644
--- a/gdb/testsuite/gdb.arch/aarch64-fp.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-fp.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/aarch64-frameptr-vecreg-unwind.c b/gdb/testsuite/gdb.arch/aarch64-frameptr-vecreg-unwind.c
new file mode 100644
index 0000000..44ed3e8
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-frameptr-vecreg-unwind.c
@@ -0,0 +1,62 @@
+/* Copyright 2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+volatile void dummy () {}
+
+long test_function(void)
+{
+ __asm__ volatile (
+ /* Zero d0 (64-bit vector register part of v0). */
+ "movi d0, #0\n\t"
+
+ /* Move the frame pointer (x29) to d0 using fmov. */
+ "fmov d0, x29\n\t"
+
+ /* Describe CFI: Frame pointer is now in d0. */
+ ".cfi_register x29, d0\n\t"
+
+ /* Clobber list: Specify all modified registers. */
+ : /* No output operands. */
+ : /* No input operands. */
+ : "d0"
+ );
+
+ dummy (); /* break-here */
+
+ __asm__ volatile (
+ /* Restore the frame pointer (x29) from d0 using fmov. */
+ "fmov x29, d0\n\t"
+
+ /* Describe CFI: Frame pointer is restored. */
+ ".cfi_restore x29\n\t"
+
+ /* Clobber list: Specify all modified registers. */
+ : /* No output operands. */
+ : /* No input operands. */
+ : "x29", "d0"
+ );
+
+ return 0;
+}
+
+int
+main ()
+{
+ long result = test_function ();
+ dummy ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.arch/aarch64-frameptr-vecreg-unwind.exp b/gdb/testsuite/gdb.arch/aarch64-frameptr-vecreg-unwind.exp
new file mode 100644
index 0000000..2d710bc
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-frameptr-vecreg-unwind.exp
@@ -0,0 +1,33 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+require is_aarch64_target
+
+standard_testfile
+
+if { [prepare_for_testing "failed to prepare" ${testfile} \
+ "${srcfile}" {debug}] } {
+ return -1
+}
+
+if {![runto_main]} {
+ return
+}
+
+gdb_breakpoint [gdb_get_line_number "break-here"]
+gdb_continue_to_breakpoint "break-here"
+gdb_test "with confirm off --return -1" "result = test_function \\(\\);"
+gdb_test "step" "dummy \\(\\);"
+gdb_test "print result" "= -1"
diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-core.c b/gdb/testsuite/gdb.arch/aarch64-gcs-core.c
new file mode 100644
index 0000000..f3362cb
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-gcs-core.c
@@ -0,0 +1,123 @@
+/* This test program is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/auxv.h>
+#include <linux/prctl.h>
+#include <sys/syscall.h>
+
+/* Feature check for Guarded Control Stack. */
+#ifndef HWCAP_GCS
+#define HWCAP_GCS (1ULL << 32)
+#endif
+
+#ifndef PR_GET_SHADOW_STACK_STATUS
+#define PR_GET_SHADOW_STACK_STATUS 74
+#define PR_SET_SHADOW_STACK_STATUS 75
+#define PR_SHADOW_STACK_ENABLE (1UL << 0)
+#endif
+
+/* We need to use a macro to call prctl because after GCS is enabled, it's not
+ possible to return from the function which enabled it. This is because the
+ return address of the calling function isn't on the GCS. */
+#define my_syscall2(num, arg1, arg2) \
+ ({ \
+ register long _num __asm__("x8") = (num); \
+ register long _arg1 __asm__("x0") = (long)(arg1); \
+ register long _arg2 __asm__("x1") = (long)(arg2); \
+ register long _arg3 __asm__("x2") = 0; \
+ register long _arg4 __asm__("x3") = 0; \
+ register long _arg5 __asm__("x4") = 0; \
+ \
+ __asm__ volatile ("svc #0\n" \
+ : "=r"(_arg1) \
+ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), \
+ "r"(_arg5), "r"(_num) \
+ : "memory", "cc"); \
+ _arg1; \
+ })
+
+#define get_gcspr(void) \
+ ({ \
+ unsigned long *gcspr; \
+ \
+ /* Get GCSPR_EL0. */ \
+ asm volatile ("mrs %0, S3_3_C2_C5_1" : "=r"(gcspr) : : "cc"); \
+ \
+ gcspr; \
+ })
+
+/* Corrupt the return address to see if GDB will report a SIGSEGV with the
+ expected $_siginfo.si_code. */
+static void __attribute__ ((noinline))
+function (unsigned long *gcspr)
+{
+ /* x30 holds the return address. */
+ register long x30 __asm__("x30") __attribute__ ((unused));
+
+ /* Print GCSPR to stdout so that the testcase can capture it. */
+ printf ("%p\n", get_gcspr ());
+ fflush (stdout);
+
+ /* Cause a GCS exception. */
+ x30 = 0xbadc0ffee;
+ __asm__ volatile ("ret\n");
+}
+
+int
+main (void)
+{
+ if (!(getauxval (AT_HWCAP) & HWCAP_GCS))
+ {
+ fprintf (stderr, "GCS support not found in AT_HWCAP\n");
+ return EXIT_FAILURE;
+ }
+
+ /* Force shadow stacks on, our tests *should* be fine with or
+ without libc support and with or without this having ended
+ up tagged for GCS and enabled by the dynamic linker. We
+ can't use the libc prctl() function since we can't return
+ from enabling the stack. Also lock GCS if not already
+ locked so we can test behaviour when it's locked. */
+ unsigned long gcs_mode;
+ int ret = my_syscall2 (__NR_prctl, PR_GET_SHADOW_STACK_STATUS, &gcs_mode);
+ if (ret)
+ {
+ fprintf (stderr, "Failed to read GCS state: %d\n", ret);
+ return EXIT_FAILURE;
+ }
+
+ if (!(gcs_mode & PR_SHADOW_STACK_ENABLE))
+ {
+ gcs_mode = PR_SHADOW_STACK_ENABLE;
+ ret = my_syscall2 (__NR_prctl, PR_SET_SHADOW_STACK_STATUS, gcs_mode);
+ if (ret)
+ {
+ fprintf (stderr, "Failed to configure GCS: %d\n", ret);
+ return EXIT_FAILURE;
+ }
+ }
+
+ unsigned long *gcspr = get_gcspr ();
+
+ /* Pass gscpr to function just so it's used for something. */
+ function (gcspr); /* Break here. */
+
+ /* Avoid returning, in case libc doesn't understand GCS. */
+ exit (EXIT_SUCCESS);
+}
diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-core.exp b/gdb/testsuite/gdb.arch/aarch64-gcs-core.exp
new file mode 100644
index 0000000..66990eb
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-gcs-core.exp
@@ -0,0 +1,116 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test reading and writing the core dump of a binary that uses a Guarded
+# Control Stack.
+
+require allow_aarch64_gcs_tests
+
+standard_testfile
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
+ return
+}
+
+set linespec ${srcfile}:[gdb_get_line_number "Break here"]
+
+if {![runto $linespec]} {
+ return
+}
+
+# Obtain an OS-generated core file. Save test program output to
+# ${binfile}.out.
+set core_filename [core_find $binfile {} {} "${binfile}.out"]
+set core_generated [expr {$core_filename != ""}]
+
+# Make sure GDB can read the given core file correctly.
+proc check_core_file {core_filename saved_gcspr} {
+ global decimal hex
+
+ # Load the core file.
+ if {[gdb_test "core $core_filename" \
+ [multi_line \
+ "Core was generated by .*\\." \
+ "Program terminated with signal SIGSEGV, Segmentation fault" \
+ "Guarded Control Stack error\\." \
+ "#0 function \\(gcspr=$hex\\) at .*aarch64-gcs-core.c:$decimal" \
+ "$decimal.*__asm__ volatile \\(\"ret\\\\n\"\\);"] \
+ "load core file"]} {
+ return -1
+ }
+
+ # Check the value of GCSPR in the core file.
+ gdb_test "print/x \$gcspr" "\\$\[0-9\]+ = $saved_gcspr" \
+ "gcspr contents from core file"
+}
+
+if {!$core_generated} {
+ untested "unable to create or find corefile"
+}
+
+if {$core_generated} {
+ clean_restart
+ gdb_load $binfile
+
+ with_test_prefix "OS corefile" {
+ # Read GCSPR value from saved output of the test program.
+ set out_id [open ${binfile}.out "r"]
+ set gcspr_in_core [gets $out_id]
+ close $out_id
+
+ check_core_file $core_filename $gcspr_in_core
+ }
+}
+
+if {![gcore_cmd_available]} {
+ unsupported "target does not support gcore command."
+ return
+}
+
+clean_restart
+gdb_load $binfile
+
+if {![runto $linespec]} {
+ return
+}
+
+# Continue until a crash. The line with the hex number is optional because
+# it's printed by the test program, and doesn't appear in the Expect buffer
+# when testing a remote target.
+gdb_test "continue" \
+ [multi_line \
+ "Continuing\\." \
+ "($hex\r\n)?" \
+ "Program received signal SIGSEGV, Segmentation fault" \
+ "Guarded Control Stack error\\." \
+ "function \\(gcspr=$hex\\) at .*aarch64-gcs-core.c:$decimal" \
+ {.*__asm__ volatile \("ret\\n"\);}] \
+ "continue to SIGSEGV"
+
+set gcspr_in_gcore [get_valueof "/x" "\$gcspr" "*unknown*"]
+
+# Generate the gcore core file.
+set gcore_filename [standard_output_file "${testfile}.gcore"]
+set gcore_generated [gdb_gcore_cmd "$gcore_filename" "generate gcore file"]
+
+gdb_assert { $gcore_generated } "gcore corefile created"
+if {$gcore_generated} {
+ clean_restart
+ gdb_load $binfile
+
+ with_test_prefix "gcore corefile" {
+ check_core_file $gcore_filename $gcspr_in_gcore
+ }
+}
diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.c b/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.c
new file mode 100644
index 0000000..754fda1
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.c
@@ -0,0 +1,140 @@
+/* This test program is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/auxv.h>
+#include <sys/syscall.h>
+#include <linux/prctl.h>
+
+/* Feature check for Guarded Control Stack. */
+#ifndef HWCAP_GCS
+#define HWCAP_GCS (1ULL << 32)
+#endif
+
+#ifndef PR_GET_SHADOW_STACK_STATUS
+#define PR_GET_SHADOW_STACK_STATUS 74
+#define PR_SET_SHADOW_STACK_STATUS 75
+#define PR_SHADOW_STACK_ENABLE (1UL << 0)
+#endif
+
+/* We need to use a macro to call prctl because after GCS is enabled, it's not
+ possible to return from the function which enabled it. This is because the
+ return address of the calling function isn't on the GCS. */
+#define my_syscall2(num, arg1, arg2) \
+ ({ \
+ register long _num __asm__("x8") = (num); \
+ register long _arg1 __asm__("x0") = (long)(arg1); \
+ register long _arg2 __asm__("x1") = (long)(arg2); \
+ register long _arg3 __asm__("x2") = 0; \
+ register long _arg4 __asm__("x3") = 0; \
+ register long _arg5 __asm__("x4") = 0; \
+ \
+ __asm__ volatile("svc #0\n" \
+ : "=r"(_arg1) \
+ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), \
+ "r"(_arg5), "r"(_num) \
+ : "memory", "cc"); \
+ _arg1; \
+ })
+
+#define get_gcspr(void) \
+ ({ \
+ unsigned long *gcspr; \
+ \
+ /* Get GCSPR_EL0. */ \
+ asm volatile("mrs %0, S3_3_C2_C5_1" : "=r"(gcspr) : : "cc"); \
+ \
+ gcspr; \
+ })
+
+static int __attribute__ ((noinline))
+function2 (void)
+{
+ return EXIT_SUCCESS;
+}
+
+/* Put branch and link instructions being tested into their own functions so
+ that the program returns one level up in the stack after the displaced
+ stepped instruction. This tests that GDB doesn't leave the GCS out of sync
+ with the regular stack. */
+
+static int __attribute__ ((noinline))
+function_bl (void)
+{
+ register int x0 __asm__("x0");
+
+ __asm__ ("bl function2\n"
+ : "=r"(x0)
+ :
+ : "x30");
+
+ return x0;
+}
+
+static int __attribute__ ((noinline))
+function_blr (void)
+{
+ register int x0 __asm__("x0");
+
+ __asm__ ("blr %1\n"
+ : "=r"(x0)
+ : "r"(&function2)
+ : "x30");
+
+ return x0;
+}
+
+int
+main (void)
+{
+ if (!(getauxval (AT_HWCAP) & HWCAP_GCS))
+ {
+ fprintf (stderr, "GCS support not found in AT_HWCAP\n");
+ return EXIT_FAILURE;
+ }
+
+ /* Force shadow stacks on, our tests *should* be fine with or
+ without libc support and with or without this having ended
+ up tagged for GCS and enabled by the dynamic linker. We
+ can't use the libc prctl() function since we can't return
+ from enabling the stack. */
+ unsigned long gcs_mode;
+ int ret = my_syscall2 (__NR_prctl, PR_GET_SHADOW_STACK_STATUS, &gcs_mode);
+ if (ret)
+ {
+ fprintf (stderr, "Failed to read GCS state: %d\n", ret);
+ return EXIT_FAILURE;
+ }
+
+ if (!(gcs_mode & PR_SHADOW_STACK_ENABLE))
+ {
+ gcs_mode = PR_SHADOW_STACK_ENABLE;
+ ret = my_syscall2 (__NR_prctl, PR_SET_SHADOW_STACK_STATUS, gcs_mode);
+ if (ret)
+ {
+ fprintf (stderr, "Failed to configure GCS: %d\n", ret);
+ return EXIT_FAILURE;
+ }
+ }
+
+ int ret1 = function_bl ();
+ int ret2 = function_blr ();
+
+ /* Avoid returning, in case libc doesn't understand GCS. */
+ exit (ret1 + ret2);
+}
diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.exp b/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.exp
new file mode 100644
index 0000000..e625251
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.exp
@@ -0,0 +1,86 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test displaced stepping in a program that uses a Guarded Control Stack.
+
+require allow_aarch64_gcs_tests
+
+standard_testfile
+
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
+ return
+}
+
+if {![runto_main]} {
+ return
+}
+
+gdb_test_no_output "set breakpoint auto-hw off"
+gdb_test_no_output "set displaced-stepping on"
+
+# Get address of the branch and link instructions of interest.
+set addr_bl 0
+set test "get address of bl instruction"
+gdb_test_multiple "disassemble function_bl" $test -lbl {
+ -re "\r\n\\s+($hex) <\\+${decimal}>:\\s+bl\\s+${hex} <function2>(?=\r\n)" {
+ set addr_bl $expect_out(1,string)
+ exp_continue
+ }
+ -re -wrap "" {
+ gdb_assert { $addr_bl != 0 } $test
+ }
+}
+
+set addr_blr 0
+set test "get address of blr instruction"
+gdb_test_multiple "disassemble function_blr" $test -lbl {
+ -re "\r\n\\s+($hex) <\\+${decimal}>:\\s+blr\\s+x${decimal}(?=\r\n)" {
+ set addr_blr $expect_out(1,string)
+ exp_continue
+ }
+ -re -wrap "" {
+ gdb_assert { $addr_blr != 0 } $test
+ }
+}
+
+if { $addr_bl == 0 || $addr_blr == 0 } {
+ return
+}
+
+gdb_test "break *$addr_bl" \
+ "Breakpoint $decimal at $hex: file .*aarch64-gcs-disp-step.c, line ${decimal}." \
+ "set breakpoint at bl instruction"
+
+gdb_test "break *$addr_blr" \
+ "Breakpoint $decimal at $hex: file .*aarch64-gcs-disp-step.c, line ${decimal}." \
+ "set breakpoint at blr instruction"
+
+gdb_test "continue" \
+ [multi_line \
+ {Continuing\.} \
+ "" \
+ "Breakpoint $decimal, function_bl \\(\\) at .*aarch64-gcs-disp-step.c:${decimal}(?: \\\[GCS error\\\])?" \
+ {[^\r\n]+"bl function2\\n"}] \
+ "continue to breakpoint at bl"
+
+gdb_test "continue" \
+ [multi_line \
+ {Continuing\.} \
+ "" \
+ "Breakpoint $decimal, $hex in function_blr \\(\\) at .*aarch64-gcs-disp-step.c:${decimal}(?: \\\[GCS error\\\])?" \
+ {[^\r\n]+"blr %1\\n"}] \
+ "continue to breakpoint at blr"
+
+gdb_continue_to_end
diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-return.c b/gdb/testsuite/gdb.arch/aarch64-gcs-return.c
new file mode 100644
index 0000000..c062fea
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-gcs-return.c
@@ -0,0 +1,105 @@
+/* This test program is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/auxv.h>
+#include <sys/syscall.h>
+#include <linux/prctl.h>
+
+/* Feature check for Guarded Control Stack. */
+#ifndef HWCAP_GCS
+#define HWCAP_GCS (1ULL << 32)
+#endif
+
+#ifndef PR_GET_SHADOW_STACK_STATUS
+#define PR_GET_SHADOW_STACK_STATUS 74
+#define PR_SET_SHADOW_STACK_STATUS 75
+#define PR_SHADOW_STACK_ENABLE (1UL << 0)
+#endif
+
+/* We need to use a macro to call prctl because after GCS is enabled, it's not
+ possible to return from the function which enabled it. This is because the
+ return address of the calling function isn't on the GCS. */
+#define my_syscall2(num, arg1, arg2) \
+ ({ \
+ register long _num __asm__("x8") = (num); \
+ register long _arg1 __asm__("x0") = (long)(arg1); \
+ register long _arg2 __asm__("x1") = (long)(arg2); \
+ register long _arg3 __asm__("x2") = 0; \
+ register long _arg4 __asm__("x3") = 0; \
+ register long _arg5 __asm__("x4") = 0; \
+ \
+ __asm__ volatile("svc #0\n" \
+ : "=r"(_arg1) \
+ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), \
+ "r"(_arg5), "r"(_num) \
+ : "memory", "cc"); \
+ _arg1; \
+ })
+
+static int __attribute__ ((noinline))
+call2 ()
+{
+ return 42; /* Break call2. */
+}
+
+static int __attribute__ ((noinline))
+call1 ()
+{
+ return call2 (); /* Break call1. */
+}
+
+int
+main ()
+{
+ if (!(getauxval (AT_HWCAP) & HWCAP_GCS))
+ {
+ fprintf (stderr, "GCS support not found in AT_HWCAP\n");
+ return EXIT_FAILURE;
+ }
+
+ /* Force shadow stacks on, our tests *should* be fine with or
+ without libc support and with or without this having ended
+ up tagged for GCS and enabled by the dynamic linker. We
+ can't use the libc prctl() function since we can't return
+ from enabling the stack. Also lock GCS if not already
+ locked so we can test behaviour when it's locked. */
+ unsigned long gcs_mode;
+ int ret = my_syscall2 (__NR_prctl, PR_GET_SHADOW_STACK_STATUS, &gcs_mode);
+ if (ret)
+ {
+ fprintf (stderr, "Failed to read GCS state: %d\n", ret);
+ return EXIT_FAILURE;
+ }
+
+ if (!(gcs_mode & PR_SHADOW_STACK_ENABLE))
+ {
+ gcs_mode = PR_SHADOW_STACK_ENABLE;
+ ret = my_syscall2 (__NR_prctl, PR_SET_SHADOW_STACK_STATUS, gcs_mode);
+ if (ret)
+ {
+ fprintf (stderr, "Failed to configure GCS: %d\n", ret);
+ return EXIT_FAILURE;
+ }
+ }
+
+ call1 (); /* Break begin. */
+
+ /* Avoid returning, in case libc doesn't understand GCS. */
+ exit (EXIT_SUCCESS);
+}
diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-return.exp b/gdb/testsuite/gdb.arch/aarch64-gcs-return.exp
new file mode 100644
index 0000000..7e531e8
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-gcs-return.exp
@@ -0,0 +1,132 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test the GDB return command in a program that uses a Guarded Control Stack.
+# Based on the return tests in gdb.arch/amd64-shadow-stack-cmds.exp.
+# Note that potential GCS violations often only occur after resuming normal
+# execution. Therefore, it is important to test normal program
+# completion after testing the return command.
+
+require allow_aarch64_gcs_tests
+
+standard_testfile
+
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
+ return
+}
+
+set begin_line [gdb_get_line_number "Break begin"]
+set call1_line [gdb_get_line_number "Break call1"]
+set call2_line [gdb_get_line_number "Break call2"]
+
+if {![runto ${begin_line}]} {
+ return
+}
+
+proc restart_and_run_infcall_call2 {} {
+ global binfile call2_line
+ clean_restart
+ gdb_load $binfile
+ if {![runto_main]} {
+ return
+ }
+ set inside_infcall_str "The program being debugged stopped while in a function called from GDB"
+ gdb_breakpoint ${call2_line}
+ gdb_continue_to_breakpoint "Break call2" ".*Break call2.*"
+ gdb_test "call (int) call2()" \
+ "Breakpoint \[0-9\]*, call2.*$inside_infcall_str.*"
+}
+
+with_test_prefix "test inferior call and continue" {
+ gdb_breakpoint ${call1_line}
+ gdb_continue_to_breakpoint "Break call1" ".*Break call1.*"
+
+ gdb_test "call (int) call2()" "= 42"
+
+ gdb_continue_to_end
+}
+
+with_test_prefix "test return inside an inferior call" {
+ restart_and_run_infcall_call2
+
+ gdb_test "return" "\#0.*call2.*" \
+ "Test GCS return inside an inferior call" \
+ "Make.*return now\\? \\(y or n\\) " "y"
+
+ gdb_continue_to_end
+}
+
+with_test_prefix "test return 'above' an inferior call" {
+ restart_and_run_infcall_call2
+
+ gdb_test "frame 2" "call2 ().*" "move to frame 'above' inferior call"
+
+ gdb_test "return" "\#0.*call1.*" \
+ "Test GCS return 'above' an inferior call" \
+ "Make.*return now\\? \\(y or n\\) " "y"
+
+ gdb_continue_to_end
+}
+
+clean_restart
+gdb_load $binfile
+if {![runto ${begin_line}]} {
+ return
+}
+
+# Extract GCS pointer inside main, call1 and call2 function.
+gdb_breakpoint ${call1_line}
+gdb_breakpoint ${call2_line}
+set gcspr_main [get_valueof /x "\$gcspr" 0 "get value of gcspr in main"]
+gdb_continue_to_breakpoint "Break call1" ".*Break call1.*"
+set gcspr_call1 [get_valueof /x "\$gcspr" 0 "get value of gcspr in call1"]
+gdb_continue_to_breakpoint "Break call2" ".*Break call2.*"
+set gcspr_call2 [get_valueof /x "\$gcspr" 0 "get value of gcspr in call2"]
+
+with_test_prefix "test frame level update" {
+ gdb_test "up" "call1.*" "move to frame 1"
+ gdb_test "print /x \$gcspr" "= $gcspr_call1" "check gcspr of frame 1"
+ gdb_test "up" "main.*" "move to frame 2"
+ gdb_test "print /x \$gcspr" "= $gcspr_main" "check gcspr of frame 2"
+ gdb_test "frame 0" "call2.*" "move to frame 0"
+ gdb_test "print /x \$gcspr" "= $gcspr_call2" "check gcspr of frame 0"
+}
+
+with_test_prefix "test return from current frame" {
+ gdb_test "return (int) 1" "#0.*call1.*" \
+ "Test GCS return from current frame" \
+ "Make.*return now\\? \\(y or n\\) " "y"
+
+ gdb_continue_to_end
+}
+
+clean_restart
+gdb_load $binfile
+if {![runto_main]} {
+ return
+}
+
+with_test_prefix "test return from past frame" {
+ gdb_breakpoint ${call2_line}
+ gdb_continue_to_breakpoint "Break call2" ".*Break call2.*"
+
+ gdb_test "frame 1" ".*in call1.*"
+
+ gdb_test "return (int) 1" "#0.*main.*" \
+ "Test GCS return from past frame" \
+ "Make.*return now\\? \\(y or n\\) " "y"
+
+ gdb_continue_to_end
+}
diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-tdesc-without-linux.xml b/gdb/testsuite/gdb.arch/aarch64-gcs-tdesc-without-linux.xml
new file mode 100644
index 0000000..056ab58
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-gcs-tdesc-without-linux.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<target>
+ <architecture>aarch64</architecture>
+ <feature name="org.gnu.gdb.aarch64.core">
+ <flags id="cpsr_flags" size="4">
+ <field name="SP" start="0" end="0" type="bool"/>
+ <field name="EL" start="2" end="3" type="uint32"/>
+ <field name="nRW" start="4" end="4" type="bool"/>
+ <field name="F" start="6" end="6" type="bool"/>
+ <field name="I" start="7" end="7" type="bool"/>
+ <field name="A" start="8" end="8" type="bool"/>
+ <field name="D" start="9" end="9" type="bool"/>
+ <field name="BTYPE" start="10" end="11" type="uint32"/>
+ <field name="SSBS" start="12" end="12" type="bool"/>
+ <field name="IL" start="20" end="20" type="bool"/>
+ <field name="SS" start="21" end="21" type="bool"/>
+ <field name="PAN" start="22" end="22" type="bool"/>
+ <field name="UAO" start="23" end="23" type="bool"/>
+ <field name="DIT" start="24" end="24" type="bool"/>
+ <field name="TCO" start="25" end="25" type="bool"/>
+ <field name="V" start="28" end="28" type="bool"/>
+ <field name="C" start="29" end="29" type="bool"/>
+ <field name="Z" start="30" end="30" type="bool"/>
+ <field name="N" start="31" end="31" type="bool"/>
+ </flags>
+ <reg name="x0" bitsize="64" type="int" regnum="0"/>
+ <reg name="x1" bitsize="64" type="int" regnum="1"/>
+ <reg name="x2" bitsize="64" type="int" regnum="2"/>
+ <reg name="x3" bitsize="64" type="int" regnum="3"/>
+ <reg name="x4" bitsize="64" type="int" regnum="4"/>
+ <reg name="x5" bitsize="64" type="int" regnum="5"/>
+ <reg name="x6" bitsize="64" type="int" regnum="6"/>
+ <reg name="x7" bitsize="64" type="int" regnum="7"/>
+ <reg name="x8" bitsize="64" type="int" regnum="8"/>
+ <reg name="x9" bitsize="64" type="int" regnum="9"/>
+ <reg name="x10" bitsize="64" type="int" regnum="10"/>
+ <reg name="x11" bitsize="64" type="int" regnum="11"/>
+ <reg name="x12" bitsize="64" type="int" regnum="12"/>
+ <reg name="x13" bitsize="64" type="int" regnum="13"/>
+ <reg name="x14" bitsize="64" type="int" regnum="14"/>
+ <reg name="x15" bitsize="64" type="int" regnum="15"/>
+ <reg name="x16" bitsize="64" type="int" regnum="16"/>
+ <reg name="x17" bitsize="64" type="int" regnum="17"/>
+ <reg name="x18" bitsize="64" type="int" regnum="18"/>
+ <reg name="x19" bitsize="64" type="int" regnum="19"/>
+ <reg name="x20" bitsize="64" type="int" regnum="20"/>
+ <reg name="x21" bitsize="64" type="int" regnum="21"/>
+ <reg name="x22" bitsize="64" type="int" regnum="22"/>
+ <reg name="x23" bitsize="64" type="int" regnum="23"/>
+ <reg name="x24" bitsize="64" type="int" regnum="24"/>
+ <reg name="x25" bitsize="64" type="int" regnum="25"/>
+ <reg name="x26" bitsize="64" type="int" regnum="26"/>
+ <reg name="x27" bitsize="64" type="int" regnum="27"/>
+ <reg name="x28" bitsize="64" type="int" regnum="28"/>
+ <reg name="x29" bitsize="64" type="int" regnum="29"/>
+ <reg name="x30" bitsize="64" type="int" regnum="30"/>
+ <reg name="sp" bitsize="64" type="data_ptr" regnum="31"/>
+ <reg name="pc" bitsize="64" type="code_ptr" regnum="32"/>
+ <reg name="cpsr" bitsize="32" type="cpsr_flags" regnum="33"/>
+ </feature>
+ <feature name="org.gnu.gdb.aarch64.gcs">
+ <reg name="gcspr" bitsize="64" type="data_ptr" regnum="90" group="system"/>
+ </feature>
+</target>
diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.c b/gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.c
new file mode 100644
index 0000000..10cf749
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.c
@@ -0,0 +1,26 @@
+/* This test program is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+
+int
+main (void)
+{
+ printf ("Hello, world!\n");
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.exp b/gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.exp
new file mode 100644
index 0000000..ba7741f
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.exp
@@ -0,0 +1,48 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test that GDB complains when given a target description with the GCS feature
+# but not the GCS Linux feature.
+
+require allow_aarch64_gcs_tests
+
+standard_testfile
+
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
+ return
+}
+
+set xml_path "${srcdir}/${subdir}/aarch64-gcs-tdesc-without-linux.xml"
+
+gdb_test "set tdesc filename ${xml_path}" \
+ "warning: Incomplete GCS support in the target: missing Linux part. GCS feature disabled." \
+ "warn about incomplete GCS support"
+
+# We can't test a debugging session on a remote target because with the
+# wrong tdesc, GDB expects a g packet reply with the wrong size.
+if {[gdb_protocol_is_remote]} {
+ return
+}
+
+if {![runto_main]} {
+ return
+}
+
+gdb_test "print \$gcspr" " = <unavailable>" "GCSPR is unavailable"
+
+# Now check that we can continue the debugging session normally.
+gdb_test "next"
+
+gdb_continue_to_end
diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs.c b/gdb/testsuite/gdb.arch/aarch64-gcs.c
new file mode 100644
index 0000000..9eb2e9e
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-gcs.c
@@ -0,0 +1,180 @@
+/* This test program is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <sys/auxv.h>
+#include <sys/syscall.h>
+#include <linux/prctl.h>
+
+/* Feature check for Guarded Control Stack. */
+#ifndef HWCAP_GCS
+#define HWCAP_GCS (1ULL << 32)
+#endif
+
+#ifndef PR_GET_SHADOW_STACK_STATUS
+#define PR_GET_SHADOW_STACK_STATUS 74
+#define PR_SET_SHADOW_STACK_STATUS 75
+#define PR_SHADOW_STACK_ENABLE (1UL << 0)
+#endif
+
+/* We need to use a macro to call prctl because after GCS is enabled, it's not
+ possible to return from the function which enabled it. This is because the
+ return address of the calling function isn't on the GCS. */
+#define my_syscall2(num, arg1, arg2) \
+ ({ \
+ register long _num __asm__("x8") = (num); \
+ register long _arg1 __asm__("x0") = (long)(arg1); \
+ register long _arg2 __asm__("x1") = (long)(arg2); \
+ register long _arg3 __asm__("x2") = 0; \
+ register long _arg4 __asm__("x3") = 0; \
+ register long _arg5 __asm__("x4") = 0; \
+ \
+ __asm__ volatile ("svc #0\n" \
+ : "=r"(_arg1) \
+ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), \
+ "r"(_arg5), "r"(_num) \
+ : "memory", "cc"); \
+ _arg1; \
+ })
+
+#define get_gcspr(void) \
+ ({ \
+ unsigned long *gcspr; \
+ \
+ /* Get GCSPR_EL0. */ \
+ asm volatile ("mrs %0, S3_3_C2_C5_1" : "=r"(gcspr) : : "cc"); \
+ \
+ gcspr; \
+ })
+
+static unsigned long *handler_gcspr = 0;
+
+static void
+handler (int sig)
+{
+ handler_gcspr = get_gcspr ();
+}
+
+static int __attribute__ ((unused))
+called_from_gdb (int val)
+{
+ return val + 1;
+}
+
+/* Corrupt the return address to see if GDB will report a SIGSEGV with the
+ expected $_siginfo.si_code. */
+static void __attribute__ ((noinline))
+normal_function2 (void)
+{
+ /* x30 holds the return address. */
+ register unsigned long x30 __asm__("x30") __attribute__ ((unused));
+
+ /* Cause a GCS exception. */
+ x30 = 0xbadc0ffee;
+ /* Use explicit ret so that we can verify that a SIGSEGV was generated
+ exactly on the return instruction. */
+ __asm__ volatile ("ret\n");
+}
+
+static inline void __attribute__ ((__always_inline__))
+inline_function2 (void)
+{
+ normal_function2 ();
+}
+
+static void __attribute__ ((noinline))
+normal_function1 (void)
+{
+ inline_function2 ();
+}
+
+/* First in a sequence of inline and normal functions, to test GDB
+ backtrace. */
+static inline void __attribute__ ((__always_inline__))
+inline_function1 (void)
+{
+ normal_function1 ();
+}
+
+/* Trivial function, just so that GDB can test return with wrong GCSPR. */
+static void __attribute__ ((noinline))
+normal_function0 (void)
+{
+ /* Use explicit ret so that we can verify that a SIGSEGV was generated
+ exactly on the return instruction. */
+ __asm__ volatile ("ret\n");
+}
+
+int
+main (void)
+{
+ if (!(getauxval (AT_HWCAP) & HWCAP_GCS))
+ {
+ fprintf (stderr, "GCS support not found in AT_HWCAP\n");
+ return EXIT_FAILURE;
+ }
+
+ /* Force shadow stacks on, our tests *should* be fine with or
+ without libc support and with or without this having ended
+ up tagged for GCS and enabled by the dynamic linker. We
+ can't use the libc prctl() function since we can't return
+ from enabling the stack. Also lock GCS if not already
+ locked so we can test behaviour when it's locked. */
+ unsigned long gcs_mode;
+ int ret = my_syscall2 (__NR_prctl, PR_GET_SHADOW_STACK_STATUS, &gcs_mode);
+ if (ret)
+ {
+ fprintf (stderr, "Failed to read GCS state: %d\n", ret);
+ return EXIT_FAILURE;
+ }
+
+ if (!(gcs_mode & PR_SHADOW_STACK_ENABLE))
+ {
+ gcs_mode = PR_SHADOW_STACK_ENABLE;
+ ret = my_syscall2 (__NR_prctl, PR_SET_SHADOW_STACK_STATUS, gcs_mode);
+ if (ret)
+ {
+ fprintf (stderr, "Failed to configure GCS: %d\n", ret);
+ return EXIT_FAILURE;
+ }
+ }
+
+ /* Regular function call. */
+ normal_function0 ();
+
+ /* This is used by GDB. */
+ __attribute__((unused)) unsigned long *gcspr = get_gcspr ();
+
+ struct sigaction act = { 0 };
+
+ act.sa_handler = &handler; /* Break here. */
+ if (sigaction (SIGUSR1, &act, NULL) == -1)
+ {
+ perror ("sigaction");
+ exit (EXIT_FAILURE);
+ }
+
+ raise (SIGUSR1);
+
+/* Call sequence of inline and normal functions, to test GDB backtrace. */
+ inline_function1 ();
+
+ /* Avoid returning, in case libc doesn't understand GCS. */
+ exit (EXIT_SUCCESS);
+}
diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs.exp b/gdb/testsuite/gdb.arch/aarch64-gcs.exp
new file mode 100644
index 0000000..63c18a1
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-gcs.exp
@@ -0,0 +1,99 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test a binary that uses a Guarded Control Stack.
+
+require allow_aarch64_gcs_tests
+
+standard_testfile
+
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
+ return
+}
+
+set linespec ${srcfile}:[gdb_get_line_number "Break here"]
+
+if {![runto ${linespec}]} {
+ return
+}
+
+gdb_test "print \$gcs_features_enabled" \
+ [string_to_regexp { = [ PR_SHADOW_STACK_ENABLE ]}] \
+ "GCS is enabled"
+
+gdb_test "print \$gcspr" ". = \\(void \\*\\) $hex" "GDB knows about gcspr"
+gdb_test "print \$gcspr == gcspr" ". = 1" "GDB has the correct gcspr value"
+gdb_test_no_output "set \$gcspr_in_main = \$gcspr" \
+ "save gcspr value in main for later"
+
+# If the inferior function call fails, we don't want the tests following it
+# to be affected.
+gdb_test_no_output "set unwindonsignal on"
+gdb_test "print called_from_gdb (41)" ". = 42" "call inferior function"
+
+gdb_test "break handler" "Breakpoint \[0-9\]+ .*aarch64-gcs.c, line \[0-9\]+\\."
+gdb_test "handle SIGUSR1 nostop" \
+ ".*\r\nSIGUSR1\\s+No\\s+Yes\\s+Yes\\s+User defined signal 1" \
+ "let the inferior receive SIGUSR1 uninterrupted"
+gdb_test "continue" \
+ ".*\r\nBreakpoint \[0-9\]+, handler \\(sig=10\\) at .*aarch64-gcs.c.*handler_gcspr = get_gcspr \\(\\);" \
+ "continue to signal handler"
+
+gdb_test_no_output "set \$gcspr_in_handler = \$gcspr" \
+ "save gcspr value in handler for later"
+# Select the frame above the <signal handler called> frame, which makes GDB
+# unwind the gcspr from the signal frame GCS context.
+gdb_test "frame 2" "#2 ($hex in )?\\S+ \\(.*\\) (at|from) \\S+.*" \
+ "reached frame 2"
+gdb_test "print \$gcspr" ". = \\(void \\*\\) $hex" "gcspr in frame level 2"
+gdb_test "print \$gcspr == \$gcspr_in_handler + 8" ". = 1" \
+ "gcspr unwound from signal context is correct"
+
+gdb_test "continue" \
+ [multi_line \
+ "Continuing\\." \
+ "" \
+ "Program received signal SIGSEGV, Segmentation fault" \
+ "Guarded Control Stack error\\." \
+ "normal_function2 \\(\\) at .*aarch64-gcs.c:$decimal" \
+ "${decimal}\\s+__asm__ volatile \\(\"ret\\\\n\"\\);"] \
+ "continue to SIGSEGV"
+
+gdb_test "print \$_siginfo.si_code" ". = 10" \
+ "test value of si_code when GCS SIGSEGV happens"
+# The GCS grows down, and there are two real frames until main.
+gdb_test "print \$gcspr == \$gcspr_in_main - 16" ". = 1" \
+ "test value of gcspr when GCS SIGSEGV happens"
+
+# Test writing to GCSPR.
+clean_restart
+gdb_load $binfile
+if {![runto normal_function0]} {
+ return
+}
+
+gdb_test_no_output "set \$gcspr = 0xbadc0ffee" "set bogus gcspr value"
+# Continue to make sure that the value was actually written to the register.
+# The SIGSEGV isn't a GCS error because the problem isn't that the GCS entry
+# doesn't match the return address, but rather that that GCSPR is pointing
+# to an invalid address.
+gdb_test "continue" \
+ [multi_line \
+ "Continuing\\." \
+ "" \
+ "Program received signal SIGSEGV, Segmentation fault\\." \
+ "normal_function0 \\(\\) at .*aarch64-gcs.c:$decimal" \
+ "${decimal}\\s+__asm__ volatile \\(\"ret\\\\n\"\\);"] \
+ "continue after bad gcspr"
diff --git a/gdb/testsuite/gdb.arch/aarch64-mops-single-step.c b/gdb/testsuite/gdb.arch/aarch64-mops-single-step.c
index 4a27867..2780e55 100644
--- a/gdb/testsuite/gdb.arch/aarch64-mops-single-step.c
+++ b/gdb/testsuite/gdb.arch/aarch64-mops-single-step.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-mops-single-step.exp b/gdb/testsuite/gdb.arch/aarch64-mops-single-step.exp
index 2cb5fdc..3891fcc 100644
--- a/gdb/testsuite/gdb.arch/aarch64-mops-single-step.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-mops-single-step.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -71,7 +71,7 @@ proc step_through_sequence { prefix } {
return 0
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.c b/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.c
index b981f03..e620533 100644
--- a/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.c
+++ b/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp b/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp
index 9e21060..20d2513 100644
--- a/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
}
set linespec ${srcfile}:[gdb_get_line_number "Break here"]
-if ![runto ${linespec}] {
+if {![runto ${linespec}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/aarch64-mte-core.c b/gdb/testsuite/gdb.arch/aarch64-mte-core.c
index 4823c7c..af93afe 100644
--- a/gdb/testsuite/gdb.arch/aarch64-mte-core.c
+++ b/gdb/testsuite/gdb.arch/aarch64-mte-core.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-mte-core.exp b/gdb/testsuite/gdb.arch/aarch64-mte-core.exp
index 395e0be..849780a 100644
--- a/gdb/testsuite/gdb.arch/aarch64-mte-core.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-mte-core.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -67,14 +67,14 @@ proc test_mte_core_file { core_filename mode } {
# has the expected value, that means the core file was generated correctly
# and that GDB read the contents correctly.
for {set i 0} {$i < $nmaps} {incr i} {
- for {set offset 0} {$offset < $page_size} {set offset [expr $offset + 16]} {
+ for {set offset 0} {$offset < $page_size} {set offset [expr {$offset + 16}]} {
set hex_tag [format "%x" $tag]
gdb_test "memory-tag print-allocation-tag mmap_pointers\[$i\] + $offset" \
"= 0x$hex_tag" \
"mmap_ponters\[$i\] + $offset contains expected tag"
# Update the expected tag. The test writes tags in sequential
# order.
- set tag [expr ($tag + 1) % 16]
+ set tag [expr {($tag + 1) % 16}]
}
}
}
@@ -98,7 +98,7 @@ proc test_mode { mode } {
}
set binfile [standard_output_file ${executable}]
- if ![runto_main] {
+ if {![runto_main]} {
untested "could not run to main"
return -1
}
@@ -145,7 +145,8 @@ proc test_mode { mode } {
# both correctly.
if {$gcore_generated} {
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
with_test_prefix "gcore corefile" {
test_mte_core_file $gcore_filename $mode
}
@@ -154,7 +155,8 @@ proc test_mode { mode } {
}
if {$core_generated} {
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
with_test_prefix "native corefile" {
test_mte_core_file $core_filename $mode
}
diff --git a/gdb/testsuite/gdb.arch/aarch64-mte.c b/gdb/testsuite/gdb.arch/aarch64-mte.c
index bb04b87..ecec916c 100644
--- a/gdb/testsuite/gdb.arch/aarch64-mte.c
+++ b/gdb/testsuite/gdb.arch/aarch64-mte.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-mte.exp b/gdb/testsuite/gdb.arch/aarch64-mte.exp
index 47acb5a..a228755 100644
--- a/gdb/testsuite/gdb.arch/aarch64-mte.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-mte.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -63,7 +63,7 @@ if {![supports_memtag]} {
gdb_breakpoint "access_memory"
-if [gdb_continue "access_memory"] {
+if {[gdb_continue "access_memory"]} {
return -1
}
@@ -104,7 +104,7 @@ with_test_prefix "literals" {
set addr_tagged [get_tagged_ptr $i ${tagged_ptr_addr}]
}
- set tag_hexnz [get_hex_tag [expr $i % 16]]
+ set tag_hexnz [get_hex_tag [expr {$i % 16}]]
gdb_test "memory-tag print-logical-tag ${addr_tagged}" \
" = 0x${tag_hexnz}" \
"print-logical-tag with tag ${i}"
@@ -124,7 +124,7 @@ with_test_prefix "literals" {
$atag_msg \
"set-allocation-tag with tag ${i}"
- set tag_hexnz [get_hex_tag [expr $i % 16]]
+ set tag_hexnz [get_hex_tag [expr {$i % 16}]]
gdb_test "memory-tag print-allocation-tag ${tagged_ptr_addr}" " = 0x${tag_hexnz}" \
"print-allocation-tag with tag ${i}"
}
@@ -139,7 +139,7 @@ with_test_prefix "literals" {
$atag_msg \
"set-allocation-tag with tag ${i}"
- set atag_hexnz [get_hex_tag [expr $i % 16]]
+ set atag_hexnz [get_hex_tag [expr {$i % 16}]]
# Validate that the logical tag matches the allocation tag.
with_test_prefix "tag ${i}" {
@@ -152,14 +152,14 @@ with_test_prefix "literals" {
# Get a pointer with the logical tag that does not match the
# allocation tag.
- set ltag [expr $i + 1]
+ set ltag [expr {$i + 1}]
with_test_prefix "fetch mismatch tag ${i}" {
set addr_tagged [get_tagged_ptr $ltag ${tagged_ptr_addr}]
}
# Validate that the logical tag does not match the allocation
# tag.
- set ltag_hexnz [get_hex_tag [expr [expr $i + 1]% 16]]
+ set ltag_hexnz [get_hex_tag [expr {($i + 1) % 16}]]
gdb_test "memory-tag check ${addr_tagged}" \
"Logical tag \\(0x${ltag_hexnz}\\) does not match the allocation tag \\(0x${atag_hexnz}\\) for address $hex\." \
"check mismatch with tag ${i}"
@@ -187,7 +187,7 @@ with_test_prefix "symbolic" {
"update value of symbol ${tagged_ptr_symbol}"
}
- set tag_hexnz [get_hex_tag [expr $i % 16]]
+ set tag_hexnz [get_hex_tag [expr {$i % 16}]]
gdb_test "memory-tag print-logical-tag ${tagged_ptr_symbol}" \
" = 0x${tag_hexnz}" \
"print-logical-tag with tag ${i}"
@@ -211,7 +211,7 @@ with_test_prefix "symbolic" {
$atag_msg \
"set-allocation-tag with tag ${i}"
- set tag_hexnz [get_hex_tag [expr $i % 16]]
+ set tag_hexnz [get_hex_tag [expr {$i % 16}]]
gdb_test "memory-tag print-allocation-tag ${tagged_ptr_symbol}" \
" = 0x${tag_hexnz}" \
"print-allocation-tag with tag ${i}"
@@ -227,7 +227,7 @@ with_test_prefix "symbolic" {
$atag_msg \
"set-allocation-tag with tag ${i}"
- set atag_hexnz [get_hex_tag [expr $i % 16]]
+ set atag_hexnz [get_hex_tag [expr {$i % 16}]]
# Validate that the logical tag matches the allocation tag.
with_test_prefix "tag ${i}" {
@@ -245,7 +245,7 @@ with_test_prefix "symbolic" {
# Get a pointer with the logical tag that does not match the
# allocation tag.
- set ltag [expr $i + 1]
+ set ltag [expr {$i + 1}]
with_test_prefix "fetch mismatch tag ${i}" {
set addr_tagged [get_tagged_ptr $ltag ${tagged_ptr_addr}]
}
@@ -257,7 +257,7 @@ with_test_prefix "symbolic" {
# Validate that the logical tag does not match the allocation
# tag.
- set ltag_hexnz [get_hex_tag [expr [expr $i + 1]% 16]]
+ set ltag_hexnz [get_hex_tag [expr {($i + 1) % 16}]]
gdb_test "memory-tag check ${tagged_ptr_symbol}" \
"Logical tag \\(0x${ltag_hexnz}\\) does not match the allocation tag \\(0x${atag_hexnz}\\) for address $hex\." \
"check mismatch with tag ${i}"
@@ -281,7 +281,7 @@ with_test_prefix "print command" {
return -1
}
- set atag [expr [expr $ltag + 1] % 16]
+ set atag [expr {($ltag + 1) % 16}]
set atag_hexnn [get_tag_nn $atag]
gdb_test "memory-tag set-allocation-tag ${tagged_ptr_symbol} 1 ${atag_hexnn}" \
@@ -334,13 +334,13 @@ gdb_test "continue" \
# Restart to execute the async tag fault test.
with_test_prefix "async" {
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
gdb_breakpoint "access_memory"
- if [gdb_continue "access_memory"] {
+ if {[gdb_continue "access_memory"]} {
fail "could not run to tagged memory test function"
return -1
}
diff --git a/gdb/testsuite/gdb.arch/aarch64-non-address-bits.c b/gdb/testsuite/gdb.arch/aarch64-non-address-bits.c
index 855de36..8d65462 100644
--- a/gdb/testsuite/gdb.arch/aarch64-non-address-bits.c
+++ b/gdb/testsuite/gdb.arch/aarch64-non-address-bits.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-non-address-bits.exp b/gdb/testsuite/gdb.arch/aarch64-non-address-bits.exp
index 8b77786..e3023d1 100644
--- a/gdb/testsuite/gdb.arch/aarch64-non-address-bits.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-non-address-bits.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/aarch64-pauth.c b/gdb/testsuite/gdb.arch/aarch64-pauth.c
index fb1e8a7..ea7dbc6 100644
--- a/gdb/testsuite/gdb.arch/aarch64-pauth.c
+++ b/gdb/testsuite/gdb.arch/aarch64-pauth.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-pauth.exp b/gdb/testsuite/gdb.arch/aarch64-pauth.exp
index d5b4b61..89193ce 100644
--- a/gdb/testsuite/gdb.arch/aarch64-pauth.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-pauth.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2024 Free Software Foundation, Inc.
+# Copyright (C) 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ if {!$compilation_ok} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/aarch64-prologue.c b/gdb/testsuite/gdb.arch/aarch64-prologue.c
index 1df7dd8..58e72af 100644
--- a/gdb/testsuite/gdb.arch/aarch64-prologue.c
+++ b/gdb/testsuite/gdb.arch/aarch64-prologue.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-prologue.exp b/gdb/testsuite/gdb.arch/aarch64-prologue.exp
index 5085a23..2e0d05d 100644
--- a/gdb/testsuite/gdb.arch/aarch64-prologue.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-prologue.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/aarch64-pseudo-unwind-asm.S b/gdb/testsuite/gdb.arch/aarch64-pseudo-unwind-asm.S
index 208f5d0..b1c2871 100644
--- a/gdb/testsuite/gdb.arch/aarch64-pseudo-unwind-asm.S
+++ b/gdb/testsuite/gdb.arch/aarch64-pseudo-unwind-asm.S
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/aarch64-pseudo-unwind.c b/gdb/testsuite/gdb.arch/aarch64-pseudo-unwind.c
index 49b0553..1646a34 100644
--- a/gdb/testsuite/gdb.arch/aarch64-pseudo-unwind.c
+++ b/gdb/testsuite/gdb.arch/aarch64-pseudo-unwind.c
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/aarch64-pseudo-unwind.exp b/gdb/testsuite/gdb.arch/aarch64-pseudo-unwind.exp
index 8b7c148..e835ddf 100644
--- a/gdb/testsuite/gdb.arch/aarch64-pseudo-unwind.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-pseudo-unwind.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-clean_restart ${binfile}
+clean_restart $testfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.c b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.c
index a448eed..f573ba0 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.c
+++ b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp
index a2fffec..cce7376 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} ${compile_f
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -91,7 +91,7 @@ gdb_breakpoint [gdb_get_line_number "exit(0)"]
gdb_continue_to_breakpoint "exit" ".*exit.*"
set handlerframe [get_current_frame_number]
-set mainframe [expr $handlerframe + 2]
+set mainframe [expr {$handlerframe + 2}]
# Check register values
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-core-0.exp b/gdb/testsuite/gdb.arch/aarch64-sme-core-0.exp
index ad2b576..764cf16 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-core-0.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-core-0.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-core-1.exp b/gdb/testsuite/gdb.arch/aarch64-sme-core-1.exp
index 792f495..a847c7c 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-core-1.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-core-1.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-core-2.exp b/gdb/testsuite/gdb.arch/aarch64-sme-core-2.exp
index 4282c6d..4ee0d9f 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-core-2.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-core-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-core-3.exp b/gdb/testsuite/gdb.arch/aarch64-sme-core-3.exp
index 7ffb0c0..de143aa 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-core-3.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-core-3.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-core-4.exp b/gdb/testsuite/gdb.arch/aarch64-sme-core-4.exp
index ac979d2..6a122ea 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-core-4.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-core-4.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-core.c b/gdb/testsuite/gdb.arch/aarch64-sme-core.c
index f7014c1..df87c02 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-core.c
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-core.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-core.exp.tcl b/gdb/testsuite/gdb.arch/aarch64-sme-core.exp.tcl
index b9b83b9..b57ff73 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-core.exp.tcl
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-core.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,13 +25,13 @@ load_lib aarch64-scalable.exp
#
proc check_sme_core_file { core_filename state vl svl } {
# Load the core file.
- if [gdb_test "core $core_filename" \
- [multi_line \
- "Core was generated by.*\." \
- "Program terminated with signal SIGSEGV, Segmentation fault\." \
- "#0 ${::hex} in main \\(.*\\) at .*" \
+ if {[gdb_test "core $core_filename" \
+ [multi_line \
+ "Core was generated by.*\." \
+ "Program terminated with signal SIGSEGV, Segmentation fault\." \
+ "#0 ${::hex} in main \\(.*\\) at .*" \
".*p = 0xff;.* crash point .*"] \
- "load core file"] {
+ "load core file"]} {
untested "failed to generate core file"
return -1
}
@@ -91,7 +91,8 @@ proc generate_sme_core_files { executable binfile id state vl svl} {
# and the native one generated by the Linux Kernel. Make sure GDB can read
# both correctly.
if {$gcore_generated} {
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
gdb_test_no_output "set print repeats 1" \
"adjust repeat count post-crash gcore"
@@ -103,7 +104,8 @@ proc generate_sme_core_files { executable binfile id state vl svl} {
}
if {$core_generated} {
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
gdb_test_no_output "set print repeats 1" \
"adjust repeat count post-crash native core"
@@ -167,7 +169,7 @@ proc test_sme_core_file { id_start id_end } {
return -1
}
- if ![runto_main] {
+ if {![runto_main]} {
untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-0.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-0.exp
index e3447e6..04ac477 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-0.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-0.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-1.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-1.exp
index 8808240..5926c91 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-1.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-1.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-2.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-2.exp
index 758b8a7..bef6179 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-2.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-3.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-3.exp
index 293f696..72bbca2 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-3.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-3.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-4.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-4.exp
index 67db61c..0c1ac80 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-4.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-4.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-5.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-5.exp
index 41c8477..35aba9d 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-5.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-5.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-6.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-6.exp
index 4df5812..ac8f009 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-6.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-6.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-7.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-7.exp
index 553265b..45a58e1 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-7.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-7.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-8.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-8.exp
index bebe7d9..78b24d7 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-8.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-8.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-9.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-9.exp
index 84ef5f5..5368c53 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-9.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available-9.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available.c b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available.c
index 3558007..9e11acf 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available.c
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available.exp.tcl b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available.exp.tcl
index 642b7b6..de17e4e 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available.exp.tcl
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,11 +34,11 @@ require !gdb_protocol_is_remote
#
proc check_regs { mode vl svl } {
# Check VG to make sure it is correct
- set expected_vg [expr $vl / 8]
+ set expected_vg [expr {$vl / 8}]
gdb_test "print \$vg" "= ${expected_vg}"
# Check SVG to make sure it is correct
- set expected_svg [expr $svl / 8]
+ set expected_svg [expr {$svl / 8}]
gdb_test "print \$svg" "= ${expected_svg}"
# If svl is adjusted by prctl, we will have ZA enabled. If gdb is
@@ -50,13 +50,13 @@ proc check_regs { mode vl svl } {
}
# Check SVCR.
- if [gdb_test "print \$svcr" $za_state "svcr before assignments" ] {
+ if {[gdb_test "print \$svcr" $za_state "svcr before assignments" ]} {
fail "incorrect za state"
return -1
}
# Check the size of ZA.
- set expected_za_size [expr $svl * $svl]
+ set expected_za_size [expr {$svl * $svl}]
gdb_test "print sizeof \$za" " = $expected_za_size"
# Check the size of Z0.
@@ -69,7 +69,7 @@ proc check_regs { mode vl svl } {
# Exercise reading/writing from/to the tile pseudo-registers.
set last_tile 1
- set expected_size [expr $svl * $svl]
+ set expected_size [expr {$svl * $svl}]
set tile_svl $svl
set za_state "= \\\[ ZA \\\]"
foreach_with_prefix granularity {"b" "h" "s" "d" "q"} {
@@ -83,7 +83,7 @@ proc check_regs { mode vl svl } {
initialize_2d_array $register_name 255 $tile_svl $tile_svl
# Make sure we have ZA state.
- if [gdb_test "print \$svcr" $za_state "svcr after assignment to ${register_name}" ] {
+ if {[gdb_test "print \$svcr" $za_state "svcr after assignment to ${register_name}" ]} {
fail "incorrect za state"
return -1
}
@@ -91,9 +91,9 @@ proc check_regs { mode vl svl } {
set pattern [string_to_regexp [2d_array_value_pattern 255 $tile_svl $tile_svl]]
gdb_test "print $register_name" " = $pattern" "read back from $register_name"
}
- set last_tile [expr $last_tile * 2]
- set expected_size [expr $expected_size / 2]
- set tile_svl [expr $tile_svl / 2]
+ set last_tile [expr {$last_tile * 2}]
+ set expected_size [expr {$expected_size / 2}]
+ set tile_svl [expr {$tile_svl / 2}]
}
# Exercise reading/writing from/to the tile slice pseudo-registers.
@@ -114,7 +114,7 @@ proc check_regs { mode vl svl } {
initialize_1d_array $register_name 255 $num_elements
# Make sure we have ZA state.
- if [gdb_test "print \$svcr" $za_state "svcr after assignment of ${register_name}" ] {
+ if {[gdb_test "print \$svcr" $za_state "svcr after assignment of ${register_name}" ]} {
fail "incorrect za state"
return -1
}
@@ -124,13 +124,13 @@ proc check_regs { mode vl svl } {
}
}
}
- set last_tile [expr $last_tile * 2]
- set last_slice [expr ($last_slice / 2)]
- set num_elements [expr $num_elements / 2]
+ set last_tile [expr {$last_tile * 2}]
+ set last_slice [expr {($last_slice / 2)}]
+ set num_elements [expr {$num_elements / 2}]
}
# Exercise reading/writing from/to SME2 registers.
- if [is_sme2_available] {
+ if {[is_sme2_available]} {
# The target supports SME2.
set zt_size 64
gdb_test "print sizeof \$zt0" " = $zt_size"
@@ -163,7 +163,7 @@ proc test_sme_registers_available { id_start id_end } {
}
set binfile [standard_output_file ${executable}]
- if ![runto_main] {
+ if {![runto_main]} {
untested "could not run to main"
return -1
}
@@ -245,8 +245,8 @@ proc test_sme_registers_available { id_start id_end } {
gdb_continue_to_breakpoint $non_prctl_breakpoint
# Adjust svl via gdb.
- set vg_value [expr $vl / 8]
- set svg_value [expr $svl / 8]
+ set vg_value [expr {$vl / 8}]
+ set svg_value [expr {$svl / 8}]
gdb_test_no_output "set \$vg = ${vg_value}"
gdb_test_no_output "set \$svg = ${svg_value}"
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-0.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-0.exp
index ca5df0a..c74c215 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-0.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-0.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-1.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-1.exp
index 0a3e680..d6b927e 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-1.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-1.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-2.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-2.exp
index 5c8a5ae..5f35bd5 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-2.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-3.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-3.exp
index c8fc511..114ce2a 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-3.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-3.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-4.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-4.exp
index b527252..28fa6b0 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-4.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-4.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.c b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.c
index 4c991e6..6376c87 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.c
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.exp.tcl b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.exp.tcl
index c1c5269..4f37019 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.exp.tcl
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ proc test_sme_registers_sigframe { id_start id_end } {
}
set binfile [standard_output_file ${executable}]
- if ![runto_main] {
+ if {![runto_main]} {
untested "could not run to main"
return -1
}
@@ -83,16 +83,16 @@ proc test_sme_registers_sigframe { id_start id_end } {
}
# Run the program until it has adjusted the svl.
- if [gdb_continue_to_breakpoint $sigill_breakpoint] {
+ if {[gdb_continue_to_breakpoint $sigill_breakpoint]} {
return -1
}
# Check SVG to make sure it is correct
- set expected_svg [expr $svl / 8]
+ set expected_svg [expr {$svl / 8}]
gdb_test "print \$svg" "= ${expected_svg}"
# Check the size of ZA.
- set expected_za_size [expr $svl * $svl]
+ set expected_za_size [expr {$svl * $svl}]
gdb_test "print sizeof \$za" " = $expected_za_size"
# Check the value of SVCR.
@@ -134,14 +134,14 @@ proc test_sme_registers_sigframe { id_start id_end } {
gdb_test_no_output "set \$tpidr2=0x0102030405060708"
# Run to the illegal instruction.
- if [gdb_test "continue" "Continuing\.\r\n\r\nProgram received signal SIGILL, Illegal instruction\..*in main.*"] {
+ if {[gdb_test "continue" "Continuing\.\r\n\r\nProgram received signal SIGILL, Illegal instruction\..*in main.*"]} {
return
}
# Skip the illegal instruction. The signal handler will be called after we continue.
gdb_test_no_output "set \$pc=\$pc+4"
# Continue to the signal handler.
- if [gdb_continue_to_breakpoint $handler_breakpoint] {
+ if {[gdb_continue_to_breakpoint $handler_breakpoint]} {
return -1
}
@@ -159,7 +159,7 @@ proc test_sme_registers_sigframe { id_start id_end } {
}
# Check the size of ZA in the signal frame.
- set expected_za_size [expr $svl * $svl]
+ set expected_za_size [expr {$svl * $svl}]
gdb_test "print sizeof \$za" " = $expected_za_size" "size of za in signal frame"
# Check the value of SVCR in the signal frame.
@@ -172,7 +172,7 @@ proc test_sme_registers_sigframe { id_start id_end } {
gdb_test "print/x \$tpidr2" " = 0x102030405060708" "tpidr2 contents from signal frame"
# Check the value of SME2 ZT0 in the signal frame.
- if [is_sme2_available] {
+ if {[is_sme2_available]} {
# The target supports SME2.
set zt_size 64
gdb_test "print sizeof \$zt0" " = $zt_size"
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-0.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-0.exp
index f209586..e4c9c8c 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-0.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-0.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-1.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-1.exp
index dc66e82..87ac5da 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-1.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-1.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-2.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-2.exp
index cbaa152..45aca2d 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-2.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-3.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-3.exp
index eaa72bc..21b1d82 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-3.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-3.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-4.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-4.exp
index 840c2f5..4308716 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-4.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-4.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-5.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-5.exp
index 082a8b0..71c9367 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-5.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-5.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-6.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-6.exp
index ab4d72e..34c716c 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-6.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-6.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-7.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-7.exp
index c3a24db..c851239 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-7.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-7.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-8.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-8.exp
index 8aee577..43d69cf 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-8.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-8.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-9.exp b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-9.exp
index 90efff3..2e2b1cb 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-9.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-9.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.c b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.c
index 4648193..316fc8a 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.c
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.exp.tcl b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.exp.tcl
index 77ff66c..04e8b88 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.exp.tcl
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,21 +26,21 @@ load_lib aarch64-scalable.exp
#
proc_with_prefix check_regs { vl svl } {
# Check VG to make sure it is correct
- set expected_vg [expr $vl / 8]
+ set expected_vg [expr {$vl / 8}]
gdb_test "print \$vg" "= ${expected_vg}"
# Check SVG to make sure it is correct
- set expected_svg [expr $svl / 8]
+ set expected_svg [expr {$svl / 8}]
gdb_test "print \$svg" "= ${expected_svg}"
# Make sure there is no SM or ZA state.
- if [gdb_test "print \$svcr" "= \\\[ \\\]"] {
+ if {[gdb_test "print \$svcr" "= \\\[ \\\]"]} {
fail "incorrect ZA state"
return -1
}
# Check the size of ZA.
- set expected_za_size [expr $svl * $svl]
+ set expected_za_size [expr {$svl * $svl}]
gdb_test "print sizeof \$za" " = $expected_za_size"
# Check the size of Z0.
@@ -69,15 +69,15 @@ proc_with_prefix check_regs { vl svl } {
}
}
}
- set last_tile [expr $last_tile * 2]
- set last_slice [expr ($last_slice / 2)]
- set elements [expr ($elements / 2)]
+ set last_tile [expr {$last_tile * 2}]
+ set last_slice [expr {($last_slice / 2)}]
+ set elements [expr {($elements / 2)}]
}
# Exercise reading/writing the tile pseudo-registers.
set last_tile 1
set elements $svl
- set expected_size [expr $svl * $svl]
+ set expected_size [expr {$svl * $svl}]
foreach_with_prefix granularity {"b" "h" "s" "d" "q"} {
set pattern [string_to_regexp [2d_array_value_pattern 0 $elements $elements]]
for {set tile 0} {$tile < $last_tile} {incr tile} {
@@ -86,13 +86,13 @@ proc_with_prefix check_regs { vl svl } {
gdb_test "print sizeof ${register_name}" " = ${expected_size}"
gdb_test "print ${register_name}" $pattern
}
- set last_tile [expr $last_tile * 2]
- set expected_size [expr $expected_size / 2]
- set elements [expr ($elements / 2)]
+ set last_tile [expr {$last_tile * 2}]
+ set expected_size [expr {$expected_size / 2}]
+ set elements [expr {($elements / 2)}]
}
# Exercise reading from SME2 registers.
- if [is_sme2_available] {
+ if {[is_sme2_available]} {
# The target supports SME2.
set zt_size 64
gdb_test "print sizeof \$zt0" " = $zt_size"
@@ -128,7 +128,7 @@ proc test_sme_registers_unavailable { id_start id_end } {
return -1
}
- if ![runto_main] {
+ if {![runto_main]} {
untested "could not run to main"
return -1
}
@@ -207,8 +207,8 @@ proc test_sme_registers_unavailable { id_start id_end } {
}
# Adjust vg and svg.
- set vg_value [expr $vl / 8]
- set svg_value [expr $svl / 8]
+ set vg_value [expr {$vl / 8}]
+ set svg_value [expr {$svl / 8}]
gdb_test_no_output "set \$vg = ${vg_value}"
gdb_test_no_output "set \$svg = ${svg_value}"
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-sanity.c b/gdb/testsuite/gdb.arch/aarch64-sme-sanity.c
index 0a316db..4b22635 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-sanity.c
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-sanity.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-sanity.exp b/gdb/testsuite/gdb.arch/aarch64-sme-sanity.exp
index 913d0be..9664069 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sme-sanity.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sme-sanity.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -60,8 +60,8 @@ gdb_test_no_output "set print repeats 1" "adjust repeat count"
# Fetch both the vector length and the streaming vector length the target
# system is using. We do not force any vector lengths and do not change
# it mid-execution.
-set vl [expr [get_valueof "" "\$vg" "0" "fetch value of vl"] * 8]
-set svl [expr [get_valueof "" "\$svg" "0" "fetch value of svl"] * 8]
+set vl [expr {[get_valueof "" "\$vg" "0" "fetch value of vl"] * 8}]
+set svl [expr {[get_valueof "" "\$svg" "0" "fetch value of svl"] * 8}]
# Now we are at the point where we can start checking state and moving the
# testcase forward.
diff --git a/gdb/testsuite/gdb.arch/aarch64-sve-sigunwind.c b/gdb/testsuite/gdb.arch/aarch64-sve-sigunwind.c
new file mode 100644
index 0000000..c86beaf
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-sve-sigunwind.c
@@ -0,0 +1,205 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Exercise unwinding AArch64's SVE registers from a signal frame. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <sys/prctl.h>
+#include <unistd.h>
+
+static int second_vl = 0;
+
+static void
+initialize_sve_state_main ()
+{
+ __asm __volatile ("dup z0.b, -1");
+ __asm __volatile ("dup z1.b, -1");
+ __asm __volatile ("dup z2.b, -1");
+ __asm __volatile ("dup z3.b, -1");
+ __asm __volatile ("dup z4.b, -1");
+ __asm __volatile ("dup z5.b, -1");
+ __asm __volatile ("dup z6.b, -1");
+ __asm __volatile ("dup z7.b, -1");
+ __asm __volatile ("dup z8.b, -1");
+ __asm __volatile ("dup z9.b, -1");
+ __asm __volatile ("dup z10.b, -1");
+ __asm __volatile ("dup z11.b, -1");
+ __asm __volatile ("dup z12.b, -1");
+ __asm __volatile ("dup z13.b, -1");
+ __asm __volatile ("dup z14.b, -1");
+ __asm __volatile ("dup z15.b, -1");
+ __asm __volatile ("dup z16.b, -1");
+ __asm __volatile ("dup z17.b, -1");
+ __asm __volatile ("dup z18.b, -1");
+ __asm __volatile ("dup z19.b, -1");
+ __asm __volatile ("dup z20.b, -1");
+ __asm __volatile ("dup z21.b, -1");
+ __asm __volatile ("dup z22.b, -1");
+ __asm __volatile ("dup z23.b, -1");
+ __asm __volatile ("dup z24.b, -1");
+ __asm __volatile ("dup z25.b, -1");
+ __asm __volatile ("dup z26.b, -1");
+ __asm __volatile ("dup z27.b, -1");
+ __asm __volatile ("dup z28.b, -1");
+ __asm __volatile ("dup z29.b, -1");
+ __asm __volatile ("dup z30.b, -1");
+ __asm __volatile ("dup z31.b, -1");
+ __asm __volatile ("ptrue p0.d");
+ __asm __volatile ("ptrue p1.d");
+ __asm __volatile ("ptrue p2.d");
+ __asm __volatile ("ptrue p3.d");
+ __asm __volatile ("ptrue p4.d");
+ __asm __volatile ("ptrue p5.d");
+ __asm __volatile ("ptrue p6.d");
+ __asm __volatile ("ptrue p7.d");
+ __asm __volatile ("ptrue p8.d");
+ __asm __volatile ("ptrue p9.d");
+ __asm __volatile ("ptrue p10.d");
+ __asm __volatile ("ptrue p11.d");
+ __asm __volatile ("ptrue p12.d");
+ __asm __volatile ("ptrue p13.d");
+ __asm __volatile ("ptrue p14.d");
+ __asm __volatile ("ptrue p15.d");
+ __asm __volatile ("setffr");
+}
+
+static void
+initialize_sve_state_sighandler ()
+{
+ __asm __volatile ("dup z0.b, -2");
+ __asm __volatile ("dup z1.b, -2");
+ __asm __volatile ("dup z2.b, -2");
+ __asm __volatile ("dup z3.b, -2");
+ __asm __volatile ("dup z4.b, -2");
+ __asm __volatile ("dup z5.b, -2");
+ __asm __volatile ("dup z6.b, -2");
+ __asm __volatile ("dup z7.b, -2");
+ __asm __volatile ("dup z8.b, -2");
+ __asm __volatile ("dup z9.b, -2");
+ __asm __volatile ("dup z10.b, -2");
+ __asm __volatile ("dup z11.b, -2");
+ __asm __volatile ("dup z12.b, -2");
+ __asm __volatile ("dup z13.b, -2");
+ __asm __volatile ("dup z14.b, -2");
+ __asm __volatile ("dup z15.b, -2");
+ __asm __volatile ("dup z16.b, -2");
+ __asm __volatile ("dup z17.b, -2");
+ __asm __volatile ("dup z18.b, -2");
+ __asm __volatile ("dup z19.b, -2");
+ __asm __volatile ("dup z20.b, -2");
+ __asm __volatile ("dup z21.b, -2");
+ __asm __volatile ("dup z22.b, -2");
+ __asm __volatile ("dup z23.b, -2");
+ __asm __volatile ("dup z24.b, -2");
+ __asm __volatile ("dup z25.b, -2");
+ __asm __volatile ("dup z26.b, -2");
+ __asm __volatile ("dup z27.b, -2");
+ __asm __volatile ("dup z28.b, -2");
+ __asm __volatile ("dup z29.b, -2");
+ __asm __volatile ("dup z30.b, -2");
+ __asm __volatile ("dup z31.b, -2");
+ __asm __volatile ("pfalse p0.b");
+ __asm __volatile ("pfalse p1.b");
+ __asm __volatile ("pfalse p2.b");
+ __asm __volatile ("pfalse p3.b");
+ __asm __volatile ("pfalse p4.b");
+ __asm __volatile ("pfalse p5.b");
+ __asm __volatile ("pfalse p6.b");
+ __asm __volatile ("pfalse p7.b");
+ __asm __volatile ("pfalse p8.b");
+ __asm __volatile ("pfalse p9.b");
+ __asm __volatile ("pfalse p10.b");
+ __asm __volatile ("pfalse p11.b");
+ __asm __volatile ("pfalse p12.b");
+ __asm __volatile ("pfalse p13.b");
+ __asm __volatile ("pfalse p14.b");
+ __asm __volatile ("pfalse p15.b");
+ __asm __volatile ("setffr");
+}
+
+/* Set new value for the SVE vector length.
+ Return the value that was set. */
+
+static int
+set_vl (int vl)
+{
+ int rc;
+
+ rc = prctl (PR_SVE_SET_VL, vl, 0, 0, 0);
+ if (rc < 0)
+ {
+ perror ("FAILED to PR_SVE_SET_VL");
+ exit (EXIT_FAILURE);
+ }
+
+ return rc & PR_SVE_VL_LEN_MASK;
+}
+
+static void
+sighandler (int sig, siginfo_t *info, void *ucontext)
+{
+ /* Set vector length to the second value. */
+ second_vl = set_vl (second_vl);
+ initialize_sve_state_sighandler ();
+ printf ("sighandler: second_vl = %d\n", second_vl); /* Break here. */
+}
+
+int
+main (int argc, char *argv[])
+{
+ if (argc != 3)
+ {
+ fprintf (stderr, "Usage: %s <first vl> <second vl>\n", argv[0]);
+ return 1;
+ }
+
+ int first_vl = atoi (argv[1]);
+ second_vl = atoi (argv[2]);
+
+ if (first_vl == 0 || second_vl == 0)
+ {
+ fprintf (stderr, "Invalid vector length.\n");
+ return 1;
+ }
+
+ /* Set vector length to the first value. */
+ first_vl = set_vl (first_vl);
+
+ printf ("main: first_vl = %d\n", first_vl);
+
+ unsigned char buf[256];
+
+ /* Use an SVE register to make the kernel start saving the SVE bank. */
+ asm volatile ("mov z0.b, #255\n\t"
+ "str z0, %0"
+ :
+ : "m" (buf)
+ : "z0", "memory");
+
+ initialize_sve_state_main ();
+
+ struct sigaction sigact;
+ sigact.sa_sigaction = sighandler;
+ sigact.sa_flags = SA_SIGINFO;
+ sigaction (SIGUSR1, &sigact, NULL);
+
+ kill (getpid (), SIGUSR1);
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.arch/aarch64-sve-sigunwind.exp b/gdb/testsuite/gdb.arch/aarch64-sve-sigunwind.exp
new file mode 100644
index 0000000..7a47fc7
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-sve-sigunwind.exp
@@ -0,0 +1,106 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Exercise unwinding AArch64's SVE registers from a signal frame.
+
+require allow_aarch64_sve_tests
+# Remote targets can't communicate vector length changes to GDB via the RSP.
+require !gdb_protocol_is_remote
+
+set first_vl 0
+set second_vl 0
+
+# Find two valid VL values to use in the test.
+# The minimum supported VL is 16 bytes, maximum is 256 bytes, and VL can change
+# in increments of at least 16 bytes.
+for {set i 16} {$i <= 256} {incr i 16} {
+ if {![aarch64_supports_sve_vl $i]} {
+ continue
+ }
+
+ if {$first_vl == 0} {
+ set first_vl $i
+ } elseif {$second_vl == 0} {
+ set second_vl $i
+ break
+ }
+}
+
+if {$first_vl == 0 || $second_vl == 0} {
+ untested "test needs to support at least two vector lengths"
+ return
+}
+
+standard_testfile
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
+ [list debug additional_flags=-march=armv9-a]] } {
+ return
+}
+
+# We want SIGUSR1 to be delivered normally.
+gdb_test "handle SIGUSR1 nostop" \
+ [multi_line {Signal Stop Print Pass to program Description} \
+ {SIGUSR1 No Yes Yes User defined signal 1}] \
+ "don't stop for SIGUSR1"
+
+set linespec ${srcfile}:[gdb_get_line_number "Break here."]
+gdb_test_no_output "set args $first_vl $second_vl"
+
+if {![runto ${linespec}]} {
+ return
+}
+
+set first_vg [expr {$first_vl/8}]
+set second_vg [expr {$second_vl/8}]
+
+gdb_test "print \$vg" ". = $second_vg" "vg was changed"
+
+for {set row 0} {$row < 32} {incr row} {
+ set register_name "\$z${row}\.b\.u"
+ gdb_test "print sizeof $register_name" " = $second_vl" \
+ "size of $register_name in the signal handler"
+ gdb_test "print $register_name" ". = \\{254 <repeats $second_vl times>\\}" \
+ "$register_name contents in signal handler"
+}
+
+for {set row 0} {$row < 16} {incr row} {
+ set register_name "\$p${row}"
+ gdb_test "print $register_name" ". = \\{(0, ){[expr {$second_vl/8 - 1}]}0\\}" \
+ "$register_name contents in signal handler"
+}
+gdb_test "print \$ffr" ". = \\{(255, ){[expr {$second_vl/8 - 1}]}255\\}" \
+ "ffr contents in signal handler"
+
+gdb_test "frame function main" \
+ [multi_line "#$decimal $hex in main \[^\r\n\]+" \
+ "$decimal\[ \t\]+kill \\(getpid \\(\\), SIGUSR1\\);"]
+
+gdb_test "print \$vg" ". = $first_vg" "vg was correctly unwound"
+
+for {set row 0} {$row < 32} {incr row} {
+ set register_name "\$z${row}\.b\.u"
+ gdb_test "print sizeof $register_name" " = $first_vl" \
+ "size of $register_name was correctly unwound"
+ gdb_test "print $register_name" ". = \\{255 <repeats $first_vl times>\\}" \
+ "$register_name contents were correctly unwound"
+}
+
+for {set row 0} {$row < 16} {incr row} {
+ set register_name "\$p${row}"
+ gdb_test "print $register_name" ". = \\{(1, ){[expr {$first_vl/8 - 1}]}1\\}" \
+ "$register_name contents were correctly unwound"
+}
+gdb_test "print \$ffr" ". = \\{(255, ){[expr {$first_vl/8 - 1}]}255\\}" \
+ "ffr contents were correctly unwound"
diff --git a/gdb/testsuite/gdb.arch/aarch64-sve.c b/gdb/testsuite/gdb.arch/aarch64-sve.c
index 268922a..c8c6640 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sve.c
+++ b/gdb/testsuite/gdb.arch/aarch64-sve.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-sve.exp b/gdb/testsuite/gdb.arch/aarch64-sve.exp
index 43b5e67..6cdc30d 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sve.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sve.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
set linespec ${srcfile}:[gdb_get_line_number "break here"]
-if ![runto ${linespec}] {
+if {![runto ${linespec}]} {
return
}
@@ -59,7 +59,7 @@ proc get_register_value {register} {
# The test executable halves the vector length in a loop, so loop along
# to check it.
-for {set i [get_register_value "vg"]} {$i > 1} {set i [expr $i / 2]} {
+for {set i [get_register_value "vg"]} {$i > 1} {set i [expr {$i / 2}]} {
set lines_before [count_info_registers]
gdb_test "next" ".*if .res < 0." "step over prctl vg = ${i}"
diff --git a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.c b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.c
index 41c2677..c693bd9 100644
--- a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.c
+++ b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp
index c0caabd..eb2bc92 100644
--- a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/aarch64-unwind-pc.S b/gdb/testsuite/gdb.arch/aarch64-unwind-pc.S
index 059f243..722e4c1 100644
--- a/gdb/testsuite/gdb.arch/aarch64-unwind-pc.S
+++ b/gdb/testsuite/gdb.arch/aarch64-unwind-pc.S
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp b/gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp
index d0f78dd..bc6d242 100644
--- a/gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/aarch64-w-registers.c b/gdb/testsuite/gdb.arch/aarch64-w-registers.c
index 46e0ce8..731c6f7 100644
--- a/gdb/testsuite/gdb.arch/aarch64-w-registers.c
+++ b/gdb/testsuite/gdb.arch/aarch64-w-registers.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aarch64-w-registers.exp b/gdb/testsuite/gdb.arch/aarch64-w-registers.exp
index f8f4538..06c6626 100644
--- a/gdb/testsuite/gdb.arch/aarch64-w-registers.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-w-registers.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.arch/aix-sighandle.c b/gdb/testsuite/gdb.arch/aix-sighandle.c
index 2acaef9..4b6dca6 100644
--- a/gdb/testsuite/gdb.arch/aix-sighandle.c
+++ b/gdb/testsuite/gdb.arch/aix-sighandle.c
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/aix-sighandle.exp b/gdb/testsuite/gdb.arch/aix-sighandle.exp
index 9a33275..e8a2a29 100644
--- a/gdb/testsuite/gdb.arch/aix-sighandle.exp
+++ b/gdb/testsuite/gdb.arch/aix-sighandle.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/alpha-step.c b/gdb/testsuite/gdb.arch/alpha-step.c
index 9afdebe..363d4fc 100644
--- a/gdb/testsuite/gdb.arch/alpha-step.c
+++ b/gdb/testsuite/gdb.arch/alpha-step.c
@@ -1,4 +1,4 @@
-/* Copyright 2005-2024 Free Software Foundation, Inc.
+/* Copyright 2005-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/alpha-step.exp b/gdb/testsuite/gdb.arch/alpha-step.exp
index 3a6e554..aea492e 100644
--- a/gdb/testsuite/gdb.arch/alpha-step.exp
+++ b/gdb/testsuite/gdb.arch/alpha-step.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] !
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
proc test_stepi {function } {
# Restart the program from scratch. If GDB got confused during one
@@ -41,50 +42,50 @@ proc test_stepi {function } {
gdb_test "break *$function+4" \
"Breakpoint .* at .*" \
"breakpoint on fb$function instruction"
-
+
gdb_test "continue" \
"Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \
"continue to fb$function instruction (first call)"
-
+
# Extra check to make sure we stopped on the FP branch instruction.
-
+
gdb_test "x /i \$pc" \
"0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \
"Check breakpoint on fb$function instruction (first call)"
-
+
# Step test, followed by the check that we landed on the expected
# instruction (the testcase should be written in such a way that
# the branch is taken on the first call to this function.
-
+
gdb_test "stepi" \
"0x\[0-9a-fA-F\]+.*" \
"stepi on fb$function (first call)"
-
+
gdb_test "x /i \$pc" \
"0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+ret.*" \
"Check stepi over fb$function stopped on ret"
-
+
# Continue again. FUNCTION should be called a second time, this time
# with an argument such that the FP branch will not be taken.
-
+
gdb_test "continue" \
"Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \
"continue to fb$function instruction (second call)"
-
+
# Extra check to make sure we stopped on the FP branch instruction.
-
+
gdb_test "x /i \$pc" \
"0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \
"Check breakpoint on fb$function instruction (second call)"
-
+
# Step test, branch should not be taken.
-
+
gdb_test "stepi" \
"0x\[0-9a-fA-F\]+.*" \
"stepi on fb$function (branch not taken)"
-
+
# Extra check to verify that we landed on the instruction we expected.
-
+
gdb_test "x /i \$pc" \
"0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fneg.*" \
"check stepi over fb$function stopped on fneg instruction"
diff --git a/gdb/testsuite/gdb.arch/altivec-abi.exp b/gdb/testsuite/gdb.arch/altivec-abi.exp
index 836e16e..c41e82d 100644
--- a/gdb/testsuite/gdb.arch/altivec-abi.exp
+++ b/gdb/testsuite/gdb.arch/altivec-abi.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2024 Free Software Foundation, Inc.
+# Copyright (C) 2002-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,7 +39,7 @@ proc altivec_abi_tests { extra_flags force_abi } {
if { "$force_abi" == "auto" } {
# If the toolchain does not record attributes, skip auto-ABI tests.
set readelf_program [gdb_find_readelf]
- set result [catch "exec $readelf_program -A $binfile" output]
+ set result [catch {exec $readelf_program -A $binfile} output]
if {$result == 0 && ![regexp Tag_GNU_Power_ABI_Vector $output]} {
untested "ABI not marked"
@@ -47,7 +47,8 @@ proc altivec_abi_tests { extra_flags force_abi } {
}
}
- clean_restart $binfile
+ clean_restart
+ gdb_load $::binfile
# Run to `main' where we begin our tests.
if {![runto_main]} {
@@ -131,7 +132,7 @@ proc altivec_abi_tests { extra_flags force_abi } {
gdb_test "p matrix\[3\]" ".*= .31, 32, 33, 34, 35, 36, 37, 38." "print fourth vector"
}
-if [test_compiler_info gcc*] {
+if {[test_compiler_info gcc*]} {
set binprefix ${binfile}
with_test_prefix "default ABI, auto" {
@@ -165,7 +166,7 @@ if [test_compiler_info gcc*] {
altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "auto"
}
}
-} elseif [test_compiler_info xlc*] {
+} elseif {[test_compiler_info xlc*]} {
altivec_abi_tests "additional_flags=-qaltivec" "auto"
} else {
warning "unknown compiler"
diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp
index 2721f59..dfe7e24 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
@@ -1,5 +1,5 @@
-# Copyright (C) 2002-2024 Free Software Foundation, Inc.
-#
+# Copyright (C) 2002-2025 Free Software Foundation, Inc.
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -26,9 +26,9 @@ require allow_altivec_tests
standard_testfile
set compile_flags {debug nowarnings}
-if [test_compiler_info gcc*] {
+if {[test_compiler_info gcc*]} {
set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec"
-} elseif [test_compiler_info xlc*] {
+} elseif {[test_compiler_info xlc*]} {
set compile_flags "$compile_flags additional_flags=-qaltivec"
} else {
warning "unknown compiler"
@@ -134,11 +134,11 @@ gdb_test "continue" \
"Breakpoint $decimal, vector_fun .a=.0xfefefefe, 0xfefefefe, 0xfefefefe, 0xfefefefe., b=.0x1010101, 0x1010101, 0x1010101, 0x1010101.*altivec-regs.c.*vec_splat_u8.2..;" \
"continue to vector_fun"
-# Do a next over the assignment to vector 'a'.
+# Do a next over the assignment to vector 'a'.
gdb_test "next" ".*b = \\(\\(vector unsigned int\\) vec_splat_u8\\(3\\)\\);" \
"next (1)"
-# Do a next over the assignment to vector 'b'.
+# Do a next over the assignment to vector 'b'.
gdb_test "next" "c = vec_add \\(a, b\\);" \
"next (2)"
diff --git a/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.S b/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.S
index 3bac139..5ec2d17 100644
--- a/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.S
+++ b/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.S
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp b/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp
index f8f7ab3..a2caf46 100644
--- a/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp
+++ b/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-byte.exp b/gdb/testsuite/gdb.arch/amd64-byte.exp
index 1349f99..d67361d 100644
--- a/gdb/testsuite/gdb.arch/amd64-byte.exp
+++ b/gdb/testsuite/gdb.arch/amd64-byte.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list
return
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return 0
@@ -63,7 +63,7 @@ with_test_prefix "at first bp" {
}
for { set r 1 } { $r <= 4 } { incr r } {
- set h [expr $r + 14]
+ set h [expr {$r + 14}]
gdb_test "print/x \$$byte_regs($h)" \
".. = 0x[format %x $r]2" \
"check contents of %$byte_regs($h)"
@@ -85,7 +85,7 @@ with_test_prefix "at second bp" {
}
for { set r 1 } { $r <= 4 } { incr r } {
- set h [expr $r + 14]
+ set h [expr {$r + 14}]
gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
}
}
@@ -101,7 +101,7 @@ with_test_prefix "at third bp" {
}
for { set r 1 } { $r <= 4 } { incr r } {
- set h [expr $r + 14]
+ set h [expr {$r + 14}]
gdb_test "print \$$byte_regs($h)" \
".. = $h" \
"check contents of %$byte_regs($h)"
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S
index 9b6b2b1..0ba0816 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S
@@ -1,4 +1,4 @@
-/* Copyright 2009-2024 Free Software Foundation, Inc.
+/* Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
index 4ae6461..b11efa7 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
# instructions.
require is_x86_64_m64_target have_avx
+require support_displaced_stepping
standard_testfile .S
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c
index fbbfad1..0fb2904 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -16,9 +16,27 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
+#include <stdlib.h>
+
+extern void test_call (void);
+
+void
+unreachable (void)
+{
+ abort ();
+}
void
setup_alarm (void)
{
alarm (300);
}
+
+int
+main ()
+{
+ setup_alarm ();
+ test_call ();
+ unreachable ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S
index f585b3b..20a8eb7 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S
@@ -1,4 +1,4 @@
-/* Copyright 2009-2024 Free Software Foundation, Inc.
+/* Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,33 +18,12 @@
handling. */
.text
-
- .global main
-main:
- nop
-
- callq setup_alarm
-
- nop
-
-/***********************************************/
-
-/* test call/ret */
-
.global test_call
test_call:
call test_call
- nop
+ call unreachable
.global test_ret_end
test_ret_end:
nop
-/***********************************************/
-
-/* all done */
-
-done:
- mov $0,%rdi
- call exit
- hlt
.section .note.GNU-stack,"",@progbits
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp
index 2db3ff2..cd982a0 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -59,7 +59,7 @@ gdb_test_multiple "x/2i \$pc" "get address of next insn" {
}
# Clear the slot on the stack and confirm it was set to zero.
-set sp [expr $sp - 0x8]
+set sp [expr {$sp - 0x8}]
gdb_test_no_output "set {unsigned long long} $sp = 0" \
"clear stack slot"
set zero_val 0x[format %016x 0]
@@ -73,7 +73,7 @@ gdb_test "stepi" \
# Check stack pointer was updated to the expected value.
set new_sp [get_hexadecimal_valueof "\$sp" "*UNKNOWN*" \
"get stack pointer after step"]
-gdb_assert {[expr $sp == $new_sp]} \
+gdb_assert {[expr {$sp == $new_sp}]} \
"check stack pointer was updated as expected"
# Check the contents of the stack were updated to the expected value.
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-signal.c b/gdb/testsuite/gdb.arch/amd64-disp-step-signal.c
index 66d529c..8b55289 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step-signal.c
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step-signal.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step.S b/gdb/testsuite/gdb.arch/amd64-disp-step.S
index ed805da..6037164 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step.S
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step.S
@@ -1,4 +1,4 @@
-/* Copyright 2009-2024 Free Software Foundation, Inc.
+/* Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step.exp b/gdb/testsuite/gdb.arch/amd64-disp-step.exp
index 1ec41d6..3b0d828 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step.exp
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -143,7 +143,7 @@ proc set_regs { regs val } {
# Use send_gdb/gdb_expect so that these aren't logged as pass/fail.
send_gdb "set \$${reg} = ${val}\n"
gdb_expect 10 {
- -re "$gdb_prompt $" {
+ -re "$gdb_prompt $" {
verbose "Setting ${reg} to ${val}." 2
}
timeout {
@@ -223,7 +223,7 @@ proc rip_test { reg test_start_label test_end_label signal_modes } {
# the displaced step, but instead just delivers the signal.
set inferior_pid [get_inferior_pid]
# Ensure that $inferior_pid refers to a single process.
- gdb_assert {[expr $inferior_pid > 0]} \
+ gdb_assert {[expr {$inferior_pid > 0}]} \
"check for a sane inferior pid"
if {$inferior_pid > 0} {
remote_exec target "kill -ALRM $inferior_pid"
diff --git a/gdb/testsuite/gdb.arch/amd64-dword.exp b/gdb/testsuite/gdb.arch/amd64-dword.exp
index eacdee2..cd3d76b 100644
--- a/gdb/testsuite/gdb.arch/amd64-dword.exp
+++ b/gdb/testsuite/gdb.arch/amd64-dword.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list
return
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.S b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.S
index 38a3960..bb51874 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.S
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.c b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.c
index 133b1d8..b759d09 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.c
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp
index b9f97ca..ec6ebc4 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
set opts {}
standard_testfile .S .c
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-inline.exp COMPILE=1"
standard_testfile .c .c
lappend opts debug optimize=-O2
@@ -25,7 +25,7 @@ if [info exists COMPILE] {
}
# Make .c available on the host.
-if [is_remote host] {
+if {[is_remote host]} {
gdb_remote_download host $srcdir/$subdir/$srcfile2
}
@@ -33,7 +33,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.S b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.S
index 04dcf02..2a6aee2 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.S
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.c b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.c
index 6b470aa..aa43849 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.c
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp
index 5078d0c..2207ecf 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
standard_testfile .S .c
set opts {}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-param-dwarf5.exp COMPILE=1"
standard_testfile .c .c
lappend opts optimize=-O2 dwarf5
@@ -25,7 +25,7 @@ if [info exists COMPILE] {
}
# Make .c available on the host.
-if [is_remote host] {
+if {[is_remote host]} {
gdb_remote_download host $srcdir/$subdir/$srcfile2
}
@@ -33,7 +33,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param.S b/gdb/testsuite/gdb.arch/amd64-entry-value-param.S
index 9bf28ca..a94c8ab 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-param.S
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param.c b/gdb/testsuite/gdb.arch/amd64-entry-value-param.c
index 6b470aa..aa43849 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-param.c
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp
index e3a85d4..57b3ca4 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
standard_testfile .S .c
set opts {}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-param.exp COMPILE=1"
standard_testfile .c .c
lappend opts debug optimize=-O2
@@ -25,7 +25,7 @@ if [info exists COMPILE] {
}
# Make .c available on the host.
-if [is_remote host] {
+if {[is_remote host]} {
remote_download host $srcdir/$subdir/$srcfile2
}
@@ -33,7 +33,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.S b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.S
index 2d151bb..a4d98ab 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.S
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.cc b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.cc
index 8916039..99e088b 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.cc
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp
index 7bd1b4e..94737f3 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ standard_testfile .S .cc
require is_x86_64_m64_target
# Make .cc available on the host.
-if [is_remote host] {
+if {[is_remote host]} {
gdb_remote_download host $srcdir/$subdir/$srcfile2
}
@@ -27,7 +27,7 @@ if { [prepare_for_testing_full "failed to prepare" \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.cc b/gdb/testsuite/gdb.arch/amd64-entry-value.cc
index 3649895..90b17b2 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value.cc
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.exp b/gdb/testsuite/gdb.arch/amd64-entry-value.exp
index 3d119d0..59f0975 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
standard_testfile .s
set opts {nopie}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.arch/amd64-entry-value.exp COMPILE=1"
set srcfile ${testfile}.cc
lappend opts debug
@@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.s b/gdb/testsuite/gdb.arch/amd64-entry-value.s
index a3143f5..d9e6a7e 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value.s
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-eval.cc b/gdb/testsuite/gdb.arch/amd64-eval.cc
index b93c6fe..9b908c6 100644
--- a/gdb/testsuite/gdb.arch/amd64-eval.cc
+++ b/gdb/testsuite/gdb.arch/amd64-eval.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-eval.exp b/gdb/testsuite/gdb.arch/amd64-eval.exp
index 805dc73..79ff8aa 100644
--- a/gdb/testsuite/gdb.arch/amd64-eval.exp
+++ b/gdb/testsuite/gdb.arch/amd64-eval.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis-no-cfi.S b/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis-no-cfi.S
new file mode 100644
index 0000000..39cf3e6
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis-no-cfi.S
@@ -0,0 +1,117 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* This file is compiled from gdb.arch/amd64-extended-prologue-analysis.c
+ using gcc 11.4.0 with flags: -g0 -O1 -S -fno-omit-frame-pointer
+ -fno-asynchronous-unwind-tables. */
+
+ .file "amd64-extended-prologue-analysis.c"
+ .text
+ .globl bar
+ .type bar, @function
+bar:
+ endbr64
+ leal (%rdi,%rdi), %eax
+ ret
+ .size bar, .-bar
+ .globl foo
+ .type foo, @function
+foo:
+ endbr64
+ pushq %rbp
+ movq %rsp, %rbp
+ pushq %r15
+ pushq %r14
+ pushq %r13
+ pushq %r12
+ pushq %rbx
+ subq $280, %rsp
+ movl %edi, %ebx
+ movl %esi, %r14d
+ movl %edx, %r13d
+ movl %ecx, %r12d
+ movq %fs:40, %rax
+ movq %rax, -56(%rbp)
+ xorl %eax, %eax
+.L3:
+ leal (%rbx,%rax), %ecx
+ movslq %eax, %rdx
+ movb %cl, -320(%rbp,%rdx)
+ addl $1, %eax
+ cmpl $256, %eax
+ jne .L3
+ movl %ebx, %edi
+ call bar
+ movl %eax, %r15d
+ movl %r14d, %edi
+ call bar
+ leal (%r15,%rax), %r14d
+ movl %r13d, %edi
+ call bar
+ addl %eax, %r14d
+ movl %r12d, %edi
+ call bar
+ addl %r14d, %eax
+ addl %ebx, %eax
+ movq -56(%rbp), %rdx
+ subq %fs:40, %rdx
+ jne .L7
+ addq $280, %rsp
+ popq %rbx
+ popq %r12
+ popq %r13
+ popq %r14
+ popq %r15
+ popq %rbp
+ ret
+.L7:
+ call __stack_chk_fail@PLT
+ .size foo, .-foo
+ .globl main
+ .type main, @function
+main:
+ endbr64
+ pushq %rbp
+ movq %rsp, %rbp
+ subq $16, %rsp
+ leal (%rdi,%rdi), %ecx
+ leal 2(%rdi), %edx
+ leal 1(%rdi), %esi
+ call foo
+ movl %eax, -4(%rbp)
+ movl -4(%rbp), %eax
+ leave
+ ret
+ .size main, .-main
+ .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
+ .section .note.GNU-stack,"",@progbits
+ .section .note.gnu.property,"a"
+ .align 8
+ .long 1f - 0f
+ .long 4f - 1f
+ .long 5
+0:
+ .string "GNU"
+1:
+ .align 8
+ .long 0xc0000002
+ .long 3f - 2f
+2:
+ .long 0x3
+3:
+ .align 8
+4:
diff --git a/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis-offset.S b/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis-offset.S
new file mode 100644
index 0000000..ea001b3
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis-offset.S
@@ -0,0 +1,112 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* This file is compiled from gdb.arch/amd64-extended-prologue-analysis.c
+ using gcc 11.4.0 with flags: -g0 -O1 -S -fomit-frame-pointer
+ -fno-asynchronous-unwind-tables. */
+
+ .file "amd64-extended-prologue-analysis.c"
+ .text
+ .globl bar
+ .type bar, @function
+bar:
+ endbr64
+ leal (%rdi,%rdi), %eax
+ ret
+ .size bar, .-bar
+ .globl foo
+ .type foo, @function
+foo:
+ endbr64
+ pushq %r14
+ pushq %r13
+ pushq %r12
+ pushq %rbp
+ pushq %rbx
+ subq $272, %rsp
+ movl %edi, %ebx
+ movl %esi, %r13d
+ movl %edx, %r12d
+ movl %ecx, %ebp
+ movq %fs:40, %rax
+ movq %rax, 264(%rsp)
+ xorl %eax, %eax
+.L3:
+ leal (%rbx,%rax), %ecx
+ movslq %eax, %rdx
+ movb %cl, (%rsp,%rdx)
+ addl $1, %eax
+ cmpl $256, %eax
+ jne .L3
+ movl %ebx, %edi
+ call bar
+ movl %eax, %r14d
+ movl %r13d, %edi
+ call bar
+ leal (%r14,%rax), %r13d
+ movl %r12d, %edi
+ call bar
+ addl %eax, %r13d
+ movl %ebp, %edi
+ call bar
+ addl %r13d, %eax
+ addl %ebx, %eax
+ movq 264(%rsp), %rdx
+ subq %fs:40, %rdx
+ jne .L7
+ addq $272, %rsp
+ popq %rbx
+ popq %rbp
+ popq %r12
+ popq %r13
+ popq %r14
+ ret
+.L7:
+ call __stack_chk_fail@PLT
+ .size foo, .-foo
+ .globl main
+ .type main, @function
+main:
+ endbr64
+ subq $24, %rsp
+ leal (%rdi,%rdi), %ecx
+ leal 2(%rdi), %edx
+ leal 1(%rdi), %esi
+ call foo
+ movl %eax, 12(%rsp)
+ movl 12(%rsp), %eax
+ addq $24, %rsp
+ ret
+ .size main, .-main
+ .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
+ .section .note.GNU-stack,"",@progbits
+ .section .note.gnu.property,"a"
+ .align 8
+ .long 1f - 0f
+ .long 4f - 1f
+ .long 5
+0:
+ .string "GNU"
+1:
+ .align 8
+ .long 0xc0000002
+ .long 3f - 2f
+2:
+ .long 0x3
+3:
+ .align 8
+4:
diff --git a/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.S b/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.S
new file mode 100644
index 0000000..691eee0
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.S
@@ -0,0 +1,143 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* This file is compiled from gdb.arch/amd64-extended-prologue-analysis.c
+ using gcc 11.4.0 with flags: -g0 -O1 -S -fno-omit-frame-pointer. */
+
+ .file "amd64-extended-prologue-analysis.c"
+ .text
+ .globl bar
+ .type bar, @function
+bar:
+.LFB0:
+ .cfi_startproc
+ endbr64
+ leal (%rdi,%rdi), %eax
+ ret
+ .cfi_endproc
+.LFE0:
+ .size bar, .-bar
+ .globl foo
+ .type foo, @function
+foo:
+.LFB1:
+ .cfi_startproc
+ endbr64
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register 6
+ pushq %r15
+ pushq %r14
+ pushq %r13
+ pushq %r12
+ pushq %rbx
+ subq $280, %rsp
+ .cfi_offset 15, -24
+ .cfi_offset 14, -32
+ .cfi_offset 13, -40
+ .cfi_offset 12, -48
+ .cfi_offset 3, -56
+ movl %edi, %ebx
+ movl %esi, %r14d
+ movl %edx, %r13d
+ movl %ecx, %r12d
+ movq %fs:40, %rax
+ movq %rax, -56(%rbp)
+ xorl %eax, %eax
+.L3:
+ leal (%rbx,%rax), %ecx
+ movslq %eax, %rdx
+ movb %cl, -320(%rbp,%rdx)
+ addl $1, %eax
+ cmpl $256, %eax
+ jne .L3
+ movl %ebx, %edi
+ call bar
+ movl %eax, %r15d
+ movl %r14d, %edi
+ call bar
+ leal (%r15,%rax), %r14d
+ movl %r13d, %edi
+ call bar
+ addl %eax, %r14d
+ movl %r12d, %edi
+ call bar
+ addl %r14d, %eax
+ addl %ebx, %eax
+ movq -56(%rbp), %rdx
+ subq %fs:40, %rdx
+ jne .L7
+ addq $280, %rsp
+ popq %rbx
+ popq %r12
+ popq %r13
+ popq %r14
+ popq %r15
+ popq %rbp
+ .cfi_remember_state
+ .cfi_def_cfa 7, 8
+ ret
+.L7:
+ .cfi_restore_state
+ call __stack_chk_fail@PLT
+ .cfi_endproc
+.LFE1:
+ .size foo, .-foo
+ .globl main
+ .type main, @function
+main:
+.LFB2:
+ .cfi_startproc
+ endbr64
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register 6
+ subq $16, %rsp
+ leal (%rdi,%rdi), %ecx
+ leal 2(%rdi), %edx
+ leal 1(%rdi), %esi
+ call foo
+ movl %eax, -4(%rbp)
+ movl -4(%rbp), %eax
+ leave
+ .cfi_def_cfa 7, 8
+ ret
+ .cfi_endproc
+.LFE2:
+ .size main, .-main
+ .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
+ .section .note.GNU-stack,"",@progbits
+ .section .note.gnu.property,"a"
+ .align 8
+ .long 1f - 0f
+ .long 4f - 1f
+ .long 5
+0:
+ .string "GNU"
+1:
+ .align 8
+ .long 0xc0000002
+ .long 3f - 2f
+2:
+ .long 0x3
+3:
+ .align 8
+4:
diff --git a/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.c b/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.c
new file mode 100644
index 0000000..707b4fb
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.c
@@ -0,0 +1,56 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int __attribute__ ((noinline))
+bar (int x)
+{
+ return x + x;
+}
+
+/* This function should generate a prologue in shape of:
+ push %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset %rbp, -16
+ mov %rsp, %rbp
+ .cfi_def_cfa_register %rbp
+ push %reg1
+ push %reg2
+ sub $XXX, %rsp
+ .cfi_offset %reg2, 32
+ .cfi_offset %reg1, 24
+
+ So to be able to unwind a register, GDB needs to skip prologue past
+ register pushes and stack allocation (to access .cfi directives). */
+int __attribute__ ((noinline))
+foo (int a, int b, int c, int d)
+{
+ /* "volatile" alone isn't enough for clang to not optimize it out and
+ allocate space on the stack. */
+ volatile char s[256];
+ for (int i = 0; i < 256; i++)
+ s[i] = (char) (a + i);
+
+ a += bar (a) + bar (b) + bar (c) + bar (d);
+ return a;
+}
+
+int
+main (int argc, char **argv)
+{
+ volatile int a = foo (argc, argc + 1, argc + 2, argc * 2);
+ return a;
+}
diff --git a/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.exp b/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.exp
new file mode 100644
index 0000000..dcdb850
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.exp
@@ -0,0 +1,208 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# This test verifies that when placing a breakpoint on a function with a frame
+# pointer, instructions that push callee-saved registers and stack allocation
+# in the prologue are skipped, without debug info. When stopped on such
+# breakpoint, the pushed registers should be able to be immediately unwound.
+# With debug info present, GDB would try to use prologue-end markers found in
+# the line table to determine where the prologue ends.
+#
+# It is also tested both with and without .eh_frame's .cfi directives - with
+# them, GDB can only unwind a register once stopped after .cfi directive for
+# that register's push.
+
+require is_x86_64_m64_target
+standard_testfile .c -no-cfi.S .S -offset.S
+
+proc test_run {} {
+ gdb_breakpoint "foo"
+ gdb_continue_to_breakpoint "Continue to foo"
+
+ gdb_test "backtrace" "#0\[^\r\n\]+in foo\[^s\]+#1\[^\r\n\]+in main\[^s\]+" \
+ "Verify backtrace output in foo"
+
+ set main_r12 [get_integer_valueof "\$r12" "null"]
+ gdb_assert { $main_r12 ne "null" }
+
+ set foo_r12 [expr {$main_r12 + 2}]
+ gdb_test "print \$r12=$foo_r12" "$foo_r12" "Set foo's %r12=$foo_r12"
+ gdb_test "up" ".*main.*" "Go up a frame from foo"
+ gdb_test "print \$r12" "$main_r12" "foo's %r12 unwound"
+ gdb_test "down" ".*foo.*" "Go back down a frame to foo"
+ gdb_test "print \$r12" "$foo_r12" "foo's %r12 unwound back"
+}
+
+proc offset_test_run {} {
+ gdb_breakpoint "*foo"
+ gdb_continue_to_breakpoint "Continue to entry of foo"
+
+ set old_reg_val [get_integer_valueof "\$r12" "null"]
+ gdb_assert { $old_reg_val ne "null" }
+
+ set new_reg_val [expr {$old_reg_val + 3}]
+ gdb_test "print \$r14=$new_reg_val" "$new_reg_val" "Set %r14=$new_reg_val"
+ gdb_test "print \$r13=$new_reg_val" "$new_reg_val" "Set %r13=$new_reg_val"
+ gdb_test "print \$r12=$new_reg_val" "$new_reg_val" "Set %r12=$new_reg_val"
+
+ set addr_past_prologue "null"
+ gdb_test_multiple "disassemble" "Disassemble foo" -lbl {
+ -re "\r\n\\s*($::hex) <\\+($::decimal)>:\\s*mov.*(?=\r\n)" {
+ set addr_past_prologue $expect_out(1,string)
+ exp_continue
+ }
+
+ -re -wrap "" {
+ gdb_assert { $addr_past_prologue ne "null" } $gdb_test_name
+ }
+ }
+
+ gdb_assert { $addr_past_prologue ne "null" }
+
+ gdb_breakpoint "*$addr_past_prologue"
+ gdb_continue_to_breakpoint "Continue past foo's prologue"
+
+ gdb_test "up" ".*main.*" "Go up a frame from foo"
+ gdb_test "print \$r14" "$new_reg_val" "Verify %r14 value"
+ gdb_test "print \$r13" "$new_reg_val" "Verify %r13 value"
+ gdb_test "print \$r12" "$new_reg_val" "Verify %r12 value"
+}
+
+# Tests are done for two versions (not counting with and w/o .cfi):
+# - binary compiled from C source, which verifies we actually test against
+# the code that compilers produce and we expect
+# - binary compiled from ASM source, which verifies that we properly analyze
+# prologue sequences even when compiler introduces a sudden change in how
+# it generates assembly
+#
+# With those 2 versions, we can easily distinguish GDB breaking analyzer and
+# compilers behaving differently, if there ever is an impactful change in how
+# they generate prologues.
+with_test_prefix "w/o .cfi directives" {
+ with_test_prefix "compiler gen" {
+ # -fno-asynchronous-unwind-tables is needed to get rid of .cfi
+ # directives in .eh_frame section.
+ if { [gdb_can_simple_compile fno-asynchronous-unwind-tables \
+ { void foo () { } } object -fno-asynchronous-unwind-tables] == 0 } {
+ unsupported \
+ "compiler doesn't support -fno-asynchronous-unwind-tables flag"
+ } else {
+ # For at least gcc 11.4/clang 14.0.0 and later, -O1 makes them more
+ # eager to use registers in the prologue.
+ #
+ # At least gcc 11.4 and later by default does not generate full
+ # debug info, "nodebug" is there for other compilers.
+ if { [prepare_for_testing "failed to prepare" "$testfile-no-cfi-C" \
+ $srcfile { optimize=-O1 nodebug
+ additional_flags=-fno-asynchronous-unwind-tables
+ additional_flags=-fno-omit-frame-pointer}] } {
+ return
+ }
+
+ if { ![runto_main] } {
+ untested "unable to run to main"
+ return
+ }
+
+ test_run
+ }
+ }
+
+ with_test_prefix "ASM source" {
+ if { [prepare_for_testing "failed to prepare" "$testfile-no-cfi-S" \
+ $srcfile2 nodebug ] } {
+ return
+ }
+
+ if { ![runto_main] } {
+ untested "unable to run to main"
+ return
+ }
+
+ test_run
+ }
+}
+
+with_test_prefix "with .cfi directives" {
+ with_test_prefix "compiler gen" {
+ if { [prepare_for_testing "failed to prepare" "$testfile-cfi-C" \
+ $srcfile { optimize=-O1
+ nodebug additional_flags=-fno-omit-frame-pointer}] } {
+ return
+ }
+
+ if { ![runto_main] } {
+ untested "unable to run to main"
+ return
+ }
+
+ test_run
+ }
+
+ with_test_prefix "ASM source" {
+ if { [prepare_for_testing "failed to prepare" "$testfile-cfi-S" \
+ $srcfile3 nodebug ] } {
+ return
+ }
+
+ if { ![runto_main] } {
+ untested "unable to run to main"
+ return
+ }
+
+ test_run
+ }
+}
+
+# This section exists to verify that we properly assign offsets for functions
+# w/o a frame pointer, for registers when they're pushed. If they were assigned
+# in a wrong way, we might end up unwinding improper register values.
+with_test_prefix "offset initialization" {
+ with_test_prefix "compiler gen" {
+ if { [gdb_can_simple_compile fno-asynchronous-unwind-tables \
+ { void foo () { } } object -fno-asynchronous-unwind-tables] == 0 } {
+ unsupported \
+ "compiler doesn't support -fno-asynchronous-unwind-tables flag"
+ } else {
+ if { [prepare_for_testing "failed to prepare" "$testfile-offset-C" \
+ $srcfile { optimize=-O1 nodebug
+ additional_flags=-fno-asynchronous-unwind-tables
+ additional_flags=-fomit-frame-pointer}] } {
+ return
+ }
+
+ if { ![runto_main] } {
+ untested "unable to run to main"
+ return
+ }
+
+ offset_test_run
+ }
+ }
+
+ with_test_prefix "ASM source" {
+ if { [prepare_for_testing "failed to prepare" "$testfile-offset-S" \
+ $srcfile4 nodebug ] } {
+ return
+ }
+
+ if { ![runto_main] } {
+ untested "unable to run to main"
+ return
+ }
+
+ offset_test_run
+ }
+}
diff --git a/gdb/testsuite/gdb.arch/amd64-frameptr-vecreg-unwind.c b/gdb/testsuite/gdb.arch/amd64-frameptr-vecreg-unwind.c
new file mode 100644
index 0000000..1b79a65
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-frameptr-vecreg-unwind.c
@@ -0,0 +1,63 @@
+/* Copyright 2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+volatile void dummy () {}
+
+long test_function(void)
+{
+ __asm__ volatile (
+ /* Clear xmm0. */
+ "vxorps %%xmm0, %%xmm0, %%xmm0\n\t"
+
+ /* Move the frame pointer (rbp) to xmm0. */
+ "movq %%rbp, %%xmm0\n\t"
+
+ /* CFI: Frame pointer is in xmm0. */
+ ".cfi_register %%rbp, %%xmm0\n\t"
+
+ /* Clobber list: Specify all modified registers */
+ : // No output operands
+ : // No input operands
+ : "xmm0"
+ );
+
+ dummy (); /* break-here */
+
+ /* Pseudo-epilogue: Restore rbp from xmm0. */
+ __asm__ volatile (
+ /* Restore rbp. */
+ "movq %%xmm0, %%rbp\n\t"
+
+ /* Describe CFI: Frame pointer is restored. */
+ ".cfi_restore %%rbp\n\t"
+
+ /* Clobber list: Specify all modified registers */
+ : /* No output operands. */
+ : /* No input operands. */
+ : /* Despite clobbering rbp, gcc doesn't let us list it here. */
+ );
+
+ return 0;
+}
+
+int
+main ()
+{
+ long result = test_function ();
+ dummy ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.arch/amd64-frameptr-vecreg-unwind.exp b/gdb/testsuite/gdb.arch/amd64-frameptr-vecreg-unwind.exp
new file mode 100644
index 0000000..3c0b319
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-frameptr-vecreg-unwind.exp
@@ -0,0 +1,40 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This test verifies that we can read and write the value of a pseudo register
+# in unwound frames. For the test, we choose one raw register, rbx, and one
+# pseudo register that is backed by rbx, ebx. We have two frames (the inner one,
+# #0 and the outer one, #1) that each set a value for rbx. We verify that we
+# can read both rbx and ebx correctly for each frame, and that when we write to
+# ebx, rbx for that frame is correctly updated.
+
+require is_x86_64_m64_target
+
+standard_testfile
+
+if { [prepare_for_testing "failed to prepare" ${testfile} \
+ "${srcfile}" {debug}] } {
+ return -1
+}
+
+if {![runto_main]} {
+ return
+}
+
+gdb_breakpoint [gdb_get_line_number "break-here"]
+gdb_continue_to_breakpoint "break-here"
+gdb_test "with confirm off --return -1" "result = test_function \\(\\);"
+gdb_test "step" "dummy \\(\\);"
+gdb_test "print result" "= -1"
diff --git a/gdb/testsuite/gdb.arch/amd64-gs_base.c b/gdb/testsuite/gdb.arch/amd64-gs_base.c
index a577cff..41669f8 100644
--- a/gdb/testsuite/gdb.arch/amd64-gs_base.c
+++ b/gdb/testsuite/gdb.arch/amd64-gs_base.c
@@ -1,6 +1,6 @@
/* Test program for fs_base and gs_base.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/amd64-gs_base.exp b/gdb/testsuite/gdb.arch/amd64-gs_base.exp
index 6e95f78..a48cbec 100644
--- a/gdb/testsuite/gdb.arch/amd64-gs_base.exp
+++ b/gdb/testsuite/gdb.arch/amd64-gs_base.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-i386-address.S b/gdb/testsuite/gdb.arch/amd64-i386-address.S
index cd5a68c..32f7eb5 100644
--- a/gdb/testsuite/gdb.arch/amd64-i386-address.S
+++ b/gdb/testsuite/gdb.arch/amd64-i386-address.S
@@ -1,4 +1,4 @@
-/* Copyright 2009-2024 Free Software Foundation, Inc.
+/* Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-i386-address.exp b/gdb/testsuite/gdb.arch/amd64-i386-address.exp
index 2a37220..31ce704 100644
--- a/gdb/testsuite/gdb.arch/amd64-i386-address.exp
+++ b/gdb/testsuite/gdb.arch/amd64-i386-address.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
require {is_any_target "x86_64-*-*" "i?86-*-*"} is_lp64_target
require {!istarget "*-*-openbsd*"}
-if [prepare_for_testing "failed to prepare" amd64-i386-address amd64-i386-address.S [list debug "additional_flags=-m32 -nostdlib"]] {
+if {[prepare_for_testing "failed to prepare" amd64-i386-address amd64-i386-address.S [list debug "additional_flags=-m32 -nostdlib"]]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-init-x87-values.S b/gdb/testsuite/gdb.arch/amd64-init-x87-values.S
index 0133b20..fe3eccc 100644
--- a/gdb/testsuite/gdb.arch/amd64-init-x87-values.S
+++ b/gdb/testsuite/gdb.arch/amd64-init-x87-values.S
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp b/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp
index f6e1204..5bbadaf 100644
--- a/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp
+++ b/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ standard_testfile .S
set options [list debug \
additional_flags=-static \
- additional_flags=-nostartfiles]
+ ldflags=-nostartfiles]
if { [build_executable "failed to prepare" ${testfile} ${srcfile} $options] } {
return -1
}
@@ -40,7 +40,7 @@ if { [build_executable "failed to prepare" ${testfile} ${srcfile} $options] } {
proc_with_prefix check_x87_regs_around_init {} {
global binfile
- clean_restart ${binfile}
+ clean_restart ${::testfile}
# Get things started.
if {![runto_main]} {
@@ -115,7 +115,7 @@ proc_with_prefix check_x87_regs_around_init {} {
proc_with_prefix check_setting_mxcsr_before_enable {} {
global binfile gdb_prompt
- clean_restart ${binfile}
+ clean_restart ${::testfile}
if {![runto_main]} {
return 0
@@ -149,7 +149,7 @@ proc_with_prefix check_setting_mxcsr_before_enable {} {
proc_with_prefix check_setting_x87_regs_before_enable {} {
global binfile
- clean_restart ${binfile}
+ clean_restart ${::testfile}
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.S b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.S
index bf9f67c..81b6b9c 100644
--- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.S
+++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.c b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.c
index 1e0e957..8123e70 100644
--- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.c
+++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp
index d78c051..a499eae 100644
--- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp
+++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {nopie}] }
return -1
}
-if ![runto breakpt] {
+if {![runto breakpt]} {
return -1
}
@@ -45,9 +45,9 @@ gdb_test "bt" "^#0 +breakpt *\\(\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in func5\[^\
gdb_test "bt" "^#0 +breakpt *\\(\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in func5\[^\r\n\]*\r\n#2 +0x\[0-9a-f\]+ in func4\[^\r\n\]*\r\n#3 +0x\[0-9a-f\]+ in func3\[^\r\n\]*\r\nBacktrace stopped: Cannot access memory at address 0x\[0-9a-f\]+" \
"second backtrace, with error message"
-clean_restart ${binfile}
+clean_restart ${::testfile}
-if ![runto breakpt] {
+if {![runto breakpt]} {
return -1
}
@@ -59,9 +59,9 @@ gdb_test "interpreter-exec mi \"-stack-info-depth\"" \
"\\^done,depth=\"4\"" \
"check mi -stack-info-depth command, second time"
-clean_restart ${binfile}
+clean_restart ${::testfile}
-if ![runto breakpt] {
+if {![runto breakpt]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.c b/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.c
index 445673c..39b1a61 100644
--- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.c
+++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp b/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp
index b58a75f..7f1b806 100644
--- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp
+++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
return -1
}
-if ![runto breakpt] {
+if {![runto breakpt]} {
return -1
}
@@ -49,9 +49,9 @@ gdb_test "bt no-filters" "^#0 +$hex in func2 \\(\\)\r\nBacktrace stopped: Cannot
gdb_test "bt no-filters" "^#0 +$hex in func2 \\(\\)\r\nBacktrace stopped: Cannot access memory at address 0x\[0-9a-f\]+" \
"second backtrace, with error message"
-clean_restart ${binfile}
+clean_restart ${::testfile}
-if ![runto breakpt] {
+if {![runto breakpt]} {
return -1
}
@@ -63,9 +63,9 @@ gdb_test "interpreter-exec mi \"-stack-info-depth\"" \
"\\^done,depth=\"1\"" \
"check mi -stack-info-depth command, second time"
-clean_restart ${binfile}
+clean_restart ${::testfile}
-if ![runto breakpt] {
+if {![runto breakpt]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-lam.c b/gdb/testsuite/gdb.arch/amd64-lam.c
index 0fe2bc6..f3fb30f 100755
--- a/gdb/testsuite/gdb.arch/amd64-lam.c
+++ b/gdb/testsuite/gdb.arch/amd64-lam.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-lam.exp b/gdb/testsuite/gdb.arch/amd64-lam.exp
index 0bcbb63..241a301 100644
--- a/gdb/testsuite/gdb.arch/amd64-lam.exp
+++ b/gdb/testsuite/gdb.arch/amd64-lam.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-optimout-repeat.S b/gdb/testsuite/gdb.arch/amd64-optimout-repeat.S
index aa867dd..30e7ec8 100644
--- a/gdb/testsuite/gdb.arch/amd64-optimout-repeat.S
+++ b/gdb/testsuite/gdb.arch/amd64-optimout-repeat.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-optimout-repeat.c b/gdb/testsuite/gdb.arch/amd64-optimout-repeat.c
index ea3f5fa..8a494a7 100644
--- a/gdb/testsuite/gdb.arch/amd64-optimout-repeat.c
+++ b/gdb/testsuite/gdb.arch/amd64-optimout-repeat.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp b/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp
index 3ff40ad..38ce3ac 100644
--- a/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp
+++ b/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
standard_testfile .S .c
set opts {}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.arch/amd64-optimout-repeat.exp COMPILE=1"
set srcfile ${srcfile2}
lappend opts debug optimize=-O2
@@ -28,7 +28,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-osabi.exp b/gdb/testsuite/gdb.arch/amd64-osabi.exp
index 2c1eb07..4fffdd9 100644
--- a/gdb/testsuite/gdb.arch/amd64-osabi.exp
+++ b/gdb/testsuite/gdb.arch/amd64-osabi.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-prologue-skip.S b/gdb/testsuite/gdb.arch/amd64-prologue-skip.S
index 6485503..fff8294 100644
--- a/gdb/testsuite/gdb.arch/amd64-prologue-skip.S
+++ b/gdb/testsuite/gdb.arch/amd64-prologue-skip.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-prologue-skip.exp b/gdb/testsuite/gdb.arch/amd64-prologue-skip.exp
index 4a21e04..c96c0c7 100644
--- a/gdb/testsuite/gdb.arch/amd64-prologue-skip.exp
+++ b/gdb/testsuite/gdb.arch/amd64-prologue-skip.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,7 +14,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
standard_testfile .S
-set binfile ${binfile}.o
+set testfile $testfile.o
+set binfile [standard_output_file $testfile]
require is_x86_64_m64_target
@@ -23,7 +24,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug}]
return
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test "break *pushrbp" " at 0x1: file .*"
gdb_test "break pushrbp" " at 0x1: file .*"
diff --git a/gdb/testsuite/gdb.arch/amd64-prologue-xmm.c b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.c
index 9c3974e..a6e7062 100644
--- a/gdb/testsuite/gdb.arch/amd64-prologue-xmm.c
+++ b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp
index fcf9fbe..3a688ab 100644
--- a/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp
+++ b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ set csrcfile [file rootname $srcfile].c
set csrcfile ${testfile}.c
set opts {}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS='gdb.arch/amd64-prologue-xmm.exp COMPILE=1'
set srcfile ${csrcfile}
lappend opts debug optimize=-O0
@@ -28,11 +28,11 @@ if [info exists COMPILE] {
require is_x86_64_m64_target
}
-if {[prepare_for_testing "failed to prepare" ${binfile} $srcfile $opts]} {
+if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile $opts]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-prologue-xmm.s b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.s
index 1a2e337..bbbdb7a 100644
--- a/gdb/testsuite/gdb.arch/amd64-prologue-xmm.s
+++ b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-pseudo-unwind-asm.S b/gdb/testsuite/gdb.arch/amd64-pseudo-unwind-asm.S
index 6aa1c94..5284ce0 100644
--- a/gdb/testsuite/gdb.arch/amd64-pseudo-unwind-asm.S
+++ b/gdb/testsuite/gdb.arch/amd64-pseudo-unwind-asm.S
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/amd64-pseudo-unwind.c b/gdb/testsuite/gdb.arch/amd64-pseudo-unwind.c
index 49b0553..1646a34 100644
--- a/gdb/testsuite/gdb.arch/amd64-pseudo-unwind.c
+++ b/gdb/testsuite/gdb.arch/amd64-pseudo-unwind.c
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/amd64-pseudo-unwind.exp b/gdb/testsuite/gdb.arch/amd64-pseudo-unwind.exp
index fa82bef..49721dd 100644
--- a/gdb/testsuite/gdb.arch/amd64-pseudo-unwind.exp
+++ b/gdb/testsuite/gdb.arch/amd64-pseudo-unwind.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.arch/amd64-pseudo.c b/gdb/testsuite/gdb.arch/amd64-pseudo.c
index cbf91b1..982d436 100644
--- a/gdb/testsuite/gdb.arch/amd64-pseudo.c
+++ b/gdb/testsuite/gdb.arch/amd64-pseudo.c
@@ -1,6 +1,6 @@
/* Test program for byte registers.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/amd64-shadow-stack-cmds.exp b/gdb/testsuite/gdb.arch/amd64-shadow-stack-cmds.exp
new file mode 100644
index 0000000..0ae172d
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-shadow-stack-cmds.exp
@@ -0,0 +1,143 @@
+# Copyright 2024-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test shadow stack enabling for frame level update, the return and the
+# call commands.
+# As potential CET violations often only occur after resuming normal
+# execution, test normal program continuation after each return or call
+# commands.
+
+require allow_ssp_tests
+
+standard_testfile amd64-shadow-stack.c
+
+# Restart GDB an run until breakpoint in call2.
+
+proc restart_and_run_infcall_call2 {} {
+ global binfile
+ clean_restart ${::testfile}
+ if { ![runto_main] } {
+ return -1
+ }
+ set inside_infcall_str "The program being debugged stopped while in a function called from GDB"
+ gdb_breakpoint [ gdb_get_line_number "break call2" ]
+ gdb_continue_to_breakpoint "break call2" ".*break call2.*"
+ gdb_test "call (int) call2()" \
+ "Breakpoint \[0-9\]*, call2.*$inside_infcall_str.*"
+}
+
+save_vars { ::env(GLIBC_TUNABLES) } {
+
+ append_environment GLIBC_TUNABLES "glibc.cpu.hwcaps" "SHSTK"
+
+ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
+ {debug additional_flags="-fcf-protection=return"}] } {
+ return -1
+ }
+
+ clean_restart ${::testfile}
+ if { ![runto_main] } {
+ return -1
+ }
+
+ with_test_prefix "test inferior call and continue" {
+ gdb_breakpoint [ gdb_get_line_number "break call1" ]
+ gdb_continue_to_breakpoint "break call1" ".*break call1.*"
+
+ gdb_test "call (int) call2()" "= 42"
+
+ gdb_continue_to_end
+ }
+
+ with_test_prefix "test return inside an inferior call" {
+ restart_and_run_infcall_call2
+
+ gdb_test "return" "\#0.*call2.*" \
+ "Test shadow stack return inside an inferior call" \
+ "Make.*return now\\? \\(y or n\\) " "y"
+
+ gdb_continue_to_end
+ }
+
+ with_test_prefix "test return 'above' an inferior call" {
+ restart_and_run_infcall_call2
+
+ gdb_test "frame 2" "call2 ().*" "move to frame 'above' inferior call"
+
+ gdb_test "return" "\#0.*call1.*" \
+ "Test shadow stack return 'above' an inferior call" \
+ "Make.*return now\\? \\(y or n\\) " "y"
+
+ gdb_continue_to_end
+ }
+
+ clean_restart ${::testfile}
+ if { ![runto_main] } {
+ return -1
+ }
+
+ set call1_line [ gdb_get_line_number "break call1" ]
+ set call2_line [ gdb_get_line_number "break call2" ]
+
+ # Extract shadow stack pointer inside main, call1 and call2 function.
+ gdb_breakpoint $call1_line
+ gdb_breakpoint $call2_line
+ set ssp_main [get_valueof /x "\$pl3_ssp" 0 "get value of ssp in main"]
+ gdb_continue_to_breakpoint "break call1" ".*break call1.*"
+ set ssp_call1 [get_valueof /x "\$pl3_ssp" 0 "get value of ssp in call1"]
+ gdb_continue_to_breakpoint "break call2" ".*break call2.*"
+ set ssp_call2 [get_valueof /x "\$pl3_ssp" 0 "get value of ssp in call2"]
+
+ with_test_prefix "test frame level update" {
+ gdb_test "up" "call1.*" "move to frame 1"
+ gdb_test "print /x \$pl3_ssp" "= $ssp_call1" "check pl3_ssp of frame 1"
+ gdb_test "up" "main.*" "move to frame 2"
+ gdb_test "print /x \$pl3_ssp" "= $ssp_main" "check pl3_ssp of frame 2"
+ gdb_test "frame 0" "call2.*" "move to frame 0"
+ gdb_test "print /x \$pl3_ssp" "= $ssp_call2" "check pl3_ssp of frame 0"
+ }
+
+ with_test_prefix "test return from current frame" {
+ gdb_test "return (int) 1" "#0.*call1.*" \
+ "Test shadow stack return from current frame" \
+ "Make.*return now\\? \\(y or n\\) " "y"
+
+ # Potential CET violations often only occur after resuming normal execution.
+ # Therefore, it is important to test normal program continuation after
+ # testing the return command.
+ gdb_continue_to_end
+ }
+
+ clean_restart ${::testfile}
+ if { ![runto_main] } {
+ return -1
+ }
+
+ with_test_prefix "test return from past frame" {
+ gdb_breakpoint $call2_line
+ gdb_continue_to_breakpoint "break call2" ".*break call2.*"
+
+ gdb_test "frame 1" ".*in call1.*"
+
+ gdb_test "return (int) 1" "#0.*main.*" \
+ "Test shadow stack return from past frame" \
+ "Make.*return now\\? \\(y or n\\) " "y"
+
+ # Potential CET violations often only occur after resuming normal execution.
+ # Therefore, it is important to test normal program continuation after
+ # testing the return command.
+ gdb_continue_to_end
+ }
+}
diff --git a/gdb/testsuite/gdb.arch/amd64-shadow-stack-corefile.c b/gdb/testsuite/gdb.arch/amd64-shadow-stack-corefile.c
new file mode 100644
index 0000000..5e84793
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-shadow-stack-corefile.c
@@ -0,0 +1,46 @@
+/* This test program is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+
+/* Call the return instruction before function epilogue to trigger a
+ control-flow exception. */
+void
+function ()
+{
+ unsigned long ssp;
+ #ifndef __ILP32__
+ asm volatile ("xor %0, %0; rdsspq %0" : "=r" (ssp));
+ #else
+ asm volatile ("xor %0, %0; rdsspd %0" : "=r" (ssp));
+ #endif
+
+ /* Print ssp to stdout so that the testcase can capture it. */
+ printf ("%p\n", (void *) ssp);
+ fflush (stdout);
+
+ /* Manually cause a control-flow exception by executing a return
+ instruction before function epilogue, so the address atop the stack
+ is not the return instruction. */
+ __asm__ volatile ("ret\n");
+}
+
+int
+main (void)
+{
+ function (); /* Break here. */
+}
diff --git a/gdb/testsuite/gdb.arch/amd64-shadow-stack-corefile.exp b/gdb/testsuite/gdb.arch/amd64-shadow-stack-corefile.exp
new file mode 100644
index 0000000..82d68da
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-shadow-stack-corefile.exp
@@ -0,0 +1,119 @@
+# Copyright 2024-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test the shadow stack pointer note in core dumps.
+# Based on the corefile tests in gdb.arch/aarch64-gcs-core.exp.
+
+require allow_ssp_tests
+
+standard_testfile
+
+# Make sure GDB can read the given core file correctly.
+
+proc check_core_file {core_filename saved_pl3_ssp} {
+ global decimal
+
+ # Load the core file.
+ if {[gdb_test "core $core_filename" \
+ [multi_line \
+ "Core was generated by .*\\." \
+ "Program terminated with signal SIGSEGV, Segmentation fault.*" \
+ "#0 function \\(\\) at .*amd64-shadow-stack-corefile.c:$decimal" \
+ "$decimal.*__asm__ volatile \\(\"ret\\\\n\"\\);"] \
+ "load core file"]} {
+ return
+ }
+
+ # Check the value of ssp in the core file.
+ gdb_test "print/x \$pl3_ssp" "\\$\[0-9\]+ = $saved_pl3_ssp" \
+ "pl3_ssp contents from core file $saved_pl3_ssp"
+}
+
+save_vars { ::env(GLIBC_TUNABLES) } {
+
+ append_environment GLIBC_TUNABLES "glibc.cpu.hwcaps" "SHSTK"
+
+ if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
+ {debug additional_flags="-fcf-protection=return"}] } {
+ return
+ }
+
+ set linespec ${srcfile}:[gdb_get_line_number "Break here"]
+
+ if {![runto $linespec]} {
+ return
+ }
+
+ # Obtain an OS-generated core file. Save test program output to
+ # ${binfile}.out.
+ set core_filename [core_find $binfile {} {} "${binfile}.out"]
+ set core_generated [expr {$core_filename != ""}]
+
+ if {!$core_generated} {
+ untested "unable to create or find corefile"
+ }
+
+ # Load the core file and check the value of the shadow stack pointer.
+ if {$core_generated} {
+ clean_restart $::testfile
+
+ with_test_prefix "OS corefile" {
+ # Read ssp value from saved output of the test program.
+ set out_id [open ${binfile}.out "r"]
+ set ssp_in_gcore [gets $out_id]
+ close $out_id
+ check_core_file $core_filename $ssp_in_gcore
+ }
+ }
+
+ if {![gcore_cmd_available]} {
+ unsupported "target does not support gcore command."
+ return
+ }
+
+ clean_restart $::testfile
+
+ if {![runto $linespec]} {
+ return
+ }
+
+ # Continue until a crash. The line with the hex number is optional because
+ # it's printed by the test program, and doesn't appear in the Expect buffer
+ # when testing a remote target.
+
+ gdb_test "continue" \
+ [multi_line \
+ "Continuing\\." \
+ "($hex\r\n)?" \
+ "Program received signal SIGSEGV, Segmentation fault.*" \
+ "function \\(\\) at .*amd64-shadow-stack-corefile.c:$decimal" \
+ {.*__asm__ volatile \("ret\\n"\);}] \
+ "continue to SIGSEGV"
+
+ set ssp_in_gcore [get_valueof "/x" "\$pl3_ssp" "*unknown*"]
+
+ # Generate the gcore core file.
+ set gcore_filename [standard_output_file "${testfile}.gcore"]
+ set gcore_generated [gdb_gcore_cmd "$gcore_filename" "generate gcore file"]
+
+ gdb_assert { $gcore_generated } "gcore corefile created"
+ if { $gcore_generated } {
+ clean_restart $::testfile
+
+ with_test_prefix "gcore corefile" {
+ check_core_file $gcore_filename $ssp_in_gcore
+ }
+ }
+}
diff --git a/gdb/testsuite/gdb.arch/amd64-shadow-stack-disp-step.exp b/gdb/testsuite/gdb.arch/amd64-shadow-stack-disp-step.exp
new file mode 100644
index 0000000..e4efa00
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-shadow-stack-disp-step.exp
@@ -0,0 +1,84 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test continue from call instructions with shadow stack and displaced
+# stepping being enabled.
+
+require allow_ssp_tests support_displaced_stepping
+
+standard_testfile amd64-shadow-stack.c
+
+save_vars { ::env(GLIBC_TUNABLES) } {
+
+ append_environment GLIBC_TUNABLES "glibc.cpu.hwcaps" "SHSTK"
+
+ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
+ additional_flags="-fcf-protection=return"] } {
+ return
+ }
+
+ # Enable displaced stepping.
+ gdb_test_no_output "set displaced-stepping on"
+ gdb_test "show displaced-stepping" ".* displaced stepping .* is on.*"
+
+ if { ![runto_main] } {
+ return
+ }
+
+ # Get the address of the call to the call1 function.
+ set call1_addr -1
+ gdb_test_multiple "disassemble main" "" {
+ -re -wrap "($hex) <\\+($decimal)>:\\s*call\\s*0x.*<call1>.*" {
+ set call1_addr $expect_out(1,string)
+ pass $gdb_test_name
+ }
+ }
+
+ if { $call1_addr == -1 } {
+ return
+ }
+
+ # Get the address of the call to the call2 function.
+ set call2_addr -1
+ gdb_test_multiple "disassemble call1" "" {
+ -re -wrap "($hex) <\\+($decimal)>:\\s*call\\s*0x.*<call2>.*" {
+ set call2_addr $expect_out(1,string)
+ pass $gdb_test_name
+ }
+ }
+
+ if { $call2_addr == -1 } {
+ return
+ }
+
+ gdb_test "break *$call1_addr" \
+ "Breakpoint $decimal at $hex.*" \
+ "break at the address of the call1 instruction"
+
+ gdb_test "break *$call2_addr" \
+ "Breakpoint $decimal at $hex.*" \
+ "break at the address of the call2 instruction"
+
+ gdb_test "continue" \
+ "Breakpoint $decimal, $call1_addr in main ().*" \
+ "continue until call1 instruction"
+
+ # Test continue from breakpoint at call1 and call2 instructions.
+ gdb_test "continue" \
+ "Breakpoint $decimal, $call2_addr in call1 ().*" \
+ "continue from call1 instruction"
+
+ gdb_continue_to_end "continue from call2 instruction"
+}
diff --git a/gdb/testsuite/gdb.arch/amd64-shadow-stack.c b/gdb/testsuite/gdb.arch/amd64-shadow-stack.c
new file mode 100644
index 0000000..4a1ca1e
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-shadow-stack.c
@@ -0,0 +1,40 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2024-2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+static int
+call2 ()
+{
+ return 42; /* break call2. */
+}
+
+static int
+call1 ()
+{
+ return call2 (); /* break call1. */
+}
+
+int
+main ()
+{
+ /* Depending on instruction generation we might end up in the call
+ instruction of call1 function after "runto_main". Avoid this by
+ adding a nop instruction, to simplify the testing in
+ amd64-shadow-stack-disp-step.exp. */
+ asm ("nop");
+ call1 (); /* break main. */
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.arch/amd64-shadow-stack.exp b/gdb/testsuite/gdb.arch/amd64-shadow-stack.exp
new file mode 100644
index 0000000..e9f6fa6
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-shadow-stack.exp
@@ -0,0 +1,71 @@
+# Copyright 2024-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test accessing the shadow stack pointer register.
+
+require allow_ssp_tests
+
+standard_testfile
+
+# Write PL3_SSP register with invalid shadow stack pointer value.
+proc write_invalid_ssp {} {
+ gdb_test "print /x \$pl3_ssp = 0x12345678" "= 0x12345678" "set pl3_ssp value"
+ gdb_test "print /x \$pl3_ssp" "= 0x12345678" "read pl3_ssp value after setting"
+}
+
+save_vars { ::env(GLIBC_TUNABLES) } {
+
+ append_environment GLIBC_TUNABLES "glibc.cpu.hwcaps" "SHSTK"
+
+ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
+ additional_flags="-fcf-protection=return"] } {
+ return
+ }
+
+ if {![runto_main]} {
+ return
+ }
+
+ with_test_prefix "invalid ssp" {
+ write_invalid_ssp
+
+ # Continue until SIGSEV to test that the value is written back to HW.
+ gdb_test "continue" \
+ [multi_line \
+ "Continuing\\." \
+ "" \
+ "Program received signal SIGSEGV, Segmentation fault\\." \
+ "$hex in main \\(\\)"] \
+ "continue to SIGSEGV"
+ }
+
+ clean_restart ${::testfile}
+ if { ![runto_main] } {
+ return
+ }
+
+ with_test_prefix "restore original ssp" {
+ # Read PL3_SSP register.
+ set ssp_main [get_hexadecimal_valueof "\$pl3_ssp" "read pl3_ssp value"]
+
+ write_invalid_ssp
+
+ # Restore original value.
+ gdb_test "print /x \$pl3_ssp = $ssp_main" "= $ssp_main" "restore original value"
+
+ # Now we should not see a SIGSEV, since the original value is restored.
+ gdb_continue_to_end
+ }
+}
diff --git a/gdb/testsuite/gdb.arch/amd64-stap-expressions.S b/gdb/testsuite/gdb.arch/amd64-stap-expressions.S
index 23bb4fe..5404841 100644
--- a/gdb/testsuite/gdb.arch/amd64-stap-expressions.S
+++ b/gdb/testsuite/gdb.arch/amd64-stap-expressions.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/amd64-stap-expressions.exp b/gdb/testsuite/gdb.arch/amd64-stap-expressions.exp
index e2af6cd..f14c938 100644
--- a/gdb/testsuite/gdb.arch/amd64-stap-expressions.exp
+++ b/gdb/testsuite/gdb.arch/amd64-stap-expressions.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S b/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S
index c338c85..4a867cd 100644
--- a/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S
+++ b/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.exp b/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.exp
index 2ab06c3..135790a 100644
--- a/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.exp
+++ b/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp b/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp
index d51af23..48d7b65 100644
--- a/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp
+++ b/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-stap-three-arg-disp.c b/gdb/testsuite/gdb.arch/amd64-stap-three-arg-disp.c
index 38cbc3f..3912370 100644
--- a/gdb/testsuite/gdb.arch/amd64-stap-three-arg-disp.c
+++ b/gdb/testsuite/gdb.arch/amd64-stap-three-arg-disp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/amd64-stap-triplet.S b/gdb/testsuite/gdb.arch/amd64-stap-triplet.S
index e5532b2..5fd18af 100644
--- a/gdb/testsuite/gdb.arch/amd64-stap-triplet.S
+++ b/gdb/testsuite/gdb.arch/amd64-stap-triplet.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/amd64-stap-triplet.c b/gdb/testsuite/gdb.arch/amd64-stap-triplet.c
index a96a2cb..d9898e2 100644
--- a/gdb/testsuite/gdb.arch/amd64-stap-triplet.c
+++ b/gdb/testsuite/gdb.arch/amd64-stap-triplet.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.S b/gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.S
index d1a3697..952a685 100644
--- a/gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.S
+++ b/gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.exp b/gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.exp
index 469b31b..43816f5 100644
--- a/gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.exp
+++ b/gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp
index 24d9945..5fbdf8b 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
set opts {}
standard_testfile amd64-tailcall-cxx1.S amd64-tailcall-cxx2.S
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.arch/amd64-tailcall-cxx.exp COMPILE=1"
standard_testfile amd64-tailcall-cxx1.cc amd64-tailcall-cxx2.cc
lappend opts debug
@@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} "${srcfile} ${srcfile2
return -1
}
-if ![runto g] {
+if {![runto g]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx1.S b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx1.S
index f4fec68..5efa0f3 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx1.S
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx1.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx1.cc b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx1.cc
index 869215d..17d5a68 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx1.cc
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx1.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx2.S b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx2.S
index ac1aaed..9cd5305 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx2.S
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx2.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx2.cc b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx2.cc
index 5bfd519..969056f 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx2.cc
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx2.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.S b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.S
index 373f16e..7e87c1a9 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.S
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.c b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.c
index 585cfb2..59c8721 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.c
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp
index 33461e5..12abf58 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
set opts {}
standard_testfile .S
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.arch/amd64-tailcall-noret.exp COMPILE=1"
standard_testfile
lappend opts debug optimize=-O2
@@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
return -1
}
-if ![runto noret] {
+if {![runto noret]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.S b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.S
index 3f2449d..97624f6 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.S
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.c b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.c
index d50894d..24a2cf1 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.c
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp
index f666e6a..e96b85b 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
set opts {}
standard_testfile .S .c
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.arch/amd64-tailcall-ret.exp COMPILE=1"
standard_testfile .c .c
lappend opts debug optimize=-O2
@@ -25,7 +25,7 @@ if [info exists COMPILE] {
}
# Make .c available on the host.
-if [is_remote host] {
+if {[is_remote host]} {
gdb_remote_download host $srcdir/$subdir/$srcfile2
}
@@ -33,7 +33,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-self.S b/gdb/testsuite/gdb.arch/amd64-tailcall-self.S
index 26afb76..24f4e64 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-self.S
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-self.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-self.c b/gdb/testsuite/gdb.arch/amd64-tailcall-self.c
index f184389..4bb692f 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-self.c
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-self.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp
index 18f37ab..e5f47eb 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {}] } {
return -1
}
-if ![runto b] {
+if {![runto b]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/amd64-watchpoint-downgrade.c b/gdb/testsuite/gdb.arch/amd64-watchpoint-downgrade.c
index 1140117..3707669 100644
--- a/gdb/testsuite/gdb.arch/amd64-watchpoint-downgrade.c
+++ b/gdb/testsuite/gdb.arch/amd64-watchpoint-downgrade.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/amd64-watchpoint-downgrade.exp b/gdb/testsuite/gdb.arch/amd64-watchpoint-downgrade.exp
index a8ebadb..5663b0d 100644
--- a/gdb/testsuite/gdb.arch/amd64-watchpoint-downgrade.exp
+++ b/gdb/testsuite/gdb.arch/amd64-watchpoint-downgrade.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@ gdb_test "starti" \
[multi_line \
"warning: watchpoint $num downgraded to software watchpoint" \
"" \
- "Program stopped\\." \
+ "(Program|Thread \[^\r\n\]) stopped\\." \
".*"]
# Watchpoint should now have downgraded to a s/w watchpoint.
diff --git a/gdb/testsuite/gdb.arch/amd64-word.exp b/gdb/testsuite/gdb.arch/amd64-word.exp
index 3b47147..8a6b28d 100644
--- a/gdb/testsuite/gdb.arch/amd64-word.exp
+++ b/gdb/testsuite/gdb.arch/amd64-word.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list
return
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.arch/arc-analyze-prologue.S b/gdb/testsuite/gdb.arch/arc-analyze-prologue.S
index 969950f..21faf09 100644
--- a/gdb/testsuite/gdb.arch/arc-analyze-prologue.S
+++ b/gdb/testsuite/gdb.arch/arc-analyze-prologue.S
@@ -1,6 +1,6 @@
; This testcase is part of GDB, the GNU debugger.
-; Copyright 2017-2024 Free Software Foundation, Inc.
+; Copyright 2017-2025 Free Software Foundation, Inc.
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp b/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp
index b8d9a8f..dc1149c 100644
--- a/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp
+++ b/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile $options] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
@@ -85,7 +85,7 @@ proc prologue_test {funcname {savedregs ""} {fp_offset ""} } {
}
if { $fp_offset != "" } {
set sp [get_integer_valueof \$sp -1 "get value of sp in $funcname"]
- set fp_val [expr $sp + $fp_offset]
+ set fp_val [expr {$sp + $fp_offset}]
set fp_real_val \
[get_integer_valueof \$fp 0 "get value of fp in $funcname"]
if { $fp_real_val != $fp_val } {
diff --git a/gdb/testsuite/gdb.arch/arc-dbnz.S b/gdb/testsuite/gdb.arch/arc-dbnz.S
index 45e1dfe..142c52f 100644
--- a/gdb/testsuite/gdb.arch/arc-dbnz.S
+++ b/gdb/testsuite/gdb.arch/arc-dbnz.S
@@ -1,6 +1,6 @@
; This testcase is part of GDB, the GNU debugger.
-; Copyright 2024 Free Software Foundation, Inc.
+; Copyright 2024-2025 Free Software Foundation, Inc.
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/arc-dbnz.exp b/gdb/testsuite/gdb.arch/arc-dbnz.exp
index f1fce0e..7f76aa2 100644
--- a/gdb/testsuite/gdb.arch/arc-dbnz.exp
+++ b/gdb/testsuite/gdb.arch/arc-dbnz.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.arch/arc-decode-insn.S b/gdb/testsuite/gdb.arch/arc-decode-insn.S
index 6b37d54..512f37a 100644
--- a/gdb/testsuite/gdb.arch/arc-decode-insn.S
+++ b/gdb/testsuite/gdb.arch/arc-decode-insn.S
@@ -1,6 +1,6 @@
; This testcase is part of GDB, the GNU debugger.
-; Copyright 2017-2024 Free Software Foundation, Inc.
+; Copyright 2017-2025 Free Software Foundation, Inc.
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/arc-decode-insn.exp b/gdb/testsuite/gdb.arch/arc-decode-insn.exp
index a0ae43f..01b23eb 100644
--- a/gdb/testsuite/gdb.arch/arc-decode-insn.exp
+++ b/gdb/testsuite/gdb.arch/arc-decode-insn.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,7 +39,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
@@ -53,7 +53,7 @@ proc test_branch_insn { test_name } {
# Calculate instruction length, based on ${test_name}_end symbol.
set end_pc [get_hexadecimal_valueof &${test_name}_end -1]
- set length [expr $end_pc - $pc]
+ set length [expr {$end_pc - $pc}]
set target_address [get_hexadecimal_valueof &${test_name}_target -1]
diff --git a/gdb/testsuite/gdb.arch/arc-disassembler-options.exp b/gdb/testsuite/gdb.arch/arc-disassembler-options.exp
index 3a4c523..5b3527c 100644
--- a/gdb/testsuite/gdb.arch/arc-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/arc-disassembler-options.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/arc-disassembler-options.s b/gdb/testsuite/gdb.arch/arc-disassembler-options.s
index 46f93e4..11ce0bd 100644
--- a/gdb/testsuite/gdb.arch/arc-disassembler-options.s
+++ b/gdb/testsuite/gdb.arch/arc-disassembler-options.s
@@ -1,6 +1,6 @@
# This test is part of GDB, the GNU debugger.
#
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/arc-tdesc-cpu.exp b/gdb/testsuite/gdb.arch/arc-tdesc-cpu.exp
index 5ff5138..35b74c8 100644
--- a/gdb/testsuite/gdb.arch/arc-tdesc-cpu.exp
+++ b/gdb/testsuite/gdb.arch/arc-tdesc-cpu.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/arc-tdesc-cpu.xml b/gdb/testsuite/gdb.arch/arc-tdesc-cpu.xml
index 5f99873..d28ca05 100644
--- a/gdb/testsuite/gdb.arch/arc-tdesc-cpu.xml
+++ b/gdb/testsuite/gdb.arch/arc-tdesc-cpu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2017-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/testsuite/gdb.arch/arm-bl-branch-dest.c b/gdb/testsuite/gdb.arch/arm-bl-branch-dest.c
index 4927a75..d56c194 100644
--- a/gdb/testsuite/gdb.arch/arm-bl-branch-dest.c
+++ b/gdb/testsuite/gdb.arch/arm-bl-branch-dest.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/arm-bl-branch-dest.exp b/gdb/testsuite/gdb.arch/arm-bl-branch-dest.exp
index f7621bb..051322d 100644
--- a/gdb/testsuite/gdb.arch/arm-bl-branch-dest.exp
+++ b/gdb/testsuite/gdb.arch/arm-bl-branch-dest.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.c b/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.c
index d26721c..45dc78c 100644
--- a/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.c
+++ b/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp b/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp
index e73fcc5..d01f817 100644
--- a/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp
+++ b/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile ]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/arm-disassembler-options.exp b/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
index d605bcb..d20b2a8 100644
--- a/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/arm-disp-step.S b/gdb/testsuite/gdb.arch/arm-disp-step.S
index 1a145cc..bb21d3e 100644
--- a/gdb/testsuite/gdb.arch/arm-disp-step.S
+++ b/gdb/testsuite/gdb.arch/arm-disp-step.S
@@ -1,4 +1,4 @@
-/* Copyright 2010-2024 Free Software Foundation, Inc.
+/* Copyright 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/arm-disp-step.exp b/gdb/testsuite/gdb.arch/arm-disp-step.exp
index 4319deb..a6214ef 100644
--- a/gdb/testsuite/gdb.arch/arm-disp-step.exp
+++ b/gdb/testsuite/gdb.arch/arm-disp-step.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/arm-neon.c b/gdb/testsuite/gdb.arch/arm-neon.c
index a8aa537..43f511a 100644
--- a/gdb/testsuite/gdb.arch/arm-neon.c
+++ b/gdb/testsuite/gdb.arch/arm-neon.c
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/arm-neon.exp b/gdb/testsuite/gdb.arch/arm-neon.exp
index cc95877..b29b9ca 100644
--- a/gdb/testsuite/gdb.arch/arm-neon.exp
+++ b/gdb/testsuite/gdb.arch/arm-neon.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug quie
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/arm-pseudo-unwind-asm.S b/gdb/testsuite/gdb.arch/arm-pseudo-unwind-asm.S
index 46cde89..92a4813 100644
--- a/gdb/testsuite/gdb.arch/arm-pseudo-unwind-asm.S
+++ b/gdb/testsuite/gdb.arch/arm-pseudo-unwind-asm.S
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy-asm.S b/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy-asm.S
index f6b9b4e..ec08069 100644
--- a/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy-asm.S
+++ b/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy-asm.S
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.c b/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.c
index adda4b8..e167a6e 100644
--- a/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.c
+++ b/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.c
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.exp b/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.exp
index bfedff2..9cbf71d 100644
--- a/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.exp
+++ b/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-clean_restart ${binfile}
+clean_restart $testfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.arch/arm-pseudo-unwind.c b/gdb/testsuite/gdb.arch/arm-pseudo-unwind.c
index adda4b8..e167a6e 100644
--- a/gdb/testsuite/gdb.arch/arm-pseudo-unwind.c
+++ b/gdb/testsuite/gdb.arch/arm-pseudo-unwind.c
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/arm-pseudo-unwind.exp b/gdb/testsuite/gdb.arch/arm-pseudo-unwind.exp
index 004c606..4cbb12e 100644
--- a/gdb/testsuite/gdb.arch/arm-pseudo-unwind.exp
+++ b/gdb/testsuite/gdb.arch/arm-pseudo-unwind.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-clean_restart ${binfile}
+clean_restart $testfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.c b/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.c
index 318c785..14c71e0 100644
--- a/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.c
+++ b/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp b/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp
index de061da..32f085a 100644
--- a/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp
+++ b/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ if { [build_executable "failed to prepare" ${testfile} ${srcfile} \
save_vars { GDBFLAGS } {
append GDBFLAGS " --readnever"
- if { [clean_restart ${binfile}] == -1 } {
+ if { [clean_restart $testfile] == -1 } {
return -1
}
}
diff --git a/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.c b/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.c
index 9b5e137..4847d42 100644
--- a/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.c
+++ b/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.exp b/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.exp
index 788bc86..e5246eb 100644
--- a/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.exp
+++ b/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/avr-flash-qualifier.c b/gdb/testsuite/gdb.arch/avr-flash-qualifier.c
index d1ce4ab..d65db61 100644
--- a/gdb/testsuite/gdb.arch/avr-flash-qualifier.c
+++ b/gdb/testsuite/gdb.arch/avr-flash-qualifier.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp b/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp
index e392df3..ea58543 100644
--- a/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp
+++ b/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
-if ![runto [gdb_get_line_number "break here."]] {
+if {![runto [gdb_get_line_number "break here."]]} {
untested "could not run to \"break here.\""
return -1
}
diff --git a/gdb/testsuite/gdb.arch/core-file-pid0.exp b/gdb/testsuite/gdb.arch/core-file-pid0.exp
index b95f1e3..a172555 100644
--- a/gdb/testsuite/gdb.arch/core-file-pid0.exp
+++ b/gdb/testsuite/gdb.arch/core-file-pid0.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp b/gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp
index 70cf81d..6a08f70 100644
--- a/gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp
+++ b/gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -21,12 +21,12 @@ require support_displaced_stepping
# Some targets have leading underscores on assembly symbols.
set additional_flags [gdb_target_symbol_prefix_flags]
-if [prepare_for_testing "failed to prepare" $executable $srcfile \
- [list debug $additional_flags]] {
+if {[prepare_for_testing "failed to prepare" $executable $srcfile \
+ [list debug $additional_flags]]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/e500-abi.exp b/gdb/testsuite/gdb.arch/e500-abi.exp
index b2abb59..388838a 100644
--- a/gdb/testsuite/gdb.arch/e500-abi.exp
+++ b/gdb/testsuite/gdb.arch/e500-abi.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/e500-prologue.c b/gdb/testsuite/gdb.arch/e500-prologue.c
index c4b2767..b7712c4 100644
--- a/gdb/testsuite/gdb.arch/e500-prologue.c
+++ b/gdb/testsuite/gdb.arch/e500-prologue.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/e500-prologue.exp b/gdb/testsuite/gdb.arch/e500-prologue.exp
index 7732393..b468e71 100644
--- a/gdb/testsuite/gdb.arch/e500-prologue.exp
+++ b/gdb/testsuite/gdb.arch/e500-prologue.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] !
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
# Insert a breakpoint in FUNCTION and verifies that the breakpoint was
# inserted at the expected location. EXPECTED_LOCATION should be an
@@ -36,7 +37,7 @@ proc insert_breakpoint {function expected_location} {
global gdb_prompt
global expect_out
global hex
-
+
set address ""
# Insert a breakpoint using the given function name, and extract
diff --git a/gdb/testsuite/gdb.arch/e500-regs.exp b/gdb/testsuite/gdb.arch/e500-regs.exp
index a22ec31..fa10b4f 100644
--- a/gdb/testsuite/gdb.arch/e500-regs.exp
+++ b/gdb/testsuite/gdb.arch/e500-regs.exp
@@ -1,5 +1,5 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
-#
+# Copyright 2003-2025 Free Software Foundation, Inc.
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -136,7 +136,8 @@ gdb_expect_list "info vector" ".*$gdb_prompt $" {
# We must restart everything, because we have set important registers to
# some unusual values.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return 0
}
@@ -154,11 +155,11 @@ gdb_test "continue" \
"Breakpoint 2, vector_fun .a=.-2, -2., b=.1, 1.*e500-regs.c.*ev_create_s32 .2, 2.;" \
"continue to vector_fun"
-# Do a next over the assignment to vector 'a'.
+# Do a next over the assignment to vector 'a'.
gdb_test "next" ".*b = \\(vector int\\) __ev_create_s32 \\(3, 3\\);" \
"next (1)"
-# Do a next over the assignment to vector 'b'.
+# Do a next over the assignment to vector 'b'.
gdb_test "next" "c = __ev_and \\(a, b\\);" \
"next (2)"
diff --git a/gdb/testsuite/gdb.arch/ftrace-insn-reloc.exp b/gdb/testsuite/gdb.arch/ftrace-insn-reloc.exp
index 4ea86b4..d8b94f2 100644
--- a/gdb/testsuite/gdb.arch/ftrace-insn-reloc.exp
+++ b/gdb/testsuite/gdb.arch/ftrace-insn-reloc.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -19,16 +19,16 @@ standard_testfile insn-reloc.c
# Some targets have leading underscores on assembly symbols.
set additional_flags [gdb_target_symbol_prefix_flags]
-if [prepare_for_testing "failed to prepare" $testfile-no-ipa $srcfile \
- [list debug $additional_flags]] {
+if {[prepare_for_testing "failed to prepare" $testfile-no-ipa $srcfile \
+ [list debug $additional_flags]]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
@@ -48,7 +48,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
clean_restart $testfile
set remote_libipa [gdb_load_shlib $libipa]
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.arch/gdb1291.exp b/gdb/testsuite/gdb.arch/gdb1291.exp
index 183c7c7..9f460c8 100644
--- a/gdb/testsuite/gdb.arch/gdb1291.exp
+++ b/gdb/testsuite/gdb.arch/gdb1291.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ""] !
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
#
# Run to `main' where we begin our tests.
diff --git a/gdb/testsuite/gdb.arch/gdb1291.s b/gdb/testsuite/gdb.arch/gdb1291.s
index a359191..f83db0f 100644
--- a/gdb/testsuite/gdb.arch/gdb1291.s
+++ b/gdb/testsuite/gdb.arch/gdb1291.s
@@ -1,4 +1,4 @@
-! Copyright 2004-2024 Free Software Foundation, Inc.
+! Copyright 2004-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/gdb1431.exp b/gdb/testsuite/gdb.arch/gdb1431.exp
index cbb34e8..bc65d26 100644
--- a/gdb/testsuite/gdb.arch/gdb1431.exp
+++ b/gdb/testsuite/gdb.arch/gdb1431.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ""] !
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
#
# Run to `main' where we begin our tests.
diff --git a/gdb/testsuite/gdb.arch/gdb1431.s b/gdb/testsuite/gdb.arch/gdb1431.s
index 0628639..10482dc 100644
--- a/gdb/testsuite/gdb.arch/gdb1431.s
+++ b/gdb/testsuite/gdb.arch/gdb1431.s
@@ -1,4 +1,4 @@
-! Copyright 2004-2024 Free Software Foundation, Inc.
+! Copyright 2004-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/gdb1558.c b/gdb/testsuite/gdb.arch/gdb1558.c
index 3735acb..063b861 100644
--- a/gdb/testsuite/gdb.arch/gdb1558.c
+++ b/gdb/testsuite/gdb.arch/gdb1558.c
@@ -1,4 +1,4 @@
-/* Copyright 2004-2024 Free Software Foundation, Inc.
+/* Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/gdb1558.exp b/gdb/testsuite/gdb.arch/gdb1558.exp
index 8ba9476..3de5723 100644
--- a/gdb/testsuite/gdb.arch/gdb1558.exp
+++ b/gdb/testsuite/gdb.arch/gdb1558.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {"add
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
gdb_test "b -q main" "Breakpoint 1.*" "set breakpoint at main"
gdb_test "b -q sub1" "Breakpoint 2.*" "set breakpoint at sub1"
diff --git a/gdb/testsuite/gdb.arch/i386-attach-see-vdso.c b/gdb/testsuite/gdb.arch/i386-attach-see-vdso.c
index 2eee4c4..cc8298e 100644
--- a/gdb/testsuite/gdb.arch/i386-attach-see-vdso.c
+++ b/gdb/testsuite/gdb.arch/i386-attach-see-vdso.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/i386-attach-see-vdso.exp b/gdb/testsuite/gdb.arch/i386-attach-see-vdso.exp
index dc75774..755e329 100644
--- a/gdb/testsuite/gdb.arch/i386-attach-see-vdso.exp
+++ b/gdb/testsuite/gdb.arch/i386-attach-see-vdso.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/i386-avx.c b/gdb/testsuite/gdb.arch/i386-avx.c
index c9d7575..b3eb4bd 100644
--- a/gdb/testsuite/gdb.arch/i386-avx.c
+++ b/gdb/testsuite/gdb.arch/i386-avx.c
@@ -1,6 +1,6 @@
/* Test program for AVX registers.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/i386-avx.exp b/gdb/testsuite/gdb.arch/i386-avx.exp
index 8523c8b..3a1d8e8 100644
--- a/gdb/testsuite/gdb.arch/i386-avx.exp
+++ b/gdb/testsuite/gdb.arch/i386-avx.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
return
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return 0
@@ -53,7 +53,7 @@ gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
"set first breakpoint in main"
gdb_continue_to_breakpoint "continue to first breakpoint in main"
-if [is_amd64_regs_target] {
+if {[is_amd64_regs_target]} {
set nr_regs 16
} else {
set nr_regs 8
@@ -79,7 +79,7 @@ gdb_continue_to_breakpoint "continue to second breakpoint in main"
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "print data\[$r\]" \
- ".. = \\{f = \\{[expr $r + 10], $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}\\}.*" \
+ ".. = \\{f = \\{[expr {$r + 10}], $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}\\}.*" \
"check contents of data\[$r\]"
}
@@ -93,7 +93,7 @@ with_test_prefix "force-disable xml descriptions" {
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"set remote target-features-packet off\""
- clean_restart ${binfile}
+ clean_restart ${::testfile}
}
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.arch/i386-avx512.c b/gdb/testsuite/gdb.arch/i386-avx512.c
index 19b79a0..1f4ab63 100644
--- a/gdb/testsuite/gdb.arch/i386-avx512.c
+++ b/gdb/testsuite/gdb.arch/i386-avx512.c
@@ -1,6 +1,6 @@
/* Test program for AVX 512 registers.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/i386-avx512.exp b/gdb/testsuite/gdb.arch/i386-avx512.exp
index 45c7223..675a3c7 100644
--- a/gdb/testsuite/gdb.arch/i386-avx512.exp
+++ b/gdb/testsuite/gdb.arch/i386-avx512.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -78,7 +78,7 @@ gdb_continue_to_breakpoint "continue to second breakpoint in main"
set nr_regs 7
for { set r 0 } { $r < $nr_regs } { incr r } {
- set val [expr $r + 1]
+ set val [expr {$r + 1}]
gdb_test "print/x k_data\[$r\]" \
".. = 0x$val$val$val$val" \
"check contents of k_data\[$r\]"
@@ -89,7 +89,7 @@ gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
"set third breakpoint in main"
gdb_continue_to_breakpoint "continue to third breakpoint in main"
-if [is_amd64_regs_target] {
+if {[is_amd64_regs_target]} {
set nr_regs 32
} else {
set nr_regs 8
@@ -134,7 +134,7 @@ gdb_continue_to_breakpoint "continue to fourth breakpoint in main"
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "print zmm_data\[$r\]" \
- ".. = \\{f = \\{[expr $r + 10], [expr $r.125 + 10], [expr $r.25 + 10], [expr $r.375 + 10], [expr $r.5 + 10], [expr $r.625 + 10], [expr $r.75 + 10], [expr $r.875 + 10]\\}\\}.*" \
+ ".. = \\{f = \\{[expr {$r + 10}], [expr {$r + 10.125}], [expr {$r + 10.25}], [expr {$r + 10.375}], [expr {$r + 10.5}], [expr {$r + 10.625}], [expr {$r +10.75}], [expr {$r + 10.875}]\\}\\}.*" \
"check contents of zmm_data\[$r\] after writing ZMM regs"
}
@@ -152,7 +152,7 @@ gdb_continue_to_breakpoint "continue to fifth breakpoint in main"
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "print zmm_data\[$r\]" \
- ".. = \\{f = \\{[expr $r + 20], [expr $r.125 + 20], [expr $r.25 + 20], [expr $r.375 + 20], [expr $r.5 + 10], [expr $r.625 + 10], [expr $r.75 + 10], [expr $r.875 + 10]\\}\\}.*" \
+ ".. = \\{f = \\{[expr {$r + 20}], [expr {$r + 20.125}], [expr {$r + 20.25}], [expr {$r + 20.375}], [expr {$r + 10.5}], [expr {$r + 10.625}], [expr {$r + 10.75}], [expr {$r + 10.875}]\\}\\}.*" \
"check contents of zmm_data\[$r\] after writing YMM regs"
}
@@ -168,7 +168,7 @@ gdb_continue_to_breakpoint "continue to sixth breakpoint in main"
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "print zmm_data\[$r\]" \
- ".. = \\{f = \\{[expr $r + 30], [expr $r.125 + 30], [expr $r.25 + 20], [expr $r.375 + 20], [expr $r.5 + 10], [expr $r.625 + 10], [expr $r.75 + 10], [expr $r.875 + 10]\\}\\}.*" \
+ ".. = \\{f = \\{[expr {$r + 30}], [expr {$r + 30.125}], [expr {$r + 20.25}], [expr {$r + 20.375}], [expr {$r + 10.5}], [expr {$r + 10.625}], [expr {$r + 10.75}], [expr {$r + 10.875}]\\}\\}.*" \
"check contents of zmm_data\[$r\] after writing XMM regs"
}
diff --git a/gdb/testsuite/gdb.arch/i386-biarch-core.exp b/gdb/testsuite/gdb.arch/i386-biarch-core.exp
index 14de337..c04b87d 100644
--- a/gdb/testsuite/gdb.arch/i386-biarch-core.exp
+++ b/gdb/testsuite/gdb.arch/i386-biarch-core.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -54,7 +54,7 @@ set corefile [gdb_remote_download host $corefile]
# First check if this particular GDB supports i386, otherwise we should not
# expect the i386 core file to be loaded successfully.
set archs [get_set_option_choices "set architecture" "i386"]
-set supports_arch_i386 [expr [lsearch -exact $archs i386] != -1]
+set supports_arch_i386 [expr {[lsearch -exact $archs i386] != -1}]
# Wrongly built GDB complains by:
# "..." is not a core dump: File format not recognized
diff --git a/gdb/testsuite/gdb.arch/i386-bp_permanent.c b/gdb/testsuite/gdb.arch/i386-bp_permanent.c
index 1489712..c347152 100644
--- a/gdb/testsuite/gdb.arch/i386-bp_permanent.c
+++ b/gdb/testsuite/gdb.arch/i386-bp_permanent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/i386-bp_permanent.exp b/gdb/testsuite/gdb.arch/i386-bp_permanent.exp
index 64c1e0f..6eb9ee6 100644
--- a/gdb/testsuite/gdb.arch/i386-bp_permanent.exp
+++ b/gdb/testsuite/gdb.arch/i386-bp_permanent.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list
}
-clean_restart $binfile
+clean_restart $::testfile
#
# Run to `main' where we begin our tests.
diff --git a/gdb/testsuite/gdb.arch/i386-byte.exp b/gdb/testsuite/gdb.arch/i386-byte.exp
index 20515fd..12b57f3 100644
--- a/gdb/testsuite/gdb.arch/i386-byte.exp
+++ b/gdb/testsuite/gdb.arch/i386-byte.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list
return
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return 0
@@ -51,7 +51,7 @@ with_test_prefix "at first bp" {
gdb_test "print/x \$$byte_regs($r)" \
".. = 0x[format %x $r]1" \
"check contents of %$byte_regs($r)"
- set h [expr $r + 4]
+ set h [expr {$r + 4}]
gdb_test "print/x \$$byte_regs($h)" \
".. = 0x[format %x $r]2" \
"check contents of %$byte_regs($h)"
@@ -59,7 +59,7 @@ with_test_prefix "at first bp" {
for { set r 1 } { $r <= 4 } { incr r } {
gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
- set h [expr $r + 4]
+ set h [expr {$r + 4}]
gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
}
}
@@ -72,7 +72,7 @@ with_test_prefix "at second bp" {
gdb_test "print \$$byte_regs($r)" \
".. = $r" \
"check contents of %$byte_regs($r)"
- set h [expr $r + 4]
+ set h [expr {$r + 4}]
gdb_test "print \$$byte_regs($h)" \
".. = $h" \
"check contents of %$byte_regs($h)"
diff --git a/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.S b/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.S
index d6f5fbf..a04a0c5 100644
--- a/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.S
+++ b/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.S
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.exp b/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.exp
index 18422ab..661265b 100644
--- a/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.exp
+++ b/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,11 +21,11 @@ require is_x86_like_target
set testfile "i386-cfi-notcurrent"
set srcfile ${testfile}.S
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {nodebug}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {nodebug}]} {
return -1
}
-if ![runto f] {
+if {![runto f]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c b/gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c
index fbbfad1..0fb2904 100644
--- a/gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c
+++ b/gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -16,9 +16,27 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
+#include <stdlib.h>
+
+extern void test_call (void);
+
+void
+unreachable (void)
+{
+ abort ();
+}
void
setup_alarm (void)
{
alarm (300);
}
+
+int
+main ()
+{
+ setup_alarm ();
+ test_call ();
+ unreachable ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.S b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.S
index e195c1c..20a8eb7 100644
--- a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.S
+++ b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.S
@@ -1,4 +1,4 @@
-/* Copyright 2009-2024 Free Software Foundation, Inc.
+/* Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,33 +18,12 @@
handling. */
.text
-
- .global main
-main:
- nop
-
- call setup_alarm
-
- nop
-
-/***********************************************/
-
-/* test call/ret */
-
.global test_call
test_call:
call test_call
- nop
+ call unreachable
.global test_ret_end
test_ret_end:
nop
-/***********************************************/
-
-/* all done */
-
-done:
- pushl $0
- call exit
- hlt
.section .note.GNU-stack,"",@progbits
diff --git a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp
index 5de7ebc..1d4c87e 100644
--- a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp
+++ b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -59,7 +59,7 @@ gdb_test_multiple "x/2i \$pc" "get address of next insn" {
}
# Clear the slot on the stack and confirm it was set to zero.
-set sp [expr $sp - 0x4]
+set sp [expr {$sp - 0x4}]
gdb_test_no_output "set {unsigned int} $sp = 0" \
"clear stack slot"
set zero_val 0x[format %08x 0]
@@ -73,7 +73,7 @@ gdb_test "stepi" \
# Check stack pointer was updated to the expected value.
set new_sp [get_hexadecimal_valueof "\$sp" "*UNKNOWN*" \
"get stack pointer after step"]
-gdb_assert {[expr $sp == $new_sp]} \
+gdb_assert {[expr {$sp == $new_sp}]} \
"check stack pointer was updated as expected"
# Check the contents of the stack were updated to the expected value.
diff --git a/gdb/testsuite/gdb.arch/i386-disp-step.S b/gdb/testsuite/gdb.arch/i386-disp-step.S
index 1171f27..bf93523 100644
--- a/gdb/testsuite/gdb.arch/i386-disp-step.S
+++ b/gdb/testsuite/gdb.arch/i386-disp-step.S
@@ -1,4 +1,4 @@
-/* Copyright 2009-2024 Free Software Foundation, Inc.
+/* Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/i386-disp-step.exp b/gdb/testsuite/gdb.arch/i386-disp-step.exp
index ee26cc2..43b8722 100644
--- a/gdb/testsuite/gdb.arch/i386-disp-step.exp
+++ b/gdb/testsuite/gdb.arch/i386-disp-step.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/i386-dr3-watch.c b/gdb/testsuite/gdb.arch/i386-dr3-watch.c
index 1004403..0ae0fdf 100644
--- a/gdb/testsuite/gdb.arch/i386-dr3-watch.c
+++ b/gdb/testsuite/gdb.arch/i386-dr3-watch.c
@@ -1,4 +1,4 @@
-/* Copyright 2011-2024 Free Software Foundation, Inc.
+/* Copyright 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/i386-dr3-watch.exp b/gdb/testsuite/gdb.arch/i386-dr3-watch.exp
index 84b3806..16d2872 100644
--- a/gdb/testsuite/gdb.arch/i386-dr3-watch.exp
+++ b/gdb/testsuite/gdb.arch/i386-dr3-watch.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ require {is_any_target "i?86-*-*" "x86_64-*-*"}
standard_testfile
-if [prepare_for_testing "failed to prepare" ${binfile} ${srcfile} {debug $additional_flags}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug $additional_flags}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/i386-float.S b/gdb/testsuite/gdb.arch/i386-float.S
index 3a9386b..18a9437 100644
--- a/gdb/testsuite/gdb.arch/i386-float.S
+++ b/gdb/testsuite/gdb.arch/i386-float.S
@@ -1,4 +1,4 @@
-/* Copyright 2009-2024 Free Software Foundation, Inc.
+/* Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/i386-float.exp b/gdb/testsuite/gdb.arch/i386-float.exp
index a9710a8..e86386e 100644
--- a/gdb/testsuite/gdb.arch/i386-float.exp
+++ b/gdb/testsuite/gdb.arch/i386-float.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/i386-gnu-cfi-asm.S b/gdb/testsuite/gdb.arch/i386-gnu-cfi-asm.S
index c750c15..f628f82 100644
--- a/gdb/testsuite/gdb.arch/i386-gnu-cfi-asm.S
+++ b/gdb/testsuite/gdb.arch/i386-gnu-cfi-asm.S
@@ -1,4 +1,4 @@
-/* Copyright 2007-2024 Free Software Foundation, Inc.
+/* Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/i386-gnu-cfi.c b/gdb/testsuite/gdb.arch/i386-gnu-cfi.c
index 57fc5ca..382a43c 100644
--- a/gdb/testsuite/gdb.arch/i386-gnu-cfi.c
+++ b/gdb/testsuite/gdb.arch/i386-gnu-cfi.c
@@ -1,6 +1,6 @@
/* Unwinding of DW_CFA_GNU_negative_offset_extended test program.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/i386-gnu-cfi.exp b/gdb/testsuite/gdb.arch/i386-gnu-cfi.exp
index 5bcac7c..c446fae 100644
--- a/gdb/testsuite/gdb.arch/i386-gnu-cfi.exp
+++ b/gdb/testsuite/gdb.arch/i386-gnu-cfi.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfilec} ${srcdir}/${subdir}/${srcfile
# Get things started.
-clean_restart $binfile
+clean_restart $::testfile
# We should stop in abort(3).
diff --git a/gdb/testsuite/gdb.arch/i386-permbkpt.S b/gdb/testsuite/gdb.arch/i386-permbkpt.S
index 7f0876f..e219687 100644
--- a/gdb/testsuite/gdb.arch/i386-permbkpt.S
+++ b/gdb/testsuite/gdb.arch/i386-permbkpt.S
@@ -1,4 +1,4 @@
-/* Copyright 2009-2024 Free Software Foundation, Inc.
+/* Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/i386-permbkpt.exp b/gdb/testsuite/gdb.arch/i386-permbkpt.exp
index 6f136b3..1118cb4 100644
--- a/gdb/testsuite/gdb.arch/i386-permbkpt.exp
+++ b/gdb/testsuite/gdb.arch/i386-permbkpt.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test "break -q main" "" "first permanent break"
gdb_test "break -q main" "" "second permanent break"
diff --git a/gdb/testsuite/gdb.arch/i386-pkru.c b/gdb/testsuite/gdb.arch/i386-pkru.c
index 8ef9c7c..e2dae98 100644
--- a/gdb/testsuite/gdb.arch/i386-pkru.c
+++ b/gdb/testsuite/gdb.arch/i386-pkru.c
@@ -1,6 +1,6 @@
/* Test program for PKEYS registers.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/i386-pkru.exp b/gdb/testsuite/gdb.arch/i386-pkru.exp
index a8a36b7..6355c43 100644
--- a/gdb/testsuite/gdb.arch/i386-pkru.exp
+++ b/gdb/testsuite/gdb.arch/i386-pkru.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -63,8 +63,8 @@ set v [linux_kernel_version]
if { $v != {} } {
set have_xfail \
[expr \
- [version_compare [list 5 14 0] <= $v] \
- && [version_compare $v < [list 6 2 0]]]
+ {[version_compare [list 5 14 0] <= $v] \
+ && [version_compare $v < [list 6 2 0]]}]
}
# Test pkru register at startup
diff --git a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection-stackalign.c b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection-stackalign.c
new file mode 100644
index 0000000..f55cee5
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection-stackalign.c
@@ -0,0 +1,27 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <alloca.h>
+
+int
+main (int argc, char **argv)
+{
+ volatile __attribute__ ((__aligned__ (64))) int a;
+ volatile char *p = (char *) alloca (argc * 12);
+ p[2] = 'b';
+ return 1;
+}
diff --git a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.c b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.c
index 84192a5..b47cc38 100644
--- a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.c
+++ b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp
index 05eb027..ac2be79 100644
--- a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp
+++ b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,41 +19,65 @@
# This option places an `endbr32`/`endbr64` instruction at the start of
# all functions, which can interfere with prologue analysis.
-standard_testfile .c
-set binfile ${binfile}
+standard_testfile .c -stackalign.c
require {is_any_target x86_64-*-* i?86-*-*}
-
require supports_fcf_protection
-set opts {debug additional_flags=-fcf-protection=full}
+# Tests if breakpoint set on main is placed past main's entry.
+proc test_run {} {
+ # Get start address of function main.
+ set main_addr [get_integer_valueof &main -1]
+ gdb_assert {$main_addr != -1}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $opts] != "" } {
- untested "failed to compile"
- return
-}
+ set bp_addr -1
-clean_restart ${binfile}
+ # Put breakpoint on main, get the address where the breakpoint was installed.
+ gdb_test_multiple "break -q main" "break on main, get address" {
+ -re -wrap "Breakpoint $::decimal at ($::hex).*" {
+ set bp_addr $expect_out(1,string)
-# Get start address of function main.
-set main_addr [get_integer_valueof &main -1]
-gdb_assert {$main_addr != -1}
+ # Convert to decimal.
+ set bp_addr [expr {$bp_addr}]
-set bp_addr -1
+ pass $gdb_test_name
+ }
+ }
-# Put breakpoint on main, get the address where the breakpoint was installed.
-gdb_test_multiple "break -q main" "break on main, get address" {
- -re -wrap "Breakpoint $decimal at ($hex).*" {
- set bp_addr $expect_out(1,string)
+ # Make sure some prologue was skipped.
+ gdb_assert {$bp_addr != -1 && $bp_addr > $main_addr} \
+ "breakpoint placed past main's entry"
+}
- # Convert to decimal.
- set bp_addr [expr $bp_addr]
+with_test_prefix "skip-cf-protection" {
+ set opts {debug additional_flags=-fcf-protection=full}
- pass $gdb_test_name
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
+ $opts] != "" } {
+ untested "failed to compile"
+ return
}
+
+ clean_restart ${::testfile}
+
+ test_run
}
-if { $bp_addr != -1 } {
- # Make sure some prologue was skipped.
- gdb_assert {$bp_addr > $main_addr}
+# Now, make sure that the prologue analysis does not end up at function's entry
+# when stack alignment sequence is generated right after 'endbr64'/'endbr32'.
+# That could happen if GDB handled those incorrectly - there was a bug that
+# checked for those two in incorrect order, which caused such issue.
+with_test_prefix "skip-cf-protection-stackalign" {
+ # gcc is easier to make it produce the sequence of interest.
+ if { ![is_c_compiler_gcc] } {
+ unsupported "stackalign test part requires gcc compiler"
+ return
+ }
+
+ if { [prepare_for_testing "failed to prepare" "${testfile}-stackalign" \
+ $srcfile2 [list optimize=-O0 additional_flags=-fcf-protection=full]] } {
+ return
+ }
+
+ test_run
}
diff --git a/gdb/testsuite/gdb.arch/i386-prologue.c b/gdb/testsuite/gdb.arch/i386-prologue.c
index 494188c..a340259 100644
--- a/gdb/testsuite/gdb.arch/i386-prologue.c
+++ b/gdb/testsuite/gdb.arch/i386-prologue.c
@@ -1,6 +1,6 @@
/* Unwinder test program.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/i386-prologue.exp b/gdb/testsuite/gdb.arch/i386-prologue.exp
index aac9b02..bfab6d1 100644
--- a/gdb/testsuite/gdb.arch/i386-prologue.exp
+++ b/gdb/testsuite/gdb.arch/i386-prologue.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -53,7 +53,7 @@ proc skip_breakpoint { msg } {
}
-clean_restart $binfile
+clean_restart $::testfile
#
# Run to `main' where we begin our tests.
diff --git a/gdb/testsuite/gdb.arch/i386-pseudo.c b/gdb/testsuite/gdb.arch/i386-pseudo.c
index 777c3a0..31754dc 100644
--- a/gdb/testsuite/gdb.arch/i386-pseudo.c
+++ b/gdb/testsuite/gdb.arch/i386-pseudo.c
@@ -1,6 +1,6 @@
/* Test program for byte registers.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/i386-signal.c b/gdb/testsuite/gdb.arch/i386-signal.c
index 45e3a30..ff281d3 100644
--- a/gdb/testsuite/gdb.arch/i386-signal.c
+++ b/gdb/testsuite/gdb.arch/i386-signal.c
@@ -1,6 +1,6 @@
/* Unwinder test program for signal frames.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/i386-signal.exp b/gdb/testsuite/gdb.arch/i386-signal.exp
index c66ad5b..80d1827 100644
--- a/gdb/testsuite/gdb.arch/i386-signal.exp
+++ b/gdb/testsuite/gdb.arch/i386-signal.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This file is part of the GDB testsuite.
@@ -30,7 +30,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
runto func
gdb_test "backtrace 10" \
diff --git a/gdb/testsuite/gdb.arch/i386-size-overlap.c b/gdb/testsuite/gdb.arch/i386-size-overlap.c
index 58a9268..5b1d193 100644
--- a/gdb/testsuite/gdb.arch/i386-size-overlap.c
+++ b/gdb/testsuite/gdb.arch/i386-size-overlap.c
@@ -1,6 +1,6 @@
/* Overlapping symbol sizes test program.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/i386-size-overlap.exp b/gdb/testsuite/gdb.arch/i386-size-overlap.exp
index c10d95b..db88673 100644
--- a/gdb/testsuite/gdb.arch/i386-size-overlap.exp
+++ b/gdb/testsuite/gdb.arch/i386-size-overlap.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
# We use gdb_run_cmd so this stands a chance to work for remote
# targets too.
diff --git a/gdb/testsuite/gdb.arch/i386-size.c b/gdb/testsuite/gdb.arch/i386-size.c
index 0ead51c..09b2324 100644
--- a/gdb/testsuite/gdb.arch/i386-size.c
+++ b/gdb/testsuite/gdb.arch/i386-size.c
@@ -1,6 +1,6 @@
/* Symbol size test program.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/i386-size.exp b/gdb/testsuite/gdb.arch/i386-size.exp
index 2a2c4ac..997e629 100644
--- a/gdb/testsuite/gdb.arch/i386-size.exp
+++ b/gdb/testsuite/gdb.arch/i386-size.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
# We use gdb_run_cmd so this stands a chance to work for remote
# targets too.
diff --git a/gdb/testsuite/gdb.arch/i386-sse-stack-align.S b/gdb/testsuite/gdb.arch/i386-sse-stack-align.S
index 89cd17c..61f9c0b 100644
--- a/gdb/testsuite/gdb.arch/i386-sse-stack-align.S
+++ b/gdb/testsuite/gdb.arch/i386-sse-stack-align.S
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/i386-sse-stack-align.c b/gdb/testsuite/gdb.arch/i386-sse-stack-align.c
index 67e0f67..bd5ce3a 100644
--- a/gdb/testsuite/gdb.arch/i386-sse-stack-align.c
+++ b/gdb/testsuite/gdb.arch/i386-sse-stack-align.c
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp b/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp
index bb86ca3..6b9260b 100644
--- a/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp
+++ b/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ set executable ${testfile}
set binfile [standard_output_file ${executable}]
set opts {}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
set srcfile ${csrcfile}
lappend opts debug optimize=-O2 additional_flags=-msse
}
@@ -53,5 +53,5 @@ foreach i {0 1 2 3 4} {
if {$args != ""} {
set args "$args, "
}
- set args "$args[expr $i + 1]"
+ set args "$args[expr {$i + 1}]"
}
diff --git a/gdb/testsuite/gdb.arch/i386-sse.c b/gdb/testsuite/gdb.arch/i386-sse.c
index 66ff4fd..592952c 100644
--- a/gdb/testsuite/gdb.arch/i386-sse.c
+++ b/gdb/testsuite/gdb.arch/i386-sse.c
@@ -1,6 +1,6 @@
/* Test program for SSE registers.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/i386-sse.exp b/gdb/testsuite/gdb.arch/i386-sse.exp
index 42ca9f5..ee22b62 100644
--- a/gdb/testsuite/gdb.arch/i386-sse.exp
+++ b/gdb/testsuite/gdb.arch/i386-sse.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
return
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return 0
@@ -68,7 +68,7 @@ gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
"set first breakpoint in main"
gdb_continue_to_breakpoint "continue to first breakpoint in main"
-if [is_amd64_regs_target] {
+if {[is_amd64_regs_target]} {
set nr_regs 16
} else {
set nr_regs 8
@@ -94,6 +94,6 @@ gdb_continue_to_breakpoint "continue to second breakpoint in main"
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "print data\[$r\]" \
- ".. = \\{f = \\{[expr $r + 10], $r.25, $r.5, $r.75\\}\\}.*" \
+ ".. = \\{f = \\{[expr {$r + 10}], $r.25, $r.5, $r.75\\}\\}.*" \
"check contents of data\[$r\]"
}
diff --git a/gdb/testsuite/gdb.arch/i386-stap-eval-lang-ada.S b/gdb/testsuite/gdb.arch/i386-stap-eval-lang-ada.S
index 25c6e3a..26f6bf7 100644
--- a/gdb/testsuite/gdb.arch/i386-stap-eval-lang-ada.S
+++ b/gdb/testsuite/gdb.arch/i386-stap-eval-lang-ada.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/i386-stap-eval-lang-ada.c b/gdb/testsuite/gdb.arch/i386-stap-eval-lang-ada.c
index 5618700..f232a21 100644
--- a/gdb/testsuite/gdb.arch/i386-stap-eval-lang-ada.c
+++ b/gdb/testsuite/gdb.arch/i386-stap-eval-lang-ada.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/i386-stap-eval-lang-ada.exp b/gdb/testsuite/gdb.arch/i386-stap-eval-lang-ada.exp
index 4e8b074..c361a2d 100644
--- a/gdb/testsuite/gdb.arch/i386-stap-eval-lang-ada.exp
+++ b/gdb/testsuite/gdb.arch/i386-stap-eval-lang-ada.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/i386-unwind.c b/gdb/testsuite/gdb.arch/i386-unwind.c
index 2b5804a..74efc19 100644
--- a/gdb/testsuite/gdb.arch/i386-unwind.c
+++ b/gdb/testsuite/gdb.arch/i386-unwind.c
@@ -1,6 +1,6 @@
/* Unwinder test program.
- Copyright 2003-2024 Free Software Foundation, Inc.
+ Copyright 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/i386-unwind.exp b/gdb/testsuite/gdb.arch/i386-unwind.exp
index 25bbcfb..76f0a78 100644
--- a/gdb/testsuite/gdb.arch/i386-unwind.exp
+++ b/gdb/testsuite/gdb.arch/i386-unwind.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
# Testcase for backtrace/1435.
diff --git a/gdb/testsuite/gdb.arch/i386-word.exp b/gdb/testsuite/gdb.arch/i386-word.exp
index d908c4f..ed02d27 100644
--- a/gdb/testsuite/gdb.arch/i386-word.exp
+++ b/gdb/testsuite/gdb.arch/i386-word.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list
return
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.S b/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.S
index eec63e5..81fdc5b 100644
--- a/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.S
+++ b/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.S
@@ -1,4 +1,4 @@
-/* Copyright 2009-2024 Free Software Foundation, Inc.
+/* Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp b/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp
index 7a1e529..ed617fc 100644
--- a/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp
+++ b/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,10 +23,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
# We need to start the inferior to place the breakpoints in the memory at all.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -53,7 +54,7 @@ gdb_test_multiple "b bundle" $test {
}
}
-if ![info exists bpt2address] {
+if {![info exists bpt2address]} {
return -1
}
@@ -64,7 +65,7 @@ set test "disassembly with breakpoints"
gdb_test_multiple "disass main" $test {
-re $match {
set got $expect_out(1,string)
- if [string equal -nocase $orig $got] {
+ if {[string equal -nocase $orig $got]} {
pass $test
} else {
fail $test
diff --git a/gdb/testsuite/gdb.arch/insn-reloc.c b/gdb/testsuite/gdb.arch/insn-reloc.c
index 9cd7285..32adcb5 100644
--- a/gdb/testsuite/gdb.arch/insn-reloc.c
+++ b/gdb/testsuite/gdb.arch/insn-reloc.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/iwmmxt-regs.c b/gdb/testsuite/gdb.arch/iwmmxt-regs.c
index b406a7e..a7ca49d 100644
--- a/gdb/testsuite/gdb.arch/iwmmxt-regs.c
+++ b/gdb/testsuite/gdb.arch/iwmmxt-regs.c
@@ -1,6 +1,6 @@
/* Register test program.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/iwmmxt-regs.exp b/gdb/testsuite/gdb.arch/iwmmxt-regs.exp
index 6df0960..86e9ccb 100644
--- a/gdb/testsuite/gdb.arch/iwmmxt-regs.exp
+++ b/gdb/testsuite/gdb.arch/iwmmxt-regs.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/mips-disassembler-options.exp b/gdb/testsuite/gdb.arch/mips-disassembler-options.exp
index f3862da..e2d930e 100644
--- a/gdb/testsuite/gdb.arch/mips-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/mips-disassembler-options.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/mips-disassembler-options.s b/gdb/testsuite/gdb.arch/mips-disassembler-options.s
index 65415a9..466bf2b 100644
--- a/gdb/testsuite/gdb.arch/mips-disassembler-options.s
+++ b/gdb/testsuite/gdb.arch/mips-disassembler-options.s
@@ -1,6 +1,6 @@
# This test is part of GDB, the GNU debugger.
#
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/mips-fcr.c b/gdb/testsuite/gdb.arch/mips-fcr.c
index a3b9352..6d906ec 100644
--- a/gdb/testsuite/gdb.arch/mips-fcr.c
+++ b/gdb/testsuite/gdb.arch/mips-fcr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/mips-fcr.exp b/gdb/testsuite/gdb.arch/mips-fcr.exp
index d7a39fb..6fe332a 100644
--- a/gdb/testsuite/gdb.arch/mips-fcr.exp
+++ b/gdb/testsuite/gdb.arch/mips-fcr.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile}] } {
return
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.arch/mips-fpregset-core.c b/gdb/testsuite/gdb.arch/mips-fpregset-core.c
index f976371..09d39f0 100644
--- a/gdb/testsuite/gdb.arch/mips-fpregset-core.c
+++ b/gdb/testsuite/gdb.arch/mips-fpregset-core.c
@@ -1,6 +1,6 @@
/* This test is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/mips-fpregset-core.exp b/gdb/testsuite/gdb.arch/mips-fpregset-core.exp
index d62fa25..d67cef2 100644
--- a/gdb/testsuite/gdb.arch/mips-fpregset-core.exp
+++ b/gdb/testsuite/gdb.arch/mips-fpregset-core.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -79,7 +79,8 @@ set core_supported [expr {$corefile != ""}]
# Generate a core file with "gcore".
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
runto break_here
@@ -116,7 +117,8 @@ proc mips_fpregset_core_test { supported corefile } {
upvar host_triplet host_triplet
upvar binfile binfile
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
set test "load core file"
if { $supported } {
diff --git a/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp b/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp
index 224ee76..1921578 100644
--- a/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp
+++ b/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp
@@ -1,19 +1,19 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
-# Test single-step on bbit.
+# Test single-step on bbit.
require {istarget "*octeon*"}
@@ -48,7 +48,7 @@ proc single_step_until { match } {
set insn [current_insn]
set start [timestamp]
while { $insn != "" && [timestamp] - $start < 3*$timeout } {
- if [regexp $match $insn] {
+ if {[regexp $match $insn]} {
return 1
}
if {![single_step]} {
@@ -66,7 +66,7 @@ proc test_bbit { name taken } {
}
pass "$name single-step until bbit"
gdb_test "si" "" "$name single-step on bbit"
- if [regexp "li\\s+\[sv\]0,$taken" [current_insn]] {
+ if {[regexp "li\\s+\[sv\]0,$taken" [current_insn]]} {
pass "$name check insn after bbit"
} else {
send_log "expected: li\\s+\[sv\]0,$taken found [current_insn]\n"
@@ -86,7 +86,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
pass "compilation"
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
# Native needs run.
runto_main
diff --git a/gdb/testsuite/gdb.arch/mips16-thunks-inmain.c b/gdb/testsuite/gdb.arch/mips16-thunks-inmain.c
index 4f6f211..09f85b7 100644
--- a/gdb/testsuite/gdb.arch/mips16-thunks-inmain.c
+++ b/gdb/testsuite/gdb.arch/mips16-thunks-inmain.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/mips16-thunks-main.c b/gdb/testsuite/gdb.arch/mips16-thunks-main.c
index bfcc02d..3188f35 100644
--- a/gdb/testsuite/gdb.arch/mips16-thunks-main.c
+++ b/gdb/testsuite/gdb.arch/mips16-thunks-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/mips16-thunks-sin.c b/gdb/testsuite/gdb.arch/mips16-thunks-sin.c
index 866096c..75ffc58 100644
--- a/gdb/testsuite/gdb.arch/mips16-thunks-sin.c
+++ b/gdb/testsuite/gdb.arch/mips16-thunks-sin.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/mips16-thunks-sinfrob.c b/gdb/testsuite/gdb.arch/mips16-thunks-sinfrob.c
index c0b131e..5dea0a2 100644
--- a/gdb/testsuite/gdb.arch/mips16-thunks-sinfrob.c
+++ b/gdb/testsuite/gdb.arch/mips16-thunks-sinfrob.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/mips16-thunks-sinfrob16.c b/gdb/testsuite/gdb.arch/mips16-thunks-sinfrob16.c
index a16ec48..8ae3dcf 100644
--- a/gdb/testsuite/gdb.arch/mips16-thunks-sinfrob16.c
+++ b/gdb/testsuite/gdb.arch/mips16-thunks-sinfrob16.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/mips16-thunks-sinmain.c b/gdb/testsuite/gdb.arch/mips16-thunks-sinmain.c
index 7a07622..81ea79e 100644
--- a/gdb/testsuite/gdb.arch/mips16-thunks-sinmain.c
+++ b/gdb/testsuite/gdb.arch/mips16-thunks-sinmain.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/mips16-thunks-sinmips16.c b/gdb/testsuite/gdb.arch/mips16-thunks-sinmips16.c
index 1a57957..3009080 100644
--- a/gdb/testsuite/gdb.arch/mips16-thunks-sinmips16.c
+++ b/gdb/testsuite/gdb.arch/mips16-thunks-sinmips16.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/mips16-thunks.exp b/gdb/testsuite/gdb.arch/mips16-thunks.exp
index 6a888d5..6936bf3 100644
--- a/gdb/testsuite/gdb.arch/mips16-thunks.exp
+++ b/gdb/testsuite/gdb.arch/mips16-thunks.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/pa-nullify.exp b/gdb/testsuite/gdb.arch/pa-nullify.exp
index fef7c84..cb8eeeb 100644
--- a/gdb/testsuite/gdb.arch/pa-nullify.exp
+++ b/gdb/testsuite/gdb.arch/pa-nullify.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,9 +40,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] !
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
-# In the first test, we do a "step" on a function whose last instruction
+# In the first test, we do a "step" on a function whose last instruction
# contains a branch-with-nullify. The instruction in the delay slot belongs
# to the next function. We verify that when we step off the first function
# that we end up back at the caller and not at the second instruction.
@@ -64,9 +65,9 @@ gdb_test_multiple "stepi" "${test}" {
}
}
-# In the second test, we verify that we can get a proper backtrace
+# In the second test, we verify that we can get a proper backtrace
# even when we are in a nullified instruction that belongs to the next function.
-# We also verify that when stepping over a branch-with-nullify insn that we
+# We also verify that when stepping over a branch-with-nullify insn that we
# stay on the same insn for two steps.
proc get_addr_of_sym { sym } {
@@ -126,7 +127,7 @@ if {![runto_main]} {
}
gdb_breakpoint "*$foo_last"
gdb_test "continue" "Breakpoint \[0-9\]*,.* in foo.*" "$test: continue to breakpoint"
-if [gen_core $test] {
+if {[gen_core $test]} {
test_core_bt $test
}
@@ -137,6 +138,6 @@ if {![runto_main]} {
gdb_breakpoint "*$foo_last"
gdb_test "continue" "Breakpoint \[0-9\]*,.* in foo.*" "$test: continue to breakpoint"
gdb_test "stepi" ".*in foo.*" "$test: step to nullified instruction"
-if [gen_core $test] {
+if {[gen_core $test]} {
test_core_bt $test
}
diff --git a/gdb/testsuite/gdb.arch/powerpc-addpcis.exp b/gdb/testsuite/gdb.arch/powerpc-addpcis.exp
index 867d806..9d88c78 100644
--- a/gdb/testsuite/gdb.arch/powerpc-addpcis.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-addpcis.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -86,25 +86,25 @@ set check_r9 [get_hexadecimal_valueof "\$r9" "default0"]
# addpcis 8,+0x10 # /* set r8 */
# addpcis 9,+0x100 # /* set r9 */
-if [expr $check_r3 + 0x1000000 != $check_r6 - 0xc ] {
+if {$check_r3 + 0x1000000 != $check_r6 - 0xc} {
fail "unexpected value r3 + 0x1,000,000 != r6 + 0xc ; r3: $check_r3 r6: $check_r6 "
}
-if [expr $check_r4 + 0x100000 != $check_r6 - 0x8 ] {
+if {$check_r4 + 0x100000 != $check_r6 - 0x8} {
fail "unexpected value r4 + 0x100,000 != r6 - 0x8 ; r4: $check_r4 r6: $check_r6 "
}
-if [expr $check_r5 + 0x10000 != $check_r6 - 0x4 ] {
+if {$check_r5 + 0x10000 != $check_r6 - 0x4} {
fail "unexpected value r5 + 0x10,000 != r6 , r5: $check_r5 r6: $check_r6 "
}
-if [expr $check_r6 != $check_r6] {
+if {$check_r6 != $check_r6} {
fail "unexpected value r6 != r6 , r6: $check_r6 r6: $check_r6 "
}
-if [expr $check_r7 - 0x10000 != $check_r6 + 0x4] {
+if {$check_r7 - 0x10000 != $check_r6 + 0x4} {
fail "unexpected value r7 - 0x10,000 != r6 + 0x4 , r7: $check_r7 r7: $check_r6 "
}
-if [expr $check_r8 - 0x100000 != $check_r6 + 0x8 ] {
+if {$check_r8 - 0x100000 != $check_r6 + 0x8} {
fail "unexpected value r8 - 0x100,000 != r6 , r8: $check_r8 r8: $check_r6 "
}
-if [expr $check_r9 - 0x1000000 != $check_r6 + 0xc ] {
+if {$check_r9 - 0x1000000 != $check_r6 + 0xc} {
fail "unexpected value r9 - 0x1,000,000 != r6 + 0xc , r9: $check_r9 r6: $check_r6 "
}
diff --git a/gdb/testsuite/gdb.arch/powerpc-addpcis.s b/gdb/testsuite/gdb.arch/powerpc-addpcis.s
index b0f8c2f..6cdcb98 100644
--- a/gdb/testsuite/gdb.arch/powerpc-addpcis.s
+++ b/gdb/testsuite/gdb.arch/powerpc-addpcis.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-aix-prologue.c b/gdb/testsuite/gdb.arch/powerpc-aix-prologue.c
index 3652bcd..4b1b1ae 100644
--- a/gdb/testsuite/gdb.arch/powerpc-aix-prologue.c
+++ b/gdb/testsuite/gdb.arch/powerpc-aix-prologue.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp b/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp
index ed595d4..4e6ee78 100644
--- a/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] !
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
# Insert a breakpoint in FUNCTION and verifies that the breakpoint was
# inserted at the expected location. EXPECTED_LOCATION should be an
@@ -37,7 +38,7 @@ proc insert_breakpoint {function expected_location} {
global gdb_prompt
global expect_out
global hex
-
+
set address ""
# Insert a breakpoint using the given function name, and extract
diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec.exp b/gdb/testsuite/gdb.arch/powerpc-altivec.exp
index fc041ee..0084ffe 100644
--- a/gdb/testsuite/gdb.arch/powerpc-altivec.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-altivec.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}]
return -1
}
-clean_restart ${objfile}
+clean_restart
+gdb_load $objfile
# Disassemble the function.
set func ""
@@ -52,7 +53,7 @@ proc func_check {instr} {
set test "found: '$instr'"
set peb [instr_to_patt $instr]
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $peb
diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec.s b/gdb/testsuite/gdb.arch/powerpc-altivec.s
index 236e878..3c5b84c 100644
--- a/gdb/testsuite/gdb.arch/powerpc-altivec.s
+++ b/gdb/testsuite/gdb.arch/powerpc-altivec.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec2.exp b/gdb/testsuite/gdb.arch/powerpc-altivec2.exp
index 3c29c6d..cd2240a 100644
--- a/gdb/testsuite/gdb.arch/powerpc-altivec2.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-altivec2.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}]
return -1
}
-clean_restart ${objfile}
+clean_restart
+gdb_load $objfile
# Disassemble the function.
set func ""
@@ -51,7 +52,7 @@ proc func_check {instr} {
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec2.s b/gdb/testsuite/gdb.arch/powerpc-altivec2.s
index 411bf2f..abe54b3 100644
--- a/gdb/testsuite/gdb.arch/powerpc-altivec2.s
+++ b/gdb/testsuite/gdb.arch/powerpc-altivec2.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec3.exp b/gdb/testsuite/gdb.arch/powerpc-altivec3.exp
index 334d352..c7d1a2b 100644
--- a/gdb/testsuite/gdb.arch/powerpc-altivec3.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-altivec3.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}]
return -1
}
-clean_restart ${objfile}
+clean_restart
+gdb_load $objfile
# Disassemble the function.
set func ""
@@ -51,7 +52,7 @@ proc func_check {instr} {
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec3.s b/gdb/testsuite/gdb.arch/powerpc-altivec3.s
index a752a79..b649111 100644
--- a/gdb/testsuite/gdb.arch/powerpc-altivec3.s
+++ b/gdb/testsuite/gdb.arch/powerpc-altivec3.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-d128-regs.c b/gdb/testsuite/gdb.arch/powerpc-d128-regs.c
index e2116ef..a5fa1c4 100644
--- a/gdb/testsuite/gdb.arch/powerpc-d128-regs.c
+++ b/gdb/testsuite/gdb.arch/powerpc-d128-regs.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp b/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
index 9a935b7..904c758 100644
--- a/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,13 +29,13 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {qui
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
if {![runto_main]} {
return
}
-if [gdb_test "show arch" ".*powerpc:common.*" "checking for PPC arch"] {
+if {[gdb_test "show arch" ".*powerpc:common.*" "checking for PPC arch"]} {
return -1
}
@@ -50,12 +50,12 @@ gdb_test "info reg dl$i" \
"dl$i\[ \]*1\.2345678910\[ \t\]*\\(raw 0x2205800000000000000000049c5de09c\\)" \
"print dl$i register with the info reg command"
-gdb_test "info reg f[expr 2*$i]" \
- "f[expr 2*$i]\[ \]*8\.608957309287334e\-145\[ \t\]*\\(raw 0x2205800000000000\\)" \
+gdb_test "info reg f[expr {2*$i}]" \
+ "f[expr {2*$i}]\[ \]*8\.608957309287334e\-145\[ \t\]*\\(raw 0x2205800000000000\\)" \
"testing lower half of dl$i register"
-gdb_test "info reg f[expr 2*$i+1]" \
- "f[expr 2*$i+1]\[ \]*9\.7841140127686122e\-314\[ \t\]*\\(raw 0x000000049c5de09c\\)" \
+gdb_test "info reg f[expr {2*$i+1}]" \
+ "f[expr {2*$i+1}]\[ \]*9\.7841140127686122e\-314\[ \t\]*\\(raw 0x000000049c5de09c\\)" \
"testing upper half of dl$i register"
}
diff --git a/gdb/testsuite/gdb.arch/powerpc-disassembler-options.exp b/gdb/testsuite/gdb.arch/powerpc-disassembler-options.exp
index 4ec2e98..4d57c87 100644
--- a/gdb/testsuite/gdb.arch/powerpc-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-disassembler-options.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-fpscr-gcore.exp b/gdb/testsuite/gdb.arch/powerpc-fpscr-gcore.exp
index 74edffb..13163d2 100644
--- a/gdb/testsuite/gdb.arch/powerpc-fpscr-gcore.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-fpscr-gcore.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ if {[build_executable "compile" $binfile $gen_src] == -1} {
return -1
}
-clean_restart $binfile
+clean_restart $testfile
if {![runto_main]} {
return -1
diff --git a/gdb/testsuite/gdb.arch/powerpc-htm-regs.c b/gdb/testsuite/gdb.arch/powerpc-htm-regs.c
index a653f31..bc1c2b1 100644
--- a/gdb/testsuite/gdb.arch/powerpc-htm-regs.c
+++ b/gdb/testsuite/gdb.arch/powerpc-htm-regs.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-htm-regs.exp b/gdb/testsuite/gdb.arch/powerpc-htm-regs.exp
index 59a4d47..456833e 100644
--- a/gdb/testsuite/gdb.arch/powerpc-htm-regs.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-htm-regs.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -82,7 +82,8 @@ with_test_prefix "check htm support" {
return
}
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
# Displaced-stepping a tbegin. causes problems,
# so we make the breakpoint temporary.
@@ -131,7 +132,7 @@ if {[build_executable "compile" $binfile $srcfile {debug}] == -1} {
return
}
-clean_restart $binfile
+clean_restart $testfile
gdb_breakpoint [gdb_get_line_number "first marker"] temporary
@@ -158,7 +159,7 @@ gdb_test_no_output "set \$xer = 0xc0000000"
# FPRs
gdb_test_no_output "set \$f0 = 0.5"
for {set i 1} {$i < 32} {incr i 1} {
- gdb_test_no_output "set \$f$i = \$f[expr $i - 1] + 1.0"
+ gdb_test_no_output "set \$f$i = \$f[expr {$i - 1}] + 1.0"
}
gdb_test_no_output "set \$fpscr = 0x84005000"
@@ -212,7 +213,7 @@ proc test_register_match {reg_name reg_var_name hex} {
# In some infrequent cases CXER doesn't match the
# pre-transactional XER, possibly due to a linux kernel bug.
set should_xfail 0
- if [istarget "powerpc*-*-linux*" && reg_name == "cxer"] {
+ if {[istarget "powerpc*-*-linux*" && reg_name == "cxer"]} {
set should_xfail 1
}
@@ -267,7 +268,7 @@ test_register_match "ctar" "tar" 1
# Support for writing to the checkpointed registers is not
# currently available in the gdbserver stub.
-if [target_is_gdbserver] {
+if {[target_is_gdbserver]} {
unsupported "write to checkpointed registers"
return
}
@@ -281,7 +282,7 @@ for {set i 0} {$i < 32} {incr i 1} {
gdb_test_no_output "set \$cf0 = 0.25"
for {set i 1} {$i < 32} {incr i 1} {
- gdb_test_no_output "set \$cf$i = \$cf[expr $i - 1] + 1.0"
+ gdb_test_no_output "set \$cf$i = \$cf[expr {$i - 1}] + 1.0"
}
for {set i 0} {$i < 32} {incr i 1} {
diff --git a/gdb/testsuite/gdb.arch/powerpc-lnia.exp b/gdb/testsuite/gdb.arch/powerpc-lnia.exp
index 7b29bf1..c317465 100644
--- a/gdb/testsuite/gdb.arch/powerpc-lnia.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-lnia.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -82,22 +82,22 @@ set check_r9 [get_hexadecimal_valueof "\$r9" "default0"]
# Specifically that the values loaded by the lnia instruction
# reflect the value of the PC as if the instruction was
# not displaced.
-if [expr $check_r3 + 4 != $check_r4] {
+if {$check_r3 + 4 != $check_r4} {
fail "unexpected value r3+4 != r4 , r3: $check_r3 r4: $check_r4 "
}
-if [expr $check_r4 + 4 != $check_r5] {
+if {$check_r4 + 4 != $check_r5} {
fail "unexpected value r4+4 != r5 , r4: $check_r4 r5: $check_r5 "
}
-if [expr $check_r5 + 4 != $check_r6] {
+if {$check_r5 + 4 != $check_r6} {
fail "unexpected value r5+4 != r6 , r5: $check_r5 r6: $check_r6 "
}
-if [expr $check_r6 + 4 != $check_r7] {
+if {$check_r6 + 4 != $check_r7} {
fail "unexpected value r6+4 != r7 , r6: $check_r6 r7: $check_r7 "
}
-if [expr $check_r7 + 4 != $check_r8] {
+if {$check_r7 + 4 != $check_r8} {
fail "unexpected value r7+4 != r8 , r7: $check_r7 r8: $check_r8 "
}
-if [expr $check_r8 + 4 != $check_r9] {
+if {$check_r8 + 4 != $check_r9} {
fail "unexpected value r8+4 != r9 , r8: $check_r8 r9: $check_r9 "
}
diff --git a/gdb/testsuite/gdb.arch/powerpc-lnia.s b/gdb/testsuite/gdb.arch/powerpc-lnia.s
index 8cf0f46..bf3d800 100644
--- a/gdb/testsuite/gdb.arch/powerpc-lnia.s
+++ b/gdb/testsuite/gdb.arch/powerpc-lnia.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp
index 547134c..ef6e1ff 100644
--- a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -109,16 +109,16 @@ set vs5_expected 0xa7b7c7d7a6b6c6d6a5b5c5d5a4b4c4d4
set vs6_expected 0xa9b9c9d9a8b8c8d8a7b7c7d7a6b6c6d6
set vs7_expected 0xabbbcbdbaabacadaa9b9c9d9a8b8c8d8
-if [expr $check_vs4 != $vs4_expected] {
+if {$check_vs4 != $vs4_expected} {
fail "unexpected value vs4; actual:$check_vs4 expected:$vs4_expected"
}
-if [expr $check_vs5 != $vs5_expected ] {
+if {$check_vs5 != $vs5_expected} {
fail "unexpected value vs5; actual:$check_vs5 expected:$vs5_expected"
}
-if [expr $check_vs6 != $vs6_expected ] {
+if {$check_vs6 != $vs6_expected} {
fail "unexpected value vs6; actual:$check_vs6 expected:$vs6_expected"
}
-if [expr $check_vs7 != $vs7_expected ] {
+if {$check_vs7 != $vs7_expected} {
fail "unexpected value vs7; actual:$check_vs7 expected:$vs7_expected"
}
diff --git a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.s b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.s
index 654bc2d..7c1ee9c 100644
--- a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.s
+++ b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.s
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-power10.exp b/gdb/testsuite/gdb.arch/powerpc-power10.exp
index a4bfe5c..089ca73 100644
--- a/gdb/testsuite/gdb.arch/powerpc-power10.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-power10.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}]
return -1
}
-clean_restart ${objfile}
+clean_restart
+gdb_load $objfile
# Disassemble the function.
set func ""
@@ -51,7 +52,7 @@ proc func_check {instr} {
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
diff --git a/gdb/testsuite/gdb.arch/powerpc-power10.s b/gdb/testsuite/gdb.arch/powerpc-power10.s
index 82f4cb8..50703b6 100644
--- a/gdb/testsuite/gdb.arch/powerpc-power10.s
+++ b/gdb/testsuite/gdb.arch/powerpc-power10.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-power7.exp b/gdb/testsuite/gdb.arch/powerpc-power7.exp
index 39b5312..4d85fd9 100644
--- a/gdb/testsuite/gdb.arch/powerpc-power7.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-power7.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}]
return -1
}
-clean_restart ${objfile}
+clean_restart
+gdb_load $objfile
# Disassemble the function.
set func ""
@@ -51,7 +52,7 @@ proc func_check {instr} {
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
diff --git a/gdb/testsuite/gdb.arch/powerpc-power7.s b/gdb/testsuite/gdb.arch/powerpc-power7.s
index a4bfc25..808baae 100644
--- a/gdb/testsuite/gdb.arch/powerpc-power7.s
+++ b/gdb/testsuite/gdb.arch/powerpc-power7.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-power8.exp b/gdb/testsuite/gdb.arch/powerpc-power8.exp
index 50d9784..f679253 100644
--- a/gdb/testsuite/gdb.arch/powerpc-power8.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-power8.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}]
return -1
}
-clean_restart ${objfile}
+clean_restart
+gdb_load $objfile
# Disassemble the function.
set func ""
@@ -51,7 +52,7 @@ proc func_check {instr} {
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
diff --git a/gdb/testsuite/gdb.arch/powerpc-power8.s b/gdb/testsuite/gdb.arch/powerpc-power8.s
index b7e90d1..f7db1b0 100644
--- a/gdb/testsuite/gdb.arch/powerpc-power8.s
+++ b/gdb/testsuite/gdb.arch/powerpc-power8.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-power9.exp b/gdb/testsuite/gdb.arch/powerpc-power9.exp
index f1707fc..784ba9b 100644
--- a/gdb/testsuite/gdb.arch/powerpc-power9.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-power9.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}]
return -1
}
-clean_restart ${objfile}
+clean_restart
+gdb_load $objfile
# Disassemble the function.
set func ""
@@ -51,7 +52,7 @@ proc func_check {instr} {
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
diff --git a/gdb/testsuite/gdb.arch/powerpc-power9.s b/gdb/testsuite/gdb.arch/powerpc-power9.s
index 96c1b29..784c9be 100644
--- a/gdb/testsuite/gdb.arch/powerpc-power9.s
+++ b/gdb/testsuite/gdb.arch/powerpc-power9.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.c b/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.c
index e464848..3a68ce0 100644
--- a/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.c
+++ b/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp b/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp
index a9b0dfb..1b70535 100644
--- a/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -66,9 +66,9 @@ proc ppr_dscr_available {} {
}
with_test_prefix "check PPR/DSCR access" {
- clean_restart $binfile
+ clean_restart $::testfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -86,9 +86,9 @@ with_test_prefix "check PPR/DSCR access" {
}
# Now do the actual test
-clean_restart $binfile
+clean_restart $::testfile
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue-frame.S b/gdb/testsuite/gdb.arch/powerpc-prologue-frame.S
index ee36fea..d232b49 100644
--- a/gdb/testsuite/gdb.arch/powerpc-prologue-frame.S
+++ b/gdb/testsuite/gdb.arch/powerpc-prologue-frame.S
@@ -1,6 +1,6 @@
/* This test is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue-frame.c b/gdb/testsuite/gdb.arch/powerpc-prologue-frame.c
index c569121..b008512 100644
--- a/gdb/testsuite/gdb.arch/powerpc-prologue-frame.c
+++ b/gdb/testsuite/gdb.arch/powerpc-prologue-frame.c
@@ -1,6 +1,6 @@
/* This test is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp b/gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp
index 9d93692..4682cb9 100644
--- a/gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,9 +26,9 @@ if {[gdb_compile \
}
-clean_restart ${binfile}
+clean_restart $testfile
-if ![runto bar] {
+if {![runto bar]} {
untested "could not run to bar"
return -1
}
diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue.c b/gdb/testsuite/gdb.arch/powerpc-prologue.c
index c933c8f..8bb45d6 100644
--- a/gdb/testsuite/gdb.arch/powerpc-prologue.c
+++ b/gdb/testsuite/gdb.arch/powerpc-prologue.c
@@ -1,6 +1,6 @@
/* Unwinder test program.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue.exp b/gdb/testsuite/gdb.arch/powerpc-prologue.exp
index e076ec2..44877a1 100644
--- a/gdb/testsuite/gdb.arch/powerpc-prologue.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-prologue.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] !
}
-clean_restart $binfile
+clean_restart $testfile
#
# Run to `main' where we begin our tests.
diff --git a/gdb/testsuite/gdb.arch/powerpc-stackless.S b/gdb/testsuite/gdb.arch/powerpc-stackless.S
index 8cba2b9..8b14cfb 100644
--- a/gdb/testsuite/gdb.arch/powerpc-stackless.S
+++ b/gdb/testsuite/gdb.arch/powerpc-stackless.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-stackless.exp b/gdb/testsuite/gdb.arch/powerpc-stackless.exp
index 289fc2a..07ad5ed 100644
--- a/gdb/testsuite/gdb.arch/powerpc-stackless.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-stackless.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-tar.c b/gdb/testsuite/gdb.arch/powerpc-tar.c
index c280d70..3b65b47 100644
--- a/gdb/testsuite/gdb.arch/powerpc-tar.c
+++ b/gdb/testsuite/gdb.arch/powerpc-tar.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-tar.exp b/gdb/testsuite/gdb.arch/powerpc-tar.exp
index 863001d..917d759 100644
--- a/gdb/testsuite/gdb.arch/powerpc-tar.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-tar.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -68,9 +68,9 @@ proc tar_available {} {
# Do one pass to check if TAR is usable, system
# software can prevent it from being used.
with_test_prefix "check TAR access" {
- clean_restart $binfile
+ clean_restart $::testfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -84,9 +84,9 @@ with_test_prefix "check TAR access" {
}
# Now do the actual test
-clean_restart $binfile
+clean_restart $::testfile
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.arch/powerpc-trap.exp b/gdb/testsuite/gdb.arch/powerpc-trap.exp
index 32cfce4..04d76f5 100644
--- a/gdb/testsuite/gdb.arch/powerpc-trap.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-trap.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-trap.s b/gdb/testsuite/gdb.arch/powerpc-trap.s
index a7671ef..0d21a47 100644
--- a/gdb/testsuite/gdb.arch/powerpc-trap.s
+++ b/gdb/testsuite/gdb.arch/powerpc-trap.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-vector-regs.c b/gdb/testsuite/gdb.arch/powerpc-vector-regs.c
index 474803e..64160c5 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vector-regs.c
+++ b/gdb/testsuite/gdb.arch/powerpc-vector-regs.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp b/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp
index 7f3ecf6..4537646 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2024 Free Software Foundation, Inc.
+# Copyright (C) 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable {debug}]
}
# Check if our test binary can actually run on this processor.
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_run_cmd
@@ -44,7 +44,7 @@ gdb_test_multiple "" "wait for exit" {
}
# Run the actual test.
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_breakpoint [gdb_get_line_number "marker"]
diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp b/gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp
index 51ad038..db568c6 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ if {[build_executable "compile" $binfile $gen_src] == -1} {
return -1
}
-clean_restart $binfile
+clean_restart $testfile
if {![runto_main]} {
return -1
diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx.exp b/gdb/testsuite/gdb.arch/powerpc-vsx.exp
index 6ca48d1..27f2bd0 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vsx.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-vsx.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}]
return -1
}
-clean_restart ${objfile}
+clean_restart
+gdb_load $objfile
# Disassemble the function.
set func ""
@@ -51,7 +52,7 @@ proc func_check {instr} {
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx.s b/gdb/testsuite/gdb.arch/powerpc-vsx.s
index 1446dc9..167a260 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vsx.s
+++ b/gdb/testsuite/gdb.arch/powerpc-vsx.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx2.exp b/gdb/testsuite/gdb.arch/powerpc-vsx2.exp
index 6ebaddb..ec09815 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vsx2.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-vsx2.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}]
return -1
}
-clean_restart ${objfile}
+clean_restart
+gdb_load $objfile
# Disassemble the function.
set func ""
@@ -51,7 +52,7 @@ proc func_check {instr} {
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx2.s b/gdb/testsuite/gdb.arch/powerpc-vsx2.s
index 1e6ddc4..d271d18 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vsx2.s
+++ b/gdb/testsuite/gdb.arch/powerpc-vsx2.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx3.exp b/gdb/testsuite/gdb.arch/powerpc-vsx3.exp
index 1bce934..5aeed8e 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vsx3.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-vsx3.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}]
return -1
}
-clean_restart ${objfile}
+clean_restart
+gdb_load $objfile
# Disassemble the function.
set func ""
@@ -51,7 +52,7 @@ proc func_check {instr} {
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx3.s b/gdb/testsuite/gdb.arch/powerpc-vsx3.s
index 3cbe575..524d199 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vsx3.s
+++ b/gdb/testsuite/gdb.arch/powerpc-vsx3.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc64-prologue.c b/gdb/testsuite/gdb.arch/powerpc64-prologue.c
index 9afce87..86bf7e5 100644
--- a/gdb/testsuite/gdb.arch/powerpc64-prologue.c
+++ b/gdb/testsuite/gdb.arch/powerpc64-prologue.c
@@ -1,6 +1,6 @@
/* Unwinder test program.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/powerpc64-prologue.exp b/gdb/testsuite/gdb.arch/powerpc64-prologue.exp
index cb53f14..a5401a3 100644
--- a/gdb/testsuite/gdb.arch/powerpc64-prologue.exp
+++ b/gdb/testsuite/gdb.arch/powerpc64-prologue.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/powerpc64-trap.s b/gdb/testsuite/gdb.arch/powerpc64-trap.s
index 76b06cc..45bf002 100644
--- a/gdb/testsuite/gdb.arch/powerpc64-trap.s
+++ b/gdb/testsuite/gdb.arch/powerpc64-trap.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/ppc-dfp.c b/gdb/testsuite/gdb.arch/ppc-dfp.c
index 37b2014..1b5cf6a 100644
--- a/gdb/testsuite/gdb.arch/ppc-dfp.c
+++ b/gdb/testsuite/gdb.arch/ppc-dfp.c
@@ -1,4 +1,4 @@
-/* Copyright 2008-2024 Free Software Foundation, Inc.
+/* Copyright 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/ppc-dfp.exp b/gdb/testsuite/gdb.arch/ppc-dfp.exp
index 476ac21..3c3b030 100644
--- a/gdb/testsuite/gdb.arch/ppc-dfp.exp
+++ b/gdb/testsuite/gdb.arch/ppc-dfp.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require {istarget "powerpc*"}
standard_testfile
-if ![test_compiler_info gcc*] {
+if {![test_compiler_info gcc*]} {
# We use GCC's extended asm syntax
warning "unknown compiler"
return -1
@@ -31,7 +31,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {quie
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
gdb_breakpoint [gdb_get_line_number "Set DFP rounding mode."]
diff --git a/gdb/testsuite/gdb.arch/ppc-fp.c b/gdb/testsuite/gdb.arch/ppc-fp.c
index 23fb8b5..f5fc4a3 100644
--- a/gdb/testsuite/gdb.arch/ppc-fp.c
+++ b/gdb/testsuite/gdb.arch/ppc-fp.c
@@ -1,4 +1,4 @@
-/* Copyright 2008-2024 Free Software Foundation, Inc.
+/* Copyright 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/ppc-fp.exp b/gdb/testsuite/gdb.arch/ppc-fp.exp
index 1f4e953..b8b3f00 100644
--- a/gdb/testsuite/gdb.arch/ppc-fp.exp
+++ b/gdb/testsuite/gdb.arch/ppc-fp.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ require {istarget "powerpc*"}
standard_testfile
-if ![test_compiler_info gcc*] {
+if {![test_compiler_info gcc*]} {
# We use GCC's extended asm syntax
warning "unknown compiler"
return -1
@@ -31,7 +31,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {quie
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
gdb_breakpoint [gdb_get_line_number "Invalid operation."]
gdb_breakpoint [gdb_get_line_number "Division by zero."]
diff --git a/gdb/testsuite/gdb.arch/ppc-longdouble.c b/gdb/testsuite/gdb.arch/ppc-longdouble.c
index 54ebc9c..cfcd861 100644
--- a/gdb/testsuite/gdb.arch/ppc-longdouble.c
+++ b/gdb/testsuite/gdb.arch/ppc-longdouble.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/ppc-longdouble.exp b/gdb/testsuite/gdb.arch/ppc-longdouble.exp
index f9345fe..739e36f 100644
--- a/gdb/testsuite/gdb.arch/ppc-longdouble.exp
+++ b/gdb/testsuite/gdb.arch/ppc-longdouble.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ proc do_test { name {opts {}} } {
return
}
- clean_restart ${binfile}.${name}
+ clean_restart ${::testfile}.${name}
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.S b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.S
index 3d07cb8..c4366aa 100644
--- a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.S
+++ b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.S
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp
index 9bd0235..a6ceb0f 100644
--- a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp
+++ b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c
index 70e40be..4c428d2 100644
--- a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c
+++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c
index a4e7c0a..1863862 100644
--- a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c
+++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp
index f91bebe..35b442f 100644
--- a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp
+++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
require {istarget "powerpc*"} is_lp64_target
set flags { nodebug }
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
standard_testfile .c -main.c
lappend flags optimize=-O2
lappend flags additional_flags=-fno-stack-protector
diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s
index 4071037..5923584 100644
--- a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s
+++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.S b/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.S
index ddb7413..0c338e5 100644
--- a/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.S
+++ b/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.S
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.c b/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.c
index 666e0ee..0f19080 100644
--- a/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.c
+++ b/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.c
@@ -1,4 +1,4 @@
-/* Copyright 2017-2024 Free Software Foundation, Inc.
+/* Copyright 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.exp b/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.exp
index f150efc..62791ce 100644
--- a/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.exp
+++ b/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp b/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
index fe388fe..6fd8486 100644
--- a/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
+++ b/gdb/testsuite/gdb.arch/ppc64-symtab-cordic.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/pr25124.S b/gdb/testsuite/gdb.arch/pr25124.S
index 0b6f94b..a41db83 100644
--- a/gdb/testsuite/gdb.arch/pr25124.S
+++ b/gdb/testsuite/gdb.arch/pr25124.S
@@ -1,7 +1,7 @@
/* Test proper disassembling of ARM thumb instructions when reloading a symbol
file.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/pr25124.exp b/gdb/testsuite/gdb.arch/pr25124.exp
index 26cfc13..4e7c114 100644
--- a/gdb/testsuite/gdb.arch/pr25124.exp
+++ b/gdb/testsuite/gdb.arch/pr25124.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug
return -1
}
-clean_restart $binfile
+clean_restart $testfile
# Check if the disassemble ouput is correct.
gdb_test "x /i main+8" \
diff --git a/gdb/testsuite/gdb.arch/riscv-bp-infcall.c b/gdb/testsuite/gdb.arch/riscv-bp-infcall.c
index 57d4f75..b910419 100644
--- a/gdb/testsuite/gdb.arch/riscv-bp-infcall.c
+++ b/gdb/testsuite/gdb.arch/riscv-bp-infcall.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv-bp-infcall.exp b/gdb/testsuite/gdb.arch/riscv-bp-infcall.exp
index 46b1bc8..39aa793 100644
--- a/gdb/testsuite/gdb.arch/riscv-bp-infcall.exp
+++ b/gdb/testsuite/gdb.arch/riscv-bp-infcall.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if {![runto_main]} {
# Figure out where the breakpoint will be placed taking account for
# stack alignment, and allocation of the dummy code area.
set bp_addr [get_valueof "/x" "\$sp" 0]
-set bp_addr [format 0x%x [expr ($bp_addr & ~0xf) - 0x20]]
+set bp_addr [format 0x%x [expr {($bp_addr & ~0xf) - 0x20}]]
# Fill the region we know will be used as the scratch area with the
# compressed nop instruction. If GDB fails to overwrite this with an
diff --git a/gdb/testsuite/gdb.arch/riscv-default-tdesc.exp b/gdb/testsuite/gdb.arch/riscv-default-tdesc.exp
index fcffdc6..023b270 100644
--- a/gdb/testsuite/gdb.arch/riscv-default-tdesc.exp
+++ b/gdb/testsuite/gdb.arch/riscv-default-tdesc.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv-info-fcsr.c b/gdb/testsuite/gdb.arch/riscv-info-fcsr.c
index b4ccf93..39f0d62 100644
--- a/gdb/testsuite/gdb.arch/riscv-info-fcsr.c
+++ b/gdb/testsuite/gdb.arch/riscv-info-fcsr.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp b/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp
index d270e40..358544f 100644
--- a/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp
+++ b/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ if {![runto_main]} {
# that can be written to the fcsr register. The two arguments should
# be the value of each of the two fields within the fcsr register.
proc merge_fflags_and_frm { fflags_value frm_value } {
- set fcsr_value 0x[format %x [expr $fflags_value | ($frm_value << 5)]]
+ set fcsr_value 0x[format %x [expr {$fflags_value | ($frm_value << 5)}]]
return $fcsr_value
}
@@ -48,11 +48,11 @@ proc check_fcsr { fflags_value frm_value frm_string } {
set frm_str_re [string_to_regexp "$frm_string"]
set frm_val_re [format %d ${frm_value}]
- set nv [format %d [expr ($fflags_value >> 4) & 0x1]]
- set dz [format %d [expr ($fflags_value >> 3) & 0x1]]
- set of [format %d [expr ($fflags_value >> 2) & 0x1]]
- set uf [format %d [expr ($fflags_value >> 1) & 0x1]]
- set nx [format %d [expr ($fflags_value >> 0) & 0x1]]
+ set nv [format %d [expr {($fflags_value >> 4) & 0x1}]]
+ set dz [format %d [expr {($fflags_value >> 3) & 0x1}]]
+ set of [format %d [expr {($fflags_value >> 2) & 0x1}]]
+ set uf [format %d [expr {($fflags_value >> 1) & 0x1}]]
+ set nx [format %d [expr {($fflags_value >> 0) & 0x1}]]
set fflags_pattern "NV:${nv} DZ:${dz} OF:${of} UF:${uf} NX:${nx}"
set frm_pattern "FRM:${frm_val_re} \\\[${frm_str_re}\\\]"
diff --git a/gdb/testsuite/gdb.arch/riscv-reg-aliases.c b/gdb/testsuite/gdb.arch/riscv-reg-aliases.c
index 7ba3b41..16a0466 100644
--- a/gdb/testsuite/gdb.arch/riscv-reg-aliases.c
+++ b/gdb/testsuite/gdb.arch/riscv-reg-aliases.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv-reg-aliases.exp b/gdb/testsuite/gdb.arch/riscv-reg-aliases.exp
index b3d7c9d..c005ca9 100644
--- a/gdb/testsuite/gdb.arch/riscv-reg-aliases.exp
+++ b/gdb/testsuite/gdb.arch/riscv-reg-aliases.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv-tdesc-loading.exp b/gdb/testsuite/gdb.arch/riscv-tdesc-loading.exp
index 1cf9848..721b76e 100644
--- a/gdb/testsuite/gdb.arch/riscv-tdesc-loading.exp
+++ b/gdb/testsuite/gdb.arch/riscv-tdesc-loading.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv-tdesc-regs.c b/gdb/testsuite/gdb.arch/riscv-tdesc-regs.c
index 27a14b7..65b18bc 100644
--- a/gdb/testsuite/gdb.arch/riscv-tdesc-regs.c
+++ b/gdb/testsuite/gdb.arch/riscv-tdesc-regs.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp b/gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp
index 58859d1..55bb4ec 100644
--- a/gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp
+++ b/gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv-unwind-long-insn.S b/gdb/testsuite/gdb.arch/riscv-unwind-long-insn.S
index b8a35e8..11549eb 100644
--- a/gdb/testsuite/gdb.arch/riscv-unwind-long-insn.S
+++ b/gdb/testsuite/gdb.arch/riscv-unwind-long-insn.S
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv-unwind-long-insn.c b/gdb/testsuite/gdb.arch/riscv-unwind-long-insn.c
index 66a3e9a..fc88313 100644
--- a/gdb/testsuite/gdb.arch/riscv-unwind-long-insn.c
+++ b/gdb/testsuite/gdb.arch/riscv-unwind-long-insn.c
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv-unwind-long-insn.exp b/gdb/testsuite/gdb.arch/riscv-unwind-long-insn.exp
index e57c0ea..b0ab2b0 100644
--- a/gdb/testsuite/gdb.arch/riscv-unwind-long-insn.exp
+++ b/gdb/testsuite/gdb.arch/riscv-unwind-long-insn.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li-foo.s b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li-foo.s
index b9a8bea..281b877 100644
--- a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li-foo.s
+++ b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li-foo.s
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.c b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.c
index 0d14cef..0309d43 100644
--- a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.c
+++ b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.exp b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.exp
index 7a18357..6be9ba9 100644
--- a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.exp
+++ b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw-foo.s b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw-foo.s
index af01afd..a8b0dd3 100644
--- a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw-foo.s
+++ b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw-foo.s
@@ -1,4 +1,4 @@
-/* Copyright 2021-2024 Free Software Foundation, Inc.
+/* Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw.c b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw.c
index 82f2ec5..20af541 100644
--- a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw.c
+++ b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw.c
@@ -1,4 +1,4 @@
-/* Copyright 2021-2024 Free Software Foundation, Inc.
+/* Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw.exp b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw.exp
index 36762f1..219feaf 100644
--- a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw.exp
+++ b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.c b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.c
index f3f2217..dd8b676 100644
--- a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.c
+++ b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.c
@@ -1,4 +1,4 @@
-/* Copyright 2021-2024 Free Software Foundation, Inc.
+/* Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.exp b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.exp
index 1010e3e..aa74972 100644
--- a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.exp
+++ b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.s b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.s
index a5e2bda..b1290bd 100644
--- a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.s
+++ b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.s
@@ -1,4 +1,4 @@
-/* Copyright 2021-2024 Free Software Foundation, Inc.
+/* Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/s390-disassembler-options.exp b/gdb/testsuite/gdb.arch/s390-disassembler-options.exp
index c75ee35..f71f114 100644
--- a/gdb/testsuite/gdb.arch/s390-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/s390-disassembler-options.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/s390-multiarch.c b/gdb/testsuite/gdb.arch/s390-multiarch.c
index f88b307..8eaf017 100644
--- a/gdb/testsuite/gdb.arch/s390-multiarch.c
+++ b/gdb/testsuite/gdb.arch/s390-multiarch.c
@@ -1,4 +1,4 @@
-/* Copyright 2013-2024 Free Software Foundation, Inc.
+/* Copyright 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/s390-multiarch.exp b/gdb/testsuite/gdb.arch/s390-multiarch.exp
index 7483a35..1125275 100644
--- a/gdb/testsuite/gdb.arch/s390-multiarch.exp
+++ b/gdb/testsuite/gdb.arch/s390-multiarch.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/s390-stackless.S b/gdb/testsuite/gdb.arch/s390-stackless.S
index 8b23ffd..ebe8ad8 100644
--- a/gdb/testsuite/gdb.arch/s390-stackless.S
+++ b/gdb/testsuite/gdb.arch/s390-stackless.S
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/s390-stackless.exp b/gdb/testsuite/gdb.arch/s390-stackless.exp
index 247d7a4..83f5126 100644
--- a/gdb/testsuite/gdb.arch/s390-stackless.exp
+++ b/gdb/testsuite/gdb.arch/s390-stackless.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/s390-tdbregs.c b/gdb/testsuite/gdb.arch/s390-tdbregs.c
index 6b20072..9de36d4 100644
--- a/gdb/testsuite/gdb.arch/s390-tdbregs.c
+++ b/gdb/testsuite/gdb.arch/s390-tdbregs.c
@@ -1,4 +1,4 @@
-/* Copyright 2008-2024 Free Software Foundation, Inc.
+/* Copyright 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/s390-tdbregs.exp b/gdb/testsuite/gdb.arch/s390-tdbregs.exp
index 2452858..2f4d4a3 100644
--- a/gdb/testsuite/gdb.arch/s390-tdbregs.exp
+++ b/gdb/testsuite/gdb.arch/s390-tdbregs.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/s390-vregs.S b/gdb/testsuite/gdb.arch/s390-vregs.S
index 8111ded..a730aa4 100644
--- a/gdb/testsuite/gdb.arch/s390-vregs.S
+++ b/gdb/testsuite/gdb.arch/s390-vregs.S
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/s390-vregs.exp b/gdb/testsuite/gdb.arch/s390-vregs.exp
index f83b3b0..9ee959b 100644
--- a/gdb/testsuite/gdb.arch/s390-vregs.exp
+++ b/gdb/testsuite/gdb.arch/s390-vregs.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ require {is_any_target s390-*-* s390x-*-*}
standard_testfile .S
-if [isnative] {
+if {[isnative]} {
# Create a temporary directory, to take a core dump there later.
set coredir [standard_output_file ${testfile}.d]
remote_exec build "rm -rf $coredir"
@@ -31,7 +31,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -71,7 +71,7 @@ gdb_test_multiple "x/i \$pc" "get PC after vector insn" {
}
}
-if [expr $before_pc + 6 != $after_pc] {
+if {$before_pc + 6 != $after_pc} {
fail "stepping first vector insn"
}
@@ -93,17 +93,17 @@ set a_low 2
set b_high 3
set b_low 5
-set a [expr ($a_high << 32) | $a_low]
-set b [expr ($b_high << 32) | $b_low]
+set a [expr {($a_high << 32) | $a_low}]
+set b [expr {($b_high << 32) | $b_low}]
for {set j 0} {$j < 32} {incr j 1} {
- set i [expr 17 * $j % 32]
+ set i [expr {17 * $j % 32}]
gdb_test_no_output \
- "set \$v$i.v2_int64\[0\] = [expr $a * ($i + 1)]" \
+ "set \$v$i.v2_int64\[0\] = [expr {$a * ($i + 1)}]" \
"set v$i left"
- set i [expr 19 * (31 - $j) % 32]
+ set i [expr {19 * (31 - $j) % 32}]
gdb_test_no_output \
- "set \$v$i.v2_int64\[1\] = [expr $b * (32 - $i)]" \
+ "set \$v$i.v2_int64\[1\] = [expr {$b * (32 - $i)}]" \
"set v$i right"
}
@@ -121,7 +121,7 @@ set vregs [capture_command_output "x/64xg &save_area" ""]
set i 0
foreach {- left right} [regexp -all -inline -line {^.*:\s+(\w+)\s+(\w+)} $vregs] {
- if [expr $left != $a * ($i + 1) || $right != $b * (32 - $i)] {
+ if {$left != $a * ($i + 1) || $right != $b * (32 - $i)} {
fail "verify \$v$i after set"
}
if { $i < 16 } {
@@ -157,10 +157,10 @@ foreach {- r i val} [regexp -all -inline -line \
if { $r ne "v" } {
fail "info registers vector: bad line $j"
} elseif { $val ne [hex128 \
- [expr $a_high * ($i + 1) * $a_high ] \
- [expr $a_low * ($i + 1) * $a_low ] \
- [expr $b_high * (32 - $i) * $b_high * 32] \
- [expr $b_low * (32 - $i) * $b_low * 32] ] } {
+ [expr {$a_high * ($i + 1) * $a_high }] \
+ [expr {$a_low * ($i + 1) * $a_low }] \
+ [expr {$b_high * (32 - $i) * $b_high * 32}] \
+ [expr {$b_low * (32 - $i) * $b_low * 32}] ] } {
fail "compare \$v$i"
}
incr j 1
diff --git a/gdb/testsuite/gdb.arch/skip-prologue.c b/gdb/testsuite/gdb.arch/skip-prologue.c
index 08ceacb..a8234d7 100644
--- a/gdb/testsuite/gdb.arch/skip-prologue.c
+++ b/gdb/testsuite/gdb.arch/skip-prologue.c
@@ -1,4 +1,4 @@
-/* Copyright 2024 Free Software Foundation, Inc.
+/* Copyright 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/skip-prologue.exp b/gdb/testsuite/gdb.arch/skip-prologue.exp
index 89d2225..26fd022 100644
--- a/gdb/testsuite/gdb.arch/skip-prologue.exp
+++ b/gdb/testsuite/gdb.arch/skip-prologue.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -48,7 +48,7 @@ proc do_test { f } {
}
set test {$bp_addr == $prologue_end_addr}
- if { [expr $test] } {
+ if {$bp_addr == $prologue_end_addr} {
pass $test
} elseif { $bp_addr < $prologue_end_addr } {
# We'll allow this. For instance, amd64 has a prologue
diff --git a/gdb/testsuite/gdb.arch/sparc-sysstep.c b/gdb/testsuite/gdb.arch/sparc-sysstep.c
index b4d15ea..4324f44 100644
--- a/gdb/testsuite/gdb.arch/sparc-sysstep.c
+++ b/gdb/testsuite/gdb.arch/sparc-sysstep.c
@@ -1,6 +1,6 @@
/* Test single-stepping system call instructions in sparc.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/sparc-sysstep.exp b/gdb/testsuite/gdb.arch/sparc-sysstep.exp
index 3f30640..2a5c194 100644
--- a/gdb/testsuite/gdb.arch/sparc-sysstep.exp
+++ b/gdb/testsuite/gdb.arch/sparc-sysstep.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,11 +28,11 @@ set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
set opts {}
-if {[prepare_for_testing "failed to prepare" ${binfile} $srcfile {additional_flags=-g}]} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {additional_flags=-g}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/sparc64-adi.c b/gdb/testsuite/gdb.arch/sparc64-adi.c
index 97f6a99..b1c7eb4 100644
--- a/gdb/testsuite/gdb.arch/sparc64-adi.c
+++ b/gdb/testsuite/gdb.arch/sparc64-adi.c
@@ -1,6 +1,6 @@
/* Application Data Integrity (ADI) test in sparc64.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/sparc64-adi.exp b/gdb/testsuite/gdb.arch/sparc64-adi.exp
index 64cf6b7..40a8eab 100644
--- a/gdb/testsuite/gdb.arch/sparc64-adi.exp
+++ b/gdb/testsuite/gdb.arch/sparc64-adi.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
# This file is part of the gdb testsuite.
-# Basic tests of examining/assigning ADI version tags, and reporting
+# Basic tests of examining/assigning ADI version tags, and reporting
# precise mismatch.
require {istarget "sparc64*-*-linux*"}
diff --git a/gdb/testsuite/gdb.arch/sparc64-regs.S b/gdb/testsuite/gdb.arch/sparc64-regs.S
index c09cffb..b4df1cf 100644
--- a/gdb/testsuite/gdb.arch/sparc64-regs.S
+++ b/gdb/testsuite/gdb.arch/sparc64-regs.S
@@ -1,4 +1,4 @@
-/* Copyright 2017-2024 Free Software Foundation, Inc.
+/* Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/sparc64-regs.exp b/gdb/testsuite/gdb.arch/sparc64-regs.exp
index a5ef9e9..f5b7309 100644
--- a/gdb/testsuite/gdb.arch/sparc64-regs.exp
+++ b/gdb/testsuite/gdb.arch/sparc64-regs.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/thumb-bx-pc.S b/gdb/testsuite/gdb.arch/thumb-bx-pc.S
index eee1268..7052cc3 100644
--- a/gdb/testsuite/gdb.arch/thumb-bx-pc.S
+++ b/gdb/testsuite/gdb.arch/thumb-bx-pc.S
@@ -1,6 +1,6 @@
/* Test PC adjustment from Thumb-mode "bx pc" instruction.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/thumb-bx-pc.exp b/gdb/testsuite/gdb.arch/thumb-bx-pc.exp
index 71aa026..e5699d7 100644
--- a/gdb/testsuite/gdb.arch/thumb-bx-pc.exp
+++ b/gdb/testsuite/gdb.arch/thumb-bx-pc.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ set testfile "thumb-bx-pc"
set srcfile ${testfile}.S
set opts {}
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/thumb-prologue.c b/gdb/testsuite/gdb.arch/thumb-prologue.c
index a0aa9ac..b9b3862 100644
--- a/gdb/testsuite/gdb.arch/thumb-prologue.c
+++ b/gdb/testsuite/gdb.arch/thumb-prologue.c
@@ -1,6 +1,6 @@
/* Unwinder test program.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/thumb-prologue.exp b/gdb/testsuite/gdb.arch/thumb-prologue.exp
index 53e6b4e..2ee82fb 100644
--- a/gdb/testsuite/gdb.arch/thumb-prologue.exp
+++ b/gdb/testsuite/gdb.arch/thumb-prologue.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {"add
}
-clean_restart $binfile
+clean_restart $testfile
#
# Run to `main' where we begin our tests.
diff --git a/gdb/testsuite/gdb.arch/thumb-singlestep.S b/gdb/testsuite/gdb.arch/thumb-singlestep.S
index a172273..4e4cff3 100644
--- a/gdb/testsuite/gdb.arch/thumb-singlestep.S
+++ b/gdb/testsuite/gdb.arch/thumb-singlestep.S
@@ -1,6 +1,6 @@
/* Test program with deliberately incorrect execution mode transition
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/thumb-singlestep.exp b/gdb/testsuite/gdb.arch/thumb-singlestep.exp
index d1d4a44..88fe49b 100644
--- a/gdb/testsuite/gdb.arch/thumb-singlestep.exp
+++ b/gdb/testsuite/gdb.arch/thumb-singlestep.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ set testfile "thumb-singlestep"
set srcfile ${testfile}.S
set additional_flags "additional_flags=-mthumb"
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} [list debug $additional_flags]] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} [list debug $additional_flags]]} {
return -1
}
diff --git a/gdb/testsuite/gdb.arch/thumb2-it.S b/gdb/testsuite/gdb.arch/thumb2-it.S
index 8f81b35..64a594e 100644
--- a/gdb/testsuite/gdb.arch/thumb2-it.S
+++ b/gdb/testsuite/gdb.arch/thumb2-it.S
@@ -1,6 +1,6 @@
/* Thumb-2 IT blocks test program.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/thumb2-it.exp b/gdb/testsuite/gdb.arch/thumb2-it.exp
index dadf063..e6ef06d 100644
--- a/gdb/testsuite/gdb.arch/thumb2-it.exp
+++ b/gdb/testsuite/gdb.arch/thumb2-it.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug
return -1
}
-clean_restart $binfile
+clean_restart $testfile
if {![runto_main]} {
return -1
diff --git a/gdb/testsuite/gdb.arch/vsx-regs.exp b/gdb/testsuite/gdb.arch/vsx-regs.exp
index 4e48e6e..a6ecbfd 100644
--- a/gdb/testsuite/gdb.arch/vsx-regs.exp
+++ b/gdb/testsuite/gdb.arch/vsx-regs.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,9 +24,9 @@ require {istarget "powerpc*"} allow_vsx_tests
standard_testfile
set compile_flags {debug nowarnings quiet}
-if [test_compiler_info gcc*] {
+if {[test_compiler_info gcc*]} {
set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec"
-} elseif [test_compiler_info xlc*] {
+} elseif {[test_compiler_info xlc*]} {
set compile_flags "$compile_flags additional_flags=-qaltivec"
} else {
warning "unknown compiler"
@@ -184,7 +184,8 @@ if {!$core_supported} {
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
set core_loaded [gdb_core_cmd "$corefile" "re-load generated corefile"]
if { $core_loaded == -1 } {
diff --git a/gdb/testsuite/gdb.arch/vsx-vsr-float28.c b/gdb/testsuite/gdb.arch/vsx-vsr-float28.c
index 0d7e683..f65b981 100644
--- a/gdb/testsuite/gdb.arch/vsx-vsr-float28.c
+++ b/gdb/testsuite/gdb.arch/vsx-vsr-float28.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp b/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp
index 49d4916..76c38ff 100644
--- a/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp
+++ b/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,9 +23,9 @@ require {istarget "powerpc*"} allow_vsx_tests
standard_testfile
set compile_flags {debug nowarnings quiet}
-if [test_compiler_info gcc*] {
+if {[test_compiler_info gcc*]} {
set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec"
-} elseif [test_compiler_info xlc*] {
+} elseif {[test_compiler_info xlc*]} {
set compile_flags "$compile_flags additional_flags=-qaltivec"
} else {
warning "unknown compiler"
diff --git a/gdb/testsuite/gdb.arch/x86-avx512bf16.c b/gdb/testsuite/gdb.arch/x86-avx512bf16.c
index 81a57a9..cae98fa 100644
--- a/gdb/testsuite/gdb.arch/x86-avx512bf16.c
+++ b/gdb/testsuite/gdb.arch/x86-avx512bf16.c
@@ -1,6 +1,6 @@
/* Test program for bfloat16 of AVX 512 registers.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/x86-avx512bf16.exp b/gdb/testsuite/gdb.arch/x86-avx512bf16.exp
index 6059b04..5d39cc7 100644
--- a/gdb/testsuite/gdb.arch/x86-avx512bf16.exp
+++ b/gdb/testsuite/gdb.arch/x86-avx512bf16.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/x86-avx512fp16-abi.c b/gdb/testsuite/gdb.arch/x86-avx512fp16-abi.c
index 42800d7..a96e373 100644
--- a/gdb/testsuite/gdb.arch/x86-avx512fp16-abi.c
+++ b/gdb/testsuite/gdb.arch/x86-avx512fp16-abi.c
@@ -1,6 +1,6 @@
/* Test program for _Float16 parameters and return values.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/x86-avx512fp16-abi.exp b/gdb/testsuite/gdb.arch/x86-avx512fp16-abi.exp
index 40de576..92a68a8 100644
--- a/gdb/testsuite/gdb.arch/x86-avx512fp16-abi.exp
+++ b/gdb/testsuite/gdb.arch/x86-avx512fp16-abi.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.arch/x86-avx512fp16.c b/gdb/testsuite/gdb.arch/x86-avx512fp16.c
index 9613eca..d124ddd 100644
--- a/gdb/testsuite/gdb.arch/x86-avx512fp16.c
+++ b/gdb/testsuite/gdb.arch/x86-avx512fp16.c
@@ -1,6 +1,6 @@
/* Test program for bfloat16 of AVX 512 registers.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.arch/x86-avx512fp16.exp b/gdb/testsuite/gdb.arch/x86-avx512fp16.exp
index 89c080f..ac22086 100644
--- a/gdb/testsuite/gdb.arch/x86-avx512fp16.exp
+++ b/gdb/testsuite/gdb.arch/x86-avx512fp16.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c b/gdb/testsuite/gdb.arch/x86-set-solib-absolute-prefix.c
index 685a22e..685a22e 100644
--- a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c
+++ b/gdb/testsuite/gdb.arch/x86-set-solib-absolute-prefix.c
diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp b/gdb/testsuite/gdb.arch/x86-set-solib-absolute-prefix.exp
index cf74789..cf74789 100644
--- a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp
+++ b/gdb/testsuite/gdb.arch/x86-set-solib-absolute-prefix.exp
diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
index 80c48ea..eb96c19 100644
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -1,5 +1,5 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
-#
+# Copyright 1998-2025 Free Software Foundation, Inc.
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -184,7 +184,7 @@ if {[istarget "*-*-openbsd*"]} {
# built with different defaults. So no matter what we do, we lose. We may as
# well get out of this test sooner rather than later.
set dest [target_info name]
-if [board_info $dest exists multilib_flags] {
+if {[board_info $dest exists multilib_flags]} {
set multilib_flags [board_info $dest multilib_flags]
if { "${multilib_flags}" != "" } {
untested "failed to compile"
@@ -269,16 +269,16 @@ if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } {
}
# Collect some line numbers.
-set line_enter [expr [gdb_get_line_number "main enter" "asmsrc1.s"] + 1]
-set line_main [expr [gdb_get_line_number "main start" "asmsrc1.s"] + 1]
-set line_call_foo2 [expr [gdb_get_line_number "call foo2" "asmsrc1.s"] + 1]
-set line_search_comment [expr [gdb_get_line_number "search" "asmsrc1.s"] + 1]
-set line_foo3 [expr [gdb_get_line_number "foo3 start" "asmsrc1.s"] + 1]
-set line_main_exit [expr [gdb_get_line_number "main exit" "asmsrc1.s"] + 1]
-set line_foo2 [expr [gdb_get_line_number "foo2 start" "asmsrc2.s"] + 1]
-set line_call_foo3 [expr [gdb_get_line_number "call foo3" "asmsrc2.s"] + 1]
-set line_call_foo3_again [expr $line_call_foo3 + 1]
-set line_foo2_leave [expr [gdb_get_line_number "foo2 leave" "asmsrc2.s"] + 1]
+set line_enter [expr {[gdb_get_line_number "main enter" "asmsrc1.s"] + 1}]
+set line_main [expr {[gdb_get_line_number "main start" "asmsrc1.s"] + 1}]
+set line_call_foo2 [expr {[gdb_get_line_number "call foo2" "asmsrc1.s"] + 1}]
+set line_search_comment [expr {[gdb_get_line_number "search" "asmsrc1.s"] + 1}]
+set line_foo3 [expr {[gdb_get_line_number "foo3 start" "asmsrc1.s"] + 1}]
+set line_main_exit [expr {[gdb_get_line_number "main exit" "asmsrc1.s"] + 1}]
+set line_foo2 [expr {[gdb_get_line_number "foo2 start" "asmsrc2.s"] + 1}]
+set line_call_foo3 [expr {[gdb_get_line_number "call foo3" "asmsrc2.s"] + 1}]
+set line_call_foo3_again [expr {$line_call_foo3 + 1}]
+set line_foo2_leave [expr {[gdb_get_line_number "foo2 leave" "asmsrc2.s"] + 1}]
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
@@ -346,7 +346,7 @@ gdb_test "f" ".*asmsrc2\[.\]s:$line_foo2.*" "f in foo2"
# `next' one insn (or macro) to set up our stackframe (for the following bt).
gdb_test "n" "$line_call_foo3\[ \]*.*foo3" "n in foo2"
-# See if a simple `bt' prints the right source files and
+# See if a simple `bt' prints the right source files and
# doesn't fall off the stack.
gdb_test "bt 10" \
@@ -405,7 +405,7 @@ gdb_test_multiple "info sources" "info sources" {
set seen_asmsrc_2 1
exp_continue
}
- -re ", " {
+ -re ", " {
exp_continue
}
-re "$gdb_prompt $" {
@@ -416,7 +416,7 @@ gdb_test_multiple "info sources" "info sources" {
}
}
}
-
+
# Try 'info line'
gdb_test "info line" \
diff --git a/gdb/testsuite/gdb.base/a2-run.exp b/gdb/testsuite/gdb.base/a2-run.exp
index f366144..0df7558 100644
--- a/gdb/testsuite/gdb.base/a2-run.exp
+++ b/gdb/testsuite/gdb.base/a2-run.exp
@@ -1,4 +1,4 @@
-# Copyright 1988-2024 Free Software Foundation, Inc.
+# Copyright 1988-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,6 +18,8 @@
# Can't do this test without stdio support.
require {!gdb_skip_stdio_test "a2run.exp"}
+set have_startup_shell [have_startup_shell]
+
#
# test running programs
#
@@ -153,7 +155,7 @@ gdb_test_stdio "" "usage: factorial <number>" "" "run after setting args to nil
# work with stub targets, where GDB connects to debug an already started
# process.
-if [use_gdb_stub] {
+if {[use_gdb_stub]} {
verbose "Skipping rest of a2-run.exp because target is a stub."
return
}
@@ -166,9 +168,8 @@ gdb_run_cmd
setup_xfail "arm-*-coff"
gdb_test_stdio "" "720" "" "run \"$testfile\" again after setting args"
-# GOAL: Test that shell is being used with "run". For remote debugging
-# targets, there is no guarantee that a "shell" (whatever that is) is used.
-if {![is_remote target]} {
+# GOAL: Test that shell is being used with "run".
+if { $have_startup_shell == 1 } {
gdb_test_stdio "run `echo 8`" \
"40320" "" "run \"$testfile\" with shell"
}
diff --git a/gdb/testsuite/gdb.base/access-mem-running.c b/gdb/testsuite/gdb.base/access-mem-running.c
index 51f94c6..8408efb 100644
--- a/gdb/testsuite/gdb.base/access-mem-running.c
+++ b/gdb/testsuite/gdb.base/access-mem-running.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/access-mem-running.exp b/gdb/testsuite/gdb.base/access-mem-running.exp
index 821cdd0..ca30ec2 100644
--- a/gdb/testsuite/gdb.base/access-mem-running.exp
+++ b/gdb/testsuite/gdb.base/access-mem-running.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,10 +32,11 @@ proc test { non_stop } {
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"set non-stop $non_stop\""
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -113,7 +114,7 @@ proc test { non_stop } {
}
foreach non_stop { "off" "on" } {
- set stop_mode [expr ($non_stop=="off")?"all-stop":"non-stop"]
+ set stop_mode [expr {($non_stop=="off")?"all-stop":"non-stop"}]
with_test_prefix "$stop_mode" {
test $non_stop
}
diff --git a/gdb/testsuite/gdb.base/add-symbol-file-attach.c b/gdb/testsuite/gdb.base/add-symbol-file-attach.c
index 3ebd468..109e712 100644
--- a/gdb/testsuite/gdb.base/add-symbol-file-attach.c
+++ b/gdb/testsuite/gdb.base/add-symbol-file-attach.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/add-symbol-file-attach.exp b/gdb/testsuite/gdb.base/add-symbol-file-attach.exp
index e39a26a..9039249 100644
--- a/gdb/testsuite/gdb.base/add-symbol-file-attach.exp
+++ b/gdb/testsuite/gdb.base/add-symbol-file-attach.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/address_space_qualifier.exp b/gdb/testsuite/gdb.base/address_space_qualifier.exp
index b067e8d..dc91162 100644
--- a/gdb/testsuite/gdb.base/address_space_qualifier.exp
+++ b/gdb/testsuite/gdb.base/address_space_qualifier.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/advance-until-multiple-locations.cc b/gdb/testsuite/gdb.base/advance-until-multiple-locations.cc
index 159377c..d092f8d 100644
--- a/gdb/testsuite/gdb.base/advance-until-multiple-locations.cc
+++ b/gdb/testsuite/gdb.base/advance-until-multiple-locations.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/advance-until-multiple-locations.exp b/gdb/testsuite/gdb.base/advance-until-multiple-locations.exp
index 88a4b0d..86b8e0d 100644
--- a/gdb/testsuite/gdb.base/advance-until-multiple-locations.exp
+++ b/gdb/testsuite/gdb.base/advance-until-multiple-locations.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,14 +33,14 @@ set lineno [gdb_get_line_number "multiple locations here"]
proc_with_prefix until_advance_lineno_from_inlined {cmd} {
global lineno
- if ![runto test] {
+ if {![runto test]} {
return
}
gdb_breakpoint $lineno
gdb_continue_to_breakpoint "break here"
- set lineno2 [expr $lineno + 1]
+ set lineno2 [expr {$lineno + 1}]
gdb_test "$cmd $lineno2" \
"inline_func .* at .*:$lineno2.*return i.*" \
@@ -53,7 +53,7 @@ proc_with_prefix until_advance_lineno_from_inlined {cmd} {
proc_with_prefix until_advance_lineno_from_non_inlined {cmd} {
global lineno
- if ![runto test] {
+ if {![runto test]} {
return
}
@@ -68,7 +68,7 @@ proc_with_prefix until_advance_lineno_from_non_inlined {cmd} {
proc_with_prefix until_advance_inline_func {cmd} {
global lineno
- if ![runto test] {
+ if {![runto test]} {
return
}
@@ -83,7 +83,7 @@ proc_with_prefix until_advance_inline_func {cmd} {
proc_with_prefix advance_overload {} {
global lineno
- if ![runto test] {
+ if {![runto test]} {
return
}
@@ -117,7 +117,7 @@ proc_with_prefix advance_overload {} {
proc_with_prefix until_overload {} {
global lineno
- if ![runto test] {
+ if {![runto test]} {
return
}
diff --git a/gdb/testsuite/gdb.base/advance.exp b/gdb/testsuite/gdb.base/advance.exp
index 040e0d9..2051e9f 100644
--- a/gdb/testsuite/gdb.base/advance.exp
+++ b/gdb/testsuite/gdb.base/advance.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -63,7 +63,7 @@ gdb_test "continue" \
".*Breakpoint ${decimal}, main.*func3.*break here.*" \
"continue to call to func3 in main"
-# Verify that "advance <funcname>" when funcname is called as parameter to
+# Verify that "advance <funcname>" when funcname is called as parameter to
# another function works.
#
gdb_test "advance foo" \
diff --git a/gdb/testsuite/gdb.base/alias.exp b/gdb/testsuite/gdb.base/alias.exp
index 23a7166..593a830 100644
--- a/gdb/testsuite/gdb.base/alias.exp
+++ b/gdb/testsuite/gdb.base/alias.exp
@@ -1,5 +1,5 @@
# Test the alias command.
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/align-c++.exp b/gdb/testsuite/gdb.base/align-c++.exp
index 48455e1..57af0be 100644
--- a/gdb/testsuite/gdb.base/align-c++.exp
+++ b/gdb/testsuite/gdb.base/align-c++.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/align-c.exp b/gdb/testsuite/gdb.base/align-c.exp
index be0a5f4..f5b779d 100644
--- a/gdb/testsuite/gdb.base/align-c.exp
+++ b/gdb/testsuite/gdb.base/align-c.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/align.exp.tcl b/gdb/testsuite/gdb.base/align.exp.tcl
index 3f08e8b..6b6ceec 100644
--- a/gdb/testsuite/gdb.base/align.exp.tcl
+++ b/gdb/testsuite/gdb.base/align.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/all-architectures-0.exp b/gdb/testsuite/gdb.base/all-architectures-0.exp
index cf532a9..2ba8d22 100644
--- a/gdb/testsuite/gdb.base/all-architectures-0.exp
+++ b/gdb/testsuite/gdb.base/all-architectures-0.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/all-architectures-1.exp b/gdb/testsuite/gdb.base/all-architectures-1.exp
index eb25564..e43e652 100644
--- a/gdb/testsuite/gdb.base/all-architectures-1.exp
+++ b/gdb/testsuite/gdb.base/all-architectures-1.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/all-architectures-2.exp b/gdb/testsuite/gdb.base/all-architectures-2.exp
index fcc1069..553501d 100644
--- a/gdb/testsuite/gdb.base/all-architectures-2.exp
+++ b/gdb/testsuite/gdb.base/all-architectures-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/all-architectures-3.exp b/gdb/testsuite/gdb.base/all-architectures-3.exp
index 24030b3..4a81c20 100644
--- a/gdb/testsuite/gdb.base/all-architectures-3.exp
+++ b/gdb/testsuite/gdb.base/all-architectures-3.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/all-architectures-4.exp b/gdb/testsuite/gdb.base/all-architectures-4.exp
index 79b6b49..c4d45e4 100644
--- a/gdb/testsuite/gdb.base/all-architectures-4.exp
+++ b/gdb/testsuite/gdb.base/all-architectures-4.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/all-architectures-5.exp b/gdb/testsuite/gdb.base/all-architectures-5.exp
index 3a9d1d9..6a756f0 100644
--- a/gdb/testsuite/gdb.base/all-architectures-5.exp
+++ b/gdb/testsuite/gdb.base/all-architectures-5.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/all-architectures-6.exp b/gdb/testsuite/gdb.base/all-architectures-6.exp
index 2c3277a..cdf9955 100644
--- a/gdb/testsuite/gdb.base/all-architectures-6.exp
+++ b/gdb/testsuite/gdb.base/all-architectures-6.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/all-architectures-7.exp b/gdb/testsuite/gdb.base/all-architectures-7.exp
index 52405c0..01961d1 100644
--- a/gdb/testsuite/gdb.base/all-architectures-7.exp
+++ b/gdb/testsuite/gdb.base/all-architectures-7.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/all-architectures.exp.tcl b/gdb/testsuite/gdb.base/all-architectures.exp.tcl
index f97387f..5892ab7 100644
--- a/gdb/testsuite/gdb.base/all-architectures.exp.tcl
+++ b/gdb/testsuite/gdb.base/all-architectures.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -187,7 +187,7 @@ proc gdb_test_no_output_osabi {cmd test} {
set num_slices 8
set num_archs [llength $supported_archs]
-set archs_per_slice [expr (($num_archs + $num_slices - 1) / $num_slices)]
+set archs_per_slice [expr {(($num_archs + $num_slices - 1) / $num_slices)}]
with_test_prefix "tests" {
foreach_with_prefix osabi $supported_osabis {
@@ -201,10 +201,10 @@ with_test_prefix "tests" {
incr arch_count
# Skip architectures outside our slice.
- if {$arch_count < [expr $test_slice * $archs_per_slice]} {
+ if {$arch_count < $test_slice * $archs_per_slice} {
continue
}
- if {$arch_count >= [expr ($test_slice + 1) * $archs_per_slice]} {
+ if {$arch_count >= ($test_slice + 1) * $archs_per_slice} {
continue
}
@@ -312,7 +312,7 @@ with_test_prefix "tests" {
foreach v $options {
with_test_prefix "$var=$v" {
gdb_test_no_output_osabi "$cmd $v" "$cmd"
- run_axis $all_axes [expr $cur_axis + 1] $arch
+ run_axis $all_axes [expr {$cur_axis + 1}] $arch
}
}
}
diff --git a/gdb/testsuite/gdb.base/all-bin.exp b/gdb/testsuite/gdb.base/all-bin.exp
index af973b2..d910965 100644
--- a/gdb/testsuite/gdb.base/all-bin.exp
+++ b/gdb/testsuite/gdb.base/all-bin.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
#
# tests for arithmetic, logical and relational operators
# with mixed types
-#
+#
diff --git a/gdb/testsuite/gdb.base/annota-input-while-running.c b/gdb/testsuite/gdb.base/annota-input-while-running.c
index 25b4cab..a0d83ae 100644
--- a/gdb/testsuite/gdb.base/annota-input-while-running.c
+++ b/gdb/testsuite/gdb.base/annota-input-while-running.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/annota-input-while-running.exp b/gdb/testsuite/gdb.base/annota-input-while-running.exp
index 4625622..2b8d3b9 100644
--- a/gdb/testsuite/gdb.base/annota-input-while-running.exp
+++ b/gdb/testsuite/gdb.base/annota-input-while-running.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
index 927e8a7..0da5a09 100644
--- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@ set old_gdb_prompt $gdb_prompt
set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
#
-# Escape all the characters in the path that need it. For instance
+# Escape all the characters in the path that need it. For instance
# the directory name could contain '+'.
#
set escapedsrcfile [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
@@ -244,7 +244,7 @@ gdb_test_multiple "break handle_USR1" "break handle_USR1" {
}
#
-# break at printf. When we are stopped at printf, we can test
+# break at printf. When we are stopped at printf, we can test
#
gdb_test_multiple "break printf" "break printf" {
-re "\r\n\032\032post-prompt\r\nBreakpoint.*at $hex.*\032\032breakpoints-invalid\r\n.*$gdb_prompt$" {
@@ -336,14 +336,14 @@ gdb_test_multiple "backtrace" "backtrace from shlibrary" {
#
-# test printing a frame with some arguments:
+# test printing a frame with some arguments:
# annotate-arg-begin
# annotate-arg-name-end
# annotate-arg-value
# annotate-arg-end
#
-if [target_info exists gdb,nosignals] {
+if {[target_info exists gdb,nosignals]} {
unsupported "send SIGUSR1"
unsupported "backtrace @ signal handler"
} else {
@@ -507,10 +507,10 @@ gdb_test_multiple "info inferior 1" "get inferior pid" {
# annotate-signal-name-end
# annotate-signal-string
# annotate-signal-string-end
-# FIXME: annotate-signal not tested (requires that the inferior be
+# FIXME: annotate-signal not tested (requires that the inferior be
# stopped by a "random" signal)
-if [target_info exists gdb,nosignals] {
+if {[target_info exists gdb,nosignals]} {
unsupported "signal sent"
} else {
gdb_test_multiple "signal SIGTRAP" "signal sent" {
@@ -533,7 +533,8 @@ proc thread_test {} {
if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] == "" } {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/annota3.exp b/gdb/testsuite/gdb.base/annota3.exp
index 134a3d3..9d94be9 100644
--- a/gdb/testsuite/gdb.base/annota3.exp
+++ b/gdb/testsuite/gdb.base/annota3.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -85,7 +85,7 @@ gdb_test_multiple "end" "end if construct" {
#
# info break:
#
-send_gdb "info break\n"
+send_gdb "info break\n"
gdb_expect_list "breakpoint info" "$gdb_prompt$" [concat {
"\r\n\032\032post-prompt\r\n"
"Num Type Disp Enb Address +What\r\n" } [list \
@@ -114,7 +114,7 @@ gdb_expect_list "run until main breakpoint" "$gdb_prompt$" [concat {
# We don't care about the annotated output for this operation, it is the same as
# the one produced by run above
#
-send_gdb "next\n"
+send_gdb "next\n"
gdb_expect_list "go after array init line" "$gdb_prompt$" {
"\r\n\032\032post-prompt\r\n"
"\r\n\032\032starting\r\n"
@@ -183,10 +183,10 @@ gdb_expect_list "backtrace from shlibrary" "$gdb_prompt$" {
#
-# test printing a frame with some arguments:
+# test printing a frame with some arguments:
#
-if [target_info exists gdb,nosignals] {
+if {[target_info exists gdb,nosignals]} {
unsupported "send SIGUSR1"
unsupported "backtrace @ signal handler"
} else {
@@ -345,7 +345,7 @@ gdb_test_multiple "info inferior 1" "$test" {
# Send a signal that is not handled
-if [target_info exists gdb,nosignals] {
+if {[target_info exists gdb,nosignals]} {
unsupported "signal sent"
} else {
send_gdb "signal SIGTRAP\n"
diff --git a/gdb/testsuite/gdb.base/annotate-symlink.exp b/gdb/testsuite/gdb.base/annotate-symlink.exp
index 67f5841..a5d431e 100644
--- a/gdb/testsuite/gdb.base/annotate-symlink.exp
+++ b/gdb/testsuite/gdb.base/annotate-symlink.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2024 Free Software Foundation, Inc.
+# Copyright (C) 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ standard_testfile realname-expand.c realname-expand-real.c
require {!is_remote host}
set srcdirabs [file join [pwd] $srcdir]
-set srcfilelink [standard_output_file realname-expand-link.c]
+set srcfilelink [build_standard_output_file realname-expand-link.c]
remote_exec build "ln -sf ${srcdirabs}/${subdir}/${srcfile2} $srcfilelink"
diff --git a/gdb/testsuite/gdb.base/anon.exp b/gdb/testsuite/gdb.base/anon.exp
index a6433f5..8f9e44b 100644
--- a/gdb/testsuite/gdb.base/anon.exp
+++ b/gdb/testsuite/gdb.base/anon.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/args.exp b/gdb/testsuite/gdb.base/args.exp
index 363d74a..07101da 100644
--- a/gdb/testsuite/gdb.base/args.exp
+++ b/gdb/testsuite/gdb.base/args.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,6 +21,7 @@ require {!target_info exists noargs}
# This test requires starting new inferior processes, skip it if the target
# board is a stub.
require !use_gdb_stub
+require {expr {[have_startup_shell] != -1}}
standard_testfile
@@ -29,74 +30,187 @@ if {[build_executable $testfile.exp $testfile $srcfile] == -1} {
return -1
}
-# NAME is the name to use for the tests and ARGLIST is the list of
-# arguments that are passed to GDB when it is started.
+# Assuming a running GDB. Check the status of the single inferior
+# argument feature. When this feature is on GDB passes inferior
+# arguments as a single combined string. When this feature is off GDB
+# will split the inferior arguments into multiple separate strings.
#
-# The optional RE_LIST is the list of patterns to check the arguments
-# against, these patterns should match ARGLIST. If the arguments are
-# expected to show up unmodified in the test output then RE_LIST can
-# be dropped, and this proc will reuse ARGLIST.
-
-proc args_test { name arglist {re_list {}} } {
-
- # If RE_LIST is not supplied then we can reuse ARGLIST, this
- # implies that the arguments will appear unmodified in the test
- # output.
- if {[llength $re_list] == 0} {
- set re_list $arglist
+# Return true when arguments are being split, or false when a single
+# combined string is being sent.
+
+proc is_argument_splitting_on {} {
+ set arg_splitting true
+
+ gdb_test_multiple "show remote single-inferior-argument-feature-packet" "" {
+ -re -wrap "Support for the 'single-inferior-argument-feature' packet on the current remote target is \"(on|off)\"\\.(.*)" {
+ set value $expect_out(1,string)
+ pass $gdb_test_name
+ if { $value eq "on" } {
+ set arg_splitting false
+ }
+ }
+ -re -wrap "Support for the 'single-inferior-argument-feature' packet on the current remote target is \"auto\", currently (enabled|disabled)\\.(.*)" {
+ set value $expect_out(1,string)
+ pass $gdb_test_name
+ if { $value eq "enabled" } {
+ set arg_splitting false
+ }
+ }
}
- foreach_with_prefix startup_with_shell { on off } {
- save_vars { ::GDBFLAGS } {
- set ::GDBFLAGS "$::GDBFLAGS --args $::binfile $arglist"
-
- clean_restart $::binfile
-
- gdb_test_no_output "set startup-with-shell ${startup_with_shell}" \
- "set startup-with-shell for $name"
+ return $arg_splitting
+}
- runto_main
- gdb_breakpoint [gdb_get_line_number "set breakpoint here"]
- gdb_continue_to_breakpoint "breakpoint for $name"
+# NAME is the name to use for the tests and ARGLIST is the list of
+# arguments that are passed to GDB when it is started.
+#
+# The optional RE_ESC_LIST is the list of patterns to check the
+# inferior arguments against when GDB is started using --args. If
+# RE_ESC_LIST is not given then ARGLIST is reused, this implies that
+# the inferior arguments appear unchanged in the test output.
+#
+# The optional RE_NO_ESC_LIST is the list of patterns to check the
+# inferior arguments against when GDB is started using
+# --no-escape-args. If RE_NO_ESC_LIST is not given then RE_ESC_LIST
+# is reused, this implies that there's no difference between the test
+# output when the arguments are escaped or not.
+
+proc args_test { name arglist {re_esc_list {}} {re_no_esc_list {}} } {
+
+ # If either of the two regexp lists are not specificed then we can
+ # use an earlier argument value instead.
+ #
+ # For the first regexp list, if this is missing then we use the
+ # argument list, this assumes that the arguments will appear
+ # unmodified in the output.
+ if {[llength $re_esc_list] == 0} {
+ set re_esc_list $arglist
+ }
- set expected_len [expr 1 + [llength $re_list]]
- gdb_test "print argc" "\\\$$::decimal = $expected_len" "argc for $name"
+ # If the second regexp list is missing then we reuse the first
+ # regexp list. This assumes there's no difference between escaped
+ # and unescaped arguments in the output.
+ if {[llength $re_no_esc_list] == 0} {
+ set re_no_esc_list $re_esc_list
+ }
- set i 1
- foreach arg $re_list {
- gdb_test "print argv\[$i\]" "\\\$$::decimal = $::hex \"$arg\"" \
- "argv\[$i\] for $name"
- set i [expr $i + 1]
+ foreach_with_prefix startup_with_shell { on off } {
+ foreach_with_prefix arg_flag { args no-escape-args } {
+ save_vars { ::GDBFLAGS } {
+ set ::GDBFLAGS "$::GDBFLAGS --${arg_flag} $::binfile $arglist"
+
+ clean_restart $::testfile
+
+ gdb_test_no_output \
+ "set startup-with-shell ${startup_with_shell}" \
+ "set startup-with-shell for $name"
+
+ runto_main
+ gdb_breakpoint [gdb_get_line_number "set breakpoint here"]
+ gdb_continue_to_breakpoint "breakpoint for $name"
+
+ if { $arg_flag eq "args" || $startup_with_shell eq "off" } {
+ set re_list $re_esc_list
+ } else {
+ set re_list $re_no_esc_list
+ }
+
+ set expected_len [expr {1 + [llength $re_list]}]
+ gdb_test "print argc" \
+ "\\\$$::decimal = $expected_len" "argc for $name"
+
+ set i 1
+ foreach arg $re_list {
+ if { $arg eq "\n" } {
+ set arg {\\n}
+ } elseif { $arg eq "\"" } {
+ set arg {\\\"}
+ }
+
+ # If we are starting with a shell, we're not escaping
+ # special shell characters in arguments passed to GDB,
+ # we're using a remote target, and the arguments contain
+ # a shell variable (indicated with a '$'), then this
+ # test will currently fail if we are splitting the
+ # arguments.
+ if { $startup_with_shell eq "on"
+ && $arg_flag eq "no-escape-args"
+ && [gdb_protocol_is_remote]
+ && [string first "\$" $arglist] != -1
+ && [is_argument_splitting_on] } {
+ setup_xfail "*-*-*" gdb/28392
+ }
+
+ gdb_test "print argv\[$i\]" \
+ "\\\$$::decimal = $::hex \"$arg\"" \
+ "argv\[$i\] for $name"
+ set i [expr {$i + 1}]
+ }
}
}
}
}
-# Test that the --args are processed correctly.
+# Run all the tests.
+proc run_all_tests {} {
+ # Test that the --args are processed correctly.
+
+ args_test basic {{1} {3}}
-args_test basic {{1} {3}}
+ # Test that the --args are processed correctly even if one of them is
+ # empty.
-# Test that the --args are processed correctly even if one of them is
-# empty.
+ args_test "one empty" {{1} {} {3}}
-args_test "one empty" {{1} {} {3}}
+ # Try with 2 empty args.
-# Try with 2 empty args.
+ args_test "two empty" {{1} {} {} 3}
-args_test "two empty" {{1} {} {} 3}
+ # Try with arguments containing literal single quotes.
-# Try with arguments containing literal single quotes.
+ args_test "one empty with single quotes" {{1} {''} {3}}
-args_test "one empty with single quotes" {{1} {''} {3}}
+ args_test "two empty with single quotes" {{1} {''} {''} {3}}
-args_test "two empty with single quotes" {{1} {''} {''} {3}}
+ # Try with arguments containing literal newlines.
-# Try with arguments containing literal newlines.
+ args_test "one newline" {{1} "\n" {3}} {1 \\\\n 3}
-args_test "one newline" {{1} "\n" {3}} {1 \\\\n 3}
+ args_test "two newlines" {{1} "\n" "\n" {3}} {1 \\\\n \\\\n 3}
-args_test "two newlines" {{1} "\n" "\n" {3}} {1 \\\\n \\\\n 3}
+ args_test "lone single quote" {{1} \' {3}}
-args_test "lone single quote" {{1} \' {3}}
+ args_test "lone double quote" {{1} \" {3}} {1 \\\\\" 3}
-args_test "lone double quote" {{1} \" {3}} {1 \\\\\" 3}
+ save_vars { ::env(TEST) } {
+ set ::env(TEST) "ABCD"
+ args_test "shell variable" {{$TEST}} {\\$TEST} {{ABCD}}
+ }
+
+ # At one point we had a bug where, if the last inferior argument,
+ # appearing after --args, looked like an option GDB might be able
+ # to process, e.g. started with a dash, then GDB would try to
+ # process it. This would leave GDB in a broken state, and so GDB
+ # would fail to start. A example of a failing GDB command line:
+ # $ gdb --args /bin/ls --all
+ foreach_with_prefix flag { args no-escape-args } {
+ args_test "with trailing GDB flag" [list "--${flag}"]
+ }
+ args_test "with trailing GDB option and value" [list "--ex" "start"]
+ args_test "with trailing double dash option" [list "--foo"]
+ args_test "with trailing single dash option" [list "-foo"]
+}
+
+run_all_tests
+
+# For extended-remote targets, disable the packet which passes
+# inferior arguments as a single string. This changes how the vRun
+# (extended-remote only) packet works.
+if {[target_info gdb_protocol] == "extended-remote"} {
+ with_test_prefix "single-inferior-arg disabled" {
+ save_vars { GDBFLAGS } {
+ append GDBFLAGS " -ex \"set remote single-inferior-argument-feature-packet off\""
+ run_all_tests
+ }
+ }
+}
diff --git a/gdb/testsuite/gdb.base/argv0-symlink.c b/gdb/testsuite/gdb.base/argv0-symlink.c
index 3fb9313..a950f3c 100644
--- a/gdb/testsuite/gdb.base/argv0-symlink.c
+++ b/gdb/testsuite/gdb.base/argv0-symlink.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/argv0-symlink.exp b/gdb/testsuite/gdb.base/argv0-symlink.exp
index 27ea8d9..6edaea8 100644
--- a/gdb/testsuite/gdb.base/argv0-symlink.exp
+++ b/gdb/testsuite/gdb.base/argv0-symlink.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
# command expanding symlinks in the name of the program being run.
# This test uses pathnames on build to create symbolic links on host and
# expects the test program running on target to see those symbolic links.
-# Therefore, it can't work reliably on anything other than configurations
+# Therefore, it can't work reliably on anything other than configurations
# where build/host/target are all the same.
require isnative
@@ -47,7 +47,7 @@ with_test_prefix "file symlink" {
clean_restart "$filelink"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -87,7 +87,7 @@ with_test_prefix "dir symlink" {
clean_restart "$dirlink/$filelink"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/arithmet.exp b/gdb/testsuite/gdb.base/arithmet.exp
index c4a7f35..4e0ea12 100644
--- a/gdb/testsuite/gdb.base/arithmet.exp
+++ b/gdb/testsuite/gdb.base/arithmet.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
#
# tests for correctness of arithmetic operators, associativity and precedence
# with integer type variables
-#
+#
#
# test running programs
@@ -54,7 +54,7 @@ gdb_test "print x" "14"
gdb_test "print y" "2"
gdb_test "print z" "2"
gdb_test "print w" "3"
-
+
gdb_test "print x+y" "16"
gdb_test "print x-y" "12"
gdb_test "print x*y" "28"
diff --git a/gdb/testsuite/gdb.base/array-indices.exp b/gdb/testsuite/gdb.base/array-indices.exp
index 84f7191..4c16179 100644
--- a/gdb/testsuite/gdb.base/array-indices.exp
+++ b/gdb/testsuite/gdb.base/array-indices.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/array-indices.exp.tcl b/gdb/testsuite/gdb.base/array-indices.exp.tcl
index 7374753..e2a8613 100644
--- a/gdb/testsuite/gdb.base/array-indices.exp.tcl
+++ b/gdb/testsuite/gdb.base/array-indices.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/array-repeat.c b/gdb/testsuite/gdb.base/array-repeat.c
index ec509f4..bf6daf5 100644
--- a/gdb/testsuite/gdb.base/array-repeat.c
+++ b/gdb/testsuite/gdb.base/array-repeat.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/array-repeat.exp b/gdb/testsuite/gdb.base/array-repeat.exp
index 1379ae7..368ab28 100644
--- a/gdb/testsuite/gdb.base/array-repeat.exp
+++ b/gdb/testsuite/gdb.base/array-repeat.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/array-repeat.exp.tcl b/gdb/testsuite/gdb.base/array-repeat.exp.tcl
index b4a656e..e2ae5a2 100644
--- a/gdb/testsuite/gdb.base/array-repeat.exp.tcl
+++ b/gdb/testsuite/gdb.base/array-repeat.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/arrayidx.c b/gdb/testsuite/gdb.base/arrayidx.c
index e44256b..719087b 100644
--- a/gdb/testsuite/gdb.base/arrayidx.c
+++ b/gdb/testsuite/gdb.base/arrayidx.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2005-2024 Free Software Foundation, Inc.
+ Copyright 2005-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/arrayidx.exp b/gdb/testsuite/gdb.base/arrayidx.exp
index e279c9c..757ce92 100644
--- a/gdb/testsuite/gdb.base/arrayidx.exp
+++ b/gdb/testsuite/gdb.base/arrayidx.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debu
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.base/asmlabel.c b/gdb/testsuite/gdb.base/asmlabel.c
index 1ccee4b..49a3250 100644
--- a/gdb/testsuite/gdb.base/asmlabel.c
+++ b/gdb/testsuite/gdb.base/asmlabel.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/asmlabel.exp b/gdb/testsuite/gdb.base/asmlabel.exp
index f3af063..6a4d2a2 100644
--- a/gdb/testsuite/gdb.base/asmlabel.exp
+++ b/gdb/testsuite/gdb.base/asmlabel.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.base/assign.exp b/gdb/testsuite/gdb.base/assign.exp
index 38c2b2e..b96588c 100644
--- a/gdb/testsuite/gdb.base/assign.exp
+++ b/gdb/testsuite/gdb.base/assign.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
#
# tests for all the assignemnt operators
# with mixed types and with int type variables
-#
+#
#
# test running programs
@@ -33,7 +33,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
#
diff --git a/gdb/testsuite/gdb.base/async-shell.c b/gdb/testsuite/gdb.base/async-shell.c
index 3acdee0..401cb4b 100644
--- a/gdb/testsuite/gdb.base/async-shell.c
+++ b/gdb/testsuite/gdb.base/async-shell.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/async-shell.exp b/gdb/testsuite/gdb.base/async-shell.exp
index 991ab7f..228ed10 100644
--- a/gdb/testsuite/gdb.base/async-shell.exp
+++ b/gdb/testsuite/gdb.base/async-shell.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/async.exp b/gdb/testsuite/gdb.base/async.exp
index f1cd569..2f3ee9f 100644
--- a/gdb/testsuite/gdb.base/async.exp
+++ b/gdb/testsuite/gdb.base/async.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -109,7 +109,7 @@ gdb_test_multiple {x/2i $pc} "$test" {
}
}
set next_insn_is_stmt \
- [expr [lsearch -regexp $is_stmt 0x0*$next_insn_addr] != -1]
+ [expr {[lsearch -regexp $is_stmt 0x0*$next_insn_addr] != -1}]
if { $next_insn_is_stmt } {
set prefix ""
diff --git a/gdb/testsuite/gdb.base/attach-deleted-exec.c b/gdb/testsuite/gdb.base/attach-deleted-exec.c
index ebfae87..8b8c1be 100644
--- a/gdb/testsuite/gdb.base/attach-deleted-exec.c
+++ b/gdb/testsuite/gdb.base/attach-deleted-exec.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/attach-deleted-exec.exp b/gdb/testsuite/gdb.base/attach-deleted-exec.exp
index 1196115..45fac0d 100644
--- a/gdb/testsuite/gdb.base/attach-deleted-exec.exp
+++ b/gdb/testsuite/gdb.base/attach-deleted-exec.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -67,5 +67,49 @@ if { [regexp $re_nfs $filename] } {
gdb_assert { [string equal $filename /proc/${testpid}/exe] } $test
}
+# Restart GDB.
+clean_restart
+
+# Setup an empty sysroot. GDB will fail to find the executable within
+# the sysroot. Additionally, the presence of a sysroot should prevent
+# GDB from trying to load the executable from /proc/PID/exe.
+set sysroot [standard_output_file "sysroot"]
+gdb_test_no_output "set sysroot $sysroot" \
+ "setup sysroot"
+
+# Attach to the inferior. GDB should complain about failing to find
+# the executable. It is the name of the executable that GDB doesn't
+# find that we're interesting in here. For native targets GDB should
+# be looking for BINFILE, not /proc/PID/exe.
+#
+# For extended-remote targets things are unfortunately harder. Native
+# GDB looks for BINFILE because it understands that GDB will be
+# looking in the sysroot. But remote GDB doesn't know if GDB is using
+# a sysroot or not. As such, gdbserver will return /proc/PID/exe if
+# it knows that the file has been deleted locally. This isn't great
+# if GDB then plans to look in a sysroot, but equally, if the remote
+# file has been deleted, then the name GDB will return, will have had
+# " (deleted" appended, so we're unlikely to get a hit in the sysroot
+# either way.
+if { [target_info gdb_protocol] == "extended-remote" } {
+ set filename_re "/proc/$testpid/exe"
+} else {
+ set filename_re "\[^\r\n\]+/${testfile} \\(deleted\\)"
+}
+
+verbose -log "APB: warning: No executable has been specified, and target executable $filename_re could not be found\\. Try using the \"file\" command\\."
+
+gdb_test "attach $testpid" \
+ [multi_line \
+ "Attaching to process $decimal" \
+ "warning: No executable has been specified, and target executable $filename_re could not be found\\. Try using the \"file\" command\\." \
+ ".*"] \
+ "attach to inferior"
+
+# Check GDB hasn't managed to load an executable.
+gdb_test "info inferior" \
+ "\\*\[^)\]+\\)\\s*" \
+ "confirm no executable is loaded."
+
# Cleanup.
kill_wait_spawned_process $test_spawn_id
diff --git a/gdb/testsuite/gdb.base/attach-fail-twice.c b/gdb/testsuite/gdb.base/attach-fail-twice.c
index d045e35..6bc7f6b 100644
--- a/gdb/testsuite/gdb.base/attach-fail-twice.c
+++ b/gdb/testsuite/gdb.base/attach-fail-twice.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/attach-fail-twice.exp b/gdb/testsuite/gdb.base/attach-fail-twice.exp
index 5902046..5e5d73f 100644
--- a/gdb/testsuite/gdb.base/attach-fail-twice.exp
+++ b/gdb/testsuite/gdb.base/attach-fail-twice.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -77,7 +77,8 @@ proc test_good_attach {test} {
}
proc_with_prefix test {} {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
# GDB used to have a bug on Windows where failing to attach once
# made a subsequent "attach" or "run" hang. So it's important for
diff --git a/gdb/testsuite/gdb.base/attach-non-pgrp-leader.c b/gdb/testsuite/gdb.base/attach-non-pgrp-leader.c
index 62ceef4..eee5ee4 100644
--- a/gdb/testsuite/gdb.base/attach-non-pgrp-leader.c
+++ b/gdb/testsuite/gdb.base/attach-non-pgrp-leader.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/attach-non-pgrp-leader.exp b/gdb/testsuite/gdb.base/attach-non-pgrp-leader.exp
index 7d1bfe1..c43a11c 100644
--- a/gdb/testsuite/gdb.base/attach-non-pgrp-leader.exp
+++ b/gdb/testsuite/gdb.base/attach-non-pgrp-leader.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,8 @@ proc do_test {} {
# Attach to the parent, run it to a known point, extract the
# child's PID, and detach.
with_test_prefix "parent" {
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
gdb_test "attach $parent_pid" \
"Attaching to program.*, process $parent_pid.*" \
@@ -56,7 +57,8 @@ proc do_test {} {
# Start over, and attach to the child this time.
with_test_prefix "child" {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
gdb_test "attach $child_pid" \
"Attaching to program.*, process $child_pid.*" \
diff --git a/gdb/testsuite/gdb.base/attach-pie-misread.c b/gdb/testsuite/gdb.base/attach-pie-misread.c
index 9fd03d9..b41c18d 100644
--- a/gdb/testsuite/gdb.base/attach-pie-misread.c
+++ b/gdb/testsuite/gdb.base/attach-pie-misread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/attach-pie-misread.exp b/gdb/testsuite/gdb.base/attach-pie-misread.exp
index 7943170..5f85d00 100644
--- a/gdb/testsuite/gdb.base/attach-pie-misread.exp
+++ b/gdb/testsuite/gdb.base/attach-pie-misread.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,18 +39,18 @@ proc read_phdr {binfile test} {
set readelf_program [gdb_find_readelf]
set command "exec $readelf_program -Wl $binfile"
verbose -log "command is $command"
- set result [catch $command output]
+ set result [catch {{*}$command} output]
verbose -log "result is $result"
verbose -log "output is $output"
if {$result != 0} {
fail $test
return
}
- if ![regexp {\nProgram Headers:\n *Type [^\n]* Align\n(.*?)\n\n} $output trash phdr] {
+ if {![regexp {\nProgram Headers:\n *Type [^\n]* Align\n(.*?)\n\n} $output trash phdr]} {
fail "$test (no Program Headers)"
return
}
- if ![regexp -line {^ *DYNAMIC +0x[0-9a-f]+ +(0x[0-9a-f]+) } $phdr trash dynamic_vaddr] {
+ if {![regexp -line {^ *DYNAMIC +0x[0-9a-f]+ +(0x[0-9a-f]+) } $phdr trash dynamic_vaddr]} {
fail "$test (no DYNAMIC found)"
return
}
@@ -74,7 +74,7 @@ set phdr [read_phdr $binfile "readelf initial scan"]
set dynamic_vaddr [lindex $phdr 0]
set align_max [lindex $phdr 1]
-set stub_size [format 0x%x [expr "2 * $align_max - ($dynamic_vaddr & ($align_max - 1))"]]
+set stub_size [format 0x%x [expr {2 * $align_max - ($dynamic_vaddr & ($align_max - 1))}]]
verbose -log "stub_size is $stub_size"
# On x86_64 it is commonly about 4MB.
@@ -86,7 +86,7 @@ if {$stub_size > 25000000} {
set test "generate stub"
set command "exec $binfile $stub_size >$genfile"
verbose -log "command is $command"
-set result [catch $command output]
+set result [catch {{*}$command} output]
verbose -log "result is $result"
verbose -log "output is $output"
if {$result == 0} {
@@ -109,14 +109,14 @@ file delete -- $genfile
set phdr [read_phdr $binfile "readelf rebuilt with stub_size"]
set dynamic_vaddr_prelinkno [lindex $phdr 0]
-if ![prelink_yes $prelink_args] {
+if {![prelink_yes $prelink_args]} {
return -1
}
set phdr [read_phdr $binfile "readelf with prelink -R"]
set dynamic_vaddr_prelinkyes [lindex $phdr 0]
-set first_offset [format 0x%x [expr $dynamic_vaddr_prelinkyes - $dynamic_vaddr_prelinkno]]
+set first_offset [format 0x%x [expr {$dynamic_vaddr_prelinkyes - $dynamic_vaddr_prelinkno}]]
verbose -log "first_offset is $first_offset"
set test "first offset is non-zero"
@@ -156,7 +156,7 @@ gdb_expect {
foreach align_mult {1 2} { with_test_prefix "shift-by-$align_mult" {
# FIXME: We believe there is enough room under FIRST_OFFSET.
- set shifted_offset [format 0x%x [expr "$first_offset - $align_mult * $align_max"]]
+ set shifted_offset [format 0x%x [expr {$first_offset - $align_mult * $align_max}]]
verbose -log "shifted_offset is $shifted_offset"
# For normal prelink (prelink_yes call), we need to supply $prelink_args.
@@ -165,7 +165,7 @@ foreach align_mult {1 2} { with_test_prefix "shift-by-$align_mult" {
# as the libraries would also get relocated.
set command "exec /usr/sbin/prelink -q -N --no-exec-shield -r $shifted_offset $binfile"
verbose -log "command is $command"
- set result [catch $command output]
+ set result [catch {{*}$command} output]
verbose -log "result is $result"
verbose -log "output is $output"
diff --git a/gdb/testsuite/gdb.base/attach-pie-noexec.c b/gdb/testsuite/gdb.base/attach-pie-noexec.c
index d9fab24..d1e431f 100644
--- a/gdb/testsuite/gdb.base/attach-pie-noexec.c
+++ b/gdb/testsuite/gdb.base/attach-pie-noexec.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/attach-pie-noexec.exp b/gdb/testsuite/gdb.base/attach-pie-noexec.exp
index 4e6ede1..58f1890 100644
--- a/gdb/testsuite/gdb.base/attach-pie-noexec.exp
+++ b/gdb/testsuite/gdb.base/attach-pie-noexec.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,12 +30,12 @@ gdb_test_multiple $test $test {
pass $test
}
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
set test "sanity check info shared"
gdb_test_multiple "info shared" $test {
- -re "From\[ \t\]+To\[ \t\]+Syms Read\[ \t\]+Shared Object Library\r\n0x.*\r\n$gdb_prompt $" {
+ -re "From\[ \t\]+To(\\s+NS)?\[ \t\]+Syms Read\[ \t\]+Shared Object Library\r\n0x.*\r\n$gdb_prompt $" {
pass $test
}
-re "No shared libraries loaded at this time\\.\r\n$gdb_prompt $" {
@@ -62,6 +62,6 @@ if { ![gdb_attach $testpid] } {
return
}
gdb_test "set architecture $arch" "The target architecture is set to \"$arch\"\\."
-gdb_test "info shared" "From\[ \t\]+To\[ \t\]+Syms Read\[ \t\]+Shared Object Library\r\n0x.*"
+gdb_test "info shared" "From\[ \t\]+To(\\s+NS)?\[ \t\]+Syms Read\[ \t\]+Shared Object Library\r\n0x.*"
kill_wait_spawned_process $test_spawn_id
diff --git a/gdb/testsuite/gdb.base/attach-twice.c b/gdb/testsuite/gdb.base/attach-twice.c
index 7b0af35..41e808c 100644
--- a/gdb/testsuite/gdb.base/attach-twice.c
+++ b/gdb/testsuite/gdb.base/attach-twice.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/attach-twice.exp b/gdb/testsuite/gdb.base/attach-twice.exp
index 87a12dc..63205e2 100644
--- a/gdb/testsuite/gdb.base/attach-twice.exp
+++ b/gdb/testsuite/gdb.base/attach-twice.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,6 +45,6 @@ gdb_test_multiple "attach $testpid" $test {
}
if {$parentpid != 0} {
- eval exec kill -9 $parentpid
+ exec kill -9 $parentpid
}
kill_wait_spawned_process $test_spawn_id
diff --git a/gdb/testsuite/gdb.base/attach-wait-input.c b/gdb/testsuite/gdb.base/attach-wait-input.c
index 87219cd..8e88317 100644
--- a/gdb/testsuite/gdb.base/attach-wait-input.c
+++ b/gdb/testsuite/gdb.base/attach-wait-input.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/attach-wait-input.exp b/gdb/testsuite/gdb.base/attach-wait-input.exp
index bbe73d1..47e3d25 100644
--- a/gdb/testsuite/gdb.base/attach-wait-input.exp
+++ b/gdb/testsuite/gdb.base/attach-wait-input.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,7 +43,8 @@ proc start_program {binfile} {
global gdb_prompt
global decimal
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
if {![runto setup_done]} {
return 0
diff --git a/gdb/testsuite/gdb.base/attach.c b/gdb/testsuite/gdb.base/attach.c
index b3c5498..5133dd0 100644
--- a/gdb/testsuite/gdb.base/attach.c
+++ b/gdb/testsuite/gdb.base/attach.c
@@ -5,7 +5,7 @@
exit unless/until gdb sets the variable to non-zero.)
*/
#include <stdio.h>
-#include <unistd.h>
+#include "gdb_watchdog.h"
int bidule = 0;
volatile int should_exit = 0;
@@ -14,7 +14,7 @@ int main ()
{
int local_i = 0;
- alarm (60);
+ gdb_watchdog (60);
while (! should_exit)
{
diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp
index 2b655e6..c4e27a1 100644
--- a/gdb/testsuite/gdb.base/attach.exp
+++ b/gdb/testsuite/gdb.base/attach.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -56,7 +56,8 @@ proc_with_prefix do_attach_failure_tests {} {
global escapedbinfile
global srcfile
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
# Figure out a regular expression that will match the sysroot,
# noting that the default sysroot is "target:", and also noting
@@ -83,7 +84,7 @@ proc_with_prefix do_attach_failure_tests {} {
}
-re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $" {
# Response expected from /proc-based systems.
- pass "$test"
+ pass "$test"
}
-re "Can't attach to process..*$gdb_prompt $" {
# Response expected on Cygwin
@@ -104,7 +105,7 @@ proc_with_prefix do_attach_failure_tests {} {
}
-re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $" {
# Response expected from /proc-based systems.
- pass "$test"
+ pass "$test"
}
-re "Can't attach to process..*$gdb_prompt $" {
# Response expected on Cygwin
@@ -156,7 +157,7 @@ proc_with_prefix do_attach_failure_tests {} {
pass "$test"
}
}
-
+
# Verify that we can't double attach to the process.
set test "first attach"
@@ -215,7 +216,8 @@ proc_with_prefix do_attach_tests {} {
global timeout
global decimal
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
# Figure out a regular expression that will match the sysroot,
# noting that the default sysroot is "target:", and also noting
@@ -240,7 +242,7 @@ proc_with_prefix do_attach_tests {} {
# (Actually, the test system appears to do this automatically for
# us. So, we must also be prepared to be asked if we want to
# discard an existing set of symbols.)
-
+
set test "set file, before attach1"
gdb_test_multiple "file $binfile" "$test" {
-re "Load new symbol table from.*y or n. $" {
@@ -265,25 +267,25 @@ proc_with_prefix do_attach_tests {} {
# Verify that we can "see" the variable "should_exit" in the
# program, and that it is zero.
-
+
gdb_test "print should_exit" " = 0" "after attach1, print should_exit"
# Detach the process.
-
+
gdb_test "detach" \
"Detaching from program: .*$escapedbinfile, process $testpid\r\n\\\[Inferior $decimal \\(.*\\) detached\\\]" \
"attach1 detach"
# Wait a bit for gdb to finish detaching
-
+
exec sleep 5
# Purge the symbols from gdb's brain. (We want to be certain the
# next attach, which won't be preceded by a "file" command, is
# really getting the executable file without our help.)
-
+
set old_timeout $timeout
- set timeout 15
+ set timeout 15
set test "attach1, purging symbols after detach"
gdb_test_multiple "file" "$test" {
-re "No executable file now.*Discard symbol table.*y or n. $" {
@@ -294,7 +296,7 @@ proc_with_prefix do_attach_tests {} {
# Verify that we can attach to the process just by giving the
# process ID.
-
+
set test "attach2, with no file"
set found_exec_file 0
gdb_test_multiple "attach $testpid" "$test" {
@@ -354,7 +356,7 @@ proc_with_prefix do_attach_tests {} {
# Verify that we can attach to the process, and find its a.out
# when we're cd'd to some directory that doesn't contain the
# a.out. (We use the source path set by the "dir" command.)
-
+
gdb_test "dir [standard_output_file {}]" "Source directories searched: .*" \
"set source path"
@@ -387,7 +389,7 @@ proc_with_prefix do_attach_tests {} {
"$test" \
"Kill the program being debugged.*y or n. $" \
"y"
-
+
# Another "don't leave a process around"
kill_wait_spawned_process $test_spawn_id
}
@@ -404,7 +406,7 @@ proc_with_prefix do_call_attach_tests {} {
set testpid [spawn_id_get_pid $test_spawn_id]
# Attach
-
+
gdb_test "file $binfile2" ".*" "load file"
set test "attach call"
gdb_test_multiple "attach $testpid" "$test" {
@@ -420,7 +422,7 @@ proc_with_prefix do_call_attach_tests {} {
}
# See if other registers are problems
-
+
set test "info other register"
gdb_test_multiple "i r r3" "$test" {
-re "warning: reading register.*$gdb_prompt $" {
@@ -432,12 +434,12 @@ proc_with_prefix do_call_attach_tests {} {
}
# Get rid of the process
-
+
gdb_test "p should_exit = 1"
gdb_continue_to_end
-
+
# Be paranoid
-
+
kill_wait_spawned_process $test_spawn_id
}
@@ -519,7 +521,8 @@ proc_with_prefix do_attach_exec_mismatch_handling_tests {} {
global binfile2
global binfile3
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
# Start two programs that can be attached to.
# The first program contains a 'int bidule' variable, the second a 'float bidule'.
@@ -588,7 +591,7 @@ proc_with_prefix do_attach_exec_mismatch_handling_tests {} {
gdb_test "y" "Reading symbols from .*attach.*" $gdb_test_name
}
}
-
+
gdb_test "detach" "Detaching from program: .* detached\\\]" "$test detach attach initial exec-file"
diff --git a/gdb/testsuite/gdb.base/auto-connect-native-target.c b/gdb/testsuite/gdb.base/auto-connect-native-target.c
index f63feb6..926ccf1 100644
--- a/gdb/testsuite/gdb.base/auto-connect-native-target.c
+++ b/gdb/testsuite/gdb.base/auto-connect-native-target.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/auto-connect-native-target.exp b/gdb/testsuite/gdb.base/auto-connect-native-target.exp
index fe1ed2f..914e3ba 100644
--- a/gdb/testsuite/gdb.base/auto-connect-native-target.exp
+++ b/gdb/testsuite/gdb.base/auto-connect-native-target.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/auto-load-script b/gdb/testsuite/gdb.base/auto-load-script
index fcf3d64..6d2f1db 100644
--- a/gdb/testsuite/gdb.base/auto-load-script
+++ b/gdb/testsuite/gdb.base/auto-load-script
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/auto-load.c b/gdb/testsuite/gdb.base/auto-load.c
index c38538d..120c08d 100644
--- a/gdb/testsuite/gdb.base/auto-load.c
+++ b/gdb/testsuite/gdb.base/auto-load.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/auto-load.exp b/gdb/testsuite/gdb.base/auto-load.exp
index 1517509..2faa292 100644
--- a/gdb/testsuite/gdb.base/auto-load.exp
+++ b/gdb/testsuite/gdb.base/auto-load.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/auxv.c b/gdb/testsuite/gdb.base/auxv.c
index 7d434c7..c9a20ab 100644
--- a/gdb/testsuite/gdb.base/auxv.c
+++ b/gdb/testsuite/gdb.base/auxv.c
@@ -1,4 +1,4 @@
-/* Copyright 1992-2024 Free Software Foundation, Inc.
+/* Copyright 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/auxv.exp b/gdb/testsuite/gdb.base/auxv.exp
index 0759a4f..0bb4c36 100644
--- a/gdb/testsuite/gdb.base/auxv.exp
+++ b/gdb/testsuite/gdb.base/auxv.exp
@@ -1,6 +1,6 @@
# Test `info auxv' and related functionality.
-# Copyright (C) 1992-2024 Free Software Foundation, Inc.
+# Copyright (C) 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,11 +37,12 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
# Make it the working directory for the inferior.
set coredir [standard_output_file coredir.[getpid]]
file mkdir $coredir
-set core_works [expr [isnative] && ! [is_remote target]]
+set core_works [expr {[isnative] && ! [is_remote target]}]
# Run GDB on the test program up to where it will dump core.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_test_no_output "set print sevenbit-strings"
gdb_test_no_output "set width 0"
diff --git a/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp b/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp
index 53bf642..652e8c1 100644
--- a/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp
+++ b/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp
@@ -31,7 +31,7 @@ proc prepare_test {has_cfi} {
"${objcallerfile}" \
object [list {additional_flags=-fomit-frame-pointer \
-funwind-tables -fasynchronous-unwind-tables}]] != "" } {
- untested "couldn't compile with cfi"
+ untested "couldn't compile"
return false
}
} else {
@@ -41,7 +41,7 @@ proc prepare_test {has_cfi} {
object [list {additional_flags=-fomit-frame-pointer \
-fno-unwind-tables \
-fno-asynchronous-unwind-tables}]] != "" } {
- untested "couldn't compile without cfi"
+ untested "couldn't compile"
return false
}
}
@@ -52,17 +52,15 @@ proc prepare_test {has_cfi} {
return false
}
- clean_restart "$binfile-${extension}"
+ clean_restart
+ gdb_load $binfile-$extension
- with_test_prefix "${extension}" {
-
- if ![runto callback] then {
- fail "has_cfi=$has_cfi: Can't run to callback"
- return false
- }
- gdb_test_no_output "maint frame-unwinder disable ARCH"
- return true
+ if { ![runto callback] } {
+ fail "has_cfi=$has_cfi: Can't run to callback"
+ return false
}
+ gdb_test_no_output "maint frame-unwinder disable ARCH"
+ return true
}
if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" \
@@ -72,15 +70,45 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" \
return
}
-if { [prepare_test false] } {
- gdb_test "bt" \
+proc_with_prefix no-cfi {} {
+ if { ![prepare_test false] } {
+ return
+ }
+
+ set re_msg \
+ [string_list_to_regexp \
+ "Required frame unwinder may have been disabled," \
+ " see 'maint info frame-unwinders'"]
+ set hs {[^\r\n]}
+ set re_bt_line "#0\\s+[string_to_regexp {callback ()}] $hs+"
+ set re_bt_no_filters \
[multi_line \
- "\[^\r\n\]+Required frame unwinder may have been disabled, \[^\r\n\]+" \
- "#0\\s+callback \\(\\) \[^\r\n\]+"] \
- "verify unwind fail without CFI"
+ $re_bt_line \
+ $re_msg]
+ gdb_test "bt -no-filters" \
+ $re_bt_no_filters \
+ "verify no-filters unwind fail"
+
+ # Flush frame cache to retrigger the message.
+ gdb_test "maint flush register-cache" \
+ [string_to_regexp "Register cache flushed."]
+
+ # This output may occur when we run into the message while applying the
+ # frame filters.
+ set re_bt \
+ [multi_line \
+ $hs+$re_msg \
+ $re_bt_line]
+ gdb_test "bt" \
+ "($re_bt|$re_bt_no_filters)" \
+ "verify unwind fail"
}
-if { [prepare_test true] } {
+proc_with_prefix cfi {} {
+ if { ![prepare_test true] } {
+ return
+ }
+
if { [istarget "arm*-*-*"] } {
setup_kfail backtrace/31950 *-*-*
}
@@ -89,6 +117,12 @@ if { [prepare_test true] } {
# #1 0x00000000004004e9 in caller ()
# #2 0x00000000004004cd in main () at ...
gdb_test "bt" \
- "#0 +callback $text\r\n#1 $text in caller $text\r\n#2 $text in main $text" \
- "Verify unwinding works based only on CFI information"
+ [multi_line \
+ "#0 +callback $text" \
+ "#1 $text in caller $text" \
+ "#2 $text in main $text"] \
+ "Verify unwinding works"
}
+
+no-cfi
+cfi
diff --git a/gdb/testsuite/gdb.base/backtrace.c b/gdb/testsuite/gdb.base/backtrace.c
index 50995ad..33edd39 100644
--- a/gdb/testsuite/gdb.base/backtrace.c
+++ b/gdb/testsuite/gdb.base/backtrace.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/backtrace.exp b/gdb/testsuite/gdb.base/backtrace.exp
index fd6b358..3020666 100644
--- a/gdb/testsuite/gdb.base/backtrace.exp
+++ b/gdb/testsuite/gdb.base/backtrace.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,11 +17,7 @@
standard_testfile
-set flags {}
-lappend flags debug
-lappend_include_file flags $srcdir/lib/attributes.h
-
-if { [prepare_for_testing "failed to prepare" $testfile $srcfile $flags] } {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
return -1
}
diff --git a/gdb/testsuite/gdb.base/bad-file.exp b/gdb/testsuite/gdb.base/bad-file.exp
index 1a9fa35..b823eaa 100644
--- a/gdb/testsuite/gdb.base/bad-file.exp
+++ b/gdb/testsuite/gdb.base/bad-file.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/bang.exp b/gdb/testsuite/gdb.base/bang.exp
index e8acda3..2848c6f 100644
--- a/gdb/testsuite/gdb.base/bang.exp
+++ b/gdb/testsuite/gdb.base/bang.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/basic-edit-cmd.c b/gdb/testsuite/gdb.base/basic-edit-cmd.c
index fb0f70d..43e1984 100644
--- a/gdb/testsuite/gdb.base/basic-edit-cmd.c
+++ b/gdb/testsuite/gdb.base/basic-edit-cmd.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/basic-edit-cmd.exp b/gdb/testsuite/gdb.base/basic-edit-cmd.exp
index aa0efb5..ad5c9a5 100644
--- a/gdb/testsuite/gdb.base/basic-edit-cmd.exp
+++ b/gdb/testsuite/gdb.base/basic-edit-cmd.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ if {![runto_main]} {
# Are we using DWARF debug format?
get_debug_format
-set non_dwarf [expr ! [test_debug_format "DWARF \[0-9\]"]]
+set non_dwarf [expr {! [test_debug_format "DWARF \[0-9\]"]}]
# Find line numbers for use in tests.
set line_0 [gdb_get_line_number "prologue location"]
@@ -68,7 +68,8 @@ save_vars { env(EDITOR) } {
"try edit when no symbol file is loaded"
# Now start with a test binary.
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
with_test_prefix "before starting inferior" {
diff --git a/gdb/testsuite/gdb.base/batch-exit-status.exp b/gdb/testsuite/gdb.base/batch-exit-status.exp
index 5151464..86e5fdd 100644
--- a/gdb/testsuite/gdb.base/batch-exit-status.exp
+++ b/gdb/testsuite/gdb.base/batch-exit-status.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ proc _test_exit_status {expect_status cmdline_opts {re ""}} {
return
}
- set has_re [expr ![string equal $re ""]]
+ set has_re [expr {![string equal $re ""]}]
if { ! $has_re } {
set re "\$FOOBAR^"
}
diff --git a/gdb/testsuite/gdb.base/batch-preserve-term-settings.c b/gdb/testsuite/gdb.base/batch-preserve-term-settings.c
index cd4a9b2..7d13022 100644
--- a/gdb/testsuite/gdb.base/batch-preserve-term-settings.c
+++ b/gdb/testsuite/gdb.base/batch-preserve-term-settings.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp b/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
index d4ceba6..52b546c 100644
--- a/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
+++ b/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug] == -1} {
}
set file_arg $binfile
-if [is_remote host] {
+if {[is_remote host]} {
set file_arg [remote_download host $file_arg]
}
@@ -46,11 +46,11 @@ proc spawn_shell {} {
# Try to match:
# PS1="gdb-subshell$ "^M
- # $ gdb-subshell$
+ # $ gdb-subshell$
# or:
# PS1="gdb-subshell$ "^M
# sh-4.4$ PS1="gdb-subshell$ "^M
- # gdb-subshell$
+ # gdb-subshell$
set gotit 0
set test "spawn shell"
gdb_expect {
@@ -88,7 +88,7 @@ proc exit_shell {} {
pass "$test"
}
}
- if ![is_remote host] {
+ if {![is_remote host]} {
remote_close host
}
}
@@ -131,7 +131,7 @@ proc test_terminal_settings_preserved {} {
global gdb_prompt
global shell_prompt_re
- if ![spawn_shell] {
+ if {![spawn_shell]} {
return
}
@@ -176,7 +176,7 @@ proc test_terminal_settings_preserved {} {
}
set test "terminal settings preserved"
- if $stty_supported {
+ if {$stty_supported} {
run_stty "stty after" stty_after
gdb_assert [string equal $stty_before $stty_after] $test
@@ -224,7 +224,7 @@ proc test_terminal_settings_preserved_after_cli_exit { cmds } {
global gdb_prompt
global shell_prompt_re
- if ![spawn_shell] {
+ if {![spawn_shell]} {
return
}
@@ -263,7 +263,7 @@ proc test_terminal_settings_preserved_after_cli_exit { cmds } {
send_quit_command "quit gdb"
set test "terminal settings preserved"
- if $stty_supported {
+ if {$stty_supported} {
run_stty "stty after" stty_after
gdb_assert [string equal $stty_before $stty_after] $test
@@ -286,11 +286,11 @@ proc test_terminal_settings_preserved_after_sigterm { } {
# On Windows, GDB's "shell" command spawns cmd.exe, which does not
# understand PPID. So we're out of luck even if the test harness
# uses a remote_exec shell with a working "kill" command.
- if [ishost *-*-mingw*] {
+ if {[ishost *-*-mingw*]} {
return
}
- if ![spawn_shell] {
+ if {![spawn_shell]} {
return
}
@@ -347,13 +347,13 @@ proc test_terminal_settings_preserved_after_sigterm { } {
}
}
- if !$gdb_killed {
+ if {!$gdb_killed} {
send_quit_command "quit gdb"
}
}
set test "terminal settings preserved"
- if $stty_supported {
+ if {$stty_supported} {
run_stty "stty after" stty_after
gdb_assert [string equal $stty_before $stty_after] $test
diff --git a/gdb/testsuite/gdb.base/bfd-errors-lib.c b/gdb/testsuite/gdb.base/bfd-errors-lib.c
index 9b8f311..481622a 100644
--- a/gdb/testsuite/gdb.base/bfd-errors-lib.c
+++ b/gdb/testsuite/gdb.base/bfd-errors-lib.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.base/bfd-errors.exp b/gdb/testsuite/gdb.base/bfd-errors.exp
index b611c33..f298247 100644
--- a/gdb/testsuite/gdb.base/bfd-errors.exp
+++ b/gdb/testsuite/gdb.base/bfd-errors.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -39,7 +39,7 @@
#
# This test then loads the shared library's symbol table (and other
# debug info) using the 'add-symbol-file' command. While doing this,
-# the test observes and records the BFD errors that were output.
+# the test observes and records the BFD errors that were output.
# Finally, data collected while adding the shared library symbols are
# examined to make sure that identical messages were suppressed while
# also making sure that at least two messages have been printed.
@@ -87,10 +87,10 @@ close $solib_fp
set objcopy_program [gdb_find_objcopy]
# Extract the .dynsym and .dynstr section from the shared object.
-if { [catch "exec $objcopy_program \
- --dump-section .dynsym=${binfile_lib}.dynsym \
- --dump-section .dynstr=${binfile_lib}.dynstr \
- ${binfile_lib}" output] } {
+if { [catch {exec $objcopy_program \
+ --dump-section .dynsym=${binfile_lib}.dynsym \
+ --dump-section .dynstr=${binfile_lib}.dynstr \
+ ${binfile_lib}} output] } {
untested "failed objcopy dump-section"
verbose -log "objcopy output: $output"
return -1
@@ -119,29 +119,29 @@ if { $is_elf64 } {
} else {
set sz 16
}
-set cnt [expr $dynsym_len / $sz]
+set cnt [expr {$dynsym_len / $sz}]
# Create 32-bit patterns (bad offsets) to write into the st_name area.
if { $is_big_endian } {
- set pat(0) [binary format I [expr $dynstr_len + 1000]]
- set pat(1) [binary format I [expr $dynstr_len + 2000]]
+ set pat(0) [binary format I [expr {$dynstr_len + 1000}]]
+ set pat(1) [binary format I [expr {$dynstr_len + 2000}]]
} else {
- set pat(0) [binary format i [expr $dynstr_len + 1000]]
- set pat(1) [binary format i [expr $dynstr_len + 2000]]
+ set pat(0) [binary format i [expr {$dynstr_len + 1000}]]
+ set pat(1) [binary format i [expr {$dynstr_len + 2000}]]
}
# Mangle st_name for the symbols following the first (STN_UNDEF) entry.
while { [incr cnt -1] > 0 } {
seek $dynsym_fp [incr off $sz]
- puts $dynsym_fp $pat([expr $cnt % 2])
+ puts $dynsym_fp $pat([expr {$cnt % 2}])
}
close $dynsym_fp
# Replace .dynsym section in shared object with the mangled version.
-if { [catch "exec $objcopy_program \
- --update-section .dynsym=${binfile_lib}.dynsym \
- ${binfile_lib}" output] } {
+if { [catch {exec $objcopy_program \
+ --update-section .dynsym=${binfile_lib}.dynsym \
+ ${binfile_lib}} output] } {
untested "failed objcopy update-section"
verbose -log "objcopy output: $output"
return -1
diff --git a/gdb/testsuite/gdb.base/bfp-test.c b/gdb/testsuite/gdb.base/bfp-test.c
index 9815584..927621c 100644
--- a/gdb/testsuite/gdb.base/bfp-test.c
+++ b/gdb/testsuite/gdb.base/bfp-test.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2005-2024 Free Software Foundation, Inc.
+ Copyright 2005-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/bfp-test.exp b/gdb/testsuite/gdb.base/bfp-test.exp
index e633f90..1251868 100644
--- a/gdb/testsuite/gdb.base/bfp-test.exp
+++ b/gdb/testsuite/gdb.base/bfp-test.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debu
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return
@@ -38,7 +39,7 @@ gdb_test "print b32" ".*1 = 1\.5.*" "the original value of b32 is 1.5"
gdb_test "print b64" ".*2 = 2\.25.*" "the original value of b64 is 2.25"
gdb_test "print b128" ".*3 = 3\.375.*" "the original value of b128 is 3.375"
-# Test that gdb could correctly recognize float constant expression with a suffix.
+# Test that gdb could correctly recognize float constant expression with a suffix.
gdb_test "print b32=-1.5f" ".*4 = -1\.5.*" "try to change b32 to -1.5 with 'print b32=-1.5f'"
gdb_test "print b64=-2.25f" ".*5 = -2\.25.*" "try to change b64 to -2.25 with 'print b64=-2.25f'"
gdb_test "print b128=-3.375l" ".*6 = -3\.375.*" "try to change b128 to -3.375 with 'print b128=-3.375l'"
diff --git a/gdb/testsuite/gdb.base/bg-exec-sigint-bp-cond.c b/gdb/testsuite/gdb.base/bg-exec-sigint-bp-cond.c
index 6cbc073..ea4534e 100644
--- a/gdb/testsuite/gdb.base/bg-exec-sigint-bp-cond.c
+++ b/gdb/testsuite/gdb.base/bg-exec-sigint-bp-cond.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/bg-exec-sigint-bp-cond.exp b/gdb/testsuite/gdb.base/bg-exec-sigint-bp-cond.exp
index 79e2177..2e2a8e6 100644
--- a/gdb/testsuite/gdb.base/bg-exec-sigint-bp-cond.exp
+++ b/gdb/testsuite/gdb.base/bg-exec-sigint-bp-cond.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,8 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
# AFTER_KILL_COND is appended to the breakpoint condition, after "kill
# -SIGINT $gdb_pid".
proc test { {after_kill_cond ""} } {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.base/bg-execution-repeat.c b/gdb/testsuite/gdb.base/bg-execution-repeat.c
index d5b48ee..3c0cc76 100644
--- a/gdb/testsuite/gdb.base/bg-execution-repeat.c
+++ b/gdb/testsuite/gdb.base/bg-execution-repeat.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -37,9 +37,9 @@ main (void)
{
alarm (60);
+ do_wait = 1;
foo ();
- do_wait = 1;
wait ();
/* do_wait set to 0 externally. */
diff --git a/gdb/testsuite/gdb.base/bg-execution-repeat.exp b/gdb/testsuite/gdb.base/bg-execution-repeat.exp
index 61f26f3..923092b 100644
--- a/gdb/testsuite/gdb.base/bg-execution-repeat.exp
+++ b/gdb/testsuite/gdb.base/bg-execution-repeat.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,9 +33,10 @@ proc test {continue_cmd} {
global binfile
global linenum
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -67,6 +68,17 @@ proc test {continue_cmd} {
# enable the "set var" command with an interrupt / continue& pair.
gdb_test -no-prompt-anchor "interrupt"
+ set test "interrupt received"
+ set re [string_to_regexp "Program received signal SIGINT, Interrupt."]
+ gdb_expect {
+ -re $re {
+ pass $test
+ }
+ timeout {
+ fail "$test (timeout)"
+ }
+ }
+
# Allow the breakpoint to trigger.
gdb_test -no-prompt-anchor "set var do_wait=0"
diff --git a/gdb/testsuite/gdb.base/bigcore.c b/gdb/testsuite/gdb.base/bigcore.c
index 8acfc0b..1c12f4e 100644
--- a/gdb/testsuite/gdb.base/bigcore.c
+++ b/gdb/testsuite/gdb.base/bigcore.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/bigcore.exp b/gdb/testsuite/gdb.base/bigcore.exp
index 5e09d2f..7066a63 100644
--- a/gdb/testsuite/gdb.base/bigcore.exp
+++ b/gdb/testsuite/gdb.base/bigcore.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,8 +28,8 @@ require isnative
# I/O bandwidth.
if { [istarget "*-*-*bsd*"]
- || [istarget "*-*-solaris*"]
- || [istarget "*-*-darwin*"]
+ || [istarget "*-*-solaris*"]
+ || [istarget "*-*-darwin*"]
|| [istarget "*-*-cygwin*"] } {
untested "kernel lacks sparse corefile support (PR gdb/1551)"
return
@@ -117,7 +117,8 @@ proc test {dumper} {
# Run GDB on the bigcore program up-to where it will dump core.
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
gdb_test_no_output "set print sevenbit-strings"
gdb_test_no_output "set width 0"
diff --git a/gdb/testsuite/gdb.base/bitfields.exp b/gdb/testsuite/gdb.base/bitfields.exp
index 6954a35..9a5eaff 100644
--- a/gdb/testsuite/gdb.base/bitfields.exp
+++ b/gdb/testsuite/gdb.base/bitfields.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -165,7 +165,7 @@ proc bitfield_at_offset {} {
global srcfile
gdb_breakpoint break5
- if [gdb_test "cont" "Break.*break5 \\(\\) at .*$srcfile:$decimal.*" "continuing to break5"] {
+ if {[gdb_test "cont" "Break.*break5 \\(\\) at .*$srcfile:$decimal.*" "continuing to break5"]} {
return
}
diff --git a/gdb/testsuite/gdb.base/bitfields2.exp b/gdb/testsuite/gdb.base/bitfields2.exp
index 3bd2d5b..124f9c2 100644
--- a/gdb/testsuite/gdb.base/bitfields2.exp
+++ b/gdb/testsuite/gdb.base/bitfields2.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,11 +13,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# This file was adapted from bitfields.exp by Paul Hilfinger
+# This file was adapted from bitfields.exp by Paul Hilfinger
# (Hilfinger@gnat.com)
#
-# Tests for bit-fields that do not fit in type (unsigned) int, but do fit
+# Tests for bit-fields that do not fit in type (unsigned) int, but do fit
# in type (unsigned) long long. We perform essentially the same tests as
# in bitfields.c, which considers only bit-fields that are <= 9 bits long.
#
@@ -33,7 +33,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
set has_signed_bitfields 1
#
-# Continue to expected breakpoint at FUNCTION. Append TAG to make pass/fail
+# Continue to expected breakpoint at FUNCTION. Append TAG to make pass/fail
# messages (to make them unique). Suppress tests on failure.
#
proc continue_test { function tag } {
@@ -54,7 +54,7 @@ proc start_test { function } {
gdb_breakpoint $function
continue_test $function "#0"
}
-
+
#
# Test bitfield locating and uniqueness.
@@ -233,7 +233,8 @@ proc bitfield_set {} {
}
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_test_no_output "set print sevenbit-strings"
runto_main
diff --git a/gdb/testsuite/gdb.base/bitops.exp b/gdb/testsuite/gdb.base/bitops.exp
index e0cbd87..0bf6b20 100644
--- a/gdb/testsuite/gdb.base/bitops.exp
+++ b/gdb/testsuite/gdb.base/bitops.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
# tests expressions with bitwise operators, and some
# logical operators
# Does not use a target program
-#
+#
#
diff --git a/gdb/testsuite/gdb.base/bitshift.exp b/gdb/testsuite/gdb.base/bitshift.exp
index dccc36b..1e308f2 100644
--- a/gdb/testsuite/gdb.base/bitshift.exp
+++ b/gdb/testsuite/gdb.base/bitshift.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -158,6 +158,7 @@ foreach signed {0 1} {
set sign_prefix "u"
}
foreach bits {8 16 32 64} {
+ # tclint-disable-next-line command-args
proc make_${sign_prefix}int${bits} {lang val} \
"make_val_cast \$lang $signed $bits \$val"
}
diff --git a/gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.c b/gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.c
index 48246df..6751546 100644
--- a/gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.c
+++ b/gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.exp b/gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.exp
index 8a1f729..648992c 100644
--- a/gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.exp
+++ b/gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -118,7 +118,8 @@ proc do_test {} {
# "attach".
with_test_prefix "run" {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
if {![runto_main]} {
return -1
@@ -129,7 +130,8 @@ with_test_prefix "run" {
with_test_prefix "attach" {
if {[can_spawn_for_attach]} {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
set test_spawn_id [spawn_wait_for_attach $binfile]
set testpid [spawn_id_get_pid $test_spawn_id]
diff --git a/gdb/testsuite/gdb.base/bp-cmds-execution-x-script.c b/gdb/testsuite/gdb.base/bp-cmds-execution-x-script.c
index ea18b9e..8deb8a9 100644
--- a/gdb/testsuite/gdb.base/bp-cmds-execution-x-script.c
+++ b/gdb/testsuite/gdb.base/bp-cmds-execution-x-script.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/bp-cmds-execution-x-script.exp b/gdb/testsuite/gdb.base/bp-cmds-execution-x-script.exp
index 1d91958..e2f301c 100644
--- a/gdb/testsuite/gdb.base/bp-cmds-execution-x-script.exp
+++ b/gdb/testsuite/gdb.base/bp-cmds-execution-x-script.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/bp-cmds-execution-x-script.gdb b/gdb/testsuite/gdb.base/bp-cmds-execution-x-script.gdb
index bc6305a..90d3e1a 100644
--- a/gdb/testsuite/gdb.base/bp-cmds-execution-x-script.gdb
+++ b/gdb/testsuite/gdb.base/bp-cmds-execution-x-script.gdb
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/bp-cmds-run-with-ex.c b/gdb/testsuite/gdb.base/bp-cmds-run-with-ex.c
index 27a14b7..65b18bc 100644
--- a/gdb/testsuite/gdb.base/bp-cmds-run-with-ex.c
+++ b/gdb/testsuite/gdb.base/bp-cmds-run-with-ex.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/bp-cmds-run-with-ex.exp b/gdb/testsuite/gdb.base/bp-cmds-run-with-ex.exp
index 62dd97a..37300f7 100644
--- a/gdb/testsuite/gdb.base/bp-cmds-run-with-ex.exp
+++ b/gdb/testsuite/gdb.base/bp-cmds-run-with-ex.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/bp-cmds-run-with-ex.gdb b/gdb/testsuite/gdb.base/bp-cmds-run-with-ex.gdb
index ed93473..a83c234 100644
--- a/gdb/testsuite/gdb.base/bp-cmds-run-with-ex.gdb
+++ b/gdb/testsuite/gdb.base/bp-cmds-run-with-ex.gdb
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/bp-cmds-sourced-script.c b/gdb/testsuite/gdb.base/bp-cmds-sourced-script.c
index 27a14b7..65b18bc 100644
--- a/gdb/testsuite/gdb.base/bp-cmds-sourced-script.c
+++ b/gdb/testsuite/gdb.base/bp-cmds-sourced-script.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/bp-cmds-sourced-script.exp b/gdb/testsuite/gdb.base/bp-cmds-sourced-script.exp
index 08df303..6ba7d10 100644
--- a/gdb/testsuite/gdb.base/bp-cmds-sourced-script.exp
+++ b/gdb/testsuite/gdb.base/bp-cmds-sourced-script.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/bp-cmds-sourced-script.gdb b/gdb/testsuite/gdb.base/bp-cmds-sourced-script.gdb
index 8debae9..e78cfed 100644
--- a/gdb/testsuite/gdb.base/bp-cmds-sourced-script.gdb
+++ b/gdb/testsuite/gdb.base/bp-cmds-sourced-script.gdb
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/bp-cond-failure.c b/gdb/testsuite/gdb.base/bp-cond-failure.c
index b742139..644d7fd 100644
--- a/gdb/testsuite/gdb.base/bp-cond-failure.c
+++ b/gdb/testsuite/gdb.base/bp-cond-failure.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/bp-cond-failure.exp b/gdb/testsuite/gdb.base/bp-cond-failure.exp
index b4c046c..f33092b 100644
--- a/gdb/testsuite/gdb.base/bp-cond-failure.exp
+++ b/gdb/testsuite/gdb.base/bp-cond-failure.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
standard_testfile
-if { [prepare_for_testing "failed to prepare" ${binfile} "${srcfile}" \
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
{debug c++}] == -1 } {
return
}
@@ -45,7 +45,8 @@ if { [is_address_zero_readable] } {
}
proc run_test { cond_eval access_type bpexpr nloc } {
- clean_restart ${::binfile}
+ clean_restart
+ gdb_load $::binfile
if { ![runto_main] } {
return -1
@@ -75,7 +76,7 @@ proc run_test { cond_eval access_type bpexpr nloc } {
"Error in testing condition for breakpoint ${bp_num}.2:" \
"Cannot access memory at address 0x0" \
"" \
- "Breakpoint ${bp_num}.2, foo \\(c=49 ...\\) at \[^\r\n\]+:\[0-9\]+" \
+ "(Thread \[^\r\n\]+ hit )?Breakpoint ${bp_num}.2, foo \\(c=49 ...\\) at \[^\r\n\]+:\[0-9\]+" \
"${::decimal}\\s+\[^\r\n\]+ breakpoint here\\. \[^\r\n\]+"]
} else {
gdb_test "continue" \
@@ -84,7 +85,7 @@ proc run_test { cond_eval access_type bpexpr nloc } {
"Error in testing condition for breakpoint ${bp_num}:" \
"Cannot access memory at address 0x0" \
"" \
- "Breakpoint ${bp_num}, bar \\(\\) at \[^\r\n\]+:\[0-9\]+" \
+ "(Thread \[^\r\n\]+ hit )?Breakpoint ${bp_num}, bar \\(\\) at \[^\r\n\]+:\[0-9\]+" \
"${::decimal}\\s+\[^\r\n\]+ breakpoint here\\. \[^\r\n\]+"]
}
}
diff --git a/gdb/testsuite/gdb.base/bp-disabled-by-cond.exp b/gdb/testsuite/gdb.base/bp-disabled-by-cond.exp
index f0bdd16..371b9e7 100644
--- a/gdb/testsuite/gdb.base/bp-disabled-by-cond.exp
+++ b/gdb/testsuite/gdb.base/bp-disabled-by-cond.exp
@@ -52,7 +52,8 @@ set exit_bp_line [gdb_get_line_number "BP before exit" $srcfile]
# Restart the inferior, which should unload the shared library, GDB
# should mark the b/p as disabled due to its condition again.
proc run_test { hit_cond } {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.base/bp-permanent.c b/gdb/testsuite/gdb.base/bp-permanent.c
index 99f1c41..72e5e8a 100644
--- a/gdb/testsuite/gdb.base/bp-permanent.c
+++ b/gdb/testsuite/gdb.base/bp-permanent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -101,7 +101,7 @@ test_signal_no_handler (void)
}
static void
-test_signal_nested_handler ()
+test_signal_nested_handler (int sig)
{
test ();
}
diff --git a/gdb/testsuite/gdb.base/bp-permanent.exp b/gdb/testsuite/gdb.base/bp-permanent.exp
index aa55442..df51126 100644
--- a/gdb/testsuite/gdb.base/bp-permanent.exp
+++ b/gdb/testsuite/gdb.base/bp-permanent.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,8 @@ proc test {always_inserted sw_watchpoint} {
global gdb_prompt
global srcfile binfile
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
if {![runto_main]} {
return -1
@@ -102,7 +103,7 @@ proc test {always_inserted sw_watchpoint} {
# We now have the breakpoint instruction stored in 'buffer'. Poke it
# to memory manually.
- set count [expr $address_after_bp - $address_bp]
+ set count [expr {$address_after_bp - $address_bp}]
for {set i 0} {$i < $count} {incr i} {
set test "p /x addr_bp\[$i\] = buffer\[$i\]"
gdb_test_multiple $test $test {
@@ -134,7 +135,7 @@ proc test {always_inserted sw_watchpoint} {
unsupported "failed to stop at permanent breakpoint"
return
}
- -re "Program received signal SIGTRAP.*$gdb_prompt $" {
+ -re "received signal SIGTRAP.*$gdb_prompt $" {
pass $test
}
}
@@ -174,7 +175,7 @@ proc test {always_inserted sw_watchpoint} {
# disabled, it should act as if we hadn't created it in the first
# place. IOW, we should get a random signal, and, the breakpoint's
# command should not run.
- gdb_test "continue" "Program received signal SIGTRAP.*" \
+ gdb_test "continue" "received signal SIGTRAP.*" \
"disabled permanent breakpoint doesn't explain stop"
gdb_test "info breakpoints" \
@@ -215,7 +216,7 @@ proc test {always_inserted sw_watchpoint} {
gdb_test "next" "after next .*"
}
- if ![target_info exists gdb,nosignals] {
+ if {![target_info exists gdb,nosignals]} {
with_test_prefix "continue trips on nested permanent bp" {
delete_breakpoints
@@ -241,7 +242,7 @@ proc test {always_inserted sw_watchpoint} {
gdb_test "p counter" " = 2"
}
- if [can_single_step_to_signal_handler] {
+ if {[can_single_step_to_signal_handler]} {
with_test_prefix "stepi signal with handler" {
delete_breakpoints
diff --git a/gdb/testsuite/gdb.base/branch-to-self.c b/gdb/testsuite/gdb.base/branch-to-self.c
index 9647371..fc48ac2 100644
--- a/gdb/testsuite/gdb.base/branch-to-self.c
+++ b/gdb/testsuite/gdb.base/branch-to-self.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/branch-to-self.exp b/gdb/testsuite/gdb.base/branch-to-self.exp
index 71859d7..3f09786 100644
--- a/gdb/testsuite/gdb.base/branch-to-self.exp
+++ b/gdb/testsuite/gdb.base/branch-to-self.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ with_test_prefix "single-step" {
global testfile
clean_restart ${testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
set line_num [gdb_get_line_number "loop-line" ${testfile}.c]
@@ -60,7 +60,7 @@ with_test_prefix "break-cond" {
clean_restart ${testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/break-always.c b/gdb/testsuite/gdb.base/break-always.c
index b75febc..a4b389a 100644
--- a/gdb/testsuite/gdb.base/break-always.c
+++ b/gdb/testsuite/gdb.base/break-always.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-always.exp b/gdb/testsuite/gdb.base/break-always.exp
index 5bd0527..24d8d65 100644
--- a/gdb/testsuite/gdb.base/break-always.exp
+++ b/gdb/testsuite/gdb.base/break-always.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-caller-line.c b/gdb/testsuite/gdb.base/break-caller-line.c
index 8829a1b..f3762db 100644
--- a/gdb/testsuite/gdb.base/break-caller-line.c
+++ b/gdb/testsuite/gdb.base/break-caller-line.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-caller-line.exp b/gdb/testsuite/gdb.base/break-caller-line.exp
index 13d5e55..9925a1d 100644
--- a/gdb/testsuite/gdb.base/break-caller-line.exp
+++ b/gdb/testsuite/gdb.base/break-caller-line.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile}] } {
return -1
}
-if ![runto callee] {
+if {![runto callee]} {
return 0
}
diff --git a/gdb/testsuite/gdb.base/break-dbg.cc b/gdb/testsuite/gdb.base/break-dbg.cc
new file mode 100644
index 0000000..642ded0
--- /dev/null
+++ b/gdb/testsuite/gdb.base/break-dbg.cc
@@ -0,0 +1,31 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+volatile int global_var = 0;
+
+int
+foo ()
+{
+ return global_var;
+}
+
+int
+main ()
+{
+ int res = foo ();
+ return res;
+}
diff --git a/gdb/testsuite/gdb.base/break-dbg.exp b/gdb/testsuite/gdb.base/break-dbg.exp
new file mode 100644
index 0000000..a7c7d92
--- /dev/null
+++ b/gdb/testsuite/gdb.base/break-dbg.exp
@@ -0,0 +1,80 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+# Some basic testing of 'set debug breakpoint on'. At one point a bug
+# meant that some breakpoints would immediately trigger a segfault if
+# GDB tried to run with breakpoint debugging turned on.
+#
+# Test is compiled as C++ only so 'catch catch/throw/rethrow' have a
+# something to do. The original bug would trigger for any 'catch'
+# style breakpoint, so C++ isn't really a hard requirement.
+
+standard_testfile .cc
+
+require allow_cplus_tests
+
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
+ {debug c++}] } {
+ return
+}
+
+if {![runto_main]} {
+ return
+}
+
+gdb_test "catch catch" "^Catchpoint $decimal \\(catch\\)"
+gdb_test "catch throw" "^Catchpoint $decimal \\(throw\\)"
+gdb_test "catch rethrow" "^Catchpoint $decimal \\(rethrow\\)"
+
+gdb_test "catch exec" "^Catchpoint $decimal \\(exec\\)"
+gdb_test "catch fork" "^Catchpoint $decimal \\(fork\\)"
+gdb_test "catch vfork" "^Catchpoint $decimal \\(vfork\\)"
+
+gdb_test "catch load" "^Catchpoint $decimal \\(load\\)"
+gdb_test "catch unload" "^Catchpoint $decimal \\(unload\\)"
+
+gdb_test "catch signal" "^Catchpoint $decimal \\(standard signals\\)"
+
+set re_warning_xml_disabled \
+ [string_to_regexp \
+ [join \
+ [list \
+ "warning: Can not parse XML syscalls information;" \
+ "XML support was disabled at compile time."]]]
+gdb_test "catch syscall" \
+ [multi_line \
+ "^($re_warning_xml_disabled" \
+ ")?Catchpoint $decimal [string_to_regexp {(any syscall)}]"]
+
+gdb_test "watch -l global_var" "\[Ww]atchpoint $decimal: -location global_var"
+
+gdb_test_no_output "set debug breakpoint on"
+
+set saw_bp_debug_line false
+gdb_test_multiple "step" "" {
+ -re "^step\r\n" {
+ exp_continue
+ }
+ -re "^\\\[breakpoint\\\] \[^\r\n\]+\r\n" {
+ set saw_bp_debug_line true
+ exp_continue
+ }
+ -re "^$gdb_prompt $" {
+ gdb_assert { $saw_bp_debug_line } $gdb_test_name
+ }
+ -re "^\[^\r\n\]*\r\n" {
+ exp_continue
+ }
+}
diff --git a/gdb/testsuite/gdb.base/break-entry.exp b/gdb/testsuite/gdb.base/break-entry.exp
index 709ed1a..584ddaf 100644
--- a/gdb/testsuite/gdb.base/break-entry.exp
+++ b/gdb/testsuite/gdb.base/break-entry.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -56,7 +56,7 @@ if {[istarget powerpc64-*] && [is_lp64_target]} {
}
}
-if ![runto "*$entry"] {
+if {![runto "*$entry"]} {
return
}
gdb_test {p/x $pc} " = $entry"
diff --git a/gdb/testsuite/gdb.base/break-fun-addr.exp b/gdb/testsuite/gdb.base/break-fun-addr.exp
index c57b1cd..ba6e32e 100644
--- a/gdb/testsuite/gdb.base/break-fun-addr.exp
+++ b/gdb/testsuite/gdb.base/break-fun-addr.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,7 +44,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile1}" executable {d
# on the first instruction of function "main" ("*main"), then
# run to that breakpoint.
-clean_restart ${binfile1}
+clean_restart
+gdb_load $binfile1
with_test_prefix "${testfile1}" {
diff --git a/gdb/testsuite/gdb.base/break-fun-addr1.c b/gdb/testsuite/gdb.base/break-fun-addr1.c
index a3b9352..6d906ec 100644
--- a/gdb/testsuite/gdb.base/break-fun-addr1.c
+++ b/gdb/testsuite/gdb.base/break-fun-addr1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-fun-addr2.c b/gdb/testsuite/gdb.base/break-fun-addr2.c
index 7353dc8..6e70405 100644
--- a/gdb/testsuite/gdb.base/break-fun-addr2.c
+++ b/gdb/testsuite/gdb.base/break-fun-addr2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-idempotent.c b/gdb/testsuite/gdb.base/break-idempotent.c
index b763a30..c0417fb 100644
--- a/gdb/testsuite/gdb.base/break-idempotent.c
+++ b/gdb/testsuite/gdb.base/break-idempotent.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-idempotent.exp b/gdb/testsuite/gdb.base/break-idempotent.exp
index 0903841..842ce42 100644
--- a/gdb/testsuite/gdb.base/break-idempotent.exp
+++ b/gdb/testsuite/gdb.base/break-idempotent.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -161,11 +161,11 @@ foreach_with_prefix pie { "nopie" "pie" } {
set binfile [standard_output_file $testfile-$pie]
- if {[prepare_for_testing "failed to prepare" $binfile $srcfile $opts]} {
+ if {[prepare_for_testing "failed to prepare" $testfile-$pie $srcfile $opts]} {
continue
}
- if [is_remote host] {
+ if {[is_remote host]} {
set arg [remote_download host $binfile]
if { $arg == "" } {
untested "download failed"
diff --git a/gdb/testsuite/gdb.base/break-include.c b/gdb/testsuite/gdb.base/break-include.c
index fd92386..2b0d2dd 100644
--- a/gdb/testsuite/gdb.base/break-include.c
+++ b/gdb/testsuite/gdb.base/break-include.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-include.exp b/gdb/testsuite/gdb.base/break-include.exp
index a7fde67..a374d6b 100644
--- a/gdb/testsuite/gdb.base/break-include.exp
+++ b/gdb/testsuite/gdb.base/break-include.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-include.inc b/gdb/testsuite/gdb.base/break-include.inc
index 899ff4d..245bd65 100644
--- a/gdb/testsuite/gdb.base/break-include.inc
+++ b/gdb/testsuite/gdb.base/break-include.inc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-inline.c b/gdb/testsuite/gdb.base/break-inline.c
index a3768a6..43e97f5 100644
--- a/gdb/testsuite/gdb.base/break-inline.c
+++ b/gdb/testsuite/gdb.base/break-inline.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-inline.exp b/gdb/testsuite/gdb.base/break-inline.exp
index 56603f6..5793c4e 100644
--- a/gdb/testsuite/gdb.base/break-inline.exp
+++ b/gdb/testsuite/gdb.base/break-inline.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-interp-lib.c b/gdb/testsuite/gdb.base/break-interp-lib.c
index 4cec45e..1230a5e 100644
--- a/gdb/testsuite/gdb.base/break-interp-lib.c
+++ b/gdb/testsuite/gdb.base/break-interp-lib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-interp-main.c b/gdb/testsuite/gdb.base/break-interp-main.c
index b4c600f..b0358c2 100644
--- a/gdb/testsuite/gdb.base/break-interp-main.c
+++ b/gdb/testsuite/gdb.base/break-interp-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index fd8afdd..f06c15f 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -49,19 +49,19 @@ proc system_debug_get {exec} {
# isfile returns 1 even for symlinks to files.
set retval $debug_root/$exec_build_id_debug
- if [file isfile $retval] {
+ if {[file isfile $retval]} {
return $retval
}
set retval $exec_dir/$debug_base
- if [file isfile $retval] {
+ if {[file isfile $retval]} {
return $retval
}
set retval $exec_dir/.debug/$debug_base
- if [file isfile $retval] {
+ if {[file isfile $retval]} {
return $retval
}
set retval $debug_root/$exec_dir/$debug_base
- if [file isfile $retval] {
+ if {[file isfile $retval]} {
return $retval
}
return ""
@@ -78,7 +78,8 @@ gdb_test_multiple $test $test {
}
set interp_system [section_get [standard_output_file $binfile_test] .interp]
-clean_restart $interp_system
+clean_restart
+gdb_load $interp_system
set dl_main_found 0
gdb_test_multiple "info addr dl_main" "" {
-re -wrap "Symbol \"dl_main\" is a function at address $hex\\." {
@@ -107,7 +108,7 @@ proc strip_debug {dest} {
set strip_program [transform strip]
set command "exec $strip_program --strip-debug $dest"
verbose -log "command is $command"
- if [catch $command] {
+ if {[catch {{*}$command}]} {
fail $test
return 0
} else {
@@ -185,7 +186,7 @@ proc reach_1 {func command displacement} {
}
}
}
- if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
+ if {![regexp {^(NONE|FOUND-.*)$} $displacement]} {
fail $test_displacement
}
@@ -218,6 +219,7 @@ proc test_core {file displacement} {
set corefile [core_find $file {} "segv"]
if {$corefile == ""} {
+ untested "unable to create or find corefile"
return
}
@@ -255,7 +257,7 @@ proc test_core {file displacement} {
pass $test
}
}
- if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
+ if {![regexp {^(NONE|FOUND-.*)$} $displacement]} {
fail $test_displacement
}
gdb_test_no_output "set verbose off"
@@ -306,7 +308,7 @@ proc test_attach_gdb {file pid displacement prefix} {
pass $test
}
}
- if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
+ if {![regexp {^(NONE|FOUND-.*)$} $displacement]} {
fail $test_displacement
}
gdb_test_no_output "set verbose off"
@@ -379,7 +381,7 @@ proc test_attach {file displacement {relink_args ""}} {
# `libfunc' is present in the backtrace and therefore the
# displacement has been guessed right.
- if [prelink$relink $relink_args [file tail $exec]] {
+ if {[prelink$relink $relink_args [file tail $exec]]} {
# /proc/PID/exe cannot be loaded as it is "EXECNAME (deleted)".
test_attach_gdb $exec $pid $displacement "attach-relink$relink"
}
@@ -409,7 +411,7 @@ proc test_ld {file ifmain trynosym displacement} {
# prevents that from happening. So turn it off.
gdb_test "set disable-randomization off"
- if $ifmain {
+ if {$ifmain} {
gdb_test_no_output "set args segv"
} else {
global binfile_test
@@ -448,7 +450,7 @@ proc test_ld {file ifmain trynosym displacement} {
gdb_test_no_output "set verbose on"
}
- if $ifmain {
+ if {$ifmain} {
reach "main" continue "NONE"
reach "libfunc" continue "NONE"
@@ -465,13 +467,13 @@ proc test_ld {file ifmain trynosym displacement} {
reach $solib_bp "run" $displacement 2
gdb_test_no_output "set verbose off"
- if $ifmain {
+ if {$ifmain} {
test_core $file $displacement
test_attach $file $displacement
}
- if !$trynosym {
+ if {!$trynosym} {
return
}
@@ -492,7 +494,7 @@ proc test_ld {file ifmain trynosym displacement} {
set escapedfile [string_to_regexp $file]
gdb_test "exec-file $file" "exec-file $escapedfile" "load"
- if $ifmain {
+ if {$ifmain} {
reach $solib_bp run $displacement 3
set entrynohex ""
@@ -548,7 +550,7 @@ proc test_ld {file ifmain trynosym displacement} {
pass $test
}
}
- if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
+ if {![regexp {^(NONE|FOUND-.*)$} $displacement]} {
fail $test_displacement
}
}
@@ -587,7 +589,7 @@ foreach_with_prefix ldprelink {NO YES} {
file_copy $interp_system $interp
# Never call strip-debug before unprelink:
# prelink: ...: Section .note.gnu.build-id created after prelinking
- if ![prelinkNO $interp] {
+ if {![prelinkNO $interp]} {
continue
}
strip_debug $interp
@@ -603,7 +605,7 @@ foreach_with_prefix ldprelink {NO YES} {
set test "eu-unstrip unprelinked:[file tail $interp_system] + [file tail $interp_system_debug] to [file tail $interp]"
set command "exec eu-unstrip -o $interp $interp ${interp}.debug"
verbose -log "command is $command"
- if [catch $command] {
+ if {[catch {{*}$command}]} {
setup_xfail *-*-*
fail $test
continue
@@ -613,7 +615,7 @@ foreach_with_prefix ldprelink {NO YES} {
} elseif {$ldsepdebug == "SEP" && $interp_system_debug == ""} {
file_copy $interp_system $interp
# eu-unstrip: DWARF data in '...' not adjusted for prelinking bias; consider prelink -u
- if ![prelinkNO $interp] {
+ if {![prelinkNO $interp]} {
continue
}
gdb_gnu_strip_debug $interp
@@ -623,14 +625,14 @@ foreach_with_prefix ldprelink {NO YES} {
}
if {$ldsepdebug == "SEP"} {
- if ![prelinkNO "${interp}.debug"] {
+ if {![prelinkNO "${interp}.debug"]} {
continue
}
} else {
file delete "${interp}.debug"
}
- if ![prelink$ldprelink $interp "[file tail $interp], second time"] {
+ if {![prelink$ldprelink $interp "[file tail $interp], second time"]} {
continue
}
@@ -645,7 +647,7 @@ foreach_with_prefix ldprelink {NO YES} {
}
test_ld $interp 0 [expr {$ldsepdebug == "NO"}] $displacement
- if ![file_copy $interp $interp_saved] {
+ if {![file_copy $interp $interp_saved]} {
continue
}
diff --git a/gdb/testsuite/gdb.base/break-main-file-remove-fail.c b/gdb/testsuite/gdb.base/break-main-file-remove-fail.c
index fa82eba..fec6526 100644
--- a/gdb/testsuite/gdb.base/break-main-file-remove-fail.c
+++ b/gdb/testsuite/gdb.base/break-main-file-remove-fail.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-main-file-remove-fail.exp b/gdb/testsuite/gdb.base/break-main-file-remove-fail.exp
index 97b662c..4dd88cd 100644
--- a/gdb/testsuite/gdb.base/break-main-file-remove-fail.exp
+++ b/gdb/testsuite/gdb.base/break-main-file-remove-fail.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -55,7 +55,7 @@ proc test_remove_bp { initial_load } {
gdb_reload
}
- if ![runto start] {
+ if {![runto start]} {
return
}
@@ -86,7 +86,7 @@ proc test_remove_bp { initial_load } {
# remove the memory breakpoint afterwards should fail, and GDB
# should warn the user about it.
set pagesize [get_integer_valueof "pg_size" 0]
- set align_addr [expr $bp_addr - $bp_addr % $pagesize]
+ set align_addr [expr {$bp_addr - $bp_addr % $pagesize}]
set munmap_prototype "int (*) (void *, size_t)"
set munmap_expr "(($munmap_prototype) munmap) ($align_addr, $pagesize)"
diff --git a/gdb/testsuite/gdb.base/break-on-linker-gcd-function.cc b/gdb/testsuite/gdb.base/break-on-linker-gcd-function.cc
index f658595..13b74a6 100644
--- a/gdb/testsuite/gdb.base/break-on-linker-gcd-function.cc
+++ b/gdb/testsuite/gdb.base/break-on-linker-gcd-function.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp b/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp
index cf1596a..6bd6219 100644
--- a/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp
+++ b/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-probes-solib.c b/gdb/testsuite/gdb.base/break-probes-solib.c
index 308c738..8011b9a 100644
--- a/gdb/testsuite/gdb.base/break-probes-solib.c
+++ b/gdb/testsuite/gdb.base/break-probes-solib.c
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-probes.c b/gdb/testsuite/gdb.base/break-probes.c
index ce6f1c1..61fc7fc 100644
--- a/gdb/testsuite/gdb.base/break-probes.c
+++ b/gdb/testsuite/gdb.base/break-probes.c
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-probes.exp b/gdb/testsuite/gdb.base/break-probes.exp
index 3ebd896..d377801 100644
--- a/gdb/testsuite/gdb.base/break-probes.exp
+++ b/gdb/testsuite/gdb.base/break-probes.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-unload-file.c b/gdb/testsuite/gdb.base/break-unload-file.c
index 80a65f6..07bb943 100644
--- a/gdb/testsuite/gdb.base/break-unload-file.c
+++ b/gdb/testsuite/gdb.base/break-unload-file.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break-unload-file.exp b/gdb/testsuite/gdb.base/break-unload-file.exp
index fb9874b..9eab6b9 100644
--- a/gdb/testsuite/gdb.base/break-unload-file.exp
+++ b/gdb/testsuite/gdb.base/break-unload-file.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break.c b/gdb/testsuite/gdb.base/break.c
index b1c5159..51dd654 100644
--- a/gdb/testsuite/gdb.base/break.c
+++ b/gdb/testsuite/gdb.base/break.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1992-2024 Free Software Foundation, Inc.
+ Copyright 1992-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp
index 34ac219..e1f4860 100644
--- a/gdb/testsuite/gdb.base/break.exp
+++ b/gdb/testsuite/gdb.base/break.exp
@@ -1,4 +1,4 @@
-# Copyright 1988-2024 Free Software Foundation, Inc.
+# Copyright 1988-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -765,7 +765,7 @@ proc_with_prefix test_next_with_recursion {} {
delete_breakpoints
- if [istarget "mips*tx39-*"] {
+ if {[istarget "mips*tx39-*"]} {
set timeout 60
}
# We used to set timeout here for all other targets as well. This
diff --git a/gdb/testsuite/gdb.base/break1.c b/gdb/testsuite/gdb.base/break1.c
index 756e59b..26c4663 100644
--- a/gdb/testsuite/gdb.base/break1.c
+++ b/gdb/testsuite/gdb.base/break1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1992-2024 Free Software Foundation, Inc.
+ Copyright 1992-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,13 @@ struct some_struct
{
int a_field;
int b_field;
- union { int z_field; };
+ union
+ {
+ struct
+ {
+ int z_field;
+ };
+ };
};
struct some_struct values[50];
diff --git a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.c b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.c
index 1e9e789..2b15698 100644
--- a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.c
+++ b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
index 21cc7ff..7c6b1cb 100644
--- a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
+++ b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -139,7 +139,7 @@ proc get_next_insn {} {
set hw_step [probe_target_hardware_step]
-if ![get_function_bounds "main" main_lo main_hi] {
+if {![get_function_bounds "main" main_lo main_hi]} {
# Can't do the following tests if main's bounds are unknown.
return -1
}
diff --git a/gdb/testsuite/gdb.base/breakpoint-shadow.c b/gdb/testsuite/gdb.base/breakpoint-shadow.c
index 836be65..2a128d5 100644
--- a/gdb/testsuite/gdb.base/breakpoint-shadow.c
+++ b/gdb/testsuite/gdb.base/breakpoint-shadow.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/breakpoint-shadow.exp b/gdb/testsuite/gdb.base/breakpoint-shadow.exp
index 9cf88e9..8e74ec2 100644
--- a/gdb/testsuite/gdb.base/breakpoint-shadow.exp
+++ b/gdb/testsuite/gdb.base/breakpoint-shadow.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
}
# We need to start the inferior to place the breakpoints in the memory at all.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -51,7 +51,7 @@ proc test_disassembly {test} {
gdb_test_multiple "disass main" $test {
-re $match {
set got $expect_out(1,string)
- if [string equal -nocase $orig $got] {
+ if {[string equal -nocase $orig $got]} {
pass $test
} else {
fail $test
diff --git a/gdb/testsuite/gdb.base/bt-on-error-and-warning.exp b/gdb/testsuite/gdb.base/bt-on-error-and-warning.exp
index e83cc6c..8a5970a 100644
--- a/gdb/testsuite/gdb.base/bt-on-error-and-warning.exp
+++ b/gdb/testsuite/gdb.base/bt-on-error-and-warning.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/bt-on-fatal-signal.c b/gdb/testsuite/gdb.base/bt-on-fatal-signal.c
index 0f0e857..2a061a8 100644
--- a/gdb/testsuite/gdb.base/bt-on-fatal-signal.c
+++ b/gdb/testsuite/gdb.base/bt-on-fatal-signal.c
@@ -1,4 +1,4 @@
-/* Copyright 2021-2024 Free Software Foundation, Inc.
+/* Copyright 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp b/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp
index 81a634d..1ef9774 100644
--- a/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp
+++ b/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -61,7 +61,8 @@ foreach test_data {{SEGV "Segmentation fault"} \
# Restart GDB.
save_vars { GDB } {
set GDB [gdb_no_core]
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
}
# Capture the pid of GDB.
@@ -125,7 +126,7 @@ foreach test_data {{SEGV "Segmentation fault"} \
gdb_assert { $saw_fatal_msg }
gdb_assert { $saw_bt_start }
gdb_assert { $saw_bt_end }
- gdb_assert { [expr $internal_error_msg_count == 2] }
+ gdb_assert { [expr {$internal_error_msg_count == 2}] }
}
-re "$gdb_prompt $" {
# GDB should terminate, we should never get back to
diff --git a/gdb/testsuite/gdb.base/bt-selected-frame.c b/gdb/testsuite/gdb.base/bt-selected-frame.c
index 8ac8c33..00010cf 100644
--- a/gdb/testsuite/gdb.base/bt-selected-frame.c
+++ b/gdb/testsuite/gdb.base/bt-selected-frame.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/bt-selected-frame.exp b/gdb/testsuite/gdb.base/bt-selected-frame.exp
index 123cf17..bbe2a5a 100644
--- a/gdb/testsuite/gdb.base/bt-selected-frame.exp
+++ b/gdb/testsuite/gdb.base/bt-selected-frame.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,8 @@ if { [build_executable "failed to prepare" $testfile $srcfile debug] } {
proc check_selected_frame_after_bt { bt_cmd stack_pattern } {
global binfile
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
with_test_prefix $bt_cmd {
diff --git a/gdb/testsuite/gdb.base/build-id-seqno.c b/gdb/testsuite/gdb.base/build-id-seqno.c
index e2119ba7..ce81e8e 100644
--- a/gdb/testsuite/gdb.base/build-id-seqno.c
+++ b/gdb/testsuite/gdb.base/build-id-seqno.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/build-id-seqno.exp b/gdb/testsuite/gdb.base/build-id-seqno.exp
index 9566933..48f883c 100644
--- a/gdb/testsuite/gdb.base/build-id-seqno.exp
+++ b/gdb/testsuite/gdb.base/build-id-seqno.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/c-linkage-name-2.c b/gdb/testsuite/gdb.base/c-linkage-name-2.c
index a3eaa93..f12dfa5 100644
--- a/gdb/testsuite/gdb.base/c-linkage-name-2.c
+++ b/gdb/testsuite/gdb.base/c-linkage-name-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/c-linkage-name.c b/gdb/testsuite/gdb.base/c-linkage-name.c
index 7c138e8..e974b7e 100644
--- a/gdb/testsuite/gdb.base/c-linkage-name.c
+++ b/gdb/testsuite/gdb.base/c-linkage-name.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/c-linkage-name.exp b/gdb/testsuite/gdb.base/c-linkage-name.exp
index 3d219bd..a373540 100644
--- a/gdb/testsuite/gdb.base/c-linkage-name.exp
+++ b/gdb/testsuite/gdb.base/c-linkage-name.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/cached-source-file.c b/gdb/testsuite/gdb.base/cached-source-file.c
index eb5319b..e352484 100644
--- a/gdb/testsuite/gdb.base/cached-source-file.c
+++ b/gdb/testsuite/gdb.base/cached-source-file.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/cached-source-file.exp b/gdb/testsuite/gdb.base/cached-source-file.exp
index b063362..73d9359 100644
--- a/gdb/testsuite/gdb.base/cached-source-file.exp
+++ b/gdb/testsuite/gdb.base/cached-source-file.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2020-2024 Free Software Foundation, Inc.
+# Copyright (C) 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp
index c0a47a7..fd1f1a0 100644
--- a/gdb/testsuite/gdb.base/call-ar-st.exp
+++ b/gdb/testsuite/gdb.base/call-ar-st.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} {
set oldtimeout $timeout
-set timeout [expr "$timeout + 60"]
+set timeout [expr {$timeout + 60}]
gdb_test_no_output "set print sevenbit-strings"
gdb_test_no_output "set print address off"
@@ -86,7 +86,7 @@ set array_c_re \
"aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ" \
"aZaZaZaZaZaZaZaZaZa"]
-if ![gdb_skip_stdio_test "print_char_array(char_array)"] {
+if {![gdb_skip_stdio_test "print_char_array(char_array)"]} {
gdb_test_stdio "print print_char_array(char_array)" $array_c_re
}
@@ -95,7 +95,7 @@ gdb_test "tbreak $stop_line" \
"Temporary breakpoint.*file.*$srcfile, line $stop_line.*" \
"tbreakpoint at tbreak2"
-if ![gdb_skip_stdio_test "continue to tbreak2"] {
+if {![gdb_skip_stdio_test "continue to tbreak2"]} {
set gdb_re \
[multi_line \
"main.*at.*:\[0-9\]+" \
@@ -106,7 +106,7 @@ if ![gdb_skip_stdio_test "continue to tbreak2"] {
}
# I am disabling this test, because it takes too long. I verified by
-# hand that it works, feel free to check for yourself.
+# hand that it works, feel free to check for yourself.
#call print_all_arrays(integer_array, char_array, float_array, double_array)
#send_gdb "print print_all_arrays(integer_array, char_array, float_array, double_array)\n"
#gdb_expect {
@@ -165,7 +165,7 @@ gdb_test "step" \
"step inside print_all_arrays"
#step -over
-if ![gdb_skip_stdio_test "next over print_int_array in print_all_arrays"] {
+if {![gdb_skip_stdio_test "next over print_int_array in print_all_arrays"]} {
set stop_line [gdb_get_line_number "-next1-"]
gdb_test_stdio "next" \
"array_i :" \
@@ -214,7 +214,7 @@ if {$allow_float_test && \
#call sum_array_print(10, *list1, *list2, *list3, *list4)
-if ![gdb_skip_stdio_test "print sum_array_print(...)"] {
+if {![gdb_skip_stdio_test "print sum_array_print(...)"]} {
gdb_test_stdio "print sum_array_print(10, *list1, *list2, *list3, *list4)" \
[multi_line \
@@ -239,7 +239,7 @@ if ![gdb_skip_stdio_test "print sum_array_print(...)"] {
#step over
set stop_line [gdb_get_line_number "-next2-"]
-if ![gdb_skip_stdio_test "next to next2"] {
+if {![gdb_skip_stdio_test "next to next2"]} {
gdb_test_stdio "next" \
"BYE BYE FOR NOW" \
"$stop_line.*printf\\(.VERY GREEN GRASS.n.\\);.*" \
@@ -250,7 +250,7 @@ if ![gdb_skip_stdio_test "next to next2"] {
#call print_array_rep(\*list1, \*list2, \*list3)
-if ![gdb_skip_stdio_test "print print_array_rep(...)"] {
+if {![gdb_skip_stdio_test "print print_array_rep(...)"]} {
gdb_test_stdio "print print_array_rep(\*list1, \*list2, \*list3)" \
"Contents of linked list3:"
}
@@ -300,7 +300,7 @@ gdb_test "tbreak $stop_line" \
"Temporary breakpoint.* file .*$srcfile, line $stop_line.*" \
"tbreakpoint at tbreak6"
-if ![gdb_skip_stdio_test "continuing to tbreak6"] {
+if {![gdb_skip_stdio_test "continuing to tbreak6"]} {
gdb_test_stdio "continue" \
"Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t" \
"main \\(\\) at .*$srcfile:$stop_line.*c = 0.*" \
@@ -309,8 +309,8 @@ if ![gdb_skip_stdio_test "continuing to tbreak6"] {
gdb_test "continue" ".*" ""
}
-#call print_small_structs(*struct1, *struct2, *struct3, *struct4,
-# *flags, *flags_combo, *three_char, *five_char,
+#call print_small_structs(*struct1, *struct2, *struct3, *struct4,
+# *flags, *flags_combo, *three_char, *five_char,
# *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)
if {$allow_float_test && \
@@ -373,7 +373,7 @@ gdb_test "print compute_with_small_structs(20)" \
"\[0-9\]+ = void"
-#call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098,
+#call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098,
# 3.14, -5678.12345, -0.11111111, 216.97065)
if {$allow_float_test && \
@@ -422,8 +422,8 @@ if {$allow_float_test} {
set ws "\[\n\r\t \]+"
-#call print_small_structs(struct1, struct2, struct3, struct4, flags,
-# flags_combo, three_char, five_char, int_char_combo,
+#call print_small_structs(struct1, struct2, struct3, struct4, flags,
+# flags_combo, three_char, five_char, int_char_combo,
# d1, d2, d3, f1, f2, f3)
if {$allow_float_test && \
@@ -495,7 +495,7 @@ gdb_test "tbreak $stop_line" \
"Temporary breakpoint.* file .*$srcfile, line $stop_line.*" \
"tbreakpoint at tbreak8"
-if ![gdb_skip_stdio_test "continuing to tbreak8"] {
+if {![gdb_skip_stdio_test "continuing to tbreak8"]} {
gdb_test_stdio "continue" \
"Contents of two_floats_t:" \
".*main \\(\\) at.*$srcfile:$stop_line.*$stop_line.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \
@@ -511,7 +511,7 @@ gdb_test "step" \
"step into init_bit_flags_combo"
#call print_bit_flags_combo(*bit_flags_combo)
-if ![gdb_skip_stdio_test "continuing at step3"] {
+if {![gdb_skip_stdio_test "continuing at step3"]} {
gdb_test_stdio "print print_bit_flags_combo(*bit_flags_combo)" \
"alpha.*gamma.*epsilon.*ch1: y.*ch2: n"
}
@@ -600,14 +600,14 @@ gdb_test continue "Continuing\\..*main \\(\\) at .*$srcfile:$stop_line\[ \t\n\r\
#call sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)
-if ![gdb_skip_stdio_test "print sum_struct_print(...)"] {
+if {![gdb_skip_stdio_test "print sum_struct_print(...)"]} {
gdb_test_stdio "print sum_struct_print(10,*struct1,*struct2,*struct3,*struct4)" \
"Sum of the 4 struct values and seed :\[ \t\n\r\]+218"
}
#call print_struct_rep(*struct1, *struct2, *struct3)
-if ![gdb_skip_stdio_test "print print_struct_rep(...)"] {
+if {![gdb_skip_stdio_test "print print_struct_rep(...)"]} {
gdb_test_stdio "print print_struct_rep(*struct1, *struct2, *struct3)" \
[multi_line \
"Contents of struct1: " \
@@ -622,7 +622,7 @@ if ![gdb_skip_stdio_test "print print_struct_rep(...)"] {
]
}
-if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] {
+if {![gdb_skip_stdio_test "print print_one_large_struct(...)"]} {
gdb_test_stdio "print print_one_large_struct(*list1)" \
" 4 1"
}
diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp
index af5c576..4ce686b 100644
--- a/gdb/testsuite/gdb.base/call-rt-st.exp
+++ b/gdb/testsuite/gdb.base/call-rt-st.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,7 +39,8 @@ set allow_float_test [allow_float_test]
# Start with a fresh gdb.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_test_no_output "set print sevenbit-strings"
gdb_test_no_output "set print address off"
gdb_test_no_output "set width 0"
@@ -108,13 +109,13 @@ proc print_struct_call { expr inf_result gdb_result } {
}
-if ![gdb_skip_stdio_test "print print_struct_rep(*struct1)"] {
+if {![gdb_skip_stdio_test "print print_struct_rep(*struct1)"]} {
print_struct_call "print_struct_rep(*struct1)" \
".*Contents of struct1:\[ \t\n\r\]+22\[ \t\]+0\[ \t\n\r\]+" \
".\[0-9\]+ = \\{value = 5, head = 0\\}"
}
-if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] {
+if {![gdb_skip_stdio_test "print print_one_large_struct(...)"]} {
print_struct_call "print_one_large_struct(*list1)" \
".*\[ \t\]+4\[ \t\]+1\[ \r\n\]+" \
".\[0-9\]+ = \\{next_index = \\{1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\}, values = \\{4, 6, 8, 10, 12, 14, 16, 18, 20, 22\\}, head = 0\\}"
@@ -134,43 +135,43 @@ if {$allow_float_test && \
".\[0-9\]+ = \\{float1 = -2\\.34500003, float2 = 1\\}"
}
-if ![gdb_skip_stdio_test "print print_bit_flags_char(*cflags)"] {
+if {![gdb_skip_stdio_test "print print_bit_flags_char(*cflags)"]} {
print_struct_call "print_bit_flags_char(*cflags)" \
".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+" \
".\[0-9\]+ = \\{alpha = 1 '\\\\001', beta = 0 '\\\\000', gamma = 1 '\\\\001', delta = 0 '\\\\000', epsilon = 1 '\\\\001', omega = 0 '\\\\000'\\}"
}
-if ![gdb_skip_stdio_test "print print_bit_flags_short(*sflags)"] {
+if {![gdb_skip_stdio_test "print print_bit_flags_short(*sflags)"]} {
print_struct_call "print_bit_flags_short(*sflags)" \
".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+" \
".\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}"
}
-if ![gdb_skip_stdio_test "print print_bit_flags(*flags)"] {
+if {![gdb_skip_stdio_test "print print_bit_flags(*flags)"]} {
print_struct_call "print_bit_flags(*flags)" \
".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+" \
".\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}"
}
-if ![gdb_skip_stdio_test "print print_bit_flags_combo(*flags_combo)"] {
+if {![gdb_skip_stdio_test "print print_bit_flags_combo(*flags_combo)"]} {
print_struct_call "print_bit_flags_combo(*flags_combo)" \
".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+ch1: y\[ \t\]+ch2: n\[ \r\n\]+" \
".\[0-9\]+ = \\{alpha = 1, beta = 0, ch1 = 121 'y', gamma = 1, delta = 0, ch2 = 110 'n', epsilon = 1, omega = 0\\}"
}
-if ![gdb_skip_stdio_test "print print_three_chars(*three_chars)"] {
+if {![gdb_skip_stdio_test "print print_three_chars(*three_chars)"]} {
print_struct_call "print_three_chars(*three_char)" \
".*Contents of three_char_t:\[ \r\n\]+x\[ \t\]+y\[ \t\]+z\[ \r\n\]+" \
".\[0-9\]+ = \\{ch1 = 120 'x', ch2 = 121 'y', ch3 = 122 'z'\\}"
}
-if ![gdb_skip_stdio_test "print print_five_chars(*five_chars)"] {
+if {![gdb_skip_stdio_test "print print_five_chars(*five_chars)"]} {
print_struct_call "print_five_chars(*five_char)" \
".*Contents of five_char_t:\[ \r\n\]+h\[ \t\]+e\[ \t\]+l\[ \t\]+l\[ \t\]+o\[ \r\n\]+" \
".\[0-9\]+ = \\{ch1 = 104 'h', ch2 = 101 'e', ch3 = 108 'l', ch4 = 108 'l', ch5 = 111 'o'\\}"
}
-if ![gdb_skip_stdio_test "print print_int_char_combo(*int_char_combo)"] {
+if {![gdb_skip_stdio_test "print print_int_char_combo(*int_char_combo)"]} {
print_struct_call "print_int_char_combo(*int_char_combo)" \
".*Contents of int_char_combo_t:\[ \r\n\]+13\[ \t\]+!\[ \r\n\]+" \
".\[0-9\]+ = \\{int1 = 13, ch1 = 33 '!'\\}"
diff --git a/gdb/testsuite/gdb.base/call-sc.c b/gdb/testsuite/gdb.base/call-sc.c
index e4fd453..652d346 100644
--- a/gdb/testsuite/gdb.base/call-sc.c
+++ b/gdb/testsuite/gdb.base/call-sc.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/call-sc.exp b/gdb/testsuite/gdb.base/call-sc.exp
index 3a83d96..ff4e7ac 100644
--- a/gdb/testsuite/gdb.base/call-sc.exp
+++ b/gdb/testsuite/gdb.base/call-sc.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -46,7 +46,7 @@ proc start_scalars_test { type } {
set testfile "call-sc-${type}"
set binfile [standard_output_file ${testfile}]
- if { [prepare_for_testing "failed to prepare" $binfile $srcfile $flags] } {
+ if { [prepare_for_testing "failed to prepare" $testfile $srcfile $flags] } {
return -1
}
@@ -107,7 +107,7 @@ proc test_scalar_calls { } {
# Check that GDB can always extract a scalar-return value from an
# inferior function call. Since GDB always knows the location of
# an inferior function call's return value these should never fail
-
+
# Implemented by calling the parameterless function "fun" and then
# examining the return value printed by GDB.
@@ -250,7 +250,7 @@ proc test_scalar_returns { } {
set test "value foo returned; ${tests}"
gdb_test_multiple "p/c L" "${test}" {
-re " = 49 '1'.*${gdb_prompt} $" {
- if $return_value_unknown {
+ if {$return_value_unknown} {
# This contradicts the above claim that GDB didn't
# know the location of the return-value.
fail "${test}"
@@ -259,7 +259,7 @@ proc test_scalar_returns { } {
}
}
-re " = 90 .*${gdb_prompt} $" {
- if $return_value_unknown {
+ if {$return_value_unknown} {
# The struct return case. Since any modification
# would be by reference, and that can't happen, the
# value should be unmodified and hence Z is expected.
@@ -272,7 +272,7 @@ proc test_scalar_returns { } {
}
}
-re " = 57 .*${gdb_prompt} $" {
- if $return_value_unknown {
+ if {$return_value_unknown} {
# The struct return case.
# The return value is stored on the stack, and since GDB
# didn't override it, it still has value that was stored
@@ -285,7 +285,7 @@ proc test_scalar_returns { } {
}
}
-re ".*${gdb_prompt} $" {
- if $return_value_unimplemented {
+ if {$return_value_unimplemented} {
# What a surprise. The architecture hasn't implemented
# return_value, and hence has to fail.
kfail "$test" gdb/1444
@@ -293,8 +293,8 @@ proc test_scalar_returns { } {
fail "$test"
}
}
- }
-
+ }
+
# Check that a "finish" works.
# This is almost but not quite the same as "call struct funcs".
@@ -334,7 +334,7 @@ proc test_scalar_returns { } {
set test "value foo finished; ${tests}"
gdb_test_multiple "p/c" "${test}" {
-re " = 49 '1'\[\r\n\]+${gdb_prompt} $" {
- if $finish_value_unknown {
+ if {$finish_value_unknown} {
# This contradicts the above claim that GDB didn't
# know the location of the return-value.
fail "${test}"
@@ -344,7 +344,7 @@ proc test_scalar_returns { } {
}
-re " = 90 'Z'\[\r\n\]+${gdb_prompt} $" {
# The value didn't get found. This is "expected".
- if $finish_value_unknown {
+ if {$finish_value_unknown} {
pass "${test}"
} else {
# This contradicts the above claim that GDB did
diff --git a/gdb/testsuite/gdb.base/call-signal-resume.exp b/gdb/testsuite/gdb.base/call-signal-resume.exp
index a281a63..a74b8af 100644
--- a/gdb/testsuite/gdb.base/call-signal-resume.exp
+++ b/gdb/testsuite/gdb.base/call-signal-resume.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,7 +47,8 @@ proc get_dummy_frame_number { } {
# Start with a fresh gdb.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if { ![runto_main] } {
return 0
diff --git a/gdb/testsuite/gdb.base/call-signals.c b/gdb/testsuite/gdb.base/call-signals.c
index 071e230..fff2955 100644
--- a/gdb/testsuite/gdb.base/call-signals.c
+++ b/gdb/testsuite/gdb.base/call-signals.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/call-strs.exp b/gdb/testsuite/gdb.base/call-strs.exp
index f6a9f42..02eecb6 100644
--- a/gdb/testsuite/gdb.base/call-strs.exp
+++ b/gdb/testsuite/gdb.base/call-strs.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -67,70 +67,70 @@ gdb_test "print s" \
" = \"test string\".*"
#print str_func1(s)
-if ![gdb_skip_stdio_test "print str_func1(s)"] {
+if {![gdb_skip_stdio_test "print str_func1(s)"]} {
gdb_test_stdio "print str_func1(s)" \
"first string arg is: test string" \
"\"test string\".*"
}
#print str_func1("test string")
-if ![gdb_skip_stdio_test "print str_func1(teststring)"] {
+if {![gdb_skip_stdio_test "print str_func1(teststring)"]} {
gdb_test_stdio "print str_func1(\"test string\")" \
"first string arg is: test string" \
"\"test string\".*"
}
#call str_func1(s)
-if ![gdb_skip_stdio_test "call str_func1(s)"] {
+if {![gdb_skip_stdio_test "call str_func1(s)"]} {
gdb_test_stdio "call str_func1(s)" \
"first string arg is: test string" \
"\"test string\".*"
}
#call str_func1("test string")
-if ![gdb_skip_stdio_test "call str_func1 (...)"] {
+if {![gdb_skip_stdio_test "call str_func1 (...)"]} {
gdb_test_stdio "call str_func1(\"test string\")" \
"first string arg is: test string" \
"\"test string\".*"
}
#print str_func1(buf)
-if ![gdb_skip_stdio_test "print str_func1(buf)"] {
+if {![gdb_skip_stdio_test "print str_func1(buf)"]} {
gdb_test_stdio "print str_func1(buf)" \
"first string arg is: test string" \
"\"test string\".*"
}
#call str_func1(buf)
-if ![gdb_skip_stdio_test "call str_func1(buf)"] {
+if {![gdb_skip_stdio_test "call str_func1(buf)"]} {
gdb_test_stdio "call str_func1(buf)" \
"first string arg is: test string" \
"\"test string\".*"
}
#print str_func("a","b","c","d","e","f","g")
-if ![gdb_skip_stdio_test "print str_func(a,b,c,d,e,f,g)"] {
+if {![gdb_skip_stdio_test "print str_func(a,b,c,d,e,f,g)"]} {
gdb_test_stdio "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" \
"first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+" \
"= \"abcdefg\".*"
}
#call str_func("a","b","c","d","e","f","g")
-if ![gdb_skip_stdio_test "call str_func(a,b,c,d,e,f,g)"] {
+if {![gdb_skip_stdio_test "call str_func(a,b,c,d,e,f,g)"]} {
gdb_test_stdio "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" \
"first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+" \
"= \"abcdefg\".*"
}
#print str_func(s,s,s,s,s,s,s)
-if ![gdb_skip_stdio_test "print str_func(s,s,s,s,s,s,s,s)"] {
+if {![gdb_skip_stdio_test "print str_func(s,s,s,s,s,s,s,s)"]} {
gdb_test_stdio "print str_func(s,s,s,s,s,s,s)" \
"first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+" \
"\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*"
}
#call str_func(s,s,s,s,s,s,s)
-if ![gdb_skip_stdio_test "call str_func(s,s,s,s,s,s,s,s)"] {
+if {![gdb_skip_stdio_test "call str_func(s,s,s,s,s,s,s,s)"]} {
gdb_test_stdio "call str_func(s,s,s,s,s,s,s)" \
"first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+" \
"\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*"
diff --git a/gdb/testsuite/gdb.base/callexit.c b/gdb/testsuite/gdb.base/callexit.c
index b1b7cd1..aecff4d 100644
--- a/gdb/testsuite/gdb.base/callexit.c
+++ b/gdb/testsuite/gdb.base/callexit.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/callexit.exp b/gdb/testsuite/gdb.base/callexit.exp
index f2b0838..e0ce899 100644
--- a/gdb/testsuite/gdb.base/callexit.exp
+++ b/gdb/testsuite/gdb.base/callexit.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,8 @@ require {!target_info exists gdb,cannot_call_functions}
# Start with a fresh gdb.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if { ![runto_main] } {
return 0
diff --git a/gdb/testsuite/gdb.base/callfuncs.c b/gdb/testsuite/gdb.base/callfuncs.c
index bb30c51..42ab16c 100644
--- a/gdb/testsuite/gdb.base/callfuncs.c
+++ b/gdb/testsuite/gdb.base/callfuncs.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1993-2024 Free Software Foundation, Inc.
+ Copyright 1993-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp
index 494b6df..59306d4 100644
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ standard_testfile
# We still want to test non-prototype functions for now, which is why
# we disable compilers warning about them.
set compile_flags {debug additional_flags=-Wno-deprecated-non-prototype}
-if [support_complex_tests] {
+if {[support_complex_tests]} {
lappend compile_flags "additional_flags=-DTEST_COMPLEX"
}
@@ -132,7 +132,7 @@ proc do_function_calls {prototypes} {
gdb_test "p t_int_double(99, 99.0)" " = 1"
}
- if [support_complex_tests] {
+ if {[support_complex_tests]} {
gdb_test "p t_float_complex_values(fc1, fc2)" " = 1"
gdb_test "p t_float_complex_values(fc3, fc4)" " = 0"
@@ -221,7 +221,7 @@ proc do_function_calls {prototypes} {
"call inferior func with struct - returns double"
}
- if [support_complex_tests] {
+ if {[support_complex_tests]} {
gdb_test "p t_structs_fc(struct_val1)" ".*= 3 \\+ 3i" \
"call inferior func with struct - returns float _Complex"
@@ -257,7 +257,7 @@ proc fetch_all_registers {test} {
exp_continue
}
-re "^bspstore\[ \t\]+\[^\r\n\]+\r\n" {
- if [istarget "ia64-*-*"] {
+ if {[istarget "ia64-*-*"]} {
# Filter out bspstore which is specially tied to bsp,
# giving spurious differences.
} else {
@@ -266,7 +266,7 @@ proc fetch_all_registers {test} {
exp_continue
}
-re "^pstate\[ \t\]+\[^\r\n\]+\r\n" {
- if [istarget "sparc64-*-linux-gnu"] {
+ if {[istarget "sparc64-*-linux-gnu"]} {
# Filter out the pstate register, since in sparc64
# targets the Linux kernel disables pstate.PEF when
# returning from traps, giving spurious differences.
@@ -276,7 +276,7 @@ proc fetch_all_registers {test} {
exp_continue
}
-re "^last_break\[ \t\]+\[^\r\n\]+\r\n" {
- if [istarget "s390*-*-*"] {
+ if {[istarget "s390*-*-*"]} {
# Filter out last_break which is read-only,
# giving spurious differences.
} else {
@@ -285,7 +285,7 @@ proc fetch_all_registers {test} {
exp_continue
}
-re "^\(?:cycle\|instret\)\[ \t\]+\[^\r\n\]+\r\n" {
- if [istarget "riscv*-*-*"] {
+ if {[istarget "riscv*-*-*"]} {
# Filter out the cycle counter and instructions
# retired counter CSRs which are read-only, giving
# spurious differences.
@@ -386,9 +386,9 @@ proc perform_all_tests {prototypes} {
"The program being debugged stopped while.*" \
"stop at breakpoint in call dummy function"
gdb_test "continue" "Continuing.*" "continue from call dummy breakpoint"
- if ![gdb_test "bt 2" \
- "#0 main.*" \
- "bt after continuing from call dummy breakpoint"] then {
+ if {![gdb_test "bt 2" \
+ "#0 main.*" \
+ "bt after continuing from call dummy breakpoint"]} then {
set new_reg_content [fetch_all_registers \
"register contents after stop in call dummy"]
if {$old_reg_content == $new_reg_content} {
@@ -412,9 +412,9 @@ proc perform_all_tests {prototypes} {
gdb_test "finish" \
"Value returned is .* = 9" \
"finish from call dummy breakpoint returns correct value"
- if ![gdb_test "bt 2" \
- "#0 main.*" \
- "bt after finishing from call dummy breakpoint"] then {
+ if {![gdb_test "bt 2" \
+ "#0 main.*" \
+ "bt after finishing from call dummy breakpoint"]} then {
set new_reg_content [fetch_all_registers \
"register contents after finish in call dummy"]
if {$old_reg_content == $new_reg_content} {
@@ -435,11 +435,11 @@ proc perform_all_tests {prototypes} {
# with a value, make sure we are back at main with the same register contents.
gdb_test "print add(4,5)" "The program being debugged stopped while.*" \
"call function causing a breakpoint and then do a return"
- if ![gdb_test "return 7" \
- "#0 main.*" \
- "back at main after return from call dummy breakpoint" \
- "Make add return now. .y or n.*" \
- "y"] then {
+ if {![gdb_test "return 7" \
+ "#0 main.*" \
+ "back at main after return from call dummy breakpoint" \
+ "Make add return now. .y or n.*" \
+ "y"]} then {
set new_reg_content [fetch_all_registers \
"register contents after return in call dummy"]
if {$old_reg_content == $new_reg_content} {
diff --git a/gdb/testsuite/gdb.base/cast-call.c b/gdb/testsuite/gdb.base/cast-call.c
index 41040ab..aeb3a61 100644
--- a/gdb/testsuite/gdb.base/cast-call.c
+++ b/gdb/testsuite/gdb.base/cast-call.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/cast-call.exp b/gdb/testsuite/gdb.base/cast-call.exp
index ab12334..5ecf1c9 100644
--- a/gdb/testsuite/gdb.base/cast-call.exp
+++ b/gdb/testsuite/gdb.base/cast-call.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/cast-indirection.c b/gdb/testsuite/gdb.base/cast-indirection.c
index d59c66e..5b90a49 100644
--- a/gdb/testsuite/gdb.base/cast-indirection.c
+++ b/gdb/testsuite/gdb.base/cast-indirection.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/cast-indirection.exp b/gdb/testsuite/gdb.base/cast-indirection.exp
index 7b9b5a5..198b0aa 100644
--- a/gdb/testsuite/gdb.base/cast-indirection.exp
+++ b/gdb/testsuite/gdb.base/cast-indirection.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/catch-follow-exec.c b/gdb/testsuite/gdb.base/catch-follow-exec.c
index 094423b..55d2c61 100644
--- a/gdb/testsuite/gdb.base/catch-follow-exec.c
+++ b/gdb/testsuite/gdb.base/catch-follow-exec.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/catch-follow-exec.exp b/gdb/testsuite/gdb.base/catch-follow-exec.exp
index 911f0e3..1f5f865 100644
--- a/gdb/testsuite/gdb.base/catch-follow-exec.exp
+++ b/gdb/testsuite/gdb.base/catch-follow-exec.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/catch-fork-kill.c b/gdb/testsuite/gdb.base/catch-fork-kill.c
index 2ccea32..5dc0d56 100644
--- a/gdb/testsuite/gdb.base/catch-fork-kill.c
+++ b/gdb/testsuite/gdb.base/catch-fork-kill.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/catch-fork-kill.exp b/gdb/testsuite/gdb.base/catch-fork-kill.exp
index 086be29..e851d66 100644
--- a/gdb/testsuite/gdb.base/catch-fork-kill.exp
+++ b/gdb/testsuite/gdb.base/catch-fork-kill.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,6 +32,8 @@
standard_testfile
+require allow_fork_tests
+
# Build two programs -- one for fork, and another for vfork.
set testfile_fork "${testfile}-fork"
set testfile_vfork "${testfile}-vfork"
@@ -57,7 +59,7 @@ proc do_test {fork_kind exit_kind} {
with_test_prefix "$fork_kind" {
clean_restart $testfile
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/catch-fork-static.exp b/gdb/testsuite/gdb.base/catch-fork-static.exp
index 5c9d18f..9d50d5d 100644
--- a/gdb/testsuite/gdb.base/catch-fork-static.exp
+++ b/gdb/testsuite/gdb.base/catch-fork-static.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,9 +21,7 @@
# ld.so probes before reaching main, and ptrace flags were set then. But a
# static executable would just keep running and never catch the fork.
-# Until "catch fork" is implemented on other targets...
-#
-require {is_any_target "*-*-linux*" "*-*-openbsd*"}
+require allow_fork_tests
# Reusing foll-fork.c since it's a simple forking program.
standard_testfile foll-fork.c
diff --git a/gdb/testsuite/gdb.base/catch-gdb-caused-signals.c b/gdb/testsuite/gdb.base/catch-gdb-caused-signals.c
index 7993a40..324510c 100644
--- a/gdb/testsuite/gdb.base/catch-gdb-caused-signals.c
+++ b/gdb/testsuite/gdb.base/catch-gdb-caused-signals.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/catch-gdb-caused-signals.exp b/gdb/testsuite/gdb.base/catch-gdb-caused-signals.exp
index 08cee51..862cae4 100644
--- a/gdb/testsuite/gdb.base/catch-gdb-caused-signals.exp
+++ b/gdb/testsuite/gdb.base/catch-gdb-caused-signals.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -47,7 +47,7 @@ gdb_test "handle SIGILL nostop noprint" \
gdb_test "print return_one()" " = 1"
-if ![target_info exists gdb,noinferiorio] {
+if {![target_info exists gdb,noinferiorio]} {
# Clean up the breakpoint state.
delete_breakpoints
diff --git a/gdb/testsuite/gdb.base/catch-load-so.c b/gdb/testsuite/gdb.base/catch-load-so.c
index 29d77e0..d3c3ef2 100644
--- a/gdb/testsuite/gdb.base/catch-load-so.c
+++ b/gdb/testsuite/gdb.base/catch-load-so.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/catch-load.c b/gdb/testsuite/gdb.base/catch-load.c
index 21e0cb9..175084a 100644
--- a/gdb/testsuite/gdb.base/catch-load.c
+++ b/gdb/testsuite/gdb.base/catch-load.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/catch-load.exp b/gdb/testsuite/gdb.base/catch-load.exp
index 11ab49a..ee1ae89 100644
--- a/gdb/testsuite/gdb.base/catch-load.exp
+++ b/gdb/testsuite/gdb.base/catch-load.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.base/catch-signal-fork.c b/gdb/testsuite/gdb.base/catch-signal-fork.c
index 54cd695..62ec6c0 100644
--- a/gdb/testsuite/gdb.base/catch-signal-fork.c
+++ b/gdb/testsuite/gdb.base/catch-signal-fork.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/catch-signal-fork.exp b/gdb/testsuite/gdb.base/catch-signal-fork.exp
index 2e065df..2a33ee1 100644
--- a/gdb/testsuite/gdb.base/catch-signal-fork.exp
+++ b/gdb/testsuite/gdb.base/catch-signal-fork.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,6 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
require {!target_info exists gdb,nosignals}
+require allow_fork_tests
standard_testfile
diff --git a/gdb/testsuite/gdb.base/catch-signal-siginfo-cond.c b/gdb/testsuite/gdb.base/catch-signal-siginfo-cond.c
index c65fb23..f3d1d1e 100644
--- a/gdb/testsuite/gdb.base/catch-signal-siginfo-cond.c
+++ b/gdb/testsuite/gdb.base/catch-signal-siginfo-cond.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/catch-signal-siginfo-cond.exp b/gdb/testsuite/gdb.base/catch-signal-siginfo-cond.exp
index 4598622..dd47b55 100644
--- a/gdb/testsuite/gdb.base/catch-signal-siginfo-cond.exp
+++ b/gdb/testsuite/gdb.base/catch-signal-siginfo-cond.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/catch-signal.c b/gdb/testsuite/gdb.base/catch-signal.c
index 85a9109..6aeb873 100644
--- a/gdb/testsuite/gdb.base/catch-signal.c
+++ b/gdb/testsuite/gdb.base/catch-signal.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/catch-signal.exp b/gdb/testsuite/gdb.base/catch-signal.exp
index 6e15da0..4ddecd6 100644
--- a/gdb/testsuite/gdb.base/catch-signal.exp
+++ b/gdb/testsuite/gdb.base/catch-signal.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp
index 2e20b8f..0a1a4f3 100644
--- a/gdb/testsuite/gdb.base/catch-syscall.exp
+++ b/gdb/testsuite/gdb.base/catch-syscall.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -348,7 +348,7 @@ proc test_catch_syscall_execve {} {
# Check for entry/return across the execve, making sure that the
# syscall_state isn't lost when turning into a new process.
insert_catch_syscall_with_arg "execve"
- if [check_continue "execve"] {
+ if {[check_continue "execve"]} {
# The check_continue test generates an XFAIL on Powerpc. In
# that case, gdb is already at main so don't do the continue.
@@ -630,7 +630,8 @@ proc test_catch_syscall_multi_arch {} {
test_catch_syscall_multi_arch_1 $arch1 $arch2 $syscall1_name \
$syscall2_name $syscall_number
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
}
proc do_syscall_tests_without_xml {} {
@@ -801,18 +802,21 @@ fill_all_syscalls_numbers
# Execute the tests, using XML support
gdb_exit
if { [allow_xml_test] } {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
do_syscall_tests
# Now, we have to see if GDB displays a warning when we
# don't set the data-directory but try to use catch syscall
# anyway. For that, we must restart GDB first.
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
test_catch_syscall_fail_nodatadir
}
# Restart gdb
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
# Execute the tests, without XML support. In this case, GDB will
# only display syscall numbers, and not syscall names.
diff --git a/gdb/testsuite/gdb.base/charset-malloc.c b/gdb/testsuite/gdb.base/charset-malloc.c
index 2c614ba..3009b90 100644
--- a/gdb/testsuite/gdb.base/charset-malloc.c
+++ b/gdb/testsuite/gdb.base/charset-malloc.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
Contributed by Red Hat, originally written by Jim Blandy.
diff --git a/gdb/testsuite/gdb.base/charset.c b/gdb/testsuite/gdb.base/charset.c
index 444f9cc..c513264 100644
--- a/gdb/testsuite/gdb.base/charset.c
+++ b/gdb/testsuite/gdb.base/charset.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2001-2024 Free Software Foundation, Inc.
+ Copyright 2001-2025 Free Software Foundation, Inc.
Contributed by Red Hat, originally written by Jim Blandy.
diff --git a/gdb/testsuite/gdb.base/charset.exp b/gdb/testsuite/gdb.base/charset.exp
index 0d39d04..80fbf4a 100644
--- a/gdb/testsuite/gdb.base/charset.exp
+++ b/gdb/testsuite/gdb.base/charset.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2001-2024 Free Software Foundation, Inc.
+# Copyright 2001-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -391,7 +391,7 @@ foreach target_charset $charset_subset {
set var_name [string tolower "${target_charset}_string"]
regsub -all -- "\[^a-z0-9_\]" $var_name "_" var_name
}
-
+
# Compute a regexp matching the results we expect. This is static,
# but it's easier than writing it out.
regsub -all "." "abfnrtv" "(\\\\&|x)" escapes
@@ -492,7 +492,7 @@ foreach target_charset $charset_subset {
}
}
- # Try printing a character escape that doesn't exist. We should
+ # Try printing a character escape that doesn't exist. We should
# get the unescaped character, in the target character set.
gdb_test "print $L'\\q'" " = \[0-9-\]+ $L'q'" \
"print escape that doesn't exist in $target_charset"
@@ -549,7 +549,7 @@ if {$wchar_ok} {
set ucs2_ok [expr {[get_sizeof char16_t 99] == 2}]
-if ![valid_host_charset "UTF-16"] {
+if {![valid_host_charset "UTF-16"]} {
verbose -log "Disabling UTF-16 tests."
set ucs2_ok 0
}
@@ -640,4 +640,4 @@ foreach name {short int long} {
}
-gdb_exit
+gdb_exit
diff --git a/gdb/testsuite/gdb.base/check-psymtab.c b/gdb/testsuite/gdb.base/check-psymtab.c
index 2e251e2..8772187 100644
--- a/gdb/testsuite/gdb.base/check-psymtab.c
+++ b/gdb/testsuite/gdb.base/check-psymtab.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/check-psymtab.exp b/gdb/testsuite/gdb.base/check-psymtab.exp
index 43e232c..1dfbd7d 100644
--- a/gdb/testsuite/gdb.base/check-psymtab.exp
+++ b/gdb/testsuite/gdb.base/check-psymtab.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/checkpoint-ns.exp b/gdb/testsuite/gdb.base/checkpoint-ns.exp
index 1cc130f..5d31799 100644
--- a/gdb/testsuite/gdb.base/checkpoint-ns.exp
+++ b/gdb/testsuite/gdb.base/checkpoint-ns.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/checkpoint.c b/gdb/testsuite/gdb.base/checkpoint.c
index 0e01e2b..ec1d05a 100644
--- a/gdb/testsuite/gdb.base/checkpoint.c
+++ b/gdb/testsuite/gdb.base/checkpoint.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2005-2024 Free Software Foundation, Inc.
+ Copyright 2005-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/checkpoint.exp b/gdb/testsuite/gdb.base/checkpoint.exp
index 68bddd8..55eba5d 100644
--- a/gdb/testsuite/gdb.base/checkpoint.exp
+++ b/gdb/testsuite/gdb.base/checkpoint.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -290,7 +290,8 @@ gdb_test "restart 10" "has no checkpoints" "no more checkpoint 10"
# Now let's try setting a large number of checkpoints (>600)
#
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
runto_main
gdb_breakpoint $break1_loc
@@ -356,7 +357,8 @@ gdb_test "kill" "" "kill all one with many checkpoints" \
#
with_test_prefix "delete checkpoint 0" {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
runto_main
gdb_test "checkpoint" "Checkpoint 1: fork returned pid $decimal\\."
diff --git a/gdb/testsuite/gdb.base/chng-syms.exp b/gdb/testsuite/gdb.base/chng-syms.exp
index 7f5490f..0f7be07 100644
--- a/gdb/testsuite/gdb.base/chng-syms.exp
+++ b/gdb/testsuite/gdb.base/chng-syms.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
# Author: Paul N. Hilfinger (Hilfinger@gnat.com)
-# Test that GDB cleans up properly after errors that result when a
-# breakpoint is reset.
+# Test that GDB cleans up properly after errors that result when a
+# breakpoint is reset.
standard_testfile .c
@@ -36,7 +36,8 @@ proc expect_to_stop_here { ident } {
gdb_test "" "Breakpoint \[0-9\]*, stop_here .*" "running to stop_here $ident"
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_test "break stop_here if (var1 == 42)" \
"Breakpoint.*at.* file .*$srcfile, line.*" \
@@ -44,21 +45,21 @@ gdb_test "break stop_here if (var1 == 42)" \
gdb_run_cmd
expect_to_stop_here "first time"
-
+
gdb_continue_to_end "breakpoint first time through"
# Now we recompile the executable, but without a variable named "var1", first
# waiting to insure that even on fast machines, the file modification times
-# are distinct. This will force GDB to reload the file on the
-# next "run" command, causing an error when GDB tries to tries to reset
+# are distinct. This will force GDB to reload the file on the
+# next "run" command, causing an error when GDB tries to tries to reset
# the breakpoint.
sleep 2
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DVARIABLE=var2}] != "" } {
-# Complication: Since GDB generally holds an open file descriptor on the
-# executable at this point, there are some systems in which the
-# re-compilation will fail. In such cases, we'll consider the test
+# Complication: Since GDB generally holds an open file descriptor on the
+# executable at this point, there are some systems in which the
+# re-compilation will fail. In such cases, we'll consider the test
# (vacuously) passed providing that re-running it succeeds as before.
gdb_run_cmd
diff --git a/gdb/testsuite/gdb.base/clear_non_user_bp.exp b/gdb/testsuite/gdb.base/clear_non_user_bp.exp
index d1d9bd7..c016d07 100644
--- a/gdb/testsuite/gdb.base/clear_non_user_bp.exp
+++ b/gdb/testsuite/gdb.base/clear_non_user_bp.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,7 +47,8 @@ if { [gdb_compile "${srcdir}/${subdir}/main.c" "${binfile}" executable {debug}]
}
# Start with a fresh gdb.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.base/cli-suppress-notification.c b/gdb/testsuite/gdb.base/cli-suppress-notification.c
index b364109..12fe04c 100644
--- a/gdb/testsuite/gdb.base/cli-suppress-notification.c
+++ b/gdb/testsuite/gdb.base/cli-suppress-notification.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,12 +15,85 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-static int global = 0;
+#include <stdlib.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <assert.h>
+
+/* Used for thread synchronisation. */
+
+pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t g_cond = PTHREAD_COND_INITIALIZER;
+
+/* This is set by GDB. */
+
+volatile int wait_for_gdb = 1;
+
+/* This is used to create some work for GDB to step through. */
+
+volatile int global_var = 0;
+
+/* A simple thread worker function. */
+
+void*
+worker_thread_func (void *arg)
+{
+ int res;
+
+ /* Grab the mutex. This completes once the main thread is waiting. */
+ res = pthread_mutex_lock (&g_mutex);
+ assert (res == 0);
+
+ /* Wake the main thread, letting it know that we are here. At this
+ point the main thread is still blocked as we hold G_MUTEX. */
+ res = pthread_cond_signal (&g_cond);
+
+ /* Now we wait. This releases G_MUTEX and allows the main thread to
+ continue. */
+ res = pthread_cond_wait (&g_cond, &g_mutex);
+ assert (res == 0);
+
+ /* Unlock the mutex. We're all done now. */
+ res = pthread_mutex_unlock (&g_mutex);
+ assert (res == 0);
+
+ return NULL;
+}
int
-main ()
+main (void)
{
- global++;
- global++;
+ pthread_t thr;
+ int res;
+
+ /* Lock G_MUTEX before creating the worker thread. */
+ pthread_mutex_lock (&g_mutex);
+
+ res = pthread_create (&thr, NULL, worker_thread_func, NULL);
+ assert (res == 0);
+
+ /* Release G_MUTEX and wait for the worker thread. */
+ res = pthread_cond_wait (&g_cond, &g_mutex);
+ assert (res == 0);
+
+ global_var++; /* Break here. */
+ global_var++; /* Second. */
+ global_var++; /* Third. */
+
+ while (wait_for_gdb)
+ sleep(1);
+
+ /* Notify the worker thread, it will exit once G_MUTEX is released. */
+ pthread_cond_signal (&g_cond);
+ pthread_mutex_unlock (&g_mutex);
+
+ /* Wait for the worker to actually exit. */
+ res = pthread_join (thr, NULL);
+ assert (res == 0);
+
+ /* Clean up the mutex and condition variable. */
+ pthread_mutex_destroy (&g_mutex);
+ pthread_cond_destroy (&g_cond);
+
return 0;
}
diff --git a/gdb/testsuite/gdb.base/cli-suppress-notification.exp b/gdb/testsuite/gdb.base/cli-suppress-notification.exp
index 1b06ec4..003f7d2 100644
--- a/gdb/testsuite/gdb.base/cli-suppress-notification.exp
+++ b/gdb/testsuite/gdb.base/cli-suppress-notification.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,7 +17,8 @@
standard_testfile
-if {[prepare_for_testing "failed to prepare" ${binfile} ${srcfile}]} {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
+ {debug pthreads}] } {
return
}
@@ -25,15 +26,53 @@ if {![runto_main]} {
return
}
-gdb_test "inferior 1" ".*Switching to inferior 1 .* to thread 1 .*" \
- "inferior switch is not suppressed"
+delete_breakpoints
+
+gdb_breakpoint [gdb_get_line_number "Break here"]
+gdb_continue_to_breakpoint "threads created"
+
+if {![use_gdb_stub]} {
+ gdb_test "add-inferior -exec $binfile" ".*" \
+ "add a second inferior"
+
+ gdb_test "inferior 2" ".*Switching to inferior 2 .*" \
+ "inferior switch is not suppressed"
+ gdb_test "info breakpoints"
+ gdb_test "info inferiors"
+ gdb_test "info connections"
+ gdb_run_cmd
+ gdb_test_multiple "" "stop at breakpoint in inferior 2" {
+ -wrap -re "Breakpoint ${::decimal}(?:\\.${::decimal})?, main .*" {
+ pass $gdb_test_name
+ }
+ }
+}
gdb_test_no_output "set suppress-cli-notifications on"
-gdb_test_no_output "inferior 1" "inferior switch is suppressed"
+if {![use_gdb_stub]} {
+ gdb_test_no_output "inferior 1" \
+ "inferior switch is suppressed when changing inferior"
+}
+gdb_test_no_output "inferior 1" \
+ "inferior switch is suppressed when same inferior selected"
gdb_test_no_output "next" "stepping is suppressed"
+gdb_test_no_output "thread 2" "switch to a new thread"
+gdb_test_no_output "thread 2" "switch to the same thread"
# Now check that suppression can be turned back off.
gdb_test_no_output "set suppress-cli-notifications off"
-gdb_test "inferior 1" ".*Switching to inferior 1 .* to thread 1 .*" \
- "inferior switch is not suppressed again"
-gdb_test "next" "return 0;" "stepping is not suppressed"
+gdb_test "thread 1" \
+ [multi_line \
+ "\\\[Switching to thread 1\[^\r\n\]*\\\]" \
+ "#0\\s+main\[^\r\n\]+" \
+ "\[^\r\n\]+Second\\. \\*/"]
+gdb_test_no_output "set wait_for_gdb = 0" \
+ "set wait_for_gdb in first inferior"
+
+if {![use_gdb_stub]} {
+ gdb_test "inferior 2" ".*Switching to inferior 2 .* to thread 2\\.1 .*" \
+ "inferior switch is not suppressed again"
+ gdb_test "next" ".*Second.*" "stepping is not suppressed"
+ gdb_test_no_output "set wait_for_gdb = 0" \
+ "set wait_for_gdb in second inferior"
+}
diff --git a/gdb/testsuite/gdb.base/code-expr.exp b/gdb/testsuite/gdb.base/code-expr.exp
index 33bac17..38f238c 100644
--- a/gdb/testsuite/gdb.base/code-expr.exp
+++ b/gdb/testsuite/gdb.base/code-expr.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2024 Free Software Foundation, Inc.
+# Copyright (C) 2001-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_test_no_output "set print sevenbit-strings"
gdb_test_no_output "set print address off"
@@ -274,7 +275,7 @@ gdb_test "whatis (enum misordered @data) v_misordered" \
"type = @data enum misordered" \
"(enum misordered @data)"
-#
+#
# Pointers
#
diff --git a/gdb/testsuite/gdb.base/code_elim.exp b/gdb/testsuite/gdb.base/code_elim.exp
index 8ead31d..0270bc9 100644
--- a/gdb/testsuite/gdb.base/code_elim.exp
+++ b/gdb/testsuite/gdb.base/code_elim.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/code_elim1.c b/gdb/testsuite/gdb.base/code_elim1.c
index f51af97..5a3cce2 100644
--- a/gdb/testsuite/gdb.base/code_elim1.c
+++ b/gdb/testsuite/gdb.base/code_elim1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/code_elim2.c b/gdb/testsuite/gdb.base/code_elim2.c
index 0b719b4..a01aac3 100644
--- a/gdb/testsuite/gdb.base/code_elim2.c
+++ b/gdb/testsuite/gdb.base/code_elim2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/color-prompt.exp b/gdb/testsuite/gdb.base/color-prompt.exp
new file mode 100644
index 0000000..c037185
--- /dev/null
+++ b/gdb/testsuite/gdb.base/color-prompt.exp
@@ -0,0 +1,29 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check using a prompt with color in CLI.
+
+# Using tuiterm requires setting TERM on host.
+require {!is_remote host}
+
+# We use a tuiterm, which allows us to determine cursor position.
+tuiterm_env
+Term::clean_restart 8 80
+
+# We start with an empty screen, to generate a visible prompt.
+Term::gen_prompt
+
+set tui 0
+source $srcdir/$subdir/../gdb.tui/color-prompt.exp.tcl
diff --git a/gdb/testsuite/gdb.base/command-line-input.exp b/gdb/testsuite/gdb.base/command-line-input.exp
index 86870bf..9760f1a 100644
--- a/gdb/testsuite/gdb.base/command-line-input.exp
+++ b/gdb/testsuite/gdb.base/command-line-input.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,19 +18,59 @@
# Test issuing a command split in multiple lines with continuation
# characters.
-gdb_exit
-gdb_start
+clean_restart
-set test "print 1\\\\n + 2"
-gdb_test_multiple "print 1\\\n + 2" $test {
- -re "^print 1\\\\\r\n \\+ 2\r\n\\\$$decimal = 3\r\n$gdb_prompt $" {
- pass $test
+set bs "\\"
+set re_bs [string_to_regexp $bs]
+set re_dollar [string_to_regexp $]
+
+set re \
+ [multi_line \
+ ^[string_to_regexp "print 1$bs"] \
+ [string_to_regexp " + 2"] \
+ "$re_dollar$decimal = 3" \
+ "$gdb_prompt $"]
+gdb_test_multiple "print 1$bs\n + 2" "print 1$bs${bs}n + 2" {
+ -re $re {
+ pass $gdb_test_name
+ }
+}
+
+set re \
+ [multi_line \
+ ^[string_to_regexp "print 1$bs"] \
+ "2" \
+ "$re_dollar$decimal = 12" \
+ "$gdb_prompt $"]
+gdb_test_multiple "print 1$bs\n2" "print 1$bs${bs}n2" {
+ -re $re {
+ pass $gdb_test_name
}
}
-set test "print 1\\\\n2"
-gdb_test_multiple "print 1\\\n2" $test {
- -re "^print 1\\\\\r\n2\r\n\\\$$decimal = 12\r\n$gdb_prompt $" {
- pass $test
+with_test_prefix "cancel multiline" {
+ send_gdb "print$bs\n 1"
+ gdb_test_multiple "" "setup" {
+ -re "print$re_bs\r\n 1" {
+ pass $gdb_test_name
+ }
+ }
+
+ send_gdb "\003"
+ gdb_test_multiple "" "cancel" {
+ -re -wrap "" {
+ pass $gdb_test_name
+ }
+ }
+
+ # Regression test for PR cli/33063.
+ gdb_test_multiple "print 2" "command after cancel" {
+ -re -wrap " = 2" {
+ pass $gdb_test_name
+ }
+ -re -wrap "" {
+ # Avoid undefined command error.
+ fail $gdb_test_name
+ }
}
}
diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp
index 6aee034..c21be23 100644
--- a/gdb/testsuite/gdb.base/commands.exp
+++ b/gdb/testsuite/gdb.base/commands.exp
@@ -1,4 +1,4 @@
-# Copyright 1988-2024 Free Software Foundation, Inc.
+# Copyright 1988-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -255,7 +255,7 @@ proc_with_prefix infrun_breakpoint_command_test {} {
delete_breakpoints
gdb_test "break factorial if value == 5" "Breakpoint.*at.*"
-# infrun_breakpoint_command_test - This test was broken into two parts
+# infrun_breakpoint_command_test - This test was broken into two parts
# to get around a synchronization problem in expect.
# part1: issue the gdb command "commands"
# part2: send the list of commands
@@ -547,7 +547,7 @@ proc_with_prefix user_defined_command_manyargs_test {} {
set expected "nargs=$nargs:"
for {set i 1} {$i <= $nargs} {incr i} {
- append expected " " [expr 2 * $i]
+ append expected " " [expr {2 * $i}]
}
gdb_test $cmd $expected "execute command"
@@ -658,7 +658,7 @@ proc_with_prefix test_command_prompt_position {} {
gdb_test_multiple "printf \"Now the value is %d\\n\", value" $test {
-re "^printf.*value\r\n>$" {
gdb_test_multiple "end" $test {
- -re "^end\r\n$gdb_prompt $" {
+ -re "^end\r\n$gdb_prompt $" {
pass $test
}
}
@@ -681,7 +681,7 @@ proc_with_prefix deprecated_command_test {} {
gdb_test "p 5" ".\[0-9\]* = 5.*" "deprecated warning goes away /1/"
gdb_test_no_output "maintenance deprecate p \"new_p\"" "maintenance deprecate p \"new_p\" /2/"
- gdb_test_no_output "maintenance deprecate print \"new_print\""
+ gdb_test_no_output "maintenance deprecate print \"new_print\""
gdb_test "p 5" \
"Warning: command 'print' \\(p\\) is deprecated.*Use 'new_print'.*" \
"both alias and command are deprecated"
@@ -751,7 +751,7 @@ proc_with_prefix bp_deleted_in_command_test {} {
# one command that deletes this breakpoint.
gdb_test "break factorial" \
"Breakpoint \[0-9\]+ at .*: file .*run.c, line \[0-9\]+\."
-
+
gdb_test_multiple "commands" "begin commands" {
-re "Type commands for breakpoint.*>$" {
pass "begin commands"
diff --git a/gdb/testsuite/gdb.base/compare-sections.c b/gdb/testsuite/gdb.base/compare-sections.c
index 40acd93..40222d3 100644
--- a/gdb/testsuite/gdb.base/compare-sections.c
+++ b/gdb/testsuite/gdb.base/compare-sections.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/compare-sections.exp b/gdb/testsuite/gdb.base/compare-sections.exp
index cf43602..b95149e 100644
--- a/gdb/testsuite/gdb.base/compare-sections.exp
+++ b/gdb/testsuite/gdb.base/compare-sections.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -136,7 +136,7 @@ with_test_prefix "read-only" {
}
# Come up with different value.
- set patch [expr 255 - $orig]
+ set patch [expr {255 - $orig}]
# Write PATCH to memory.
set written -1
diff --git a/gdb/testsuite/gdb.base/complete-empty.exp b/gdb/testsuite/gdb.base/complete-empty.exp
index 2689068..5e87431 100644
--- a/gdb/testsuite/gdb.base/complete-empty.exp
+++ b/gdb/testsuite/gdb.base/complete-empty.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index 571d714..59a6c57 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
#
# tests for command completion
#
-# Here are some useful test cases for completion.
+# Here are some useful test cases for completion.
# They should be tested with both M-? and TAB.
#
# "show output-" "radix"
@@ -676,7 +676,7 @@ with_cwd $srcdir {
}
# If the directory name contains a '+' we must escape it, adding a backslash.
-# If not, the test below will fail because it will interpret the '+' as a
+# If not, the test below will fail because it will interpret the '+' as a
# regexp operator. We use string_to_regexp for this purpose.
gdb_test "cd ${fullsrcdir}" \
diff --git a/gdb/testsuite/gdb.base/complex-parts.c b/gdb/testsuite/gdb.base/complex-parts.c
index 73c2bb3..8dde5aa 100644
--- a/gdb/testsuite/gdb.base/complex-parts.c
+++ b/gdb/testsuite/gdb.base/complex-parts.c
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/complex-parts.exp b/gdb/testsuite/gdb.base/complex-parts.exp
index 40f14f4..5b81966 100644
--- a/gdb/testsuite/gdb.base/complex-parts.exp
+++ b/gdb/testsuite/gdb.base/complex-parts.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/complex.c b/gdb/testsuite/gdb.base/complex.c
index 4735ff4..2a82902 100644
--- a/gdb/testsuite/gdb.base/complex.c
+++ b/gdb/testsuite/gdb.base/complex.c
@@ -1,4 +1,4 @@
-/* Copyright 2002-2024 Free Software Foundation, Inc.
+/* Copyright 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/complex.exp b/gdb/testsuite/gdb.base/complex.exp
index 99842eb..ef17c47 100644
--- a/gdb/testsuite/gdb.base/complex.exp
+++ b/gdb/testsuite/gdb.base/complex.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/comprdebug.exp b/gdb/testsuite/gdb.base/comprdebug.exp
index c12224e..d8859c5 100644
--- a/gdb/testsuite/gdb.base/comprdebug.exp
+++ b/gdb/testsuite/gdb.base/comprdebug.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $ofile \
set objcopy_program [gdb_find_objcopy]
set cmd "$objcopy_program --compress-debug-sections $ofile"
verbose "invoking $cmd"
-set result [catch "exec $cmd" output]
+set result [catch {exec {*}$cmd} output]
verbose "result is $result"
verbose "output is $output"
diff --git a/gdb/testsuite/gdb.base/cond-eval-mode.c b/gdb/testsuite/gdb.base/cond-eval-mode.c
index e958f5e..8fd797e 100644
--- a/gdb/testsuite/gdb.base/cond-eval-mode.c
+++ b/gdb/testsuite/gdb.base/cond-eval-mode.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/cond-eval-mode.exp b/gdb/testsuite/gdb.base/cond-eval-mode.exp
index 0e98b83..9f49801 100644
--- a/gdb/testsuite/gdb.base/cond-eval-mode.exp
+++ b/gdb/testsuite/gdb.base/cond-eval-mode.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@ gdb_test_multiple $test_target $test_target {
# We now know that the target supports target-side conditional
# evaluation. Now make sure we can force-disable the
# ConditionalBreakpoints RSP feature.
-if [gdb_protocol_is_remote] {
+if {[gdb_protocol_is_remote]} {
gdb_test \
"set remote conditional-breakpoints-packet off" \
"Support for the 'ConditionalBreakpoints' packet on the current remote target is set to \"off\"."
diff --git a/gdb/testsuite/gdb.base/cond-expr.exp b/gdb/testsuite/gdb.base/cond-expr.exp
index 67918cf..31c2545 100644
--- a/gdb/testsuite/gdb.base/cond-expr.exp
+++ b/gdb/testsuite/gdb.base/cond-expr.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
# This file is part of the gdb testsuite
#
-# test of evaluation of conditional expressions, with constants and
+# test of evaluation of conditional expressions, with constants and
# variables. Using the print and the whatis command
# written with the only purpose in mind to cover the holes in the
# eval.c file
@@ -39,7 +39,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.base/condbreak-bad.c b/gdb/testsuite/gdb.base/condbreak-bad.c
index 2ceac89..d13f6f4 100644
--- a/gdb/testsuite/gdb.base/condbreak-bad.c
+++ b/gdb/testsuite/gdb.base/condbreak-bad.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/condbreak-bad.exp b/gdb/testsuite/gdb.base/condbreak-bad.exp
index 4644ae7..578478d 100644
--- a/gdb/testsuite/gdb.base/condbreak-bad.exp
+++ b/gdb/testsuite/gdb.base/condbreak-bad.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
standard_testfile
-if {[prepare_for_testing "failed to prepare" ${binfile} ${srcfile}]} {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
return
}
@@ -94,7 +94,7 @@ with_test_prefix "with continue 2" {
set bpnum [get_integer_valueof "\$bpnum" 0 "get bpnum"]
gdb_test_no_output "cond $bpnum a == 999"
-
+
gdb_test "cond $bpnum gibberish" \
"No symbol \"gibberish\" in current context." \
"attempt a bad condition"
diff --git a/gdb/testsuite/gdb.base/condbreak-call-false.c b/gdb/testsuite/gdb.base/condbreak-call-false.c
index 431c3a1..0df9e84 100644
--- a/gdb/testsuite/gdb.base/condbreak-call-false.c
+++ b/gdb/testsuite/gdb.base/condbreak-call-false.c
@@ -1,4 +1,4 @@
-/* Copyright 2013-2024 Free Software Foundation, Inc.
+/* Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/condbreak-call-false.exp b/gdb/testsuite/gdb.base/condbreak-call-false.exp
index 7b68a52..d46f47f 100644
--- a/gdb/testsuite/gdb.base/condbreak-call-false.exp
+++ b/gdb/testsuite/gdb.base/condbreak-call-false.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/condbreak-multi-context.cc b/gdb/testsuite/gdb.base/condbreak-multi-context.cc
index a674fd2..fa5966e 100644
--- a/gdb/testsuite/gdb.base/condbreak-multi-context.cc
+++ b/gdb/testsuite/gdb.base/condbreak-multi-context.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/condbreak-multi-context.exp b/gdb/testsuite/gdb.base/condbreak-multi-context.exp
index 024f768..b4ea0f1 100644
--- a/gdb/testsuite/gdb.base/condbreak-multi-context.exp
+++ b/gdb/testsuite/gdb.base/condbreak-multi-context.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -53,7 +53,8 @@ proc find_location_contexts { } {
global loc_name loc_index fill
global decimal hex gdb_prompt binfile
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
if {![runto_main]} {
return
@@ -130,7 +131,8 @@ proc check_bp_locations {bpnum states cond {msg ""}} {
proc_with_prefix scenario_1 { start_before } {
global warning decimal fill bkptno_num_re binfile
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
if { $start_before } {
if {![runto_main temporary]} {
@@ -242,7 +244,8 @@ proc setup_bps { bpnum1_name bpnum2_name } {
proc_with_prefix scenario_2 { start_before } {
global binfile bkptno_num_re
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
if { $start_before } {
if {![runto_main temporary]} {
@@ -290,7 +293,8 @@ proc_with_prefix scenario_2 { start_before } {
proc_with_prefix scenario_3 { start_before } {
global binfile bkptno_num_re loc_index warning
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
if { $start_before } {
if {![runto_main temporary]} {
@@ -367,7 +371,8 @@ proc_with_prefix scenario_3 { start_before } {
proc_with_prefix scenario_4 { start_before } {
global binfile bkptno_num_re loc_index warning
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
if { $start_before } {
if {![runto_main temporary]} {
diff --git a/gdb/testsuite/gdb.base/condbreak.exp b/gdb/testsuite/gdb.base/condbreak.exp
index 1f07bb5..6392dbc 100644
--- a/gdb/testsuite/gdb.base/condbreak.exp
+++ b/gdb/testsuite/gdb.base/condbreak.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# This test was written by Rich Title.
+# This test was written by Rich Title.
# Purpose is to test conditional breakpoints.
# Modeled after "break.exp".
@@ -42,7 +42,7 @@ gdb_test "break -q main" \
"Breakpoint.*at.* file .*$srcfile, line.*" \
"breakpoint function"
-#
+#
# test conditional break at function
#
gdb_test "break marker1 if 1==1" \
@@ -58,7 +58,7 @@ gdb_test "break $srcfile:$bp_location1 if 1==1" \
gdb_test_no_output "delete 3"
-#
+#
# test conditional break at function
#
gdb_test "break marker1 if (1==1)" \
@@ -139,7 +139,7 @@ gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.
# user instruction, GDB's search finds the second line entry, decides
# that the PC is indeed at the beginning of a source line, and doesn't
# print an address in the breakpoint hit message.
-#
+#
# GCC's Dwarf2 writer, on the other hand, squeezes out duplicate line
# entries, so GDB considers the source line to begin at the start of
# the function's prologue. Thus, if the program stops at the
diff --git a/gdb/testsuite/gdb.base/consecutive-step-over.c b/gdb/testsuite/gdb.base/consecutive-step-over.c
index e5dab4a..747b608 100644
--- a/gdb/testsuite/gdb.base/consecutive-step-over.c
+++ b/gdb/testsuite/gdb.base/consecutive-step-over.c
@@ -1,4 +1,4 @@
-/* Copyright 2014-2024 Free Software Foundation, Inc.
+/* Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/consecutive-step-over.exp b/gdb/testsuite/gdb.base/consecutive-step-over.exp
index 9da35df..65379cc 100644
--- a/gdb/testsuite/gdb.base/consecutive-step-over.exp
+++ b/gdb/testsuite/gdb.base/consecutive-step-over.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,7 +39,7 @@ set n_insns 3
# Extract addresses of a few consecutive instructions.
set test "get breakpoint addresses"
-if { [gdb_test_multiple "x /[expr $n_insns + 1]i \$pc" $test {
+if { [gdb_test_multiple "x /[expr {$n_insns + 1}]i \$pc" $test {
-re "=> $hex${up_to_nl} ($hex)${up_to_nl} ($hex)${up_to_nl} ($hex)${up_to_nl}$gdb_prompt $" {
for {set i 1} {$i <= $n_insns} {incr i} {
set bp_addrs($i) $expect_out($i,string)
diff --git a/gdb/testsuite/gdb.base/consecutive.exp b/gdb/testsuite/gdb.base/consecutive.exp
index 5ea146c..fa58a8f 100644
--- a/gdb/testsuite/gdb.base/consecutive.exp
+++ b/gdb/testsuite/gdb.base/consecutive.exp
@@ -1,4 +1,4 @@
-# Copyright 2001-2024 Free Software Foundation, Inc.
+# Copyright 2001-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -54,7 +54,7 @@ gdb_test "break \*$bp_addr" "Breakpoint $decimal at $bp_addr: file .*" \
gdb_test_multiple "step" "stopped at bp, 2nd instr" {
-re -wrap "Breakpoint $decimal, ($hex) in foo.*" {
set stop_addr $expect_out(1,string)
- if {[eval expr "$bp_addr == $stop_addr"]} {
+ if {$bp_addr == $stop_addr} {
pass "stopped at bp, 2nd instr"
} else {
fail "stopped at bp, 2nd instr (wrong address)"
@@ -65,7 +65,7 @@ gdb_test_multiple "step" "stopped at bp, 2nd instr" {
set stop_addr_is_stmt [hex_in_list $stop_addr $is_stmt]
if {!$stop_addr_is_stmt} {
fail "stopped at bp, 2nd instr (missing hex prefix)"
- } elseif {[eval expr "$bp_addr == $stop_addr"]} {
+ } elseif {$bp_addr == $stop_addr} {
pass "stopped at bp, 2nd instr"
} else {
fail "stopped at bp, 2nd instr (wrong address)"
diff --git a/gdb/testsuite/gdb.base/constvars.exp b/gdb/testsuite/gdb.base/constvars.exp
index 05085b7..4abd745 100644
--- a/gdb/testsuite/gdb.base/constvars.exp
+++ b/gdb/testsuite/gdb.base/constvars.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
#
@@ -53,7 +54,7 @@ proc local_compiler_xfail_check { } {
if {[test_compiler_info gcc-2-*]} {
if { ![test_debug_format "HP"] \
&& ![test_debug_format "DWARF \[0-9\]"] } then {
- setup_xfail "*-*-*"
+ setup_xfail "*-*-*"
}
}
}
@@ -68,7 +69,7 @@ proc local_compiler_xfail_check_2 { } {
}
}
-gdb_test "break marker1" "Breakpoint $decimal at .*"
+gdb_test "break marker1" "Breakpoint $decimal at .*"
gdb_test_multiple "cont" "up from marker1" {
-re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.base/continue-after-aborted-step-over.c b/gdb/testsuite/gdb.base/continue-after-aborted-step-over.c
index c5b670f..0701df3 100644
--- a/gdb/testsuite/gdb.base/continue-after-aborted-step-over.c
+++ b/gdb/testsuite/gdb.base/continue-after-aborted-step-over.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/continue-after-aborted-step-over.exp b/gdb/testsuite/gdb.base/continue-after-aborted-step-over.exp
index d586135..2bac000 100644
--- a/gdb/testsuite/gdb.base/continue-after-aborted-step-over.exp
+++ b/gdb/testsuite/gdb.base/continue-after-aborted-step-over.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,12 +45,13 @@ proc do_test {displaced breakpoint_always_inserted} {
global gdb_prompt decimal
global srcfile binfile
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
gdb_test_no_output "set displaced-stepping $displaced"
gdb_test_no_output "set breakpoint always-inserted $breakpoint_always_inserted"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -58,7 +59,7 @@ proc do_test {displaced breakpoint_always_inserted} {
# any kind of breakpoint insertion failure. If we can examine
# what's at memory address 0, it is possible that we could also
# execute it.
- if [is_address_zero_readable] {
+ if {[is_address_zero_readable]} {
untested "memory at address 0 is possibly executable"
return
}
diff --git a/gdb/testsuite/gdb.base/continue-all-already-running.c b/gdb/testsuite/gdb.base/continue-all-already-running.c
index f6683c0..2f67835 100644
--- a/gdb/testsuite/gdb.base/continue-all-already-running.c
+++ b/gdb/testsuite/gdb.base/continue-all-already-running.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/continue-all-already-running.exp b/gdb/testsuite/gdb.base/continue-all-already-running.exp
index 993c15c..a3e8c27 100644
--- a/gdb/testsuite/gdb.base/continue-all-already-running.exp
+++ b/gdb/testsuite/gdb.base/continue-all-already-running.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ save_vars { GDBFLAGS } {
}
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/coredump-filter-build-id.exp b/gdb/testsuite/gdb.base/coredump-filter-build-id.exp
index cddacce..75ba07d 100644
--- a/gdb/testsuite/gdb.base/coredump-filter-build-id.exp
+++ b/gdb/testsuite/gdb.base/coredump-filter-build-id.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if { ![istarget *-*-linux*] } {
untested "$testfile.exp"
return -1
}
-require is_x86_64_m64_target
+require is_x86_64_m64_target gcore_cmd_available
if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug build-id}] } {
return -1
@@ -48,7 +48,7 @@ if { ![gdb_gcore_cmd "$corefilename" "save corefile"] } {
# Determine if GDB dumped the mapping containing the build-id. This
# is done by invoking an external program (eu-unstrip).
-if { [catch "exec [gdb_find_eu-unstrip] -n --core $corefilename" output] == 0 } {
+if { [catch {exec [gdb_find_eu-unstrip] -n --core $corefilename} output] == 0 } {
set line [lindex [split $output "\n"] 0]
set test "gcore dumped mapping with build-id"
diff --git a/gdb/testsuite/gdb.base/coredump-filter.c b/gdb/testsuite/gdb.base/coredump-filter.c
index e11a706..63a5ca0 100644
--- a/gdb/testsuite/gdb.base/coredump-filter.c
+++ b/gdb/testsuite/gdb.base/coredump-filter.c
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/coredump-filter.exp b/gdb/testsuite/gdb.base/coredump-filter.exp
index 18c3505..9d99b96 100644
--- a/gdb/testsuite/gdb.base/coredump-filter.exp
+++ b/gdb/testsuite/gdb.base/coredump-filter.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/corefile-buildid-shlib-shr.c b/gdb/testsuite/gdb.base/corefile-buildid-shlib-shr.c
index 7c46479..7ab63bd 100644
--- a/gdb/testsuite/gdb.base/corefile-buildid-shlib-shr.c
+++ b/gdb/testsuite/gdb.base/corefile-buildid-shlib-shr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/corefile-buildid-shlib.c b/gdb/testsuite/gdb.base/corefile-buildid-shlib.c
index c01f829..e2b3af9 100644
--- a/gdb/testsuite/gdb.base/corefile-buildid-shlib.c
+++ b/gdb/testsuite/gdb.base/corefile-buildid-shlib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/corefile-buildid.c b/gdb/testsuite/gdb.base/corefile-buildid.c
index fe76957..69ccd97 100644
--- a/gdb/testsuite/gdb.base/corefile-buildid.c
+++ b/gdb/testsuite/gdb.base/corefile-buildid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/corefile-buildid.exp b/gdb/testsuite/gdb.base/corefile-buildid.exp
index 377ae80..de0b295 100644
--- a/gdb/testsuite/gdb.base/corefile-buildid.exp
+++ b/gdb/testsuite/gdb.base/corefile-buildid.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ proc create_core_file { progname } {
verbose -log "corefile is $corefile"
# Check the corefile has a build-id for the executable.
- if { [catch "exec [gdb_find_eu-unstrip] -n --core $corefile" output] == 0 } {
+ if { [catch {exec [gdb_find_eu-unstrip] -n --core $corefile} output] == 0 } {
set line [lindex [split $output "\n"] 0]
set binfile_re (?:[string_to_regexp $progname]|\\\[(?:exe|pie)\\\])
if { ![regexp "^${::hex}\\+${::hex} \[a-f0-9\]+@${::hex}.*$binfile_re$" $line] } {
diff --git a/gdb/testsuite/gdb.base/corefile-exec-context.c b/gdb/testsuite/gdb.base/corefile-exec-context.c
index ed4df60..6f5f29c 100644
--- a/gdb/testsuite/gdb.base/corefile-exec-context.c
+++ b/gdb/testsuite/gdb.base/corefile-exec-context.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/corefile-exec-context.exp b/gdb/testsuite/gdb.base/corefile-exec-context.exp
index 6bd2b04..f6085f7 100644
--- a/gdb/testsuite/gdb.base/corefile-exec-context.exp
+++ b/gdb/testsuite/gdb.base/corefile-exec-context.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ if {[build_executable $testfile.exp $testfile $srcfile] == -1} {
# length then lets try to make it longer.
set binfile_len [string length $binfile]
if { $binfile_len <= 80 } {
- set extra_len [expr 80 - $binfile_len + 1]
+ set extra_len [expr {80 - $binfile_len + 1}]
set extra_str [string repeat "x" $extra_len]
set new_binfile $binfile$extra_str
remote_exec build "mv $binfile $new_binfile"
@@ -51,7 +51,8 @@ remote_exec build "mv $corefile $corefile_1"
# Load the core file and confirm that the full executable name is
# seen.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
set saw_generated_line false
gdb_test_multiple "core-file $corefile_1" "load core file no args" {
-re "^Core was generated by `[string_to_regexp $binfile]'\\.\r\n" {
@@ -80,7 +81,8 @@ remote_exec build "mv $corefile $corefile_2"
# Load the core file and confirm that the full executable name and
# argument list are seen.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
set saw_generated_line false
gdb_test_multiple "core-file $corefile_2" "load core file with args" {
-re "^Core was generated by `[string_to_regexp $binfile] $args'\\.\r\n" {
@@ -155,7 +157,8 @@ remote_exec build "mv $corefile $corefile_3"
# Restart, load the core file, and check the environment variable
# shows up.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
# Check for environment variable VAR_NAME in the environment, its
# value should be VAR_VALUE.
diff --git a/gdb/testsuite/gdb.base/corefile-find-exec.c b/gdb/testsuite/gdb.base/corefile-find-exec.c
index ed4df60..6f5f29c 100644
--- a/gdb/testsuite/gdb.base/corefile-find-exec.c
+++ b/gdb/testsuite/gdb.base/corefile-find-exec.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/corefile-find-exec.exp b/gdb/testsuite/gdb.base/corefile-find-exec.exp
index 07e660d..0daabc8 100644
--- a/gdb/testsuite/gdb.base/corefile-find-exec.exp
+++ b/gdb/testsuite/gdb.base/corefile-find-exec.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/corefile-shmem-zero-id-lib.c b/gdb/testsuite/gdb.base/corefile-shmem-zero-id-lib.c
new file mode 100644
index 0000000..58fdec6
--- /dev/null
+++ b/gdb/testsuite/gdb.base/corefile-shmem-zero-id-lib.c
@@ -0,0 +1,522 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* This file contains a library that can be preloaded into GDB on Linux
+ using the LD_PRELOAD technique.
+
+ The library intercepts calls to OPEN, CLOSE, READ, and PREAD in order to
+ fake the inode number of a shared memory mapping.
+
+ When GDB creates a core file (e.g. with the 'gcore' command), then
+ shared memory mappings should be included in the generated core file.
+
+ The 'id' for the shared memory mapping shares the inode slot in the
+ /proc/PID/smaps file, which is what GDB consults to decide which
+ mappings should be included in the core file.
+
+ It is possible for a shared memory mapping to have an 'id' of zero.
+
+ At one point there was a bug in GDB where mappings with an inode of zero
+ would not be included in the generated core file. This meant that most
+ shared memory mappings would be included in the generated core file,
+ but, if a shared memory mapping happened to get an 'id' of zero, then,
+ because this would appear as a zero inode in the smaps file, this shared
+ memory mapping would be excluded from the generated core file.
+
+ This preload library spots when GDB opens a /proc/PID/smaps file and
+ immediately copies the contents of this file into an internal buffer.
+ The buffer is then scanned looking for a shared memory mapping, and, if
+ a shared memory mapping is found, its 'id' (in the inode position) is
+ changed to zero.
+
+ Calls to read/pread are intercepted, and attempts to read from the smaps
+ file are then served from the modified buffer contents.
+
+ The close calls are monitored and, when the smaps file is closed, the
+ internal buffer is released.
+
+ This works with GDB (currently) because the requirements for access to
+ the smaps file are pretty simple. GDB opens the file and grabs the
+ entire contents with a single pread call and a large buffer. There's no
+ seeking within the file or anything like that.
+
+ The intention is that this library is preloaded into a GDB session which
+ is then used to start an inferior and generate a core file. GDB will
+ then see the zero inode for the shared memory mapping and should, if the
+ bug is correctly fixed, still add the shared memory mapping to the
+ generated core file. */
+
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <dlfcn.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdbool.h>
+#include <assert.h>
+
+/* Logging. */
+
+static void
+log_msg (const char *fmt, ...)
+{
+#ifdef LOGGING
+ va_list ap;
+
+ va_start (ap, fmt);
+ vfprintf (stderr, fmt, ap);
+ va_end (ap);
+#endif /* LOGGING */
+}
+
+/* Error handling, message and exit. */
+
+static void
+error (const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start (ap, fmt);
+ vfprintf (stderr, fmt, ap);
+ va_end (ap);
+
+ exit (EXIT_FAILURE);
+}
+
+/* The type of the open() function. */
+typedef int (*open_func_type)(const char *pathname, int flags, ...);
+
+/* The type of the close() function. */
+typedef int (*close_func_type)(int fd);
+
+/* The type of the read() function. */
+typedef ssize_t (*read_func_type)(int fd, void *buf, size_t count);
+
+/* The type of the pread() function. */
+typedef ssize_t (*pread_func_type) (int fd, void *buf, size_t count, off_t offset);
+
+/* Structure that holds information about a /proc/PID/smaps file that has
+ been opened. */
+struct interesting_file
+{
+ /* The file descriptor for the opened file. */
+ int fd;
+
+ /* The read offset within the file. Set to zero when the file is
+ opened. Any 'read' calls will update this offset. */
+ size_t offset;
+
+ /* The size of the contents within the buffer. This is not the total
+ buffer size (which might be larger). Attempts to read beyond SIZE
+ indicate an attempt to read beyond the end of the file. */
+ size_t size;
+
+ /* The (possibly modified) contents of the file. */
+ char *content;
+};
+
+/* We only track a single interesting file. Currently, for the use case
+ we imagine, GDB will only ever open one /proc/PID/smaps file at once. */
+struct interesting_file the_file = { -1, 0, 0, NULL };
+
+/* Update the contents of the global THE_FILE buffer. It is assumed that
+ the file contents have already been loaded into THE_FILE's content
+ buffer.
+
+ Look for any lines that represent a shared memory mapping and modify
+ the inode field (which holds the shared memory id) to be zero. */
+static void
+update_file_content_buffer (void)
+{
+ assert (the_file.content != NULL);
+
+ char *start = the_file.content;
+ do
+ {
+ /* Every line, even the last one, ends with a newline. */
+ char *end = strchrnul (start, '\n');
+ assert (end != NULL);
+ assert (*end != '\0');
+
+ /* Attribute lines start with an uppercase letter. The lines we want
+ to modify should start with a lower case hex character,
+ i.e. [0-9a-f]. Also, every line that we want to consider should
+ be long enough, but just in case, check the longest possible
+ filename that we care about. */
+ if (isxdigit (*start) && (isdigit (*start) || islower (*start))
+ && (end - start) > 23)
+ {
+ /* There are two possible filenames that we look for:
+ /SYSV%08x
+ /SYSV%08x (deleted)
+ The END pointer is pointing to the first character after the
+ filename.
+
+ Setup OFFSET to be the offset from END to the start of the
+ filename. As we check the filename we set OFFSET to 0 if the
+ filename doesn't match one of the expected patterns. */
+ size_t offset;
+ if (strncmp ((end - 13), "/SYSV", 5) == 0)
+ offset = 13;
+ else if (strncmp ((end - 23), "/SYSV", 5) == 0)
+ {
+ if (strncmp ((end - 10), " (deleted)", 10) == 0)
+ offset = 23;
+ else
+ offset = 0;
+ }
+ else
+ offset = 0;
+
+ for (int i = 0; i < 8 && offset != 0; ++i)
+ {
+ if (!isdigit (*(end - offset + 5 + i)))
+ offset = 0;
+ }
+
+ /* If OFFSET is non-zero then the filename on this line looks
+ like a shared memory mapping, and OFFSET is the offset from
+ END to the first character of the filename. */
+ if (offset != 0)
+ {
+ log_msg ("[LD_PRELOAD] shared memory entry: %.*s\n",
+ offset, (end - offset));
+
+ /* Set PTR to the first character before the filename. This
+ should be a white space character. */
+ char *ptr = end - offset - 1;
+ assert (isspace (*ptr));
+
+ /* Walk backwards until we find the inode field. */
+ while (isspace (*ptr))
+ --ptr;
+
+ /* Now replace every character in the inode field, except the
+ first one, with a space character. */
+ while (!isspace (*(ptr - 1)))
+ {
+ assert (isdigit (*ptr));
+ *ptr = ' ';
+ --ptr;
+ }
+
+ /* Replace the first character with '0'. */
+ assert (isdigit (*ptr));
+ *ptr = '0';
+
+ /* This print is checked for from GDB. */
+ printf ("[LD_PRELOAD] updated a shared memory mapping\n");
+ }
+ }
+
+ /* Update START to point to the next line. The last line of the
+ file will be empty. */
+ assert (*end == '\n');
+ start = end;
+ while (*start == '\n')
+ ++start;
+ }
+ while (*start != '\0');
+}
+
+/* Return true if PATHNAME has for form "/proc/PID/smaps" (without the
+ quotes). Otherwise, return false. */
+
+static bool
+is_smaps_file (const char *pathname)
+{
+ if (strncmp (pathname, "/proc/", 6) == 0)
+ {
+ int idx = 6;
+ while (isdigit (pathname[idx]))
+ idx++;
+ if (idx > 6 && strcmp (&pathname[idx], "/smaps") == 0)
+ return true;
+ }
+
+ return false;
+}
+
+/* Return true if PATHNAME should be considered interesting. PATHNAME is
+ interesting if it has the form /proc/PID/smaps, and there is no
+ interesting file already opened. */
+
+static bool
+is_interesting_pathname (const char *pathname)
+{
+ return the_file.fd == -1 && is_smaps_file (pathname);
+}
+
+/* Read the contents of an interesting file from FD (and open file
+ descriptor) into the global THE_FILE variable, making the file FD the
+ current interesting file. There should be no already open interesting
+ file when this function is called.
+
+ The contents of the file FD are read into a memory buffer and updated so
+ that any shared memory mappings listed within FD (which will be an smaps
+ file) will have the id zero. */
+
+static void
+read_interesting_file_contents (int fd)
+{
+#define BLOCK_SIZE 1024
+ /* Slurp contents into a local buffer. */
+ size_t buffer_size = 1024;
+ size_t offset = 0;
+
+ assert (the_file.size == 0);
+ assert (the_file.content == NULL);
+ assert (the_file.fd == -1);
+ assert (the_file.offset == 0);
+
+ do
+ {
+ the_file.content = (char *) realloc (the_file.content, buffer_size);
+ if (the_file.content == NULL)
+ error ("[LD_PRELOAD] Failed allocating memory: %s\n", strerror (errno));
+
+ ssize_t bytes_read = read (fd, the_file.content + offset, BLOCK_SIZE);
+ if (bytes_read == -1)
+ error ("[LD_PRELOAD] Failed reading file: %s\n", strerror (errno));
+
+ the_file.size += bytes_read;
+
+ if (bytes_read < BLOCK_SIZE)
+ break;
+
+ offset += BLOCK_SIZE;
+ buffer_size += BLOCK_SIZE;
+ }
+ while (true);
+
+ /* Add a null terminator. This makes the update easier. We know
+ there will be space because we only break out of the loop above
+ when the last read returns less than BLOCK_SIZE bytes. This means
+ we allocated an extra BLOCK_SIZE bytes, but didn't fill them all.
+ This means there must be at least 1 byte available for the null. */
+ the_file.content[the_file.size] = '\0';
+
+ /* Reset the seek pointer. */
+ if (lseek (fd, 0, SEEK_SET) == (off_t) -1)
+ error ("[LD_PRELOAD] Failed to lseek in file: %s\n", strerror (errno));
+
+ /* Record the file descriptor, this is used in read, pread, and close
+ in order to spot when we need to intercept the call. */
+ the_file.fd = fd;
+
+ update_file_content_buffer ();
+#undef BLOCK_SIZE
+}
+
+/* Intercept calls to 'open'. If this is an attempt to open a
+ /proc/PID/smaps file then intercept it, load the file contents into a
+ buffer and update the file contents. For all other open requests, just
+ forward to the real open function. */
+int
+open (const char *pathname, int flags, ...)
+{
+ /* Pointer to the real open function. */
+ static open_func_type real_open = NULL;
+
+ /* Mode is only used if the O_CREAT flag is set in FLAGS. */
+ mode_t mode = 0;
+
+ /* Set true if this is a /proc/PID/smaps file. */
+ bool is_interesting = is_interesting_pathname (pathname);
+
+ /* Check if O_CREAT is in flags. If it is, get the mode. */
+ if (flags & O_CREAT)
+ {
+ va_list args;
+ va_start (args, flags);
+ mode = va_arg (args, mode_t);
+ va_end (args);
+ }
+
+ /* Debug. */
+ if (is_interesting)
+ log_msg ("[LD_PRELOAD] Opening file: %s\n", pathname);
+
+ /* Make sure we have a pointer to the real open() function. */
+ if (real_open == NULL)
+ {
+ /* Get the address of the real open() function. */
+ real_open = (open_func_type) dlsym (RTLD_NEXT, "open");
+ if (real_open == NULL)
+ error ("[LD_PRELOAD] dlsym() error for 'open': %s\n", dlerror ());
+ }
+
+ /* Call the original open() function with the provided arguments. */
+ int res = -1;
+ if (flags & O_CREAT)
+ res = real_open (pathname, flags, mode);
+ else
+ res = real_open (pathname, flags);
+
+ if (res != -1 && is_interesting)
+ read_interesting_file_contents (res);
+
+ return res;
+}
+
+/* Like above, but for open64. */
+
+int
+open64 (const char *pathname, int flags, ...)
+{
+ /* Pointer to the real open64 function. */
+ static open_func_type real_open64 = NULL;
+
+ /* Mode is only used if the O_CREAT flag is set in FLAGS. */
+ mode_t mode = 0;
+
+ /* Set true if this is a /proc/PID/smaps file. */
+ bool is_interesting = is_interesting_pathname (pathname);
+
+ /* Check if O_CREAT is in flags. If it is, get the mode. */
+ if (flags & O_CREAT)
+ {
+ va_list args;
+ va_start (args, flags);
+ mode = va_arg (args, mode_t);
+ va_end (args);
+ }
+
+ /* Debug. */
+ if (is_interesting)
+ log_msg ("[LD_PRELOAD] Opening file: %s\n", pathname);
+
+ /* Make sure we have a pointer to the real open64() function. */
+ if (real_open64 == NULL)
+ {
+ /* Get the address of the real open64() function. */
+ real_open64 = (open_func_type) dlsym (RTLD_NEXT, "open64");
+ if (real_open64 == NULL)
+ error ("[LD_PRELOAD] dlsym() error for 'open64': %s\n", dlerror ());
+ }
+
+ /* Call the original open64() function with the provided arguments. */
+ int res = -1;
+ if (flags & O_CREAT)
+ res = real_open64 (pathname, flags, mode);
+ else
+ res = real_open64 (pathname, flags);
+
+ if (res != -1 && is_interesting)
+ read_interesting_file_contents (res);
+
+ return res;
+}
+
+/* Intercept the 'close' function. If this is a previously opened
+ interesting file then clean up. Otherwise, forward to the normal close
+ function. */
+int
+close (int fd)
+{
+ static close_func_type real_close = NULL;
+
+ if (fd == the_file.fd)
+ {
+ the_file.fd = -1;
+ free (the_file.content);
+ the_file.content = NULL;
+ the_file.offset = 0;
+ the_file.size = 0;
+ log_msg ("[LD_PRELOAD] Closing file.\n");
+ }
+
+ /* Make sure we have a pointer to the real open() function. */
+ if (real_close == NULL)
+ {
+ /* Get the address of the real open() function. */
+ real_close = (close_func_type) dlsym (RTLD_NEXT, "close");
+ if (real_close == NULL)
+ error ("[LD_PRELOAD] dlsym() error for 'close': %s\n", dlerror ());
+ }
+
+ return real_close (fd);
+}
+
+/* Intercept 'pread' calls. If this is a pread from a previously opened
+ interesting file, then read from the in memory buffer. Otherwise,
+ forward to the real pread function. */
+ssize_t
+pread (int fd, void *buf, size_t count, off_t offset)
+{
+ static pread_func_type real_pread = NULL;
+
+ if (fd == the_file.fd)
+ {
+ size_t max;
+
+ if (offset > the_file.size)
+ max = 0;
+ else
+ max = the_file.size - offset;
+ if (count > max)
+ count = max;
+
+ memcpy (buf, the_file.content + offset, count);
+ log_msg ("[LD_PRELOAD] Read from file.\n");
+ return count;
+ }
+
+ if (real_pread == NULL)
+ {
+ /* Get the address of the real read() function. */
+ real_pread = (pread_func_type) dlsym (RTLD_NEXT, "pread");
+ if (real_pread == NULL)
+ error ("[LD_PRELOAD] dlsym() error for 'pread': %s\n", dlerror ());
+ }
+
+ return real_pread (fd, buf, count, offset);
+}
+
+/* Intercept 'read' calls. If this is a read from a previously opened
+ interesting file, then read from the in memory buffer. Otherwise,
+ forward to the real read function. */
+ssize_t
+read (int fd, void *buf, size_t count)
+{
+ static read_func_type real_read = NULL;
+
+ if (fd == the_file.fd)
+ {
+ ssize_t bytes_read = pread (fd, buf, count, the_file.offset);
+ if (bytes_read > 0)
+ the_file.offset += bytes_read;
+ return bytes_read;
+ }
+
+ if (real_read == NULL)
+ {
+ /* Get the address of the real read() function. */
+ real_read = (read_func_type) dlsym (RTLD_NEXT, "read");
+ if (real_read == NULL)
+ error ("[LD_PRELOAD] dlsym() error for 'read': %s\n", dlerror ());
+ }
+
+ return real_read (fd, buf, count);
+}
diff --git a/gdb/testsuite/gdb.base/corefile-shmem-zero-id.c b/gdb/testsuite/gdb.base/corefile-shmem-zero-id.c
new file mode 100644
index 0000000..92d2edf
--- /dev/null
+++ b/gdb/testsuite/gdb.base/corefile-shmem-zero-id.c
@@ -0,0 +1,63 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <assert.h>
+#include <time.h>
+
+void
+breakpt (void)
+{
+ /* Nothing. */
+}
+
+int
+main (void)
+{
+ /* Create a shared memory mapping. */
+ int sid = shmget (IPC_PRIVATE, 0x1000, IPC_CREAT | IPC_EXCL | 0777);
+ if (sid == -1)
+ {
+ perror ("shmget");
+ exit (1);
+ }
+
+ /* Attach the shared memory mapping. */
+ void *addr = shmat (sid, NULL, SHM_RND);
+ if (addr == (void *) -1L)
+ {
+ perror ("shmat");
+ exit (1);
+ }
+
+ breakpt ();
+
+ /* Mark the shared memory mapping as deleted -- once the last user
+ has finished with it. */
+ if (shmctl (sid, IPC_RMID, NULL) != 0)
+ {
+ perror ("shmctl");
+ exit (1);
+ }
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/corefile-shmem-zero-id.exp b/gdb/testsuite/gdb.base/corefile-shmem-zero-id.exp
new file mode 100644
index 0000000..94ab454
--- /dev/null
+++ b/gdb/testsuite/gdb.base/corefile-shmem-zero-id.exp
@@ -0,0 +1,230 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This test script tries to check GDB's ability to create a core file
+# (e.g. with 'gcore' command) when there's a shared memory mapping
+# with the id zero.
+#
+# Testing this case is hard. Older kernels don't even seem to give
+# out the shared memory id zero. And on new kernels you still cannot
+# guarantee to grab the zero id for testing; the id might be in use by
+# some other process, or the kernel might just not give out that id
+# for some other reason.
+#
+# To figure out which mappings to include in the core file, GDB reads
+# the /proc/PID/smaps file. There is a field in this file which for
+# file backed mappings, holds the inode of the file. But for shared
+# memory mappings this field holds the shared memory id. The problem
+# was that GDB would ignore any entry in /proc/PID/smaps with an inode
+# entry of zero, which would catch the shared memory mapping with a
+# zero id.
+#
+# There was an attempt to write a test which spammed out requests for
+# shared memory mappings and tried to find the one with id zero, but
+# this was still really unreliable.
+#
+# This test takes a different approach. We compile a library which we
+# preload into the GDB process. This library intercepts calls to
+# open, close, read, and pread, and watches for an attempt to open the
+# /proc/PID/smaps file.
+#
+# When we see that file being opened, we copy the file contents into a
+# memory buffer and modify the buffer so that the inode field for any
+# shared memory mappings is set to zero. We then intercept calls to
+# read and pread and return results from that in memory buffer.
+#
+# The test executable itself create a shared memory mapping (which
+# might have any id).
+#
+# GDB, with the pre-load library in place, start the inferior and then
+# uses the 'gcore' command to dump a core file. When GDB opens the
+# smaps file and reads from it, the preload library ensures that GDB
+# sees an inode of zero.
+#
+
+# This test only works on Linux
+require isnative
+require {!is_remote host}
+require {!is_remote target}
+require {istarget *-linux*}
+require gcore_cmd_available
+
+standard_testfile .c -lib.c
+
+set libfile ${testfile}-lib
+set libobj [standard_output_file ${libfile}.so]
+
+# Compile the preload library. We only get away with this as we
+# limit this test to running when ISNATIVE is true.
+if { [build_executable "build preload lib" $libobj $srcfile2 \
+ {debug shlib libs=-ldl}] == -1 } {
+ return
+}
+
+# Now compile the inferior executable.
+if {[build_executable "build executable" $testfile $srcfile] == -1} {
+ return
+}
+
+# Spawn GDB with LIBOBJ preloaded using LD_PRELOAD.
+save_vars { env(LD_PRELOAD) env(ASAN_OPTIONS) } {
+ if { ![info exists env(LD_PRELOAD) ]
+ || $env(LD_PRELOAD) == "" } {
+ set env(LD_PRELOAD) "$libobj"
+ } else {
+ append env(LD_PRELOAD) ":$libobj"
+ }
+
+ # Prevent address sanitizer error:
+ # ASan runtime does not come first in initial library list; you should
+ # either link runtime to your application or manually preload it with
+ # LD_PRELOAD.
+ append_environment_default ASAN_OPTIONS verify_asan_link_order 0
+
+ clean_restart
+ gdb_load $binfile
+
+ # Start GDB with the modified environment, this means that, when
+ # using remote targets, gdbserver will also use the preload
+ # library.
+ if {![runto_main]} {
+ return
+ }
+}
+
+gdb_breakpoint breakpt
+gdb_continue_to_breakpoint "run to breakpt"
+
+# Check the /proc/PID/smaps file itself. The call to 'cat' should
+# inherit the preload library, so should see the modified file
+# contents. Check that the shared memory mapping line has an id of
+# zero. This confirms that the preload library is working. If the
+# preload library breaks then we'll start seeing non-zero shared
+# memory ids, which always worked, so we'd never know that this test
+# is broken!
+#
+# This check ensures the test is working as expected.
+set shmem_line_count 0
+set fixup_line_count 0
+set inf_pid [get_inferior_pid]
+gdb_test_multiple "shell cat /proc/${inf_pid}/smaps" "check smaps" {
+ -re "^\\\[LD_PRELOAD\\\] updated a shared memory mapping\r\n" {
+ incr fixup_line_count
+ exp_continue
+ }
+ -re "^\[^\r\n\]+($decimal)\\s+/SYSV\[0-9\]{8}(?: \\(deleted\\))?\r\n" {
+ set id $expect_out(1,string)
+ if { $id == 0 } {
+ incr shmem_line_count
+ }
+ exp_continue
+ }
+ -re "^$gdb_prompt $" {
+ with_test_prefix $gdb_test_name {
+ gdb_assert { $shmem_line_count == 1 } \
+ "single shared memory mapping found"
+ gdb_assert { $fixup_line_count == 1 } \
+ "single fixup line found"
+ }
+ }
+ -re "^\[^\r\n\]+\r\n" {
+ exp_continue
+ }
+}
+
+# Now generate a core file. This will use the preload library to read
+# the smaps file. The code below is copied from 'proc gdb_gcore_cmd',
+# but we don't use that as we also look for a message that is printed
+# by the LD_PRELOAD library. This is an extra level of check that the
+# preload library is triggering when needed.
+set corefile [standard_output_file ${testfile}.core]
+set saw_ld_preload_msg false
+set saw_saved_msg false
+with_timeout_factor 3 {
+ gdb_test_multiple "gcore $corefile" "save core file" {
+ -re "^\\\[LD_PRELOAD\\\] updated a shared memory mapping\r\n" {
+ # GDB actually reads the smaps file multiple times when
+ # creating a core file, so we'll see multiple of these
+ # fixup lines.
+ set saw_ld_preload_msg true
+ exp_continue
+ }
+ -re "^Saved corefile \[^\r\n\]+\r\n" {
+ set saw_saved_msg true
+ exp_continue
+ }
+ -re "^$gdb_prompt $" {
+ with_test_prefix $gdb_test_name {
+ gdb_assert { $saw_saved_msg } \
+ "saw 'Saved corefile' message"
+
+ # If we're using a remote target then the message from
+ # the preload library will go to gdbservers stdout,
+ # not GDB's, so don't check for it.
+ if { [gdb_protocol_is_native] } {
+ gdb_assert { $saw_ld_preload_msg } \
+ "saw LD_PRELOAD message from library"
+ }
+ }
+ }
+ -re "^\[^\r\n\]*\r\n" {
+ exp_continue
+ }
+ }
+}
+
+# Restart GDB. This time we are _not_ using the preload library. We
+# no longer need it as we are only analysing the core file now.
+clean_restart
+gdb_load $binfile
+
+# Load the core file.
+gdb_test "core-file $corefile" \
+ "Program terminated with signal SIGTRAP, Trace/breakpoint trap\\..*" \
+ "load core file"
+
+# Look through the mappings. We _should_ see the shared memory
+# mapping. We _should_not_ see any of the special '[blah]' style
+# mappings, e.g. [vdso], [vstack], [vsyscalls], etc.
+set saw_special_mapping false
+set saw_shmem_mapping false
+gdb_test_multiple "info proc mappings" "" {
+ -re "\r\nStart Addr\[^\r\n\]+File\\s*\r\n" {
+ exp_continue
+ }
+
+ -re "^$hex\\s+$hex\\s+$hex\\s+$hex\\s+\\\[\\S+\\\]\\s*\r\n" {
+ set saw_special_mapping true
+ exp_continue
+ }
+
+ -re "^$hex\\s+$hex\\s+$hex\\s+$hex\\s+/SYSV\[0-9\]+ \\(deleted\\)\\s*\r\n" {
+ set saw_shmem_mapping true
+ exp_continue
+ }
+
+ -re "^$hex\\s+$hex\\s+$hex\\s+$hex\[^\r\n\]*\r\n" {
+ exp_continue
+ }
+
+ -re "^$gdb_prompt $" {
+ with_test_prefix $gdb_test_name {
+ gdb_assert { $saw_shmem_mapping } \
+ "check shared memory mapping exists"
+ gdb_assert { !$saw_special_mapping } \
+ "check no special mappings added"
+ }
+ }
+}
diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
index 83b42ab..6e44df84 100644
--- a/gdb/testsuite/gdb.base/corefile.exp
+++ b/gdb/testsuite/gdb.base/corefile.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,6 +31,7 @@ if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
# mmapped data in core file" test.
set corefile [core_find $binfile {}]
if {$corefile == ""} {
+ untested "unable to create or find corefile"
return 0
}
@@ -59,7 +60,7 @@ proc start_gdb_with_corefile { testname coreopt corefile {binfile ""} } {
-re -wrap "Couldn't find .* registers in core file.*" {
fail "$gdb_test_name (couldn't find regs)"
}
- -re -wrap "Core was generated by `[string_to_regexp $corefile]'\\.\r\n.*\#0 \[^\r\n\]+\(\).*" {
+ -re -wrap "Core was generated by `[string_to_regexp $binfile]'\\.\r\n.*\#0 \[^\r\n\]+\(\).*" {
pass $gdb_test_name
}
-re -wrap "Core was generated by .*\r\n\#0 .*\(\).*" {
@@ -74,6 +75,16 @@ proc start_gdb_with_corefile { testname coreopt corefile {binfile ""} } {
fail "$gdb_test_name (core not loaded)"
}
}
+
+ # COREFILE will have whitespace quoted ready for use on the command
+ # line. But for the 'info inferiors' output whitespace is not quoted,
+ # so remote the quoting now.
+ regsub -all "\\\\ " $corefile " " corefile
+ gdb_test "info inferiors" \
+ [multi_line \
+ "\\* 1\[^\r\n\]+\\(core\\)\\s+.*[string_to_regexp $binfile]\\s*" \
+ "\\s+core file [string_to_regexp $corefile]"] \
+ "$testname, info inferiors"
}
}
@@ -96,7 +107,8 @@ foreach_with_prefix coreopt {--core= -core= "-c "} {
# Now restart normally.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
# Test basic corefile recognition via core-file command.
@@ -200,7 +212,8 @@ set coremmap_data_backup_filename \
remote_exec host "mv ${coremmap_data_filename} \
${coremmap_data_backup_filename}"
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
# Load the core file and check we get a warning about the
# coremmap.data file being missing.
@@ -229,7 +242,8 @@ remote_exec host "mv ${coremmap_data_backup_filename} \
# Test that we can unload the core with the "detach" command.
proc_with_prefix corefile_detach {} {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
gdb_test "core-file $::corefile" "Core was generated by .*" "load core"
gdb_test "detach" "No core file now\\." "detach core"
@@ -251,7 +265,8 @@ proc corefile_test_run {} {
return
}
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
gdb_test "core-file $corefile" "Core was generated by .*" "run: load core again"
set re "Local core dump file:"
@@ -260,7 +275,7 @@ proc corefile_test_run {} {
"run: sanity check we see the core file"
set test "run: with core"
- if [runto_main] {
+ if {[runto_main]} {
pass $test
} else {
fail $test
@@ -322,7 +337,7 @@ proc corefile_test_attach {} {
return
}
- if [can_spawn_for_attach] {
+ if {[can_spawn_for_attach]} {
set test "attach: spawn sleep"
set res [remote_spawn host "$binfile sleep"]
if { $res < 0 || $res == "" } {
diff --git a/gdb/testsuite/gdb.base/corefile2.exp b/gdb/testsuite/gdb.base/corefile2.exp
index c0624f6..3975460 100644
--- a/gdb/testsuite/gdb.base/corefile2.exp
+++ b/gdb/testsuite/gdb.base/corefile2.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,6 +40,7 @@ if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
set corefile [core_find $binfile {}]
if {$corefile == ""} {
+ untested "unable to create or find corefile"
return 0
}
@@ -170,7 +171,8 @@ with_test_prefix "renamed binfile" {
# Restart and run to the abort call.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return
@@ -194,7 +196,8 @@ if {!$core_supported} {
gdb_test_no_output "maint print core-file-backed-mappings" \
"maint print core-file-backed-mapping with no core file"
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
set core_loaded [gdb_core_cmd "$corefile" "re-load generated corefile"]
if { $core_loaded == -1 } {
diff --git a/gdb/testsuite/gdb.base/corefile3.c b/gdb/testsuite/gdb.base/corefile3.c
new file mode 100644
index 0000000..16030dd
--- /dev/null
+++ b/gdb/testsuite/gdb.base/corefile3.c
@@ -0,0 +1,118 @@
+/* Copyright 1992-2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* This file is based on coremaker.c. */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <assert.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+
+#define MAPSIZE (8 * 1024)
+
+/* Global pointers so it's easier to access them from GDB. */
+
+char *rw_mapping = NULL;
+char *malloc_buffer = NULL;
+char *anon_mapping = NULL;
+char *shm_mapping = NULL;
+
+/* Create mappings within this process. */
+
+void
+mmapdata ()
+{
+ /* Allocate and initialize a buffer that will be used to write the file
+ that is later mapped in. */
+
+ malloc_buffer = (char *) malloc (MAPSIZE);
+ for (int j = 0; j < MAPSIZE; ++j)
+ malloc_buffer[j] = j;
+
+ /* Write the file to map in. */
+
+ int fd = open ("coremmap.data", O_CREAT | O_RDWR, 0666);
+ assert (fd != -1);
+ write (fd, malloc_buffer, MAPSIZE);
+
+ /* Now map the file into our address space as RW_MAPPING. */
+
+ rw_mapping
+ = (char *) mmap (0, MAPSIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
+ assert (rw_mapping != (char *) MAP_FAILED);
+
+ /* Verify that the original data and the mapped data are identical. If
+ not, we'd rather fail now than when trying to access the mapped data
+ from the core file. */
+
+ for (int j = 0; j < MAPSIZE; ++j)
+ assert (malloc_buffer[j] == rw_mapping[j]);
+
+ /* Touch RW_MAPPING so the kernel writes it out into 'core'. */
+ rw_mapping[0] = malloc_buffer[0];
+
+ /* Create yet another region which is allocated, but not written to. */
+ anon_mapping = mmap (NULL, MAPSIZE, PROT_READ | PROT_WRITE,
+ MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ assert (anon_mapping != MAP_FAILED);
+
+ /* Create a shared memory mapping. */
+ int sid = shmget (IPC_PRIVATE, MAPSIZE, IPC_CREAT | IPC_EXCL | 0777);
+ assert (sid != -1);
+ shm_mapping = (char *) shmat (sid, NULL, 0);
+ int res = shmctl (sid, IPC_RMID, NULL);
+ assert (res == 0);
+ assert (shm_mapping != MAP_FAILED);
+}
+
+void
+func2 ()
+{
+#ifdef SA_FULLDUMP
+ /* Force a corefile that includes the data section for AIX. */
+ {
+ struct sigaction sa;
+
+ sigaction (SIGABRT, (struct sigaction *)0, &sa);
+ sa.sa_flags |= SA_FULLDUMP;
+ sigaction (SIGABRT, &sa, (struct sigaction *)0);
+ }
+#endif
+
+ abort ();
+}
+
+void
+func1 ()
+{
+ func2 ();
+}
+
+int
+main (void)
+{
+ mmapdata ();
+ func1 ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/corefile3.exp b/gdb/testsuite/gdb.base/corefile3.exp
new file mode 100644
index 0000000..4528509
--- /dev/null
+++ b/gdb/testsuite/gdb.base/corefile3.exp
@@ -0,0 +1,73 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Create a core file with some mapped file regions, but ensure that
+# the the kernel should write the regions into the core file (e.g. r/w
+# file backed mapping).
+#
+# We then delete the file that backed the mapping and load the core
+# file into GDB.
+#
+# GDB shouldn't warn about the file being missing. It doesn't matter;
+# the file contents can all be found in the core file itself.
+
+require isnative
+require {!is_remote host}
+
+standard_testfile
+
+if {[build_executable $testfile.exp $testfile $srcfile] == -1} {
+ return
+}
+
+set corefile [core_find $binfile {}]
+if {$corefile == ""} {
+ untested "unable to create or find corefile"
+ return
+}
+
+# Move the coremap.data file out of the way, so it cannot be found
+# when we later load the core file into GDB. This file was generated
+# by the inferior as it was running.
+set data_filename \
+ [standard_output_file coredir.[getpid]/coremmap.data]
+set backup_filename \
+ [standard_output_file coredir.[getpid]/coremmap.data.backup]
+remote_exec host "mv ${data_filename} ${backup_filename}"
+
+clean_restart
+gdb_load $binfile
+
+# Load the core file. The 'coremap.data' file cannot be found by GDB,
+# but all the mappings for that file are r/w and should be present in
+# the core file, so we shouldn't get any warnings from GDB about it.
+set warnings_seen 0
+gdb_test_multiple "core-file $corefile" "core-file command" {
+ -re "^warning: Can't open file \[^\r\n\]+ during file-backed mapping note processing\r\n" {
+ incr warnings_seen
+ exp_continue
+ }
+ -re "^$gdb_prompt $" {
+ gdb_assert { $warnings_seen == 0 } $gdb_test_name
+ }
+ -re "^\[^\r\n\]*\r\n" {
+ exp_continue
+ }
+}
+
+# Check the mappings are all readable.
+foreach label { rw_mapping malloc_buffer anon_mapping shm_mapping } {
+ gdb_test "x/1wd $label" "^$hex:\\s+$decimal"
+}
diff --git a/gdb/testsuite/gdb.base/coremaker.c b/gdb/testsuite/gdb.base/coremaker.c
index 5e19766..b73e659 100644
--- a/gdb/testsuite/gdb.base/coremaker.c
+++ b/gdb/testsuite/gdb.base/coremaker.c
@@ -1,4 +1,4 @@
-/* Copyright 1992-2024 Free Software Foundation, Inc.
+/* Copyright 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/coremaker2.c b/gdb/testsuite/gdb.base/coremaker2.c
index f9a1759..8cc3eeb 100644
--- a/gdb/testsuite/gdb.base/coremaker2.c
+++ b/gdb/testsuite/gdb.base/coremaker2.c
@@ -1,4 +1,4 @@
-/* Copyright 1992-2024 Free Software Foundation, Inc.
+/* Copyright 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/ctf-constvars.c b/gdb/testsuite/gdb.base/ctf-constvars.c
index 43d68a6..e484851 100644
--- a/gdb/testsuite/gdb.base/ctf-constvars.c
+++ b/gdb/testsuite/gdb.base/ctf-constvars.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/ctf-constvars.exp b/gdb/testsuite/gdb.base/ctf-constvars.exp
index ea3cc93..f38ee53 100644
--- a/gdb/testsuite/gdb.base/ctf-constvars.exp
+++ b/gdb/testsuite/gdb.base/ctf-constvars.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/ctf-ptype.c b/gdb/testsuite/gdb.base/ctf-ptype.c
index ca34789..3984cf3 100644
--- a/gdb/testsuite/gdb.base/ctf-ptype.c
+++ b/gdb/testsuite/gdb.base/ctf-ptype.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp
index 25e31fc..1aaa48c 100644
--- a/gdb/testsuite/gdb.base/ctf-ptype.exp
+++ b/gdb/testsuite/gdb.base/ctf-ptype.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -234,11 +234,10 @@ proc ptype_maybe_prototyped { id prototyped plain { overprototyped "NO-MATCH" }
# Turn the arguments, which are literal strings, into
# regular expressions by quoting any special characters they contain.
foreach var { prototyped plain overprototyped } {
- eval "set val \$$var"
- regsub -all "\[\]\[*()\]" $val "\\\\&" val
+ set val [string_to_regexp [set $var]]
regsub -all "short int" $val "short( int)?" val
regsub -all "long int" $val "long( int)?" val
- eval "set $var \$val"
+ set $var $val
}
gdb_test_multiple "ptype $id" "ptype $id" {
@@ -280,7 +279,7 @@ ptype_maybe_prototyped "fffptr" "int (*(*(*)(char))(short int))(long int)" \
if {[runto_main]} {
- if [target_info exists gdb,cannot_call_functions] {
+ if {[target_info exists gdb,cannot_call_functions]} {
unsupported "this target can not call functions"
return
}
diff --git a/gdb/testsuite/gdb.base/ctxobj-f.c b/gdb/testsuite/gdb.base/ctxobj-f.c
index d258e9f..e9884c4 100644
--- a/gdb/testsuite/gdb.base/ctxobj-f.c
+++ b/gdb/testsuite/gdb.base/ctxobj-f.c
@@ -1,5 +1,5 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/ctxobj-m.c b/gdb/testsuite/gdb.base/ctxobj-m.c
index f9fbfda..10475e1 100644
--- a/gdb/testsuite/gdb.base/ctxobj-m.c
+++ b/gdb/testsuite/gdb.base/ctxobj-m.c
@@ -1,5 +1,5 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/ctxobj-v.c b/gdb/testsuite/gdb.base/ctxobj-v.c
index 6e39d8d..f9f108c 100644
--- a/gdb/testsuite/gdb.base/ctxobj-v.c
+++ b/gdb/testsuite/gdb.base/ctxobj-v.c
@@ -1,5 +1,5 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/ctxobj.exp b/gdb/testsuite/gdb.base/ctxobj.exp
index d113718..4a50ab6 100644
--- a/gdb/testsuite/gdb.base/ctxobj.exp
+++ b/gdb/testsuite/gdb.base/ctxobj.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -56,7 +56,7 @@ clean_restart $executable
gdb_load_shlib $libobj1
gdb_load_shlib $libobj2
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/cursal.c b/gdb/testsuite/gdb.base/cursal.c
index bc1e46f..a400503 100644
--- a/gdb/testsuite/gdb.base/cursal.c
+++ b/gdb/testsuite/gdb.base/cursal.c
@@ -1,4 +1,4 @@
-/* Copyright 2004-2024 Free Software Foundation, Inc.
+/* Copyright 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/cursal.exp b/gdb/testsuite/gdb.base/cursal.exp
index 6c1fe38..04a41bc 100644
--- a/gdb/testsuite/gdb.base/cursal.exp
+++ b/gdb/testsuite/gdb.base/cursal.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/cvexpr.c b/gdb/testsuite/gdb.base/cvexpr.c
index 35f259a..76703cc 100644
--- a/gdb/testsuite/gdb.base/cvexpr.c
+++ b/gdb/testsuite/gdb.base/cvexpr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/cvexpr.exp b/gdb/testsuite/gdb.base/cvexpr.exp
index 439bf71..e2f8c35 100644
--- a/gdb/testsuite/gdb.base/cvexpr.exp
+++ b/gdb/testsuite/gdb.base/cvexpr.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2024 Free Software Foundation, Inc.
+# Copyright (C) 2001-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -517,7 +517,7 @@ foreach testspec $specs {
# These tests don't rely on the debug format.
with_test_prefix nodebug {
- if { [prepare_for_testing "failed to prepare" $binfile $srcfile {nodebug}] } {
+ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug}] } {
return 0
}
diff --git a/gdb/testsuite/gdb.base/dcache-flush.c b/gdb/testsuite/gdb.base/dcache-flush.c
index 5161709..cd18a88 100644
--- a/gdb/testsuite/gdb.base/dcache-flush.c
+++ b/gdb/testsuite/gdb.base/dcache-flush.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dcache-flush.exp b/gdb/testsuite/gdb.base/dcache-flush.exp
index 2d4def2..0bd034b 100644
--- a/gdb/testsuite/gdb.base/dcache-flush.exp
+++ b/gdb/testsuite/gdb.base/dcache-flush.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile}] } {
return -1
}
-if ![runto func] {
+if {![runto func]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/dcache-line-read-error.c b/gdb/testsuite/gdb.base/dcache-line-read-error.c
index 6feb201..d47b9d6 100644
--- a/gdb/testsuite/gdb.base/dcache-line-read-error.c
+++ b/gdb/testsuite/gdb.base/dcache-line-read-error.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dcache-line-read-error.exp b/gdb/testsuite/gdb.base/dcache-line-read-error.exp
index d10c3a4..62d561c 100644
--- a/gdb/testsuite/gdb.base/dcache-line-read-error.exp
+++ b/gdb/testsuite/gdb.base/dcache-line-read-error.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile}] } {
return -1
}
-if ![runto breakpt] {
+if {![runto breakpt]} {
return -1
}
@@ -45,7 +45,7 @@ proc delete_mem {} {
# Make the dcache line size bigger than the pagesize.
set pagesize [get_integer_valueof "pg_size" -1]
-set linesize [expr $pagesize * 2]
+set linesize [expr {$pagesize * 2}]
gdb_test_no_output "set dcache line-size $linesize" \
"set dcache line size to twice the pagesize"
diff --git a/gdb/testsuite/gdb.base/debug-expr.exp b/gdb/testsuite/gdb.base/debug-expr.exp
index 838a2a5..0775d23 100644
--- a/gdb/testsuite/gdb.base/debug-expr.exp
+++ b/gdb/testsuite/gdb.base/debug-expr.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/debug-frame-2.c b/gdb/testsuite/gdb.base/debug-frame-2.c
index 571b140..9a284ec 100644
--- a/gdb/testsuite/gdb.base/debug-frame-2.c
+++ b/gdb/testsuite/gdb.base/debug-frame-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/debug-frame.c b/gdb/testsuite/gdb.base/debug-frame.c
index 629c309..9d419f7 100644
--- a/gdb/testsuite/gdb.base/debug-frame.c
+++ b/gdb/testsuite/gdb.base/debug-frame.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/debug-frame.exp b/gdb/testsuite/gdb.base/debug-frame.exp
index f928f19..eee65ae 100644
--- a/gdb/testsuite/gdb.base/debug-frame.exp
+++ b/gdb/testsuite/gdb.base/debug-frame.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfiles]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/decl-before-def-decl.c b/gdb/testsuite/gdb.base/decl-before-def-decl.c
index 3b46366..507e595 100644
--- a/gdb/testsuite/gdb.base/decl-before-def-decl.c
+++ b/gdb/testsuite/gdb.base/decl-before-def-decl.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/decl-before-def-def.c b/gdb/testsuite/gdb.base/decl-before-def-def.c
index 1dda03b..29959b4 100644
--- a/gdb/testsuite/gdb.base/decl-before-def-def.c
+++ b/gdb/testsuite/gdb.base/decl-before-def-def.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/decl-before-def.exp b/gdb/testsuite/gdb.base/decl-before-def.exp
index 62e152e..4456929 100644
--- a/gdb/testsuite/gdb.base/decl-before-def.exp
+++ b/gdb/testsuite/gdb.base/decl-before-def.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/default-args.c b/gdb/testsuite/gdb.base/default-args.c
index eccdcfd..f78eb2a 100644
--- a/gdb/testsuite/gdb.base/default-args.c
+++ b/gdb/testsuite/gdb.base/default-args.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/default-args.exp b/gdb/testsuite/gdb.base/default-args.exp
index 1ddf682..ae417ed 100644
--- a/gdb/testsuite/gdb.base/default-args.exp
+++ b/gdb/testsuite/gdb.base/default-args.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,8 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
# Basic/core tests using user-visible commands.
with_test_prefix "basics" {
diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp
index 93a6733..aab074c 100644
--- a/gdb/testsuite/gdb.base/default.exp
+++ b/gdb/testsuite/gdb.base/default.exp
@@ -1,4 +1,4 @@
-# Copyright 1988-2024 Free Software Foundation, Inc.
+# Copyright 1988-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,14 +31,14 @@ set timeout 60
gdb_test "add-symbol-file" "add-symbol-file takes a file name and an address"
# test append
-gdb_test "append" "List of \"append\" subcommands:.*"
-gdb_test "append binary" "List of \"append binary\" subcommands:.*"
-gdb_test "append memory" "Missing filename\."
-gdb_test "append value" "Missing filename\."
-gdb_test "append binary memory" "Missing filename\."
-gdb_test "append binary value" "Missing filename\."
-
-if !$use_gdb_stub {
+gdb_test "append" "List of \"append\" subcommands:.*"
+gdb_test "append binary" "List of \"append binary\" subcommands:.*"
+gdb_test "append memory" "Missing filename\."
+gdb_test "append value" "Missing filename\."
+gdb_test "append binary memory" "Missing filename\."
+gdb_test "append binary value" "Missing filename\."
+
+if {!$use_gdb_stub} {
gdb_test_multiple "attach" "attach" {
-re "Argument required .(process-id|program) to attach.*$gdb_prompt $"\
{ pass "attach" }
@@ -59,7 +59,7 @@ if !$use_gdb_stub {
gdb_test $i "No default breakpoint address now." "break \"$i\" abbreviation"
}
-
+
gdb_test "backtrace" "No stack."
# ba and bac are no longer unique command prefixes. So these tests
@@ -148,21 +148,21 @@ gdb_test "down" "No stack.*"
#test down-silently
gdb_test "down-silently" "No stack."
# test dump
-gdb_test "dump" "List of \"dump\" subcommands:.*"
-gdb_test "dump binary" "List of \"dump binary\" subcommands:.*"
-gdb_test "dump ihex" "List of \"dump ihex\" subcommands:.*"
-gdb_test "dump memory" "Missing filename\."
-gdb_test "dump srec" "List of \"dump srec\" subcommands:.*"
-gdb_test "dump tekhex" "List of \"dump tekhex\" subcommands:.*"
-gdb_test "dump value" "Missing filename\."
-gdb_test "dump binary memory" "Missing filename\."
-gdb_test "dump binary value" "Missing filename\."
-gdb_test "dump ihex memory" "Missing filename\."
-gdb_test "dump ihex value" "Missing filename\."
-gdb_test "dump srec memory" "Missing filename\."
-gdb_test "dump srec value" "Missing filename\."
-gdb_test "dump tekhex memory" "Missing filename\."
-gdb_test "dump tekhex value" "Missing filename\."
+gdb_test "dump" "List of \"dump\" subcommands:.*"
+gdb_test "dump binary" "List of \"dump binary\" subcommands:.*"
+gdb_test "dump ihex" "List of \"dump ihex\" subcommands:.*"
+gdb_test "dump memory" "Missing filename\."
+gdb_test "dump srec" "List of \"dump srec\" subcommands:.*"
+gdb_test "dump tekhex" "List of \"dump tekhex\" subcommands:.*"
+gdb_test "dump value" "Missing filename\."
+gdb_test "dump binary memory" "Missing filename\."
+gdb_test "dump binary value" "Missing filename\."
+gdb_test "dump ihex memory" "Missing filename\."
+gdb_test "dump ihex value" "Missing filename\."
+gdb_test "dump srec memory" "Missing filename\."
+gdb_test "dump srec value" "Missing filename\."
+gdb_test "dump tekhex memory" "Missing filename\."
+gdb_test "dump tekhex value" "Missing filename\."
#test echo
gdb_test_no_output "echo" "echo"
#test enable breakpoints delete
@@ -253,10 +253,39 @@ gdb_test "h" "List of classes of commands:(\[^\r\n\]*\[\r\n\])+aliases -- User-d
gdb_test "help" "List of classes of commands:(\[^\r\n\]*\[\r\n\])+aliases -- User-defined aliases of other commands(\[^\r\n\]*\[\r\n\])+breakpoints -- Making program stop at certain points(\[^\r\n\]*\[\r\n\])+data -- Examining data(\[^\r\n\]*\[\r\n\])+files -- Specifying and examining files(\[^\r\n\]*\[\r\n\])+obscure -- Obscure features(\[^\r\n\]*\[\r\n\])+running -- Running the program(\[^\r\n\]*\[\r\n\])+stack -- Examining the stack(\[^\r\n\]*\[\r\n\])+status -- Status inquiries(\[^\r\n\]*\[\r\n\])+support -- Support facilities(\[^\r\n\]*\[\r\n\])+user-defined -- User-defined commands(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by a class name for a list of commands in that class.(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
#test handle
gdb_test "handle" "Argument required .signal to handle.*"
-#test info "i" abbreviation
-gdb_test "i" "List of \"info\" subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "info \"i\" abbreviation"
+
+proc test_info_command { command message } {
+ set saw_info_header 0
+ set saw_help_info 0
+ set saw_command_abbrev 0
+ gdb_test_multiple $command $message -lbl {
+ -re "\r\nList of \"info\" subcommands:" {
+ verbose "Info header displayed"
+ set saw_info_header 1
+ exp_continue
+ }
+ -re "Type \"help info\" followed by subcommand name for full documentation\\." {
+ verbose "Help info displayed"
+ set saw_help_info 1
+ exp_continue
+ }
+ -re "\r\nCommand name abbreviations are allowed if unambiguous\\." {
+ verbose "Command name abbreviations displayed"
+ set saw_command_abbrev 1
+ exp_continue
+ }
+ -re -wrap "" {
+ gdb_assert { $saw_info_header && $saw_help_info
+ && $saw_command_abbrev } $gdb_test_name
+ }
+ }
+}
+
+#test info "i" abbreviation
+test_info_command "i" "info \"i\" abbreviation"
#test info
-gdb_test "info" "List of \"info\" subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
+test_info_command "info" "info"
+
#test ignore
gdb_test "ignore" "Argument required .a breakpoint number.*"
#test info address
@@ -379,38 +408,52 @@ gdb_test "info registers" "The program has no registers now."
gdb_test "info s" "No stack." "info stack \"s\" abbreviation"
#test info stack
gdb_test "info stack" "No stack."
-#test info set
-# Test improved to check three parts:
-# 1) confirm
-# 2) prompt
-# 3) write
-# And only succeed if all three are matched.
-# This should fix an old problem on native solaris 2.8,
-# where this test fails due to this line:
+
+#test "info set" and "show" commands
+# The test needs to match the "prompt: ..." part to fix an old problem on native
+# Solaris 2.8, where this test fails due to this line:
# prompt: Gdb's prompt is "(gdb) ".^M
-set set_confirm_seen 0
-set set_prompt_seen 0
-gdb_test_multiple "info set" "info set" {
- -re "confirm: Whether to confirm potentially dangerous operations is o\[a-z\]*.(\[^\r\n\]*\[\r\n\])+history filename: The filename in which to record the command history is (\[^\r\n\]*\[\r\n\])+listsize: Number of source lines gdb will list by default is 10" {
- verbose "Confirm dislayed"
- set set_confirm_seen 1
- exp_continue
- }
- -re "Gdb's prompt is \"$gdb_prompt \"" {
- verbose "GDB prompt displayed"
- set set_prompt_seen 1
- exp_continue
- }
- -re "Writing into executable.*$gdb_prompt $" {
- verbose "write displayed"
- if { $set_prompt_seen && $set_confirm_seen } {
- pass "info set"
- } else {
- verbose "prompt $set_prompt_seen confirm $set_confirm_seen"
- fail "info set (incomplete output)"
+proc test_info_set_show { command } {
+ set set_confirm_seen 0
+ set set_history_filename_seen 0
+ set set_listsize_seen 0
+ set set_prompt_seen 0
+ set set_write_seen 0
+ gdb_test_multiple $command $command -lbl {
+ -re "\r\nconfirm: Whether to confirm potentially dangerous operations is o\[a-z\]+\\." {
+ verbose "Confirm displayed"
+ set set_confirm_seen 1
+ exp_continue
+ }
+ -re "\r\nhistory filename: The filename in which to record the command history is \[^\r\n\]+\\." {
+ verbose "History filename displayed"
+ set set_history_filename_seen 1
+ exp_continue
+ }
+ -re "\r\nlistsize: Number of source lines gdb will list by default is 10\\." {
+ verbose "Listsize displayed"
+ set set_listsize_seen 1
+ exp_continue
+ }
+ -re "\r\nprompt: Gdb's prompt is \"$::gdb_prompt \"" {
+ verbose "GDB prompt displayed"
+ set set_prompt_seen 1
+ exp_continue
+ }
+ -re "write: Writing into executable and core files is o\[a-z\]+\\." {
+ verbose "Write displayed"
+ set set_write_seen 1
+ exp_continue
+ }
+ -re -wrap "" {
+ gdb_assert { $set_confirm_seen && $set_history_filename_seen
+ && $set_listsize_seen && $set_prompt_seen
+ && $set_write_seen } $gdb_test_name
}
}
}
+test_info_set_show "info set"
+
gdb_test "info symbol" "Argument required .address.."
#test info source
gdb_test "info source" "No current source file..*"
@@ -484,7 +527,7 @@ gdb_test "ptype" "The history is empty."
gdb_test "pwd" "Working directory .*"
#test run "r" abbreviation
-if $use_gdb_stub {
+if {$use_gdb_stub} {
# Only extended-remote supports "run".
} else {
gdb_test_multiple "r" "run \"r\" abbreviation" {
@@ -506,7 +549,7 @@ if $use_gdb_stub {
}
#test run
-if $use_gdb_stub {
+if {$use_gdb_stub} {
# Only extended-remote supports "run".
} else {
gdb_test_multiple "run" "run" {
@@ -591,12 +634,41 @@ gdb_test "set history" "List of \"set history\" subcommands:(\[^\r\n\]*\[\r\n\])
gdb_test "set language" "Requires an argument. Valid arguments are auto, local, unknown, ada, asm, c, c.., d, fortran, go, minimal, modula-2, objective-c, opencl, pascal, rust."
#test set listsize
gdb_test "set listsize" "Argument required .integer to set it to.*"
+
+proc test_set_print { command message } {
+ set saw_info_header 0
+ set saw_help_info 0
+ set saw_command_abbrev 0
+ gdb_test_multiple $command $message -lbl {
+ -re "\r\nList of \"set print\" subcommands:" {
+ verbose "Info header displayed"
+ set saw_info_header 1
+ exp_continue
+ }
+ -re "Type \"help set print\" followed by subcommand name for full documentation\\." {
+ verbose "Help info displayed"
+ set saw_help_info 1
+ exp_continue
+ }
+ -re "\r\nCommand name abbreviations are allowed if unambiguous\\." {
+ verbose "Command name abbreviations displayed"
+ set saw_command_abbrev 1
+ exp_continue
+ }
+ -re -wrap "" {
+ gdb_assert { $saw_info_header && $saw_help_info
+ && $saw_command_abbrev } $gdb_test_name
+ }
+ }
+}
+
#test set print "p" abbreviation
-gdb_test "set p" "List of \"set print\" subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print \"p\" abbreviation"
+test_set_print "set p" "set print \"p\" abbreviation"
#test set print "pr" abbreviation
-gdb_test "set pr" "List of \"set print\" subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print \"pr\" abbreviation"
+test_set_print "set pr" "set print \"pr\" abbreviation"
#test set print
-gdb_test "set print" "List of \"set print\" subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
+test_set_print "set print" "set print"
+
#test set print address
gdb_test_no_output "set print address" "set print address"
#test set print array
@@ -687,7 +759,6 @@ set show_conv_list \
{$_probe_arg10 = <error: No frame selected>} \
{$_probe_arg11 = <error: No frame selected>} \
{$_cimag = <internal function _cimag>} \
- {$_colorsupport = "monochrome"} \
{$_creal = <internal function _creal>} \
{$_isvoid = <internal function _isvoid>} \
{$_shell = <internal function _shell>} \
@@ -695,12 +766,12 @@ set show_conv_list \
{$_gdb_maint_setting = <internal function _gdb_maint_setting>} \
{$_gdb_setting_str = <internal function _gdb_setting_str>} \
{$_gdb_setting = <internal function _gdb_setting>} \
- {$_gdb_major = 17} \
- {$_gdb_minor = 1} \
{$_shell_exitsignal = void} \
{$_shell_exitcode = 0} \
+ {$_linker_namespace_count = 0} \
+ {$_linker_namespace = <error: No registers.>}\
}
-if [allow_python_tests] {
+if {[allow_python_tests]} {
append show_conv_list \
{
{$_memeq = <internal function _memeq>} \
@@ -714,10 +785,52 @@ if [allow_python_tests] {
{$_any_caller_matches = <internal function _any_caller_matches>} \
}
}
-gdb_test_list_exact "show convenience" "show convenience" \
- "\[^\r\n\]+\[\r\n\]+" \
- "\[^\r\n\]+" \
- $show_conv_list
+
+set lines [gdb_get_lines_no_pass "show convenience"]
+set matches 0
+set all_found 1
+foreach s $show_conv_list {
+ if { ![regexp (^|\r\n)[string_to_regexp $s](\r\n|$) $lines] } {
+ verbose -log "didn't match: '$s'"
+ set all_found 0
+ break
+ }
+ incr matches
+}
+
+set re_var [string_to_regexp {$_colorsupport}]
+if { [is_remote host] } {
+ set re_val {[^\r\n]+}
+} else {
+ set re_val [string_to_regexp {"monochrome"}]
+}
+if { [regexp "$re_var = $re_val" $lines] } {
+ incr matches
+} else {
+ set all_found 0
+}
+
+set re_vars \
+ [list \
+ [string_to_regexp {$_gdb_major}] \
+ [string_to_regexp {$_gdb_minor}]]
+foreach re_var $re_vars {
+ if { [regexp "$re_var = $decimal" $lines] } {
+ incr matches
+ } else {
+ set all_found 0
+ }
+}
+
+if { [regexp [string_to_regexp {$_tlb = void}] $lines] } {
+ incr matches
+} else {
+ # Convenience variable _tlb is added only if support for windows targets
+ # is enabled. Don't complain if it's missing.
+}
+
+gdb_assert { $all_found && $matches == [count_newlines $lines] } \
+ "show convenience"
#test show directories
gdb_test "show directories" "Source directories searched: .cdir\[:;\].cwd"
@@ -739,12 +852,47 @@ gdb_test "show history" "history expansion: *History expansion on command input
gdb_test "show language" "The current source language is \"auto; currently c\"."
#test show listsize
gdb_test "show listsize" "Number of source lines gdb will list by default is 10."
+
+proc test_show_print { command } {
+ set saw_print_address 0
+ set saw_print_frame_args 0
+ set saw_print_symbol 0
+ set saw_print_vtbl 0
+ gdb_test_multiple $command $command -lbl {
+ -re "\r\nprint address: Printing of addresses is o\[a-z\]+\\." {
+ verbose "Print address displayed"
+ set saw_print_address 1
+ exp_continue
+ }
+ -re "\r\nprint frame-arguments: Printing of non-scalar frame arguments is \[^\r\n\]+\\." {
+ verbose "Print frame-arguments displayed"
+ set saw_print_frame_args 1
+ exp_continue
+ }
+ -re "\r\nprint symbol: Printing of symbols when printing pointers is o\[a-z\]+\\." {
+ verbose "Print symbol displayed"
+ set saw_print_symbol 1
+ exp_continue
+ }
+ -re "\r\nprint vtbl: Printing of C\\+\\+ virtual function tables is o\[a-z\]+\\." {
+ verbose "Print vtbl displayed"
+ set saw_print_vtbl 1
+ exp_continue
+ }
+ -re -wrap "" {
+ gdb_assert { $saw_print_address && $saw_print_frame_args
+ && $saw_print_symbol && $saw_print_vtbl } $gdb_test_name
+ }
+ }
+}
+
#test show print "p" abbreviation
-gdb_test "show p" ".*"
+test_show_print "show p"
#test show print "pr" abbreviation
-gdb_test "show pr" ".*"
+test_show_print "show pr"
#test show print
-gdb_test "show print" ".*"
+test_show_print "show print"
+
#test show paths
gdb_test "show paths" "Executable and object file path:.*"
#test show print address
@@ -790,30 +938,10 @@ gdb_test "show width" "Number of characters gdb thinks are in a line is.*"
#test show write
# This is only supported on targets which use exec.o.
gdb_test "show write" "Writing into executable and core files is o.*"
+
#test show
-set show_confirm_seen 0
-set show_prompt_seen 0
-gdb_test_multiple "show" "show" {
- -re "confirm: *Whether to confirm potentially dangerous operations is on.(\[^\r\n\]*\[\r\n\])+history filename: *The filename in which to record the command history is (\[^\r\n\]*\[\r\n\])+history save: *Saving of the history record on exit is on.(\[^\r\n\]*\[\r\n\])+history size: *The size of the command history is(\[^\r\n\]*\[\r\n\])+listsize: *Number of source lines gdb will list by default is 10(\[^\r\n]*\[\r\n\])+print elements: *Limit on string chars or array elements to print is 200." {
- verbose "Confirm displayed"
- set show_confirm_seen 1
- exp_continue
- }
- -re "Gdb's prompt is \"$gdb_prompt \"" {
- verbose "GDB prompt displayed"
- set show_prompt_seen 1
- exp_continue
- }
- -re "Writing into executable.*$gdb_prompt $" {
- verbose "write displayed"
- if { $show_prompt_seen && $show_confirm_seen } {
- pass "show"
- } else {
- verbose "prompt $show_prompt_seen confirm $show_confirm_seen"
- fail "show (incomplete output)"
- }
- }
-}
+test_info_set_show "show"
+
#history saving should stay disabled
gdb_test_no_output "set history save off" "set history save off"
#test stepi "si" abbreviation
diff --git a/gdb/testsuite/gdb.base/define-prefix.exp b/gdb/testsuite/gdb.base/define-prefix.exp
index 81d3a56..91f2211 100644
--- a/gdb/testsuite/gdb.base/define-prefix.exp
+++ b/gdb/testsuite/gdb.base/define-prefix.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/define.exp b/gdb/testsuite/gdb.base/define.exp
index 193eb7a..7dd6006 100644
--- a/gdb/testsuite/gdb.base/define.exp
+++ b/gdb/testsuite/gdb.base/define.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/del.c b/gdb/testsuite/gdb.base/del.c
index a567d94..c0ba6ac 100644
--- a/gdb/testsuite/gdb.base/del.c
+++ b/gdb/testsuite/gdb.base/del.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/del.exp b/gdb/testsuite/gdb.base/del.exp
index 58937de..441e677 100644
--- a/gdb/testsuite/gdb.base/del.exp
+++ b/gdb/testsuite/gdb.base/del.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/detach-sysroot-target.c b/gdb/testsuite/gdb.base/detach-sysroot-target.c
index b1ce99c..a21818d 100644
--- a/gdb/testsuite/gdb.base/detach-sysroot-target.c
+++ b/gdb/testsuite/gdb.base/detach-sysroot-target.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/detach-sysroot-target.exp b/gdb/testsuite/gdb.base/detach-sysroot-target.exp
index d4374fa..b6a9da1 100644
--- a/gdb/testsuite/gdb.base/detach-sysroot-target.exp
+++ b/gdb/testsuite/gdb.base/detach-sysroot-target.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
standard_testfile
-if {[prepare_for_testing "failed to prepare" ${binfile} ${srcfile}]} {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
return
}
@@ -48,7 +48,7 @@ gdb_test_multiple "show sysroot" "" {
}
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/detach-while-running.c b/gdb/testsuite/gdb.base/detach-while-running.c
index 9c038f4..5be97f4 100644
--- a/gdb/testsuite/gdb.base/detach-while-running.c
+++ b/gdb/testsuite/gdb.base/detach-while-running.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/detach-while-running.exp b/gdb/testsuite/gdb.base/detach-while-running.exp
index 4ce6c70..34c2adc 100644
--- a/gdb/testsuite/gdb.base/detach-while-running.exp
+++ b/gdb/testsuite/gdb.base/detach-while-running.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,7 +45,8 @@ proc test {} {
if {$is_remote} {
append ::GDBFLAGS " -ex \"maint set target-non-stop on\""
}
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
}
set test_spawn_id [spawn_wait_for_attach $binfile]
diff --git a/gdb/testsuite/gdb.base/detach.exp b/gdb/testsuite/gdb.base/detach.exp
index 99c5bf1..c8d4350 100644
--- a/gdb/testsuite/gdb.base/detach.exp
+++ b/gdb/testsuite/gdb.base/detach.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,8 @@ proc do_detach_tests {} {
gdb_test "detach" "Detaching from program: .*$escapedbinfile, .*" "detach, $pass"
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
global pass
set pass "one"
diff --git a/gdb/testsuite/gdb.base/dfp-exprs.exp b/gdb/testsuite/gdb.base/dfp-exprs.exp
index 411e4ed..0a20cad 100644
--- a/gdb/testsuite/gdb.base/dfp-exprs.exp
+++ b/gdb/testsuite/gdb.base/dfp-exprs.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2024 Free Software Foundation, Inc.
+# Copyright (C) 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dfp-test.c b/gdb/testsuite/gdb.base/dfp-test.c
index 85a2ef9..aeb1f6b 100644
--- a/gdb/testsuite/gdb.base/dfp-test.c
+++ b/gdb/testsuite/gdb.base/dfp-test.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dfp-test.exp b/gdb/testsuite/gdb.base/dfp-test.exp
index c758e00..11f75da 100644
--- a/gdb/testsuite/gdb.base/dfp-test.exp
+++ b/gdb/testsuite/gdb.base/dfp-test.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2024 Free Software Foundation, Inc.
+# Copyright (C) 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {quie
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.base/disabled-location.c b/gdb/testsuite/gdb.base/disabled-location.c
index 0f07fe0..b89014d 100644
--- a/gdb/testsuite/gdb.base/disabled-location.c
+++ b/gdb/testsuite/gdb.base/disabled-location.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/disabled-location.exp b/gdb/testsuite/gdb.base/disabled-location.exp
index c8979df..d2b16f6 100644
--- a/gdb/testsuite/gdb.base/disabled-location.exp
+++ b/gdb/testsuite/gdb.base/disabled-location.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/disasm-end-cu-1.c b/gdb/testsuite/gdb.base/disasm-end-cu-1.c
index 7b8de8b..20c5017 100644
--- a/gdb/testsuite/gdb.base/disasm-end-cu-1.c
+++ b/gdb/testsuite/gdb.base/disasm-end-cu-1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/disasm-end-cu-2.c b/gdb/testsuite/gdb.base/disasm-end-cu-2.c
index e637d84..5857a52 100644
--- a/gdb/testsuite/gdb.base/disasm-end-cu-2.c
+++ b/gdb/testsuite/gdb.base/disasm-end-cu-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/disasm-end-cu.exp b/gdb/testsuite/gdb.base/disasm-end-cu.exp
index 6570b4c..34f25be 100644
--- a/gdb/testsuite/gdb.base/disasm-end-cu.exp
+++ b/gdb/testsuite/gdb.base/disasm-end-cu.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" "disasm-end-cu" {disasm-end-cu-1.c
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/disasm-optim.S b/gdb/testsuite/gdb.base/disasm-optim.S
index caa39fe..b5202b0 100644
--- a/gdb/testsuite/gdb.base/disasm-optim.S
+++ b/gdb/testsuite/gdb.base/disasm-optim.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+ Copyright (C) 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/disasm-optim.c b/gdb/testsuite/gdb.base/disasm-optim.c
index 68a626f..f672d97 100644
--- a/gdb/testsuite/gdb.base/disasm-optim.c
+++ b/gdb/testsuite/gdb.base/disasm-optim.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+ Copyright (C) 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/disasm-optim.exp b/gdb/testsuite/gdb.base/disasm-optim.exp
index cded114..9b81a4c 100644
--- a/gdb/testsuite/gdb.base/disasm-optim.exp
+++ b/gdb/testsuite/gdb.base/disasm-optim.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" $testfile ${testfile}.S {nodebug}]
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/disasm-optim.h b/gdb/testsuite/gdb.base/disasm-optim.h
index 321aa38..6009e5e 100644
--- a/gdb/testsuite/gdb.base/disasm-optim.h
+++ b/gdb/testsuite/gdb.base/disasm-optim.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+ Copyright (C) 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/displaced-step-closure.c b/gdb/testsuite/gdb.base/displaced-step-closure.c
index 075b9ee..d45c14b 100644
--- a/gdb/testsuite/gdb.base/displaced-step-closure.c
+++ b/gdb/testsuite/gdb.base/displaced-step-closure.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/displaced-step-closure.exp b/gdb/testsuite/gdb.base/displaced-step-closure.exp
index 0929f29..bbdd207 100644
--- a/gdb/testsuite/gdb.base/displaced-step-closure.exp
+++ b/gdb/testsuite/gdb.base/displaced-step-closure.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/display.exp b/gdb/testsuite/gdb.base/display.exp
index 9964c23..d635982 100644
--- a/gdb/testsuite/gdb.base/display.exp
+++ b/gdb/testsuite/gdb.base/display.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
# Preserve the old timeout, and set a new one that should be
# sufficient to avoid timing out during this test.
set oldtimeout $timeout
-set timeout [expr "$timeout + 60"]
+set timeout [expr {$timeout + 60}]
verbose "Timeout is now $timeout seconds" 2
# use this to debug:
@@ -43,7 +43,7 @@ verbose "Timeout is now $timeout seconds" 2
# Some coverage stuff
#
-if !$use_gdb_stub {
+if {!$use_gdb_stub} {
gdb_test "kill" ".*The program is not being run.*"
gdb_test "detach" ".*"
gdb_test "run" ".*"
@@ -52,7 +52,8 @@ if !$use_gdb_stub {
gdb_test "kill" ".*" "kill again"
gdb_test "detach" ".*" "detach again"
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
}
# Ok, on to real life
diff --git a/gdb/testsuite/gdb.base/dlmopen-lib-dep.c b/gdb/testsuite/gdb.base/dlmopen-lib-dep.c
index 1645f55..f981bea 100644
--- a/gdb/testsuite/gdb.base/dlmopen-lib-dep.c
+++ b/gdb/testsuite/gdb.base/dlmopen-lib-dep.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dlmopen-lib.c b/gdb/testsuite/gdb.base/dlmopen-lib.c
index 4ce9280..36ccbf02 100644
--- a/gdb/testsuite/gdb.base/dlmopen-lib.c
+++ b/gdb/testsuite/gdb.base/dlmopen-lib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dlmopen-main.c b/gdb/testsuite/gdb.base/dlmopen-main.c
index 196d13a..cf82a69 100644
--- a/gdb/testsuite/gdb.base/dlmopen-main.c
+++ b/gdb/testsuite/gdb.base/dlmopen-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dlmopen-ns-ids-lib.c b/gdb/testsuite/gdb.base/dlmopen-ns-ids-lib.c
new file mode 100644
index 0000000..86cbb0f
--- /dev/null
+++ b/gdb/testsuite/gdb.base/dlmopen-ns-ids-lib.c
@@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+int gdb_dlmopen_glob = 0;
+
+__attribute__((visibility ("default")))
+int
+inc (int n)
+{
+ int amount = gdb_dlmopen_glob;
+ return n + amount; /* bp.inc. */
+}
diff --git a/gdb/testsuite/gdb.base/dlmopen-ns-ids-main.c b/gdb/testsuite/gdb.base/dlmopen-ns-ids-main.c
new file mode 100644
index 0000000..c7c038a
--- /dev/null
+++ b/gdb/testsuite/gdb.base/dlmopen-ns-ids-main.c
@@ -0,0 +1,60 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#define _GNU_SOURCE
+#include <dlfcn.h>
+#include <stddef.h>
+#include <assert.h>
+#include <unistd.h>
+#include <stdio.h>
+
+int
+main (void)
+{
+ void *handle[4];
+ int (*fun) (int);
+ Lmid_t lmid;
+ int dl;
+
+ handle[0] = dlmopen (LM_ID_NEWLM, DSO_NAME, RTLD_LAZY | RTLD_LOCAL);
+ assert (handle[0] != NULL);
+
+ handle[1] = dlmopen (LM_ID_NEWLM, DSO_NAME, RTLD_LAZY | RTLD_LOCAL);
+ assert (handle[1] != NULL);
+
+ handle[2] = dlmopen (LM_ID_NEWLM, DSO_NAME, RTLD_LAZY | RTLD_LOCAL);
+ assert (handle[2] != NULL);
+
+ for (dl = 2; dl >= 0; dl--)
+ {
+ fun = dlsym (handle[dl], "inc");
+ fun (dl);
+ }
+
+ dlclose (handle[0]); /* TAG: first dlclose */
+ dlclose (handle[1]); /* TAG: second dlclose */
+ dlclose (handle[2]); /* TAG: third dlclose */
+
+ handle[3] = dlmopen (LM_ID_NEWLM, DSO_NAME, RTLD_LAZY | RTLD_LOCAL);
+ dlinfo (handle[3], RTLD_DI_LMID, &lmid);
+
+ dlclose (handle[3]); /* TAG: fourth dlclose */
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/dlmopen-ns-ids.exp b/gdb/testsuite/gdb.base/dlmopen-ns-ids.exp
new file mode 100644
index 0000000..f3bdfb0
--- /dev/null
+++ b/gdb/testsuite/gdb.base/dlmopen-ns-ids.exp
@@ -0,0 +1,320 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+#
+# Test several things related to handling linker namespaces:
+# * That the user-facing namespace ID is consistent;
+
+require allow_dlmopen_tests
+
+standard_testfile -main.c -lib.c
+
+set srcfile_lib $srcfile2
+set so_name dlmopen-lib.so
+set binfile_lib [standard_output_file $so_name]
+
+if { [build_executable "build shlib" $binfile_lib $srcfile_lib \
+ [list debug shlib]] == -1 } {
+ return
+}
+
+if { [build_executable "failed to build" $testfile $srcfile \
+ [list additional_flags=-DDSO_NAME=\"$binfile_lib\" \
+ shlib_load debug]] } {
+ return
+}
+
+# Return a list of shared libraries extract from the "info sharedlibrary"
+# command. Each item in the list is itself a list with the following items:
+#
+# - "from" address
+# - "to" address
+# - namespace ID
+# - name (file path)
+
+proc get_info_shared {} {
+ set from_re "($::hex)\\s+"
+ set to_re "($::hex)\\s+"
+ set ns_re "(?:($::decimal)\\s+)?"
+ set syms_read_re "(Yes( \\(\\*\\))?|No)\\s+"
+ set name_re "(\[^\r\n\]+)"
+ set libs {}
+
+ gdb_test_multiple "info sharedlibrary" "" {
+ -re {From\s+To\s+(Linker NS\s+)?Syms Read\s+Shared Object Library\r\n} {
+ exp_continue
+ }
+
+ -re "^${from_re}${to_re}${ns_re}${syms_read_re}${name_re}\r\n" {
+ set from $expect_out(1,string)
+ set to $expect_out(2,string)
+ set ns $expect_out(3,string)
+ set name $expect_out(4,string)
+
+ lappend libs [list $from $to $ns $name]
+ exp_continue
+ }
+
+ -re {^\(\*\): Shared library is missing debugging information\.\r\n} {
+ exp_continue
+ }
+
+ -re "^$::gdb_prompt " {
+ pass $gdb_test_name
+ }
+ }
+
+ return $libs
+}
+
+# Verify that "info sharedlibrary" does not contain duplicate entries.
+
+proc check_no_duplicates {} {
+ with_test_prefix "check no duplicates" {
+ set libs [get_info_shared]
+ array set seen {}
+ set seen_duplicate 0
+
+ foreach lib $libs {
+ if {[info exists seen($lib)]} {
+ verbose -log "already seen: $lib"
+ set seen_duplicate 1
+ }
+
+ set seen($lib) 1
+ }
+
+ gdb_assert {!$seen_duplicate} "no duplicates"
+ }
+}
+
+# Run the command "info sharedlibrary" and get the first namespace
+# for the so
+proc get_first_so_ns {} {
+ set ns -1
+ set lib_regexp [string_to_regexp ${::binfile_lib}]
+ gdb_test_multiple "info sharedlibrary $::so_name" "get SO namespace" -lbl {
+ -re "\r\nFrom\\s+To\\s+\(Linker NS\\s+\)?Syms\\s+Read\\s+Shared Object Library(?=\r\n)" {
+ exp_continue
+ }
+ -re "\r\n$::hex\\s+$::hex\\s+($::decimal)\\s+\[^\r\n]+${lib_regexp}(?=\r\n)" {
+ if {$ns == -1} {
+ set ns $expect_out(1,string)
+ }
+ exp_continue
+ }
+ -re -wrap "" {
+ }
+ }
+ return $ns
+}
+
+# Run the tests relating to the command "info sharedlibrary", to
+# verify that the namespace ID is consistent.
+proc test_info_shared {} {
+ clean_restart
+ gdb_load $::binfile
+
+ if { ![runto_main] } {
+ return
+ }
+
+ # First test that we don't print a namespace column at the start.
+ gdb_test "info sharedlibrary" \
+ "From\\s+To\\s+Syms\\s+Read\\s+Shared Object Library.*" \
+ "before loading anything"
+
+ gdb_breakpoint [gdb_get_line_number "TAG: first dlclose"]
+ gdb_continue_to_breakpoint "TAG: first dlclose"
+
+ # Next, test that we *do* print a namespace column after loading SOs.
+ gdb_test "info sharedlibrary" \
+ "From\\s+To\\s+Linker NS\\s+Syms\\s+Read\\s+Shared Object Library.*" \
+ "after loading everything"
+
+ check_no_duplicates
+
+ gdb_assert {[get_first_so_ns] == 1} "before closing any library"
+
+ gdb_test "next" ".*second dlclose.*" "close first library"
+ gdb_assert {[get_first_so_ns] == 2} "after closing one library"
+
+ gdb_test "next" ".*third dlclose.*" "close second library"
+ gdb_assert {[get_first_so_ns] == 3} "before closing two libraries"
+
+ gdb_breakpoint [gdb_get_line_number "TAG: fourth dlclose"]
+ gdb_continue_to_breakpoint "TAG: fourth dlclose"
+ # As of writing this test, glibc's LMID is just an index on an array of
+ # namespaces. After closing a namespace, requesting a new one will
+ # return the index of the lowest-closed namespace, so this will likely
+ # be namespace 1, and because of glibc's reuse of the r_debug object,
+ # GDB should be able to assign the same number.
+ gdb_assert {[get_first_so_ns] == [get_integer_valueof "lmid" "-1"]} \
+ "reopen a namespace"
+
+ gdb_test "next" ".*return 0.*" "final namespace inactive"
+ gdb_test "info sharedlibrary" \
+ "From\\s+To\\s+Syms\\s+Read\\s+Shared Object Library.*" \
+ "after unloading everything"
+}
+
+# Run all tests related to the linkage namespaces convenience
+# variables, _active_namespaces and _current_namespaces.
+# Also tests that the namespace ID is only printed at the correct
+# times.
+proc_with_prefix test_conv_vars {} {
+ clean_restart
+ gdb_load $::binfile
+
+ gdb_test "print \$_linker_namespace_count" "0" \
+ "0 namespace before starting inferior"
+ gdb_test "print \$_linker_namespace" "No registers." \
+ "No current namespace before starting inferior"
+
+ if { ![runto_main] } {
+ return
+ }
+
+ gdb_test "print \$_linker_namespace_count" "1" \
+ "Before activating namespaces"
+ gdb_test "print \$_linker_namespace" ".* = 0" \
+ "Still in the default namespace"
+
+ gdb_breakpoint "inc" allow-pending
+ gdb_breakpoint [gdb_get_line_number "TAG: first dlclose"]
+
+ foreach_with_prefix dl {3 2 1} {
+ gdb_continue_to_breakpoint "inc"
+
+ gdb_test "print \$_linker_namespace" ".* = $dl" \
+ "Verify we're in namespace $dl"
+ }
+
+ # Check that we display the namespace of the selected
+ # frame, not the lowermost one.
+ gdb_test "up" "\#1.*in main.*"
+ gdb_test "print \$_linker_namespace" ".* = 0" \
+ "print namespace of selected frame"
+
+ gdb_continue_to_breakpoint "first dlclose"
+ gdb_test "print \$_linker_namespace_count" "4" "all SOs loaded"
+
+ gdb_test "next" ".*second dlclose.*" "close one SO"
+ gdb_test "print \$_linker_namespace_count" "3" "one SOs unloaded"
+ gdb_test "next" ".*third dlclose.*" "close another SO"
+ gdb_test "print \$_linker_namespace_count" "2" "two SOs unloaded"
+
+ # Restarting GDB so that we can test setting a breakpoint
+ # using the convenience variable, while a proper bp syntax
+ # isn't implemented for namespaces
+ clean_restart
+ gdb_load $::binfile
+ if {![runto_main]} {
+ return
+ }
+
+ # We need to load one SO because you can't have confitional
+ # breakpoints and pending breakpoints at the same time with
+ # gdb_breakpoint.
+ gdb_test "next" ".*assert.*" "load the first SO"
+ gdb_breakpoint "inc if \$_linker_namespace == 2"
+ gdb_continue_to_breakpoint "inc"
+ gdb_continue_to_end "" continue 1
+}
+
+# Run several tests relating to the command "info namespaces".
+proc test_info_linker_namespaces {} {
+ clean_restart
+ gdb_load $::binfile
+
+ # Check that "info linker-namespaces" while the inferior is not running
+ # doesn't crash.
+ gdb_test "info linker-namespaces" \
+ "Current inferior does not support linker namespaces\\. Use \"info sharedlibrary\" instead\\." \
+ "info linker-namespaces before running"
+
+ if { ![runto_main] } {
+ return
+ }
+
+ with_test_prefix "info linker-namespaces" {
+ gdb_breakpoint [gdb_get_line_number "TAG: first dlclose"]
+ gdb_continue_to_breakpoint "TAG: first dlclose"
+ }
+
+ # First, test printing a single namespace, and ensure all of
+ # them are correct, using both syntaxes.
+ set n_libraries 999
+
+ gdb_test_multiple "info linker-namespaces \[\[0\]\]" "print namespace 0" {
+ -re -wrap "($::decimal) librar(?:y|ies) loaded in linker namespace 0:.*" {
+ set n_libraries $expect_out(1,string)
+ }
+ }
+
+ # Some systems may add libc and libm to every loaded namespace,
+ # others may load only one or neither, because the SO doesn't
+ # actually use either library. The best we can do is check if
+ # we found the dynamic linker, and up to 2 more libraries.
+ gdb_assert {$n_libraries <= 3} "the correct number of libraries was reported"
+
+ set binfile_lib_re [string_to_regexp $::binfile_lib]
+
+ foreach_with_prefix ns {1 2 3} {
+ set found_test_so false
+ set n_libraries 999
+
+ gdb_test_multiple "info linker-namespaces $ns" "print namespace $ns" {
+ -re ".*($::decimal) librar(?:y|ies) loaded in linker namespace $ns:\r\n" {
+ set n_libraries $expect_out(1,string)
+ exp_continue
+ }
+
+ -re -wrap "${binfile_lib_re}.*" {
+ set found_test_so true
+ }
+ }
+
+ # Some systems may add libc and libm to every loaded namespace,
+ # others may load only one or neither, because the SO doesn't
+ # actually use either library. The best we can do is check if
+ # we found the dynamic linker, the test SO, and maybe up to 2
+ # more libraries.
+ gdb_assert {$n_libraries <= 4} "the correct number of libraries was reported"
+ gdb_assert {$found_test_so} "this testfile's SO was reported"
+ }
+
+ # These patterns are simpler, and purposefully glob multiple lines.
+ # The point is to ensure that we find and display all the namespaces,
+ # without worrying about the libraries printed, since that was tested
+ # above.
+ gdb_test "info linker-namespaces" \
+ [multi_line "There are 4 linker namespaces loaded\\." \
+ "" \
+ "$::decimal librar(y|ies) loaded in linker namespace 0:" \
+ ".*" \
+ "$::decimal librar(y|ies) loaded in linker namespace 1:" \
+ ".*" \
+ "$::decimal librar(y|ies) loaded in linker namespace 2:" \
+ ".*" \
+ "$::decimal librar(y|ies) loaded in linker namespace 3:" \
+ ".*" ] "print namespaces with no argument"
+}
+
+test_info_shared
+test_conv_vars
+test_info_linker_namespaces
diff --git a/gdb/testsuite/gdb.base/dlmopen.exp b/gdb/testsuite/gdb.base/dlmopen.exp
index a8e3b08..f8c4f6c 100644
--- a/gdb/testsuite/gdb.base/dlmopen.exp
+++ b/gdb/testsuite/gdb.base/dlmopen.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -95,9 +95,19 @@ if { $dyln_name eq "" } {
return
}
+# If the dynamic linker path contains a symlink, some instances show the real
+# path instead of the original path. Accept both.
+lassign [remote_exec target realpath "$dyln_name"] realpath_ret dyln_realpath_name
+
+if { $realpath_ret == 0 } {
+ set dyln_realpath_name [string trim $dyln_realpath_name]
+} else {
+ set dyln_realpath_name "not-a-valid-path"
+}
+
# Return true if FILENAME is the dynamic linker. Otherwise return false.
proc is_dyln { filename } {
- return [expr {$filename eq $::dyln_name}]
+ return [expr {$filename eq $::dyln_name || $filename eq $::dyln_realpath_name}]
}
# Check that 'info shared' show NUM occurrences of DSO.
@@ -106,9 +116,9 @@ proc check_dso_count { dso num } {
set count 0
gdb_test_multiple "info shared" "info shared" {
- -re "$hex $hex Yes \[^\r\n\]*$dso\r\n" {
+ -re "$hex $hex \($::decimal\\s+\)\?Yes \[^\r\n\]*$dso\r\n" {
# use longer form so debug remote does not interfere
- set count [expr $count + 1]
+ set count [expr {$count + 1}]
exp_continue
}
-re "$gdb_prompt " {
@@ -173,7 +183,8 @@ proc test_dlmopen {} {
# Setup for calling 'test_dlmopen', this is the version of the test
# that doesn't use 'attach'.
proc test_dlmopen_no_attach {} {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
if { ![runto_main] } {
return
@@ -198,7 +209,8 @@ proc test_dlmopen_with_attach {} {
return
}
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
# Start the test program.
set test_spawn_id [spawn_wait_for_attach $::binfile]
@@ -233,12 +245,12 @@ proc get_dyld_info {} {
set dyld_count 0
set dyld_start_addr ""
gdb_test_multiple "info sharedlibrary" "" {
- -re "From\\s+To\\s+Syms\\s+Read\\s+Shared Object Library\r\n" {
+ -re "From\\s+To\\s+\(Linker NS\\s+\)?Syms\\s+Read\\s+Shared Object Library\r\n" {
exp_continue
}
- -re "^($::hex)\\s+$::hex\\s+\[^/\]+(/\[^\r\n\]+)\r\n" {
+ -re "^($::hex)\\s+$::hex\\s+\(\#$::decimal\\s+\)?\[^/\]+(/\[^\r\n\]+)\r\n" {
set addr $expect_out(1,string)
- set lib $expect_out(2,string)
+ set lib $expect_out(3,string)
if { [is_dyln $lib] } {
# This looks like it might be the dynamic linker.
@@ -288,7 +300,8 @@ proc_with_prefix test_solib_unmap_events { } {
return
}
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
if { ![runto_main] } {
return
@@ -358,15 +371,19 @@ proc_with_prefix test_solib_unmap_events { } {
# dynamic linker as pending when some instances of the library were
# unloaded, despite there really only being one copy of the dynamic
# linker actually loaded into the inferior's address space.
- gdb_test_multiple "info breakpoints $bpnum" "check b/p status" {
- -re -wrap "$bpnum\\s+breakpoint\\s+keep\\s+y\\s+<PENDING>\\s+\\*$::hex\\s*\r\n\\s+stop only if \\(0\\)" {
- fail $gdb_test_name
- }
-
- -re -wrap "$bpnum\\s+breakpoint\\s+keep\\s+y\\s+$::hex\\s*\[^\r\n\]+\r\n\\s+stop only if \\(0\\)" {
- pass $gdb_test_name
- }
- }
+ set hs {[^\r\n]}
+ set re_pass \
+ [multi_line \
+ "" \
+ [join \
+ [list \
+ "$bpnum" "breakpoint" "keep" "y" "$::hex$hs+"] \
+ {\s+}] \
+ [string cat \
+ {\s+} \
+ [string_to_regexp "stop only if (0)"] \
+ ([string_to_regexp " (target evals)"])?]]
+ gdb_test "info breakpoints $bpnum" $re_pass "check b/p status"
# With all the dlclose calls now complete, we should be back to a
# single copy of the dynamic linker.
@@ -379,7 +396,8 @@ proc_with_prefix test_solib_unmap_events { } {
# Check that we can 'next' over the dlclose calls without GDB giving any
# warnings or errors.
proc_with_prefix test_next_over_dlclose {} {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
if { ![runto_main] } {
return
diff --git a/gdb/testsuite/gdb.base/dmsym.c b/gdb/testsuite/gdb.base/dmsym.c
index ad92ed2..6b13ed2 100644
--- a/gdb/testsuite/gdb.base/dmsym.c
+++ b/gdb/testsuite/gdb.base/dmsym.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dmsym.exp b/gdb/testsuite/gdb.base/dmsym.exp
index a806845..3506ca7 100644
--- a/gdb/testsuite/gdb.base/dmsym.exp
+++ b/gdb/testsuite/gdb.base/dmsym.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dmsym_main.c b/gdb/testsuite/gdb.base/dmsym_main.c
index 97ee31b..3423599 100644
--- a/gdb/testsuite/gdb.base/dmsym_main.c
+++ b/gdb/testsuite/gdb.base/dmsym_main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/document.exp b/gdb/testsuite/gdb.base/document.exp
index 8a5e7d0..1d7b9b2 100644
--- a/gdb/testsuite/gdb.base/document.exp
+++ b/gdb/testsuite/gdb.base/document.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dprintf-bp-same-addr.c b/gdb/testsuite/gdb.base/dprintf-bp-same-addr.c
index bbd8a57..be48418 100644
--- a/gdb/testsuite/gdb.base/dprintf-bp-same-addr.c
+++ b/gdb/testsuite/gdb.base/dprintf-bp-same-addr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp b/gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp
index b2c9557..5d8ffa3 100644
--- a/gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp
+++ b/gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -17,8 +17,8 @@
standard_testfile
-if [build_executable "failed to prepare" \
- ${testfile} ${srcfile} {debug}] {
+if {[build_executable "failed to prepare" \
+ ${testfile} ${srcfile} {debug}]} {
return -1
}
@@ -28,9 +28,10 @@ proc test { style } {
global gdb_prompt binfile dp_location
with_test_prefix "$style" {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/dprintf-detach.c b/gdb/testsuite/gdb.base/dprintf-detach.c
index 97ea4ed..15481c2 100644
--- a/gdb/testsuite/gdb.base/dprintf-detach.c
+++ b/gdb/testsuite/gdb.base/dprintf-detach.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dprintf-detach.exp b/gdb/testsuite/gdb.base/dprintf-detach.exp
index b4184d6..573aa0a 100644
--- a/gdb/testsuite/gdb.base/dprintf-detach.exp
+++ b/gdb/testsuite/gdb.base/dprintf-detach.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,8 +26,8 @@ require can_spawn_for_attach
standard_testfile
set escapedbinfile [string_to_regexp ${binfile}]
-if [build_executable "failed to prepare for dprintf-detach" \
- ${testfile} ${srcfile} {debug}] {
+if {[build_executable "failed to prepare for dprintf-detach" \
+ ${testfile} ${srcfile} {debug}]} {
return -1
}
@@ -37,13 +37,14 @@ proc dprintf_detach_test { breakpoint_always_inserted dprintf_style disconnected
with_test_prefix "$test_prefix" {
# Start with a clean gdb
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
gdb_test_no_output "set breakpoint always-inserted ${breakpoint_always_inserted}"
gdb_test_no_output "set dprintf-style ${dprintf_style}"
gdb_test_no_output "set disconnected-dprintf ${disconnected_dprintf}"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -68,7 +69,8 @@ proc dprintf_detach_test { breakpoint_always_inserted dprintf_style disconnected
gdb_exit
# Check that the process still exists by attaching a new gdb to it.
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
set test "re-attach to inferior"
set is_gdbserver [target_is_gdbserver]
diff --git a/gdb/testsuite/gdb.base/dprintf-execution-x-script.c b/gdb/testsuite/gdb.base/dprintf-execution-x-script.c
index f8ad58f..610e354 100644
--- a/gdb/testsuite/gdb.base/dprintf-execution-x-script.c
+++ b/gdb/testsuite/gdb.base/dprintf-execution-x-script.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dprintf-execution-x-script.exp b/gdb/testsuite/gdb.base/dprintf-execution-x-script.exp
index 12de3ae..65de2d5 100644
--- a/gdb/testsuite/gdb.base/dprintf-execution-x-script.exp
+++ b/gdb/testsuite/gdb.base/dprintf-execution-x-script.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -93,7 +93,8 @@ do_test "" $test
# Restart GDB and 'source' the script; this will (still) run the program
# due to the 'run' command in the script.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
do_test "source $x_file" "load and run script using source command"
# This should leave us at the gdb prompt; Run program again using
diff --git a/gdb/testsuite/gdb.base/dprintf-execution-x-script.gdb b/gdb/testsuite/gdb.base/dprintf-execution-x-script.gdb
index 433c0ca..cf6ed0e 100644
--- a/gdb/testsuite/gdb.base/dprintf-execution-x-script.gdb
+++ b/gdb/testsuite/gdb.base/dprintf-execution-x-script.gdb
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dprintf-next.c b/gdb/testsuite/gdb.base/dprintf-next.c
index ffcdd73..74f6c42 100644
--- a/gdb/testsuite/gdb.base/dprintf-next.c
+++ b/gdb/testsuite/gdb.base/dprintf-next.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dprintf-next.exp b/gdb/testsuite/gdb.base/dprintf-next.exp
index b276394..d8ba03d 100644
--- a/gdb/testsuite/gdb.base/dprintf-next.exp
+++ b/gdb/testsuite/gdb.base/dprintf-next.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -19,12 +19,12 @@ set expfile $testfile.exp
set dp_location [gdb_get_line_number "Set dprintf here"]
-if [prepare_for_testing "failed to prepare for dprintf with next" \
- ${testfile} ${srcfile} {debug}] {
+if {[prepare_for_testing "failed to prepare for dprintf with next" \
+ ${testfile} ${srcfile} {debug}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/dprintf-non-stop.c b/gdb/testsuite/gdb.base/dprintf-non-stop.c
index e804977..58c785c 100644
--- a/gdb/testsuite/gdb.base/dprintf-non-stop.c
+++ b/gdb/testsuite/gdb.base/dprintf-non-stop.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dprintf-non-stop.exp b/gdb/testsuite/gdb.base/dprintf-non-stop.exp
index 7c6365a..538f703 100644
--- a/gdb/testsuite/gdb.base/dprintf-non-stop.exp
+++ b/gdb/testsuite/gdb.base/dprintf-non-stop.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,8 +16,8 @@
standard_testfile
set executable ${testfile}
-if [build_executable "failed to prepare for dprintf with non-stop" \
- ${testfile} ${srcfile} {debug}] {
+if {[build_executable "failed to prepare for dprintf with non-stop" \
+ ${testfile} ${srcfile} {debug}]} {
return -1
}
@@ -26,7 +26,7 @@ save_vars { GDBFLAGS } {
clean_restart ${executable}
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/dprintf-pending.c b/gdb/testsuite/gdb.base/dprintf-pending.c
index e246e88..2180dd2 100644
--- a/gdb/testsuite/gdb.base/dprintf-pending.c
+++ b/gdb/testsuite/gdb.base/dprintf-pending.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dprintf-pending.exp b/gdb/testsuite/gdb.base/dprintf-pending.exp
index 528dd10..f28e969 100644
--- a/gdb/testsuite/gdb.base/dprintf-pending.exp
+++ b/gdb/testsuite/gdb.base/dprintf-pending.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -60,7 +60,8 @@ with_test_prefix "without symbols" {
gdb_test "" ".*x=3.*x=4.*x=3.*" "run to resolved dprintf"
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_load_shlib $lib_sl
#
diff --git a/gdb/testsuite/gdb.base/dprintf-pendshr.c b/gdb/testsuite/gdb.base/dprintf-pendshr.c
index 6fcbc03..89797c2 100644
--- a/gdb/testsuite/gdb.base/dprintf-pendshr.c
+++ b/gdb/testsuite/gdb.base/dprintf-pendshr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dprintf.c b/gdb/testsuite/gdb.base/dprintf.c
index eebbfb3..f6d1e3d 100644
--- a/gdb/testsuite/gdb.base/dprintf.c
+++ b/gdb/testsuite/gdb.base/dprintf.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dprintf.exp b/gdb/testsuite/gdb.base/dprintf.exp
index 649126f..6fb2085 100644
--- a/gdb/testsuite/gdb.base/dprintf.exp
+++ b/gdb/testsuite/gdb.base/dprintf.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile $flags] } {
set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
set dp_location1 [gdb_get_line_number "set dprintf 1 here"]
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -74,9 +74,10 @@ proc restart {} {
global binfile
global bp_location1 dp_location1
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -141,7 +142,7 @@ proc test_call {} {
# The "call" style depends on having I/O functions available.
-if ![target_info exists gdb,noinferiorio] {
+if {![target_info exists gdb,noinferiorio]} {
with_test_prefix "call" {
test_call
}
@@ -170,7 +171,7 @@ proc test_agent {} {
}
}
- if !$target_can_dprintf {
+ if {!$target_can_dprintf} {
return
}
@@ -190,7 +191,7 @@ proc test_agent {} {
}
}
- if $target_can_dprintf {
+ if {$target_can_dprintf} {
gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "2nd dprintf"
gdb_test_sequence "info breakpoints" "dprintf info" {
@@ -217,7 +218,7 @@ gdb_test "set dprintf-style foobar" "Undefined item: \"foobar\"." \
# Test that force-disabling the BreakpointCommands RSP feature works
# as expected. dprintf relies on support for target-side breakpoint
# commands --- use it as proxy.
-if [gdb_protocol_is_remote] {
+if {[gdb_protocol_is_remote]} {
gdb_test \
"set remote breakpoint-commands-packet off" \
"Support for the 'BreakpointCommands' packet on the current remote target is set to \"off\"."
diff --git a/gdb/testsuite/gdb.base/dso2dso-dso1.c b/gdb/testsuite/gdb.base/dso2dso-dso1.c
index 8b1619d..c51d196 100644
--- a/gdb/testsuite/gdb.base/dso2dso-dso1.c
+++ b/gdb/testsuite/gdb.base/dso2dso-dso1.c
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/dso2dso-dso1.h b/gdb/testsuite/gdb.base/dso2dso-dso1.h
index 74920834..4a4144c 100644
--- a/gdb/testsuite/gdb.base/dso2dso-dso1.h
+++ b/gdb/testsuite/gdb.base/dso2dso-dso1.h
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/dso2dso-dso2.c b/gdb/testsuite/gdb.base/dso2dso-dso2.c
index 5dc6591..1b30c5c 100644
--- a/gdb/testsuite/gdb.base/dso2dso-dso2.c
+++ b/gdb/testsuite/gdb.base/dso2dso-dso2.c
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/dso2dso-dso2.h b/gdb/testsuite/gdb.base/dso2dso-dso2.h
index 394681e..d4b5744 100644
--- a/gdb/testsuite/gdb.base/dso2dso-dso2.h
+++ b/gdb/testsuite/gdb.base/dso2dso-dso2.h
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/dso2dso.c b/gdb/testsuite/gdb.base/dso2dso.c
index d4557c43..9b39bb7 100644
--- a/gdb/testsuite/gdb.base/dso2dso.c
+++ b/gdb/testsuite/gdb.base/dso2dso.c
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/dso2dso.exp b/gdb/testsuite/gdb.base/dso2dso.exp
index 9ca1bd0..3b00f6d 100644
--- a/gdb/testsuite/gdb.base/dso2dso.exp
+++ b/gdb/testsuite/gdb.base/dso2dso.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -54,7 +54,8 @@ if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable \
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
gdb_load_shlib $binfile_libdso2
gdb_load_shlib $binfile_libdso1
diff --git a/gdb/testsuite/gdb.base/dtrace-probe.c b/gdb/testsuite/gdb.base/dtrace-probe.c
index 6920389..29fafbc 100644
--- a/gdb/testsuite/gdb.base/dtrace-probe.c
+++ b/gdb/testsuite/gdb.base/dtrace-probe.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dtrace-probe.d b/gdb/testsuite/gdb.base/dtrace-probe.d
index 3cda1a2..a8784de 100644
--- a/gdb/testsuite/gdb.base/dtrace-probe.d
+++ b/gdb/testsuite/gdb.base/dtrace-probe.d
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dtrace-probe.exp b/gdb/testsuite/gdb.base/dtrace-probe.exp
index a8c38f9..a91e31f 100644
--- a/gdb/testsuite/gdb.base/dtrace-probe.exp
+++ b/gdb/testsuite/gdb.base/dtrace-probe.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,15 +21,16 @@ proc dtrace_test {} {
global testfile hex srcfile binfile
standard_testfile
-
+
if {[dtrace_build_usdt_test_program] == -1} {
untested "failed to compile"
return -1
}
- clean_restart ${binfile}
-
- if ![runto_main] {
+ clean_restart
+ gdb_load $binfile
+
+ if {![runto_main]} {
return -1
}
@@ -63,14 +64,14 @@ proc dtrace_test {} {
# Since test:progress-counter is disabled we can run to the second
# instance of the test:two-locations probe.
- runto "-probe-dtrace test:two-locations"]
- runto "-probe-dtrace test:two-locations"]
+ runto "-probe-dtrace test:two-locations"
+ runto "-probe-dtrace test:two-locations"
# Go back to the breakpoint on main() and enable the
# test:progress-counter probe. Set a breakpoint on it and see
# that it gets reached.
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/dump.c b/gdb/testsuite/gdb.base/dump.c
index bdcafbf..14b66b1 100644
--- a/gdb/testsuite/gdb.base/dump.c
+++ b/gdb/testsuite/gdb.base/dump.c
@@ -35,7 +35,7 @@ main()
for (i = 0; i < ARRSIZE; i++)
intarray[i] = i+1;
- intstruct.a = 12 * 1;
+ intstruct.a = (12 * 1) << 16;
intstruct.b = 12 * 2;
intstruct.c = 12 * 3;
intstruct.d = 12 * 4;
diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp
index 54efe51..67f3195 100644
--- a/gdb/testsuite/gdb.base/dump.exp
+++ b/gdb/testsuite/gdb.base/dump.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -46,7 +46,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${op
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
gdb_test "dump mem /dev/null 0x10 0x20" "Cannot access memory at address 0x10" \
"inaccessible memory is reported"
@@ -107,14 +108,7 @@ set endian [get_endianness]
# Now generate some dump files.
proc make_dump_file { command msg } {
- global gdb_prompt
-
- gdb_test_multiple "${command}" "$msg" {
- -re ".*\[Ee\]rror.*$gdb_prompt $" { fail $msg }
- -re ".*\[Ww\]arning.*$gdb_prompt $" { fail $msg }
- -re ".*\[Uu\]ndefined .*$gdb_prompt $" { fail $msg }
- -re ".*$gdb_prompt $" { pass $msg }
- }
+ gdb_test_no_output "${command}" "$msg"
}
make_dump_file "dump val [set intarr1.bin] intarray" \
@@ -198,7 +192,7 @@ proc capture_pointer_with_type { pointer } {
# Expected output of "p ${pointer}" is like "$7 = (int (*)[32]) 0x804a0e0",
# and we want to extract "(int (*)[32]) 0x804a0e0" from it via
# following regexp.
- if [regexp " \\(.*\\).* 0x\[0-9a-fA-F\]+" $expect_out(0,string) output_string] {
+ if {[regexp " \\(.*\\).* 0x\[0-9a-fA-F\]+" $expect_out(0,string) output_string]} {
# OUTPUT_STRING is expected to be like "(int (*)[32]) 0x804a0e0".
pass "$test"
} else {
@@ -267,12 +261,12 @@ make_dump_file \
proc test_restore_saved_value { restore_args msg oldval newval } {
global gdb_prompt
-
+
gdb_test "restore $restore_args" \
"Restoring .*" \
"$msg; file restored ok"
if { ![string compare $oldval \
- [capture_value $newval "$msg"]] } then {
+ [capture_value $newval "$msg"]] } then {
pass "$msg; value restored ok"
} else {
fail "$msg; value restored ok"
@@ -404,7 +398,7 @@ test_restore_saved_value "[set intstr1.bin] binary $struct2_start" \
#
# test restore with start/stop addresses.
#
-# For this purpose, we will restore just the third element of the array,
+# For this purpose, we will restore just the third element of the array,
# and check to see that adjacent elements are not modified.
#
# We will need the address and offset of the third and fourth elements.
@@ -455,7 +449,7 @@ gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 4"
if {![string compare $is64bitonly "no"]} {
print_zero_all
- # restore with expressions
+ # restore with expressions
test_restore_saved_value \
"[set intarr3.srec] (char*)${array2_start}-(char*)${array_start} &intarray\[3\] &intarray\[4\]" \
"array partial with expressions" 4 "intarray2\[3\]"
@@ -481,7 +475,7 @@ gdb_file_cmd ${binfile}
# Now fix the endianness at the correct state.
gdb_test_multiple "set endian $endian" "set endianness" {
- -re ".* (big|little) endian.*$gdb_prompt $" {
+ -re ".* (big|little) endian.*$gdb_prompt $" {
pass "setting $endian endianness"
}
}
@@ -504,10 +498,10 @@ if { ![string compare $struct_val \
proc test_reload_saved_value { filename msg oldval newval } {
global gdb_prompt
-
+
gdb_file_cmd $filename
if { ![string compare $oldval \
- [capture_value $newval "$msg"]] } then {
+ [capture_value $newval "$msg"]] } then {
pass "$msg; value restored ok"
} else {
fail "$msg; value restored ok"
diff --git a/gdb/testsuite/gdb.base/dup-sect.S b/gdb/testsuite/gdb.base/dup-sect.S
index 64e9161..d640a66 100644
--- a/gdb/testsuite/gdb.base/dup-sect.S
+++ b/gdb/testsuite/gdb.base/dup-sect.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/dup-sect.exp b/gdb/testsuite/gdb.base/dup-sect.exp
index e5d185f..5a5ad91 100644
--- a/gdb/testsuite/gdb.base/dup-sect.exp
+++ b/gdb/testsuite/gdb.base/dup-sect.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ if {[build_executable ${testfile}.exp $executable [list ${srcfile} ${srcmainfile
set test "rename section"
set objcopy_program [gdb_find_objcopy]
-set result [catch "exec $objcopy_program --rename-section sect2=sect1 $binfile" output]
+set result [catch {exec $objcopy_program --rename-section sect2=sect1 $binfile} output]
verbose "result is $result"
verbose "output is $output"
if {$result != 0} {
@@ -62,7 +62,7 @@ if {[gdb_gnu_strip_debug $binfile] != 0} {
# in $binfile.
set test "strip"
set strip_program [transform strip]
-set result [catch "exec $strip_program $binfile" output]
+set result [catch {exec $strip_program $binfile} output]
verbose "result is $result"
verbose "output is $output"
if {$result != 0} {
diff --git a/gdb/testsuite/gdb.base/duplicate-bp.c b/gdb/testsuite/gdb.base/duplicate-bp.c
index 8212b24..bb6c155 100644
--- a/gdb/testsuite/gdb.base/duplicate-bp.c
+++ b/gdb/testsuite/gdb.base/duplicate-bp.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/duplicate-bp.exp b/gdb/testsuite/gdb.base/duplicate-bp.exp
index 5ab001d..da5834b 100644
--- a/gdb/testsuite/gdb.base/duplicate-bp.exp
+++ b/gdb/testsuite/gdb.base/duplicate-bp.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,8 @@ proc test_setup { count } {
global srcfile
global binfile
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.base/early-init-file.c b/gdb/testsuite/gdb.base/early-init-file.c
index b1ce99c..a21818d 100644
--- a/gdb/testsuite/gdb.base/early-init-file.c
+++ b/gdb/testsuite/gdb.base/early-init-file.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/early-init-file.exp b/gdb/testsuite/gdb.base/early-init-file.exp
index 7c6e9e2..6d70c4c 100644
--- a/gdb/testsuite/gdb.base/early-init-file.exp
+++ b/gdb/testsuite/gdb.base/early-init-file.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/echo.exp b/gdb/testsuite/gdb.base/echo.exp
index 30c0ab9..bb6a343 100644
--- a/gdb/testsuite/gdb.base/echo.exp
+++ b/gdb/testsuite/gdb.base/echo.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1988-2024 Free Software Foundation, Inc.
+# Copyright (C) 1988-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/eh_return.c b/gdb/testsuite/gdb.base/eh_return.c
index 7329de6..6817d2a 100644
--- a/gdb/testsuite/gdb.base/eh_return.c
+++ b/gdb/testsuite/gdb.base/eh_return.c
@@ -2,7 +2,7 @@
It was copied from gcc repo, gcc/testsuite/gcc.target/aarch64/eh_return.c.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/eh_return.exp b/gdb/testsuite/gdb.base/eh_return.exp
index 9fefc89..703f9e9 100644
--- a/gdb/testsuite/gdb.base/eh_return.exp
+++ b/gdb/testsuite/gdb.base/eh_return.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -71,7 +71,8 @@ if { $address == -1 } {
return 0
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_assert [gdb_breakpoint "*$address" no-message] "set breakpoint on address"
diff --git a/gdb/testsuite/gdb.base/empty-host-env-vars.exp b/gdb/testsuite/gdb.base/empty-host-env-vars.exp
index 5fab65a..1a1b158 100644
--- a/gdb/testsuite/gdb.base/empty-host-env-vars.exp
+++ b/gdb/testsuite/gdb.base/empty-host-env-vars.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/empty_exe.exp b/gdb/testsuite/gdb.base/empty_exe.exp
index 20feb74..bc6bd39 100644
--- a/gdb/testsuite/gdb.base/empty_exe.exp
+++ b/gdb/testsuite/gdb.base/empty_exe.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp
index 924133e..92815a7 100644
--- a/gdb/testsuite/gdb.base/ena-dis-br.exp
+++ b/gdb/testsuite/gdb.base/ena-dis-br.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -240,7 +240,7 @@ with_test_prefix "run $count" {
incr count
}
-# See the comments in condbreak.exp for "run until breakpoint at marker1"
+# See the comments in condbreak.exp for "run until breakpoint at marker1"
# for an explanation of the xfail below.
set test "continue to break marker1, 2nd time"
gdb_test_multiple "continue" "$test" {
diff --git a/gdb/testsuite/gdb.base/endian.c b/gdb/testsuite/gdb.base/endian.c
index 8567fdd..c135956 100644
--- a/gdb/testsuite/gdb.base/endian.c
+++ b/gdb/testsuite/gdb.base/endian.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/endian.exp b/gdb/testsuite/gdb.base/endian.exp
index 7ef288b..993617b 100644
--- a/gdb/testsuite/gdb.base/endian.exp
+++ b/gdb/testsuite/gdb.base/endian.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/endianity.c b/gdb/testsuite/gdb.base/endianity.c
index f415c4a..a8cdca8 100644
--- a/gdb/testsuite/gdb.base/endianity.c
+++ b/gdb/testsuite/gdb.base/endianity.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/endianity.exp b/gdb/testsuite/gdb.base/endianity.exp
index 789266d..013866d 100644
--- a/gdb/testsuite/gdb.base/endianity.exp
+++ b/gdb/testsuite/gdb.base/endianity.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,8 +16,8 @@
standard_testfile .c
set test_sso [expr \
- [supports_scalar_storage_order_attribute] \
- && [supports_gnuc]]
+ {[supports_scalar_storage_order_attribute] \
+ && [supports_gnuc]}]
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
[list debug additional_flags=-DTEST_SSO=$test_sso]] } {
diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp
index 90359fd..8c542ef 100644
--- a/gdb/testsuite/gdb.base/ending-run.exp
+++ b/gdb/testsuite/gdb.base/ending-run.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -78,7 +78,7 @@ gdb_test_multiple "info line ending-run.c:$break1_line" "" {
gdb_test_multiple "i b" "all set to continue" {
-re ".* breakpoint .* breakpoint .*$gdb_prompt $" {
- fail "all set to continue (didn't clear bps)"
+ fail "all set to continue (didn't clear bps)"
}
-re ".*2.*main.*$break2_line.*$gdb_prompt $" {
pass "all set to continue"
@@ -92,7 +92,7 @@ gdb_test_multiple "i b" "all set to continue" {
# See if we can step out with control. The "1 2 3" stuff
# is output from the program.
#
-if ![gdb_skip_stdio_test "cont"] {
+if {![gdb_skip_stdio_test "cont"]} {
gdb_test_stdio "cont" \
"1 2 7 14 23 34 47 62 79" \
"Breakpoint.*$break2_line.*"
@@ -100,7 +100,7 @@ if ![gdb_skip_stdio_test "cont"] {
gdb_test "cont" ".*Breakpoint.*$break2_line.*"
}
-if ![gdb_skip_stdio_test "Step to return"] {
+if {![gdb_skip_stdio_test "Step to return"]} {
gdb_test_stdio "next" \
"Goodbye!" \
"[expr {$break2_line + 1}].*" \
@@ -129,13 +129,13 @@ gdb_test_multiple "next" "step out of main" {
fail "step out of main"
gdb_test "n" ".*" ""
}
- -re ".*in.*start.*$gdb_prompt $" {
+ -re ".*in.*start.*$gdb_prompt $" {
pass "step out of main"
}
- -re ".*in.*bsp_trap.*$gdb_prompt $" {
+ -re ".*in.*bsp_trap.*$gdb_prompt $" {
pass "step out of main"
}
- -re ".*in.*init.*$gdb_prompt $" {
+ -re ".*in.*init.*$gdb_prompt $" {
# This is what happens on sparc64-elf ultra.
pass "step out of main"
}
@@ -172,7 +172,7 @@ gdb_test_multiple "next" "step out of main" {
# This is what happens on the ARM RVDS runtime
pass "step out of main"
}
- -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $" {
+ -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $" {
pass "step out of main"
}
-re ".*in __wrap__?main ().*$gdb_prompt $" {
@@ -183,7 +183,7 @@ gdb_test_multiple "next" "step out of main" {
# another `next' is necessary.
gdb_test "next" ".*in start_l ().*" "step out of main"
}
- -re ".*in.*currently asm.*$gdb_prompt $" {
+ -re ".*in.*currently asm.*$gdb_prompt $" {
pass "step out of main"
}
-re "_*start\[0-9\]* \\(\[^)\]*\\).*$gdb_prompt $" {
@@ -224,7 +224,7 @@ set program_in_exit 0
if {!$use_gdb_stub
&& (! [target_info exists use_cygmon] || ! [target_info use_cygmon])} {
global program_exited
- if {[eval expr $program_exited == 0]} {
+ if {$program_exited == 0} {
gdb_test_multiple "n" "step to end of run" {
-re "$inferior_exited_re normally.*$gdb_prompt $" {
# If we actually have debug info for the start function,
@@ -245,7 +245,7 @@ if {!$use_gdb_stub
set program_exited_normally 1
}
-re ".*Single.*in exit.*from.*dld.sl.*$gdb_prompt $" {
- pass "step to end of run"
+ pass "step to end of run"
set program_in_exit 1
}
-re ".*Single.*_int_reset.*$gdb_prompt $" {
@@ -254,7 +254,7 @@ if {!$use_gdb_stub
set program_exited_normally 1
}
}
- }
+ }
}
if {$program_in_exit} {
@@ -275,10 +275,10 @@ if {!$use_gdb_stub
set exec_output [remote_exec host "ls core"]
- if [ regexp "core not found" $exec_output] {
+ if {[ regexp "core not found" $exec_output]} {
pass "no core dumped on quit"
} else {
- if [ regexp "No such file or directory" $exec_output] {
+ if {[ regexp "No such file or directory" $exec_output]} {
pass "ls: core (No core dumped on quit)"
} else {
remote_exec build "rm -f core"
diff --git a/gdb/testsuite/gdb.base/enum_cond.c b/gdb/testsuite/gdb.base/enum_cond.c
index df8830f..d264200 100644
--- a/gdb/testsuite/gdb.base/enum_cond.c
+++ b/gdb/testsuite/gdb.base/enum_cond.c
@@ -1,5 +1,5 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/enum_cond.exp b/gdb/testsuite/gdb.base/enum_cond.exp
index d58da47..5c78ec9 100644
--- a/gdb/testsuite/gdb.base/enum_cond.exp
+++ b/gdb/testsuite/gdb.base/enum_cond.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/enumval.c b/gdb/testsuite/gdb.base/enumval.c
index c487e78..ab7496a 100644
--- a/gdb/testsuite/gdb.base/enumval.c
+++ b/gdb/testsuite/gdb.base/enumval.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/enumval.exp b/gdb/testsuite/gdb.base/enumval.exp
index 79adb46..de95745 100644
--- a/gdb/testsuite/gdb.base/enumval.exp
+++ b/gdb/testsuite/gdb.base/enumval.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/environ.exp b/gdb/testsuite/gdb.base/environ.exp
index 1bc5c71..36cc5f4 100644
--- a/gdb/testsuite/gdb.base/environ.exp
+++ b/gdb/testsuite/gdb.base/environ.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/eof-exit.exp b/gdb/testsuite/gdb.base/eof-exit.exp
index 5b9ec7b..9b6be28 100644
--- a/gdb/testsuite/gdb.base/eof-exit.exp
+++ b/gdb/testsuite/gdb.base/eof-exit.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/errno.c b/gdb/testsuite/gdb.base/errno.c
index c6835a8..a896d36 100644
--- a/gdb/testsuite/gdb.base/errno.c
+++ b/gdb/testsuite/gdb.base/errno.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/errno.exp b/gdb/testsuite/gdb.base/errno.exp
index 262176e..9607b81 100644
--- a/gdb/testsuite/gdb.base/errno.exp
+++ b/gdb/testsuite/gdb.base/errno.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -45,8 +45,9 @@
standard_testfile
proc do_tests {{do_xfail_cast 0} {do_xfail 0} {do_xfail_core_test 0}} {
- clean_restart $::binfile
- if ![runto_main] {
+ clean_restart
+ gdb_load $::binfile
+ if {![runto_main]} {
return
}
@@ -144,12 +145,12 @@ proc do_tests {{do_xfail_cast 0} {do_xfail 0} {do_xfail_core_test 0}} {
}
}
- if $do_xfail {
+ if {$do_xfail} {
setup_xfail *-*-*
}
gdb_test "print errno" ".* = 42"
- if $do_xfail_cast {
+ if {$do_xfail_cast} {
setup_xfail *-*-*
}
gdb_test "print (int) errno" ".* = 42"
@@ -172,17 +173,18 @@ proc do_tests {{do_xfail_cast 0} {do_xfail 0} {do_xfail_core_test 0}} {
gdb_test "print errno" ".* = 36" "print masking errno"
# Finish test early if no core file was made.
- if !$core_supported {
+ if {!$core_supported} {
return
}
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
set core_loaded [gdb_core_cmd $corefile "load corefile"]
if { $core_loaded == -1 } {
return
}
- if $do_xfail_core_test {
+ if {$do_xfail_core_test} {
setup_xfail *-*-*
}
gdb_test "print errno" ".* = 42" "check errno value from corefile"
diff --git a/gdb/testsuite/gdb.base/eu-strip-infcall.c b/gdb/testsuite/gdb.base/eu-strip-infcall.c
index b4b59f5..896d51c 100644
--- a/gdb/testsuite/gdb.base/eu-strip-infcall.c
+++ b/gdb/testsuite/gdb.base/eu-strip-infcall.c
@@ -1,4 +1,4 @@
-/* Copyright 2011-2024 Free Software Foundation, Inc.
+/* Copyright 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/eu-strip-infcall.exp b/gdb/testsuite/gdb.base/eu-strip-infcall.exp
index 531906f..43f2bc0 100644
--- a/gdb/testsuite/gdb.base/eu-strip-infcall.exp
+++ b/gdb/testsuite/gdb.base/eu-strip-infcall.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if {[lindex $status 0] != 0} {
clean_restart $testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/eval-avoid-side-effects.exp b/gdb/testsuite/gdb.base/eval-avoid-side-effects.exp
index 914f01e..fdd6bed 100644
--- a/gdb/testsuite/gdb.base/eval-avoid-side-effects.exp
+++ b/gdb/testsuite/gdb.base/eval-avoid-side-effects.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/eval-skip.exp b/gdb/testsuite/gdb.base/eval-skip.exp
index e8f766e..aca5118 100644
--- a/gdb/testsuite/gdb.base/eval-skip.exp
+++ b/gdb/testsuite/gdb.base/eval-skip.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
# operators, or in the non returned part of a (x ? y: z) expression.
# the part that is not evaluated is parsed and evaluated anyway, but with
# the EVAL_SKIP flag set
-#
+#
# source file "int-type.c"
#
@@ -39,7 +39,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.base/eval.exp b/gdb/testsuite/gdb.base/eval.exp
index bcc9fb9..e471b20 100644
--- a/gdb/testsuite/gdb.base/eval.exp
+++ b/gdb/testsuite/gdb.base/eval.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/examine-backward.c b/gdb/testsuite/gdb.base/examine-backward.c
index d54e100..b986a6c 100644
--- a/gdb/testsuite/gdb.base/examine-backward.c
+++ b/gdb/testsuite/gdb.base/examine-backward.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/examine-backward.exp b/gdb/testsuite/gdb.base/examine-backward.exp
index fe3d13e..0eef327 100644
--- a/gdb/testsuite/gdb.base/examine-backward.exp
+++ b/gdb/testsuite/gdb.base/examine-backward.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare for examine-backward" \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -357,7 +357,7 @@ with_test_prefix "backward disassemble general" {
lappend disassmbly $instructions
}
for {set i 0} {$i < [llength $length_to_examine]} {incr i} {
- set idx [expr [llength $length_to_examine] - $i - 1]
+ set idx [expr {[llength $length_to_examine] - $i - 1}]
set len [lindex $length_to_examine $idx]
set actual [capture_command_output "x/-${len}i" ""]
set expected [lindex $disassmbly $idx]
diff --git a/gdb/testsuite/gdb.base/exe-lock.exp b/gdb/testsuite/gdb.base/exe-lock.exp
index 532c7bb..2e375b4 100644
--- a/gdb/testsuite/gdb.base/exe-lock.exp
+++ b/gdb/testsuite/gdb.base/exe-lock.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debu
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
# Sanity-check: Verify that the executable exists. This is just to
# make sure that, when we verify later that the file does not exist,
diff --git a/gdb/testsuite/gdb.base/exec-invalid-sysroot.exp b/gdb/testsuite/gdb.base/exec-invalid-sysroot.exp
index 30c72dc..99f5e7d 100644
--- a/gdb/testsuite/gdb.base/exec-invalid-sysroot.exp
+++ b/gdb/testsuite/gdb.base/exec-invalid-sysroot.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -69,5 +69,6 @@ proc do_exec_sysroot_test {} {
}
# Start with a fresh gdb
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
do_exec_sysroot_test
diff --git a/gdb/testsuite/gdb.base/execl-update-breakpoints.c b/gdb/testsuite/gdb.base/execl-update-breakpoints.c
index f0dea4d..e71efd0 100644
--- a/gdb/testsuite/gdb.base/execl-update-breakpoints.c
+++ b/gdb/testsuite/gdb.base/execl-update-breakpoints.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/execl-update-breakpoints.exp b/gdb/testsuite/gdb.base/execl-update-breakpoints.exp
index 86f038a..cd49df1 100644
--- a/gdb/testsuite/gdb.base/execl-update-breakpoints.exp
+++ b/gdb/testsuite/gdb.base/execl-update-breakpoints.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,7 +41,8 @@ if { [gdb_compile $objfile $exec1 executable {debug text_segment=0x1000000}] !=
# First check whether the address of "main" in exec1 is readable in
# exec2. If it is, then skip the test as unsupported.
-clean_restart ${exec1}
+clean_restart
+gdb_load $exec1
if {![runto_main]} {
return -1
}
@@ -55,7 +56,8 @@ gdb_test_multiple "p/x &main" $test {
}
}
-clean_restart ${exec2}
+clean_restart
+gdb_load $exec2
if {![runto_main]} {
return -1
}
@@ -84,7 +86,8 @@ proc test { always_inserted } {
global exec1
global gdb_prompt
- clean_restart ${exec1}
+ clean_restart
+ gdb_load $exec1
gdb_test_no_output "set breakpoint always-inserted $always_inserted"
diff --git a/gdb/testsuite/gdb.base/execution-termios.c b/gdb/testsuite/gdb.base/execution-termios.c
index b4c13b2..f3e4f16 100644
--- a/gdb/testsuite/gdb.base/execution-termios.c
+++ b/gdb/testsuite/gdb.base/execution-termios.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/execution-termios.exp b/gdb/testsuite/gdb.base/execution-termios.exp
index c530d73..c817db2 100644
--- a/gdb/testsuite/gdb.base/execution-termios.exp
+++ b/gdb/testsuite/gdb.base/execution-termios.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
proc test { prefix body } {
with_test_prefix $prefix {
- if ![runto_main] {
+ if {![runto_main]} {
return 0
}
uplevel 1 $body
@@ -39,7 +39,7 @@ test "next" {
}
test "infcall" {
- if ![target_info exists gdb,cannot_call_functions] {
+ if {![target_info exists gdb,cannot_call_functions]} {
gdb_test "print func ()" " = 1" "termios ok"
} else {
unsupported "cannot call functions"
diff --git a/gdb/testsuite/gdb.base/exitsignal.exp b/gdb/testsuite/gdb.base/exitsignal.exp
index 2d6fc03..6606cc1 100644
--- a/gdb/testsuite/gdb.base/exitsignal.exp
+++ b/gdb/testsuite/gdb.base/exitsignal.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/expand-psymtabs.c b/gdb/testsuite/gdb.base/expand-psymtabs.c
index 8af65ba..ba0c64c 100644
--- a/gdb/testsuite/gdb.base/expand-psymtabs.c
+++ b/gdb/testsuite/gdb.base/expand-psymtabs.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/expand-psymtabs.exp b/gdb/testsuite/gdb.base/expand-psymtabs.exp
index 875b100..981a06d 100644
--- a/gdb/testsuite/gdb.base/expand-psymtabs.exp
+++ b/gdb/testsuite/gdb.base/expand-psymtabs.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
#
# This test is meant to verify that, even with lazy partial symtab
# reading in effect, GDB can set breakpoints by line number
-# successfully in either compilation unit.
+# successfully in either compilation unit.
standard_testfile
diff --git a/gdb/testsuite/gdb.base/exprs.exp b/gdb/testsuite/gdb.base/exprs.exp
index 375af6b..b1cc8fb 100644
--- a/gdb/testsuite/gdb.base/exprs.exp
+++ b/gdb/testsuite/gdb.base/exprs.exp
@@ -1,4 +1,4 @@
-# Copyright 1988-2024 Free Software Foundation, Inc.
+# Copyright 1988-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
#
# set it up at a breakpoint so we can play with the variable values
@@ -44,11 +45,11 @@ proc test_expr { args } {
if { [llength $args] % 2 } {
warning "an even # of arguments should be passed to test_expr"
}
- set last_ent [expr [llength $args] - 1]
+ set last_ent [expr {[llength $args] - 1}]
set testname [lindex $args $last_ent]
gdb_test [lindex $args 0] ".*" "$testname, setup"
- for {set x 1} {$x < $last_ent} {set x [expr $x + 2]} {
- gdb_test [lindex $args $x] [lindex $args [expr $x + 1]] "$testname, [lindex $args $x]"
+ for {set x 1} {$x < $last_ent} {set x [expr {$x + 2}]} {
+ gdb_test [lindex $args $x] [lindex $args [expr {$x + 1}]] "$testname, [lindex $args $x]"
}
}
#
@@ -223,10 +224,10 @@ gdb_test_multiple "print sizeof (long long) > sizeof (long)" \
pass "sizeof (long long) > sizeof (long) (false)"
}
}
-if [expr ! $ok] { setup_xfail "*-*-*" }
+if {!$ok} { setup_xfail "*-*-*" }
gdb_test "print (void*) ((long long) (unsigned long) -1 + 1)" \
"warning: value truncated.*" "truncate (void*) 0x00000000ffffffff + 1"
-if [expr ! $ok] { setup_xfail "*-*-*" }
+if {!$ok} { setup_xfail "*-*-*" }
gdb_test "print (void*) (~((long long)(unsigned long) -1) - 1)" \
"warning: value truncated.*" "truncate (void*) 0xffffffff00000000 - 1"
@@ -284,3 +285,24 @@ gdb_test "print v_short + " \
# Test for a syntax error in the middle of an expression.
gdb_test "print v_short =}{= 3" \
"A syntax error in expression, near `\\}\\{= 3'\\."
+
+set hs {[^\r\n]}
+set re_debug [string cat $hs* {[Ss]hift} $hs*]
+
+gdb_test_no_output "set debug parse 1"
+set saw_start 0
+set saw_val 0
+gdb_test_multiple "print 23" "print with debugging" -lbl {
+ -re "\r\n${re_debug}(?=\r\n)" {
+ set saw_start 1
+ exp_continue
+ }
+ -re "\r\n.$decimal = 23(?=\r\n)" {
+ set saw_val 1
+ exp_continue
+ }
+
+ -re -wrap "" {
+ gdb_assert {$saw_start && $saw_val} $gdb_test_name
+ }
+}
diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c
index 0f20151..4ba5ab0 100644
--- a/gdb/testsuite/gdb.base/fileio.c
+++ b/gdb/testsuite/gdb.base/fileio.c
@@ -73,6 +73,10 @@ static const char *strerrno (int err);
#define STRING "Hello World"
+#define STRINGIFY(s) STRINGIFY_(s)
+#define STRINGIFY_(s) #s
+#define OUTDIR STRINGIFY (OUTDIR_)
+
static void stop (void) {}
/* A NULL string. We pass this to stat below instead of a NULL
diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp
index f31a775..e2b7354 100644
--- a/gdb/testsuite/gdb.base/fileio.exp
+++ b/gdb/testsuite/gdb.base/fileio.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if {[is_remote host]} {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
executable \
- [list debug "additional_flags=-DOUTDIR=\"$outdir/\""]] != "" } {
+ [list debug additional_flags=[quote_for_host -DOUTDIR_=$outdir/]]] != "" } {
untested "failed to compile"
return -1
}
@@ -39,9 +39,10 @@ if {[file exists $dir2] && ![file writable $dir2]} {
system "rm -rf [standard_output_file *.fileio.test]"
set oldtimeout $timeout
-set timeout [expr "$timeout + 60"]
+set timeout [expr {$timeout + 60}]
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
gdb_test_no_output "set print sevenbit-strings"
gdb_test_no_output "set print address off"
gdb_test_no_output "set width 0"
@@ -50,7 +51,7 @@ if {![runto_main]} {
return
}
-gdb_test "break stop" "Breakpoint .*$srcfile.*"
+gdb_test "break stop" "Breakpoint .*$srcfile.*"
set stop_msg ".*Breakpoint .* stop \\(\\) at.*$srcfile:.*static void stop \\(void\\) {}.*"
@@ -72,7 +73,7 @@ gdb_test continue \
gdb_test "continue" ".*" ""
-catch "system \"chmod -f -w [standard_output_file nowrt.fileio.test]\""
+catch {system "chmod -f -w [standard_output_file nowrt.fileio.test]"}
# If the user is root, we will always have write permission.
if { [root_user] } {
@@ -240,7 +241,7 @@ gdb_test continue \
# This test fails on Cygwin because unlink() succeeds on Win32 systems
# in that situation.
-if [ishost *cygwin*] {
+if {[ishost *cygwin*]} {
setup_xfail "*-*-*"
}
# If the user is root, we will always have write permission.
diff --git a/gdb/testsuite/gdb.base/filename-completion.exp b/gdb/testsuite/gdb.base/filename-completion.exp
index a1dd974..c80e634 100644
--- a/gdb/testsuite/gdb.base/filename-completion.exp
+++ b/gdb/testsuite/gdb.base/filename-completion.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -148,7 +148,7 @@ proc test_tab_complete_within_line_multiple { input_line back_count \
[join [list \
[string range $input_line 0 end-$back_count] \
${add_completed_line} \
- [string range $input_line end-[expr $back_count - 1] end]] \
+ [string range $input_line end-[expr {$back_count - 1}] end]] \
""]
set expanded_line_re [string_to_regexp $expanded_line]
@@ -166,7 +166,7 @@ proc test_tab_complete_within_line_multiple { input_line back_count \
set after_tab_re "^$input_line_re"
set after_tab_re "$after_tab_re\\\x08{$back_count}"
set after_tab_re "$after_tab_re${completion::bell_re}"
- set tail [string range $input_line end-[expr $back_count - 1] end]
+ set tail [string range $input_line end-[expr {$back_count - 1}] end]
set after_tab_re "$after_tab_re$add_completed_line_re"
set after_tab_re "$after_tab_re[string_to_regexp $tail]"
set after_tab_re "$after_tab_re\\\x08{$back_count}"
@@ -218,7 +218,7 @@ proc test_tab_complete_within_line_unique { input_line back_count insert_str } {
set re [string_to_regexp $input_line]
set re $re\\\x08{$back_count}
set re $re[string_to_regexp $insert_str]
- set tail [string range $input_line end-[expr $back_count - 1] end]
+ set tail [string range $input_line end-[expr {$back_count - 1}] end]
set re $re[string_to_regexp $tail]
set re $re\\\x08{$back_count}
@@ -385,7 +385,7 @@ proc run_quoting_and_escaping_tests { root } {
remove-symbol-file \
"target core" "target exec" "target tfile" \
"maint print c-tdesc" "save gdb-index"
- "save gdb-index -dwarf-5" }
+ "save gdb-index -dwarf-5" "shell ls"}
if { [allow_compile_tests] } {
lappend all_cmds "compile file"
}
@@ -408,6 +408,31 @@ proc run_quoting_and_escaping_tests { root } {
run_quoting_and_escaping_tests_1 $root $cmd
}
}
+
+ # Some additional testing of shell command. Test 'shell' and '!'
+ # when there are multiple filenames on the command line. This
+ # focuses on completion of the final filename. There is also some
+ # testing of the shell command above, this tests completion within
+ # the line.
+ foreach_with_prefix shell_cmd { "shell " "!" "pipe print 1 | " } {
+ foreach suffix { "aaa/aa bb" "bb2/dir 1/unique file" } {
+ set dir $root/$suffix
+
+ regsub -all " " "$dir" "\\ " dir_with_backslash
+
+ with_test_prefix "suffix='$suffix'" {
+ with_test_prefix "with_backslash" {
+ run_quoting_and_escaping_tests_1 $root "${shell_cmd}ls $dir_with_backslash"
+ }
+ with_test_prefix "with double quotes" {
+ run_quoting_and_escaping_tests_1 $root "${shell_cmd}ls \"$dir\""
+ }
+ with_test_prefix "with single quotes" {
+ run_quoting_and_escaping_tests_1 $root "${shell_cmd}ls '$dir'"
+ }
+ }
+ }
+ }
}
# Helper for run_unquoted_tests. ROOT is the root directory as setup
diff --git a/gdb/testsuite/gdb.base/filesym.c b/gdb/testsuite/gdb.base/filesym.c
index 4145e37..66cb1bb 100644
--- a/gdb/testsuite/gdb.base/filesym.c
+++ b/gdb/testsuite/gdb.base/filesym.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/filesym.exp b/gdb/testsuite/gdb.base/filesym.exp
index 28f0776..4cfba92 100644
--- a/gdb/testsuite/gdb.base/filesym.exp
+++ b/gdb/testsuite/gdb.base/filesym.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/find-unmapped.c b/gdb/testsuite/gdb.base/find-unmapped.c
index c4517db..c02cea6 100644
--- a/gdb/testsuite/gdb.base/find-unmapped.c
+++ b/gdb/testsuite/gdb.base/find-unmapped.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/find-unmapped.exp b/gdb/testsuite/gdb.base/find-unmapped.exp
index cab1fe9..8f18650 100644
--- a/gdb/testsuite/gdb.base/find-unmapped.exp
+++ b/gdb/testsuite/gdb.base/find-unmapped.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile}] } {
return -1
}
-if ![runto breakpt] {
+if {![runto breakpt]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/find.c b/gdb/testsuite/gdb.base/find.c
index ffac2c9..786b960 100644
--- a/gdb/testsuite/gdb.base/find.c
+++ b/gdb/testsuite/gdb.base/find.c
@@ -1,7 +1,7 @@
/* Testcase for the find command.
This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/find.exp b/gdb/testsuite/gdb.base/find.exp
index a46d6af..aa4fc3c 100644
--- a/gdb/testsuite/gdb.base/find.exp
+++ b/gdb/testsuite/gdb.base/find.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_test "break $srcfile:stop_here" \
"Breakpoint.*at.* file .*$srcfile, line.*" \
@@ -164,7 +165,7 @@ gdb_test "find /w search_buf, +search_buf_size, 0x12345678" \
# For native targets, test a pattern straddling a chunk boundary.
-if [isnative] {
+if {[isnative]} {
gdb_test_no_output "set *(int32_t*) &search_buf\[${CHUNK_SIZE}-1\] = 0xfdb97531" ""
gdb_test "find /w search_buf, +search_buf_size, 0xfdb97531" \
"${hex_number}${one_pattern_found}" \
diff --git a/gdb/testsuite/gdb.base/finish-pretty.c b/gdb/testsuite/gdb.base/finish-pretty.c
index 41f1118..48dbc67 100644
--- a/gdb/testsuite/gdb.base/finish-pretty.c
+++ b/gdb/testsuite/gdb.base/finish-pretty.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/finish-pretty.exp b/gdb/testsuite/gdb.base/finish-pretty.exp
index 0b6bea6..8f0c7c1 100644
--- a/gdb/testsuite/gdb.base/finish-pretty.exp
+++ b/gdb/testsuite/gdb.base/finish-pretty.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] } {
}
proc finish_pretty { } {
- if ![runto foo] {
+ if {![runto foo]} {
return
}
gdb_test_no_output "set print pretty" \
diff --git a/gdb/testsuite/gdb.base/finish.exp b/gdb/testsuite/gdb.base/finish.exp
index f40577c..d68863b 100644
--- a/gdb/testsuite/gdb.base/finish.exp
+++ b/gdb/testsuite/gdb.base/finish.exp
@@ -1,4 +1,4 @@
-# Copyright 2000-2024 Free Software Foundation, Inc.
+# Copyright 2000-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/fission-macro-2.c b/gdb/testsuite/gdb.base/fission-macro-2.c
index fb088c8..ecd3ab3 100644
--- a/gdb/testsuite/gdb.base/fission-macro-2.c
+++ b/gdb/testsuite/gdb.base/fission-macro-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/fission-macro.c b/gdb/testsuite/gdb.base/fission-macro.c
index 9c8cbec..03606bb 100644
--- a/gdb/testsuite/gdb.base/fission-macro.c
+++ b/gdb/testsuite/gdb.base/fission-macro.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/fission-macro.exp b/gdb/testsuite/gdb.base/fission-macro.exp
index 9e5d5c0..0680da6 100644
--- a/gdb/testsuite/gdb.base/fission-macro.exp
+++ b/gdb/testsuite/gdb.base/fission-macro.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
# Gcc 14 is the first release containing the fix for PR debug/111409.
-require {expr [gcc_major_version] >= 14}
+require {expr {[gcc_major_version] >= 14}}
standard_testfile .c -2.c
diff --git a/gdb/testsuite/gdb.base/fixsection.c b/gdb/testsuite/gdb.base/fixsection.c
index d3874b3..0de02388 100644
--- a/gdb/testsuite/gdb.base/fixsection.c
+++ b/gdb/testsuite/gdb.base/fixsection.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/fixsection.exp b/gdb/testsuite/gdb.base/fixsection.exp
index 23c7475..3056851 100644
--- a/gdb/testsuite/gdb.base/fixsection.exp
+++ b/gdb/testsuite/gdb.base/fixsection.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,8 @@ if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
gdb_load_shlib ${lib_sl}
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.base/flexible-array-member.c b/gdb/testsuite/gdb.base/flexible-array-member.c
index d53bcd0..00e1313 100644
--- a/gdb/testsuite/gdb.base/flexible-array-member.c
+++ b/gdb/testsuite/gdb.base/flexible-array-member.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/flexible-array-member.exp b/gdb/testsuite/gdb.base/flexible-array-member.exp
index 7bc40de..5e8cc9a 100644
--- a/gdb/testsuite/gdb.base/flexible-array-member.exp
+++ b/gdb/testsuite/gdb.base/flexible-array-member.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/float.c b/gdb/testsuite/gdb.base/float.c
index ec0beee..52e4719 100644
--- a/gdb/testsuite/gdb.base/float.c
+++ b/gdb/testsuite/gdb.base/float.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/float.exp b/gdb/testsuite/gdb.base/float.exp
index 49dc0a3..278b3f5 100644
--- a/gdb/testsuite/gdb.base/float.exp
+++ b/gdb/testsuite/gdb.base/float.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/float128.c b/gdb/testsuite/gdb.base/float128.c
index ee6dde4..475d7f4 100644
--- a/gdb/testsuite/gdb.base/float128.c
+++ b/gdb/testsuite/gdb.base/float128.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/float128.exp b/gdb/testsuite/gdb.base/float128.exp
index a779318..b8d3a6c 100644
--- a/gdb/testsuite/gdb.base/float128.exp
+++ b/gdb/testsuite/gdb.base/float128.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,8 @@ if { [do_compile] != "" && [do_compile {-mfloat128}] != "" } {
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.base/floatn.c b/gdb/testsuite/gdb.base/floatn.c
index 5b1a741..d7c33e7 100644
--- a/gdb/testsuite/gdb.base/floatn.c
+++ b/gdb/testsuite/gdb.base/floatn.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/floatn.exp b/gdb/testsuite/gdb.base/floatn.exp
index 6cfd0fd..1b39ed8 100644
--- a/gdb/testsuite/gdb.base/floatn.exp
+++ b/gdb/testsuite/gdb.base/floatn.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,8 @@ if { [do_compile] != "" && [do_compile {-mfloat128}] != "" } {
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.base/foll-exec-c++.exp b/gdb/testsuite/gdb.base/foll-exec-c++.exp
new file mode 100644
index 0000000..d96310b
--- /dev/null
+++ b/gdb/testsuite/gdb.base/foll-exec-c++.exp
@@ -0,0 +1,24 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This file is part of the gdb testsuite
+
+# See foll-exec.exp.tcl for test details. This file runs the test
+# using the C++ compiler.
+
+require allow_cplus_tests
+set lang c++
+
+source $srcdir/$subdir/foll-exec.exp.tcl
diff --git a/gdb/testsuite/gdb.base/foll-exec-c.exp b/gdb/testsuite/gdb.base/foll-exec-c.exp
new file mode 100644
index 0000000..67f62cc
--- /dev/null
+++ b/gdb/testsuite/gdb.base/foll-exec-c.exp
@@ -0,0 +1,23 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This file is part of the gdb testsuite
+
+# See foll-exec.exp.tcl for test details. This file runs the test
+# using the C compiler.
+
+set lang c
+
+source $srcdir/$subdir/foll-exec.exp.tcl
diff --git a/gdb/testsuite/gdb.base/foll-exec-mode.c b/gdb/testsuite/gdb.base/foll-exec-mode.c
index 9bd2554..be0fa80 100644
--- a/gdb/testsuite/gdb.base/foll-exec-mode.c
+++ b/gdb/testsuite/gdb.base/foll-exec-mode.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/foll-exec-mode.exp b/gdb/testsuite/gdb.base/foll-exec-mode.exp
index 56a2ffc..ec2d905 100644
--- a/gdb/testsuite/gdb.base/foll-exec-mode.exp
+++ b/gdb/testsuite/gdb.base/foll-exec-mode.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/foll-exec.c b/gdb/testsuite/gdb.base/foll-exec.c
index e3a47f0..291f803 100644
--- a/gdb/testsuite/gdb.base/foll-exec.c
+++ b/gdb/testsuite/gdb.base/foll-exec.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 1997-2024 Free Software Foundation, Inc.
+ Copyright 1997-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,25 +19,38 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-
+#include <libgen.h>
+#include <assert.h>
#include <limits.h>
int global_i = 100;
+#ifndef EXECD_PROG
+#define EXECD_PROG "execd-prog"
+#endif
+
int main (int argc, char ** argv)
{
int local_j = global_i + 1;
int local_k = local_j + 1;
char prog[PATH_MAX];
- int len;
+ size_t len = PATH_MAX - 1;
+
+ printf ("foll-exec is about to execlp(%s)...\n", EXECD_PROG);
+
+ prog [len] = '\0';
+
+ strncpy (prog, dirname (argv[0]), len);
+ len -= strlen (prog);
+ assert (len > 0);
- printf ("foll-exec is about to execlp(execd-prog)...\n");
+ strncat (prog, "/", len);
+ len -= 1;
+ assert (len > 0);
- strcpy (prog, argv[0]);
- len = strlen (prog);
- /* Replace "foll-exec" with "execd-prog". */
- memcpy (prog + len - 9, "execd-prog", 10);
- prog[len + 1] = 0;
+ strncat (prog, EXECD_PROG, len);
+ len -= strlen (EXECD_PROG);
+ assert (len > 0);
/* In the following function call, maximum line length exceed the limit 80.
This is intentional and required for clang compiler such that complete
@@ -45,7 +58,7 @@ int main (int argc, char ** argv)
multi-line. */
execlp (prog, /* tbreak-execlp */ prog, "execlp arg1 from foll-exec", (char *) 0);
- printf ("foll-exec is about to execl(execd-prog)...\n");
+ printf ("foll-exec is about to execl(%s)...\n", EXECD_PROG);
/* In the following function call, maximum line length exceed the limit 80.
This is intentional and required for clang compiler such that complete
@@ -61,7 +74,7 @@ int main (int argc, char ** argv)
argv[0] = prog;
- printf ("foll-exec is about to execv(execd-prog)...\n");
+ printf ("foll-exec is about to execv(%s)...\n", EXECD_PROG);
execv (prog, argv); /* tbreak-execv */
}
diff --git a/gdb/testsuite/gdb.base/foll-exec.exp b/gdb/testsuite/gdb.base/foll-exec.exp.tcl
index 206e713..64bcea8 100644
--- a/gdb/testsuite/gdb.base/foll-exec.exp
+++ b/gdb/testsuite/gdb.base/foll-exec.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,33 +22,56 @@ require {istarget "*-linux*"}
standard_testfile foll-exec.c
-set testfile2 "execd-prog"
-set srcfile2 ${testfile2}.c
-set binfile2 [standard_output_file ${testfile2}]
+# Compile a program that performs an exec as EXECER_LANG, and a
+# program that will be exec'd as EXECEE_LANG. Either language can be
+# 'c' or 'c++'. Then run various test associated with 'catch exec'
+# using the compiled programs.
+proc do_exec_tests { execer_lang execee_lang } {
+ global srcfile testfile
+ global gdb_prompt
-set compile_options debug
+ # First compile the program to be exec'd, the execee.
+ set execee_base_filename "execd-prog"
+ set srcfile2 ${execee_base_filename}.c
+ set execee_testfile "execd-prog-${execee_lang}"
+ set execee_testfile_re [string_to_regexp $execee_testfile]
+ set execee_binfile [standard_output_file $execee_testfile]
-# build the first test case
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable $compile_options] != "" } {
- untested "failed to compile"
- return -1
-}
+ set execee_flags debug
+ if { $execee_lang == "c++" } {
+ lappend execee_flags "c++"
+ }
-if { [is_remote target] } {
- gdb_remote_download target $binfile2
-}
+ if { [build_executable "failed to build $execee_testfile" $execee_testfile \
+ $srcfile2 $execee_flags] == -1 } {
+ return
+ }
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $compile_options] != "" } {
- untested "failed to compile"
- return -1
-}
+ if { [is_remote target] } {
+ gdb_remote_download target $execee_binfile
+ }
-proc do_exec_tests {} {
- global binfile srcfile srcfile2 testfile testfile2
- global gdb_prompt
+
+ # Now compile the program to do the exec, the execer.
+ set execer_testfile "$testfile-${execee_lang}"
+ set execer_binfile [standard_output_file $execer_testfile]
+
+ set execer_flags debug
+ if { $execer_lang == "c++" } {
+ lappend execer_flags "c++"
+ }
+ lappend execer_flags "additional_flags=-DEXECD_PROG=\"${execee_testfile}\""
+
+ if { [build_executable "failed to build $execer_testfile" $execer_testfile \
+ $srcfile $execer_flags] == -1 } {
+ return
+ }
+
+ # Now we can start running the tests.
+ clean_restart
+ gdb_load $execer_binfile
# Start the program running, and stop at main.
- #
if {![runto_main]} {
return
}
@@ -71,7 +94,8 @@ proc do_exec_tests {} {
return
}
- clean_restart $binfile
+ clean_restart
+ gdb_load $execer_binfile
# Start the program running, and stop at main.
#
@@ -120,7 +144,7 @@ proc do_exec_tests {} {
set execd_line [gdb_get_line_number "after-exec" $srcfile2]
send_gdb "next\n"
gdb_expect {
- -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:${execd_line}.*int local_j = argc;.*$gdb_prompt $"\
+ -re ".*xecuting new program: .*${execee_testfile_re}.*${srcfile2}:${execd_line}.*int local_j = argc;.*$gdb_prompt $"\
{pass "step through execlp call"}
-re "$gdb_prompt $" {fail "step through execlp call"}
timeout {fail "(timeout) step through execlp call"}
@@ -160,7 +184,8 @@ proc do_exec_tests {} {
# Explicitly kill this program, or a subsequent rerun actually runs
# the exec'd program, not the original program...
- clean_restart $binfile
+ clean_restart
+ gdb_load $execer_binfile
# Start the program running, and stop at main.
#
@@ -193,7 +218,7 @@ proc do_exec_tests {} {
send_gdb "continue\n"
gdb_expect {
- -re ".*xecuting new program:.*${testfile2}.*Catchpoint .*(exec\'d .*${testfile2}).*$gdb_prompt $"\
+ -re ".*xecuting new program:.*${execee_testfile_re}.*Catchpoint .*(exec\'d .*${execee_testfile_re}).*$gdb_prompt $"\
{pass "hit catch exec"}
-re "$gdb_prompt $" {fail "hit catch exec"}
timeout {fail "(timeout) hit catch exec"}
@@ -210,7 +235,7 @@ proc do_exec_tests {} {
#
set msg "info shows catchpoint exec pathname"
gdb_test_multiple "info breakpoints" $msg {
- -re ".*catchpoint.*keep y.*exec, program \".*${testfile2}\".*$gdb_prompt $" {
+ -re ".*catchpoint.*keep y.*exec, program \".*${execee_testfile_re}\".*$gdb_prompt $" {
pass $msg
}
}
@@ -228,7 +253,8 @@ proc do_exec_tests {} {
# Explicitly kill this program, or a subsequent rerun actually runs
# the exec'd program, not the original program...
- clean_restart $binfile
+ clean_restart
+ gdb_load $execer_binfile
# Start the program running, and stop at main.
#
@@ -269,7 +295,7 @@ proc do_exec_tests {} {
#
send_gdb "next 2\n"
gdb_expect {
- -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:${execd_line}.*int local_j = argc;.*$gdb_prompt $"\
+ -re ".*xecuting new program: .*${execee_testfile_re}.*${srcfile2}:${execd_line}.*int local_j = argc;.*$gdb_prompt $"\
{pass "step through execl call"}
-re "$gdb_prompt $" {fail "step through execl call"}
timeout {fail "(timeout) step through execl call"}
@@ -295,7 +321,8 @@ proc do_exec_tests {} {
# Explicitly kill this program, or a subsequent rerun actually runs
# the exec'd program, not the original program...
- clean_restart $binfile
+ clean_restart
+ gdb_load $execer_binfile
# Start the program running, and stop at main.
#
@@ -330,7 +357,7 @@ proc do_exec_tests {} {
}
send_gdb "next\n"
gdb_expect {
- -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:${execd_line}.*int local_j = argc;.*$gdb_prompt $"\
+ -re ".*xecuting new program: .*${execee_testfile_re}.*${srcfile2}:${execd_line}.*int local_j = argc;.*$gdb_prompt $"\
{pass "step through execv call"}
-re "$gdb_prompt $" {fail "step through execv call"}
timeout {fail "(timeout) step through execv call"}
@@ -356,7 +383,8 @@ proc do_exec_tests {} {
# Explicitly kill this program, or a subsequent rerun actually runs
# the exec'd program, not the original program...
- clean_restart $binfile
+ clean_restart
+ gdb_load $execer_binfile
# Start the program running, and stop at main.
#
@@ -370,13 +398,13 @@ proc do_exec_tests {} {
#
send_gdb "continue\n"
gdb_expect {
- -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:${execd_line}.*int local_j = argc;.*$gdb_prompt $"\
+ -re ".*xecuting new program: .*${execee_testfile_re}.*${srcfile2}:${execd_line}.*int local_j = argc;.*$gdb_prompt $"\
{pass "continue through exec"}
-re "$gdb_prompt $" {fail "continue through exec"}
timeout {fail "(timeout) continue through exec"}
}
}
-clean_restart $binfile
-
-do_exec_tests
+foreach_with_prefix execee_lang { c c++ } {
+ do_exec_tests $lang $execee_lang
+}
diff --git a/gdb/testsuite/gdb.base/foll-fork-syscall.c b/gdb/testsuite/gdb.base/foll-fork-syscall.c
new file mode 100644
index 0000000..ef695f5
--- /dev/null
+++ b/gdb/testsuite/gdb.base/foll-fork-syscall.c
@@ -0,0 +1,35 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+#include <stdio.h>
+
+int
+main (int argc, char **argv)
+{
+ int pid, x = 0;
+
+ pid = fork ();
+ if (pid == 0) /* set breakpoint here */
+ printf ("I am the child\n");
+ else
+ printf ("I am the parent\n");
+
+ chdir (".");
+ ++x; /* set exit breakpoint here */
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/foll-fork-syscall.exp b/gdb/testsuite/gdb.base/foll-fork-syscall.exp
new file mode 100644
index 0000000..21ef334
--- /dev/null
+++ b/gdb/testsuite/gdb.base/foll-fork-syscall.exp
@@ -0,0 +1,143 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test catching syscalls with all permutations of follow-fork parent/child
+# and detach-on-fork on/off.
+
+# Test relies on checking follow-fork output. Do not run if gdb debug is
+# enabled because it will be redirected to the log.
+require !gdb_debug_enabled
+require {is_any_target "i?86-*-*" "x86_64-*-*"}
+require allow_fork_tests
+
+standard_testfile
+
+if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
+ return -1
+}
+
+proc setup_gdb {} {
+ global testfile
+
+ clean_restart $testfile
+
+ if {![runto_main]} {
+ return false
+ }
+
+ # Set a breakpoint after the fork is "complete."
+ if {![gdb_breakpoint [gdb_get_line_number "set breakpoint here"]]} {
+ return false
+ }
+
+ # Set exit breakpoint (to prevent inferior from exiting).
+ if {![gdb_breakpoint [gdb_get_line_number "set exit breakpoint here"]]} {
+ return false
+ }
+ return true
+}
+
+# Check that fork catchpoints are supported, as an indicator for whether
+# fork-following is supported. Return 1 if they are, else 0.
+
+proc_with_prefix check_fork_catchpoints {} {
+ global gdb_prompt
+
+ if { ![setup_gdb] } {
+ return false
+ }
+
+ # Verify that the system supports "catch fork".
+ gdb_test "catch fork" "Catchpoint \[0-9\]* \\(fork\\)" "insert first fork catchpoint"
+ set has_fork_catchpoints false
+ gdb_test_multiple "continue" "continue to first fork catchpoint" {
+ -re ".*Your system does not support this type\r\nof catchpoint.*$gdb_prompt $" {
+ unsupported "continue to first fork catchpoint"
+ }
+ -re ".*Catchpoint.*$gdb_prompt $" {
+ set has_fork_catchpoints true
+ pass "continue to first fork catchpoint"
+ }
+ }
+
+ return $has_fork_catchpoints
+}
+
+proc_with_prefix test_catch_syscall {follow-fork-mode detach-on-fork} {
+ # Start with shiny new gdb instance.
+ if {![setup_gdb]} {
+ return
+ }
+
+ # The "Detaching..." and "Attaching..." messages may be hidden by
+ # default.
+ gdb_test_no_output "set verbose"
+
+ # Setup modes to test.
+ gdb_test_no_output "set follow-fork-mode ${follow-fork-mode}"
+ gdb_test_no_output "set detach-on-fork ${detach-on-fork}"
+
+ gdb_test "catch fork" "Catchpoint . \\(fork\\)"
+ gdb_test "catch syscall chdir" "Catchpoint . \\(syscall 'chdir'.*\\)"
+
+ # Which inferior we're expecting to follow. Assuming the parent
+ # will be inferior #1, and the child will be inferior #2.
+ if {${follow-fork-mode} == "parent"} {
+ set following_inf 1
+ } else {
+ set followin_inf 2
+ }
+ # Next stop should be the fork catchpoint.
+ set expected_re ""
+ append expected_re "Catchpoint . \\(forked process.*"
+ gdb_test "continue" $expected_re "continue to fork catchpoint"
+
+ # Next stop should be the breakpoint after the fork.
+ set expected_re ".*"
+ if {${follow-fork-mode} == "child" || ${detach-on-fork} == "off"} {
+ append expected_re "\\\[New inferior.*"
+ }
+ if {${detach-on-fork} == "on"} {
+ append expected_re "\\\[Detaching after fork from "
+ if {${follow-fork-mode} == "parent"} {
+ append expected_re "child"
+ } else {
+ append expected_re "parent"
+ }
+ append expected_re " process.*"
+ }
+ append expected_re "Breakpoint .*set breakpoint here.*"
+ gdb_test "continue" $expected_re "continue to breakpoint after fork"
+
+ # Next stop should be the syscall catchpoint.
+ set expected_re ".*Catchpoint . \\(call to syscall chdir\\).*"
+ gdb_test continue $expected_re "continue to chdir syscall"
+}
+
+# Check for follow-fork support.
+if {![check_fork_catchpoints]} {
+ untested "follow-fork not supported"
+ return
+}
+
+# Test all permutations.
+foreach_with_prefix follow-fork-mode {"parent" "child"} {
+
+ # Do not run tests when not detaching from the parent.
+ # See breakpoints/13457 for discussion.
+ foreach_with_prefix detach-on-fork {"on"} {
+ test_catch_syscall ${follow-fork-mode} ${detach-on-fork}
+ }
+}
diff --git a/gdb/testsuite/gdb.base/foll-fork.exp b/gdb/testsuite/gdb.base/foll-fork.exp
index 0d801f0..470f651 100644
--- a/gdb/testsuite/gdb.base/foll-fork.exp
+++ b/gdb/testsuite/gdb.base/foll-fork.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,6 +17,8 @@
# enabled as it will be redirected to the log.
require !gdb_debug_enabled
+require allow_fork_tests
+
standard_testfile
if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
@@ -65,8 +67,8 @@ proc_with_prefix check_fork_catchpoints {} {
# the followed process stops where it is expected to stop, that processes
# are detached (or not) as expected, and that the inferior list has the
# expected contents after following the fork. WHO is the argument to
-# the 'set follow-fork-mode' command, DETACH is the argument to the
-# 'set detach-on-fork' command, and CMD is the GDB command used to
+# the 'set follow-fork-mode' command, DETACH is the argument to the
+# 'set detach-on-fork' command, and CMD is the GDB command used to
# execute the program past the fork. If the value of WHO or DETACH is
# 'default', the corresponding GDB command is skipped for that test.
# The value of CMD must be either 'next 2' or 'continue'.
diff --git a/gdb/testsuite/gdb.base/foll-vfork-exit.c b/gdb/testsuite/gdb.base/foll-vfork-exit.c
index 5f8871d..5085a18 100644
--- a/gdb/testsuite/gdb.base/foll-vfork-exit.c
+++ b/gdb/testsuite/gdb.base/foll-vfork-exit.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1997-2024 Free Software Foundation, Inc.
+ Copyright 1997-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/foll-vfork.c b/gdb/testsuite/gdb.base/foll-vfork.c
index 6a4d105..32a4c79 100644
--- a/gdb/testsuite/gdb.base/foll-vfork.c
+++ b/gdb/testsuite/gdb.base/foll-vfork.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1997-2024 Free Software Foundation, Inc.
+ Copyright 1997-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp
index 6736303..a480b93 100644
--- a/gdb/testsuite/gdb.base/foll-vfork.exp
+++ b/gdb/testsuite/gdb.base/foll-vfork.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,12 +18,7 @@
# either execs or exits --- since those events take somewhat different
# code paths in GDB, both variants are exercised.
-# Until "set follow-fork-mode" and "catch vfork" are implemented on
-# other targets...
-#
-if {![istarget "*-linux*"]} {
- continue
-}
+require allow_fork_tests
standard_testfile .c -exit.c vforked-prog.c
@@ -58,7 +53,7 @@ if { [is_remote target] } {
proc setup_gdb { binfile srcfile } {
clean_restart $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return -code return
}
diff --git a/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen-shlib.c b/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen-shlib.c
index 67c8e99..26ecf57 100644
--- a/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen-shlib.c
+++ b/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen-shlib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.c b/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.c
index e6530af..f3921d0 100644
--- a/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.c
+++ b/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.exp b/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.exp
index de339c5..cb49ef6 100644
--- a/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.exp
+++ b/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@
# in the source of the shlib, and "list" should display the source where
# the program stopped.
+require allow_fork_tests
require allow_shlib_tests
standard_testfile .c -shlib.c
@@ -40,7 +41,8 @@ if { [build_executable "failed to prepare" ${testfile} ${srcfile} $opts] } {
}
proc do_test {} {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
gdb_locate_shlib $::shlib_path
gdb_test_no_output "set follow-fork-mode child"
gdb_test_no_output "set detach-on-fork off"
diff --git a/gdb/testsuite/gdb.base/fork-print-inferior-events.c b/gdb/testsuite/gdb.base/fork-print-inferior-events.c
index 94fb903..831f039 100644
--- a/gdb/testsuite/gdb.base/fork-print-inferior-events.c
+++ b/gdb/testsuite/gdb.base/fork-print-inferior-events.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/fork-print-inferior-events.exp b/gdb/testsuite/gdb.base/fork-print-inferior-events.exp
index 9e8c98d..0c6ad87 100644
--- a/gdb/testsuite/gdb.base/fork-print-inferior-events.exp
+++ b/gdb/testsuite/gdb.base/fork-print-inferior-events.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,6 +19,8 @@
# inferior-events [on,off]', 'set follow-fork-mode [child,parent]' and
# 'set detach-on-fork [on,off]' are the correct ones.
+require allow_fork_tests
+
# This test relies on "run", so it cannot run on target remote stubs.
require !use_gdb_stub
@@ -71,7 +73,8 @@ set i 0
foreach_with_prefix print_inferior_events { "on" "off" } {
foreach_with_prefix follow_fork_mode { "child" "parent" } {
foreach_with_prefix detach_on_fork { "on" "off" } {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
gdb_test_no_output "set print inferior-events $print_inferior_events"
gdb_test_no_output "set follow-fork-mode $follow_fork_mode"
gdb_test_no_output "set detach-on-fork $detach_on_fork"
@@ -80,7 +83,7 @@ foreach_with_prefix print_inferior_events { "on" "off" } {
# Always add the "Starting program..." string so that we
# match exactly the lines we want.
set output "Starting program: $binfile\\s*\r\n${thread_db_re}${output}${thread_db_re}${exited_normally_re}"
- set i [expr $i + 1]
+ set i [expr {$i + 1}]
gdb_test "run" $output
}
}
diff --git a/gdb/testsuite/gdb.base/fork-running-state.c b/gdb/testsuite/gdb.base/fork-running-state.c
index e1446a3..d5d34fe 100644
--- a/gdb/testsuite/gdb.base/fork-running-state.c
+++ b/gdb/testsuite/gdb.base/fork-running-state.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/fork-running-state.exp b/gdb/testsuite/gdb.base/fork-running-state.exp
index de4322e..c446800 100644
--- a/gdb/testsuite/gdb.base/fork-running-state.exp
+++ b/gdb/testsuite/gdb.base/fork-running-state.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,6 +17,8 @@
# in non-stop). GDB used to miss updating the parent/child running
# states after a fork.
+require allow_fork_tests
+
standard_testfile
# The test proper.
diff --git a/gdb/testsuite/gdb.base/fortran-sym-case.c b/gdb/testsuite/gdb.base/fortran-sym-case.c
index fdc2ea6..3760b91 100644
--- a/gdb/testsuite/gdb.base/fortran-sym-case.c
+++ b/gdb/testsuite/gdb.base/fortran-sym-case.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/fortran-sym-case.exp b/gdb/testsuite/gdb.base/fortran-sym-case.exp
index f4b8985..f0c4518 100644
--- a/gdb/testsuite/gdb.base/fortran-sym-case.exp
+++ b/gdb/testsuite/gdb.base/fortran-sym-case.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/frame-args.c b/gdb/testsuite/gdb.base/frame-args.c
index 9123d1b..879ec60 100644
--- a/gdb/testsuite/gdb.base/frame-args.c
+++ b/gdb/testsuite/gdb.base/frame-args.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/frame-args.exp b/gdb/testsuite/gdb.base/frame-args.exp
index ddf8400..0daa3aa 100644
--- a/gdb/testsuite/gdb.base/frame-args.exp
+++ b/gdb/testsuite/gdb.base/frame-args.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debu
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto break_me]} {
return
diff --git a/gdb/testsuite/gdb.base/frame-info-consistent.exp b/gdb/testsuite/gdb.base/frame-info-consistent.exp
index 4f48311..b594047 100644
--- a/gdb/testsuite/gdb.base/frame-info-consistent.exp
+++ b/gdb/testsuite/gdb.base/frame-info-consistent.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -97,7 +97,8 @@ proc compare_frames {frames} {
proc test {enable} {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
gdb_test_no_output "maint frame-unwinder $enable DEBUGINFO"
diff --git a/gdb/testsuite/gdb.base/frame-selection.c b/gdb/testsuite/gdb.base/frame-selection.c
index 18a58e4..7d36c75 100644
--- a/gdb/testsuite/gdb.base/frame-selection.c
+++ b/gdb/testsuite/gdb.base/frame-selection.c
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/frame-selection.exp b/gdb/testsuite/gdb.base/frame-selection.exp
index 32ed92d..9806a59 100644
--- a/gdb/testsuite/gdb.base/frame-selection.exp
+++ b/gdb/testsuite/gdb.base/frame-selection.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -52,7 +52,7 @@ proc get_new_address { {addresses {}} } {
set elem [lindex [lsort -integer -decreasing $addresses] 0]
# Return a new address as a hex formatted string.
- return [format "%#x" [expr $elem + 0x10]]
+ return [format "%#x" [expr {$elem + 0x10}]]
}
diff --git a/gdb/testsuite/gdb.base/frame-view.c b/gdb/testsuite/gdb.base/frame-view.c
index 619335e..ae00a2f 100644
--- a/gdb/testsuite/gdb.base/frame-view.c
+++ b/gdb/testsuite/gdb.base/frame-view.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/frame-view.exp b/gdb/testsuite/gdb.base/frame-view.exp
index 705a024..34ac668 100644
--- a/gdb/testsuite/gdb.base/frame-view.exp
+++ b/gdb/testsuite/gdb.base/frame-view.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,8 @@ if { [build_executable "failed to prepare" \
# "select-frame view".
proc test_select_frame_view { with_pretty_printer } {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
if { $with_pretty_printer } {
require allow_python_tests
diff --git a/gdb/testsuite/gdb.base/frame-view.py b/gdb/testsuite/gdb.base/frame-view.py
index 7b341b4..832f348 100644
--- a/gdb/testsuite/gdb.base/frame-view.py
+++ b/gdb/testsuite/gdb.base/frame-view.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/frameapply.c b/gdb/testsuite/gdb.base/frameapply.c
index 388113c..0f1a32a 100644
--- a/gdb/testsuite/gdb.base/frameapply.c
+++ b/gdb/testsuite/gdb.base/frameapply.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/frameapply.exp b/gdb/testsuite/gdb.base/frameapply.exp
index 1d3eac9..589a922 100644
--- a/gdb/testsuite/gdb.base/frameapply.exp
+++ b/gdb/testsuite/gdb.base/frameapply.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/freebpcmd.c b/gdb/testsuite/gdb.base/freebpcmd.c
index 4d69c5b..cf749ee 100644
--- a/gdb/testsuite/gdb.base/freebpcmd.c
+++ b/gdb/testsuite/gdb.base/freebpcmd.c
@@ -1,5 +1,5 @@
/* Test program for GDB crashes while doing bp commands that continue inferior.
- Copyright 2003-2024 Free Software Foundation, Inc.
+ Copyright 2003-2025 Free Software Foundation, Inc.
This file is part of the gdb testsuite.
diff --git a/gdb/testsuite/gdb.base/freebpcmd.exp b/gdb/testsuite/gdb.base/freebpcmd.exp
index 3c6958b..90333f9 100644
--- a/gdb/testsuite/gdb.base/freebpcmd.exp
+++ b/gdb/testsuite/gdb.base/freebpcmd.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/fullname.c b/gdb/testsuite/gdb.base/fullname.c
index 8a08de0..0ea4053 100644
--- a/gdb/testsuite/gdb.base/fullname.c
+++ b/gdb/testsuite/gdb.base/fullname.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/fullname.exp b/gdb/testsuite/gdb.base/fullname.exp
index be7250e..d989a48 100644
--- a/gdb/testsuite/gdb.base/fullname.exp
+++ b/gdb/testsuite/gdb.base/fullname.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ if { [gdb_compile [standard_output_file tmp-${srcfile}] "${binfile}" executable
return -1
}
-# Unlike most GDB tests, we do not use gdb_reinitialize_dir in this script.
+# Unlike most GDB tests, we do not use gdb_reinitialize_dir in this script.
# We're testing GDB's ability to find files in other ways.
# Get the line number.
@@ -45,7 +45,8 @@ set line [gdb_get_line_number "set breakpoint 1 here"]
# Initialize GDB after getting the line number, to make sure
# symbols aren't loaded.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
set msg "set breakpoint by full path before loading symbols - built absolute"
if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}] != 0 } {
@@ -65,12 +66,13 @@ if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}]
}
# Build the test executable using a relative path.
-if { [gdb_compile [relative_filename [pwd] [standard_output_file tmp-${srcfile}]] \
+if { [gdb_compile [relative_filename [pwd] [build_standard_output_file tmp-${srcfile}]] \
"${binfile}" executable {debug}] != "" } {
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
set msg "set breakpoint by full path before loading symbols - built relative"
if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}] != 0 } {
@@ -99,7 +101,8 @@ with_cwd [standard_output_file {}] {
}
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
set msg "set breakpoint by full path before loading symbols - built other"
if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}] != 0 } {
diff --git a/gdb/testsuite/gdb.base/fullpath-expand-func.c b/gdb/testsuite/gdb.base/fullpath-expand-func.c
index 9024f60..c07b72c 100644
--- a/gdb/testsuite/gdb.base/fullpath-expand-func.c
+++ b/gdb/testsuite/gdb.base/fullpath-expand-func.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/fullpath-expand.c b/gdb/testsuite/gdb.base/fullpath-expand.c
index 781951f..614f06a 100644
--- a/gdb/testsuite/gdb.base/fullpath-expand.c
+++ b/gdb/testsuite/gdb.base/fullpath-expand.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/fullpath-expand.exp b/gdb/testsuite/gdb.base/fullpath-expand.exp
index c2ae85a..a94488f 100644
--- a/gdb/testsuite/gdb.base/fullpath-expand.exp
+++ b/gdb/testsuite/gdb.base/fullpath-expand.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ with_cwd $srcdir {
}
}
-set result [catch "exec realpath ${srcdir}/${subdir}/${srcfile2}" realsrcfile2]
+set result [catch {exec realpath ${srcdir}/${subdir}/${srcfile2}} realsrcfile2]
if { $result != 0 || $realsrcfile2 == "" } {
untested "invalid realpath of ${srcfile2}: result $result output $realsrcfile2"
return -1
diff --git a/gdb/testsuite/gdb.base/func-ptr.c b/gdb/testsuite/gdb.base/func-ptr.c
index cfb766b..d541905 100644
--- a/gdb/testsuite/gdb.base/func-ptr.c
+++ b/gdb/testsuite/gdb.base/func-ptr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/func-ptr.exp b/gdb/testsuite/gdb.base/func-ptr.exp
index c1d79b2..d2eb0bc 100644
--- a/gdb/testsuite/gdb.base/func-ptr.exp
+++ b/gdb/testsuite/gdb.base/func-ptr.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" "func-ptr" {func-ptr.c} {debug}] }
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.base/func-ptrs.c b/gdb/testsuite/gdb.base/func-ptrs.c
index 7c05895..7eddfba 100644
--- a/gdb/testsuite/gdb.base/func-ptrs.c
+++ b/gdb/testsuite/gdb.base/func-ptrs.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/func-ptrs.exp b/gdb/testsuite/gdb.base/func-ptrs.exp
index cf6da04..5532c6c 100644
--- a/gdb/testsuite/gdb.base/func-ptrs.exp
+++ b/gdb/testsuite/gdb.base/func-ptrs.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/funcargs.exp b/gdb/testsuite/gdb.base/funcargs.exp
index ac6741d..e4c3c5b 100644
--- a/gdb/testsuite/gdb.base/funcargs.exp
+++ b/gdb/testsuite/gdb.base/funcargs.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ standard_testfile
set gcc_compiled [is_c_compiler_gcc]
set compile_flags {debug nowarnings quiet}
-if [support_complex_tests] {
+if {[support_complex_tests]} {
lappend compile_flags "additional_flags=-DTEST_COMPLEX"
}
@@ -55,7 +55,7 @@ proc_with_prefix integral_args {} {
# Print each arg as a double check to see if we can print
# them here as well as with backtrace.
- gdb_test "print c" ".* = 97 'a'" "print c after run to call0a"
+ gdb_test "print c" ".* = 97 'a'" "print c after run to call0a"
gdb_test "print s" ".* = 1" "print s after run to call0a"
gdb_test "print i" ".* = 2" "print i after run to call0a"
gdb_test "print l " ".* = 3" "print l after run to call0a"
@@ -921,7 +921,7 @@ proc_with_prefix localvars_in_indirect_call { } {
gdb_breakpoint call0a
gdb_continue call0a
delete_breakpoints
-
+
# Print each arg as a double check to see if we can print
# them here as well as with backtrace.
@@ -937,9 +937,9 @@ proc_with_prefix localvars_in_indirect_call { } {
"#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
"backtrace in indirectly called function"
- #
+ #
# "finish" brings us back to main. We then will try to step through
- # the second indirect call.
+ # the second indirect call.
# On some targets (e.g. m68k) gdb will stop from the finish in midline
# of the first indirect call. This is due to stack adjustment instructions
# after the indirect call. In these cases we will step till we hit the
@@ -1032,7 +1032,7 @@ proc_with_prefix stepping_over_trampolines { } {
}
set prev_timeout $timeout
-if [istarget "mips*tx39-*"] {
+if {[istarget "mips*tx39-*"]} {
set timeout 300
} else {
set timeout 60
@@ -1083,7 +1083,7 @@ if {$allow_float_test} {
}
# Test _Complex type here if supported.
-if [support_complex_tests] {
+if {[support_complex_tests]} {
complex_args
complex_integral_args
diff --git a/gdb/testsuite/gdb.base/gcore-buffer-overflow.c b/gdb/testsuite/gdb.base/gcore-buffer-overflow.c
index a035686..f5aa937 100644
--- a/gdb/testsuite/gdb.base/gcore-buffer-overflow.c
+++ b/gdb/testsuite/gdb.base/gcore-buffer-overflow.c
@@ -1,4 +1,4 @@
-/* Copyright 2007-2024 Free Software Foundation, Inc.
+/* Copyright 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/gcore-buffer-overflow.exp b/gdb/testsuite/gdb.base/gcore-buffer-overflow.exp
index f084eb4..5a6bfe6 100644
--- a/gdb/testsuite/gdb.base/gcore-buffer-overflow.exp
+++ b/gdb/testsuite/gdb.base/gcore-buffer-overflow.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
# Start with a fresh gdb.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_test_no_output "set args ${pattern}" \
"set buffer exceeding arguments"
diff --git a/gdb/testsuite/gdb.base/gcore-memory-usage.exp b/gdb/testsuite/gdb.base/gcore-memory-usage.exp
index bd041f2..ca47ad6 100644
--- a/gdb/testsuite/gdb.base/gcore-memory-usage.exp
+++ b/gdb/testsuite/gdb.base/gcore-memory-usage.exp
@@ -47,8 +47,10 @@ proc get_mem_usage {pid prefix} {
# This proc restarts GDB, runs the inferior with the desired
# amount of memory, then checks how much memory is necessary
# to run the gcore command. It will return -1 if the gcore
-# command fails, 0 otherwise.
-proc run_test {megs} {
+# command fails, otherwise the amount of memory used by GDB
+# to generate that gcore. MAX_MEM is the maximum amount of
+# memory GDB is allowed to use, in megabytes.
+proc run_test {megs max_mem} {
with_test_prefix "$megs Mb" {
clean_restart $::testfile
@@ -71,26 +73,27 @@ proc run_test {megs} {
# Do the main part of the test: How much is the memory
# usage of GDB going to grow after using the gcore command.
- set diff_k [expr $mem_after - $mem_before]
- set diff [expr $diff_k/1024]
+ set diff_k [expr {$mem_after - $mem_before}]
+ set diff [expr {$diff_k/1024}]
verbose -log "The gcore command used $diff Mb ($diff_k Kb)"
- # The original plan was to compare to a multiple of MEGS
- # but since the requirements don't seem to go up as the
- # inferior allocated more memory, we instead just hardcode
- # 2 megs, since sometimes 1 is used.
- gdb_assert {$diff < 2} "gdb did not use too much memory"
+ gdb_assert {$diff <= $max_mem} "gdb did not use too much memory"
gdb_test_no_output "set spin=0" "Allow program to exit"
}
- return 0
+ return $diff
}
# If we couldn't create the first corefile, there's no point
-# in running the second part of the test.
-if {[run_test 4] != 0} {
+# in running the second part of the test. The maximum amount
+# of memory allowed is the same as the memory used by the
+# inferior.
+set mem_limit [run_test 4 4]
+if {$mem_limit < 0} {
return
}
# Surprisingly enough, the larger inferior doesn't seem to use
# any extra memory, it usually uses less memory. Which is good,
# it means our memory requirements aren't growing with the inferior.
-run_test 64
+# This test ensures that it remains true that a larger inferior will
+# not grow the memory requirements.
+run_test 64 $mem_limit
diff --git a/gdb/testsuite/gdb.base/gcore-relro-lib.c b/gdb/testsuite/gdb.base/gcore-relro-lib.c
index 92d6f60..31ac8dc 100644
--- a/gdb/testsuite/gdb.base/gcore-relro-lib.c
+++ b/gdb/testsuite/gdb.base/gcore-relro-lib.c
@@ -1,4 +1,4 @@
-/* Copyright 2010-2024 Free Software Foundation, Inc.
+/* Copyright 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/gcore-relro-main.c b/gdb/testsuite/gdb.base/gcore-relro-main.c
index 99bbfd6..359f304 100644
--- a/gdb/testsuite/gdb.base/gcore-relro-main.c
+++ b/gdb/testsuite/gdb.base/gcore-relro-main.c
@@ -1,4 +1,4 @@
-/* Copyright 2010-2024 Free Software Foundation, Inc.
+/* Copyright 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/gcore-relro-pie.c b/gdb/testsuite/gdb.base/gcore-relro-pie.c
index b4865ff..0c7f1d4 100644
--- a/gdb/testsuite/gdb.base/gcore-relro-pie.c
+++ b/gdb/testsuite/gdb.base/gcore-relro-pie.c
@@ -1,4 +1,4 @@
-/* Copyright 2013-2024 Free Software Foundation, Inc.
+/* Copyright 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/gcore-relro-pie.exp b/gdb/testsuite/gdb.base/gcore-relro-pie.exp
index 1bec244..a7a6e9b 100644
--- a/gdb/testsuite/gdb.base/gcore-relro-pie.exp
+++ b/gdb/testsuite/gdb.base/gcore-relro-pie.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ set gcorefile ${binfile}.gcore
set strip_program [transform strip]
remote_file host delete ${stripped_binfile}
-if [run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"] {
+if {[run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"]} {
return -1
}
@@ -38,10 +38,11 @@ if [run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"] {
set perm [file attributes ${binfile} -permissions]
file attributes ${stripped_binfile} -permissions $perm
-clean_restart ${stripped_binfile}
+clean_restart
+gdb_load $stripped_binfile
# The binary is stripped of debug info, but not minsyms.
-if ![runto break_here] {
+if {![runto break_here]} {
return -1
}
@@ -51,7 +52,8 @@ if {![gdb_gcore_cmd $gcorefile "save a corefile"]} {
# Now restart gdb with the unstripped binary and load the corefile.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_test "core ${gcorefile}" \
"Core was generated by .*" "re-load generated corefile"
diff --git a/gdb/testsuite/gdb.base/gcore-relro.exp b/gdb/testsuite/gdb.base/gcore-relro.exp
index 5f99cfb..4d3d352 100644
--- a/gdb/testsuite/gdb.base/gcore-relro.exp
+++ b/gdb/testsuite/gdb.base/gcore-relro.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,10 +34,11 @@ set objfile [standard_output_file ${testfile}.o]
}
with_test_prefix "first session" {
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
gdb_load_shlib ${binfile_lib}
- if ![runto lib] {
+ if {![runto lib]} {
return -1
}
@@ -49,7 +50,8 @@ with_test_prefix "first session" {
# Now restart gdb and load the corefile.
with_test_prefix "second session" {
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
gdb_load_shlib ${binfile_lib}
gdb_test "core ${gcorefile}" "Core was generated by .*" \
diff --git a/gdb/testsuite/gdb.base/gcore-tls-pie.c b/gdb/testsuite/gdb.base/gcore-tls-pie.c
index 4a57a07..858921a 100644
--- a/gdb/testsuite/gdb.base/gcore-tls-pie.c
+++ b/gdb/testsuite/gdb.base/gcore-tls-pie.c
@@ -1,4 +1,4 @@
-/* Copyright 2013-2024 Free Software Foundation, Inc.
+/* Copyright 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/gcore-tls-pie.exp b/gdb/testsuite/gdb.base/gcore-tls-pie.exp
index a9c1fbd..27df210 100644
--- a/gdb/testsuite/gdb.base/gcore-tls-pie.exp
+++ b/gdb/testsuite/gdb.base/gcore-tls-pie.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ set gcorefile ${binfile}.gcore
set strip_program [transform strip]
remote_file host delete ${stripped_binfile}
-if [run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"] {
+if {[run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"]} {
return -1
}
@@ -42,10 +42,11 @@ if [run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"] {
set perm [file attributes ${binfile} -permissions]
file attributes ${stripped_binfile} -permissions $perm
-clean_restart ${stripped_binfile}
+clean_restart
+gdb_load $stripped_binfile
# The binary is stripped of debug info, but not minsyms.
-if ![runto break_here] {
+if {![runto break_here]} {
return -1
}
@@ -55,7 +56,8 @@ if {![gdb_gcore_cmd $gcorefile "save a corefile"]} {
# Now restart gdb with the unstripped binary and load the corefile.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_test "core ${gcorefile}" \
"Core was generated by .*" "re-load generated corefile"
diff --git a/gdb/testsuite/gdb.base/gcore.c b/gdb/testsuite/gdb.base/gcore.c
index 9a3ac08d..bc95fa4 100644
--- a/gdb/testsuite/gdb.base/gcore.c
+++ b/gdb/testsuite/gdb.base/gcore.c
@@ -1,4 +1,4 @@
-/* Copyright 2002-2024 Free Software Foundation, Inc.
+/* Copyright 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/gcore.exp b/gdb/testsuite/gdb.base/gcore.exp
index ff4e94c..a902760 100644
--- a/gdb/testsuite/gdb.base/gcore.exp
+++ b/gdb/testsuite/gdb.base/gcore.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,6 +16,7 @@
# This file was written by Michael Snyder (msnyder@redhat.com)
# This is a test for the gdb command "generate-core-file".
+require gcore_cmd_available
standard_testfile
@@ -57,7 +58,8 @@ if {!$core_supported} {
}
# Now restart gdb and load the corefile.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
set core_loaded [gdb_core_cmd "$corefile" "re-load generated corefile"]
if { $core_loaded == -1 } {
@@ -100,7 +102,7 @@ if {![string compare $pre_corefile_sysregs $post_corefile_sysregs]} {
set post_corefile_extern_array \
[capture_command_output "print extern_array" "$print_prefix"]
-if ![string compare $pre_corefile_extern_array $post_corefile_extern_array] {
+if {![string compare $pre_corefile_extern_array $post_corefile_extern_array]} {
pass "corefile restored extern array"
} else {
fail "corefile restored extern array"
@@ -108,7 +110,7 @@ if ![string compare $pre_corefile_extern_array $post_corefile_extern_array] {
set post_corefile_static_array \
[capture_command_output "print static_array" "$print_prefix"]
-if ![string compare $pre_corefile_static_array $post_corefile_static_array] {
+if {![string compare $pre_corefile_static_array $post_corefile_static_array]} {
pass "corefile restored static array"
} else {
fail "corefile restored static array"
@@ -116,7 +118,7 @@ if ![string compare $pre_corefile_static_array $post_corefile_static_array] {
set post_corefile_uninit_array \
[capture_command_output "print un_initialized_array" "$print_prefix"]
-if ![string compare $pre_corefile_uninit_array $post_corefile_uninit_array] {
+if {![string compare $pre_corefile_uninit_array $post_corefile_uninit_array]} {
pass "corefile restored un-initialized array"
} else {
fail "corefile restored un-initialized array"
@@ -124,7 +126,7 @@ if ![string compare $pre_corefile_uninit_array $post_corefile_uninit_array] {
set post_corefile_heap_string \
[capture_command_output "print heap_string" "$print_prefix"]
-if ![string compare $pre_corefile_heap_string $post_corefile_heap_string] {
+if {![string compare $pre_corefile_heap_string $post_corefile_heap_string]} {
pass "corefile restored heap array"
} else {
fail "corefile restored heap array"
@@ -132,14 +134,14 @@ if ![string compare $pre_corefile_heap_string $post_corefile_heap_string] {
set post_corefile_local_array \
[capture_command_output "print array_func::local_array" "$print_prefix"]
-if ![string compare $pre_corefile_local_array $post_corefile_local_array] {
+if {![string compare $pre_corefile_local_array $post_corefile_local_array]} {
pass "corefile restored stack array"
} else {
fail "corefile restored stack array"
}
set post_corefile_backtrace [capture_command_output "backtrace" ""]
-if ![string compare $pre_corefile_backtrace $post_corefile_backtrace] {
+if {![string compare $pre_corefile_backtrace $post_corefile_backtrace]} {
pass "corefile restored backtrace"
} else {
fail "corefile restored backtrace"
diff --git a/gdb/testsuite/gdb.base/gcorebg.c b/gdb/testsuite/gdb.base/gcorebg.c
index f055454..43d97e3 100644
--- a/gdb/testsuite/gdb.base/gcorebg.c
+++ b/gdb/testsuite/gdb.base/gcorebg.c
@@ -1,4 +1,4 @@
-/* Copyright 2007-2024 Free Software Foundation, Inc.
+/* Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gcorebg.exp b/gdb/testsuite/gdb.base/gcorebg.exp
index 3761f22..fd9f06e 100644
--- a/gdb/testsuite/gdb.base/gcorebg.exp
+++ b/gdb/testsuite/gdb.base/gcorebg.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -46,10 +46,10 @@ proc test_body { detached } {
global binfile
global GCORE
global corefile
- global GDB_DATA_DIRECTORY
+ global GDB GDB_DATA_DIRECTORY
# We can't use gdb_test_multiple here because GDB is not started.
- set gcore_cmd $GCORE
+ set gcore_cmd "$GCORE -g $GDB"
if {$GDB_DATA_DIRECTORY ne ""} {
set gcore_cmd "$gcore_cmd -d '$GDB_DATA_DIRECTORY'"
}
diff --git a/gdb/testsuite/gdb.base/gdb-index-err.c b/gdb/testsuite/gdb.base/gdb-index-err.c
index cb8b860..4caa75a 100644
--- a/gdb/testsuite/gdb.base/gdb-index-err.c
+++ b/gdb/testsuite/gdb.base/gdb-index-err.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gdb-index-err.exp b/gdb/testsuite/gdb.base/gdb-index-err.exp
index 0f46b3e..b353836 100644
--- a/gdb/testsuite/gdb.base/gdb-index-err.exp
+++ b/gdb/testsuite/gdb.base/gdb-index-err.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -90,13 +90,15 @@ foreach_with_prefix flag { "" "-dwarf-5" } {
}
# Add the index section to the executable.
- clean_restart ${binfile}.${extension}
+ clean_restart
+ gdb_load $binfile.$extension
gdb_assert {[ensure_gdb_index ${binfile}.${extension} ${flag}] == 1} \
"add index to executable"
# Reload the executable (which now has an index), and try to
# generate and index from it. This will fail.
- clean_restart ${binfile}.${extension}
+ clean_restart
+ gdb_load $binfile.$extension
gdb_test "save gdb-index ${flag} $already_indexed_dir" \
"Error while writing index for `[string_to_regexp $binfile.$extension]': Cannot use an index to create the index" \
"try to generate an index from a binary with an index"
diff --git a/gdb/testsuite/gdb.base/gdb-sigterm-2.exp b/gdb/testsuite/gdb.base/gdb-sigterm-2.exp
index 3899e9b..f55c1ee 100644
--- a/gdb/testsuite/gdb.base/gdb-sigterm-2.exp
+++ b/gdb/testsuite/gdb.base/gdb-sigterm-2.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gdb-sigterm.c b/gdb/testsuite/gdb.base/gdb-sigterm.c
index 7c64555..f7e3455 100644
--- a/gdb/testsuite/gdb.base/gdb-sigterm.c
+++ b/gdb/testsuite/gdb.base/gdb-sigterm.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gdb-sigterm.exp b/gdb/testsuite/gdb.base/gdb-sigterm.exp
index 0f23d03..02410fd 100644
--- a/gdb/testsuite/gdb.base/gdb-sigterm.exp
+++ b/gdb/testsuite/gdb.base/gdb-sigterm.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ if { [build_executable ${testfile}.exp ${testfile} $srcfile $options] == -1 } {
proc do_test { pass } {
global testfile gdb_prompt binfile pf_prefix
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -53,7 +53,7 @@ proc do_test { pass } {
set abort 0
}
}
- if $abort {
+ if {$abort} {
verbose -log "$pf_prefix $test: did not run"
return $abort
}
diff --git a/gdb/testsuite/gdb.base/gdb1056.exp b/gdb/testsuite/gdb.base/gdb1056.exp
index 78a2f1d..0e0e4a0 100644
--- a/gdb/testsuite/gdb.base/gdb1056.exp
+++ b/gdb/testsuite/gdb.base/gdb1056.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gdb1090.c b/gdb/testsuite/gdb.base/gdb1090.c
index 602a29f..fe30e44 100644
--- a/gdb/testsuite/gdb.base/gdb1090.c
+++ b/gdb/testsuite/gdb.base/gdb1090.c
@@ -1,5 +1,5 @@
/* Test program for multi-register variable.
- Copyright 2003-2024 Free Software Foundation, Inc.
+ Copyright 2003-2025 Free Software Foundation, Inc.
This file is part of the gdb testsuite.
diff --git a/gdb/testsuite/gdb.base/gdb1090.exp b/gdb/testsuite/gdb.base/gdb1090.exp
index 447cb6f..7db8c4b 100644
--- a/gdb/testsuite/gdb.base/gdb1090.exp
+++ b/gdb/testsuite/gdb.base/gdb1090.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gdb11530.c b/gdb/testsuite/gdb.base/gdb11530.c
index 54b5b94..4d61373 100644
--- a/gdb/testsuite/gdb.base/gdb11530.c
+++ b/gdb/testsuite/gdb.base/gdb11530.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
Contributed by Pierre Muller.
diff --git a/gdb/testsuite/gdb.base/gdb11530.exp b/gdb/testsuite/gdb.base/gdb11530.exp
index 7602251..4b910ca 100644
--- a/gdb/testsuite/gdb.base/gdb11530.exp
+++ b/gdb/testsuite/gdb.base/gdb11530.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gdb11531.c b/gdb/testsuite/gdb.base/gdb11531.c
index 900f513..137e3f2 100644
--- a/gdb/testsuite/gdb.base/gdb11531.c
+++ b/gdb/testsuite/gdb.base/gdb11531.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
Contributed by Pierre Muller.
diff --git a/gdb/testsuite/gdb.base/gdb11531.exp b/gdb/testsuite/gdb.base/gdb11531.exp
index 59fc6f5..c6c5e7b 100644
--- a/gdb/testsuite/gdb.base/gdb11531.exp
+++ b/gdb/testsuite/gdb.base/gdb11531.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gdb1250.c b/gdb/testsuite/gdb.base/gdb1250.c
index c909496..f520cca 100644
--- a/gdb/testsuite/gdb.base/gdb1250.c
+++ b/gdb/testsuite/gdb.base/gdb1250.c
@@ -1,6 +1,6 @@
/* Test program for stack trace through noreturn function.
- Copyright 2003-2024 Free Software Foundation, Inc.
+ Copyright 2003-2025 Free Software Foundation, Inc.
This file is part of the gdb testsuite.
diff --git a/gdb/testsuite/gdb.base/gdb1250.exp b/gdb/testsuite/gdb.base/gdb1250.exp
index 832403a..2cabbf0 100644
--- a/gdb/testsuite/gdb.base/gdb1250.exp
+++ b/gdb/testsuite/gdb.base/gdb1250.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto abort {allow-pending}]} {
return
diff --git a/gdb/testsuite/gdb.base/gdb1555-main.c b/gdb/testsuite/gdb.base/gdb1555-main.c
index 63a73bd..c1cf1ae 100644
--- a/gdb/testsuite/gdb.base/gdb1555-main.c
+++ b/gdb/testsuite/gdb.base/gdb1555-main.c
@@ -1,6 +1,6 @@
/* Test step/next in a shared library
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/gdb1555.c b/gdb/testsuite/gdb.base/gdb1555.c
index a799ab9..355dee8 100644
--- a/gdb/testsuite/gdb.base/gdb1555.c
+++ b/gdb/testsuite/gdb.base/gdb1555.c
@@ -1,6 +1,6 @@
/* Test step/next in a shared library
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/gdb1555.exp b/gdb/testsuite/gdb.base/gdb1555.exp
index a5b2760..174c8f7 100644
--- a/gdb/testsuite/gdb.base/gdb1555.exp
+++ b/gdb/testsuite/gdb.base/gdb1555.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,8 @@ if { [gdb_compile_shlib $libsrc $libobj {debug}] != ""
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_load_shlib $libobj
if {![runto_main]} {
@@ -48,8 +49,8 @@ gdb_test_multiple "s" $name \
-re "hithere2 \\(\\) at.*${libfile}.c:\[0-9\]+\r\n\[0-9\]+.*a = 21;.*$gdb_prompt $" {
pass $name
}
- -re "0x\[0-9a-f\]+ in .* \\(\\) from /lib/ld.so.1.*$gdb_prompt $" {
- kfail "gdb/1555" $name
+ -re "0x\[0-9a-f\]+ in .* \\(\\) from /lib/ld.so.1.*$gdb_prompt $" {
+ kfail "gdb/1555" $name
}
}
@@ -60,8 +61,8 @@ gdb_test_multiple "n" $name \
-re "\[0-9\]+.*return a;.*$gdb_prompt $" {
pass $name
}
- -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\n$inferior_exited_re normally.*$gdb_prompt $" {
- kfail "gdb/1555" $name
+ -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\n$inferior_exited_re normally.*$gdb_prompt $" {
+ kfail "gdb/1555" $name
}
}
diff --git a/gdb/testsuite/gdb.base/gdb1821.c b/gdb/testsuite/gdb.base/gdb1821.c
index 6ee03f0..6f48eb3 100644
--- a/gdb/testsuite/gdb.base/gdb1821.c
+++ b/gdb/testsuite/gdb.base/gdb1821.c
@@ -1,6 +1,6 @@
/* Test printing of structure member names in gdb. PR exp/1821
- Copyright 2005-2024 Free Software Foundation, Inc.
+ Copyright 2005-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/gdb1821.exp b/gdb/testsuite/gdb.base/gdb1821.exp
index e51444c..cd9c542 100644
--- a/gdb/testsuite/gdb.base/gdb1821.exp
+++ b/gdb/testsuite/gdb.base/gdb1821.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,6 +30,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
if {![runto_main]} {
return
-}
-gdb_test "print /x bar" "{x__0 = 0x0, y__0 = 0x0, z__1 = 0x0}"
+}
+gdb_test "print /x bar" "{x__0 = 0x0, y__0 = 0x0, z__1 = 0x0}"
diff --git a/gdb/testsuite/gdb.base/gdbhistsize-history.exp b/gdb/testsuite/gdb.base/gdbhistsize-history.exp
index 8a99ba9..d73996d 100644
--- a/gdb/testsuite/gdb.base/gdbhistsize-history.exp
+++ b/gdb/testsuite/gdb.base/gdbhistsize-history.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gdbindex-stabs-dwarf.c b/gdb/testsuite/gdb.base/gdbindex-stabs-dwarf.c
index 0e17dc1..b6e3ff8 100644
--- a/gdb/testsuite/gdb.base/gdbindex-stabs-dwarf.c
+++ b/gdb/testsuite/gdb.base/gdbindex-stabs-dwarf.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gdbindex-stabs.c b/gdb/testsuite/gdb.base/gdbindex-stabs.c
index 0b6f46a..5a4a649 100644
--- a/gdb/testsuite/gdb.base/gdbindex-stabs.c
+++ b/gdb/testsuite/gdb.base/gdbindex-stabs.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gdbindex-stabs.exp b/gdb/testsuite/gdb.base/gdbindex-stabs.exp
index c3fe7e5..9becaa1 100644
--- a/gdb/testsuite/gdb.base/gdbindex-stabs.exp
+++ b/gdb/testsuite/gdb.base/gdbindex-stabs.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,8 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile_stabs}" ${objfile_stabs} object
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
# FAIL was: No line number known for stabs_function.
gdb_test "list stabs_function" " marker-here .*"
diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp
index ac9630d..11a4a23 100644
--- a/gdb/testsuite/gdb.base/gdbinit-history.exp
+++ b/gdb/testsuite/gdb.base/gdbinit-history.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -141,7 +141,7 @@ proc check_history { hist } {
if { [llength $hist_lines] == 1 } {
set pattern [lindex $hist_lines 0]
} else {
- set pattern [eval multi_line $hist_lines]
+ set pattern [multi_line {*}$hist_lines]
}
# Check the history.
diff --git a/gdb/testsuite/gdb.base/gdbvars.exp b/gdb/testsuite/gdb.base/gdbvars.exp
index 7ec7df3..7eddcdc 100644
--- a/gdb/testsuite/gdb.base/gdbvars.exp
+++ b/gdb/testsuite/gdb.base/gdbvars.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-2024 Free Software Foundation, Inc.
+# Copyright (C) 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/global-var-nested-by-dso-solib1.c b/gdb/testsuite/gdb.base/global-var-nested-by-dso-solib1.c
index c467fdb..0048db6 100644
--- a/gdb/testsuite/gdb.base/global-var-nested-by-dso-solib1.c
+++ b/gdb/testsuite/gdb.base/global-var-nested-by-dso-solib1.c
@@ -1,4 +1,4 @@
-/* Copyright 2014-2024 Free Software Foundation, Inc.
+/* Copyright 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/global-var-nested-by-dso-solib2.c b/gdb/testsuite/gdb.base/global-var-nested-by-dso-solib2.c
index aedbabc..b592ae7 100644
--- a/gdb/testsuite/gdb.base/global-var-nested-by-dso-solib2.c
+++ b/gdb/testsuite/gdb.base/global-var-nested-by-dso-solib2.c
@@ -1,4 +1,4 @@
-/* Copyright 2014-2024 Free Software Foundation, Inc.
+/* Copyright 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/global-var-nested-by-dso.c b/gdb/testsuite/gdb.base/global-var-nested-by-dso.c
index c7ce3cb..247ae9f 100644
--- a/gdb/testsuite/gdb.base/global-var-nested-by-dso.c
+++ b/gdb/testsuite/gdb.base/global-var-nested-by-dso.c
@@ -1,4 +1,4 @@
-/* Copyright 2014-2024 Free Software Foundation, Inc.
+/* Copyright 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/global-var-nested-by-dso.exp b/gdb/testsuite/gdb.base/global-var-nested-by-dso.exp
index 1b79576..480396a 100644
--- a/gdb/testsuite/gdb.base/global-var-nested-by-dso.exp
+++ b/gdb/testsuite/gdb.base/global-var-nested-by-dso.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,8 @@ if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable \
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
gdb_load_shlib $binfile_lib1
gdb_load_shlib $binfile_lib2
diff --git a/gdb/testsuite/gdb.base/gnu-debugdata.c b/gdb/testsuite/gdb.base/gnu-debugdata.c
index 1b7c13e..6366cfa 100644
--- a/gdb/testsuite/gdb.base/gnu-debugdata.c
+++ b/gdb/testsuite/gdb.base/gnu-debugdata.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gnu-debugdata.exp b/gdb/testsuite/gdb.base/gnu-debugdata.exp
index e55d113..2fabd45 100644
--- a/gdb/testsuite/gdb.base/gnu-debugdata.exp
+++ b/gdb/testsuite/gdb.base/gnu-debugdata.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
standard_testfile
-if [build_executable ${testfile}.exp $testfile] {
+if {[build_executable ${testfile}.exp $testfile]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-final.c b/gdb/testsuite/gdb.base/gnu-ifunc-final.c
index f9045f8..0d4b976 100644
--- a/gdb/testsuite/gdb.base/gnu-ifunc-final.c
+++ b/gdb/testsuite/gdb.base/gnu-ifunc-final.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-lib.c b/gdb/testsuite/gdb.base/gnu-ifunc-lib.c
index 0191182..007df1a 100644
--- a/gdb/testsuite/gdb.base/gnu-ifunc-lib.c
+++ b/gdb/testsuite/gdb.base/gnu-ifunc-lib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.c b/gdb/testsuite/gdb.base/gnu-ifunc.c
index c78bc0a..9ecfc8f 100644
--- a/gdb/testsuite/gdb.base/gnu-ifunc.c
+++ b/gdb/testsuite/gdb.base/gnu-ifunc.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.exp b/gdb/testsuite/gdb.base/gnu-ifunc.exp
index ff1d561..f134a0f 100644
--- a/gdb/testsuite/gdb.base/gnu-ifunc.exp
+++ b/gdb/testsuite/gdb.base/gnu-ifunc.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -96,7 +96,8 @@ proc_with_prefix set-break {resolver_attr resolver_debug final_debug} {
set suffix [make_binsuffix $resolver_attr $resolver_debug $final_debug]
set lib_so [standard_output_file ${libfile}-$suffix.so]
- clean_restart $binfile-$suffix
+ clean_restart
+ gdb_load $binfile-$suffix
gdb_load_shlib ${lib_so}
if {![runto_main]} {
@@ -185,6 +186,11 @@ proc_with_prefix set-break {resolver_attr resolver_debug final_debug} {
# other two locations.
gdb_test "info breakpoints" "$location\r\n.*$location\r\n$location"
}
+
+ # At one point a bug existed such that GDB would trigger an assert
+ # while restarting the inferior with ifunc breakpoints set.
+ gdb_run_cmd
+ gdb_test "" "Breakpoint $::decimal,.*final \\(\[^\r\n\]*\\).*" "restart, run until breakpoint"
}
# Misc GNU ifunc tests. For the description of RESOLVER_ATTR,
@@ -218,7 +224,8 @@ proc misc_tests {resolver_attr resolver_debug final_debug} {
# Start with a fresh gdb.
- clean_restart $binfile-$suffix
+ clean_restart
+ gdb_load $binfile-$suffix
gdb_load_shlib ${lib_so}
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.base/gnu_vector.c b/gdb/testsuite/gdb.base/gnu_vector.c
index 7007d9a..f738978 100644
--- a/gdb/testsuite/gdb.base/gnu_vector.c
+++ b/gdb/testsuite/gdb.base/gnu_vector.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gnu_vector.exp b/gdb/testsuite/gdb.base/gnu_vector.exp
index cd2bb9b..62c2003 100644
--- a/gdb/testsuite/gdb.base/gnu_vector.exp
+++ b/gdb/testsuite/gdb.base/gnu_vector.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,7 +40,8 @@ if { [do_compile {-mcpu=native}] != ""
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if { ![runto_main] } {
return -1
diff --git a/gdb/testsuite/gdb.base/gold-gdb-index-2.c b/gdb/testsuite/gdb.base/gold-gdb-index-2.c
index c72c0f0..ac0a60a 100644
--- a/gdb/testsuite/gdb.base/gold-gdb-index-2.c
+++ b/gdb/testsuite/gdb.base/gold-gdb-index-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gold-gdb-index.c b/gdb/testsuite/gdb.base/gold-gdb-index.c
index 5023a66..2bcef13 100644
--- a/gdb/testsuite/gdb.base/gold-gdb-index.c
+++ b/gdb/testsuite/gdb.base/gold-gdb-index.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gold-gdb-index.exp b/gdb/testsuite/gdb.base/gold-gdb-index.exp
index 0309dd3..c91fd3a 100644
--- a/gdb/testsuite/gdb.base/gold-gdb-index.exp
+++ b/gdb/testsuite/gdb.base/gold-gdb-index.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gold-gdb-index.h b/gdb/testsuite/gdb.base/gold-gdb-index.h
index d665fdb..a26b856 100644
--- a/gdb/testsuite/gdb.base/gold-gdb-index.h
+++ b/gdb/testsuite/gdb.base/gold-gdb-index.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/gstack.c b/gdb/testsuite/gdb.base/gstack.c
index a871670..aa5ce43 100644
--- a/gdb/testsuite/gdb.base/gstack.c
+++ b/gdb/testsuite/gdb.base/gstack.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/hashline1.exp b/gdb/testsuite/gdb.base/hashline1.exp
index e2f18b5..8e815ae 100644
--- a/gdb/testsuite/gdb.base/hashline1.exp
+++ b/gdb/testsuite/gdb.base/hashline1.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,8 @@ if { [gdb_compile $compile_name "${binfile}" executable {debug}] != "" } {
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
set bp_location [gdb_get_line_number "set breakpoint here" $new_srcfile]
diff --git a/gdb/testsuite/gdb.base/hashline2.exp b/gdb/testsuite/gdb.base/hashline2.exp
index 8a91a7d..f12b4d1 100644
--- a/gdb/testsuite/gdb.base/hashline2.exp
+++ b/gdb/testsuite/gdb.base/hashline2.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,8 @@ if { [gdb_compile $new_srcfile "${binfile}" executable {debug}] != "" } {
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
set bp_location [gdb_get_line_number "set breakpoint here" ${new_srcfile}]
diff --git a/gdb/testsuite/gdb.base/hashline3.exp b/gdb/testsuite/gdb.base/hashline3.exp
index 8686901..508f7c9 100644
--- a/gdb/testsuite/gdb.base/hashline3.exp
+++ b/gdb/testsuite/gdb.base/hashline3.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,8 @@ if { [gdb_compile $new_srcfile "${binfile}" executable {debug}] != "" } {
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
set bp_location [gdb_get_line_number "set breakpoint here" $new_srcfile]
diff --git a/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c b/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c
index 57031ac..eb9410b 100644
--- a/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c
+++ b/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported-shr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.c b/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.c
index 8808e23..fff2953 100644
--- a/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.c
+++ b/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp b/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp
index e90f352..9355ce0 100644
--- a/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp
+++ b/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,8 @@ if { [gdb_compile_shlib ${srcdir}/${subdir}/${lib_src} ${lib_so} $lib_opts] != "
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
gdb_load_shlib $lib_so
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.base/hbreak-unmapped.c b/gdb/testsuite/gdb.base/hbreak-unmapped.c
index c38538d..120c08d 100644
--- a/gdb/testsuite/gdb.base/hbreak-unmapped.c
+++ b/gdb/testsuite/gdb.base/hbreak-unmapped.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/hbreak-unmapped.exp b/gdb/testsuite/gdb.base/hbreak-unmapped.exp
index b28af6d..80c7aa8 100644
--- a/gdb/testsuite/gdb.base/hbreak-unmapped.exp
+++ b/gdb/testsuite/gdb.base/hbreak-unmapped.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/hbreak.c b/gdb/testsuite/gdb.base/hbreak.c
index 86d73cf..640e1f2 100644
--- a/gdb/testsuite/gdb.base/hbreak.c
+++ b/gdb/testsuite/gdb.base/hbreak.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/hbreak.exp b/gdb/testsuite/gdb.base/hbreak.exp
index 73a3e2a..6a9bcbe 100644
--- a/gdb/testsuite/gdb.base/hbreak.exp
+++ b/gdb/testsuite/gdb.base/hbreak.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${test} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/hbreak2.exp b/gdb/testsuite/gdb.base/hbreak2.exp
index 37c001a..65f08e2 100644
--- a/gdb/testsuite/gdb.base/hbreak2.exp
+++ b/gdb/testsuite/gdb.base/hbreak2.exp
@@ -1,4 +1,4 @@
-# Copyright 1988-2024 Free Software Foundation, Inc.
+# Copyright 1988-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -477,7 +477,7 @@ proc test_next_with_recursion {} {
delete_breakpoints
- if [istarget "mips*tx39-*"] {
+ if {[istarget "mips*tx39-*"]} {
set timeout 60
}
# We used to set timeout here for all other targets as well. This
diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp
index 056e352..ec41382 100644
--- a/gdb/testsuite/gdb.base/help.exp
+++ b/gdb/testsuite/gdb.base/help.exp
@@ -1,4 +1,4 @@
-# Copyright 1988-2024 Free Software Foundation, Inc.
+# Copyright 1988-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/history-duplicates.exp b/gdb/testsuite/gdb.base/history-duplicates.exp
index 5ac4a35..2f80ecc 100644
--- a/gdb/testsuite/gdb.base/history-duplicates.exp
+++ b/gdb/testsuite/gdb.base/history-duplicates.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/hook-stop.c b/gdb/testsuite/gdb.base/hook-stop.c
index 3e552f8..22d1c27 100644
--- a/gdb/testsuite/gdb.base/hook-stop.c
+++ b/gdb/testsuite/gdb.base/hook-stop.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/hook-stop.exp b/gdb/testsuite/gdb.base/hook-stop.exp
index 864e034..1c774ce 100644
--- a/gdb/testsuite/gdb.base/hook-stop.exp
+++ b/gdb/testsuite/gdb.base/hook-stop.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,8 @@ proc define_hook_stop {commands} {
proc setup {commands} {
global srcfile binfile
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
if {![runto_main]} {
return -code return
diff --git a/gdb/testsuite/gdb.base/huge.exp b/gdb/testsuite/gdb.base/huge.exp
index ecc4d2d..01bc9ea 100644
--- a/gdb/testsuite/gdb.base/huge.exp
+++ b/gdb/testsuite/gdb.base/huge.exp
@@ -1,4 +1,4 @@
-# Copyright 2001-2024 Free Software Foundation, Inc.
+# Copyright 2001-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,14 +23,14 @@ require {!target_info exists gdb,skip_huge_test}
standard_testfile .c
-set max [expr 2 * 1024 * 1024]
+set max [expr {2 * 1024 * 1024}]
set min 16
set opts {}
lappend opts debug
set compilation_succeeded 0
-for { set size $max } { $size >= $min } { set size [expr $size / 2] } {
+for { set size $max } { $size >= $min } { set size [expr {$size / 2}] } {
set try_opts [concat $opts [list additional_flags=-DCRASH_GDB=$size]]
if { [build_executable $testfile.exp $testfile $srcfile $try_opts] == -1 } {
continue
@@ -39,10 +39,11 @@ for { set size $max } { $size >= $min } { set size [expr $size / 2] } {
set compilation_succeeded 1
break
}
-require {expr $compilation_succeeded}
+require {expr {$compilation_succeeded}}
# Start with a fresh gdb.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
save_vars { timeout } {
set timeout 30
@@ -83,6 +84,6 @@ save_vars { timeout } {
unsupported $test
} else {
# At 56 passes with and without the fix, so use 55.
- gdb_assert {$space_used < [expr 55 * 4 * $size] } $test
+ gdb_assert {$space_used < [expr {55 * 4 * $size}] } $test
}
}
diff --git a/gdb/testsuite/gdb.base/hw-sw-break-same-address.exp b/gdb/testsuite/gdb.base/hw-sw-break-same-address.exp
index 657e55c..a342104 100644
--- a/gdb/testsuite/gdb.base/hw-sw-break-same-address.exp
+++ b/gdb/testsuite/gdb.base/hw-sw-break-same-address.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${test} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/ifelse.exp b/gdb/testsuite/gdb.base/ifelse.exp
index d91ac98..f1dc9d2 100644
--- a/gdb/testsuite/gdb.base/ifelse.exp
+++ b/gdb/testsuite/gdb.base/ifelse.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/include-main.c b/gdb/testsuite/gdb.base/include-main.c
index 6290ae0..f54e268 100644
--- a/gdb/testsuite/gdb.base/include-main.c
+++ b/gdb/testsuite/gdb.base/include-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/include-main.exp b/gdb/testsuite/gdb.base/include-main.exp
index 7247b1c..5cded4b 100644
--- a/gdb/testsuite/gdb.base/include-main.exp
+++ b/gdb/testsuite/gdb.base/include-main.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/included.c b/gdb/testsuite/gdb.base/included.c
index 4f43e61..ab8edf4 100644
--- a/gdb/testsuite/gdb.base/included.c
+++ b/gdb/testsuite/gdb.base/included.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/included.exp b/gdb/testsuite/gdb.base/included.exp
index c33d695..a125a27 100644
--- a/gdb/testsuite/gdb.base/included.exp
+++ b/gdb/testsuite/gdb.base/included.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ gdb_test_no_output "set listsize 1"
gdb_test "list -q main" ".*"
get_debug_format
-set non_dwarf [expr ! [test_debug_format "DWARF \[0-9\]"]]
+set non_dwarf [expr {! [test_debug_format "DWARF \[0-9\]"]}]
# We should be able to find the source file containing the definition,
# even though it was an included header.
diff --git a/gdb/testsuite/gdb.base/included.h b/gdb/testsuite/gdb.base/included.h
index fd8d23d..c16083a 100644
--- a/gdb/testsuite/gdb.base/included.h
+++ b/gdb/testsuite/gdb.base/included.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/index-cache-2.c b/gdb/testsuite/gdb.base/index-cache-2.c
index 27303b6..6706d5b 100644
--- a/gdb/testsuite/gdb.base/index-cache-2.c
+++ b/gdb/testsuite/gdb.base/index-cache-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/index-cache.c b/gdb/testsuite/gdb.base/index-cache.c
index 1e3b8fd..4717cfd 100644
--- a/gdb/testsuite/gdb.base/index-cache.c
+++ b/gdb/testsuite/gdb.base/index-cache.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/index-cache.exp b/gdb/testsuite/gdb.base/index-cache.exp
index e64495a..c7dbc46 100644
--- a/gdb/testsuite/gdb.base/index-cache.exp
+++ b/gdb/testsuite/gdb.base/index-cache.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,8 +29,8 @@ if { [build_executable "failed to prepare" $testfile [list $srcfile $srcfile2] \
# - the binary already has an index section
# - we use the -readnow switch
set has_index_section [exec_has_index_section $binfile]
-set uses_readnow [expr [string first "-readnow" $GDBFLAGS] != -1]
-set expecting_index_cache_use [expr !$has_index_section && !$uses_readnow]
+set uses_readnow [expr {[string first "-readnow" $GDBFLAGS] != -1}]
+set expecting_index_cache_use [expr {!$has_index_section && !$uses_readnow}]
# List the files in DIR on the host (where GDB-under-test runs).
# Return a list of two elements:
diff --git a/gdb/testsuite/gdb.base/infcall-exec.c b/gdb/testsuite/gdb.base/infcall-exec.c
index e79b4f7..769192c 100644
--- a/gdb/testsuite/gdb.base/infcall-exec.c
+++ b/gdb/testsuite/gdb.base/infcall-exec.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/infcall-exec.exp b/gdb/testsuite/gdb.base/infcall-exec.exp
index 354bdbc..b819284 100644
--- a/gdb/testsuite/gdb.base/infcall-exec.exp
+++ b/gdb/testsuite/gdb.base/infcall-exec.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,8 @@ if { [is_remote target] } {
set binfile2 [gdb_remote_download target $binfile2]
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return -1
diff --git a/gdb/testsuite/gdb.base/infcall-exec2.c b/gdb/testsuite/gdb.base/infcall-exec2.c
index 30eb2b4..9b81ef7 100644
--- a/gdb/testsuite/gdb.base/infcall-exec2.c
+++ b/gdb/testsuite/gdb.base/infcall-exec2.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/infcall-failure-2.exp b/gdb/testsuite/gdb.base/infcall-failure-2.exp
new file mode 100644
index 0000000..2a7d784
--- /dev/null
+++ b/gdb/testsuite/gdb.base/infcall-failure-2.exp
@@ -0,0 +1,37 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile infcall-failure.c
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] == -1 } {
+ return
+}
+
+if { ![runto_main] } {
+ return
+}
+
+if { ![gdb_breakpoint "*0x1" message] } {
+ return
+}
+
+gdb_test "p foo ()" \
+ [multi_line \
+ [string_to_regexp "Command aborted."] \
+ ".*" ]
+
+# Check that gdb is still responsive. Regression test for PR gdb/33068.
+gdb_test "p 1 + 1" \
+ " = 2"
diff --git a/gdb/testsuite/gdb.base/infcall-failure.c b/gdb/testsuite/gdb.base/infcall-failure.c
index f0af35d..33db345 100644
--- a/gdb/testsuite/gdb.base/infcall-failure.c
+++ b/gdb/testsuite/gdb.base/infcall-failure.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/infcall-failure.exp b/gdb/testsuite/gdb.base/infcall-failure.exp
index 8d08555..594cb2b 100644
--- a/gdb/testsuite/gdb.base/infcall-failure.exp
+++ b/gdb/testsuite/gdb.base/infcall-failure.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,7 +39,8 @@ proc start_gdb_and_runto_main { target_async target_non_stop } {
append ::GDBFLAGS \
" -ex \"maintenance set target-async ${target_async}\""
- clean_restart ${::binfile}
+ clean_restart
+ gdb_load $::binfile
}
if { ![runto_main] } {
@@ -131,7 +132,13 @@ proc_with_prefix run_cond_hits_segfault_test { async_p non_stop_p } {
[multi_line \
"Continuing\\." \
"" \
- "Program received signal SIGSEGV, Segmentation fault\\." \
+ [string cat \
+ [string_to_regexp \
+ "Program received signal SIGSEGV, Segmentation fault."] \
+ "("] \
+ [string cat \
+ [string_to_regexp "Address not mapped to object."] \
+ ")?"] \
"${::hex} in func_segfault \\(\\) at \[^\r\n\]+:${::segv_line}" \
"${::decimal}\\s+\[^\r\n\]+Segfault here\[^\r\n\]+" \
"Error in testing condition for breakpoint ${bp_1_num}:" \
@@ -161,7 +168,13 @@ proc_with_prefix run_call_hits_segfault_test { async_p non_stop_p } {
gdb_test "call func_segfault ()" \
[multi_line \
"" \
- "Program received signal SIGSEGV, Segmentation fault\\." \
+ [string cat \
+ [string_to_regexp \
+ "Program received signal SIGSEGV, Segmentation fault."] \
+ "("] \
+ [string cat \
+ [string_to_regexp "Address not mapped to object."] \
+ ")?"] \
"${::hex} in func_segfault \\(\\) at \[^\r\n\]+:${::segv_line}" \
"${::decimal}\\s+\[^\r\n\]+Segfault here\[^\r\n\]+" \
"The program being debugged was signaled while in a function called from GDB\\." \
diff --git a/gdb/testsuite/gdb.base/infcall-input.c b/gdb/testsuite/gdb.base/infcall-input.c
index 8352d39..4cf513c 100644
--- a/gdb/testsuite/gdb.base/infcall-input.c
+++ b/gdb/testsuite/gdb.base/infcall-input.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/infcall-input.exp b/gdb/testsuite/gdb.base/infcall-input.exp
index 9f86a97..dea3b85 100644
--- a/gdb/testsuite/gdb.base/infcall-input.exp
+++ b/gdb/testsuite/gdb.base/infcall-input.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/infcall-nested-structs-c++.exp b/gdb/testsuite/gdb.base/infcall-nested-structs-c++.exp
index 4fe7505..706acc4 100644
--- a/gdb/testsuite/gdb.base/infcall-nested-structs-c++.exp
+++ b/gdb/testsuite/gdb.base/infcall-nested-structs-c++.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/infcall-nested-structs-c.exp b/gdb/testsuite/gdb.base/infcall-nested-structs-c.exp
index ce0ef4a..1f76598 100644
--- a/gdb/testsuite/gdb.base/infcall-nested-structs-c.exp
+++ b/gdb/testsuite/gdb.base/infcall-nested-structs-c.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/infcall-nested-structs.c b/gdb/testsuite/gdb.base/infcall-nested-structs.c
index 242ef78..98568a3 100644
--- a/gdb/testsuite/gdb.base/infcall-nested-structs.c
+++ b/gdb/testsuite/gdb.base/infcall-nested-structs.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl b/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl
index 5d04f38..b633cf2 100644
--- a/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl
+++ b/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
# Some targets can't call functions, so don't even bother with this
# test.
-if [target_info exists gdb,cannot_call_functions] {
+if {[target_info exists gdb,cannot_call_functions]} {
unsupported "this target can not call functions"
continue
}
@@ -28,7 +28,7 @@ set float_types { tf td tld }
set complex_types { tfc tdc tldc }
set compile_flags {debug}
-if [support_complex_tests] {
+if {[support_complex_tests]} {
lappend compile_flags "additional_flags=-DTEST_COMPLEX"
lappend compile_flags "additional_flags=-Wno-psabi"
}
@@ -81,7 +81,8 @@ proc start_nested_structs_test { lang types } {
}
# Start with a fresh gdb.
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
# Make certain that the output is consistent
gdb_test_no_output "set print sevenbit-strings"
@@ -91,7 +92,7 @@ proc start_nested_structs_test { lang types } {
gdb_test_no_output "set print elements 300"
# Advance to main
- if { ![runto_main] } then {
+ if { ![runto_main] } {
return 0
}
@@ -163,7 +164,7 @@ foreach ta $int_types {
start_gdb_and_run_tests $lang $ta
}
-if [support_complex_tests] {
+if {[support_complex_tests]} {
foreach ta $complex_types {
start_gdb_and_run_tests $lang $ta
}
diff --git a/gdb/testsuite/gdb.base/infcall-timeout.c b/gdb/testsuite/gdb.base/infcall-timeout.c
index 61f64c5..934366c 100644
--- a/gdb/testsuite/gdb.base/infcall-timeout.c
+++ b/gdb/testsuite/gdb.base/infcall-timeout.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/infcall-timeout.exp b/gdb/testsuite/gdb.base/infcall-timeout.exp
index ad4dbe3..621a7b9 100644
--- a/gdb/testsuite/gdb.base/infcall-timeout.exp
+++ b/gdb/testsuite/gdb.base/infcall-timeout.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,7 +41,8 @@ proc run_test { target_async target_non_stop non_stop unwind } {
append ::GDBFLAGS \
" -ex \"maintenance set target-async ${target_async}\""
- clean_restart ${::binfile}
+ clean_restart
+ gdb_load $::binfile
}
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.base/inferior-args.c b/gdb/testsuite/gdb.base/inferior-args.c
index e06c393..faa3183 100644
--- a/gdb/testsuite/gdb.base/inferior-args.c
+++ b/gdb/testsuite/gdb.base/inferior-args.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/inferior-args.exp b/gdb/testsuite/gdb.base/inferior-args.exp
index a1977db..6ac25fc 100644
--- a/gdb/testsuite/gdb.base/inferior-args.exp
+++ b/gdb/testsuite/gdb.base/inferior-args.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,6 +17,7 @@
# This does not work on boards that don't support inferior arguments.
require {!target_info exists noargs}
+require {expr {[have_startup_shell] != -1}}
standard_testfile .c
@@ -42,7 +43,8 @@ proc do_test { method startup_with_shell inferior_args expected_results \
stub_suitable } {
global binfile hex
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
gdb_test_no_output "set startup-with-shell $startup_with_shell"
@@ -125,13 +127,13 @@ proc do_test { method startup_with_shell inferior_args expected_results \
error "invalid method $method"
}
- set argc [expr [llength $expected_results] + 1]
+ set argc [expr {[llength $expected_results] + 1}]
# Now that we are stopped at main, inspect argc/argv.
gdb_test "print argc" " = $argc"
gdb_test "print argv\[0\]" " = $hex \"\[^\r\n\]+\""
for { set i 1 } { $i < $argc } { incr i } {
- set idx [expr $i - 1]
+ set idx [expr {$i - 1}]
gdb_test "print argv\[$i\]" " = [lindex $expected_results $idx]"
}
}
@@ -168,8 +170,7 @@ lappend test_desc_list [list "test one" \
# the rest of this mess in order to avoid TCL escaping the quote for
# me. It's super important that what we send to GDB is '"' not '\"'.
set item [list "test two" false]
-set cmd [format "lappend item \{ '%c' '\\%c' \}" 34 34]
-eval $cmd
+lappend item [format { '%c' '\%c' } 34 34]
set bs "\\\\"
lappend item [list "$hex \"$bs\"\"" "$hex \"$bs$bs$bs\"\""]
lappend test_desc_list $item
@@ -211,14 +212,31 @@ lappend test_desc_list [list "test four" \
[list "$hex \"'\"" \
"$hex \"\\\\\"\""]]
-foreach desc $test_desc_list {
- lassign $desc name stub_suitable args re_list
- with_test_prefix $name {
- foreach_with_prefix set_method { "start" "starti" "run" "set args" } {
- foreach_with_prefix startup_with_shell { on off } {
- do_test $set_method $startup_with_shell $args $re_list \
- $stub_suitable
+# Run all tests in the global TEST_DESC_LIST.
+proc run_all_tests {} {
+ foreach desc $::test_desc_list {
+ lassign $desc name stub_suitable args re_list
+ with_test_prefix $name {
+ foreach_with_prefix set_method { "start" "starti" "run" "set args" } {
+ foreach_with_prefix startup_with_shell { on off } {
+ do_test $set_method $startup_with_shell $args $re_list \
+ $stub_suitable
+ }
}
}
}
}
+
+run_all_tests
+
+# For extended-remote targets, disable the packet which passes
+# inferior arguments as a single string. This changes how the vRun
+# (extended-remote only) packet works.
+if {[target_info gdb_protocol] == "extended-remote"} {
+ with_test_prefix "single-inferior-arg disabled" {
+ save_vars { GDBFLAGS } {
+ append GDBFLAGS " -ex \"set remote single-inferior-argument-feature-packet off\""
+ run_all_tests
+ }
+ }
+}
diff --git a/gdb/testsuite/gdb.base/inferior-clone.exp b/gdb/testsuite/gdb.base/inferior-clone.exp
index 4b8b772..e356421 100644
--- a/gdb/testsuite/gdb.base/inferior-clone.exp
+++ b/gdb/testsuite/gdb.base/inferior-clone.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/inferior-died.c b/gdb/testsuite/gdb.base/inferior-died.c
index 9aa5adb..f7cb9d5 100644
--- a/gdb/testsuite/gdb.base/inferior-died.c
+++ b/gdb/testsuite/gdb.base/inferior-died.c
@@ -1,6 +1,6 @@
/* Test for fork-related gdb bug
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/inferior-died.exp b/gdb/testsuite/gdb.base/inferior-died.exp
index 9fa1c99..83f500b 100644
--- a/gdb/testsuite/gdb.base/inferior-died.exp
+++ b/gdb/testsuite/gdb.base/inferior-died.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,10 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Until "set follow-fork-mode" and "catch fork" are implemented on
-# other targets...
-#
-require {istarget "*-*-linux*"}
+require allow_fork_tests
require support_displaced_stepping
@@ -28,12 +25,13 @@ if { [build_executable "failed to build" ${testfile} ${testfile}.c] } {
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"set non-stop on\""
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
}
gdb_test_no_output "set detach-on-fork off"
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/inferior-noarg.c b/gdb/testsuite/gdb.base/inferior-noarg.c
index 7b7b92a..a8d19f2 100644
--- a/gdb/testsuite/gdb.base/inferior-noarg.c
+++ b/gdb/testsuite/gdb.base/inferior-noarg.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/inferior-noarg.exp b/gdb/testsuite/gdb.base/inferior-noarg.exp
index b377742..51b9b24 100644
--- a/gdb/testsuite/gdb.base/inferior-noarg.exp
+++ b/gdb/testsuite/gdb.base/inferior-noarg.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/infnan.c b/gdb/testsuite/gdb.base/infnan.c
index 3a86843..04efda7 100644
--- a/gdb/testsuite/gdb.base/infnan.c
+++ b/gdb/testsuite/gdb.base/infnan.c
@@ -1,6 +1,6 @@
/* This test file is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/infnan.exp b/gdb/testsuite/gdb.base/infnan.exp
index cef7fba..11470f1 100644
--- a/gdb/testsuite/gdb.base/infnan.exp
+++ b/gdb/testsuite/gdb.base/infnan.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-fun-solib.c b/gdb/testsuite/gdb.base/info-fun-solib.c
index 81bb12c..4f3211c 100644
--- a/gdb/testsuite/gdb.base/info-fun-solib.c
+++ b/gdb/testsuite/gdb.base/info-fun-solib.c
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-fun.c b/gdb/testsuite/gdb.base/info-fun.c
index 987e1f9..5efdd64 100644
--- a/gdb/testsuite/gdb.base/info-fun.c
+++ b/gdb/testsuite/gdb.base/info-fun.c
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-fun.exp b/gdb/testsuite/gdb.base/info-fun.exp
index 6cd7680..884496c 100644
--- a/gdb/testsuite/gdb.base/info-fun.exp
+++ b/gdb/testsuite/gdb.base/info-fun.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.base/info-locals-unused-static-var.c b/gdb/testsuite/gdb.base/info-locals-unused-static-var.c
index 5bb1e91..324cf20 100644
--- a/gdb/testsuite/gdb.base/info-locals-unused-static-var.c
+++ b/gdb/testsuite/gdb.base/info-locals-unused-static-var.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-locals-unused-static-var.exp b/gdb/testsuite/gdb.base/info-locals-unused-static-var.exp
index de7077b..cf6b050 100644
--- a/gdb/testsuite/gdb.base/info-locals-unused-static-var.exp
+++ b/gdb/testsuite/gdb.base/info-locals-unused-static-var.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-macros.exp b/gdb/testsuite/gdb.base/info-macros.exp
index 2ace202..1e10604 100644
--- a/gdb/testsuite/gdb.base/info-macros.exp
+++ b/gdb/testsuite/gdb.base/info-macros.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug macr
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/info-os.c b/gdb/testsuite/gdb.base/info-os.c
index 122c318..3614f3b 100644
--- a/gdb/testsuite/gdb.base/info-os.c
+++ b/gdb/testsuite/gdb.base/info-os.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-os.exp b/gdb/testsuite/gdb.base/info-os.exp
index 22e9819..be7a746 100644
--- a/gdb/testsuite/gdb.base/info-os.exp
+++ b/gdb/testsuite/gdb.base/info-os.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -128,7 +128,7 @@ proc expect_multiline { command expect test } {
exp_continue
}
-re "^$gdb_prompt $" {
- if $found {
+ if {$found} {
set ok 1
}
# Exit the loop.
diff --git a/gdb/testsuite/gdb.base/info-proc.exp b/gdb/testsuite/gdb.base/info-proc.exp
index af7f1dcd..adc8894 100644
--- a/gdb/testsuite/gdb.base/info-proc.exp
+++ b/gdb/testsuite/gdb.base/info-proc.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -63,7 +63,8 @@ if {[istarget "*-*-linux*"]} {
}
set gcorefile [standard_output_file $testfile.gcore]
if {[gdb_gcore_cmd $gcorefile "save a core file"]} {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
gdb_test "core $gcorefile" "Core was generated by.*" \
"core [file tail $gcorefile]"
diff --git a/gdb/testsuite/gdb.base/info-program.c b/gdb/testsuite/gdb.base/info-program.c
index a61bc9f..c90bbb4 100644
--- a/gdb/testsuite/gdb.base/info-program.c
+++ b/gdb/testsuite/gdb.base/info-program.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-program.exp b/gdb/testsuite/gdb.base/info-program.exp
index b31985d..da24880 100644
--- a/gdb/testsuite/gdb.base/info-program.exp
+++ b/gdb/testsuite/gdb.base/info-program.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,8 @@ standard_testfile
proc do_test { threads non-stop } {
save_vars { ::GDBFLAGS } {
append ::GDBFLAGS " -ex \"set non-stop ${non-stop}\""
- clean_restart $::binfile-$threads
+ clean_restart
+ gdb_load $::binfile-$threads
}
gdb_test "info program" \
diff --git a/gdb/testsuite/gdb.base/info-shared-solib1.c b/gdb/testsuite/gdb.base/info-shared-solib1.c
index 584218b..d5f7478 100644
--- a/gdb/testsuite/gdb.base/info-shared-solib1.c
+++ b/gdb/testsuite/gdb.base/info-shared-solib1.c
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-shared-solib2.c b/gdb/testsuite/gdb.base/info-shared-solib2.c
index 7a0aa40c..ad4d1be 100644
--- a/gdb/testsuite/gdb.base/info-shared-solib2.c
+++ b/gdb/testsuite/gdb.base/info-shared-solib2.c
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-shared.c b/gdb/testsuite/gdb.base/info-shared.c
index 562e880..7d62e04 100644
--- a/gdb/testsuite/gdb.base/info-shared.c
+++ b/gdb/testsuite/gdb.base/info-shared.c
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-shared.exp b/gdb/testsuite/gdb.base/info-shared.exp
index a96dd3c..7475749 100644
--- a/gdb/testsuite/gdb.base/info-shared.exp
+++ b/gdb/testsuite/gdb.base/info-shared.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -79,9 +79,12 @@ proc check_info_shared { test expect1 expect2 } {
}
}
+# Check that "info shared" before running doesn't crash.
+check_info_shared "info sharedlibrary before running" 0 0
+
# Start the inferior, and check neither of the libraries are loaded at
# the start.
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
check_info_shared "info sharedlibrary #1" 0 0
diff --git a/gdb/testsuite/gdb.base/info-target.exp b/gdb/testsuite/gdb.base/info-target.exp
index 7dfe074..f354108 100644
--- a/gdb/testsuite/gdb.base/info-target.exp
+++ b/gdb/testsuite/gdb.base/info-target.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-types-c++.exp b/gdb/testsuite/gdb.base/info-types-c++.exp
index b0a2637..c538436 100644
--- a/gdb/testsuite/gdb.base/info-types-c++.exp
+++ b/gdb/testsuite/gdb.base/info-types-c++.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-types-c.exp b/gdb/testsuite/gdb.base/info-types-c.exp
index 7e6108c..9b363a2 100644
--- a/gdb/testsuite/gdb.base/info-types-c.exp
+++ b/gdb/testsuite/gdb.base/info-types-c.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-types.c b/gdb/testsuite/gdb.base/info-types.c
index 1e1d354..eee32d4 100644
--- a/gdb/testsuite/gdb.base/info-types.c
+++ b/gdb/testsuite/gdb.base/info-types.c
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-types.exp.tcl b/gdb/testsuite/gdb.base/info-types.exp.tcl
index 0a33afe..c05837b 100644
--- a/gdb/testsuite/gdb.base/info-types.exp.tcl
+++ b/gdb/testsuite/gdb.base/info-types.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ proc run_test { lang } {
return -1
}
- if ![runto_main] then {
+ if { ![runto_main] } {
return 0
}
diff --git a/gdb/testsuite/gdb.base/info-var-f1.c b/gdb/testsuite/gdb.base/info-var-f1.c
index 1e38bda..a4c18aa 100644
--- a/gdb/testsuite/gdb.base/info-var-f1.c
+++ b/gdb/testsuite/gdb.base/info-var-f1.c
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-var-f2.c b/gdb/testsuite/gdb.base/info-var-f2.c
index 5744571..75b4393 100644
--- a/gdb/testsuite/gdb.base/info-var-f2.c
+++ b/gdb/testsuite/gdb.base/info-var-f2.c
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-var.exp b/gdb/testsuite/gdb.base/info-var.exp
index 4a8a59d..7c2d0f7 100644
--- a/gdb/testsuite/gdb.base/info-var.exp
+++ b/gdb/testsuite/gdb.base/info-var.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info-var.h b/gdb/testsuite/gdb.base/info-var.h
index 307568d..89e5fae 100644
--- a/gdb/testsuite/gdb.base/info-var.h
+++ b/gdb/testsuite/gdb.base/info-var.h
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info_minsym.c b/gdb/testsuite/gdb.base/info_minsym.c
index 859f5dc..e380c5a 100644
--- a/gdb/testsuite/gdb.base/info_minsym.c
+++ b/gdb/testsuite/gdb.base/info_minsym.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info_minsym.exp b/gdb/testsuite/gdb.base/info_minsym.exp
index 9b0fcdf..33413ed 100644
--- a/gdb/testsuite/gdb.base/info_minsym.exp
+++ b/gdb/testsuite/gdb.base/info_minsym.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info_qt.c b/gdb/testsuite/gdb.base/info_qt.c
index 5ec4b51..47c707c 100644
--- a/gdb/testsuite/gdb.base/info_qt.c
+++ b/gdb/testsuite/gdb.base/info_qt.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info_qt.exp b/gdb/testsuite/gdb.base/info_qt.exp
index f53a620..0cf5386 100644
--- a/gdb/testsuite/gdb.base/info_qt.exp
+++ b/gdb/testsuite/gdb.base/info_qt.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info_sources.c b/gdb/testsuite/gdb.base/info_sources.c
index baedf66..fb5a1cc 100644
--- a/gdb/testsuite/gdb.base/info_sources.c
+++ b/gdb/testsuite/gdb.base/info_sources.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info_sources.exp b/gdb/testsuite/gdb.base/info_sources.exp
index 6ef711f..3340c83 100644
--- a/gdb/testsuite/gdb.base/info_sources.exp
+++ b/gdb/testsuite/gdb.base/info_sources.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -68,7 +68,7 @@ proc test_info_sources {args expect_seen_info_sources \
}
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/info_sources_2-header.h b/gdb/testsuite/gdb.base/info_sources_2-header.h
index cbf127b..cc81eb7 100644
--- a/gdb/testsuite/gdb.base/info_sources_2-header.h
+++ b/gdb/testsuite/gdb.base/info_sources_2-header.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info_sources_2-lib.c b/gdb/testsuite/gdb.base/info_sources_2-lib.c
index 832e84e..6befc8d 100644
--- a/gdb/testsuite/gdb.base/info_sources_2-lib.c
+++ b/gdb/testsuite/gdb.base/info_sources_2-lib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info_sources_2-test.c b/gdb/testsuite/gdb.base/info_sources_2-test.c
index 4d34235..8328ae9 100644
--- a/gdb/testsuite/gdb.base/info_sources_2-test.c
+++ b/gdb/testsuite/gdb.base/info_sources_2-test.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/info_sources_2.exp b/gdb/testsuite/gdb.base/info_sources_2.exp
index 90442d0..aa26140 100644
--- a/gdb/testsuite/gdb.base/info_sources_2.exp
+++ b/gdb/testsuite/gdb.base/info_sources_2.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,11 +35,12 @@ if {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable \
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
set solib_name [gdb_load_shlib $solib_name]
-if ![runto foo] {
+if {![runto foo]} {
untested "failed to run to function foo"
return -1
}
@@ -72,13 +73,18 @@ proc run_info_sources { extra_args args } {
set objfile_name ""
set source_files {}
set files {}
+ # Note below we sanitize paths so we can compare against the
+ # host_file_normalize'd paths later. Note we sanitize, but
+ # don't normalize here, as the latter would turn a relative
+ # path into an absolute path, and this testcase wants to make
+ # sure that GDB prints the absolute path.
gdb_test_multiple $cmd "" {
-re "${command_regex}\r\n" {
exp_continue
}
-re "^(\[^\r\n\]+):\r\n" {
- set objfile_name $expect_out(1,string)
+ set objfile_name [host_file_sanitize $expect_out(1,string)]
if { $is_remote_target } {
set objfile_name [file tail $objfile_name]
}
@@ -101,7 +107,7 @@ proc run_info_sources { extra_args args } {
}
-re "^(\[^,\r\n\]+), " {
- set f $expect_out(1,string)
+ set f [host_file_sanitize $expect_out(1,string)]
lappend files $f
exp_continue
}
@@ -111,7 +117,7 @@ proc run_info_sources { extra_args args } {
return
}
- set f $expect_out(1,string)
+ set f [host_file_sanitize $expect_out(1,string)]
lappend files $f
set info_sources($objfile_name) $files
set $objfile_name ""
@@ -133,7 +139,7 @@ proc run_info_sources { extra_args args } {
}
# Figure out the path for SOURCEFILE that we're looking for.
- set sourcepath [file normalize ${srcdir}/${subdir}/${sourcefile}]
+ set sourcepath [host_file_normalize ${srcdir}/${subdir}/${sourcefile}]
if { $is_remote_target } {
set objfile [file tail $objfile]
@@ -142,7 +148,7 @@ proc run_info_sources { extra_args args } {
# Make sure we handle the case where there are no source files
# associated with a particular objfile.
set source_list {}
- if [info exists info_sources($objfile)] {
+ if {[info exists info_sources($objfile)]} {
set source_list $info_sources($objfile)
}
@@ -156,32 +162,34 @@ proc run_info_sources { extra_args args } {
# The actual tests.
+set host_binfile [host_file_normalize $binfile$EXEEXT]
+
run_info_sources "" \
- ${binfile} ${srcfile} \
- ${binfile} ${testfile}-header.h \
+ ${host_binfile} ${srcfile} \
+ ${host_binfile} ${testfile}-header.h \
${solib_name} ${srcfile2} \
${solib_name} ${testfile}-header.h
run_info_sources "-basename info_sources_2" \
- ${binfile} ${srcfile} \
- ${binfile} ${testfile}-header.h \
+ ${host_binfile} ${srcfile} \
+ ${host_binfile} ${testfile}-header.h \
${solib_name} ${srcfile2} \
${solib_name} ${testfile}-header.h
run_info_sources "-basename \\.c" \
- ${binfile} ${srcfile} \
- ${binfile} !${testfile}-header.h \
+ ${host_binfile} ${srcfile} \
+ ${host_binfile} !${testfile}-header.h \
${solib_name} ${srcfile2} \
${solib_name} !${testfile}-header.h
run_info_sources "-basename -- -test\\.c" \
- ${binfile} ${srcfile} \
- ${binfile} !${testfile}-header.h \
+ ${host_binfile} ${srcfile} \
+ ${host_binfile} !${testfile}-header.h \
${solib_name} !${srcfile2} \
${solib_name} !${testfile}-header.h
run_info_sources "-basename -- -lib\\.c" \
- ${binfile} !${srcfile} \
- ${binfile} !${testfile}-header.h \
+ ${host_binfile} !${srcfile} \
+ ${host_binfile} !${testfile}-header.h \
${solib_name} ${srcfile2} \
${solib_name} !${testfile}-header.h
diff --git a/gdb/testsuite/gdb.base/info_sources_base.c b/gdb/testsuite/gdb.base/info_sources_base.c
index 3afe60c..9183a20 100644
--- a/gdb/testsuite/gdb.base/info_sources_base.c
+++ b/gdb/testsuite/gdb.base/info_sources_base.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.c b/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.c
index 3615b56..f04d0eb 100644
--- a/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.c
+++ b/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp b/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp
index e12244f..90300c8 100644
--- a/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp
+++ b/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -51,6 +51,6 @@ gdb_test "add-symbol-file $binfile 0xffff0000" \
"add symbol table from file \".*\" at.*\\(y or n\\) " "y"
# Check if we are able to read offset adjusted line information of main
-
+
gdb_test "info line main" \
"Line.*starts at address 0xffff0000.*and ends at.*"
diff --git a/gdb/testsuite/gdb.base/infoline.c b/gdb/testsuite/gdb.base/infoline.c
index c0840fe..fb37f66 100644
--- a/gdb/testsuite/gdb.base/infoline.c
+++ b/gdb/testsuite/gdb.base/infoline.c
@@ -1,4 +1,4 @@
-/* Copyright 2011-2024 Free Software Foundation, Inc.
+/* Copyright 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/infoline.exp b/gdb/testsuite/gdb.base/infoline.exp
index 67aa6e3..48b8e32 100644
--- a/gdb/testsuite/gdb.base/infoline.exp
+++ b/gdb/testsuite/gdb.base/infoline.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.c b/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.c
index c912663..d8326ef 100644
--- a/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.c
+++ b/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.exp b/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.exp
index 46561a9..7fc47af 100644
--- a/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.exp
+++ b/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.py b/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.py
index 278fa85..4ab7257 100644
--- a/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.py
+++ b/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -65,6 +65,10 @@ class TestUnwinder(Unwinder):
for reg in pending_frame.architecture().registers("general"):
val = pending_frame.read_register(reg)
+ # Having unavailable registers leads to a fall back to the standard
+ # unwinders. Don't add unavailable registers to avoid this.
+ if str(val) == "<unavailable>":
+ continue
unwinder.add_saved_register(reg, val)
return unwinder
diff --git a/gdb/testsuite/gdb.base/interact.exp b/gdb/testsuite/gdb.base/interact.exp
index 5779efc..6cf8e18 100644
--- a/gdb/testsuite/gdb.base/interact.exp
+++ b/gdb/testsuite/gdb.base/interact.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/internal-functions-ptype.exp b/gdb/testsuite/gdb.base/internal-functions-ptype.exp
index 9c77868..7bf03d8 100644
--- a/gdb/testsuite/gdb.base/internal-functions-ptype.exp
+++ b/gdb/testsuite/gdb.base/internal-functions-ptype.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/internal-string-values.c b/gdb/testsuite/gdb.base/internal-string-values.c
index 2046b56..d4e358e 100644
--- a/gdb/testsuite/gdb.base/internal-string-values.c
+++ b/gdb/testsuite/gdb.base/internal-string-values.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/internal-string-values.exp b/gdb/testsuite/gdb.base/internal-string-values.exp
index 9ecb59e..c1afa18 100644
--- a/gdb/testsuite/gdb.base/internal-string-values.exp
+++ b/gdb/testsuite/gdb.base/internal-string-values.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -250,7 +250,8 @@ proc_with_prefix test_internal_var { } {
return
}
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
if {![runto_main]} {
fail "could not run to main"
diff --git a/gdb/testsuite/gdb.base/interp.c b/gdb/testsuite/gdb.base/interp.c
index 8526473..3c41234 100644
--- a/gdb/testsuite/gdb.base/interp.c
+++ b/gdb/testsuite/gdb.base/interp.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/interp.exp b/gdb/testsuite/gdb.base/interp.exp
index 5e3488e..e6cfe77 100644
--- a/gdb/testsuite/gdb.base/interp.exp
+++ b/gdb/testsuite/gdb.base/interp.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/interpreter-exec.gdb b/gdb/testsuite/gdb.base/interpreter-exec.gdb
index 24d4bbe..5e26b6d 100644
--- a/gdb/testsuite/gdb.base/interpreter-exec.gdb
+++ b/gdb/testsuite/gdb.base/interpreter-exec.gdb
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/interrupt-a.c b/gdb/testsuite/gdb.base/interrupt-a.c
index 9b647e3..09cc014 100644
--- a/gdb/testsuite/gdb.base/interrupt-a.c
+++ b/gdb/testsuite/gdb.base/interrupt-a.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/interrupt-a.exp b/gdb/testsuite/gdb.base/interrupt-a.exp
index eabfb2b..87c856b 100644
--- a/gdb/testsuite/gdb.base/interrupt-a.exp
+++ b/gdb/testsuite/gdb.base/interrupt-a.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/interrupt-daemon-attach.c b/gdb/testsuite/gdb.base/interrupt-daemon-attach.c
index beb4089..dca6c9b 100644
--- a/gdb/testsuite/gdb.base/interrupt-daemon-attach.c
+++ b/gdb/testsuite/gdb.base/interrupt-daemon-attach.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/interrupt-daemon-attach.exp b/gdb/testsuite/gdb.base/interrupt-daemon-attach.exp
index ae81b0f..a42fc12 100644
--- a/gdb/testsuite/gdb.base/interrupt-daemon-attach.exp
+++ b/gdb/testsuite/gdb.base/interrupt-daemon-attach.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,8 @@ proc do_test {} {
# Attach to the parent, run it to a known point, extract the
# child's PID, and detach.
with_test_prefix "parent" {
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
gdb_test "attach $parent_pid" \
"Attaching to program.*, process $parent_pid.*" \
@@ -60,7 +61,8 @@ proc do_test {} {
with_test_prefix "child" {
global gdb_prompt
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
gdb_test "attach $child_pid" \
"Attaching to program.*, process $child_pid.*" \
diff --git a/gdb/testsuite/gdb.base/interrupt-daemon.c b/gdb/testsuite/gdb.base/interrupt-daemon.c
index f397f9f..4c20c34 100644
--- a/gdb/testsuite/gdb.base/interrupt-daemon.c
+++ b/gdb/testsuite/gdb.base/interrupt-daemon.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/interrupt-daemon.exp b/gdb/testsuite/gdb.base/interrupt-daemon.exp
index 8327294..aa6b675 100644
--- a/gdb/testsuite/gdb.base/interrupt-daemon.exp
+++ b/gdb/testsuite/gdb.base/interrupt-daemon.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,6 +16,8 @@
# Make sure that we can interrupt an inferior that forks and moves to
# its own session.
+require allow_fork_tests
+
standard_testfile
if {[build_executable "failed to build" $testfile $srcfile {debug}]} {
@@ -28,11 +30,12 @@ proc do_test {} {
global binfile
global gdb_prompt
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
gdb_test "set follow-fork-mode child" ".*"
- if ![runto "daemon_main"] {
+ if {![runto "daemon_main"]} {
return
}
diff --git a/gdb/testsuite/gdb.base/interrupt-noterm.c b/gdb/testsuite/gdb.base/interrupt-noterm.c
index c247c01..5d6f97e 100644
--- a/gdb/testsuite/gdb.base/interrupt-noterm.c
+++ b/gdb/testsuite/gdb.base/interrupt-noterm.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/interrupt-noterm.exp b/gdb/testsuite/gdb.base/interrupt-noterm.exp
index 399b4f6..c09a84c 100644
--- a/gdb/testsuite/gdb.base/interrupt-noterm.exp
+++ b/gdb/testsuite/gdb.base/interrupt-noterm.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,15 +15,15 @@
standard_testfile
-if [prepare_for_testing "failed to prepare for testing" \
- ${testfile} ${srcfile} {debug}] {
+if {[prepare_for_testing "failed to prepare for testing" \
+ ${testfile} ${srcfile} {debug}]} {
return -1
}
# Pretend there's no terminal.
gdb_test_no_output "set interactive-mode off"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp
index 417cf21..fef0bd9 100644
--- a/gdb/testsuite/gdb.base/interrupt.exp
+++ b/gdb/testsuite/gdb.base/interrupt.exp
@@ -1,4 +1,4 @@
-# Copyright 1994-2024 Free Software Foundation, Inc.
+# Copyright 1994-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jit-attach-pie.c b/gdb/testsuite/gdb.base/jit-attach-pie.c
index 27c6b32..7e9f1c4 100644
--- a/gdb/testsuite/gdb.base/jit-attach-pie.c
+++ b/gdb/testsuite/gdb.base/jit-attach-pie.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jit-attach-pie.exp b/gdb/testsuite/gdb.base/jit-attach-pie.exp
index d2dda69..ff71e86 100644
--- a/gdb/testsuite/gdb.base/jit-attach-pie.exp
+++ b/gdb/testsuite/gdb.base/jit-attach-pie.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jit-bfd-name.exp b/gdb/testsuite/gdb.base/jit-bfd-name.exp
index 36c82a1..723922c 100644
--- a/gdb/testsuite/gdb.base/jit-bfd-name.exp
+++ b/gdb/testsuite/gdb.base/jit-bfd-name.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -46,18 +46,19 @@ if { [compile_jit_main ${main_srcfile} ${main_binfile} {}] != 0 } {
return
}
-clean_restart $::main_binfile
+clean_restart
+gdb_load $::main_binfile
if { ![runto_main] } {
return
}
# Poke desired values directly into inferior instead of using "set
# args" because "set args" does not work under gdbserver.
-set count [expr [llength $jit_solibs_target] + 1]
+set count [expr {[llength $jit_solibs_target] + 1}]
gdb_test_no_output "set var argc=$count" "forging argc"
gdb_test_no_output "set var argv=fake_argv" "forging argv"
for {set i 1} {$i < $count} {incr i} {
- set jit_solib_target [lindex $jit_solibs_target [expr $i-1]]
+ set jit_solib_target [lindex $jit_solibs_target [expr {$i-1}]]
gdb_test_no_output "set var argv\[$i\]=\"${jit_solib_target}\"" \
"forging argv\[$i\]"
}
@@ -67,11 +68,13 @@ gdb_breakpoint [gdb_get_line_number "break here 1" $::main_srcfile]
gdb_continue_to_breakpoint "break here 1"
# Confirm that the two expected functions are available.
+set re_f1 [string_to_regexp "int jit_function_0001(void)"]
+set re_f2 [string_to_regexp "int jit_function_0002(void)"]
gdb_test "info function ^jit_function" \
[multi_line \
"File \[^\r\n\]+jit-elf-solib.c:" \
- "${decimal}:\\s+int jit_function_0001\\(\\);" \
- "${decimal}:\\s+int jit_function_0002\\(\\);"]
+ "${decimal}:\\s+$re_f1;" \
+ "${decimal}:\\s+$re_f2;"]
# Capture the addresses of each JIT symfile.
set symfile_addrs {}
@@ -121,7 +124,7 @@ set count 0
foreach addr $symfile_addrs len $symfile_lengths {
incr count
set output [standard_output_file "dump-elf-solib.${count}.so"]
- set end [expr $addr + $len]
+ set end [expr {$addr + $len}]
gdb_test_no_output "dump binary memory $output $addr $end" \
"dump jit solib $count"
@@ -138,7 +141,7 @@ foreach addr $symfile_addrs len $symfile_lengths {
set start [format 0x%x $addr]
# Calculate the end address.
- set end [format 0x%x [expr $addr + $len]]
+ set end [format 0x%x [expr {$addr + $len}]]
# This is what we expect the address range to look like in the BFD
# filename.
diff --git a/gdb/testsuite/gdb.base/jit-elf-fork-main.c b/gdb/testsuite/gdb.base/jit-elf-fork-main.c
index fd0173d..dea21c9 100644
--- a/gdb/testsuite/gdb.base/jit-elf-fork-main.c
+++ b/gdb/testsuite/gdb.base/jit-elf-fork-main.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jit-elf-fork-solib.c b/gdb/testsuite/gdb.base/jit-elf-fork-solib.c
index f98d1d1..690d7a0 100644
--- a/gdb/testsuite/gdb.base/jit-elf-fork-solib.c
+++ b/gdb/testsuite/gdb.base/jit-elf-fork-solib.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jit-elf-fork.exp b/gdb/testsuite/gdb.base/jit-elf-fork.exp
index 3fccf17..92e7dc6 100644
--- a/gdb/testsuite/gdb.base/jit-elf-fork.exp
+++ b/gdb/testsuite/gdb.base/jit-elf-fork.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,6 +15,7 @@
# Test fork handling of an inferior that has JIT-ed objfiles.
+require allow_fork_tests
require allow_shlib_tests
load_lib jit-elf-helpers.exp
@@ -53,7 +54,8 @@ if { [compile_jit_main ${main_srcfile} ${main_binfile} {}] != 0 } {
# that the callers can continue execution until there.
proc do_setup { detach-on-fork follow-fork-mode } {
- clean_restart ${::main_binfile}
+ clean_restart
+ gdb_load $::main_binfile
gdb_test_no_output "set detach-on-fork ${detach-on-fork}"
gdb_test_no_output "set follow-fork-mode ${follow-fork-mode}"
diff --git a/gdb/testsuite/gdb.base/jit-elf-main.c b/gdb/testsuite/gdb.base/jit-elf-main.c
index 7e51705..562df7a 100644
--- a/gdb/testsuite/gdb.base/jit-elf-main.c
+++ b/gdb/testsuite/gdb.base/jit-elf-main.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jit-elf-so.exp b/gdb/testsuite/gdb.base/jit-elf-so.exp
index 2759c64..a709c0c 100644
--- a/gdb/testsuite/gdb.base/jit-elf-so.exp
+++ b/gdb/testsuite/gdb.base/jit-elf-so.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -73,7 +73,8 @@ proc one_jit_test {solib_binfiles_target match_str} {
global main_loader_binfile main_loader_srcfile
global main_solib_binfile main_solib_binfile_target main_solib_srcfile
- clean_restart $main_loader_binfile
+ clean_restart
+ gdb_load $main_loader_binfile
gdb_locate_shlib $main_solib_binfile
# This is just to help debugging when things fail
@@ -101,10 +102,10 @@ proc one_jit_test {solib_binfiles_target match_str} {
# Poke desired values directly into inferior instead of using "set args"
# because "set args" does not work under gdbserver.
- gdb_test_no_output "set var argc=[expr $count + 1]" "forging argc"
+ gdb_test_no_output "set var argc=[expr {$count + 1}]" "forging argc"
gdb_test_no_output "set var argv=fake_argv" "forging argv"
for {set i 1} {$i <= $count} {incr i} {
- set binfile_target [lindex $solib_binfiles_target [expr $i-1]]
+ set binfile_target [lindex $solib_binfiles_target [expr {$i-1}]]
gdb_test_no_output "set var argv\[$i\]=\"${binfile_target}\"" \
"forging argv\[$i\]"
}
diff --git a/gdb/testsuite/gdb.base/jit-elf-solib.c b/gdb/testsuite/gdb.base/jit-elf-solib.c
index f98d1d1..c6fcb89 100644
--- a/gdb/testsuite/gdb.base/jit-elf-solib.c
+++ b/gdb/testsuite/gdb.base/jit-elf-solib.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -22,4 +22,4 @@
#error "Must define the FUNCTION_NAME macro to set a jited function name"
#endif
-int FUNCTION_NAME() { return 42; }
+int FUNCTION_NAME(void) { return 42; }
diff --git a/gdb/testsuite/gdb.base/jit-elf-util.h b/gdb/testsuite/gdb.base/jit-elf-util.h
index 13cebeb..bde2449 100644
--- a/gdb/testsuite/gdb.base/jit-elf-util.h
+++ b/gdb/testsuite/gdb.base/jit-elf-util.h
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jit-elf.exp b/gdb/testsuite/gdb.base/jit-elf.exp
index 85874fc..2ce9c77 100644
--- a/gdb/testsuite/gdb.base/jit-elf.exp
+++ b/gdb/testsuite/gdb.base/jit-elf.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -48,7 +48,8 @@ proc clean_reattach {} {
gdb_test_no_output "set var wait_for_gdb = 1"
gdb_test "detach" "Detaching from .*"
- clean_restart ${main_binfile}
+ clean_restart
+ gdb_load $main_binfile
if { ![gdb_attach $testpid \
-pattern "main.*at .*$::main_basename.c:.*"] } {
@@ -84,7 +85,8 @@ proc one_jit_test {jit_solibs_target match_str reattach} {
global test_verbose
global main_binfile main_srcfile
- clean_restart ${main_binfile}
+ clean_restart
+ gdb_load $main_binfile
# This is just to help debugging when things fail
if {$test_verbose > 0} {
@@ -101,7 +103,7 @@ proc one_jit_test {jit_solibs_target match_str reattach} {
gdb_test_no_output "set var argc=$count" "forging argc"
gdb_test_no_output "set var argv=fake_argv" "forging argv"
for {set i 1} {$i < $count} {incr i} {
- set jit_solib_target [lindex $jit_solibs_target [expr $i-1]]
+ set jit_solib_target [lindex $jit_solibs_target [expr {$i-1}]]
gdb_test_no_output "set var argv\[$i\]=\"${jit_solib_target}\"" \
"forging argv\[$i\]"
}
diff --git a/gdb/testsuite/gdb.base/jit-protocol.h b/gdb/testsuite/gdb.base/jit-protocol.h
index 3e85c19..fc53824 100644
--- a/gdb/testsuite/gdb.base/jit-protocol.h
+++ b/gdb/testsuite/gdb.base/jit-protocol.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/jit-reader-exec.c b/gdb/testsuite/gdb.base/jit-reader-exec.c
index 966ba13..a7ac4be 100644
--- a/gdb/testsuite/gdb.base/jit-reader-exec.c
+++ b/gdb/testsuite/gdb.base/jit-reader-exec.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jit-reader-exec.exp b/gdb/testsuite/gdb.base/jit-reader-exec.exp
index 06e2c90..e70f104 100644
--- a/gdb/testsuite/gdb.base/jit-reader-exec.exp
+++ b/gdb/testsuite/gdb.base/jit-reader-exec.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,7 +43,8 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.base/jit-reader-execd.c b/gdb/testsuite/gdb.base/jit-reader-execd.c
index 9eccc49..34ff03a 100644
--- a/gdb/testsuite/gdb.base/jit-reader-execd.c
+++ b/gdb/testsuite/gdb.base/jit-reader-execd.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jit-reader-host.c b/gdb/testsuite/gdb.base/jit-reader-host.c
index 359935a..a106dad 100644
--- a/gdb/testsuite/gdb.base/jit-reader-host.c
+++ b/gdb/testsuite/gdb.base/jit-reader-host.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/jit-reader-host.h b/gdb/testsuite/gdb.base/jit-reader-host.h
index da15ade..62750d5 100644
--- a/gdb/testsuite/gdb.base/jit-reader-host.h
+++ b/gdb/testsuite/gdb.base/jit-reader-host.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/jit-reader-simple-dl.c b/gdb/testsuite/gdb.base/jit-reader-simple-dl.c
index df92291..b5e2a2a 100644
--- a/gdb/testsuite/gdb.base/jit-reader-simple-dl.c
+++ b/gdb/testsuite/gdb.base/jit-reader-simple-dl.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jit-reader-simple-jit.c b/gdb/testsuite/gdb.base/jit-reader-simple-jit.c
index 42b727f..56874f8 100644
--- a/gdb/testsuite/gdb.base/jit-reader-simple-jit.c
+++ b/gdb/testsuite/gdb.base/jit-reader-simple-jit.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jit-reader-simple.c b/gdb/testsuite/gdb.base/jit-reader-simple.c
index 32f322e..8968469 100644
--- a/gdb/testsuite/gdb.base/jit-reader-simple.c
+++ b/gdb/testsuite/gdb.base/jit-reader-simple.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jit-reader-simple.exp b/gdb/testsuite/gdb.base/jit-reader-simple.exp
index f3c0125..eebab22 100644
--- a/gdb/testsuite/gdb.base/jit-reader-simple.exp
+++ b/gdb/testsuite/gdb.base/jit-reader-simple.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -103,9 +103,11 @@ proc jit_test_reread {standalone change_addr} {
with_test_prefix "initial run" {
if {$standalone} {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
} else {
- clean_restart $binfile_dl
+ clean_restart
+ gdb_load $binfile_dl
}
runto_main
@@ -124,7 +126,7 @@ proc jit_test_reread {standalone change_addr} {
# second, gdb might not reload the executable automatically.
sleep 1
- if ${change_addr} {
+ if {${change_addr}} {
set options "additional_flags=-DSPACER"
if {$standalone} {
gdb_rename_execfile $binfile ${binfile}x
@@ -153,7 +155,7 @@ proc jit_test_reread {standalone change_addr} {
"maint info breakpoints shows jit breakpoint"
}
- if ${change_addr} {
+ if {${change_addr}} {
gdb_assert {$addr_before != $addr_after} "address changed"
} else {
gdb_assert {$addr_before == $addr_after} "address didn't change"
@@ -161,7 +163,7 @@ proc jit_test_reread {standalone change_addr} {
}
foreach standalone {1 0} {
- with_test_prefix [expr ($standalone)?"standalone":"shared"] {
+ with_test_prefix [expr {($standalone)?"standalone":"shared"}] {
with_test_prefix "change addr" {
jit_test_reread $standalone 1
}
@@ -175,7 +177,8 @@ foreach standalone {1 0} {
# see JIT breakpoints defined for both.
with_test_prefix "two JITers" {
- clean_restart $binfile_dl2
+ clean_restart
+ gdb_load $binfile_dl2
if {![runto_main]} {
return -1
diff --git a/gdb/testsuite/gdb.base/jit-reader.c b/gdb/testsuite/gdb.base/jit-reader.c
index 78117f0..d3d007d 100644
--- a/gdb/testsuite/gdb.base/jit-reader.c
+++ b/gdb/testsuite/gdb.base/jit-reader.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/jit-reader.exp b/gdb/testsuite/gdb.base/jit-reader.exp
index 2a96207..cd844ca 100644
--- a/gdb/testsuite/gdb.base/jit-reader.exp
+++ b/gdb/testsuite/gdb.base/jit-reader.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -102,7 +102,8 @@ proc jit_reader_test {} {
set any "\[^\r\n\]*"
- clean_restart $jit_host_bin
+ clean_restart
+ gdb_load $jit_host_bin
gdb_load_shlib $jit_reader_bin
if {$test_verbose > 0} {
diff --git a/gdb/testsuite/gdb.base/jump-inline.c b/gdb/testsuite/gdb.base/jump-inline.c
index 8c0fcdd..a5744e5 100644
--- a/gdb/testsuite/gdb.base/jump-inline.c
+++ b/gdb/testsuite/gdb.base/jump-inline.c
@@ -1,4 +1,4 @@
-/* Copyright 2021-2024 Free Software Foundation, Inc.
+/* Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jump-inline.exp b/gdb/testsuite/gdb.base/jump-inline.exp
index ec1d2a1..7c36479 100644
--- a/gdb/testsuite/gdb.base/jump-inline.exp
+++ b/gdb/testsuite/gdb.base/jump-inline.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jump.exp b/gdb/testsuite/gdb.base/jump.exp
index 735aeeb..ee3c1c3 100644
--- a/gdb/testsuite/gdb.base/jump.exp
+++ b/gdb/testsuite/gdb.base/jump.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jump_multiple_objfiles-foo.c b/gdb/testsuite/gdb.base/jump_multiple_objfiles-foo.c
index 6f39dec..98ddb23 100755
--- a/gdb/testsuite/gdb.base/jump_multiple_objfiles-foo.c
+++ b/gdb/testsuite/gdb.base/jump_multiple_objfiles-foo.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jump_multiple_objfiles.c b/gdb/testsuite/gdb.base/jump_multiple_objfiles.c
index 7d87a28..492b415 100755
--- a/gdb/testsuite/gdb.base/jump_multiple_objfiles.c
+++ b/gdb/testsuite/gdb.base/jump_multiple_objfiles.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jump_multiple_objfiles.exp b/gdb/testsuite/gdb.base/jump_multiple_objfiles.exp
index 0c8c345..868777f 100755
--- a/gdb/testsuite/gdb.base/jump_multiple_objfiles.exp
+++ b/gdb/testsuite/gdb.base/jump_multiple_objfiles.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/jump_multiple_objfiles.h b/gdb/testsuite/gdb.base/jump_multiple_objfiles.h
index 62792df..cc82d6b 100755
--- a/gdb/testsuite/gdb.base/jump_multiple_objfiles.h
+++ b/gdb/testsuite/gdb.base/jump_multiple_objfiles.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/kill-after-signal.c b/gdb/testsuite/gdb.base/kill-after-signal.c
index 0b5ae03..50186c5 100644
--- a/gdb/testsuite/gdb.base/kill-after-signal.c
+++ b/gdb/testsuite/gdb.base/kill-after-signal.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/kill-after-signal.exp b/gdb/testsuite/gdb.base/kill-after-signal.exp
index 4293d59..de0093e 100644
--- a/gdb/testsuite/gdb.base/kill-after-signal.exp
+++ b/gdb/testsuite/gdb.base/kill-after-signal.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,13 +19,13 @@ require can_single_step_to_signal_handler
require {!target_info exists gdb,nosignals}
-if [prepare_for_testing "failed to prepare" ${testfile}] {
+if {[prepare_for_testing "failed to prepare" ${testfile}]} {
return -1
}
gdb_test "handle SIGUSR1 stop print pass" "SIGUSR1\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+.*"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.c b/gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.c
index 3aa16f5..78b0e7b 100644
--- a/gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.c
+++ b/gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.exp b/gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.exp
index 8c4f3c0..b97d2c2 100644
--- a/gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.exp
+++ b/gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,11 +19,12 @@
# commands.
require can_spawn_for_attach
+require allow_multi_inferior_tests
standard_testfile
set executable $testfile
-if [prepare_for_testing "failed to prepare" $executable] {
+if {[prepare_for_testing "failed to prepare" $executable]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/kill-during-detach.c b/gdb/testsuite/gdb.base/kill-during-detach.c
index 416150a..590bcc4 100644
--- a/gdb/testsuite/gdb.base/kill-during-detach.c
+++ b/gdb/testsuite/gdb.base/kill-during-detach.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/kill-during-detach.exp b/gdb/testsuite/gdb.base/kill-during-detach.exp
index d9ab8ee..290606a 100644
--- a/gdb/testsuite/gdb.base/kill-during-detach.exp
+++ b/gdb/testsuite/gdb.base/kill-during-detach.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -76,7 +76,8 @@ set checkpoint_line [gdb_get_line_number "Checkpoint here"]
proc run_test { exit_p checkpoint_p } {
save_vars { ::GDBFLAGS } {
append ::GDBFLAGS " -ex \"set non-stop on\""
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
}
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.base/killed-outside.c b/gdb/testsuite/gdb.base/killed-outside.c
index 706746d..f8d9c77 100644
--- a/gdb/testsuite/gdb.base/killed-outside.c
+++ b/gdb/testsuite/gdb.base/killed-outside.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/killed-outside.exp b/gdb/testsuite/gdb.base/killed-outside.exp
index 88f4afe..6cdbdb4 100644
--- a/gdb/testsuite/gdb.base/killed-outside.exp
+++ b/gdb/testsuite/gdb.base/killed-outside.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -46,9 +46,10 @@ proc test {cmds_after_kill} {
global gdb_prompt
global decimal
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
- if ![runto done] {
+ if {![runto done]} {
return
}
diff --git a/gdb/testsuite/gdb.base/label-without-address.c b/gdb/testsuite/gdb.base/label-without-address.c
index 038d8ae..37865bf 100644
--- a/gdb/testsuite/gdb.base/label-without-address.c
+++ b/gdb/testsuite/gdb.base/label-without-address.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/label-without-address.exp b/gdb/testsuite/gdb.base/label-without-address.exp
index 9d8470f..74bebd3 100644
--- a/gdb/testsuite/gdb.base/label-without-address.exp
+++ b/gdb/testsuite/gdb.base/label-without-address.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/label.exp b/gdb/testsuite/gdb.base/label.exp
index 7325789..fff16e07 100644
--- a/gdb/testsuite/gdb.base/label.exp
+++ b/gdb/testsuite/gdb.base/label.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/langs.exp b/gdb/testsuite/gdb.base/langs.exp
index 862741b..ab09d82 100644
--- a/gdb/testsuite/gdb.base/langs.exp
+++ b/gdb/testsuite/gdb.base/langs.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1997-2024 Free Software Foundation, Inc.
+# Copyright (C) 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
standard_testfile langs0.c langs1.c langs2.c
-if [is_remote host] {
+if {[is_remote host]} {
remote_download host ${srcdir}/${subdir}/langs1.f
remote_download host ${srcdir}/${subdir}/langs2.cxx
}
@@ -88,12 +88,13 @@ if {[runto csub]} {
gdb_test "show language" "currently $lang\".*" \
"show language at main"
- if [target_info exists gdb,noresults] { return }
+ if {[target_info exists gdb,noresults]} { return }
gdb_continue_to_end "first session"
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
# Try exercising the "minimal" language a bit...
@@ -101,7 +102,7 @@ if {[runto csub]} {
# Also test warn-language-frame-mismatch.
gdb_test_no_output "set warn-language-frame-mismatch off"
gdb_test_no_output "set lang minimal" "set lang to minimal"
-
+
gdb_test "print x" " = 5000" "print parameter value"
# Ensure this at least does not crash.
diff --git a/gdb/testsuite/gdb.base/langs1.f b/gdb/testsuite/gdb.base/langs1.f
index aa290d9..b89210a 100644
--- a/gdb/testsuite/gdb.base/langs1.f
+++ b/gdb/testsuite/gdb.base/langs1.f
@@ -1,4 +1,4 @@
-c Copyright (C) 1999-2024 Free Software Foundation, Inc.
+c Copyright (C) 1999-2025 Free Software Foundation, Inc.
c This program is free software; you can redistribute it and/or modify
c it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/large-frame-1.c b/gdb/testsuite/gdb.base/large-frame-1.c
index 37967bc..2f258a1 100644
--- a/gdb/testsuite/gdb.base/large-frame-1.c
+++ b/gdb/testsuite/gdb.base/large-frame-1.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/large-frame-2.c b/gdb/testsuite/gdb.base/large-frame-2.c
index c75ef67..541b180 100644
--- a/gdb/testsuite/gdb.base/large-frame-2.c
+++ b/gdb/testsuite/gdb.base/large-frame-2.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/large-frame.exp b/gdb/testsuite/gdb.base/large-frame.exp
index 5e4a204..f0d7af6 100644
--- a/gdb/testsuite/gdb.base/large-frame.exp
+++ b/gdb/testsuite/gdb.base/large-frame.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,12 +28,12 @@ if { [is_remote host] } {
# the test.
proc run_test { opt_level } {
- global srcfile srcfile2 binfile hex
+ global srcfile srcfile2 hex
standard_testfile large-frame-1.c large-frame-2.c
if {[prepare_for_testing_full "failed to prepare" \
- [list ${binfile}-${opt_level} debug \
+ [list $::testfile-$opt_level debug \
$srcfile [list debug] \
$srcfile2 [list nodebug optimize=-$opt_level]]]} {
return
diff --git a/gdb/testsuite/gdb.base/large-frame.h b/gdb/testsuite/gdb.base/large-frame.h
index 1baa1dd..881a1e8 100644
--- a/gdb/testsuite/gdb.base/large-frame.h
+++ b/gdb/testsuite/gdb.base/large-frame.h
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/ldbl_e308.c b/gdb/testsuite/gdb.base/ldbl_e308.c
index 2ebbb40..e3329e0 100644
--- a/gdb/testsuite/gdb.base/ldbl_e308.c
+++ b/gdb/testsuite/gdb.base/ldbl_e308.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/ldbl_e308.exp b/gdb/testsuite/gdb.base/ldbl_e308.exp
index 3eb313e..cb997cb 100644
--- a/gdb/testsuite/gdb.base/ldbl_e308.exp
+++ b/gdb/testsuite/gdb.base/ldbl_e308.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/libsegfault.exp b/gdb/testsuite/gdb.base/libsegfault.exp
index 61a54ff..a3883e1 100644
--- a/gdb/testsuite/gdb.base/libsegfault.exp
+++ b/gdb/testsuite/gdb.base/libsegfault.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,6 +24,15 @@
# the local machine.
require {!is_remote host}
+# On Cygwin, the testcase would somehow end up trying to preload
+# libSegFault.so into the Expect process, which would fail and crash
+# it. Since libSegFault.so is a glibc feature that doesn't exist on
+# Cygwin, just skip testing there.
+require {!expr {[isbuild "*-*-cygwin*"] && [ishost "*-*-cygwin*"]}}
+# Same when testing MinGW with MSYS2, as MSYS2 is really a Cygwin
+# fork.
+require {!expr {[isbuild "*-*-mingw*"] && [ishost "*-*-mingw*"]}}
+
# Spawn GDB with LIB preloaded with LD_PRELOAD. CMDLINE_OPTS are
# command line options passed to GDB.
diff --git a/gdb/testsuite/gdb.base/limited-length.c b/gdb/testsuite/gdb.base/limited-length.c
index c8ece16..28ac703 100644
--- a/gdb/testsuite/gdb.base/limited-length.c
+++ b/gdb/testsuite/gdb.base/limited-length.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/limited-length.exp b/gdb/testsuite/gdb.base/limited-length.exp
index 2d160e1..3b0857d 100644
--- a/gdb/testsuite/gdb.base/limited-length.exp
+++ b/gdb/testsuite/gdb.base/limited-length.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -74,7 +74,7 @@ with_test_prefix "with standard max-value size" {
# Set the max-value-size so we can only print 51 elements.
set elements 51
set int_size [get_valueof "/d" "sizeof(large_1d_array\[0\])" "*unknown*"]
-gdb_test_no_output "set max-value-size [expr $int_size * $elements]"
+gdb_test_no_output "set max-value-size [expr {$int_size * $elements}]"
with_test_prefix "with reduced max-value size" {
gdb_test "print large_1d_array" \
diff --git a/gdb/testsuite/gdb.base/line-symtabs.c b/gdb/testsuite/gdb.base/line-symtabs.c
index 8f62a1c..75b0c5b 100644
--- a/gdb/testsuite/gdb.base/line-symtabs.c
+++ b/gdb/testsuite/gdb.base/line-symtabs.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/line-symtabs.exp b/gdb/testsuite/gdb.base/line-symtabs.exp
index 9a405c3..f937b32 100644
--- a/gdb/testsuite/gdb.base/line-symtabs.exp
+++ b/gdb/testsuite/gdb.base/line-symtabs.exp
@@ -1,5 +1,5 @@
# Test handling of line symbol tables (non-primary symtabs).
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/line-symtabs.h b/gdb/testsuite/gdb.base/line-symtabs.h
index cec5553..50e51d7 100644
--- a/gdb/testsuite/gdb.base/line-symtabs.h
+++ b/gdb/testsuite/gdb.base/line-symtabs.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/line65535.c b/gdb/testsuite/gdb.base/line65535.c
index 2cef12a..5ca8402 100644
--- a/gdb/testsuite/gdb.base/line65535.c
+++ b/gdb/testsuite/gdb.base/line65535.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/line65535.exp b/gdb/testsuite/gdb.base/line65535.exp
index e2dda0a..a9cb739 100644
--- a/gdb/testsuite/gdb.base/line65535.exp
+++ b/gdb/testsuite/gdb.base/line65535.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/lineinc.exp b/gdb/testsuite/gdb.base/lineinc.exp
index df5e967..61983cc 100644
--- a/gdb/testsuite/gdb.base/lineinc.exp
+++ b/gdb/testsuite/gdb.base/lineinc.exp
@@ -1,5 +1,5 @@
# Test macro handling of #included files.
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
#
# Compiling lineinc.c with Dwarf 2 macro information will produce
# something like this:
-#
+#
# $ gcc -g3 lineinc.c -o lineinc
# $ readelf -wml lineinc
# ...
@@ -33,10 +33,10 @@
# 4 0 0 0 lineinc3.h
# ...
# Contents of the .debug_macinfo section:
-#
+#
# DW_MACINFO_start_file - lineno: 0 filenum: 1
# DW_MACINFO_define - lineno : 1 macro : __VERSION__ "3.2 20020903 (Red Hat Linux 8.0 3.2-7)"
-# DW_MACINFO_define - lineno : 2 macro : __USER_LABEL_PREFIX__
+# DW_MACINFO_define - lineno : 2 macro : __USER_LABEL_PREFIX__
# ...
# DW_MACINFO_define - lineno : 1 macro : __i386__ 1
# DW_MACINFO_define - lineno : 1 macro : __tune_i386__ 1
@@ -52,7 +52,7 @@
# DW_MACINFO_define - lineno : 2 macro : FOO 3
# DW_MACINFO_end_file
# DW_MACINFO_end_file
-# $
+# $
#
# Note how the inclusions of lineinc1.h and lineinc2.h are both
# attributed to line 10 of lineinc.c, and the #inclusion of lineinc3.h
@@ -86,7 +86,8 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" ${binfile} executable \
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
# Any command that causes GDB to read the debugging info for the
# lineinc.c compilation unit will do here.
@@ -104,7 +105,7 @@ gdb_test_multiple "break -q main" $test_name {
exp_continue
}
-re "$gdb_prompt" {
- }
+ }
timeout {
fail "$test_name (timeout)"
}
diff --git a/gdb/testsuite/gdb.base/list-ambiguous-readnow.exp b/gdb/testsuite/gdb.base/list-ambiguous-readnow.exp
index b5b79d3..82b68cc 100644
--- a/gdb/testsuite/gdb.base/list-ambiguous-readnow.exp
+++ b/gdb/testsuite/gdb.base/list-ambiguous-readnow.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/list-ambiguous.exp b/gdb/testsuite/gdb.base/list-ambiguous.exp
index ef62697..e3c821d 100644
--- a/gdb/testsuite/gdb.base/list-ambiguous.exp
+++ b/gdb/testsuite/gdb.base/list-ambiguous.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -48,8 +48,8 @@ proc test_list_ambiguous_symbol {symbol_line symbol} {
set lineno0 [gdb_get_line_number $symbol_line $srcfile]
set lineno1 [gdb_get_line_number $symbol_line $srcfile2]
- set lines0_re [line_range_pattern [expr $lineno0 - 5] [expr $lineno0 + 4]]
- set lines1_re [line_range_pattern [expr $lineno1 - 5] [expr $lineno1 + 4]]
+ set lines0_re [line_range_pattern [expr {$lineno0 - 5}] [expr {$lineno0 + 4}]]
+ set lines1_re [line_range_pattern [expr {$lineno1 - 5}] [expr {$lineno1 + 4}]]
set any "\[^\r\n\]*"
set h0_re "file: \"${any}list-ambiguous0.c\", line number: $lineno0, symbol: \"$symbol\""
diff --git a/gdb/testsuite/gdb.base/list-ambiguous0.c b/gdb/testsuite/gdb.base/list-ambiguous0.c
index db11702..bdd674c 100644
--- a/gdb/testsuite/gdb.base/list-ambiguous0.c
+++ b/gdb/testsuite/gdb.base/list-ambiguous0.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/list-ambiguous1.c b/gdb/testsuite/gdb.base/list-ambiguous1.c
index b7587df..ccf5c7b 100644
--- a/gdb/testsuite/gdb.base/list-ambiguous1.c
+++ b/gdb/testsuite/gdb.base/list-ambiguous1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/list-before-start.exp b/gdb/testsuite/gdb.base/list-before-start.exp
index 5499257..c047827 100644
--- a/gdb/testsuite/gdb.base/list-before-start.exp
+++ b/gdb/testsuite/gdb.base/list-before-start.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/list-dot-nodebug-extra.c b/gdb/testsuite/gdb.base/list-dot-nodebug-extra.c
index 58c1b64..77cff18 100644
--- a/gdb/testsuite/gdb.base/list-dot-nodebug-extra.c
+++ b/gdb/testsuite/gdb.base/list-dot-nodebug-extra.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/list-dot-nodebug.c b/gdb/testsuite/gdb.base/list-dot-nodebug.c
index 5d2a1a3..5be8099 100644
--- a/gdb/testsuite/gdb.base/list-dot-nodebug.c
+++ b/gdb/testsuite/gdb.base/list-dot-nodebug.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/list-dot-nodebug.exp b/gdb/testsuite/gdb.base/list-dot-nodebug.exp
index e15e2bd..a5bc313 100644
--- a/gdb/testsuite/gdb.base/list-dot-nodebug.exp
+++ b/gdb/testsuite/gdb.base/list-dot-nodebug.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/list-missing-source.exp b/gdb/testsuite/gdb.base/list-missing-source.exp
index 01155d8..196a1f2 100644
--- a/gdb/testsuite/gdb.base/list-missing-source.exp
+++ b/gdb/testsuite/gdb.base/list-missing-source.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,7 +43,8 @@ if { [gdb_compile "${srcfile}" "${binfile}" \
remote_file host delete $srcfile
# Now start GDB, run to main and try to list the source.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.base/list-nodebug-2.c b/gdb/testsuite/gdb.base/list-nodebug-2.c
index 861e614..747abb2 100644
--- a/gdb/testsuite/gdb.base/list-nodebug-2.c
+++ b/gdb/testsuite/gdb.base/list-nodebug-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/list-nodebug.c b/gdb/testsuite/gdb.base/list-nodebug.c
index d4ae678..8df8f3f 100644
--- a/gdb/testsuite/gdb.base/list-nodebug.c
+++ b/gdb/testsuite/gdb.base/list-nodebug.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/list-nodebug.exp b/gdb/testsuite/gdb.base/list-nodebug.exp
index e07fa9e..d92201b 100644
--- a/gdb/testsuite/gdb.base/list-nodebug.exp
+++ b/gdb/testsuite/gdb.base/list-nodebug.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp
index f628784..2da2742 100644
--- a/gdb/testsuite/gdb.base/list.exp
+++ b/gdb/testsuite/gdb.base/list.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,14 +44,14 @@ proc set_listsize { arg } {
global set_listsize_count
incr set_listsize_count
- if [gdb_test_no_output "set listsize $arg" "setting listsize to $arg #$set_listsize_count"] {
+ if {[gdb_test_no_output "set listsize $arg" "setting listsize to $arg #$set_listsize_count"]} {
return 0
}
if { $arg == 0 } {
set arg "unlimited"
}
- if [gdb_test "show listsize" "Number of source lines.* is ${arg}.*" "show listsize $arg #$set_listsize_count"] {
+ if {[gdb_test "show listsize" "Number of source lines.* is ${arg}.*" "show listsize $arg #$set_listsize_count"]} {
return 0
}
return 1
@@ -68,21 +68,21 @@ proc test_listsize {} {
# Show default size
gdb_test "show listsize" "Number of source lines gdb will list by default is 10.*" "show default list size"
-
+
# Show the default lines
gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*7\[ \t\]+x = 0;\r\n.*10\[ \t\]+foo .x\[+)\]+;)" "list default lines around main"
# Ensure we can limit printouts to one line
- if [set_listsize 1] {
+ if {[set_listsize 1]} {
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 1"
gdb_test "list 2" "2\[ \t\]+" "list line 2 with listsize 1"
- }
+ }
# Try just two lines
-
- if [ set_listsize 2 ] {
+
+ if {[ set_listsize 2 ]} {
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 1 with listsize 2"
gdb_test "list 2" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 2 with listsize 2"
gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+" "list line 3 with listsize 2"
@@ -90,7 +90,7 @@ proc test_listsize {} {
# Try small listsize > 1 that is an odd number
- if [ set_listsize 3 ] {
+ if {[ set_listsize 3 ]} {
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 1 with listsize 3"
gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 2 with listsize 3"
gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[(\]+\[)\]+\r\n4\[ \t\]+\{" "list line 3 with listsize 3"
@@ -101,7 +101,7 @@ proc test_listsize {} {
if {[set_listsize 4]} {
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 1 with listsize 4"
gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 2 with listsize 4"
-
+
gdb_test "list 3" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 3 with listsize 4"
gdb_test "list 4" "2\[ \t\]+\r\n.*5\[ \t\]+int x;.*" "list line 4 with listsize 4"
}
@@ -110,7 +110,7 @@ proc test_listsize {} {
if {[set_listsize 100]} {
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*\r\n${last_line_re}" "list line 1 with listsize 100"
-
+
gdb_test "list 10" "1\[ \t\]+#include \"list0.h\".*\r\n${last_line_re}" "list line 10 with listsize 100"
}
@@ -182,7 +182,7 @@ proc_with_prefix test_list_forward {} {
# Test that repeating the list linenum command doesn't print the same
# lines over again. Note that this test makes sure that the argument
# linenum is dropped, when we repeat the previous command. 'x/5i $pc'
-# works the same way.
+# works the same way.
proc_with_prefix test_repeat_list_command {} {
global last_line_re
@@ -227,8 +227,8 @@ proc test_list_range {} {
# gdb_test "list -100,-40" "Line number -60 out of range; .*list0.c has 39 lines." "list range; both bounds negative"
- set past_end [expr ${last_line} + 10]
- set much_past_end [expr ${past_end} + 10]
+ set past_end [expr {${last_line} + 10}]
+ set much_past_end [expr {${past_end} + 10}]
gdb_test "list 30,${past_end}" "30\[ \t\]+foo \(.*\);.*${last_line_re}" "list range; upper bound past EOF"
@@ -323,7 +323,7 @@ proc test_list_filename_and_function {} {
# Test some invalid specs
# The following test takes the FIXME result on most systems using
# DWARF. It fails to notice that main() is not in the file requested.
-
+
setup_xfail "*-*-*"
# Does this actually work ANYWHERE? I believe not, as this is an `aspect' of
@@ -369,7 +369,7 @@ proc test_forward_reverse_search {} {
# Test that GDB won't crash if the line being searched is extremely long.
set oldtimeout $timeout
- set timeout [expr "$timeout + 300"]
+ set timeout [expr {$timeout + 300}]
verbose "Timeout is now $timeout seconds" 2
gdb_test "search 1234" ".*1234.*" "search extremely long line (> 5000 chars)"
set timeout $oldtimeout
@@ -385,7 +385,8 @@ proc test_only_end {} {
proc test_list_invalid_args {} {
global binfile
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
gdb_test "list -INVALID" \
"invalid explicit location argument, \"-INVALID\"" \
"first use of \"list -INVALID\""
@@ -393,7 +394,8 @@ proc test_list_invalid_args {} {
"invalid explicit location argument, \"-INVALID\"" \
"second use of \"list -INVALID\""
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
gdb_test "list +INVALID" "Function \"\\+INVALID\" not defined." \
"first use of \"list +INVALID\""
gdb_test "list +INVALID" "Function \"\\+INVALID\" not defined." \
@@ -499,7 +501,8 @@ proc test_list {command listsize1 listsize2 linerange1 linerange2} {
with_test_prefix "$command after stop: $listsize1, $listsize2" {
global binfile
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/load-command.c b/gdb/testsuite/gdb.base/load-command.c
index b52616f..8d1d628 100644
--- a/gdb/testsuite/gdb.base/load-command.c
+++ b/gdb/testsuite/gdb.base/load-command.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/load-command.exp b/gdb/testsuite/gdb.base/load-command.exp
index 2d3656e..8111404 100644
--- a/gdb/testsuite/gdb.base/load-command.exp
+++ b/gdb/testsuite/gdb.base/load-command.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
standard_testfile
-if [gdb_protocol_is_native] {
+if {[gdb_protocol_is_native]} {
unsupported "the native target does not support the load command"
return
}
@@ -27,11 +27,11 @@ if [gdb_protocol_is_native] {
set opts {debug nopie}
-if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile $opts]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/logical.exp b/gdb/testsuite/gdb.base/logical.exp
index 18352a8..f924b09 100644
--- a/gdb/testsuite/gdb.base/logical.exp
+++ b/gdb/testsuite/gdb.base/logical.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
#
@@ -48,7 +49,7 @@ proc evaluate { vars ops } {
set var [lindex $vars $vari]
for {set opi 0} {$opi < [llength $ops]} {incr opi} {
set op [lindex [lindex $ops $opi] 0]
- set val [lindex [lindex $ops $opi] [expr $vari + 1]]
+ set val [lindex [lindex $ops $opi] [expr {$vari + 1}]]
gdb_test "print $var, $op" " = $val" "evaluate $op; variables $var; expecting $val"
}
}
diff --git a/gdb/testsuite/gdb.base/long-inferior-output.c b/gdb/testsuite/gdb.base/long-inferior-output.c
index c032190..031cb24 100644
--- a/gdb/testsuite/gdb.base/long-inferior-output.c
+++ b/gdb/testsuite/gdb.base/long-inferior-output.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/long-inferior-output.exp b/gdb/testsuite/gdb.base/long-inferior-output.exp
index db31078..90369f8 100644
--- a/gdb/testsuite/gdb.base/long-inferior-output.exp
+++ b/gdb/testsuite/gdb.base/long-inferior-output.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ require {!target_info exists gdb,noinferiorio}
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile {} {debug}] {
+if {[prepare_for_testing "failed to prepare" $testfile {} {debug}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/long_long.c b/gdb/testsuite/gdb.base/long_long.c
index e54b0e0..2775e96 100644
--- a/gdb/testsuite/gdb.base/long_long.c
+++ b/gdb/testsuite/gdb.base/long_long.c
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 1999-2024 Free Software Foundation, Inc.
+ Copyright 1999-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp
index 81ba543..2e2400b 100644
--- a/gdb/testsuite/gdb.base/long_long.exp
+++ b/gdb/testsuite/gdb.base/long_long.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,10 +30,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [con
# use this to debug:
#log_user 1
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto known_types]} {
- return
+ return
}
# Detect the size of the target's basic types.
@@ -52,7 +53,7 @@ set sizeof_long_double [get_sizeof "long double" 8]
proc pat2 { n pats } {
set i 0
while { $n > 1 } {
- set n [expr $n / 2]
+ set n [expr {$n / 2}]
incr i
}
return [lindex $pats $i]
diff --git a/gdb/testsuite/gdb.base/longest-types.c b/gdb/testsuite/gdb.base/longest-types.c
index 73fd7ab..304982b 100644
--- a/gdb/testsuite/gdb.base/longest-types.c
+++ b/gdb/testsuite/gdb.base/longest-types.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/longest-types.exp b/gdb/testsuite/gdb.base/longest-types.exp
index 4390908..5b8c16d 100644
--- a/gdb/testsuite/gdb.base/longest-types.exp
+++ b/gdb/testsuite/gdb.base/longest-types.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/longjmp-until-in-main.c b/gdb/testsuite/gdb.base/longjmp-until-in-main.c
index 2cd21aa..eb6b3f5 100644
--- a/gdb/testsuite/gdb.base/longjmp-until-in-main.c
+++ b/gdb/testsuite/gdb.base/longjmp-until-in-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/longjmp-until-in-main.exp b/gdb/testsuite/gdb.base/longjmp-until-in-main.exp
index 2e308f5..8ce647b 100644
--- a/gdb/testsuite/gdb.base/longjmp-until-in-main.exp
+++ b/gdb/testsuite/gdb.base/longjmp-until-in-main.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/longjmp.c b/gdb/testsuite/gdb.base/longjmp.c
index e3b0249..91552b4 100644
--- a/gdb/testsuite/gdb.base/longjmp.c
+++ b/gdb/testsuite/gdb.base/longjmp.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/longjmp.exp b/gdb/testsuite/gdb.base/longjmp.exp
index 00a3fcb..99552e6 100644
--- a/gdb/testsuite/gdb.base/longjmp.exp
+++ b/gdb/testsuite/gdb.base/longjmp.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
}
proc do_test { with_probes } {
- clean_restart ${::binfile}
+ clean_restart
+ gdb_load $::binfile
if { !$with_probes } {
gdb_test "maint ignore-probes libc ^longjmp$"
diff --git a/gdb/testsuite/gdb.base/macro-source-path.c b/gdb/testsuite/gdb.base/macro-source-path.c
index cf440c1..b1e9eba 100644
--- a/gdb/testsuite/gdb.base/macro-source-path.c
+++ b/gdb/testsuite/gdb.base/macro-source-path.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/macro-source-path.exp b/gdb/testsuite/gdb.base/macro-source-path.exp
index 33fb40f..9c84227 100644
--- a/gdb/testsuite/gdb.base/macro-source-path.exp
+++ b/gdb/testsuite/gdb.base/macro-source-path.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ require {!is_remote host}
# Set the current working directory to $out/cwd, so that we can test compiling
# using relative paths.
-set out_dir [standard_output_file ""]
+set out_dir [build_standard_output_file ""]
file mkdir $out_dir/cwd
file mkdir $out_dir/other
file copy -force $srcdir/$subdir/$srcfile $out_dir/cwd
@@ -53,7 +53,8 @@ proc test { src name } {
return
}
- clean_restart $binfile
+ clean_restart
+ gdb_load [host_file_normalize $binfile]
if { ![runto_main] } {
return
diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp
index 388b2fc..c275d74 100644
--- a/gdb/testsuite/gdb.base/macscp.exp
+++ b/gdb/testsuite/gdb.base/macscp.exp
@@ -1,5 +1,5 @@
# Test macro scoping.
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,8 @@ if {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${objfile}" \
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
# Ask GDB to show the current definition of MACRO, and return a list
@@ -43,7 +44,7 @@ clean_restart ${binfile}
#
# If GDB complains that it doesn't have any information about
# preprocessor macro definitions, return the string `no-macro-info'.
-#
+#
# If expect times out waiting for GDB, we return the string `timeout'.
#
# If GDB's output doesn't otherwise match what we're expecting, we
@@ -207,7 +208,7 @@ if {$macro_support == 0} {
unsupported "skipping test because debug information does not include macro information."
return 0
}
-
+
list_and_check_macro main WHERE {macscp1.c {before macscp1_3}}
list_and_check_macro macscp2_2 WHERE {macscp2.h macscp1.c {before macscp2_2}}
list_and_check_macro macscp3_2 WHERE {macscp3.h macscp1.c {before macscp3_2}}
@@ -233,10 +234,10 @@ switch -exact -- [info_macro WHERE] {
pass "info macro WHERE after `list macscp_4_2_from_macscp2'"
}
{macscp4.h macscp3.h macscp1.c {before macscp4_2_..., from macscp3.h}} {
- setup_kfail "gdb/7660" *-*-*
+ setup_kfail "gdb/7660" *-*-*
fail "info macro WHERE after `list macscp_4_2_from_macscp2' (gdb/7660)"
}
- timeout {
+ timeout {
fail "info macro WHERE after `list macscp_4_2_from_macscp2' (timeout)"
}
default { fail "info macro WHERE after `list macscp_4_2_from_macscp2'" }
@@ -248,7 +249,7 @@ switch -exact -- [info_macro WHERE] {
pass "info macro WHERE after `list macscp_4_2_from_macscp3'"
}
{macscp4.h macscp2.h macscp1.c {before macscp4_2_..., from macscp2.h}} {
- setup_kfail "gdb/7660" *-*-*
+ setup_kfail "gdb/7660" *-*-*
fail "info macro WHERE after `list macscp_4_2_from_macscp3' (gdb/7660)"
}
timeout {
@@ -359,7 +360,7 @@ for {set i 0} {$i < [llength $funcs]} {incr i} {
if {[string compare $result $expected] == 0} {
pass "info macro WHERE stopped in $func"
} elseif {[string compare $result $kfail_expected] == 0} {
- setup_kfail "gdb/7660" *-*-*
+ setup_kfail "gdb/7660" *-*-*
fail "info macro WHERE stopped in $func (gdb/7660)"
} elseif {[string compare $result timeout] == 0} {
fail "info macro WHERE stopped in $func (timeout)"
@@ -392,7 +393,7 @@ for {set i 0} {$i < [llength $funcs]} {incr i} {
switch -- [lindex $result end] {
undefined { pass $test_name }
timeout { fail "$test_name (timeout)" }
- default {
+ default {
maybe_kfail $func "$test_name"
}
}
@@ -407,7 +408,7 @@ for {set i 0} {$i < [llength $funcs]} {incr i} {
switch -- [lindex $result end] {
undefined { pass $test_name }
timeout { fail "$test_name (timeout)" }
- default {
+ default {
maybe_kfail $func "$test_name"
}
}
diff --git a/gdb/testsuite/gdb.base/main-c.exp b/gdb/testsuite/gdb.base/main-c.exp
index 2c79f0e..413b64b 100644
--- a/gdb/testsuite/gdb.base/main-c.exp
+++ b/gdb/testsuite/gdb.base/main-c.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/main-psymtab.exp b/gdb/testsuite/gdb.base/main-psymtab.exp
index cc0ca65..24227b0 100644
--- a/gdb/testsuite/gdb.base/main-psymtab.exp
+++ b/gdb/testsuite/gdb.base/main-psymtab.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/main.c b/gdb/testsuite/gdb.base/main.c
index 7b7b92a..a8d19f2 100644
--- a/gdb/testsuite/gdb.base/main.c
+++ b/gdb/testsuite/gdb.base/main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.c b/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.c
index 2551c40..f324d86 100644
--- a/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.c
+++ b/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp b/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp
index 446d7a9..aaf3a8b 100644
--- a/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp
+++ b/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.h b/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.h
index 957b6a4..763e51e 100644
--- a/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.h
+++ b/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/maint-info-inline-frames-and-blocks.c b/gdb/testsuite/gdb.base/maint-info-inline-frames-and-blocks.c
index 35b2064..f0034ef 100644
--- a/gdb/testsuite/gdb.base/maint-info-inline-frames-and-blocks.c
+++ b/gdb/testsuite/gdb.base/maint-info-inline-frames-and-blocks.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/maint-info-inline-frames-and-blocks.exp b/gdb/testsuite/gdb.base/maint-info-inline-frames-and-blocks.exp
index 97e5d99..91d0379 100644
--- a/gdb/testsuite/gdb.base/maint-info-inline-frames-and-blocks.exp
+++ b/gdb/testsuite/gdb.base/maint-info-inline-frames-and-blocks.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -201,7 +201,8 @@ gdb_test "maint info blocks" [make_blocks_result normal_func \
inline_func_a inline_func_b] \
"maint info blocks using stored \$pc, inferior still running"
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
# Use the recorded $pc value to check inline frames when the inferior
# is not executing.
diff --git a/gdb/testsuite/gdb.base/maint-info-sections.exp b/gdb/testsuite/gdb.base/maint-info-sections.exp
index da9cdd8..8b2a558 100644
--- a/gdb/testsuite/gdb.base/maint-info-sections.exp
+++ b/gdb/testsuite/gdb.base/maint-info-sections.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/maint-print-frame-id.c b/gdb/testsuite/gdb.base/maint-print-frame-id.c
index 63970ec..82891f1 100644
--- a/gdb/testsuite/gdb.base/maint-print-frame-id.c
+++ b/gdb/testsuite/gdb.base/maint-print-frame-id.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/maint-print-frame-id.exp b/gdb/testsuite/gdb.base/maint-print-frame-id.exp
index 257a164..6d94c72 100644
--- a/gdb/testsuite/gdb.base/maint-print-frame-id.exp
+++ b/gdb/testsuite/gdb.base/maint-print-frame-id.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/maint-target-async-off.c b/gdb/testsuite/gdb.base/maint-target-async-off.c
index fb4ffc2..f2b8dba 100644
--- a/gdb/testsuite/gdb.base/maint-target-async-off.c
+++ b/gdb/testsuite/gdb.base/maint-target-async-off.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/maint-target-async-off.exp b/gdb/testsuite/gdb.base/maint-target-async-off.exp
index 87c7116..a86a21b 100644
--- a/gdb/testsuite/gdb.base/maint-target-async-off.exp
+++ b/gdb/testsuite/gdb.base/maint-target-async-off.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/maint-test-remote-args.exp b/gdb/testsuite/gdb.base/maint-test-remote-args.exp
new file mode 100644
index 0000000..6cd3006
--- /dev/null
+++ b/gdb/testsuite/gdb.base/maint-test-remote-args.exp
@@ -0,0 +1,40 @@
+# Copyright 2024-2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test the 'maint test-remote-args' command.
+#
+# We do minimal testing in here. If you are thinking of adding a new
+# test here then you are most likely adding the test in the wrong
+# place. Remote argument testing is checked in the following test
+# scripts: gdb.base/args.exp, gdb.base/inferior-args.exp,
+# gdb.base/startup-with-shell.exp, and gdb.python/py-inferior.exp.
+# The test gdb.gdb/unittest.exp also runs 'maint selftest
+# remote-args', which are the remote argument self tests.
+#
+# If you have a new test for an argument that was being passed
+# incorrectly, then add the test to one of those scripts.
+#
+# This file is ONLY for validating that the 'maint test-remote-args'
+# command itself is working.
+
+gdb_start
+
+gdb_test "maint test-remote-args a b c" \
+ [multi_line \
+ "Input \\(a b c\\)" \
+ " \\(a\\)" \
+ " \\(b\\)" \
+ " \\(c\\)" \
+ "Output \\(a b c\\)"]
diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
index c77612d..fd366d6 100644
--- a/gdb/testsuite/gdb.base/maint.exp
+++ b/gdb/testsuite/gdb.base/maint.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -52,6 +52,41 @@ if {[prepare_for_testing "failed to prepare" $testfile \
return -1
}
+# Check "maint set per-command" warnings. We do this early so that
+# the following tests don't need to expect them, as GDB only warns
+# once.
+
+with_test_prefix "warnings" {
+ # Potential warning given by "maint set per-command time".
+ set maybe_per_command_warning \
+ "(?:warning: per-thread run time information not available on this platform)?"
+
+ # This one should not issue the "per-command time" warning.
+ with_test_prefix "per-command space" {
+ gdb_test_no_output "mt set per-command space on"
+ gdb_test_no_output "mt set per-command space off"
+ }
+
+ # These might warn. "per-command on" enables all sub commands, so
+ # might trigger the "per-command time" warning.
+ foreach cmd {"per-command" "per-command time"} {
+ with_test_prefix $cmd {
+ # GDB only warns once, so restart between commands.
+ clean_restart
+ gdb_load $binfile
+ gdb_test "mt set $cmd on" "$maybe_per_command_warning"
+ gdb_test "mt set $cmd off" "command started"
+ gdb_test_no_output "mt set $cmd on" \
+ "mt set $cmd on, again"
+ gdb_test "mt set $cmd off" "command started" \
+ "mt set $cmd off, again"
+ }
+ }
+
+ # We've already warned once above, so the following tests don't
+ # need to expect the warning.
+}
+
set readnow_p [readnow]
# The commands we test here produce many lines of output; disable "press
@@ -144,7 +179,7 @@ if { $index_cache_misses == 0 && $using_index_cache } {
set have_gdb_index 1
}
-set have_psyms [expr ! ( $have_gdb_index || $readnow_p )]
+set have_psyms [expr {! ( $have_gdb_index || $readnow_p )}]
#
# this command does not produce any output
@@ -188,9 +223,9 @@ gdb_test "maint set per-command off" \
# The timeout value is raised, because printing all the symbols and
# statistical information about Cygwin and Windows libraries takes a lot
# of time.
-if [istarget "*-*-cygwin*"] {
+if {[istarget "*-*-cygwin*"]} {
set oldtimeout $timeout
- set timeout [expr $timeout + 500]
+ set timeout [expr {$timeout + 500}]
}
set re \
@@ -205,8 +240,8 @@ set re \
"( Number of \"partial\" symbols read: $decimal" \
")?( Number of psym tables \\(not yet expanded\\): $decimal" \
")?( Total memory used for psymbol cache: $decimal" \
- ")?( Number of read CUs: $decimal" \
- " Number of unread CUs: $decimal" \
+ ")?( Number of read units: $decimal" \
+ " Number of unread units: $decimal" \
")? Total memory used for objfile obstack: $decimal" \
" Total memory used for BFD obstack: $decimal" \
" Total memory used for string cache: $decimal" \
@@ -253,7 +288,7 @@ gdb_test_multiple "$cmd $re" "$cmd" -lbl {
}
proc maint_pass_if {val name} {
- if $val { pass $name } else { fail $name }
+ if {$val} { pass $name } else { fail $name }
}
maint_pass_if $header "maint print objfiles: header"
@@ -343,7 +378,7 @@ gdb_test_multiple "maint print type argc" $msg {
}
}
-if [istarget "hppa*-*-11*"] {
+if {[istarget "hppa*-*-11*"]} {
setup_xfail hppa*-*-*11* CLLbs14860
gdb_test_multiple "maint print unwind &main" "maint print unwind" {
-re ".*unwind_table_entry \\($hex\\):\r\n\tregion_start = $hex <main>\r\n\tregion_end = $hex <main\\+\[0-9\]*>\r\n\tflags = Args_stored Save_RP\r\n\tRegion_description = $hex\r\n\tEntry_FR = $hex\r\n\tEntry_GR = $hex\r\n\tTotal_frame_size = $hex\r\n$gdb_prompt $" {
@@ -356,7 +391,7 @@ if [istarget "hppa*-*-11*"] {
}
set oldtimeout $timeout
-set timeout [expr $timeout + 300]
+set timeout [expr {$timeout + 300}]
set bp_location6 [gdb_get_line_number "set breakpoint 6 here"]
@@ -371,7 +406,7 @@ gdb_test_multiple "maint info breakpoints" "maint info breakpoints" {
gdb_test "maint print" \
"List.*unambiguous\\..*" \
- "maint print w/o args"
+ "maint print w/o args"
gdb_test "maint info" \
"List.*unambiguous\\..*" \
@@ -471,7 +506,7 @@ test_prefix_command_help {"maint" "maintenance"} {
}
#set oldtimeout $timeout
-#set timeout [expr $timeout + 300]
+#set timeout [expr {$timeout + 300}]
gdb_test_multiple "maint dump-me" "maint dump-me" {
-re "Should GDB dump core.*\\(y or n\\) $" {
@@ -487,7 +522,7 @@ send_gdb "maint internal-error\n"
gdb_expect {
-re "A problem internal to GDB has been detected" {
pass "maint internal-error"
- if [gdb_internal_error_resync] {
+ if {[gdb_internal_error_resync]} {
pass "internal-error resync"
} else {
fail "internal-error resync"
@@ -513,4 +548,9 @@ gdb_test_no_output "maint print symbols"
gdb_test_no_output "maint print msymbols"
gdb_test_no_output "maint print psymbols"
+gdb_test "maint canonicalize int short" "canonical = short"
+gdb_test "maint canonicalize fn<ty<int>>" \
+ "canonical = fn<ty<int> >"
+gdb_test "maint canonical unsigned int" "No change\\."
+
gdb_exit
diff --git a/gdb/testsuite/gdb.base/many-completions.exp b/gdb/testsuite/gdb.base/many-completions.exp
index c6215ed..340e38c 100644
--- a/gdb/testsuite/gdb.base/many-completions.exp
+++ b/gdb/testsuite/gdb.base/many-completions.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/many-headers.c b/gdb/testsuite/gdb.base/many-headers.c
index 25d21ae..5214abf 100644
--- a/gdb/testsuite/gdb.base/many-headers.c
+++ b/gdb/testsuite/gdb.base/many-headers.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/many-headers.exp b/gdb/testsuite/gdb.base/many-headers.exp
index 349b47f..5e022da 100644
--- a/gdb/testsuite/gdb.base/many-headers.exp
+++ b/gdb/testsuite/gdb.base/many-headers.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,6 +33,7 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
# Generate core file.
set corefile [core_find $binfile]
if {$corefile == ""} {
+ untested "unable to create or find corefile"
return 0
}
diff --git a/gdb/testsuite/gdb.base/max-depth-c++.exp b/gdb/testsuite/gdb.base/max-depth-c++.exp
index 4b31bce..2891f7f 100644
--- a/gdb/testsuite/gdb.base/max-depth-c++.exp
+++ b/gdb/testsuite/gdb.base/max-depth-c++.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/max-depth-c.exp b/gdb/testsuite/gdb.base/max-depth-c.exp
index d9018b3..36353e3 100644
--- a/gdb/testsuite/gdb.base/max-depth-c.exp
+++ b/gdb/testsuite/gdb.base/max-depth-c.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/max-depth.c b/gdb/testsuite/gdb.base/max-depth.c
index 7e46b13..4811af9 100644
--- a/gdb/testsuite/gdb.base/max-depth.c
+++ b/gdb/testsuite/gdb.base/max-depth.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/max-depth.exp.tcl b/gdb/testsuite/gdb.base/max-depth.exp.tcl
index 9c6fc61..22bf180 100644
--- a/gdb/testsuite/gdb.base/max-depth.exp.tcl
+++ b/gdb/testsuite/gdb.base/max-depth.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,12 +30,12 @@ proc compile_and_run_tests { lang } {
lappend flags "additional_flags=-std=c++11"
}
- if { [prepare_for_testing "failed to prepare" "${binfile}" "${srcfile}" "${flags}"] } {
+ if { [prepare_for_testing "failed to prepare" $testfile $srcfile $flags] } {
return 0
}
# Advance to main.
- if { ![runto_main] } then {
+ if { ![runto_main] } {
return 0
}
diff --git a/gdb/testsuite/gdb.base/max-value-size.c b/gdb/testsuite/gdb.base/max-value-size.c
index a831aca..f351de7 100644
--- a/gdb/testsuite/gdb.base/max-value-size.c
+++ b/gdb/testsuite/gdb.base/max-value-size.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/max-value-size.exp b/gdb/testsuite/gdb.base/max-value-size.exp
index e513983..09591b3 100644
--- a/gdb/testsuite/gdb.base/max-value-size.exp
+++ b/gdb/testsuite/gdb.base/max-value-size.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/memattr.c b/gdb/testsuite/gdb.base/memattr.c
index 0084ce9..49774f3 100644
--- a/gdb/testsuite/gdb.base/memattr.c
+++ b/gdb/testsuite/gdb.base/memattr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/memattr.exp b/gdb/testsuite/gdb.base/memattr.exp
index bba00cc..b6afb4f 100644
--- a/gdb/testsuite/gdb.base/memattr.exp
+++ b/gdb/testsuite/gdb.base/memattr.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/memops-watchpoint.c b/gdb/testsuite/gdb.base/memops-watchpoint.c
index 0255cfb..3a40293 100644
--- a/gdb/testsuite/gdb.base/memops-watchpoint.c
+++ b/gdb/testsuite/gdb.base/memops-watchpoint.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/memops-watchpoint.exp b/gdb/testsuite/gdb.base/memops-watchpoint.exp
index cee2d79..09500b3 100644
--- a/gdb/testsuite/gdb.base/memops-watchpoint.exp
+++ b/gdb/testsuite/gdb.base/memops-watchpoint.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
}
set linespec ${srcfile}:[gdb_get_line_number "Break here"]
-if ![runto ${linespec}] {
+if {![runto ${linespec}]} {
return -1
}
@@ -44,118 +44,63 @@ gdb_test "watch -location c\[28\]" \
# This is to allow the tests to work if there's a properly named symbol for
# the function, even if there's no libc debug info.
-set saw_watch_trigger 0
-set saw_function 0
-set is_supported 1
-set message "continue until memset watchpoint hits"
-set watch_trigger \
+# ARRAY_RE is the array whose modification is caught by the
+# watchpoint. SOURCE_FUNCTION is the function that modifies the
+# array, as written in the source of the test program. FUNCTION_RE
+# matches the name of the symbol that actually implements
+# SOURCE_FUNCTION (e.g., memcpy may be implemented with memmove, so we
+# may want to expect both). OLD_VALUE_RE and NEW_VALUE_RE match the
+# old/new values when the watchpoint triggers.
+
+proc continue_to_watchpoint {array_re source_function function_re
+ old_value_re new_value_re} {
+ set thread_prefix_re "(?:Thread $::decimal \[^\r\n\]*hit )?"
+
+ set saw_watch_trigger 0
+ set saw_function 0
+ set is_supported 1
+ set watch_trigger_re \
[multi_line \
"Continuing\\." \
"" \
- "(Hardware w|W)atchpoint ${decimal}: -location a\\\[28\\\]" \
+ "${thread_prefix_re}(Hardware w|W)atchpoint ${::decimal}: -location ${array_re}\\\[28\\\]" \
"" \
- "Old value = 104 'h'" \
- "New value = 0 '\\\\000'"]
-gdb_test_multiple "continue" $message {
- -re $watch_trigger {
- set saw_watch_trigger 1
- exp_continue
- }
- -re ".*memset.* \\(\\) at .*:$decimal\r\n" {
- set saw_function 1
- exp_continue
- }
- -re ".*memset.* \\(\\) from .*libc\[^\r\n\]+\r\n" {
- set saw_function 1
- exp_continue
- }
- -re "in \\?\\? \\(\\) from .*libc\[^\r\n\]+\r\n" {
- set is_supported 0
- unsupported "symbol for memset not found"
- exp_continue
- }
- -re "$gdb_prompt $" {
- if { $is_supported } {
- setup_kfail breakpoints/31665 arm*-*-linux*
- gdb_assert { $saw_watch_trigger && $saw_function } $message
+ "Old value = ${old_value_re}" \
+ "New value = ${new_value_re}"]
+ gdb_test_multiple "continue" \
+ "continue until $source_function watchpoint hits" {
+ -re $watch_trigger_re {
+ set saw_watch_trigger 1
+ exp_continue
+ }
+ -re "${function_re}.* \\(\\) at \[^\r\n\]+:${::decimal}(?=\r\n)" {
+ set saw_function 1
+ exp_continue
+ }
+ -re "${function_re}.* \\(\\) from \[^\r\n\]+(?=\r\n)" {
+ set saw_function 1
+ exp_continue
+ }
+ -re "in \\?\\? \\(\\) from \[^\r\n\]+(?=\r\n)" {
+ set is_supported 0
+ unsupported "symbol for ${source_function} not found"
+ exp_continue
+ }
+ -re -wrap "" {
+ if { $is_supported } {
+ setup_kfail breakpoints/31665 arm*-*-linux*
+ gdb_assert { $saw_watch_trigger && $saw_function } \
+ $gdb_test_name
+ }
}
}
}
+# Note: Some architectures use memmove for memset.
+continue_to_watchpoint "a" "memset" "(memset|memmove)" "104 'h'" "0 '\\\\000'"
+
# Note: Some architectures use memmove for memcpy.
-set saw_watch_trigger 0
-set saw_function 0
-set is_supported 1
-set message "continue until memcpy watchpoint hits"
-set watch_trigger \
- [multi_line \
- "Continuing\\." \
- "" \
- "(Hardware w|W)atchpoint ${decimal}: -location b\\\[28\\\]" \
- "" \
- "Old value = 101 'e'" \
- "New value = 114 'r'"]
-gdb_test_multiple "continue" $message {
- -re $watch_trigger {
- set saw_watch_trigger 1
- exp_continue
- }
- -re ".*(memcpy|memmove).* \\(\\) at .*:$decimal\r\n" {
- set saw_function 1
- exp_continue
- }
- -re ".*(memcpy|memmove).* \\(\\) from .*libc\[^\r\n\]+\r\n" {
- set saw_function 1
- exp_continue
- }
- -re "in \\?\\? \\(\\) from .*libc\[^\r\n\]+\r\n" {
- set is_supported 0
- unsupported "symbol for memcpy not found"
- exp_continue
- }
- -re "$gdb_prompt $" {
- if { $is_supported } {
- setup_kfail breakpoints/31665 arm*-*-linux*
- gdb_assert { $saw_watch_trigger && $saw_function } $message
- }
- }
-}
+continue_to_watchpoint "b" "memcpy" "(memcpy|memmove)" "101 'e'" "114 'r'"
# Note: Some architectures use memcpy for memmove.
-set saw_watch_trigger 0
-set saw_function 0
-set is_supported 1
-set message "continue until memmove watchpoint hits"
-set watch_trigger \
- [multi_line \
- "Continuing\\." \
- "" \
- "(Hardware w|W)atchpoint ${decimal}: -location c\\\[28\\\]" \
- "" \
- "Old value = 100 'd'" \
- "New value = 114 'r'"]
-gdb_test_multiple "continue" $message {
- -re $watch_trigger {
- set saw_watch_trigger 1
- exp_continue
- }
- -re ".*(memcpy|memmove).* \\(\\) at .*:$decimal\r\n" {
- set saw_function 1
- exp_continue
- }
- -re ".*(memcpy|memmove).* \\(\\) from .*libc\[^\r\n\]+\r\n" {
- set saw_function 1
- exp_continue
- }
- -re "in \\?\\? \\(\\) from .*libc\[^\r\n\]+\r\n" {
- set is_supported 0
- unsupported "symbol for memmove not found"
- exp_continue
- }
- -re "$gdb_prompt $" {
- if { $is_supported } {
- setup_kfail breakpoints/31665 arm*-*-linux*
- gdb_assert { $saw_watch_trigger && $saw_function } $message
- }
- }
-}
+continue_to_watchpoint "c" "memmove" "(memcpy|memmove)" "100 'd'" "114 'r'"
diff --git a/gdb/testsuite/gdb.base/memtag.c b/gdb/testsuite/gdb.base/memtag.c
index 9c48b17..0e07e8d 100644
--- a/gdb/testsuite/gdb.base/memtag.c
+++ b/gdb/testsuite/gdb.base/memtag.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/memtag.exp b/gdb/testsuite/gdb.base/memtag.exp
index 11249c6..2951c91 100644
--- a/gdb/testsuite/gdb.base/memtag.exp
+++ b/gdb/testsuite/gdb.base/memtag.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,7 +39,7 @@ with_test_prefix "before program execution" {
clean_restart $testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/mips_pro.exp b/gdb/testsuite/gdb.base/mips_pro.exp
index 105e118..ca46e82 100644
--- a/gdb/testsuite/gdb.base/mips_pro.exp
+++ b/gdb/testsuite/gdb.base/mips_pro.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/miscexprs.exp b/gdb/testsuite/gdb.base/miscexprs.exp
index 6dbfebe..9d2d1d2 100644
--- a/gdb/testsuite/gdb.base/miscexprs.exp
+++ b/gdb/testsuite/gdb.base/miscexprs.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,14 +20,14 @@
#
# tests for expressions with struct/array elements and mixed operator types
# with elementary types
-#
+#
# By default, the datastructures are allocated on the stack. For targets
# with very small stack, that will not work. In that case, just set
# storage to `-DSTORAGE=static' which changes the datastructures to be
# allocated in data segment.
set storage "-DSTORAGE="
-if [target_info exists gdb,small_stack_section] {
+if {[target_info exists gdb,small_stack_section]} {
set storage "-DSTORAGE=static"
}
@@ -44,7 +44,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [lis
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
#
diff --git a/gdb/testsuite/gdb.base/morestack.c b/gdb/testsuite/gdb.base/morestack.c
index 102c528..fc7bf81 100644
--- a/gdb/testsuite/gdb.base/morestack.c
+++ b/gdb/testsuite/gdb.base/morestack.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/morestack.exp b/gdb/testsuite/gdb.base/morestack.exp
index 06a5aa4..96cc15c 100644
--- a/gdb/testsuite/gdb.base/morestack.exp
+++ b/gdb/testsuite/gdb.base/morestack.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/moribund-step.exp b/gdb/testsuite/gdb.base/moribund-step.exp
index f0d4b37..d28e33f 100644
--- a/gdb/testsuite/gdb.base/moribund-step.exp
+++ b/gdb/testsuite/gdb.base/moribund-step.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ save_vars { GDBFLAGS } {
}
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/msym-bp-2.c b/gdb/testsuite/gdb.base/msym-bp-2.c
index 4545ff5..9c2ea41 100644
--- a/gdb/testsuite/gdb.base/msym-bp-2.c
+++ b/gdb/testsuite/gdb.base/msym-bp-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/msym-bp-shl-lib.c b/gdb/testsuite/gdb.base/msym-bp-shl-lib.c
index 58e7698..66b2a83 100644
--- a/gdb/testsuite/gdb.base/msym-bp-shl-lib.c
+++ b/gdb/testsuite/gdb.base/msym-bp-shl-lib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/msym-bp-shl-main-2.c b/gdb/testsuite/gdb.base/msym-bp-shl-main-2.c
index 727735c..f642f85 100644
--- a/gdb/testsuite/gdb.base/msym-bp-shl-main-2.c
+++ b/gdb/testsuite/gdb.base/msym-bp-shl-main-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/msym-bp-shl-main.c b/gdb/testsuite/gdb.base/msym-bp-shl-main.c
index add26b2..1da7711 100644
--- a/gdb/testsuite/gdb.base/msym-bp-shl-main.c
+++ b/gdb/testsuite/gdb.base/msym-bp-shl-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/msym-bp-shl.exp b/gdb/testsuite/gdb.base/msym-bp-shl.exp
index 31af1f9..fb0a99d 100644
--- a/gdb/testsuite/gdb.base/msym-bp-shl.exp
+++ b/gdb/testsuite/gdb.base/msym-bp-shl.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -55,7 +55,8 @@ proc test {debug} {
return
}
- clean_restart $bin
+ clean_restart
+ gdb_load $bin
gdb_load_shlib $lib
# Should find two locations: the static foo in the
@@ -74,7 +75,7 @@ proc test {debug} {
}
}
- if ![runto_main] {
+ if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/msym-bp.c b/gdb/testsuite/gdb.base/msym-bp.c
index 45f2ba3..a01800a 100644
--- a/gdb/testsuite/gdb.base/msym-bp.c
+++ b/gdb/testsuite/gdb.base/msym-bp.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/msym-bp.exp b/gdb/testsuite/gdb.base/msym-bp.exp
index 84d2902..08da72e 100644
--- a/gdb/testsuite/gdb.base/msym-bp.exp
+++ b/gdb/testsuite/gdb.base/msym-bp.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -68,7 +68,7 @@ proc test {debug} {
test_break "before run"
- if ![runto_main] {
+ if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/msym-lang-main.c b/gdb/testsuite/gdb.base/msym-lang-main.c
index a0a1613..fb9f4ee 100644
--- a/gdb/testsuite/gdb.base/msym-lang-main.c
+++ b/gdb/testsuite/gdb.base/msym-lang-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/msym-lang.c b/gdb/testsuite/gdb.base/msym-lang.c
index 81e5027..0ef7093 100644
--- a/gdb/testsuite/gdb.base/msym-lang.c
+++ b/gdb/testsuite/gdb.base/msym-lang.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/msym-lang.exp b/gdb/testsuite/gdb.base/msym-lang.exp
index 357fdee..c86d686 100644
--- a/gdb/testsuite/gdb.base/msym-lang.exp
+++ b/gdb/testsuite/gdb.base/msym-lang.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/multi-forks.c b/gdb/testsuite/gdb.base/multi-forks.c
index 0764a50..4611167 100644
--- a/gdb/testsuite/gdb.base/multi-forks.c
+++ b/gdb/testsuite/gdb.base/multi-forks.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2005-2024 Free Software Foundation, Inc.
+ Copyright 2005-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/multi-forks.exp b/gdb/testsuite/gdb.base/multi-forks.exp
index 19b40c4..73bd1c4 100644
--- a/gdb/testsuite/gdb.base/multi-forks.exp
+++ b/gdb/testsuite/gdb.base/multi-forks.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,11 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Until "set follow-fork-mode" and "catch fork" are implemented on
-# other targets...
-#
-require {istarget "*-*-linux*"}
-
+require allow_fork_tests
standard_testfile .c
@@ -32,7 +28,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $fla
# Start with a fresh gdb
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
global gdb_prompt
@@ -107,7 +104,8 @@ proc continue_to_exit_bp_loc {} {
# parent's branch.
foreach mode { "child" "parent" } {
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
runto_main
gdb_test_no_output "set follow-fork $mode"
@@ -139,7 +137,8 @@ foreach mode { "child" "parent" } {
# Start with a fresh gdb
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
runto_main
gdb_breakpoint $exit_bp_loc
@@ -152,7 +151,7 @@ gdb_test "show detach-on-fork" "on." "show detach default on"
gdb_test_no_output "set detach off" "set detach off"
#
-# We will now run every fork up to the exit bp,
+# We will now run every fork up to the exit bp,
# eventually winding up with 16 inferiors.
#
@@ -181,9 +180,9 @@ gdb_test "inferior 2" " main .*" "restart final"
# Now we should examine all the pids.
#
-#
+#
# Test detach inferior
-#
+#
# [assumes we're at #1]
gdb_test "detach inferior 2" "Detaching .*" "detach 2"
@@ -191,7 +190,7 @@ gdb_test "detach inferior 3" "Detaching .*" "detach 3"
gdb_test "detach inferior 4" "Detaching .*" "detach 4"
gdb_test "detach inferior 5" "Detaching .*" "detach 5"
-#
+#
# Test kill inferior
#
diff --git a/gdb/testsuite/gdb.base/multi-line-starts-subshell.exp b/gdb/testsuite/gdb.base/multi-line-starts-subshell.exp
index aaff39d..ba3bdb2 100644
--- a/gdb/testsuite/gdb.base/multi-line-starts-subshell.exp
+++ b/gdb/testsuite/gdb.base/multi-line-starts-subshell.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/native-target-noproc-tdesc.exp b/gdb/testsuite/gdb.base/native-target-noproc-tdesc.exp
index d7d471d..0e2841a 100644
--- a/gdb/testsuite/gdb.base/native-target-noproc-tdesc.exp
+++ b/gdb/testsuite/gdb.base/native-target-noproc-tdesc.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/nested-addr.c b/gdb/testsuite/gdb.base/nested-addr.c
index e51f350..ce5b1c8 100644
--- a/gdb/testsuite/gdb.base/nested-addr.c
+++ b/gdb/testsuite/gdb.base/nested-addr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/nested-addr.exp b/gdb/testsuite/gdb.base/nested-addr.exp
index f0bfe6a..8f19017 100644
--- a/gdb/testsuite/gdb.base/nested-addr.exp
+++ b/gdb/testsuite/gdb.base/nested-addr.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ if {[prepare_for_testing "failed to prepare" "${testfile}" "${srcfile}"]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/nested-subp1.c b/gdb/testsuite/gdb.base/nested-subp1.c
index 04161ca..f65ea52 100644
--- a/gdb/testsuite/gdb.base/nested-subp1.c
+++ b/gdb/testsuite/gdb.base/nested-subp1.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/nested-subp1.exp b/gdb/testsuite/gdb.base/nested-subp1.exp
index f9d614d..9d0e873 100644
--- a/gdb/testsuite/gdb.base/nested-subp1.exp
+++ b/gdb/testsuite/gdb.base/nested-subp1.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ standard_testfile
set testcase "nested-subp1"
-if ![support_nested_function_tests] {
+if {![support_nested_function_tests]} {
untested "compiler does not support nested functions"
return -1
}
@@ -40,7 +40,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${testcase}.c" \
# Run until the variables we are interested in are visible.
clean_restart "${testcase}"
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/nested-subp2.c b/gdb/testsuite/gdb.base/nested-subp2.c
index 01e03e2..c08aeea 100644
--- a/gdb/testsuite/gdb.base/nested-subp2.c
+++ b/gdb/testsuite/gdb.base/nested-subp2.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/nested-subp2.exp b/gdb/testsuite/gdb.base/nested-subp2.exp
index 10449c9..1846685 100644
--- a/gdb/testsuite/gdb.base/nested-subp2.exp
+++ b/gdb/testsuite/gdb.base/nested-subp2.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ standard_testfile
set testcase "nested-subp2"
-if ![support_nested_function_tests] {
+if {![support_nested_function_tests]} {
untested "compiler does not support nested functions"
return -1
}
@@ -49,7 +49,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${testcase}.c" \
# Run until the variables we are interested in are visible.
clean_restart "${testcase}"
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/nested-subp3.c b/gdb/testsuite/gdb.base/nested-subp3.c
index 754c756..28ffcdd 100644
--- a/gdb/testsuite/gdb.base/nested-subp3.c
+++ b/gdb/testsuite/gdb.base/nested-subp3.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/nested-subp3.exp b/gdb/testsuite/gdb.base/nested-subp3.exp
index 0f75a84..4099667 100644
--- a/gdb/testsuite/gdb.base/nested-subp3.exp
+++ b/gdb/testsuite/gdb.base/nested-subp3.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ standard_testfile
set testcase "nested-subp3"
-if ![support_nested_function_tests] {
+if {![support_nested_function_tests]} {
untested "compiler does not support nested functions"
return -1
}
@@ -49,7 +49,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${testcase}.c" \
# Run until the variables we are interested in are visible.
clean_restart "${testcase}"
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/new-ui-echo.c b/gdb/testsuite/gdb.base/new-ui-echo.c
index 603bd49..6c99997e 100644
--- a/gdb/testsuite/gdb.base/new-ui-echo.c
+++ b/gdb/testsuite/gdb.base/new-ui-echo.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/new-ui-echo.exp b/gdb/testsuite/gdb.base/new-ui-echo.exp
index 1ee6704..c8d39e8 100644
--- a/gdb/testsuite/gdb.base/new-ui-echo.exp
+++ b/gdb/testsuite/gdb.base/new-ui-echo.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.c b/gdb/testsuite/gdb.base/new-ui-pending-input.c
index 5102247..e5cd93e 100644
--- a/gdb/testsuite/gdb.base/new-ui-pending-input.c
+++ b/gdb/testsuite/gdb.base/new-ui-pending-input.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb.base/new-ui-pending-input.exp
index cfb7ca0..dd2f60d 100644
--- a/gdb/testsuite/gdb.base/new-ui-pending-input.exp
+++ b/gdb/testsuite/gdb.base/new-ui-pending-input.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/new-ui.c b/gdb/testsuite/gdb.base/new-ui.c
index 674ce63..7f9e00a 100644
--- a/gdb/testsuite/gdb.base/new-ui.c
+++ b/gdb/testsuite/gdb.base/new-ui.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/new-ui.exp b/gdb/testsuite/gdb.base/new-ui.exp
index a56d213..345cd36 100644
--- a/gdb/testsuite/gdb.base/new-ui.exp
+++ b/gdb/testsuite/gdb.base/new-ui.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -81,7 +81,7 @@ proc_with_prefix do_test {} {
clean_restart $testfile
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -184,14 +184,14 @@ proc_with_prefix do_test_invalid_args {} {
"new-ui with bad interpreter name"
# Test that the TUI cannot be used for a new UI.
- if [allow_tui_tests] {
+ if {[allow_tui_tests]} {
gdb_test "new-ui tui $extra_tty_name" \
"interpreter 'tui' cannot be used with a new UI" \
"new-ui with tui"
}
# Test that we can continue working normally.
- if ![runto_main] {
+ if {![runto_main]} {
return
}
}
diff --git a/gdb/testsuite/gdb.base/nextoverexit.c b/gdb/testsuite/gdb.base/nextoverexit.c
index 36ec6c4..7eaafe4 100644
--- a/gdb/testsuite/gdb.base/nextoverexit.c
+++ b/gdb/testsuite/gdb.base/nextoverexit.c
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/nextoverexit.exp b/gdb/testsuite/gdb.base/nextoverexit.exp
index b09fe91..3209079 100644
--- a/gdb/testsuite/gdb.base/nextoverexit.exp
+++ b/gdb/testsuite/gdb.base/nextoverexit.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.base/nodebug.exp b/gdb/testsuite/gdb.base/nodebug.exp
index 4c07d2e..6ed428e 100644
--- a/gdb/testsuite/gdb.base/nodebug.exp
+++ b/gdb/testsuite/gdb.base/nodebug.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,9 +18,9 @@
standard_testfile .c
-if [test_compiler_info "xlc-*"] {
+if {[test_compiler_info "xlc-*"]} {
# By default, IBM'x xlc compiler doesn't add static variables into the symtab.
- # Use "-qstatsym" to do so.
+ # Use "-qstatsym" to do so.
set exec_opts additional_flags=-qstatsym
} else {
set exec_opts ""
@@ -33,7 +33,8 @@ if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != "
# Start with a fresh gdb.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
# Run to FUNC and unload symbols from system shared libraries, to
# avoid conflicts with the minsyms in the program. E.g.,
@@ -41,7 +42,7 @@ clean_restart $binfile
proc nodebug_runto {func} {
with_test_prefix $func {
- if ![runto $func] {
+ if {![runto $func]} {
return false
}
gdb_test_no_output "nosharedlibrary" \
@@ -54,7 +55,7 @@ proc nodebug_runto {func} {
# require coercion/promotion, both prototyped and unprototyped, both
# return-type-cast style, and function-pointer-cast styles.
proc test_call_promotion {} {
- if [target_info exists gdb,cannot_call_functions] {
+ if {[target_info exists gdb,cannot_call_functions]} {
return
}
@@ -85,9 +86,9 @@ proc test_call_promotion {} {
}
if {[nodebug_runto inner]} {
-
+
# Expect to find global/local symbols in each of text/data/bss.
-
+
# The exact format for some of this output is not necessarily
# ideal, particularly interpreting "p top" requires a fair bit of
# savvy about gdb's workings and the meaning of the "{}"
@@ -99,7 +100,7 @@ if {[nodebug_runto inner]} {
# to detect that gdb does not know the type, rather than just
# being told they are ints or functions returning int like old
# versions of gdb used to do.
-
+
# On alpha (and other ecoff systems) the native compilers put
# out debugging info for non-aggregate return values of functions
# even without -g, which should be accepted.
@@ -219,7 +220,7 @@ if {[nodebug_runto inner]} {
# Check that pointer arithmetic works as expected.
set addr1 [get_hexadecimal_valueof "&dataglobal" "*UNKNOWN*"]
set addr2 [get_hexadecimal_valueof "(int *) &dataglobal + 1" "*UNKNOWN*"]
- set offset [expr $addr2 - $addr1]
+ set offset [expr {$addr2 - $addr1}]
set int_size [get_integer_valueof "sizeof (int)" "*UNKNOWN*"]
gdb_assert { $offset == $int_size }
@@ -270,14 +271,14 @@ if {[nodebug_runto inner]} {
# ever, why bother with a weaker test?
#gdb_test "backtrace 10" "#0.*inner.*#1.*#2.*top.*#3.*main.*" \
# "backtrace from inner for externals"
-
+
# This test is not as obscure as it might look. `p getenv ("TERM")'
# is a real-world example, at least on many systems.
foreach cmd {"p/c" "ptype" "whatis"} {
gdb_test "$cmd array_index(\"abcdef\",2)" \
"'array_index' has unknown return type; cast the call to its declared return type"
}
- if [target_info exists gdb,cannot_call_functions] {
+ if {[target_info exists gdb,cannot_call_functions]} {
unsupported "p/c (int) array_index(\"abcdef\",2)"
} else {
# We need to up this because this can be really slow on some boards.
diff --git a/gdb/testsuite/gdb.base/nofield.c b/gdb/testsuite/gdb.base/nofield.c
index 9e81510..4ff1ccc 100644
--- a/gdb/testsuite/gdb.base/nofield.c
+++ b/gdb/testsuite/gdb.base/nofield.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/nofield.exp b/gdb/testsuite/gdb.base/nofield.exp
index 0113a8c..31d0234 100644
--- a/gdb/testsuite/gdb.base/nofield.exp
+++ b/gdb/testsuite/gdb.base/nofield.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debu
set eol "\r\n"
set sp "\[ \t\]*"
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_test "ptype struct not_empty" \
"type = struct not_empty {$eol${sp}void \\*e;$eol${sp}void \\*u;$eol}"
diff --git a/gdb/testsuite/gdb.base/non-executable.exp b/gdb/testsuite/gdb.base/non-executable.exp
index 0f3b81a..fcfaa1f 100644
--- a/gdb/testsuite/gdb.base/non-executable.exp
+++ b/gdb/testsuite/gdb.base/non-executable.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/non-lazy-array-index.c b/gdb/testsuite/gdb.base/non-lazy-array-index.c
index 8bf99e8..390911f 100644
--- a/gdb/testsuite/gdb.base/non-lazy-array-index.c
+++ b/gdb/testsuite/gdb.base/non-lazy-array-index.c
@@ -1,4 +1,4 @@
-/* Copyright 2021-2024 Free Software Foundation, Inc.
+/* Copyright 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/non-lazy-array-index.exp b/gdb/testsuite/gdb.base/non-lazy-array-index.exp
index be7ea06..288f159 100644
--- a/gdb/testsuite/gdb.base/non-lazy-array-index.exp
+++ b/gdb/testsuite/gdb.base/non-lazy-array-index.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/noreturn-finish.c b/gdb/testsuite/gdb.base/noreturn-finish.c
index cac0fe7..0413c05 100644
--- a/gdb/testsuite/gdb.base/noreturn-finish.c
+++ b/gdb/testsuite/gdb.base/noreturn-finish.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/noreturn-finish.exp b/gdb/testsuite/gdb.base/noreturn-finish.exp
index 7e17d28..2da0a40 100644
--- a/gdb/testsuite/gdb.base/noreturn-finish.exp
+++ b/gdb/testsuite/gdb.base/noreturn-finish.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
standard_testfile
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/noreturn-return.c b/gdb/testsuite/gdb.base/noreturn-return.c
index cac0fe7..0413c05 100644
--- a/gdb/testsuite/gdb.base/noreturn-return.c
+++ b/gdb/testsuite/gdb.base/noreturn-return.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/noreturn-return.exp b/gdb/testsuite/gdb.base/noreturn-return.exp
index f034be2..e6f8117 100644
--- a/gdb/testsuite/gdb.base/noreturn-return.exp
+++ b/gdb/testsuite/gdb.base/noreturn-return.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
standard_testfile
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/normal.c b/gdb/testsuite/gdb.base/normal.c
index 3fab53d..a9a452a 100644
--- a/gdb/testsuite/gdb.base/normal.c
+++ b/gdb/testsuite/gdb.base/normal.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/nostdlib.c b/gdb/testsuite/gdb.base/nostdlib.c
index 633183a..82feace 100644
--- a/gdb/testsuite/gdb.base/nostdlib.c
+++ b/gdb/testsuite/gdb.base/nostdlib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/nostdlib.exp b/gdb/testsuite/gdb.base/nostdlib.exp
index f595bab..826fbd9 100644
--- a/gdb/testsuite/gdb.base/nostdlib.exp
+++ b/gdb/testsuite/gdb.base/nostdlib.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,13 +34,15 @@ foreach_with_prefix pie { "nopie" "pie" } {
set binfile [standard_output_file $testfile-$pie]
set board [target_info name]
- if [board_info $board exists mathlib] {
+ if {[board_info $board exists mathlib]} {
set mathlib [board_info $dest mathlib]
set_board_info mathlib ""
+ # tclint-disable-next-line command-args
set err [eval $compile]
set_board_info mathlib $mathlib
} else {
set_board_info mathlib ""
+ # tclint-disable-next-line command-args
set err [eval $compile]
unset_board_info mathlib
}
@@ -49,7 +51,8 @@ foreach_with_prefix pie { "nopie" "pie" } {
return -1
}
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
gdb_breakpoint "*marker"
diff --git a/gdb/testsuite/gdb.base/offsets.c b/gdb/testsuite/gdb.base/offsets.c
index e9532bd..a46a072 100644
--- a/gdb/testsuite/gdb.base/offsets.c
+++ b/gdb/testsuite/gdb.base/offsets.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/offsets.exp b/gdb/testsuite/gdb.base/offsets.exp
index bf9a78c..3193ed9 100644
--- a/gdb/testsuite/gdb.base/offsets.exp
+++ b/gdb/testsuite/gdb.base/offsets.exp
@@ -1,6 +1,6 @@
# Test big offsets
-# Copyright (c) 2014-2024 Free Software Foundation, Inc.
+# Copyright (c) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ gdb_test_multiple "print &big_struct.second" "$test" {
-re "\\$\[0-9\]* = .* (0x\[0-9a-fA-F\]*) .*\[\r\n\]*$gdb_prompt $" {
set addr2 $expect_out(1,string)
- if {[expr $addr2 - $addr1] == [expr 0x10000000 + 16]} {
+ if {[expr {$addr2 - $addr1}] == [expr {0x10000000 + 16}]} {
pass "big offsets"
} else {
fail "big offsets"
diff --git a/gdb/testsuite/gdb.base/opaque.exp b/gdb/testsuite/gdb.base/opaque.exp
index d803714..c010fb8 100644
--- a/gdb/testsuite/gdb.base/opaque.exp
+++ b/gdb/testsuite/gdb.base/opaque.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -110,7 +110,7 @@ gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
# Run to main, where struct foo is incomplete.
-if ![runto_main] {
+if {![runto_main]} {
return
}
@@ -160,7 +160,7 @@ gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
# Run to getfoo, where struct foo is complete.
-if ![runto getfoo] {
+if {![runto getfoo]} {
perror "cannot run to breakpoint at getfoo"
}
diff --git a/gdb/testsuite/gdb.base/options.c b/gdb/testsuite/gdb.base/options.c
index e2442af..81c8b89 100644
--- a/gdb/testsuite/gdb.base/options.c
+++ b/gdb/testsuite/gdb.base/options.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/options.exp b/gdb/testsuite/gdb.base/options.exp
index 8760a91..067f55e 100644
--- a/gdb/testsuite/gdb.base/options.exp
+++ b/gdb/testsuite/gdb.base/options.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -62,8 +62,7 @@ proc check_completion_result {expected test} {
# just checking whether GDB recognizes the option and auto-appends a
# space.
proc test_completer_recognizes {res input_line} {
- set expected_re [string_to_regexp $input_line]
- test_gdb_complete_unique $input_line $expected_re
+ test_gdb_complete_unique $input_line $input_line
check_completion_result $res $input_line
}
@@ -206,9 +205,10 @@ proc_with_prefix test-print {{prefix ""}} {
}
global binfile
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -318,9 +318,10 @@ proc_with_prefix test-backtrace {} {
"backtrace no-filters"
global binfile
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -509,12 +510,26 @@ proc_with_prefix test-thread-apply {} {
proc_with_prefix test-info-threads {} {
test_gdb_complete_multiple "info threads " "" "" {
"-gid"
+ "-running"
+ "-stopped"
"ID"
}
+ test_gdb_complete_multiple "info threads " "-" "" {
+ "-gid"
+ "-running"
+ "-stopped"
+ }
+
test_gdb_complete_unique \
- "info threads -" \
+ "info threads -g" \
"info threads -gid"
+ test_gdb_complete_unique \
+ "info threads -r" \
+ "info threads -running"
+ test_gdb_complete_unique \
+ "info threads -s" \
+ "info threads -stopped"
# "ID" isn't really something the user can type.
test_gdb_complete_none "info threads I"
@@ -1148,7 +1163,7 @@ foreach prefix {
# Same for "compile print". Not really a wrapper prefix command like
# "frame apply", but similar enough that we test pretty much the same
# things.
-if ![skip_compile_feature_tests] {
+if {![skip_compile_feature_tests]} {
test-print "compile "
}
diff --git a/gdb/testsuite/gdb.base/osabi.exp b/gdb/testsuite/gdb.base/osabi.exp
index 4fd267b..ba99835 100644
--- a/gdb/testsuite/gdb.base/osabi.exp
+++ b/gdb/testsuite/gdb.base/osabi.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/overlays.exp b/gdb/testsuite/gdb.base/overlays.exp
index c8730ec..8e7e0c0 100644
--- a/gdb/testsuite/gdb.base/overlays.exp
+++ b/gdb/testsuite/gdb.base/overlays.exp
@@ -1,5 +1,5 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
-#
+# Copyright 1997-2025 Free Software Foundation, Inc.
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -64,7 +64,7 @@ proc get_func_address { func func_sym msg } {
global hexx
set func_addr 0
- send_gdb "print $func\n"
+ send_gdb "print $func\n"
gdb_expect {
-re "\\$\[0-9\]+ = $fptrcast (${hexx}) <$func_sym>.*$gdb_prompt $" {
set func_addr $expect_out(1,string)
@@ -99,39 +99,39 @@ if {$data_overlays} {
# map each overlay successively, and
# capture the VMA addresses of [foo bar baz grbx foox barx bazx grbxx]
-gdb_test "overlay map .ovly0" ""
+gdb_test "overlay map .ovly0" ""
gdb_test "overlay list" "Section .ovly0, loaded at.*, mapped at.*" "list ovly0"
set foo_vma [get_func_address "foo" "foo" "foo runtime address"]
-gdb_test "overlay map .ovly1" ""
+gdb_test "overlay map .ovly1" ""
gdb_test "overlay list" "Section .ovly1, loaded at.*, mapped at.*" "list ovly1"
set bar_vma [get_func_address "bar" "bar" "bar runtime address"]
-gdb_test "overlay map .ovly2" ""
+gdb_test "overlay map .ovly2" ""
gdb_test "overlay list" "Section .ovly2, loaded at.*, mapped at.*" "list ovly2"
set baz_vma [get_func_address "baz" "baz" "baz runtime address"]
-gdb_test "overlay map .ovly3" ""
+gdb_test "overlay map .ovly3" ""
gdb_test "overlay list" "Section .ovly3, loaded at.*, mapped at.*" "list ovly3"
set grbx_vma [get_func_address "grbx" "grbx" "grbx runtime address"]
if {$data_overlays} {
- gdb_test "overlay map .data00" ""
+ gdb_test "overlay map .data00" ""
gdb_test "overlay list" "Section .data00, loaded .*, mapped .*" "list data00"
gdb_test "print \$foox_vma = &foox" \
".* $iptrcast 0x.*" "foox runtime addr"
- gdb_test "overlay map .data01" ""
+ gdb_test "overlay map .data01" ""
gdb_test "overlay list" "Section .data01, loaded .*, mapped .*" "list data01"
gdb_test "print \$barx_vma = &barx" \
".* $iptrcast 0x.*" "barx runtime addr"
- gdb_test "overlay map .data02" ""
+ gdb_test "overlay map .data02" ""
gdb_test "overlay list" "Section .data02, loaded .*, mapped .*" "list data02"
gdb_test "print \$bazx_vma = &bazx" \
".* $iptrcast 0x.*" "bazx runtime addr"
- gdb_test "overlay map .data03" ""
+ gdb_test "overlay map .data03" ""
gdb_test "overlay list" "Section .data03, loaded .*, mapped .*" "list data03"
gdb_test "print \$grbxx_vma = &grbxx" \
".* $iptrcast 0x.*" "grbxx runtime addr"
@@ -149,7 +149,7 @@ if {$data_overlays} {
gdb_test "print \$grbxx_lma != \$grbxx_vma" ".* = 1" "grbxx's LMA != VMA"
}
-# Verify that early-mapped overlays have been bumped out
+# Verify that early-mapped overlays have been bumped out
# by later-mapped overlays laid over in the same VMA range.
send_gdb "overlay list\n"
diff --git a/gdb/testsuite/gdb.base/page-logging.exp b/gdb/testsuite/gdb.base/page-logging.exp
index 6cc9770..b07d540 100644
--- a/gdb/testsuite/gdb.base/page-logging.exp
+++ b/gdb/testsuite/gdb.base/page-logging.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/page.exp b/gdb/testsuite/gdb.base/page.exp
index c95a2bc..026356a 100644
--- a/gdb/testsuite/gdb.base/page.exp
+++ b/gdb/testsuite/gdb.base/page.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.c b/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.c
index 726fffe..7e8a5ef 100644
--- a/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.c
+++ b/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp b/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp
index 1fc7043..d60a0ea 100644
--- a/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp
+++ b/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,8 @@ proc test_ctrlc_while_target_running_does_not_paginate {} {
set testline [gdb_get_line_number "after sleep"]
with_test_prefix "ctrlc target running" {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.base/paginate-bg-execution.c b/gdb/testsuite/gdb.base/paginate-bg-execution.c
index 54e0aec..d3a4659 100644
--- a/gdb/testsuite/gdb.base/paginate-bg-execution.c
+++ b/gdb/testsuite/gdb.base/paginate-bg-execution.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/paginate-bg-execution.exp b/gdb/testsuite/gdb.base/paginate-bg-execution.exp
index 1906e58..40f98fc 100644
--- a/gdb/testsuite/gdb.base/paginate-bg-execution.exp
+++ b/gdb/testsuite/gdb.base/paginate-bg-execution.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,8 @@ proc test_bg_execution_pagination_return {} {
global decimal
with_test_prefix "paginate" {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.base/paginate-execution-startup.c b/gdb/testsuite/gdb.base/paginate-execution-startup.c
index 54e0aec..d3a4659 100644
--- a/gdb/testsuite/gdb.base/paginate-execution-startup.c
+++ b/gdb/testsuite/gdb.base/paginate-execution-startup.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/paginate-execution-startup.exp b/gdb/testsuite/gdb.base/paginate-execution-startup.exp
index 134cf64..8f971c8 100644
--- a/gdb/testsuite/gdb.base/paginate-execution-startup.exp
+++ b/gdb/testsuite/gdb.base/paginate-execution-startup.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug] == -1} {
}
set file_arg $binfile
-if [is_remote host] {
+if {[is_remote host]} {
set file_arg [remote_download host $file_arg]
}
@@ -176,7 +176,7 @@ save_vars { INTERNAL_GDBFLAGS } {
if {[probe_can_run_cmdline] > 0} {
test_fg_execution_pagination_return
- if ![target_info exists gdb,nointerrupts] {
+ if {![target_info exists gdb,nointerrupts]} {
test_fg_execution_pagination_cancel "ctrl-c"
}
test_fg_execution_pagination_cancel "quit"
diff --git a/gdb/testsuite/gdb.base/paginate-inferior-exit.c b/gdb/testsuite/gdb.base/paginate-inferior-exit.c
index 54e0aec..d3a4659 100644
--- a/gdb/testsuite/gdb.base/paginate-inferior-exit.c
+++ b/gdb/testsuite/gdb.base/paginate-inferior-exit.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/paginate-inferior-exit.exp b/gdb/testsuite/gdb.base/paginate-inferior-exit.exp
index 3d99a5f..6cc992b 100644
--- a/gdb/testsuite/gdb.base/paginate-inferior-exit.exp
+++ b/gdb/testsuite/gdb.base/paginate-inferior-exit.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,8 @@ proc test_paginate_inferior_exited {} {
global inferior_exited_re
with_test_prefix "paginate" {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.base/parse_number.exp b/gdb/testsuite/gdb.base/parse_number.exp
index 64ce14c..7f6e37f 100644
--- a/gdb/testsuite/gdb.base/parse_number.exp
+++ b/gdb/testsuite/gdb.base/parse_number.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -48,21 +48,21 @@ proc fits_in_type { n type_bits type_signedness } {
if { $n < 0} {
set n_sign -1
- set n [expr -$n]
+ set n [expr {-$n}]
} else {
set n_sign 1
}
- set smax [expr 1 << ($type_bits - 1)];
+ set smax [expr {1 << ($type_bits - 1)}];
if { $n_sign == -1 } {
# Negative number, signed type.
- return [expr ($n <= $smax)]
+ return [expr {($n <= $smax)}]
} elseif { $n_sign == 1 && $type_signed_p } {
# Positive number, signed type.
- return [expr ($n < $smax)]
+ return [expr {($n < $smax)}]
} elseif { $n_sign == 1 && !$type_signed_p } {
# Positive number, unsigned type.
- return [expr ($n >> $type_bits) == 0]
+ return [expr {($n >> $type_bits) == 0}]
} else {
error "unreachable"
}
@@ -99,9 +99,9 @@ proc parse_number { lang n } {
}
global sizeof_long_long sizeof_long sizeof_int
- set long_long_bits [expr $sizeof_long_long * 8]
- set long_bits [expr $sizeof_long * 8]
- set int_bits [expr $sizeof_int * 8]
+ set long_long_bits [expr {$sizeof_long_long * 8}]
+ set long_bits [expr {$sizeof_long * 8}]
+ set int_bits [expr {$sizeof_int * 8}]
if { $lang == "rust" } {
if { [fits_in_type $n 32 s] } {
@@ -303,7 +303,7 @@ proc test_parse_numbers {arch} {
foreach_with_prefix prefix $prefixes {
foreach baseval $basevals {
foreach offset { -2 -1 0 1 2 } {
- set dec_val [expr $baseval + $offset]
+ set dec_val [expr {$baseval + $offset}]
set hex_val [format "0x%llx" $dec_val]
if { $dec_val < 0 } {
continue
diff --git a/gdb/testsuite/gdb.base/paste-newline.exp b/gdb/testsuite/gdb.base/paste-newline.exp
index dabceac..77e278e 100644
--- a/gdb/testsuite/gdb.base/paste-newline.exp
+++ b/gdb/testsuite/gdb.base/paste-newline.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/patch.c b/gdb/testsuite/gdb.base/patch.c
index 583116c..44abbd6 100644
--- a/gdb/testsuite/gdb.base/patch.c
+++ b/gdb/testsuite/gdb.base/patch.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/patch.exp b/gdb/testsuite/gdb.base/patch.exp
index 628ad56..f6abc59 100644
--- a/gdb/testsuite/gdb.base/patch.exp
+++ b/gdb/testsuite/gdb.base/patch.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,8 @@ with_test_prefix "exec" {
gdb_test "p extern_global = 2" " = 2" "modify value"
gdb_test "p extern_global" " = 2" "value modified"
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
gdb_test "p extern_global" " = 2" "value modified persisted"
}
@@ -43,7 +44,8 @@ with_test_prefix "exec" {
# Generate a core file.
with_test_prefix "gcore" {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.base/pc-fp.exp b/gdb/testsuite/gdb.base/pc-fp.exp
index 667bc45..8e3d80c 100644
--- a/gdb/testsuite/gdb.base/pc-fp.exp
+++ b/gdb/testsuite/gdb.base/pc-fp.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/pc-not-saved.c b/gdb/testsuite/gdb.base/pc-not-saved.c
index bc6632a..f482c36 100644
--- a/gdb/testsuite/gdb.base/pc-not-saved.c
+++ b/gdb/testsuite/gdb.base/pc-not-saved.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/pc-not-saved.exp b/gdb/testsuite/gdb.base/pc-not-saved.exp
index 5f22568..e761e93 100644
--- a/gdb/testsuite/gdb.base/pc-not-saved.exp
+++ b/gdb/testsuite/gdb.base/pc-not-saved.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -60,7 +60,8 @@ gdb_assert { ![string equal $pc unknown] } \
"check we read the frame's PC"
# Restart and load the Python unwinder script.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
gdb_test_no_output "source ${remote_python_file}" "load python file"
# Tell the Python unwinder to use the frame-id we cached above.
diff --git a/gdb/testsuite/gdb.base/pc-not-saved.py b/gdb/testsuite/gdb.base/pc-not-saved.py
index 8090858..b8bc361 100644
--- a/gdb/testsuite/gdb.base/pc-not-saved.py
+++ b/gdb/testsuite/gdb.base/pc-not-saved.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/pending.c b/gdb/testsuite/gdb.base/pending.c
index 45b38e9..3ec15b5 100644
--- a/gdb/testsuite/gdb.base/pending.c
+++ b/gdb/testsuite/gdb.base/pending.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/pending.exp b/gdb/testsuite/gdb.base/pending.exp
index 833e084..fc1820a 100644
--- a/gdb/testsuite/gdb.base/pending.exp
+++ b/gdb/testsuite/gdb.base/pending.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -103,8 +103,8 @@ gdb_test "info break" \
"pending plus real breakpoint info"
-#
-# Test not setting a pending breakpoint
+#
+# Test not setting a pending breakpoint
#
gdb_test "break pendfunc2" \
"" \
@@ -113,7 +113,7 @@ gdb_test "break pendfunc2" \
"n"
#
-# Add condition to pending breakpoint
+# Add condition to pending breakpoint
#
gdb_test_no_output "condition 1 k == 1"
diff --git a/gdb/testsuite/gdb.base/pendshr.c b/gdb/testsuite/gdb.base/pendshr.c
index c56f125..fc0c066 100644
--- a/gdb/testsuite/gdb.base/pendshr.c
+++ b/gdb/testsuite/gdb.base/pendshr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/permissions.exp b/gdb/testsuite/gdb.base/permissions.exp
index 6c3cecb..edfe5a0 100644
--- a/gdb/testsuite/gdb.base/permissions.exp
+++ b/gdb/testsuite/gdb.base/permissions.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/persistent-lang.cc b/gdb/testsuite/gdb.base/persistent-lang.cc
index 27a14b7..65b18bc 100644
--- a/gdb/testsuite/gdb.base/persistent-lang.cc
+++ b/gdb/testsuite/gdb.base/persistent-lang.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/persistent-lang.exp b/gdb/testsuite/gdb.base/persistent-lang.exp
index d3bedae..3528998 100644
--- a/gdb/testsuite/gdb.base/persistent-lang.exp
+++ b/gdb/testsuite/gdb.base/persistent-lang.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/pie-execl.c b/gdb/testsuite/gdb.base/pie-execl.c
index d468d85..e53290e 100644
--- a/gdb/testsuite/gdb.base/pie-execl.c
+++ b/gdb/testsuite/gdb.base/pie-execl.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/pie-execl.exp b/gdb/testsuite/gdb.base/pie-execl.exp
index cbcb3ac..0400a99 100644
--- a/gdb/testsuite/gdb.base/pie-execl.exp
+++ b/gdb/testsuite/gdb.base/pie-execl.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -49,7 +49,7 @@ clean_restart ${executable1}
gdb_test_no_output "set args ${binfile2}" "set args ${binfile2_test_msg}"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -113,7 +113,7 @@ verbose -log "addr2 is $addr2"
# Ensure we cannot get a false PASS and the inferior has really changed.
set test "pie_execl_marker address has changed"
-if [string equal $addr1 $addr2] {
+if {[string equal $addr1 $addr2]} {
fail $test
} else {
pass $test
diff --git a/gdb/testsuite/gdb.base/pie-fork.c b/gdb/testsuite/gdb.base/pie-fork.c
index 716cf36..54473f9 100644
--- a/gdb/testsuite/gdb.base/pie-fork.c
+++ b/gdb/testsuite/gdb.base/pie-fork.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/pie-fork.exp b/gdb/testsuite/gdb.base/pie-fork.exp
index 16aba1f..fcc6ad4 100644
--- a/gdb/testsuite/gdb.base/pie-fork.exp
+++ b/gdb/testsuite/gdb.base/pie-fork.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,20 +16,23 @@
# Test that we can follow forks properly when the executable is
# position-independent.
+require allow_fork_tests
+
standard_testfile
set opts [list debug pie]
-if [build_executable "failed to prepare" $testfile $srcfile $opts] {
+if {[build_executable "failed to prepare" $testfile $srcfile $opts]} {
return
}
proc setup_test {detach_on_fork {follow_fork_mode "parent"}} {
global binfile
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/pointers.exp b/gdb/testsuite/gdb.base/pointers.exp
index 0bf88be..9895a2f 100644
--- a/gdb/testsuite/gdb.base/pointers.exp
+++ b/gdb/testsuite/gdb.base/pointers.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
#
# tests for pointer arithmetic and pointer dereferencing
# with integer type variables and pointers to integers
-#
+#
#
# test running programs
@@ -32,7 +32,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
#
@@ -64,7 +65,7 @@ gdb_test "next " "more_code.*;" "continuing after dummy()"
# pass "illegal pointer assignment rejected"
# }
# -re ".*$gdb_prompt $" { fail "illegal pointer assignment rejected" }
-# timeout { fail "(timeout) illegal pointer assignment rejected" }
+# timeout { fail "(timeout) illegal pointer assignment rejected" }
# }
@@ -74,7 +75,7 @@ gdb_test "next " "more_code.*;" "continuing after dummy()"
# pass "illegal pointer assignment rejected"
# }
# -re ".*$gdb_prompt $" { fail "illegal pointer assignment rejected" }
-# timeout { fail "(timeout) ilegal pointer assignment rejected" }
+# timeout { fail "(timeout) ilegal pointer assignment rejected" }
# }
#send_gdb "print v_unsigned_int_pointer == v_double_pointer\n"
@@ -83,7 +84,7 @@ gdb_test "next " "more_code.*;" "continuing after dummy()"
# pass "illegal pointer operation (+) rejected"
# }
# -re ".*$gdb_prompt $" { fail "illegal pointer operation (+) rejected" }
-# timeout { fail "(timeout) illegal pointer operation (+) rejected" }
+# timeout { fail "(timeout) illegal pointer operation (+) rejected" }
# }
@@ -93,7 +94,7 @@ gdb_test "next " "more_code.*;" "continuing after dummy()"
# pass "illegal pointer operation (*) rejected"
# }
# -re ".*$gdb_prompt $" { fail "illegal pointer operation (*) rejected" }
-# timeout { fail "(timeout) illegal pointer operation (*) rejected" }
+# timeout { fail "(timeout) illegal pointer operation (*) rejected" }
# }
@@ -103,7 +104,7 @@ gdb_test "next " "more_code.*;" "continuing after dummy()"
# pass "ilegal pointer assignment rejected"
# }
# -re ".*$gdb_prompt $" { fail "illegal pointer assignment rejected" }
-# timeout { fail "(timeout) illegal pointer assignment rejected" }
+# timeout { fail "(timeout) illegal pointer assignment rejected" }
# }
@@ -113,7 +114,7 @@ gdb_test "next " "more_code.*;" "continuing after dummy()"
# pass "illegal pointer assignment rejected"
# }
# -re ".*$gdb_prompt $" { fail "illegal pointer assignment rejected" }
-# timeout { fail "(timeout) illegal pointer assignment rejected" }
+# timeout { fail "(timeout) illegal pointer assignment rejected" }
# }
gdb_test_no_output "set variable v_int_pointer=&v_int_array\[0\]" \
@@ -202,9 +203,9 @@ gdb_test "print *( *(matrix+1) +2)" " = 5" \
gdb_test "print **ptr_to_ptr_to_float" " = 100" \
"print through ptr to ptr"
-# tests for pointers
+# tests for pointers
# with elementary type variables and pointers.
-#
+#
gdb_test "break marker1" ".*" ""
gdb_test "cont" "Break.* marker1 \\(\\) at .*:$decimal.*" \
@@ -220,7 +221,7 @@ gdb_test "print *pS" " = -14" "print value of *pS"
gdb_test_multiple "ptype pS" "ptype pS" {
-re "type = short \\*.*$gdb_prompt $" { pass "ptype pS" }
-re "type = short int \\*.*$gdb_prompt $" { pass "ptype pS" }
-}
+}
gdb_test "print *pUS" " = 7" "print value of *pUS"
diff --git a/gdb/testsuite/gdb.base/pr10179.exp b/gdb/testsuite/gdb.base/pr10179.exp
index efe77aa..a6d8a83 100644
--- a/gdb/testsuite/gdb.base/pr10179.exp
+++ b/gdb/testsuite/gdb.base/pr10179.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if {[build_executable ${testname}.exp $testname $sources {debug}] == -1} {
clean_restart ${testname}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/pr11022.c b/gdb/testsuite/gdb.base/pr11022.c
index 1600f2a..81688ad 100644
--- a/gdb/testsuite/gdb.base/pr11022.c
+++ b/gdb/testsuite/gdb.base/pr11022.c
@@ -1,6 +1,6 @@
/* This test is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/pr11022.exp b/gdb/testsuite/gdb.base/pr11022.exp
index 59f8eff..70a7d8b 100644
--- a/gdb/testsuite/gdb.base/pr11022.exp
+++ b/gdb/testsuite/gdb.base/pr11022.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
# Start with a fresh gdb.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.base/prelink-lib.c b/gdb/testsuite/gdb.base/prelink-lib.c
index 3eac0cf..0f55968 100644
--- a/gdb/testsuite/gdb.base/prelink-lib.c
+++ b/gdb/testsuite/gdb.base/prelink-lib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/prelink.c b/gdb/testsuite/gdb.base/prelink.c
index 6bc417b..23610db 100644
--- a/gdb/testsuite/gdb.base/prelink.c
+++ b/gdb/testsuite/gdb.base/prelink.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/prelink.exp b/gdb/testsuite/gdb.base/prelink.exp
index 6b4790e..73380bb 100644
--- a/gdb/testsuite/gdb.base/prelink.exp
+++ b/gdb/testsuite/gdb.base/prelink.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,13 +43,13 @@ if {$prelink_args == ""} {
}
set test "split debug of executable"
-if [gdb_gnu_strip_debug $binfile] {
+if {[gdb_gnu_strip_debug $binfile]} {
fail $test
} else {
pass $test
}
-if ![prelink_yes $prelink_args] {
+if {![prelink_yes $prelink_args]} {
# Maybe we don't have prelink.
return -1
}
@@ -57,10 +57,10 @@ if ![prelink_yes $prelink_args] {
set found 0
set coredir "[standard_output_file coredir.[getpid]]"
file mkdir $coredir
-catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\""
+catch {system "(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1"}
foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" {
- if [remote_file build exists $i] {
+ if {[remote_file build exists $i]} {
remote_exec build "mv $i [standard_output_file prelink.core]"
set found 1
}
@@ -85,7 +85,7 @@ if { $found == 0 } {
}
# Relink $libfile to a different address.
-if ![prelink_yes $prelink_args] {
+if {![prelink_yes $prelink_args]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/premature-dummy-frame-removal.c b/gdb/testsuite/gdb.base/premature-dummy-frame-removal.c
index 1e78769..bc9e92e 100644
--- a/gdb/testsuite/gdb.base/premature-dummy-frame-removal.c
+++ b/gdb/testsuite/gdb.base/premature-dummy-frame-removal.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/premature-dummy-frame-removal.exp b/gdb/testsuite/gdb.base/premature-dummy-frame-removal.exp
index c813fbe..27e8410 100644
--- a/gdb/testsuite/gdb.base/premature-dummy-frame-removal.exp
+++ b/gdb/testsuite/gdb.base/premature-dummy-frame-removal.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/premature-dummy-frame-removal.py b/gdb/testsuite/gdb.base/premature-dummy-frame-removal.py
index 2c3567d..a89e279 100644
--- a/gdb/testsuite/gdb.base/premature-dummy-frame-removal.py
+++ b/gdb/testsuite/gdb.base/premature-dummy-frame-removal.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/pretty-array.c b/gdb/testsuite/gdb.base/pretty-array.c
index d474126..585921d 100644
--- a/gdb/testsuite/gdb.base/pretty-array.c
+++ b/gdb/testsuite/gdb.base/pretty-array.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/pretty-array.exp b/gdb/testsuite/gdb.base/pretty-array.exp
index 80d515c..1e93ea7 100644
--- a/gdb/testsuite/gdb.base/pretty-array.exp
+++ b/gdb/testsuite/gdb.base/pretty-array.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/pretty-print.c b/gdb/testsuite/gdb.base/pretty-print.c
index 9a93f94..b2cd518 100644
--- a/gdb/testsuite/gdb.base/pretty-print.c
+++ b/gdb/testsuite/gdb.base/pretty-print.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/pretty-print.exp b/gdb/testsuite/gdb.base/pretty-print.exp
index a36f8fc..8533481 100644
--- a/gdb/testsuite/gdb.base/pretty-print.exp
+++ b/gdb/testsuite/gdb.base/pretty-print.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/print-file-var-lib1.c b/gdb/testsuite/gdb.base/print-file-var-lib1.c
index 7561b64..0a73ba6 100644
--- a/gdb/testsuite/gdb.base/print-file-var-lib1.c
+++ b/gdb/testsuite/gdb.base/print-file-var-lib1.c
@@ -1,5 +1,5 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/print-file-var-lib2.c b/gdb/testsuite/gdb.base/print-file-var-lib2.c
index 4c53c16..97d65ea 100644
--- a/gdb/testsuite/gdb.base/print-file-var-lib2.c
+++ b/gdb/testsuite/gdb.base/print-file-var-lib2.c
@@ -1,5 +1,5 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/print-file-var-main.c b/gdb/testsuite/gdb.base/print-file-var-main.c
index d8475c7..6c67255 100644
--- a/gdb/testsuite/gdb.base/print-file-var-main.c
+++ b/gdb/testsuite/gdb.base/print-file-var-main.c
@@ -1,5 +1,5 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/print-file-var.exp b/gdb/testsuite/gdb.base/print-file-var.exp
index 70e454d..d4866ad 100644
--- a/gdb/testsuite/gdb.base/print-file-var.exp
+++ b/gdb/testsuite/gdb.base/print-file-var.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -81,7 +81,7 @@ proc test {hidden dlopen version_id_main lang} {
gdb_load_shlib $libobj1
gdb_locate_shlib $libobj2
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -129,7 +129,7 @@ proc test {hidden dlopen version_id_main lang} {
}
}
- if $version_id_main {
+ if {$version_id_main} {
compare "'print-file-var-main.c'::this_version_id" "vm"
compare "this_version_id" "vm"
}
diff --git a/gdb/testsuite/gdb.base/print-file-var.h b/gdb/testsuite/gdb.base/print-file-var.h
index bfcd8cac..7c6de34 100644
--- a/gdb/testsuite/gdb.base/print-file-var.h
+++ b/gdb/testsuite/gdb.base/print-file-var.h
@@ -1,5 +1,5 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/print-internal-string.c b/gdb/testsuite/gdb.base/print-internal-string.c
index 8ede883..b521482 100644
--- a/gdb/testsuite/gdb.base/print-internal-string.c
+++ b/gdb/testsuite/gdb.base/print-internal-string.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/print-internal-string.exp b/gdb/testsuite/gdb.base/print-internal-string.exp
index 21605f0..ddfaaef 100644
--- a/gdb/testsuite/gdb.base/print-internal-string.exp
+++ b/gdb/testsuite/gdb.base/print-internal-string.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if {![runto_main]} {
return 0
}
-if [allow_python_tests] {
+if {[allow_python_tests]} {
# The $_as_string convenience function is implemented in Python.
gdb_test {printf "%s\n", $_as_string("aabbcc")} "\"aabbcc\""
diff --git a/gdb/testsuite/gdb.base/print-symbol-loading-lib.c b/gdb/testsuite/gdb.base/print-symbol-loading-lib.c
index 92d6f60..31ac8dc 100644
--- a/gdb/testsuite/gdb.base/print-symbol-loading-lib.c
+++ b/gdb/testsuite/gdb.base/print-symbol-loading-lib.c
@@ -1,4 +1,4 @@
-/* Copyright 2010-2024 Free Software Foundation, Inc.
+/* Copyright 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/print-symbol-loading-main.c b/gdb/testsuite/gdb.base/print-symbol-loading-main.c
index 99bbfd6..359f304 100644
--- a/gdb/testsuite/gdb.base/print-symbol-loading-main.c
+++ b/gdb/testsuite/gdb.base/print-symbol-loading-main.c
@@ -1,4 +1,4 @@
-/* Copyright 2010-2024 Free Software Foundation, Inc.
+/* Copyright 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/print-symbol-loading.exp b/gdb/testsuite/gdb.base/print-symbol-loading.exp
index b3520f1..695a3d2 100644
--- a/gdb/testsuite/gdb.base/print-symbol-loading.exp
+++ b/gdb/testsuite/gdb.base/print-symbol-loading.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
# Test the "print symbol-loading" option.
-require allow_shlib_tests
+require allow_shlib_tests gcore_cmd_available
standard_testfile print-symbol-loading-main.c
set libfile print-symbol-loading-lib
@@ -35,10 +35,11 @@ if { [gdb_compile ${objfile} ${binfile} executable $opts] != "" } {
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_load_shlib ${binfile_lib}
-if ![runto lib] {
+if {![runto lib]} {
return -1
}
@@ -94,8 +95,9 @@ proc test_load_shlib { print_symbol_loading } {
global binfile
global gdb_prompt
with_test_prefix "shlib ${print_symbol_loading}" {
- clean_restart ${binfile}
- if ![runto_main] {
+ clean_restart
+ gdb_load $binfile
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp
index 40176c6..0165791 100644
--- a/gdb/testsuite/gdb.base/printcmds.exp
+++ b/gdb/testsuite/gdb.base/printcmds.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -96,18 +96,18 @@ proc test_integer_literals_rejected {} {
# Test various octal values.
- test_print_reject "p 09"
- test_print_reject "p 079"
+ test_print_reject "p 09"
+ test_print_reject "p 079"
# Test various hexadecimal values.
- test_print_reject "p 0xG"
- test_print_reject "p 0xAG"
+ test_print_reject "p 0xG"
+ test_print_reject "p 0xAG"
# Test various binary values.
- test_print_reject "p 0b2"
- test_print_reject "p 0b12"
+ test_print_reject "p 0b2"
+ test_print_reject "p 0b12"
}
proc test_float_accepted {} {
@@ -458,14 +458,14 @@ proc test_print_repeats_10_one { setting } {
for { set x 1 } { $x <= 16 } { incr x } {
gdb_test_no_output "set print $setting $x" "$setting $x repeats"
for { set e 1 } { $e <= 16 } {incr e } {
- set v [expr $e - 1]
+ set v [expr {$e - 1}]
set command "p &ctable2\[${v}*16\]"
if { $x < $e } {
set aval $x
} else {
set aval $e
}
- set xval [expr $x - $e]
+ set xval [expr {$x - $e}]
if { $xval < 0 } {
set xval 0
}
@@ -703,7 +703,7 @@ proc test_artificial_arrays {} {
# for the test because that character isn't recognized as an
# escape character.
set ctrlv "\026"
- if [ishost *-*-mingw*] {
+ if {[ishost *-*-mingw*]} {
set ctrlv ""
}
gdb_test_escape_braces "p int1dim\[0\]${ctrlv}@2" " = {0, 1}" {p int1dim[0]@2}
@@ -744,6 +744,12 @@ proc test_print_char_arrays {} {
gdb_test_no_output "set print address off" "address off char arrays"
}
+proc test_print_arrays_negative {} {
+ # Check whether correct error messages are printed
+ gdb_test "p 1 == { }" "size of the array element must not be zero"
+ gdb_test "p 1 == { 1, 'a' }" "array elements must all be the same size"
+}
+
proc test_print_nibbles {} {
gdb_test_no_output "set print nibbles on"
foreach lang_line {
@@ -791,7 +797,7 @@ proc test_print_string_constants {} {
gdb_test_no_output "set print elements 50"
- if [target_info exists gdb,cannot_call_functions] {
+ if {[target_info exists gdb,cannot_call_functions]} {
unsupported "this target can not call functions"
return
}
@@ -815,7 +821,7 @@ proc test_print_string_constants {} {
proc test_print_array_constants {} {
global hex
- if [target_info exists gdb,cannot_call_functions] {
+ if {[target_info exists gdb,cannot_call_functions]} {
unsupported "this target can not call functions"
return
}
@@ -1022,7 +1028,7 @@ proc test_print_symbol {} {
gdb_test_no_output "set print symbol off"
}
-# Escape a left curly brace to prevent it from being interpreted as
+# Escape a left curly brace to prevent it from being interpreted as
# the beginning of a bound
proc gdb_test_escape_braces { args } {
@@ -1235,6 +1241,7 @@ test_print_int_arrays
test_print_typedef_arrays
test_artificial_arrays
test_print_char_arrays
+test_print_arrays_negative
test_print_nibbles
# We used to do the runto main here.
test_print_string_constants
diff --git a/gdb/testsuite/gdb.base/printf-wchar_t.c b/gdb/testsuite/gdb.base/printf-wchar_t.c
index 00b6001..7263f87 100644
--- a/gdb/testsuite/gdb.base/printf-wchar_t.c
+++ b/gdb/testsuite/gdb.base/printf-wchar_t.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/printf-wchar_t.exp b/gdb/testsuite/gdb.base/printf-wchar_t.exp
index f4903f7..ea9d37a 100644
--- a/gdb/testsuite/gdb.base/printf-wchar_t.exp
+++ b/gdb/testsuite/gdb.base/printf-wchar_t.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/prologue-include.c b/gdb/testsuite/gdb.base/prologue-include.c
index b8dd39e..3efc0ba 100644
--- a/gdb/testsuite/gdb.base/prologue-include.c
+++ b/gdb/testsuite/gdb.base/prologue-include.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/prologue-include.exp b/gdb/testsuite/gdb.base/prologue-include.exp
index cf748df..d57a471 100644
--- a/gdb/testsuite/gdb.base/prologue-include.exp
+++ b/gdb/testsuite/gdb.base/prologue-include.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/prologue-include.h b/gdb/testsuite/gdb.base/prologue-include.h
index acdd8c0..1854502 100644
--- a/gdb/testsuite/gdb.base/prologue-include.h
+++ b/gdb/testsuite/gdb.base/prologue-include.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/prologue.c b/gdb/testsuite/gdb.base/prologue.c
index 100e3db..f60c778 100644
--- a/gdb/testsuite/gdb.base/prologue.c
+++ b/gdb/testsuite/gdb.base/prologue.c
@@ -1,6 +1,6 @@
/* This test is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/prologue.exp b/gdb/testsuite/gdb.base/prologue.exp
index a925e4f..736e779 100644
--- a/gdb/testsuite/gdb.base/prologue.exp
+++ b/gdb/testsuite/gdb.base/prologue.exp
@@ -1,5 +1,5 @@
# Test for prologue skipping in minimal symbols with line info.
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.base/psym-external-decl-2.c b/gdb/testsuite/gdb.base/psym-external-decl-2.c
index 57291f0..a30fa2b 100644
--- a/gdb/testsuite/gdb.base/psym-external-decl-2.c
+++ b/gdb/testsuite/gdb.base/psym-external-decl-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/psym-external-decl.c b/gdb/testsuite/gdb.base/psym-external-decl.c
index f651626..fe67dae 100644
--- a/gdb/testsuite/gdb.base/psym-external-decl.c
+++ b/gdb/testsuite/gdb.base/psym-external-decl.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/psym-external-decl.exp b/gdb/testsuite/gdb.base/psym-external-decl.exp
index 1e2a1d7..9798535 100644
--- a/gdb/testsuite/gdb.base/psym-external-decl.exp
+++ b/gdb/testsuite/gdb.base/psym-external-decl.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/psymtab.exp b/gdb/testsuite/gdb.base/psymtab.exp
index 8e792b5..bc80740 100644
--- a/gdb/testsuite/gdb.base/psymtab.exp
+++ b/gdb/testsuite/gdb.base/psymtab.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/ptr-typedef.c b/gdb/testsuite/gdb.base/ptr-typedef.c
index a28e24f..ccde9fb 100644
--- a/gdb/testsuite/gdb.base/ptr-typedef.c
+++ b/gdb/testsuite/gdb.base/ptr-typedef.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2005-2024 Free Software Foundation, Inc.
+ Copyright 2005-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/ptr-typedef.exp b/gdb/testsuite/gdb.base/ptr-typedef.exp
index eb70a8a..f7bdf08 100644
--- a/gdb/testsuite/gdb.base/ptr-typedef.exp
+++ b/gdb/testsuite/gdb.base/ptr-typedef.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,9 +22,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
# Get things started.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
-if ![runto marker1] {
+if {![runto marker1]} {
untested "couldn't run to marker1"
}
diff --git a/gdb/testsuite/gdb.base/ptype-offsets.cc b/gdb/testsuite/gdb.base/ptype-offsets.cc
index 6b1baa8..c657bec 100644
--- a/gdb/testsuite/gdb.base/ptype-offsets.cc
+++ b/gdb/testsuite/gdb.base/ptype-offsets.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/ptype-offsets.exp b/gdb/testsuite/gdb.base/ptype-offsets.exp
index 68748da..ff20ef5 100644
--- a/gdb/testsuite/gdb.base/ptype-offsets.exp
+++ b/gdb/testsuite/gdb.base/ptype-offsets.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/ptype.exp b/gdb/testsuite/gdb.base/ptype.exp
index bdec993..25dd4c9 100644
--- a/gdb/testsuite/gdb.base/ptype.exp
+++ b/gdb/testsuite/gdb.base/ptype.exp
@@ -1,4 +1,4 @@
-# Copyright 1988-2024 Free Software Foundation, Inc.
+# Copyright 1988-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -51,7 +51,7 @@ gdb_test_multiple "ptype red1" "ptype unnamed enumeration member" {
# Here and elsewhere, we accept
# "long", "long int", or "int" for long variables (whatis.exp already
# has an XFAIL for "int" (Sun cc bug), so no need to fail it here).
-gdb_test "ptype struct t_struct" "type = struct t_struct \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype structure"
+gdb_test "ptype struct t_struct" "type = struct t_struct \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype structure"
# Test the equivalence between '.' and '->' for struct member references.
@@ -73,30 +73,30 @@ if {[gdb_test "ptype v_t_struct_p->v_float_member" "type = float"] < 0} {
# IBM's xlc puts out bogus stabs--the stuff field is type 42,
# which isn't defined.
-gdb_test "ptype struct link" "type = struct link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list structure"
+gdb_test "ptype struct link" "type = struct link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list structure"
#
# test ptype command with unions
#
-gdb_test "ptype union t_union" "type = union t_union \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype union"
+gdb_test "ptype union t_union" "type = union t_union \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype union"
# IBM's xlc puts out bogus stabs--the stuff field is type 42,
# which isn't defined.
-gdb_test "ptype union tu_link" "type = union tu_link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list union"
+gdb_test "ptype union tu_link" "type = union tu_link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list union"
#
# test ptype command with enums
#
-gdb_test "ptype primary" "type = enum .red, green, blue.*" "ptype unnamed enumeration"
+gdb_test "ptype primary" "type = enum .red, green, blue.*" "ptype unnamed enumeration"
-gdb_test "ptype enum colors" "type = enum colors \{yellow, purple, pink\}.*" "ptype named enumeration"
+gdb_test "ptype enum colors" "type = enum colors \{yellow, purple, pink\}.*" "ptype named enumeration"
#
# test ptype command with enums as typedef
#
-gdb_test "ptype boolean" "type = enum (boolean |)\{FALSE, TRUE\}.*" "ptype unnamed typedef'd enumeration"
+gdb_test "ptype boolean" "type = enum (boolean |)\{FALSE, TRUE\}.*" "ptype unnamed typedef'd enumeration"
# And check that whatis shows the name, not "enum {...}".
# This probably fails for all DWARF 1 cases, so assume so for now. -fnf
@@ -132,20 +132,20 @@ gdb_test "ptype enum bvals" "type = enum bvals \{my_false, my_true\}.*" "ptype n
#
# test ptype command with out-of-order enum values
#
-gdb_test "ptype enum misordered" "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*" "ptype misordered enumeration"
+gdb_test "ptype enum misordered" "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*" "ptype misordered enumeration"
#
# test ptype command with a named enum's value
#
-gdb_test "ptype three" "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*" "ptype named enumeration member"
+gdb_test "ptype three" "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*" "ptype named enumeration member"
-gdb_test "ptype red" "type = enum \{red, green, blue\}.*" "ptype unnamed enumeration member #2"
+gdb_test "ptype red" "type = enum \{red, green, blue\}.*" "ptype unnamed enumeration member #2"
#
# test ptype command with basic C types
#
# I've commented most of this out because it duplicates tests in whatis.exp.
-# I've just left in a token test or 2 which is designed to test that ptype
+# I've just left in a token test or 2 which is designed to test that ptype
# acts like whatis for basic types. If it is thought to be necessary to
# test both whatis and ptype for all the types, the tests should be
# merged into whatis.exp, or else maintenance will be a royal pain -kingdon
@@ -174,7 +174,7 @@ gdb_test "ptype red" "type = enum \{red, green, blue\}.*" "ptype unnamed enumera
# timeout { fail "(timeout) ptype unsigned char" }
#}
-gdb_test "ptype v_short" "type = short(| int).*" "ptype short"
+gdb_test "ptype v_short" "type = short(| int).*" "ptype short"
#send "ptype v_signed_short\n"
#gdb_expect {
@@ -192,7 +192,7 @@ gdb_test "ptype v_short" "type = short(| int).*" "ptype short"
#}
-gdb_test "ptype v_int" "type = int.*" "ptype int"
+gdb_test "ptype v_int" "type = int.*" "ptype int"
#send "ptype v_signed_int\n"
#gdb_expect {
@@ -306,7 +306,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int"
#
#send "ptype v_long_array\n"
#gdb_expect {
-# -re "type = (long|int|long int) .2..*$gdb_prompt $" {
+# -re "type = (long|int|long int) .2..*$gdb_prompt $" {
# pass "ptype long array" }
# -re ".*$gdb_prompt $" { fail "ptype long array" }
# timeout { fail "(timeout) ptype long array" }
@@ -315,7 +315,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int"
#
#send "ptype v_signed_long_array\n"
#gdb_expect {
-# -re "type = (long|int|long int) .2..*$gdb_prompt $" {
+# -re "type = (long|int|long int) .2..*$gdb_prompt $" {
# pass "ptype signed long array" }
# -re ".*$gdb_prompt $" { fail "ptype signed long array" }
# timeout { fail "(timeout) ptype signed long array" }
@@ -528,11 +528,10 @@ proc ptype_maybe_prototyped { id prototyped plain { overprototyped "NO-MATCH" }
# Turn the arguments, which are literal strings, into
# regular expressions by quoting any special characters they contain.
foreach var { prototyped plain overprototyped } {
- eval "set val \$$var"
- regsub -all "\[\]\[*()\]" $val "\\\\&" val
+ set val [string_to_regexp [set $var]]
regsub -all "short int" $val "short( int)?" val
regsub -all "long int" $val "long( int)?" val
- eval "set $var \$val"
+ set $var $val
}
gdb_test_multiple "ptype $id" "ptype $id" {
@@ -544,10 +543,10 @@ proc ptype_maybe_prototyped { id prototyped plain { overprototyped "NO-MATCH" }
fail "ptype $id (compiler doesn't emit prototyped types)"
}
-re "type = $overprototyped\[\r\n\]+$gdb_prompt $" {
- if { [test_compiler_info "armcc-*"] } {
- setup_xfail "*-*-*"
- }
- fail "ptype $id (compiler doesn't emit unprototyped types)"
+ # C23 no longer supports non-prototype function declaration, in which
+ # case the overprototyped regexp is the expected one. Simply pass
+ # in all cases.
+ pass "ptype $id (overprototyped)"
}
}
}
@@ -586,7 +585,7 @@ gdb_test "ptype foo" "type = char" "ptype foo typedef after second list of charf
if {[runto_main]} {
- if [target_info exists gdb,cannot_call_functions] {
+ if {[target_info exists gdb,cannot_call_functions]} {
unsupported "this target can not call functions"
return
}
diff --git a/gdb/testsuite/gdb.base/quit-live.c b/gdb/testsuite/gdb.base/quit-live.c
index 3d2e741..5bfaf23 100644
--- a/gdb/testsuite/gdb.base/quit-live.c
+++ b/gdb/testsuite/gdb.base/quit-live.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/quit-live.exp b/gdb/testsuite/gdb.base/quit-live.exp
index 3199d5f..e33d8bc 100644
--- a/gdb/testsuite/gdb.base/quit-live.exp
+++ b/gdb/testsuite/gdb.base/quit-live.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2024 Free Software Foundation, Inc.
+# Copyright (C) 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -95,7 +95,8 @@ proc quit_with_live_inferior {appear_how extra_inferior quit_how} {
set test_spawn_id ""
if {$appear_how != "attach-nofile"} {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
} else {
clean_restart
}
@@ -119,8 +120,13 @@ proc quit_with_live_inferior {appear_how extra_inferior quit_how} {
}
if {$extra_inferior} {
- gdb_test "add-inferior" "Added inferior 2 on connection .*" \
- "add empty inferior 2"
+ if {[target_info gdb_protocol] ne "remote"} {
+ gdb_test "add-inferior" "Added inferior 2 on connection .*" \
+ "add empty inferior 2"
+ } else {
+ gdb_test "add-inferior -no-connection" "Added inferior 2" \
+ "add empty inferior 2"
+ }
gdb_test "inferior 2" "Switching to inferior 2.*" \
"switch to inferior 2"
}
diff --git a/gdb/testsuite/gdb.base/quit.exp b/gdb/testsuite/gdb.base/quit.exp
index b9a80f8..682ce4a 100644
--- a/gdb/testsuite/gdb.base/quit.exp
+++ b/gdb/testsuite/gdb.base/quit.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/radix.exp b/gdb/testsuite/gdb.base/radix.exp
index 37eb849..eeeb9bb 100644
--- a/gdb/testsuite/gdb.base/radix.exp
+++ b/gdb/testsuite/gdb.base/radix.exp
@@ -1,5 +1,5 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 1993-2024 Free Software Foundation, Inc.
+# Copyright 1993-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -59,20 +59,20 @@ proc test_input_radix { iradix iradixhex iradixoctal } {
test_one_input $iradix "-1" "-1"
# test simple two-digit constants
- test_one_input $iradix "10" [expr $iradix]
- test_one_input $iradix "11" [expr $iradix + 1]
- test_one_input $iradix "-10" [expr 0 - $iradix]
- test_one_input $iradix "-11" [expr 0 - $iradix - 1]
+ test_one_input $iradix "10" [expr {$iradix}]
+ test_one_input $iradix "11" [expr {$iradix + 1}]
+ test_one_input $iradix "-10" [expr {0 - $iradix}]
+ test_one_input $iradix "-11" [expr {0 - $iradix - 1}]
# test simple three-digit constants
- test_one_input $iradix "100" [expr $iradix * $iradix]
- test_one_input $iradix "101" [expr $iradix * $iradix + 1]
- test_one_input $iradix "-100" [expr 0 - $iradix * $iradix]
- test_one_input $iradix "-101" [expr 0 - $iradix * $iradix - 1]
+ test_one_input $iradix "100" [expr {$iradix * $iradix}]
+ test_one_input $iradix "101" [expr {$iradix * $iradix + 1}]
+ test_one_input $iradix "-100" [expr {0 - $iradix * $iradix}]
+ test_one_input $iradix "-101" [expr {0 - $iradix * $iradix - 1}]
# test a five-digit constant
test_one_input $iradix "10101" \
- [expr $iradix * $iradix * $iradix * $iradix + $iradix * $iradix + 1]
+ [expr {$iradix * $iradix * $iradix * $iradix + $iradix * $iradix + 1}]
}
test_input_radix 2 "2" "2"
diff --git a/gdb/testsuite/gdb.base/random-signal.c b/gdb/testsuite/gdb.base/random-signal.c
index 4b6d896..127a149 100644
--- a/gdb/testsuite/gdb.base/random-signal.c
+++ b/gdb/testsuite/gdb.base/random-signal.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/random-signal.exp b/gdb/testsuite/gdb.base/random-signal.exp
index a02d036..16f9467 100644
--- a/gdb/testsuite/gdb.base/random-signal.exp
+++ b/gdb/testsuite/gdb.base/random-signal.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -49,7 +49,8 @@ proc do_test {} {
# while gdb is processing the internal software watchtpoint
# single-step. With remote debugging, the ctrl-c reaches GDB first.
with_test_prefix "run" {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
if {![runto_main]} {
return -1
@@ -62,7 +63,8 @@ with_test_prefix "run" {
# reaches GDB first. Test that as well.
with_test_prefix "attach" {
if {[can_spawn_for_attach]} {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
set test_spawn_id [spawn_wait_for_attach $binfile]
set testpid [spawn_id_get_pid $test_spawn_id]
diff --git a/gdb/testsuite/gdb.base/randomize.c b/gdb/testsuite/gdb.base/randomize.c
index 199440f..193506d 100644
--- a/gdb/testsuite/gdb.base/randomize.c
+++ b/gdb/testsuite/gdb.base/randomize.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/randomize.exp b/gdb/testsuite/gdb.base/randomize.exp
index 37bf99d..5a7b089 100644
--- a/gdb/testsuite/gdb.base/randomize.exp
+++ b/gdb/testsuite/gdb.base/randomize.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@ gdb_test "show disable-randomization" \
set addr1 [address_get "randomized first address"]
set addr2 [address_get "randomized second address"]
set test "randomized addresses should not match"
-if [string equal $addr1 $addr2] {
+if {[string equal $addr1 $addr2]} {
untested "no randomization detected on this system"
return -1
} else {
@@ -75,7 +75,7 @@ gdb_test "show disable-randomization" \
set addr1 [address_get "fixed first address"]
set addr2 [address_get "fixed second address"]
set test "fixed addresses should match"
-if [string equal $addr1 $addr2] {
+if {[string equal $addr1 $addr2]} {
pass $test
} else {
fail $test
diff --git a/gdb/testsuite/gdb.base/range-stepping.c b/gdb/testsuite/gdb.base/range-stepping.c
index cd3ba0f..04d56cb 100644
--- a/gdb/testsuite/gdb.base/range-stepping.c
+++ b/gdb/testsuite/gdb.base/range-stepping.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/range-stepping.exp b/gdb/testsuite/gdb.base/range-stepping.exp
index bdcd598..d1131c8 100644
--- a/gdb/testsuite/gdb.base/range-stepping.exp
+++ b/gdb/testsuite/gdb.base/range-stepping.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,11 +22,11 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_range_stepping_enabled] {
+if {![gdb_range_stepping_enabled]} {
unsupported "range stepping not supported by the target"
return -1
}
@@ -171,7 +171,7 @@ with_test_prefix "loop 2" {
# Check that range stepping works well even when it is interrupted by
# ctrl-c.
-if ![target_info exists gdb,nointerrupts] {
+if {![target_info exists gdb,nointerrupts]} {
with_test_prefix "interrupt" {
gdb_test_no_output "set debug remote 1"
diff --git a/gdb/testsuite/gdb.base/readline-ask.c b/gdb/testsuite/gdb.base/readline-ask.c
index 247d357..e1b3f2c 100644
--- a/gdb/testsuite/gdb.base/readline-ask.c
+++ b/gdb/testsuite/gdb.base/readline-ask.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/readline-ask.exp b/gdb/testsuite/gdb.base/readline-ask.exp
index 60a11e0..0fdfc76 100644
--- a/gdb/testsuite/gdb.base/readline-ask.exp
+++ b/gdb/testsuite/gdb.base/readline-ask.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,6 +13,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+require {!is_remote host}
+
standard_testfile .c
set inputrc ${srcdir}/${subdir}/${testfile}.inputrc
@@ -25,7 +27,8 @@ setenv TERM dumb
# INPUTRC gets reset for the next testfile.
setenv INPUTRC $inputrc
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if { ![readline_is_used] } {
unsupported "completion doesn't work when readline isn't used."
diff --git a/gdb/testsuite/gdb.base/readline-ask.inputrc b/gdb/testsuite/gdb.base/readline-ask.inputrc
index 072f1a7..6ba06f4 100644
--- a/gdb/testsuite/gdb.base/readline-ask.inputrc
+++ b/gdb/testsuite/gdb.base/readline-ask.inputrc
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/readline-commands-eof.c b/gdb/testsuite/gdb.base/readline-commands-eof.c
index 4061e6a..60003a6 100644
--- a/gdb/testsuite/gdb.base/readline-commands-eof.c
+++ b/gdb/testsuite/gdb.base/readline-commands-eof.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/readline-commands-eof.exp b/gdb/testsuite/gdb.base/readline-commands-eof.exp
index c823118..d55dd1d 100644
--- a/gdb/testsuite/gdb.base/readline-commands-eof.exp
+++ b/gdb/testsuite/gdb.base/readline-commands-eof.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,7 +43,8 @@ if { ![readline_supports_eof_flag] } {
# arrived. If it is then GDB will start displaying extra blank lines
# after each line of input.
proc run_test {} {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
gdb_breakpoint main
diff --git a/gdb/testsuite/gdb.base/readline.exp b/gdb/testsuite/gdb.base/readline.exp
index 4e613d6..9b87790 100644
--- a/gdb/testsuite/gdb.base/readline.exp
+++ b/gdb/testsuite/gdb.base/readline.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,6 +21,8 @@
# Tests for readline operations.
#
+require {!is_remote host}
+
# This function is used to test operate-and-get-next.
# NAME is the name of the test.
# ARGS is a list of alternating commands and expected results.
diff --git a/gdb/testsuite/gdb.base/readnever.c b/gdb/testsuite/gdb.base/readnever.c
index e7f755d..5028ae5 100644
--- a/gdb/testsuite/gdb.base/readnever.c
+++ b/gdb/testsuite/gdb.base/readnever.c
@@ -1,4 +1,4 @@
-/* Copyright 2016-2024 Free Software Foundation, Inc.
+/* Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/readnever.exp b/gdb/testsuite/gdb.base/readnever.exp
index 6788441..891adf5 100644
--- a/gdb/testsuite/gdb.base/readnever.exp
+++ b/gdb/testsuite/gdb.base/readnever.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [build_executable "failed to build" $testfile $srcfile { debug }] == -1 } {
save_vars { GDBFLAGS } {
append GDBFLAGS " --readnever"
- if { [clean_restart ${binfile}] == -1 } {
+ if { [clean_restart $testfile] == -1 } {
return -1
}
}
diff --git a/gdb/testsuite/gdb.base/realname-expand-real.c b/gdb/testsuite/gdb.base/realname-expand-real.c
index 9024f60..c07b72c 100644
--- a/gdb/testsuite/gdb.base/realname-expand-real.c
+++ b/gdb/testsuite/gdb.base/realname-expand-real.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/realname-expand.c b/gdb/testsuite/gdb.base/realname-expand.c
index 781951f..614f06a 100644
--- a/gdb/testsuite/gdb.base/realname-expand.c
+++ b/gdb/testsuite/gdb.base/realname-expand.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/realname-expand.exp b/gdb/testsuite/gdb.base/realname-expand.exp
index e62a4db..8753b32 100644
--- a/gdb/testsuite/gdb.base/realname-expand.exp
+++ b/gdb/testsuite/gdb.base/realname-expand.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/record-full-error.exp b/gdb/testsuite/gdb.base/record-full-error.exp
index 0ec2dab..70d858b 100644
--- a/gdb/testsuite/gdb.base/record-full-error.exp
+++ b/gdb/testsuite/gdb.base/record-full-error.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/recpar.c b/gdb/testsuite/gdb.base/recpar.c
index 87746a0..8206f2d 100644
--- a/gdb/testsuite/gdb.base/recpar.c
+++ b/gdb/testsuite/gdb.base/recpar.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/recpar.exp b/gdb/testsuite/gdb.base/recpar.exp
index b62b6aa..5676067 100644
--- a/gdb/testsuite/gdb.base/recpar.exp
+++ b/gdb/testsuite/gdb.base/recpar.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/recurse.exp b/gdb/testsuite/gdb.base/recurse.exp
index 01ba55a..e05f7e0 100644
--- a/gdb/testsuite/gdb.base/recurse.exp
+++ b/gdb/testsuite/gdb.base/recurse.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -108,10 +108,10 @@ proc recurse_tests {} {
# The former version expected the test to return to main().
# Now it expects the test to return to main or to stop in the
# function's epilogue.
- #
+ #
# The problem is that gdb needs to (but doesn't) understand
# function epilogues in the same way as for prologues.
- #
+ #
# If there is no hardware watchpoint (such as a x86 debug register),
# then watchpoints are done "the hard way" by single-stepping the
# target until the value of the watched variable changes. If you
@@ -119,7 +119,7 @@ proc recurse_tests {} {
# When you do that, the "top" stack frame may become partially
# deconstructed (as when you pop the frame pointer, for instance),
# and from that point on, GDB can no longer make sense of the stack.
- #
+ #
# A test which stops in the epilogue is trying to determine when GDB
# leaves the stack frame in which the watchpoint was created. It does
# this basically by watching for the frame pointer to change. When
@@ -134,7 +134,7 @@ proc recurse_tests {} {
# Preserve the old timeout, and set a new one that should be
# sufficient to avoid timing out during this test.
set oldtimeout $timeout
-set timeout [expr "$timeout + 60"]
+set timeout [expr {$timeout + 60}]
verbose "Timeout is now $timeout seconds" 2
recurse_tests
diff --git a/gdb/testsuite/gdb.base/reggroups.c b/gdb/testsuite/gdb.base/reggroups.c
index cd4a9b2..7d13022 100644
--- a/gdb/testsuite/gdb.base/reggroups.c
+++ b/gdb/testsuite/gdb.base/reggroups.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/reggroups.exp b/gdb/testsuite/gdb.base/reggroups.exp
index 638601b..0d333af 100644
--- a/gdb/testsuite/gdb.base/reggroups.exp
+++ b/gdb/testsuite/gdb.base/reggroups.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -114,7 +114,7 @@ set reggroups [fetch_reggroups "fetch reggroups"]
set regcount 0
foreach reggroup $reggroups {
set regs [fetch_reggroup_regs $reggroup "fetch reggroup regs $reggroup"]
- set regcount [expr $regcount + [llength $regs]]
+ set regcount [expr {$regcount + [llength $regs]}]
}
gdb_assert "[llength $regcount] != 0" "system has reggroup registers"
diff --git a/gdb/testsuite/gdb.base/relational.exp b/gdb/testsuite/gdb.base/relational.exp
index 76352fd..d79e205 100644
--- a/gdb/testsuite/gdb.base/relational.exp
+++ b/gdb/testsuite/gdb.base/relational.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
#
# tests for correctenss of relational operators, associativity and precedence
# with integer type variables
-#
+#
#
# test running programs
diff --git a/gdb/testsuite/gdb.base/relativedebug.c b/gdb/testsuite/gdb.base/relativedebug.c
index c696cce..f6b1614 100644
--- a/gdb/testsuite/gdb.base/relativedebug.c
+++ b/gdb/testsuite/gdb.base/relativedebug.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/relativedebug.exp b/gdb/testsuite/gdb.base/relativedebug.exp
index f882a5c..2465ffd 100644
--- a/gdb/testsuite/gdb.base/relativedebug.exp
+++ b/gdb/testsuite/gdb.base/relativedebug.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
# Get things started.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
runto_main
diff --git a/gdb/testsuite/gdb.base/relocate.c b/gdb/testsuite/gdb.base/relocate.c
index 0b65036..6cd946f 100644
--- a/gdb/testsuite/gdb.base/relocate.c
+++ b/gdb/testsuite/gdb.base/relocate.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/relocate.exp b/gdb/testsuite/gdb.base/relocate.exp
index e3a6a03..db42885 100644
--- a/gdb/testsuite/gdb.base/relocate.exp
+++ b/gdb/testsuite/gdb.base/relocate.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ clean_restart
#Check that invalid options are rejected.
foreach x {"-raednow" "readnow" "foo" "-readnow s"} {
- set word [lindex $x [expr [llength $x]-1]]
+ set word [lindex $x [expr {[llength $x]-1}]]
gdb_test "add-symbol-file ${binfile} 0 $x" \
"Unrecognized argument \"$word\"" \
"add-symbol-file: unknown option $word"
@@ -278,7 +278,7 @@ with_test_prefix "functions, 2nd" {
# Re-load the object giving an explicit address for .text
-set text [ format "0x%x" [expr ${function_foo_addr} + 0x20000] ]
+set text [ format "0x%x" [expr {${function_foo_addr} + 0x20000}] ]
clean_restart
gdb_test "add-symbol-file $binfile -o $offset $text" \
"Reading symbols from ${binfile}\.\.\.(\r\n$readnow_re)?" \
@@ -295,7 +295,7 @@ with_test_prefix "functions, 3rd" {
# Re-load the object giving an explicit address for .data
-set data [ format "0x%x" [expr ${global_foo_addr} + 0x20000] ]
+set data [ format "0x%x" [expr {${global_foo_addr} + 0x20000}] ]
clean_restart
gdb_test "add-symbol-file $binfile -o $offset -s .data $data" \
"Reading symbols from ${binfile}\.\.\.(\r\n$readnow_re)?" \
diff --git a/gdb/testsuite/gdb.base/remote-exec-file.exp b/gdb/testsuite/gdb.base/remote-exec-file.exp
index 2ef23f0..baaf039 100644
--- a/gdb/testsuite/gdb.base/remote-exec-file.exp
+++ b/gdb/testsuite/gdb.base/remote-exec-file.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,10 +37,13 @@ with_test_prefix "set inf 2" {
with_test_prefix "show inf 1" {
gdb_test "inferior 1" "Switching to inferior 1.*"
- gdb_test "show remote exec-file" "prog1"
+ gdb_test "show remote exec-file" \
+ "The remote exec-file is \"prog1\"\\."
+
}
with_test_prefix "show inf 2" {
gdb_test "inferior 2" "Switching to inferior 2.*"
- gdb_test "show remote exec-file" "prog2"
+ gdb_test "show remote exec-file" \
+ "The remote exec-file is \"prog2\"\\."
}
diff --git a/gdb/testsuite/gdb.base/remote.exp b/gdb/testsuite/gdb.base/remote.exp
index 52c4d27..1d97726 100644
--- a/gdb/testsuite/gdb.base/remote.exp
+++ b/gdb/testsuite/gdb.base/remote.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -136,7 +136,7 @@ proc gdb_load_timed {executable class writesize} {
fail "$test - loading executable"
return
}
- verbose "$test - time [expr ($load_end_time - $load_begin_time) / 1000] ms"
+ verbose "$test - time [expr {($load_end_time - $load_begin_time) / 1000}] ms"
pass $test
}
@@ -164,7 +164,8 @@ gdb_load_timed $binfile "limit" 0
# Get the size of random_data table (defaults to 48K).
set sizeof_random_data [get_sizeof "random_data" 48*1024]
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
#
# Part THREE: Check the upload behavior.
diff --git a/gdb/testsuite/gdb.base/remotetimeout.exp b/gdb/testsuite/gdb.base/remotetimeout.exp
index b7d8c90..0f1e167 100644
--- a/gdb/testsuite/gdb.base/remotetimeout.exp
+++ b/gdb/testsuite/gdb.base/remotetimeout.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/reread-readsym.c b/gdb/testsuite/gdb.base/reread-readsym.c
index 0c151af..145a3b4 100644
--- a/gdb/testsuite/gdb.base/reread-readsym.c
+++ b/gdb/testsuite/gdb.base/reread-readsym.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/reread-readsym.exp b/gdb/testsuite/gdb.base/reread-readsym.exp
index 8c06ff6..698662d 100644
--- a/gdb/testsuite/gdb.base/reread-readsym.exp
+++ b/gdb/testsuite/gdb.base/reread-readsym.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/reread.exp b/gdb/testsuite/gdb.base/reread.exp
index 481409b..065cf1b 100644
--- a/gdb/testsuite/gdb.base/reread.exp
+++ b/gdb/testsuite/gdb.base/reread.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -86,7 +86,7 @@ foreach_with_prefix opts { "" "pie" } {
# Should see "Breakpoint 1, foo () at reread2.c:9"
set test "run to foo() second time"
- if [is_remote target] {
+ if {[is_remote target]} {
unsupported $test
} else {
gdb_run_cmd
@@ -97,7 +97,7 @@ foreach_with_prefix opts { "" "pie" } {
### Second pass: verify that GDB checks the executable file's
### timestamp when the program is *restarted*, not just when it exits.
- if [is_remote target] {
+ if {[is_remote target]} {
unsupported "second pass: GDB should check for changes before running"
} else {
@@ -106,7 +106,8 @@ foreach_with_prefix opts { "" "pie" } {
gdb_rename_execfile ${binfile1} ${binfile}
# Restart GDB entirely.
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
# Set a breakpoint on foo and run to it.
gdb_test "break foo" \
diff --git a/gdb/testsuite/gdb.base/reset-catchpoint-cond-lib.c b/gdb/testsuite/gdb.base/reset-catchpoint-cond-lib.c
index 06f3c3d..1df2260 100644
--- a/gdb/testsuite/gdb.base/reset-catchpoint-cond-lib.c
+++ b/gdb/testsuite/gdb.base/reset-catchpoint-cond-lib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/reset-catchpoint-cond.c b/gdb/testsuite/gdb.base/reset-catchpoint-cond.c
index 0c1d5ea..11bd74d 100644
--- a/gdb/testsuite/gdb.base/reset-catchpoint-cond.c
+++ b/gdb/testsuite/gdb.base/reset-catchpoint-cond.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/reset-catchpoint-cond.exp b/gdb/testsuite/gdb.base/reset-catchpoint-cond.exp
index d953938..852576a 100644
--- a/gdb/testsuite/gdb.base/reset-catchpoint-cond.exp
+++ b/gdb/testsuite/gdb.base/reset-catchpoint-cond.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -75,7 +75,8 @@ proc run_test { mode } {
return
}
- clean_restart $exec_name
+ clean_restart
+ gdb_load $exec_name
gdb_load_shlib $::libfile
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.base/reset-catchpoint-cond.py b/gdb/testsuite/gdb.base/reset-catchpoint-cond.py
index bf90ec8..9a93920 100644
--- a/gdb/testsuite/gdb.base/reset-catchpoint-cond.py
+++ b/gdb/testsuite/gdb.base/reset-catchpoint-cond.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/restore.c b/gdb/testsuite/gdb.base/restore.c
index 7b7882b..a8f8fd3 100644
--- a/gdb/testsuite/gdb.base/restore.c
+++ b/gdb/testsuite/gdb.base/restore.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1998-2024 Free Software Foundation, Inc.
+ Copyright 1998-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/restore.exp b/gdb/testsuite/gdb.base/restore.exp
index 2d50fb1..a19c956 100644
--- a/gdb/testsuite/gdb.base/restore.exp
+++ b/gdb/testsuite/gdb.base/restore.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -55,10 +55,10 @@ proc restore_tests { } {
gdb_test "tbreak callee$e" "Temporary breakpoint.*\[0-9\]*\\." \
"caller$c calls callee$e; tbreak callee"
-
+
gdb_test "continue" " callee$e prologue .*/" \
"caller$c calls callee$e; continue to callee"
-
+
# Do a forced return from the callee.
set test "caller$c calls callee$e; return callee now"
@@ -71,7 +71,7 @@ proc restore_tests { } {
# Check that the values of the local variables are what
# they should be.
for {set var 1} {$var <= $c} {incr var} {
- set expected [expr 0x7eeb + $var]
+ set expected [expr {0x7eeb + $var}]
set test "caller$c calls callee$e; return restored l$var to $expected"
set pass_pattern " = $expected"
set unsupported_pattern " = <optimized out>"
@@ -96,7 +96,8 @@ restore_tests
set timeout $prev_timeout
# Test PR cli/23785
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
if { ![runto_main] } {
return -1
}
diff --git a/gdb/testsuite/gdb.base/return-nodebug.c b/gdb/testsuite/gdb.base/return-nodebug.c
index d8e08ed..d0724f7 100644
--- a/gdb/testsuite/gdb.base/return-nodebug.c
+++ b/gdb/testsuite/gdb.base/return-nodebug.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/return-nodebug.exp b/gdb/testsuite/gdb.base/return-nodebug.exp
index d44967b..32b31c6 100644
--- a/gdb/testsuite/gdb.base/return-nodebug.exp
+++ b/gdb/testsuite/gdb.base/return-nodebug.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/return-nodebug1.c b/gdb/testsuite/gdb.base/return-nodebug1.c
index d733d06..c129b44 100644
--- a/gdb/testsuite/gdb.base/return-nodebug1.c
+++ b/gdb/testsuite/gdb.base/return-nodebug1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/return.c b/gdb/testsuite/gdb.base/return.c
index 6520663..c17470d 100644
--- a/gdb/testsuite/gdb.base/return.c
+++ b/gdb/testsuite/gdb.base/return.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1992-2024 Free Software Foundation, Inc.
+ Copyright 1992-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/return.exp b/gdb/testsuite/gdb.base/return.exp
index 23016f8..2d8665f 100644
--- a/gdb/testsuite/gdb.base/return.exp
+++ b/gdb/testsuite/gdb.base/return.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-2024 Free Software Foundation, Inc.
+# Copyright (C) 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,8 +36,8 @@ proc return_tests { } {
send_gdb "step\n"
exp_continue
}
- -re ".*in main after func1.*$gdb_prompt $" {
- pass "simple return"
+ -re ".*in main after func1.*$gdb_prompt $" {
+ pass "simple return"
}
}
diff --git a/gdb/testsuite/gdb.base/return2.exp b/gdb/testsuite/gdb.base/return2.exp
index a9b0b98..e90a60b 100644
--- a/gdb/testsuite/gdb.base/return2.exp
+++ b/gdb/testsuite/gdb.base/return2.exp
@@ -1,4 +1,4 @@
-# Copyright 2000-2024 Free Software Foundation, Inc.
+# Copyright 2000-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -103,7 +103,8 @@ proc return2_tests { } {
# Start with a fresh gdb.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
set timeout 30
return2_tests
diff --git a/gdb/testsuite/gdb.base/retval-large-struct.c b/gdb/testsuite/gdb.base/retval-large-struct.c
index 52ac178..839b1fb 100644
--- a/gdb/testsuite/gdb.base/retval-large-struct.c
+++ b/gdb/testsuite/gdb.base/retval-large-struct.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/retval-large-struct.exp b/gdb/testsuite/gdb.base/retval-large-struct.exp
index a8f6ff6..4414f6f 100644
--- a/gdb/testsuite/gdb.base/retval-large-struct.exp
+++ b/gdb/testsuite/gdb.base/retval-large-struct.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/reverse-init-functions.exp b/gdb/testsuite/gdb.base/reverse-init-functions.exp
index 5558d28..74201e9 100644
--- a/gdb/testsuite/gdb.base/reverse-init-functions.exp
+++ b/gdb/testsuite/gdb.base/reverse-init-functions.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/rtld-step-main.c b/gdb/testsuite/gdb.base/rtld-step-main.c
index 5677680..91b7727 100644
--- a/gdb/testsuite/gdb.base/rtld-step-main.c
+++ b/gdb/testsuite/gdb.base/rtld-step-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/rtld-step-nodebugsym.c b/gdb/testsuite/gdb.base/rtld-step-nodebugsym.c
index 029a504..4e3f807 100644
--- a/gdb/testsuite/gdb.base/rtld-step-nodebugsym.c
+++ b/gdb/testsuite/gdb.base/rtld-step-nodebugsym.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/rtld-step-nodebugsym.exp b/gdb/testsuite/gdb.base/rtld-step-nodebugsym.exp
index b64c8fe..7c617f2 100644
--- a/gdb/testsuite/gdb.base/rtld-step-nodebugsym.exp
+++ b/gdb/testsuite/gdb.base/rtld-step-nodebugsym.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/rtld-step-rtld.c b/gdb/testsuite/gdb.base/rtld-step-rtld.c
index 8d88a5a..31d008f 100644
--- a/gdb/testsuite/gdb.base/rtld-step-rtld.c
+++ b/gdb/testsuite/gdb.base/rtld-step-rtld.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/rtld-step.exp b/gdb/testsuite/gdb.base/rtld-step.exp
index 1985428..a2086a1 100644
--- a/gdb/testsuite/gdb.base/rtld-step.exp
+++ b/gdb/testsuite/gdb.base/rtld-step.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -53,7 +53,7 @@ set binfile_rtld [standard_output_file ${rtld_basename}]
# the flags -static-pie -fPIE were needed for Fedora 35 through Fedora
# 38. The source file rtld-step-rtld.c didn't need the _start()
# function either. And, better still, it was possible to call
-# printf() to output progress messages in the pretend/fake RTLD.
+# printf() to output progress messages in the pretend/fake RTLD.
# Sadly, these output statements had to be removed in order to obtain
# code which would work on other Linux distributions / releases.
#
@@ -114,7 +114,8 @@ if { [gdb_compile ${srcfile_main} ${binfile_main} executable $main_flags] != ""
return -1
}
-clean_restart ${binfile_main}
+clean_restart
+gdb_load $binfile_main
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.base/run-after-attach.c b/gdb/testsuite/gdb.base/run-after-attach.c
index 3aa16f5..78b0e7b 100644
--- a/gdb/testsuite/gdb.base/run-after-attach.c
+++ b/gdb/testsuite/gdb.base/run-after-attach.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/run-after-attach.exp b/gdb/testsuite/gdb.base/run-after-attach.exp
index 7e9211b..2b8b4d0 100644
--- a/gdb/testsuite/gdb.base/run-after-attach.exp
+++ b/gdb/testsuite/gdb.base/run-after-attach.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ require can_spawn_for_attach
standard_testfile
set executable $testfile
-if [prepare_for_testing "failed to prepare" $executable] {
+if {[prepare_for_testing "failed to prepare" $executable]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/run-attach-while-running.c b/gdb/testsuite/gdb.base/run-attach-while-running.c
index a736c7e..35b5df3 100644
--- a/gdb/testsuite/gdb.base/run-attach-while-running.c
+++ b/gdb/testsuite/gdb.base/run-attach-while-running.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/run-attach-while-running.exp b/gdb/testsuite/gdb.base/run-attach-while-running.exp
index 7bf73fdb..7b40a5f 100644
--- a/gdb/testsuite/gdb.base/run-attach-while-running.exp
+++ b/gdb/testsuite/gdb.base/run-attach-while-running.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -60,7 +60,8 @@ proc_with_prefix test { non-stop threaded run-or-attach } {
set ::GDBFLAGS "$::GDBFLAGS -ex \"maint set target-non-stop on\""
}
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
}
if { ![runto_main] } {
diff --git a/gdb/testsuite/gdb.base/run-control-while-bg-execution.c b/gdb/testsuite/gdb.base/run-control-while-bg-execution.c
index 1fd36ee..329b0b1 100644
--- a/gdb/testsuite/gdb.base/run-control-while-bg-execution.c
+++ b/gdb/testsuite/gdb.base/run-control-while-bg-execution.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/run-control-while-bg-execution.exp b/gdb/testsuite/gdb.base/run-control-while-bg-execution.exp
index 380047a..2c75d06 100644
--- a/gdb/testsuite/gdb.base/run-control-while-bg-execution.exp
+++ b/gdb/testsuite/gdb.base/run-control-while-bg-execution.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -49,9 +49,15 @@ if {[build_executable "failed to prepare" $testfile $srcfile]} {
# - run: use the run command
# - attach: start a process outside of GDB and attach it
proc do_test { action1 action2 } {
+
+ if {$action1 == "add" && ![allow_multi_inferior_tests]} {
+ return
+ }
+
save_vars { ::GDBFLAGS } {
append ::GDBFLAGS " -ex \"maintenance set target-non-stop on\""
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
}
# Ensure we are at least after the getpid call, should we need it.
diff --git a/gdb/testsuite/gdb.base/run-fail-twice.c b/gdb/testsuite/gdb.base/run-fail-twice.c
index fddf841..2bbb585 100644
--- a/gdb/testsuite/gdb.base/run-fail-twice.c
+++ b/gdb/testsuite/gdb.base/run-fail-twice.c
@@ -1,4 +1,4 @@
-/* Copyright 2024 Free Software Foundation, Inc.
+/* Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/run-fail-twice.exp b/gdb/testsuite/gdb.base/run-fail-twice.exp
index 676fc48..07cbdda 100644
--- a/gdb/testsuite/gdb.base/run-fail-twice.exp
+++ b/gdb/testsuite/gdb.base/run-fail-twice.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,7 +43,8 @@ proc test_run {testname} {
proc_with_prefix test {} {
global gdb_prompt binfile
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
gdb_test_no_output "set confirm off"
diff --git a/gdb/testsuite/gdb.base/save-bp.c b/gdb/testsuite/gdb.base/save-bp.c
index 8936894..103b092 100644
--- a/gdb/testsuite/gdb.base/save-bp.c
+++ b/gdb/testsuite/gdb.base/save-bp.c
@@ -1,4 +1,4 @@
-/* Copyright 2011-2024 Free Software Foundation, Inc.
+/* Copyright 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/save-bp.exp b/gdb/testsuite/gdb.base/save-bp.exp
index 2872d7b..00b216a 100644
--- a/gdb/testsuite/gdb.base/save-bp.exp
+++ b/gdb/testsuite/gdb.base/save-bp.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# Delete all breakpoints, watchpoints, tracepoints, and catchpoints so that
@@ -61,7 +61,7 @@ gdb_test "save breakpoint $bps" "" "save breakpoint bps"
# Now start a new debugger session...
clean_restart $testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# Delete all breakpoints, watchpoints, tracepoints, and catchpoints so that
diff --git a/gdb/testsuite/gdb.base/savedregs.c b/gdb/testsuite/gdb.base/savedregs.c
index dffdc87..a916cab 100644
--- a/gdb/testsuite/gdb.base/savedregs.c
+++ b/gdb/testsuite/gdb.base/savedregs.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/savedregs.exp b/gdb/testsuite/gdb.base/savedregs.exp
index f20fd7c..74b402f 100644
--- a/gdb/testsuite/gdb.base/savedregs.exp
+++ b/gdb/testsuite/gdb.base/savedregs.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
}
# get things started
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
# Advance to main
if {![runto_main]} {
@@ -95,7 +96,7 @@ proc process_saved_regs { current inner outer } {
}
incr level
}
-
+
# Now iterate through the list of OUTER frames checking that the
# "info frame" output from each still matches what was captured
# during an early query. To avoid cascading failures, checking is
@@ -108,7 +109,7 @@ proc process_saved_regs { current inner outer } {
foreach func $outer {
set test [concat "Check $func info frame; stack contains" \
$current $inner $outer]
- if $ok {
+ if {$ok} {
set ok 0
set pat [string_to_regexp "$saved_regs($func)"]
gdb_test_multiple "info frame $level" "$test" {
diff --git a/gdb/testsuite/gdb.base/scope-hw-watch-disable.c b/gdb/testsuite/gdb.base/scope-hw-watch-disable.c
index df5baad..6453766 100644
--- a/gdb/testsuite/gdb.base/scope-hw-watch-disable.c
+++ b/gdb/testsuite/gdb.base/scope-hw-watch-disable.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/scope-hw-watch-disable.exp b/gdb/testsuite/gdb.base/scope-hw-watch-disable.exp
index 29eb682..6ddb2f6 100644
--- a/gdb/testsuite/gdb.base/scope-hw-watch-disable.exp
+++ b/gdb/testsuite/gdb.base/scope-hw-watch-disable.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/scope.exp b/gdb/testsuite/gdb.base/scope.exp
index a3b11f6..38ab6ca 100644
--- a/gdb/testsuite/gdb.base/scope.exp
+++ b/gdb/testsuite/gdb.base/scope.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -263,7 +263,7 @@ proc_with_prefix test_at_autovars {} {
set count 0
while {$count < 100} {
gdb_test "print i$count" ".* = $count" ""
- set count [expr $count+1]
+ set count [expr {$count+1}]
}
clear_xfail "*-*-*"
pass "$count auto variables correctly initialized"
@@ -327,7 +327,7 @@ clean_restart
gdb_file_cmd $binfile
# Test that variables in various segments print out correctly before
-# the program is run.
+# the program is run.
# AIX--sections get mapped to the same address so we can't get the right one.
setup_xfail "rs6000-*-*"
diff --git a/gdb/testsuite/gdb.base/sect-cmd.exp b/gdb/testsuite/gdb.base/sect-cmd.exp
index 49a94cd..e8d1404 100644
--- a/gdb/testsuite/gdb.base/sect-cmd.exp
+++ b/gdb/testsuite/gdb.base/sect-cmd.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/segv.c b/gdb/testsuite/gdb.base/segv.c
index 53aef97..b730e7a 100644
--- a/gdb/testsuite/gdb.base/segv.c
+++ b/gdb/testsuite/gdb.base/segv.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/sep-proc.c b/gdb/testsuite/gdb.base/sep-proc.c
index 8466e2e..a72c7d2 100644
--- a/gdb/testsuite/gdb.base/sep-proc.c
+++ b/gdb/testsuite/gdb.base/sep-proc.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/sep.c b/gdb/testsuite/gdb.base/sep.c
index 0df02e8..5cd4223 100644
--- a/gdb/testsuite/gdb.base/sep.c
+++ b/gdb/testsuite/gdb.base/sep.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/sep.exp b/gdb/testsuite/gdb.base/sep.exp
index eb36dd0..6abf356 100644
--- a/gdb/testsuite/gdb.base/sep.exp
+++ b/gdb/testsuite/gdb.base/sep.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
set location [gdb_get_line_number "say_hello" "sep-proc.c"]
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
# Try to display the source code inside a file which is included by
# another source file. The purpose of this test is to verify that
@@ -45,7 +46,8 @@ gdb_test "list sep-proc.c:$location" \
# Try the same, but this time with a breakpoint. We need to exit
# GDB to make sure that we havn't loaded the full symbols yet when
# we test the breakpoint insertion.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
set test "breakpoint inside included file"
gdb_test_multiple "break sep-proc.c:$location" "$test" {
diff --git a/gdb/testsuite/gdb.base/sepdebug.c b/gdb/testsuite/gdb.base/sepdebug.c
index d6ecadd..47111cb 100644
--- a/gdb/testsuite/gdb.base/sepdebug.c
+++ b/gdb/testsuite/gdb.base/sepdebug.c
@@ -1,4 +1,4 @@
-/* Copyright 1994-2024 Free Software Foundation, Inc.
+/* Copyright 1994-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp
index eb3515b..0235cbe 100644
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -1,4 +1,4 @@
-# Copyright 1988-2024 Free Software Foundation, Inc.
+# Copyright 1988-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
# the name of a debuginfo only file. This file will be stored in the
# gdb.base/ subdirectory.
-if [gdb_gnu_strip_debug $binfile$EXEEXT] {
+if {[gdb_gnu_strip_debug $binfile$EXEEXT]} {
# check that you have a recent version of strip and objcopy installed
unsupported "cannot produce separate debug info files"
return -1
@@ -461,7 +461,7 @@ gdb_test "finish 123" \
# Verify that GDB responds gracefully to a request to "finish" from
# the outermost frame. On a stub that never exits, this will just
-# run to the stubs routine, so we don't get this error... Thus the
+# run to the stubs routine, so we don't get this error... Thus the
# second condition.
#
@@ -478,7 +478,7 @@ gdb_test_multiple "finish" "finish from outermost frame disallowed" {
# Test "next" over recursive function call.
#
-proc test_next_with_recursion {} {
+proc test_next_with_recursion {} {
global gdb_prompt
global decimal
global binfile
@@ -520,7 +520,7 @@ proc test_next_with_recursion {} {
delete_breakpoints
- if [istarget "mips*tx39-*"] {
+ if {[istarget "mips*tx39-*"]} {
set timeout 60
}
# We used to set timeout here for all other targets as well. This
@@ -610,7 +610,7 @@ proc test_different_dir {type test_different_dir xfail} {
#
# Add a second pass pattern. The behavior differs here between stabs
# and dwarf for one-line functions. Stabs preserves two line symbols
- # (one before the prologue and one after) with the same line number,
+ # (one before the prologue and one after) with the same line number,
# but dwarf regards these as duplicates and discards one of them.
# Therefore the address after the prologue (where the breakpoint is)
# has no exactly matching line symbol, and GDB reports the breakpoint
diff --git a/gdb/testsuite/gdb.base/sepdebug2.c b/gdb/testsuite/gdb.base/sepdebug2.c
index e816f41..490b4d8 100644
--- a/gdb/testsuite/gdb.base/sepdebug2.c
+++ b/gdb/testsuite/gdb.base/sepdebug2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/sepsymtab.c b/gdb/testsuite/gdb.base/sepsymtab.c
index 995d195..1876b5c 100644
--- a/gdb/testsuite/gdb.base/sepsymtab.c
+++ b/gdb/testsuite/gdb.base/sepsymtab.c
@@ -1,4 +1,4 @@
-/* Copyright 2006-2024 Free Software Foundation, Inc.
+/* Copyright 2006-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/sepsymtab.exp b/gdb/testsuite/gdb.base/sepsymtab.exp
index c94ca9f..1822f1f 100644
--- a/gdb/testsuite/gdb.base/sepsymtab.exp
+++ b/gdb/testsuite/gdb.base/sepsymtab.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,13 +25,14 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-if [gdb_gnu_strip_debug $binfile no-main] {
+if {[gdb_gnu_strip_debug $binfile no-main]} {
# check that you have a recent version of strip and objcopy installed
unsupported "cannot produce separate debug info files"
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
set command "info sym main"
set command_regex [string_to_regexp $command]
diff --git a/gdb/testsuite/gdb.base/server-del-break.c b/gdb/testsuite/gdb.base/server-del-break.c
index 0c151af..145a3b4 100644
--- a/gdb/testsuite/gdb.base/server-del-break.c
+++ b/gdb/testsuite/gdb.base/server-del-break.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/server-del-break.exp b/gdb/testsuite/gdb.base/server-del-break.exp
index db59878..adf5035 100644
--- a/gdb/testsuite/gdb.base/server-del-break.exp
+++ b/gdb/testsuite/gdb.base/server-del-break.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/set-cwd.c b/gdb/testsuite/gdb.base/set-cwd.c
index f27e398..eaf8a9b 100644
--- a/gdb/testsuite/gdb.base/set-cwd.c
+++ b/gdb/testsuite/gdb.base/set-cwd.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/set-cwd.exp b/gdb/testsuite/gdb.base/set-cwd.exp
index 41446f8..73a200f 100644
--- a/gdb/testsuite/gdb.base/set-cwd.exp
+++ b/gdb/testsuite/gdb.base/set-cwd.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -184,7 +184,9 @@ proc_with_prefix test_cwd_reset { } {
}
test_cd_into_dir
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
test_tilde_expansion
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
test_cwd_reset
diff --git a/gdb/testsuite/gdb.base/set-inferior-tty.c b/gdb/testsuite/gdb.base/set-inferior-tty.c
index 26a4197..3207aa9 100644
--- a/gdb/testsuite/gdb.base/set-inferior-tty.c
+++ b/gdb/testsuite/gdb.base/set-inferior-tty.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/set-inferior-tty.exp b/gdb/testsuite/gdb.base/set-inferior-tty.exp
index 47a1f4d..c9b0a96 100644
--- a/gdb/testsuite/gdb.base/set-inferior-tty.exp
+++ b/gdb/testsuite/gdb.base/set-inferior-tty.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,8 @@ if {[build_executable $testfile.exp $testfile ${srcfile} ${compile_options}] ==
proc test_set_inferior_tty { command } {
global binfile
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
gdb_test_no_output "$command hello" "set inferior-tty to hello"
gdb_test "show inferior-tty" \
diff --git a/gdb/testsuite/gdb.base/set-lang-auto.exp b/gdb/testsuite/gdb.base/set-lang-auto.exp
index 9958e43..e6f961b 100644
--- a/gdb/testsuite/gdb.base/set-lang-auto.exp
+++ b/gdb/testsuite/gdb.base/set-lang-auto.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/set-noassign.exp b/gdb/testsuite/gdb.base/set-noassign.exp
index f59860d..be0c2bc 100644
--- a/gdb/testsuite/gdb.base/set-noassign.exp
+++ b/gdb/testsuite/gdb.base/set-noassign.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp
index 9380331..2d5b62d 100644
--- a/gdb/testsuite/gdb.base/setshow.exp
+++ b/gdb/testsuite/gdb.base/setshow.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,8 @@ if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable {debug}]
proc_with_prefix test_setshow_annotate {} {
# Start with a fresh gdb
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
if {![runto_main]} {
return
@@ -78,7 +79,8 @@ proc_with_prefix test_setshow_annotate {} {
}
proc_with_prefix test_setshow_args {} {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
if {![runto_main]} {
return
@@ -409,7 +411,7 @@ proc_with_prefix test_setshow_print_characters {} {
proc_with_prefix test_setshow_prompt {} {
clean_restart
- if [board_info target exists gdb_prompt] {
+ if {[board_info target exists gdb_prompt]} {
return
}
@@ -513,6 +515,70 @@ proc_with_prefix test_argument_preceded_by_space {} {
}
}
+# Some settings are per-inferior instead of global. Verify that we can set
+# and show them correctly, including with the $_gdb_setting and
+# $_gdb_setting_str convenience functions.
+
+proc_with_prefix test_per_inferior_settings {} {
+ clean_restart $::testfile
+
+ # The $_gdb_setting/$_gdb_setting_str tests require running inferiors,
+ # because they allocate memory in the inferiors for the produced values.
+ # Since we need two inferiors for this test, we can't run them with stub
+ # boards (e.g. gdbserver with non-extended remote protocol), since they
+ # can only run one inferior at a time. We can still run the other tests
+ # with multiple inferiors, they just won't be running inferiors.
+ set run [expr {![use_gdb_stub]}]
+
+ # Add a second inferior.
+ gdb_test "add-inferior -exec $::binfile" "Added inferior 2.*" \
+ "add second inferior"
+
+ # Set some settings on each inferior.
+ foreach_with_prefix inf {1 2} {
+ gdb_test "inferior ${inf}" "Switching to inferior ${inf}.*" \
+ "switch to inferior ${inf} before set"
+
+ if { $run } {
+ if {![runto_main]} {
+ fail "could not run to main"
+ return
+ }
+ }
+
+ gdb_test_no_output "set inferior-tty /inf${inf}-tty"
+ gdb_test_no_output "set cwd /inf${inf}-cwd"
+ gdb_test_no_output "set args /inf${inf}-args"
+ gdb_test_no_output "set remote exec-file /inf${inf}-ref"
+ # Outputs a warning, ignore it.
+ gdb_test "set tdesc filename /inf${inf}-tf"
+ }
+
+ foreach_with_prefix inf {1 2} {
+ gdb_test "inferior ${inf}" "Switching to inferior ${inf}.*" \
+ "switch to inferior ${inf} before show"
+
+ gdb_test "show inferior-tty" "Terminal for future runs of program being debugged is \"/inf${inf}-tty\"."
+ gdb_test "show cwd" "Current working directory that will be used when starting the inferior is \"/inf${inf}-cwd\"."
+ gdb_test "show args" "Argument list to give program being debugged when it is started is \"/inf${inf}-args\"."
+ gdb_test "show remote exec-file" "The remote exec-file is \"/inf${inf}-ref\"."
+ gdb_test "show tdesc filename" "The target description will be read from \"/inf${inf}-tf\"."
+
+ if { $run } {
+ gdb_test "print \$_gdb_setting(\"inferior-tty\")" " = \"/inf${inf}-tty\""
+ gdb_test "print \$_gdb_setting_str(\"inferior-tty\")" " = \"/inf${inf}-tty\""
+ gdb_test "print \$_gdb_setting(\"cwd\")" " = \"/inf${inf}-cwd\""
+ gdb_test "print \$_gdb_setting_str(\"cwd\")" " = \"/inf${inf}-cwd\""
+ gdb_test "print \$_gdb_setting(\"args\")" " = \"/inf${inf}-args\""
+ gdb_test "print \$_gdb_setting_str(\"args\")" " = \"/inf${inf}-args\""
+ gdb_test "print \$_gdb_setting(\"remote exec-file\")" " = \"/inf${inf}-ref\""
+ gdb_test "print \$_gdb_setting_str(\"remote exec-file\")" " = \"/inf${inf}-ref\""
+ gdb_test "print \$_gdb_setting(\"tdesc filename\")" " = \"/inf${inf}-tf\""
+ gdb_test "print \$_gdb_setting_str(\"tdesc filename\")" " = \"/inf${inf}-tf\""
+ }
+ }
+}
+
test_setshow_annotate
test_setshow_args
test_setshow_check
@@ -533,3 +599,4 @@ test_setshow_write
test_show_user
test_setshow_verbose
test_argument_preceded_by_space
+test_per_inferior_settings
diff --git a/gdb/testsuite/gdb.base/settings.c b/gdb/testsuite/gdb.base/settings.c
index b6a97f1..5333d9d 100644
--- a/gdb/testsuite/gdb.base/settings.c
+++ b/gdb/testsuite/gdb.base/settings.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/settings.exp b/gdb/testsuite/gdb.base/settings.exp
index 3dafbae..d83023b 100644
--- a/gdb/testsuite/gdb.base/settings.exp
+++ b/gdb/testsuite/gdb.base/settings.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -531,7 +531,8 @@ proc test-string {variant} {
global srcfile binfile
# Load symbols for the completion test below.
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
# Use these variables to make sure we don't call the wrong command
# by mistake.
diff --git a/gdb/testsuite/gdb.base/setvar.exp b/gdb/testsuite/gdb.base/setvar.exp
index 416dcc6..5335eff 100644
--- a/gdb/testsuite/gdb.base/setvar.exp
+++ b/gdb/testsuite/gdb.base/setvar.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 1988-2024 Free Software Foundation, Inc.
+# Copyright 1988-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
#
# set it up at a breakpoint so we canplay with the variable values
#
-gdb_test_no_output "set print sevenbit-strings"
+gdb_test_no_output "set print sevenbit-strings"
if {![runto_main]} {
return
@@ -51,22 +51,22 @@ gdb_test_multiple "print sizeof (unsigned long)" "sizeof ulong" {
set ulong_minus_1 18446744073709551615
set ulong_minus_456 18446744073709551160
}
-}
+}
proc test_set { args } {
global gdb_prompt
- set length [expr [llength $args] - 1]
+ set length [expr {[llength $args] - 1}]
set message "[lindex $args $length]"
- set final [expr $length - 2]
+ set final [expr {$length - 2}]
set count 1
# Set up the variables.
for {set x 0} {$x < $length} {incr x} {
if { "[lindex $args $x]" != "" } {
set arg [lindex $args $x]
- if { ($x == $final) || ([string first ".*" [lindex $args [expr $x + 1]]] >= 0) } {
- set match [lindex $args [expr $x + 1]]
+ if { ($x == $final) || ([string first ".*" [lindex $args [expr {$x + 1}]]] >= 0) } {
+ set match [lindex $args [expr {$x + 1}]]
set mess "$message -- $match"
if { $count != 1 } {
append mess " (#$count)"
@@ -78,7 +78,7 @@ proc test_set { args } {
set mess "$message -- $match"
}
verbose "doing $arg $match"
- if [gdb_test -nopass "$arg" "$match" "$mess"] {
+ if {[gdb_test -nopass "$arg" "$match" "$mess"]} {
return 1
}
}
@@ -91,27 +91,27 @@ proc test_set { args } {
#
# Because bare char types can be either signed or unsigned, we just test the
# range of values that are common to both (0-127).
-#
+#
-test_set "set variable v_char=0" "print v_char" ".\[0-9\]* = 0 \'.000\'" "set variable char=0"
-test_set "set variable v_char=1" "print v_char" ".\[0-9\]* = 1 \'.001\'" "set variable char=1"
-test_set "set variable v_char=7" "print v_char" ".\[0-9\]* = 7 \'.a\'" "set variable char=7 (Bel)"
-test_set "set variable v_char=32" "print v_char" ".\[0-9\]* = 32 \' \'" "set variable char=32 (SPC)"
-test_set "set variable v_char=65" "print v_char" ".\[0-9\]* = 65 \'A\'" "set variable char=65 ('A')"
-test_set "set variable v_char=97" "print v_char" ".\[0-9\]* = 97 \'a\'" "set variable char=97 ('a')"
-test_set "set variable v_char=126" "print v_char" ".\[0-9\]* = 126 \'~\'" "set variable char=126 ('~')"
-test_set "set variable v_char=127" "print v_char" ".\[0-9\]* = 127 \'.177\'" "set variable char=127 (8-bit)"
+test_set "set variable v_char=0" "print v_char" ".\[0-9\]* = 0 \'.000\'" "set variable char=0"
+test_set "set variable v_char=1" "print v_char" ".\[0-9\]* = 1 \'.001\'" "set variable char=1"
+test_set "set variable v_char=7" "print v_char" ".\[0-9\]* = 7 \'.a\'" "set variable char=7 (Bel)"
+test_set "set variable v_char=32" "print v_char" ".\[0-9\]* = 32 \' \'" "set variable char=32 (SPC)"
+test_set "set variable v_char=65" "print v_char" ".\[0-9\]* = 65 \'A\'" "set variable char=65 ('A')"
+test_set "set variable v_char=97" "print v_char" ".\[0-9\]* = 97 \'a\'" "set variable char=97 ('a')"
+test_set "set variable v_char=126" "print v_char" ".\[0-9\]* = 126 \'~\'" "set variable char=126 ('~')"
+test_set "set variable v_char=127" "print v_char" ".\[0-9\]* = 127 \'.177\'" "set variable char=127 (8-bit)"
#
# test "set variable" for type "signed char"
-#
-test_set "set variable v_char=0" "print v_signed_char" ".\[0-9\]* = 0 \'.000\'" "set variable signed char=0"
-test_set "set variable v_signed_char=1" "print v_signed_char" ".\[0-9\]* = 1 \'.001\'" "set variable signed char=1"
-test_set "set variable v_signed_char=7" "print v_signed_char" ".\[0-9\]* = 7 \'.a\'" "set variable signed char=7 (Bel)"
-test_set "set variable v_signed_char=32" "print v_signed_char" ".\[0-9\]* = 32 \' \'" "set variable signed char=32 (SPC)"
-test_set "set variable v_signed_char=65" "print v_signed_char" ".\[0-9\]* = 65 \'A\'" "set variable signed char=65 ('A')"
-test_set "set variable v_signed_char=97" "print v_signed_char" ".\[0-9\]* = 97 \'a\'" "set variable signed char=97 ('a')"
-test_set "set variable v_signed_char=126" "print v_signed_char" ".\[0-9\]* = 126 \'~\'" "set variable signed char=126 ('~')"
-test_set "set variable v_signed_char=127" "print v_signed_char" ".\[0-9\]* = 127 \'.177\'" "set variable signed char=127 (8-bit)"
+#
+test_set "set variable v_char=0" "print v_signed_char" ".\[0-9\]* = 0 \'.000\'" "set variable signed char=0"
+test_set "set variable v_signed_char=1" "print v_signed_char" ".\[0-9\]* = 1 \'.001\'" "set variable signed char=1"
+test_set "set variable v_signed_char=7" "print v_signed_char" ".\[0-9\]* = 7 \'.a\'" "set variable signed char=7 (Bel)"
+test_set "set variable v_signed_char=32" "print v_signed_char" ".\[0-9\]* = 32 \' \'" "set variable signed char=32 (SPC)"
+test_set "set variable v_signed_char=65" "print v_signed_char" ".\[0-9\]* = 65 \'A\'" "set variable signed char=65 ('A')"
+test_set "set variable v_signed_char=97" "print v_signed_char" ".\[0-9\]* = 97 \'a\'" "set variable signed char=97 ('a')"
+test_set "set variable v_signed_char=126" "print v_signed_char" ".\[0-9\]* = 126 \'~\'" "set variable signed char=126 ('~')"
+test_set "set variable v_signed_char=127" "print v_signed_char" ".\[0-9\]* = 127 \'.177\'" "set variable signed char=127 (8-bit)"
gdb_test_no_output "set variable v_signed_char=-1"
with_target_charset "ASCII" {
@@ -129,156 +129,156 @@ with_target_charset "ASCII" {
#
# test "set variable" for type "unsigned char"
#
-test_set "set variable v_unsigned_char=0" "print v_unsigned_char" ".\[0-9\]* = 0 \'.000\'" "set variable unsigned char=0"
-test_set "set variable v_unsigned_char=1" "print v_unsigned_char" ".\[0-9\]* = 1 \'.001\'" "set variable unsigned char=1"
-test_set "set variable v_unsigned_char=7" "print v_unsigned_char" ".\[0-9\]* = 7 \'.a\'" "set variable unsigned char=7 (Bel)"
-test_set "set variable v_unsigned_char=32" "print v_unsigned_char" ".\[0-9\]* = 32 \' \'" "set variable unsigned char=32 (SPC)"
-test_set "set variable v_unsigned_char=65" "print v_unsigned_char" ".\[0-9\]* = 65 \'A\'" "set variable unsigned char=65 ('A')"
-test_set "set variable v_unsigned_char=97" "print v_unsigned_char" ".\[0-9\]* = 97 \'a\'" "set variable unsigned char=97 ('a')"
-test_set "set variable v_unsigned_char=126" "print v_unsigned_char" ".\[0-9\]* = 126 \'~\'" "set variable unsigned char=126 ('~')"
+test_set "set variable v_unsigned_char=0" "print v_unsigned_char" ".\[0-9\]* = 0 \'.000\'" "set variable unsigned char=0"
+test_set "set variable v_unsigned_char=1" "print v_unsigned_char" ".\[0-9\]* = 1 \'.001\'" "set variable unsigned char=1"
+test_set "set variable v_unsigned_char=7" "print v_unsigned_char" ".\[0-9\]* = 7 \'.a\'" "set variable unsigned char=7 (Bel)"
+test_set "set variable v_unsigned_char=32" "print v_unsigned_char" ".\[0-9\]* = 32 \' \'" "set variable unsigned char=32 (SPC)"
+test_set "set variable v_unsigned_char=65" "print v_unsigned_char" ".\[0-9\]* = 65 \'A\'" "set variable unsigned char=65 ('A')"
+test_set "set variable v_unsigned_char=97" "print v_unsigned_char" ".\[0-9\]* = 97 \'a\'" "set variable unsigned char=97 ('a')"
+test_set "set variable v_unsigned_char=126" "print v_unsigned_char" ".\[0-9\]* = 126 \'~\'" "set variable unsigned char=126 ('~')"
with_target_charset "ASCII" {
- test_set "set variable v_unsigned_char=~0" "print v_unsigned_char" ".\[0-9\]* = 255 \'.377\'" "set variable unsigned char=255 (8-bit)"
+ test_set "set variable v_unsigned_char=~0" "print v_unsigned_char" ".\[0-9\]* = 255 \'.377\'" "set variable unsigned char=255 (8-bit)"
}
#
# test "set variable" for type "short"
#
-test_set "set variable v_short=0" "print v_short" ".\[0-9\]* = 0" "set variable short=0"
-test_set "set variable v_short=1" "print v_short" ".\[0-9\]* = 1" "set variable short=1"
-test_set "set variable v_short=-1" "print v_short" ".\[0-9\]* = -1" "set variable short=-1 (minus)"
+test_set "set variable v_short=0" "print v_short" ".\[0-9\]* = 0" "set variable short=0"
+test_set "set variable v_short=1" "print v_short" ".\[0-9\]* = 1" "set variable short=1"
+test_set "set variable v_short=-1" "print v_short" ".\[0-9\]* = -1" "set variable short=-1 (minus)"
#
# test "set variable" for type "signed short"
#
-test_set "set variable v_signed_short=0" "print v_signed_short" ".\[0-9\]* = 0" "set variable signed short=0"
-test_set "set variable v_signed_short=1" "print v_signed_short" ".\[0-9\]* = 1" "set variable signed short=1"
-test_set "set variable v_signed_short=-1" "print v_signed_short" ".\[0-9\]* = -1" "set variable signed short=-1 (minus)"
+test_set "set variable v_signed_short=0" "print v_signed_short" ".\[0-9\]* = 0" "set variable signed short=0"
+test_set "set variable v_signed_short=1" "print v_signed_short" ".\[0-9\]* = 1" "set variable signed short=1"
+test_set "set variable v_signed_short=-1" "print v_signed_short" ".\[0-9\]* = -1" "set variable signed short=-1 (minus)"
#
# test "set variable" for type "unsigned short"
#
-test_set "set variable v_unsigned_short=0" "print v_unsigned_short" ".\[0-9\]* = 0" "set variable unsigned short=0"
-test_set "set variable v_unsigned_short=1" "print v_unsigned_short" ".\[0-9\]* = 1" "set variable unsigned short=1"
-test_set "set variable v_unsigned_short=~0" "print v_unsigned_short" ".\[0-9\]* = 65535" "set variable unsigned short=~0 (minus)"
+test_set "set variable v_unsigned_short=0" "print v_unsigned_short" ".\[0-9\]* = 0" "set variable unsigned short=0"
+test_set "set variable v_unsigned_short=1" "print v_unsigned_short" ".\[0-9\]* = 1" "set variable unsigned short=1"
+test_set "set variable v_unsigned_short=~0" "print v_unsigned_short" ".\[0-9\]* = 65535" "set variable unsigned short=~0 (minus)"
#
# test "set variable" for type "int"
#
-test_set "set variable v_int=0" "print v_int" ".\[0-9\]* = 0" "set variable int=0"
-test_set "set variable v_int=1" "print v_int" ".\[0-9\]* = 1" "set variable int=1"
-test_set "set variable v_int=-1" "print v_int" ".\[0-9\]* = -1" "set variable int=-1 (minus)"
+test_set "set variable v_int=0" "print v_int" ".\[0-9\]* = 0" "set variable int=0"
+test_set "set variable v_int=1" "print v_int" ".\[0-9\]* = 1" "set variable int=1"
+test_set "set variable v_int=-1" "print v_int" ".\[0-9\]* = -1" "set variable int=-1 (minus)"
#
# test "set variable" for type "signed int"
#
-test_set "set variable v_signed_int=0" "print v_signed_int" ".\[0-9\]* = 0" "set variable signed int=0"
-test_set "set variable v_signed_int=1" "print v_signed_int" ".\[0-9\]* = 1" "set variable signed int=1"
-test_set "set variable v_signed_int=-1" "print v_signed_int" ".\[0-9\]* = -1" "set variable signed int=-1 (minus)"
+test_set "set variable v_signed_int=0" "print v_signed_int" ".\[0-9\]* = 0" "set variable signed int=0"
+test_set "set variable v_signed_int=1" "print v_signed_int" ".\[0-9\]* = 1" "set variable signed int=1"
+test_set "set variable v_signed_int=-1" "print v_signed_int" ".\[0-9\]* = -1" "set variable signed int=-1 (minus)"
#
# test "set variable" for type "unsigned int"
#
-test_set "set variable v_unsigned_int=0" "print v_unsigned_int" ".\[0-9\]* = 0" "set variable unsigned int=0"
-test_set "set variable v_unsigned_int=1" "print v_unsigned_int" ".\[0-9\]* = 1" "set variable unsigned int=1"
-test_set "set variable v_unsigned_int=~0" "print v_unsigned_int" ".\[0-9\]* = (4294967295|65535)" "set variable unsigned int=~0 (minus)"
-#test_set ".\[0-9\]* = 65535" "set variable unsigned int=~0 (minus)"
+test_set "set variable v_unsigned_int=0" "print v_unsigned_int" ".\[0-9\]* = 0" "set variable unsigned int=0"
+test_set "set variable v_unsigned_int=1" "print v_unsigned_int" ".\[0-9\]* = 1" "set variable unsigned int=1"
+test_set "set variable v_unsigned_int=~0" "print v_unsigned_int" ".\[0-9\]* = (4294967295|65535)" "set variable unsigned int=~0 (minus)"
+#test_set ".\[0-9\]* = 65535" "set variable unsigned int=~0 (minus)"
#
# test "set variable" for type "long"
#
-test_set "set variable v_long=0" "print v_long" ".\[0-9\]* = 0" "set variable long=0"
-test_set "set variable v_long=1" "print v_long" ".\[0-9\]* = 1" "set variable long=1"
-test_set "set variable v_long=-1" "print v_long" ".\[0-9\]* = -1" "set variable long=-1 (minus)"
+test_set "set variable v_long=0" "print v_long" ".\[0-9\]* = 0" "set variable long=0"
+test_set "set variable v_long=1" "print v_long" ".\[0-9\]* = 1" "set variable long=1"
+test_set "set variable v_long=-1" "print v_long" ".\[0-9\]* = -1" "set variable long=-1 (minus)"
#
# test "set variable" for type "signed long"
#
-test_set "set variable v_signed_long=0" "print v_signed_long" ".\[0-9\]* = 0" "set variable signed long=0"
-test_set "set variable v_signed_long=1" "print v_signed_long" ".\[0-9\]* = 1" "set variable signed long=1"
-test_set "set variable v_signed_long=-1" "print v_signed_long" ".\[0-9\]* = -1" "set variable signed long=-1 (minus)"
+test_set "set variable v_signed_long=0" "print v_signed_long" ".\[0-9\]* = 0" "set variable signed long=0"
+test_set "set variable v_signed_long=1" "print v_signed_long" ".\[0-9\]* = 1" "set variable signed long=1"
+test_set "set variable v_signed_long=-1" "print v_signed_long" ".\[0-9\]* = -1" "set variable signed long=-1 (minus)"
#
# test "set variable" for type "unsigned long"
#
-test_set "set variable v_unsigned_long=0" "print v_unsigned_long" ".\[0-9\]* = 0" "set variable unsigned long=0"
-test_set "set variable v_unsigned_long=1" "print v_unsigned_long" ".\[0-9\]* = 1" "set variable unsigned long=1"
-test_set "set variable v_unsigned_long=~0" "print v_unsigned_long" ".\[0-9\]* = $ulong_minus_1" "set variable unsigned long=~0 (minus)"
+test_set "set variable v_unsigned_long=0" "print v_unsigned_long" ".\[0-9\]* = 0" "set variable unsigned long=0"
+test_set "set variable v_unsigned_long=1" "print v_unsigned_long" ".\[0-9\]* = 1" "set variable unsigned long=1"
+test_set "set variable v_unsigned_long=~0" "print v_unsigned_long" ".\[0-9\]* = $ulong_minus_1" "set variable unsigned long=~0 (minus)"
#
# test "set variable" for type "float"
#
-test_set "set variable v_float=0.0" "print v_float" ".\[0-9\]* = 0" "set variable float=0"
-test_set "set variable v_float=1.0" "print v_float" ".\[0-9\]* = 1" "set variable float=1"
-test_set "set variable v_float=-1.0" "print v_float" ".\[0-9\]* = -1" "set variable float=-1 (minus)"
+test_set "set variable v_float=0.0" "print v_float" ".\[0-9\]* = 0" "set variable float=0"
+test_set "set variable v_float=1.0" "print v_float" ".\[0-9\]* = 1" "set variable float=1"
+test_set "set variable v_float=-1.0" "print v_float" ".\[0-9\]* = -1" "set variable float=-1 (minus)"
#
# test "set variable" for type "double"
#
-test_set "set variable v_double=0.0" "print v_double" ".\[0-9\]* = 0" "set variable double=0"
-test_set "set variable v_double=1.0" "print v_double" ".\[0-9\]* = 1" "set variable double=1"
-test_set "set variable v_double=-1.0" "print v_double" ".*.\[0-9\]* = -1" "set variable double=-1 (minus)"
+test_set "set variable v_double=0.0" "print v_double" ".\[0-9\]* = 0" "set variable double=0"
+test_set "set variable v_double=1.0" "print v_double" ".\[0-9\]* = 1" "set variable double=1"
+test_set "set variable v_double=-1.0" "print v_double" ".*.\[0-9\]* = -1" "set variable double=-1 (minus)"
#
# test "set variable" for "char array[2]"
#
-test_set "set variable v_char_array\[0\]='h'" "set variable v_char_array\[1\]='i'" "print v_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable char array=\"hi\" (string)"
+test_set "set variable v_char_array\[0\]='h'" "set variable v_char_array\[1\]='i'" "print v_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable char array=\"hi\" (string)"
#
# test "set variable" for "signed char array[2]"
#
-test_set "set variable v_signed_char_array\[0\]='h'" "set variable v_signed_char_array\[1\]='i'" "print v_signed_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable signed char array=\"hi\" (string)"
+test_set "set variable v_signed_char_array\[0\]='h'" "set variable v_signed_char_array\[1\]='i'" "print v_signed_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable signed char array=\"hi\" (string)"
#
# test "set variable" for "unsigned char array[2]"
#
-test_set "set variable v_unsigned_char_array\[0\]='h'" "set variable v_unsigned_char_array\[1\]='i'" "print v_unsigned_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable unsigned char array=\"hi\" (string)"
+test_set "set variable v_unsigned_char_array\[0\]='h'" "set variable v_unsigned_char_array\[1\]='i'" "print v_unsigned_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable unsigned char array=\"hi\" (string)"
#
# test "set variable" for "short array[2]"
#
-test_set "set variable v_short_array\[0\]=123" "set variable v_short_array\[1\]=-456" "print v_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable short array"
+test_set "set variable v_short_array\[0\]=123" "set variable v_short_array\[1\]=-456" "print v_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable short array"
#
# test "set variable" for "signed short array[2]"
#
-test_set "set variable v_signed_short_array\[0\]=123" "set variable v_signed_short_array\[1\]=-456" "print v_signed_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed short array"
+test_set "set variable v_signed_short_array\[0\]=123" "set variable v_signed_short_array\[1\]=-456" "print v_signed_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed short array"
#
# test "set variable" for "unsigned short array[2]"
#
-test_set "set variable v_unsigned_short_array\[0\]=123" "set variable v_unsigned_short_array\[1\]=-456" "print v_unsigned_short_array" ".*.\[0-9\]* =.*\\{123,.*65080\\}" "set variable unsigned short array"
+test_set "set variable v_unsigned_short_array\[0\]=123" "set variable v_unsigned_short_array\[1\]=-456" "print v_unsigned_short_array" ".*.\[0-9\]* =.*\\{123,.*65080\\}" "set variable unsigned short array"
#
# test "set variable" for "int array[2]"
#
-test_set "set variable v_int_array\[0\]=123" "set variable v_int_array\[1\]=-456" "print v_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable int array"
+test_set "set variable v_int_array\[0\]=123" "set variable v_int_array\[1\]=-456" "print v_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable int array"
#
# test "set variable" for "signed int array[2]"
#
-test_set "set variable v_signed_int_array\[0\]=123" "set variable v_signed_int_array\[1\]=-456" "print v_signed_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed int array"
+test_set "set variable v_signed_int_array\[0\]=123" "set variable v_signed_int_array\[1\]=-456" "print v_signed_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed int array"
#
# test "set variable" for "unsigned int array[2]"
#
-test_set "set variable v_unsigned_int_array\[0\]=123" "set variable v_unsigned_int_array\[1\]=-456" "print v_unsigned_int_array" ".*.\[0-9\]* =.*\\{123,.*(4294966840|65080)\\}" "set variable unsigned int array"
+test_set "set variable v_unsigned_int_array\[0\]=123" "set variable v_unsigned_int_array\[1\]=-456" "print v_unsigned_int_array" ".*.\[0-9\]* =.*\\{123,.*(4294966840|65080)\\}" "set variable unsigned int array"
#
# test "set variable" for "long array[2]"
#
-test_set "set variable v_long_array\[0\]=123" "set variable v_long_array\[1\]=-456" "print v_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable long array"
+test_set "set variable v_long_array\[0\]=123" "set variable v_long_array\[1\]=-456" "print v_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable long array"
#
# test "set variable" for "signed long array[2]"
#
-test_set "set variable v_signed_long_array\[0\]=123" "set variable v_signed_long_array\[1\]=-456" "print v_signed_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed long array"
+test_set "set variable v_signed_long_array\[0\]=123" "set variable v_signed_long_array\[1\]=-456" "print v_signed_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed long array"
#
# test "set variable" for "unsigned long array[2]"
#
-test_set "set variable v_unsigned_long_array\[0\]=123" "set variable v_unsigned_long_array\[1\]=-456" "print v_unsigned_long_array" ".*.\[0-9\]* =.*\\{123,.*$ulong_minus_456\\}" "set variable unsigned long array"
+test_set "set variable v_unsigned_long_array\[0\]=123" "set variable v_unsigned_long_array\[1\]=-456" "print v_unsigned_long_array" ".*.\[0-9\]* =.*\\{123,.*$ulong_minus_456\\}" "set variable unsigned long array"
#
# test "set variable" for "float array[2]"
#
-test_set "set variable v_float_array\[0\]=123.0" "set variable v_float_array\[1\]=-456.0" "print v_float_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable float array"
+test_set "set variable v_float_array\[0\]=123.0" "set variable v_float_array\[1\]=-456.0" "print v_float_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable float array"
#
# test "set variable" for "double array[2]"
#
-test_set "set variable v_double_array\[0\]=123.0" "set variable v_double_array\[1\]=-456.0" "print v_double_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable double array"
+test_set "set variable v_double_array\[0\]=123.0" "set variable v_double_array\[1\]=-456.0" "print v_double_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable double array"
#
# test "set variable" for type "char *"
#
-test_set "set v_char_pointer=v_char_array" "set variable *(v_char_pointer)='h'" "set variable *(v_char_pointer+1)='i'" "print v_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable char pointer=\"hi\" (string)"
+test_set "set v_char_pointer=v_char_array" "set variable *(v_char_pointer)='h'" "set variable *(v_char_pointer+1)='i'" "print v_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable char pointer=\"hi\" (string)"
#
# test "set variable" for type "signed char *"
#
-test_set "set v_signed_char_pointer=v_signed_char_array" "set variable *(v_signed_char_pointer)='h'" "set variable *(v_signed_char_pointer+1)='i'" "print v_signed_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_signed_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable signed char pointer=\"hi\" (string)"
+test_set "set v_signed_char_pointer=v_signed_char_array" "set variable *(v_signed_char_pointer)='h'" "set variable *(v_signed_char_pointer+1)='i'" "print v_signed_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_signed_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable signed char pointer=\"hi\" (string)"
#
# test "set variable" for type "unsigned char *"
#
-test_set "set v_unsigned_char_pointer=v_unsigned_char_array" "set variable *(v_unsigned_char_pointer)='h'" "set variable *(v_unsigned_char_pointer+1)='i'" "print v_unsigned_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_unsigned_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable unsigned char pointer=\"hi\" (string)"
+test_set "set v_unsigned_char_pointer=v_unsigned_char_array" "set variable *(v_unsigned_char_pointer)='h'" "set variable *(v_unsigned_char_pointer+1)='i'" "print v_unsigned_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_unsigned_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable unsigned char pointer=\"hi\" (string)"
#
# test "set variable" for type "short *"
#
-test_set "set v_short_pointer=v_short_array" "set variable *(v_short_pointer)=123" "set variable *(v_short_pointer+1)=-456" "print v_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_short_pointer+1)" ".*.\[0-9\]* = -456" "set variable short pointer"
+test_set "set v_short_pointer=v_short_array" "set variable *(v_short_pointer)=123" "set variable *(v_short_pointer+1)=-456" "print v_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_short_pointer+1)" ".*.\[0-9\]* = -456" "set variable short pointer"
#
# test "set variable" for type "signed short *"
#
@@ -300,11 +300,11 @@ gdb_test "print *(v_unsigned_short_pointer+1)" ".\[0-9\]* = 65080"
#
# test "set variable" for type "int *"
#
-test_set "set v_int_pointer=v_int_array" "set variable *(v_int_pointer)=123" "set variable *(v_int_pointer+1)=-456" "print v_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_int_pointer+1)" ".*.\[0-9\]* = -456" "set variable int pointer"
+test_set "set v_int_pointer=v_int_array" "set variable *(v_int_pointer)=123" "set variable *(v_int_pointer+1)=-456" "print v_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_int_pointer+1)" ".*.\[0-9\]* = -456" "set variable int pointer"
#
# test "set variable" for type "signed int *"
#
-test_set "set v_signed_int_pointer=v_signed_int_array" "set variable *(v_signed_int_pointer)=123" "set variable *(v_signed_int_pointer+1)=-456" "print v_signed_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_signed_int_pointer+1)" ".*.\[0-9\]* = -456" "set variable signed int pointer"
+test_set "set v_signed_int_pointer=v_signed_int_array" "set variable *(v_signed_int_pointer)=123" "set variable *(v_signed_int_pointer+1)=-456" "print v_signed_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_signed_int_pointer+1)" ".*.\[0-9\]* = -456" "set variable signed int pointer"
#
# test "set variable" for type "unsigned int *"
#
@@ -313,32 +313,32 @@ test_set "" "print *(v_unsigned_int_pointer+1)" ".*.\[0-9\]* = (4294966840|65080
#
# test "set variable" for type "long *"
#
-test_set "set v_long_pointer=v_long_array" "set variable *(v_long_pointer)=123" "set variable *(v_long_pointer+1)=-456" "print v_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_long_pointer+1)" ".*.\[0-9\]* = -456" "set variable long pointer"
+test_set "set v_long_pointer=v_long_array" "set variable *(v_long_pointer)=123" "set variable *(v_long_pointer+1)=-456" "print v_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_long_pointer+1)" ".*.\[0-9\]* = -456" "set variable long pointer"
#
# test "set variable" for type "signed long *"
#
-test_set "set v_signed_long_pointer=v_signed_long_array" "set variable *(v_signed_long_pointer)=123" "set variable *(v_signed_long_pointer+1)=-456" "print v_signed_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_signed_long_pointer+1)" ".*.\[0-9\]* = -456" "set variable signed long pointer"
+test_set "set v_signed_long_pointer=v_signed_long_array" "set variable *(v_signed_long_pointer)=123" "set variable *(v_signed_long_pointer+1)=-456" "print v_signed_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_signed_long_pointer+1)" ".*.\[0-9\]* = -456" "set variable signed long pointer"
#
# test "set variable" for type "unsigned long *"
#
-test_set "set v_unsigned_long_pointer=v_unsigned_long_array" "set variable *(v_unsigned_long_pointer)=123" "set variable *(v_unsigned_long_pointer+1)=-456" "print v_unsigned_long_array" ".*.\[0-9\]* =.*\\{123,.*$ulong_minus_456\\}" "print *(v_unsigned_long_pointer+1)" ".*.\[0-9\]* = $ulong_minus_456" "set variable unsigned long pointer"
+test_set "set v_unsigned_long_pointer=v_unsigned_long_array" "set variable *(v_unsigned_long_pointer)=123" "set variable *(v_unsigned_long_pointer+1)=-456" "print v_unsigned_long_array" ".*.\[0-9\]* =.*\\{123,.*$ulong_minus_456\\}" "print *(v_unsigned_long_pointer+1)" ".*.\[0-9\]* = $ulong_minus_456" "set variable unsigned long pointer"
#
# test "set variable" for type "float *"
#
-test_set "set v_float_pointer=v_float_array" "set variable *(v_float_pointer)=123.0" "set variable *(v_float_pointer+1)=-456.0" "print v_float_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_float_pointer+1)" ".*.\[0-9\]* = -456" "set variable float pointer"
+test_set "set v_float_pointer=v_float_array" "set variable *(v_float_pointer)=123.0" "set variable *(v_float_pointer+1)=-456.0" "print v_float_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_float_pointer+1)" ".*.\[0-9\]* = -456" "set variable float pointer"
#
# test "set variable" for type "double *"
#
-test_set "set v_double_pointer=v_double_array" "set variable *(v_double_pointer)=123.0" "set variable *(v_double_pointer+1)=-456.0" "print v_double_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_double_pointer+1)" ".*.\[0-9\]* = -456" "set variable double pointer"
+test_set "set v_double_pointer=v_double_array" "set variable *(v_double_pointer)=123.0" "set variable *(v_double_pointer+1)=-456.0" "print v_double_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_double_pointer+1)" ".*.\[0-9\]* = -456" "set variable double pointer"
#
# test "set variable" for struct members
#
-test_set "set variable v_struct1.v_char_member='h'" "print v_struct1.v_char_member" ".*.\[0-9\]* = 104 \'h\'" "set variable structure char member"
-test_set "set variable v_struct1.v_short_member=1" "print v_struct1.v_short_member" ".*.\[0-9\]* = 1" "set variable structure short member"
-test_set "set variable v_struct1.v_int_member=2" "print v_struct1.v_int_member" ".*.\[0-9\]* = 2" "set variable structure int member"
-test_set "set variable v_struct1.v_long_member=3" "print v_struct1.v_long_member" ".*.\[0-9\]* = 3" "set variable structure long member"
-test_set "set variable v_struct1.v_float_member=4.0" "print v_struct1.v_float_member" ".*.\[0-9\]* = 4" "set variable structure float member"
-test_set "set variable v_struct1.v_double_member=5.0" "print v_struct1.v_double_member" ".*.\[0-9\]* = 5" "set variable structure double member"
+test_set "set variable v_struct1.v_char_member='h'" "print v_struct1.v_char_member" ".*.\[0-9\]* = 104 \'h\'" "set variable structure char member"
+test_set "set variable v_struct1.v_short_member=1" "print v_struct1.v_short_member" ".*.\[0-9\]* = 1" "set variable structure short member"
+test_set "set variable v_struct1.v_int_member=2" "print v_struct1.v_int_member" ".*.\[0-9\]* = 2" "set variable structure int member"
+test_set "set variable v_struct1.v_long_member=3" "print v_struct1.v_long_member" ".*.\[0-9\]* = 3" "set variable structure long member"
+test_set "set variable v_struct1.v_float_member=4.0" "print v_struct1.v_float_member" ".*.\[0-9\]* = 4" "set variable structure float member"
+test_set "set variable v_struct1.v_double_member=5.0" "print v_struct1.v_double_member" ".*.\[0-9\]* = 5" "set variable structure double member"
gdb_test "print v_struct1" \
".*.\[0-9\]* = \{.*v_char_member = 104 \'h\',.*v_short_member = 1,\
diff --git a/gdb/testsuite/gdb.base/share-env-with-gdbserver.c b/gdb/testsuite/gdb.base/share-env-with-gdbserver.c
index cdb86d6..3183c33 100644
--- a/gdb/testsuite/gdb.base/share-env-with-gdbserver.c
+++ b/gdb/testsuite/gdb.base/share-env-with-gdbserver.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/share-env-with-gdbserver.exp b/gdb/testsuite/gdb.base/share-env-with-gdbserver.exp
index 79cee83..aa4b300 100644
--- a/gdb/testsuite/gdb.base/share-env-with-gdbserver.exp
+++ b/gdb/testsuite/gdb.base/share-env-with-gdbserver.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -91,7 +91,8 @@ proc do_prepare_inferior { } {
proc do_test { var_value { var_name "" } { var_name_match "" } { var_value_match "" } } {
global binfile test_var_name
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
if { $var_name == "" } {
set var_name $test_var_name
@@ -146,7 +147,8 @@ with_test_prefix "strange named var" {
proc test_set_unset_vars { } {
global binfile
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
with_test_prefix "set 3 environment variables" {
# Set some environment variables
@@ -205,7 +207,8 @@ with_test_prefix "test set/unset of vars" {
proc test_unset { } {
global hex decimal binfile gdb_prompt
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
do_prepare_inferior
@@ -234,7 +237,8 @@ proc test_unset { } {
}
with_test_prefix "set-then-unset" {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
# Test if setting and then unsetting $HOME works.
gdb_test_no_output "set environment HOME = test" "set HOME as test"
diff --git a/gdb/testsuite/gdb.base/share-psymtabs-bt-2.c b/gdb/testsuite/gdb.base/share-psymtabs-bt-2.c
index afdf84b..c1d7d2e 100644
--- a/gdb/testsuite/gdb.base/share-psymtabs-bt-2.c
+++ b/gdb/testsuite/gdb.base/share-psymtabs-bt-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/share-psymtabs-bt.c b/gdb/testsuite/gdb.base/share-psymtabs-bt.c
index 406ad54..78c24ed 100644
--- a/gdb/testsuite/gdb.base/share-psymtabs-bt.c
+++ b/gdb/testsuite/gdb.base/share-psymtabs-bt.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/share-psymtabs-bt.exp b/gdb/testsuite/gdb.base/share-psymtabs-bt.exp
index 6c13e5e..62c8dc5 100644
--- a/gdb/testsuite/gdb.base/share-psymtabs-bt.exp
+++ b/gdb/testsuite/gdb.base/share-psymtabs-bt.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/shell.exp b/gdb/testsuite/gdb.base/shell.exp
index e92270c..62052a1 100644
--- a/gdb/testsuite/gdb.base/shell.exp
+++ b/gdb/testsuite/gdb.base/shell.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp
index 4a963ed..4a5cefd 100644
--- a/gdb/testsuite/gdb.base/shlib-call.exp
+++ b/gdb/testsuite/gdb.base/shlib-call.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -59,7 +59,8 @@ if { [gdb_compile_shlib ${lib1src} ${lib1} $lib_opts] != ""
# Start with a fresh gdb.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_load_shlib $lib1
gdb_load_shlib $lib2
@@ -78,7 +79,7 @@ gdb_test "next 2" "g = shr1\\(g\\);" "next to shr1"
gdb_test "print g" "\[0-9\]* = 1"
#step -over
-if ![gdb_skip_stdio_test "next over shr1"] {
+if {![gdb_skip_stdio_test "next over shr1"]} {
gdb_test_stdio "next" \
"address of sgs is $hex" \
"g = shr2\\(g\\);" \
@@ -92,7 +93,7 @@ if ![gdb_skip_stdio_test "next over shr1"] {
gdb_test "print g" "\[0-9\]* = 2" "print g two"
#print shr1(1)
-if ![gdb_skip_stdio_test "print shr1(1)"] {
+if {![gdb_skip_stdio_test "print shr1(1)"]} {
gdb_test_stdio "print shr1(1)" \
"address of sgs is $hex" \
"\[0-9\]* = 2" \
@@ -100,7 +101,7 @@ if ![gdb_skip_stdio_test "print shr1(1)"] {
}
#print shr1(g)
-if ![gdb_skip_stdio_test "print shr1(g)"] {
+if {![gdb_skip_stdio_test "print shr1(g)"]} {
gdb_test_stdio "print shr1(g)" \
"address of sgs is $hex" \
"\[0-9\]* = 4" \
@@ -119,7 +120,7 @@ gdb_test "continue" \
#print shr1(1)
-if ![gdb_skip_stdio_test "print shr1(1) 2nd time"] {
+if {![gdb_skip_stdio_test "print shr1(1) 2nd time"]} {
gdb_test_stdio "print shr1(1)" \
"address of sgs is $hex" \
"\[0-9\]* = 2" \
@@ -161,7 +162,8 @@ gdb_test "step" "mainshr1 \\(g=4\\) at.*return 2.g;" \
# Start with a fresh gdb.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
# PR's 16495, 18213
# test that we can re-set breakpoints in shared libraries
diff --git a/gdb/testsuite/gdb.base/shlib-unload.exp b/gdb/testsuite/gdb.base/shlib-unload.exp
index 9d47416..e38d04d 100644
--- a/gdb/testsuite/gdb.base/shlib-unload.exp
+++ b/gdb/testsuite/gdb.base/shlib-unload.exp
@@ -57,7 +57,7 @@ set bp_disabled_re "warning: Temporarily disabling breakpoints for unloaded shar
# assuming that GDB has disabled some breakpoints.
set stop_after_bp_re [multi_line \
"^$::bp_disabled_re" \
- "[expr $::bp_line + 1]\\s+assert \\(res == 0\\);"]
+ "[expr {$::bp_line + 1}]\\s+assert \\(res == 0\\);"]
# Checking that a breakpoint with multiple locations in a shared
# library only triggers a single breakpoint modified event from
@@ -69,7 +69,8 @@ proc_with_prefix test_bp_modified_events {} {
return
}
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
if {![runto_main]} {
return
@@ -114,7 +115,8 @@ proc_with_prefix test_bp_modified_events {} {
# Check that GDB disables dprintf breakpoints within a shared library
# when the shared library is unloaded.
proc_with_prefix test_dprintf_after_unload {} {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
if {![runto_main]} {
return
@@ -143,7 +145,8 @@ proc_with_prefix test_dprintf_after_unload {} {
# inferior. We should not get an error about re-setting the dprintf
# breakpoint.
proc_with_prefix test_dprintf_with_rerun {} {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
if {![runto_main]} {
return
@@ -238,7 +241,8 @@ proc_with_prefix test_silent_nosharedlib {} {
}
foreach_with_prefix type { breakpoint dprintf } {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.base/show-user-completion.exp b/gdb/testsuite/gdb.base/show-user-completion.exp
index 8194915..88f6122 100644
--- a/gdb/testsuite/gdb.base/show-user-completion.exp
+++ b/gdb/testsuite/gdb.base/show-user-completion.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/shreloc.exp b/gdb/testsuite/gdb.base/shreloc.exp
index 82e6ec6..e960291 100644
--- a/gdb/testsuite/gdb.base/shreloc.exp
+++ b/gdb/testsuite/gdb.base/shreloc.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,11 +42,11 @@ if {([istarget "*pc-cygwin"] || [istarget "*pc-mingw32"]) } {
lappend lib_opts "ldflags=-Wl,--image-base,0x04000000"
}
-if [test_compiler_info "xlc-*"] {
+if {[test_compiler_info "xlc-*"]} {
- # IBM's xlc compiler does not add static variables to the ELF symbol
- # table by default. We need this option to make the variables show
- # up in "maint print msymbols".
+ # IBM's xlc compiler does not add static variables to the ELF symbol
+ # table by default. We need this option to make the variables show
+ # up in "maint print msymbols".
lappend lib_opts "additional_flags=-qstatsym"
@@ -65,7 +65,8 @@ if { [gdb_compile_shlib $lib1src $lib1_sl $lib_opts] != ""} {
# Start with a fresh gdb.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
gdb_load_shlib $lib1_sl
gdb_load_shlib $lib2_sl
@@ -193,13 +194,13 @@ proc check_different {var msymfile} {
return 1
}
-if [is_remote host] {
+if {[is_remote host]} {
set msymfile shreloc.txt
} else {
set msymfile [standard_output_file shreloc.txt]
}
-if [send_gdb_discard "maint print msymbols ${msymfile}"] {
+if {[send_gdb_discard "maint print msymbols ${msymfile}"]} {
if {[check_different "static_var_\[12\]" "${msymfile}"]} {
pass "(msymbol) relocated static vars have different addresses"
} else {
diff --git a/gdb/testsuite/gdb.base/sigall.exp b/gdb/testsuite/gdb.base/sigall.exp
index 94d58ae..461a92b 100644
--- a/gdb/testsuite/gdb.base/sigall.exp
+++ b/gdb/testsuite/gdb.base/sigall.exp
@@ -1,4 +1,4 @@
-# Copyright 1995-2024 Free Software Foundation, Inc.
+# Copyright 1995-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,13 +41,14 @@ proc test_one_sig {nextsig} {
setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
}
# On Linux SPARC64 systems SIGLOST==SIGPWR and gdb identifies
- # the raised signal as PWR.
- if {$thissig == "LOST" && [istarget "sparc64-*-linux*"]} {
+ # the raised signal as PWR. Same for Cygwin.
+ if {$thissig == "LOST"
+ && ([istarget "sparc64-*-linux*"] || [istarget "*-*-cygwin*"])} {
set esig "PWR"
}
gdb_test "continue" \
- "Continuing.*Program received signal SIG$esig.*" \
+ "Continuing.* received signal SIG$esig.*" \
"get signal $esig"
}
@@ -177,7 +178,7 @@ gdb_test "handle SIGTERM stop print" \
"SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
gdb_test "b handle_TERM" "Breakpoint \[0-9\]+ .*"
gdb_test "continue" \
- "Continuing.*Program received signal SIGTERM.*" \
+ "Continuing.* received signal SIGTERM.*" \
"get signal TERM"
gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM"
gdb_continue_to_end "continue to sigall exit"
diff --git a/gdb/testsuite/gdb.base/sigaltstack.c b/gdb/testsuite/gdb.base/sigaltstack.c
index 24bb4a7..4515745 100644
--- a/gdb/testsuite/gdb.base/sigaltstack.c
+++ b/gdb/testsuite/gdb.base/sigaltstack.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/sigaltstack.exp b/gdb/testsuite/gdb.base/sigaltstack.exp
index fea4e7c..47013a0 100644
--- a/gdb/testsuite/gdb.base/sigaltstack.exp
+++ b/gdb/testsuite/gdb.base/sigaltstack.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
}
# get things started
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
# Pass all the alarms straight through (but verbosely)
gdb_test "handle SIGALRM print pass nostop"
diff --git a/gdb/testsuite/gdb.base/sigbpt.c b/gdb/testsuite/gdb.base/sigbpt.c
index 8660d8b..66238eb 100644
--- a/gdb/testsuite/gdb.base/sigbpt.c
+++ b/gdb/testsuite/gdb.base/sigbpt.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/sigbpt.exp b/gdb/testsuite/gdb.base/sigbpt.exp
index 6808db2..c003baf 100644
--- a/gdb/testsuite/gdb.base/sigbpt.exp
+++ b/gdb/testsuite/gdb.base/sigbpt.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -236,7 +236,7 @@ proc cont_out { name args } {
# Now single step the faulted instrction at that breakpoint.
gdb_test "stepi" \
"Program received signal ${signame}.*pc(\r\n| *)=> [at_segv] .*" \
- "${name}; stepi fault"
+ "${name}; stepi fault"
# Clear any breakpoints
for {set i 0} {$i < [llength $args]} {incr i} {
diff --git a/gdb/testsuite/gdb.base/sigchld.c b/gdb/testsuite/gdb.base/sigchld.c
index d5d9d7b..b642f33 100644
--- a/gdb/testsuite/gdb.base/sigchld.c
+++ b/gdb/testsuite/gdb.base/sigchld.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/sigchld.exp b/gdb/testsuite/gdb.base/sigchld.exp
index b69b8f8..4011241 100644
--- a/gdb/testsuite/gdb.base/sigchld.exp
+++ b/gdb/testsuite/gdb.base/sigchld.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,8 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
runto_main
diff --git a/gdb/testsuite/gdb.base/siginfo-addr.c b/gdb/testsuite/gdb.base/siginfo-addr.c
index a7bf13c..7cba3e3 100644
--- a/gdb/testsuite/gdb.base/siginfo-addr.c
+++ b/gdb/testsuite/gdb.base/siginfo-addr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/siginfo-addr.exp b/gdb/testsuite/gdb.base/siginfo-addr.exp
index 81b319f..4352503 100644
--- a/gdb/testsuite/gdb.base/siginfo-addr.exp
+++ b/gdb/testsuite/gdb.base/siginfo-addr.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/siginfo-infcall.c b/gdb/testsuite/gdb.base/siginfo-infcall.c
index ea0ca9e..372ff0a 100644
--- a/gdb/testsuite/gdb.base/siginfo-infcall.c
+++ b/gdb/testsuite/gdb.base/siginfo-infcall.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/siginfo-infcall.exp b/gdb/testsuite/gdb.base/siginfo-infcall.exp
index 731c3b7..46d67cc 100644
--- a/gdb/testsuite/gdb.base/siginfo-infcall.exp
+++ b/gdb/testsuite/gdb.base/siginfo-infcall.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/siginfo-obj.c b/gdb/testsuite/gdb.base/siginfo-obj.c
index c06b5a1..3aa7d48 100644
--- a/gdb/testsuite/gdb.base/siginfo-obj.c
+++ b/gdb/testsuite/gdb.base/siginfo-obj.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/siginfo-obj.exp b/gdb/testsuite/gdb.base/siginfo-obj.exp
index 38065c0..52f7140 100644
--- a/gdb/testsuite/gdb.base/siginfo-obj.exp
+++ b/gdb/testsuite/gdb.base/siginfo-obj.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -118,7 +118,8 @@ with_test_prefix "validate modified siginfo fields" {
# Test siginfo preservation in core files.
if {$gcore_created} {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
gdb_test "core $gcorefile" "Core was generated by.*" \
"core [file tail $gcorefile]"
diff --git a/gdb/testsuite/gdb.base/siginfo-thread.c b/gdb/testsuite/gdb.base/siginfo-thread.c
index bb9cff6..7ca527c 100644
--- a/gdb/testsuite/gdb.base/siginfo-thread.c
+++ b/gdb/testsuite/gdb.base/siginfo-thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/siginfo-thread.exp b/gdb/testsuite/gdb.base/siginfo-thread.exp
index 384eb8b..270b4e1 100644
--- a/gdb/testsuite/gdb.base/siginfo-thread.exp
+++ b/gdb/testsuite/gdb.base/siginfo-thread.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,8 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" \
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
# Advance to main
if {![runto_main]} {
@@ -92,7 +93,8 @@ gdb_test "p \$_siginfo.si_signo == $ssi_signo" " = 0" \
# Test siginfo preservation in core files.
if {$gcore_created} {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
gdb_test "core $gcorefile" "Core was generated by.*" \
"core [file tail $gcorefile]"
diff --git a/gdb/testsuite/gdb.base/siginfo.c b/gdb/testsuite/gdb.base/siginfo.c
index 39e15ba..77d94da 100644
--- a/gdb/testsuite/gdb.base/siginfo.c
+++ b/gdb/testsuite/gdb.base/siginfo.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/siginfo.exp b/gdb/testsuite/gdb.base/siginfo.exp
index d703250..a8571b9 100644
--- a/gdb/testsuite/gdb.base/siginfo.exp
+++ b/gdb/testsuite/gdb.base/siginfo.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/signals-state-child.c b/gdb/testsuite/gdb.base/signals-state-child.c
index 31d40e9..69267ed 100644
--- a/gdb/testsuite/gdb.base/signals-state-child.c
+++ b/gdb/testsuite/gdb.base/signals-state-child.c
@@ -1,4 +1,4 @@
-/* Copyright 2016-2024 Free Software Foundation, Inc.
+/* Copyright 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/signals-state-child.exp b/gdb/testsuite/gdb.base/signals-state-child.exp
index 8c5965b..9bcf730 100644
--- a/gdb/testsuite/gdb.base/signals-state-child.exp
+++ b/gdb/testsuite/gdb.base/signals-state-child.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -90,14 +90,15 @@ if { $res < 0 || $res == "" } {
}
set wait_status [remote_wait target 60]
-set have_standalone [expr [lindex $wait_status 0] == 0]
+set have_standalone [expr {[lindex $wait_status 0] == 0}]
gdb_assert { $have_standalone } "collect standalone signals state"
remote_close target
# Now run the program through gdb, and dump its initial signal actions
# and mask in "gdb.txt".
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return -1
diff --git a/gdb/testsuite/gdb.base/signals.exp b/gdb/testsuite/gdb.base/signals.exp
index e6bd35a..c0aaa0a 100644
--- a/gdb/testsuite/gdb.base/signals.exp
+++ b/gdb/testsuite/gdb.base/signals.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ proc test_handle_all_print {} {
# Increase timeout and expect input buffer for large output from gdb.
# Allow blank or TAB as whitespace characters.
set oldtimeout $timeout
- set timeout [expr "$timeout + 60"]
+ set timeout [expr {$timeout + 60}]
verbose "Timeout is now $timeout seconds" 2
if { ![istarget "*-*-linux*"]
&& ( [istarget "*-*-gnu*"]
@@ -58,7 +58,8 @@ proc test_handle_all_print {} {
}
test_handle_all_print
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
if {[runto_main]} {
@@ -257,7 +258,7 @@ The program being debugged stopped while in a function called from GDB.*" \
gdb_test "signal" \
"Argument required .signal number..*" \
"signal without arguments disallowed"
-
+
# Verify that we can successfully send a signal other than 0 to
# the inferior. (This probably causes the inferior to run away.
# Be prepared to rerun to main for further testing.)
diff --git a/gdb/testsuite/gdb.base/signed-builtin-types-lib.c b/gdb/testsuite/gdb.base/signed-builtin-types-lib.c
index 26b28aa..3b78dad 100644
--- a/gdb/testsuite/gdb.base/signed-builtin-types-lib.c
+++ b/gdb/testsuite/gdb.base/signed-builtin-types-lib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/signed-builtin-types.c b/gdb/testsuite/gdb.base/signed-builtin-types.c
index 4eec62f..460e048 100644
--- a/gdb/testsuite/gdb.base/signed-builtin-types.c
+++ b/gdb/testsuite/gdb.base/signed-builtin-types.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/signed-builtin-types.exp b/gdb/testsuite/gdb.base/signed-builtin-types.exp
index 4cc324b..7750d98 100644
--- a/gdb/testsuite/gdb.base/signed-builtin-types.exp
+++ b/gdb/testsuite/gdb.base/signed-builtin-types.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/signest.c b/gdb/testsuite/gdb.base/signest.c
index 37bb8b9..54245f8 100644
--- a/gdb/testsuite/gdb.base/signest.c
+++ b/gdb/testsuite/gdb.base/signest.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/signest.exp b/gdb/testsuite/gdb.base/signest.exp
index b66f066..c55db4a 100644
--- a/gdb/testsuite/gdb.base/signest.exp
+++ b/gdb/testsuite/gdb.base/signest.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ standard_testfile
require {!target_info exists gdb,nosignals}
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/signull.c b/gdb/testsuite/gdb.base/signull.c
index 17529b4..d93d884 100644
--- a/gdb/testsuite/gdb.base/signull.c
+++ b/gdb/testsuite/gdb.base/signull.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1996-2024 Free Software Foundation, Inc.
+ Copyright 1996-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/signull.exp b/gdb/testsuite/gdb.base/signull.exp
index 6d72cd5..9ad772f 100644
--- a/gdb/testsuite/gdb.base/signull.exp
+++ b/gdb/testsuite/gdb.base/signull.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debu
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
#
# Run to `main' where we begin our tests.
diff --git a/gdb/testsuite/gdb.base/sigrepeat.c b/gdb/testsuite/gdb.base/sigrepeat.c
index 79fe648..c65f07f 100644
--- a/gdb/testsuite/gdb.base/sigrepeat.c
+++ b/gdb/testsuite/gdb.base/sigrepeat.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/sigrepeat.exp b/gdb/testsuite/gdb.base/sigrepeat.exp
index dd65d92..8fa92af 100644
--- a/gdb/testsuite/gdb.base/sigrepeat.exp
+++ b/gdb/testsuite/gdb.base/sigrepeat.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
}
# get things started
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
# Advance to main
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.base/sigstep.c b/gdb/testsuite/gdb.base/sigstep.c
index 6e96ad2..e0f4604 100644
--- a/gdb/testsuite/gdb.base/sigstep.c
+++ b/gdb/testsuite/gdb.base/sigstep.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/sigstep.exp b/gdb/testsuite/gdb.base/sigstep.exp
index d08a34e..2df5dd0 100644
--- a/gdb/testsuite/gdb.base/sigstep.exp
+++ b/gdb/testsuite/gdb.base/sigstep.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,7 +40,8 @@ set other_handler_location [gdb_get_line_number "other handler location"]
proc restart {} {
global binfile
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
gdb_test "display/i \$pc"
diff --git a/gdb/testsuite/gdb.base/sigwinch-notty.exp b/gdb/testsuite/gdb.base/sigwinch-notty.exp
index cef21c0..0459ce9 100644
--- a/gdb/testsuite/gdb.base/sigwinch-notty.exp
+++ b/gdb/testsuite/gdb.base/sigwinch-notty.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.exp
index 5706a6f..3c81b77 100644
--- a/gdb/testsuite/gdb.base/sizeof.exp
+++ b/gdb/testsuite/gdb.base/sizeof.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2000-2024 Free Software Foundation, Inc.
+# Copyright 2000-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -127,7 +127,7 @@ while { $ok } {
gdb_expect {
-re ".*dump" {
#pass "maint print arch $ok"
- #set ok [expr $ok + 1]
+ #set ok [expr {$ok + 1}]
}
-re "$gdb_prompt $" {
pass "maint print arch"
diff --git a/gdb/testsuite/gdb.base/skip-inline.c b/gdb/testsuite/gdb.base/skip-inline.c
index 207e8d6..4ac203b 100644
--- a/gdb/testsuite/gdb.base/skip-inline.c
+++ b/gdb/testsuite/gdb.base/skip-inline.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/skip-inline.exp b/gdb/testsuite/gdb.base/skip-inline.exp
index 3c01234..e3bc108 100644
--- a/gdb/testsuite/gdb.base/skip-inline.exp
+++ b/gdb/testsuite/gdb.base/skip-inline.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ set srcfile skip-inline.c
set srcfile1 skip1.c
proc_with_prefix single_step { } {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -43,7 +43,7 @@ proc_with_prefix single_step { } {
}
proc_with_prefix double_step { } {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -61,7 +61,7 @@ proc_with_prefix double_step { } {
}
proc_with_prefix triple_step { } {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -75,7 +75,7 @@ proc_with_prefix triple_step { } {
}
proc_with_prefix skip_current_frame { } {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/skip-solib.exp b/gdb/testsuite/gdb.base/skip-solib.exp
index 9df0983..e152023 100644
--- a/gdb/testsuite/gdb.base/skip-solib.exp
+++ b/gdb/testsuite/gdb.base/skip-solib.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -72,7 +72,7 @@ with_test_prefix "ignoring solib file" {
"Num\\s+Enb\\s+Glob\\s+File\\s+RE\\s+Function\\s*" \
"1\\s+y\\s+n\\s+${srcfile_lib}\\s+n\\s+<none>\\s*"]
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -94,7 +94,7 @@ with_test_prefix "ignoring solib function" {
"Function multiply will be skipped when stepping\\." \
"skip function"
- if ![runto_main] {
+ if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/skip.c b/gdb/testsuite/gdb.base/skip.c
index 138b087..fc6319c 100644
--- a/gdb/testsuite/gdb.base/skip.c
+++ b/gdb/testsuite/gdb.base/skip.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/skip.exp b/gdb/testsuite/gdb.base/skip.exp
index ccc7ca3..3e2f162 100644
--- a/gdb/testsuite/gdb.base/skip.exp
+++ b/gdb/testsuite/gdb.base/skip.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -49,7 +49,7 @@ gdb_test "skip -rfunction" "Missing value for -rfunction option."
gdb_test "skip -x" "Invalid skip option: -x"
gdb_test "skip -rfu foo.* xyzzy" "Invalid argument: xyzzy"
-if ![runto_main] {
+if {![runto_main]} {
return
}
@@ -93,7 +93,7 @@ gdb_test "info skip" \
# files, so when we step into the first line in main(), we should step
# right over it and go to the second line of main().
-if ![runto_main] {
+if {![runto_main]} {
return
}
@@ -121,7 +121,7 @@ with_test_prefix "step after deleting 1" {
"4\\s+y\\s+n\\s+<none>\\s+n\\s+baz"] \
"info skip (delete 1)"
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -164,7 +164,7 @@ with_test_prefix "step after disabling 3" {
"3\\s+n\\s+n\\s+$srcfile1\\s+n\\s+<none>\\s*" \
"info skip shows entry as disabled"
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -180,7 +180,7 @@ with_test_prefix "step after enable 3" {
"3\\s+y\\s+n\\s+$srcfile1\\s+n\\s+<none>\\s*" \
"info skip shows entry as enabled"
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -247,7 +247,7 @@ gdb_test "skip -fu baz" "Function baz will be skipped when stepping\."
gdb_test "skip -rfu ^b.z$" "Function\\(s\\) \\^b\\.z\\$ will be skipped when stepping."
with_test_prefix "step using -fi" {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -257,7 +257,7 @@ with_test_prefix "step using -fi" {
}
with_test_prefix "step using -gfi" {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -267,7 +267,7 @@ with_test_prefix "step using -gfi" {
}
with_test_prefix "step using -fu for baz" {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -278,7 +278,7 @@ with_test_prefix "step using -fu for baz" {
}
with_test_prefix "step using -rfu for baz" {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -293,7 +293,7 @@ with_test_prefix "step using -rfu for baz" {
with_test_prefix "step using -fi + -fu" {
gdb_test_no_output "skip delete"
- if ![runto test_skip_file_and_function] {
+ if {![runto test_skip_file_and_function]} {
return
}
@@ -309,8 +309,9 @@ with_test_prefix "step using -fi + -fu" {
with_test_prefix "skip delete completion" {
global binfile
- clean_restart "${binfile}"
- if ![runto_main] {
+ clean_restart
+ gdb_load $binfile
+ if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/skip1.c b/gdb/testsuite/gdb.base/skip1.c
index a68b96b..3888ac0 100644
--- a/gdb/testsuite/gdb.base/skip1.c
+++ b/gdb/testsuite/gdb.base/skip1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/skipcxx.cc b/gdb/testsuite/gdb.base/skipcxx.cc
index 677d8d8..65ba99a 100644
--- a/gdb/testsuite/gdb.base/skipcxx.cc
+++ b/gdb/testsuite/gdb.base/skipcxx.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/skipcxx.exp b/gdb/testsuite/gdb.base/skipcxx.exp
index 73beed8..29f9254 100644
--- a/gdb/testsuite/gdb.base/skipcxx.exp
+++ b/gdb/testsuite/gdb.base/skipcxx.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/so-disc-shr.c b/gdb/testsuite/gdb.base/so-disc-shr.c
index d6cf36c..ab2f0b5 100644
--- a/gdb/testsuite/gdb.base/so-disc-shr.c
+++ b/gdb/testsuite/gdb.base/so-disc-shr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/so-impl-ld.exp b/gdb/testsuite/gdb.base/so-impl-ld.exp
index 04d4e47..1e309e5 100644
--- a/gdb/testsuite/gdb.base/so-impl-ld.exp
+++ b/gdb/testsuite/gdb.base/so-impl-ld.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,8 @@ if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
# Start with a fresh gdb
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_load_shlib $lib_sl
# This program implicitly loads SOM shared libraries.
diff --git a/gdb/testsuite/gdb.base/solib-abort-lib.c b/gdb/testsuite/gdb.base/solib-abort-lib.c
index 39797ab..a224b26 100644
--- a/gdb/testsuite/gdb.base/solib-abort-lib.c
+++ b/gdb/testsuite/gdb.base/solib-abort-lib.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/solib-abort.c b/gdb/testsuite/gdb.base/solib-abort.c
index 1e2d78f..5148ffb 100644
--- a/gdb/testsuite/gdb.base/solib-abort.c
+++ b/gdb/testsuite/gdb.base/solib-abort.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/solib-abort.exp b/gdb/testsuite/gdb.base/solib-abort.exp
index c0cfef0..ab162a9 100644
--- a/gdb/testsuite/gdb.base/solib-abort.exp
+++ b/gdb/testsuite/gdb.base/solib-abort.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,7 +38,8 @@ if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.base/solib-corrupted.exp b/gdb/testsuite/gdb.base/solib-corrupted.exp
index aff8b85..9b5556d 100644
--- a/gdb/testsuite/gdb.base/solib-corrupted.exp
+++ b/gdb/testsuite/gdb.base/solib-corrupted.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
# corruption cannot be tested. Disable the probes interface.
gdb_test "maint ignore-probes rtld"
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.base/solib-disc.c b/gdb/testsuite/gdb.base/solib-disc.c
index 9894174..f97fae1 100644
--- a/gdb/testsuite/gdb.base/solib-disc.c
+++ b/gdb/testsuite/gdb.base/solib-disc.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/solib-disc.exp b/gdb/testsuite/gdb.base/solib-disc.exp
index 280e8de..880f632 100644
--- a/gdb/testsuite/gdb.base/solib-disc.exp
+++ b/gdb/testsuite/gdb.base/solib-disc.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,7 +44,8 @@ if { [gdb_compile_shlib $libsrc $libobj {debug}] != ""
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
gdb_load_shlib $libobj
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.base/solib-display-lib.c b/gdb/testsuite/gdb.base/solib-display-lib.c
index e43a88c..4e025b8 100644
--- a/gdb/testsuite/gdb.base/solib-display-lib.c
+++ b/gdb/testsuite/gdb.base/solib-display-lib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/solib-display-main.c b/gdb/testsuite/gdb.base/solib-display-main.c
index d9ac66b..593ee33 100644
--- a/gdb/testsuite/gdb.base/solib-display-main.c
+++ b/gdb/testsuite/gdb.base/solib-display-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/solib-display.exp b/gdb/testsuite/gdb.base/solib-display.exp
index c9c66f6..f79ed54 100644
--- a/gdb/testsuite/gdb.base/solib-display.exp
+++ b/gdb/testsuite/gdb.base/solib-display.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.base/solib-nodir.exp b/gdb/testsuite/gdb.base/solib-nodir.exp
index fe34396..249f494 100644
--- a/gdb/testsuite/gdb.base/solib-nodir.exp
+++ b/gdb/testsuite/gdb.base/solib-nodir.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -53,7 +53,7 @@ gdb_test_no_output "set cwd ${binlibfiledir}" \
"set cwd OBJDIR/${subdir}"
set test "library loaded"
-if [runto_main] {
+if {[runto_main]} {
pass $test
} else {
fail $test
diff --git a/gdb/testsuite/gdb.base/solib-overlap-lib.c b/gdb/testsuite/gdb.base/solib-overlap-lib.c
index 47eedda..dc2a7aa 100644
--- a/gdb/testsuite/gdb.base/solib-overlap-lib.c
+++ b/gdb/testsuite/gdb.base/solib-overlap-lib.c
@@ -1,4 +1,4 @@
-/* Copyright 2009-2024 Free Software Foundation, Inc.
+/* Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.base/solib-overlap-main.c b/gdb/testsuite/gdb.base/solib-overlap-main.c
index dfa2c03..0fa9ea1 100644
--- a/gdb/testsuite/gdb.base/solib-overlap-main.c
+++ b/gdb/testsuite/gdb.base/solib-overlap-main.c
@@ -1,4 +1,4 @@
-/* Copyright 2009-2024 Free Software Foundation, Inc.
+/* Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.base/solib-overlap.exp b/gdb/testsuite/gdb.base/solib-overlap.exp
index 593f51d..893deb6 100644
--- a/gdb/testsuite/gdb.base/solib-overlap.exp
+++ b/gdb/testsuite/gdb.base/solib-overlap.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -42,7 +42,7 @@ set srcfile ${srcdir}/${subdir}/${testfile}.c
# Prelink first lib1 at 0x40000000 and lib2 at 0x41000000.
# During second pass try lib1 at 0x50000000 and lib2 at 0x51000000.
foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix "$prelink_lib1" {
- set prelink_lib2 [format "0x%x" [expr $prelink_lib1 + 0x01000000]]
+ set prelink_lib2 [format "0x%x" [expr {$prelink_lib1 + 0x01000000}]]
# Library file.
set binfile_lib1 [standard_output_file ${libname}1-${prelink_lib1}.so]
@@ -64,8 +64,8 @@ foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix "$prelink_lib1"
return -1
}
- if {[catch "exec prelink -N -r ${prelink_lib1} ${binfile_lib1}" output] != 0
- || [catch "exec prelink -N -r ${prelink_lib2} ${binfile_lib2}" output] != 0} {
+ if {[catch {exec prelink -N -r ${prelink_lib1} ${binfile_lib1}} output] != 0
+ || [catch {exec prelink -N -r ${prelink_lib2} ${binfile_lib2}} output] != 0} {
# Maybe we don't have prelink.
verbose -log "prelink failed: $output"
untested "could not prelink ${binfile_lib1_test_msg} or ${binfile_lib2_test_msg}."
diff --git a/gdb/testsuite/gdb.base/solib-probes-nosharedlibrary.c b/gdb/testsuite/gdb.base/solib-probes-nosharedlibrary.c
index e6a98eb..e851b7e 100644
--- a/gdb/testsuite/gdb.base/solib-probes-nosharedlibrary.c
+++ b/gdb/testsuite/gdb.base/solib-probes-nosharedlibrary.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/solib-probes-nosharedlibrary.exp b/gdb/testsuite/gdb.base/solib-probes-nosharedlibrary.exp
index d66d68a..1fe909c 100644
--- a/gdb/testsuite/gdb.base/solib-probes-nosharedlibrary.exp
+++ b/gdb/testsuite/gdb.base/solib-probes-nosharedlibrary.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/solib-search-lib1.c b/gdb/testsuite/gdb.base/solib-search-lib1.c
index 535cfce..44062a8 100644
--- a/gdb/testsuite/gdb.base/solib-search-lib1.c
+++ b/gdb/testsuite/gdb.base/solib-search-lib1.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/solib-search-lib2.c b/gdb/testsuite/gdb.base/solib-search-lib2.c
index 4bb467d..d9322dc 100644
--- a/gdb/testsuite/gdb.base/solib-search-lib2.c
+++ b/gdb/testsuite/gdb.base/solib-search-lib2.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/solib-search.c b/gdb/testsuite/gdb.base/solib-search.c
index 775bf21..d8426c6 100644
--- a/gdb/testsuite/gdb.base/solib-search.c
+++ b/gdb/testsuite/gdb.base/solib-search.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/solib-search.exp b/gdb/testsuite/gdb.base/solib-search.exp
index bf021c8..35b0314 100644
--- a/gdb/testsuite/gdb.base/solib-search.exp
+++ b/gdb/testsuite/gdb.base/solib-search.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
# Test solib-search-path, and in the case of solib-svr4.c whether l_addr_p
# is properly reset when the path is changed.
-require allow_shlib_tests
+require allow_shlib_tests gcore_cmd_available
require {!is_remote target}
# Build "wrong" and "right" versions of the libraries in separate directories.
diff --git a/gdb/testsuite/gdb.base/solib-search.h b/gdb/testsuite/gdb.base/solib-search.h
index 89f385c..f917e88 100644
--- a/gdb/testsuite/gdb.base/solib-search.h
+++ b/gdb/testsuite/gdb.base/solib-search.h
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/solib-symbol-lib.c b/gdb/testsuite/gdb.base/solib-symbol-lib.c
index 9f1e6b4..49fb67b 100644
--- a/gdb/testsuite/gdb.base/solib-symbol-lib.c
+++ b/gdb/testsuite/gdb.base/solib-symbol-lib.c
@@ -1,4 +1,4 @@
-/* Copyright 2007-2024 Free Software Foundation, Inc.
+/* Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.base/solib-symbol-main.c b/gdb/testsuite/gdb.base/solib-symbol-main.c
index a6186cd..34c099b 100644
--- a/gdb/testsuite/gdb.base/solib-symbol-main.c
+++ b/gdb/testsuite/gdb.base/solib-symbol-main.c
@@ -1,4 +1,4 @@
-/* Copyright 2007-2024 Free Software Foundation, Inc.
+/* Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/solib-symbol.exp
index 1ec3867..4d3494c 100644
--- a/gdb/testsuite/gdb.base/solib-symbol.exp
+++ b/gdb/testsuite/gdb.base/solib-symbol.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -34,7 +34,8 @@ if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
gdb_load_shlib $binfile_lib
# Set a breakpoint in the binary.
diff --git a/gdb/testsuite/gdb.base/solib-vanish-lib1.c b/gdb/testsuite/gdb.base/solib-vanish-lib1.c
index f15b4dc..565e651 100644
--- a/gdb/testsuite/gdb.base/solib-vanish-lib1.c
+++ b/gdb/testsuite/gdb.base/solib-vanish-lib1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/solib-vanish-lib2.c b/gdb/testsuite/gdb.base/solib-vanish-lib2.c
index ba673e6..e3d94ed 100644
--- a/gdb/testsuite/gdb.base/solib-vanish-lib2.c
+++ b/gdb/testsuite/gdb.base/solib-vanish-lib2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/solib-vanish-main.c b/gdb/testsuite/gdb.base/solib-vanish-main.c
index 4ef78dc..5615854 100644
--- a/gdb/testsuite/gdb.base/solib-vanish-main.c
+++ b/gdb/testsuite/gdb.base/solib-vanish-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/solib-vanish.exp b/gdb/testsuite/gdb.base/solib-vanish.exp
index 9c7c372..d85e06a 100644
--- a/gdb/testsuite/gdb.base/solib-vanish.exp
+++ b/gdb/testsuite/gdb.base/solib-vanish.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/solib-weak.c b/gdb/testsuite/gdb.base/solib-weak.c
index 4199721..0a693ba 100644
--- a/gdb/testsuite/gdb.base/solib-weak.c
+++ b/gdb/testsuite/gdb.base/solib-weak.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/solib-weak.exp b/gdb/testsuite/gdb.base/solib-weak.exp
index 1ed552c..f9b8856 100644
--- a/gdb/testsuite/gdb.base/solib-weak.exp
+++ b/gdb/testsuite/gdb.base/solib-weak.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -69,7 +69,7 @@ proc do_test { lib1opts lib2opts lib1first } {
set lib1 [standard_output_file ${libfile1}.sl]
set lib2 [standard_output_file ${libfile2}.sl]
- if $lib1first {
+ if {$lib1first} {
set exec_opts [list debug shlib=${lib1} shlib=${lib2}]
set expected_file ${libfile1}
} else {
@@ -84,7 +84,8 @@ proc do_test { lib1opts lib2opts lib1first } {
}
with_test_prefix $testopts {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
gdb_load_shlib $lib1
gdb_load_shlib $lib2
diff --git a/gdb/testsuite/gdb.base/source-dir.c b/gdb/testsuite/gdb.base/source-dir.c
index e6a98eb..e851b7e 100644
--- a/gdb/testsuite/gdb.base/source-dir.c
+++ b/gdb/testsuite/gdb.base/source-dir.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/source-dir.exp b/gdb/testsuite/gdb.base/source-dir.exp
index 96b6446..96f5a7c 100644
--- a/gdb/testsuite/gdb.base/source-dir.exp
+++ b/gdb/testsuite/gdb.base/source-dir.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -62,7 +62,7 @@ proc test_truncated_comp_dir {} {
# /some/path/to/gdb/build/testsuite/
# We are going to copy the source file out of the source tree into
# a location like this:
- # /some/path/to/gdb/build/testsuite/output/gdb.base/soure-dir/
+ # /some/path/to/gdb/build/testsuite/output/gdb.base/source-dir/
#
# We will then switch to this directory and compile the source
# file, however, we will ask GCC to remove this prefix from the
@@ -83,15 +83,16 @@ proc test_truncated_comp_dir {} {
# All of these pathname and directory manipulations assume
# host == build, so do not attempt this set of tests on remote host.
- if [is_remote host] {
+ if {[is_remote host]} {
return
}
- set working_dir [standard_output_file ""]
+ set working_dir [build_standard_output_file ""]
with_cwd $working_dir {
- set strip_dir [file normalize "${working_dir}/../.."]
+ set strip_dir [build_file_normalize "${working_dir}/../.."]
+ set h_strip_dir [host_file_normalize $strip_dir]
- set new_srcfile [standard_output_file ${srcfile}]
+ set new_srcfile [build_standard_output_file ${srcfile}]
set fd [open "$new_srcfile" w]
puts $fd "int
main ()
@@ -100,8 +101,17 @@ proc test_truncated_comp_dir {} {
}"
close $fd
+ # We ask GCC to remove both the build and host views of the
+ # path, because we don't know which one GCC uses. E.g., we're
+ # testing on MSYS2 with an MSYS2 cross-compiler that targets
+ # MinGW, then the path GCC uses is a Unix path. If OTOH we're
+ # testing on MSYS2 with a native Windows compiler, then the
+ # path GCC uses is a Windows path.
set options \
- "debug additional_flags=-fdebug-prefix-map=${strip_dir}="
+ [list \
+ "debug" \
+ "additional_flags=-fdebug-prefix-map=${strip_dir}=" \
+ "additional_flags=-fdebug-prefix-map=${h_strip_dir}="]
if { [gdb_compile "${srcfile}" "${binfile}" \
executable ${options}] != "" } {
untested "failed to compile"
@@ -109,7 +119,8 @@ proc test_truncated_comp_dir {} {
}
}
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
if { [ishost *-*-mingw*] } {
gdb_test_no_output "set directories \$cdir;\$cwd"
@@ -133,9 +144,9 @@ proc test_truncated_comp_dir {} {
"Does not include preprocessor macro info." ] \
"info source before setting directory search list"
- gdb_test "dir $strip_dir" \
+ gdb_test "dir $h_strip_dir" \
[search_dir_list [list \
- "$strip_dir" \
+ "$h_strip_dir" \
"\\\$cdir" \
"\\\$cwd"]] \
"setup source path search directory"
@@ -146,17 +157,23 @@ proc test_truncated_comp_dir {} {
"4\[ \t\]+return 0;" \
"5\[ \t\]+\\}" ]
- gdb_test "info source" \
- [multi_line \
- "Current source file is ${srcfile}" \
- "Compilation directory is \[^\n\r\]+" \
- "Located in ${new_srcfile}" \
- "Contains 5 lines." \
- "Source language is c." \
- "Producer is \[^\n\r\]+" \
- "\[^\n\r\]+" \
- "\[^\n\r\]+" ] \
- "info source after setting directory search list"
+ set re [multi_line \
+ "Current source file is ${srcfile}" \
+ "Compilation directory is \[^\n\r\]+" \
+ "Located in (\[^\n\r\]+)" \
+ "Contains 5 lines." \
+ "Source language is c." \
+ "Producer is \[^\n\r\]+" \
+ "\[^\n\r\]+" \
+ "\[^\n\r\]+"]
+ set test "info source after setting directory search list"
+ gdb_test_multiple "info source" $test {
+ -re -wrap "$re" {
+ set host_new_srcfile [host_file_normalize $new_srcfile]
+ set host_location [host_file_sanitize $expect_out(1,string)]
+ gdb_assert {$host_new_srcfile eq $host_location} $gdb_test_name
+ }
+ }
}
proc test_change_search_directory_with_empty_dirname {} {
diff --git a/gdb/testsuite/gdb.base/source-error-1.gdb b/gdb/testsuite/gdb.base/source-error-1.gdb
index 8528fd8..05f9029 100644
--- a/gdb/testsuite/gdb.base/source-error-1.gdb
+++ b/gdb/testsuite/gdb.base/source-error-1.gdb
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/source-error.gdb b/gdb/testsuite/gdb.base/source-error.gdb
index d5b9983..a531253 100644
--- a/gdb/testsuite/gdb.base/source-error.gdb
+++ b/gdb/testsuite/gdb.base/source-error.gdb
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/source-execution.c b/gdb/testsuite/gdb.base/source-execution.c
index 46d9299..9f64585 100644
--- a/gdb/testsuite/gdb.base/source-execution.c
+++ b/gdb/testsuite/gdb.base/source-execution.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/source-execution.exp b/gdb/testsuite/gdb.base/source-execution.exp
index 7fc60d5..c0a54f2 100644
--- a/gdb/testsuite/gdb.base/source-execution.exp
+++ b/gdb/testsuite/gdb.base/source-execution.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/source-execution.gdb b/gdb/testsuite/gdb.base/source-execution.gdb
index 8fb9194c..55d9be8 100644
--- a/gdb/testsuite/gdb.base/source-execution.gdb
+++ b/gdb/testsuite/gdb.base/source-execution.gdb
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/source-nofile.gdb b/gdb/testsuite/gdb.base/source-nofile.gdb
index 0255445..f3461b6 100644
--- a/gdb/testsuite/gdb.base/source-nofile.gdb
+++ b/gdb/testsuite/gdb.base/source-nofile.gdb
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/source-open.c b/gdb/testsuite/gdb.base/source-open.c
index afaa14e..bd8a16d 100644
--- a/gdb/testsuite/gdb.base/source-open.c
+++ b/gdb/testsuite/gdb.base/source-open.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/source-open.exp b/gdb/testsuite/gdb.base/source-open.exp
index df9a9f9..016fde4 100644
--- a/gdb/testsuite/gdb.base/source-open.exp
+++ b/gdb/testsuite/gdb.base/source-open.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/source-search.c b/gdb/testsuite/gdb.base/source-search.c
new file mode 100644
index 0000000..2320c5c
--- /dev/null
+++ b/gdb/testsuite/gdb.base/source-search.c
@@ -0,0 +1,127 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int
+main (void)
+{
+ /* Line 21 */
+ /* Line 22 */
+ /* Line 23 */
+ /* Line 24 */
+ /* Line 25 */
+ /* Line 26 */
+ /* Line 27 */
+ /* Line 28 */
+ /* Line 29 */
+ /* Line 30 */
+ /* Line 31 */
+ /* Line 32 */
+ /* Line 33 */
+ /* Line 34 */
+ /* Line 35 */
+ /* Line 36 */
+ /* Line 37 */
+ /* Line 38 */
+ /* Line 39 */
+ /* Line 40 */
+ /* Line 41 */
+ /* Line 42 */
+ /* Line 43 */
+ /* Line 44 */
+ /* Line 45 */
+ /* Line 46 */
+ /* Line 47 */
+ /* Line 48 */
+ /* Line 49 */
+ /* Line 50 */
+ /* Line 51 */
+ /* Line 52 */
+ /* Line 53 */
+ /* Line 54 */
+ /* Line 55 */
+ /* Line 56 */
+ /* Line 57 */
+ /* Line 58 */
+ /* Line 59 */
+ /* Line 60 */
+ /* Line 61 */
+ /* Line 62 */
+ /* Line 63 */
+ /* Line 64 */
+ /* Line 65 */
+ /* Line 66 */
+ /* Line 67 */
+ /* Line 68 */
+ /* Line 69 */
+ /* Line 70 */
+ /* Line 71 */
+ /* Line 72 */
+ /* Line 73 */
+ /* Line 74 */
+ /* Line 75 */
+ /* Line 76 */
+ /* Line 77 */
+ /* Line 78 */
+ /* Line 79 */
+ /* Line 80 */
+ /* Line 81 */
+ /* Line 82 */
+ /* Line 83 */
+ /* Line 84 */
+ /* Line 85 */
+ /* Line 86 */
+ /* Line 87 */
+ /* Line 88 */
+ /* Line 89 */
+ /* Line 90 */
+ /* Line 91 */
+ /* Line 92 */
+ /* Line 93 */
+ /* Line 94 */
+ /* Line 95 */
+ /* Line 96 */
+ /* Line 97 */
+ /* Line 98 */
+ /* Line 99 */
+ /* Line 100 */
+ /* Line 101 */
+ /* Line 102 */
+ /* Line 103 */
+ /* Line 104 */
+ /* Line 105 */
+ /* Line 106 */
+ /* Line 107 */
+ /* Line 108 */
+ /* Line 109 */
+ /* Line 110 */
+ /* Line 111 */
+ /* Line 112 */
+ /* Line 113 */
+ /* Line 114 */
+ /* Line 115 */
+ /* Line 116 */
+ /* Line 117 */
+ /* Line 118 */
+ /* Line 119 */
+ /* Line 120 */
+ /* Line 121 */
+ /* Line 122 */
+ /* Line 123 */
+ /* Line 124 */
+ /* Line 125 */
+ return 0;
+} /* Last line. */
diff --git a/gdb/testsuite/gdb.base/source-search.exp b/gdb/testsuite/gdb.base/source-search.exp
new file mode 100644
index 0000000..559c500
--- /dev/null
+++ b/gdb/testsuite/gdb.base/source-search.exp
@@ -0,0 +1,106 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test 'forward-search' and 'reverse-search' commands. This test
+# relies on some hard-coded line numbers relating to the source file.
+# We could switch to using gdb_get_line_number, but it doesn't feel
+# like that would add much value; just don't change the source file.
+
+standard_testfile
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
+ return
+}
+
+gdb_test "forward-search This testcase is part" \
+ "1\\s+/\\* This testcase is part of GDB, the GNU debugger\\." \
+ "search for first line of the file"
+
+gdb_test "forward-search This testcase is part" \
+ "Expression not found" \
+ "repeated search doesn't find the same first line"
+
+# The 'reverse-search' command starts searching from the line before
+# the last line displayed. So in this case, the reverse search starts
+# from line 0, i.e. nothing is searched.
+gdb_test "reverse-search This testcase is part" \
+ "Expression not found" \
+ "reverse search doesn't find the first line either"
+
+# List some source lines, and then perform some forward-searches. The
+# searches start from the first line after the last line displayed.
+gdb_test "list 20" ".*" \
+ "list source code ahead of a forward-search"
+gdb_test "forward-search Line 2" \
+ "25\\s+/\\* Line 25 \\*/" \
+ "first forward-search after a list"
+gdb_test "forward-search Line 2" \
+ "26\\s+/\\* Line 26 \\*/" \
+ "second forward-search after a list"
+gdb_test "forward-search Line 2" \
+ "27\\s+/\\* Line 27 \\*/" \
+ "third forward-search after a list"
+
+# Now reverse-search from where we got too.
+gdb_test "reverse-search Line 2" \
+ "26\\s+/\\* Line 26 \\*/" \
+ "first reverse-search for 'Line 2'"
+gdb_test "reverse-search Line 2" \
+ "25\\s+/\\* Line 25 \\*/" \
+ "second reverse-search for 'Line 2'"
+gdb_test "reverse-search Line 2" \
+ "24\\s+/\\* Line 24 \\*/" \
+ "third reverse-search for 'Line 2'"
+
+# List some source lines, and then perform a reverse-search. The
+# search starts frm the first line before the last line displayed.
+gdb_test "list 20" ".*" \
+ "list source code ahead of a reverse-search"
+gdb_test "reverse-search Line 2" \
+ "23\\s+/\\* Line 23 \\*/" \
+ "reverse-search after a list"
+
+# List the last lines of the file, then reverse search for the last
+# line. As reverse-search starts on the line before the last line
+# displayed, this will fail to find the last line.
+gdb_test "list 127"
+gdb_test "reverse-search Last line" \
+ "Expression not found" \
+ "reverse search for the last line fails"
+
+# List some lines from the middle of the file. Then try an invalid
+# 'list' command. Finally, check searches pick up from the middle of
+# the file where the first 'list' successfully completed.
+foreach_with_prefix search_direction { forward reverse } {
+ foreach_with_prefix bad_list { out-of-range backwards } {
+ gdb_test "list 50"
+
+ if { $bad_list eq "out-of-range" } {
+ gdb_test "list 1000" \
+ "Line number 995 out of range; \[^\r\n\]+ has 127 lines\\."
+ } else {
+ gdb_test_no_output "list 60,50"
+ }
+
+ if { $search_direction eq "forward" } {
+ set line 55
+ } else {
+ set line 53
+ }
+
+ gdb_test "${search_direction}-search Line" \
+ "$line\\s+/\\* Line $line \\*/"
+ }
+}
diff --git a/gdb/testsuite/gdb.base/source-test.gdb b/gdb/testsuite/gdb.base/source-test.gdb
index f23b549..cd1dfcc 100644
--- a/gdb/testsuite/gdb.base/source-test.gdb
+++ b/gdb/testsuite/gdb.base/source-test.gdb
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/source.exp b/gdb/testsuite/gdb.base/source.exp
index 26e4d26..d8b814f 100644
--- a/gdb/testsuite/gdb.base/source.exp
+++ b/gdb/testsuite/gdb.base/source.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.c b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.c
index d22cf67..4a91280 100644
--- a/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.c
+++ b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp
index 226a756..0ded183 100644
--- a/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp
+++ b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
@@ -140,7 +140,7 @@ gdb_test_multiple "" $test {
set disasm_after [disassemble "after"]
set test "before/after disassembly matches"
-if ![string compare $disasm_before $disasm_after] {
+if {![string compare $disasm_before $disasm_after]} {
pass $test
} else {
fail $test
diff --git a/gdb/testsuite/gdb.base/sss-bp-on-user-bp.c b/gdb/testsuite/gdb.base/sss-bp-on-user-bp.c
index 5a5a68e..c34e7b7 100644
--- a/gdb/testsuite/gdb.base/sss-bp-on-user-bp.c
+++ b/gdb/testsuite/gdb.base/sss-bp-on-user-bp.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/sss-bp-on-user-bp.exp b/gdb/testsuite/gdb.base/sss-bp-on-user-bp.exp
index a3cbe1d..4aabe19 100644
--- a/gdb/testsuite/gdb.base/sss-bp-on-user-bp.exp
+++ b/gdb/testsuite/gdb.base/sss-bp-on-user-bp.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/stack-checking.c b/gdb/testsuite/gdb.base/stack-checking.c
index 2439edc..bec4815 100644
--- a/gdb/testsuite/gdb.base/stack-checking.c
+++ b/gdb/testsuite/gdb.base/stack-checking.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/stack-checking.exp b/gdb/testsuite/gdb.base/stack-checking.exp
index 41fd7e8..15fc677 100644
--- a/gdb/testsuite/gdb.base/stack-checking.exp
+++ b/gdb/testsuite/gdb.base/stack-checking.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [con
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.base/stack-protector.c b/gdb/testsuite/gdb.base/stack-protector.c
index 3967857..738383f 100644
--- a/gdb/testsuite/gdb.base/stack-protector.c
+++ b/gdb/testsuite/gdb.base/stack-protector.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/stack-protector.exp b/gdb/testsuite/gdb.base/stack-protector.exp
index 6b6043e..c56c5f5 100644
--- a/gdb/testsuite/gdb.base/stack-protector.exp
+++ b/gdb/testsuite/gdb.base/stack-protector.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2024 Free Software Foundation, Inc.
+# Copyright (C) 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/stale-infcall.c b/gdb/testsuite/gdb.base/stale-infcall.c
index 07def7f..f66d12d 100644
--- a/gdb/testsuite/gdb.base/stale-infcall.c
+++ b/gdb/testsuite/gdb.base/stale-infcall.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/stale-infcall.exp b/gdb/testsuite/gdb.base/stale-infcall.exp
index e0c71de..1d2c655 100644
--- a/gdb/testsuite/gdb.base/stale-infcall.exp
+++ b/gdb/testsuite/gdb.base/stale-infcall.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/stap-probe.c b/gdb/testsuite/gdb.base/stap-probe.c
index 2bc010d..0162875 100644
--- a/gdb/testsuite/gdb.base/stap-probe.c
+++ b/gdb/testsuite/gdb.base/stap-probe.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/stap-probe.exp b/gdb/testsuite/gdb.base/stap-probe.exp
index 40e8c5e..4d8efc1 100644
--- a/gdb/testsuite/gdb.base/stap-probe.exp
+++ b/gdb/testsuite/gdb.base/stap-probe.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -60,8 +60,8 @@ proc gdb_count_probes { type provider name { object "" }} {
}
}
- if { [expr $no_probes_line && $probe_count > 0] \
- || [expr !$no_probes_line && $probe_count == 0] } {
+ if { ($no_probes_line && $probe_count > 0) \
+ || (!$no_probes_line && $probe_count == 0) } {
perror "Mismatch between no probes found line, and probes count"
return -1
}
@@ -74,7 +74,7 @@ proc check_for_usable_xmm0_probe { binfile } {
set binfile [standard_output_file $binfile]
set command "exec $readelf_program -n $binfile"
verbose -log "command is $command"
- set result [catch $command output]
+ set result [catch {{*}$command} output]
verbose -log "result is $result"
verbose -log "output is $output"
@@ -89,7 +89,7 @@ proc check_for_usable_xmm0_probe { binfile } {
# First, look for the xmmreg probe, and if we find it, grab the
# argument string.
- if ![regexp {\n\s+Provider: test\n\s+Name: xmmreg\n[^\n]+\n\s+Arguments: ([^\n]+)\n} $output ignore arguments] {
+ if {![regexp {\n\s+Provider: test\n\s+Name: xmmreg\n[^\n]+\n\s+Arguments: ([^\n]+)\n} $output ignore arguments]} {
verbose -log "APB: Couldn't find probe at all"
return false
}
@@ -98,7 +98,7 @@ proc check_for_usable_xmm0_probe { binfile } {
verbose -log "APB: arguments: '$arguments'"
# Check the the argument string mentions xmm0.
- if ![regexp {@%?xmm0} $arguments] {
+ if {![regexp {@%?xmm0} $arguments]} {
verbose -log "APB: Prove doesn't use xmm0 register"
return false
}
@@ -133,7 +133,7 @@ proc stap_test {exec_name {args ""}} {
"get original address of relocation_marker"]
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -159,7 +159,7 @@ proc stap_test {exec_name {args ""}} {
[get_hexadecimal_valueof "&relocation_marker" \
"0" "get revised relocation_marker address"]
set relocation_base \
- [expr $updated_semaphore_addr_var - $semaphore_addr_var]
+ [expr {$updated_semaphore_addr_var - $semaphore_addr_var}]
if {$relocation_base != 0} {
# Checks that GDB doesn't mistakenly relocate and write to null
# semaphore addresses. If it were to relocate a zero-valued
@@ -219,7 +219,7 @@ proc stap_test {exec_name {args ""}} {
"print \$_probe_arg1 for probe ps"
# Check the probe is using the xmm0 register.
- if [check_for_usable_xmm0_probe $exec_name] {
+ if {[check_for_usable_xmm0_probe $exec_name]} {
delete_breakpoints
if {[runto "-pstap test:xmmreg"]} {
diff --git a/gdb/testsuite/gdb.base/start-cpp.cc b/gdb/testsuite/gdb.base/start-cpp.cc
index 6a800d8..1f788ed 100644
--- a/gdb/testsuite/gdb.base/start-cpp.cc
+++ b/gdb/testsuite/gdb.base/start-cpp.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/start-cpp.exp b/gdb/testsuite/gdb.base/start-cpp.exp
index 330c6ea..ea8972f 100644
--- a/gdb/testsuite/gdb.base/start-cpp.exp
+++ b/gdb/testsuite/gdb.base/start-cpp.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/start.c b/gdb/testsuite/gdb.base/start.c
index 4587679..f06fe58 100644
--- a/gdb/testsuite/gdb.base/start.c
+++ b/gdb/testsuite/gdb.base/start.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2005-2024 Free Software Foundation, Inc.
+ Copyright 2005-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/start.exp b/gdb/testsuite/gdb.base/start.exp
index 64b04c2..02e238a 100644
--- a/gdb/testsuite/gdb.base/start.exp
+++ b/gdb/testsuite/gdb.base/start.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/starti.c b/gdb/testsuite/gdb.base/starti.c
index 35f995c..7e5555f 100644
--- a/gdb/testsuite/gdb.base/starti.c
+++ b/gdb/testsuite/gdb.base/starti.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/starti.exp b/gdb/testsuite/gdb.base/starti.exp
index 5fe98dc..c123519 100644
--- a/gdb/testsuite/gdb.base/starti.exp
+++ b/gdb/testsuite/gdb.base/starti.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/startup-with-shell.c b/gdb/testsuite/gdb.base/startup-with-shell.c
index ca7a809..423cd17 100644
--- a/gdb/testsuite/gdb.base/startup-with-shell.c
+++ b/gdb/testsuite/gdb.base/startup-with-shell.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/startup-with-shell.exp b/gdb/testsuite/gdb.base/startup-with-shell.exp
index e27f17a..6872369 100644
--- a/gdb/testsuite/gdb.base/startup-with-shell.exp
+++ b/gdb/testsuite/gdb.base/startup-with-shell.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,6 +22,8 @@ require !use_gdb_stub
# (via dejagnu) yet.
require {!is_remote target}
+require {expr {[have_startup_shell] != -1}}
+
standard_testfile
if { [build_executable "failed to prepare" $testfile $srcfile debug] } {
@@ -40,7 +42,8 @@ run_on_host \
proc initial_setup_simple { startup_with_shell run_args } {
global hex decimal binfile unique_file
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
gdb_test_no_output "set startup-with-shell $startup_with_shell"
gdb_test_no_output "set print characters unlimited"
@@ -91,73 +94,97 @@ proc run_test_same { args re testname } {
run_test $args $re $re $testname
}
-# The regexp to match a single '\' character.
-set bs "\\\\"
-
-# Are we using 'remote' or 'extended-remote' protocol?
-set is_remote_p [gdb_protocol_is_remote]
-
-## Run the actual tests
-
-run_test "$unique_file_dir/*.unique-extension" \
- "\"$unique_file\"" \
- "\"$unique_file_dir/\\\*\.unique-extension\"" \
- "arg is glob" \
- $is_remote_p
-
-run_test_same "$unique_file_dir/\\*.unique-extension" \
- "\"$unique_file_dir/\\\*\.unique-extension\"" \
- "arg is escaped glob"
-
-save_vars { env(TEST) } {
- set env(TEST) "1234"
- run_test "\$TEST" \
- "\"1234\"" \
- "\"\\\$TEST\"" \
- "arg is shell variable" \
- $is_remote_p
+# Run the actual tests
+proc run_all_tests { { is_remote_with_split_args false } } {
+ # The regexp to match a single '\' character.
+ set bs "\\\\"
+
+ run_test "$::unique_file_dir/*.unique-extension" \
+ "\"$::unique_file\"" \
+ "\"$::unique_file_dir/\\\*\.unique-extension\"" \
+ "arg is glob" \
+ $is_remote_with_split_args
+
+ run_test_same "$::unique_file_dir/\\*.unique-extension" \
+ "\"$::unique_file_dir/\\\*\.unique-extension\"" \
+ "arg is escaped glob"
+
+ save_vars { ::env(TEST) } {
+ set ::env(TEST) "1234"
+ run_test "\$TEST" \
+ "\"1234\"" \
+ "\"\\\$TEST\"" \
+ "arg is shell variable" \
+ $is_remote_with_split_args
+
+ run_test_same "\\\$TEST" \
+ "\"\\\$TEST\"" \
+ "arg is escaped shell variable"
+ }
- run_test_same "\\\$TEST" \
- "\"\\\$TEST\"" \
- "arg is escaped shell variable"
+ run_test "\$(echo foo)" \
+ "\"foo\"" \
+ "\"\\\$\\(echo\"" \
+ "arg is parameter expansion, command execution" \
+ $is_remote_with_split_args
+
+ run_test "\$((2 + 3))" \
+ "\"5\"" \
+ "\"\\\$\\(\\(2\"" \
+ "arg is parameter expansion, expression evaluation" \
+ $is_remote_with_split_args
+
+ run_test_same "\"\\a\"" \
+ "\"${bs}${bs}a\"" \
+ "retain backslash in double quote arg"
+
+ run_test_same "'\\a'" \
+ "\"${bs}${bs}a\"" \
+ "retain backslash in single quote arg"
+
+ run_test_same "\"\\\$\"" \
+ "\"\\\$\"" \
+ "'\$' can be escaped in double quote arg"
+
+ run_test_same "'\\\$'" \
+ "\"${bs}${bs}\\\$\"" \
+ "'\$' is not escaped in single quote arg"
+
+ run_test_same "\"\\`\"" \
+ "\"\\`\"" \
+ "'`' can be escaped in double quote arg"
+
+ run_test_same "'\\`'" \
+ "\"${bs}${bs}`\"" \
+ "'`' is not escaped in single quote arg"
+
+ run_test_same "\"\\\"\"" \
+ "\"${bs}\"\"" \
+ "'\"' can be escaped in double quote arg"
+
+ run_test_same "'\\\"'" \
+ "\"${bs}${bs}${bs}\"\"" \
+ "'\"' is not escaped in single quote arg"
+
+ run_test_same "\"\\\\\"" \
+ "\"${bs}${bs}\"" \
+ "'\\' can be escaped in double quote arg"
+
+ run_test_same "'\\\\'" \
+ "\"${bs}${bs}${bs}${bs}\"" \
+ "'\\' is not escaped in single quote arg"
}
-run_test_same "\"\\a\"" \
- "\"${bs}${bs}a\"" \
- "retain backslash in double quote arg"
-
-run_test_same "'\\a'" \
- "\"${bs}${bs}a\"" \
- "retain backslash in single quote arg"
-
-run_test_same "\"\\\$\"" \
- "\"\\\$\"" \
- "'\$' can be escaped in double quote arg"
+run_all_tests
-run_test_same "'\\\$'" \
- "\"${bs}${bs}\\\$\"" \
- "'\$' is not escaped in single quote arg"
-
-run_test_same "\"\\`\"" \
- "\"\\`\"" \
- "'`' can be escaped in double quote arg"
-
-run_test_same "'\\`'" \
- "\"${bs}${bs}`\"" \
- "'`' is not escaped in single quote arg"
-
-run_test_same "\"\\\"\"" \
- "\"${bs}\"\"" \
- "'\"' can be escaped in double quote arg"
-
-run_test_same "'\\\"'" \
- "\"${bs}${bs}${bs}\"\"" \
- "'\"' is not escaped in single quote arg"
-
-run_test_same "\"\\\\\"" \
- "\"${bs}${bs}\"" \
- "'\\' can be escaped in double quote arg"
-
-run_test_same "'\\\\'" \
- "\"${bs}${bs}${bs}${bs}\"" \
- "'\\' is not escaped in single quote arg"
+# For extended-remote targets, disable the packet which passes
+# inferior arguments as a single string. This changes how the vRun
+# (extended-remote only) packet works.
+if {[target_info gdb_protocol] == "extended-remote"} {
+ with_test_prefix "single-inferior-arg disabled" {
+ save_vars { GDBFLAGS } {
+ append GDBFLAGS " -ex \"set remote single-inferior-argument-feature-packet off\""
+ run_all_tests true
+ }
+ }
+}
diff --git a/gdb/testsuite/gdb.base/statistics.exp b/gdb/testsuite/gdb.base/statistics.exp
index a333f99..1dacc4d 100644
--- a/gdb/testsuite/gdb.base/statistics.exp
+++ b/gdb/testsuite/gdb.base/statistics.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-break.c b/gdb/testsuite/gdb.base/step-break.c
index 8cd4df7..1934f60 100644
--- a/gdb/testsuite/gdb.base/step-break.c
+++ b/gdb/testsuite/gdb.base/step-break.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-break.exp b/gdb/testsuite/gdb.base/step-break.exp
index 7dc0492..e565185 100644
--- a/gdb/testsuite/gdb.base/step-break.exp
+++ b/gdb/testsuite/gdb.base/step-break.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-bt.c b/gdb/testsuite/gdb.base/step-bt.c
index 9b3c718..49f42ad 100644
--- a/gdb/testsuite/gdb.base/step-bt.c
+++ b/gdb/testsuite/gdb.base/step-bt.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-bt.exp b/gdb/testsuite/gdb.base/step-bt.exp
index f872daf..f213a2f 100644
--- a/gdb/testsuite/gdb.base/step-bt.exp
+++ b/gdb/testsuite/gdb.base/step-bt.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-indirect-call-thunk.c b/gdb/testsuite/gdb.base/step-indirect-call-thunk.c
index 277653c..3266305 100644
--- a/gdb/testsuite/gdb.base/step-indirect-call-thunk.c
+++ b/gdb/testsuite/gdb.base/step-indirect-call-thunk.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp b/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp
index 36d3933..146a0e0 100644
--- a/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp
+++ b/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-into-other-file.c b/gdb/testsuite/gdb.base/step-into-other-file.c
index 5ec7c33..5023755 100644
--- a/gdb/testsuite/gdb.base/step-into-other-file.c
+++ b/gdb/testsuite/gdb.base/step-into-other-file.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-into-other-file.exp b/gdb/testsuite/gdb.base/step-into-other-file.exp
index f0e8c3f..80fc55e 100644
--- a/gdb/testsuite/gdb.base/step-into-other-file.exp
+++ b/gdb/testsuite/gdb.base/step-into-other-file.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/step-into-other-file.h b/gdb/testsuite/gdb.base/step-into-other-file.h
index 60b4816..0617011 100644
--- a/gdb/testsuite/gdb.base/step-into-other-file.h
+++ b/gdb/testsuite/gdb.base/step-into-other-file.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-line.c b/gdb/testsuite/gdb.base/step-line.c
index 24b8bfb..ac7a7bb 100644
--- a/gdb/testsuite/gdb.base/step-line.c
+++ b/gdb/testsuite/gdb.base/step-line.c
@@ -1,6 +1,6 @@
/* Test step/next in presence of #line directives.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/step-line.exp b/gdb/testsuite/gdb.base/step-line.exp
index 6629eb8..068adf5 100644
--- a/gdb/testsuite/gdb.base/step-line.exp
+++ b/gdb/testsuite/gdb.base/step-line.exp
@@ -1,4 +1,4 @@
-# Copyright 2001-2024 Free Software Foundation, Inc.
+# Copyright 2001-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-line.inp b/gdb/testsuite/gdb.base/step-line.inp
index 744b2f0..7f49e97 100644
--- a/gdb/testsuite/gdb.base/step-line.inp
+++ b/gdb/testsuite/gdb.base/step-line.inp
@@ -1,6 +1,6 @@
# Test step/next in presence of #line directives
-# Copyright (C) 2001-2024 Free Software Foundation, Inc.
+# Copyright (C) 2001-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-over-clone.c b/gdb/testsuite/gdb.base/step-over-clone.c
index 920de86..f254882 100644
--- a/gdb/testsuite/gdb.base/step-over-clone.c
+++ b/gdb/testsuite/gdb.base/step-over-clone.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-over-exit.c b/gdb/testsuite/gdb.base/step-over-exit.c
index 5c34547..6c3db60 100644
--- a/gdb/testsuite/gdb.base/step-over-exit.c
+++ b/gdb/testsuite/gdb.base/step-over-exit.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-over-exit.exp b/gdb/testsuite/gdb.base/step-over-exit.exp
index d373b1a..105157d 100644
--- a/gdb/testsuite/gdb.base/step-over-exit.exp
+++ b/gdb/testsuite/gdb.base/step-over-exit.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,11 +13,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-standard_testfile
-
# Test a thread is doing step-over a syscall instruction which is exit,
# and GDBserver should cleanup its state of step-over properly.
+# The testcase relies on follow-fork-mode child.
+require allow_fork_tests
+
+standard_testfile
+
set syscall_insn ""
# Define the syscall instruction for each target.
@@ -35,7 +38,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/step-over-fork.c b/gdb/testsuite/gdb.base/step-over-fork.c
index 3b46f44..365e080 100644
--- a/gdb/testsuite/gdb.base/step-over-fork.c
+++ b/gdb/testsuite/gdb.base/step-over-fork.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-over-no-symbols.exp b/gdb/testsuite/gdb.base/step-over-no-symbols.exp
index 98158e1..24e3bf7 100644
--- a/gdb/testsuite/gdb.base/step-over-no-symbols.exp
+++ b/gdb/testsuite/gdb.base/step-over-no-symbols.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,9 +47,10 @@ proc test_step_over { displaced } {
global hex
global binfile
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/step-over-syscall.exp b/gdb/testsuite/gdb.base/step-over-syscall.exp
index dc73def..e4425a1 100644
--- a/gdb/testsuite/gdb.base/step-over-syscall.exp
+++ b/gdb/testsuite/gdb.base/step-over-syscall.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -227,7 +227,7 @@ proc step_over_syscall { syscall } {
lappend options "pthreads"
}
- if [build_executable ${testfile}.exp ${testfile} ${testfile}.c $options] {
+ if {[build_executable ${testfile}.exp ${testfile} ${testfile}.c $options]} {
untested "failed to compile"
return -1
}
diff --git a/gdb/testsuite/gdb.base/step-over-vfork.c b/gdb/testsuite/gdb.base/step-over-vfork.c
index 0ce8d65..704c0d8 100644
--- a/gdb/testsuite/gdb.base/step-over-vfork.c
+++ b/gdb/testsuite/gdb.base/step-over-vfork.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-resume-infcall.c b/gdb/testsuite/gdb.base/step-resume-infcall.c
index a5baf1a..f2e9047 100644
--- a/gdb/testsuite/gdb.base/step-resume-infcall.c
+++ b/gdb/testsuite/gdb.base/step-resume-infcall.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2005-2024 Free Software Foundation, Inc.
+ Copyright 2005-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-resume-infcall.exp b/gdb/testsuite/gdb.base/step-resume-infcall.exp
index 5646e7c..f1f8dc2 100644
--- a/gdb/testsuite/gdb.base/step-resume-infcall.exp
+++ b/gdb/testsuite/gdb.base/step-resume-infcall.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -27,7 +27,7 @@ gdb_test "step" " in-func .*"
gdb_test "up" " call-func .*"
gdb_test_no_output {set $b=$pc}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/step-sw-breakpoint-adjust-pc.c b/gdb/testsuite/gdb.base/step-sw-breakpoint-adjust-pc.c
index c4baeac..438ed7a 100644
--- a/gdb/testsuite/gdb.base/step-sw-breakpoint-adjust-pc.c
+++ b/gdb/testsuite/gdb.base/step-sw-breakpoint-adjust-pc.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-sw-breakpoint-adjust-pc.exp b/gdb/testsuite/gdb.base/step-sw-breakpoint-adjust-pc.exp
index 4577b8f..b10465f 100644
--- a/gdb/testsuite/gdb.base/step-sw-breakpoint-adjust-pc.exp
+++ b/gdb/testsuite/gdb.base/step-sw-breakpoint-adjust-pc.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
standard_testfile
-if [build_executable "failed to build" ${testfile} ${srcfile} {debug}] {
+if {[build_executable "failed to build" ${testfile} ${srcfile} {debug}]} {
return -1
}
@@ -36,13 +36,14 @@ proc test {non_stop displaced always_inserted} {
save_vars { GDBFLAGS } {
set GDBFLAGS "$GDBFLAGS -ex \"set non-stop $non_stop\""
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
}
gdb_test_no_output "set displaced-stepping $displaced"
gdb_test_no_output "set breakpoint always-inserted $always_inserted"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/step-symless.c b/gdb/testsuite/gdb.base/step-symless.c
index 19c72f8..e39216e 100644
--- a/gdb/testsuite/gdb.base/step-symless.c
+++ b/gdb/testsuite/gdb.base/step-symless.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-symless.exp b/gdb/testsuite/gdb.base/step-symless.exp
index b01b9f6..47e4682 100644
--- a/gdb/testsuite/gdb.base/step-symless.exp
+++ b/gdb/testsuite/gdb.base/step-symless.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if {[build_executable ${testfile}.exp ${testfile} ${srcfile} {nodebug}] == -1} {
# We need those symbols global to access them from the .S file.
set test "strip stub symbols"
set objcopy_program [gdb_find_objcopy]
-set result [catch "exec $objcopy_program -N symless ${binfile}" output]
+set result [catch {exec $objcopy_program -N symless ${binfile}} output]
verbose "result is $result"
verbose "output is $output"
if {$result != 0} {
@@ -32,7 +32,7 @@ pass $test
clean_restart $testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/step-test.exp b/gdb/testsuite/gdb.base/step-test.exp
index 6e6f89b..cfcf511 100644
--- a/gdb/testsuite/gdb.base/step-test.exp
+++ b/gdb/testsuite/gdb.base/step-test.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debu
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return 0
@@ -32,7 +33,7 @@ if {![runto_main]} {
# Set a breakpoint at line 45, if stepi then finish fails, we would
# run to the end of the program, which would mess up the rest of the tests.
-
+
# Vanilla step/next
#
gdb_test "next" ".*${decimal}.*x = 1;.*" "next 1"
@@ -91,10 +92,10 @@ if { [istarget "ia64-*-*"] || [istarget "mips*-*-*"]} {
###
### The exact regexps used are "$HERE.*$gdb_prompt $"
### and "$THERE.*$gdb_prompt $"
-###
+###
proc test_i {name command here there} {
global gdb_prompt
-
+
set i 0
gdb_test_multiple "$command" "$name" {
-re "$here.*$gdb_prompt $" {
@@ -122,7 +123,7 @@ test_i "stepi to next line" "stepi" \
# if this passes through a (useless) PLT entry.
test_i "stepi into function" "stepi" \
"(.*${decimal}.*callee.*STEPI|.* in callee@plt)" \
- ".*callee \\(\\) at .*step-test\\.c"
+ ".*callee \\(\\) at .*step-test\\.c"
# Continue to step until we reach the function's body. This makes it
# more likely that we've actually completed the prologue, so "finish"
@@ -133,7 +134,7 @@ test_i "stepi into function's first source line" "stepi" \
"(${decimal}.*int callee|$pic_thunk_re)" \
".*${decimal}.*myglob.*; return 0;"
-# Have to be careful here, if the finish does not work,
+# Have to be careful here, if the finish does not work,
# then we may run to the end of the program, which
# will cause erroneous failures in the rest of the tests
set test "stepi: finish call"
@@ -142,7 +143,7 @@ gdb_test_multiple "finish" "$test" {
pass "$test"
}
-re ".*(Program received|$inferior_exited_re).*$gdb_prompt $" {
- # Oops... We ran to the end of the program... Better reset
+ # Oops... We ran to the end of the program... Better reset
if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.base/step-through-epilogue.c b/gdb/testsuite/gdb.base/step-through-epilogue.c
index c545cb1..d96f0ae 100644
--- a/gdb/testsuite/gdb.base/step-through-epilogue.c
+++ b/gdb/testsuite/gdb.base/step-through-epilogue.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1992-2024 Free Software Foundation, Inc.
+ Copyright 1992-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/step-through-epilogue.exp b/gdb/testsuite/gdb.base/step-through-epilogue.exp
index 8416e13..e024433 100644
--- a/gdb/testsuite/gdb.base/step-through-epilogue.exp
+++ b/gdb/testsuite/gdb.base/step-through-epilogue.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/store.exp b/gdb/testsuite/gdb.base/store.exp
index 2271156..21f4422 100644
--- a/gdb/testsuite/gdb.base/store.exp
+++ b/gdb/testsuite/gdb.base/store.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/structs.c b/gdb/testsuite/gdb.base/structs.c
index dd85e5e..34ade49 100644
--- a/gdb/testsuite/gdb.base/structs.c
+++ b/gdb/testsuite/gdb.base/structs.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1996-2024 Free Software Foundation, Inc.
+ Copyright 1996-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp
index 99b6aa9..4850a59 100644
--- a/gdb/testsuite/gdb.base/structs.exp
+++ b/gdb/testsuite/gdb.base/structs.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 1996-2024 Free Software Foundation, Inc.
+# Copyright 1996-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -56,7 +56,7 @@ proc start_structs_test { types } {
}
set binfile [standard_output_file ${testfile}]
- if { [prepare_for_testing "failed to prepare" $binfile $srcfile $flags] } {
+ if { [prepare_for_testing "failed to prepare" $testfile $srcfile $flags] } {
return -1
}
@@ -75,7 +75,7 @@ proc start_structs_test { types } {
get_debug_format
# Limit the slow $anychar_re{256} matching for better performance.
- if $first {
+ if {$first} {
set first 0
# Verify $anychar_re can match all the values of `char' type.
@@ -215,7 +215,7 @@ proc test_struct_calls { n } {
# Check that GDB can always extract a struct-return value from an
# inferior function call. Since GDB always knows the location of an
# inferior function call's return value these should never fail
-
+
# Implemented by calling the parameterless function "fun$N" and then
# examining the return value printed by GDB.
@@ -364,7 +364,7 @@ proc test_struct_returns { n } {
pass "${test}"
}
-re " = [any $n].*${gdb_prompt} $" {
- if $return_value_known {
+ if {$return_value_known} {
# This contradicts the above claim that GDB knew
# the location of the return value.
fail "${test}"
@@ -375,7 +375,7 @@ proc test_struct_returns { n } {
}
}
-re ".*${gdb_prompt} $" {
- if $return_value_unimplemented {
+ if {$return_value_unimplemented} {
# What a surprise. The architecture hasn't implemented
# return_value, and hence has to fail.
kfail "$test" gdb/1444
@@ -383,8 +383,8 @@ proc test_struct_returns { n } {
fail "$test"
}
}
- }
-
+ }
+
# Check that a "finish" works.
# This is almost but not quite the same as "call struct funcs".
@@ -425,7 +425,7 @@ proc test_struct_returns { n } {
set test "value foo<n> finished; ${tests}"
gdb_test_multiple "p/c" "${test}" {
-re "[foo ${n}]\[\r\n\]+${gdb_prompt} $" {
- if $finish_value_known {
+ if {$finish_value_known} {
pass "${test}"
} else {
# This contradicts the above claim that GDB didn't
@@ -435,7 +435,7 @@ proc test_struct_returns { n } {
}
-re "[zed ${n}]\[\r\n\]+${gdb_prompt} $" {
# The value didn't get found. This is "expected".
- if $finish_value_known {
+ if {$finish_value_known} {
# This contradicts the above claim that GDB did
# know the location of the return-value.
fail "${test}"
diff --git a/gdb/testsuite/gdb.base/structs2.exp b/gdb/testsuite/gdb.base/structs2.exp
index 938d931..f0e8342 100644
--- a/gdb/testsuite/gdb.base/structs2.exp
+++ b/gdb/testsuite/gdb.base/structs2.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
standard_testfile .c
-if { [prepare_for_testing "failed to prepare" $binfile $srcfile {debug}] } {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] } {
return -1
}
@@ -31,14 +31,14 @@ gdb_test "break param_reg" \
"Breakpoint .* at .*" \
"structs2 breakpoint set"
-if [test_compiler_info gcc-3-*] {
+if {[test_compiler_info gcc-3-*]} {
setup_xfail hppa*-* gcc/15860
}
gdb_test "continue" \
".*pr_char=120.*pr_uchar=130.*pr_short=32000.*pr_ushort=33000.*bkpt = 1.*" \
"structs2 continue1"
-if [test_compiler_info gcc-3-*] {
+if {[test_compiler_info gcc-3-*]} {
setup_xfail hppa*-* gcc/15860
}
gdb_test "continue" \
diff --git a/gdb/testsuite/gdb.base/structs3.c b/gdb/testsuite/gdb.base/structs3.c
index 7b6808f..2fd26d0 100644
--- a/gdb/testsuite/gdb.base/structs3.c
+++ b/gdb/testsuite/gdb.base/structs3.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/structs3.exp b/gdb/testsuite/gdb.base/structs3.exp
index 15ba8f3..22cda9d 100644
--- a/gdb/testsuite/gdb.base/structs3.exp
+++ b/gdb/testsuite/gdb.base/structs3.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" "structs3" "" {debug}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/style-interp-exec-mi.c b/gdb/testsuite/gdb.base/style-interp-exec-mi.c
index fb4ffc2..f2b8dba 100644
--- a/gdb/testsuite/gdb.base/style-interp-exec-mi.c
+++ b/gdb/testsuite/gdb.base/style-interp-exec-mi.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/style-interp-exec-mi.exp b/gdb/testsuite/gdb.base/style-interp-exec-mi.exp
index 6c704ba..3c738c3 100644
--- a/gdb/testsuite/gdb.base/style-interp-exec-mi.exp
+++ b/gdb/testsuite/gdb.base/style-interp-exec-mi.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/style-logging.exp b/gdb/testsuite/gdb.base/style-logging.exp
index d866d36..10b4636 100644
--- a/gdb/testsuite/gdb.base/style-logging.exp
+++ b/gdb/testsuite/gdb.base/style-logging.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/style.c b/gdb/testsuite/gdb.base/style.c
index e72c2ee..fb705eb 100644
--- a/gdb/testsuite/gdb.base/style.c
+++ b/gdb/testsuite/gdb.base/style.c
@@ -2,7 +2,7 @@
/* The leading newlines here are intentional, do not remove. They are used to
test that the source highlighter doesn't strip them. */
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index f63dedc..222f17e 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,6 +13,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+require {!is_remote host}
+
load_lib gdb-python.exp
# Test CLI output styling.
@@ -48,7 +50,7 @@ proc clean_restart_and_disable { prefix args } {
global currently_disabled_style
with_test_prefix "$prefix" {
- eval "clean_restart $args"
+ clean_restart {*}$args
if { $currently_disabled_style != "" } {
set st $currently_disabled_style
@@ -75,7 +77,7 @@ proc run_style_tests { } {
# Restart GDB with the correct TERM variable setting, this
# means that GDB will enable styling.
- clean_restart_and_disable "restart 1" ${binfile}
+ clean_restart_and_disable "restart 1" $::testfile
set readnow [readnow]
@@ -161,7 +163,7 @@ proc run_style_tests { } {
# - 4 leading spaces
# - argv string
# - closing parenthesis
- set line_len [expr 4 + $argv_len + 1]
+ set line_len [expr {4 + $argv_len + 1}]
if { $argv == "argv=0x0" && $width >= 27 } {
# Embedded target with no argv support.
@@ -323,12 +325,24 @@ proc run_style_tests { } {
gdb_test_no_output "set style version background 255"
gdb_test_no_output "set style version foreground #FED210"
gdb_test "show style version background" \
- "The \033\\\[38;2;254;210;16;48;5;255;22;27m.*\".*version.*\".*style.*\033\\\[m background color is: 255" \
+ "The \033\\\[38;2;254;210;16;48;5;255;22;23;24;27m.*\".*version.*\".*style.*\033\\\[m background color is: 255" \
"Version's 256-color background style"
gdb_test "show style version foreground" \
- "The \033\\\[38;2;254;210;16;48;5;255;22;27m.*\".*version.*\".*style.*\033\\\[m foreground color is: #FED210" \
+ "The \033\\\[38;2;254;210;16;48;5;255;22;23;24;27m.*\".*version.*\".*style.*\033\\\[m foreground color is: #FED210" \
"Version's TrueColor foreground style"
}
+
+ gdb_test_no_output "set host-charset UTF-8"
+ # Chosen since it will print an error.
+ gdb_test "maint translate-address" \
+ "❌️ requires argument.*" \
+ "emoji output"
+
+ gdb_test_no_output "set style error-prefix abcd:" \
+ "set the error prefix"
+ gdb_test "maint translate-address" \
+ "abcd:requires argument.*" \
+ "error prefix"
}
}
@@ -344,7 +358,7 @@ proc test_disable_disassembler_styling { } {
# Restart GDB with the correct TERM variable setting, this
# means that GDB will enable styling.
- clean_restart_and_disable "restart 3" $::binfile
+ clean_restart_and_disable "restart 3" $::testfile
set styled_hex [limited_style $::hex address]
set main [limited_style main function]
@@ -459,7 +473,7 @@ proc test_disassembler_error_handling { } {
# Restart GDB with the correct TERM variable setting, this
# means that GDB will enable styling.
- clean_restart_and_disable "restart 4" $::binfile
+ clean_restart_and_disable "restart 4" $::testfile
# Disable use of libopcodes for styling. As this function is
# only called when Python Pygments module is available, we
@@ -739,10 +753,293 @@ proc test_enable_styling_warning { } {
}
}
+# Run an 'apropos' command. Each line of output starts with a
+# non-default style (command style). Ensure that pagination triggers
+# during the 'apropos' output such that, at the point pagination kicks
+# in, a non-default style is in effect.
+#
+# Then, at the pagination prompt, quit the command.
+#
+# Next, run a command which switches to a different style, and then
+# back to the current style.
+#
+# At one point, a bug in the pagination code would leave the
+# non-default style from the 'apropos' command recorded as the current
+# style, such that the second command would switch back to the earlier
+# style.
+proc test_pagination_cmd_after_quit_styling {} {
+ with_ansi_styling_terminal {
+ clean_restart
+ }
+
+ # We're going to use 'apropos time'. Check that with a height of
+ # 12 lines, each line starts with a non-default style, and that we
+ # do see the pagination prompt. This means that there are more
+ # than 12 lines for this command.
+ with_test_prefix "validate apropos output" {
+ gdb_test_no_output "set height 12"
+
+ set saw_pagination_prompt false
+ gdb_test_multiple "apropos time" "" {
+ -re "^apropos time\r\n" {
+ exp_continue
+ }
+ -re "^\033\\\[39;49;1;23;24;27m\[^\r\n\]+\r\n" {
+ exp_continue
+ }
+ -re "^$::pagination_prompt$" {
+ set saw_pagination_prompt true
+ send_gdb "q\n"
+ exp_continue
+ }
+ -re "^q\r\n" {
+ exp_continue
+ }
+ -re "^Quit\r\n" {
+ exp_continue
+ }
+ -re "^$::gdb_prompt $" {
+ gdb_assert { $saw_pagination_prompt } $gdb_test_name
+ }
+ -re "^\[^\r\n\]+\r\n" {
+ exp_continue
+ }
+ }
+ }
+
+ # Now reduce the height to 10 and re-run 'apropos time'. Based on
+ # the previous check, we know that this is going to present the
+ # pagination prompt when a non-default style is in use.
+ gdb_test_no_output "set height 10"
+
+ set saw_pagination_prompt false
+ gdb_test_multiple "apropos time" "" {
+ -re "$::pagination_prompt" {
+ set saw_pagination_prompt true
+ send_gdb "q\n"
+ exp_continue
+ }
+ -re "\r\n$::gdb_prompt $" {
+ gdb_assert { $saw_pagination_prompt } $gdb_test_name
+ }
+ }
+
+ # The help output for this maintenance command switches to a
+ # different style, and then back to the default. If the
+ # pagination bug still exists, then this would switch back to the
+ # non-default style that was in use when pagination kicked in
+ # above.
+ gdb_test "maintenance time" \
+ "^\"\033\\\[39;49;1;23;24;27mmaintenance time\033\\\[m\" takes a numeric argument\\."
+}
+
+# Helper for test_pagination_prompt_styling. Return false if STR, a
+# line that appears immediately before a pagination prompt, matches
+# the pattern for needing a style reset at the end, but does not have
+# the style reset.
+#
+# In all other cases, return true. So lines that don't match the
+# known pattern for neededing a style reset will always return true,
+# as will lines that match the pattern, and do have the style reset.
+proc previous_line_is_ok { str } {
+
+ # Create a copy of STR with all the '\033' characters removed.
+ # Then compare string lengths to get a count of the '\033'
+ # charactes present in STR.
+ regsub -all "\033" $str {} stripped
+ set count [expr {[string length $str] - [string length $stripped]}]
+
+ # If STR switched styles, then it _must_ switch back again,
+ # otherwise the pagination prompt will be in the wrong style.
+ # This means that there _must_ be an even number of '\033'
+ # characters in STR. If there is not then we switched style, but
+ # failed to switch back.
+ if {$count % 2 != 0} {
+ return false
+ }
+
+ # 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 \033" $str] } {
+ return true
+ }
+
+ # This line did match the above pattern, so we know that a style
+ # reset _must_ occur at the end of the line. If it doesn't then
+ # this line is not OK.
+ if { ![regexp "\033\\\[m$" $str] } {
+ return false
+ }
+
+ # All tests passed, this line looks OK.
+ return true
+}
+
+# Test that the pagination prompt is displayed unstyled. This is done
+# by looking at the 'info files' output and selecting a width that
+# will mean we should get a pagination prompt part way through a
+# styled filename.
+#
+# Then, re-run 'info files' and check that for every pagination
+# prompt, the previous line disables styling as expected.
+proc test_pagination_prompt_styling {} {
+ with_ansi_styling_terminal {
+ clean_restart
+ gdb_load $::binfile
+ }
+
+ if {![runto_main]} {
+ return
+ }
+
+ # Set height so we actually get a pagination prompt.
+ gdb_test_no_output "set height 3"
+
+ # Scan the 'info files' output and set DESIRED_WIDTH such that it
+ # will trigger pagination part-way through a styled filename.
+ set desired_width 0
+ gdb_test_multiple "info files" "find good test width" {
+ -re "^info files\r\n" {
+ exp_continue
+ }
+
+ -re "^$::pagination_prompt$" {
+ send_gdb "\n"
+ exp_continue
+ }
+
+ -re "^$::gdb_prompt $" {
+ }
+
+ -re "^((\\s+$::hex - $::hex is \[^\r\n\]+ in )\[^\r\n\]+)\r\n" {
+ if { $desired_width == 0 } {
+ set full_line $expect_out(1,string)
+ set inner_line $expect_out(2,string)
+ set desired_width [expr [string length $inner_line] + ([string length $full_line] - [string length $inner_line]) / 2]
+ }
+ exp_continue
+ }
+
+ -re "^\[^\r\n\]*\r\n" {
+ exp_continue
+ }
+ }
+
+ if { $desired_width < [string length $::pagination_prompt_str] + 2 } {
+ # Avoid readline wrapping after printing the pagination prompt.
+ return
+ }
+
+ # Now setup the screen width.
+ gdb_test_no_output "set width $desired_width" \
+ "set width to desired width"
+
+ # Re-run 'info files'. Check that the content before any
+ # pagination prompt correctly disables styling.
+ set saw_bad_line false
+ set prev_line ""
+ gdb_test_multiple "info files" "check pagination prompt styling" {
+ -re "^info files\r\n" {
+ exp_continue
+ }
+
+ -re "^$::pagination_prompt$" {
+ if { ![previous_line_is_ok $prev_line] } {
+ set saw_bad_line true
+ }
+ send_gdb "\n"
+ exp_continue
+ }
+
+ -re "^(\[^\r\n\]+)$::pagination_prompt$" {
+ set prev_line $expect_out(1,string)
+ if { ![previous_line_is_ok $prev_line] } {
+ set saw_bad_line true
+ }
+ send_gdb "\n"
+ exp_continue
+ }
+
+ -re "^$::gdb_prompt $" {
+ gdb_assert { !$saw_bad_line } $gdb_test_name
+ }
+
+ -re "^(\[^\r\n\]*)\r\n" {
+ set prev_line $expect_out(1,string)
+ exp_continue
+ }
+ }
+}
+
+# Test that GDB can correctly restore the current style after a
+# pagination prompt.
+#
+# Set the logging file to a garbage string based on LENGTH (is
+# actually 2x LENGTH), then 'show logging file'. Press return at the
+# pagination prompt, and check that the reset of the filename is
+# styled correctly, and that GDB correctly switches back to the
+# default style once the logging file has finished.
+proc test_pagination_continue_styling_1 { length } {
+ with_ansi_styling_terminal {
+ clean_restart
+ gdb_load $::binfile
+ }
+
+ set filename [string repeat "ax" $length]
+
+ gdb_test_no_output "set logging file $filename"
+
+ gdb_test_no_output "set height 3"
+ gdb_test_no_output "set width 80"
+
+ set saw_bad_styling false
+ gdb_test_multiple "show logging file" "" {
+ -re "^show logging file\r\n" {
+ exp_continue
+ }
+
+ -re "^The current logfile is \"\033\\\[32;49;22;23;24;27m(?:ax)+\033\\\[m" {
+ exp_continue
+ }
+
+ -re "^\r\n\033\\\[32;49;22;23;24;27m(?:ax)+\033\\\[m(?=--)" {
+ exp_continue
+ }
+
+ -re "^\r\n\033\\\[32;49;22;23;24;27m(?:ax)+(?=--)" {
+ set saw_bad_styling true
+ exp_continue
+ }
+
+ -re "^\r\n\033\\\[32;49;22;23;24;27m(?:ax)+\033\\\[m\"\\.\r\n" {
+ exp_continue
+ }
+
+ -re "^$::gdb_prompt $" {
+ gdb_assert { !$saw_bad_styling } $gdb_test_name
+ }
+
+ -re "^$::pagination_prompt$$" {
+ send_gdb "\n"
+ exp_continue
+ }
+ }
+}
+
+# Wrapper around test_pagination_continue_styling_1, calls that
+# function with different lengths.
+proc test_pagination_continue_styling { } {
+ foreach_with_prefix length { 80 160 } {
+ test_pagination_continue_styling_1 $length
+ }
+}
+
# Check to see if the Python styling of disassembler output is
# expected or not, this styling requires Python support in GDB, and
# the Python pygments module to be available.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {[allow_python_tests] && [gdb_py_module_available "pygments"]} {
set python_disassembly_styling true
} else {
@@ -781,3 +1078,6 @@ test_colorsupport_truecolor
test_colorsupport_truecolor_only
test_enable_styling_warning
+test_pagination_cmd_after_quit_styling
+test_pagination_prompt_styling
+test_pagination_continue_styling
diff --git a/gdb/testsuite/gdb.base/subst.exp b/gdb/testsuite/gdb.base/subst.exp
index b1e352d..27c82c0 100644
--- a/gdb/testsuite/gdb.base/subst.exp
+++ b/gdb/testsuite/gdb.base/subst.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/sym-file-lib.c b/gdb/testsuite/gdb.base/sym-file-lib.c
index 9a4af81..c9ae329 100644
--- a/gdb/testsuite/gdb.base/sym-file-lib.c
+++ b/gdb/testsuite/gdb.base/sym-file-lib.c
@@ -1,4 +1,4 @@
-/* Copyright 2013-2024 Free Software Foundation, Inc.
+/* Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.base/sym-file-loader.c b/gdb/testsuite/gdb.base/sym-file-loader.c
index 1c70536..f782a37 100644
--- a/gdb/testsuite/gdb.base/sym-file-loader.c
+++ b/gdb/testsuite/gdb.base/sym-file-loader.c
@@ -1,4 +1,4 @@
-/* Copyright 2013-2024 Free Software Foundation, Inc.
+/* Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.base/sym-file-loader.h b/gdb/testsuite/gdb.base/sym-file-loader.h
index 69c7402..a626899 100644
--- a/gdb/testsuite/gdb.base/sym-file-loader.h
+++ b/gdb/testsuite/gdb.base/sym-file-loader.h
@@ -1,4 +1,4 @@
-/* Copyright 2013-2024 Free Software Foundation, Inc.
+/* Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.base/sym-file-main.c b/gdb/testsuite/gdb.base/sym-file-main.c
index 31b2da1..e941af8 100644
--- a/gdb/testsuite/gdb.base/sym-file-main.c
+++ b/gdb/testsuite/gdb.base/sym-file-main.c
@@ -1,4 +1,4 @@
-/* Copyright 2013-2024 Free Software Foundation, Inc.
+/* Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.base/sym-file.exp b/gdb/testsuite/gdb.base/sym-file.exp
index 17650cb..13febda 100644
--- a/gdb/testsuite/gdb.base/sym-file.exp
+++ b/gdb/testsuite/gdb.base/sym-file.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -61,7 +61,8 @@ if {[gdb_compile_shlib $libsrc $lib_so {debug}] != ""} {
return
}
-if {[prepare_for_testing "failed to prepare" $binfile "$srcfile $srcfile2" $exec_opts]} {
+if { [prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2" \
+ $exec_opts] } {
return
}
@@ -70,7 +71,8 @@ gdb_load_shlib ${lib_so}
proc do_test { remove_expr } {
global lib_basename lib_syms srcfile srcfile3
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.base/symbol-alias.c b/gdb/testsuite/gdb.base/symbol-alias.c
index 790ba39..8db973f 100644
--- a/gdb/testsuite/gdb.base/symbol-alias.c
+++ b/gdb/testsuite/gdb.base/symbol-alias.c
@@ -1,6 +1,6 @@
/* This test is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/symbol-alias.exp b/gdb/testsuite/gdb.base/symbol-alias.exp
index 30599c7..84ba82d 100644
--- a/gdb/testsuite/gdb.base/symbol-alias.exp
+++ b/gdb/testsuite/gdb.base/symbol-alias.exp
@@ -1,5 +1,5 @@
# Test for printing alias symbols.
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,8 +16,8 @@
standard_testfile symbol-alias.c symbol-alias2.c
# Clang versions prior to v15 do not emit debug info for aliases.
-set old_clang [expr [test_compiler_info {clang-1[0-4]-*-*}] \
- || [test_compiler_info {clang-[1-9]-*}]]
+set old_clang [expr {[test_compiler_info {clang-1[0-4]-*-*}] \
+ || [test_compiler_info {clang-[1-9]-*}]}]
if { [prepare_for_testing "failed to prepare" ${testfile} [list $srcfile $srcfile2]] } {
return -1
diff --git a/gdb/testsuite/gdb.base/symbol-alias2.c b/gdb/testsuite/gdb.base/symbol-alias2.c
index 09e2660..0da57dd 100644
--- a/gdb/testsuite/gdb.base/symbol-alias2.c
+++ b/gdb/testsuite/gdb.base/symbol-alias2.c
@@ -1,6 +1,6 @@
/* This test is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/symbol-without-target_section.c b/gdb/testsuite/gdb.base/symbol-without-target_section.c
index e99cc78..64e7e3e 100644
--- a/gdb/testsuite/gdb.base/symbol-without-target_section.c
+++ b/gdb/testsuite/gdb.base/symbol-without-target_section.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/symbol-without-target_section.exp b/gdb/testsuite/gdb.base/symbol-without-target_section.exp
index 56cbd18..cf4d262 100644
--- a/gdb/testsuite/gdb.base/symbol-without-target_section.exp
+++ b/gdb/testsuite/gdb.base/symbol-without-target_section.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/symfile-warn.c b/gdb/testsuite/gdb.base/symfile-warn.c
index aa148a9..ddcee2b 100644
--- a/gdb/testsuite/gdb.base/symfile-warn.c
+++ b/gdb/testsuite/gdb.base/symfile-warn.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/symfile-warn.exp b/gdb/testsuite/gdb.base/symfile-warn.exp
index b34de70..485c449 100644
--- a/gdb/testsuite/gdb.base/symfile-warn.exp
+++ b/gdb/testsuite/gdb.base/symfile-warn.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/symlink-sourcefile.c b/gdb/testsuite/gdb.base/symlink-sourcefile.c
index 55df002..0f46d42 100644
--- a/gdb/testsuite/gdb.base/symlink-sourcefile.c
+++ b/gdb/testsuite/gdb.base/symlink-sourcefile.c
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/symlink-sourcefile.exp b/gdb/testsuite/gdb.base/symlink-sourcefile.exp
index 1a02eec..cf1e9a8 100644
--- a/gdb/testsuite/gdb.base/symlink-sourcefile.exp
+++ b/gdb/testsuite/gdb.base/symlink-sourcefile.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/symtab-search-order-1.c b/gdb/testsuite/gdb.base/symtab-search-order-1.c
index fa0c4cf..2fc201f 100644
--- a/gdb/testsuite/gdb.base/symtab-search-order-1.c
+++ b/gdb/testsuite/gdb.base/symtab-search-order-1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/symtab-search-order-shlib-1.c b/gdb/testsuite/gdb.base/symtab-search-order-shlib-1.c
index 5f6ece5..955004a 100644
--- a/gdb/testsuite/gdb.base/symtab-search-order-shlib-1.c
+++ b/gdb/testsuite/gdb.base/symtab-search-order-shlib-1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/symtab-search-order.c b/gdb/testsuite/gdb.base/symtab-search-order.c
index 64f742b..96cb94a 100644
--- a/gdb/testsuite/gdb.base/symtab-search-order.c
+++ b/gdb/testsuite/gdb.base/symtab-search-order.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/symtab-search-order.exp b/gdb/testsuite/gdb.base/symtab-search-order.exp
index d34b0af..aca9ca1 100644
--- a/gdb/testsuite/gdb.base/symtab-search-order.exp
+++ b/gdb/testsuite/gdb.base/symtab-search-order.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,10 +33,11 @@ if { [gdb_compile_shlib $lib1src $lib1 $lib_opts] != ""
# Start with a fresh gdb.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
gdb_load_shlib $lib1
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/sysroot-debug-lookup.exp b/gdb/testsuite/gdb.base/sysroot-debug-lookup.exp
index 80cad95..74c1708 100644
--- a/gdb/testsuite/gdb.base/sysroot-debug-lookup.exp
+++ b/gdb/testsuite/gdb.base/sysroot-debug-lookup.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/template.c b/gdb/testsuite/gdb.base/template.c
index 002dcb8..371e20b 100644
--- a/gdb/testsuite/gdb.base/template.c
+++ b/gdb/testsuite/gdb.base/template.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/template.exp b/gdb/testsuite/gdb.base/template.exp
index 8a68a2f..09c3e3d 100644
--- a/gdb/testsuite/gdb.base/template.exp
+++ b/gdb/testsuite/gdb.base/template.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/term.c b/gdb/testsuite/gdb.base/term.c
index fd667d8..6f45b2d 100644
--- a/gdb/testsuite/gdb.base/term.c
+++ b/gdb/testsuite/gdb.base/term.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/term.exp b/gdb/testsuite/gdb.base/term.exp
index d113cee..76bc004 100644
--- a/gdb/testsuite/gdb.base/term.exp
+++ b/gdb/testsuite/gdb.base/term.exp
@@ -1,4 +1,4 @@
-# Copyright 1988-2024 Free Software Foundation, Inc.
+# Copyright 1988-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/testenv.c b/gdb/testsuite/gdb.base/testenv.c
index 5a98cba..7dc35fc 100644
--- a/gdb/testsuite/gdb.base/testenv.c
+++ b/gdb/testsuite/gdb.base/testenv.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/testenv.exp b/gdb/testsuite/gdb.base/testenv.exp
index 908918a..540a48f 100644
--- a/gdb/testsuite/gdb.base/testenv.exp
+++ b/gdb/testsuite/gdb.base/testenv.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ standard_testfile .c
# Compile binary
# and start with a fresh gdb
-if { [prepare_for_testing "failed to prepare" ${binfile} ${srcfile}] } {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
return -1
}
@@ -75,7 +75,7 @@ proc find_env {varname} {
}
if {[string match "$varname=*" $var]} {
- set from [expr [string first "=" $var] + 1]
+ set from [expr {[string first "=" $var] + 1}]
set to [string length $var]
return [string range $var $from $to]
}
@@ -90,11 +90,12 @@ proc find_env {varname} {
proc_with_prefix test_set_unset_env {} {
global binfile
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
# First test with no TEST_GDB_VAR.
with_test_prefix "test1" {
- if ![run_and_count_vars] {
+ if {![run_and_count_vars]} {
return
}
test_num_test_vars 0 "no TEST_GDB vars"
@@ -105,7 +106,7 @@ proc_with_prefix test_set_unset_env {} {
gdb_test_no_output "set env TEST_GDB_VAR1 test1" \
"set TEST_GDB_VAR1"
- if ![run_and_count_vars] {
+ if {![run_and_count_vars]} {
return
}
test_num_test_vars 1 "one TEST_GDB var"
@@ -116,7 +117,7 @@ proc_with_prefix test_set_unset_env {} {
gdb_test_no_output "set env TEST_GDB_VAR2 test2" \
"set TEST_GDB_VAR2"
- if ![run_and_count_vars] {
+ if {![run_and_count_vars]} {
return
}
@@ -129,7 +130,7 @@ proc_with_prefix test_set_unset_env {} {
gdb_test_no_output "unset env TEST_GDB_VAR1" \
"unset TEST_GDB_VAR1"
- if ![run_and_count_vars] {
+ if {![run_and_count_vars]} {
return
}
@@ -144,20 +145,21 @@ proc_with_prefix test_inherit_env_var {} {
# This test assumes that the build's environ (where dejagnu runs)
# is the same as the host's (where gdb runs) environ.
- if [is_remote host] {
+ if {[is_remote host]} {
return
}
save_vars {env(TEST_GDB_GLOBAL)} {
set env(TEST_GDB_GLOBAL) "Global environment value"
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
gdb_breakpoint $bp_line
# First test with only inherited TEST_GDB_GLOBAL.
with_test_prefix "test1" {
- if ![run_and_count_vars] {
+ if {![run_and_count_vars]} {
return
}
@@ -177,7 +179,7 @@ proc_with_prefix test_inherit_env_var {} {
gdb_test_no_output "unset env TEST_GDB_GLOBAL" \
"unset TEST_GDB_GLOBAL"
- if ![run_and_count_vars] {
+ if {![run_and_count_vars]} {
return
}
diff --git a/gdb/testsuite/gdb.base/thread-bp-multi-loc.c b/gdb/testsuite/gdb.base/thread-bp-multi-loc.c
index 5950b0f..881ff85 100644
--- a/gdb/testsuite/gdb.base/thread-bp-multi-loc.c
+++ b/gdb/testsuite/gdb.base/thread-bp-multi-loc.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/thread-bp-multi-loc.exp b/gdb/testsuite/gdb.base/thread-bp-multi-loc.exp
index bdb51bf..1f0b2a7 100644
--- a/gdb/testsuite/gdb.base/thread-bp-multi-loc.exp
+++ b/gdb/testsuite/gdb.base/thread-bp-multi-loc.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/timestamp.exp b/gdb/testsuite/gdb.base/timestamp.exp
index 4bcdcad..80ea66e 100644
--- a/gdb/testsuite/gdb.base/timestamp.exp
+++ b/gdb/testsuite/gdb.base/timestamp.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/tls-common.exp.tcl b/gdb/testsuite/gdb.base/tls-common.exp.tcl
new file mode 100644
index 0000000..a17409f
--- /dev/null
+++ b/gdb/testsuite/gdb.base/tls-common.exp.tcl
@@ -0,0 +1,50 @@
+# Copyright 2024-2025 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# Require statement, variables and procs used by tls-nothreads.exp,
+# tls-multiobj.exp, and tls-dlobj.exp.
+
+# The tests listed above are known to work for the targets listed on
+# the 'require' line, below.
+#
+# At the moment, only the Linux target is listed, but, ideally, these
+# tests should be run on other targets too. E.g, testing on FreeBSD
+# shows many failures which should be addressed in some fashion before
+# enabling it for that target.
+
+require {is_any_target "*-*-linux*"}
+
+# These are the targets which have support for internal TLS lookup:
+
+set internal_tls_linux_targets {"x86_64-*-linux*" "aarch64-*-linux*"
+ "riscv*-*-linux*" "powerpc64*-*-linux*"
+ "s390x*-*-linux*"}
+
+# The "maint set force-internal-tls-address-lookup" command is only
+# available for certain Linux architectures. Don't attempt to force
+# use of internal TLS support for architectures which don't support
+# it.
+
+if {[is_any_target {*}$internal_tls_linux_targets]} {
+ set internal_tls_iters { false true }
+} else {
+ set internal_tls_iters { false }
+}
+
+# Set up a kfail with message KFAIL_MSG when KFAIL_COND holds, then
+# issue gdb_test with command CMD and regular expression RE.
+
+proc gdb_test_with_kfail {cmd re kfail_cond kfail_msg} {
+ if {[uplevel 1 [list expr $kfail_cond]]} {
+ setup_kfail $kfail_msg *-*-*
+ }
+ gdb_test $cmd $re
+}
diff --git a/gdb/testsuite/gdb.base/tls-dlobj-lib.c b/gdb/testsuite/gdb.base/tls-dlobj-lib.c
new file mode 100644
index 0000000..e82a064
--- /dev/null
+++ b/gdb/testsuite/gdb.base/tls-dlobj-lib.c
@@ -0,0 +1,87 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2024-2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* This program needs to be compiled with preprocessor symbol set to
+ a small integer, e.g. "gcc -DN=1 ..." With N defined, the CONCAT2
+ and CONCAT3 macros will construct suitable names for the global
+ variables and functions. */
+
+#define CONCAT2(a,b) CONCAT2_(a,b)
+#define CONCAT2_(a,b) a ## b
+
+#define CONCAT3(a,b,c) CONCAT3_(a,b,c)
+#define CONCAT3_(a,b,c) a ## b ## c
+
+/* For N=1, this ends up being...
+ __thread int tls_lib1_tbss_1;
+ __thread int tls_lib1_tbss_2;
+ __thread int tls_lib1_tdata_1 = 196;
+ __thread int tls_lib1_tdata_2 = 197; */
+
+__thread int CONCAT3(tls_lib, N, _tbss_1);
+__thread int CONCAT3(tls_lib, N, _tbss_2);
+__thread int CONCAT3(tls_lib, N, _tdata_1) = CONCAT2(N, 96);
+__thread int CONCAT3(tls_lib, N, _tdata_2) = CONCAT2(N, 97);
+
+/* Substituting for N, define function:
+
+ int get_tls_libN_var (int which) . */
+
+int
+CONCAT3(get_tls_lib, N, _var) (int which)
+{
+ switch (which)
+ {
+ case 0:
+ return -1;
+ case 1:
+ return CONCAT3(tls_lib, N, _tbss_1);
+ case 2:
+ return CONCAT3(tls_lib, N, _tbss_2);
+ case 3:
+ return CONCAT3(tls_lib, N, _tdata_1);
+ case 4:
+ return CONCAT3(tls_lib, N, _tdata_2);
+ }
+ return -1;
+}
+
+/* Substituting for N, define function:
+
+ void set_tls_libN_var (int which, int val) . */
+
+void
+CONCAT3(set_tls_lib, N, _var) (int which, int val)
+{
+ switch (which)
+ {
+ case 0:
+ break;
+ case 1:
+ CONCAT3(tls_lib, N, _tbss_1) = val;
+ break;
+ case 2:
+ CONCAT3(tls_lib, N, _tbss_2) = val;
+ break;
+ case 3:
+ CONCAT3(tls_lib, N, _tdata_1) = val;
+ break;
+ case 4:
+ CONCAT3(tls_lib, N, _tdata_2) = val;
+ break;
+ }
+}
diff --git a/gdb/testsuite/gdb.base/tls-dlobj.c b/gdb/testsuite/gdb.base/tls-dlobj.c
new file mode 100644
index 0000000..a93f4a7
--- /dev/null
+++ b/gdb/testsuite/gdb.base/tls-dlobj.c
@@ -0,0 +1,311 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2024-2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <dlfcn.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+typedef void (*setter_ftype) (int which, int val);
+
+__thread int tls_main_tbss_1;
+__thread int tls_main_tbss_2;
+__thread int tls_main_tdata_1 = 96;
+__thread int tls_main_tdata_2 = 97;
+
+extern void set_tls_lib10_var (int which, int val);
+extern void set_tls_lib11_var (int which, int val);
+
+volatile int data;
+
+static void
+set_tls_main_var (int which, int val)
+{
+ switch (which)
+ {
+ case 1:
+ tls_main_tbss_1 = val;
+ break;
+ case 2:
+ tls_main_tbss_2 = val;
+ break;
+ case 3:
+ tls_main_tdata_1 = val;
+ break;
+ case 4:
+ tls_main_tdata_2 = val;
+ break;
+ }
+}
+
+void
+use_it (int a)
+{
+ data = a;
+}
+
+static void *
+load_dso (char *dso_name, int n, setter_ftype *setterp)
+{
+ char buf[80];
+ void *sym;
+ void *handle = dlopen (dso_name, RTLD_NOW | RTLD_GLOBAL);
+ if (handle == NULL)
+ {
+ fprintf (stderr, "dlopen of DSO '%s' failed: %s\n", dso_name, dlerror ());
+ exit (1);
+ }
+ sprintf (buf, "set_tls_lib%d_var", n);
+ sym = dlsym (handle, buf);
+ assert (sym != NULL);
+ *setterp = sym;
+
+ /* Some libc implementations (for some architectures) refuse to
+ initialize TLS data structures (specifically, the DTV) without
+ first calling dlsym on one of the TLS symbols. */
+ sprintf (buf, "tls_lib%d_tdata_1", n);
+ assert (dlsym (handle, buf) != NULL);
+
+ return handle;
+}
+
+int
+main (int argc, char **argv)
+{
+ int i, status;
+ setter_ftype s0, s1, s2, s3, s4, s10, s11;
+ void *h1 = load_dso (OBJ1, 1, &s1);
+ void *h2 = load_dso (OBJ2, 2, &s2);
+ void *h3 = load_dso (OBJ3, 3, &s3);
+ void *h4 = load_dso (OBJ4, 4, &s4);
+ s0 = set_tls_main_var;
+ s10 = set_tls_lib10_var;
+ s11 = set_tls_lib11_var;
+
+ use_it (0); /* main-breakpoint-1 */
+
+ /* Set TLS variables in main program and all libraries. */
+ for (i = 1; i <= 4; i++)
+ s0 (i, 10 + i);
+ for (i = 1; i <= 4; i++)
+ s1 (i, 110 + i);
+ for (i = 1; i <= 4; i++)
+ s2 (i, 210 + i);
+ for (i = 1; i <= 4; i++)
+ s3 (i, 310 + i);
+ for (i = 1; i <= 4; i++)
+ s4 (i, 410 + i);
+ for (i = 1; i <= 4; i++)
+ s10 (i, 1010 + i);
+ for (i = 1; i <= 4; i++)
+ s11 (i, 1110 + i);
+
+ use_it (0); /* main-breakpoint-2 */
+
+ /* Unload lib2 and lib3. */
+ status = dlclose (h2);
+ assert (status == 0);
+ status = dlclose (h3);
+ assert (status == 0);
+
+ /* Set TLS variables in main program and in libraries which are still
+ loaded. */
+ for (i = 1; i <= 4; i++)
+ s0 (i, 20 + i);
+ for (i = 1; i <= 4; i++)
+ s1 (i, 120 + i);
+ for (i = 1; i <= 4; i++)
+ s4 (i, 420 + i);
+ for (i = 1; i <= 4; i++)
+ s10 (i, 1020 + i);
+ for (i = 1; i <= 4; i++)
+ s11 (i, 1120 + i);
+
+ use_it (0); /* main-breakpoint-3 */
+
+ /* Load lib3. */
+ h3 = load_dso (OBJ3, 3, &s3);
+
+ /* Set TLS vars again; currently, only lib2 is not loaded. */
+ for (i = 1; i <= 4; i++)
+ s0 (i, 30 + i);
+ for (i = 1; i <= 4; i++)
+ s1 (i, 130 + i);
+ for (i = 1; i <= 4; i++)
+ s3 (i, 330 + i);
+ for (i = 1; i <= 4; i++)
+ s4 (i, 430 + i);
+ for (i = 1; i <= 4; i++)
+ s10 (i, 1030 + i);
+ for (i = 1; i <= 4; i++)
+ s11 (i, 1130 + i);
+
+ use_it (0); /* main-breakpoint-4 */
+
+ /* Unload lib1 and lib4; load lib2. */
+ status = dlclose (h1);
+ assert (status == 0);
+ status = dlclose (h4);
+ assert (status == 0);
+ h2 = load_dso (OBJ2, 2, &s2);
+
+ /* Set TLS vars; currently, lib2 and lib3 are loaded,
+ lib1 and lib4 are not. */
+ for (i = 1; i <= 4; i++)
+ s0 (i, 40 + i);
+ for (i = 1; i <= 4; i++)
+ s2 (i, 240 + i);
+ for (i = 1; i <= 4; i++)
+ s3 (i, 340 + i);
+ for (i = 1; i <= 4; i++)
+ s10 (i, 1040 + i);
+ for (i = 1; i <= 4; i++)
+ s11 (i, 1140 + i);
+
+ use_it (0); /* main-breakpoint-5 */
+
+ /* Load lib4 and lib1. Unload lib2. */
+ h4 = load_dso (OBJ4, 4, &s4);
+ h1 = load_dso (OBJ1, 1, &s1);
+ status = dlclose (h2);
+ assert (status == 0);
+
+ /* Set TLS vars; currently, lib1, lib3, and lib4 are loaded;
+ lib2 is not loaded. */
+ for (i = 1; i <= 4; i++)
+ s0 (i, 50 + i);
+ for (i = 1; i <= 4; i++)
+ s1 (i, 150 + i);
+ for (i = 1; i <= 4; i++)
+ s3 (i, 350 + i);
+ for (i = 1; i <= 4; i++)
+ s4 (i, 450 + i);
+ for (i = 1; i <= 4; i++)
+ s10 (i, 1050 + i);
+ for (i = 1; i <= 4; i++)
+ s11 (i, 1150 + i);
+
+ use_it (0); /* main-breakpoint-6 */
+
+ /* Load lib2, unload lib1, lib3, and lib4; then load lib3 again. */
+ h2 = load_dso (OBJ2, 2, &s2);
+ status = dlclose (h1);
+ assert (status == 0);
+ status = dlclose (h3);
+ assert (status == 0);
+ status = dlclose (h4);
+ assert (status == 0);
+ h3 = load_dso (OBJ3, 3, &s3);
+
+ /* Set TLS vars; currently, lib2 and lib3 are loaded;
+ lib1 and lib4 are not loaded. */
+ for (i = 1; i <= 4; i++)
+ s0 (i, 60 + i);
+ for (i = 1; i <= 4; i++)
+ s2 (i, 260 + i);
+ for (i = 1; i <= 4; i++)
+ s3 (i, 360 + i);
+ for (i = 1; i <= 4; i++)
+ s10 (i, 1060 + i);
+ for (i = 1; i <= 4; i++)
+ s11 (i, 1160 + i);
+
+ use_it (0); /* main-breakpoint-7 */
+
+ /* Unload lib3 and lib2, then (re)load lib4, lib3, lib2, and lib1,
+ in that order. */
+ status = dlclose (h3);
+ assert (status == 0);
+ status = dlclose (h2);
+ assert (status == 0);
+ h4 = load_dso (OBJ4, 4, &s4);
+ h3 = load_dso (OBJ3, 3, &s3);
+ h2 = load_dso (OBJ2, 2, &s2);
+ h1 = load_dso (OBJ1, 1, &s1);
+
+ /* Set TLS vars; currently, lib1, lib2, lib3, and lib4 are all
+ loaded. */
+ for (i = 1; i <= 4; i++)
+ s0 (i, 70 + i);
+ for (i = 1; i <= 4; i++)
+ s1 (i, 170 + i);
+ for (i = 1; i <= 4; i++)
+ s2 (i, 270 + i);
+ for (i = 1; i <= 4; i++)
+ s3 (i, 370 + i);
+ for (i = 1; i <= 4; i++)
+ s4 (i, 470 + i);
+ for (i = 1; i <= 4; i++)
+ s10 (i, 1070 + i);
+ for (i = 1; i <= 4; i++)
+ s11 (i, 1170 + i);
+
+ use_it (0); /* main-breakpoint-8 */
+
+ /* Unload lib3, lib1, and lib4. */
+ status = dlclose (h3);
+ assert (status == 0);
+ status = dlclose (h1);
+ assert (status == 0);
+ status = dlclose (h4);
+ assert (status == 0);
+
+ /* Set TLS vars; currently, lib2 is loaded; lib1, lib3, and lib4 are
+ not. */
+ for (i = 1; i <= 4; i++)
+ s0 (i, 80 + i);
+ for (i = 1; i <= 4; i++)
+ s2 (i, 280 + i);
+ for (i = 1; i <= 4; i++)
+ s10 (i, 1080 + i);
+ for (i = 1; i <= 4; i++)
+ s11 (i, 1180 + i);
+
+ use_it (0); /* main-breakpoint-9 */
+
+ /* Load lib3, unload lib2, load lib4. */
+ h3 = load_dso (OBJ3, 3, &s3);
+ status = dlclose (h2);
+ assert (status == 0);
+ h4 = load_dso (OBJ4, 4, &s4);
+
+ /* Set TLS vars; currently, lib3 and lib4 are loaded; lib1 and lib2
+ are not. */
+ for (i = 1; i <= 4; i++)
+ s0 (i, 90 + i);
+ for (i = 1; i <= 4; i++)
+ s3 (i, 390 + i);
+ for (i = 1; i <= 4; i++)
+ s4 (i, 490 + i);
+ for (i = 1; i <= 4; i++)
+ s10 (i, 1090 + i);
+ for (i = 1; i <= 4; i++)
+ s11 (i, 1190 + i);
+
+ use_it (0); /* main-breakpoint-10 */
+
+ /* Attempt to keep variables in the main program from being optimized
+ away. */
+ use_it (tls_main_tbss_1);
+ use_it (tls_main_tbss_2);
+ use_it (tls_main_tdata_1);
+ use_it (tls_main_tdata_2);
+
+ use_it (100); /* main-breakpoint-last */
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/tls-dlobj.exp b/gdb/testsuite/gdb.base/tls-dlobj.exp
new file mode 100644
index 0000000..9b70799
--- /dev/null
+++ b/gdb/testsuite/gdb.base/tls-dlobj.exp
@@ -0,0 +1,380 @@
+# Copyright 2024-2025 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# Test that the GDB-internal TLS link map to module id mapping code
+# works correctly when debugging a program which is linked against
+# shared objects and which also loads and unloads other shared objects
+# in different orders. For targets which have GDB-internal TLS
+# support, it'll check both GDB-internal TLS support as well as that
+# provided by a helper library such as libthread_db.
+
+source $srcdir/$subdir/tls-common.exp.tcl
+
+require allow_shlib_tests
+
+standard_testfile
+
+set libsrc "${srcdir}/${subdir}/${testfile}-lib.c"
+
+# These will be dlopen'd:
+set lib1obj [standard_output_file "${testfile}1-lib.so"]
+set lib2obj [standard_output_file "${testfile}2-lib.so"]
+set lib3obj [standard_output_file "${testfile}3-lib.so"]
+set lib4obj [standard_output_file "${testfile}4-lib.so"]
+
+# These will be dynamically linked with the main program:
+set lib10obj [standard_output_file "${testfile}10-lib.so"]
+set lib11obj [standard_output_file "${testfile}11-lib.so"]
+
+# Due to problems with some versions of glibc, we expect some tests to
+# fail due to TLS storage not being allocated/initialized. Test
+# command CMD using regular expression RE, and use XFAIL instead of
+# FAIL when the relevant RE is matched and COND is true when evaluated
+# in the upper level.
+
+proc gdb_test_with_xfail { cmd re cond} {
+ gdb_test_multiple $cmd $cmd {
+ -re -wrap $re {
+ pass $gdb_test_name
+ }
+ -re -wrap "The inferior has not yet allocated storage for thread-local variables.*" {
+ if {[ uplevel 1 [list expr $cond]]} {
+ xfail $gdb_test_name
+ } else {
+ fail $gdb_test_name
+ }
+ }
+ }
+}
+
+proc do_tests {force_internal_tls} {
+ clean_restart
+ gdb_load $::binfile
+ if {![runto_main]} {
+ return
+ }
+
+ if {$force_internal_tls} {
+ gdb_test_no_output "maint set force-internal-tls-address-lookup on"
+ }
+
+ gdb_breakpoint [gdb_get_line_number "main-breakpoint-1"]
+ gdb_continue_to_breakpoint "main-breakpoint-1"
+
+ with_test_prefix "before assignments" {
+ gdb_test "print tls_main_tbss_1" ".* = 0"
+ gdb_test "print tls_main_tbss_2" ".* = 0"
+ gdb_test "print tls_main_tdata_1" ".* = 96"
+ gdb_test "print tls_main_tdata_2" ".* = 97"
+
+ # For these tests, where we're attempting to access TLS vars
+ # in a dlopen'd library, but before assignment to any of the
+ # vars, so it could happen that storage hasn't been allocated
+ # yet. But it might also work. (When testing against MUSL,
+ # things just work; GLIBC ends to produce the TLS error.) So
+ # accept either the right answer or a TLS error message.
+
+ set tlserr "The inferior has not yet allocated storage for thread-local variables.*"
+ foreach n {1 2 3 4} {
+ gdb_test "print tls_lib${n}_tbss_1" \
+ "0|${tlserr}"
+ gdb_test "print tls_lib${n}_tbss_2" \
+ "0|${tlserr}"
+ gdb_test "print tls_lib${n}_tdata_1" \
+ "96|${tlserr}"
+ gdb_test "print tls_lib${n}_tdata_2" \
+ "97|${tlserr}"
+ }
+ foreach n {10 11} {
+ gdb_test "print tls_lib${n}_tbss_1" ".* = 0"
+ gdb_test "print tls_lib${n}_tbss_2" ".* = 0"
+ gdb_test "print tls_lib${n}_tdata_1" ".* = ${n}96"
+ gdb_test "print tls_lib${n}_tdata_2" ".* = ${n}97"
+ }
+ }
+
+ gdb_breakpoint [gdb_get_line_number "main-breakpoint-2"]
+ gdb_continue_to_breakpoint "main-breakpoint-2"
+
+ with_test_prefix "at main-breakpoint-2" {
+ gdb_test "print tls_main_tbss_1" ".* = 11"
+ gdb_test "print tls_main_tbss_2" ".* = 12"
+ gdb_test "print tls_main_tdata_1" ".* = 13"
+ gdb_test "print tls_main_tdata_2" ".* = 14"
+
+ foreach n {1 2 3 4 10 11} {
+ gdb_test "print tls_lib${n}_tbss_1" ".* = ${n}11"
+ gdb_test "print tls_lib${n}_tbss_2" ".* = ${n}12"
+ gdb_test "print tls_lib${n}_tdata_1" ".* = ${n}13"
+ gdb_test "print tls_lib${n}_tdata_2" ".* = ${n}14"
+ }
+ }
+
+ gdb_breakpoint [gdb_get_line_number "main-breakpoint-3"]
+ gdb_continue_to_breakpoint "main-breakpoint-3"
+
+ # At this point lib2 and lib3 have been unloaded. Also, TLS vars
+ # in remaining libraries have been changed.
+
+ with_test_prefix "at main-breakpoint-3" {
+ gdb_test "print tls_main_tbss_1" ".* = 21"
+ gdb_test "print tls_main_tbss_2" ".* = 22"
+ gdb_test "print tls_main_tdata_1" ".* = 23"
+ gdb_test "print tls_main_tdata_2" ".* = 24"
+
+ foreach n {1 4 10 11} {
+ gdb_test "print tls_lib${n}_tbss_1" ".* = ${n}21"
+ gdb_test "print tls_lib${n}_tbss_2" ".* = ${n}22"
+ gdb_test "print tls_lib${n}_tdata_1" ".* = ${n}23"
+ gdb_test "print tls_lib${n}_tdata_2" ".* = ${n}24"
+ }
+ }
+
+ gdb_breakpoint [gdb_get_line_number "main-breakpoint-4"]
+ gdb_continue_to_breakpoint "main-breakpoint-4"
+
+ # lib3 has been loaded again; lib2 is the only one not loaded.
+
+ with_test_prefix "at main-breakpoint-4" {
+ gdb_test "print tls_main_tbss_1" ".* = 31"
+ gdb_test "print tls_main_tbss_2" ".* = 32"
+ gdb_test "print tls_main_tdata_1" ".* = 33"
+ gdb_test "print tls_main_tdata_2" ".* = 34"
+
+ set cond { $n == 3 }
+ foreach n {1 3 4 10 11} {
+ gdb_test_with_xfail "print tls_lib${n}_tbss_1" ".* = ${n}31" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tbss_2" ".* = ${n}32" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tdata_1" ".* = ${n}33" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tdata_2" ".* = ${n}34" $cond
+ }
+ }
+
+ gdb_breakpoint [gdb_get_line_number "main-breakpoint-5"]
+ gdb_continue_to_breakpoint "main-breakpoint-5"
+
+ # lib2 and lib3 are loaded; lib1 and lib4 are not.
+
+ with_test_prefix "at main-breakpoint-5" {
+ gdb_test "print tls_main_tbss_1" ".* = 41"
+ gdb_test "print tls_main_tbss_2" ".* = 42"
+ gdb_test "print tls_main_tdata_1" ".* = 43"
+ gdb_test "print tls_main_tdata_2" ".* = 44"
+
+ set cond { $n == 2 || $n == 3 }
+ foreach n {2 3 10 11} {
+ gdb_test_with_xfail "print tls_lib${n}_tbss_1" ".* = ${n}41" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tbss_2" ".* = ${n}42" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tdata_1" ".* = ${n}43" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tdata_2" ".* = ${n}44" $cond
+ }
+ }
+
+ gdb_breakpoint [gdb_get_line_number "main-breakpoint-6"]
+ gdb_continue_to_breakpoint "main-breakpoint-6"
+
+ # lib1, lib3 and lib4 are loaded; lib2 is not loaded.
+
+ with_test_prefix "at main-breakpoint-6" {
+ gdb_test "print tls_main_tbss_1" ".* = 51"
+ gdb_test "print tls_main_tbss_2" ".* = 52"
+ gdb_test "print tls_main_tdata_1" ".* = 53"
+ gdb_test "print tls_main_tdata_2" ".* = 54"
+
+ set cond { $n == 1 || $n == 3 || $n == 4}
+ foreach n {1 3 4 10 11} {
+ gdb_test_with_xfail "print tls_lib${n}_tbss_1" ".* = ${n}51" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tbss_2" ".* = ${n}52" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tdata_1" ".* = ${n}53" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tdata_2" ".* = ${n}54" $cond
+ }
+ }
+
+ gdb_breakpoint [gdb_get_line_number "main-breakpoint-7"]
+ gdb_continue_to_breakpoint "main-breakpoint-7"
+
+ # lib2 and lib3 are loaded; lib1 and lib4 are not.
+
+ with_test_prefix "at main-breakpoint-7" {
+ gdb_test "print tls_main_tbss_1" ".* = 61"
+ gdb_test "print tls_main_tbss_2" ".* = 62"
+ gdb_test "print tls_main_tdata_1" ".* = 63"
+ gdb_test "print tls_main_tdata_2" ".* = 64"
+
+ set cond { $n == 2 || $n == 3 }
+ foreach n {2 3 10 11} {
+ gdb_test_with_xfail "print tls_lib${n}_tbss_1" ".* = ${n}61" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tbss_2" ".* = ${n}62" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tdata_1" ".* = ${n}63" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tdata_2" ".* = ${n}64" $cond
+ }
+ }
+
+ gdb_breakpoint [gdb_get_line_number "main-breakpoint-8"]
+ gdb_continue_to_breakpoint "main-breakpoint-8"
+
+ # lib1, lib2, lib3, and lib4 are all loaded.
+
+ with_test_prefix "at main-breakpoint-8" {
+ gdb_test "print tls_main_tbss_1" ".* = 71"
+ gdb_test "print tls_main_tbss_2" ".* = 72"
+ gdb_test "print tls_main_tdata_1" ".* = 73"
+ gdb_test "print tls_main_tdata_2" ".* = 74"
+
+ foreach n {1 2 3 4 10 11} {
+ gdb_test "print tls_lib${n}_tbss_1" ".* = ${n}71"
+ gdb_test "print tls_lib${n}_tbss_2" ".* = ${n}72"
+ gdb_test "print tls_lib${n}_tdata_1" ".* = ${n}73"
+ gdb_test "print tls_lib${n}_tdata_2" ".* = ${n}74"
+ }
+ }
+
+ gdb_breakpoint [gdb_get_line_number "main-breakpoint-9"]
+ gdb_continue_to_breakpoint "main-breakpoint-9"
+
+ # lib2 is loaded; lib1, lib3, and lib4 are not.
+
+ with_test_prefix "at main-breakpoint-9" {
+ gdb_test "print tls_main_tbss_1" ".* = 81"
+ gdb_test "print tls_main_tbss_2" ".* = 82"
+ gdb_test "print tls_main_tdata_1" ".* = 83"
+ gdb_test "print tls_main_tdata_2" ".* = 84"
+
+ foreach n {2 10 11} {
+ gdb_test "print tls_lib${n}_tbss_1" ".* = ${n}81"
+ gdb_test "print tls_lib${n}_tbss_2" ".* = ${n}82"
+ gdb_test "print tls_lib${n}_tdata_1" ".* = ${n}83"
+ gdb_test "print tls_lib${n}_tdata_2" ".* = ${n}84"
+ }
+ }
+
+ gdb_breakpoint [gdb_get_line_number "main-breakpoint-10"]
+ gdb_continue_to_breakpoint "main-breakpoint-10"
+
+ # lib3 and lib4 are loaded; lib1 and lib2 are not.
+
+ with_test_prefix "at main-breakpoint-10" {
+ gdb_test "print tls_main_tbss_1" ".* = 91"
+ gdb_test "print tls_main_tbss_2" ".* = 92"
+ gdb_test "print tls_main_tdata_1" ".* = 93"
+ gdb_test "print tls_main_tdata_2" ".* = 94"
+
+ set cond { $n == 3 || $n == 4 }
+ foreach n {3 4 10 11} {
+ gdb_test_with_xfail "print tls_lib${n}_tbss_1" ".* = ${n}91" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tbss_2" ".* = ${n}92" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tdata_1" ".* = ${n}93" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tdata_2" ".* = ${n}94" $cond
+ }
+ }
+
+ # gdb_interact
+
+ set corefile ${::binfile}.core
+ set core_supported 0
+ if { ![is_remote host] } {
+ set core_supported [gdb_gcore_cmd $corefile "save corefile"]
+ }
+
+ # Finish test early if no core file was made.
+ if {!$core_supported} {
+ return
+ }
+
+ clean_restart
+ gdb_load $::binfile
+
+ set core_loaded [gdb_core_cmd $corefile "load corefile"]
+ if { $core_loaded == -1 } {
+ return
+ }
+
+ with_test_prefix "core file" {
+ if {$force_internal_tls} {
+ gdb_test_no_output "maint set force-internal-tls-address-lookup on"
+ }
+
+ gdb_test "print tls_main_tbss_1" ".* = 91"
+ gdb_test "print tls_main_tbss_2" ".* = 92"
+ gdb_test "print tls_main_tdata_1" ".* = 93"
+ gdb_test "print tls_main_tdata_2" ".* = 94"
+
+ set cond { $n == 3 || $n == 4 }
+ foreach n {3 4 10 11} {
+ gdb_test_with_xfail "print tls_lib${n}_tbss_1" ".* = ${n}91" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tbss_2" ".* = ${n}92" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tdata_1" ".* = ${n}93" $cond
+ gdb_test_with_xfail "print tls_lib${n}_tdata_2" ".* = ${n}94" $cond
+ }
+ }
+}
+
+# Build shared objects for dlopen:
+if { [gdb_compile_shlib $libsrc $lib1obj [list debug additional_flags=-DN=1]] != "" } {
+ untested "failed to compile shared object"
+ return -1
+}
+if { [gdb_compile_shlib $libsrc $lib2obj [list debug additional_flags=-DN=2]] != "" } {
+ untested "failed to compile shared object"
+ return -1
+}
+if { [gdb_compile_shlib $libsrc $lib3obj [list debug additional_flags=-DN=3]] != "" } {
+ untested "failed to compile shared object"
+ return -1
+}
+if { [gdb_compile_shlib $libsrc $lib4obj [list debug additional_flags=-DN=4]] != "" } {
+ untested "failed to compile shared object"
+ return -1
+}
+
+# Build shared objects to link against main program:
+if { [gdb_compile_shlib $libsrc $lib10obj [list debug additional_flags=-DN=10]] != "" } {
+ untested "failed to compile shared object"
+ return -1
+}
+if { [gdb_compile_shlib $libsrc $lib11obj [list debug additional_flags=-DN=11]] != "" } {
+ untested "failed to compile shared object"
+ return -1
+}
+
+# Use gdb_compile_pthreads to build and link the main program for
+# testing. It's also possible to run the tests using plain old
+# gdb_compile, but this adds complexity with setting up additional
+# KFAILs. (When run using GLIBC versions earlier than 2.34, a program
+# that's not dynamically linked against libpthread will lack a working
+# libthread_db, and, therefore, won't be able to access thread local
+# storage without GDB-internal TLS support. Additional complications
+# arise from when testing on x86_64 with -m32, which tends to work
+# okay on GLIBC 2.34 and newer, but not older versions. It gets messy
+# to properly sort out all of these cases.)
+#
+# This test was originally written to do it both ways, i.e. with both
+# both gdb_compile and gdb_compile_pthreads, but the point of this
+# test is to check that the link map address to TLS module id mapping
+# code works correctly in programs which use lots of dlopen and
+# dlclose calls in various orders - and that can be done using just
+# gdb_compile_pthreads.
+
+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
+ [list debug shlib_load \
+ shlib=${lib10obj} \
+ shlib=${lib11obj} \
+ additional_flags=-DOBJ1=\"${lib1obj}\" \
+ additional_flags=-DOBJ2=\"${lib2obj}\" \
+ additional_flags=-DOBJ3=\"${lib3obj}\" \
+ additional_flags=-DOBJ4=\"${lib4obj}\" \
+ ]] != "" } {
+ untested "failed to compile"
+} else {
+ foreach_with_prefix force_internal_tls $internal_tls_iters {
+ do_tests $force_internal_tls
+ }
+}
diff --git a/gdb/testsuite/gdb.base/tls-multiobj.c b/gdb/testsuite/gdb.base/tls-multiobj.c
new file mode 100644
index 0000000..dd4aadb
--- /dev/null
+++ b/gdb/testsuite/gdb.base/tls-multiobj.c
@@ -0,0 +1,89 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2024-2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+__thread int tls_main_tbss_1;
+__thread int tls_main_tbss_2;
+__thread int tls_main_tdata_1 = 96;
+__thread int tls_main_tdata_2 = 97;
+
+extern __thread int tls_lib1_tbss_1;
+extern __thread int tls_lib1_tbss_2;
+extern __thread int tls_lib1_tdata_1;
+extern __thread int tls_lib1_tdata_2;
+
+extern __thread int tls_lib2_tbss_1;
+extern __thread int tls_lib2_tbss_2;
+extern __thread int tls_lib2_tdata_1;
+extern __thread int tls_lib2_tdata_2;
+
+extern __thread int tls_lib3_tbss_1;
+extern __thread int tls_lib3_tbss_2;
+extern __thread int tls_lib3_tdata_1;
+extern __thread int tls_lib3_tdata_2;
+
+extern void lib1_func ();
+extern void lib2_func ();
+extern void lib3_func ();
+
+volatile int data;
+
+void
+use_it (int a)
+{
+ data = a;
+}
+
+int
+main (int argc, char **argv)
+{
+ use_it (-1);
+
+ tls_main_tbss_1 = 51; /* main-breakpoint-1 */
+ tls_main_tbss_2 = 52;
+ tls_main_tdata_1 = 53;
+ tls_main_tdata_2 = 54;
+
+ tls_lib1_tbss_1 = 151;
+ tls_lib1_tbss_2 = 152;
+ tls_lib1_tdata_1 = 153;
+ tls_lib1_tdata_2 = 154;
+
+ tls_lib2_tbss_1 = 251;
+ tls_lib2_tbss_2 = 252;
+ tls_lib2_tdata_1 = 253;
+ tls_lib2_tdata_2 = 254;
+
+ tls_lib3_tbss_1 = 351;
+ tls_lib3_tbss_2 = 352;
+ tls_lib3_tdata_1 = 353;
+ tls_lib3_tdata_2 = 354;
+
+ lib1_func ();
+ lib2_func ();
+ lib3_func ();
+
+ /* Attempt to keep variables in the main program from being optimized
+ away. */
+ use_it (tls_main_tbss_1);
+ use_it (tls_main_tbss_2);
+ use_it (tls_main_tdata_1);
+ use_it (tls_main_tdata_2);
+
+ use_it (100); /* main-breakpoint-2 */
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/tls-multiobj.exp b/gdb/testsuite/gdb.base/tls-multiobj.exp
new file mode 100644
index 0000000..14bbfc9
--- /dev/null
+++ b/gdb/testsuite/gdb.base/tls-multiobj.exp
@@ -0,0 +1,232 @@
+# Copyright 2024-2025 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# Using different compilation/linking scenarios, attempt to access
+# thread-local variables in a non-threaded program using multiple
+# shared objects.
+
+source $srcdir/$subdir/tls-common.exp.tcl
+
+standard_testfile
+
+set lib1src "${srcdir}/${subdir}/${testfile}1.c"
+set lib2src "${srcdir}/${subdir}/${testfile}2.c"
+set lib3src "${srcdir}/${subdir}/${testfile}3.c"
+
+set lib1obj [standard_output_file "${testfile}1-lib.so"]
+set lib2obj [standard_output_file "${testfile}2-lib.so"]
+set lib3obj [standard_output_file "${testfile}3-lib.so"]
+
+proc do_tests {force_internal_tls {do_kfail_tls_access 0}} {
+ clean_restart
+ gdb_load $::binfile
+ if {![runto_main]} {
+ return
+ }
+
+ if {$force_internal_tls} {
+ gdb_test_no_output "maint set force-internal-tls-address-lookup on"
+ }
+
+ if { $do_kfail_tls_access && [istarget "*-*-linux*"] } {
+ # Turn off do_kfail_tls_access when libthread_db is loaded.
+ # This can happen for the default case when testing x86_64
+ # w/ -m32 using glibc versions 2.34 or newer.
+ gdb_test_multiple "maint check libthread-db" "Check for loaded libthread_db" {
+ -re -wrap "libthread_db integrity checks passed." {
+ set do_kfail_tls_access 0
+ pass $gdb_test_name
+ }
+ -re -wrap "No libthread_db loaded" {
+ pass $gdb_test_name
+ }
+ }
+ # Also turn off do_kfail_tls_access when connected to a
+ # gdbserver and we observe that accessing a TLS variable
+ # works.
+ if {[target_is_gdbserver]} {
+ gdb_test_multiple "print tls_main_tbss_1" \
+ "Check TLS accessibility when connected to a gdbserver" {
+ -re -wrap "= 0" {
+ set do_kfail_tls_access 0
+ pass $gdb_test_name
+ }
+ -re -wrap "Remote target failed to process qGetTLSAddr request" {
+ pass $gdb_test_name
+ }
+ }
+ }
+ }
+
+ gdb_breakpoint [gdb_get_line_number "main-breakpoint-1"]
+ gdb_continue_to_breakpoint "main-breakpoint-1"
+
+ set t $do_kfail_tls_access
+ set m "tls not available"
+ with_test_prefix "before assignments" {
+ gdb_test_with_kfail "print tls_main_tbss_1" ".* = 0" $t $m
+ gdb_test_with_kfail "print tls_main_tbss_2" ".* = 0" $t $m
+ gdb_test_with_kfail "print tls_main_tdata_1" ".* = 96" $t $m
+ gdb_test_with_kfail "print tls_main_tdata_2" ".* = 97" $t $m
+
+ gdb_test_with_kfail "print tls_lib1_tbss_1" ".* = 0" $t $m
+ gdb_test_with_kfail "print tls_lib1_tbss_2" ".* = 0" $t $m
+ gdb_test_with_kfail "print tls_lib1_tdata_1" ".* = 196" $t $m
+ gdb_test_with_kfail "print tls_lib1_tdata_2" ".* = 197" $t $m
+
+ gdb_test_with_kfail "print tls_lib2_tbss_1" ".* = 0" $t $m
+ gdb_test_with_kfail "print tls_lib2_tbss_2" ".* = 0" $t $m
+ gdb_test_with_kfail "print tls_lib2_tdata_1" ".* = 296" $t $m
+ gdb_test_with_kfail "print tls_lib2_tdata_2" ".* = 297" $t $m
+
+ gdb_test_with_kfail "print tls_lib3_tbss_1" ".* = 0" $t $m
+ gdb_test_with_kfail "print tls_lib3_tbss_2" ".* = 0" $t $m
+ gdb_test_with_kfail "print tls_lib3_tdata_1" ".* = 396" $t $m
+ gdb_test_with_kfail "print tls_lib3_tdata_2" ".* = 397" $t $m
+ }
+
+ gdb_breakpoint [gdb_get_line_number "main-breakpoint-2"]
+ gdb_continue_to_breakpoint "main-breakpoint-2"
+
+ with_test_prefix "after assignments" {
+ gdb_test_with_kfail "print tls_main_tbss_1" ".* = 51" $t $m
+ gdb_test_with_kfail "print tls_main_tbss_2" ".* = 52" $t $m
+ gdb_test_with_kfail "print tls_main_tdata_1" ".* = 53" $t $m
+ gdb_test_with_kfail "print tls_main_tdata_2" ".* = 54" $t $m
+
+ gdb_test_with_kfail "print tls_lib1_tbss_1" ".* = 151" $t $m
+ gdb_test_with_kfail "print tls_lib1_tbss_2" ".* = 152" $t $m
+ gdb_test_with_kfail "print tls_lib1_tdata_1" ".* = 153" $t $m
+ gdb_test_with_kfail "print tls_lib1_tdata_2" ".* = 154" $t $m
+
+ gdb_test_with_kfail "print tls_lib2_tbss_1" ".* = 251" $t $m
+ gdb_test_with_kfail "print tls_lib2_tbss_2" ".* = 252" $t $m
+ gdb_test_with_kfail "print tls_lib2_tdata_1" ".* = 253" $t $m
+ gdb_test_with_kfail "print tls_lib2_tdata_2" ".* = 254" $t $m
+
+ gdb_test_with_kfail "print tls_lib3_tbss_1" ".* = 351" $t $m
+ gdb_test_with_kfail "print tls_lib3_tbss_2" ".* = 352" $t $m
+ gdb_test_with_kfail "print tls_lib3_tdata_1" ".* = 353" $t $m
+ gdb_test_with_kfail "print tls_lib3_tdata_2" ".* = 354" $t $m
+ }
+
+ set corefile ${::binfile}.core
+ set core_supported 0
+ if { ![is_remote host] } {
+ set core_supported [gdb_gcore_cmd $corefile "save corefile"]
+ }
+
+ # Finish test early if no core file was made.
+ if {!$core_supported} {
+ return
+ }
+
+ clean_restart
+ gdb_load $::binfile
+
+ set core_loaded [gdb_core_cmd $corefile "load corefile"]
+ if { $core_loaded == -1 } {
+ return
+ }
+
+ with_test_prefix "core file" {
+ if {$force_internal_tls} {
+ gdb_test_no_output "maint set force-internal-tls-address-lookup on"
+ }
+
+ gdb_test_with_kfail "print tls_main_tbss_1" ".* = 51" $t $m
+ gdb_test_with_kfail "print tls_main_tbss_2" ".* = 52" $t $m
+ gdb_test_with_kfail "print tls_main_tdata_1" ".* = 53" $t $m
+ gdb_test_with_kfail "print tls_main_tdata_2" ".* = 54" $t $m
+
+ gdb_test_with_kfail "print tls_lib1_tbss_1" ".* = 151" $t $m
+ gdb_test_with_kfail "print tls_lib1_tbss_2" ".* = 152" $t $m
+ gdb_test_with_kfail "print tls_lib1_tdata_1" ".* = 153" $t $m
+ gdb_test_with_kfail "print tls_lib1_tdata_2" ".* = 154" $t $m
+
+ gdb_test_with_kfail "print tls_lib2_tbss_1" ".* = 251" $t $m
+ gdb_test_with_kfail "print tls_lib2_tbss_2" ".* = 252" $t $m
+ gdb_test_with_kfail "print tls_lib2_tdata_1" ".* = 253" $t $m
+ gdb_test_with_kfail "print tls_lib2_tdata_2" ".* = 254" $t $m
+
+ gdb_test_with_kfail "print tls_lib3_tbss_1" ".* = 351" $t $m
+ gdb_test_with_kfail "print tls_lib3_tbss_2" ".* = 352" $t $m
+ gdb_test_with_kfail "print tls_lib3_tdata_1" ".* = 353" $t $m
+ gdb_test_with_kfail "print tls_lib3_tdata_2" ".* = 354" $t $m
+ }
+}
+
+if { [gdb_compile_shlib $lib1src $lib1obj {debug}] != "" } {
+ untested "failed to compile shared object"
+ return -1
+}
+if { [gdb_compile_shlib $lib2src $lib2obj {debug}] != "" } {
+ untested "failed to compile shared object"
+ return -1
+}
+if { [gdb_compile_shlib $lib3src $lib3obj {debug}] != "" } {
+ untested "failed to compile shared object"
+ return -1
+}
+
+# Certain linux target architectures implement support for internal
+# TLS lookup which is used when thread stratum support (via
+# libthread_db) is missing or when the linux-only GDB maintenance
+# setting 'force-internal-tls-address-lookup' is 'on'. Thus for some
+# of the testing scenarios, such as statically linked executables,
+# this internal support will be used. Set 'do_kfail_tls_access' to 1
+# for those architectures which don't implement internal tls support.
+if {[istarget *-*-linux*]
+ && ![is_any_target {*}$internal_tls_linux_targets]} {
+ set do_kfail_tls_access 1
+} elseif {[istarget *-*-linux*] && [is_x86_like_target]} {
+ # This covers the case of x86_64 with -m32:
+ set do_kfail_tls_access 1
+} else {
+ set do_kfail_tls_access 0
+}
+
+set binprefix $binfile
+
+with_test_prefix "default" {
+ set binfile $binprefix-default
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
+ [list debug shlib=${lib1obj} \
+ shlib=${lib2obj} \
+ shlib=${lib3obj}]] != "" } {
+ untested "failed to compile"
+ } else {
+ foreach_with_prefix force_internal_tls $internal_tls_iters {
+ # Depending on glibc version, it might not be appropriate
+ # for do_kfail_tls_access to be set here. That will be
+ # handled in 'do_tests', disabling it if necessary.
+ #
+ # Specifically, glibc versions 2.34 and later have the
+ # thread library (and libthread_db availability) in
+ # programs not linked against libpthread.so
+ do_tests $force_internal_tls $do_kfail_tls_access
+ }
+ }
+}
+
+with_test_prefix "pthreads" {
+ set binfile $binprefix-pthreads
+ if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
+ [list debug shlib=${lib1obj} \
+ shlib=${lib2obj} \
+ shlib=${lib3obj}]] != "" } {
+ untested "failed to compile"
+ } else {
+ foreach_with_prefix force_internal_tls $internal_tls_iters {
+ do_tests $force_internal_tls
+ }
+ }
+}
diff --git a/gdb/testsuite/gdb.base/tls-multiobj1.c b/gdb/testsuite/gdb.base/tls-multiobj1.c
new file mode 100644
index 0000000..6207173
--- /dev/null
+++ b/gdb/testsuite/gdb.base/tls-multiobj1.c
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2024-2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+__thread int tls_lib1_tbss_1;
+__thread int tls_lib1_tbss_2;
+__thread int tls_lib1_tdata_1 = 196;
+__thread int tls_lib1_tdata_2 = 197;
+
+void
+lib1_func ()
+{
+}
diff --git a/gdb/testsuite/gdb.base/tls-multiobj2.c b/gdb/testsuite/gdb.base/tls-multiobj2.c
new file mode 100644
index 0000000..9ff8b67
--- /dev/null
+++ b/gdb/testsuite/gdb.base/tls-multiobj2.c
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2024-2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+__thread int tls_lib2_tbss_1;
+__thread int tls_lib2_tbss_2;
+__thread int tls_lib2_tdata_1 = 296;
+__thread int tls_lib2_tdata_2 = 297;
+
+void
+lib2_func ()
+{
+}
diff --git a/gdb/testsuite/gdb.base/tls-multiobj3.c b/gdb/testsuite/gdb.base/tls-multiobj3.c
new file mode 100644
index 0000000..3594eba0
--- /dev/null
+++ b/gdb/testsuite/gdb.base/tls-multiobj3.c
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2024-2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+__thread int tls_lib3_tbss_1;
+__thread int tls_lib3_tbss_2;
+__thread int tls_lib3_tdata_1 = 396;
+__thread int tls_lib3_tdata_2 = 397;
+
+void
+lib3_func ()
+{
+}
diff --git a/gdb/testsuite/gdb.base/tls-nothreads.c b/gdb/testsuite/gdb.base/tls-nothreads.c
new file mode 100644
index 0000000..cac20f8
--- /dev/null
+++ b/gdb/testsuite/gdb.base/tls-nothreads.c
@@ -0,0 +1,57 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2024-2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+__thread int tls_tbss_1;
+__thread int tls_tbss_2;
+__thread int tls_tbss_3;
+
+__thread int tls_tdata_1 = 21;
+__thread int tls_tdata_2 = 22;
+__thread int tls_tdata_3 = 23;
+
+volatile int data;
+
+void
+use_it (int a)
+{
+ data = a;
+}
+
+int
+main (int argc, char **argv)
+{
+ use_it (-1);
+
+ tls_tbss_1 = 24; /* main-breakpoint-1 */
+ tls_tbss_2 = 25;
+ tls_tbss_3 = 26;
+
+ tls_tdata_1 = 42;
+ tls_tdata_2 = 43;
+ tls_tdata_3 = 44;
+
+ use_it (tls_tbss_1);
+ use_it (tls_tbss_2);
+ use_it (tls_tbss_3);
+ use_it (tls_tdata_1);
+ use_it (tls_tdata_2);
+ use_it (tls_tdata_3);
+
+ use_it (100); /* main-breakpoint-2 */
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/tls-nothreads.exp b/gdb/testsuite/gdb.base/tls-nothreads.exp
new file mode 100644
index 0000000..fe3ce80
--- /dev/null
+++ b/gdb/testsuite/gdb.base/tls-nothreads.exp
@@ -0,0 +1,251 @@
+# Copyright 2024-2025 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# Using different compilation/linking scenarios, attempt to access
+# thread-local variables in a non-threaded program. Also test that
+# GDB internal TLS lookup works correctly.
+
+source $srcdir/$subdir/tls-common.exp.tcl
+
+standard_testfile
+
+proc do_tests {force_internal_tls {do_kfail_tls_access 0}} {
+ clean_restart
+ gdb_load $::binfile
+ if {![runto_main]} {
+ return
+ }
+
+ if {$force_internal_tls} {
+ gdb_test_no_output "maint set force-internal-tls-address-lookup on"
+ }
+
+ if { $do_kfail_tls_access && [istarget "*-*-linux*"] } {
+ # Turn off do_kfail_tls_access when libthread_db is loaded.
+ # This can happen for the default case when testing x86_64
+ # w/ -m32 using glibc versions 2.34 or newer.
+ gdb_test_multiple "maint check libthread-db" "Check for loaded libthread_db" {
+ -re -wrap "libthread_db integrity checks passed." {
+ set do_kfail_tls_access 0
+ pass $gdb_test_name
+ }
+ -re -wrap "No libthread_db loaded" {
+ pass $gdb_test_name
+ }
+ }
+ # Also turn off do_kfail_tls_access when connected to a
+ # gdbserver and we observe that accessing a TLS variable
+ # works.
+ if {[target_is_gdbserver]} {
+ gdb_test_multiple "print tls_tbss_1" "Check TLS accessibility when connected to a gdbserver" {
+ -re -wrap "= 0" {
+ set do_kfail_tls_access 0
+ pass $gdb_test_name
+ }
+ -re -wrap "Remote target failed to process qGetTLSAddr request" {
+ pass $gdb_test_name
+ }
+ }
+ }
+ }
+
+ gdb_breakpoint [gdb_get_line_number "main-breakpoint-1"]
+ gdb_continue_to_breakpoint "main-breakpoint-1"
+
+ set t $do_kfail_tls_access
+ set m "tls not available"
+ with_test_prefix "before assignments" {
+ gdb_test_with_kfail "print tls_tbss_1" ".* = 0" $t $m
+ gdb_test_with_kfail "print tls_tbss_2" ".* = 0" $t $m
+ gdb_test_with_kfail "print tls_tbss_3" ".* = 0" $t $m
+
+ gdb_test_with_kfail "print tls_tdata_1" ".* = 21" $t $m
+ gdb_test_with_kfail "print tls_tdata_2" ".* = 22" $t $m
+ gdb_test_with_kfail "print tls_tdata_3" ".* = 23" $t $m
+ }
+
+ gdb_breakpoint [gdb_get_line_number "main-breakpoint-2"]
+ gdb_continue_to_breakpoint "main-breakpoint-2"
+
+ with_test_prefix "after assignments" {
+ gdb_test_with_kfail "print tls_tbss_1" ".* = 24" $t $m
+ gdb_test_with_kfail "print tls_tbss_2" ".* = 25" $t $m
+ gdb_test_with_kfail "print tls_tbss_3" ".* = 26" $t $m
+
+ gdb_test_with_kfail "print tls_tdata_1" ".* = 42" $t $m
+ gdb_test_with_kfail "print tls_tdata_2" ".* = 43" $t $m
+ gdb_test_with_kfail "print tls_tdata_3" ".* = 44" $t $m
+ }
+
+ # Make a core file now, but save testing using it until the end
+ # in case core files are not supported.
+ set corefile ${::binfile}.core
+ set core_supported 0
+ if { ![is_remote host] } {
+ set core_supported [gdb_gcore_cmd $corefile "save corefile"]
+ }
+
+ # Now continue to end and see what happens when attempting to
+ # access a TLS variable when the program is no longer running.
+ gdb_continue_to_end
+ with_test_prefix "after exit" {
+ gdb_test "print tls_tbss_1" \
+ "Cannot (?:read|find address of TLS symbol) `tls_tbss_1' without registers"
+ }
+
+ with_test_prefix "stripped" {
+ set binfile_stripped "${::binfile}.stripped"
+ set objcopy [gdb_find_objcopy]
+ set cmd "$objcopy --strip-debug ${::binfile} $binfile_stripped"
+ if {![catch {exec {*}$cmd} cmd_output]} {
+ clean_restart
+ gdb_load $binfile_stripped
+ if {![runto_main]} {
+ return
+ }
+
+ if {$force_internal_tls} {
+ gdb_test_no_output "maint set force-internal-tls-address-lookup on"
+ }
+
+ # While there are no debug (e.g. DWARF) symbols, there
+ # are minimal symbols, so we should be able to place a
+ # breakpoint in use_it and continue to it. Continuing
+ # twice should put us past the assignments, at which point
+ # we can see if the TLS variables are still accessible.
+ gdb_test "break use_it" "Breakpoint 2 at $::hex"
+ gdb_test "continue" "Breakpoint 2, $::hex in use_it.*"
+ gdb_test "continue" "Breakpoint 2, $::hex in use_it.*" "continue 2"
+
+ # Note that a cast has been added in order to avoid the
+ # "...has unknown type; cast it to its declared type"
+ # problem.
+ gdb_test_with_kfail "print (int) tls_tbss_1" ".* = 24" $t $m
+ gdb_test_with_kfail "print (int) tls_tbss_2" ".* = 25" $t $m
+ gdb_test_with_kfail "print (int) tls_tbss_3" ".* = 26" $t $m
+
+ gdb_test_with_kfail "print (int) tls_tdata_1" ".* = 42" $t $m
+ gdb_test_with_kfail "print (int) tls_tdata_2" ".* = 43" $t $m
+ gdb_test_with_kfail "print (int) tls_tdata_3" ".* = 44" $t $m
+
+ # Get rid of the "use_it" breakpoint
+ gdb_test_no_output "del 2"
+
+ # Continue to program exit
+ gdb_continue_to_end
+
+ # TLS variables should not be accessible after program exit
+ # (This case initially caused GDB to crash during development
+ # of GDB-internal TLS lookup support.)
+ with_test_prefix "after exit" {
+ gdb_test "print (int) tls_tbss_1" \
+ "Cannot find address of TLS symbol `tls_tbss_1' without registers"
+ }
+ }
+ }
+
+ # Finish test early if no core file was made.
+ if {!$core_supported} {
+ return
+ }
+
+ clean_restart
+ gdb_load $::binfile
+
+ set core_loaded [gdb_core_cmd $corefile "load corefile"]
+ if { $core_loaded == -1 } {
+ return
+ }
+
+ with_test_prefix "core file" {
+ if {$force_internal_tls} {
+ gdb_test_no_output "maint set force-internal-tls-address-lookup on"
+ }
+
+ gdb_test_with_kfail "print tls_tbss_1" ".* = 24" $t $m
+ gdb_test_with_kfail "print tls_tbss_2" ".* = 25" $t $m
+ gdb_test_with_kfail "print tls_tbss_3" ".* = 26" $t $m
+
+ gdb_test_with_kfail "print tls_tdata_1" ".* = 42" $t $m
+ gdb_test_with_kfail "print tls_tdata_2" ".* = 43" $t $m
+ gdb_test_with_kfail "print tls_tdata_3" ".* = 44" $t $m
+ }
+}
+
+# Certain linux target architectures implement support for internal
+# TLS lookup which is used when thread stratum support (via
+# libthread_db) is missing or when the linux-only GDB maintenance
+# setting 'force-internal-tls-address-lookup' is 'on'. Thus for some
+# of the testing scenarios, such as statically linked executables,
+# this internal support will be used. Set 'do_kfail_tls_access' to 1
+# for those architectures which don't implement internal TLS support.
+if {[istarget *-*-linux*]
+ && ![is_any_target {*}$internal_tls_linux_targets]} {
+ set do_kfail_tls_access 1
+} elseif {[istarget *-*-linux*] && [is_x86_like_target]} {
+ # This covers the case of x86_64 with -m32:
+ set do_kfail_tls_access 1
+} else {
+ set do_kfail_tls_access 0
+}
+
+set binprefix $binfile
+
+with_test_prefix "default" {
+ set binfile $binprefix-default
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "failed to compile"
+ } else {
+ foreach_with_prefix force_internal_tls $internal_tls_iters {
+ # Depending on glibc version, it might not be appropriate
+ # for do_kfail_tls_access to be set here. That will be
+ # handled in 'do_tests', disabling it if necessary.
+ #
+ # Specifically, glibc versions 2.34 and later have the
+ # thread library (and libthread_db availability) in
+ # programs not linked against libpthread.so
+ do_tests $force_internal_tls $do_kfail_tls_access
+ }
+ }
+}
+
+with_test_prefix "static" {
+ set binfile $binprefix-static
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug "additional_flags=-static"}] != "" } {
+ untested "failed to compile"
+ } else {
+ foreach_with_prefix force_internal_tls $internal_tls_iters {
+ do_tests $force_internal_tls $do_kfail_tls_access
+ }
+ }
+}
+
+with_test_prefix "pthreads" {
+ set binfile $binprefix-pthreads
+ if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "failed to compile"
+ } else {
+ foreach_with_prefix force_internal_tls $internal_tls_iters {
+ do_tests $force_internal_tls
+ }
+ }
+}
+
+with_test_prefix "pthreads-static" {
+ set binfile $binprefix-pthreads-static
+ if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug "additional_flags=-static"}] != "" } {
+ untested "failed to compile"
+ } else {
+ foreach_with_prefix force_internal_tls $internal_tls_iters {
+ do_tests $force_internal_tls $do_kfail_tls_access
+ }
+ }
+}
diff --git a/gdb/testsuite/gdb.base/trace-commands.exp b/gdb/testsuite/gdb.base/trace-commands.exp
index 1cabb20..d6732a3 100644
--- a/gdb/testsuite/gdb.base/trace-commands.exp
+++ b/gdb/testsuite/gdb.base/trace-commands.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/traced-thread.c b/gdb/testsuite/gdb.base/traced-thread.c
index c06b0b2..d056d50 100644
--- a/gdb/testsuite/gdb.base/traced-thread.c
+++ b/gdb/testsuite/gdb.base/traced-thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/traced-thread.exp b/gdb/testsuite/gdb.base/traced-thread.exp
index 9b5c67a..b27549d 100644
--- a/gdb/testsuite/gdb.base/traced-thread.exp
+++ b/gdb/testsuite/gdb.base/traced-thread.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/twice.exp b/gdb/testsuite/gdb.base/twice.exp
index 46093fd..83d271d 100644
--- a/gdb/testsuite/gdb.base/twice.exp
+++ b/gdb/testsuite/gdb.base/twice.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,8 @@ if { [gdb_compile $local_srcfile "${binfile}" executable $options] != "" } {
# Start with a fresh gdb.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
if {[runto_main]} {
# Test that GDB can still detect whether we have line numbers
@@ -47,4 +48,4 @@ if {[runto_main]} {
gdb_test "step" "nothing \\(\\) at.*"
}
-remote_exec build "rm -f twice.c"
+remote_exec build "rm -f twice.c"
diff --git a/gdb/testsuite/gdb.base/type-opaque-lib.c b/gdb/testsuite/gdb.base/type-opaque-lib.c
index 70626cb..a3c363d 100644
--- a/gdb/testsuite/gdb.base/type-opaque-lib.c
+++ b/gdb/testsuite/gdb.base/type-opaque-lib.c
@@ -1,6 +1,6 @@
/* Test resolving of an opaque type from the loaded shared library.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/type-opaque-main.c b/gdb/testsuite/gdb.base/type-opaque-main.c
index 4b67d14..375ed70 100644
--- a/gdb/testsuite/gdb.base/type-opaque-main.c
+++ b/gdb/testsuite/gdb.base/type-opaque-main.c
@@ -1,6 +1,6 @@
/* Test resolving of an opaque type from the loaded shared library.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/type-opaque.exp b/gdb/testsuite/gdb.base/type-opaque.exp
index 01ed4a0..f5d8582 100644
--- a/gdb/testsuite/gdb.base/type-opaque.exp
+++ b/gdb/testsuite/gdb.base/type-opaque.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,8 @@ if { [gdb_compile_shlib $libsrc $libobj {debug}] != ""
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_load_shlib ${libobj}
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.base/ui-redirect.exp b/gdb/testsuite/gdb.base/ui-redirect.exp
index ed10916..c758697 100644
--- a/gdb/testsuite/gdb.base/ui-redirect.exp
+++ b/gdb/testsuite/gdb.base/ui-redirect.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ if { [prepare_for_testing "failed to prepare" ui-redirect start.c] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/unload.c b/gdb/testsuite/gdb.base/unload.c
index 7173de8..28b744d 100644
--- a/gdb/testsuite/gdb.base/unload.c
+++ b/gdb/testsuite/gdb.base/unload.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/unload.exp b/gdb/testsuite/gdb.base/unload.exp
index 8f129c7..b2d848d 100644
--- a/gdb/testsuite/gdb.base/unload.exp
+++ b/gdb/testsuite/gdb.base/unload.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -50,7 +50,8 @@ if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
gdb_load_shlib $lib_sl
gdb_load_shlib $lib_sl2
diff --git a/gdb/testsuite/gdb.base/unloadshr.c b/gdb/testsuite/gdb.base/unloadshr.c
index 708e9bc..e48de39 100644
--- a/gdb/testsuite/gdb.base/unloadshr.c
+++ b/gdb/testsuite/gdb.base/unloadshr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/unloadshr2.c b/gdb/testsuite/gdb.base/unloadshr2.c
index f35a196..1bc6abd 100644
--- a/gdb/testsuite/gdb.base/unloadshr2.c
+++ b/gdb/testsuite/gdb.base/unloadshr2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/until-nodebug.exp b/gdb/testsuite/gdb.base/until-nodebug.exp
index 6445a6c..bd327a10 100644
--- a/gdb/testsuite/gdb.base/until-nodebug.exp
+++ b/gdb/testsuite/gdb.base/until-nodebug.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile nodebug]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.base/until-trailing-insns.c b/gdb/testsuite/gdb.base/until-trailing-insns.c
index 4ddcf39..3f6d416 100644
--- a/gdb/testsuite/gdb.base/until-trailing-insns.c
+++ b/gdb/testsuite/gdb.base/until-trailing-insns.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/until-trailing-insns.exp b/gdb/testsuite/gdb.base/until-trailing-insns.exp
index ffd5df8..4456812 100644
--- a/gdb/testsuite/gdb.base/until-trailing-insns.exp
+++ b/gdb/testsuite/gdb.base/until-trailing-insns.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -100,16 +100,16 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name until-trailing-isns.c}
- {stmt_list $L DW_FORM_sec_offset}
- {low_pc 0 addr}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name until-trailing-isns.c
+ DW_AT_stmt_list $L DW_FORM_sec_offset
+ DW_AT_low_pc 0 addr
} {
subprogram {
- {external 1 flag}
- {name main}
- {low_pc $main_start addr}
- {high_pc $main_len DW_FORM_data4}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc $main_len DW_FORM_data4
}
}
}
@@ -160,7 +160,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/until.exp b/gdb/testsuite/gdb.base/until.exp
index 046ccdb..a4e626e 100644
--- a/gdb/testsuite/gdb.base/until.exp
+++ b/gdb/testsuite/gdb.base/until.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64-2.exp b/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64-2.exp
index b187b56..0e307d3 100644
--- a/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64-2.exp
+++ b/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ lappend srcfile_flags nopie
set ldflags $srcfile_flags
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# Make sure that we use .eh_frame info, by generating it
# using -fasynchronous-unwind-tables.
if { [gdb_can_simple_compile fasynchronous-unwind-tables \
diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64.exp b/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64.exp
index 0a2cd95..08944f9 100644
--- a/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64.exp
+++ b/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ lappend srcfile_flags nopie
set srcfile2_flags $srcfile_flags
set ldflags $srcfile_flags
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
standard_testfile unwind-on-each-insn.c unwind-on-each-insn-foo.c
# When updating the .s file, use these flags to generate the file:
#lappend srcfile2_flags additional_flags=-save-temps
diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn-foo.c b/gdb/testsuite/gdb.base/unwind-on-each-insn-foo.c
index 5591eea..5798a69 100644
--- a/gdb/testsuite/gdb.base/unwind-on-each-insn-foo.c
+++ b/gdb/testsuite/gdb.base/unwind-on-each-insn-foo.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn-i386.exp b/gdb/testsuite/gdb.base/unwind-on-each-insn-i386.exp
index 7d00a1e..0285c54 100644
--- a/gdb/testsuite/gdb.base/unwind-on-each-insn-i386.exp
+++ b/gdb/testsuite/gdb.base/unwind-on-each-insn-i386.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ lappend srcfile_flags nopie
set srcfile2_flags $srcfile_flags
set ldflags $srcfile_flags
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
standard_testfile unwind-on-each-insn.c unwind-on-each-insn-foo.c
# When updating the .s file, use these flags to generate the file:
#lappend srcfile2_flags additional_flags=-save-temps
diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn.c b/gdb/testsuite/gdb.base/unwind-on-each-insn.c
index dd1d367..16fca03 100644
--- a/gdb/testsuite/gdb.base/unwind-on-each-insn.c
+++ b/gdb/testsuite/gdb.base/unwind-on-each-insn.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn.exp b/gdb/testsuite/gdb.base/unwind-on-each-insn.exp
index 5f1a045..b826fa9 100644
--- a/gdb/testsuite/gdb.base/unwind-on-each-insn.exp
+++ b/gdb/testsuite/gdb.base/unwind-on-each-insn.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn.exp.tcl b/gdb/testsuite/gdb.base/unwind-on-each-insn.exp.tcl
index ceedfea..9318d59 100644
--- a/gdb/testsuite/gdb.base/unwind-on-each-insn.exp.tcl
+++ b/gdb/testsuite/gdb.base/unwind-on-each-insn.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/unwindonsignal.c b/gdb/testsuite/gdb.base/unwindonsignal.c
index 4de1bde..3addb44 100644
--- a/gdb/testsuite/gdb.base/unwindonsignal.c
+++ b/gdb/testsuite/gdb.base/unwindonsignal.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/unwindonsignal.exp b/gdb/testsuite/gdb.base/unwindonsignal.exp
index 3179355..2d402fe 100644
--- a/gdb/testsuite/gdb.base/unwindonsignal.exp
+++ b/gdb/testsuite/gdb.base/unwindonsignal.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/user-namespace-attach.c b/gdb/testsuite/gdb.base/user-namespace-attach.c
new file mode 100644
index 0000000..684ce1c
--- /dev/null
+++ b/gdb/testsuite/gdb.base/user-namespace-attach.c
@@ -0,0 +1,35 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+
+volatile int spin_p = 1;
+
+int
+main ()
+{
+ alarm (60);
+
+ printf ("pid = %lld\n", ((long long) getpid ()));
+
+ while (spin_p)
+ sleep (1);
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/user-namespace-attach.exp b/gdb/testsuite/gdb.base/user-namespace-attach.exp
new file mode 100644
index 0000000..741093c
--- /dev/null
+++ b/gdb/testsuite/gdb.base/user-namespace-attach.exp
@@ -0,0 +1,148 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that GDB can attach to a process started using 'unshare'. The
+# inferior is started in a separate mnt namespace.
+
+require can_spawn_for_attach
+
+standard_testfile
+
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile] == -1} {
+ return
+}
+
+# This test relies (at least in some parts) on the sysroot being
+# 'target:'. Grab the current sysroot now so we can skip those tests
+# if the board file has changed the sysroot.
+set sysroot ""
+set test "show sysroot"
+gdb_test_multiple $test $test {
+ -re -wrap "The current system root is \"(.*)\"\\." {
+ set sysroot $expect_out(1,string)
+ }
+}
+
+# Start a process using 'unshare FLAGS', then attach to the process
+# from GDB. Check that the attach worked as expected.
+proc run_test { flags } {
+
+ # If FLAGS contains '--mount' then a separate mnt namespace will
+ # be created, in which case the executable will have been read
+ # from the 'target:'. Otherwise, the executable will have been
+ # read from the local filesystem, and there will be no prefix.
+ #
+ # Of course, this only applies if the sysroot is 'target:', some
+ # boards change this, so skip these tests on those boards.
+ if { [lsearch -exact [split $flags " "] "--mount"] != -1 } {
+ if { $::sysroot ne "target:" } {
+ return
+ }
+
+ set prefix "target:"
+ } else {
+ set prefix ""
+ }
+
+ set unshare_cmd "unshare $flags"
+
+ # Run '/bin/true' using UNSHARE_CMD. If the flags in UNSHARE_CMD
+ # aren't supported then this will fail, this means we shouldn't
+ # spawn the command with our test executable and try attaching.
+ #
+ # This will also fail if /bin/true isn't present, or doesn't work
+ # as we expect. But this should be fine for many targets.
+ set res [remote_exec target "$unshare_cmd /bin/true"]
+ if { [lindex $res 0] != 0 } {
+ unsupported "unshare flags not supported"
+ return
+ }
+
+ set inferior_spawn_id \
+ [spawn_wait_for_attach [list "$unshare_cmd $::binfile"]]
+ if { $inferior_spawn_id == -1 } {
+ unsupported "failed to spawn for attach"
+ return
+ }
+
+ set inferior_pid [spawn_id_get_pid $inferior_spawn_id]
+
+ clean_restart
+
+ set saw_bad_warning false
+ gdb_test_multiple "attach $inferior_pid" "attach to inferior" {
+ -re "^attach $::decimal\r\n" {
+ exp_continue
+ }
+
+ -re "^warning: \[^\r\n\]+: could not open as an executable file: \[^\r\n\]+\r\n" {
+ set saw_bad_warning true
+ exp_continue
+ }
+
+ -re "^warning: \[^\r\n\]+: can't open to read symbols: \[^\r\n\]+\r\n" {
+ set saw_bad_warning true
+ exp_continue
+ }
+
+ -re "^warning: Could not load vsyscall page because no executable was specified\r\n" {
+ # This warning is a secondary consequence of the above bad
+ # warnings, so don't count this as a bad warnings, ignore
+ # it instead.
+ exp_continue
+ }
+
+ -re "^warning:\\s+$::decimal\\s*\[^\r\n\]+: No such file or directory\r\n" {
+ # This unrelated warning is seen when GDB stops in libc,
+ # and the source code for libc is not available.
+ exp_continue
+ }
+
+ -re "^warning: \[^\r\n\]+\r\n" {
+ # If we ignore "other" warnings then, should the above
+ # warnings strings change we'll start ignoring the bad
+ # warnings, and the test will appear to pass.
+ #
+ # If you are seeing a warning here that really has nothing
+ # to do with the test failing, then the correct solution
+ # is to add a new regexp to specifically match _that_
+ # warning, and ignore it.
+ set saw_bad_warning true
+ exp_continue
+ }
+
+ -re "^$::gdb_prompt $" {
+ gdb_assert { !$saw_bad_warning } $gdb_test_name
+ }
+
+ -re "^\[^\r\n\]*\r\n" {
+ exp_continue
+ }
+ }
+
+ # Ensure GDB could access the executable.
+ set binfile_re [string_to_regexp $::binfile]
+ gdb_test "info inferiors" \
+ "\r\n\\*\\s+$::decimal\\s+\[^\r\n\]+\\s+${prefix}${binfile_re}\\s*"
+}
+
+set test_flags [list \
+ "--mount --map-root-user" \
+ "--user" \
+ "--user --map-root-user"]
+
+foreach_with_prefix flags $test_flags {
+ run_test $flags
+}
diff --git a/gdb/testsuite/gdb.base/utf8-identifiers.c b/gdb/testsuite/gdb.base/utf8-identifiers.c
index f887459..e0c3fd3 100644
--- a/gdb/testsuite/gdb.base/utf8-identifiers.c
+++ b/gdb/testsuite/gdb.base/utf8-identifiers.c
@@ -2,7 +2,7 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/utf8-identifiers.exp b/gdb/testsuite/gdb.base/utf8-identifiers.exp
index 0f9c6a3..8d19dbc 100644
--- a/gdb/testsuite/gdb.base/utf8-identifiers.exp
+++ b/gdb/testsuite/gdb.base/utf8-identifiers.exp
@@ -2,7 +2,7 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ load_lib completion-support.exp
if { [is_c_compiler_gcc] } {
# Gcc fully supports fextended-identifiers starting GCC 5.
- require {expr [gcc_major_version] >= 5}
+ require {expr {[gcc_major_version] >= 5}}
}
require {have_host_locale C.UTF-8}
@@ -36,7 +36,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} [list $srcfile]] } {
return -1
}
-if ![runto done] {
+if {![runto done]} {
return
}
diff --git a/gdb/testsuite/gdb.base/valgrind-bt.c b/gdb/testsuite/gdb.base/valgrind-bt.c
index cd03723..b0aea95 100644
--- a/gdb/testsuite/gdb.base/valgrind-bt.c
+++ b/gdb/testsuite/gdb.base/valgrind-bt.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/valgrind-bt.exp b/gdb/testsuite/gdb.base/valgrind-bt.exp
index b3f3c09..f885419 100644
--- a/gdb/testsuite/gdb.base/valgrind-bt.exp
+++ b/gdb/testsuite/gdb.base/valgrind-bt.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/valgrind-disp-step.c b/gdb/testsuite/gdb.base/valgrind-disp-step.c
index b95b5f4..6350ec6 100644
--- a/gdb/testsuite/gdb.base/valgrind-disp-step.c
+++ b/gdb/testsuite/gdb.base/valgrind-disp-step.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/valgrind-disp-step.exp b/gdb/testsuite/gdb.base/valgrind-disp-step.exp
index 00918d6..d76c3b4 100644
--- a/gdb/testsuite/gdb.base/valgrind-disp-step.exp
+++ b/gdb/testsuite/gdb.base/valgrind-disp-step.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/valgrind-infcall-2.c b/gdb/testsuite/gdb.base/valgrind-infcall-2.c
index cb77aca..89f18e8 100644
--- a/gdb/testsuite/gdb.base/valgrind-infcall-2.c
+++ b/gdb/testsuite/gdb.base/valgrind-infcall-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/valgrind-infcall-2.exp b/gdb/testsuite/gdb.base/valgrind-infcall-2.exp
index 857e434..bc8a4bd 100644
--- a/gdb/testsuite/gdb.base/valgrind-infcall-2.exp
+++ b/gdb/testsuite/gdb.base/valgrind-infcall-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/valgrind-infcall.c b/gdb/testsuite/gdb.base/valgrind-infcall.c
index 1903941..c3e025a 100644
--- a/gdb/testsuite/gdb.base/valgrind-infcall.c
+++ b/gdb/testsuite/gdb.base/valgrind-infcall.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/valgrind-infcall.exp b/gdb/testsuite/gdb.base/valgrind-infcall.exp
index 229425e..3b06c1d 100644
--- a/gdb/testsuite/gdb.base/valgrind-infcall.exp
+++ b/gdb/testsuite/gdb.base/valgrind-infcall.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -54,7 +54,7 @@ while {$loop && $continue_count < 100} {
pass "$test (false warning)"
}
}
- set continue_count [expr $continue_count + 1]
+ set continue_count [expr {$continue_count + 1}]
}
set test "p gdb_test_infcall ()"
diff --git a/gdb/testsuite/gdb.base/value-double-free.c b/gdb/testsuite/gdb.base/value-double-free.c
index ebf4726..0332f8d 100644
--- a/gdb/testsuite/gdb.base/value-double-free.c
+++ b/gdb/testsuite/gdb.base/value-double-free.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/value-double-free.exp b/gdb/testsuite/gdb.base/value-double-free.exp
index e577152..8395b97 100644
--- a/gdb/testsuite/gdb.base/value-double-free.exp
+++ b/gdb/testsuite/gdb.base/value-double-free.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/value-history-unavailable.c b/gdb/testsuite/gdb.base/value-history-unavailable.c
index b11498e..5ee20e4 100644
--- a/gdb/testsuite/gdb.base/value-history-unavailable.c
+++ b/gdb/testsuite/gdb.base/value-history-unavailable.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/value-history-unavailable.exp b/gdb/testsuite/gdb.base/value-history-unavailable.exp
index 8dc25db..6794953 100644
--- a/gdb/testsuite/gdb.base/value-history-unavailable.exp
+++ b/gdb/testsuite/gdb.base/value-history-unavailable.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,11 +27,11 @@ if {![runto_main]} {
set target_char_mask [get_valueof "/u" "a.x\[0]" "255" "get target char mask"]
set target_char_bit 0
-for {set i $target_char_mask} {$i > 0} {set i [expr $i >> 1]} {
+for {set i $target_char_mask} {$i > 0} {set i [expr {$i >> 1}]} {
incr target_char_bit
}
set target_char_rank -1
-for {set i $target_char_bit} {$i > 0} {set i [expr $i >> 1]} {
+for {set i $target_char_bit} {$i > 0} {set i [expr {$i >> 1}]} {
incr target_char_rank
}
diff --git a/gdb/testsuite/gdb.base/varargs.exp b/gdb/testsuite/gdb.base/varargs.exp
index 6923ca8..d25ae26 100644
--- a/gdb/testsuite/gdb.base/varargs.exp
+++ b/gdb/testsuite/gdb.base/varargs.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ set allow_float_test [allow_float_test]
set flags {}
lappend flags debug
lappend_include_file flags $srcdir/lib/unbuffer_output.c
-if [support_complex_tests] {
+if {[support_complex_tests]} {
lappend flags "additional_flags=-DTEST_COMPLEX"
}
@@ -49,13 +49,14 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
# Start with a fresh gdb.
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
gdb_test_no_output "set print sevenbit-strings"
gdb_test_no_output "set print address off"
gdb_test_no_output "set width 0"
-if [gdb_skip_stdio_test "varargs.exp"] {
+if {[gdb_skip_stdio_test "varargs.exp"]} {
# Nothing in this module is testable without printf.
return
}
@@ -92,7 +93,7 @@ if {$allow_float_test} {
# Test _Complex type here if supported.
-if [support_complex_tests] {
+if {[support_complex_tests]} {
global gdb_prompt
set test "print find_max_float_real(4, fc1, fc2, fc3, fc4)"
diff --git a/gdb/testsuite/gdb.base/vdso-warning.c b/gdb/testsuite/gdb.base/vdso-warning.c
index c38538d..120c08d 100644
--- a/gdb/testsuite/gdb.base/vdso-warning.c
+++ b/gdb/testsuite/gdb.base/vdso-warning.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/vdso-warning.exp b/gdb/testsuite/gdb.base/vdso-warning.exp
index cf7fe9b..ea5f492 100644
--- a/gdb/testsuite/gdb.base/vdso-warning.exp
+++ b/gdb/testsuite/gdb.base/vdso-warning.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/vfork-follow-parent.c b/gdb/testsuite/gdb.base/vfork-follow-parent.c
index ca0f07a..6889ebf 100644
--- a/gdb/testsuite/gdb.base/vfork-follow-parent.c
+++ b/gdb/testsuite/gdb.base/vfork-follow-parent.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/vfork-follow-parent.exp b/gdb/testsuite/gdb.base/vfork-follow-parent.exp
index d9fa88b..8cb785d 100644
--- a/gdb/testsuite/gdb.base/vfork-follow-parent.exp
+++ b/gdb/testsuite/gdb.base/vfork-follow-parent.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,6 +19,8 @@
# schedule-multiple on" or "set detach-on-fork on". Test these two resolution
# methods.
+require allow_fork_tests
+
standard_testfile .c vforked-prog.c
set binfile ${testfile}-exit
diff --git a/gdb/testsuite/gdb.base/vforked-prog.c b/gdb/testsuite/gdb.base/vforked-prog.c
index 02dd9a2..6222b14 100644
--- a/gdb/testsuite/gdb.base/vforked-prog.c
+++ b/gdb/testsuite/gdb.base/vforked-prog.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1997-2024 Free Software Foundation, Inc.
+ Copyright 1997-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/vla-datatypes.c b/gdb/testsuite/gdb.base/vla-datatypes.c
index 6241e7e..859929a 100644
--- a/gdb/testsuite/gdb.base/vla-datatypes.c
+++ b/gdb/testsuite/gdb.base/vla-datatypes.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/vla-datatypes.exp b/gdb/testsuite/gdb.base/vla-datatypes.exp
index b46340a..a116123 100644
--- a/gdb/testsuite/gdb.base/vla-datatypes.exp
+++ b/gdb/testsuite/gdb.base/vla-datatypes.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/vla-optimized-out.c b/gdb/testsuite/gdb.base/vla-optimized-out.c
index b83b2bf..24ec103 100644
--- a/gdb/testsuite/gdb.base/vla-optimized-out.c
+++ b/gdb/testsuite/gdb.base/vla-optimized-out.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/vla-optimized-out.exp b/gdb/testsuite/gdb.base/vla-optimized-out.exp
index b57e474..316043d 100644
--- a/gdb/testsuite/gdb.base/vla-optimized-out.exp
+++ b/gdb/testsuite/gdb.base/vla-optimized-out.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ proc vla_optimized_out {exe_suffix options} {
return -1
}
- if ![runto f1] {
+ if {![runto f1]} {
return
}
diff --git a/gdb/testsuite/gdb.base/vla-ptr.c b/gdb/testsuite/gdb.base/vla-ptr.c
index 31bca8d..58823df 100644
--- a/gdb/testsuite/gdb.base/vla-ptr.c
+++ b/gdb/testsuite/gdb.base/vla-ptr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/vla-ptr.exp b/gdb/testsuite/gdb.base/vla-ptr.exp
index df1b8f0..22ac0a3 100644
--- a/gdb/testsuite/gdb.base/vla-ptr.exp
+++ b/gdb/testsuite/gdb.base/vla-ptr.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/vla-sideeffect.c b/gdb/testsuite/gdb.base/vla-sideeffect.c
index 15cf5c3..11367aa 100644
--- a/gdb/testsuite/gdb.base/vla-sideeffect.c
+++ b/gdb/testsuite/gdb.base/vla-sideeffect.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/vla-sideeffect.exp b/gdb/testsuite/gdb.base/vla-sideeffect.exp
index 8215ec2..158ae35 100644
--- a/gdb/testsuite/gdb.base/vla-sideeffect.exp
+++ b/gdb/testsuite/gdb.base/vla-sideeffect.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -31,7 +31,8 @@ gdb_continue_to_breakpoint "vla-filled"
# Check side effects for sizeof argument.
set sizeof_int [get_sizeof "int" 4]
-set sizeof_vla [ expr "10" * "$sizeof_int" ]
+
+set sizeof_vla [expr {10 * $sizeof_int}]
gdb_test "print sizeof (vla1\[i++\])" " = ${sizeof_int}"
gdb_test "print i" " = 0" \
diff --git a/gdb/testsuite/gdb.base/vla-struct-fields.c b/gdb/testsuite/gdb.base/vla-struct-fields.c
index bbd0197..62716ea 100644
--- a/gdb/testsuite/gdb.base/vla-struct-fields.c
+++ b/gdb/testsuite/gdb.base/vla-struct-fields.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/vla-struct-fields.exp b/gdb/testsuite/gdb.base/vla-struct-fields.exp
index deb66fa..72af212 100644
--- a/gdb/testsuite/gdb.base/vla-struct-fields.exp
+++ b/gdb/testsuite/gdb.base/vla-struct-fields.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/vla-stub-define.c b/gdb/testsuite/gdb.base/vla-stub-define.c
index 2cc6f09..14b83ba 100644
--- a/gdb/testsuite/gdb.base/vla-stub-define.c
+++ b/gdb/testsuite/gdb.base/vla-stub-define.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/vla-stub.c b/gdb/testsuite/gdb.base/vla-stub.c
index 169469d..babab1d 100644
--- a/gdb/testsuite/gdb.base/vla-stub.c
+++ b/gdb/testsuite/gdb.base/vla-stub.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/vla-stub.exp b/gdb/testsuite/gdb.base/vla-stub.exp
index 11b4b48..274f821 100644
--- a/gdb/testsuite/gdb.base/vla-stub.exp
+++ b/gdb/testsuite/gdb.base/vla-stub.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/volatile.exp b/gdb/testsuite/gdb.base/volatile.exp
index ef9a615..e85d415 100644
--- a/gdb/testsuite/gdb.base/volatile.exp
+++ b/gdb/testsuite/gdb.base/volatile.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@
# const volatile pointers to const vars
# const volatile pointers to volatile vars
# ... etc. (you get the idea)
-# Mostly with char and unsigned char.
+# Mostly with char and unsigned char.
#
# test running programs
@@ -54,7 +54,7 @@ proc local_compiler_xfail_check { } {
if {[test_compiler_info gcc-2-*]} {
if { ![test_debug_format "HP"] \
&& ![test_debug_format "DWARF \[0-9\]"] } then {
- setup_xfail "*-*-*"
+ setup_xfail "*-*-*"
}
}
}
diff --git a/gdb/testsuite/gdb.base/warning.exp b/gdb/testsuite/gdb.base/warning.exp
index 4d0878e..65b42e7 100644
--- a/gdb/testsuite/gdb.base/warning.exp
+++ b/gdb/testsuite/gdb.base/warning.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watch-before-fork.c b/gdb/testsuite/gdb.base/watch-before-fork.c
index 34a5553..d2108d5 100644
--- a/gdb/testsuite/gdb.base/watch-before-fork.c
+++ b/gdb/testsuite/gdb.base/watch-before-fork.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watch-before-fork.exp b/gdb/testsuite/gdb.base/watch-before-fork.exp
index 6cf06df..509561e 100644
--- a/gdb/testsuite/gdb.base/watch-before-fork.exp
+++ b/gdb/testsuite/gdb.base/watch-before-fork.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,6 +20,8 @@
# This test uses "awatch".
require allow_hw_watchpoint_access_tests
+require allow_fork_tests
+
standard_testfile
if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
diff --git a/gdb/testsuite/gdb.base/watch-bitfields.c b/gdb/testsuite/gdb.base/watch-bitfields.c
index 6e62b27..cc967a5 100644
--- a/gdb/testsuite/gdb.base/watch-bitfields.c
+++ b/gdb/testsuite/gdb.base/watch-bitfields.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watch-bitfields.exp b/gdb/testsuite/gdb.base/watch-bitfields.exp
index 1c0d808..b53f343 100644
--- a/gdb/testsuite/gdb.base/watch-bitfields.exp
+++ b/gdb/testsuite/gdb.base/watch-bitfields.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watch-cond-infcall.c b/gdb/testsuite/gdb.base/watch-cond-infcall.c
index 8ea0d6c..feaef8b 100644
--- a/gdb/testsuite/gdb.base/watch-cond-infcall.c
+++ b/gdb/testsuite/gdb.base/watch-cond-infcall.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watch-cond-infcall.exp b/gdb/testsuite/gdb.base/watch-cond-infcall.exp
index 874f6d2..301fd6c 100644
--- a/gdb/testsuite/gdb.base/watch-cond-infcall.exp
+++ b/gdb/testsuite/gdb.base/watch-cond-infcall.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watch-cond.c b/gdb/testsuite/gdb.base/watch-cond.c
index e934151..4cde9cc 100644
--- a/gdb/testsuite/gdb.base/watch-cond.c
+++ b/gdb/testsuite/gdb.base/watch-cond.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watch-cond.exp b/gdb/testsuite/gdb.base/watch-cond.exp
index 6a6deac..0990f53 100644
--- a/gdb/testsuite/gdb.base/watch-cond.exp
+++ b/gdb/testsuite/gdb.base/watch-cond.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watch-non-mem.c b/gdb/testsuite/gdb.base/watch-non-mem.c
index 82ac976..37efe19 100644
--- a/gdb/testsuite/gdb.base/watch-non-mem.c
+++ b/gdb/testsuite/gdb.base/watch-non-mem.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watch-non-mem.exp b/gdb/testsuite/gdb.base/watch-non-mem.exp
index 98c2085..5915e7f 100644
--- a/gdb/testsuite/gdb.base/watch-non-mem.exp
+++ b/gdb/testsuite/gdb.base/watch-non-mem.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watch-read.c b/gdb/testsuite/gdb.base/watch-read.c
index 694cf67..e66e0f9 100644
--- a/gdb/testsuite/gdb.base/watch-read.c
+++ b/gdb/testsuite/gdb.base/watch-read.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watch-read.exp b/gdb/testsuite/gdb.base/watch-read.exp
index f56d84d..8e4d8ba 100644
--- a/gdb/testsuite/gdb.base/watch-read.exp
+++ b/gdb/testsuite/gdb.base/watch-read.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watch-vfork.c b/gdb/testsuite/gdb.base/watch-vfork.c
index 03747be..ef9771a 100644
--- a/gdb/testsuite/gdb.base/watch-vfork.c
+++ b/gdb/testsuite/gdb.base/watch-vfork.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watch-vfork.exp b/gdb/testsuite/gdb.base/watch-vfork.exp
index f7e268f..503727d 100644
--- a/gdb/testsuite/gdb.base/watch-vfork.exp
+++ b/gdb/testsuite/gdb.base/watch-vfork.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,6 +17,8 @@
standard_testfile .c
+require allow_fork_tests
+
if { [build_executable ${testfile}.exp ${testfile} $srcfile {debug}] } {
untested "failed to compile"
return -1
diff --git a/gdb/testsuite/gdb.base/watch_thread_num.c b/gdb/testsuite/gdb.base/watch_thread_num.c
index 9413881..87230cf 100644
--- a/gdb/testsuite/gdb.base/watch_thread_num.c
+++ b/gdb/testsuite/gdb.base/watch_thread_num.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
Copyright 1992, 1993, 1994, 1995, 1999, 2002, 2003, 2007, 2008, 2009
Free Software Foundation, Inc.
diff --git a/gdb/testsuite/gdb.base/watch_thread_num.exp b/gdb/testsuite/gdb.base/watch_thread_num.exp
index 577059b..e1b54c0 100644
--- a/gdb/testsuite/gdb.base/watch_thread_num.exp
+++ b/gdb/testsuite/gdb.base/watch_thread_num.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,8 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart
+gdb_load $binfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.base/watchpoint-cond-gone-stripped.c b/gdb/testsuite/gdb.base/watchpoint-cond-gone-stripped.c
index a33f99a..ca88d76 100644
--- a/gdb/testsuite/gdb.base/watchpoint-cond-gone-stripped.c
+++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone-stripped.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watchpoint-cond-gone.c b/gdb/testsuite/gdb.base/watchpoint-cond-gone.c
index 2679ddd..4c51a80 100644
--- a/gdb/testsuite/gdb.base/watchpoint-cond-gone.c
+++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp b/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp
index 3d8bb5b..c789c60 100644
--- a/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if {[prepare_for_testing_full "failed to prepare" \
# Problem does not occur otherwise.
gdb_test_no_output "set can-use-hw-watchpoints 0"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/watchpoint-delete.c b/gdb/testsuite/gdb.base/watchpoint-delete.c
index 706d8b3..a95bb10 100644
--- a/gdb/testsuite/gdb.base/watchpoint-delete.c
+++ b/gdb/testsuite/gdb.base/watchpoint-delete.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watchpoint-delete.exp b/gdb/testsuite/gdb.base/watchpoint-delete.exp
index c15133b..cdf532f 100644
--- a/gdb/testsuite/gdb.base/watchpoint-delete.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-delete.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
# It is more compatible this way.
gdb_test_no_output "set can-use-hw-watchpoints 0"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-attach.c b/gdb/testsuite/gdb.base/watchpoint-hw-attach.c
index 765c2f0..0eed7b3 100644
--- a/gdb/testsuite/gdb.base/watchpoint-hw-attach.c
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-attach.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp b/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp
index ff3585a..afdb82e 100644
--- a/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,29 +26,19 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
return -1
}
-if ![runto_main] {
- return -1
-}
+set test_spawn_id [spawn_wait_for_attach $binfile]
+set testpid [spawn_id_get_pid $test_spawn_id]
-# Run to the point where mypid in the test program has been
-# populated.
-gdb_breakpoint [gdb_get_line_number "pidacquired"]
-gdb_continue_to_breakpoint "pidacquired"
-
-# Get the PID of the test process.
-set testpid [get_integer_valueof "mypid" 0]
+gdb_test "attach $testpid" "Attaching to program: .*, process $testpid.*" "attach once"
gdb_test "detach" "Detaching from program: .*, process $testpid\r\n\\\[Inferior $decimal \\(process $testpid\\) detached\\\]"
-if {$testpid == ""} {
- return -1
-}
-
# A clean restart is needed to force the hardware watchpoint setup
# logic to run post attach rather than post inferior launch.
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
-gdb_test "attach $testpid" "Attaching to program: .*, process $testpid.*" "attach"
+gdb_test "attach $testpid" "Attaching to program: .*, process $testpid.*" "attach twice"
# Ensure the test program is in the top frame so the required
# variables are in scope.
@@ -62,3 +52,5 @@ gdb_test "watch watched_variable" \
gdb_test "continue" \
"continue.*Continuing.*\.Hardware watchpoint $decimal: watched_variable.*Old value = 0.*New value = 4.*watched_variable\\);"
+
+kill_wait_spawned_process $test_spawn_id
diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.c b/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.c
index 8fabd51..3d88b10 100644
--- a/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.c
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp b/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp
index 2948c90..906654e 100644
--- a/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${test} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/watchpoint-hw.c b/gdb/testsuite/gdb.base/watchpoint-hw.c
index 13d395d..0288b91 100644
--- a/gdb/testsuite/gdb.base/watchpoint-hw.c
+++ b/gdb/testsuite/gdb.base/watchpoint-hw.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watchpoint-hw.exp b/gdb/testsuite/gdb.base/watchpoint-hw.exp
index 0755c2e..820a6db 100644
--- a/gdb/testsuite/gdb.base/watchpoint-hw.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-hw.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.c b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.c
index 2838785..4b04765 100644
--- a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.c
+++ b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp
index 6409279..23ef746 100644
--- a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -158,7 +158,7 @@ proc valid_addr_p {cmd offset width} {
# registers to represent the whole unaligned region. Breakpoint
# addresses must still be aligned though.
if {$cmd == "hbreak" } {
- if { [expr ($offset) % 4] != 0 } {
+ if {$offset % 4 != 0} {
return 0
}
}
@@ -170,20 +170,20 @@ proc valid_addr_p {cmd offset width} {
}
} else {
# Watchpoints can be of length 1, 2, 4 or 8 bytes.
- if { [expr $width % 2] != 0 } {
+ if { $width % 2 != 0 } {
return 0
}
}
- if { [expr ($offset) % 8] == 0 && $width == 8 } {
+ if {$offset % 8 == 0 && $width == 8} {
# If WIDTH is 8 byte, the address should be 8-byte aligned.
return 1
- } elseif { [expr ($offset) % 4] == 0 } {
+ } elseif {$offset % 4 == 0} {
return 1
- } elseif { [expr ($offset) % 4] == 2 && $width == 2 } {
+ } elseif {$offset % 4 == 2 && $width == 2} {
# Halfword watchpoints and breakpoints.
return 1
- } elseif { [expr ($offset) % 4] == 1 && $width == 1 && $cmd != "hbreak" } {
+ } elseif {$offset % 4 == 1 && $width == 1 && $cmd != "hbreak"} {
# Single byte watchpoints.
return 1
} else {
@@ -249,7 +249,7 @@ proc run_watchpoints_tests {hw_wp_p} {
for {set x 0} {$x < 4} {incr x} {
if { ![valid_addr_p $cmd1 $x $width]
- || ![valid_addr_p $cmd2 $x+1 $width] } {
+ || ![valid_addr_p $cmd2 [expr {$x+1}] $width] } {
# Skip tests if requested address or length
# of breakpoint or watchpoint don't meet
# target or kernel requirements.
diff --git a/gdb/testsuite/gdb.base/watchpoint-running.c b/gdb/testsuite/gdb.base/watchpoint-running.c
index 3ba1cb2..8cd7c44 100644
--- a/gdb/testsuite/gdb.base/watchpoint-running.c
+++ b/gdb/testsuite/gdb.base/watchpoint-running.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watchpoint-running.exp b/gdb/testsuite/gdb.base/watchpoint-running.exp
index abba43f..61c1f8c 100644
--- a/gdb/testsuite/gdb.base/watchpoint-running.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-running.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ set allow_hw_watchpoint_tests_p [allow_hw_watchpoint_tests]
standard_testfile
-if [build_executable "failed to prepare" $testfile $srcfile {debug}] {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug}]} {
return -1
}
@@ -43,7 +43,8 @@ proc test {stop_mode hw} {
# default.
append ::GDBFLAGS " -ex \"maint set target-non-stop on\""
}
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
}
gdb_test_no_output "set can-use-hw-watchpoints $hw"
@@ -86,7 +87,7 @@ proc test {stop_mode hw} {
# sufficient time to ever wrap around.)
gdb_assert {$val1 != $val2} "values are different"
- set wp_str [expr ($hw)?"Hardware watchpoint":"Watchpoint"]
+ set wp_str [expr {($hw)?"Hardware watchpoint":"Watchpoint"}]
# Now set a watchpoint, while the inferior is running. Since
# we're watching a global, and we can read global memory while the
@@ -129,7 +130,7 @@ foreach hw {0 1} {
continue
}
foreach stop_mode {all-stop non-stop} {
- set wp_type [expr ($hw)?"hardware":"software"]
+ set wp_type [expr {($hw)?"hardware":"software"}]
with_test_prefix "$stop_mode: $wp_type" {
test $stop_mode $hw
}
diff --git a/gdb/testsuite/gdb.base/watchpoint-solib-shr.c b/gdb/testsuite/gdb.base/watchpoint-solib-shr.c
index 373bf92..d573569 100644
--- a/gdb/testsuite/gdb.base/watchpoint-solib-shr.c
+++ b/gdb/testsuite/gdb.base/watchpoint-solib-shr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watchpoint-solib.c b/gdb/testsuite/gdb.base/watchpoint-solib.c
index 1a50256..25114ed 100644
--- a/gdb/testsuite/gdb.base/watchpoint-solib.c
+++ b/gdb/testsuite/gdb.base/watchpoint-solib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watchpoint-solib.exp b/gdb/testsuite/gdb.base/watchpoint-solib.exp
index bafc759..7f58a83 100644
--- a/gdb/testsuite/gdb.base/watchpoint-solib.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-solib.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -49,7 +49,8 @@ if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
gdb_load_shlib $lib_sl
runto_main
diff --git a/gdb/testsuite/gdb.base/watchpoint-stops-at-right-insn.c b/gdb/testsuite/gdb.base/watchpoint-stops-at-right-insn.c
index 66208f5..83a2508 100644
--- a/gdb/testsuite/gdb.base/watchpoint-stops-at-right-insn.c
+++ b/gdb/testsuite/gdb.base/watchpoint-stops-at-right-insn.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watchpoint-stops-at-right-insn.exp b/gdb/testsuite/gdb.base/watchpoint-stops-at-right-insn.exp
index 154514f..163ec3b 100644
--- a/gdb/testsuite/gdb.base/watchpoint-stops-at-right-insn.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-stops-at-right-insn.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -129,7 +129,8 @@ proc test {always_inserted} {
with_test_prefix "always-inserted $always_inserted" {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.base/watchpoint-unaligned.c b/gdb/testsuite/gdb.base/watchpoint-unaligned.c
index 6f70925..ca2fa45 100644
--- a/gdb/testsuite/gdb.base/watchpoint-unaligned.c
+++ b/gdb/testsuite/gdb.base/watchpoint-unaligned.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,6 +18,8 @@
#include <stdint.h>
#include <assert.h>
+static volatile int volatile_dummy;
+
static int again;
static volatile struct
@@ -53,6 +55,40 @@ write_size8twice (void)
data.u.size8twice[offset] = first;
data.u.size8twice[offset + 1] = second;
#endif
+
+ /* Setting a breakpoint on an instruction after an instruction triggering a
+ watchpoint makes it ambiguous which one will be reported.
+ Insert a dummy instruction in between to make sure the watchpoint gets
+ reported. */
+ volatile_dummy = 1;
+
+ return; /* write_size8twice_return */
+}
+
+static void
+read_size8twice (void)
+{
+ static uint64_t volatile first;
+ static uint64_t volatile second;
+
+#ifdef __aarch64__
+ volatile void *p = &data.u.size8twice[offset];
+ asm volatile ("ldp %0, %1, [%2]"
+ : "=r" (first), "=r" (second) /* output */
+ : "r" (p) /* input */
+ : /* clobber */);
+#else
+ first = data.u.size8twice[offset];
+ second = data.u.size8twice[offset + 1];
+#endif
+
+ /* Setting a breakpoint on an instruction after an instruction triggering a
+ watchpoint makes it ambiguous which one will be reported.
+ Insert a dummy instruction inbetween to make sure the watchpoint gets
+ reported. */
+ volatile_dummy = 1;
+
+ return; /* read_size8twice_return */
}
int
@@ -63,6 +99,7 @@ main (void)
assert (sizeof (data) == 8 + 3 * 8);
write_size8twice ();
+ read_size8twice ();
while (size)
{
diff --git a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp
index 999dd3a..13dcfba 100644
--- a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -43,14 +43,14 @@ if {[istarget "s390*-*-*"]} {
foreach wpsize $sizes {
for {set wpoffset 0} {$wpoffset < 8 / $wpsize} {incr wpoffset} {
- set wpstart [expr $wpoffset * $wpsize]
- set wpend [expr ($wpoffset + 1) * $wpsize]
+ set wpstart [expr {$wpoffset * $wpsize}]
+ set wpend [expr {($wpoffset + 1) * $wpsize}]
set wpendaligned $alignedend($wpend)
foreach rdsize $sizes {
for {set rdoffset 0} {$rdoffset < 8 / $rdsize} {incr rdoffset} {
- set rdstart [expr $rdoffset * $rdsize]
- set rdend [expr ($rdoffset + 1) * $rdsize]
- set expect_hit [expr max ($wpstart, $rdstart) < min ($wpend, $rdend)]
+ set rdstart [expr {$rdoffset * $rdsize}]
+ set rdend [expr {($rdoffset + 1) * $rdsize}]
+ set expect_hit [expr {max ($wpstart, $rdstart) < min ($wpend, $rdend)}]
set test "$rwatch data.u.size$wpsize\[$wpoffset\]"
set wpnum ""
gdb_test_multiple $test $test {
@@ -88,7 +88,7 @@ foreach wpsize $sizes {
if {$expect_hit == 0 && $rdstart < $wpendaligned} {
setup_xfail external/20207 "aarch64*-*-linux*"
}
- if {!$expect_hit && [expr max ($wpstart / 8, $rdstart / 8) < min (($wpend + 7) / 8, ($rdend + 7) / 8)]} {
+ if {!$expect_hit && max ($wpstart / 8, $rdstart / 8) < min (($wpend + 7) / 8, ($rdend + 7) / 8)} {
setup_xfail breakpoints/23131 "powerpc*-*-*"
}
fail $test
@@ -139,7 +139,7 @@ foreach_with_prefix wpcount {4 7} {
}
}
set test "wpcount($wpcount)"
- if {!$wpoffset_to_wpnum([expr $wpcount - 1])} {
+ if {!$wpoffset_to_wpnum([expr {$wpcount - 1}])} {
untested $test
continue
}
@@ -151,6 +151,63 @@ foreach_with_prefix wpcount {4 7} {
gdb_assert $got_hit $test
}
+proc size8twice { function cmd offset index } {
+ clean_restart $::testfile
+
+ if { ![runto $function] } {
+ return -1
+ }
+
+ # Set offset in the inferior.
+ gdb_test_no_output "set var offset = $offset"
+
+ # Set a breakpoint.
+ set bp_src_string "${function}_return"
+ set bp_loc [gdb_get_line_number $bp_src_string]
+ gdb_breakpoint $bp_loc \
+ "Breakpoint $::decimal at $::hex" "$bp_src_string"
+
+ # Set a hardware watchpoint.
+ set watch_index [expr {$offset + $index}]
+ set test "$cmd data.u.size8twice\[$watch_index\]"
+ set wpnum 0
+ gdb_test_multiple $test "" {
+ -re -wrap "Hardware (read )?watchpoint ($::decimal): .*" {
+ set wpnum $expect_out(2,string)
+ pass $gdb_test_name
+ }
+ -re -wrap "Watchpoint ($::decimal): .*" {
+ if {[istarget "arm*-*-*"]} {
+ untested $gdb_test_name
+ } else {
+ fail $gdb_test_name
+ }
+ }
+ }
+
+ if { ! $wpnum } {
+ # No hardware watchpoint, we're done.
+ return 0
+ }
+
+ # Try to trigger the hardware watchpoint.
+ set got_hit 0
+ gdb_test_multiple "continue" "" {
+ -re -wrap "\r\nCould not insert hardware watchpoint .*" {
+ }
+ -re -wrap "Hardware (read )?watchpoint $wpnum:.*(New value|Value) = .*" {
+ set got_hit 1
+ send_gdb "continue\n"
+ exp_continue
+ }
+ -re -wrap " $bp_src_string .*" {
+ }
+ }
+ gdb_assert { $got_hit }
+
+ return $got_hit
+}
+
# We've got an array with 3 8-byte elements. Do a store of 16 bytes,
# to:
# - elements 0 and 1 (offset == 0), and
@@ -158,49 +215,21 @@ foreach_with_prefix wpcount {4 7} {
# For each case, check setting a watchpoint at:
# - the first written element (index == 0), and
# - the second element (index == 1).
-foreach_with_prefix offset { 0 1 } {
- foreach_with_prefix index { 0 1 } {
-
- clean_restart $binfile
-
- if ![runto_main] {
- return -1
- }
-
- gdb_test_no_output "set var offset = $offset"
- gdb_breakpoint [gdb_get_line_number "final_return"] \
- "Breakpoint $decimal at $hex" "final_return"
- set watch_index [expr $offset + $index]
- set test "watch data.u.size8twice\[$watch_index\]"
- set wpnum 0
- gdb_test_multiple $test $test {
- -re "Hardware watchpoint (\[0-9\]+): .*\r\n$gdb_prompt $" {
- set wpnum $expect_out(1,string)
- pass $gdb_test_name
- }
- -re "Watchpoint (\[0-9\]+): .*\r\n$gdb_prompt $" {
- if {[istarget "arm*-*-*"]} {
- untested $gdb_test_name
- } else {
- fail $gdb_test_name
- }
+foreach_with_prefix fun { write_size8twice read_size8twice } {
+ if { $fun == "write_size8twice" } {
+ set cmd "watch"
+ } else {
+ set cmd "rwatch"
+ }
+ foreach_with_prefix offset { 0 1 } {
+ foreach_with_prefix index { 0 1 } {
+ set res [size8twice $fun $cmd $offset $index]
+ if { $res != 1 } {
+ break
}
}
- if {$wpnum} {
- set test "continue"
- set got_hit 0
- gdb_test_multiple $test $test {
- -re "\r\nCould not insert hardware watchpoint .*\r\n$gdb_prompt $" {
- }
- -re "Hardware watchpoint $wpnum:.*New value = .*\r\n$gdb_prompt $" {
- set got_hit 1
- send_gdb "continue\n"
- exp_continue
- }
- -re " final_return .*\r\n$gdb_prompt $" {
- }
- }
- gdb_assert $got_hit "size8twice write"
+ if { $res != 1 } {
+ break
}
}
}
diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp
index 2449663..7a5a96a 100644
--- a/gdb/testsuite/gdb.base/watchpoint.exp
+++ b/gdb/testsuite/gdb.base/watchpoint.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -55,23 +55,23 @@ proc initialize {} {
global decimal
global srcfile
- if [gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker1" ] {
+ if {[gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker1" ]} {
return 0
}
- if [gdb_test "break marker2" "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker2" ] {
+ if {[gdb_test "break marker2" "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker2" ]} {
return 0
}
- if [gdb_test "info break" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*" "info break" ] {
+ if {[gdb_test "info break" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*" "info break" ]} {
return 0
}
gdb_test "watch ival3" ".*\[Ww\]atchpoint 3: ival3.*" "set watchpoint on ival3"
- if [gdb_test "info watch" "3\[ \]*.*watchpoint.*ival3" "watchpoint found in watchpoint/breakpoint table" ] {
+ if {[gdb_test "info watch" "3\[ \]*.*watchpoint.*ival3" "watchpoint found in watchpoint/breakpoint table" ]} {
return 0
}
@@ -80,7 +80,7 @@ proc initialize {} {
# to use it. This allows the test program to run at full speed until
# we get to the first marker function.
- if [gdb_test_no_output "disable 3" "disable watchpoint" ] {
+ if {[gdb_test_no_output "disable 3" "disable watchpoint" ]} {
return 0
}
@@ -99,8 +99,8 @@ proc test_simple_watchpoint {} {
# Ensure that the watchpoint is disabled when we startup.
- if [gdb_test_no_output "disable 3" \
- "disable watchpoint in test_simple_watchpoint" ] {
+ if {[gdb_test_no_output "disable 3" \
+ "disable watchpoint in test_simple_watchpoint" ]} {
return 0
}
@@ -121,7 +121,7 @@ proc test_simple_watchpoint {} {
# After reaching the marker function, enable the watchpoint.
- if [gdb_test_no_output "enable 3" "enable watchpoint" ] {
+ if {[gdb_test_no_output "enable 3" "enable watchpoint" ]} {
return
}
@@ -165,7 +165,7 @@ Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count
# Check that the hit count is reported correctly
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 3 times.*" "watchpoint hit count is 3"
-
+
# Continue until the next change, from 2 to 3.
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" "watchpoint hit, fourth time"
@@ -188,14 +188,14 @@ Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count
# Disable the watchpoint so we run at full speed until we exit.
- if [gdb_test_no_output "disable 3" "watchpoint disabled" ] {
+ if {[gdb_test_no_output "disable 3" "watchpoint disabled" ]} {
return
}
# Run until process exits.
- if [target_info exists gdb,noresults] { return }
+ if {[target_info exists gdb,noresults]} { return }
gdb_continue_to_end "continue to exit in test_simple_watchpoint"
}
@@ -213,8 +213,8 @@ proc test_disabling_watchpoints {} {
# Ensure that the watchpoint is disabled when we startup.
- if [gdb_test_no_output "disable 3" \
- "disable watchpoint in test_disabling_watchpoints" ] {
+ if {[gdb_test_no_output "disable 3" \
+ "disable watchpoint in test_disabling_watchpoints" ]} {
return 0
}
@@ -236,7 +236,7 @@ proc test_disabling_watchpoints {} {
# After reaching the marker function, enable the watchpoint.
- if [gdb_test_no_output "enable 3" "watchpoint enabled" ] {
+ if {[gdb_test_no_output "enable 3" "watchpoint enabled" ]} {
return
}
@@ -245,14 +245,14 @@ proc test_disabling_watchpoints {} {
# Don't check the old value, because on VxWorks the variable value
# will not have been reinitialized.
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = .*New value = 0.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchpoints, first time"
-
+
# Continue until the next change, from 0 to 1.
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchpoints, second time"
-
+
# Disable the watchpoint but leave breakpoints
- if [gdb_test_no_output "disable 3" \
- "disable watchpoint #2 in test_disabling_watchpoints" ] {
+ if {[gdb_test_no_output "disable 3" \
+ "disable watchpoint #2 in test_disabling_watchpoints" ]} {
return 0
}
@@ -265,8 +265,8 @@ proc test_disabling_watchpoints {} {
# Make sure we hit no more watchpoints.
gdb_test "cont" "Continuing.*Breakpoint.*marker2 \\(\\).*" \
"disabled watchpoint skipped"
-
- if [target_info exists gdb,noresults] { return }
+
+ if {[target_info exists gdb,noresults]} { return }
gdb_continue_to_end "continue to exit in test_disabling_watchpoints"
}
@@ -286,7 +286,7 @@ proc test_stepping {} {
gdb_test "p func1 ()" "= 73" \
"calling function with watchpoint enabled"
- #
+ #
# "finish" brings us back to main.
# On some targets (e.g. alpha) gdb will stop from the finish in midline
# of the marker1 call. This is due to register restoring code on
@@ -357,7 +357,7 @@ proc test_watchpoint_triggered_in_syscall {} {
global gdb_prompt
# These tests won't work without printf support.
- if [gdb_skip_stdio_test "watchpoints triggered in syscall"] {
+ if {[gdb_skip_stdio_test "watchpoints triggered in syscall"]} {
return
}
# Run until we get to the first marker function.
@@ -391,10 +391,10 @@ proc test_watchpoint_triggered_in_syscall {} {
set test "sent 123"
gdb_test_multiple "123" $test {
- -re ".*\[Ww\]atchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
- -re ".*\[Ww\]atchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
- -re ".*\[Ww\]atchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
- -re ".*\[Ww\]atchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
+ -re ".*\[Ww\]atchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\[^\n\]*\n" { set x [expr {$x+1}] ; exp_continue }
+ -re ".*\[Ww\]atchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\[^\n\]*\n" { set x [expr {$x+1}] ; exp_continue }
+ -re ".*\[Ww\]atchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\[^\n\]*\n" { set x [expr {$x+1}] ; exp_continue }
+ -re ".*\[Ww\]atchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\[^\n\]*\n" { set x [expr {$x+1}] ; exp_continue }
-re ".*$gdb_prompt $" { pass $test }
}
@@ -402,27 +402,27 @@ proc test_watchpoint_triggered_in_syscall {} {
# should have printed.
set test "print buf\[0\]"
gdb_test_multiple $test $test {
- -re ".*= 49.*$gdb_prompt $" { set y [expr $y+1]; pass $test }
+ -re ".*= 49.*$gdb_prompt $" { set y [expr {$y+1}]; pass $test }
-re ".*= 0.*$gdb_prompt $" { $test }
}
set test "print buf\[1\]"
gdb_test_multiple $test $test {
- -re ".*= 50.*$gdb_prompt $" { set y [expr $y+1]; pass $test }
+ -re ".*= 50.*$gdb_prompt $" { set y [expr {$y+1}]; pass $test }
-re ".*= 0.*$gdb_prompt $" { pass $test }
}
set test "print buf\[2\]"
gdb_test_multiple $test $test {
- -re ".*= 51.*$gdb_prompt $" { set y [expr $y+1]; pass $test }
+ -re ".*= 51.*$gdb_prompt $" { set y [expr {$y+1}]; pass $test }
-re ".*= 0.*$gdb_prompt $" { pass $test }
}
set test "print buf\[3\]"
gdb_test_multiple $test $test {
- -re ".*= 10.*$gdb_prompt $" { set y [expr $y+1]; pass $test }
+ -re ".*= 10.*$gdb_prompt $" { set y [expr {$y+1}]; pass $test }
-re ".*= 0.*$gdb_prompt $" { pass $test }
}
# Did we find what we were looking for? If not, flunk it.
- if {[expr $x==$y]} { pass $testname } else { fail "$testname (only triggered $x watchpoints, expected $y)"}
+ if {$x==$y} { pass $testname } else { fail "$testname (only triggered $x watchpoints, expected $y)"}
# Continue until we hit the finishing marker function.
# Make sure we hit no more watchpoints.
@@ -432,7 +432,7 @@ proc test_watchpoint_triggered_in_syscall {} {
# Disable everything so we can finish the program at full speed
gdb_test_no_output "disable" "disable in test_watchpoint_triggered_in_syscall"
- if [target_info exists gdb,noresults] { return }
+ if {[target_info exists gdb,noresults]} { return }
gdb_continue_to_end "continue to exit in test_watchpoint_triggered_in_syscall"
}
@@ -567,7 +567,7 @@ proc test_complex_watchpoint {} {
# Disable everything so we can finish the program at full speed
gdb_test_no_output "disable" "disable in test_complex_watchpoint, second time"
- if [target_info exists gdb,noresults] { return }
+ if {[target_info exists gdb,noresults]} { return }
gdb_continue_to_end "continue to exit in test_complex_watchpoint"
}
@@ -941,7 +941,7 @@ proc test_watch_register_location {} {
# Start with a fresh gdb.
set prev_timeout $timeout
-set timeout 600
+set timeout 600
verbose "Timeout now 600 sec.\n"
test_no_hw_watchpoints
@@ -964,7 +964,7 @@ proc do_tests {} {
test_disabling_watchpoints
- if ![target_info exists gdb,cannot_call_functions] {
+ if {![target_info exists gdb,cannot_call_functions]} {
test_stepping
}
}
@@ -978,9 +978,9 @@ proc do_tests {} {
"disable fast watches, 2"
}
- # Only enabled for some targets merely because it has not been tested
+ # Only enabled for some targets merely because it has not been tested
# elsewhere.
- # On sparc-sun-sunos4.1.3, GDB was running all the way to the marker4
+ # On sparc-sun-sunos4.1.3, GDB was running all the way to the marker4
# breakpoint before stopping for the watchpoint. I don't know why.
if {[istarget "hppa*-*-*"]} {
test_watchpoint_triggered_in_syscall
diff --git a/gdb/testsuite/gdb.base/watchpoints.c b/gdb/testsuite/gdb.base/watchpoints.c
index b72f8ab..d2232e1 100644
--- a/gdb/testsuite/gdb.base/watchpoints.c
+++ b/gdb/testsuite/gdb.base/watchpoints.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/watchpoints.exp b/gdb/testsuite/gdb.base/watchpoints.exp
index ae05fb6..0d21315 100644
--- a/gdb/testsuite/gdb.base/watchpoints.exp
+++ b/gdb/testsuite/gdb.base/watchpoints.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -53,7 +53,8 @@ with_test_prefix "before inferior start" {
# This will turn hardware watchpoints back on and delete the watchpoint
# we just created.
- clean_restart ${binfile}
+ clean_restart
+ gdb_load $binfile
# Disable hardware watchpoints if necessary.
if {!$allow_hw_watchpoint_tests_p} {
@@ -93,13 +94,13 @@ with_test_prefix "before inferior start" {
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival1\r\n\[ \t]+breakpoint already hit 3 times.*" "watchpoint ival1 hit count is 3"
# Disable ival1 watchpoint
gdb_test_no_output "disable 2" ""
-
+
# Continue until the next change, from 1 to 2.
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" "watchpoint hit, third time"
# Check that the hit count is reported correctly
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 3 times.*" "watchpoint hit count is 3"
-
+
# Continue until the next change, from 2 to 3.
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" "watchpoint hit, fourth time"
diff --git a/gdb/testsuite/gdb.base/wchar.c b/gdb/testsuite/gdb.base/wchar.c
index 24e0a6f..3863614 100644
--- a/gdb/testsuite/gdb.base/wchar.c
+++ b/gdb/testsuite/gdb.base/wchar.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/wchar.exp b/gdb/testsuite/gdb.base/wchar.exp
index 0fc97cf..f0e4777 100644
--- a/gdb/testsuite/gdb.base/wchar.exp
+++ b/gdb/testsuite/gdb.base/wchar.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -72,3 +72,7 @@ gdb_test "print repeat_p" "= $hex L\"A$cent$cent\"\.\.\." \
# From PR cli/14977, but here because it requires wchar_t.
gdb_test "printf \"%ls\\n\", 0" "\\(null\\)"
+
+# From PR exp/33124 - a bug when converting escapes.
+set wbs {L'\\'}
+gdb_test "print $wbs" " = $decimal [string_to_regexp $wbs]"
diff --git a/gdb/testsuite/gdb.base/weaklib1.c b/gdb/testsuite/gdb.base/weaklib1.c
index 9d64f67..b5f9491 100644
--- a/gdb/testsuite/gdb.base/weaklib1.c
+++ b/gdb/testsuite/gdb.base/weaklib1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/weaklib2.c b/gdb/testsuite/gdb.base/weaklib2.c
index b40a0f9..2987454 100644
--- a/gdb/testsuite/gdb.base/weaklib2.c
+++ b/gdb/testsuite/gdb.base/weaklib2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/whatis-exp.exp b/gdb/testsuite/gdb.base/whatis-exp.exp
index 1f8522f..ffcfc44 100644
--- a/gdb/testsuite/gdb.base/whatis-exp.exp
+++ b/gdb/testsuite/gdb.base/whatis-exp.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
# computing the value, but just the type
# of the result. It goes through the evaluate_subexp_standard
# with the EVAL_AVOID_SIDE_EFFECTS flag rather than EVAL_NORMAL
-#
+#
#
# test running programs
diff --git a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.c b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.c
index fb11ca2..1e87907 100644
--- a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.c
+++ b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp
index 7088299..744c6ee 100644
--- a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp
+++ b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ standard_testfile
proc prepare {lang} {
global srcfile testfile
- if [target_info exists no_long_long] {
+ if {[target_info exists no_long_long]} {
set options [list debug additional_flags=-DNO_LONG_LONG]
} else {
set options [list debug]
diff --git a/gdb/testsuite/gdb.base/whatis.c b/gdb/testsuite/gdb.base/whatis.c
index 53a4879..9c115ae 100644
--- a/gdb/testsuite/gdb.base/whatis.c
+++ b/gdb/testsuite/gdb.base/whatis.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 1992-2024 Free Software Foundation, Inc.
+ Copyright 1992-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/whatis.exp b/gdb/testsuite/gdb.base/whatis.exp
index 7111983..5fa29af 100644
--- a/gdb/testsuite/gdb.base/whatis.exp
+++ b/gdb/testsuite/gdb.base/whatis.exp
@@ -1,4 +1,4 @@
-# Copyright 1988-2024 Free Software Foundation, Inc.
+# Copyright 1988-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
# test running programs
#
-if [target_info exists no_long_long] {
+if {[target_info exists no_long_long]} {
set exec_opts [list debug additional_flags=-DNO_LONG_LONG]
} else {
set exec_opts [list debug]
@@ -122,7 +122,7 @@ proc do_test {dir options} {
"whatis unsigned long"
- if ![target_info exists no_long_long] {
+ if {![target_info exists no_long_long]} {
gdb_test "whatis v_unsigned_long_long" \
"type = (unsigned long long|long long unsigned int)" \
"whatis unsigned long long"
@@ -192,7 +192,7 @@ proc do_test {dir options} {
"type = (unsigned (int|long|long int)|long unsigned int) \\\[2\\\]" \
"whatis unsigned long array"
- if ![target_info exists no_long_long] {
+ if {![target_info exists no_long_long]} {
gdb_test "whatis v_unsigned_long_long_array" \
"type = (unsigned long long|long long unsigned int) \\\[2\\\]" \
"whatis unsigned long long array"
@@ -260,7 +260,7 @@ proc do_test {dir options} {
"type = (unsigned (int|long|long int)|long unsigned int) \\*" \
"whatis unsigned long pointer"
- if ![target_info exists no_long_long] {
+ if {![target_info exists no_long_long]} {
gdb_test "whatis v_long_long_pointer" \
"type = long long(| int) \\*" \
"whatis long long pointer"
@@ -464,7 +464,7 @@ proc do_test {dir options} {
"type = (unsigned (int|long|long int)|long unsigned int) \\($void\\)" \
"whatis unsigned long function"
- if ![target_info exists no_long_long] {
+ if {![target_info exists no_long_long]} {
gdb_test "whatis v_long_long_func" \
"type = long long(| int) \\($void\\)" \
"whatis long long function"
diff --git a/gdb/testsuite/gdb.base/with-mf-inc.c b/gdb/testsuite/gdb.base/with-mf-inc.c
index eeef8b3..c1443d7 100644
--- a/gdb/testsuite/gdb.base/with-mf-inc.c
+++ b/gdb/testsuite/gdb.base/with-mf-inc.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/with-mf-main.c b/gdb/testsuite/gdb.base/with-mf-main.c
index 2de1205..dde2e1e 100644
--- a/gdb/testsuite/gdb.base/with-mf-main.c
+++ b/gdb/testsuite/gdb.base/with-mf-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/with-mf.exp b/gdb/testsuite/gdb.base/with-mf.exp
index 6f2a1d8..3ac5e1d 100644
--- a/gdb/testsuite/gdb.base/with-mf.exp
+++ b/gdb/testsuite/gdb.base/with-mf.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,8 @@ if { [ensure_gdb_index $binfile] == -1 } {
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
gdb_test "with language ada -- print g_s" \
" = \\(a => 1, b => 2, c => 3\\)"
diff --git a/gdb/testsuite/gdb.base/with.c b/gdb/testsuite/gdb.base/with.c
index 67028e3..c7d9850 100644
--- a/gdb/testsuite/gdb.base/with.c
+++ b/gdb/testsuite/gdb.base/with.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/with.exp b/gdb/testsuite/gdb.base/with.exp
index 2e54825..cb69e33 100644
--- a/gdb/testsuite/gdb.base/with.exp
+++ b/gdb/testsuite/gdb.base/with.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,8 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
return -1
}
-clean_restart $binfile
+clean_restart
+gdb_load $binfile
# Test "maint with". VALUES is a list of values. A nested "with" is
# performed with each combination of pair of values from this list.
@@ -178,7 +179,8 @@ with_test_prefix "user-defined" {
# Check repeating.
with_test_prefix "repeat" {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
# "with" with no command reinvokes the previous command.
gdb_test "with language ada" \
@@ -209,9 +211,10 @@ with_test_prefix "repeat" {
# Basic run control.
with_test_prefix "run control" {
- clean_restart $binfile
+ clean_restart
+ gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -220,6 +223,49 @@ with_test_prefix "run control" {
"return 0;.*=>.*"
}
+# Some parameters are not global, but per-inferior. Make sure we save
+# and restore the correct value, based on the current inferior. If a
+# per-inferior parameter does not provide a getter for the value
+# (depending on the current inferior), the `with` environment will not
+# save (and later restore) the proper value if the last modified
+# inferior is not the current one.
+with_test_prefix "per-inferior parameters" {
+ clean_restart
+
+ # Add a second inferior.
+ gdb_test "add-inferior" "Added inferior 2"
+
+ # Set some parameters on each inferior.
+ foreach_with_prefix inf {1 2} {
+ gdb_test "inferior ${inf}" "Switching to inferior ${inf}.*" \
+ "switch to inferior ${inf} before set"
+ gdb_test_no_output "set inferior-tty /inf${inf}-tty"
+ gdb_test_no_output "set cwd /inf${inf}-cwd"
+ gdb_test_no_output "set args /inf${inf}-args"
+ gdb_test_no_output "set remote exec-file /inf${inf}-ref"
+ # Outputs a warning, ignore it.
+ gdb_test "set tdesc filename /inf${inf}-tf"
+ }
+
+ gdb_test "inferior 1" "Switching to inferior 1.*" "switch back to inferior 1"
+
+ gdb_test "with inferior-tty tmp-value -- print 1" " = 1"
+ gdb_test "show inferior-tty" "/inf1-tty.*"
+
+ gdb_test "with cwd tmp-value -- print 1" " = 1"
+ gdb_test "show cwd" "/inf1-cwd.*"
+
+ gdb_test "with args tmp-value -- print 1" " = 1"
+ gdb_test "show args" "/inf1-args.*"
+
+ gdb_test "with remote exec-file tmp-value -- print 1" " = 1"
+ gdb_test "show remote exec-file" "/inf1-ref.*"
+
+ # Again, this prints some warnings around the " = 1", ignore them.
+ gdb_test "with tdesc filename tmp-value -- print 1" " = 1.*"
+ gdb_test "show tdesc filename" "/inf1-tf.*"
+}
+
# Check errors.
with_test_prefix "errors" {
gdb_test "with" "Missing arguments\\."
diff --git a/gdb/testsuite/gdb.base/wrap-line.exp b/gdb/testsuite/gdb.base/wrap-line.exp
index d5001bf..f763588 100644
--- a/gdb/testsuite/gdb.base/wrap-line.exp
+++ b/gdb/testsuite/gdb.base/wrap-line.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,11 +30,11 @@ proc fill_line { width } {
# Take into account that the prompt also takes space.
set prefix [string length "(gdb) "]
- set start [expr $prefix + 1]
+ set start [expr {$prefix + 1}]
# Print chars.
for { set i $start } { $i <= $width } { incr i } {
- set c [expr $i % 10]
+ set c [expr {$i % 10}]
send_gdb $c
append res $c
}
@@ -93,7 +93,7 @@ proc test_wrap { width_auto_detected } {
if { $wrap_mode == $wrap_mode_terminal } {
gdb_assert { $gdb_width == $readline_width }
} elseif { $wrap_mode == $wrap_mode_readline } {
- gdb_assert { $gdb_width == [expr $readline_width + 1] }
+ gdb_assert { $gdb_width == [expr {$readline_width + 1}] }
} else {
set have_wrap 0
}
diff --git a/gdb/testsuite/gdb.base/write_mem.c b/gdb/testsuite/gdb.base/write_mem.c
index 33d0419..3de5bf9 100644
--- a/gdb/testsuite/gdb.base/write_mem.c
+++ b/gdb/testsuite/gdb.base/write_mem.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/write_mem.exp b/gdb/testsuite/gdb.base/write_mem.exp
index 3f2380c..3a07813 100644
--- a/gdb/testsuite/gdb.base/write_mem.exp
+++ b/gdb/testsuite/gdb.base/write_mem.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.base/wrong_frame_bt_full-main.c b/gdb/testsuite/gdb.base/wrong_frame_bt_full-main.c
index f960b47..eef098a 100644
--- a/gdb/testsuite/gdb.base/wrong_frame_bt_full-main.c
+++ b/gdb/testsuite/gdb.base/wrong_frame_bt_full-main.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/wrong_frame_bt_full-opaque.c b/gdb/testsuite/gdb.base/wrong_frame_bt_full-opaque.c
index 0c519c5..d7daaf5 100644
--- a/gdb/testsuite/gdb.base/wrong_frame_bt_full-opaque.c
+++ b/gdb/testsuite/gdb.base/wrong_frame_bt_full-opaque.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.base/wrong_frame_bt_full.exp b/gdb/testsuite/gdb.base/wrong_frame_bt_full.exp
index ddc34d4..56efd29 100644
--- a/gdb/testsuite/gdb.base/wrong_frame_bt_full.exp
+++ b/gdb/testsuite/gdb.base/wrong_frame_bt_full.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ if {[gdb_compile \
clean_restart ${main_testfile}
-if ![runto opaque_routine] {
+if {![runto opaque_routine]} {
untested "could not run to opaque_routine"
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/buffer-size.exp b/gdb/testsuite/gdb.btrace/buffer-size.exp
index 1008fa8..16958ae 100644
--- a/gdb/testsuite/gdb.btrace/buffer-size.exp
+++ b/gdb/testsuite/gdb.btrace/buffer-size.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <markus.t.metzger@intel.com>
#
@@ -20,11 +20,11 @@
require allow_btrace_tests
standard_testfile record_goto.c
-if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/cpu.exp b/gdb/testsuite/gdb.btrace/cpu.exp
index 26ffa09..b93882f 100644
--- a/gdb/testsuite/gdb.btrace/cpu.exp
+++ b/gdb/testsuite/gdb.btrace/cpu.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/data.c b/gdb/testsuite/gdb.btrace/data.c
index 352031a..4916290 100644
--- a/gdb/testsuite/gdb.btrace/data.c
+++ b/gdb/testsuite/gdb.btrace/data.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/data.exp b/gdb/testsuite/gdb.btrace/data.exp
index 30a946c..4245157 100644
--- a/gdb/testsuite/gdb.btrace/data.exp
+++ b/gdb/testsuite/gdb.btrace/data.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <markus.t.metzger@intel.com>
#
@@ -20,11 +20,11 @@
require allow_btrace_tests
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/delta.exp b/gdb/testsuite/gdb.btrace/delta.exp
index 4e4d06a..64e965d 100644
--- a/gdb/testsuite/gdb.btrace/delta.exp
+++ b/gdb/testsuite/gdb.btrace/delta.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <markus.t.metzger@intel.com>
#
@@ -20,11 +20,11 @@
require allow_btrace_tests
standard_testfile record_goto.c
-if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/dlopen-dso.c b/gdb/testsuite/gdb.btrace/dlopen-dso.c
index faf2d2f..a4abc0b 100644
--- a/gdb/testsuite/gdb.btrace/dlopen-dso.c
+++ b/gdb/testsuite/gdb.btrace/dlopen-dso.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/dlopen.c b/gdb/testsuite/gdb.btrace/dlopen.c
index 469fed8..e9f8109 100644
--- a/gdb/testsuite/gdb.btrace/dlopen.c
+++ b/gdb/testsuite/gdb.btrace/dlopen.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/dlopen.exp b/gdb/testsuite/gdb.btrace/dlopen.exp
index d0e5a65..1383bd9 100644
--- a/gdb/testsuite/gdb.btrace/dlopen.exp
+++ b/gdb/testsuite/gdb.btrace/dlopen.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/enable-new-thread.c b/gdb/testsuite/gdb.btrace/enable-new-thread.c
index 52be9a3..598dd74 100644
--- a/gdb/testsuite/gdb.btrace/enable-new-thread.c
+++ b/gdb/testsuite/gdb.btrace/enable-new-thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/enable-new-thread.exp b/gdb/testsuite/gdb.btrace/enable-new-thread.exp
index dbbe6a7..ab73d45 100644
--- a/gdb/testsuite/gdb.btrace/enable-new-thread.exp
+++ b/gdb/testsuite/gdb.btrace/enable-new-thread.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,11 +20,11 @@
require allow_btrace_tests
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/enable-running.c b/gdb/testsuite/gdb.btrace/enable-running.c
index ce1f8f6..f25641e 100644
--- a/gdb/testsuite/gdb.btrace/enable-running.c
+++ b/gdb/testsuite/gdb.btrace/enable-running.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/enable-running.exp b/gdb/testsuite/gdb.btrace/enable-running.exp
index 0d3555a..92ae566 100644
--- a/gdb/testsuite/gdb.btrace/enable-running.exp
+++ b/gdb/testsuite/gdb.btrace/enable-running.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ save_vars { GDBFLAGS } {
clean_restart $testfile
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/enable.c b/gdb/testsuite/gdb.btrace/enable.c
index fb7f0ea..a2a2559 100644
--- a/gdb/testsuite/gdb.btrace/enable.c
+++ b/gdb/testsuite/gdb.btrace/enable.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <christian.himpel@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/enable.exp b/gdb/testsuite/gdb.btrace/enable.exp
index 4e39c07..cc48cc2 100644
--- a/gdb/testsuite/gdb.btrace/enable.exp
+++ b/gdb/testsuite/gdb.btrace/enable.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <christian.himpel@intel.com>
#
@@ -35,11 +35,11 @@ gdb_test "record instruction-history" "No recording is currently active\\..*" "r
gdb_test "info record" "No recording is currently active\\." "info record without target"
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile {} {debug}] {
+if {[prepare_for_testing "failed to prepare" $testfile {} {debug}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -78,20 +78,20 @@ gdb_exit
load_lib gdbserver-support.exp
require allow_gdbserver_tests
clean_restart $testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# make sure record-btrace can be enabled after re-run
clean_restart $testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test_no_output "record btrace" "enable after restart"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test_no_output "record btrace" "enable after re-run"
diff --git a/gdb/testsuite/gdb.btrace/event-tracing-gap.c b/gdb/testsuite/gdb.btrace/event-tracing-gap.c
index b04f74d..fb30fdd 100644
--- a/gdb/testsuite/gdb.btrace/event-tracing-gap.c
+++ b/gdb/testsuite/gdb.btrace/event-tracing-gap.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/event-tracing-gap.exp b/gdb/testsuite/gdb.btrace/event-tracing-gap.exp
index d33e8e8..4ada8bb 100644
--- a/gdb/testsuite/gdb.btrace/event-tracing-gap.exp
+++ b/gdb/testsuite/gdb.btrace/event-tracing-gap.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/event-tracing.exp b/gdb/testsuite/gdb.btrace/event-tracing.exp
index 1a5eee0..3bd4db5 100644
--- a/gdb/testsuite/gdb.btrace/event-tracing.exp
+++ b/gdb/testsuite/gdb.btrace/event-tracing.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/exception.cc b/gdb/testsuite/gdb.btrace/exception.cc
index 855218f..9a621bd 100644
--- a/gdb/testsuite/gdb.btrace/exception.cc
+++ b/gdb/testsuite/gdb.btrace/exception.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/exception.exp b/gdb/testsuite/gdb.btrace/exception.exp
index 6ffdd2b..61a4bd9 100755
--- a/gdb/testsuite/gdb.btrace/exception.exp
+++ b/gdb/testsuite/gdb.btrace/exception.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <markus.t.metzger@intel.com>
#
@@ -22,12 +22,12 @@ require allow_btrace_tests
# We expect a specific function call history. This gets messed up with
# PIE on 32-bit.
standard_testfile exception.cc
-if [prepare_for_testing "failed to prepare" $testfile $srcfile \
- {nopie c++ debug}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
+ {nopie c++ debug}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/function_call_history.c b/gdb/testsuite/gdb.btrace/function_call_history.c
index a6a6bec..f078530 100644
--- a/gdb/testsuite/gdb.btrace/function_call_history.c
+++ b/gdb/testsuite/gdb.btrace/function_call_history.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <christian.himpel@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/function_call_history.exp b/gdb/testsuite/gdb.btrace/function_call_history.exp
index ce3d1a0..325099a 100644
--- a/gdb/testsuite/gdb.btrace/function_call_history.exp
+++ b/gdb/testsuite/gdb.btrace/function_call_history.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <christian.himpel@intel.com>
#
@@ -22,11 +22,11 @@ require allow_btrace_tests
# We expect a specific function call history. This gets messed up with
# PIE on 32-bit.
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile {} {nopie debug}] {
+if {[prepare_for_testing "failed to prepare" $testfile {} {nopie debug}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -226,7 +226,7 @@ gdb_test "record function-call-history /c 21, +11" [multi_line \
] "indented"
# make sure we can handle incomplete trace with respect to indentation
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# navigate to the fib in line 24 above
diff --git a/gdb/testsuite/gdb.btrace/gcore.exp b/gdb/testsuite/gdb.btrace/gcore.exp
index ff607b5..6d7ba5c 100644
--- a/gdb/testsuite/gdb.btrace/gcore.exp
+++ b/gdb/testsuite/gdb.btrace/gcore.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <markus.t.metzger@intel.com>
#
@@ -20,11 +20,11 @@
require allow_btrace_tests
standard_testfile record_goto.c
-if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/i386-ptwrite.S b/gdb/testsuite/gdb.btrace/i386-ptwrite.S
index 5c649cf..f0b6fa9 100644
--- a/gdb/testsuite/gdb.btrace/i386-ptwrite.S
+++ b/gdb/testsuite/gdb.btrace/i386-ptwrite.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/i686-record_goto.S b/gdb/testsuite/gdb.btrace/i686-record_goto.S
index c19fcdf..e02615f 100644
--- a/gdb/testsuite/gdb.btrace/i686-record_goto.S
+++ b/gdb/testsuite/gdb.btrace/i686-record_goto.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/i686-tailcall-only.S b/gdb/testsuite/gdb.btrace/i686-tailcall-only.S
index 753fe56..295c9e6 100644
--- a/gdb/testsuite/gdb.btrace/i686-tailcall-only.S
+++ b/gdb/testsuite/gdb.btrace/i686-tailcall-only.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/i686-tailcall.S b/gdb/testsuite/gdb.btrace/i686-tailcall.S
index 29cbf57..b60136d 100644
--- a/gdb/testsuite/gdb.btrace/i686-tailcall.S
+++ b/gdb/testsuite/gdb.btrace/i686-tailcall.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/instruction_history.S b/gdb/testsuite/gdb.btrace/instruction_history.S
index c7fa78a..9f969a6 100644
--- a/gdb/testsuite/gdb.btrace/instruction_history.S
+++ b/gdb/testsuite/gdb.btrace/instruction_history.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <christian.himpel@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/instruction_history.c b/gdb/testsuite/gdb.btrace/instruction_history.c
index 7304e42..ea3a16b 100644
--- a/gdb/testsuite/gdb.btrace/instruction_history.c
+++ b/gdb/testsuite/gdb.btrace/instruction_history.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <christian.himpel@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/instruction_history.exp b/gdb/testsuite/gdb.btrace/instruction_history.exp
index d3ff313..fb68b33 100644
--- a/gdb/testsuite/gdb.btrace/instruction_history.exp
+++ b/gdb/testsuite/gdb.btrace/instruction_history.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <christian.himpel@intel.com>
#
@@ -20,11 +20,11 @@
require allow_btrace_tests
standard_testfile .c .S
-if [prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2" {debug}] {
+if {[prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2" {debug}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/multi-inferior.c b/gdb/testsuite/gdb.btrace/multi-inferior.c
index fb4ffc2..f2b8dba 100644
--- a/gdb/testsuite/gdb.btrace/multi-inferior.c
+++ b/gdb/testsuite/gdb.btrace/multi-inferior.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/multi-inferior.exp b/gdb/testsuite/gdb.btrace/multi-inferior.exp
index 6996b18..fc75233 100644
--- a/gdb/testsuite/gdb.btrace/multi-inferior.exp
+++ b/gdb/testsuite/gdb.btrace/multi-inferior.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,17 +24,19 @@
require allow_btrace_tests
+require allow_multi_inferior_tests
+
require !use_gdb_stub
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile {} {debug}] {
+if {[prepare_for_testing "failed to prepare" $testfile {} {debug}]} {
return -1
}
set host_binfile [gdb_remote_download host $binfile]
with_test_prefix "inferior 1" {
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
}
@@ -44,7 +46,7 @@ with_test_prefix "inferior 2" {
"add second inferior"
gdb_test "inferior 2" "Switching to inferior 2.*"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -63,7 +65,7 @@ with_test_prefix "inferior 3" {
"add third inferior"
gdb_test "inferior 3" "Switching to inferior 3.*"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/multi-thread-step.c b/gdb/testsuite/gdb.btrace/multi-thread-step.c
index 18ade27..1a72a41 100644
--- a/gdb/testsuite/gdb.btrace/multi-thread-step.c
+++ b/gdb/testsuite/gdb.btrace/multi-thread-step.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/multi-thread-step.exp b/gdb/testsuite/gdb.btrace/multi-thread-step.exp
index cd20e8a..7a769b5 100644
--- a/gdb/testsuite/gdb.btrace/multi-thread-step.exp
+++ b/gdb/testsuite/gdb.btrace/multi-thread-step.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <markus.t.metzger@intel.com>
#
@@ -26,7 +26,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" "$binfile" executable {debu
}
clean_restart $testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/nohist.exp b/gdb/testsuite/gdb.btrace/nohist.exp
index ac6a41c..220a380 100644
--- a/gdb/testsuite/gdb.btrace/nohist.exp
+++ b/gdb/testsuite/gdb.btrace/nohist.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <markus.t.metzger@intel.com>
#
@@ -20,11 +20,11 @@
require allow_btrace_tests
standard_testfile record_goto.c
-if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/non-stop.c b/gdb/testsuite/gdb.btrace/non-stop.c
index 852ef05..6748da0 100644
--- a/gdb/testsuite/gdb.btrace/non-stop.c
+++ b/gdb/testsuite/gdb.btrace/non-stop.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/non-stop.exp b/gdb/testsuite/gdb.btrace/non-stop.exp
index 8397c20..bc5ebdb 100644
--- a/gdb/testsuite/gdb.btrace/non-stop.exp
+++ b/gdb/testsuite/gdb.btrace/non-stop.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ save_vars { GDBFLAGS } {
clean_restart $testfile
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/null-deref.c b/gdb/testsuite/gdb.btrace/null-deref.c
index f0de31f..1ad1b81 100644
--- a/gdb/testsuite/gdb.btrace/null-deref.c
+++ b/gdb/testsuite/gdb.btrace/null-deref.c
@@ -1,4 +1,4 @@
-/* Copyright 2024 Free Software Foundation, Inc.
+/* Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/ptwrite.c b/gdb/testsuite/gdb.btrace/ptwrite.c
index e10b885..3fb5cd2 100644
--- a/gdb/testsuite/gdb.btrace/ptwrite.c
+++ b/gdb/testsuite/gdb.btrace/ptwrite.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/ptwrite.exp b/gdb/testsuite/gdb.btrace/ptwrite.exp
index 7f1adad..5207488 100644
--- a/gdb/testsuite/gdb.btrace/ptwrite.exp
+++ b/gdb/testsuite/gdb.btrace/ptwrite.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ require allow_btrace_ptw_tests allow_python_tests
set opts {}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.btrace/ptwrite.exp COMPILE=1"
standard_testfile ptwrite.c
lappend opts debug additional_flags=-mptwrite
@@ -36,7 +36,7 @@ if [info exists COMPILE] {
return -1
}
-if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile $opts]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/reconnect.c b/gdb/testsuite/gdb.btrace/reconnect.c
index 0f64a8e..ad1f6e5 100644
--- a/gdb/testsuite/gdb.btrace/reconnect.c
+++ b/gdb/testsuite/gdb.btrace/reconnect.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <tim.wiederhake@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/reconnect.exp b/gdb/testsuite/gdb.btrace/reconnect.exp
index 41f702a..44a9121 100644
--- a/gdb/testsuite/gdb.btrace/reconnect.exp
+++ b/gdb/testsuite/gdb.btrace/reconnect.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <tim.wiederhake@intel.com>
#
@@ -23,7 +23,7 @@ require allow_btrace_tests
require allow_gdbserver_tests
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/record_goto-step.exp b/gdb/testsuite/gdb.btrace/record_goto-step.exp
index e7adc62..d881cf7 100644
--- a/gdb/testsuite/gdb.btrace/record_goto-step.exp
+++ b/gdb/testsuite/gdb.btrace/record_goto-step.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <markus.t.metzger@intel.com>
#
@@ -20,11 +20,11 @@
require allow_btrace_tests
standard_testfile record_goto.c
-if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/record_goto.c b/gdb/testsuite/gdb.btrace/record_goto.c
index 4f18f9c..624a8fd 100644
--- a/gdb/testsuite/gdb.btrace/record_goto.c
+++ b/gdb/testsuite/gdb.btrace/record_goto.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/record_goto.exp b/gdb/testsuite/gdb.btrace/record_goto.exp
index cd6ab38..f7dbe10 100644
--- a/gdb/testsuite/gdb.btrace/record_goto.exp
+++ b/gdb/testsuite/gdb.btrace/record_goto.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <markus.t.metzger@intel.com>
#
@@ -28,7 +28,7 @@ require allow_btrace_tests
# Luckily, they are similar enough that a single test script can handle
# both.
set opts {}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.btrace/record_goto.exp COMPILE=1"
standard_testfile record_goto.c
lappend opts debug
@@ -43,11 +43,11 @@ if [info exists COMPILE] {
return -1
}
-if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile $opts]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/rn-dl-bind.c b/gdb/testsuite/gdb.btrace/rn-dl-bind.c
index 3d216a2..da784cd 100644
--- a/gdb/testsuite/gdb.btrace/rn-dl-bind.c
+++ b/gdb/testsuite/gdb.btrace/rn-dl-bind.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/rn-dl-bind.exp b/gdb/testsuite/gdb.btrace/rn-dl-bind.exp
index 756be2f..22ce8e5 100644
--- a/gdb/testsuite/gdb.btrace/rn-dl-bind.exp
+++ b/gdb/testsuite/gdb.btrace/rn-dl-bind.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <markus.t.metzger@intel.com>
#
@@ -24,12 +24,12 @@
require allow_btrace_tests
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile $srcfile \
- {debug ldflags=-Wl,-z,lazy}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
+ {debug ldflags=-Wl,-z,lazy}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/segv.c b/gdb/testsuite/gdb.btrace/segv.c
index 742eec1..414afd2 100644
--- a/gdb/testsuite/gdb.btrace/segv.c
+++ b/gdb/testsuite/gdb.btrace/segv.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/segv.exp b/gdb/testsuite/gdb.btrace/segv.exp
index 9804b93..509bcf1 100644
--- a/gdb/testsuite/gdb.btrace/segv.exp
+++ b/gdb/testsuite/gdb.btrace/segv.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <markus.t.metzger@intel.com>
#
@@ -20,10 +20,10 @@
require allow_btrace_tests
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/step.exp b/gdb/testsuite/gdb.btrace/step.exp
index 0adc18b..e96714a 100644
--- a/gdb/testsuite/gdb.btrace/step.exp
+++ b/gdb/testsuite/gdb.btrace/step.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <markus.t.metzger@intel.com>
#
@@ -20,11 +20,11 @@
require allow_btrace_tests
standard_testfile record_goto.c
-if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/stepi.exp b/gdb/testsuite/gdb.btrace/stepi.exp
index 689bc79..a37d144 100644
--- a/gdb/testsuite/gdb.btrace/stepi.exp
+++ b/gdb/testsuite/gdb.btrace/stepi.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <markus.t.metzger@intel.com>
#
@@ -26,7 +26,7 @@ require allow_btrace_tests
#
# Luckily, they are similar enough that a single test script can handle
# both.
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.btrace/stepi.exp COMPILE=1"
standard_testfile record_goto.c
lappend opts debug
@@ -41,11 +41,11 @@ if [info exists COMPILE] {
return -1
}
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/tailcall-only.c b/gdb/testsuite/gdb.btrace/tailcall-only.c
index 726cf11..02b517a 100644
--- a/gdb/testsuite/gdb.btrace/tailcall-only.c
+++ b/gdb/testsuite/gdb.btrace/tailcall-only.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/tailcall-only.exp b/gdb/testsuite/gdb.btrace/tailcall-only.exp
index ae3b04e..5010d16 100644
--- a/gdb/testsuite/gdb.btrace/tailcall-only.exp
+++ b/gdb/testsuite/gdb.btrace/tailcall-only.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ require allow_btrace_tests
# Luckily, they are similar enough that a single test script can handle
# both.
set opts {}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.btrace/tailcall-only.exp COMPILE=1"
standard_testfile tailcall-only.c
lappend opts debug optimize=-O2
@@ -45,11 +45,11 @@ if [info exists COMPILE] {
return -1
}
-if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile $opts]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/tailcall.c b/gdb/testsuite/gdb.btrace/tailcall.c
index 1f08e5a..40f16b1 100644
--- a/gdb/testsuite/gdb.btrace/tailcall.c
+++ b/gdb/testsuite/gdb.btrace/tailcall.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/tailcall.exp b/gdb/testsuite/gdb.btrace/tailcall.exp
index 198cfa9..d4d445c 100644
--- a/gdb/testsuite/gdb.btrace/tailcall.exp
+++ b/gdb/testsuite/gdb.btrace/tailcall.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <markus.t.metzger@intel.com>
#
@@ -27,7 +27,7 @@ require allow_btrace_tests
# Luckily, they are similar enough that a single test script can handle
# both.
set opts {}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.btrace/tailcall.exp COMPILE=1"
standard_testfile tailcall.c
lappend opts debug optimize=-O2
@@ -42,10 +42,10 @@ if [info exists COMPILE] {
return -1
}
-if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile $opts]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/tsx.c b/gdb/testsuite/gdb.btrace/tsx.c
index 49a87c2..f27eb14 100644
--- a/gdb/testsuite/gdb.btrace/tsx.c
+++ b/gdb/testsuite/gdb.btrace/tsx.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/tsx.exp b/gdb/testsuite/gdb.btrace/tsx.exp
index d312b15..6da3fa7 100644
--- a/gdb/testsuite/gdb.btrace/tsx.exp
+++ b/gdb/testsuite/gdb.btrace/tsx.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,11 +18,11 @@
require allow_btrace_pt_tests allow_tsx_tests
standard_testfile .c x86-tsx.S
-if [prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2" {debug}] {
+if {[prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2" {debug}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/unknown_functions.c b/gdb/testsuite/gdb.btrace/unknown_functions.c
index 0172fc9..217f87c 100644
--- a/gdb/testsuite/gdb.btrace/unknown_functions.c
+++ b/gdb/testsuite/gdb.btrace/unknown_functions.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/unknown_functions.exp b/gdb/testsuite/gdb.btrace/unknown_functions.exp
index b335e74..0696d8b 100644
--- a/gdb/testsuite/gdb.btrace/unknown_functions.exp
+++ b/gdb/testsuite/gdb.btrace/unknown_functions.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <markus.t.metzger@intel.com>
#
@@ -25,12 +25,12 @@ standard_testfile
# PIE on 32-bit.
#
# Also discard local symbols.
-if [prepare_for_testing "failed to prepare" $testfile $srcfile \
- {ldflags=-Wl,-x nopie}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
+ {ldflags=-Wl,-x nopie}]} {
return -1
}
-if ![runto test] {
+if {![runto test]} {
return -1
}
diff --git a/gdb/testsuite/gdb.btrace/vdso.c b/gdb/testsuite/gdb.btrace/vdso.c
index 2f518b16..b3d1b11 100644
--- a/gdb/testsuite/gdb.btrace/vdso.c
+++ b/gdb/testsuite/gdb.btrace/vdso.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/vdso.exp b/gdb/testsuite/gdb.btrace/vdso.exp
index edbb222..8bf63ac 100644
--- a/gdb/testsuite/gdb.btrace/vdso.exp
+++ b/gdb/testsuite/gdb.btrace/vdso.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <markus.t.metzger@intel.com>
#
@@ -23,11 +23,11 @@
require allow_btrace_tests
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -47,7 +47,7 @@ with_test_prefix "replay" {
set replay_gettimeofday [capture_command_output "disassemble gettimeofday" ""]
# the two disassemblies must be identical
- if ![string compare $live_gettimeofday $replay_gettimeofday] {
+ if {![string compare $live_gettimeofday $replay_gettimeofday]} {
pass "disassemble gettimeofday"
} else {
fail "disassemble gettimeofday"
diff --git a/gdb/testsuite/gdb.btrace/x86-tsx.S b/gdb/testsuite/gdb.btrace/x86-tsx.S
index 754db8a..6335e3d 100644
--- a/gdb/testsuite/gdb.btrace/x86-tsx.S
+++ b/gdb/testsuite/gdb.btrace/x86-tsx.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/x86_64-ptwrite.S b/gdb/testsuite/gdb.btrace/x86_64-ptwrite.S
index be4d204..bdd9e39 100644
--- a/gdb/testsuite/gdb.btrace/x86_64-ptwrite.S
+++ b/gdb/testsuite/gdb.btrace/x86_64-ptwrite.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/x86_64-record_goto.S b/gdb/testsuite/gdb.btrace/x86_64-record_goto.S
index f1e3d4e..c8ac53d 100644
--- a/gdb/testsuite/gdb.btrace/x86_64-record_goto.S
+++ b/gdb/testsuite/gdb.btrace/x86_64-record_goto.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
diff --git a/gdb/testsuite/gdb.btrace/x86_64-tailcall-only.S b/gdb/testsuite/gdb.btrace/x86_64-tailcall-only.S
index 6c41e44..ec73635 100644
--- a/gdb/testsuite/gdb.btrace/x86_64-tailcall-only.S
+++ b/gdb/testsuite/gdb.btrace/x86_64-tailcall-only.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.btrace/x86_64-tailcall.S b/gdb/testsuite/gdb.btrace/x86_64-tailcall.S
index e3679cc..8b96fad 100644
--- a/gdb/testsuite/gdb.btrace/x86_64-tailcall.S
+++ b/gdb/testsuite/gdb.btrace/x86_64-tailcall.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
diff --git a/gdb/testsuite/gdb.compile/compile-constvar.S b/gdb/testsuite/gdb.compile/compile-constvar.S
index 85532a8..61f688a 100644
--- a/gdb/testsuite/gdb.compile/compile-constvar.S
+++ b/gdb/testsuite/gdb.compile/compile-constvar.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-constvar.c b/gdb/testsuite/gdb.compile/compile-constvar.c
index e45b7cb..a230d4d 100644
--- a/gdb/testsuite/gdb.compile/compile-constvar.c
+++ b/gdb/testsuite/gdb.compile/compile-constvar.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-anonymous.cc b/gdb/testsuite/gdb.compile/compile-cplus-anonymous.cc
index d327564..266884d 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-anonymous.cc
+++ b/gdb/testsuite/gdb.compile/compile-cplus-anonymous.cc
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-anonymous.exp b/gdb/testsuite/gdb.compile/compile-cplus-anonymous.exp
index ddad628..184aa94 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-anonymous.exp
+++ b/gdb/testsuite/gdb.compile/compile-cplus-anonymous.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-array-decay.cc b/gdb/testsuite/gdb.compile/compile-cplus-array-decay.cc
index 6cac7f4..3acd1bb 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-array-decay.cc
+++ b/gdb/testsuite/gdb.compile/compile-cplus-array-decay.cc
@@ -1,4 +1,4 @@
-/* Copyright 2017-2024 Free Software Foundation, Inc.
+/* Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-array-decay.exp b/gdb/testsuite/gdb.compile/compile-cplus-array-decay.exp
index c7d15ce..82238af 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-array-decay.exp
+++ b/gdb/testsuite/gdb.compile/compile-cplus-array-decay.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-inherit.cc b/gdb/testsuite/gdb.compile/compile-cplus-inherit.cc
index 2955835..01b1995 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-inherit.cc
+++ b/gdb/testsuite/gdb.compile/compile-cplus-inherit.cc
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-inherit.exp b/gdb/testsuite/gdb.compile/compile-cplus-inherit.exp
index 9ef1e83..5ad3114 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-inherit.exp
+++ b/gdb/testsuite/gdb.compile/compile-cplus-inherit.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-member.cc b/gdb/testsuite/gdb.compile/compile-cplus-member.cc
index 4131f17..9c10c27 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-member.cc
+++ b/gdb/testsuite/gdb.compile/compile-cplus-member.cc
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-member.exp b/gdb/testsuite/gdb.compile/compile-cplus-member.exp
index ac9111c..605a087 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-member.exp
+++ b/gdb/testsuite/gdb.compile/compile-cplus-member.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-method.cc b/gdb/testsuite/gdb.compile/compile-cplus-method.cc
index 5f057c4..61cfca1 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-method.cc
+++ b/gdb/testsuite/gdb.compile/compile-cplus-method.cc
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-method.exp b/gdb/testsuite/gdb.compile/compile-cplus-method.exp
index bcbfbb0..616acc5 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-method.exp
+++ b/gdb/testsuite/gdb.compile/compile-cplus-method.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-mod.c b/gdb/testsuite/gdb.compile/compile-cplus-mod.c
index 2df0437..c578f326 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-mod.c
+++ b/gdb/testsuite/gdb.compile/compile-cplus-mod.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-namespace.cc b/gdb/testsuite/gdb.compile/compile-cplus-namespace.cc
index e3f61f2..abfd07a 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-namespace.cc
+++ b/gdb/testsuite/gdb.compile/compile-cplus-namespace.cc
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-namespace.exp b/gdb/testsuite/gdb.compile/compile-cplus-namespace.exp
index 2abc366..e556806 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-namespace.exp
+++ b/gdb/testsuite/gdb.compile/compile-cplus-namespace.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-nested.cc b/gdb/testsuite/gdb.compile/compile-cplus-nested.cc
index 2c8f669..c32537b 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-nested.cc
+++ b/gdb/testsuite/gdb.compile/compile-cplus-nested.cc
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-nested.exp b/gdb/testsuite/gdb.compile/compile-cplus-nested.exp
index 247d270..dd99a17 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-nested.exp
+++ b/gdb/testsuite/gdb.compile/compile-cplus-nested.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-print.c b/gdb/testsuite/gdb.compile/compile-cplus-print.c
index 130d822..57c6245 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-print.c
+++ b/gdb/testsuite/gdb.compile/compile-cplus-print.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-print.exp b/gdb/testsuite/gdb.compile/compile-cplus-print.exp
index e4413f0..e4e2782 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-print.exp
+++ b/gdb/testsuite/gdb.compile/compile-cplus-print.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ require is_c_compiler_gcc
require allow_compile_tests
set options {}
-if [test_compiler_info gcc*] {
+if {[test_compiler_info gcc*]} {
lappend options additional_flags=-g3
lappend options additional_flags=-std=gnu++11
lappend options c++
@@ -30,13 +30,14 @@ if [test_compiler_info gcc*] {
set srcfilesoptions [list ${srcfile} ${options}]
-if { [eval build_executable_from_specs ${testfile}.exp $testfile {$options} ${srcfilesoptions}] } {
+if { [build_executable_from_specs $testfile.exp $testfile $options \
+ {*}$srcfilesoptions] } {
return -1
}
clean_restart ${testfile}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-virtual.cc b/gdb/testsuite/gdb.compile/compile-cplus-virtual.cc
index 031309a..a64ad98 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-virtual.cc
+++ b/gdb/testsuite/gdb.compile/compile-cplus-virtual.cc
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-virtual.exp b/gdb/testsuite/gdb.compile/compile-cplus-virtual.exp
index a770208..7bbe028 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-virtual.exp
+++ b/gdb/testsuite/gdb.compile/compile-cplus-virtual.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus.c b/gdb/testsuite/gdb.compile/compile-cplus.c
index 26979c1..83a3a64 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus.c
+++ b/gdb/testsuite/gdb.compile/compile-cplus.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-cplus.exp b/gdb/testsuite/gdb.compile/compile-cplus.exp
index 35ae692..66ac76f 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus.exp
+++ b/gdb/testsuite/gdb.compile/compile-cplus.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,7 +39,9 @@ if { $srcfile3 != "" } {
}
set srcfile4options "nodebug c++"
lappend srcfilesoptions $srcfile4 $srcfile4options
-if { [eval build_executable_from_specs ${testfile}.exp $testfile {$options} ${srcfilesoptions}] } {
+
+if { [build_executable_from_specs $testfile.exp $testfile $options \
+ {*}$srcfilesoptions] } {
return -1
}
@@ -52,7 +54,7 @@ clean_restart ${testfile}
gdb_test_no_output "set language c++" \
"Set language to C++"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.compile/compile-ifunc.c b/gdb/testsuite/gdb.compile/compile-ifunc.c
index dc5b251..791ad9c 100644
--- a/gdb/testsuite/gdb.compile/compile-ifunc.c
+++ b/gdb/testsuite/gdb.compile/compile-ifunc.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-ifunc.exp b/gdb/testsuite/gdb.compile/compile-ifunc.exp
index e490890..dbe84d5 100644
--- a/gdb/testsuite/gdb.compile/compile-ifunc.exp
+++ b/gdb/testsuite/gdb.compile/compile-ifunc.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ standard_testfile
require is_c_compiler_gcc
set flags ""
-if [test_compiler_info gcc*] {
+if {[test_compiler_info gcc*]} {
set flags additional_flags=-Wno-attribute-alias
}
@@ -35,7 +35,7 @@ with_test_prefix "nodebug" {
return -1
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -65,7 +65,7 @@ with_test_prefix "debug" {
return -1
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
# gnu_ifunc (10): error: too many arguments to function 'gnu_ifunc'
diff --git a/gdb/testsuite/gdb.compile/compile-mod.c b/gdb/testsuite/gdb.compile/compile-mod.c
index 4e65aa3..f86a779 100644
--- a/gdb/testsuite/gdb.compile/compile-mod.c
+++ b/gdb/testsuite/gdb.compile/compile-mod.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-nodebug.c b/gdb/testsuite/gdb.compile/compile-nodebug.c
index e068aae..0c5641d 100644
--- a/gdb/testsuite/gdb.compile/compile-nodebug.c
+++ b/gdb/testsuite/gdb.compile/compile-nodebug.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-ops.c b/gdb/testsuite/gdb.compile/compile-ops.c
index 7c6b483..2c6ab46 100644
--- a/gdb/testsuite/gdb.compile/compile-ops.c
+++ b/gdb/testsuite/gdb.compile/compile-ops.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-ops.exp b/gdb/testsuite/gdb.compile/compile-ops.exp
index cfbe2b0..e7103bc 100644
--- a/gdb/testsuite/gdb.compile/compile-ops.exp
+++ b/gdb/testsuite/gdb.compile/compile-ops.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,328 +33,328 @@ standard_testfile .c -dbg.S
#
set assert_tos_non0 {
- bra 3
- skip -3
+ DW_OP_bra 3
+ DW_OP_skip -3
}
set assert_tos_0 [subst {
- lit0
- eq
+ DW_OP_lit0
+ DW_OP_eq
$assert_tos_non0
}]
set program [subst {
- lit0
- nop
+ DW_OP_lit0
+ DW_OP_nop
$assert_tos_0
- lit1
- const1u 1
- eq
+ DW_OP_lit1
+ DW_OP_const1u 1
+ DW_OP_eq
$assert_tos_non0
- lit16
- const2u 16
- eq
+ DW_OP_lit16
+ DW_OP_const2u 16
+ DW_OP_eq
$assert_tos_non0
- lit31
- const4u 31
- ne
+ DW_OP_lit31
+ DW_OP_const4u 31
+ DW_OP_ne
$assert_tos_0
- lit1
- neg
- const1s -1
- eq
- $assert_tos_non0
- lit16
- neg
- const2s -16
- ne
+ DW_OP_lit1
+ DW_OP_neg
+ DW_OP_const1s -1
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit16
+ DW_OP_neg
+ DW_OP_const2s -16
+ DW_OP_ne
$assert_tos_0
- lit31
- const4s -31
- neg
- ne
+ DW_OP_lit31
+ DW_OP_const4s -31
+ DW_OP_neg
+ DW_OP_ne
$assert_tos_0
- lit7
- dup
- plus_uconst 2
- lit9
- eq
- $assert_tos_non0
- lit7
- eq
- $assert_tos_non0
- lit20
- lit1
- drop
- lit20
- eq
- $assert_tos_non0
- lit17
- lit19
- over
- lit17
- eq
- $assert_tos_non0
- lit19
- eq
- $assert_tos_non0
- lit17
- eq
- $assert_tos_non0
- lit1
- lit2
- lit3
- lit4
- pick 2
- lit2
- eq
- $assert_tos_non0
- lit4
- eq
- $assert_tos_non0
- lit3
- eq
- $assert_tos_non0
- pick 0
- lit2
- eq
- $assert_tos_non0
- lit2
- eq
- $assert_tos_non0
- lit1
- eq
- $assert_tos_non0
- lit6
- lit12
- swap
- lit6
- eq
- $assert_tos_non0
- lit12
- eq
- $assert_tos_non0
- lit7
- lit8
- lit9
- rot
- lit8
- eq
- $assert_tos_non0
- lit7
- eq
- $assert_tos_non0
- lit9
- eq
- $assert_tos_non0
- lit7
- abs
- lit7
- eq
- $assert_tos_non0
- const1s -123
- abs
- const1u 123
- eq
- $assert_tos_non0
- lit3
- lit6
- and
- lit2
- eq
- $assert_tos_non0
- lit3
- lit6
- or
- lit7
- eq
- $assert_tos_non0
- lit17
- lit2
- minus
- lit15
- eq
+ DW_OP_lit7
+ DW_OP_dup
+ DW_OP_plus_uconst 2
+ DW_OP_lit9
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit7
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit20
+ DW_OP_lit1
+ DW_OP_drop
+ DW_OP_lit20
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit17
+ DW_OP_lit19
+ DW_OP_over
+ DW_OP_lit17
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit19
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit17
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit1
+ DW_OP_lit2
+ DW_OP_lit3
+ DW_OP_lit4
+ DW_OP_pick 2
+ DW_OP_lit2
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit4
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit3
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_pick 0
+ DW_OP_lit2
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit2
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit1
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit6
+ DW_OP_lit12
+ DW_OP_swap
+ DW_OP_lit6
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit12
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit7
+ DW_OP_lit8
+ DW_OP_lit9
+ DW_OP_rot
+ DW_OP_lit8
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit7
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit9
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit7
+ DW_OP_abs
+ DW_OP_lit7
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_const1s -123
+ DW_OP_abs
+ DW_OP_const1u 123
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit3
+ DW_OP_lit6
+ DW_OP_and
+ DW_OP_lit2
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit3
+ DW_OP_lit6
+ DW_OP_or
+ DW_OP_lit7
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit17
+ DW_OP_lit2
+ DW_OP_minus
+ DW_OP_lit15
+ DW_OP_eq
$assert_tos_non0
# Divide is signed truncating toward zero.
- const1s -6
- const1s -2
- div
- lit3
- eq
- $assert_tos_non0
- const1s -7
- const1s 3
- div
- const1s -2
- eq
+ DW_OP_const1s -6
+ DW_OP_const1s -2
+ DW_OP_div
+ DW_OP_lit3
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_const1s -7
+ DW_OP_const1s 3
+ DW_OP_div
+ DW_OP_const1s -2
+ DW_OP_eq
$assert_tos_non0
# Modulo is unsigned.
- const1s -6
- const1s -4
- mod
- const1s -6
- eq
- $assert_tos_non0
- const1s -6
- lit4
- mod
- lit2
- eq
- $assert_tos_non0
- lit6
- const1s -4
- mod
- lit6
- eq
+ DW_OP_const1s -6
+ DW_OP_const1s -4
+ DW_OP_mod
+ DW_OP_const1s -6
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_const1s -6
+ DW_OP_lit4
+ DW_OP_mod
+ DW_OP_lit2
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit6
+ DW_OP_const1s -4
+ DW_OP_mod
+ DW_OP_lit6
+ DW_OP_eq
$assert_tos_non0
# Signed modulo can be implemented using 'over over div mul minus'.
- const1s -6
- const1s -4
- over
- over
- div
- mul
- minus
- const1s -2
- eq
- $assert_tos_non0
- const1s -7
- lit3
- over
- over
- div
- mul
- minus
- const1s -1
- eq
- $assert_tos_non0
- lit7
- const1s -3
- over
- over
- div
- mul
- minus
- lit1
- eq
- $assert_tos_non0
- lit16
- lit31
- plus_uconst 1
- mul
- const2u 512
- eq
- $assert_tos_non0
- lit5
- not
- lit31
- and
- lit26
- eq
- $assert_tos_non0
- lit12
- lit31
- plus
- const1u 43
- eq
- $assert_tos_non0
- const1s -6
- lit2
- plus
- const1s -4
- eq
- $assert_tos_non0
- const1s -6
- plus_uconst 3
- const1s -3
- eq
- $assert_tos_non0
- lit16
- lit4
- shl
- const2u 256
- eq
- $assert_tos_non0
- lit16
- lit3
- shr
- lit2
- eq
- $assert_tos_non0
- const1s -16
- lit3
- shra
- const1s -2
- eq
- $assert_tos_non0
- lit3
- lit6
- xor
- lit5
- eq
- $assert_tos_non0
- lit3
- lit6
- le
- $assert_tos_non0
- lit3
- lit3
- le
- $assert_tos_non0
- lit6
- lit3
- le
+ DW_OP_const1s -6
+ DW_OP_const1s -4
+ DW_OP_over
+ DW_OP_over
+ DW_OP_div
+ DW_OP_mul
+ DW_OP_minus
+ DW_OP_const1s -2
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_const1s -7
+ DW_OP_lit3
+ DW_OP_over
+ DW_OP_over
+ DW_OP_div
+ DW_OP_mul
+ DW_OP_minus
+ DW_OP_const1s -1
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit7
+ DW_OP_const1s -3
+ DW_OP_over
+ DW_OP_over
+ DW_OP_div
+ DW_OP_mul
+ DW_OP_minus
+ DW_OP_lit1
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit16
+ DW_OP_lit31
+ DW_OP_plus_uconst 1
+ DW_OP_mul
+ DW_OP_const2u 512
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit5
+ DW_OP_not
+ DW_OP_lit31
+ DW_OP_and
+ DW_OP_lit26
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit12
+ DW_OP_lit31
+ DW_OP_plus
+ DW_OP_const1u 43
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_const1s -6
+ DW_OP_lit2
+ DW_OP_plus
+ DW_OP_const1s -4
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_const1s -6
+ DW_OP_plus_uconst 3
+ DW_OP_const1s -3
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit16
+ DW_OP_lit4
+ DW_OP_shl
+ DW_OP_const2u 256
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit16
+ DW_OP_lit3
+ DW_OP_shr
+ DW_OP_lit2
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_const1s -16
+ DW_OP_lit3
+ DW_OP_shra
+ DW_OP_const1s -2
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit3
+ DW_OP_lit6
+ DW_OP_xor
+ DW_OP_lit5
+ DW_OP_eq
+ $assert_tos_non0
+ DW_OP_lit3
+ DW_OP_lit6
+ DW_OP_le
+ $assert_tos_non0
+ DW_OP_lit3
+ DW_OP_lit3
+ DW_OP_le
+ $assert_tos_non0
+ DW_OP_lit6
+ DW_OP_lit3
+ DW_OP_le
$assert_tos_0
- lit3
- lit6
- lt
+ DW_OP_lit3
+ DW_OP_lit6
+ DW_OP_lt
$assert_tos_non0
- lit3
- lit3
- lt
+ DW_OP_lit3
+ DW_OP_lit3
+ DW_OP_lt
$assert_tos_0
- lit6
- lit3
- lt
+ DW_OP_lit6
+ DW_OP_lit3
+ DW_OP_lt
$assert_tos_0
- lit3
- lit6
- ge
+ DW_OP_lit3
+ DW_OP_lit6
+ DW_OP_ge
$assert_tos_0
- lit3
- lit3
- ge
+ DW_OP_lit3
+ DW_OP_lit3
+ DW_OP_ge
$assert_tos_non0
- lit6
- lit3
- ge
+ DW_OP_lit6
+ DW_OP_lit3
+ DW_OP_ge
$assert_tos_non0
- lit3
- lit6
- gt
+ DW_OP_lit3
+ DW_OP_lit6
+ DW_OP_gt
$assert_tos_0
- lit3
- lit3
- gt
+ DW_OP_lit3
+ DW_OP_lit3
+ DW_OP_gt
$assert_tos_0
- lit6
- lit3
- gt
- $assert_tos_non0
- const1s -6
- lit1
- shr
- lit0
- gt
- $assert_tos_non0
- const1s -6
- lit1
- shra
- lit0
- lt
+ DW_OP_lit6
+ DW_OP_lit3
+ DW_OP_gt
+ $assert_tos_non0
+ DW_OP_const1s -6
+ DW_OP_lit1
+ DW_OP_shr
+ DW_OP_lit0
+ DW_OP_gt
+ $assert_tos_non0
+ DW_OP_const1s -6
+ DW_OP_lit1
+ DW_OP_shra
+ DW_OP_lit0
+ DW_OP_lt
$assert_tos_non0
# Finally some result.
- addr ptr
+ DW_OP_addr ptr
}]
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
@@ -375,36 +375,36 @@ Dwarf::assemble $asm_file {
declare_labels int_label
compile_unit {
- {name file1.txt}
- {language @DW_LANG_C}
- {low_pc $func_start addr}
- {high_pc $func_end addr}
+ DW_AT_name file1.txt
+ DW_AT_language @DW_LANG_C
+ DW_AT_low_pc $func_start addr
+ DW_AT_high_pc $func_end addr
} {
global program
int_label: base_type {
- {name int}
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
+ DW_AT_name int
+ DW_AT_byte_size 4 sdata
+ DW_AT_encoding @DW_ATE_signed
}
subprogram {
- {external 1 flag}
- {name func}
- {low_pc $func_start addr}
- {high_pc $func_end addr}
+ DW_AT_external 1 flag
+ DW_AT_name func
+ DW_AT_low_pc $func_start addr
+ DW_AT_high_pc $func_end addr
} {
formal_parameter {
- {name param}
- {variable_parameter 1 flag}
- {type :$int_label}
- {location $program SPECIAL_expr}
+ DW_AT_name param
+ DW_AT_variable_parameter 1 flag
+ DW_AT_type :$int_label
+ DW_AT_location $program SPECIAL_expr
}
formal_parameter {
- {name optimized_out}
- {variable_parameter 1 flag}
- {type :$int_label}
+ DW_AT_name optimized_out
+ DW_AT_variable_parameter 1 flag
+ DW_AT_type :$int_label
}
}
}
@@ -416,7 +416,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto func] {
+if {![runto func]} {
return -1
}
diff --git a/gdb/testsuite/gdb.compile/compile-print.c b/gdb/testsuite/gdb.compile/compile-print.c
index a8267ac..d0f98f9 100644
--- a/gdb/testsuite/gdb.compile/compile-print.c
+++ b/gdb/testsuite/gdb.compile/compile-print.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-print.exp b/gdb/testsuite/gdb.compile/compile-print.exp
index 61ce750..2d3ad2f 100644
--- a/gdb/testsuite/gdb.compile/compile-print.exp
+++ b/gdb/testsuite/gdb.compile/compile-print.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" "$testfile"] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.compile/compile-setjmp-mod.c b/gdb/testsuite/gdb.compile/compile-setjmp-mod.c
index afa8963..f61ca25 100644
--- a/gdb/testsuite/gdb.compile/compile-setjmp-mod.c
+++ b/gdb/testsuite/gdb.compile/compile-setjmp-mod.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-setjmp.c b/gdb/testsuite/gdb.compile/compile-setjmp.c
index 44dfd50..f869314 100644
--- a/gdb/testsuite/gdb.compile/compile-setjmp.c
+++ b/gdb/testsuite/gdb.compile/compile-setjmp.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-setjmp.exp b/gdb/testsuite/gdb.compile/compile-setjmp.exp
index ad8732b..048d0a4 100644
--- a/gdb/testsuite/gdb.compile/compile-setjmp.exp
+++ b/gdb/testsuite/gdb.compile/compile-setjmp.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" $testfile] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.compile/compile-shlib.c b/gdb/testsuite/gdb.compile/compile-shlib.c
index a2833af..039527e 100644
--- a/gdb/testsuite/gdb.compile/compile-shlib.c
+++ b/gdb/testsuite/gdb.compile/compile-shlib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-tls.c b/gdb/testsuite/gdb.compile/compile-tls.c
index c67b2ce..df24896 100644
--- a/gdb/testsuite/gdb.compile/compile-tls.c
+++ b/gdb/testsuite/gdb.compile/compile-tls.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile-tls.exp b/gdb/testsuite/gdb.compile/compile-tls.exp
index 45e290e..e7db1da 100644
--- a/gdb/testsuite/gdb.compile/compile-tls.exp
+++ b/gdb/testsuite/gdb.compile/compile-tls.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.compile/compile.c b/gdb/testsuite/gdb.compile/compile.c
index 04beae8..0943ea5 100644
--- a/gdb/testsuite/gdb.compile/compile.c
+++ b/gdb/testsuite/gdb.compile/compile.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.compile/compile.exp b/gdb/testsuite/gdb.compile/compile.exp
index 5128dc62..66ac182 100644
--- a/gdb/testsuite/gdb.compile/compile.exp
+++ b/gdb/testsuite/gdb.compile/compile.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,8 @@ if { $srcfile3 != "" } {
lappend srcfilesoptions $srcfile3 ${options}
}
lappend srcfilesoptions $srcfile4 "nodebug"
-if { [eval build_executable_from_specs ${testfile}.exp $testfile {$options} ${srcfilesoptions}] } {
+if { [build_executable_from_specs $testfile.exp $testfile $options \
+ {*}$srcfilesoptions] } {
return -1
}
@@ -53,7 +54,7 @@ gdb_test "compile file -r ${srcdir}/${subdir}/${testfile}-mod.c" \
"The program must be running for the compile command to work.*" \
"test compile file command without running inferior"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -378,8 +379,9 @@ if { $srcfile3 != "" } {
require allow_shlib_tests
-set libbin [standard_output_file ${testfile}-shlib.so]
-set binfile [standard_output_file ${testfile}-shlib]
+set testfile $testfile-shlib
+set libbin [standard_output_file $testfile.so]
+set binfile [standard_output_file $testfile]
if { [gdb_compile_shlib ${srcdir}/${subdir}/${srcfile2} $libbin {debug}] != ""
|| [gdb_compile ${srcdir}/${subdir}/${srcfile} $binfile executable \
@@ -387,10 +389,10 @@ if { [gdb_compile_shlib ${srcdir}/${subdir}/${srcfile2} $libbin {debug}] != ""
return -1
}
-clean_restart $binfile
+clean_restart $testfile
gdb_load_shlib $libbin
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.cp/abstract-origin.cc b/gdb/testsuite/gdb.cp/abstract-origin.cc
index 44377b2..96fdc85 100644
--- a/gdb/testsuite/gdb.cp/abstract-origin.cc
+++ b/gdb/testsuite/gdb.cp/abstract-origin.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/abstract-origin.exp b/gdb/testsuite/gdb.cp/abstract-origin.exp
index c6c1b8c..f54cb9a 100644
--- a/gdb/testsuite/gdb.cp/abstract-origin.exp
+++ b/gdb/testsuite/gdb.cp/abstract-origin.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.cp/align.exp b/gdb/testsuite/gdb.cp/align.exp
index 56e00d9..b28454d 100644
--- a/gdb/testsuite/gdb.cp/align.exp
+++ b/gdb/testsuite/gdb.cp/align.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/ambiguous.exp b/gdb/testsuite/gdb.cp/ambiguous.exp
index 10fb6e0..0cd986f 100644
--- a/gdb/testsuite/gdb.cp/ambiguous.exp
+++ b/gdb/testsuite/gdb.cp/ambiguous.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp
index 1b1c26b..16344bd 100644
--- a/gdb/testsuite/gdb.cp/annota2.exp
+++ b/gdb/testsuite/gdb.cp/annota2.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ set frames_invalid "\r\n\032\032frames-invalid\r\n"
#
set main_line 25
-# The commands we test here produce many lines of output; disable "press
+# The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts.
gdb_test_no_output "set height 0"
@@ -64,7 +64,7 @@ gdb_test "break 25" \
set old_gdb_prompt $gdb_prompt
set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
-send_gdb "set annotate 2\n"
+send_gdb "set annotate 2\n"
gdb_expect {
-re "set annotate 2\r\n$gdb_prompt$" { pass "annotation set at level 2" }
-re ".*$gdb_prompt$" { fail "annotation set at level 2" }
@@ -175,7 +175,7 @@ gdb_expect {
}
#
-# break at first line of main.
+# break at first line of main.
#
set pat [multi_line "" \
"\032\032post-prompt" \
@@ -205,7 +205,7 @@ gdb_test_multiple "run" "run until main breakpoint, second time" {
}
#
-# set up a watch point on a.x
+# set up a watch point on a.x
#
set pat [multi_line "" \
"\032\032post-prompt" \
@@ -266,12 +266,12 @@ gdb_test_multiple "next" "watch triggered on a.x" {
#
-# send ^C to gdb, so that the quit() function gets called
+# send ^C to gdb, so that the quit() function gets called
# and annotate-quit is tested
# test:
# annotate-quit
#
-if ![target_info exists gdb,nointerrupts] {
+if {![target_info exists gdb,nointerrupts]} {
send_gdb "\003"
gdb_expect {
-re "\r\n\032\032error-begin\r\nQuit\r\n\r\n\032\032quit\r\n$gdb_prompt$" \
@@ -282,9 +282,9 @@ if ![target_info exists gdb,nointerrupts] {
}
#
-# FIXME: the testsuite does not currently have tests for
+# FIXME: the testsuite does not currently have tests for
# annotate_catchpoints and annotate_function_call
-# and a few variants of the annotations that are
+# and a few variants of the annotations that are
# tested (marked by FIXME on the annot?.exp files)
#
diff --git a/gdb/testsuite/gdb.cp/annota3.exp b/gdb/testsuite/gdb.cp/annota3.exp
index e5da031..db3f696 100644
--- a/gdb/testsuite/gdb.cp/annota3.exp
+++ b/gdb/testsuite/gdb.cp/annota3.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,7 +39,7 @@ require target_can_use_run_cmd
#
set main_line 25
-# The commands we test here produce many lines of output; disable "press
+# The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts.
gdb_test_no_output "set height 0"
@@ -61,7 +61,7 @@ gdb_test "break 25" \
set old_gdb_prompt $gdb_prompt
set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
-send_gdb "set annotate 3\n"
+send_gdb "set annotate 3\n"
gdb_expect_list "annotation set at level 3" "\r\n$gdb_prompt$" {
"set annotate 3"
}
@@ -131,7 +131,7 @@ gdb_expect {
}
#
-# break at first line of main.
+# break at first line of main.
#
send_gdb "break 22\n"
gdb_expect_list "break at main" "$gdb_prompt$" {
@@ -158,7 +158,7 @@ gdb_expect_list "second run until main breakpoint" "$gdb_prompt$" {
}
#
-# set up a watch point on a.x
+# set up a watch point on a.x
#
send_gdb "watch a.x\n"
gdb_expect_list "set watch on a.x" "$gdb_prompt$" {
@@ -177,12 +177,12 @@ gdb_test_multiple "next" "watch triggered on a.x" {
}
#
-# send ^C to gdb, so that the quit() function gets called
+# send ^C to gdb, so that the quit() function gets called
# and annotate-quit is tested
# test:
# annotate-quit
#
-if ![target_info exists gdb,nointerrupts] {
+if {![target_info exists gdb,nointerrupts]} {
send_gdb "\003"
gdb_expect_list "annotate-quit" "$gdb_prompt$" {
"\r\n\032\032error-begin\r\n"
@@ -192,9 +192,9 @@ if ![target_info exists gdb,nointerrupts] {
}
#
-# FIXME: the testsuite does not currently have tests for
+# FIXME: the testsuite does not currently have tests for
# annotate_catchpoints and annotate_function_call
-# and a few variants of the annotations that are
+# and a few variants of the annotations that are
# tested (marked by FIXME on the annot?.exp files)
#
diff --git a/gdb/testsuite/gdb.cp/anon-ns.cc b/gdb/testsuite/gdb.cp/anon-ns.cc
index 0a75458..16212db 100644
--- a/gdb/testsuite/gdb.cp/anon-ns.cc
+++ b/gdb/testsuite/gdb.cp/anon-ns.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/anon-ns.exp b/gdb/testsuite/gdb.cp/anon-ns.exp
index 2b2376d..a5bfe7b 100644
--- a/gdb/testsuite/gdb.cp/anon-ns.exp
+++ b/gdb/testsuite/gdb.cp/anon-ns.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# Contributed by Red Hat, originally written by Keith Seitz.
#
diff --git a/gdb/testsuite/gdb.cp/anon-ns2.cc b/gdb/testsuite/gdb.cp/anon-ns2.cc
index 326e8df..6413751 100644
--- a/gdb/testsuite/gdb.cp/anon-ns2.cc
+++ b/gdb/testsuite/gdb.cp/anon-ns2.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/anon-struct.cc b/gdb/testsuite/gdb.cp/anon-struct.cc
index 9523cb3..04a6d53 100644
--- a/gdb/testsuite/gdb.cp/anon-struct.cc
+++ b/gdb/testsuite/gdb.cp/anon-struct.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/anon-struct.exp b/gdb/testsuite/gdb.cp/anon-struct.exp
index ae2e444..0ecb9ab9 100644
--- a/gdb/testsuite/gdb.cp/anon-struct.exp
+++ b/gdb/testsuite/gdb.cp/anon-struct.exp
@@ -1,5 +1,5 @@
# Tests for anonymous union support.
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/anon-union.exp b/gdb/testsuite/gdb.cp/anon-union.exp
index 398fa53..fb36b49 100644
--- a/gdb/testsuite/gdb.cp/anon-union.exp
+++ b/gdb/testsuite/gdb.cp/anon-union.exp
@@ -1,5 +1,5 @@
# Tests for anonymous union support.
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -77,7 +77,7 @@ gdb_test "print foo" \
# Modify the member just set
gdb_test_no_output "set var foo.cloth = 35" "set var foo.cloth"
-# Now print out anon union again to see if the right member was set
+# Now print out anon union again to see if the right member was set
gdb_test "print foo" \
"\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 0, x = \{rock = 0, rock2 = 0\}, \{qux = 0, mux = 0\}, boulder = 0\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \
"print foo 3"
@@ -86,7 +86,7 @@ gdb_test "print foo" \
gdb_test "next" "42\[ \t\]*foo.mux = 55;" "next 3"
-# Now print out anon union again
+# Now print out anon union again
gdb_test "print foo" \
"\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 44, x = \{rock = 44, rock2 = 0\}, \{qux = 44, mux = 44\}, boulder = 44\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \
"print foo 4"
@@ -94,7 +94,7 @@ gdb_test "print foo" \
# Modify the member just set
gdb_test_no_output "set var foo.pebble = 45" "set var foo.pebble"
-# Now print out anon union again to see if the right member was set
+# Now print out anon union again to see if the right member was set
gdb_test "print foo" \
"\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 45, x = \{rock = 45, rock2 = 0\}, \{qux = 45, mux = 45\}, boulder = 45\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \
"print foo 5"
@@ -102,7 +102,7 @@ gdb_test "print foo" \
# Modify another member at a different level
gdb_test_no_output "set var foo.qux = 46" "set var foo.qux"
-# Now print out anon union again to see if the right member was set
+# Now print out anon union again to see if the right member was set
gdb_test "print foo" \
"\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 46, x = \{rock = 46, rock2 = 0\}, \{qux = 46, mux = 46\}, boulder = 46\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \
"print foo 6"
@@ -150,7 +150,7 @@ gdb_test "print w" "\\$\[0-9\]* = 45" "print w 2"
# See if z shows the same value
gdb_test "print z" "\\$\[0-9\]* = 45" "print z 2"
-# Set the anon union member
+# Set the anon union member
gdb_test_no_output "set var z = 27" "set var z"
# See if the change in value is noticed
diff --git a/gdb/testsuite/gdb.cp/arg-reference.cc b/gdb/testsuite/gdb.cp/arg-reference.cc
index c519b9b..d74675f 100644
--- a/gdb/testsuite/gdb.cp/arg-reference.cc
+++ b/gdb/testsuite/gdb.cp/arg-reference.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+ Copyright (C) 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.cp/arg-reference.exp b/gdb/testsuite/gdb.cp/arg-reference.exp
index b0c7e2f..36696c4 100644
--- a/gdb/testsuite/gdb.cp/arg-reference.exp
+++ b/gdb/testsuite/gdb.cp/arg-reference.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2024 Free Software Foundation, Inc.
+# Copyright (C) 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/array-indices.exp b/gdb/testsuite/gdb.cp/array-indices.exp
index db1a16d..b0f5293 100644
--- a/gdb/testsuite/gdb.cp/array-indices.exp
+++ b/gdb/testsuite/gdb.cp/array-indices.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/array-repeat.exp b/gdb/testsuite/gdb.cp/array-repeat.exp
index 95150f9..649e47d 100644
--- a/gdb/testsuite/gdb.cp/array-repeat.exp
+++ b/gdb/testsuite/gdb.cp/array-repeat.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/baseenum.cc b/gdb/testsuite/gdb.cp/baseenum.cc
index 9dee774..aef8a7e 100644
--- a/gdb/testsuite/gdb.cp/baseenum.cc
+++ b/gdb/testsuite/gdb.cp/baseenum.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2003-2024 Free Software Foundation, Inc.
+ Copyright 2003-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/baseenum.exp b/gdb/testsuite/gdb.cp/baseenum.exp
index f719ea9..0e01122 100644
--- a/gdb/testsuite/gdb.cp/baseenum.exp
+++ b/gdb/testsuite/gdb.cp/baseenum.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/bool.cc b/gdb/testsuite/gdb.cp/bool.cc
index 246c820..603e049 100644
--- a/gdb/testsuite/gdb.cp/bool.cc
+++ b/gdb/testsuite/gdb.cp/bool.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.cp/bool.exp b/gdb/testsuite/gdb.cp/bool.exp
index 1e824a2..fc61801 100644
--- a/gdb/testsuite/gdb.cp/bool.exp
+++ b/gdb/testsuite/gdb.cp/bool.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2024 Free Software Foundation, Inc.
+# Copyright (C) 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/break-f-std-string.cc b/gdb/testsuite/gdb.cp/break-f-std-string.cc
index 03cbe37..dc8b2a1 100644
--- a/gdb/testsuite/gdb.cp/break-f-std-string.cc
+++ b/gdb/testsuite/gdb.cp/break-f-std-string.cc
@@ -1,6 +1,6 @@
/* This test file is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/break-f-std-string.exp b/gdb/testsuite/gdb.cp/break-f-std-string.exp
index c03e546..b0417d9 100644
--- a/gdb/testsuite/gdb.cp/break-f-std-string.exp
+++ b/gdb/testsuite/gdb.cp/break-f-std-string.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/break-template-cast.cc b/gdb/testsuite/gdb.cp/break-template-cast.cc
index bb232cb..2e43edf 100644
--- a/gdb/testsuite/gdb.cp/break-template-cast.cc
+++ b/gdb/testsuite/gdb.cp/break-template-cast.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/break-template-cast.exp b/gdb/testsuite/gdb.cp/break-template-cast.exp
index 30e4229..4e86b2e 100644
--- a/gdb/testsuite/gdb.cp/break-template-cast.exp
+++ b/gdb/testsuite/gdb.cp/break-template-cast.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/breakpoint-locs-2.cc b/gdb/testsuite/gdb.cp/breakpoint-locs-2.cc
index b81de99..52d99d3 100644
--- a/gdb/testsuite/gdb.cp/breakpoint-locs-2.cc
+++ b/gdb/testsuite/gdb.cp/breakpoint-locs-2.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/breakpoint-locs.cc b/gdb/testsuite/gdb.cp/breakpoint-locs.cc
index e1198e9..562bbe4 100644
--- a/gdb/testsuite/gdb.cp/breakpoint-locs.cc
+++ b/gdb/testsuite/gdb.cp/breakpoint-locs.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/breakpoint-locs.exp b/gdb/testsuite/gdb.cp/breakpoint-locs.exp
index 088a766..284d127 100644
--- a/gdb/testsuite/gdb.cp/breakpoint-locs.exp
+++ b/gdb/testsuite/gdb.cp/breakpoint-locs.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/breakpoint-locs.h b/gdb/testsuite/gdb.cp/breakpoint-locs.h
index 7f58fcf..93a2554 100644
--- a/gdb/testsuite/gdb.cp/breakpoint-locs.h
+++ b/gdb/testsuite/gdb.cp/breakpoint-locs.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/breakpoint-shlib-func-lib.cc b/gdb/testsuite/gdb.cp/breakpoint-shlib-func-lib.cc
index baa66d3..c498a26 100644
--- a/gdb/testsuite/gdb.cp/breakpoint-shlib-func-lib.cc
+++ b/gdb/testsuite/gdb.cp/breakpoint-shlib-func-lib.cc
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.cp/breakpoint-shlib-func.cc b/gdb/testsuite/gdb.cp/breakpoint-shlib-func.cc
index 42a9b34..ae83293 100644
--- a/gdb/testsuite/gdb.cp/breakpoint-shlib-func.cc
+++ b/gdb/testsuite/gdb.cp/breakpoint-shlib-func.cc
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.cp/breakpoint-shlib-func.exp b/gdb/testsuite/gdb.cp/breakpoint-shlib-func.exp
index 085020f..dc4759c 100644
--- a/gdb/testsuite/gdb.cp/breakpoint-shlib-func.exp
+++ b/gdb/testsuite/gdb.cp/breakpoint-shlib-func.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.cp/breakpoint.cc b/gdb/testsuite/gdb.cp/breakpoint.cc
index 5b75705..1a64512 100644
--- a/gdb/testsuite/gdb.cp/breakpoint.cc
+++ b/gdb/testsuite/gdb.cp/breakpoint.cc
@@ -1,6 +1,6 @@
/* Code to go along with tests in breakpoint.exp.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.cp/breakpoint.exp b/gdb/testsuite/gdb.cp/breakpoint.exp
index b5cd2eb..ba9e49c 100644
--- a/gdb/testsuite/gdb.cp/breakpoint.exp
+++ b/gdb/testsuite/gdb.cp/breakpoint.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/bs15503.cc b/gdb/testsuite/gdb.cp/bs15503.cc
index 95ca324..66d68bf 100644
--- a/gdb/testsuite/gdb.cp/bs15503.cc
+++ b/gdb/testsuite/gdb.cp/bs15503.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1992-2024 Free Software Foundation, Inc.
+ Copyright 1992-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/bs15503.exp b/gdb/testsuite/gdb.cp/bs15503.exp
index 1c509c4..7cb73b2 100644
--- a/gdb/testsuite/gdb.cp/bs15503.exp
+++ b/gdb/testsuite/gdb.cp/bs15503.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/call-c-1.c b/gdb/testsuite/gdb.cp/call-c-1.c
index c041ffa..0582c8e 100644
--- a/gdb/testsuite/gdb.cp/call-c-1.c
+++ b/gdb/testsuite/gdb.cp/call-c-1.c
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/call-c.cc b/gdb/testsuite/gdb.cp/call-c.cc
index 05e0383..fb73e3a 100644
--- a/gdb/testsuite/gdb.cp/call-c.cc
+++ b/gdb/testsuite/gdb.cp/call-c.cc
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/call-c.exp b/gdb/testsuite/gdb.cp/call-c.exp
index 090cb3d..6d240c8 100644
--- a/gdb/testsuite/gdb.cp/call-c.exp
+++ b/gdb/testsuite/gdb.cp/call-c.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if {[gdb_compile "$srcdir/$subdir/${srcfile2}" "${objfilec}" object {debug}] !=
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto_main
diff --git a/gdb/testsuite/gdb.cp/call-method-register.cc b/gdb/testsuite/gdb.cp/call-method-register.cc
index 6271878..d9cc322 100644
--- a/gdb/testsuite/gdb.cp/call-method-register.cc
+++ b/gdb/testsuite/gdb.cp/call-method-register.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/call-method-register.exp b/gdb/testsuite/gdb.cp/call-method-register.exp
index b06620f..522da0a 100644
--- a/gdb/testsuite/gdb.cp/call-method-register.exp
+++ b/gdb/testsuite/gdb.cp/call-method-register.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,59 +45,59 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
- {DW_AT_name $::srcfile}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name $::srcfile
+ DW_AT_comp_dir /tmp
} {
declare_labels int_type_label struct_type_label \
struct_ptr_type_label
set ptr_size [get_sizeof "void *" 96]
DW_TAG_subprogram {
- {name main}
- {low_pc $main_start addr}
- {high_pc $main_length data8}
- {DW_AT_type :$int_type_label}
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc $main_length data8
+ DW_AT_type :$int_type_label
}
int_type_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
struct_type_label: DW_TAG_structure_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_name small}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_name small
} {
member {
- {name xxx}
- {type :$int_type_label}
- {data_member_location 0 data1}
+ DW_AT_name xxx
+ DW_AT_type :$int_type_label
+ DW_AT_data_member_location 0 data1
}
subprogram {
- {name yyy}
- {type :$int_type_label}
+ DW_AT_name yyy
+ DW_AT_type :$int_type_label
} {
formal_parameter {
- {type :$struct_ptr_type_label}
- {artificial 1 flag_present}
+ DW_AT_type :$struct_ptr_type_label
+ DW_AT_artificial 1 flag_present
}
}
}
struct_ptr_type_label: DW_TAG_pointer_type {
- {DW_AT_byte_size $ptr_size DW_FORM_data1}
- {type :$struct_type_label}
+ DW_AT_byte_size $ptr_size DW_FORM_data1
+ DW_AT_type :$struct_type_label
}
DW_TAG_variable {
- {DW_AT_name global_var}
- {DW_AT_type :$struct_type_label}
- {DW_AT_location {
+ DW_AT_name global_var
+ DW_AT_type :$struct_type_label
+ DW_AT_location {
DW_OP_reg0
- } SPECIAL_expr}
- {external 1 flag}
+ } SPECIAL_expr
+ DW_AT_external 1 flag
}
}
}
@@ -108,7 +108,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.cp/casts.exp b/gdb/testsuite/gdb.cp/casts.exp
index 9f7638c..c03a946 100644
--- a/gdb/testsuite/gdb.cp/casts.exp
+++ b/gdb/testsuite/gdb.cp/casts.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -70,12 +70,12 @@ gdb_test "print * (B *) a" ".* = {<A> = {a = 42}, b = 1729}" \
gdb_test "print * b" ".* = {<A> = {a = 42}, b = 1729}" \
"let compiler cast base class pointer to derived class pointer"
-# Check upcasting (it is trivial but still).
+# Check upcasting (it is trivial but still).
gdb_test "print * (A *) b" ".* = {a = 42}" \
"cast derived class pointer to base class pointer"
# Casting References.
-# Check upcasting.
+# Check upcasting.
gdb_test "print (A &) br" ".* = .A &.* {a = 42}" \
"cast derived class reference to base class reference"
diff --git a/gdb/testsuite/gdb.cp/casts03.cc b/gdb/testsuite/gdb.cp/casts03.cc
index a77fd5e..ec1934e 100644
--- a/gdb/testsuite/gdb.cp/casts03.cc
+++ b/gdb/testsuite/gdb.cp/casts03.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/chained-calls.cc b/gdb/testsuite/gdb.cp/chained-calls.cc
index 49b5682..9358c71 100644
--- a/gdb/testsuite/gdb.cp/chained-calls.cc
+++ b/gdb/testsuite/gdb.cp/chained-calls.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,6 +23,8 @@ public:
S operator+ (const S &s);
+ int get ();
+
int a;
};
@@ -41,6 +43,12 @@ S::operator+ (const S &s)
return res;
}
+int
+S::get ()
+{
+ return a;
+}
+
S
f (int i)
{
@@ -162,6 +170,8 @@ public:
U (type t);
type get_type ();
+ int get ();
+
int a;
char c;
type tp[2];
@@ -191,6 +201,12 @@ U::get_type ()
}
int
+U::get ()
+{
+ return a;
+}
+
+int
main ()
{
int i = g(f(0));
@@ -198,6 +214,7 @@ main ()
B b = makeb ();
C c;
+ int z = f (42).get ();
return i + getb(b, 0); /* Break here */
}
diff --git a/gdb/testsuite/gdb.cp/chained-calls.exp b/gdb/testsuite/gdb.cp/chained-calls.exp
index 989f012..d34162c 100644
--- a/gdb/testsuite/gdb.cp/chained-calls.exp
+++ b/gdb/testsuite/gdb.cp/chained-calls.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,3 +42,6 @@ gdb_test "p *c" ".* = {a = 5678}" "*c"
gdb_test "p *c + *c" ".* = {a = 11356}" "*c + *c"
gdb_test "p q(*c + *c)" ".* = {a = 11356}" "q(*c + *c)"
gdb_test "p make_int().get_type ()" ".* = INT" "make_int().get_type ()"
+gdb_test "p f(42).get()" " = 42" "f().get()"
+gdb_test "ptype f(42).get()" "type = int" "ptype f().get()"
+gdb_test "ptype make_int().get()" "type = int" "make_int().get()"
diff --git a/gdb/testsuite/gdb.cp/class2.cc b/gdb/testsuite/gdb.cp/class2.cc
index c083695..fd95c1d 100644
--- a/gdb/testsuite/gdb.cp/class2.cc
+++ b/gdb/testsuite/gdb.cp/class2.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2003-2024 Free Software Foundation, Inc.
+ Copyright 2003-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/class2.exp b/gdb/testsuite/gdb.cp/class2.exp
index abea147..9c110cf 100644
--- a/gdb/testsuite/gdb.cp/class2.exp
+++ b/gdb/testsuite/gdb.cp/class2.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/classes.cc b/gdb/testsuite/gdb.cp/classes.cc
index 70b6ddf..d41ddce 100644
--- a/gdb/testsuite/gdb.cp/classes.cc
+++ b/gdb/testsuite/gdb.cp/classes.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1993-2024 Free Software Foundation, Inc.
+ Copyright 1993-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/classes.exp b/gdb/testsuite/gdb.cp/classes.exp
index 4d29bf5..ad63749 100644
--- a/gdb/testsuite/gdb.cp/classes.exp
+++ b/gdb/testsuite/gdb.cp/classes.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -203,7 +203,7 @@ proc test_ptype_class_objects {} {
#
# gcc 2.X with stabs (stabs or stabs+?) used to have a problem with
# static methods whose name is the same as their argument mangling.
-
+
cp_test_ptype_class \
"class Static" "" "class" "Static" \
{
@@ -413,7 +413,7 @@ proc test_ptype_class_objects {} {
# Test simple access to class members.
proc test_non_inherited_member_access {} {
-
+
# Print non-inherited members of g_A.
gdb_test "print g_A.a" ".* = 1"
gdb_test "print g_A.x" ".* = 2"
diff --git a/gdb/testsuite/gdb.cp/cmpd-minsyms.cc b/gdb/testsuite/gdb.cp/cmpd-minsyms.cc
index ccd1f09..a1f4455 100644
--- a/gdb/testsuite/gdb.cp/cmpd-minsyms.cc
+++ b/gdb/testsuite/gdb.cp/cmpd-minsyms.cc
@@ -1,6 +1,6 @@
/* This test case is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/cmpd-minsyms.exp b/gdb/testsuite/gdb.cp/cmpd-minsyms.exp
index 9f2d9ae..cb31bae 100644
--- a/gdb/testsuite/gdb.cp/cmpd-minsyms.exp
+++ b/gdb/testsuite/gdb.cp/cmpd-minsyms.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# Contributed by Red Hat, originally written by Keith Seitz.
#
@@ -36,7 +36,7 @@ foreach sym $min_syms {
set tst "setting breakpoint at '$sym'"
if {[gdb_breakpoint "'$sym'"]} {
pass $tst
- }
+ }
}
diff --git a/gdb/testsuite/gdb.cp/cold-clone.cc b/gdb/testsuite/gdb.cp/cold-clone.cc
index cd7eefa..07d1cdb 100644
--- a/gdb/testsuite/gdb.cp/cold-clone.cc
+++ b/gdb/testsuite/gdb.cp/cold-clone.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/cold-clone.exp b/gdb/testsuite/gdb.cp/cold-clone.exp
index 2874d33..50bdbaa 100644
--- a/gdb/testsuite/gdb.cp/cold-clone.exp
+++ b/gdb/testsuite/gdb.cp/cold-clone.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/constexpr-field.cc b/gdb/testsuite/gdb.cp/constexpr-field.cc
index 37f0d39..1322adf 100644
--- a/gdb/testsuite/gdb.cp/constexpr-field.cc
+++ b/gdb/testsuite/gdb.cp/constexpr-field.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/constexpr-field.exp b/gdb/testsuite/gdb.cp/constexpr-field.exp
index 14787c0..d1013cd 100644
--- a/gdb/testsuite/gdb.cp/constexpr-field.exp
+++ b/gdb/testsuite/gdb.cp/constexpr-field.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/converts.exp b/gdb/testsuite/gdb.cp/converts.exp
index 6ea21fe..e350d72 100644
--- a/gdb/testsuite/gdb.cp/converts.exp
+++ b/gdb/testsuite/gdb.cp/converts.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/cp-relocate.cc b/gdb/testsuite/gdb.cp/cp-relocate.cc
index b38da25..a4987fb 100644
--- a/gdb/testsuite/gdb.cp/cp-relocate.cc
+++ b/gdb/testsuite/gdb.cp/cp-relocate.cc
@@ -1,6 +1,6 @@
/* This test file is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/cp-relocate.exp b/gdb/testsuite/gdb.cp/cp-relocate.exp
index 14ce9f5..836f5fb 100644
--- a/gdb/testsuite/gdb.cp/cp-relocate.exp
+++ b/gdb/testsuite/gdb.cp/cp-relocate.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/cpcompletion.exp b/gdb/testsuite/gdb.cp/cpcompletion.exp
index 7b93253..1fb9a6b 100644
--- a/gdb/testsuite/gdb.cp/cpcompletion.exp
+++ b/gdb/testsuite/gdb.cp/cpcompletion.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/cpexprs-debug-types.exp b/gdb/testsuite/gdb.cp/cpexprs-debug-types.exp
index de90e38..6789701 100644
--- a/gdb/testsuite/gdb.cp/cpexprs-debug-types.exp
+++ b/gdb/testsuite/gdb.cp/cpexprs-debug-types.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/cpexprs.cc b/gdb/testsuite/gdb.cp/cpexprs.cc
index fbc3680..7d31503 100644
--- a/gdb/testsuite/gdb.cp/cpexprs.cc
+++ b/gdb/testsuite/gdb.cp/cpexprs.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
Contributed by Red Hat, originally written by Keith Seitz.
diff --git a/gdb/testsuite/gdb.cp/cpexprs.exp b/gdb/testsuite/gdb.cp/cpexprs.exp
index 36026ab..2610183 100644
--- a/gdb/testsuite/gdb.cp/cpexprs.exp
+++ b/gdb/testsuite/gdb.cp/cpexprs.exp
@@ -1,6 +1,6 @@
# cpexprs.exp - C++ expressions tests
#
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# Contributed by Red Hat, originally written by Keith Seitz.
#
diff --git a/gdb/testsuite/gdb.cp/cpexprs.exp.tcl b/gdb/testsuite/gdb.cp/cpexprs.exp.tcl
index cf84f5d..6766cce 100644
--- a/gdb/testsuite/gdb.cp/cpexprs.exp.tcl
+++ b/gdb/testsuite/gdb.cp/cpexprs.exp.tcl
@@ -1,6 +1,6 @@
# cpexprs.exp - C++ expressions tests
#
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# Contributed by Red Hat, originally written by Keith Seitz.
#
@@ -28,17 +28,33 @@ proc test_breakpoint {func} {
delete_breakpoints
if { ! [gdb_breakpoint test_function] } {
fail "set test_function breakpoint for $func"
- } elseif { [gdb_test "continue" \
- "Continuing.\r\n\r\nBreakpoint $DEC+,.*test_function.*" \
- "continue to test_function for $func"] != 0 } {
- } else {
- gdb_breakpoint "$func"
- set i [expr {[string last : $func] + 1}]
- set efunc [string_to_regexp [string range $func $i end]]
- gdb_test "continue" \
- "Continuing.\r\n\r\nBreakpoint $DEC+,.*$efunc.*" \
- "continue to $func"
+ return
+ }
+
+ # Accept any input between "Continuing" and the breakpoint hit, as
+ # on Cygwin, we may see a "New Thread" notification. This is the
+ # Cygwin runtime spawning its own internal threads.
+ if { [gdb_test "continue" \
+ "Continuing.\r\n.*Breakpoint $DEC+,.*test_function.*" \
+ "continue to test_function for $func"] != 0 } {
+ return
}
+
+ # On some systems, the in-charge and not-in-charge dtors of a
+ # class may end up with the same address, so setting a breakpoint
+ # at a dtor like base::~base only finds one location. On other
+ # systems (e.g. Cygwin), the two dtors for the same class may have
+ # different addresses, so we find two locations for the
+ # breakpoint. Thus, expect that the breakpoint hit may or may not
+ # report a location number.
+ set bp_re "$DEC+(\.$DEC+)?"
+
+ gdb_breakpoint "$func"
+ set i [expr {[string last : $func] + 1}]
+ set efunc [string_to_regexp [string range $func $i end]]
+ gdb_test "continue" \
+ "Continuing.\r\n.*Breakpoint $bp_re,.*$efunc.*" \
+ "continue to $func"
}
# Add a function to the list of tested functions
@@ -114,7 +130,7 @@ set ADDR "0x$HEX+"; # address
# are (none need character escaping -- "add" will take care of that):
# add name type print_name list
-# NAME,type: value is type of function
+# NAME,type: value is type of function
# NAME,print: value is print name of function (careful w/inherited/virtual!)
# NAME,list: value is comment in source code on first line of function
# (without the leading "//")
diff --git a/gdb/testsuite/gdb.cp/cplabel.cc b/gdb/testsuite/gdb.cp/cplabel.cc
index 844e543..6b99b1d 100644
--- a/gdb/testsuite/gdb.cp/cplabel.cc
+++ b/gdb/testsuite/gdb.cp/cplabel.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/cplabel.exp b/gdb/testsuite/gdb.cp/cplabel.exp
index 5865352..0f2a947 100644
--- a/gdb/testsuite/gdb.cp/cplabel.exp
+++ b/gdb/testsuite/gdb.cp/cplabel.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.exp b/gdb/testsuite/gdb.cp/cplusfuncs.exp
index d789a1d..d1b4ecb 100644
--- a/gdb/testsuite/gdb.cp/cplusfuncs.exp
+++ b/gdb/testsuite/gdb.cp/cplusfuncs.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -424,7 +424,7 @@ proc test_lookup_operator_functions {} {
# operator[] needs double backslashes, so that a single backslash
# will be sent to GDB, preventing the square brackets from being
- # evaluated as a regular expression.
+ # evaluated as a regular expression.
info_func "operator\\\[\\\](" "void foo::operator\[\]($dm_type_foo_ref);"
# These are gnarly because they might end with 'static'.
@@ -493,7 +493,7 @@ proc test_paddr_operator_functions {} {
gdb_test "print &foo::operator new" \
" = .* $hex <foo::operator new\\(.*\\)(| static)>"
gdb_test "print &foo::operator new\[\]" \
- " = .* $hex <foo::operator new\\\[\\\]\\(.*\\)(| static)>"
+ " = .* $hex <foo::operator new\\\[\\\]\\(.*\\)(| static)>"
print_addr "foo::operator delete($dm_type_void_star)"
print_addr "foo::operator delete\[\]($dm_type_void_star)"
@@ -579,7 +579,8 @@ proc do_tests {} {
gdb_test_no_output "set width 0"
- runto_main
+ # Don't run to main, to avoid loading and expanding debug info for
+ # libstdc++.
gdb_test_no_output "set language c++"
probe_demangler
diff --git a/gdb/testsuite/gdb.cp/cpsizeof.cc b/gdb/testsuite/gdb.cp/cpsizeof.cc
index a168fc3..9d34163 100644
--- a/gdb/testsuite/gdb.cp/cpsizeof.cc
+++ b/gdb/testsuite/gdb.cp/cpsizeof.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/cpsizeof.exp b/gdb/testsuite/gdb.cp/cpsizeof.exp
index 99861cb..ccaa95f 100644
--- a/gdb/testsuite/gdb.cp/cpsizeof.exp
+++ b/gdb/testsuite/gdb.cp/cpsizeof.exp
@@ -1,5 +1,5 @@
# sizeof() tests [c++/16675]
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/ctti.exp b/gdb/testsuite/gdb.cp/ctti.exp
index 493e565..06b4eeb 100644
--- a/gdb/testsuite/gdb.cp/ctti.exp
+++ b/gdb/testsuite/gdb.cp/ctti.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/cttiadd.cc b/gdb/testsuite/gdb.cp/cttiadd.cc
index d433006..e0f6395 100644
--- a/gdb/testsuite/gdb.cp/cttiadd.cc
+++ b/gdb/testsuite/gdb.cp/cttiadd.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1998-2024 Free Software Foundation, Inc.
+ Copyright 1998-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/cttiadd1.cc b/gdb/testsuite/gdb.cp/cttiadd1.cc
index d397139..2bd6f99 100644
--- a/gdb/testsuite/gdb.cp/cttiadd1.cc
+++ b/gdb/testsuite/gdb.cp/cttiadd1.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1998-2024 Free Software Foundation, Inc.
+ Copyright 1998-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/cttiadd2.cc b/gdb/testsuite/gdb.cp/cttiadd2.cc
index 3a6bb6d..ee55572 100644
--- a/gdb/testsuite/gdb.cp/cttiadd2.cc
+++ b/gdb/testsuite/gdb.cp/cttiadd2.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1998-2024 Free Software Foundation, Inc.
+ Copyright 1998-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/cttiadd3.cc b/gdb/testsuite/gdb.cp/cttiadd3.cc
index 1b2025a..39f120e 100644
--- a/gdb/testsuite/gdb.cp/cttiadd3.cc
+++ b/gdb/testsuite/gdb.cp/cttiadd3.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1998-2024 Free Software Foundation, Inc.
+ Copyright 1998-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/debug-expr.exp b/gdb/testsuite/gdb.cp/debug-expr.exp
index 2c8fd7f..86d6a29 100644
--- a/gdb/testsuite/gdb.cp/debug-expr.exp
+++ b/gdb/testsuite/gdb.cp/debug-expr.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/demangle.exp b/gdb/testsuite/gdb.cp/demangle.exp
index f181188..420d1df 100644
--- a/gdb/testsuite/gdb.cp/demangle.exp
+++ b/gdb/testsuite/gdb.cp/demangle.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-2024 Free Software Foundation, Inc.
+# Copyright (C) 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ proc set_demangling_style {style} {
fail "$style: set demangle-style"
error "set_demangling_style: set style"
}
- timeout {
+ timeout {
fail "$style: set demangle-style (timeout)"
error "set_demangling_style: set style"
}
@@ -44,15 +44,15 @@ proc set_demangling_style {style} {
gdb_test_multiple "show demangle-style" \
"$style: check demangling style" {
- -re "The current C\[+\]+ demangling style is \"$style\".\r\n$gdb_prompt $" {
+ -re "The current C\[+\]+ demangling style is \"$style\".\r\n$gdb_prompt $" {
pass "$style: check demangling style"
}
-re ".*$gdb_prompt $" {
fail "$style: check demangling style"
error "set_demangling_style: check style"
}
- timeout {
- fail "$style: check demangling style (timeout)"
+ timeout {
+ fail "$style: check demangling style (timeout)"
error "set_demangling_style: check style"
}
}
@@ -89,13 +89,13 @@ proc test_demangling_core {tester test result} {
### Why don't we just pass the STYLE and NAME as two separate
### arguments, or let the style be a global variable? That would be
### cleaner. However, doing it this way means that:
-###
+###
### 1) the name of the test, as recorded in the summary and log,
### appears verbatim in the script, and
-###
+###
### 2) that test names are unique, even though we try to demangle the same
### identifiers using several different mangling styles.
-###
+###
### This makes it a lot easier for people tracking down failures to
### find the one they care about.
@@ -157,14 +157,14 @@ proc test_gnuv3_style_demangling {} {
}
proc catch_demangling_errors {command} {
- if {[catch $command result]} {
+ if {[catch {$command} result]} {
puts "ERROR: demangle.exp: while running $command: $result"
}
}
# Test support for different demangling styles. Note that this does
# not depend upon running the test program and does not depend upon
-# gdb being able to lookup any C++ symbols. It simply calls the
+# gdb being able to lookup any C++ symbols. It simply calls the
# internal demangler with synthesized strings and tests the results.
proc do_tests {} {
diff --git a/gdb/testsuite/gdb.cp/derivation.cc b/gdb/testsuite/gdb.cp/derivation.cc
index 7229257..1a1f829 100644
--- a/gdb/testsuite/gdb.cp/derivation.cc
+++ b/gdb/testsuite/gdb.cp/derivation.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2003-2024 Free Software Foundation, Inc.
+ Copyright 2003-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/derivation.exp b/gdb/testsuite/gdb.cp/derivation.exp
index cd5bc8a..bb3dcce 100644
--- a/gdb/testsuite/gdb.cp/derivation.exp
+++ b/gdb/testsuite/gdb.cp/derivation.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
# This file is part of the gdb testsuite
# tests for inheritance, with several derivations types combinations
-# (private, public, protected)
+# (private, public, protected)
# classes have simple members and member functions.
set ws "\[\r\n\t \]+"
diff --git a/gdb/testsuite/gdb.cp/derivation2.cc b/gdb/testsuite/gdb.cp/derivation2.cc
index 0ca7687..233580a 100644
--- a/gdb/testsuite/gdb.cp/derivation2.cc
+++ b/gdb/testsuite/gdb.cp/derivation2.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/destrprint.exp b/gdb/testsuite/gdb.cp/destrprint.exp
index e4d7ace..5ce7134 100644
--- a/gdb/testsuite/gdb.cp/destrprint.exp
+++ b/gdb/testsuite/gdb.cp/destrprint.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.cp/disasm-func-name.cc b/gdb/testsuite/gdb.cp/disasm-func-name.cc
index d3af061..2b2b56e 100644
--- a/gdb/testsuite/gdb.cp/disasm-func-name.cc
+++ b/gdb/testsuite/gdb.cp/disasm-func-name.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/disasm-func-name.exp b/gdb/testsuite/gdb.cp/disasm-func-name.exp
index 0b5dd15..b7f7804 100644
--- a/gdb/testsuite/gdb.cp/disasm-func-name.exp
+++ b/gdb/testsuite/gdb.cp/disasm-func-name.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/dispcxx.cc b/gdb/testsuite/gdb.cp/dispcxx.cc
index 3e0bdc2..07b5dfb 100644
--- a/gdb/testsuite/gdb.cp/dispcxx.cc
+++ b/gdb/testsuite/gdb.cp/dispcxx.cc
@@ -1,6 +1,6 @@
/* Test for displays in C++.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/dispcxx.exp b/gdb/testsuite/gdb.cp/dispcxx.exp
index b0be98c..107e967 100644
--- a/gdb/testsuite/gdb.cp/dispcxx.exp
+++ b/gdb/testsuite/gdb.cp/dispcxx.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
if {![runto_main]} {
return
-}
+}
gdb_breakpoint [gdb_get_line_number "Break here"]
gdb_continue_to_breakpoint here
diff --git a/gdb/testsuite/gdb.cp/empty-enum.cc b/gdb/testsuite/gdb.cp/empty-enum.cc
index 5d2b17d..d8d7d23 100644
--- a/gdb/testsuite/gdb.cp/empty-enum.cc
+++ b/gdb/testsuite/gdb.cp/empty-enum.cc
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.cp/empty-enum.exp b/gdb/testsuite/gdb.cp/empty-enum.exp
index 5fce487..487d561 100644
--- a/gdb/testsuite/gdb.cp/empty-enum.exp
+++ b/gdb/testsuite/gdb.cp/empty-enum.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -51,7 +51,7 @@ gdb_test "print arg2" " = 4"
# Xfail for missing DW_AT_type in DW_TAG_enumeration_type, gcc PR debug/16063.
-set have_xfail [expr [test_compiler_info gcc-*] && [gcc_major_version] < 5]
+set have_xfail [expr {[test_compiler_info gcc-*] && [gcc_major_version] < 5}]
gdb_test_multiple "ptype arg1" "" {
-re -wrap "type = enum enum1 : unsigned int \\{\\}" {
diff --git a/gdb/testsuite/gdb.cp/ena-dis-br-range.cc b/gdb/testsuite/gdb.cp/ena-dis-br-range.cc
index 94b381c..8292fb9 100644
--- a/gdb/testsuite/gdb.cp/ena-dis-br-range.cc
+++ b/gdb/testsuite/gdb.cp/ena-dis-br-range.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/ena-dis-br-range.exp b/gdb/testsuite/gdb.cp/ena-dis-br-range.exp
index 103d38b..d50685e 100644
--- a/gdb/testsuite/gdb.cp/ena-dis-br-range.exp
+++ b/gdb/testsuite/gdb.cp/ena-dis-br-range.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/enum-class.cc b/gdb/testsuite/gdb.cp/enum-class.cc
index e7accb2..64e2ee7 100644
--- a/gdb/testsuite/gdb.cp/enum-class.cc
+++ b/gdb/testsuite/gdb.cp/enum-class.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/enum-class.exp b/gdb/testsuite/gdb.cp/enum-class.exp
index 03537b3..dead0c5 100644
--- a/gdb/testsuite/gdb.cp/enum-class.exp
+++ b/gdb/testsuite/gdb.cp/enum-class.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/eval-reference-type.cc b/gdb/testsuite/gdb.cp/eval-reference-type.cc
new file mode 100644
index 0000000..b177cbf
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/eval-reference-type.cc
@@ -0,0 +1,36 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Tests that expression evaluation does not return an error if one of
+ the operands is of reference type. */
+
+struct
+{
+ int &get ()
+ {
+ return x;
+ };
+
+ int x = 1;
+} v_struct;
+
+int
+main (void)
+{
+ v_struct.get () = 2;
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.cp/eval-reference-type.exp b/gdb/testsuite/gdb.cp/eval-reference-type.exp
new file mode 100644
index 0000000..4c7b3b7
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/eval-reference-type.exp
@@ -0,0 +1,46 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile .cc
+
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
+ return
+}
+
+runto_main
+
+# Test for reference type.
+gdb_test "print v_struct.get () == 1 && v_struct.get () == 2" \
+ " = false"
+gdb_test "print v_struct.get () == 1 || v_struct.get () == 2" \
+ " = true"
+
+# Test for correct type resolution using 'ptype'.
+gdb_test "ptype v_struct.get ()" \
+ "type = int &"
+gdb_test "ptype v_struct.get () == 1" \
+ "type = bool"
+gdb_test "ptype v_struct.get () + 1" \
+ "type = int"
+gdb_test "ptype v_struct.get () && 1" \
+ "type = bool"
+gdb_test "ptype v_struct.get () || 1" \
+ "type = bool"
+gdb_test "ptype !v_struct.get ()" \
+ "type = bool"
+gdb_test "ptype v_struct.get () ? 2 : 3" \
+ "type = int"
+gdb_test "ptype v_struct.get () | 1" \
+ "type = int"
diff --git a/gdb/testsuite/gdb.cp/except-multi-location-lib.cc b/gdb/testsuite/gdb.cp/except-multi-location-lib.cc
index 380cbab..f990730 100644
--- a/gdb/testsuite/gdb.cp/except-multi-location-lib.cc
+++ b/gdb/testsuite/gdb.cp/except-multi-location-lib.cc
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.cp/except-multi-location-main.cc b/gdb/testsuite/gdb.cp/except-multi-location-main.cc
index 1bdce84..a0515f8 100644
--- a/gdb/testsuite/gdb.cp/except-multi-location-main.cc
+++ b/gdb/testsuite/gdb.cp/except-multi-location-main.cc
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.cp/except-multi-location.exp b/gdb/testsuite/gdb.cp/except-multi-location.exp
index 02e999f..0c3222d 100644
--- a/gdb/testsuite/gdb.cp/except-multi-location.exp
+++ b/gdb/testsuite/gdb.cp/except-multi-location.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -57,7 +57,7 @@ proc test_multi_libstdcpp {static_bin static_lib} {
gdb_load ${binfile}
gdb_load_shlib $binfile_lib
- if ![runto_main] {
+ if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.cp/exception.cc b/gdb/testsuite/gdb.cp/exception.cc
index 6f0e090..ed22d96 100644
--- a/gdb/testsuite/gdb.cp/exception.cc
+++ b/gdb/testsuite/gdb.cp/exception.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1997-2024 Free Software Foundation, Inc.
+ Copyright 1997-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/exception.exp b/gdb/testsuite/gdb.cp/exception.exp
index 5489d0c..45fa299 100644
--- a/gdb/testsuite/gdb.cp/exception.exp
+++ b/gdb/testsuite/gdb.cp/exception.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ set nl "\[\r\n\]+"
require allow_stl_tests
standard_testfile .cc
-
+
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
@@ -101,7 +101,7 @@ gdb_test_multiple "info breakpoints" $name {
gdb_test "break catcher" "Breakpoint \[0-9\]+ at.*"
# Get the first exception thrown
-
+
gdb_test "continue" \
"Continuing.${ws}Catchpoint \[0-9\]+ \\(exception thrown\\).*" \
"continue to first throw"
diff --git a/gdb/testsuite/gdb.cp/exceptprint.cc b/gdb/testsuite/gdb.cp/exceptprint.cc
index 84a98c4..8e06c72 100644
--- a/gdb/testsuite/gdb.cp/exceptprint.cc
+++ b/gdb/testsuite/gdb.cp/exceptprint.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/exceptprint.exp b/gdb/testsuite/gdb.cp/exceptprint.exp
index 02ec3ff..8f034e4 100644
--- a/gdb/testsuite/gdb.cp/exceptprint.exp
+++ b/gdb/testsuite/gdb.cp/exceptprint.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -49,7 +49,7 @@ proc do_exceptprint_tests {prefix output} {
do_continue_to_catchpoint "continue to catch"
gdb_test "print \$_exception" " = $output" \
"print exception value at catch"
-
+
do_continue_to_catchpoint "continue to rethrow"
gdb_test "print \$_exception" " = $output" \
"print exception value at rethrow"
diff --git a/gdb/testsuite/gdb.cp/expand-psymtabs-cxx.cc b/gdb/testsuite/gdb.cp/expand-psymtabs-cxx.cc
index 98e2fe0..f3c3626 100644
--- a/gdb/testsuite/gdb.cp/expand-psymtabs-cxx.cc
+++ b/gdb/testsuite/gdb.cp/expand-psymtabs-cxx.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/expand-psymtabs-cxx.exp b/gdb/testsuite/gdb.cp/expand-psymtabs-cxx.exp
index 42984e6..182b5d7 100644
--- a/gdb/testsuite/gdb.cp/expand-psymtabs-cxx.exp
+++ b/gdb/testsuite/gdb.cp/expand-psymtabs-cxx.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/expand-sals.cc b/gdb/testsuite/gdb.cp/expand-sals.cc
index bda5a38..8fd47d7 100644
--- a/gdb/testsuite/gdb.cp/expand-sals.cc
+++ b/gdb/testsuite/gdb.cp/expand-sals.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.cp/expand-sals.exp b/gdb/testsuite/gdb.cp/expand-sals.exp
index 84ec345..df6fb6a 100644
--- a/gdb/testsuite/gdb.cp/expand-sals.exp
+++ b/gdb/testsuite/gdb.cp/expand-sals.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ set srcfile expand-sals.cc
if { [prepare_for_testing "failed to prepare" expand-sals $srcfile {debug c++}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.cp/extern-c.cc b/gdb/testsuite/gdb.cp/extern-c.cc
index 9ba5607..a095a28 100644
--- a/gdb/testsuite/gdb.cp/extern-c.cc
+++ b/gdb/testsuite/gdb.cp/extern-c.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/extern-c.exp b/gdb/testsuite/gdb.cp/extern-c.exp
index 94fc65b..d3db955 100644
--- a/gdb/testsuite/gdb.cp/extern-c.exp
+++ b/gdb/testsuite/gdb.cp/extern-c.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/filename.cc b/gdb/testsuite/gdb.cp/filename.cc
index 8e888f6..fe428df 100644
--- a/gdb/testsuite/gdb.cp/filename.cc
+++ b/gdb/testsuite/gdb.cp/filename.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/filename.exp b/gdb/testsuite/gdb.cp/filename.exp
index 20f6a1c..b1f7ec6 100644
--- a/gdb/testsuite/gdb.cp/filename.exp
+++ b/gdb/testsuite/gdb.cp/filename.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/formatted-ref.cc b/gdb/testsuite/gdb.cp/formatted-ref.cc
index 4e38e33..8a10760 100644
--- a/gdb/testsuite/gdb.cp/formatted-ref.cc
+++ b/gdb/testsuite/gdb.cp/formatted-ref.cc
@@ -1,4 +1,4 @@
-/* Copyright 2007-2024 Free Software Foundation, Inc.
+/* Copyright 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.cp/formatted-ref.exp b/gdb/testsuite/gdb.cp/formatted-ref.exp
index 97c0198..bf0aae3 100644
--- a/gdb/testsuite/gdb.cp/formatted-ref.exp
+++ b/gdb/testsuite/gdb.cp/formatted-ref.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,9 +15,9 @@
# Author: P. N. Hilfinger, AdaCore, Inc.
-# This test checks the behavior of formatted print when applied to a
+# This test checks the behavior of formatted print when applied to a
# reference value. The intended behavior is that a formatted print of
-# such a value should display the same value as a plain print,
+# such a value should display the same value as a plain print,
# modulo format, of course. Older versions of GDB would instead print
# the reference's address value itself when doing a formatted print,
# rather than printing both that and the dereferenced value. We also
@@ -44,7 +44,7 @@ proc get_address { var } {
-re "\\$\[0-9\]+ = \\(.*\\) (0x\[0-9a-f\]+).*$gdb_prompt $" {
return $expect_out(1,string)
}
- timeout {
+ timeout {
perror "couldn't find address of $var"
return ""
}
@@ -59,7 +59,7 @@ proc test_p_x { var type val addr } {
gdb_test_multiple $test $test {
-re "\\$\[0-9\]+ = \\([string_to_regexp $type]\\) @0x\[a-f0-9\]+: [string_to_regexp $val].*$gdb_prompt $" {
pass $test
- }
+ }
-re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" {
fail "$test (prints just address)"
}
@@ -77,7 +77,7 @@ proc test_p_x_addr { var addr } {
gdb_test_multiple $test $test {
-re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" {
pass $test
- }
+ }
-re "\\$\[0-9\]+ = 0x\[a-f0-9+\]+.*$gdb_prompt $" {
fail "$test (prints unexpected address)"
}
diff --git a/gdb/testsuite/gdb.cp/fpointer.exp b/gdb/testsuite/gdb.cp/fpointer.exp
index 4130be8..4287452 100644
--- a/gdb/testsuite/gdb.cp/fpointer.exp
+++ b/gdb/testsuite/gdb.cp/fpointer.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/gdb1355.exp b/gdb/testsuite/gdb.cp/gdb1355.exp
index 17e7b35..c54723d 100644
--- a/gdb/testsuite/gdb.cp/gdb1355.exp
+++ b/gdb/testsuite/gdb.cp/gdb1355.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
if {![runto_main]} {
return
-}
+}
# See http://sources.redhat.com/gdb/bugs/1355
# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12066
diff --git a/gdb/testsuite/gdb.cp/gdb2384-base.cc b/gdb/testsuite/gdb.cp/gdb2384-base.cc
index aeb6fd9..1d09817 100644
--- a/gdb/testsuite/gdb.cp/gdb2384-base.cc
+++ b/gdb/testsuite/gdb.cp/gdb2384-base.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/gdb2384-base.h b/gdb/testsuite/gdb.cp/gdb2384-base.h
index 483a37f..07a61d2 100644
--- a/gdb/testsuite/gdb.cp/gdb2384-base.h
+++ b/gdb/testsuite/gdb.cp/gdb2384-base.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/gdb2384.cc b/gdb/testsuite/gdb.cp/gdb2384.cc
index 83f3405..440deba 100644
--- a/gdb/testsuite/gdb.cp/gdb2384.cc
+++ b/gdb/testsuite/gdb.cp/gdb2384.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/gdb2384.exp b/gdb/testsuite/gdb.cp/gdb2384.exp
index b378692..a53ec3a 100644
--- a/gdb/testsuite/gdb.cp/gdb2384.exp
+++ b/gdb/testsuite/gdb.cp/gdb2384.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ if { [gdb_compile_shlib $srcdir/$subdir/$srcfile2 $sofile {debug c++}] != ""
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_load_shlib ${sofile}
diff --git a/gdb/testsuite/gdb.cp/gdb2495.cc b/gdb/testsuite/gdb.cp/gdb2495.cc
index 4667e3c..ca70dc7 100644
--- a/gdb/testsuite/gdb.cp/gdb2495.cc
+++ b/gdb/testsuite/gdb.cp/gdb2495.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/gdb2495.exp b/gdb/testsuite/gdb.cp/gdb2495.exp
index 86ee7f9..d5fdace 100644
--- a/gdb/testsuite/gdb.cp/gdb2495.exp
+++ b/gdb/testsuite/gdb.cp/gdb2495.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/hang.exp b/gdb/testsuite/gdb.cp/hang.exp
index 86eab15..7279e01 100644
--- a/gdb/testsuite/gdb.cp/hang.exp
+++ b/gdb/testsuite/gdb.cp/hang.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/impl-this.cc b/gdb/testsuite/gdb.cp/impl-this.cc
index ba2fd02..c6a775e 100644
--- a/gdb/testsuite/gdb.cp/impl-this.cc
+++ b/gdb/testsuite/gdb.cp/impl-this.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/impl-this.exp b/gdb/testsuite/gdb.cp/impl-this.exp
index 6d6449c..e17809a 100644
--- a/gdb/testsuite/gdb.cp/impl-this.exp
+++ b/gdb/testsuite/gdb.cp/impl-this.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/includefile b/gdb/testsuite/gdb.cp/includefile
index 52841f4..70d0452 100644
--- a/gdb/testsuite/gdb.cp/includefile
+++ b/gdb/testsuite/gdb.cp/includefile
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/incomplete-type-overload.cc b/gdb/testsuite/gdb.cp/incomplete-type-overload.cc
index e03a4d3..b62807a 100644
--- a/gdb/testsuite/gdb.cp/incomplete-type-overload.cc
+++ b/gdb/testsuite/gdb.cp/incomplete-type-overload.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/incomplete-type-overload.exp b/gdb/testsuite/gdb.cp/incomplete-type-overload.exp
index 83f0928..007c238 100644
--- a/gdb/testsuite/gdb.cp/incomplete-type-overload.exp
+++ b/gdb/testsuite/gdb.cp/incomplete-type-overload.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,11 +33,11 @@ set flags_nodebug {}
lappend flags_nodebug nodebug
lappend flags_nodebug c++
-if [prepare_for_testing "failed to prepare" $testfile $srcfile $flags_debug] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags_debug]} {
return
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
@@ -57,105 +57,113 @@ Dwarf::assemble ${asm_file} {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
- {name $srcfile}
- {stmt_list $L DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name $srcfile
+ DW_AT_stmt_list $L DW_FORM_sec_offset
} {
declare_labels int_label base_label complete_label incomplete_label
declare_labels ptr_base_label ptr_inc_label ptr_comp_label ptr_int_label
int_label: DW_TAG_base_type {
- {DW_AT_byte_size $int_size DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name "int"}
+ DW_AT_byte_size $int_size DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name "int"
}
base_label: DW_TAG_class_type {
- {DW_AT_byte_size $struct_base_size DW_FORM_sdata}
- {DW_AT_name "base"}
+ DW_AT_byte_size $struct_base_size DW_FORM_sdata
+ DW_AT_name "base"
} {
DW_TAG_member {
- {DW_AT_name "member"}
- {DW_AT_type :$int_label}
- {DW_AT_data_member_location 0 DW_FORM_sdata}
+ DW_AT_name "member"
+ DW_AT_type :$int_label
+ DW_AT_data_member_location 0 DW_FORM_sdata
}
}
complete_label: DW_TAG_class_type {
- {DW_AT_byte_size $struct_complete_size DW_FORM_sdata}
- {DW_AT_name "complete"}
+ DW_AT_byte_size $struct_complete_size DW_FORM_sdata
+ DW_AT_name "complete"
} {
DW_TAG_inheritance {
- {DW_AT_type :$base_label}
- {DW_AT_data_member_location 0 DW_FORM_sdata}
- {DW_AT_accessibility 1 DW_FORM_data1}
+ DW_AT_type :$base_label
+ DW_AT_data_member_location 0 DW_FORM_sdata
+ DW_AT_accessibility 1 DW_FORM_data1
}
}
incomplete_label: DW_TAG_class_type {
- {DW_AT_name "incomplete"}
- {DW_AT_declaration 1 DW_FORM_flag_present}
+ DW_AT_name "incomplete"
+ DW_AT_declaration 1 DW_FORM_flag_present
}
ptr_base_label: DW_TAG_pointer_type {
- {DW_AT_byte_size $addr_size DW_FORM_udata}
- {DW_AT_type :$base_label}
+ DW_AT_byte_size $addr_size DW_FORM_udata
+ DW_AT_type :$base_label
}
ptr_inc_label: DW_TAG_pointer_type {
- {DW_AT_byte_size $addr_size DW_FORM_udata}
- {DW_AT_type :$incomplete_label}
+ DW_AT_byte_size $addr_size DW_FORM_udata
+ DW_AT_type :$incomplete_label
}
ptr_comp_label: DW_TAG_pointer_type {
- {DW_AT_byte_size $addr_size DW_FORM_udata}
- {DW_AT_type :$complete_label}
+ DW_AT_byte_size $addr_size DW_FORM_udata
+ DW_AT_type :$complete_label
}
ptr_int_label: DW_TAG_pointer_type {
- {DW_AT_byte_size $addr_size DW_FORM_udata}
- {DW_AT_type :$int_label}
+ DW_AT_byte_size $addr_size DW_FORM_udata
+ DW_AT_type :$int_label
}
DW_TAG_variable {
- {DW_AT_name "comp"}
- {DW_AT_type :$complete_label}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "comp"]} SPECIAL_expr}
- {DW_AT_external 1 DW_FORM_flag}
+ DW_AT_name "comp"
+ DW_AT_type :$complete_label
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "comp"]
+ } SPECIAL_expr
+ DW_AT_external 1 DW_FORM_flag
}
DW_TAG_variable {
- {DW_AT_name "cp"}
- {DW_AT_type :$ptr_comp_label}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "cp"]} SPECIAL_expr}
- {DW_AT_external 1 DW_FORM_flag}
+ DW_AT_name "cp"
+ DW_AT_type :$ptr_comp_label
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "cp"]
+ } SPECIAL_expr
+ DW_AT_external 1 DW_FORM_flag
}
DW_TAG_variable {
- {DW_AT_name "inc"}
- {DW_AT_type :$ptr_inc_label}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "inc"]} SPECIAL_expr}
- {DW_AT_external 1 DW_FORM_flag}
+ DW_AT_name "inc"
+ DW_AT_type :$ptr_inc_label
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "inc"]
+ } SPECIAL_expr
+ DW_AT_external 1 DW_FORM_flag
}
DW_TAG_variable {
- {DW_AT_name "ip"}
- {DW_AT_type :$ptr_int_label}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "ip"]} SPECIAL_expr}
- {DW_AT_external 1 DW_FORM_flag}
+ DW_AT_name "ip"
+ DW_AT_type :$ptr_int_label
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "ip"]
+ } SPECIAL_expr
+ DW_AT_external 1 DW_FORM_flag
}
DW_TAG_subprogram {
- {MACRO_AT_func {"main"}}
- {DW_AT_external 1 flag}
+ MACRO_AT_func {"main"}
+ DW_AT_external 1 flag
}
DW_TAG_subprogram {
- {MACRO_AT_func {"foo"}}
- {DW_AT_type :$int_label}
- {DW_AT_external 1 flag}
+ MACRO_AT_func {"foo"}
+ DW_AT_type :$int_label
+ DW_AT_external 1 flag
} { formal_parameter {
- {DW_AT_name "b"}
- {DW_AT_type :$ptr_base_label}
+ DW_AT_name "b"
+ DW_AT_type :$ptr_base_label
}
}
}
@@ -167,12 +175,12 @@ Dwarf::assemble ${asm_file} {
}
}
-if [prepare_for_testing "failed to prepare" $testfile \
- [list $asm_file $srcfile] $flags_nodebug] {
+if {[prepare_for_testing "failed to prepare" $testfile \
+ [list $asm_file $srcfile] $flags_nodebug]} {
return
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.cp/infcall-dlopen-lib.cc b/gdb/testsuite/gdb.cp/infcall-dlopen-lib.cc
index 0d33595..f6afa97 100644
--- a/gdb/testsuite/gdb.cp/infcall-dlopen-lib.cc
+++ b/gdb/testsuite/gdb.cp/infcall-dlopen-lib.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/infcall-dlopen.cc b/gdb/testsuite/gdb.cp/infcall-dlopen.cc
index ec8be2d..52bfde4 100644
--- a/gdb/testsuite/gdb.cp/infcall-dlopen.cc
+++ b/gdb/testsuite/gdb.cp/infcall-dlopen.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/infcall-dlopen.exp b/gdb/testsuite/gdb.cp/infcall-dlopen.exp
index eb073af..4662e0f 100644
--- a/gdb/testsuite/gdb.cp/infcall-dlopen.exp
+++ b/gdb/testsuite/gdb.cp/infcall-dlopen.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d0.exp b/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d0.exp
index 75b0d8c..05fa8bf 100644
--- a/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d0.exp
+++ b/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d0.exp
@@ -1,5 +1,5 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d1.exp b/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d1.exp
index df8a5bd..c47eb59 100644
--- a/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d1.exp
+++ b/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d1.exp
@@ -1,5 +1,5 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug-c-d0.exp b/gdb/testsuite/gdb.cp/infcall-nodebug-c-d0.exp
index 8233c75..9f6b786 100644
--- a/gdb/testsuite/gdb.cp/infcall-nodebug-c-d0.exp
+++ b/gdb/testsuite/gdb.cp/infcall-nodebug-c-d0.exp
@@ -1,5 +1,5 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug-c-d1.exp b/gdb/testsuite/gdb.cp/infcall-nodebug-c-d1.exp
index 2216e54..5d2bc87 100644
--- a/gdb/testsuite/gdb.cp/infcall-nodebug-c-d1.exp
+++ b/gdb/testsuite/gdb.cp/infcall-nodebug-c-d1.exp
@@ -1,5 +1,5 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug-lib.c b/gdb/testsuite/gdb.cp/infcall-nodebug-lib.c
index 6d94fad..9ca9294 100644
--- a/gdb/testsuite/gdb.cp/infcall-nodebug-lib.c
+++ b/gdb/testsuite/gdb.cp/infcall-nodebug-lib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug-main.c b/gdb/testsuite/gdb.cp/infcall-nodebug-main.c
index 0bb498b..83c27e7 100644
--- a/gdb/testsuite/gdb.cp/infcall-nodebug-main.c
+++ b/gdb/testsuite/gdb.cp/infcall-nodebug-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl b/gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl
index ff0e8f4..b743498 100644
--- a/gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl
+++ b/gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl
@@ -1,5 +1,5 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
# the rest of the test can be complied with debug information. Whilst we
# are at it, also test functions with debug information and C functions too.
-if [target_info exists gdb,cannot_call_functions] {
+if {[target_info exists gdb,cannot_call_functions]} {
unsupported "this target can not call functions"
continue
}
@@ -71,9 +71,9 @@ proc build_and_run_test { lang symbols } {
# Startup and run to main.
- clean_restart $binfile
+ clean_restart $::testfile
- if ![runto_main] then {
+ if { ![runto_main] } {
return
}
diff --git a/gdb/testsuite/gdb.cp/inherit.exp b/gdb/testsuite/gdb.cp/inherit.exp
index 929c898..25a7e78 100644
--- a/gdb/testsuite/gdb.cp/inherit.exp
+++ b/gdb/testsuite/gdb.cp/inherit.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/iostream.cc b/gdb/testsuite/gdb.cp/iostream.cc
index 887e88a..9a8bab3 100644
--- a/gdb/testsuite/gdb.cp/iostream.cc
+++ b/gdb/testsuite/gdb.cp/iostream.cc
@@ -1,6 +1,6 @@
/* Code to go along with tests in rtti.exp.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.cp/iostream.exp b/gdb/testsuite/gdb.cp/iostream.exp
index c9f8592..621695f 100644
--- a/gdb/testsuite/gdb.cp/iostream.exp
+++ b/gdb/testsuite/gdb.cp/iostream.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.cp/koenig.exp b/gdb/testsuite/gdb.cp/koenig.exp
index 7e0b4f7..377057e 100644
--- a/gdb/testsuite/gdb.cp/koenig.exp
+++ b/gdb/testsuite/gdb.cp/koenig.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/local-static.c b/gdb/testsuite/gdb.cp/local-static.c
index 0b190e4..85b452a 100644
--- a/gdb/testsuite/gdb.cp/local-static.c
+++ b/gdb/testsuite/gdb.cp/local-static.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/local-static.exp b/gdb/testsuite/gdb.cp/local-static.exp
index 1acf7d6..c80c621 100644
--- a/gdb/testsuite/gdb.cp/local-static.exp
+++ b/gdb/testsuite/gdb.cp/local-static.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/local.exp b/gdb/testsuite/gdb.cp/local.exp
index 43db4a4..7c13de0 100644
--- a/gdb/testsuite/gdb.cp/local.exp
+++ b/gdb/testsuite/gdb.cp/local.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -174,7 +174,7 @@ gdb_test_multiple "ptype Local" "local out of scope" {
kfail gdb/825 "Local out of scope"
}
}
-
+
# DTS CLLbs14316 and CLLbs17058
# coulter - I added a clause for HP's aCC compiler. We print out the type
@@ -182,7 +182,7 @@ gdb_test_multiple "ptype Local" "local out of scope" {
# because of two reasons:
# There is a number at the end of InnerLocal4 which should not be there,
# DTS CLLbs14316
-# The line number for the class
+# The line number for the class
# setup_xfail "hppa*-*-*" CLLbs14316
# ---
diff --git a/gdb/testsuite/gdb.cp/m-data.exp b/gdb/testsuite/gdb.cp/m-data.exp
index eb75a1c..05865e5 100644
--- a/gdb/testsuite/gdb.cp/m-data.exp
+++ b/gdb/testsuite/gdb.cp/m-data.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/m-static.exp b/gdb/testsuite/gdb.cp/m-static.exp
index 3d59a48..1769ba7 100644
--- a/gdb/testsuite/gdb.cp/m-static.exp
+++ b/gdb/testsuite/gdb.cp/m-static.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ if {![runto_main]} {
}
get_debug_format
-set non_dwarf [expr ! [test_debug_format "DWARF \[0-9\]"]]
+set non_dwarf [expr {! [test_debug_format "DWARF \[0-9\]"]}]
# First, run to after we've constructed all the objects:
diff --git a/gdb/testsuite/gdb.cp/main-cp.exp b/gdb/testsuite/gdb.cp/main-cp.exp
index 98024bf..f859226 100644
--- a/gdb/testsuite/gdb.cp/main-cp.exp
+++ b/gdb/testsuite/gdb.cp/main-cp.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/main.cc b/gdb/testsuite/gdb.cp/main.cc
index 75dd353..b6c34a2 100644
--- a/gdb/testsuite/gdb.cp/main.cc
+++ b/gdb/testsuite/gdb.cp/main.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/maint.exp b/gdb/testsuite/gdb.cp/maint.exp
index abd5931..68576d5 100644
--- a/gdb/testsuite/gdb.cp/maint.exp
+++ b/gdb/testsuite/gdb.cp/maint.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/many-args.cc b/gdb/testsuite/gdb.cp/many-args.cc
index f801c27..bf249ac 100644
--- a/gdb/testsuite/gdb.cp/many-args.cc
+++ b/gdb/testsuite/gdb.cp/many-args.cc
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.cp/many-args.exp b/gdb/testsuite/gdb.cp/many-args.exp
index 7e76ce1..fcb0a36 100644
--- a/gdb/testsuite/gdb.cp/many-args.exp
+++ b/gdb/testsuite/gdb.cp/many-args.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.cp/mb-ctor.exp b/gdb/testsuite/gdb.cp/mb-ctor.exp
index 1a84b79..db1da69 100644
--- a/gdb/testsuite/gdb.cp/mb-ctor.exp
+++ b/gdb/testsuite/gdb.cp/mb-ctor.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/mb-inline.exp b/gdb/testsuite/gdb.cp/mb-inline.exp
index db80bb4..579bcc6 100644
--- a/gdb/testsuite/gdb.cp/mb-inline.exp
+++ b/gdb/testsuite/gdb.cp/mb-inline.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -69,7 +69,7 @@ gdb_test_multiple "info break" "disabled breakpoint 1.2" {
# will loose. The heuristic of GDB should be improved.
setup_kfail gdb/12924 "*-*-uclinux*"
fail "disabled breakpoint 1.2"
- }
+ }
}
# Make sure we can set a breakpoint on a source statement that spans
diff --git a/gdb/testsuite/gdb.cp/mb-inline.h b/gdb/testsuite/gdb.cp/mb-inline.h
index 8983545..c5bc2ef 100644
--- a/gdb/testsuite/gdb.cp/mb-inline.h
+++ b/gdb/testsuite/gdb.cp/mb-inline.h
@@ -4,7 +4,7 @@
This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/mb-inline1.cc b/gdb/testsuite/gdb.cp/mb-inline1.cc
index 1dfc7bf..0c82905 100644
--- a/gdb/testsuite/gdb.cp/mb-inline1.cc
+++ b/gdb/testsuite/gdb.cp/mb-inline1.cc
@@ -2,7 +2,7 @@
This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/mb-inline2.cc b/gdb/testsuite/gdb.cp/mb-inline2.cc
index 545bf20..8e6b9e6 100644
--- a/gdb/testsuite/gdb.cp/mb-inline2.cc
+++ b/gdb/testsuite/gdb.cp/mb-inline2.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/mb-templates.exp b/gdb/testsuite/gdb.cp/mb-templates.exp
index 2df88a3..b067cb0 100644
--- a/gdb/testsuite/gdb.cp/mb-templates.exp
+++ b/gdb/testsuite/gdb.cp/mb-templates.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -61,7 +61,7 @@ gdb_test "break $srcfile:$bp_location" \
gdb_test_no_output {condition $bpnum i==1} \
"separate condition: set condition"
-
+
gdb_run_cmd
gdb_test "" "Breakpoint $bkptno_num_re,.*foo<int> \\(i=1\\).*" "separate condition: run to breakpoint"
diff --git a/gdb/testsuite/gdb.cp/member-name.cc b/gdb/testsuite/gdb.cp/member-name.cc
index f9ae875..1f1db76 100644
--- a/gdb/testsuite/gdb.cp/member-name.cc
+++ b/gdb/testsuite/gdb.cp/member-name.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2003-2024 Free Software Foundation, Inc.
+ Copyright 2003-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/member-name.exp b/gdb/testsuite/gdb.cp/member-name.exp
index 70806b5..069d5b2 100644
--- a/gdb/testsuite/gdb.cp/member-name.exp
+++ b/gdb/testsuite/gdb.cp/member-name.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/member-ptr.cc b/gdb/testsuite/gdb.cp/member-ptr.cc
index 7fb2a91..6fb373b 100644
--- a/gdb/testsuite/gdb.cp/member-ptr.cc
+++ b/gdb/testsuite/gdb.cp/member-ptr.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1998-2024 Free Software Foundation, Inc.
+ Copyright 1998-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/member-ptr.exp b/gdb/testsuite/gdb.cp/member-ptr.exp
index d02a1ea..83640e6 100644
--- a/gdb/testsuite/gdb.cp/member-ptr.exp
+++ b/gdb/testsuite/gdb.cp/member-ptr.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This file is part of the gdb testsuite
diff --git a/gdb/testsuite/gdb.cp/meth-typedefs.cc b/gdb/testsuite/gdb.cp/meth-typedefs.cc
index 48ac17d..9842288 100644
--- a/gdb/testsuite/gdb.cp/meth-typedefs.cc
+++ b/gdb/testsuite/gdb.cp/meth-typedefs.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/meth-typedefs.exp b/gdb/testsuite/gdb.cp/meth-typedefs.exp
index 149f44c..0438b2e 100644
--- a/gdb/testsuite/gdb.cp/meth-typedefs.exp
+++ b/gdb/testsuite/gdb.cp/meth-typedefs.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# Contributed by Red Hat, originally written by Keith Seitz.
#
diff --git a/gdb/testsuite/gdb.cp/method-call-in-c.cc b/gdb/testsuite/gdb.cp/method-call-in-c.cc
index 87820ab..065dcec 100644
--- a/gdb/testsuite/gdb.cp/method-call-in-c.cc
+++ b/gdb/testsuite/gdb.cp/method-call-in-c.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/method-call-in-c.exp b/gdb/testsuite/gdb.cp/method-call-in-c.exp
index 1c2b432..b0201ad 100644
--- a/gdb/testsuite/gdb.cp/method-call-in-c.exp
+++ b/gdb/testsuite/gdb.cp/method-call-in-c.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ foreach_with_prefix lang { c++ c } {
gdb_test "print foo.func (b, f)" " = ${result}"
incr result
- set result [expr $result + 3]
+ set result [expr {$result + 3}]
gdb_test "print foo += b" \
" = \\((?:struct )?foo_type &\\) @${hex}: \\\{var = ${result}\\\}"
diff --git a/gdb/testsuite/gdb.cp/method-ref-return.cc b/gdb/testsuite/gdb.cp/method-ref-return.cc
new file mode 100644
index 0000000..4169bfe
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/method-ref-return.cc
@@ -0,0 +1,42 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Test that we can access class method/data member via reference. */
+
+struct foo
+{
+ foo () : m_a (42) {}
+ int get_a () const { return m_a; }
+ int m_a;
+};
+
+struct bar
+{
+ bar () : m_foo () {}
+ const foo &get_foo () const { return m_foo; }
+ foo m_foo;
+};
+
+int
+main (int argc, char *argv[])
+{
+ bar b;
+ const foo &ref = b.get_foo ();
+ int ret = ref.m_a; // breakpoint here
+ ret += ref.get_a ();
+ return ret;
+} \ No newline at end of file
diff --git a/gdb/testsuite/gdb.cp/method-ref-return.exp b/gdb/testsuite/gdb.cp/method-ref-return.exp
new file mode 100644
index 0000000..1ac5ac9
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/method-ref-return.exp
@@ -0,0 +1,70 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test calling methods and accessing members via reference.
+
+require allow_cplus_tests
+
+standard_testfile .cc
+
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
+ return -1
+}
+
+if {![runto_main]} {
+ return -1
+}
+
+# Set a breakpoint after the bar object is created and the reference is obtained.
+gdb_breakpoint [gdb_get_line_number "breakpoint here"]
+gdb_continue_to_breakpoint "after reference assignment"
+
+# Test that we can call the method through reference and get the expected result.
+gdb_test_multiple "print b.get_foo()" "print method call returning reference" {
+ -re "\\$\[0-9\]+ = \\(const foo &\\) @$hex: \\{m_a = 42\\}\r\n$gdb_prompt $" {
+ pass $gdb_test_name
+ }
+ -re "Could not validate memory tag: Value can't be converted to integer\\." {
+ fail "$gdb_test_name"
+ }
+}
+
+# Test accessing the member through the reference.
+gdb_test "print b.get_foo ().m_a" \
+ "\\$\[0-9\]+ = 42" \
+ "print member access through reference"
+
+# Test calling method on the referenced object.
+gdb_test "print b.get_foo ().get_a()" \
+ "\\$\[0-9\]+ = 42" \
+ "print method call on referenced object"
+
+# Test that the stored reference works correctly.
+gdb_test_multiple "print ref" "print stored reference" {
+ -re "\\$\[0-9\]+ = \\(const foo &\\) @$hex: \\{m_a = 42\\}\r\n$gdb_prompt $" {
+ pass $gdb_test_name
+ }
+ -re "Could not validate memory tag: Value can't be converted to integer\\." {
+ fail "$gdb_test_name"
+ }
+}
+
+gdb_test "print ref.m_a" \
+ "\\$\[0-9\]+ = 42" \
+ "print member through stored reference"
+
+gdb_test "print ref.get_a()" \
+ "\\$\[0-9\]+ = 42" \
+ "print method call through stored reference" \ No newline at end of file
diff --git a/gdb/testsuite/gdb.cp/method.exp b/gdb/testsuite/gdb.cp/method.exp
index 9383816..410647a 100644
--- a/gdb/testsuite/gdb.cp/method.exp
+++ b/gdb/testsuite/gdb.cp/method.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@ gdb_test "print x" \
"\\$\[0-9\]* = 20" \
"print x in A::foo"
-# Check access to this pointer
+# Check access to this pointer
gdb_test "print this" \
"\\$\[0-9\]* = \\((class |)A *\\* *(const|)\\) $hex" \
@@ -82,7 +82,7 @@ gdb_test "print x" \
"\\$\[0-9\]* = 33" \
"print x in A::bar"
-# Check access to this pointer
+# Check access to this pointer
get_debug_format
@@ -123,7 +123,7 @@ gdb_test "print data_" \
"\\$\[0-9\]* = 33" \
"print data_ in funk::getFunky"
-# Check access to this pointer
+# Check access to this pointer
gdb_test "print this" \
"\\$\[0-9\]* = \\((class |)funk *\\* *(const|)\\) $hex" \
@@ -157,7 +157,7 @@ gdb_test_multiple "cont" "finish program" {
pass "finish program"
}
-re "Continuing.* EXIT code 0.*$inferior_exited_re normally.*$gdb_prompt $" {
- pass "finish program (exit wrapper)"
+ pass "finish program (exit wrapper)"
}
}
diff --git a/gdb/testsuite/gdb.cp/method2.exp b/gdb/testsuite/gdb.cp/method2.exp
index 0a07ff3..71cf0f0 100644
--- a/gdb/testsuite/gdb.cp/method2.exp
+++ b/gdb/testsuite/gdb.cp/method2.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/minsym-fallback-main.cc b/gdb/testsuite/gdb.cp/minsym-fallback-main.cc
index 5c7a617..f16a4ca 100644
--- a/gdb/testsuite/gdb.cp/minsym-fallback-main.cc
+++ b/gdb/testsuite/gdb.cp/minsym-fallback-main.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/minsym-fallback.cc b/gdb/testsuite/gdb.cp/minsym-fallback.cc
index 2ceb062..68de64b 100644
--- a/gdb/testsuite/gdb.cp/minsym-fallback.cc
+++ b/gdb/testsuite/gdb.cp/minsym-fallback.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/minsym-fallback.exp b/gdb/testsuite/gdb.cp/minsym-fallback.exp
index 6d8fd48..2464290 100644
--- a/gdb/testsuite/gdb.cp/minsym-fallback.exp
+++ b/gdb/testsuite/gdb.cp/minsym-fallback.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/minsym-fallback.h b/gdb/testsuite/gdb.cp/minsym-fallback.h
index d4c03ff..d1beb6f 100644
--- a/gdb/testsuite/gdb.cp/minsym-fallback.h
+++ b/gdb/testsuite/gdb.cp/minsym-fallback.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/misc.cc b/gdb/testsuite/gdb.cp/misc.cc
index 9819e21..5db4619 100644
--- a/gdb/testsuite/gdb.cp/misc.cc
+++ b/gdb/testsuite/gdb.cp/misc.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1993-2024 Free Software Foundation, Inc.
+ Copyright 1993-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/misc.exp b/gdb/testsuite/gdb.cp/misc.exp
index 3f5532e..6400395 100644
--- a/gdb/testsuite/gdb.cp/misc.exp
+++ b/gdb/testsuite/gdb.cp/misc.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -49,12 +49,12 @@ proc test_expr { args } {
if { [llength $args] % 2 } {
warning "an even # of arguments should be passed to test_expr"
}
- set last_ent [expr [llength $args] - 1]
+ set last_ent [expr {[llength $args] - 1}]
set testname [lindex $args $last_ent]
gdb_test_no_output [lindex $args 0] "$testname, setup"
- for {set x 1} {$x < $last_ent} {set x [expr $x + 2]} {
- gdb_test [lindex $args $x] [lindex $args [expr $x + 1]] "$testname, [lindex $args $x]"
+ for {set x 1} {$x < $last_ent} {set x [expr {$x + 2}]} {
+ gdb_test [lindex $args $x] [lindex $args [expr {$x + 1}]] "$testname, [lindex $args $x]"
}
}
@@ -72,7 +72,7 @@ test_expr "set language c++" \
"print as bool"
# Test bool type printing, etc.
-# Note: Language is already set to C++ above!
+# Note: Language is already set to C++ above!
gdb_test "print v_bool" "\\$\[0-9\]* = false" "print a bool var"
# set a bool variable
diff --git a/gdb/testsuite/gdb.cp/namelessclass.S b/gdb/testsuite/gdb.cp/namelessclass.S
index 5d4d7c1..9f1cbb3 100644
--- a/gdb/testsuite/gdb.cp/namelessclass.S
+++ b/gdb/testsuite/gdb.cp/namelessclass.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/namelessclass.cc b/gdb/testsuite/gdb.cp/namelessclass.cc
index ff13486..344fbec 100644
--- a/gdb/testsuite/gdb.cp/namelessclass.cc
+++ b/gdb/testsuite/gdb.cp/namelessclass.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/namelessclass.exp b/gdb/testsuite/gdb.cp/namelessclass.exp
index fc592ce..c1d3685 100644
--- a/gdb/testsuite/gdb.cp/namelessclass.exp
+++ b/gdb/testsuite/gdb.cp/namelessclass.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/namespace-enum.exp b/gdb/testsuite/gdb.cp/namespace-enum.exp
index 77c7daa..575ad3a 100644
--- a/gdb/testsuite/gdb.cp/namespace-enum.exp
+++ b/gdb/testsuite/gdb.cp/namespace-enum.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/namespace-nested-import.exp b/gdb/testsuite/gdb.cp/namespace-nested-import.exp
index 8bf0982..1d15c20 100644
--- a/gdb/testsuite/gdb.cp/namespace-nested-import.exp
+++ b/gdb/testsuite/gdb.cp/namespace-nested-import.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp
index 504359d..6569f79 100644
--- a/gdb/testsuite/gdb.cp/namespace.exp
+++ b/gdb/testsuite/gdb.cp/namespace.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -89,10 +89,10 @@ setup_xfail hppa*-*-*11* CLLbs14869
gdb_test_multiple "info func xyzq" "info func xyzq" {
-re "All functions.*File.*namespace.cc:\r\n.*\tint AAA::A_xyzq\\(int\\);\r\n.*\tint BBB::B_xyzq\\(int\\);\r\n.*\tchar AAA::xyzq\\(char\\);\r\n.*\tchar BBB::xyzq\\(char\\);\r\n.*\tchar BBB::CCC::xyzq\\(char\\);\r\n.*\tchar BBB::Class::xyzq\\(char\\);\r\n$gdb_prompt $" {
pass "info func xyzq"
- }
+ }
-re "All functions.*File.*namespace.cc:\r\n.*\tint AAA::A_xyzq\\(int\\);\r\n.*\tchar AAA::xyzq\\(char\\);\r\n.*\tint BBB::B_xyzq\\(int\\);\r\n.*\tchar BBB::CCC::xyzq\\(char\\);\r\n.*\tchar BBB::Class::xyzq\\(char\\);\r\n.*\tchar BBB::xyzq\\(char\\);\r\n$gdb_prompt $" {
pass "info func xyzq"
- }
+ }
}
# Call a function in a namespace
@@ -120,7 +120,7 @@ gdb_test "print 'BBB::CCC::xyzq'('x')" \
gdb_test "print BBB::CCC::xyzq('x')" \
"\\$\[0-9\]* = 122 'z'"
-
+
# Break on a function in a nested namespace
gdb_test "break BBB::CCC::xyzq" \
@@ -153,9 +153,9 @@ gdb_test "whatis ::C::cOtherFileVar" "type = const C::cOtherFileType"
gdb_test "print C::cOtherFileVar" "\\$\[0-9\].* = 319"
gdb_test "print ::C::cOtherFileVar" "\\$\[0-9\].* = 319"
-if $xfail_class_types { setup_xfail *-*-* }
+if {$xfail_class_types} { setup_xfail *-*-* }
gdb_test "whatis C::OtherFileClass::cOtherFileClassType" "type = short"
-if $xfail_class_types { setup_xfail *-*-* }
+if {$xfail_class_types} { setup_xfail *-*-* }
gdb_test "whatis ::C::OtherFileClass::cOtherFileClassType" "type = short"
gdb_test "print C::OtherFileClass::cOtherFileClassVar" " = 318"
@@ -171,8 +171,8 @@ gdb_test_multiple $test $test {
}
-re "\\$\[0-9\].* = 318\r\n$gdb_prompt $" {
# Do not permit to XFAIL on recent GCCs.
- if $xfail_class_types {
- setup_xfail *-*-*
+ if {$xfail_class_types} {
+ setup_xfail *-*-*
fail $test
# Unresolved means human intervention is required to determine
# whether the test passed or failed. Since the previous test
@@ -226,9 +226,9 @@ gdb_test "ptype C::OtherFileClass" "No symbol \"OtherFileClass\" in namespace \"
# Test class typedefs printing.
set expect "type = class C::OtherFileClass \{\r\n.*\r\n *typedef short cOtherFileClassType;\r\n *typedef long cOtherFileClassType2;\r\n\}"
-if $xfail_class_types { setup_xfail *-*-* }
+if {$xfail_class_types} { setup_xfail *-*-* }
gdb_test "ptype OtherFileClass" $expect "ptype OtherFileClass typedefs"
-if $xfail_class_types { setup_xfail *-*-* }
+if {$xfail_class_types} { setup_xfail *-*-* }
gdb_test "ptype ::C::OtherFileClass" $expect "ptype ::C::OtherFileClass typedefs"
# Some anonymous namespace tests.
diff --git a/gdb/testsuite/gdb.cp/namespace1.cc b/gdb/testsuite/gdb.cp/namespace1.cc
index 933321c..608e314 100644
--- a/gdb/testsuite/gdb.cp/namespace1.cc
+++ b/gdb/testsuite/gdb.cp/namespace1.cc
@@ -1,4 +1,4 @@
-/* Copyright 2003-2024 Free Software Foundation, Inc.
+/* Copyright 2003-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/nested-class-func-class.cc b/gdb/testsuite/gdb.cp/nested-class-func-class.cc
index 0661796..05b0fb0 100644
--- a/gdb/testsuite/gdb.cp/nested-class-func-class.cc
+++ b/gdb/testsuite/gdb.cp/nested-class-func-class.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/nested-class-func-class.exp b/gdb/testsuite/gdb.cp/nested-class-func-class.exp
index 04993e3..4824fdd 100644
--- a/gdb/testsuite/gdb.cp/nested-class-func-class.exp
+++ b/gdb/testsuite/gdb.cp/nested-class-func-class.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/nested-types.cc b/gdb/testsuite/gdb.cp/nested-types.cc
index 0201ca3..9db0dee 100644
--- a/gdb/testsuite/gdb.cp/nested-types.cc
+++ b/gdb/testsuite/gdb.cp/nested-types.cc
@@ -3,7 +3,7 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/nested-types.exp b/gdb/testsuite/gdb.cp/nested-types.exp
index 294358c..28ce8e0 100644
--- a/gdb/testsuite/gdb.cp/nested-types.exp
+++ b/gdb/testsuite/gdb.cp/nested-types.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@ proc build_node {id} {
# (the source only uses that at the root struct).
# We also don't create nodes not in the source file
# (id >= 60).
- if {[expr {$n % 10}] != 0 && $n < 60} {
+ if {$n % 10 != 0 && $n < 60} {
lappend nodes($id,children) $n
}
}
@@ -96,7 +96,7 @@ proc make_source {} {
send_log "int\nmain \(\)\n\{\n"
set plist {}
for {set i 10} {$i < 60} {incr i} {
- if {$i > 10 && [expr {$i % 10}] == 0} {
+ if {$i > 10 && $i % 10 == 0} {
incr i
set plist {"S10"}
send_log "\n"
diff --git a/gdb/testsuite/gdb.cp/nextoverthrow.cc b/gdb/testsuite/gdb.cp/nextoverthrow.cc
index 2f06cd2..a1ad63a 100644
--- a/gdb/testsuite/gdb.cp/nextoverthrow.cc
+++ b/gdb/testsuite/gdb.cp/nextoverthrow.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/nextoverthrow.exp b/gdb/testsuite/gdb.cp/nextoverthrow.exp
index 61854a9..e3aae28 100644
--- a/gdb/testsuite/gdb.cp/nextoverthrow.exp
+++ b/gdb/testsuite/gdb.cp/nextoverthrow.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
if {![runto_main]} {
return
-}
+}
if {![skip_unwinder_tests]} {
unsupported "nextoverthrow.exp could not find _Unwind_DebugHook"
diff --git a/gdb/testsuite/gdb.cp/no-libstdcxx-probe.exp b/gdb/testsuite/gdb.cp/no-libstdcxx-probe.exp
index 5332575..4f84480 100644
--- a/gdb/testsuite/gdb.cp/no-libstdcxx-probe.exp
+++ b/gdb/testsuite/gdb.cp/no-libstdcxx-probe.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/non-trivial-retval.cc b/gdb/testsuite/gdb.cp/non-trivial-retval.cc
index 4e81251..0861a63 100644
--- a/gdb/testsuite/gdb.cp/non-trivial-retval.cc
+++ b/gdb/testsuite/gdb.cp/non-trivial-retval.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/non-trivial-retval.exp b/gdb/testsuite/gdb.cp/non-trivial-retval.exp
index 64c0867..9f54e4d 100644
--- a/gdb/testsuite/gdb.cp/non-trivial-retval.exp
+++ b/gdb/testsuite/gdb.cp/non-trivial-retval.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/noparam.cc b/gdb/testsuite/gdb.cp/noparam.cc
index d404565..e9671f0 100644
--- a/gdb/testsuite/gdb.cp/noparam.cc
+++ b/gdb/testsuite/gdb.cp/noparam.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/noparam.exp b/gdb/testsuite/gdb.cp/noparam.exp
index 9a2b6c1..6f8e7bf 100644
--- a/gdb/testsuite/gdb.cp/noparam.exp
+++ b/gdb/testsuite/gdb.cp/noparam.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/nsalias.cc b/gdb/testsuite/gdb.cp/nsalias.cc
index a69d42f..c1ed9bf 100644
--- a/gdb/testsuite/gdb.cp/nsalias.cc
+++ b/gdb/testsuite/gdb.cp/nsalias.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/nsalias.exp b/gdb/testsuite/gdb.cp/nsalias.exp
index 0c29e6f..7ad2da8 100644
--- a/gdb/testsuite/gdb.cp/nsalias.exp
+++ b/gdb/testsuite/gdb.cp/nsalias.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -56,111 +56,113 @@ standard_testfile .cc nsalias-dw.S
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
- compile_unit {{language @DW_LANG_C_plus_plus}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C_plus_plus
+ } {
declare_labels int_label outer_label inner_label innermost_label
declare_labels im_foo_label i_foo_label o_foo_label
declare_labels OuterInner_label oi1_label oi2_label
int_label: base_type {
- {name int}
- {encoding @DW_ATE_signed}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name int
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 DW_FORM_sdata
}
outer_label: DW_TAG_namespace {
- {name outer}
+ DW_AT_name outer
} {
inner_label: DW_TAG_namespace {
- {name inner}
+ DW_AT_name inner
} {
innermost_label: DW_TAG_namespace {
- {name innermost}
+ DW_AT_name innermost
} {
DW_TAG_variable {
- {name x}
- {type :$int_label}
- {const_value 2 DW_FORM_data1}
+ DW_AT_name x
+ DW_AT_type :$int_label
+ DW_AT_const_value 2 DW_FORM_data1
}
im_foo_label: DW_TAG_subprogram {
- {name foo}
- {external 1 flag_present}
- {declaration 1 flag_present}
+ DW_AT_name foo
+ DW_AT_external 1 flag_present
+ DW_AT_declaration 1 flag_present
}
}
imported_declaration {
- {name Innermost}
- {import :$innermost_label}
+ DW_AT_name Innermost
+ DW_AT_import :$innermost_label
}
DW_TAG_variable {
- {name x}
- {type :$int_label}
- {const_value 1 DW_FORM_data1}
+ DW_AT_name x
+ DW_AT_type :$int_label
+ DW_AT_const_value 1 DW_FORM_data1
}
i_foo_label: subprogram {
- {name foo}
- {external 1 flag_present}
- {declaration 1 flag_present}
+ DW_AT_name foo
+ DW_AT_external 1 flag_present
+ DW_AT_declaration 1 flag_present
}
}
OuterInner_label: imported_declaration {
- {name Inner}
- {import :$inner_label}
+ DW_AT_name Inner
+ DW_AT_import :$inner_label
}
DW_TAG_variable {
- {name x}
- {type :$int_label}
- {const_value 0 DW_FORM_data1}
+ DW_AT_name x
+ DW_AT_type :$int_label
+ DW_AT_const_value 0 DW_FORM_data1
}
o_foo_label: subprogram {
- {name foo}
- {external 1 flag_present}
- {declaration 1 flag_present}
+ DW_AT_name foo
+ DW_AT_external 1 flag_present
+ DW_AT_declaration 1 flag_present
}
}
imported_declaration {
- {name Outer}
- {import :$outer_label}
+ DW_AT_name Outer
+ DW_AT_import :$outer_label
}
oi1_label: imported_declaration {
- {name oi1}
- {import :$OuterInner_label}
+ DW_AT_name oi1
+ DW_AT_import :$OuterInner_label
}
oi2_label: imported_declaration {
- {name oi2}
- {import :$oi1_label}
+ DW_AT_name oi2
+ DW_AT_import :$oi1_label
}
imported_declaration {
- {name oi3}
- {import :$oi2_label}
+ DW_AT_name oi3
+ DW_AT_import :$oi2_label
}
subprogram {
- {specification :$im_foo_label}
- {low_pc 0x4 DW_FORM_addr}
- {high_pc 0x7 DW_FORM_addr}
+ DW_AT_specification :$im_foo_label
+ DW_AT_low_pc 0x4 DW_FORM_addr
+ DW_AT_high_pc 0x7 DW_FORM_addr
}
subprogram {
- {specification :$i_foo_label}
- {low_pc 0x8 DW_FORM_addr}
- {high_pc 0xb DW_FORM_addr}
+ DW_AT_specification :$i_foo_label
+ DW_AT_low_pc 0x8 DW_FORM_addr
+ DW_AT_high_pc 0xb DW_FORM_addr
}
subprogram {
- {specification :$o_foo_label}
- {low_pc 0xc DW_FORM_addr}
- {high_pc 0xf DW_FORM_addr}
+ DW_AT_specification :$o_foo_label
+ DW_AT_low_pc 0xc DW_FORM_addr
+ DW_AT_high_pc 0xf DW_FORM_addr
}
}
}
@@ -253,19 +255,19 @@ set imports {
declare_labels n0_label
n0_label: DW_TAG_namespace {
- {name n0}
+ DW_AT_name n0
} {
DW_TAG_variable {
- {name x}
- {type :$int_label}
- {const_value 3 DW_FORM_data1}
+ DW_AT_name x
+ DW_AT_type :$int_label
+ DW_AT_const_value 3 DW_FORM_data1
}
}
declare_labels n0_import
n0_import: imported_declaration {
- {name N0}
- {import :$n0_label}
+ DW_AT_name N0
+ DW_AT_import :$n0_label
}
}
@@ -273,8 +275,8 @@ for {set i 1} {$i <= 100} {incr i} {
append imports [format "
declare_labels n%d_import
n%d_import: imported_declaration {
- {name N%d}
- {import :\$n%d_import}
+ DW_AT_name N%d
+ DW_AT_import :\$n%d_import
}" $i $i $i [expr {$i - 1}]]
}
@@ -283,13 +285,15 @@ standard_testfile .cc nsalias-r-dw.S
set asm_file [standard_output_file $srcfile2]
set the_dwarf [format {
cu {} {
- compile_unit {{language @DW_LANG_C_plus_plus}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C_plus_plus
+ } {
declare_labels int_label n0_label
int_label: base_type {
- {name int}
- {encoding @DW_ATE_signed}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name int
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 DW_FORM_sdata
}
%s
diff --git a/gdb/testsuite/gdb.cp/nsdecl.exp b/gdb/testsuite/gdb.cp/nsdecl.exp
index bb8e956..40030ed 100644
--- a/gdb/testsuite/gdb.cp/nsdecl.exp
+++ b/gdb/testsuite/gdb.cp/nsdecl.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/nsimport.exp b/gdb/testsuite/gdb.cp/nsimport.exp
index 8d82b16..0060ed5 100644
--- a/gdb/testsuite/gdb.cp/nsimport.exp
+++ b/gdb/testsuite/gdb.cp/nsimport.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/nsnested.exp b/gdb/testsuite/gdb.cp/nsnested.exp
index 61f6175..fa3e03a 100644
--- a/gdb/testsuite/gdb.cp/nsnested.exp
+++ b/gdb/testsuite/gdb.cp/nsnested.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/nsnoimports.exp b/gdb/testsuite/gdb.cp/nsnoimports.exp
index 9d8cace..39a3480 100644
--- a/gdb/testsuite/gdb.cp/nsnoimports.exp
+++ b/gdb/testsuite/gdb.cp/nsnoimports.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/nsrecurs.exp b/gdb/testsuite/gdb.cp/nsrecurs.exp
index 01a3965..cb6689a 100644
--- a/gdb/testsuite/gdb.cp/nsrecurs.exp
+++ b/gdb/testsuite/gdb.cp/nsrecurs.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/nsstress.exp b/gdb/testsuite/gdb.cp/nsstress.exp
index 8cba69a..085dc75 100644
--- a/gdb/testsuite/gdb.cp/nsstress.exp
+++ b/gdb/testsuite/gdb.cp/nsstress.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/nsusing.exp b/gdb/testsuite/gdb.cp/nsusing.exp
index 6a4e837..90fd9fe 100644
--- a/gdb/testsuite/gdb.cp/nsusing.exp
+++ b/gdb/testsuite/gdb.cp/nsusing.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -125,7 +125,7 @@ if { [test_compiler_info {gcc-[0-3]-*}] ||
# Xfail for incorrect decl_line on DW_TAG_imported_module,
# gcc PR debug/108716.
set have_gcc108716_xfail \
- [expr [test_compiler_info gcc-*] && [gcc_major_version] < 13]
+ [expr {[test_compiler_info gcc-*] && [gcc_major_version] < 13}]
gdb_test_multiple "print x" "print x, before using statement" {
-re -wrap "No symbol .x. in current context.*" {
diff --git a/gdb/testsuite/gdb.cp/operator.exp b/gdb/testsuite/gdb.cp/operator.exp
index 504001d..c3788b6 100644
--- a/gdb/testsuite/gdb.cp/operator.exp
+++ b/gdb/testsuite/gdb.cp/operator.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/oranking.exp b/gdb/testsuite/gdb.cp/oranking.exp
index c682c7b..9bb7269 100644
--- a/gdb/testsuite/gdb.cp/oranking.exp
+++ b/gdb/testsuite/gdb.cp/oranking.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/overload-const.cc b/gdb/testsuite/gdb.cp/overload-const.cc
index c3c42f6..f320f0d 100644
--- a/gdb/testsuite/gdb.cp/overload-const.cc
+++ b/gdb/testsuite/gdb.cp/overload-const.cc
@@ -1,6 +1,6 @@
/* This test case is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/overload-const.exp b/gdb/testsuite/gdb.cp/overload-const.exp
index 888de78..6b6056e 100644
--- a/gdb/testsuite/gdb.cp/overload-const.exp
+++ b/gdb/testsuite/gdb.cp/overload-const.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,6 +25,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $testfile.cc {c++ debug}]
gdb_test_no_output "set language c++"
-if [gdb_breakpoint "myclass::func"] {
+if {[gdb_breakpoint "myclass::func"]} {
pass "setting breakpoint at myclass::func"
}
diff --git a/gdb/testsuite/gdb.cp/overload.exp b/gdb/testsuite/gdb.cp/overload.exp
index da9deef..aa1daa4 100644
--- a/gdb/testsuite/gdb.cp/overload.exp
+++ b/gdb/testsuite/gdb.cp/overload.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -346,8 +346,8 @@ with_test_prefix "list all overloads" {
set line_bar_A [gdb_get_line_number "int bar (A)"]
set line_bar_B [gdb_get_line_number "int bar (B)"]
- set lines1 [line_range_pattern [expr $line_bar_A - 5] [expr $line_bar_A + 4]]
- set lines2 [line_range_pattern [expr $line_bar_B - 5] [expr $line_bar_B + 4]]
+ set lines1 [line_range_pattern [expr {$line_bar_A - 5}] [expr {$line_bar_A + 4}]]
+ set lines2 [line_range_pattern [expr {$line_bar_B - 5}] [expr {$line_bar_B + 4}]]
set any "\[^\r\n\]*"
set h1_re "file: \"${any}overload.cc\", line number: $line_bar_A, symbol: \"bar\\(A\\)\""
diff --git a/gdb/testsuite/gdb.cp/ovldbreak.exp b/gdb/testsuite/gdb.cp/ovldbreak.exp
index 99d0a38..9b8c6d1 100644
--- a/gdb/testsuite/gdb.cp/ovldbreak.exp
+++ b/gdb/testsuite/gdb.cp/ovldbreak.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2024 Free Software Foundation, Inc.
+# Copyright (C) 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -253,7 +253,7 @@ gdb_test "info break" $bptable "breakpoint info, after setting one-by-one"
# Test choice "cancel".
# This is copy-and-paste from set_bp_overloaded.
-send_gdb "break foo::overload1arg\n"
+send_gdb "break foo::overload1arg\n"
gdb_expect {
-re "$menu_overload1arg" {
pass "bp menu for foo::overload1arg choice cancel"
@@ -333,7 +333,7 @@ gdb_test "info breakpoints" "No breakpoints, watchpoints, tracepoints, or catchp
# This is copy-and-paste from set_bp_overloaded.
incr bpnum
-send_gdb "break foo::overload1arg\n"
+send_gdb "break foo::overload1arg\n"
gdb_expect {
-re "$menu_overload1arg" {
pass "bp menu for foo::overload1arg choice all"
@@ -402,7 +402,7 @@ proc continue_to_bp_overloaded {bpnumber might_fail line argtype argument} {
}
-re "Continuing.\r\n\r\nBreakpoint $bkptno_num_re, foo::overload1arg \\(this=${hex}, arg=.*\\) at .*$srcfile:$line\r\n$decimal\[\t \]+{ $body }.*$gdb_prompt $" {
- if $might_kfail {
+ if {$might_kfail} {
kfail "c++/8130" "continue to bp overloaded : $argtype"
} else {
fail "continue to bp overloaded : $argtype"
diff --git a/gdb/testsuite/gdb.cp/ovsrch.exp b/gdb/testsuite/gdb.cp/ovsrch.exp
index 31d5f90..e54f2e4 100644
--- a/gdb/testsuite/gdb.cp/ovsrch.exp
+++ b/gdb/testsuite/gdb.cp/ovsrch.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# Contributed by Red Hat, originally written by Keith Seitz.
#
diff --git a/gdb/testsuite/gdb.cp/ovsrch.h b/gdb/testsuite/gdb.cp/ovsrch.h
index 5d6796b..c7feea3 100644
--- a/gdb/testsuite/gdb.cp/ovsrch.h
+++ b/gdb/testsuite/gdb.cp/ovsrch.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/ovsrch1.cc b/gdb/testsuite/gdb.cp/ovsrch1.cc
index 979f9a7..6ed1758 100644
--- a/gdb/testsuite/gdb.cp/ovsrch1.cc
+++ b/gdb/testsuite/gdb.cp/ovsrch1.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/ovsrch2.cc b/gdb/testsuite/gdb.cp/ovsrch2.cc
index 38d4665..ebcbd6b 100644
--- a/gdb/testsuite/gdb.cp/ovsrch2.cc
+++ b/gdb/testsuite/gdb.cp/ovsrch2.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/ovsrch3.cc b/gdb/testsuite/gdb.cp/ovsrch3.cc
index 68de854..39ac386 100644
--- a/gdb/testsuite/gdb.cp/ovsrch3.cc
+++ b/gdb/testsuite/gdb.cp/ovsrch3.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/ovsrch4.cc b/gdb/testsuite/gdb.cp/ovsrch4.cc
index 606f9a1..e4b856e 100644
--- a/gdb/testsuite/gdb.cp/ovsrch4.cc
+++ b/gdb/testsuite/gdb.cp/ovsrch4.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/paramless.cc b/gdb/testsuite/gdb.cp/paramless.cc
index 4fa54fb..e7158d0 100644
--- a/gdb/testsuite/gdb.cp/paramless.cc
+++ b/gdb/testsuite/gdb.cp/paramless.cc
@@ -1,6 +1,6 @@
/* Test case for template breakpoint test.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.cp/paramless.exp b/gdb/testsuite/gdb.cp/paramless.exp
index 68f6644..ea9f5da 100644
--- a/gdb/testsuite/gdb.cp/paramless.exp
+++ b/gdb/testsuite/gdb.cp/paramless.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/paren-type.cc b/gdb/testsuite/gdb.cp/paren-type.cc
index 3041ec3..60432ec 100644
--- a/gdb/testsuite/gdb.cp/paren-type.cc
+++ b/gdb/testsuite/gdb.cp/paren-type.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/paren-type.exp b/gdb/testsuite/gdb.cp/paren-type.exp
index a95e049..2de6436 100644
--- a/gdb/testsuite/gdb.cp/paren-type.exp
+++ b/gdb/testsuite/gdb.cp/paren-type.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/parse-lang.cc b/gdb/testsuite/gdb.cp/parse-lang.cc
index b9993a9..37777d9 100644
--- a/gdb/testsuite/gdb.cp/parse-lang.cc
+++ b/gdb/testsuite/gdb.cp/parse-lang.cc
@@ -1,4 +1,4 @@
-/* Copyright 2013-2024 Free Software Foundation, Inc.
+/* Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/parse-lang.exp b/gdb/testsuite/gdb.cp/parse-lang.exp
index 2b72ba0..257b479d9 100644
--- a/gdb/testsuite/gdb.cp/parse-lang.exp
+++ b/gdb/testsuite/gdb.cp/parse-lang.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pass-by-ref-2.cc b/gdb/testsuite/gdb.cp/pass-by-ref-2.cc
index f575d57..cf0a6ed 100644
--- a/gdb/testsuite/gdb.cp/pass-by-ref-2.cc
+++ b/gdb/testsuite/gdb.cp/pass-by-ref-2.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pass-by-ref-2.exp b/gdb/testsuite/gdb.cp/pass-by-ref-2.exp
index 00141d8..21df064 100644
--- a/gdb/testsuite/gdb.cp/pass-by-ref-2.exp
+++ b/gdb/testsuite/gdb.cp/pass-by-ref-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pass-by-ref.exp b/gdb/testsuite/gdb.cp/pass-by-ref.exp
index a1f1df4..4c12666 100644
--- a/gdb/testsuite/gdb.cp/pass-by-ref.exp
+++ b/gdb/testsuite/gdb.cp/pass-by-ref.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -115,7 +115,7 @@ proc generate_member_function { classname signature length state } {
set definition "$classname\:\:$signature
{
data\[0\] = $CUSTOM;
- data\[[expr $length - 1]\] = $CUSTOM;
+ data\[[expr {$length - 1}]\] = $CUSTOM;
tracer = $TRACE;
}\n"
}
@@ -177,7 +177,7 @@ proc generate_class { classname length states } {
$classname\:\:$classname (void)
{
data\[0\] = $ORIGINAL;
- data\[[expr $length - 1]\] = $ORIGINAL;
+ data\[[expr {$length - 1}]\] = $ORIGINAL;
}
$definitions
@@ -398,7 +398,7 @@ proc test_for_class { prefix states cbvfun data_field length} {
gdb_test "print ${name}_var.${data_field}\[0\]" " = $ORIGINAL" \
"cbv argument should not change, item 0"
if {$length > 1} {
- set last_index [expr $length - 1]
+ set last_index [expr {$length - 1}]
gdb_test "print ${name}_var.${data_field}\[$last_index\]" \
" = $ORIGINAL" \
"cbv argument should not change, item $last_index"
diff --git a/gdb/testsuite/gdb.cp/pointer-to-member.cc b/gdb/testsuite/gdb.cp/pointer-to-member.cc
index 549032b..ab51bfa 100644
--- a/gdb/testsuite/gdb.cp/pointer-to-member.cc
+++ b/gdb/testsuite/gdb.cp/pointer-to-member.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pointer-to-member.exp b/gdb/testsuite/gdb.cp/pointer-to-member.exp
index 1d7925b..6dc5090 100644
--- a/gdb/testsuite/gdb.cp/pointer-to-member.exp
+++ b/gdb/testsuite/gdb.cp/pointer-to-member.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pr-1023.exp b/gdb/testsuite/gdb.cp/pr-1023.exp
index d39deec..f731b1f 100644
--- a/gdb/testsuite/gdb.cp/pr-1023.exp
+++ b/gdb/testsuite/gdb.cp/pr-1023.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pr-1210.exp b/gdb/testsuite/gdb.cp/pr-1210.exp
index 770a160..295ca2b 100644
--- a/gdb/testsuite/gdb.cp/pr-1210.exp
+++ b/gdb/testsuite/gdb.cp/pr-1210.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pr-574.cc b/gdb/testsuite/gdb.cp/pr-574.cc
index d0a59ba..35eb1b5 100644
--- a/gdb/testsuite/gdb.cp/pr-574.cc
+++ b/gdb/testsuite/gdb.cp/pr-574.cc
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pr-574.exp b/gdb/testsuite/gdb.cp/pr-574.exp
index d48a497..cadded9 100644
--- a/gdb/testsuite/gdb.cp/pr-574.exp
+++ b/gdb/testsuite/gdb.cp/pr-574.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pr10687.exp b/gdb/testsuite/gdb.cp/pr10687.exp
index dfbb170..9ae840a 100644
--- a/gdb/testsuite/gdb.cp/pr10687.exp
+++ b/gdb/testsuite/gdb.cp/pr10687.exp
@@ -1,4 +1,4 @@
-#Copyright 2010-2024 Free Software Foundation, Inc.
+#Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pr10728.exp b/gdb/testsuite/gdb.cp/pr10728.exp
index c9f46f6..8201e24 100644
--- a/gdb/testsuite/gdb.cp/pr10728.exp
+++ b/gdb/testsuite/gdb.cp/pr10728.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ if { [gdb_compile "${tfx}.o ${tfy}.o" ${binfile} executable {debug c++}] != ""
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.cp/pr12028.exp b/gdb/testsuite/gdb.cp/pr12028.exp
index 55cf104..b2dd6f2 100644
--- a/gdb/testsuite/gdb.cp/pr12028.exp
+++ b/gdb/testsuite/gdb.cp/pr12028.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pr17132.cc b/gdb/testsuite/gdb.cp/pr17132.cc
index 6b22370..d0f3cd6 100644
--- a/gdb/testsuite/gdb.cp/pr17132.cc
+++ b/gdb/testsuite/gdb.cp/pr17132.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pr17132.exp b/gdb/testsuite/gdb.cp/pr17132.exp
index 864c199..07caaaf 100644
--- a/gdb/testsuite/gdb.cp/pr17132.exp
+++ b/gdb/testsuite/gdb.cp/pr17132.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pr17494.cc b/gdb/testsuite/gdb.cp/pr17494.cc
index eceeb27..48a96db 100644
--- a/gdb/testsuite/gdb.cp/pr17494.cc
+++ b/gdb/testsuite/gdb.cp/pr17494.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pr17494.exp b/gdb/testsuite/gdb.cp/pr17494.exp
index 3df1051..5986a28 100644
--- a/gdb/testsuite/gdb.cp/pr17494.exp
+++ b/gdb/testsuite/gdb.cp/pr17494.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pr9067.exp b/gdb/testsuite/gdb.cp/pr9067.exp
index 3eec246..fcb197d 100644
--- a/gdb/testsuite/gdb.cp/pr9067.exp
+++ b/gdb/testsuite/gdb.cp/pr9067.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pr9167.exp b/gdb/testsuite/gdb.cp/pr9167.exp
index 72c70bc..0931266 100644
--- a/gdb/testsuite/gdb.cp/pr9167.exp
+++ b/gdb/testsuite/gdb.cp/pr9167.exp
@@ -1,4 +1,4 @@
-#Copyright 2010-2024 Free Software Foundation, Inc.
+#Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pr9631.cc b/gdb/testsuite/gdb.cp/pr9631.cc
index 8081a88..7f66895 100644
--- a/gdb/testsuite/gdb.cp/pr9631.cc
+++ b/gdb/testsuite/gdb.cp/pr9631.cc
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/pr9631.exp b/gdb/testsuite/gdb.cp/pr9631.exp
index 3415a0f..3b2cbec 100644
--- a/gdb/testsuite/gdb.cp/pr9631.exp
+++ b/gdb/testsuite/gdb.cp/pr9631.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/print-demangle.exp b/gdb/testsuite/gdb.cp/print-demangle.exp
index 2e1c310..22f9a2e 100644
--- a/gdb/testsuite/gdb.cp/print-demangle.exp
+++ b/gdb/testsuite/gdb.cp/print-demangle.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/print-global-stub.cc b/gdb/testsuite/gdb.cp/print-global-stub.cc
index a06b787..c4cc7e9 100644
--- a/gdb/testsuite/gdb.cp/print-global-stub.cc
+++ b/gdb/testsuite/gdb.cp/print-global-stub.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/print-global-stub.exp b/gdb/testsuite/gdb.cp/print-global-stub.exp
index 9a49bda..d847c00 100644
--- a/gdb/testsuite/gdb.cp/print-global-stub.exp
+++ b/gdb/testsuite/gdb.cp/print-global-stub.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,14 +19,15 @@
require allow_cplus_tests
standard_testfile .cc
-set objfile [standard_output_file ${testfile}.o]
+set testfile $testfile.o
+set binfile [standard_output_file $testfile]
-if { [gdb_compile $srcdir/$subdir/$srcfile $objfile object \
+if { [gdb_compile $srcdir/$subdir/$srcfile $binfile object \
{c++ debug}] != "" } {
untested "failed to compile"
return -1
}
-clean_restart $objfile
+clean_restart $testfile
gdb_test "print s" " = <incomplete type>"
diff --git a/gdb/testsuite/gdb.cp/print-method-args.cc b/gdb/testsuite/gdb.cp/print-method-args.cc
index 9a90ee1..803e07c 100644
--- a/gdb/testsuite/gdb.cp/print-method-args.cc
+++ b/gdb/testsuite/gdb.cp/print-method-args.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.cp/print-method-args.exp b/gdb/testsuite/gdb.cp/print-method-args.exp
index f122f3b..f14b9e8 100644
--- a/gdb/testsuite/gdb.cp/print-method-args.exp
+++ b/gdb/testsuite/gdb.cp/print-method-args.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/printmethod.cc b/gdb/testsuite/gdb.cp/printmethod.cc
index c9742e9..34e4390 100644
--- a/gdb/testsuite/gdb.cp/printmethod.cc
+++ b/gdb/testsuite/gdb.cp/printmethod.cc
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/printmethod.exp b/gdb/testsuite/gdb.cp/printmethod.exp
index cd896dc..d2140d4 100644
--- a/gdb/testsuite/gdb.cp/printmethod.exp
+++ b/gdb/testsuite/gdb.cp/printmethod.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/psmang.exp b/gdb/testsuite/gdb.cp/psmang.exp
index 416d8a7..7f9ce69 100644
--- a/gdb/testsuite/gdb.cp/psmang.exp
+++ b/gdb/testsuite/gdb.cp/psmang.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
# sure the test still fails:
#
# 2002-08-29 Jim Blandy <jimb@redhat.com>
-#
+#
# * symtab.c (lookup_symbol_aux): In the cases where we find a
# minimal symbol of an appropriate name and use its address to
# select a symtab to read and search, use `name' (as passed to us)
@@ -35,14 +35,14 @@
# The original bug was that you'd try to set a breakpoint on a method
# (e.g., `break s::method1'), and you'd get an error, but if you
# repeated the command, it would work the second time:
-#
+#
# (gdb) break s::method1
# the class s does not have any method named method1
# Hint: try 's::method1<TAB> or 's::method1<ESC-?>
# (Note leading single quote.)
# (gdb) break s::method1
# Breakpoint 1 at 0x804841b: file psmang1.cc, line 13.
-# (gdb)
+# (gdb)
#
# We observed this bug first using Stabs, and then using Dwarf 2.
#
@@ -190,6 +190,6 @@ gdb_test "break s::method1" "Breakpoint .* at .*: file .*psmang1.cc.*"
# We have to exit and restart GDB here, to make sure that all the
# compilation units are psymtabs again.
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test "break s::method2" "Breakpoint .* at .*: file .*psmang2.cc.*"
diff --git a/gdb/testsuite/gdb.cp/psmang1.cc b/gdb/testsuite/gdb.cp/psmang1.cc
index 8bd1a2b..b79f24d 100644
--- a/gdb/testsuite/gdb.cp/psmang1.cc
+++ b/gdb/testsuite/gdb.cp/psmang1.cc
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/psmang2.cc b/gdb/testsuite/gdb.cp/psmang2.cc
index aa0cbf1..102c430 100644
--- a/gdb/testsuite/gdb.cp/psmang2.cc
+++ b/gdb/testsuite/gdb.cp/psmang2.cc
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/psymtab-parameter.cc b/gdb/testsuite/gdb.cp/psymtab-parameter.cc
index e1ed8f9..e79edac 100644
--- a/gdb/testsuite/gdb.cp/psymtab-parameter.cc
+++ b/gdb/testsuite/gdb.cp/psymtab-parameter.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/psymtab-parameter.exp b/gdb/testsuite/gdb.cp/psymtab-parameter.exp
index 735a33c..cbe51a5 100644
--- a/gdb/testsuite/gdb.cp/psymtab-parameter.exp
+++ b/gdb/testsuite/gdb.cp/psymtab-parameter.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/ptype-cv-cp.cc b/gdb/testsuite/gdb.cp/ptype-cv-cp.cc
index 2acf0f7..34fa7b8 100644
--- a/gdb/testsuite/gdb.cp/ptype-cv-cp.cc
+++ b/gdb/testsuite/gdb.cp/ptype-cv-cp.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/ptype-cv-cp.exp b/gdb/testsuite/gdb.cp/ptype-cv-cp.exp
index 2471077..daada9f 100644
--- a/gdb/testsuite/gdb.cp/ptype-cv-cp.exp
+++ b/gdb/testsuite/gdb.cp/ptype-cv-cp.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/ptype-flags.cc b/gdb/testsuite/gdb.cp/ptype-flags.cc
index 40c58af..6ba1f91 100644
--- a/gdb/testsuite/gdb.cp/ptype-flags.cc
+++ b/gdb/testsuite/gdb.cp/ptype-flags.cc
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/ptype-flags.exp b/gdb/testsuite/gdb.cp/ptype-flags.exp
index 476c075..00c2f6c 100644
--- a/gdb/testsuite/gdb.cp/ptype-flags.exp
+++ b/gdb/testsuite/gdb.cp/ptype-flags.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/punctuator.exp b/gdb/testsuite/gdb.cp/punctuator.exp
index 5b8c247..c568916 100644
--- a/gdb/testsuite/gdb.cp/punctuator.exp
+++ b/gdb/testsuite/gdb.cp/punctuator.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/re-set-overloaded.cc b/gdb/testsuite/gdb.cp/re-set-overloaded.cc
index d4cf145..1343ff7 100644
--- a/gdb/testsuite/gdb.cp/re-set-overloaded.cc
+++ b/gdb/testsuite/gdb.cp/re-set-overloaded.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/re-set-overloaded.exp b/gdb/testsuite/gdb.cp/re-set-overloaded.exp
index 392ca9a..393baa8 100644
--- a/gdb/testsuite/gdb.cp/re-set-overloaded.exp
+++ b/gdb/testsuite/gdb.cp/re-set-overloaded.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/readnow-language.cc b/gdb/testsuite/gdb.cp/readnow-language.cc
index c4ade1f..96139cf 100644
--- a/gdb/testsuite/gdb.cp/readnow-language.cc
+++ b/gdb/testsuite/gdb.cp/readnow-language.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/readnow-language.exp b/gdb/testsuite/gdb.cp/readnow-language.exp
index a9cd645..a97db09 100644
--- a/gdb/testsuite/gdb.cp/readnow-language.exp
+++ b/gdb/testsuite/gdb.cp/readnow-language.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/ref-params.cc b/gdb/testsuite/gdb.cp/ref-params.cc
index 3ef2868..cd53adb 100644
--- a/gdb/testsuite/gdb.cp/ref-params.cc
+++ b/gdb/testsuite/gdb.cp/ref-params.cc
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/ref-params.exp b/gdb/testsuite/gdb.cp/ref-params.exp
index e5c28e6..4f2cbb5 100644
--- a/gdb/testsuite/gdb.cp/ref-params.exp
+++ b/gdb/testsuite/gdb.cp/ref-params.exp
@@ -1,5 +1,5 @@
# Tests for reference parameters of types and their subtypes in GDB.
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ proc gdb_start_again { text } {
global binfile
global srcfile
- clean_restart $binfile
+ clean_restart $::testfile
runto ${srcfile}:[gdb_get_line_number $text]
}
diff --git a/gdb/testsuite/gdb.cp/ref-types.cc b/gdb/testsuite/gdb.cp/ref-types.cc
index 538eac2..7dfa627 100644
--- a/gdb/testsuite/gdb.cp/ref-types.cc
+++ b/gdb/testsuite/gdb.cp/ref-types.cc
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 1999-2024 Free Software Foundation, Inc.
+ Copyright 1999-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/ref-types.exp b/gdb/testsuite/gdb.cp/ref-types.exp
index b962b6b..c7bad49 100644
--- a/gdb/testsuite/gdb.cp/ref-types.exp
+++ b/gdb/testsuite/gdb.cp/ref-types.exp
@@ -1,5 +1,5 @@
# Tests for reference types with short type variables in GDB.
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/rtti.exp b/gdb/testsuite/gdb.cp/rtti.exp
index 5caf4d1..b7f7039 100644
--- a/gdb/testsuite/gdb.cp/rtti.exp
+++ b/gdb/testsuite/gdb.cp/rtti.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/rtti.h b/gdb/testsuite/gdb.cp/rtti.h
index 04d94f6b..feb3158 100644
--- a/gdb/testsuite/gdb.cp/rtti.h
+++ b/gdb/testsuite/gdb.cp/rtti.h
@@ -1,6 +1,6 @@
/* Code to go along with tests in rtti.exp.
- Copyright 2003-2024 Free Software Foundation, Inc.
+ Copyright 2003-2025 Free Software Foundation, Inc.
Contributed by David Carlton <carlton@bactrian.org> and by Kealia,
Inc.
diff --git a/gdb/testsuite/gdb.cp/rtti1.cc b/gdb/testsuite/gdb.cp/rtti1.cc
index 527e31c..174b5a7 100644
--- a/gdb/testsuite/gdb.cp/rtti1.cc
+++ b/gdb/testsuite/gdb.cp/rtti1.cc
@@ -1,6 +1,6 @@
/* Code to go along with tests in rtti.exp.
- Copyright 2003-2024 Free Software Foundation, Inc.
+ Copyright 2003-2025 Free Software Foundation, Inc.
Contributed by David Carlton <carlton@bactrian.org> and by Kealia,
Inc.
diff --git a/gdb/testsuite/gdb.cp/rtti2.cc b/gdb/testsuite/gdb.cp/rtti2.cc
index d67c689..2666774 100644
--- a/gdb/testsuite/gdb.cp/rtti2.cc
+++ b/gdb/testsuite/gdb.cp/rtti2.cc
@@ -1,6 +1,6 @@
/* Code to go along with tests in rtti.exp.
- Copyright 2003-2024 Free Software Foundation, Inc.
+ Copyright 2003-2025 Free Software Foundation, Inc.
Contributed by David Carlton <carlton@bactrian.org> and by Kealia,
Inc.
diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-casts.cc b/gdb/testsuite/gdb.cp/rvalue-ref-casts.cc
index 86c2a02..7208f32 100644
--- a/gdb/testsuite/gdb.cp/rvalue-ref-casts.cc
+++ b/gdb/testsuite/gdb.cp/rvalue-ref-casts.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-casts.exp b/gdb/testsuite/gdb.cp/rvalue-ref-casts.exp
index 59157ed..2f54877 100644
--- a/gdb/testsuite/gdb.cp/rvalue-ref-casts.exp
+++ b/gdb/testsuite/gdb.cp/rvalue-ref-casts.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-overload.cc b/gdb/testsuite/gdb.cp/rvalue-ref-overload.cc
index f1ac8f4..9ac21f2 100644
--- a/gdb/testsuite/gdb.cp/rvalue-ref-overload.cc
+++ b/gdb/testsuite/gdb.cp/rvalue-ref-overload.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1998-2024 Free Software Foundation, Inc.
+ Copyright 1998-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-overload.exp b/gdb/testsuite/gdb.cp/rvalue-ref-overload.exp
index e589616..f4d55be 100644
--- a/gdb/testsuite/gdb.cp/rvalue-ref-overload.exp
+++ b/gdb/testsuite/gdb.cp/rvalue-ref-overload.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-params.cc b/gdb/testsuite/gdb.cp/rvalue-ref-params.cc
index 02c2afb..5b48d50 100644
--- a/gdb/testsuite/gdb.cp/rvalue-ref-params.cc
+++ b/gdb/testsuite/gdb.cp/rvalue-ref-params.cc
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-params.exp b/gdb/testsuite/gdb.cp/rvalue-ref-params.exp
index faf40f6..91f79ea 100644
--- a/gdb/testsuite/gdb.cp/rvalue-ref-params.exp
+++ b/gdb/testsuite/gdb.cp/rvalue-ref-params.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ proc gdb_start_again {text prefix} {
global srcfile
with_test_prefix $prefix {
- clean_restart $binfile
+ clean_restart $::testfile
runto ${srcfile}:[gdb_get_line_number $text]
}
@@ -49,7 +49,7 @@ gdb_test "print static_cast<int&&> (global_int)" " = \\(int &&\\) @$hex: 7"
gdb_test "print static_cast<float&> (global_float)" " = \\(float &\\) @$hex: 3\\.$decimal"
gdb_test "print static_cast<float&&> (global_float)" " = \\(float &&\\) @$hex: 3\\.$decimal"
-set t "print value of f2 on (Child&&) in main"
+set t "print value of f2 on (Child&&) in main"
gdb_start_again "marker1 here" $t
gdb_test "print f2(static_cast<Child&&>(Q))" ".* = 40.*" $t
diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-sizeof.cc b/gdb/testsuite/gdb.cp/rvalue-ref-sizeof.cc
index 23e5050..49cb2d1 100644
--- a/gdb/testsuite/gdb.cp/rvalue-ref-sizeof.cc
+++ b/gdb/testsuite/gdb.cp/rvalue-ref-sizeof.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-sizeof.exp b/gdb/testsuite/gdb.cp/rvalue-ref-sizeof.exp
index 4d01e64..ea4d447 100644
--- a/gdb/testsuite/gdb.cp/rvalue-ref-sizeof.exp
+++ b/gdb/testsuite/gdb.cp/rvalue-ref-sizeof.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-types.cc b/gdb/testsuite/gdb.cp/rvalue-ref-types.cc
index 7de05a6..e0e731e 100644
--- a/gdb/testsuite/gdb.cp/rvalue-ref-types.cc
+++ b/gdb/testsuite/gdb.cp/rvalue-ref-types.cc
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 1999-2024 Free Software Foundation, Inc.
+ Copyright 1999-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-types.exp b/gdb/testsuite/gdb.cp/rvalue-ref-types.exp
index 3e6f640..596abe7 100644
--- a/gdb/testsuite/gdb.cp/rvalue-ref-types.exp
+++ b/gdb/testsuite/gdb.cp/rvalue-ref-types.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ if {![runto 'marker1']} {
gdb_test "up" ".*main.*" "up from marker1 1"
-gdb_test "print rrt" " = \\(short( int)? &&\\) @$hex: -1" "print value of rrt"
+gdb_test "print rrt" " = \\(short( int)? &&\\) @$hex: -1" "print value of rrt"
gdb_test "ptype rrt" "type = short( int)? &&"
diff --git a/gdb/testsuite/gdb.cp/save-bp-qualified.cc b/gdb/testsuite/gdb.cp/save-bp-qualified.cc
index 509e525..4738984 100644
--- a/gdb/testsuite/gdb.cp/save-bp-qualified.cc
+++ b/gdb/testsuite/gdb.cp/save-bp-qualified.cc
@@ -1,4 +1,4 @@
-/* Copyright 2017-2024 Free Software Foundation, Inc.
+/* Copyright 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.cp/save-bp-qualified.exp b/gdb/testsuite/gdb.cp/save-bp-qualified.exp
index 3f6ee0f..ae7a9d5 100644
--- a/gdb/testsuite/gdb.cp/save-bp-qualified.exp
+++ b/gdb/testsuite/gdb.cp/save-bp-qualified.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ proc restart {} {
clean_restart $testfile
- if ![runto_main] {
+ if {![runto_main]} {
return 0
}
# Delete all breakpoints, watchpoints, tracepoints, and catchpoints so that
@@ -37,7 +37,7 @@ proc restart {} {
}
with_test_prefix "save" {
- if ![restart] {
+ if {![restart]} {
return -1
}
@@ -55,7 +55,7 @@ with_test_prefix "save" {
}
with_test_prefix "restore" {
- if ![restart] {
+ if {![restart]} {
return -1
}
diff --git a/gdb/testsuite/gdb.cp/scope-err.cc b/gdb/testsuite/gdb.cp/scope-err.cc
index 232743c..65b584b 100644
--- a/gdb/testsuite/gdb.cp/scope-err.cc
+++ b/gdb/testsuite/gdb.cp/scope-err.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/scope-err.exp b/gdb/testsuite/gdb.cp/scope-err.exp
index 6a0eae6e..cee804e 100644
--- a/gdb/testsuite/gdb.cp/scope-err.exp
+++ b/gdb/testsuite/gdb.cp/scope-err.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/shadow.exp b/gdb/testsuite/gdb.cp/shadow.exp
index 6d9a13b..515c173 100644
--- a/gdb/testsuite/gdb.cp/shadow.exp
+++ b/gdb/testsuite/gdb.cp/shadow.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/smartp.cc b/gdb/testsuite/gdb.cp/smartp.cc
index 5255f63..7141089 100644
--- a/gdb/testsuite/gdb.cp/smartp.cc
+++ b/gdb/testsuite/gdb.cp/smartp.cc
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 1999-2024 Free Software Foundation, Inc.
+ Copyright 1999-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/smartp.exp b/gdb/testsuite/gdb.cp/smartp.exp
index 279d85c..cc60aed 100644
--- a/gdb/testsuite/gdb.cp/smartp.exp
+++ b/gdb/testsuite/gdb.cp/smartp.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/static-method.cc b/gdb/testsuite/gdb.cp/static-method.cc
index a72b391..c55ab4c 100644
--- a/gdb/testsuite/gdb.cp/static-method.cc
+++ b/gdb/testsuite/gdb.cp/static-method.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/static-method.exp b/gdb/testsuite/gdb.cp/static-method.exp
index eb99edd..b58bf71 100644
--- a/gdb/testsuite/gdb.cp/static-method.exp
+++ b/gdb/testsuite/gdb.cp/static-method.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# Contributed by Red Hat, originally written by Keith Seitz.
#
diff --git a/gdb/testsuite/gdb.cp/static-print-quit.cc b/gdb/testsuite/gdb.cp/static-print-quit.cc
index 8cabd47..fb80fed 100644
--- a/gdb/testsuite/gdb.cp/static-print-quit.cc
+++ b/gdb/testsuite/gdb.cp/static-print-quit.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/static-print-quit.exp b/gdb/testsuite/gdb.cp/static-print-quit.exp
index 7236439..e4bce7f 100644
--- a/gdb/testsuite/gdb.cp/static-print-quit.exp
+++ b/gdb/testsuite/gdb.cp/static-print-quit.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,32 +27,17 @@ clean_restart $testfile.o
gdb_test_no_output "set width 80"
gdb_test_no_output "set height 2"
-set test "print c - <return>"
-gdb_test_multiple "print c" $test {
- -re "\\$\[0-9\]+ = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n--Type <RET>" {
- pass $test
+gdb_test_multiple "print c" "" {
+ -re "\\$\[0-9\]+ = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n$pagination_prompt$" {
+ pass $gdb_test_name
}
- -re "\r\n--Type <RET>" {
+ -re "\r\n$pagination_prompt$" {
# gdb-7.1 did not crash with this testcase but it had the same bug.
untested "bug does not reproduce"
return 0
}
}
-set test "print c - q <return>"
-gdb_test_multiple "" $test {
- -re " for more, q to quit, " {
- pass $test
- }
-}
-
-set test "print c - remainder"
-gdb_test_multiple "" $test {
- -re "c to continue without paging--$" {
- pass $test
- }
-}
-
gdb_test "q" ".*"
# Now the obstack is uninitialized. Exercise it.
diff --git a/gdb/testsuite/gdb.cp/static-typedef-print.cc b/gdb/testsuite/gdb.cp/static-typedef-print.cc
index 6c6263f..d0500d1 100644
--- a/gdb/testsuite/gdb.cp/static-typedef-print.cc
+++ b/gdb/testsuite/gdb.cp/static-typedef-print.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/static-typedef-print.exp b/gdb/testsuite/gdb.cp/static-typedef-print.exp
index 5de7a09..1f06dee 100644
--- a/gdb/testsuite/gdb.cp/static-typedef-print.exp
+++ b/gdb/testsuite/gdb.cp/static-typedef-print.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.cc b/gdb/testsuite/gdb.cp/step-and-next-inline.cc
index ac92206..1d67180 100644
--- a/gdb/testsuite/gdb.cp/step-and-next-inline.cc
+++ b/gdb/testsuite/gdb.cp/step-and-next-inline.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.exp b/gdb/testsuite/gdb.cp/step-and-next-inline.exp
index e16c2cc..92caed1 100644
--- a/gdb/testsuite/gdb.cp/step-and-next-inline.exp
+++ b/gdb/testsuite/gdb.cp/step-and-next-inline.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -81,7 +81,7 @@ proc do_test { use_header } {
clean_restart $executable
- if ![runto $main_location qualified] {
+ if {![runto $main_location qualified]} {
return
}
@@ -105,7 +105,7 @@ proc do_test { use_header } {
# that some easier heuristic could be figured out). Still, it is
# not certain that the first failure wouldn't also be fixed by
# having location view support, so for now it is tagged as such.
- set have_kfail [expr [test_compiler_info gcc*] && !$use_header]
+ set have_kfail [expr {[test_compiler_info gcc*] && !$use_header}]
set ok 1
gdb_test_multiple "next" "next step 1" {
@@ -206,7 +206,7 @@ proc do_test { use_header } {
clean_restart ${executable}
- if ![runto_main] {
+ if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.h b/gdb/testsuite/gdb.cp/step-and-next-inline.h
index 94e6689..abfaf07 100644
--- a/gdb/testsuite/gdb.cp/step-and-next-inline.h
+++ b/gdb/testsuite/gdb.cp/step-and-next-inline.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/stub-array-size.cc b/gdb/testsuite/gdb.cp/stub-array-size.cc
index 453a3f7..ce1866f 100644
--- a/gdb/testsuite/gdb.cp/stub-array-size.cc
+++ b/gdb/testsuite/gdb.cp/stub-array-size.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/stub-array-size.exp b/gdb/testsuite/gdb.cp/stub-array-size.exp
index da0ffcf..4cf2e42 100644
--- a/gdb/testsuite/gdb.cp/stub-array-size.exp
+++ b/gdb/testsuite/gdb.cp/stub-array-size.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/stub-array-size.h b/gdb/testsuite/gdb.cp/stub-array-size.h
index 5a527e7..6537b51 100644
--- a/gdb/testsuite/gdb.cp/stub-array-size.h
+++ b/gdb/testsuite/gdb.cp/stub-array-size.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/stub-array-size2.cc b/gdb/testsuite/gdb.cp/stub-array-size2.cc
index 4d2ac9b..8711951 100644
--- a/gdb/testsuite/gdb.cp/stub-array-size2.cc
+++ b/gdb/testsuite/gdb.cp/stub-array-size2.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/subtypes-2.cc b/gdb/testsuite/gdb.cp/subtypes-2.cc
index 02b179e..c8430ab 100644
--- a/gdb/testsuite/gdb.cp/subtypes-2.cc
+++ b/gdb/testsuite/gdb.cp/subtypes-2.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/subtypes.cc b/gdb/testsuite/gdb.cp/subtypes.cc
index a7d8ec2..286a3bf 100644
--- a/gdb/testsuite/gdb.cp/subtypes.cc
+++ b/gdb/testsuite/gdb.cp/subtypes.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/subtypes.exp b/gdb/testsuite/gdb.cp/subtypes.exp
index 871bd7c..540086c 100644
--- a/gdb/testsuite/gdb.cp/subtypes.exp
+++ b/gdb/testsuite/gdb.cp/subtypes.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if {[prepare_for_testing "failed to prepare" $testfile \
}
# Xfail for superfluous DW_TAG_lexical_block, gcc PR debug/55541.
-set have_xfail [expr [test_compiler_info gcc-*] && [gcc_major_version] < 5]
+set have_xfail [expr {[test_compiler_info gcc-*] && [gcc_major_version] < 5}]
gdb_test "ptype Outer::Inner::InnerInner" \
"type = struct Outer::Inner::InnerInner.*"
diff --git a/gdb/testsuite/gdb.cp/subtypes.h b/gdb/testsuite/gdb.cp/subtypes.h
index 38421d8..6b504a8 100644
--- a/gdb/testsuite/gdb.cp/subtypes.h
+++ b/gdb/testsuite/gdb.cp/subtypes.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/temargs.cc b/gdb/testsuite/gdb.cp/temargs.cc
index 2f5d2a7..175c315 100644
--- a/gdb/testsuite/gdb.cp/temargs.cc
+++ b/gdb/testsuite/gdb.cp/temargs.cc
@@ -1,6 +1,6 @@
/* Template argument tests.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/temargs.exp b/gdb/testsuite/gdb.cp/temargs.exp
index e715f2b..750f739 100644
--- a/gdb/testsuite/gdb.cp/temargs.exp
+++ b/gdb/testsuite/gdb.cp/temargs.exp
@@ -1,6 +1,6 @@
# temargs.exp - Template argument tests
#
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -76,13 +76,13 @@ gdb_test "break $srcfile:$line" "Breakpoint 7.*" \
gdb_continue_to_breakpoint "continue to first breakpoint for temargs"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "ptype T" "double" "test type of T in base_m"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "print I" " = 23" "test value of I in base_m"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "print P == &a_global" " = true" "test value of P in base_m"
if {!$have_pr_41736_fixed} { setup_xfail *-*-* }
@@ -101,7 +101,7 @@ gdb_test "ptype T" "long" "test type of T in inner_m"
if {!$have_pr_45024_fixed} { setup_xfail *-*-* }
gdb_test "print I" " = 47" "test value of I in inner_m"
-if $have_older_template_gcc { setup_xfail "*-*-*"
+if {$have_older_template_gcc} { setup_xfail "*-*-*"
} elseif {[test_compiler_info {gcc-[0-3]-*}]
|| [test_compiler_info {gcc-4-[0-5]-*}]} {
# gcc-4.5.x still does not emit inner DW_TAG_structure_type.
@@ -112,7 +112,7 @@ gdb_test "print P == &a_global" " = true" "test value of P in inner_m"
if {!$have_pr_41736_fixed} { setup_xfail *-*-* }
gdb_test "print MP" "&S::f" "test value of MP in inner_m"
-if $have_older_template_gcc { setup_xfail "*-*-*"
+if {$have_older_template_gcc} { setup_xfail "*-*-*"
} elseif {[test_compiler_info {gcc-[0-3]-*}]
|| [test_compiler_info {gcc-4-[0-5]-*}]} {
# gcc-4.5.x still does not emit outer DW_TAG_structure_type.
@@ -126,17 +126,17 @@ gdb_test "whatis Z" "float" "test type of Z in inner_m"
gdb_continue_to_breakpoint "continue to third breakpoint for temargs"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "ptype T" "unsigned char" "test type of T in func"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "print I" " = 91" "test value of I in func"
# PR symtab/16842 - gdb used to crash here.
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "info addr I" "Symbol \"I\" is constant." "test address of I in func"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "print P == &a_global" " = true" "test value of P in func"
if {!$have_pr_41736_fixed} { setup_xfail *-*-* }
@@ -148,23 +148,23 @@ gdb_test "print MP" "&S::f" "test value of MP in func"
gdb_continue_to_breakpoint "continue to fourth breakpoint for temargs"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "ptype T" "double" "test type of T in templ_m"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "print I" " = 23" "test value of I in templ_m"
# PR symtab/16842 - gdb used to crash here.
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "info addr I" "Symbol \"I\" is constant." "test address of I in templ_m"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "print P == &a_global" " = true" "test value of P in templ_m"
if {!$have_pr_41736_fixed} { setup_xfail *-*-* }
gdb_test "print MP" "&S::f" "test value of MP in templ_m"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "whatis Q" "short" "test type of Q in templ_m"
#
@@ -173,7 +173,7 @@ gdb_test "whatis Q" "short" "test type of Q in templ_m"
gdb_continue_to_breakpoint "continue to fifth breakpoint for temargs"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "ptype F" "type = void \\\(S::\\\*\\\)\\\(S \\\* const\\\)" \
"test type of F in k2_m"
@@ -189,11 +189,11 @@ gdb_test "print F" "&S::somefunc" "test value of F in k2_m"
gdb_continue_to_breakpoint "continue to sixth breakpoint for temargs"
-if $have_older_template_gcc { setup_xfail "*-*-*"
+if {$have_older_template_gcc} { setup_xfail "*-*-*"
} elseif { $using_gcc } { setup_xfail gcc/49546 "*-*-*" }
gdb_test "ptype F" {type = void \(\*\)\(int\)} "test type of F in k3_m"
-if $have_older_template_gcc { setup_xfail "*-*-*"
+if {$have_older_template_gcc} { setup_xfail "*-*-*"
} elseif { $using_gcc } { setup_xfail gcc/49546 "*-*-*" }
gdb_test "print F" { = \(void \(\*\)\(int\)\) 0x[0-9a-f]+ <S3::m\(int\)>} \
"test value of F in k3_m"
diff --git a/gdb/testsuite/gdb.cp/templates.exp b/gdb/testsuite/gdb.cp/templates.exp
index 8dd0cdc..6dd4e66 100644
--- a/gdb/testsuite/gdb.cp/templates.exp
+++ b/gdb/testsuite/gdb.cp/templates.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -58,9 +58,9 @@ proc test_ptype_of_templates {} {
xfail "ptype T5<int> (obsolescent gcc or gdb)"
}
-re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5<int> const|const T5<int>) ?&\\);${ws}~T5\\(\\);${ws}static void \\* operator new\\((size_t|unsigned( int| long|))\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" {
- # This also triggers gdb/1113...
- kfail "gdb/1111" "ptype T5<int>"
- # Add here a PASS case when PR gdb/1111 gets fixed.
+ # This also triggers gdb/8218...
+ kfail "gdb/8216" "ptype T5<int>"
+ # Add here a PASS case when PR gdb/8216 gets fixed.
# These are really:
# http://sourceware.org/bugzilla/show_bug.cgi?id=8216
# http://sourceware.org/bugzilla/show_bug.cgi?id=8218
@@ -98,9 +98,9 @@ proc test_ptype_of_templates {} {
xfail "ptype t5i (obsolescent gcc or gdb) -- without size_t"
}
-re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5<int> const|const T5<int>) ?&\\);${ws}~T5\\(\\);${ws}static void \\* operator new\\((size_t|unsigned( int| long|))\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" {
- # This also triggers gdb/1113...
- kfail "gdb/1111" "ptype t5i"
- # Add here a PASS case when PR gdb/1111 gets fixed.
+ # This also triggers gdb/8218...
+ kfail "gdb/8216" "ptype t5i"
+ # Add here a PASS case when PR gdb/8216 gets fixed.
# These are really:
# http://sourceware.org/bugzilla/show_bug.cgi?id=8216
# http://sourceware.org/bugzilla/show_bug.cgi?id=8218
@@ -132,7 +132,7 @@ proc test_template_breakpoints {} {
"constructor breakpoint"
}
-re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. T5 at .*\[\r\n\]*.3. T5 at .*\[\r\n\]*> $" {
- setup_kfail "gdb/1062" "*-*-*"
+ setup_kfail "gdb/8167" "*-*-*"
gdb_test "0" \
"nonsense intended to insure that this test fails" \
"constructor breakpoint"
@@ -143,7 +143,7 @@ proc test_template_breakpoints {} {
"constructor breakpoint (bad menu choices)"
}
}
-
+
gdb_test_multiple "break T5<int>::~T5" "destructor_breakpoint" {
-re "Breakpoint.*at.* file .*${testfile}.cc, line.*$gdb_prompt $"
{
@@ -151,10 +151,10 @@ proc test_template_breakpoints {} {
}
-re "the class `T5<int>' does not have destructor defined\r\nHint: try 'T5<int>::~T5<TAB> or 'T5<int>::~T5<ESC-\\?>\r\n\\(Note leading single quote.\\)\r\n$gdb_prompt $"
{
- kfail "gdb/1112" "destructor breakpoint"
+ kfail "gdb/8217" "destructor breakpoint"
}
}
-
+
gdb_test "break T5<int>::value" \
"Breakpoint.*at.* file .*${testfile}.cc, line.*" \
"value method breakpoint"
@@ -191,7 +191,7 @@ proc test_template_breakpoints {} {
proc test_template_calls {} {
global gdb_prompt
- if [target_info exists gdb,cannot_call_functions] {
+ if {[target_info exists gdb,cannot_call_functions]} {
unsupported "this target can not call functions"
return
}
@@ -264,7 +264,7 @@ proc do_tests {} {
test_template_typedef
test_template_args
- if [ runto_main] {
+ if {[ runto_main]} {
test_template_calls
}
}
@@ -307,7 +307,7 @@ gdb_test_multiple "ptype/r Foo" "ptype Foo" {
}
-re "type = class Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" {
# GCC 3.1, DWARF-2 output.
- kfail "gdb/57" "ptype Foo"
+ kfail "gdb/7162" "ptype Foo"
}
-re "No symbol \"Foo\" in current context.\r\n$gdb_prompt $" {
# GCC 2.95.3, stabs+ output.
@@ -342,28 +342,25 @@ gdb_test_multiple "ptype/r fchar" "ptype fchar" {
# ptype Foo<volatile char *>
gdb_test_multiple "ptype/r fvpchar" "ptype fvpchar" {
- -re "type = (class |)Foo<volatile char ?\\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*char.*\\*t;\r\n\r\n\[ \t\]*.*char \\* foo\\(int,.*char.*\\*\\);\r\n\\}\r\n$gdb_prompt $" {
- pass "ptype fvpchar"
- }
- -re "type = (class |)Foo<volatile char ?\\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*char.*\\*t;\r\n\r\n\[ \t\]*.*char \\* foo\\(int,.*char.*\\*\\);.*\r\n\\}\r\n$gdb_prompt $" {
+ -re "type = class Foo<char volatile\\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*volatile char \\*t;\r\n\r\n\[ \t\]*volatile char \\* foo\\(int, volatile char \\*\\);.*\r\n\\}\r\n$gdb_prompt $" {
pass "ptype fvpchar"
}
-re "type = (class |)Foo<char volatile ?\\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*char.*\\*t;\r\n\r\n\[ \t\]*.*char \\* foo\\(int,.*char.*\\*\\);\r\n\\}\r\n$gdb_prompt $" {
- kfail "gdb/1512" "ptype fvpchar"
+ kfail "gdb/8617" "ptype fvpchar"
}
}
# print a function from Foo<volatile char *>
# This test is sensitive to whitespace matching, so we'll do it twice,
-# varying the spacing, because of PR gdb/33.
+# varying the spacing, because of PR gdb/7138.
gdb_test_multiple "print Foo<volatile char *>::foo" "print Foo<volatile char *>::foo" {
-re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<(volatile char|char volatile) ?\\*> \\*(| const), int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" {
pass "print Foo<volatile char *>::foo"
}
-re "No symbol \"Foo<volatile char \\*>\" in current context.\r\n$gdb_prompt $" {
- # This used to be a kfail gdb/33 and then kfail gdb/931.
+ # This used to be a kfail gdb/7138 and then kfail gdb/8036.
fail "print Foo<volatile char *>::foo"
}
}
@@ -373,7 +370,7 @@ gdb_test_multiple "print Foo<volatile char*>::foo" "print Foo<volatile char*>::f
pass "print Foo<volatile char*>::foo"
}
-re "No symbol \"Foo<volatile char\\*>\" in current context.\r\n$gdb_prompt $" {
- # This used to be a kfail gdb/33 and then kfail gdb/931.
+ # This used to be a kfail gdb/7138 and then kfail gdb/8036.
fail "print Foo<volatile char*>::foo"
}
}
@@ -390,7 +387,7 @@ gdb_test_multiple "ptype/r Bar" "ptype Bar" {
}
-re "ptype Bar\r\ntype = class Bar<int, ?33> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);\r\n}\r\n$gdb_prompt $" {
# GCC 3.1, DWARF-2 output.
- kfail "gdb/57" "ptype Bar"
+ kfail "gdb/7162" "ptype Bar"
}
-re "No symbol \"Bar\" in current context.\r\n$gdb_prompt $" {
# GCC 2.95.3, stabs+ output.
@@ -433,11 +430,11 @@ gdb_test_multiple "ptype/r Baz" "ptype Baz" {
}
-re "type = class Baz<int, ?'s'> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n}\r\n$gdb_prompt $" {
# GCC 3.1, DWARF-2 output.
- kfail "gdb/57" "ptype Baz"
+ kfail "gdb/7162" "ptype Baz"
}
-re "type = class Baz<int, ?(\\(char\\))?115> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n}\r\n$gdb_prompt $" {
- # GCC 3.x, DWARF-2 output, running into gdb/57 and gdb/1512.
- kfail "gdb/57" "ptype Baz"
+ # GCC 3.x, DWARF-2 output, running into gdb/7162 and gdb/8617.
+ kfail "gdb/7162" "ptype Baz"
}
-re "No symbol \"Baz\" in current context.\r\n$gdb_prompt $" {
# GCC 2.95.3, stabs+ output.
@@ -479,11 +476,11 @@ gdb_test_multiple "ptype/r Qux" "ptype Qux" {
}
-re "type = class Qux<char, ?&string> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char qux\\(int, char\\);\r\n}\r\n$gdb_prompt $" {
# GCC 3.1, DWARF-2 output.
- kfail "gdb/57" "ptype Qux"
+ kfail "gdb/7162" "ptype Qux"
}
-re "type = class Qux<char, ?&\\(string\\)> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char qux\\(int, char\\);\r\n}\r\n$gdb_prompt $" {
- # GCC 3.x, DWARF-2 output; gdb/57 + gdb/1512.
- kfail "gdb/57" "ptype Qux"
+ # GCC 3.x, DWARF-2 output; gdb/7162 + gdb/8617.
+ kfail "gdb/7162" "ptype Qux"
}
-re "No symbol \"Qux\" in current context.\r\n$gdb_prompt $" {
# GCC 2.95.3, stabs+ output.
@@ -507,7 +504,7 @@ gdb_test_multiple "ptype/r quxint" "ptype quxint" {
pass "ptype quxint"
}
-re "type = class Qux<int, ?& ?\\(string\\)> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" {
- kfail "gdb/1512" "ptype quxint"
+ kfail "gdb/8617" "ptype quxint"
}
}
@@ -524,7 +521,7 @@ gdb_test_multiple "ptype/r Spec" "ptype Spec" {
}
-re "type = class Spec<int, ?char> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*int spec\\(char\\);\r\n}\r\n$gdb_prompt $" {
# GCC 3.1, DWARF-2 output.
- kfail "gdb/57" "ptype Spec"
+ kfail "gdb/7162" "ptype Spec"
}
-re "No symbol \"Spec\" in current context.\r\n$gdb_prompt $" {
# GCC 2.95.3, stabs+ output.
diff --git a/gdb/testsuite/gdb.cp/try_catch.cc b/gdb/testsuite/gdb.cp/try_catch.cc
index 82cb847..1c04238 100644
--- a/gdb/testsuite/gdb.cp/try_catch.cc
+++ b/gdb/testsuite/gdb.cp/try_catch.cc
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/try_catch.exp b/gdb/testsuite/gdb.cp/try_catch.exp
index e5e78c7..50a3ea6 100644
--- a/gdb/testsuite/gdb.cp/try_catch.exp
+++ b/gdb/testsuite/gdb.cp/try_catch.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/typed-enum.cc b/gdb/testsuite/gdb.cp/typed-enum.cc
index 77067b1..ef3c420 100644
--- a/gdb/testsuite/gdb.cp/typed-enum.cc
+++ b/gdb/testsuite/gdb.cp/typed-enum.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/typed-enum.exp b/gdb/testsuite/gdb.cp/typed-enum.exp
index 8af8a80..208c311 100644
--- a/gdb/testsuite/gdb.cp/typed-enum.exp
+++ b/gdb/testsuite/gdb.cp/typed-enum.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/typedef-base.cc b/gdb/testsuite/gdb.cp/typedef-base.cc
index 8d78be0..1c0e4c0 100644
--- a/gdb/testsuite/gdb.cp/typedef-base.cc
+++ b/gdb/testsuite/gdb.cp/typedef-base.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/typedef-base.exp b/gdb/testsuite/gdb.cp/typedef-base.exp
index 198897f..a6780da 100644
--- a/gdb/testsuite/gdb.cp/typedef-base.exp
+++ b/gdb/testsuite/gdb.cp/typedef-base.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.cp/typedef-operator.cc b/gdb/testsuite/gdb.cp/typedef-operator.cc
index 2c53878..34a1e70 100644
--- a/gdb/testsuite/gdb.cp/typedef-operator.cc
+++ b/gdb/testsuite/gdb.cp/typedef-operator.cc
@@ -1,6 +1,6 @@
/* This test case is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/typedef-operator.exp b/gdb/testsuite/gdb.cp/typedef-operator.exp
index 35bae27..9214371 100644
--- a/gdb/testsuite/gdb.cp/typedef-operator.exp
+++ b/gdb/testsuite/gdb.cp/typedef-operator.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ gdb_test_no_output "set language c++"
gdb_test "p *u" {You can't do that without a process to debug.} "test crash"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.cp/typeid.cc b/gdb/testsuite/gdb.cp/typeid.cc
index 5e34c77..531833a 100644
--- a/gdb/testsuite/gdb.cp/typeid.cc
+++ b/gdb/testsuite/gdb.cp/typeid.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/typeid.exp b/gdb/testsuite/gdb.cp/typeid.exp
index 3ba82f6..bd97b26 100644
--- a/gdb/testsuite/gdb.cp/typeid.exp
+++ b/gdb/testsuite/gdb.cp/typeid.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -63,7 +63,7 @@ with_test_prefix "before starting" {
do_typeid_tests 0
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.cp/userdef.cc b/gdb/testsuite/gdb.cp/userdef.cc
index 7e045e4..871f8ea 100644
--- a/gdb/testsuite/gdb.cp/userdef.cc
+++ b/gdb/testsuite/gdb.cp/userdef.cc
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 1999-2024 Free Software Foundation, Inc.
+ Copyright 1999-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/userdef.exp b/gdb/testsuite/gdb.cp/userdef.exp
index 869f4bc..05ff8b7 100644
--- a/gdb/testsuite/gdb.cp/userdef.exp
+++ b/gdb/testsuite/gdb.cp/userdef.exp
@@ -1,5 +1,5 @@
# Tests of overloaded operators resolution.
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ if {![runto_main]} {
}
gdb_test "break marker1" \
- "Breakpoint .*${srcfile}.*"
+ "Breakpoint .*${srcfile}.*"
gdb_test "cont" \
"Break.* marker1(\\(\\)|) \\(\\) at .*:$decimal.*" \
@@ -58,7 +58,7 @@ gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" {
pass "re-selected 'main' frame after inferior call"
}
}
-
+
gdb_test "print one - two" "\\\$\[0-9\]* = {x = -2, y = -2}"
gdb_test "print one * two" "\\\$\[0-9\]* = {x = 8, y = 15}"
diff --git a/gdb/testsuite/gdb.cp/using-crash.cc b/gdb/testsuite/gdb.cp/using-crash.cc
index 38e4434..d9e11c5 100644
--- a/gdb/testsuite/gdb.cp/using-crash.cc
+++ b/gdb/testsuite/gdb.cp/using-crash.cc
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.cp/using-crash.exp b/gdb/testsuite/gdb.cp/using-crash.exp
index 3d22e8a..a080b54 100644
--- a/gdb/testsuite/gdb.cp/using-crash.exp
+++ b/gdb/testsuite/gdb.cp/using-crash.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.cp/var-tag-2.cc b/gdb/testsuite/gdb.cp/var-tag-2.cc
index 1b6e36d..2bbbc54 100644
--- a/gdb/testsuite/gdb.cp/var-tag-2.cc
+++ b/gdb/testsuite/gdb.cp/var-tag-2.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/var-tag-3.cc b/gdb/testsuite/gdb.cp/var-tag-3.cc
index a77eb11..a6f63e4 100644
--- a/gdb/testsuite/gdb.cp/var-tag-3.cc
+++ b/gdb/testsuite/gdb.cp/var-tag-3.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/var-tag-4.cc b/gdb/testsuite/gdb.cp/var-tag-4.cc
index c9c6862..2ff1ae1 100644
--- a/gdb/testsuite/gdb.cp/var-tag-4.cc
+++ b/gdb/testsuite/gdb.cp/var-tag-4.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/var-tag.cc b/gdb/testsuite/gdb.cp/var-tag.cc
index b4584ec..042a24b 100644
--- a/gdb/testsuite/gdb.cp/var-tag.cc
+++ b/gdb/testsuite/gdb.cp/var-tag.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/var-tag.exp b/gdb/testsuite/gdb.cp/var-tag.exp
index d879328..5b56790 100644
--- a/gdb/testsuite/gdb.cp/var-tag.exp
+++ b/gdb/testsuite/gdb.cp/var-tag.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/virtbase.exp b/gdb/testsuite/gdb.cp/virtbase.exp
index 53f84a4..991df52 100644
--- a/gdb/testsuite/gdb.cp/virtbase.exp
+++ b/gdb/testsuite/gdb.cp/virtbase.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/virtbase2.cc b/gdb/testsuite/gdb.cp/virtbase2.cc
index 3ab8880..792135b 100644
--- a/gdb/testsuite/gdb.cp/virtbase2.cc
+++ b/gdb/testsuite/gdb.cp/virtbase2.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/virtbase2.exp b/gdb/testsuite/gdb.cp/virtbase2.exp
index 6e7336d..4b6abd0 100644
--- a/gdb/testsuite/gdb.cp/virtbase2.exp
+++ b/gdb/testsuite/gdb.cp/virtbase2.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/virtfunc.cc b/gdb/testsuite/gdb.cp/virtfunc.cc
index 6c894c5..a1dffa9 100644
--- a/gdb/testsuite/gdb.cp/virtfunc.cc
+++ b/gdb/testsuite/gdb.cp/virtfunc.cc
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 1993-2024 Free Software Foundation, Inc.
+ Copyright 1993-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/virtfunc.exp b/gdb/testsuite/gdb.cp/virtfunc.exp
index 636497e..e63d64a 100644
--- a/gdb/testsuite/gdb.cp/virtfunc.exp
+++ b/gdb/testsuite/gdb.cp/virtfunc.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -176,7 +176,7 @@ proc test_virtual_calls {} {
global gdb_prompt
global nl
- if [target_info exists gdb,cannot_call_functions] {
+ if {[target_info exists gdb,cannot_call_functions]} {
unsupported "this target can not call functions"
return 0
}
diff --git a/gdb/testsuite/gdb.cp/virtfunc2.cc b/gdb/testsuite/gdb.cp/virtfunc2.cc
index 78436ed..9bac676 100644
--- a/gdb/testsuite/gdb.cp/virtfunc2.cc
+++ b/gdb/testsuite/gdb.cp/virtfunc2.cc
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/virtfunc2.exp b/gdb/testsuite/gdb.cp/virtfunc2.exp
index b2b1094..d05e501 100644
--- a/gdb/testsuite/gdb.cp/virtfunc2.exp
+++ b/gdb/testsuite/gdb.cp/virtfunc2.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/vla-cxx.cc b/gdb/testsuite/gdb.cp/vla-cxx.cc
index 7603b4b..8178536 100644
--- a/gdb/testsuite/gdb.cp/vla-cxx.cc
+++ b/gdb/testsuite/gdb.cp/vla-cxx.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/vla-cxx.exp b/gdb/testsuite/gdb.cp/vla-cxx.exp
index 4303383..10f598d 100644
--- a/gdb/testsuite/gdb.cp/vla-cxx.exp
+++ b/gdb/testsuite/gdb.cp/vla-cxx.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $flags] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.cp/watch-cp.cc b/gdb/testsuite/gdb.cp/watch-cp.cc
index 5cf999b..de42cd2 100644
--- a/gdb/testsuite/gdb.cp/watch-cp.cc
+++ b/gdb/testsuite/gdb.cp/watch-cp.cc
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/watch-cp.exp b/gdb/testsuite/gdb.cp/watch-cp.exp
index 4852851..8cb1d9c 100644
--- a/gdb/testsuite/gdb.cp/watch-cp.exp
+++ b/gdb/testsuite/gdb.cp/watch-cp.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/wide_char_types.c b/gdb/testsuite/gdb.cp/wide_char_types.c
index 49c60ca..cfbfb38 100644
--- a/gdb/testsuite/gdb.cp/wide_char_types.c
+++ b/gdb/testsuite/gdb.cp/wide_char_types.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.cp/wide_char_types.exp b/gdb/testsuite/gdb.cp/wide_char_types.exp
index 45c296e..4961d7a 100644
--- a/gdb/testsuite/gdb.cp/wide_char_types.exp
+++ b/gdb/testsuite/gdb.cp/wide_char_types.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp b/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp
index 7c6cb0d..2a0e999 100644
--- a/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp
+++ b/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,6 +37,6 @@ gdb_test_no_output "set always-read-ctf on"
gdb_load $binfile
# Same thing with struct and union.
-gdb_test "ptype struct A" "type = struct A \{\[\r\n\]+\[ \t\]+struct B \\*foo;\[\r\n\]+\}.*" "ptype structure A"
-gdb_test "ptype struct B" "type = struct B \{\[\r\n\]+\[ \t\]+struct B \\*next;\[\r\n\]+\}.*" "ptype structure B"
+gdb_test "ptype struct A" "type = struct A \{\[\r\n\]+\[ \t\]+long a;\[\r\n\]+\[ \t\]+struct B \\*foo;\[\r\n\]+\}.*" "ptype structure A"
+gdb_test "ptype struct B" "type = struct B \{\[\r\n\]+\[ \t\]+int foo;\[\r\n\]+\[ \t\]+struct A \\*bar;\[\r\n\]+\}.*" "ptype structure B"
gdb_test "ptype struct C" "type = struct C \{\[\r\n\]+\[ \t\]+struct B \\*foo;\[\r\n\]+\[ \t\]+int b;\[\r\n\]+\}.*" "ptype structure C"
diff --git a/gdb/testsuite/gdb.ctf/ctf-a.c b/gdb/testsuite/gdb.ctf/ctf-a.c
index 1b7ff49..ef52397 100644
--- a/gdb/testsuite/gdb.ctf/ctf-a.c
+++ b/gdb/testsuite/gdb.ctf/ctf-a.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ctf/ctf-a.h b/gdb/testsuite/gdb.ctf/ctf-a.h
index e8616e6..9bb6556 100644
--- a/gdb/testsuite/gdb.ctf/ctf-a.h
+++ b/gdb/testsuite/gdb.ctf/ctf-a.h
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ctf/ctf-b.c b/gdb/testsuite/gdb.ctf/ctf-b.c
index 61ae0e4..ae60e39 100644
--- a/gdb/testsuite/gdb.ctf/ctf-b.c
+++ b/gdb/testsuite/gdb.ctf/ctf-b.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ctf/ctf-b.h b/gdb/testsuite/gdb.ctf/ctf-b.h
index 76a5827..59f7315 100644
--- a/gdb/testsuite/gdb.ctf/ctf-b.h
+++ b/gdb/testsuite/gdb.ctf/ctf-b.h
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ctf/ctf-c.c b/gdb/testsuite/gdb.ctf/ctf-c.c
index e646dfa..f5f3233 100644
--- a/gdb/testsuite/gdb.ctf/ctf-c.c
+++ b/gdb/testsuite/gdb.ctf/ctf-c.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ctf/ctf-c.h b/gdb/testsuite/gdb.ctf/ctf-c.h
index 87e3e7f..cdf83ee 100644
--- a/gdb/testsuite/gdb.ctf/ctf-c.h
+++ b/gdb/testsuite/gdb.ctf/ctf-c.h
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ctf/dwarf2-and-ctf-2.c b/gdb/testsuite/gdb.ctf/dwarf2-and-ctf-2.c
index 2f00f88..2a07bfd 100644
--- a/gdb/testsuite/gdb.ctf/dwarf2-and-ctf-2.c
+++ b/gdb/testsuite/gdb.ctf/dwarf2-and-ctf-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ctf/dwarf2-and-ctf.c b/gdb/testsuite/gdb.ctf/dwarf2-and-ctf.c
index eacdf8d..b786fd7 100644
--- a/gdb/testsuite/gdb.ctf/dwarf2-and-ctf.c
+++ b/gdb/testsuite/gdb.ctf/dwarf2-and-ctf.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ctf/dwarf2-and-ctf.exp b/gdb/testsuite/gdb.ctf/dwarf2-and-ctf.exp
index 64350b4..68630ec 100644
--- a/gdb/testsuite/gdb.ctf/dwarf2-and-ctf.exp
+++ b/gdb/testsuite/gdb.ctf/dwarf2-and-ctf.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ctf/funcreturn.exp b/gdb/testsuite/gdb.ctf/funcreturn.exp
index 4b5298e..55ee969 100644
--- a/gdb/testsuite/gdb.ctf/funcreturn.exp
+++ b/gdb/testsuite/gdb.ctf/funcreturn.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
require allow_ctf_tests
-if [target_info exists no_long_long] {
+if {[target_info exists no_long_long]} {
set exec_opts [list debug additional_flags=-DNO_LONG_LONG]
} else {
set exec_opts [list debug]
@@ -91,7 +91,7 @@ gdb_test "print v_unsigned_long_func" \
"$decimal = \{unsigned long|long \\(\\)\} 0x\[0-9a-z\]+ <v_unsigned_long_func>.*" \
"print unsigned long function"
-if ![target_info exists no_long_long] {
+if {![target_info exists no_long_long]} {
gdb_test "print v_long_long_func" \
"$decimal = \{long long \\(\\)\} 0x\[0-9a-z\]+ <v_long_long_func>.*" \
"print long long function"
@@ -164,7 +164,7 @@ gdb_test "whatis v_unsigned_long_func" \
"type = (unsigned (int|long|long int)|long unsigned int) \\($void\\)" \
"whatis unsigned long function"
-if ![target_info exists no_long_long] {
+if {![target_info exists no_long_long]} {
gdb_test "whatis v_long_long_func" \
"type = long long(| int) \\($void\\)" \
"whatis long long function"
diff --git a/gdb/testsuite/gdb.ctf/multi.exp b/gdb/testsuite/gdb.ctf/multi.exp
index 5215ff2..73b1b1e 100644
--- a/gdb/testsuite/gdb.ctf/multi.exp
+++ b/gdb/testsuite/gdb.ctf/multi.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.ctf/whatis.c b/gdb/testsuite/gdb.ctf/whatis.c
index ec722fb..c722cf2 100644
--- a/gdb/testsuite/gdb.ctf/whatis.c
+++ b/gdb/testsuite/gdb.ctf/whatis.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 1992-2024 Free Software Foundation, Inc.
+ Copyright 1992-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/ada-arrays.exp b/gdb/testsuite/gdb.dap/ada-arrays.exp
index 64c6eb2..8912a19 100644
--- a/gdb/testsuite/gdb.dap/ada-arrays.exp
+++ b/gdb/testsuite/gdb.dap/ada-arrays.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/ada-arrays/cstuff.c b/gdb/testsuite/gdb.dap/ada-arrays/cstuff.c
index a3de217..3a7c8a0 100644
--- a/gdb/testsuite/gdb.dap/ada-arrays/cstuff.c
+++ b/gdb/testsuite/gdb.dap/ada-arrays/cstuff.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dap/ada-arrays/main.adb b/gdb/testsuite/gdb.dap/ada-arrays/main.adb
index 6ffff4f..6b5e896 100644
--- a/gdb/testsuite/gdb.dap/ada-arrays/main.adb
+++ b/gdb/testsuite/gdb.dap/ada-arrays/main.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/ada-arrays/pck.adb b/gdb/testsuite/gdb.dap/ada-arrays/pck.adb
index db15657..c370c51 100644
--- a/gdb/testsuite/gdb.dap/ada-arrays/pck.adb
+++ b/gdb/testsuite/gdb.dap/ada-arrays/pck.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/ada-arrays/pck.ads b/gdb/testsuite/gdb.dap/ada-arrays/pck.ads
index 1043836..d6a2117 100644
--- a/gdb/testsuite/gdb.dap/ada-arrays/pck.ads
+++ b/gdb/testsuite/gdb.dap/ada-arrays/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/ada-nested.exp b/gdb/testsuite/gdb.dap/ada-nested.exp
index 7f28d27..c8ed30e 100644
--- a/gdb/testsuite/gdb.dap/ada-nested.exp
+++ b/gdb/testsuite/gdb.dap/ada-nested.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/ada-nested/prog.adb b/gdb/testsuite/gdb.dap/ada-nested/prog.adb
index f20b17e..119bb75 100644
--- a/gdb/testsuite/gdb.dap/ada-nested/prog.adb
+++ b/gdb/testsuite/gdb.dap/ada-nested/prog.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/ada-scopes.exp b/gdb/testsuite/gdb.dap/ada-scopes.exp
index ef1302e..1c787e3 100644
--- a/gdb/testsuite/gdb.dap/ada-scopes.exp
+++ b/gdb/testsuite/gdb.dap/ada-scopes.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/ada-scopes/pack.adb b/gdb/testsuite/gdb.dap/ada-scopes/pack.adb
index 22c4d44..7b6f0ca 100644
--- a/gdb/testsuite/gdb.dap/ada-scopes/pack.adb
+++ b/gdb/testsuite/gdb.dap/ada-scopes/pack.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/ada-scopes/pack.ads b/gdb/testsuite/gdb.dap/ada-scopes/pack.ads
index 845b35b..b4e8640 100644
--- a/gdb/testsuite/gdb.dap/ada-scopes/pack.ads
+++ b/gdb/testsuite/gdb.dap/ada-scopes/pack.ads
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/ada-scopes/prog.adb b/gdb/testsuite/gdb.dap/ada-scopes/prog.adb
index 17511f7..5bdbb8c 100644
--- a/gdb/testsuite/gdb.dap/ada-scopes/prog.adb
+++ b/gdb/testsuite/gdb.dap/ada-scopes/prog.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/args-env.c b/gdb/testsuite/gdb.dap/args-env.c
index 945a082..bf7553d 100644
--- a/gdb/testsuite/gdb.dap/args-env.c
+++ b/gdb/testsuite/gdb.dap/args-env.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/args-env.exp b/gdb/testsuite/gdb.dap/args-env.exp
index 5f02b00..d7961f9 100644
--- a/gdb/testsuite/gdb.dap/args-env.exp
+++ b/gdb/testsuite/gdb.dap/args-env.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/assign.c b/gdb/testsuite/gdb.dap/assign.c
index 91b0427..2c2a22b 100644
--- a/gdb/testsuite/gdb.dap/assign.c
+++ b/gdb/testsuite/gdb.dap/assign.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dap/assign.exp b/gdb/testsuite/gdb.dap/assign.exp
index 6665b6a..f5a5363 100644
--- a/gdb/testsuite/gdb.dap/assign.exp
+++ b/gdb/testsuite/gdb.dap/assign.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/assign.py b/gdb/testsuite/gdb.dap/assign.py
index 1c63259..1a965f1 100644
--- a/gdb/testsuite/gdb.dap/assign.py
+++ b/gdb/testsuite/gdb.dap/assign.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/attach-fail.exp b/gdb/testsuite/gdb.dap/attach-fail.exp
new file mode 100644
index 0000000..8992f62
--- /dev/null
+++ b/gdb/testsuite/gdb.dap/attach-fail.exp
@@ -0,0 +1,32 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test "attach" failure in DAP.
+
+require can_spawn_for_attach allow_dap_tests
+
+load_lib dap-support.exp
+
+# Passing an empty remote name here will guarantee a failure without
+# trying to find a real remote.
+set id [dap_target_remote {""}]
+
+dap_check_request_and_response "configurationDone" configurationDone
+
+set resp [lindex [dap_read_response attach $id] 0]
+gdb_assert {[dict get $resp success] == "false"} \
+ "attach failed"
+
+dap_shutdown
diff --git a/gdb/testsuite/gdb.dap/attach.c b/gdb/testsuite/gdb.dap/attach.c
index bf17c15..6ff0938 100644
--- a/gdb/testsuite/gdb.dap/attach.c
+++ b/gdb/testsuite/gdb.dap/attach.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/attach.exp b/gdb/testsuite/gdb.dap/attach.exp
index e0cd57b..5e1f634 100644
--- a/gdb/testsuite/gdb.dap/attach.exp
+++ b/gdb/testsuite/gdb.dap/attach.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,11 +33,11 @@ set attach_id [dap_attach $testpid $binfile]
dap_check_request_and_response "configurationDone" configurationDone
+dap_check_response "attach response" attach $attach_id
+
dap_wait_for_event_and_check "stopped" stopped \
"body reason" attach
-dap_check_response "attach response" attach $attach_id
-
dap_shutdown true
kill_wait_spawned_process $test_spawn_id
diff --git a/gdb/testsuite/gdb.dap/basic-dap.c b/gdb/testsuite/gdb.dap/basic-dap.c
index 67e5486..a35dbfe 100644
--- a/gdb/testsuite/gdb.dap/basic-dap.c
+++ b/gdb/testsuite/gdb.dap/basic-dap.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dap/basic-dap.exp b/gdb/testsuite/gdb.dap/basic-dap.exp
index dd785ef..fc30268 100644
--- a/gdb/testsuite/gdb.dap/basic-dap.exp
+++ b/gdb/testsuite/gdb.dap/basic-dap.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/bt-inner.c b/gdb/testsuite/gdb.dap/bt-inner.c
index e0f579a2..6aaa3e4 100644
--- a/gdb/testsuite/gdb.dap/bt-inner.c
+++ b/gdb/testsuite/gdb.dap/bt-inner.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dap/bt-main.c b/gdb/testsuite/gdb.dap/bt-main.c
index bfdfb4b..18928fe 100644
--- a/gdb/testsuite/gdb.dap/bt-main.c
+++ b/gdb/testsuite/gdb.dap/bt-main.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dap/bt-nodebug.exp b/gdb/testsuite/gdb.dap/bt-nodebug.exp
index 319dcf0..8188a98 100644
--- a/gdb/testsuite/gdb.dap/bt-nodebug.exp
+++ b/gdb/testsuite/gdb.dap/bt-nodebug.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -71,6 +71,7 @@ gdb_assert {[dict exists [lindex $breakpoints 0] instructionReference]} \
# slipped in that caused this to be incorrect, so we test both parts
# here; to test whether a string was given, we have to reach into the
# TON form.
+# tclint-disable-next-line command-args
set list_form [namespace eval ton::2list $last_ton]
set ref [namespace eval ton::2list {
get $list_form body breakpoints 0 instructionReference
diff --git a/gdb/testsuite/gdb.dap/cancel-launch.exp b/gdb/testsuite/gdb.dap/cancel-launch.exp
index 7ef18d1..acb7ee2 100644
--- a/gdb/testsuite/gdb.dap/cancel-launch.exp
+++ b/gdb/testsuite/gdb.dap/cancel-launch.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/catch-exception.exp b/gdb/testsuite/gdb.dap/catch-exception.exp
index 9793746..0e8c27a 100644
--- a/gdb/testsuite/gdb.dap/catch-exception.exp
+++ b/gdb/testsuite/gdb.dap/catch-exception.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ set obj [dap_check_request_and_response "set exception catchpoints" \
setExceptionBreakpoints \
{o filters [a [s nosuchfilter] [s assert]] \
filterOptions [a [o filterId [s exception] \
- condition [s "Global_Var = 23"]]]}]
+ condition [s program_error]]]}]
set bps [dict get [lindex $obj 0] body breakpoints]
# We should get three responses, because we requested three
@@ -77,6 +77,20 @@ dap_wait_for_event_and_check "stopped at first raise" stopped \
"body reason" breakpoint \
"body hitBreakpointIds" 2
+set found_line -1
+set line [gdb_get_line_number "EXPECTED" $testdir/prog.adb]
+set bt [lindex [dap_check_request_and_response "backtrace" stackTrace \
+ {o threadId [i 1]}] \
+ 0]
+foreach frame [dict get $bt body stackFrames] {
+ if {[dict exists $frame source path]
+ && [file tail [dict get $frame source path]] == "prog.adb"} {
+ set found_line [dict get $frame line]
+ }
+}
+
+gdb_assert {$found_line == $line} "stopped at correct raise"
+
dap_check_request_and_response "continue to assert" continue \
{o threadId [i 1]}
dap_wait_for_event_and_check "stopped at assert" stopped \
diff --git a/gdb/testsuite/gdb.dap/catch-exception/pck.ads b/gdb/testsuite/gdb.dap/catch-exception/pck.ads
index c6610f8..1fb5abb 100644
--- a/gdb/testsuite/gdb.dap/catch-exception/pck.ads
+++ b/gdb/testsuite/gdb.dap/catch-exception/pck.ads
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/catch-exception/prog.adb b/gdb/testsuite/gdb.dap/catch-exception/prog.adb
index ffcc88d..7a5a31d 100644
--- a/gdb/testsuite/gdb.dap/catch-exception/prog.adb
+++ b/gdb/testsuite/gdb.dap/catch-exception/prog.adb
@@ -1,4 +1,4 @@
--- Copyright 2023-2024 Free Software Foundation, Inc.
+-- Copyright 2023-2025 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@@ -19,15 +19,14 @@ procedure Prog is
begin
begin
- raise Program_Error;
+ raise Constraint_Error;
exception
when others =>
null;
end;
begin
- Global_Var := 23;
- raise Program_Error;
+ raise Program_Error; -- EXPECTED
exception
when others =>
null;
diff --git a/gdb/testsuite/gdb.dap/children.exp b/gdb/testsuite/gdb.dap/children.exp
index 783fff9..1e96a70 100644
--- a/gdb/testsuite/gdb.dap/children.exp
+++ b/gdb/testsuite/gdb.dap/children.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/children.py b/gdb/testsuite/gdb.dap/children.py
index b4eb074..53bcdce 100644
--- a/gdb/testsuite/gdb.dap/children.py
+++ b/gdb/testsuite/gdb.dap/children.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/cond-bp.c b/gdb/testsuite/gdb.dap/cond-bp.c
index 9d0f70c..3923a61 100644
--- a/gdb/testsuite/gdb.dap/cond-bp.c
+++ b/gdb/testsuite/gdb.dap/cond-bp.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dap/cond-bp.exp b/gdb/testsuite/gdb.dap/cond-bp.exp
index 28d4b8e..2b862e9 100644
--- a/gdb/testsuite/gdb.dap/cond-bp.exp
+++ b/gdb/testsuite/gdb.dap/cond-bp.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/cwd.exp b/gdb/testsuite/gdb.dap/cwd.exp
index b3c9f9c..6460a5d 100644
--- a/gdb/testsuite/gdb.dap/cwd.exp
+++ b/gdb/testsuite/gdb.dap/cwd.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/cxx-exception.cc b/gdb/testsuite/gdb.dap/cxx-exception.cc
index 6cccb13f..31f1ccc 100644
--- a/gdb/testsuite/gdb.dap/cxx-exception.cc
+++ b/gdb/testsuite/gdb.dap/cxx-exception.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/cxx-exception.exp b/gdb/testsuite/gdb.dap/cxx-exception.exp
index c79c5db..2b33a4f 100644
--- a/gdb/testsuite/gdb.dap/cxx-exception.exp
+++ b/gdb/testsuite/gdb.dap/cxx-exception.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/disassem.c b/gdb/testsuite/gdb.dap/disassem.c
index c0f5128..c77718f 100644
--- a/gdb/testsuite/gdb.dap/disassem.c
+++ b/gdb/testsuite/gdb.dap/disassem.c
@@ -1,4 +1,4 @@
-/* Copyright 2024 Free Software Foundation, Inc.
+/* Copyright 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dap/disassem.exp b/gdb/testsuite/gdb.dap/disassem.exp
index 6fdfc63..1fd511c 100644
--- a/gdb/testsuite/gdb.dap/disassem.exp
+++ b/gdb/testsuite/gdb.dap/disassem.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/eof.exp b/gdb/testsuite/gdb.dap/eof.exp
index 05048f2..5c709ed 100644
--- a/gdb/testsuite/gdb.dap/eof.exp
+++ b/gdb/testsuite/gdb.dap/eof.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,8 +30,10 @@ if {[dap_initialize] == ""} {
return
}
-catch "close -i $gdb_spawn_id"
-catch "wait -i $gdb_spawn_id"
+# Expect support is missing ( https://github.com/nmoroze/tclint/issues/118 ).
+# tclint-disable-next-line command-args
+catch {close -i $gdb_spawn_id}
+catch {wait -i $gdb_spawn_id}
unset gdb_spawn_id
dap_check_log_file
diff --git a/gdb/testsuite/gdb.dap/frameless.c b/gdb/testsuite/gdb.dap/frameless.c
index 3c39a60..6c2c670 100644
--- a/gdb/testsuite/gdb.dap/frameless.c
+++ b/gdb/testsuite/gdb.dap/frameless.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dap/frameless.exp b/gdb/testsuite/gdb.dap/frameless.exp
index 6963eed..7fe4da4 100644
--- a/gdb/testsuite/gdb.dap/frameless.exp
+++ b/gdb/testsuite/gdb.dap/frameless.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/global.c b/gdb/testsuite/gdb.dap/global.c
index d3b7085..b15bab1 100644
--- a/gdb/testsuite/gdb.dap/global.c
+++ b/gdb/testsuite/gdb.dap/global.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/global.exp b/gdb/testsuite/gdb.dap/global.exp
index 2704f46..cc4f26d 100644
--- a/gdb/testsuite/gdb.dap/global.exp
+++ b/gdb/testsuite/gdb.dap/global.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/hover.c b/gdb/testsuite/gdb.dap/hover.c
index 13a6dd9..1d5d47f 100644
--- a/gdb/testsuite/gdb.dap/hover.c
+++ b/gdb/testsuite/gdb.dap/hover.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dap/hover.exp b/gdb/testsuite/gdb.dap/hover.exp
index f637c4a..cd31b53 100644
--- a/gdb/testsuite/gdb.dap/hover.exp
+++ b/gdb/testsuite/gdb.dap/hover.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/insn-bp.exp b/gdb/testsuite/gdb.dap/insn-bp.exp
index 6542262..568a6ad 100644
--- a/gdb/testsuite/gdb.dap/insn-bp.exp
+++ b/gdb/testsuite/gdb.dap/insn-bp.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/lazy-string.c b/gdb/testsuite/gdb.dap/lazy-string.c
index 36faa60..6a4a27b 100644
--- a/gdb/testsuite/gdb.dap/lazy-string.c
+++ b/gdb/testsuite/gdb.dap/lazy-string.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dap/lazy-string.exp b/gdb/testsuite/gdb.dap/lazy-string.exp
index d070347..35de3b8 100644
--- a/gdb/testsuite/gdb.dap/lazy-string.exp
+++ b/gdb/testsuite/gdb.dap/lazy-string.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/lazy-string.py b/gdb/testsuite/gdb.dap/lazy-string.py
index ef886d7..da71ea1 100644
--- a/gdb/testsuite/gdb.dap/lazy-string.py
+++ b/gdb/testsuite/gdb.dap/lazy-string.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/line-zero.exp b/gdb/testsuite/gdb.dap/line-zero.exp
index e6309dc..cf3e693 100644
--- a/gdb/testsuite/gdb.dap/line-zero.exp
+++ b/gdb/testsuite/gdb.dap/line-zero.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/log-message.c b/gdb/testsuite/gdb.dap/log-message.c
index 9797ce5..3abf0f0 100644
--- a/gdb/testsuite/gdb.dap/log-message.c
+++ b/gdb/testsuite/gdb.dap/log-message.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dap/log-message.exp b/gdb/testsuite/gdb.dap/log-message.exp
index a0070af..cce367d 100644
--- a/gdb/testsuite/gdb.dap/log-message.exp
+++ b/gdb/testsuite/gdb.dap/log-message.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,6 +40,15 @@ set obj [dap_check_request_and_response "set breakpoint" \
[list s $srcfile] $line]]
set fn_bpno [dap_get_breakpoint_number $obj]
+set eol {\n}
+dap_wait_for_event_and_check "set breakpoint output, part 1" output \
+ {body category} stdout \
+ {body output} "No source file named log-message.c.$eol"
+
+dap_wait_for_event_and_check "set breakpoint output, part 2" output \
+ {body category} stdout \
+ {body output} "Breakpoint 1 (-source log-message.c -line $line) pending.$eol"
+
dap_check_request_and_response "configurationDone" configurationDone
dap_check_response "launch response" launch $launch_id
diff --git a/gdb/testsuite/gdb.dap/max-size.c b/gdb/testsuite/gdb.dap/max-size.c
index 6bc2e36..f83279f 100644
--- a/gdb/testsuite/gdb.dap/max-size.c
+++ b/gdb/testsuite/gdb.dap/max-size.c
@@ -1,4 +1,4 @@
-/* Copyright 2024 Free Software Foundation, Inc.
+/* Copyright 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dap/max-size.exp b/gdb/testsuite/gdb.dap/max-size.exp
index 05da97c..95a4fce 100644
--- a/gdb/testsuite/gdb.dap/max-size.exp
+++ b/gdb/testsuite/gdb.dap/max-size.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/memory.c b/gdb/testsuite/gdb.dap/memory.c
index d5e536b..e8cb8f6 100644
--- a/gdb/testsuite/gdb.dap/memory.c
+++ b/gdb/testsuite/gdb.dap/memory.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dap/memory.exp b/gdb/testsuite/gdb.dap/memory.exp
index 41f4f8d..e62679c 100644
--- a/gdb/testsuite/gdb.dap/memory.exp
+++ b/gdb/testsuite/gdb.dap/memory.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/modules-solib.c b/gdb/testsuite/gdb.dap/modules-solib.c
index 8db4088..99f2e31 100644
--- a/gdb/testsuite/gdb.dap/modules-solib.c
+++ b/gdb/testsuite/gdb.dap/modules-solib.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/modules.c b/gdb/testsuite/gdb.dap/modules.c
index 02b2517..b14c26c 100644
--- a/gdb/testsuite/gdb.dap/modules.c
+++ b/gdb/testsuite/gdb.dap/modules.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/modules.exp b/gdb/testsuite/gdb.dap/modules.exp
index 2e41679..b38c306 100644
--- a/gdb/testsuite/gdb.dap/modules.exp
+++ b/gdb/testsuite/gdb.dap/modules.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/pause.c b/gdb/testsuite/gdb.dap/pause.c
index 387245a..0ef0b82 100644
--- a/gdb/testsuite/gdb.dap/pause.c
+++ b/gdb/testsuite/gdb.dap/pause.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/pause.exp b/gdb/testsuite/gdb.dap/pause.exp
index c74fea3..813999b 100644
--- a/gdb/testsuite/gdb.dap/pause.exp
+++ b/gdb/testsuite/gdb.dap/pause.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/ptrref.cc b/gdb/testsuite/gdb.dap/ptrref.cc
index 98a0ef7..da4f127 100644
--- a/gdb/testsuite/gdb.dap/ptrref.cc
+++ b/gdb/testsuite/gdb.dap/ptrref.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/ptrref.exp b/gdb/testsuite/gdb.dap/ptrref.exp
index 2a972ac..08423ed 100644
--- a/gdb/testsuite/gdb.dap/ptrref.exp
+++ b/gdb/testsuite/gdb.dap/ptrref.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/remote-dap.exp b/gdb/testsuite/gdb.dap/remote-dap.exp
index bca66dd..c590877 100644
--- a/gdb/testsuite/gdb.dap/remote-dap.exp
+++ b/gdb/testsuite/gdb.dap/remote-dap.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/rust-slices.exp b/gdb/testsuite/gdb.dap/rust-slices.exp
index 1ed640a..c3c5630 100644
--- a/gdb/testsuite/gdb.dap/rust-slices.exp
+++ b/gdb/testsuite/gdb.dap/rust-slices.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/rust-slices.rs b/gdb/testsuite/gdb.dap/rust-slices.rs
index 9ac1d07..f8fa16e 100644
--- a/gdb/testsuite/gdb.dap/rust-slices.rs
+++ b/gdb/testsuite/gdb.dap/rust-slices.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2023-2024 Free Software Foundation, Inc.
+// Copyright (C) 2023-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/scopes.c b/gdb/testsuite/gdb.dap/scopes.c
index 8e95c28..2a1d76c 100644
--- a/gdb/testsuite/gdb.dap/scopes.c
+++ b/gdb/testsuite/gdb.dap/scopes.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -27,6 +27,8 @@ int main ()
static int scalar = 23;
+ void *ptr = (void *) &scalar;
+
{
const char *inner = "inner block";
diff --git a/gdb/testsuite/gdb.dap/scopes.exp b/gdb/testsuite/gdb.dap/scopes.exp
index e0c7786..52efa68 100644
--- a/gdb/testsuite/gdb.dap/scopes.exp
+++ b/gdb/testsuite/gdb.dap/scopes.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -70,7 +70,8 @@ lassign $scopes scope reg_scope
gdb_assert {[dict get $scope name] == "Locals"} "scope is locals"
gdb_assert {[dict get $scope presentationHint] == "locals"} \
"locals presentation hint"
-gdb_assert {[dict get $scope namedVariables] == 3} "three vars in scope"
+set count [dict get $scope namedVariables]
+gdb_assert {$count == 4} "four vars in scope"
gdb_assert {[dict get $reg_scope name] == "Registers"} \
"second scope is registers"
@@ -89,8 +90,8 @@ set refs1 [lindex [dap_check_request_and_response "fetch variables 0,1" \
set refs2 [lindex [dap_check_request_and_response "fetch variables 2" \
"variables" \
[format {o variablesReference [i %d] \
- start [i 2] count [i 1]} \
- $num]] \
+ start [i 2] count [i %d]} \
+ $num [expr {$count - 2}]]] \
0]
set vars [concat [dict get $refs1 body variables] \
@@ -115,6 +116,10 @@ foreach var $vars {
"scalar" {
gdb_assert {[dict get $var value] == 23} "check value of scalar"
}
+ "ptr" {
+ gdb_assert {[dict get $var memoryReference] != ""} \
+ "check memoryReference of ptr"
+ }
default {
fail "unknown variable $name"
}
@@ -128,11 +133,38 @@ set refs [lindex [dap_check_request_and_response "fetch contents of dei" \
set deivals [dict get $refs body variables]
gdb_assert {[llength $deivals] == 2} "dei has two members"
+# Request more children than exist. See PR dap/33228.
+set seq [dap_send_request variables \
+ [format {o variablesReference [i %d] count [i 100]} $dei_ref]]
+lassign [dap_read_response variables $seq] response ignore
+gdb_assert {[dict get $response success] == "false"} \
+ "variables with invalid count"
+
set num [dict get $reg_scope variablesReference]
-# The request succeeding is sufficient.
-set val [dap_check_request_and_response "fetch first register" \
+lassign [dap_check_request_and_response "fetch all registers" \
"variables" \
- [format {o variablesReference [i %d] count [i 1]} $num]]
+ [format {o variablesReference [i %d] count [i %d]} $num\
+ [dict get $reg_scope namedVariables]]] \
+ val events
+
+# If any register has children, try to fetch those as well. This is a
+# regression test for part of PR dap/33228.
+foreach var [dict get $val body variables] {
+ set regvar [dict get $var variablesReference]
+ if {$regvar > 0} {
+ # If variablesReference is non-zero, then there must be either
+ # named or indexed children.
+ if {[dict exists $var namedVariables]} {
+ set n [dict get $var namedVariables]
+ } else {
+ set n [dict get $var indexedVariables]
+ }
+
+ dap_check_request_and_response "fetch register children for $regvar" \
+ "variables" \
+ [format {o variablesReference [i %d] count [i %d]} $regvar $n]
+ }
+}
set num [dict get $scope variablesReference]
set refs [lindex [dap_check_request_and_response "set variable scalar" \
diff --git a/gdb/testsuite/gdb.dap/sources.c b/gdb/testsuite/gdb.dap/sources.c
index b607705..8e366ad 100644
--- a/gdb/testsuite/gdb.dap/sources.c
+++ b/gdb/testsuite/gdb.dap/sources.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dap/sources.exp b/gdb/testsuite/gdb.dap/sources.exp
index 305a27c..0bb2dc5 100644
--- a/gdb/testsuite/gdb.dap/sources.exp
+++ b/gdb/testsuite/gdb.dap/sources.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/stack-format.c b/gdb/testsuite/gdb.dap/stack-format.c
index 583cfa8..f509d36 100644
--- a/gdb/testsuite/gdb.dap/stack-format.c
+++ b/gdb/testsuite/gdb.dap/stack-format.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dap/stack-format.exp b/gdb/testsuite/gdb.dap/stack-format.exp
index 4056e1f..7c795c3 100644
--- a/gdb/testsuite/gdb.dap/stack-format.exp
+++ b/gdb/testsuite/gdb.dap/stack-format.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/stack-format.py b/gdb/testsuite/gdb.dap/stack-format.py
index b7799f4..a20f689 100644
--- a/gdb/testsuite/gdb.dap/stack-format.py
+++ b/gdb/testsuite/gdb.dap/stack-format.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/step-out.c b/gdb/testsuite/gdb.dap/step-out.c
index 8c7e694..32d15bc 100644
--- a/gdb/testsuite/gdb.dap/step-out.c
+++ b/gdb/testsuite/gdb.dap/step-out.c
@@ -1,4 +1,4 @@
-/* Copyright 2024 Free Software Foundation, Inc.
+/* Copyright 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dap/step-out.exp b/gdb/testsuite/gdb.dap/step-out.exp
index e9d7a25..3cf8335 100644
--- a/gdb/testsuite/gdb.dap/step-out.exp
+++ b/gdb/testsuite/gdb.dap/step-out.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/stop-at-main.exp b/gdb/testsuite/gdb.dap/stop-at-main.exp
index 52b94f4..3523b5f 100644
--- a/gdb/testsuite/gdb.dap/stop-at-main.exp
+++ b/gdb/testsuite/gdb.dap/stop-at-main.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/terminate.exp b/gdb/testsuite/gdb.dap/terminate.exp
index 9872351..b0ea4b2 100644
--- a/gdb/testsuite/gdb.dap/terminate.exp
+++ b/gdb/testsuite/gdb.dap/terminate.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/threads.c b/gdb/testsuite/gdb.dap/threads.c
new file mode 100644
index 0000000..168f044
--- /dev/null
+++ b/gdb/testsuite/gdb.dap/threads.c
@@ -0,0 +1,67 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2019-2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <pthread.h>
+
+#define NUM 2
+
+static pthread_barrier_t threads_started_barrier;
+
+static void *
+thread_function (void *arg)
+{
+ pthread_barrier_wait (&threads_started_barrier);
+
+ while (1)
+ sleep (1);
+
+ pthread_exit (NULL);
+}
+
+static void
+all_started (void)
+{
+}
+
+int
+main ()
+{
+ pthread_t threads[NUM];
+ long i;
+
+ pthread_barrier_init (&threads_started_barrier, NULL, NUM + 1);
+
+ for (i = 1; i <= NUM; i++)
+ {
+ int res;
+
+ res = pthread_create (&threads[i - 1], NULL, thread_function, NULL);
+ }
+
+ pthread_barrier_wait (&threads_started_barrier);
+
+ all_started ();
+
+ printf ("sleeping\n");
+ fflush (stdout);
+ sleep (180);
+
+ exit (EXIT_SUCCESS);
+}
diff --git a/gdb/testsuite/gdb.dap/threads.exp b/gdb/testsuite/gdb.dap/threads.exp
new file mode 100644
index 0000000..c91d107
--- /dev/null
+++ b/gdb/testsuite/gdb.dap/threads.exp
@@ -0,0 +1,81 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test DAP "threads" request.
+
+require allow_shlib_tests allow_dap_tests
+
+load_lib dap-support.exp
+
+standard_testfile
+
+set libname $testfile-solib
+set srcfile_lib $srcdir/$subdir/$libname.c
+set binfile_lib [standard_output_file $libname.so]
+
+if {[build_executable "failed to prepare" $testfile $srcfile \
+ {debug pthreads}] == -1} {
+ return
+}
+
+if {[dap_initialize] == ""} {
+ return
+}
+
+set launch_id [dap_launch $testfile]
+
+set obj [dap_check_request_and_response "set breakpoint on all_started function" \
+ setFunctionBreakpoints \
+ {o breakpoints [a [o name [s all_started]]]}]
+set fn_bpno [dap_get_breakpoint_number $obj]
+
+dap_check_request_and_response "configurationDone" configurationDone
+
+dap_check_response "launch response" launch $launch_id
+
+lassign [dap_wait_for_event_and_check "stopped at function breakpoint" \
+ stopped \
+ "body reason" breakpoint \
+ "body hitBreakpointIds" $fn_bpno] \
+ ignore \
+ all_events
+
+# Verify that we saw the correct number of thread events.
+set count 0
+foreach event $all_events {
+ if {[dict get $event type] == "event"
+ && [dict get $event event] == "thread"
+ && [dict get $event body reason] == "started"} {
+ incr count
+ }
+}
+gdb_assert {$count == 3} "correct number of thread events"
+
+dap_check_request_and_response "continue" continue \
+ {o threadId [i 1]}
+
+# Make sure that the inferior has really re-started -- note that there
+# is no "continue" event, because the "continue" request suppresses
+# those.
+dap_wait_for_event_and_check "output from inferior" output \
+ {body output} "sleeping\\n"
+
+lassign [dap_check_request_and_response "threads request" threads] \
+ response ignore
+
+gdb_assert {[llength [dict get $response body threads]] == 3} \
+ "correct number of threads"
+
+dap_shutdown true
diff --git a/gdb/testsuite/gdb.dap/type_check.exp b/gdb/testsuite/gdb.dap/type_check.exp
index e6c9d73..8c7b55a 100644
--- a/gdb/testsuite/gdb.dap/type_check.exp
+++ b/gdb/testsuite/gdb.dap/type_check.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dap/type_check.py b/gdb/testsuite/gdb.dap/type_check.py
index 81b106a..bd57bc1 100644
--- a/gdb/testsuite/gdb.dap/type_check.py
+++ b/gdb/testsuite/gdb.dap/type_check.py
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.c b/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.c
index ba26e91..e2f6a43 100644
--- a/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.c
+++ b/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp b/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp
index 8d7581f..35bb401 100644
--- a/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp
+++ b/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -46,7 +46,7 @@ set build_id_debug_file \
[standard_output_file [build_id_debug_filename_get $binfile]]
# Get the BINFILE.debug filename. This is the file we should be
-# moving to the BUILD_ID_DEBUG_FILE location, but we wont, we're going
+# moving to the BUILD_ID_DEBUG_FILE location, but we won't, we're going
# to move something else there instead.
set debugfile [standard_output_file "${binfile}.debug"]
diff --git a/gdb/testsuite/gdb.debuginfod/corefile-mapped-file-1.c b/gdb/testsuite/gdb.debuginfod/corefile-mapped-file-1.c
index dd6b3f1..dda7eff 100644
--- a/gdb/testsuite/gdb.debuginfod/corefile-mapped-file-1.c
+++ b/gdb/testsuite/gdb.debuginfod/corefile-mapped-file-1.c
@@ -1,4 +1,4 @@
-/* Copyright 2024 Free Software Foundation, Inc.
+/* Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.debuginfod/corefile-mapped-file-2.c b/gdb/testsuite/gdb.debuginfod/corefile-mapped-file-2.c
index ccf35b7..991eff5 100644
--- a/gdb/testsuite/gdb.debuginfod/corefile-mapped-file-2.c
+++ b/gdb/testsuite/gdb.debuginfod/corefile-mapped-file-2.c
@@ -1,4 +1,4 @@
-/* Copyright 2024 Free Software Foundation, Inc.
+/* Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.debuginfod/corefile-mapped-file-3.c b/gdb/testsuite/gdb.debuginfod/corefile-mapped-file-3.c
index e060866..d6786ff 100644
--- a/gdb/testsuite/gdb.debuginfod/corefile-mapped-file-3.c
+++ b/gdb/testsuite/gdb.debuginfod/corefile-mapped-file-3.c
@@ -1,4 +1,4 @@
-/* Copyright 2024 Free Software Foundation, Inc.
+/* Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp b/gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp
index f02876e..83472f0 100644
--- a/gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp
+++ b/gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -49,7 +49,7 @@
#
# This obviously needs fixing, but is a separate problem from the one being
# tested here, so this test deliberately checks the mapping using a file that
-# is mmaped rather than loaded as a shared library, as such the file is in the
+# is mmapped rather than loaded as a shared library, as such the file is in the
# core-files list of mapped files, but is not in the shared library list.
#
# Despite this test living in the gdb.debuginfod/ directory, only the last
@@ -69,18 +69,22 @@ standard_testfile -1.c -2.c -3.c
# shared library, then use GDB to figure out the offset of the
# variable 'library_ptr' within the library.
set library_filename [standard_output_file "libfoo.so"]
-set binfile2 [standard_output_file "library_loader"]
+set testfile2 "library_loader"
+set binfile2 [standard_output_file $testfile2]
if {[prepare_for_testing_full "build exec which loads the shared library" \
[list $library_filename \
{ debug shlib build-id \
additional_flags=-DPOINTER_VALUE=0x12345678 } \
$srcfile2 {}] \
- [list $binfile2 [list debug shlib=$library_filename ] \
+ [list $testfile2 [list debug shlib=$library_filename ] \
$srcfile { debug }]] != 0} {
return
}
+require {expect_build_id_in_core_file $binfile2}
+require {expect_build_id_in_core_file $library_filename}
+
if {![runto_main]} {
return
}
@@ -160,7 +164,7 @@ if { $ptr_expected_value eq "" } {
# Load this executable within GDB and confirm that we can use the
# offset we calculated previously to view the value of 'library_ptr'.
set opts [list debug additional_flags=-DSHLIB_FILENAME=\"$library_filename\"]
-if {[prepare_for_testing "prepare second executable" $binfile \
+if {[prepare_for_testing "prepare second executable" $testfile \
$srcfile3 $opts] != 0} {
return
}
@@ -174,7 +178,7 @@ gdb_continue_to_breakpoint "run to breakpoint"
set library_base_address \
[get_hexadecimal_valueof "library_base_address" "unknown"]
-set ptr_address [format 0x%x [expr $library_base_address + $ptr_offset]]
+set ptr_address [format 0x%x [expr {$library_base_address + $ptr_offset}]]
set ptr_value [read_ptr_value]
gdb_assert { $ptr_value == $ptr_expected_value } \
@@ -260,7 +264,7 @@ proc load_core_file { testname { line_re "" } } {
# We expect RES to be 2 (TCL_RETURN) or 1 (TCL_ERROR). If we get
# here then somehow the 'catch' above finished without hitting
# either of those cases, which is .... weird.
- perror "unexepcted return value, code = $res, value = $string"
+ perror "unexpected return value, code = $res, value = $string"
return -1
}
}
@@ -268,13 +272,13 @@ proc load_core_file { testname { line_re "" } } {
# And now restart GDB, load the core-file and check that the library shows as
# being mapped in, and that we can still read the library_ptr value from
# memory.
-clean_restart $binfile
+clean_restart $::testfile
load_core_file "load core file"
set library_base_address [get_hexadecimal_valueof "library_base_address" \
"unknown" "get library_base_address in core-file"]
-set ptr_address [format 0x%x [expr $library_base_address + $ptr_offset]]
+set ptr_address [format 0x%x [expr {$library_base_address + $ptr_offset}]]
set ptr_value [read_ptr_value]
gdb_assert { $ptr_value == $ptr_expected_value } \
@@ -287,7 +291,7 @@ gdb_assert { $ptr_value == $ptr_expected_value } \
set library_backup_filename [standard_output_file "libfoo.so.backup"]
remote_exec build "mv \"$library_filename\" \"$library_backup_filename\""
-clean_restart $binfile
+clean_restart $::testfile
load_core_file "load corefile with library file missing" \
"warning: Can't open file [string_to_regexp $library_filename] during file-backed mapping note processing"
@@ -309,7 +313,7 @@ set build_id_filename \
remote_exec build "mkdir -p [file dirname $build_id_filename]"
remote_exec build "ln -sf $library_backup_filename $build_id_filename"
-clean_restart $binfile
+clean_restart $::testfile
gdb_test_no_output "set debug-file-directory $debugdir" \
"set debug-file-directory"
@@ -331,7 +335,7 @@ if {[build_executable "build second version of shared library" \
return
}
-clean_restart $binfile
+clean_restart $::testfile
load_core_file "load corefile with wrong library in place" \
"warning: File [string_to_regexp $library_filename] doesn't match build-id from core-file during file-backed mapping processing"
diff --git a/gdb/testsuite/gdb.debuginfod/crc_mismatch-2.c b/gdb/testsuite/gdb.debuginfod/crc_mismatch-2.c
index 5677680..91b7727 100644
--- a/gdb/testsuite/gdb.debuginfod/crc_mismatch-2.c
+++ b/gdb/testsuite/gdb.debuginfod/crc_mismatch-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.debuginfod/crc_mismatch.c b/gdb/testsuite/gdb.debuginfod/crc_mismatch.c
index c19ca0f..6d5c897 100644
--- a/gdb/testsuite/gdb.debuginfod/crc_mismatch.c
+++ b/gdb/testsuite/gdb.debuginfod/crc_mismatch.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.debuginfod/crc_mismatch.exp b/gdb/testsuite/gdb.debuginfod/crc_mismatch.exp
index 017ef13..e44748f 100644
--- a/gdb/testsuite/gdb.debuginfod/crc_mismatch.exp
+++ b/gdb/testsuite/gdb.debuginfod/crc_mismatch.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.c b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.c
index 61cd7c6..61f562b 100644
--- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.c
+++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
index 450d890..9078068 100644
--- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
+++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -56,7 +56,7 @@ proc write_just_debugaltlink {filename dwzname buildid} {
# Only the DWARF reader checks .gnu_debugaltlink, so make sure
# there is a bit of DWARF in here.
cu {} {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {DW_AT_language @DW_LANG_C} {
}
}
}
@@ -76,17 +76,19 @@ proc write_dwarf_file {filename buildid {value 99}} {
build_id $buildid
cu {} {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
int_label2: base_type {
- {name int}
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
+ DW_AT_name int
+ DW_AT_byte_size 4 sdata
+ DW_AT_encoding @DW_ATE_signed
}
constant {
- {name the_int}
- {type :$int_label2}
- {const_value $value data1}
+ DW_AT_name the_int
+ DW_AT_type :$int_label2
+ DW_AT_const_value $value data1
}
}
}
@@ -107,7 +109,7 @@ proc_with_prefix no_url { } {
setenv DEBUGINFOD_URLS ""
# Test that GDB cannot find source without debuginfod.
- clean_restart $binfile
+ clean_restart $::testfile
gdb_test_no_output "set substitute-path $outputdir /dev/null" \
"set substitute-path"
gdb_test "list" ".*No such file or directory.*"
@@ -126,7 +128,7 @@ proc_with_prefix no_url { } {
file rename -force $debuginfo $debugdir
# Test that GDB cannot find symbols without debuginfod.
- clean_restart $binfile
+ clean_restart $::testfile
gdb_test "file" ".*No symbol file.*"
set buildid "01234567890abcdef0123456"
@@ -152,13 +154,13 @@ proc_with_prefix no_url { } {
# Test that GDB cannot find dwz without debuginfod.
clean_restart
gdb_test "file ${binfile}_alt.o" \
- ".*could not find '.gnu_debugaltlink'.*" \
+ ".*could not find supplementary DWARF file .*" \
"file [file tail ${binfile}_alt.o]"
# Generate a core file and test that GDB cannot find the
# executable.
- clean_restart ${binfile}2
- if ![runto_main] {
+ clean_restart ${::testfile}2
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.debuginfod/solib-with-soname-1.c b/gdb/testsuite/gdb.debuginfod/solib-with-soname-1.c
index 30e9267..9d25165 100644
--- a/gdb/testsuite/gdb.debuginfod/solib-with-soname-1.c
+++ b/gdb/testsuite/gdb.debuginfod/solib-with-soname-1.c
@@ -1,4 +1,4 @@
-/* Copyright 2024 Free Software Foundation, Inc.
+/* Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.debuginfod/solib-with-soname-2.c b/gdb/testsuite/gdb.debuginfod/solib-with-soname-2.c
index a51d48e..5c91084 100644
--- a/gdb/testsuite/gdb.debuginfod/solib-with-soname-2.c
+++ b/gdb/testsuite/gdb.debuginfod/solib-with-soname-2.c
@@ -1,4 +1,4 @@
-/* Copyright 2024 Free Software Foundation, Inc.
+/* Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.debuginfod/solib-with-soname.exp b/gdb/testsuite/gdb.debuginfod/solib-with-soname.exp
index 98c4535..a22fa59 100644
--- a/gdb/testsuite/gdb.debuginfod/solib-with-soname.exp
+++ b/gdb/testsuite/gdb.debuginfod/solib-with-soname.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -89,13 +89,17 @@ if {[lindex $status 0] != 0} {
}
# Build the executable. This links against libfoo.so, which is
-# poining at libfoo_1.so. Just to confuse things even more, this
+# pointing at libfoo_1.so. Just to confuse things even more, this
# executable uses dlopen to load libfoo_2.so. Weird!
if { [build_executable "build executable" ${binfile} ${srcfile2} \
[list debug shlib=${library_filename} shlib_load]] == -1 } {
return
}
+require {expect_build_id_in_core_file $library_1_filename}
+require {expect_build_id_in_core_file $library_2_filename}
+require {expect_build_id_in_core_file $binfile}
+
# If the board file is automatically splitting the debug information
# into a separate file (e.g. the cc-with-gnu-debuglink.exp board) then
# this test isn't going to work.
@@ -132,7 +136,7 @@ if {$corefile eq ""} {
proc load_exec_and_core_file { expect_warning expect_download testname \
{debugdir ""} } {
with_test_prefix $testname {
- clean_restart $::binfile
+ clean_restart $::testfile
if { $debugdir ne "" } {
gdb_test_no_output "set debug-file-directory $debugdir" \
diff --git a/gdb/testsuite/gdb.disasm/am33.exp b/gdb/testsuite/gdb.disasm/am33.exp
index 6950de9..7515da1 100644
--- a/gdb/testsuite/gdb.disasm/am33.exp
+++ b/gdb/testsuite/gdb.disasm/am33.exp
@@ -1,5 +1,5 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -795,7 +795,7 @@ proc dsp_autoincrement_tests { } {
}
}
-clean_restart $binfile
+clean_restart $::testfile
call_tests
movm_tests
diff --git a/gdb/testsuite/gdb.disasm/basics.c b/gdb/testsuite/gdb.disasm/basics.c
index 8204f90..f1eed70 100644
--- a/gdb/testsuite/gdb.disasm/basics.c
+++ b/gdb/testsuite/gdb.disasm/basics.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.disasm/basics.exp b/gdb/testsuite/gdb.disasm/basics.exp
index 771fdb9..9be9945 100644
--- a/gdb/testsuite/gdb.disasm/basics.exp
+++ b/gdb/testsuite/gdb.disasm/basics.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" $testfile ${srcfile}] == -1 } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.disasm/disassembler-options.exp b/gdb/testsuite/gdb.disasm/disassembler-options.exp
index 048c302..ac05e80 100644
--- a/gdb/testsuite/gdb.disasm/disassembler-options.exp
+++ b/gdb/testsuite/gdb.disasm/disassembler-options.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2024 Free Software Foundation, Inc.
+# Copyright (C) 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.disasm/h8300s.exp b/gdb/testsuite/gdb.disasm/h8300s.exp
index 7560c67..13eaa99 100644
--- a/gdb/testsuite/gdb.disasm/h8300s.exp
+++ b/gdb/testsuite/gdb.disasm/h8300s.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2000-2024 Free Software Foundation, Inc.
+# Copyright (C) 2000-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.disasm/hppa.exp b/gdb/testsuite/gdb.disasm/hppa.exp
index 592172b..10b5cb5 100644
--- a/gdb/testsuite/gdb.disasm/hppa.exp
+++ b/gdb/testsuite/gdb.disasm/hppa.exp
@@ -1,5 +1,5 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ set srcfile ${srcdir}/${subdir}/${testfile}.s
set binfile ${objdir}/${subdir}/${testfile}
set comp_output [gdb_compile "${srcfile}" "${binfile}" executable ""]
if { $comp_output != "" } {
- if [ regexp "Opcode not defined - DIAG" $comp_output] {
+ if {[regexp "Opcode not defined - DIAG" $comp_output]} {
warning "HP assembler in use--skipping disasm tests"
return
} else {
@@ -686,7 +686,7 @@ proc all_integer_computational_tests { } {
}
}
- set subi_insns [list {subi} {subio} {comiclr} ]
+ set subi_insns [list {subi} {subio} {comiclr}]
foreach i $subi_insns {
send_gdb "x/16i $i"; send_gdb "_tests\n"
@@ -746,7 +746,7 @@ proc all_integer_computational_tests { } {
timeout { fail "(timeout) "shd tests" }
}
- set extract_insns1 [list {extru} {extrs} {zdep} {dep} ]
+ set extract_insns1 [list {extru} {extrs} {zdep} {dep}]
foreach i $extract_insns1 {
send_gdb "x/8i $i"; send_gdb "_tests\n"
@@ -766,7 +766,7 @@ proc all_integer_computational_tests { } {
}
}
- set extract_insns2 [list {vextru} {vextrs} {zvdep} {vdep} ]
+ set extract_insns2 [list {vextru} {vextrs} {zvdep} {vdep}]
foreach i $extract_insns2 {
send_gdb "x/8i $i"; send_gdb "_tests\n"
@@ -786,7 +786,7 @@ proc all_integer_computational_tests { } {
}
}
- set extract_insns3 [list {vdepi} {zvdepi} ]
+ set extract_insns3 [list {vdepi} {zvdepi}]
foreach i $extract_insns3 {
send_gdb "x/8i $i"; send_gdb "_tests\n"
@@ -806,7 +806,7 @@ proc all_integer_computational_tests { } {
}
}
- set extract_insns4 [list {depi} {zdepi} ]
+ set extract_insns4 [list {depi} {zdepi}]
foreach i $extract_insns4 {
send_gdb "x/8i $i"; send_gdb "_tests\n"
@@ -1365,7 +1365,7 @@ proc fmemLRbug_tests { } {
}
}
-clean_restart $binfile
+clean_restart $::testfile
all_integer_memory_tests
all_immediate_tests
diff --git a/gdb/testsuite/gdb.disasm/mn10300.exp b/gdb/testsuite/gdb.disasm/mn10300.exp
index 33bac9f..74e7c7c 100644
--- a/gdb/testsuite/gdb.disasm/mn10300.exp
+++ b/gdb/testsuite/gdb.disasm/mn10300.exp
@@ -1,5 +1,5 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -529,7 +529,7 @@ proc sub_tests { } {
}
}
-clean_restart $binfile
+clean_restart $::testfile
add_tests
bcc_tests
diff --git a/gdb/testsuite/gdb.disasm/sh3.exp b/gdb/testsuite/gdb.disasm/sh3.exp
index 1cbc8dc..fc591a7 100644
--- a/gdb/testsuite/gdb.disasm/sh3.exp
+++ b/gdb/testsuite/gdb.disasm/sh3.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-2024 Free Software Foundation, Inc.
+# Copyright (C) 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -100,7 +100,7 @@ proc all_fp_misc_tests { } {
}
}
-clean_restart $binfile
+clean_restart $::testfile
all_fp_move_and_load_tests
all_fp_arithmetic_tests
diff --git a/gdb/testsuite/gdb.disasm/t01_mov.exp b/gdb/testsuite/gdb.disasm/t01_mov.exp
index afab42c..944a0a8 100644
--- a/gdb/testsuite/gdb.disasm/t01_mov.exp
+++ b/gdb/testsuite/gdb.disasm/t01_mov.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.disasm/t02_mova.exp b/gdb/testsuite/gdb.disasm/t02_mova.exp
index c147eec..9507df4 100644
--- a/gdb/testsuite/gdb.disasm/t02_mova.exp
+++ b/gdb/testsuite/gdb.disasm/t02_mova.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.disasm/t03_add.exp b/gdb/testsuite/gdb.disasm/t03_add.exp
index 6874ded5..222f004 100644
--- a/gdb/testsuite/gdb.disasm/t03_add.exp
+++ b/gdb/testsuite/gdb.disasm/t03_add.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.disasm/t04_sub.exp b/gdb/testsuite/gdb.disasm/t04_sub.exp
index 80cf613..c7280f0 100644
--- a/gdb/testsuite/gdb.disasm/t04_sub.exp
+++ b/gdb/testsuite/gdb.disasm/t04_sub.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.disasm/t05_cmp.exp b/gdb/testsuite/gdb.disasm/t05_cmp.exp
index 7c7edb7..6163337 100644
--- a/gdb/testsuite/gdb.disasm/t05_cmp.exp
+++ b/gdb/testsuite/gdb.disasm/t05_cmp.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.disasm/t06_ari2.exp b/gdb/testsuite/gdb.disasm/t06_ari2.exp
index 9394064..eb60047 100644
--- a/gdb/testsuite/gdb.disasm/t06_ari2.exp
+++ b/gdb/testsuite/gdb.disasm/t06_ari2.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.disasm/t07_ari3.exp b/gdb/testsuite/gdb.disasm/t07_ari3.exp
index dbec4e7..49df1e1 100644
--- a/gdb/testsuite/gdb.disasm/t07_ari3.exp
+++ b/gdb/testsuite/gdb.disasm/t07_ari3.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.disasm/t08_or.exp b/gdb/testsuite/gdb.disasm/t08_or.exp
index add3e39..94cef31 100644
--- a/gdb/testsuite/gdb.disasm/t08_or.exp
+++ b/gdb/testsuite/gdb.disasm/t08_or.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.disasm/t09_xor.exp b/gdb/testsuite/gdb.disasm/t09_xor.exp
index 8f8ec9b..4a8c34c 100644
--- a/gdb/testsuite/gdb.disasm/t09_xor.exp
+++ b/gdb/testsuite/gdb.disasm/t09_xor.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.disasm/t10_and.exp b/gdb/testsuite/gdb.disasm/t10_and.exp
index 6d24c9a..daa2777 100644
--- a/gdb/testsuite/gdb.disasm/t10_and.exp
+++ b/gdb/testsuite/gdb.disasm/t10_and.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.disasm/t11_logs.exp b/gdb/testsuite/gdb.disasm/t11_logs.exp
index ebc2b43..d2077de 100644
--- a/gdb/testsuite/gdb.disasm/t11_logs.exp
+++ b/gdb/testsuite/gdb.disasm/t11_logs.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.disasm/t12_bit.exp b/gdb/testsuite/gdb.disasm/t12_bit.exp
index 1c6de0f..7d8ea17 100644
--- a/gdb/testsuite/gdb.disasm/t12_bit.exp
+++ b/gdb/testsuite/gdb.disasm/t12_bit.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.disasm/t13_otr.exp b/gdb/testsuite/gdb.disasm/t13_otr.exp
index aa97188..29fd695 100644
--- a/gdb/testsuite/gdb.disasm/t13_otr.exp
+++ b/gdb/testsuite/gdb.disasm/t13_otr.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dlang/circular.c b/gdb/testsuite/gdb.dlang/circular.c
index 7a3aed5..d0ca685 100644
--- a/gdb/testsuite/gdb.dlang/circular.c
+++ b/gdb/testsuite/gdb.dlang/circular.c
@@ -1,4 +1,4 @@
-/* Copyright 2016-2024 Free Software Foundation, Inc.
+/* Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dlang/circular.exp b/gdb/testsuite/gdb.dlang/circular.exp
index e6d78d0..cc79062 100644
--- a/gdb/testsuite/gdb.dlang/circular.exp
+++ b/gdb/testsuite/gdb.dlang/circular.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,98 +27,98 @@ set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_D}
+ DW_AT_language @DW_LANG_D
} {
declare_labels circular1_label circular2_label circular3_label
declare_labels circular4_label circular5_label
circular1_label: module {
- {name circular1}
+ DW_AT_name circular1
} {
imported_module {
- {import :$circular2_label}
+ DW_AT_import :$circular2_label
}
imported_module {
- {import :$circular3_label}
+ DW_AT_import :$circular3_label
}
imported_module {
- {import :$circular4_label}
+ DW_AT_import :$circular4_label
}
imported_module {
- {import :$circular5_label}
+ DW_AT_import :$circular5_label
}
subprogram {
- {external 1 flag_present}
- {MACRO_AT_func {found}}
+ DW_AT_external 1 flag_present
+ MACRO_AT_func {found}
}
}
circular2_label: module {
- {name circular2}
+ DW_AT_name circular2
} {
imported_module {
- {import :$circular1_label}
+ DW_AT_import :$circular1_label
}
imported_module {
- {import :$circular3_label}
+ DW_AT_import :$circular3_label
}
imported_module {
- {import :$circular4_label}
+ DW_AT_import :$circular4_label
}
imported_module {
- {import :$circular5_label}
+ DW_AT_import :$circular5_label
}
}
circular3_label: module {
- {name circular3}
+ DW_AT_name circular3
} {
imported_module {
- {import :$circular1_label}
+ DW_AT_import :$circular1_label
}
imported_module {
- {import :$circular2_label}
+ DW_AT_import :$circular2_label
}
imported_module {
- {import :$circular4_label}
+ DW_AT_import :$circular4_label
}
imported_module {
- {import :$circular5_label}
+ DW_AT_import :$circular5_label
}
}
circular4_label: module {
- {name circular4}
+ DW_AT_name circular4
} {
imported_module {
- {import :$circular1_label}
+ DW_AT_import :$circular1_label
}
imported_module {
- {import :$circular2_label}
+ DW_AT_import :$circular2_label
}
imported_module {
- {import :$circular3_label}
+ DW_AT_import :$circular3_label
}
imported_module {
- {import :$circular5_label}
+ DW_AT_import :$circular5_label
}
}
circular5_label: module {
- {name circular5}
+ DW_AT_name circular5
} {
imported_module {
- {import :$circular1_label}
+ DW_AT_import :$circular1_label
}
imported_module {
- {import :$circular2_label}
+ DW_AT_import :$circular2_label
}
imported_module {
- {import :$circular3_label}
+ DW_AT_import :$circular3_label
}
imported_module {
- {import :$circular4_label}
+ DW_AT_import :$circular4_label
}
}
}
diff --git a/gdb/testsuite/gdb.dlang/debug-expr.exp b/gdb/testsuite/gdb.dlang/debug-expr.exp
index 88f6ddd..8465e47 100644
--- a/gdb/testsuite/gdb.dlang/debug-expr.exp
+++ b/gdb/testsuite/gdb.dlang/debug-expr.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dlang/demangle.exp b/gdb/testsuite/gdb.dlang/demangle.exp
index f1a1c7f..4181513 100644
--- a/gdb/testsuite/gdb.dlang/demangle.exp
+++ b/gdb/testsuite/gdb.dlang/demangle.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -197,7 +197,7 @@ proc test_d_demangling {} {
clean_restart
-if [set_lang_d] {
+if {[set_lang_d]} {
gdb_test_no_output "set width 0"
test_d_demangling
diff --git a/gdb/testsuite/gdb.dlang/dlang-start-2.exp b/gdb/testsuite/gdb.dlang/dlang-start-2.exp
index 284f841..b5c0542 100644
--- a/gdb/testsuite/gdb.dlang/dlang-start-2.exp
+++ b/gdb/testsuite/gdb.dlang/dlang-start-2.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,24 +40,24 @@ Dwarf::assemble $asm_file {
cu { label cu_start } {
compile_unit {
- {language @DW_LANG_D}
+ DW_AT_language @DW_LANG_D
} {
module {
- {name dmain}
+ DW_AT_name dmain
}
subprogram {
- {name "D main" }
- {MIPS_linkage_name "_Dmain"}
- {low_pc $dmain_start DW_FORM_addr}
- {high_pc "$dmain_start + $dmain_length" DW_FORM_addr}
- {external 1 flag_present}
+ DW_AT_name "D main"
+ DW_AT_MIPS_linkage_name "_Dmain"
+ DW_AT_low_pc $dmain_start DW_FORM_addr
+ DW_AT_high_pc "$dmain_start + $dmain_length" DW_FORM_addr
+ DW_AT_external 1 flag_present
}
subprogram {
- {name "dmain._d_cmain!().main" }
- {MIPS_linkage_name "main"}
- {low_pc $main_start DW_FORM_addr}
- {high_pc "$main_start + $main_length" DW_FORM_addr}
- {external 1 flag_present}
+ DW_AT_name "dmain._d_cmain!().main"
+ DW_AT_MIPS_linkage_name "main"
+ DW_AT_low_pc $main_start DW_FORM_addr
+ DW_AT_high_pc "$main_start + $main_length" DW_FORM_addr
+ DW_AT_external 1 flag_present
}
}
}
diff --git a/gdb/testsuite/gdb.dlang/dlang-start.exp b/gdb/testsuite/gdb.dlang/dlang-start.exp
index 03afeb5..1e4176b 100644
--- a/gdb/testsuite/gdb.dlang/dlang-start.exp
+++ b/gdb/testsuite/gdb.dlang/dlang-start.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dlang/dmain.c b/gdb/testsuite/gdb.dlang/dmain.c
index f2bac4f..c784e50 100644
--- a/gdb/testsuite/gdb.dlang/dmain.c
+++ b/gdb/testsuite/gdb.dlang/dmain.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dlang/expression.exp b/gdb/testsuite/gdb.dlang/expression.exp
index c3b8bd2..6e611ed 100644
--- a/gdb/testsuite/gdb.dlang/expression.exp
+++ b/gdb/testsuite/gdb.dlang/expression.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -129,7 +129,7 @@ proc test_d_expressions {} {
clean_restart
-if [set_lang_d] {
+if {[set_lang_d]} {
test_d_integer_literals
test_d_float_literals
test_d_expressions
diff --git a/gdb/testsuite/gdb.dlang/primitive-types.exp b/gdb/testsuite/gdb.dlang/primitive-types.exp
index 8c7f910..9e6e8fa 100644
--- a/gdb/testsuite/gdb.dlang/primitive-types.exp
+++ b/gdb/testsuite/gdb.dlang/primitive-types.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -51,7 +51,7 @@ proc test_builtin_d_types_accepted {} {
clean_restart
-if [set_lang_d] {
+if {[set_lang_d]} {
test_builtin_d_types_accepted
} else {
warning "D type tests suppressed."
diff --git a/gdb/testsuite/gdb.dlang/properties.exp b/gdb/testsuite/gdb.dlang/properties.exp
index f210fa7..d0266f8 100644
--- a/gdb/testsuite/gdb.dlang/properties.exp
+++ b/gdb/testsuite/gdb.dlang/properties.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -82,7 +82,7 @@ proc test_d_typeof {} {
clean_restart
-if [set_lang_d] {
+if {[set_lang_d]} {
test_d_sizeof
test_d_typeof
} else {
diff --git a/gdb/testsuite/gdb.dlang/simple.d b/gdb/testsuite/gdb.dlang/simple.d
index 9994227..d99a034 100644
--- a/gdb/testsuite/gdb.dlang/simple.d
+++ b/gdb/testsuite/gdb.dlang/simple.d
@@ -1,4 +1,4 @@
-// Copyright (C) 2023-2024 Free Software Foundation, Inc.
+// Copyright (C) 2023-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dlang/watch-loc.c b/gdb/testsuite/gdb.dlang/watch-loc.c
index 078840e..b7a277f 100644
--- a/gdb/testsuite/gdb.dlang/watch-loc.c
+++ b/gdb/testsuite/gdb.dlang/watch-loc.c
@@ -1,4 +1,4 @@
-/* Copyright 2017-2024 Free Software Foundation, Inc.
+/* Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dlang/watch-loc.exp b/gdb/testsuite/gdb.dlang/watch-loc.exp
index a03f524..d16b779 100644
--- a/gdb/testsuite/gdb.dlang/watch-loc.exp
+++ b/gdb/testsuite/gdb.dlang/watch-loc.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2024 Free Software Foundation, Inc.
+# Copyright (C) 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,30 +33,30 @@ Dwarf::assemble $asm_file {
cu { label cu_start } {
compile_unit {
- {language @DW_LANG_D}
+ DW_AT_language @DW_LANG_D
} {
declare_labels watch_module_label watch_struct_label
watch_module_label: module {
- {name watch}
+ DW_AT_name watch
} {
watch_struct_label: structure_type {
- {name tstruct}
- {byte_size 1 data1}
+ DW_AT_name tstruct
+ DW_AT_byte_size 1 data1
}
tag_variable {
- {name my_data}
- {type :$watch_struct_label}
- {location {
- addr [gdb_target_symbol my_data]
- } SPECIAL_expr}
- {external 1 flag}
+ DW_AT_name my_data
+ DW_AT_type :$watch_struct_label
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol my_data]
+ } SPECIAL_expr
+ DW_AT_external 1 flag
}
subprogram {
- {MACRO_AT_func { "_Dmain" }}
- {external 1 flag_present}
+ MACRO_AT_func { "_Dmain" }
+ DW_AT_external 1 flag_present
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/DW_OP_piece_with_DW_OP_GNU_uninit.exp b/gdb/testsuite/gdb.dwarf2/DW_OP_piece_with_DW_OP_GNU_uninit.exp
index 4a0eb8a..d812b0b 100644
--- a/gdb/testsuite/gdb.dwarf2/DW_OP_piece_with_DW_OP_GNU_uninit.exp
+++ b/gdb/testsuite/gdb.dwarf2/DW_OP_piece_with_DW_OP_GNU_uninit.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,37 +35,37 @@ Dwarf::assemble $asm_file {
declare_labels i64_type i32_type
i64_type: base_type {
- {name "int64_t"}
- {encoding @DW_ATE_signed}
- {byte_size 8 DW_FORM_sdata}
+ DW_AT_name "int64_t"
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 8 DW_FORM_sdata
}
i32_type: base_type {
- {name "int32_t"}
- {encoding @DW_ATE_signed}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name "int32_t"
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 DW_FORM_sdata
}
DW_TAG_variable {
- {name i64_var}
- {type :$i64_type}
- {location {
+ DW_AT_name i64_var
+ DW_AT_type :$i64_type
+ DW_AT_location {
DW_OP_constu $::c64
DW_OP_stack_value
DW_OP_GNU_uninit
DW_OP_piece 8
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_variable {
- {name i32_var}
- {type :$i32_type}
- {location {
+ DW_AT_name i32_var
+ DW_AT_type :$i32_type
+ DW_AT_location {
DW_OP_constu $::c32
DW_OP_stack_value
DW_OP_GNU_uninit
DW_OP_piece 4
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/_start.c b/gdb/testsuite/gdb.dwarf2/_start.c
index 5ec5b9e..9800ec0 100644
--- a/gdb/testsuite/gdb.dwarf2/_start.c
+++ b/gdb/testsuite/gdb.dwarf2/_start.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/ada-array-bound.c b/gdb/testsuite/gdb.dwarf2/ada-array-bound.c
new file mode 100644
index 0000000..5a7d397
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/ada-array-bound.c
@@ -0,0 +1,29 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* The data used for the structure. */
+
+unsigned char our_data[] = { 3, 7, 11, 13 };
+
+/* Dummy main function. */
+
+int
+main()
+{
+ asm ("main_label: .globl main_label");
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.dwarf2/ada-array-bound.exp b/gdb/testsuite/gdb.dwarf2/ada-array-bound.exp
new file mode 100644
index 0000000..b85777b
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/ada-array-bound.exp
@@ -0,0 +1,90 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test handling of an array type whose bound comes from the field of a
+# structure.
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+require dwarf2_support
+
+standard_testfile .c -debug.S
+
+# Set up the DWARF for the test.
+
+set asm_file [standard_output_file $srcfile2]
+Dwarf::assemble $asm_file {
+ global srcdir subdir srcfile
+
+ cu {} {
+ DW_TAG_compile_unit {
+ DW_AT_language @DW_LANG_Ada95
+ DW_AT_name $srcfile
+ } {
+ declare_labels byte array disc struct
+
+ byte: DW_TAG_base_type {
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name byte
+ }
+
+ array: DW_TAG_array_type {
+ DW_AT_name array_type
+ DW_AT_type :$byte
+ } {
+ DW_TAG_subrange_type {
+ DW_AT_type :$byte
+ DW_AT_upper_bound :$disc
+ }
+ }
+
+ struct: DW_TAG_structure_type {
+ DW_AT_name discriminated
+ DW_AT_byte_size 4 DW_FORM_sdata
+ } {
+ disc: DW_TAG_member {
+ DW_AT_name disc
+ DW_AT_type :$byte
+ DW_AT_data_member_location 0 DW_FORM_sdata
+ }
+ DW_TAG_member {
+ DW_AT_name nums
+ DW_AT_type :$array
+ DW_AT_data_member_location 1 DW_FORM_sdata
+ }
+ }
+
+ DW_TAG_variable {
+ DW_AT_name "value"
+ DW_AT_type :$struct
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "our_data"]
+ } SPECIAL_expr
+ }
+ }
+ }
+}
+
+if { [prepare_for_testing "failed to prepare" ${testfile} \
+ [list $srcfile $asm_file] {nodebug}] } {
+ return -1
+}
+
+gdb_test_no_output "set language ada"
+gdb_test "print value" \
+ [string_to_regexp " = (disc => 3, nums => (7, 11, 13))"]
diff --git a/gdb/testsuite/gdb.dwarf2/ada-artificial-field.c b/gdb/testsuite/gdb.dwarf2/ada-artificial-field.c
new file mode 100644
index 0000000..231044d
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/ada-artificial-field.c
@@ -0,0 +1,22 @@
+/* Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+unsigned char bytes[] = { 1, 2, 3 };
+
+int
+main (void)
+{
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.dwarf2/ada-artificial-field.exp b/gdb/testsuite/gdb.dwarf2/ada-artificial-field.exp
new file mode 100644
index 0000000..88792b8
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/ada-artificial-field.exp
@@ -0,0 +1,95 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test that Ada does not display artificial fields.
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+require dwarf2_support
+
+standard_testfile .c -dw.S
+
+# Make some DWARF for the test.
+set asm_file [standard_output_file $srcfile2]
+Dwarf::assemble $asm_file {
+ cu {} {
+ DW_TAG_compile_unit {
+ DW_AT_language @DW_LANG_Ada95
+ DW_AT_name fd.adb
+ DW_AT_comp_dir /tmp
+ } {
+ declare_labels byte array disc struct
+
+ byte: DW_TAG_base_type {
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name byte
+ }
+
+ struct: DW_TAG_structure_type {
+ DW_AT_name anonfield
+ DW_AT_byte_size 3 DW_FORM_sdata
+ } {
+ DW_TAG_member {
+ DW_AT_name one
+ DW_AT_type :$byte
+ DW_AT_data_member_location 0 DW_FORM_sdata
+ }
+ DW_TAG_member {
+ DW_AT_name discr
+ DW_AT_type :$byte
+ DW_AT_data_member_location 1 DW_FORM_sdata
+ DW_AT_artificial 1 DW_FORM_flag
+ }
+ DW_TAG_member {
+ DW_AT_type :$byte
+ DW_AT_data_member_location 1 DW_FORM_sdata
+ }
+ DW_TAG_member {
+ DW_AT_name two
+ DW_AT_type :$byte
+ DW_AT_data_member_location 2 DW_FORM_sdata
+ }
+ }
+
+ DW_TAG_variable {
+ DW_AT_name "value"
+ DW_AT_type :$struct
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "bytes"]
+ } SPECIAL_expr
+ }
+ }
+ }
+}
+
+if {[prepare_for_testing ${testfile}.exp ${testfile} \
+ [list $srcfile $asm_file] {nodebug}]} {
+ return
+}
+
+gdb_test_no_output "set language ada"
+
+gdb_test "print value" \
+ [string_to_regexp " = (one => 1, two => 3)"]
+
+gdb_test "ptype value" \
+ [multi_line \
+ "type = record" \
+ " one: byte;" \
+ " two: byte;" \
+ "end record"]
diff --git a/gdb/testsuite/gdb.dwarf2/ada-cold-name.exp b/gdb/testsuite/gdb.dwarf2/ada-cold-name.exp
index 08d8758..3520319 100644
--- a/gdb/testsuite/gdb.dwarf2/ada-cold-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/ada-cold-name.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,28 +30,28 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_Ada95}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_Ada95
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
} {
declare_labels b_l
b_l: DW_TAG_base_type {
- {DW_AT_byte_size 1 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name bool}
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name bool
}
DW_TAG_subprogram {
- {name pck__xtra__function.cold}
- {MACRO_AT_range {first}}
- {type :$b_l}
+ DW_AT_name pck__xtra__function.cold
+ MACRO_AT_range {first}
+ DW_AT_type :$b_l
}
DW_TAG_subprogram {
- {name pck__xtra__function}
- {MACRO_AT_range {second}}
- {type :$b_l}
+ DW_AT_name pck__xtra__function
+ MACRO_AT_range {second}
+ DW_AT_type :$b_l
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/ada-linkage-name.c b/gdb/testsuite/gdb.dwarf2/ada-linkage-name.c
index 67aa968..cef9ff0 100644
--- a/gdb/testsuite/gdb.dwarf2/ada-linkage-name.c
+++ b/gdb/testsuite/gdb.dwarf2/ada-linkage-name.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/ada-linkage-name.exp b/gdb/testsuite/gdb.dwarf2/ada-linkage-name.exp
index 516dc48..915f47e 100644
--- a/gdb/testsuite/gdb.dwarf2/ada-linkage-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/ada-linkage-name.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,31 +31,31 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_Ada95}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_Ada95
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
} {
declare_labels b_l
b_l: DW_TAG_base_type {
- {DW_AT_byte_size 1 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name bool}
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name bool
}
# Here the name comes first and the linkage name second.
DW_TAG_subprogram {
- {name system__namefirst}
- {linkage_name __gnat_namefirst}
- {MACRO_AT_range {first}}
- {type :$b_l}
+ DW_AT_name system__namefirst
+ DW_AT_linkage_name __gnat_namefirst
+ MACRO_AT_range {first}
+ DW_AT_type :$b_l
}
# Here the linkage name comes first and the name second.
DW_TAG_subprogram {
- {linkage_name __gnat_namesecond}
- {name system__namesecond}
- {MACRO_AT_range {second}}
- {type :$b_l}
+ DW_AT_linkage_name __gnat_namesecond
+ DW_AT_name system__namesecond
+ MACRO_AT_range {second}
+ DW_AT_type :$b_l
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/ada-thick-pointer.exp b/gdb/testsuite/gdb.dwarf2/ada-thick-pointer.exp
index d2b74ab..0efb8cb 100644
--- a/gdb/testsuite/gdb.dwarf2/ada-thick-pointer.exp
+++ b/gdb/testsuite/gdb.dwarf2/ada-thick-pointer.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,53 +31,53 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_Ada95}
- {DW_AT_name $srcfile}
+ DW_AT_language @DW_LANG_Ada95
+ DW_AT_name $srcfile
} {
declare_labels integer array array_pointer bounds_pointer
integer: DW_TAG_base_type {
- {DW_AT_byte_size 8 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size 8 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
array: DW_TAG_array_type {
- {DW_AT_name array_type}
- {DW_AT_type :$integer}
+ DW_AT_name array_type
+ DW_AT_type :$integer
} {
DW_TAG_subrange_type {
- {DW_AT_type :$integer}
- {DW_AT_lower_bound 1 DW_FORM_data1}
- {DW_AT_upper_bound 7 DW_FORM_data1}
+ DW_AT_type :$integer
+ DW_AT_lower_bound 1 DW_FORM_data1
+ DW_AT_upper_bound 7 DW_FORM_data1
}
}
array_pointer: DW_TAG_pointer_type {
- {DW_AT_type :$array}
- {DW_AT_byte_size 8 DW_FORM_sdata}
+ DW_AT_type :$array
+ DW_AT_byte_size 8 DW_FORM_sdata
}
# This isn't exactly what GNAT emits, but it doesn't
# matter.
bounds_pointer: DW_TAG_pointer_type {
- {DW_AT_type :$integer}
- {DW_AT_byte_size 8 DW_FORM_sdata}
+ DW_AT_type :$integer
+ DW_AT_byte_size 8 DW_FORM_sdata
}
DW_TAG_structure_type {
- {DW_AT_name thick_pointer_type}
- {DW_AT_byte_size 8 DW_FORM_sdata}
+ DW_AT_name thick_pointer_type
+ DW_AT_byte_size 8 DW_FORM_sdata
} {
DW_TAG_member {
- {DW_AT_name P_ARRAY}
- {DW_AT_type :$array_pointer}
- {DW_AT_data_member_location 0 DW_FORM_sdata}
+ DW_AT_name P_ARRAY
+ DW_AT_type :$array_pointer
+ DW_AT_data_member_location 0 DW_FORM_sdata
}
DW_TAG_member {
- {DW_AT_name P_BOUNDS}
- {DW_AT_type :$bounds_pointer}
- {DW_AT_data_member_location 8 DW_FORM_sdata}
+ DW_AT_name P_BOUNDS
+ DW_AT_type :$bounds_pointer
+ DW_AT_data_member_location 8 DW_FORM_sdata
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/ada-valprint-error.c b/gdb/testsuite/gdb.dwarf2/ada-valprint-error.c
index 4b21120..19dc4b6 100644
--- a/gdb/testsuite/gdb.dwarf2/ada-valprint-error.c
+++ b/gdb/testsuite/gdb.dwarf2/ada-valprint-error.c
@@ -1,4 +1,4 @@
-/* Copyright 2017-2024 Free Software Foundation, Inc.
+/* Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp b/gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp
index 6784b7f..a4b6a95 100644
--- a/gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp
+++ b/gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,10 +35,10 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
- DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_Ada95}
- {DW_AT_name fd.adb}
- {DW_AT_comp_dir /tmp}
+ DW_TAG_compile_unit {
+ DW_AT_language @DW_LANG_Ada95
+ DW_AT_name fd.adb
+ DW_AT_comp_dir /tmp
} {
declare_labels array_elt_label integer_label array_label \
typedef_label ref_type_label
@@ -48,8 +48,8 @@ Dwarf::assemble $asm_file {
# A structure with no size attribute, to mimick structures
# in Ada that have a dynamic size...
array_elt_label: structure_type {
- {name fd__Tints_doubledC}
- {artificial 1 DW_FORM_flag_present}
+ DW_AT_name fd__Tints_doubledC
+ DW_AT_artificial 1 DW_FORM_flag_present
}
# ... and a corresponding XVZ variable, supposed to be there
@@ -58,44 +58,44 @@ Dwarf::assemble $asm_file {
# it has been optimized out (which the compiler can do,
# even if it at the expense of debuggability).
DW_TAG_variable {
- {name fd__Tints_doubledC___XVZ}
- {DW_AT_type :$integer_label}
- {artificial 1 DW_FORM_flag_present}
+ DW_AT_name fd__Tints_doubledC___XVZ
+ DW_AT_type :$integer_label
+ DW_AT_artificial 1 DW_FORM_flag_present
}
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size $int_size DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size $int_size DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
array_label: DW_TAG_array_type {
- {DW_AT_name fd__ints_doubled}
- {DW_AT_type :$array_elt_label}
+ DW_AT_name fd__ints_doubled
+ DW_AT_type :$array_elt_label
} {
DW_TAG_subrange_type {
- {DW_AT_type :$integer_label}
- {DW_AT_upper_bound 2 DW_FORM_data1}
+ DW_AT_type :$integer_label
+ DW_AT_upper_bound 2 DW_FORM_data1
}
}
typedef_label: DW_TAG_typedef {
- {DW_AT_name fd__ints_doubled}
- {DW_AT_type :$array_label}
+ DW_AT_name fd__ints_doubled
+ DW_AT_type :$array_label
}
ref_type_label: DW_TAG_reference_type {
- {DW_AT_byte_size $ptr_size DW_FORM_sdata}
- {DW_AT_type :$typedef_label}
+ DW_AT_byte_size $ptr_size DW_FORM_sdata
+ DW_AT_type :$typedef_label
}
DW_TAG_variable {
- {name fd__global}
- {DW_AT_type :$ref_type_label}
- {DW_AT_location {
- DW_OP_addr [gdb_target_symbol fd__global]
- } SPECIAL_expr}
- {external 1 flag}
+ DW_AT_name fd__global
+ DW_AT_type :$ref_type_label
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol fd__global]
+ } SPECIAL_expr
+ DW_AT_external 1 flag
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/anon-ns-fn.cc b/gdb/testsuite/gdb.dwarf2/anon-ns-fn.cc
index d908667..7a00880 100644
--- a/gdb/testsuite/gdb.dwarf2/anon-ns-fn.cc
+++ b/gdb/testsuite/gdb.dwarf2/anon-ns-fn.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/anon-ns-fn.exp b/gdb/testsuite/gdb.dwarf2/anon-ns-fn.exp
index 5a3b40b..4017744 100644
--- a/gdb/testsuite/gdb.dwarf2/anon-ns-fn.exp
+++ b/gdb/testsuite/gdb.dwarf2/anon-ns-fn.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@ require allow_cplus_tests
standard_testfile .cc
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/arr-opt-out.c b/gdb/testsuite/gdb.dwarf2/arr-opt-out.c
index 5397911..ca413ec 100644
--- a/gdb/testsuite/gdb.dwarf2/arr-opt-out.c
+++ b/gdb/testsuite/gdb.dwarf2/arr-opt-out.c
@@ -1,4 +1,4 @@
-/* Copyright 2023 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/arr-opt-out.exp b/gdb/testsuite/gdb.dwarf2/arr-opt-out.exp
index 387ac0c..38840aa 100644
--- a/gdb/testsuite/gdb.dwarf2/arr-opt-out.exp
+++ b/gdb/testsuite/gdb.dwarf2/arr-opt-out.exp
@@ -1,4 +1,4 @@
-# Copyright 2023 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,51 +29,51 @@ set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_Ada95}
- {DW_AT_name foo.adb}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_Ada95
+ DW_AT_name foo.adb
+ DW_AT_comp_dir /tmp
} {
declare_labels integer_label array_label \
low_bound_label high_bound_label
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
# Note that the bounds don't have a location -- they are
# optimized out. This mimics what it is seen sometimes in
# the wild with optimized Ada code.
low_bound_label: DW_TAG_variable {
- {DW_AT_name pck__table___L}
- {DW_AT_type :$integer_label}
- {DW_AT_declaration 1 flag}
+ DW_AT_name pck__table___L
+ DW_AT_type :$integer_label
+ DW_AT_declaration 1 flag
}
high_bound_label: DW_TAG_variable {
- {DW_AT_name pck__table___U}
- {DW_AT_type :$integer_label}
- {DW_AT_declaration 1 flag}
+ DW_AT_name pck__table___U
+ DW_AT_type :$integer_label
+ DW_AT_declaration 1 flag
}
array_label: DW_TAG_array_type {
- {DW_AT_name pck__table}
- {DW_AT_type :$integer_label}
+ DW_AT_name pck__table
+ DW_AT_type :$integer_label
} {
DW_TAG_subrange_type {
- {DW_AT_type :$integer_label}
- {DW_AT_lower_bound :$low_bound_label}
- {DW_AT_upper_bound :$high_bound_label}
+ DW_AT_type :$integer_label
+ DW_AT_lower_bound :$low_bound_label
+ DW_AT_upper_bound :$high_bound_label
}
}
DW_TAG_variable {
- {DW_AT_name the_table}
- {DW_AT_type :$array_label}
- {DW_AT_location {
+ DW_AT_name the_table
+ DW_AT_type :$array_label
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol global_array]
- } SPECIAL_expr}
- {DW_AT_external 1 flag}
+ } SPECIAL_expr
+ DW_AT_external 1 flag
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/arr-stride.exp b/gdb/testsuite/gdb.dwarf2/arr-stride.exp
index c83cd53..bad1ffe 100644
--- a/gdb/testsuite/gdb.dwarf2/arr-stride.exp
+++ b/gdb/testsuite/gdb.dwarf2/arr-stride.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,86 +24,86 @@ set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_Ada95}
- {DW_AT_name foo.adb}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_Ada95
+ DW_AT_name foo.adb
+ DW_AT_comp_dir /tmp
} {
declare_labels integer_label array_elt_label array_label \
big_array_label struct_label
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
array_elt_label: DW_TAG_subrange_type {
- {DW_AT_lower_bound 0xe0 DW_FORM_data1}
- {DW_AT_upper_bound 0x1f DW_FORM_data1}
- {DW_AT_name pck__item}
- {DW_AT_type :$integer_label}
+ DW_AT_lower_bound 0xe0 DW_FORM_data1
+ DW_AT_upper_bound 0x1f DW_FORM_data1
+ DW_AT_name pck__item
+ DW_AT_type :$integer_label
}
DW_TAG_typedef {
- {DW_AT_name pck__table}
- {DW_AT_type :$array_label}
+ DW_AT_name pck__table
+ DW_AT_type :$array_label
}
array_label: DW_TAG_array_type {
- {DW_AT_name pck__table}
- {DW_AT_bit_stride 6 DW_FORM_data1}
- {DW_AT_type :$array_elt_label}
+ DW_AT_name pck__table
+ DW_AT_bit_stride 6 DW_FORM_data1
+ DW_AT_type :$array_elt_label
} {
DW_TAG_subrange_type {
- {DW_AT_type :$integer_label}
- {DW_AT_lower_bound 0 DW_FORM_data1}
- {DW_AT_upper_bound 4 DW_FORM_data1}
+ DW_AT_type :$integer_label
+ DW_AT_lower_bound 0 DW_FORM_data1
+ DW_AT_upper_bound 4 DW_FORM_data1
}
}
DW_TAG_typedef {
- {DW_AT_name pck__big_table}
- {DW_AT_type :$big_array_label}
+ DW_AT_name pck__big_table
+ DW_AT_type :$big_array_label
}
big_array_label: DW_TAG_array_type {
- {DW_AT_name pck__big_table}
- {DW_AT_byte_stride 1 DW_FORM_data1}
- {DW_AT_type :$array_elt_label}
+ DW_AT_name pck__big_table
+ DW_AT_byte_stride 1 DW_FORM_data1
+ DW_AT_type :$array_elt_label
} {
DW_TAG_subrange_type {
- {DW_AT_type :$integer_label}
- {DW_AT_lower_bound 0 DW_FORM_data1}
- {DW_AT_upper_bound 4 DW_FORM_data1}
+ DW_AT_type :$integer_label
+ DW_AT_lower_bound 0 DW_FORM_data1
+ DW_AT_upper_bound 4 DW_FORM_data1
}
}
struct_label: DW_TAG_structure_type {
- {name struct_type}
- {byte_size 16 DW_FORM_sdata}
+ DW_AT_name struct_type
+ DW_AT_byte_size 16 DW_FORM_sdata
} {
member {
- {name intfield}
- {type :$integer_label}
- {data_member_location 0 DW_FORM_sdata}
+ DW_AT_name intfield
+ DW_AT_type :$integer_label
+ DW_AT_data_member_location 0 DW_FORM_sdata
}
member {
- {name arrayfield}
- {type :$array_label}
- {data_member_location 4 DW_FORM_sdata}
+ DW_AT_name arrayfield
+ DW_AT_type :$array_label
+ DW_AT_data_member_location 4 DW_FORM_sdata
}
}
DW_TAG_variable {
- {name the_struct}
- {external 1 DW_FORM_flag}
- {location {
+ DW_AT_name the_struct
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
DW_OP_const1u 1
DW_OP_stack_value
DW_OP_piece 4
DW_OP_piece 12
- } SPECIAL_expr}
- {type :$struct_label}
+ } SPECIAL_expr
+ DW_AT_type :$struct_label
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/arr-subrange.exp b/gdb/testsuite/gdb.dwarf2/arr-subrange.exp
index ceb8edf..24d4600 100644
--- a/gdb/testsuite/gdb.dwarf2/arr-subrange.exp
+++ b/gdb/testsuite/gdb.dwarf2/arr-subrange.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,52 +23,52 @@ standard_testfile main.c -dw.S
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
- DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_Ada95}
- {DW_AT_name foo.adb}
- {DW_AT_comp_dir /tmp}
- {MACRO_AT_range {main}}
- } {
+ DW_TAG_compile_unit {
+ DW_AT_language @DW_LANG_Ada95
+ DW_AT_name foo.adb
+ DW_AT_comp_dir /tmp
+ MACRO_AT_range {main}
+ } {
declare_labels boolean_label typedef_label array_label enum_label
- boolean_label: DW_TAG_base_type {
- {DW_AT_byte_size 1 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_boolean}
- {DW_AT_name boolean}
- }
+ boolean_label: DW_TAG_base_type {
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_boolean
+ DW_AT_name boolean
+ }
- typedef_label: DW_TAG_typedef {
- {DW_AT_name pck__table}
- {DW_AT_type :$array_label}
- }
+ typedef_label: DW_TAG_typedef {
+ DW_AT_name pck__table
+ DW_AT_type :$array_label
+ }
array_label: DW_TAG_array_type {
- {DW_AT_name pck__table}
- {DW_AT_type :$boolean_label}
+ DW_AT_name pck__table
+ DW_AT_type :$boolean_label
} {
DW_TAG_subrange_type {
- {DW_AT_type :$enum_label}
- {DW_AT_lower_bound 0 DW_FORM_data1}
- {DW_AT_upper_bound 128 DW_FORM_data1}
+ DW_AT_type :$enum_label
+ DW_AT_lower_bound 0 DW_FORM_data1
+ DW_AT_upper_bound 128 DW_FORM_data1
}
}
enum_label: DW_TAG_enumeration_type {
- {DW_AT_name pck__enum_t}
- {DW_AT_byte_size 1 DW_FORM_sdata}
- } {
- DW_TAG_enumerator {
- {DW_AT_name pck__enum_000}
- {DW_AT_const_value 0 DW_FORM_sdata}
- }
- DW_TAG_enumerator {
- {DW_AT_name pck__enum_001}
- {DW_AT_const_value 1 DW_FORM_sdata}
- }
- DW_TAG_enumerator {
- {DW_AT_name pck__enum_128}
- {DW_AT_const_value 128 DW_FORM_sdata}
- }
+ DW_AT_name pck__enum_t
+ DW_AT_byte_size 1 DW_FORM_sdata
+ } {
+ DW_TAG_enumerator {
+ DW_AT_name pck__enum_000
+ DW_AT_const_value 0 DW_FORM_sdata
+ }
+ DW_TAG_enumerator {
+ DW_AT_name pck__enum_001
+ DW_AT_const_value 1 DW_FORM_sdata
+ }
+ DW_TAG_enumerator {
+ DW_AT_name pck__enum_128
+ DW_AT_const_value 128 DW_FORM_sdata
+ }
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/assign-variable-value-to-register.exp b/gdb/testsuite/gdb.dwarf2/assign-variable-value-to-register.exp
index 101ba94..9cbbfe9 100644
--- a/gdb/testsuite/gdb.dwarf2/assign-variable-value-to-register.exp
+++ b/gdb/testsuite/gdb.dwarf2/assign-variable-value-to-register.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,29 +36,29 @@ Dwarf::assemble $dwarf_file {
declare_labels int_label float_label
int_label: DW_TAG_base_type {
- { DW_AT_name int }
- { DW_AT_byte_size 4 DW_FORM_udata }
- { DW_AT_encoding @DW_ATE_signed }
+ DW_AT_name int
+ DW_AT_byte_size 4 DW_FORM_udata
+ DW_AT_encoding @DW_ATE_signed
}
float_label: DW_TAG_base_type {
- { DW_AT_name float }
- { DW_AT_byte_size 4 DW_FORM_udata }
- { DW_AT_encoding @DW_ATE_float }
+ DW_AT_name float
+ DW_AT_byte_size 4 DW_FORM_udata
+ DW_AT_encoding @DW_ATE_float
}
DW_TAG_subprogram {
- { DW_AT_name main }
- { DW_AT_low_pc $main_start DW_FORM_addr }
- { DW_AT_high_pc $main_end DW_FORM_addr }
- { DW_AT_type :$int_label }
+ DW_AT_name main
+ DW_AT_low_pc $main_start DW_FORM_addr
+ DW_AT_high_pc $main_end DW_FORM_addr
+ DW_AT_type :$int_label
} {
DW_TAG_variable {
- { DW_AT_name foo }
- { DW_AT_type :$float_label }
- { DW_AT_location {
+ DW_AT_name foo
+ DW_AT_type :$float_label
+ DW_AT_location {
DW_OP_regx $::st0_dwarf_regnum
- } SPECIAL_expr }
+ } SPECIAL_expr
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/atomic-type.c b/gdb/testsuite/gdb.dwarf2/atomic-type.c
index 6f74f59..0edf605 100644
--- a/gdb/testsuite/gdb.dwarf2/atomic-type.c
+++ b/gdb/testsuite/gdb.dwarf2/atomic-type.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/atomic-type.exp b/gdb/testsuite/gdb.dwarf2/atomic-type.exp
index 8039fc9..022b63c 100644
--- a/gdb/testsuite/gdb.dwarf2/atomic-type.exp
+++ b/gdb/testsuite/gdb.dwarf2/atomic-type.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,54 +27,54 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C11}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
- } {
+ DW_AT_language @DW_LANG_C11
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
+ } {
declare_labels i_l c_l c_c_l ac_c_l pac_c_l vpac_c_l avpac_c_l
- i_l: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
- }
-
- c_l: DW_TAG_base_type {
- {DW_AT_byte_size 2 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_unsigned}
- {DW_AT_name char}
- }
-
- c_c_l: DW_TAG_const_type {
- {DW_AT_type :$c_l}
- }
-
- ac_c_l: DW_TAG_atomic_type {
- {DW_AT_type :$c_c_l}
- }
-
- pac_c_l: DW_TAG_pointer_type {
- {DW_AT_byte_size 8 DW_FORM_sdata}
- {DW_AT_type :$ac_c_l}
- }
-
- vpac_c_l: DW_TAG_volatile_type {
- {DW_AT_type :$pac_c_l}
- }
-
- avpac_c_l: DW_TAG_atomic_type {
- {DW_AT_type :$vpac_c_l}
- }
-
- DW_TAG_subprogram {
- {MACRO_AT_func {f}}
- {type :$i_l}
- } {
- DW_TAG_formal_parameter {
- {type :$avpac_c_l}
- {name x}
- }
- }
+ i_l: DW_TAG_base_type {
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
+ }
+
+ c_l: DW_TAG_base_type {
+ DW_AT_byte_size 2 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name char
+ }
+
+ c_c_l: DW_TAG_const_type {
+ DW_AT_type :$c_l
+ }
+
+ ac_c_l: DW_TAG_atomic_type {
+ DW_AT_type :$c_c_l
+ }
+
+ pac_c_l: DW_TAG_pointer_type {
+ DW_AT_byte_size 8 DW_FORM_sdata
+ DW_AT_type :$ac_c_l
+ }
+
+ vpac_c_l: DW_TAG_volatile_type {
+ DW_AT_type :$pac_c_l
+ }
+
+ avpac_c_l: DW_TAG_atomic_type {
+ DW_AT_type :$vpac_c_l
+ }
+
+ DW_TAG_subprogram {
+ MACRO_AT_func {f}
+ DW_AT_type :$i_l
+ } {
+ DW_TAG_formal_parameter {
+ DW_AT_type :$avpac_c_l
+ DW_AT_name x
+ }
+ }
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp b/gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp
index 2f41db9..0cd26e8 100644
--- a/gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp
@@ -1,4 +1,4 @@
-# Copyright 2023 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@ load_lib dwarf.exp
# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support
+require !readnow
standard_testfile main.c -debug.S
@@ -32,23 +33,23 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
+ DW_AT_language @DW_LANG_C_plus_plus
} {
declare_labels myint
myint: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name myint}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name myint
}
DW_TAG_namespace {
- {DW_AT_name ns}
+ DW_AT_name ns
} {
spec: DW_TAG_variable {
- {DW_AT_name v}
- {DW_AT_type :$myint}
- {DW_AT_declaration 1 DW_FORM_flag_present}
+ DW_AT_name v
+ DW_AT_type :$myint
+ DW_AT_declaration 1 DW_FORM_flag_present
}
}
}
@@ -56,17 +57,17 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
+ DW_AT_language @DW_LANG_C_plus_plus
} {
# The new indexer has special code to compute the full
# name of an object that uses a specification that appears
# later in the DWARF.
DW_TAG_variable {
- {DW_AT_specification %$spec}
- {DW_AT_location {
+ DW_AT_specification %$spec
+ DW_AT_location {
DW_OP_const1u 23
DW_OP_stack_value
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
}
@@ -98,6 +99,11 @@ foreach_with_prefix worker_threads $worker_threads_list {
gdb_load $binfile
+ set index [have_index $binfile]
+ if { ![string eq $index ""] } {
+ return
+ }
+
gdb_test "pipe maint print objfiles | grep ns::v" \
"$ws+qualified:$ws+ns::v" \
"v has parent ns"
diff --git a/gdb/testsuite/gdb.dwarf2/bad-regnum.exp b/gdb/testsuite/gdb.dwarf2/bad-regnum.exp
index 3b8236c..f81826f 100644
--- a/gdb/testsuite/gdb.dwarf2/bad-regnum.exp
+++ b/gdb/testsuite/gdb.dwarf2/bad-regnum.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,34 +27,34 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
} {
declare_labels integer_label
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
DW_TAG_variable {
- {DW_AT_name foo1}
- {DW_AT_type :$integer_label}
- {DW_AT_location {
+ DW_AT_name foo1
+ DW_AT_type :$integer_label
+ DW_AT_location {
DW_OP_regx 2147483647
- } SPECIAL_expr}
- {external 1 flag}
+ } SPECIAL_expr
+ DW_AT_external 1 flag
}
DW_TAG_variable {
- {DW_AT_name foo2}
- {DW_AT_type :$integer_label}
- {DW_AT_location {
+ DW_AT_name foo2
+ DW_AT_type :$integer_label
+ DW_AT_location {
DW_OP_regx -1
- } SPECIAL_expr}
- {external 1 flag}
+ } SPECIAL_expr
+ DW_AT_external 1 flag
}
}
}
@@ -65,7 +65,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
index a6101e0..59330ac 100644
--- a/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
+++ b/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,48 +32,48 @@ Dwarf::assemble $asm_file {
declare_labels struct_label var_label int_label
int_label: base_type {
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
- {name int}
+ DW_AT_byte_size 4 sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
struct_label: structure_type {
- {name S}
- {byte_size 8 DW_FORM_sdata}
+ DW_AT_name S
+ DW_AT_byte_size 8 DW_FORM_sdata
} {
member {
- {name bitfield}
- {type :$int_label}
- {bit_size 12 DW_FORM_sdata}
- {bit_offset 20 DW_FORM_sdata}
+ DW_AT_name bitfield
+ DW_AT_type :$int_label
+ DW_AT_bit_size 12 DW_FORM_sdata
+ DW_AT_bit_offset 20 DW_FORM_sdata
}
member {
- {name intfield}
- {type :$int_label}
- {data_member_location 4 DW_FORM_sdata}
+ DW_AT_name intfield
+ DW_AT_type :$int_label
+ DW_AT_data_member_location 4 DW_FORM_sdata
}
}
subprogram {
- {MACRO_AT_func { main }}
- {type :$int_label}
- {external 1 flag}
+ MACRO_AT_func { main }
+ DW_AT_type :$int_label
+ DW_AT_external 1 flag
} {
var_label: DW_TAG_variable {
- {name var}
- {location {} DW_FORM_block1}
- {type :$struct_label}
+ DW_AT_name var
+ DW_AT_location {} DW_FORM_block1
+ DW_AT_type :$struct_label
}
}
}
}
}
-if [prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}] {
+if {[prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c
index 6f7933c..e22076d 100644
--- a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c
+++ b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.c b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.c
index 3088451..1742f6a 100644
--- a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.c
+++ b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp
index 750aa0f..ff9f41f 100644
--- a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp
+++ b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} $sources] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/callframecfa.S b/gdb/testsuite/gdb.dwarf2/callframecfa.S
index 9f884b6..3c7a495 100644
--- a/gdb/testsuite/gdb.dwarf2/callframecfa.S
+++ b/gdb/testsuite/gdb.dwarf2/callframecfa.S
@@ -1,5 +1,5 @@
/*
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/callframecfa.exp b/gdb/testsuite/gdb.dwarf2/callframecfa.exp
index 924b842..2dd036f 100644
--- a/gdb/testsuite/gdb.dwarf2/callframecfa.exp
+++ b/gdb/testsuite/gdb.dwarf2/callframecfa.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/calling-convention.c b/gdb/testsuite/gdb.dwarf2/calling-convention.c
index 86af28a..3331656 100644
--- a/gdb/testsuite/gdb.dwarf2/calling-convention.c
+++ b/gdb/testsuite/gdb.dwarf2/calling-convention.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/calling-convention.exp b/gdb/testsuite/gdb.dwarf2/calling-convention.exp
index 5905585..d3426b9 100644
--- a/gdb/testsuite/gdb.dwarf2/calling-convention.exp
+++ b/gdb/testsuite/gdb.dwarf2/calling-convention.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,26 +42,26 @@ set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name "calling-convention"}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name "calling-convention"
} {
declare_labels int_label
int_label: base_type {
- {byte_size [get_sizeof "int" 4] sdata}
- {encoding @DW_ATE_signed}
- {name "int"}
+ DW_AT_byte_size [get_sizeof "int" 4] sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name "int"
}
subprogram {
- {MACRO_AT_func { foo }}
- {type :$int_label}
- {calling_convention @DW_CC_nocall}
+ MACRO_AT_func { foo }
+ DW_AT_type :$int_label
+ DW_AT_calling_convention @DW_CC_nocall
}
subprogram {
- {MACRO_AT_func { main }}
- {type :$int_label}
+ MACRO_AT_func { main }
+ DW_AT_type :$int_label
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/clang-cli-macro.c b/gdb/testsuite/gdb.dwarf2/clang-cli-macro.c
index 5bc5580..97766a9 100644
--- a/gdb/testsuite/gdb.dwarf2/clang-cli-macro.c
+++ b/gdb/testsuite/gdb.dwarf2/clang-cli-macro.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/clang-cli-macro.exp b/gdb/testsuite/gdb.dwarf2/clang-cli-macro.exp
index eafb75a..d73a3a1 100644
--- a/gdb/testsuite/gdb.dwarf2/clang-cli-macro.exp
+++ b/gdb/testsuite/gdb.dwarf2/clang-cli-macro.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,22 +37,22 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_producer "clang version 15.0.0"}
- {DW_AT_language @DW_LANG_C11}
- {DW_AT_name $::srcfile}
- {DW_AT_macros $cu_macros DW_FORM_sec_offset}
- {DW_AT_stmt_list $L DW_FORM_sec_offset}
+ DW_AT_producer "clang version 15.0.0"
+ DW_AT_language @DW_LANG_C11
+ DW_AT_name $::srcfile
+ DW_AT_macros $cu_macros DW_FORM_sec_offset
+ DW_AT_stmt_list $L DW_FORM_sec_offset
} {
declare_labels int_type
int_type: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
DW_TAG_subprogram {
- {MACRO_AT_func {main}}
- {type :$int_type}
+ MACRO_AT_func {main}
+ DW_AT_type :$int_type
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/clztest.S b/gdb/testsuite/gdb.dwarf2/clztest.S
index 011ce7c..1528eac 100644
--- a/gdb/testsuite/gdb.dwarf2/clztest.S
+++ b/gdb/testsuite/gdb.dwarf2/clztest.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/clztest.exp b/gdb/testsuite/gdb.dwarf2/clztest.exp
index b1293b0..554077a 100644
--- a/gdb/testsuite/gdb.dwarf2/clztest.exp
+++ b/gdb/testsuite/gdb.dwarf2/clztest.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" "${test}" ${test}.S \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -61,7 +61,7 @@ proc scan_gdb_tests {} {
continue
}
- eval $test_cmd
+ {*}$test_cmd
}
close $fd
}
diff --git a/gdb/testsuite/gdb.dwarf2/comp-unit-lang.c b/gdb/testsuite/gdb.dwarf2/comp-unit-lang.c
index d45e60f..4f7f672 100644
--- a/gdb/testsuite/gdb.dwarf2/comp-unit-lang.c
+++ b/gdb/testsuite/gdb.dwarf2/comp-unit-lang.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp b/gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp
index 9856797..b1e890c 100644
--- a/gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp
+++ b/gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,13 +41,13 @@ proc do_test {cu_lang gdb_lang} {
# both 32- and 64-bit machines.
cu { addr_size 4 } {
compile_unit {
- {name file1.txt}
- {language @$cu_lang}
- {MACRO_AT_range {func}}
+ DW_AT_name file1.txt
+ DW_AT_language @$cu_lang
+ MACRO_AT_range {func}
} {
subprogram {
- {external 1 flag}
- {MACRO_AT_func {func}}
+ DW_AT_external 1 flag
+ MACRO_AT_func {func}
} {
}
}
@@ -59,7 +59,7 @@ proc do_test {cu_lang gdb_lang} {
return -1
}
- if ![runto func] {
+ if {![runto func]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/corrupt.exp b/gdb/testsuite/gdb.dwarf2/corrupt.exp
index 4bcd79a..a68b7e3 100644
--- a/gdb/testsuite/gdb.dwarf2/corrupt.exp
+++ b/gdb/testsuite/gdb.dwarf2/corrupt.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,31 +36,31 @@ Dwarf::assemble $asm_file {
declare_labels int_label
int_label: base_type {
- {byte_size 4 sdata}
- {name "int"}
+ DW_AT_byte_size 4 sdata
+ DW_AT_name "int"
}
enumeration_type {
- {name "ENUM"}
- {byte_size 4 sdata}
+ DW_AT_name "ENUM"
+ DW_AT_byte_size 4 sdata
} {
enumerator {
- {name "A"}
- {const_value 0 sdata}
+ DW_AT_name "A"
+ DW_AT_const_value 0 sdata
}
enumerator {
- {name "B"}
- {const_value 1 sdata}
- {sibling 12345678 DW_FORM_ref4}
+ DW_AT_name "B"
+ DW_AT_const_value 1 sdata
+ DW_AT_sibling 12345678 DW_FORM_ref4
} {
base_type {
- {byte_size 1 sdata}
- {name "char"}
+ DW_AT_byte_size 1 sdata
+ DW_AT_name "char"
}
}
array_type {
- {type :$int_label}
- {sibling 12345678 DW_FORM_ref4}
+ DW_AT_type :$int_label
+ DW_AT_sibling 12345678 DW_FORM_ref4
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/count.exp b/gdb/testsuite/gdb.dwarf2/count.exp
index 096e093..23b3c69 100644
--- a/gdb/testsuite/gdb.dwarf2/count.exp
+++ b/gdb/testsuite/gdb.dwarf2/count.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,100 +25,101 @@ standard_testfile main.c .S
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
- compile_unit {{language @DW_LANG_C99}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C99
+ } {
declare_labels char_label \
array_size_type_label long_unsigned_int_label \
array_label array_label2 static_array_label \
vla_length_label vla_array_label
char_label: base_type {
- {name char}
- {encoding @DW_ATE_signed}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name char
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 1 DW_FORM_sdata
}
array_size_type_label: base_type {
- {byte_size 8 DW_FORM_sdata}
- {encoding @DW_ATE_unsigned}
- {name __ARRAY_SIZE_TYPE__}
+ DW_AT_byte_size 8 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name __ARRAY_SIZE_TYPE__
}
long_unsigned_int_label: base_type {
- {byte_size 8 DW_FORM_sdata}
- {encoding @DW_ATE_unsigned}
- {name "long unsigned int"}
+ DW_AT_byte_size 8 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name "long unsigned int"
}
array_label: array_type {
- {type :$char_label}
+ DW_AT_type :$char_label
} {
subrange_type {
- {count {DW_OP_lit5} SPECIAL_expr}
- {type :$char_label}
+ DW_AT_count {DW_OP_lit5} SPECIAL_expr
+ DW_AT_type :$char_label
}
}
array_label2: array_type {
- {type :$char_label}
+ DW_AT_type :$char_label
} {
subrange_type {
- {count {DW_OP_lit1} SPECIAL_expr}
- {type :$char_label}
+ DW_AT_count {DW_OP_lit1} SPECIAL_expr
+ DW_AT_type :$char_label
}
}
static_array_label: array_type {
- {type :$char_label}
+ DW_AT_type :$char_label
} {
subrange_type {
- {count 5 DW_FORM_sdata}
- {type :$char_label}
+ DW_AT_count 5 DW_FORM_sdata
+ DW_AT_type :$char_label
}
}
vla_length_label:
DW_TAG_variable {
- {location
- {
- lit6
- stack_value
- } SPECIAL_expr}
- {name "__vla_array_length"}
- {type :$long_unsigned_int_label}
- {artificial 1 DW_FORM_flag_present}
+ DW_AT_location {
+ DW_OP_lit6
+ DW_OP_stack_value
+ } SPECIAL_expr
+ DW_AT_name "__vla_array_length"
+ DW_AT_type :$long_unsigned_int_label
+ DW_AT_artificial 1 DW_FORM_flag_present
}
vla_array_label: array_type {
- {type :$char_label}
+ DW_AT_type :$char_label
} {
subrange_type {
- {type :$array_size_type_label}
- {count :$vla_length_label}
+ DW_AT_type :$array_size_type_label
+ DW_AT_count :$vla_length_label
}
}
DW_TAG_variable {
- {name array2}
- {type :$array_label2}
- {const_value 65 DW_FORM_udata}
+ DW_AT_name array2
+ DW_AT_type :$array_label2
+ DW_AT_const_value 65 DW_FORM_udata
}
DW_TAG_variable {
- {name array}
- {type :$array_label}
- {const_value hello DW_FORM_block1}
+ DW_AT_name array
+ DW_AT_type :$array_label
+ DW_AT_const_value hello DW_FORM_block1
}
DW_TAG_variable {
- {name static_array}
- {type :$static_array_label}
- {const_value world DW_FORM_block1}
+ DW_AT_name static_array
+ DW_AT_type :$static_array_label
+ DW_AT_const_value world DW_FORM_block1
}
DW_TAG_variable {
- {name vla_array}
- {type :$vla_array_label}
- {const_value saluton DW_FORM_block1}
+ DW_AT_name vla_array
+ DW_AT_type :$vla_array_label
+ DW_AT_const_value saluton DW_FORM_block1
}
}
}
@@ -129,7 +130,7 @@ if { [prepare_for_testing "failed to prepare" $testfile \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/cpp-linkage-name.c b/gdb/testsuite/gdb.dwarf2/cpp-linkage-name.c
index 4b7f515..3e14bc2 100644
--- a/gdb/testsuite/gdb.dwarf2/cpp-linkage-name.c
+++ b/gdb/testsuite/gdb.dwarf2/cpp-linkage-name.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/cpp-linkage-name.exp b/gdb/testsuite/gdb.dwarf2/cpp-linkage-name.exp
index a126fea..44d31f6 100644
--- a/gdb/testsuite/gdb.dwarf2/cpp-linkage-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/cpp-linkage-name.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,49 +32,49 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
} {
declare_labels a_l b_l
a_l: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
# To expose the bug that existed at one point this
# structure must have a linkage name, but no name, and the
# linkage name is something that doesn't demangle.
b_l: DW_TAG_structure_type {
- {DW_AT_byte_size 8 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_linkage_name <anon>}
+ DW_AT_byte_size 8 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_linkage_name <anon>
} {
member {
- {name x}
- {type :$a_l}
- {data_member_location 0 data1}
+ DW_AT_name x
+ DW_AT_type :$a_l
+ DW_AT_data_member_location 0 data1
}
member {
- {name y}
- {type :$a_l}
- {data_member_location 0 data1}
+ DW_AT_name y
+ DW_AT_type :$a_l
+ DW_AT_data_member_location 0 data1
}
}
DW_TAG_subprogram {
- {MACRO_AT_func {main}}
- {type :$a_l}
+ MACRO_AT_func {main}
+ DW_AT_type :$a_l
}
DW_TAG_variable {
- {type :$b_l}
- {external 1 flag}
- {DW_AT_name global_var}
- {DW_AT_location {
+ DW_AT_type :$b_l
+ DW_AT_external 1 flag
+ DW_AT_name global_var
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol global_var]
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/cu-empty-name.c b/gdb/testsuite/gdb.dwarf2/cu-empty-name.c
index 2b72fe1..d1fead6 100644
--- a/gdb/testsuite/gdb.dwarf2/cu-empty-name.c
+++ b/gdb/testsuite/gdb.dwarf2/cu-empty-name.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2024 Free Software Foundation, Inc.
+/* Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/cu-empty-name.exp b/gdb/testsuite/gdb.dwarf2/cu-empty-name.exp
index a890962..6ee55a6 100644
--- a/gdb/testsuite/gdb.dwarf2/cu-empty-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/cu-empty-name.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,10 +27,10 @@ set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_producer "Tsetsuite"}
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name ""}
- {DW_AT_comp_dir /tmp}
+ DW_AT_producer "Tsetsuite"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ""
+ DW_AT_comp_dir /tmp
} {
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/cu-no-addrs.exp b/gdb/testsuite/gdb.dwarf2/cu-no-addrs.exp
index 6fd9fc1..796f935 100644
--- a/gdb/testsuite/gdb.dwarf2/cu-no-addrs.exp
+++ b/gdb/testsuite/gdb.dwarf2/cu-no-addrs.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,13 +35,13 @@ Dwarf::assemble $asm_file {
# The PC range here is intentionally empty -- this was the
# trigger for the bug.
compile_unit {
- {language @DW_LANG_C}
- {DW_AT_low_pc $main_start DW_FORM_addr}
- {DW_AT_high_pc $main_start DW_FORM_addr}
+ DW_AT_language @DW_LANG_C
+ DW_AT_low_pc $main_start DW_FORM_addr
+ DW_AT_high_pc $main_start DW_FORM_addr
} {
DW_TAG_subprogram {
- {DW_AT_name "main"}
- {DW_AT_low_pc $main_start DW_FORM_addr}
+ DW_AT_name "main"
+ DW_AT_low_pc $main_start DW_FORM_addr
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/data-loc.c b/gdb/testsuite/gdb.dwarf2/data-loc.c
index bb1fcee..d25e7fb 100644
--- a/gdb/testsuite/gdb.dwarf2/data-loc.c
+++ b/gdb/testsuite/gdb.dwarf2/data-loc.c
@@ -1,4 +1,4 @@
-/* Copyright 2014-2024 Free Software Foundation, Inc.
+/* Copyright 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/data-loc.exp b/gdb/testsuite/gdb.dwarf2/data-loc.exp
index c409f1e..7630dcc 100644
--- a/gdb/testsuite/gdb.dwarf2/data-loc.exp
+++ b/gdb/testsuite/gdb.dwarf2/data-loc.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,83 +34,83 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
- DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_Ada95}
- {DW_AT_name foo.adb}
- {DW_AT_comp_dir /tmp}
- } {
- declare_labels integer_label array_label array_ptr_label
+ DW_TAG_compile_unit {
+ DW_AT_language @DW_LANG_Ada95
+ DW_AT_name foo.adb
+ DW_AT_comp_dir /tmp
+ } {
+ declare_labels integer_label array_label array_ptr_label
set int_size [get_sizeof "int" 4]
set voidp_size [get_sizeof "void *" 96]
- integer_label: DW_TAG_base_type {
- {DW_AT_byte_size $int_size DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
- }
+ integer_label: DW_TAG_base_type {
+ DW_AT_byte_size $int_size DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
+ }
array_label: DW_TAG_array_type {
- {DW_AT_name foo__array_type}
- {DW_AT_type :$integer_label}
- {DW_AT_data_location {
- DW_OP_push_object_address
- DW_OP_deref
- } SPECIAL_expr}
- {external 1 flag}
+ DW_AT_name foo__array_type
+ DW_AT_type :$integer_label
+ DW_AT_data_location {
+ DW_OP_push_object_address
+ DW_OP_deref
+ } SPECIAL_expr
+ DW_AT_external 1 flag
} {
DW_TAG_subrange_type {
- {DW_AT_type :$integer_label}
- {DW_AT_lower_bound {
- DW_OP_push_object_address
- DW_OP_plus_uconst $voidp_size
- DW_OP_deref
- DW_OP_deref_size $int_size
- } SPECIAL_expr}
- {DW_AT_upper_bound {
- DW_OP_push_object_address
- DW_OP_plus_uconst $voidp_size
- DW_OP_deref
- DW_OP_plus_uconst $int_size
- DW_OP_deref_size $int_size
- } SPECIAL_expr}
+ DW_AT_type :$integer_label
+ DW_AT_lower_bound {
+ DW_OP_push_object_address
+ DW_OP_plus_uconst $voidp_size
+ DW_OP_deref
+ DW_OP_deref_size $int_size
+ } SPECIAL_expr
+ DW_AT_upper_bound {
+ DW_OP_push_object_address
+ DW_OP_plus_uconst $voidp_size
+ DW_OP_deref
+ DW_OP_plus_uconst $int_size
+ DW_OP_deref_size $int_size
+ } SPECIAL_expr
}
}
- array_ptr_label: DW_TAG_typedef {
- {DW_AT_name foo__array_type}
- {DW_AT_type :$array_label}
- }
- DW_TAG_variable {
- {DW_AT_name foo__three}
- {DW_AT_type :$array_label}
- {DW_AT_location {
- DW_OP_addr [gdb_target_symbol table_1]
- } SPECIAL_expr}
- {external 1 flag}
- }
- DW_TAG_variable {
- {DW_AT_name foo__three_tdef}
- {DW_AT_type :$array_ptr_label}
- {DW_AT_location {
- DW_OP_addr [gdb_target_symbol table_1]
- } SPECIAL_expr}
- {external 1 flag}
- }
- DW_TAG_variable {
- {DW_AT_name foo__five}
- {DW_AT_type :$array_label}
- {DW_AT_location {
- DW_OP_addr [gdb_target_symbol table_2]
- } SPECIAL_expr}
- {external 1 flag}
- }
- DW_TAG_variable {
- {DW_AT_name foo__five_tdef}
- {DW_AT_type :$array_ptr_label}
- {DW_AT_location {
- DW_OP_addr [gdb_target_symbol table_2]
- } SPECIAL_expr}
- {external 1 flag}
- }
+ array_ptr_label: DW_TAG_typedef {
+ DW_AT_name foo__array_type
+ DW_AT_type :$array_label
+ }
+ DW_TAG_variable {
+ DW_AT_name foo__three
+ DW_AT_type :$array_label
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol table_1]
+ } SPECIAL_expr
+ DW_AT_external 1 flag
+ }
+ DW_TAG_variable {
+ DW_AT_name foo__three_tdef
+ DW_AT_type :$array_ptr_label
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol table_1]
+ } SPECIAL_expr
+ DW_AT_external 1 flag
+ }
+ DW_TAG_variable {
+ DW_AT_name foo__five
+ DW_AT_type :$array_label
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol table_2]
+ } SPECIAL_expr
+ DW_AT_external 1 flag
+ }
+ DW_TAG_variable {
+ DW_AT_name foo__five_tdef
+ DW_AT_type :$array_ptr_label
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol table_2]
+ } SPECIAL_expr
+ DW_AT_external 1 flag
+ }
}
}
}
@@ -124,7 +124,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.c b/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.c
index 86a5978..fcbd6d8 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.c
+++ b/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.c
@@ -1,5 +1,5 @@
/*
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp b/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp
index 5c45b7a..9ac9d94 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp
+++ b/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,20 +31,20 @@ Dwarf::assemble $asm_file {
cu { label cu_label } {
compile_unit {
- {language @DW_LANG_C}
- {name $srcfile}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
} {
subprogram {
- {external 1 flag}
- {name main}
- {low_pc $main_start addr}
- {high_pc $main_len DW_FORM_data4}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc $main_len DW_FORM_data4
}
subprogram {
- {external 1 flag}
- {name frame2}
- {low_pc $frame2_start addr}
- {high_pc $frame2_len DW_FORM_data4}
+ DW_AT_external 1 flag
+ DW_AT_name frame2
+ DW_AT_low_pc $frame2_start addr
+ DW_AT_high_pc $frame2_len DW_FORM_data4
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp b/gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp
index c3ef2e2..016478f 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp
+++ b/gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ require dwarf2_support
standard_testfile _start.c debug-names.S
set func_info_vars \
- [get_func_info _start [list debug additional_flags=-nostartfiles]]
+ [get_func_info _start [list debug ldflags=-nostartfiles]]
# Create the DWARF.
set asm_file [standard_output_file $srcfile2]
@@ -35,11 +35,13 @@ Dwarf::assemble {
}
cu { label cu_label } {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
subprogram {
- {DW_AT_name _start}
- {DW_AT_low_pc $_start_start DW_FORM_addr}
- {DW_AT_high_pc $_start_end DW_FORM_addr}
+ DW_AT_name _start
+ DW_AT_low_pc $_start_start DW_FORM_addr
+ DW_AT_high_pc $_start_end DW_FORM_addr
}
}
}
@@ -49,18 +51,18 @@ Dwarf::assemble {
declare_labels int_type
structure_type {
- {name struct_with_int_member}
- {byte_size 4 sdata}
+ DW_AT_name struct_with_int_member
+ DW_AT_byte_size 4 sdata
} {
member {
- {name member}
- {type :$int_type}
+ DW_AT_name member
+ DW_AT_type :$int_type
}
}
int_type: base_type {
- {name int}
- {encoding @DW_ATE_signed}
- {byte_size 4 sdata}
+ DW_AT_name int
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 sdata
}
}
}
@@ -74,7 +76,7 @@ Dwarf::assemble {
}
if {[build_executable ${testfile}.exp $testfile "${asm_file} ${srcfile}" \
- [list additional_flags=-nostartfiles]] == -1} {
+ [list ldflags=-nostartfiles]] == -1} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp b/gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp
index 4d9ad56..583b230 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ require dwarf2_support
standard_testfile _start.c debug-names.S
set func_info_vars \
- [get_func_info _start [list debug additional_flags=-nostartfiles]]
+ [get_func_info _start [list debug ldflags=-nostartfiles]]
# Create the DWARF.
set asm_file [standard_output_file $srcfile2]
@@ -35,16 +35,18 @@ Dwarf::assemble {
}
cu { label cu_label } {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
subprogram {
- {DW_AT_name _start}
- {DW_AT_low_pc $_start_start DW_FORM_addr}
- {DW_AT_high_pc $_start_end DW_FORM_addr}
+ DW_AT_name _start
+ DW_AT_low_pc $_start_start DW_FORM_addr
+ DW_AT_high_pc $_start_end DW_FORM_addr
}
base_type {
- {name int}
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
+ DW_AT_name int
+ DW_AT_byte_size 4 sdata
+ DW_AT_encoding @DW_ATE_signed
}
}
}
@@ -57,8 +59,8 @@ Dwarf::assemble {
}
}
-if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
- [list additional_flags=-nostartfiles]] {
+if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
+ [list ldflags=-nostartfiles]]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp b/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp
index a8c9ab6..936cfe5 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,10 +18,14 @@ load_lib dwarf.exp
# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support
+# This test checks that no CU is initially expanded, which is negated
+# by readnow.
+require !readnow
+
standard_testfile _start.c debug-names.S
set func_info_vars \
- [get_func_info _start [list debug additional_flags=-nostartfiles]]
+ [get_func_info _start [list debug ldflags=-nostartfiles]]
# Create the DWARF.
set asm_file [standard_output_file $srcfile2]
@@ -35,16 +39,18 @@ Dwarf::assemble {
}
cu { label cu_label } {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
subprogram {
- {DW_AT_name _start}
- {DW_AT_low_pc $_start_start DW_FORM_addr}
- {DW_AT_high_pc $_start_end DW_FORM_addr}
+ DW_AT_name _start
+ DW_AT_low_pc $_start_start DW_FORM_addr
+ DW_AT_high_pc $_start_end DW_FORM_addr
}
base_type {
- {name int}
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
+ DW_AT_name int
+ DW_AT_byte_size 4 sdata
+ DW_AT_encoding @DW_ATE_signed
}
}
}
@@ -60,8 +66,8 @@ Dwarf::assemble {
}
}
-if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
- [list additional_flags=-nostartfiles]] {
+if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
+ [list ldflags=-nostartfiles]]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-non-ascending-cu.exp b/gdb/testsuite/gdb.dwarf2/debug-names-non-ascending-cu.exp
deleted file mode 100644
index 305d812..0000000
--- a/gdb/testsuite/gdb.dwarf2/debug-names-non-ascending-cu.exp
+++ /dev/null
@@ -1,81 +0,0 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-load_lib dwarf.exp
-
-# This test can only be run on targets which support DWARF-2 and use gas.
-require dwarf2_support
-
-standard_testfile _start.c debug-names.S
-
-set func_info_vars \
- [get_func_info _start [list debug additional_flags=-nostartfiles]]
-
-# Create the DWARF.
-set asm_file [standard_output_file $srcfile2]
-Dwarf::assemble {
- filename $asm_file
- add_dummy_cus 0
-} {
- global func_info_vars
- foreach var $func_info_vars {
- global $var
- }
-
- cu { label cu_label } {
- compile_unit {{language @DW_LANG_C}} {
- subprogram {
- {DW_AT_name _start}
- {DW_AT_low_pc $_start_start DW_FORM_addr}
- {DW_AT_high_pc $_start_end DW_FORM_addr}
- }
- }
- }
-
- cu { label cu_label_2 } {
- compile_unit {{language @DW_LANG_C}} {
- base_type {
- {name int}
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
- }
- }
- }
-
- debug_names {} {
- cu cu_label_2
- cu cu_label
- name _start subprogram cu_label 0xEDDB6232
- name int base_type cu_label 0xB888030
- }
-}
-
-if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
- [list additional_flags=-nostartfiles]] {
- return -1
-}
-
-# Check for warning.
-set re \
- [list \
- "warning:" \
- "Section .debug_names has incorrect entry in CU table," \
- "ignoring .debug_names."]
-set re [join $re]
-gdb_assert {[regexp $re $gdb_file_cmd_msg]} "warning"
-
-# Verify that .debug_names section is ignored.
-set index [have_index $binfile]
-gdb_assert { [string equal $index ""] } ".debug_names not used"
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-tu-dwarf5.exp b/gdb/testsuite/gdb.dwarf2/debug-names-tu-dwarf5.exp
index ec82e68..b5f9517 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names-tu-dwarf5.exp
+++ b/gdb/testsuite/gdb.dwarf2/debug-names-tu-dwarf5.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp b/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp
index 6c8f6c8..f3844c6 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp
+++ b/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl b/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl
index 826e739..19d618f 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl
+++ b/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,10 +18,14 @@ load_lib dwarf.exp
# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support
+# When using readnow, the index isn't used, which invalidates this
+# test.
+require !readnow
+
standard_testfile _start.c debug-names.S
set func_info_vars \
- [get_func_info _start [list debug additional_flags=-nostartfiles]]
+ [get_func_info _start [list debug ldflags=-nostartfiles]]
# Create the DWARF.
set asm_file [standard_output_file $srcfile2]
@@ -36,32 +40,36 @@ Dwarf::assemble {
}
cu { label cu_label version $dwarf_version } {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
subprogram {
- {DW_AT_name _start}
- {DW_AT_low_pc $_start_start DW_FORM_addr}
- {DW_AT_high_pc $_start_end DW_FORM_addr}
+ DW_AT_name _start
+ DW_AT_low_pc $_start_start DW_FORM_addr
+ DW_AT_high_pc $_start_end DW_FORM_addr
}
}
}
tu { label tu_label version $dwarf_version } 0x8ece66f4224fddb3 "" {
- type_unit {{language @DW_LANG_C}} {
+ type_unit {
+ DW_AT_language @DW_LANG_C
+ } {
declare_labels int_type
structure_type {
- {name struct_with_int_member}
- {byte_size 4 sdata}
+ DW_AT_name struct_with_int_member
+ DW_AT_byte_size 4 sdata
} {
member {
- {name member}
- {type :$int_type}
+ DW_AT_name member
+ DW_AT_type :$int_type
}
}
int_type: base_type {
- {name int}
- {encoding @DW_ATE_signed}
- {byte_size 4 sdata}
+ DW_AT_name int
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 sdata
}
}
}
@@ -75,8 +83,8 @@ Dwarf::assemble {
}
}
-if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
- [list additional_flags=-nostartfiles]] {
+if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
+ [list ldflags=-nostartfiles]]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names.exp b/gdb/testsuite/gdb.dwarf2/debug-names.exp
index 74c9192..d099aa9 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names.exp
+++ b/gdb/testsuite/gdb.dwarf2/debug-names.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ require dwarf2_support
standard_testfile _start.c debug-names.S
set func_info_vars \
- [get_func_info _start [list debug additional_flags=-nostartfiles]]
+ [get_func_info _start [list debug ldflags=-nostartfiles]]
# Create the DWARF.
set asm_file [standard_output_file $srcfile2]
@@ -35,16 +35,18 @@ Dwarf::assemble {
}
cu { label cu_label } {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
subprogram {
- {DW_AT_name _start}
- {DW_AT_low_pc $_start_start DW_FORM_addr}
- {DW_AT_high_pc $_start_end DW_FORM_addr}
+ DW_AT_name _start
+ DW_AT_low_pc $_start_start DW_FORM_addr
+ DW_AT_high_pc $_start_end DW_FORM_addr
}
base_type {
- {name int}
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
+ DW_AT_name int
+ DW_AT_byte_size 4 sdata
+ DW_AT_encoding @DW_ATE_signed
}
}
}
@@ -56,8 +58,8 @@ Dwarf::assemble {
}
}
-if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
- [list additional_flags=-nostartfiles]] {
+if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
+ [list ldflags=-nostartfiles]]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dup-psym.S b/gdb/testsuite/gdb.dwarf2/dup-psym.S
index d137707..9a08eda 100644
--- a/gdb/testsuite/gdb.dwarf2/dup-psym.S
+++ b/gdb/testsuite/gdb.dwarf2/dup-psym.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2005-2024 Free Software Foundation, Inc.
+ Copyright 2005-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dup-psym.exp b/gdb/testsuite/gdb.dwarf2/dup-psym.exp
index 655948c..ce16c93 100644
--- a/gdb/testsuite/gdb.dwarf2/dup-psym.exp
+++ b/gdb/testsuite/gdb.dwarf2/dup-psym.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw-form-ref-addr-with-type-units.exp b/gdb/testsuite/gdb.dwarf2/dw-form-ref-addr-with-type-units.exp
new file mode 100644
index 0000000..396fd94
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw-form-ref-addr-with-type-units.exp
@@ -0,0 +1,109 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This is a reproducer for PR 29518:
+#
+# https://sourceware.org/bugzilla/show_bug.cgi?id=29518
+#
+# The root cause for the problem was that function
+# dwarf2_find_containing_comp_unit was searching the whole "all_units" vector,
+# containing both compile units and type units, causing it to sometimes
+# erroneously return a type unit. It should have been restricted to searching
+# compile units.
+#
+# To get dwarf2_find_containing_comp_unit to be called and reproduce the
+# original bug, we need a value with form DW_FORM_ref_addr pointing to a
+# different compile unit. This is produced by `%$int_type` below.
+
+load_lib dwarf.exp
+require dwarf2_support
+standard_testfile main.c .S
+
+set asm_file [standard_output_file $srcfile2]
+
+Dwarf::assemble $asm_file {
+ global srcfile
+ declare_labels int_type
+
+ # The source CU.
+ cu {version 4} {
+ compile_unit {
+ } {
+ subprogram {
+ MACRO_AT_func {main}
+ DW_AT_type %$int_type
+ }
+ }
+ }
+
+ # Create a bunch of empty / dummy CUs, to make the offset of int_type a bit
+ # higher.
+ for {set i 1} {$i < 10} {incr i} {
+ cu {version 4} {
+ compile_unit {} {}
+ }
+ }
+
+ # The target CU.
+ cu {version 4} {
+ compile_unit {
+ } {
+ int_type: DW_TAG_base_type {
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
+ }
+ }
+ }
+
+ # Create many TUs.
+ #
+ # We need enough type units in the "all_units" vector in order to steer the
+ # binary search in dwarf2_find_containing_comp_unit towards the type units
+ # region of the array.
+ for {set i 1} {$i < 20} {incr i} {
+ tu {version 4} $i the_type_i {
+ type_unit {} {
+ declare_labels dummy_int_type
+
+ the_type_i: structure_type {
+ DW_AT_name s
+ DW_AT_byte_size 4 sdata
+ } {
+ member {
+ DW_AT_name i
+ DW_AT_type :$dummy_int_type
+ }
+ }
+
+ dummy_int_type: base_type {
+ DW_AT_name int
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 sdata
+ }
+ }
+ }
+ }
+}
+
+if { [prepare_for_testing "failed to prepare" ${testfile} \
+ [list $srcfile $asm_file] {nodebug}] } {
+ return -1
+}
+
+# Without the corresponding fix, we get an internal error:
+#
+# gdb/dwarf2/read.c:3940: internal-error: load_full_comp_unit: Assertion `! this_cu->is_debug_types' failed.
+gdb_test "p main" " = {int \\(void\\)} $hex <main>"
diff --git a/gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp b/gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp
new file mode 100644
index 0000000..f312885
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp
@@ -0,0 +1,41 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that an out-of-bounds DW_FORM_strx attribute triggers a DWARF error.
+
+# Out of bounds index.
+set int_str_idx 1
+
+# With readnow, the dwarf error is printed during the file command, so skip
+# the test.
+require !readnow
+
+set prepare_for_testing_done 0
+source $srcdir/$subdir/dw-form-strx.exp.tcl
+require {expr {$prepare_for_testing_done == 1}}
+
+set re_dwarf_error \
+ [string_list_to_regexp \
+ "DWARF Error: Offset from DW_FORM_GNU_str_index or DW_FORM_strx" \
+ " pointing outside of .debug_str_offsets section in CU at offset"\
+ " "]$hex
+set re_in_module \
+ {in module [^\r\n]+}
+set re_in_module [string_to_regexp {[}]$re_in_module[string_to_regexp {]}]
+set re_no_symbol [string_to_regexp {No symbol "global_var" in current context.}]
+gdb_test "ptype global_var" \
+ [multi_line \
+ "$re_dwarf_error $re_in_module"\
+ $re_no_symbol]
diff --git a/gdb/testsuite/gdb.dwarf2/dw-form-strx.exp b/gdb/testsuite/gdb.dwarf2/dw-form-strx.exp
new file mode 100644
index 0000000..7153314
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw-form-strx.exp
@@ -0,0 +1,25 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that DW_FORM_strx works.
+
+# Correct index.
+set int_str_idx 0
+
+set prepare_for_testing_done 0
+source $srcdir/$subdir/dw-form-strx.exp.tcl
+require {expr {$prepare_for_testing_done == 1}}
+
+gdb_test "ptype global_var" "type = int"
diff --git a/gdb/testsuite/gdb.dwarf2/dw-form-strx.exp.tcl b/gdb/testsuite/gdb.dwarf2/dw-form-strx.exp.tcl
new file mode 100644
index 0000000..0e5cee2
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw-form-strx.exp.tcl
@@ -0,0 +1,64 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+require dwarf2_support
+
+standard_testfile main.c -dw.S
+
+set asm_file [standard_output_file $srcfile2]
+
+# Debug info in the main file.
+Dwarf::assemble $asm_file {
+ declare_labels base_offset_cu1
+
+ debug_str_offsets { base_offset base_offset_cu1 } int
+
+ cu {
+ version 5
+ } {
+ DW_TAG_compile_unit {
+ DW_AT_str_offsets_base $base_offset_cu1 sec_offset
+ } {
+ declare_labels int4_type
+
+ int4_type: DW_TAG_base_type {
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name $::int_str_idx DW_FORM_strx_id
+ }
+
+ DW_TAG_variable {
+ DW_AT_name global_var
+ DW_AT_type :$int4_type
+ DW_AT_location {
+ DW_OP_const1u 12
+ DW_OP_stack_value
+ } SPECIAL_expr
+ }
+ }
+ }
+}
+
+if { [prepare_for_testing "failed to prepare" ${testfile} \
+ [list $srcfile $asm_file] {nodebug}] } {
+ return
+}
+
+# Let includers know prepare_for_testing was done, without having to check
+# source return status.
+set prepare_for_testing_done 1
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S
index 745e534..ff64e1e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S
@@ -1,4 +1,4 @@
-/* Copyright 2014-2024 Free Software Foundation, Inc.
+/* Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello.c b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello.c
index 8452f46..a4cf760 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello.c
@@ -1,4 +1,4 @@
-/* Copyright 2014-2024 Free Software Foundation, Inc.
+/* Copyright 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S
index 15f2cf3..d5ae9c7 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S
@@ -1,4 +1,4 @@
-/* Copyright 2014-2024 Free Software Foundation, Inc.
+/* Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world.c b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world.c
index 030d231..d89c2c5 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world.c
@@ -1,4 +1,4 @@
-/* Copyright 2014-2024 Free Software Foundation, Inc.
+/* Copyright 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.c b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.c
index 1072c71..95338e5 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.c
@@ -1,4 +1,4 @@
-/* Copyright 2014-2024 Free Software Foundation, Inc.
+/* Copyright 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp
index e93d2fa..50cb8d8 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.S b/gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.S
index 13ac525..aef8386 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.S
@@ -1,4 +1,4 @@
-/* Copyright 2010-2024 Free Software Foundation, Inc.
+/* Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.exp b/gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.exp
index 3f8fd78..457742e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-align.exp b/gdb/testsuite/gdb.dwarf2/dw2-align.exp
index ecf9655..84f016b 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-align.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-align.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,39 +27,39 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
- } {
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
+ } {
declare_labels itype ptype
- itype: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int_4096}
- {DW_AT_alignment 4096 DW_FORM_sdata}
- }
+ itype: DW_TAG_base_type {
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int_4096
+ DW_AT_alignment 4096 DW_FORM_sdata
+ }
- ptype: DW_TAG_pointer_type {
- {DW_AT_byte_size 8 DW_FORM_sdata}
- {DW_AT_type :$itype}
- {DW_AT_alignment 4096 DW_FORM_sdata}
- }
+ ptype: DW_TAG_pointer_type {
+ DW_AT_byte_size 8 DW_FORM_sdata
+ DW_AT_type :$itype
+ DW_AT_alignment 4096 DW_FORM_sdata
+ }
- DW_TAG_typedef {
- {DW_AT_name ptr_4096}
- {DW_AT_type :$ptype}
- }
+ DW_TAG_typedef {
+ DW_AT_name ptr_4096
+ DW_AT_type :$ptype
+ }
DW_TAG_structure_type {
- {DW_AT_name "struct_4096"}
- {DW_AT_byte_size 4096 DW_FORM_sdata}
- {DW_AT_alignment 4096 DW_FORM_udata}
+ DW_AT_name "struct_4096"
+ DW_AT_byte_size 4096 DW_FORM_sdata
+ DW_AT_alignment 4096 DW_FORM_udata
} {
member {
- {name a}
- {type :$itype}
- {data_member_location 0 data1}
+ DW_AT_name a
+ DW_AT_type :$itype
+ DW_AT_data_member_location 0 data1
}
}
}
@@ -71,7 +71,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.S b/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.S
index cd4582e..185e662 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp b/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp
index fa98e41..b6a2525 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.S b/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.S
index e0ffecf..d15db8a 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.exp b/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.exp
index 3dcc785..ff740d7 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.c b/gdb/testsuite/gdb.dwarf2/dw2-aranges.c
index 2802518..fe2a1a2 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-aranges.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp
index 1ba5bad..928edf0 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,14 +25,17 @@ set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu { label cu_start } {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
}
}
aranges { addr_zero true } cu_start {
}
}
-if { [prepare_for_testing "failed to prepare" $binfile [list $asm_file $srcfile ]] } {
+if { [prepare_for_testing "failed to prepare" $testfile \
+ [list $asm_file $srcfile ]] } {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-abstract-origin.c b/gdb/testsuite/gdb.dwarf2/dw2-bad-abstract-origin.c
index 96014af..426a228 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-abstract-origin.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-abstract-origin.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-abstract-origin.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-abstract-origin.exp
index 5e7d8cc..0ee06b0 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-abstract-origin.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-abstract-origin.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -93,75 +93,75 @@ proc run_test { dwarf_version } {
cu { version $dwarf_version } {
compile_unit {
- {producer "GNU C 14.1.0"}
- {language @DW_LANG_C}
- {name $::srcfile}
- {comp_dir /tmp}
- {stmt_list $lines_table DW_FORM_sec_offset}
- {low_pc 0 addr}
+ DW_AT_producer "GNU C 14.1.0"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $::srcfile
+ DW_AT_comp_dir /tmp
+ DW_AT_stmt_list $lines_table DW_FORM_sec_offset
+ DW_AT_low_pc 0 addr
} {
int_label: base_type {
- {name "int"}
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
+ DW_AT_name "int"
+ DW_AT_byte_size 4 sdata
+ DW_AT_encoding @DW_ATE_signed
}
foo_func: subprogram {
- {name foo}
- {inline @DW_INL_declared_inlined}
- {decl_file 1 data1}
- {decl_line $::func_a_decl_line data1}
+ DW_AT_name foo
+ DW_AT_inline @DW_INL_declared_inlined
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $::func_a_decl_line data1
} {
foo_block: lexical_block {
} {
value_label: DW_TAG_variable {
- {name value}
- {type :$int_label}
+ DW_AT_name value
+ DW_AT_type :$int_label
}
}
}
subprogram {
- {abstract_origin %$foo_func}
- {low_pc func_a_0 addr}
- {high_pc func_a_6 addr}
- {external 1 flag}
+ DW_AT_abstract_origin %$foo_func
+ DW_AT_low_pc func_a_0 addr
+ DW_AT_high_pc func_a_6 addr
+ DW_AT_external 1 flag
} {
bad_block: lexical_block {
- {abstract_origin %$foo_block}
- {ranges $block_ranges DW_FORM_sec_offset}
+ DW_AT_abstract_origin %$foo_block
+ DW_AT_ranges $block_ranges DW_FORM_sec_offset
} {
DW_TAG_variable {
- {abstract_origin %$value_label}
- {DW_AT_location {
+ DW_AT_abstract_origin %$value_label
+ DW_AT_location {
DW_OP_const1u 23
DW_OP_stack_value
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
}
subprogram {
- {name baz}
- {low_pc func_b_0 addr}
- {high_pc func_b_5 addr}
- {external 1 flag}
+ DW_AT_name baz
+ DW_AT_low_pc func_b_0 addr
+ DW_AT_high_pc func_b_5 addr
+ DW_AT_external 1 flag
} {
inlined_subroutine {
- {abstract_origin %$foo_func}
- {call_file 1 data1}
- {call_line $::call_line data1}
- {low_pc func_b_1 addr}
- {high_pc func_b_4 addr}
+ DW_AT_abstract_origin %$foo_func
+ DW_AT_call_file 1 data1
+ DW_AT_call_line $::call_line data1
+ DW_AT_low_pc func_b_1 addr
+ DW_AT_high_pc func_b_4 addr
} {
lexical_block {
- {abstract_origin %$bad_block}
- {low_pc func_b_2 addr}
- {high_pc func_b_3 addr}
+ DW_AT_abstract_origin %$bad_block
+ DW_AT_low_pc func_b_2 addr
+ DW_AT_high_pc func_b_3 addr
} {
DW_TAG_variable {
- {abstract_origin %$value_label}
- {DW_AT_location {
+ DW_AT_abstract_origin %$value_label
+ DW_AT_location {
DW_OP_const1u 99
DW_OP_stack_value
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-elf-other.S b/gdb/testsuite/gdb.dwarf2/dw2-bad-elf-other.S
index 0e353f5..d645172 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-elf-other.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-elf-other.S
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp
index c678c20..429386f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -54,56 +54,56 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir ${srcdir}/${subdir}}
- {stmt_list $L1 DW_FORM_sec_offset}
- {ranges ${ranges_label_1} DW_FORM_sec_offset}
- {DW_AT_low_pc 0 addr}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
+ DW_AT_comp_dir ${srcdir}/${subdir}
+ DW_AT_stmt_list $L1 DW_FORM_sec_offset
+ DW_AT_ranges ${ranges_label_1} DW_FORM_sec_offset
+ DW_AT_low_pc 0 addr
} {
declare_labels integer_label
DW_TAG_subprogram {
- {name main}
- {low_pc $main_start addr}
- {high_pc $main_length data8}
- {DW_AT_type :$integer_label}
- {DW_AT_decl_file 1 data1}
- {DW_AT_decl_line 10 data1}
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc $main_length data8
+ DW_AT_type :$integer_label
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line 10 data1
}
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size $int_size DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size $int_size DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
}
}
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name $srcfile2}
- {DW_AT_comp_dir ${srcdir}/${subdir}}
- {stmt_list $L2 DW_FORM_sec_offset}
- {ranges ${ranges_label_2} DW_FORM_sec_offset}
- {DW_AT_low_pc 0 addr}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile2
+ DW_AT_comp_dir ${srcdir}/${subdir}
+ DW_AT_stmt_list $L2 DW_FORM_sec_offset
+ DW_AT_ranges ${ranges_label_2} DW_FORM_sec_offset
+ DW_AT_low_pc 0 addr
} {
declare_labels integer_label
DW_TAG_subprogram {
- {name some_func}
- {low_pc some_func addr}
- {high_pc some_func_end addr}
- {DW_AT_type :$integer_label}
- {DW_AT_decl_file 2 data1}
- {DW_AT_decl_line 5 data1}
+ DW_AT_name some_func
+ DW_AT_low_pc some_func addr
+ DW_AT_high_pc some_func_end addr
+ DW_AT_type :$integer_label
+ DW_AT_decl_file 2 data1
+ DW_AT_decl_line 5 data1
}
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size $int_size DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size $int_size DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
}
}
@@ -170,10 +170,10 @@ if { [build_executable ${testfile}.exp ${testfile} \
proc run_test { goto_main } {
global binfile decimal hex
- clean_restart ${binfile}
+ clean_restart ${::testfile}
if { $goto_main } {
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.c b/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.c
index 28c09ec..6f7f1ff 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp
index e67eb99..ad65842 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,27 +28,26 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
-
- } {
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
+ } {
declare_labels b_l
b_l: DW_TAG_base_type {
- {DW_AT_byte_size 1 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name bool}
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name bool
}
- DW_TAG_subprogram {
- {MACRO_AT_func {f}}
- {type :$b_l}
- {DW_AT_MIPS_linkage_name _Z1fv}
+ DW_TAG_subprogram {
+ MACRO_AT_func {f}
+ DW_AT_type :$b_l
+ DW_AT_MIPS_linkage_name _Z1fv
}
- DW_TAG_subprogram {
- {MACRO_AT_func {g}}
- {type :$b_l}
- {DW_AT_MIPS_linkage_name 42 DW_FORM_data1}
+ DW_TAG_subprogram {
+ MACRO_AT_func {g}
+ DW_AT_type :$b_l
+ DW_AT_MIPS_linkage_name 42 DW_FORM_data1
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.S b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.S
index cc7a806..41f692b 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.S
@@ -1,4 +1,4 @@
-/* Copyright 2010-2024 Free Software Foundation, Inc.
+/* Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp
index d6b8d2e..8af85b3 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-unresolved.c b/gdb/testsuite/gdb.dwarf2/dw2-bad-unresolved.c
index 4e4e178..f2e7685 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-unresolved.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-unresolved.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-unresolved.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-unresolved.exp
index 3d4f993..dba8d5e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-unresolved.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-unresolved.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,21 +30,21 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
} {
declare_labels b_l
b_l: DW_TAG_base_type {
- {DW_AT_byte_size 1 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name bool}
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name bool
}
DW_TAG_variable {
- {name var}
- {type :$b_l}
- {external 1 flag}
+ DW_AT_name var
+ DW_AT_type :$b_l
+ DW_AT_external 1 flag
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-basic.S b/gdb/testsuite/gdb.dwarf2/dw2-basic.S
index 20bc309..e8ae42d 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-basic.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-basic.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-basic.exp b/gdb/testsuite/gdb.dwarf2/dw2-basic.exp
index ba1132b..803d183 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-basic.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-basic.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bfloat16.c b/gdb/testsuite/gdb.dwarf2/dw2-bfloat16.c
index 490b760..3204dca 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bfloat16.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bfloat16.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bfloat16.exp b/gdb/testsuite/gdb.dwarf2/dw2-bfloat16.exp
index d98f830..271b6ec 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bfloat16.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bfloat16.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,35 +32,35 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
- } {
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
+ } {
declare_labels bf16_type fp16_type \
bf16_var fp16_var
- bf16_type: DW_TAG_base_type {
- {DW_AT_name __bf16}
- {encoding @DW_ATE_float}
- {DW_AT_byte_size 2 DW_FORM_sdata}
- }
+ bf16_type: DW_TAG_base_type {
+ DW_AT_name __bf16
+ DW_AT_encoding @DW_ATE_float
+ DW_AT_byte_size 2 DW_FORM_sdata
+ }
- fp16_type: DW_TAG_base_type {
- {DW_AT_name __fp16}
- {encoding @DW_ATE_float}
- {DW_AT_byte_size 2 DW_FORM_sdata}
- }
+ fp16_type: DW_TAG_base_type {
+ DW_AT_name __fp16
+ DW_AT_encoding @DW_ATE_float
+ DW_AT_byte_size 2 DW_FORM_sdata
+ }
bf16_var: DW_TAG_variable {
- {DW_AT_name "bf16_1"}
- {DW_AT_type :${bf16_type}}
- {DW_AT_const_value 0x4049 DW_FORM_sdata}
+ DW_AT_name "bf16_1"
+ DW_AT_type :${bf16_type}
+ DW_AT_const_value 0x4049 DW_FORM_sdata
}
fp16_var: DW_TAG_variable {
- {DW_AT_name "fp16_1"}
- {DW_AT_type :${fp16_type}}
- {DW_AT_const_value 0x4248 DW_FORM_sdata}
+ DW_AT_name "fp16_1"
+ DW_AT_type :${fp16_type}
+ DW_AT_const_value 0x4248 DW_FORM_sdata
}
}
}
@@ -71,7 +71,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.S b/gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.S
index 3b3dc36..b8723c7 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.S
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.exp
index 2bf592e..b5ad32b 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,8 +23,8 @@ set additional_flags [gdb_target_symbol_prefix_flags_asm]
standard_testfile .S
set executable ${testfile}
-if [prepare_for_testing "failed to prepare" $testfile $srcfile \
- [list nodebug $additional_flags]] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
+ [list nodebug $additional_flags]]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S
index c892296..44beac4 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c
index 83ee4c6..6ccce95 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp
index e31df6b..13015a3 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ require dwarf2_support
standard_testfile .c -debug.S
-if [is_ilp32_target] {
+if {[is_ilp32_target]} {
set ptrbits 32
} else {
set ptrbits 64
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-common-block.S b/gdb/testsuite/gdb.dwarf2/dw2-common-block.S
index 64c6712..c9cd7cf 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-common-block.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-common-block.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-common-block.exp b/gdb/testsuite/gdb.dwarf2/dw2-common-block.exp
index 7430b53..0340b3d 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-common-block.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-common-block.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.S b/gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.S
index 7e03cfa..598190f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.exp b/gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.exp
index e686e5b..5161e67 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp b/gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp
index 281e87d..2ad358f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,8 +31,8 @@ require dwarf2_support
standard_testfile main.c -debug.S
-if [prepare_for_testing "failed to prepare" $testfile \
- "${srcfile}" {}] {
+if {[prepare_for_testing "failed to prepare" $testfile \
+ "${srcfile}" {}]} {
return -1
}
@@ -52,14 +52,14 @@ Dwarf::assemble $asm_file {
declare_labels int_type
int_type: DW_TAG_base_type {
- {DW_AT_byte_size $::int_size DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
+ DW_AT_byte_size $::int_size DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
DW_TAG_subprogram {
- {MACRO_AT_func {main}}
- {type :$int_type}
+ MACRO_AT_func {main}
+ DW_AT_type :$int_type
}
# GCC complex float.
@@ -67,36 +67,36 @@ Dwarf::assemble $asm_file {
declare_labels cf_type cd_type cld_type
cf_type: DW_TAG_base_type {
- {DW_AT_byte_size [expr 2 * $::float_size] DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_complex_float}
- {DW_AT_name "complex float"}
+ DW_AT_byte_size [expr {2 * $::float_size}] DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_complex_float
+ DW_AT_name "complex float"
}
cd_type: DW_TAG_base_type {
- {DW_AT_byte_size [expr 2 * $::double_size] DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_complex_float}
- {DW_AT_name "complex double"}
+ DW_AT_byte_size [expr {2 * $::double_size}] DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_complex_float
+ DW_AT_name "complex double"
}
cld_type: DW_TAG_base_type {
- {DW_AT_byte_size [expr 2 * $::long_double_size] DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_complex_float}
- {DW_AT_name "complex long double"}
+ DW_AT_byte_size [expr {2 * $::long_double_size}] DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_complex_float
+ DW_AT_name "complex long double"
}
DW_TAG_variable {
- {name var_complex_float}
- {DW_AT_type :$cf_type}
+ DW_AT_name var_complex_float
+ DW_AT_type :$cf_type
}
DW_TAG_variable {
- {name var_complex_double}
- {DW_AT_type :$cd_type}
+ DW_AT_name var_complex_double
+ DW_AT_type :$cd_type
}
DW_TAG_variable {
- {name var_complex_long_double}
- {DW_AT_type :$cld_type}
+ DW_AT_name var_complex_long_double
+ DW_AT_type :$cld_type
}
# GCC complex int.
@@ -105,14 +105,14 @@ Dwarf::assemble $asm_file {
declare_labels ci_type
ci_type: DW_TAG_base_type {
- {DW_AT_byte_size [expr 2 * $::int_size] DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_lo_user}
- {DW_AT_name "complex int"}
+ DW_AT_byte_size [expr {2 * $::int_size}] DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_lo_user
+ DW_AT_name "complex int"
}
DW_TAG_variable {
- {name var_complex_int}
- {DW_AT_type :$ci_type}
+ DW_AT_name var_complex_int
+ DW_AT_type :$ci_type
}
# Clang complex float.
@@ -122,47 +122,47 @@ Dwarf::assemble $asm_file {
declare_labels clang_cf_type clang_cd_type clang_cld_type
clang_cf_type: DW_TAG_base_type {
- {DW_AT_byte_size [expr 2 * $::float_size] DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_complex_float}
- {DW_AT_name "complex"}
+ DW_AT_byte_size [expr {2 * $::float_size}] DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_complex_float
+ DW_AT_name "complex"
}
DW_TAG_variable {
- {name var_complex_clang_float}
- {DW_AT_type :$clang_cf_type}
+ DW_AT_name var_complex_clang_float
+ DW_AT_type :$clang_cf_type
}
clang_cd_type: DW_TAG_base_type {
- {DW_AT_byte_size [expr 2 * $::double_size] DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_complex_float}
- {DW_AT_name "complex"}
+ DW_AT_byte_size [expr {2 * $::double_size}] DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_complex_float
+ DW_AT_name "complex"
}
DW_TAG_variable {
- {name var_complex_clang_double}
- {DW_AT_type :$clang_cd_type}
+ DW_AT_name var_complex_clang_double
+ DW_AT_type :$clang_cd_type
}
clang_cld_type: DW_TAG_base_type {
- {DW_AT_byte_size [expr 2 * $::long_double_size] DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_complex_float}
- {DW_AT_name "complex"}
+ DW_AT_byte_size [expr {2 * $::long_double_size}] DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_complex_float
+ DW_AT_name "complex"
}
DW_TAG_variable {
- {name var_complex_clang_long_double}
- {DW_AT_type :$clang_cld_type}
+ DW_AT_name var_complex_clang_long_double
+ DW_AT_type :$clang_cld_type
}
}
}
}
-if [prepare_for_testing "failed to prepare" $testfile \
- "${asm_file} ${srcfile}" {}] {
+if {[prepare_for_testing "failed to prepare" $testfile \
+ "${asm_file} ${srcfile}" {}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -191,7 +191,7 @@ proc do_test { type {clang 0}} {
gdb_test "ptype '$ctype'" \
"type = $ctype"
- eval set type_size \$::${type_id}_size
+ set type_size [subst \$::${type_id}_size]
gdb_test "p sizeof ('$type')" \
" = $type_size"
@@ -200,7 +200,7 @@ proc do_test { type {clang 0}} {
# With clang, the ctype name does not uniquely map to a type,
# so the size is unpredictable.
gdb_test "p sizeof ('$ctype')" \
- " = [expr 2 * $type_size]"
+ " = [expr {2 * $type_size}]"
}
set re_kfail \
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-compressed.S b/gdb/testsuite/gdb.dwarf2/dw2-compressed.S
index 4b5bb5f..e14ffc7 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-compressed.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-compressed.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-compressed.exp b/gdb/testsuite/gdb.dwarf2/dw2-compressed.exp
index 2265985..a4bc0c0 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-compressed.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-compressed.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-const.S b/gdb/testsuite/gdb.dwarf2/dw2-const.S
index bcf996f..f9d96aa 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-const.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-const.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-const.exp b/gdb/testsuite/gdb.dwarf2/dw2-const.exp
index 8f4a7ed..b9e607a 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-const.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-const.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static-main.c b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static-main.c
index 01dda94..5d4ed5e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static-main.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.S b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.S
index e87136c..449dbb0 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp
index e35d308..5fab31d 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-cu-size.S b/gdb/testsuite/gdb.dwarf2/dw2-cu-size.S
index 99c9df1..f5a5229 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-cu-size.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-cu-size.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-cu-size.exp b/gdb/testsuite/gdb.dwarf2/dw2-cu-size.exp
index 340de7f..df33178 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-cu-size.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-cu-size.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.c b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.c
index 9d8041d..b06c683 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
index 2af573f..8cf941d 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -449,7 +449,7 @@ remote_exec host "sh -c \"for d in $dircreatelist; do cp ${srcdir}/${subdir}/${s
clean_restart ${testfile}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp b/gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp
index aa84a20..eb7a6d8 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,15 +43,15 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {producer "gcc" }
- {language @DW_LANG_C}
- {name ${srcfile3}}
- {low_pc 0 addr}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
+ DW_AT_producer "gcc"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile3}
+ DW_AT_low_pc 0 addr
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {MACRO_AT_func {main}}
+ DW_AT_external 1 flag
+ MACRO_AT_func {main}
}
}
}
@@ -97,7 +97,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S b/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S
index f56dd3c..7e5f8f1 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S
@@ -1,4 +1,4 @@
-/* Copyright 2013-2024 Free Software Foundation, Inc.
+/* Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.exp b/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.exp
index f21f6bf..3bbd5b8 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,8 +29,8 @@ gdb_test_no_output "set breakpoint pending off"
gdb_test "break 'z:file.c':func" {Breakpoint [0-9]+ at .*}
-set dos [expr [istarget "*-*-cygwin*"] || [istarget "i?86-*-mingw*"] \
- || [istarget "*-*-msdosdjgpp*"] || [istarget "*-*-go32*"] ]
+set dos [expr {[istarget "*-*-cygwin*"] || [istarget "i?86-*-mingw*"] \
+ || [istarget "*-*-msdosdjgpp*"] || [istarget "*-*-go32*"]}]
if { $dos } {
gdb_test "break file.c:func" {Breakpoint [0-9]+ at .*}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S b/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S
index 6d473af..6baefed 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.exp
index 2891994..4cd32af 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dummy-cu.S b/gdb/testsuite/gdb.dwarf2/dw2-dummy-cu.S
index 6412883..b53307b 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-dummy-cu.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dummy-cu.S
@@ -1,4 +1,4 @@
-/* Copyright 2015-2024 Free Software Foundation, Inc.
+/* Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dummy-cu.exp b/gdb/testsuite/gdb.dwarf2/dw2-dummy-cu.exp
index 1c3be81..1ce55d5 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-dummy-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dummy-cu.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dup-frame.S b/gdb/testsuite/gdb.dwarf2/dw2-dup-frame.S
index 715f261..d988e13 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-dup-frame.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dup-frame.S
@@ -1,5 +1,5 @@
/*
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dup-frame.c b/gdb/testsuite/gdb.dwarf2/dw2-dup-frame.c
index fc91805..dbe14b8 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-dup-frame.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dup-frame.c
@@ -1,5 +1,5 @@
/*
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dup-frame.exp b/gdb/testsuite/gdb.dwarf2/dw2-dup-frame.exp
index c932abd..6274bbf 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-dup-frame.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dup-frame.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug nopie}
return -1
}
-if ![runto stop_frame] {
+if {![runto stop_frame]} {
perror "Failed to stop in stop_frame"
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-empty-file-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-empty-file-name.exp
index 536cba9..2a32433 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-empty-file-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-file-name.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,13 +33,13 @@ Dwarf::assemble $asm_file {
cu { version 5 } {
compile_unit {
- {language @DW_LANG_C}
- {name $srcfile}
- {stmt_list $Llines DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
+ DW_AT_stmt_list $Llines DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {MACRO_AT_func {main}}
+ DW_AT_external 1 flag
+ MACRO_AT_func {main}
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S
index ce66259..8e33c84 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.exp b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.exp
index 364c354..b087fd6 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.S b/gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.S
index 248df7b..aa460a1 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.S
@@ -1,4 +1,4 @@
-/* Copyright 2011-2024 Free Software Foundation, Inc.
+/* Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.exp b/gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.exp
index 01bc477..fd9890b 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-entry-pc.c b/gdb/testsuite/gdb.dwarf2/dw2-entry-pc.c
index 363781d..4e6012a 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-entry-pc.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-entry-pc.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-entry-pc.exp b/gdb/testsuite/gdb.dwarf2/dw2-entry-pc.exp
index eb4d7cd..1099edb 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-entry-pc.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-entry-pc.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -60,7 +60,7 @@ foreach var { r1_s r1_e r2_s r2_e r3_s r3_e } {
# Line on which 'foo' is declared. Used in generated debug.
set foo_decl_line [gdb_get_line_number "foo decl line"]
-if [is_ilp32_target] {
+if {[is_ilp32_target]} {
set ptr_type "data4"
} else {
set ptr_type "data8"
@@ -87,7 +87,7 @@ proc build_and_runto_main { suffix asm_file } {
return false
}
- if ![runto_main] {
+ if {![runto_main]} {
return false
}
@@ -159,20 +159,20 @@ proc_with_prefix use_low_high_bounds_without_entry_pc { dwarf_vesion } {
cu { version $::dwarf_version } {
compile_unit {
- {producer "gcc"}
- {language @DW_LANG_C}
- {name ${srcfile}}
- {comp_dir /tmp}
- {stmt_list $lines_table DW_FORM_sec_offset}
+ DW_AT_producer "gcc"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile}
+ DW_AT_comp_dir /tmp
+ DW_AT_stmt_list $lines_table DW_FORM_sec_offset
} {
subprogram {
- {name foo}
- {decl_file 1 data1}
- {decl_line $::foo_decl_line data1}
- {decl_column 1 data1}
- {low_pc $::foo_start addr}
- {high_pc $::foo_len $::ptr_type}
- {external 1 flag}
+ DW_AT_name foo
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $::foo_decl_line data1
+ DW_AT_decl_column 1 data1
+ DW_AT_low_pc $::foo_start addr
+ DW_AT_high_pc $::foo_len $::ptr_type
+ DW_AT_external 1 flag
}
}
}
@@ -202,21 +202,21 @@ proc_with_prefix use_low_high_bounds_with_entry_pc { dwarf_version } {
cu { version $::dwarf_version } {
compile_unit {
- {producer "gcc"}
- {language @DW_LANG_C}
- {name ${srcfile}}
- {comp_dir /tmp}
- {stmt_list $lines_table DW_FORM_sec_offset}
+ DW_AT_producer "gcc"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile}
+ DW_AT_comp_dir /tmp
+ DW_AT_stmt_list $lines_table DW_FORM_sec_offset
} {
subprogram {
- {name foo}
- {decl_file 1 data1}
- {decl_line $::foo_decl_line data1}
- {decl_column 1 data1}
- {low_pc $::foo_start addr}
- {high_pc $::foo_len $::ptr_type}
- {external 1 flag}
- {entry_pc foo_middle addr}
+ DW_AT_name foo
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $::foo_decl_line data1
+ DW_AT_decl_column 1 data1
+ DW_AT_low_pc $::foo_start addr
+ DW_AT_high_pc $::foo_len $::ptr_type
+ DW_AT_external 1 flag
+ DW_AT_entry_pc foo_middle addr
}
}
}
@@ -244,25 +244,25 @@ proc_with_prefix use_low_high_bounds_with_entry_offset { dwarf_version } {
declare_labels lines_table
- set foo_offset [expr $::foo_middle_addr - $::foo_start_addr]
+ set foo_offset [expr {$::foo_middle_addr - $::foo_start_addr}]
cu { version $::dwarf_version } {
compile_unit {
- {producer "gcc"}
- {language @DW_LANG_C}
- {name ${srcfile}}
- {comp_dir /tmp}
- {stmt_list $lines_table DW_FORM_sec_offset}
+ DW_AT_producer "gcc"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile}
+ DW_AT_comp_dir /tmp
+ DW_AT_stmt_list $lines_table DW_FORM_sec_offset
} {
subprogram {
- {name foo}
- {decl_file 1 data1}
- {decl_line $::foo_decl_line data1}
- {decl_column 1 data1}
- {low_pc $::foo_start addr}
- {high_pc $::foo_len $::ptr_type}
- {external 1 flag}
- {entry_pc $foo_offset data4}
+ DW_AT_name foo
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $::foo_decl_line data1
+ DW_AT_decl_column 1 data1
+ DW_AT_low_pc $::foo_start addr
+ DW_AT_high_pc $::foo_len $::ptr_type
+ DW_AT_external 1 flag
+ DW_AT_entry_pc $foo_offset data4
}
}
}
@@ -293,20 +293,20 @@ proc_with_prefix use_ranges_without_entry_pc { dwarf_version } {
cu { version $::dwarf_version } {
compile_unit {
- {producer "gcc"}
- {language @DW_LANG_C}
- {name ${srcfile}}
- {comp_dir /tmp}
- {stmt_list $lines_table DW_FORM_sec_offset}
- {low_pc 0 addr}
+ DW_AT_producer "gcc"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile}
+ DW_AT_comp_dir /tmp
+ DW_AT_stmt_list $lines_table DW_FORM_sec_offset
+ DW_AT_low_pc 0 addr
} {
subprogram {
- {name foo}
- {decl_file 1 data1}
- {decl_line $::foo_decl_line data1}
- {decl_column 1 data1}
- {external 1 flag}
- {ranges ${ranges_label} DW_FORM_sec_offset}
+ DW_AT_name foo
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $::foo_decl_line data1
+ DW_AT_decl_column 1 data1
+ DW_AT_external 1 flag
+ DW_AT_ranges ${ranges_label} DW_FORM_sec_offset
}
}
}
@@ -357,21 +357,21 @@ proc_with_prefix use_ranges_with_entry_pc { dwarf_version } {
cu { version $::dwarf_version } {
compile_unit {
- {producer "gcc"}
- {language @DW_LANG_C}
- {name ${srcfile}}
- {comp_dir /tmp}
- {stmt_list $lines_table DW_FORM_sec_offset}
- {low_pc 0 addr}
+ DW_AT_producer "gcc"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile}
+ DW_AT_comp_dir /tmp
+ DW_AT_stmt_list $lines_table DW_FORM_sec_offset
+ DW_AT_low_pc 0 addr
} {
subprogram {
- {name foo}
- {decl_file 1 data1}
- {decl_line $::foo_decl_line data1}
- {decl_column 1 data1}
- {external 1 flag}
- {ranges ${ranges_label} DW_FORM_sec_offset}
- {entry_pc foo_middle addr}
+ DW_AT_name foo
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $::foo_decl_line data1
+ DW_AT_decl_column 1 data1
+ DW_AT_external 1 flag
+ DW_AT_ranges ${ranges_label} DW_FORM_sec_offset
+ DW_AT_entry_pc foo_middle addr
}
}
}
@@ -420,25 +420,25 @@ proc_with_prefix use_ranges_with_entry_offset { dwarf_version } {
declare_labels lines_table ranges_label
- set foo_offset [expr $::foo_middle_addr - $::r1_s]
+ set foo_offset [expr {$::foo_middle_addr - $::r1_s}]
cu { version $::dwarf_version } {
compile_unit {
- {producer "gcc"}
- {language @DW_LANG_C}
- {name ${srcfile}}
- {comp_dir /tmp}
- {stmt_list $lines_table DW_FORM_sec_offset}
- {low_pc 0 addr}
+ DW_AT_producer "gcc"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile}
+ DW_AT_comp_dir /tmp
+ DW_AT_stmt_list $lines_table DW_FORM_sec_offset
+ DW_AT_low_pc 0 addr
} {
subprogram {
- {name foo}
- {decl_file 1 data1}
- {decl_line $::foo_decl_line data1}
- {decl_column 1 data1}
- {external 1 flag}
- {ranges ${ranges_label} DW_FORM_sec_offset}
- {entry_pc $foo_offset data4}
+ DW_AT_name foo
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $::foo_decl_line data1
+ DW_AT_decl_column 1 data1
+ DW_AT_external 1 flag
+ DW_AT_ranges ${ranges_label} DW_FORM_sec_offset
+ DW_AT_entry_pc $foo_offset data4
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-entry-points.c b/gdb/testsuite/gdb.dwarf2/dw2-entry-points.c
index fb76ded..258ebfa 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-entry-points.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-entry-points.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -33,11 +33,28 @@ bar_helper (void)
asm ("foobar_entry_label: .globl foobar_entry_label");
}
+__attribute__ ((noinline))
+void
+barso_helper (void)
+{
+ asm ("barso_helper_label: .globl barso_helper_label");
+ I++;
+ J++;
+ asm ("fooso_entry_label: .globl fooso_entry_label");
+ J++;
+ K++;
+ asm ("foobarso_entry_label: .globl foobarso_entry_label");
+}
+
int
main (void)
{
asm ("main_label: .globl main_label");
bar_helper ();
+ I = 0;
+ J = 0;
+ K = 0;
+ barso_helper ();
return 0;
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp b/gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp
index 632a311..07f5d74 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,6 +36,7 @@ Dwarf::assemble $asm_file {
get_func_info main
get_func_info bar_helper
+ get_func_info barso_helper
set int_size [get_sizeof "int" 4]
@@ -50,69 +51,79 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_Fortran90}
- {name dw2-entry-points.f90}
- {comp_dir /tmp}
+ DW_AT_language @DW_LANG_Fortran90
+ DW_AT_name dw2-entry-points.f90
+ DW_AT_comp_dir /tmp
} {
int_label: base_type {
- {name "int"}
- {byte_size $int_size sdata}
- {encoding @DW_ATE_signed}
+ DW_AT_name "int"
+ DW_AT_byte_size $int_size sdata
+ DW_AT_encoding @DW_ATE_signed
}
subprogram {
- {name prog}
- {decl_file 1 data1}
- {decl_line $prog_line data1}
- {low_pc $main_start addr}
- {high_pc "$main_start + $main_len" addr}
- {external 1 flag}
- {main_subprogram 1 flag}
+ DW_AT_name prog
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $prog_line data1
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc "$main_start + $main_len" addr
+ DW_AT_external 1 flag
+ DW_AT_main_subprogram 1 flag
}
subprogram {
- {name bar}
- {decl_file 1 data1}
- {decl_line $bar_line data1}
- {external 1 flag}
- {low_pc $bar_helper_start addr}
- {high_pc "$bar_helper_start + $bar_helper_len" addr}
+ DW_AT_name bar
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $bar_line data1
+ DW_AT_external 1 flag
+ DW_AT_low_pc $bar_helper_start addr
+ DW_AT_high_pc "$bar_helper_start + $bar_helper_len" addr
} {
formal_parameter {
- {name I}
- {type :$int_label}
- {location {addr $global_I} SPECIAL_expr}
+ DW_AT_name I
+ DW_AT_type :$int_label
+ DW_AT_location {
+ DW_OP_addr $global_I
+ } SPECIAL_expr
}
formal_parameter {
- {name J}
- {type :$int_label}
- {location {addr $global_J} SPECIAL_expr}
+ DW_AT_name J
+ DW_AT_type :$int_label
+ DW_AT_location {
+ DW_OP_addr $global_J
+ } SPECIAL_expr
}
entry_point {
- {name foo}
- {decl_file 1 data1}
- {decl_line $foo_line data1}
- {low_pc foo_entry_label addr}
+ DW_AT_name foo
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $foo_line data1
+ DW_AT_low_pc foo_entry_label addr
} {
formal_parameter {
- {name J}
- {type :$int_label}
- {location {addr $global_J} SPECIAL_expr}
+ DW_AT_name J
+ DW_AT_type :$int_label
+ DW_AT_location {
+ DW_OP_addr $global_J
+ } SPECIAL_expr
}
formal_parameter {
- {name K}
- {type :$int_label}
- {location {addr $global_K} SPECIAL_expr}
+ DW_AT_name K
+ DW_AT_type :$int_label
+ DW_AT_location {
+ DW_OP_addr $global_K
+ } SPECIAL_expr
}
}
entry_point {
- {name foobar}
- {decl_file 1 data1}
- {decl_line $foobar_line data1}
- {low_pc foobar_entry_label addr}
+ DW_AT_name foobar
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $foobar_line data1
+ DW_AT_low_pc foobar_entry_label addr
} {
formal_parameter {
- {name J}
- {type :$int_label}
- {location {addr $global_J} SPECIAL_expr}
+ DW_AT_name J
+ DW_AT_type :$int_label
+ DW_AT_location {
+ DW_OP_addr $global_J
+ } SPECIAL_expr
}
}
}
@@ -121,48 +132,56 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_Fortran90}
- {name dw2-entry-points-2.f90}
- {comp_dir /tmp}
+ DW_AT_language @DW_LANG_Fortran90
+ DW_AT_name dw2-entry-points-2.f90
+ DW_AT_comp_dir /tmp
} {
int2_label: base_type {
- {name "int"}
- {byte_size $int_size sdata}
- {encoding @DW_ATE_signed}
+ DW_AT_name "int"
+ DW_AT_byte_size $int_size sdata
+ DW_AT_encoding @DW_ATE_signed
}
subprogram {
- {name barso}
- {decl_file 1 data1}
- {decl_line $bar_line data1}
- {external 1 flag}
- {low_pc $bar_helper_start addr}
- {high_pc "$bar_helper_start + $bar_helper_len" addr}
+ DW_AT_name barso
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $bar_line data1
+ DW_AT_external 1 flag
+ DW_AT_low_pc $barso_helper_start addr
+ DW_AT_high_pc "$barso_helper_start + $barso_helper_len" addr
} {
formal_parameter {
- {name I}
- {type :$int2_label}
- {location {addr $global_I} SPECIAL_expr}
+ DW_AT_name I
+ DW_AT_type :$int2_label
+ DW_AT_location {
+ DW_OP_addr $global_I
+ } SPECIAL_expr
}
formal_parameter {
- {name J}
- {type :$int2_label}
- {location {addr $global_J} SPECIAL_expr}
+ DW_AT_name J
+ DW_AT_type :$int2_label
+ DW_AT_location {
+ DW_OP_addr $global_J
+ } SPECIAL_expr
}
entry_point {
- {name fooso}
- {decl_file 1 data1}
- {decl_line $foo_line data1}
- {low_pc foo_entry_label addr}
+ DW_AT_name fooso
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $foo_line data1
+ DW_AT_low_pc fooso_entry_label addr
} {
formal_parameter {
- {name J}
- {type :$int2_label}
- {location {addr $global_J} SPECIAL_expr}
+ DW_AT_name J
+ DW_AT_type :$int2_label
+ DW_AT_location {
+ DW_OP_addr $global_J
+ } SPECIAL_expr
}
formal_parameter {
- {name K}
- {type :$int2_label}
- {location {addr $global_K} SPECIAL_expr}
+ DW_AT_name K
+ DW_AT_type :$int2_label
+ DW_AT_location {
+ DW_OP_addr $global_K
+ } SPECIAL_expr
}
}
}
@@ -175,7 +194,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -200,7 +219,7 @@ gdb_test "bt" [multi_line \
clean_restart ${testfile}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-entry-value-2.c b/gdb/testsuite/gdb.dwarf2/dw2-entry-value-2.c
new file mode 100644
index 0000000..57025e0
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-entry-value-2.c
@@ -0,0 +1,32 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int var = 2;
+
+static
+void bar (int *p)
+{
+ asm ("bar_label: .globl bar_label");
+}
+
+int
+main()
+{
+ asm ("main_label: .globl main_label");
+ bar (&var);
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-entry-value-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-entry-value-2.exp
new file mode 100644
index 0000000..2945e1c
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-entry-value-2.exp
@@ -0,0 +1,125 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that we can get DW_OP_entry_value at function entry.
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+require dwarf2_support
+
+standard_testfile .c -debug.S
+
+set test "get dwarf regnum for first argument register"
+if { [is_x86_64_m64_target] } {
+ set dwarf_regnum 5
+} elseif { [istarget riscv64*] } {
+ set dwarf_regnum 10
+} else {
+ set reason "architecture-specific setting missing"
+ unsupported "$test ($reason)"
+ return
+}
+pass $test
+
+# Set up the DWARF for the test.
+
+set asm_file [standard_output_file $srcfile2]
+Dwarf::assemble $asm_file {
+ global srcdir subdir srcfile
+
+ get_func_info main
+ get_func_info bar
+
+ cu {} {
+ DW_TAG_compile_unit {
+ DW_AT_name $srcfile
+ } {
+ declare_labels integer
+
+ integer: DW_TAG_base_type {
+ DW_AT_byte_size 8 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
+ }
+
+ DW_TAG_subprogram {
+ DW_AT_name main
+ DW_AT_low_pc $main_start DW_FORM_addr
+ DW_AT_high_pc $main_end DW_FORM_addr
+ } {
+ DW_TAG_variable {
+ DW_AT_name argc
+ DW_AT_type :$integer
+ DW_AT_location {
+ DW_OP_entry_value {
+ DW_OP_regx $::dwarf_regnum
+ }
+ } SPECIAL_expr
+ }
+ }
+
+ DW_TAG_subprogram {
+ DW_AT_name bar
+ DW_AT_low_pc $bar_start DW_FORM_addr
+ DW_AT_high_pc $bar_end DW_FORM_addr
+ } {
+ DW_TAG_variable {
+ DW_AT_name foo
+ DW_AT_type :$integer
+ DW_AT_location {
+ DW_OP_entry_value {
+ DW_OP_bregx $::dwarf_regnum 0
+ DW_OP_deref_size 4
+ }
+ DW_OP_stack_value
+ } SPECIAL_expr
+ }
+ }
+ }
+ }
+}
+
+if { [prepare_for_testing "failed to prepare" $testfile \
+ [list $srcfile $asm_file] {nodebug}] } {
+ return -1
+}
+
+if { ![runto *main] } {
+ return
+}
+
+with_test_prefix "at main+0" {
+ gdb_test "p argc" " = 1"
+
+ gdb_test "stepi"
+}
+
+with_test_prefix "at main+1" {
+ gdb_test "p argc" " = <optimized out>"
+}
+
+gdb_breakpoint "*bar"
+gdb_continue_to_breakpoint "bar"
+
+with_test_prefix "at bar+0" {
+ gdb_test "p foo" " = 2"
+
+ gdb_test "stepi"
+}
+
+with_test_prefix "at bar+1" {
+ gdb_test "p foo" " = <optimized out>"
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-entry-value-main.c b/gdb/testsuite/gdb.dwarf2/dw2-entry-value-main.c
index 3b547f6..43b55b4 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-entry-value-main.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-entry-value-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-entry-value.S b/gdb/testsuite/gdb.dwarf2/dw2-entry-value.S
index cab4279..2bc5ca2 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-entry-value.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-entry-value.S
@@ -1,4 +1,4 @@
-/* Copyright 2011-2024 Free Software Foundation, Inc.
+/* Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-entry-value.exp b/gdb/testsuite/gdb.dwarf2/dw2-entry-value.exp
index 913ca28..fed0d2e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-entry-value.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-entry-value.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" "dw2-entry-value" {dw2-entry-value
return -1
}
-if ![runto f] {
+if {![runto f]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin-2.exp
index 6302ef1..3781ade 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin-2.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.c b/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.c
index 4ff445c..92640d4 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.c.inc b/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.c.inc
index 4ff445c..92640d4 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.c.inc
+++ b/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.c.inc
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp b/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp
index 9b9d6c7..e1ee3be 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp.tcl b/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp.tcl
index 155916b..9c0622c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp.tcl
+++ b/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -56,42 +56,42 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name dw2-prologue-end.c}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
- {producer "clang version 17.0.1"}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name dw2-prologue-end.c
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
+ DW_AT_producer "clang version 17.0.1"
} {
declare_labels char_label
char_label: base_type {
- {name char}
- {encoding @DW_ATE_signed}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name char
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 1 DW_FORM_sdata
}
subprogram {
- {external 1 flag}
- {name trivial}
- {low_pc $trivial_start addr}
- {high_pc "$trivial_start + $trivial_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name trivial
+ DW_AT_low_pc $trivial_start addr
+ DW_AT_high_pc "$trivial_start + $trivial_len" addr
}
subprogram {
- {external 1 flag}
- {name watch}
- {low_pc $watch_start addr}
- {high_pc "$watch_start + $watch_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name watch
+ DW_AT_low_pc $watch_start addr
+ DW_AT_high_pc "$watch_start + $watch_len" addr
} {
DW_TAG_variable {
- {name local}
- {type :$char_label}
- {DW_AT_location {DW_OP_reg0} SPECIAL_expr}
+ DW_AT_name local
+ DW_AT_type :$char_label
+ DW_AT_location {DW_OP_reg0} SPECIAL_expr
}
}
subprogram {
- {external 1 flag}
- {name main}
- {low_pc $main_start addr}
- {high_pc "$main_start + $main_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc "$main_start + $main_len" addr
}
}
}
@@ -169,7 +169,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-error.S b/gdb/testsuite/gdb.dwarf2/dw2-error.S
index 17d3117..12cedf8 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-error.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-error.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-error.c b/gdb/testsuite/gdb.dwarf2/dw2-error.c
index 445b206..c20cbe3 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-error.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-error.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-error.exp b/gdb/testsuite/gdb.dwarf2/dw2-error.exp
index 526b394..0701ec6 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-error.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-error.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ set host_binfile [gdb_remote_download host $binfile]
# First test that reading symbols fails.
gdb_test "file $host_binfile" \
- {Reading symbols.*DWARF Error: wrong version in compilation unit header \(is 153, should be 2, 3, 4 or 5\).*} \
+ {Reading symbols.*DWARF Error: wrong version in unit header \(is 153, should be 2, 3, 4 or 5\).*} \
"file $testfile"
# We can't use proc readnow, because the PR makes it return 0.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-filename.S b/gdb/testsuite/gdb.dwarf2/dw2-filename.S
index 861c035..0fa5769 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-filename.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-filename.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-filename.exp b/gdb/testsuite/gdb.dwarf2/dw2-filename.exp
index 4ed151f..0b41a8c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-filename.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-filename.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c
index 2789e6a..145cdaf 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c
@@ -1,4 +1,4 @@
-/* Copyright 2016-2024 Free Software Foundation, Inc.
+/* Copyright 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp
index bcb5eec..66adcc8 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,91 +23,91 @@ standard_testfile dw2-fixed-point.c dw2-fixed-point-dw.S
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
- DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_Ada95}
- {DW_AT_name pck.ads}
- {DW_AT_comp_dir /tmp}
- } {
- declare_labels fp1_base_type fp2_base_type fp3_small \
- fp3_base_type fp1_range_type
-
- fp1_base_type: DW_TAG_base_type {
- {DW_AT_byte_size 1 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed_fixed}
- {DW_AT_name pck__fp1_type}
- {DW_AT_binary_scale -4 DW_FORM_sdata}
- }
-
- DW_TAG_variable {
- {DW_AT_name pck__fp1_var}
- {DW_AT_type :$fp1_base_type}
- {DW_AT_location {
- DW_OP_addr [gdb_target_symbol pck__fp1_var]
- } SPECIAL_expr}
- {external 1 flag}
- }
-
- DW_TAG_variable {
- {DW_AT_name pck__fp1_var2}
- {DW_AT_type :$fp1_base_type}
- {DW_AT_location {
- DW_OP_addr [gdb_target_symbol pck__fp1_var2]
- } SPECIAL_expr}
- {external 1 flag}
- }
-
- fp2_base_type: DW_TAG_base_type {
- {DW_AT_byte_size 1 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed_fixed}
- {DW_AT_name pck__fp2_type}
- {DW_AT_decimal_scale -2 DW_FORM_sdata}
- }
-
- DW_TAG_variable {
- {DW_AT_name pck__fp2_var}
- {DW_AT_type :$fp2_base_type}
- {DW_AT_location {
- DW_OP_addr [gdb_target_symbol pck__fp2_var]
- } SPECIAL_expr}
- {external 1 flag}
- }
-
- fp3_small: DW_TAG_constant {
- {DW_AT_GNU_numerator 1 DW_FORM_data1}
- {DW_AT_GNU_denominator 30 DW_FORM_sdata}
- }
-
- fp3_base_type: DW_TAG_base_type {
- {DW_AT_byte_size 1 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed_fixed}
- {DW_AT_name pck__fp3_type}
- {DW_AT_small :$fp3_small}
- }
-
- DW_TAG_variable {
- {DW_AT_name pck__fp3_var}
- {DW_AT_type :$fp3_base_type}
- {DW_AT_location {
- DW_OP_addr [gdb_target_symbol pck__fp3_var]
- } SPECIAL_expr}
- {external 1 flag}
- }
-
- fp1_range_type: DW_TAG_subrange_type {
- {DW_AT_lower_bound 0xf0 DW_FORM_data1}
- {DW_AT_upper_bound 0x10 DW_FORM_data1}
- {DW_AT_name foo__fp1_range_type}
- {DW_AT_type :$fp1_base_type}
- }
-
- DW_TAG_variable {
- {DW_AT_name pck__fp1_range_var}
- {DW_AT_type :$fp1_range_type}
- {DW_AT_location {
- DW_OP_addr [gdb_target_symbol pck__fp1_range_var]
- } SPECIAL_expr}
- {external 1 flag}
- }
+ DW_TAG_compile_unit {
+ DW_AT_language @DW_LANG_Ada95
+ DW_AT_name pck.ads
+ DW_AT_comp_dir /tmp
+ } {
+ declare_labels fp1_base_type fp2_base_type fp3_small \
+ fp3_base_type fp1_range_type
+
+ fp1_base_type: DW_TAG_base_type {
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed_fixed
+ DW_AT_name pck__fp1_type
+ DW_AT_binary_scale -4 DW_FORM_sdata
+ }
+
+ DW_TAG_variable {
+ DW_AT_name pck__fp1_var
+ DW_AT_type :$fp1_base_type
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol pck__fp1_var]
+ } SPECIAL_expr
+ DW_AT_external 1 flag
+ }
+
+ DW_TAG_variable {
+ DW_AT_name pck__fp1_var2
+ DW_AT_type :$fp1_base_type
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol pck__fp1_var2]
+ } SPECIAL_expr
+ DW_AT_external 1 flag
+ }
+
+ fp2_base_type: DW_TAG_base_type {
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed_fixed
+ DW_AT_name pck__fp2_type
+ DW_AT_decimal_scale -2 DW_FORM_sdata
+ }
+
+ DW_TAG_variable {
+ DW_AT_name pck__fp2_var
+ DW_AT_type :$fp2_base_type
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol pck__fp2_var]
+ } SPECIAL_expr
+ DW_AT_external 1 flag
+ }
+
+ fp3_small: DW_TAG_constant {
+ DW_AT_GNU_numerator 1 DW_FORM_data1
+ DW_AT_GNU_denominator 30 DW_FORM_sdata
+ }
+
+ fp3_base_type: DW_TAG_base_type {
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed_fixed
+ DW_AT_name pck__fp3_type
+ DW_AT_small :$fp3_small
+ }
+
+ DW_TAG_variable {
+ DW_AT_name pck__fp3_var
+ DW_AT_type :$fp3_base_type
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol pck__fp3_var]
+ } SPECIAL_expr
+ DW_AT_external 1 flag
+ }
+
+ fp1_range_type: DW_TAG_subrange_type {
+ DW_AT_lower_bound 0xf0 DW_FORM_data1
+ DW_AT_upper_bound 0x10 DW_FORM_data1
+ DW_AT_name foo__fp1_range_type
+ DW_AT_type :$fp1_base_type
+ }
+
+ DW_TAG_variable {
+ DW_AT_name pck__fp1_range_var
+ DW_AT_type :$fp1_range_type
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol pck__fp1_range_var]
+ } SPECIAL_expr
+ DW_AT_external 1 flag
+ }
}
}
}
@@ -117,7 +117,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp b/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp
index 5d6e13a..8c09406 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ load_lib dwarf.exp
# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support
-standard_testfile dw2-lines.c -dw2.S
+standard_testfile dw2-lines.c -dw2.S -dw2-one-diridx.S
with_shared_gdb {
set func_info_vars [get_func_info bar]
@@ -30,52 +30,64 @@ with_shared_gdb {
proc line_for { l } {
global srcfile
set line [gdb_get_line_number "$l:" $srcfile]
- return [expr $line + 1]
+ return [expr {$line + 1}]
}
-set asm_file [standard_output_file $srcfile2]
-Dwarf::assemble $asm_file {
- declare_labels Llines
- global srcdir subdir srcfile objdir
- global func_info_vars
- foreach var $func_info_vars {
- global $var
- }
+# A helper proc to create the DWARF assembly for the test.
+# If ONE_DIRIDX is true, then the directory table will be limited
+# to one entry.
+proc create_dwarf_assembly {source_file one_diridx} {
+ set asm_file [standard_output_file $source_file]
+ Dwarf::assemble $asm_file {
+ declare_labels Llines
+ global srcdir subdir srcfile objdir
+ global func_info_vars
+ upvar one_diridx one_diridx
+ foreach var $func_info_vars {
+ global $var
+ }
- cu { version 5 } {
- compile_unit {
- {language @DW_LANG_Mips_Assembler}
- {name $srcfile}
- {comp_dir $objdir}
- {stmt_list $Llines DW_FORM_sec_offset}
- {producer "GNU AS 2.35.2"}
- } {
- subprogram {
- {external 1 flag}
- {name bar}
- {low_pc $bar_start addr}
- {high_pc "$bar_start + $bar_len" addr}
+ cu { version 5 } {
+ compile_unit {
+ DW_AT_language @DW_LANG_Mips_Assembler
+ DW_AT_name $srcfile
+ DW_AT_comp_dir $objdir
+ DW_AT_stmt_list $Llines DW_FORM_sec_offset
+ DW_AT_producer "GNU AS 2.35.2"
+ } {
+ subprogram {
+ DW_AT_external 1 flag
+ DW_AT_name bar
+ DW_AT_low_pc $bar_start addr
+ DW_AT_high_pc "$bar_start + $bar_len" addr
+ }
}
}
- }
- lines [list version 5] Llines {
- set diridx1 [include_dir "${srcdir}/${subdir}"]
- set diridx2 [include_dir "${srcdir}/${subdir}"]
- file_name "$srcfile" $diridx1
- file_name "$srcfile" $diridx2
-
- program {
- DW_LNE_set_address bar_label
- line [line_for bar_label]
- DW_LNS_copy
+ lines [list version 5] Llines {
+ set diridx1 [include_dir "${srcdir}/${subdir}"]
+ file_name "$srcfile" $diridx1
+ if {!$one_diridx} {
+ set diridx2 [include_dir "${srcdir}/${subdir}"]
+ file_name "$srcfile" $diridx2
+ } else {
+ file_name "$srcfile" $diridx1
+ }
+ program {
+ DW_LNE_set_address bar_label
+ line [line_for bar_label]
+ DW_LNS_copy
- DW_LNE_set_address $bar_end
- DW_LNE_end_sequence
+ DW_LNE_set_address $bar_end
+ DW_LNE_end_sequence
+ }
}
}
+
+ return $asm_file
}
+set asm_file [create_dwarf_assembly $srcfile2 false]
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
return -1
@@ -90,3 +102,13 @@ gdb_test_multiple "ptype bar" "" {
pass $gdb_test_name
}
}
+
+# Test whether gdb crashes in the case where the number of
+# directory indexes is only one.
+set asm_file [create_dwarf_assembly $srcfile3 true]
+if {[prepare_for_testing "failed to prepare" ${testfile}-one-diridx \
+ [list $srcfile $asm_file] {nodebug}] } {
+ return -1
+}
+
+gdb_test "ptype bar" ".*" "do not crash with only one directory table entry"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S b/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S
index ef627d9..1720da6 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.exp b/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.exp
index e1df8bf..780fc17 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-icycle.S b/gdb/testsuite/gdb.dwarf2/dw2-icycle.S
index b5bed5a..1b908ab 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-icycle.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp b/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp
index 2675f70..106e14f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c
index 643f85f..bfed504 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp
index e05727b..a77b430 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,28 +29,28 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {name file1.txt}
- {language @DW_LANG_C}
- {MACRO_AT_range { func }}
+ DW_AT_name file1.txt
+ DW_AT_language @DW_LANG_C
+ MACRO_AT_range { func }
} {
int_label: base_type {
- {name int}
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
+ DW_AT_name int
+ DW_AT_byte_size 4 sdata
+ DW_AT_encoding @DW_ATE_signed
}
subprogram {
- {external 1 flag}
- {MACRO_AT_func { func }}
+ DW_AT_external 1 flag
+ MACRO_AT_func { func }
} {
formal_parameter {
- {name param}
- {variable_parameter 1 flag}
- {type :$int_label}
- {location {
- addr [gdb_target_symbol ptr]
- deref
- } SPECIAL_expr}
+ DW_AT_name param
+ DW_AT_variable_parameter 1 flag
+ DW_AT_type :$int_label
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol ptr]
+ DW_OP_deref
+ } SPECIAL_expr
}
}
}
@@ -62,7 +62,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto func] {
+if {![runto func]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inheritance.S b/gdb/testsuite/gdb.dwarf2/dw2-inheritance.S
index a6ee159..a84fe38 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inheritance.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inheritance.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inheritance.exp b/gdb/testsuite/gdb.dwarf2/dw2-inheritance.exp
index ed3162c..84b3db0 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inheritance.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inheritance.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-break.S b/gdb/testsuite/gdb.dwarf2/dw2-inline-break.S
index 056c5e1..1fec5db 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-break.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-break.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-break.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-break.exp
index 2e6f711..de7cd2b 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-break.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-break.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
index 1f30c5c..99f0080 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -78,29 +78,29 @@ proc do_test { start_label func_name tag } {
cu {} {
compile_unit {
- {producer "gcc" }
- {language @DW_LANG_C}
- {name ${srcfile3}}
- {low_pc 0 addr}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
+ DW_AT_producer "gcc"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile3}
+ DW_AT_low_pc 0 addr
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
} {
callee_subprog_label: subprogram {
- {external 1 flag}
- {name callee}
- {inline 3 data1}
+ DW_AT_external 1 flag
+ DW_AT_name callee
+ DW_AT_inline 3 data1
}
subprogram {
- {external 1 flag}
- {name main}
- {low_pc $main_start addr}
- {high_pc "$main_start + $main_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc "$main_start + $main_len" addr
} {
inlined_subroutine {
- {abstract_origin %$callee_subprog_label}
- {low_pc $start_label addr}
- {high_pc line_label_6 addr}
- {call_file 1 data1}
- {call_line 18 data1}
+ DW_AT_abstract_origin %$callee_subprog_label
+ DW_AT_low_pc $start_label addr
+ DW_AT_high_pc line_label_6 addr
+ DW_AT_call_file 1 data1
+ DW_AT_call_line 18 data1
}
}
}
@@ -157,7 +157,7 @@ proc do_test { start_label func_name tag } {
return -1
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
index 4fd4c5a..8d68aa1 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -68,29 +68,29 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {producer "gcc" }
- {language @DW_LANG_C}
- {name ${srcfile3}}
- {low_pc 0 addr}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
+ DW_AT_producer "gcc"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile3}
+ DW_AT_low_pc 0 addr
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
} {
callee_subprog_label: subprogram {
- {external 1 flag}
- {name callee}
- {inline 3 data1}
+ DW_AT_external 1 flag
+ DW_AT_name callee
+ DW_AT_inline 3 data1
}
subprogram {
- {external 1 flag}
- {name main}
- {low_pc $main_start addr}
- {high_pc "$main_start + $main_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc "$main_start + $main_len" addr
} {
inlined_subroutine {
- {abstract_origin %$callee_subprog_label}
- {low_pc line_label_3 addr}
- {high_pc line_label_5 addr}
- {call_file 1 data1}
- {call_line 18 data1}
+ DW_AT_abstract_origin %$callee_subprog_label
+ DW_AT_low_pc line_label_3 addr
+ DW_AT_high_pc line_label_5 addr
+ DW_AT_call_file 1 data1
+ DW_AT_call_line 18 data1
}
}
}
@@ -145,7 +145,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
index 1b8d136..77a64a2 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -57,29 +57,29 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {producer "gcc" }
- {language @DW_LANG_C}
- {name ${srcfile3}}
- {low_pc 0 addr}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
+ DW_AT_producer "gcc"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile3}
+ DW_AT_low_pc 0 addr
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
} {
callee_subprog_label: subprogram {
- {external 1 flag}
- {name callee}
- {inline 3 data1}
+ DW_AT_external 1 flag
+ DW_AT_name callee
+ DW_AT_inline 3 data1
}
subprogram {
- {external 1 flag}
- {name main}
- {low_pc $main_start addr}
- {high_pc "$main_start + $main_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc "$main_start + $main_len" addr
} {
inlined_subroutine {
- {abstract_origin %$callee_subprog_label}
- {low_pc line_label_3 addr}
- {high_pc line_label_5 addr}
- {call_file 1 data1}
- {call_line 18 data1}
+ DW_AT_abstract_origin %$callee_subprog_label
+ DW_AT_low_pc line_label_3 addr
+ DW_AT_high_pc line_label_5 addr
+ DW_AT_call_file 1 data1
+ DW_AT_call_line 18 data1
}
}
}
@@ -134,7 +134,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-lbls.c b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-lbls.c
index 17e93c5..2190e78 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-lbls.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-lbls.c
@@ -1,4 +1,4 @@
-/* Copyright 2020-2024 Free Software Foundation, Inc.
+/* Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header.c b/gdb/testsuite/gdb.dwarf2/dw2-inline-header.c
index 1615f4d..0b73fa2 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header.c
@@ -1,4 +1,4 @@
-/* Copyright 2020-2024 Free Software Foundation, Inc.
+/* Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header.h b/gdb/testsuite/gdb.dwarf2/dw2-inline-header.h
index 7a6f0b9..c957777 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header.h
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header.h
@@ -1,4 +1,4 @@
-/* Copyright 2020-2024 Free Software Foundation, Inc.
+/* Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.c b/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.c
index af74b68..93cfb7c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.c
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp
index cffe594..e97f325 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -58,116 +58,116 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name dw2-inline-stepping.c}
- {low_pc 0 addr}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
- {ranges ${ranges_label} DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name dw2-inline-stepping.c
+ DW_AT_low_pc 0 addr
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
+ DW_AT_ranges ${ranges_label} DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {name ddd}
- {low_pc $ddd_start addr}
- {high_pc "$ddd_start + $ddd_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name ddd
+ DW_AT_low_pc $ddd_start addr
+ DW_AT_high_pc "$ddd_start + $ddd_len" addr
}
subprogram {
- {external 1 flag}
- {name eee}
- {low_pc $eee_start addr}
- {high_pc "$eee_start + $eee_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name eee
+ DW_AT_low_pc $eee_start addr
+ DW_AT_high_pc "$eee_start + $eee_len" addr
}
subprogram {
- {external 1 flag}
- {name jjj}
- {low_pc $jjj_start addr}
- {high_pc "$jjj_start + $jjj_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name jjj
+ DW_AT_low_pc $jjj_start addr
+ DW_AT_high_pc "$jjj_start + $jjj_len" addr
}
subprogram {
- {external 1 flag}
- {name kkk}
- {low_pc $kkk_start addr}
- {high_pc "$kkk_start + $kkk_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name kkk
+ DW_AT_low_pc $kkk_start addr
+ DW_AT_high_pc "$kkk_start + $kkk_len" addr
}
aaa_label: subprogram {
- {name aaa}
- {inline 3 data1}
+ DW_AT_name aaa
+ DW_AT_inline 3 data1
}
bbb_label: subprogram {
- {name bbb}
- {inline 3 data1}
+ DW_AT_name bbb
+ DW_AT_inline 3 data1
}
ccc_label: subprogram {
- {name ccc}
- {inline 3 data1}
+ DW_AT_name ccc
+ DW_AT_inline 3 data1
}
ggg_label: subprogram {
- {name ggg}
- {inline 3 data1}
+ DW_AT_name ggg
+ DW_AT_inline 3 data1
}
hhh_label: subprogram {
- {name hhh}
- {inline 3 data1}
+ DW_AT_name hhh
+ DW_AT_inline 3 data1
}
iii_label: subprogram {
- {name iii}
- {inline 3 data1}
+ DW_AT_name iii
+ DW_AT_inline 3 data1
}
subprogram {
- {external 1 flag}
- {name main}
- {low_pc $main_start addr}
- {high_pc "$main_start + $main_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc "$main_start + $main_len" addr
} {
inlined_subroutine {
- {abstract_origin %$aaa_label}
- {low_pc main_label2 addr}
- {high_pc main_label3 addr}
- {call_file 1 data1}
- {call_line $call_in_main data1}
+ DW_AT_abstract_origin %$aaa_label
+ DW_AT_low_pc main_label2 addr
+ DW_AT_high_pc main_label3 addr
+ DW_AT_call_file 1 data1
+ DW_AT_call_line $call_in_main data1
} {
inlined_subroutine {
- {abstract_origin %$bbb_label}
- {low_pc main_label2 addr}
- {high_pc main_label3 addr}
- {call_file 1 data1}
- {call_line $call_in_aaa data1}
+ DW_AT_abstract_origin %$bbb_label
+ DW_AT_low_pc main_label2 addr
+ DW_AT_high_pc main_label3 addr
+ DW_AT_call_file 1 data1
+ DW_AT_call_line $call_in_aaa data1
} {
inlined_subroutine {
- {abstract_origin %$ccc_label}
- {low_pc main_label2 addr}
- {high_pc main_label3 addr}
- {call_file 1 data1}
- {call_line $call_in_bbb data1}
+ DW_AT_abstract_origin %$ccc_label
+ DW_AT_low_pc main_label2 addr
+ DW_AT_high_pc main_label3 addr
+ DW_AT_call_file 1 data1
+ DW_AT_call_line $call_in_bbb data1
}
}
}
}
subprogram {
- {external 1 flag}
- {name fff}
- {low_pc $fff_start addr}
- {high_pc "$fff_start + $fff_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name fff
+ DW_AT_low_pc $fff_start addr
+ DW_AT_high_pc "$fff_start + $fff_len" addr
} {
inlined_subroutine {
- {abstract_origin %$ggg_label}
- {low_pc fff_label addr}
- {high_pc main_label2 addr}
- {call_file 1 data1}
- {call_line $call_in_fff data1}
+ DW_AT_abstract_origin %$ggg_label
+ DW_AT_low_pc fff_label addr
+ DW_AT_high_pc main_label2 addr
+ DW_AT_call_file 1 data1
+ DW_AT_call_line $call_in_fff data1
} {
inlined_subroutine {
- {abstract_origin %$hhh_label}
- {low_pc fff_label addr}
- {high_pc fff_label2 addr}
- {call_file 1 data1}
- {call_line $call_in_ggg data1}
+ DW_AT_abstract_origin %$hhh_label
+ DW_AT_low_pc fff_label addr
+ DW_AT_high_pc fff_label2 addr
+ DW_AT_call_file 1 data1
+ DW_AT_call_line $call_in_ggg data1
} {
inlined_subroutine {
- {abstract_origin %$iii_label}
- {low_pc fff_label addr}
- {high_pc fff_label2 addr}
- {call_file 1 data1}
- {call_line $call_in_hhh data1}
+ DW_AT_abstract_origin %$iii_label
+ DW_AT_low_pc fff_label addr
+ DW_AT_high_pc fff_label2 addr
+ DW_AT_call_file 1 data1
+ DW_AT_call_line $call_in_hhh data1
}
}
}
@@ -289,7 +289,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-param-main.c b/gdb/testsuite/gdb.dwarf2/dw2-inline-param-main.c
index 424e53a..2f646fb 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-param-main.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-param-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-param.S b/gdb/testsuite/gdb.dwarf2/dw2-inline-param.S
index 52221fc..7f49db3 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-param.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-param.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp
index 0f829c7..c4cc63c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ gdb_unload
set objcopy_program [gdb_find_objcopy]
set command "$objcopy_program -N block_start -N block_end -N break_at ${binfile} ${binfile_stripped}"
verbose -log "Executing: $command"
-set result [catch "exec $command" output]
+set result [catch {exec {*}$command} output]
verbose "result is $result"
verbose "output is $output"
if {$result != 0} {
@@ -51,7 +51,7 @@ if {$result != 0} {
gdb_load ${binfile_stripped}
-if ![runto "*${break_at}"] {
+if {![runto "*${break_at}"]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func-lbls.c b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func-lbls.c
index 9621b52..e3e1fc4 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func-lbls.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func-lbls.c
@@ -1,4 +1,4 @@
-/* Copyright 2020-2024 Free Software Foundation, Inc.
+/* Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.c b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.c
index b65630e..b9309a8 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.c
@@ -1,4 +1,4 @@
-/* Copyright 2020-2024 Free Software Foundation, Inc.
+/* Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp
index ed71669..0e9b0a2 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,29 +47,29 @@ Dwarf::assemble $asm_file {
# time of writing this, GCC for x86-64 doesn't make use of
# skip_prologue_using_sal, while clang does.
compile_unit {
- {producer "clang xxxx" }
- {language @DW_LANG_C}
- {name ${srcfile3}}
- {low_pc 0 addr}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
+ DW_AT_producer "clang xxxx"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile3}
+ DW_AT_low_pc 0 addr
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
} {
callee_subprog_label: subprogram {
- {external 1 flag}
- {name callee}
- {inline 3 data1}
+ DW_AT_external 1 flag
+ DW_AT_name callee
+ DW_AT_inline 3 data1
}
subprogram {
- {external 1 flag}
- {name main}
- {low_pc $main_start addr}
- {high_pc "$main_start + $main_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc "$main_start + $main_len" addr
} {
inlined_subroutine {
- {abstract_origin %$callee_subprog_label}
- {low_pc line_label_1 addr}
- {high_pc line_label_2 addr}
- {call_file 1 data1}
- {call_line 21 data1}
+ DW_AT_abstract_origin %$callee_subprog_label
+ DW_AT_low_pc line_label_1 addr
+ DW_AT_high_pc line_label_2 addr
+ DW_AT_call_file 1 data1
+ DW_AT_call_line 21 data1
}
}
}
@@ -123,7 +123,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.h b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.h
index 2bfce4e..a40a021 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.h
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.h
@@ -1,4 +1,4 @@
-/* Copyright 2020-2024 Free Software Foundation, Inc.
+/* Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.c b/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.c
index 109a372..3efec3c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.c
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp
index daf1893..e20e355 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -49,34 +49,34 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name dw2-inline-stepping.c}
- {low_pc 0 addr}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
- {ranges ${ranges_label} DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name dw2-inline-stepping.c
+ DW_AT_low_pc 0 addr
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
+ DW_AT_ranges ${ranges_label} DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {name bar}
- {low_pc $bar_start addr}
- {high_pc "$bar_start + $bar_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name bar
+ DW_AT_low_pc $bar_start addr
+ DW_AT_high_pc "$bar_start + $bar_len" addr
}
foo_prog: subprogram {
- {name foo}
- {inline 3 data1}
+ DW_AT_name foo
+ DW_AT_inline 3 data1
}
subprogram {
- {external 1 flag}
- {name main}
- {low_pc $main_start addr}
- {high_pc "$main_start + $main_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc "$main_start + $main_len" addr
} {
inlined_subroutine {
- {abstract_origin %$foo_prog}
- {low_pc main_label2 addr}
- {high_pc main_label3 addr}
- {call_file 1 data1}
- {call_line $call_line data1}
+ DW_AT_abstract_origin %$foo_prog
+ DW_AT_low_pc main_label2 addr
+ DW_AT_high_pc main_label3 addr
+ DW_AT_call_file 1 data1
+ DW_AT_call_line $call_line data1
}
}
}
@@ -126,7 +126,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-with-lexical-scope.c b/gdb/testsuite/gdb.dwarf2/dw2-inline-with-lexical-scope.c
index c1446ec..cc52104 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-with-lexical-scope.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-with-lexical-scope.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-with-lexical-scope.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-with-lexical-scope.exp
index 20836e0..8eaa3a1 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-with-lexical-scope.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-with-lexical-scope.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,59 +43,63 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C99}
- {name $srcfile}
- {low_pc $main_start addr}
- {high_pc "$main_start + $main_len" addr}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C99
+ DW_AT_name $srcfile
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc "$main_start + $main_len" addr
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
} {
int_label: base_type {
- {name "int"}
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
+ DW_AT_name "int"
+ DW_AT_byte_size 4 sdata
+ DW_AT_encoding @DW_ATE_signed
}
func_label: subprogram {
- {name func}
- {inline @DW_INL_declared_inlined}
+ DW_AT_name func
+ DW_AT_inline @DW_INL_declared_inlined
} {
num_label: DW_TAG_variable {
- {name num}
- {type :$int_label}
+ DW_AT_name num
+ DW_AT_type :$int_label
}
lexical_block {
} {
value_label: DW_TAG_variable {
- {name value}
- {type :$int_label}
+ DW_AT_name value
+ DW_AT_type :$int_label
}
}
}
subprogram {
- {name main}
- {external 1 flag}
- {low_pc $main_start addr}
- {high_pc "$main_start + $main_len" addr}
+ DW_AT_name main
+ DW_AT_external 1 flag
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc "$main_start + $main_len" addr
} {
inlined_subroutine {
- {abstract_origin %$func_label}
- {low_pc main_label addr}
- {high_pc main_label2 addr}
- {call_file 1 data1}
- {call_line $func_call data1}
+ DW_AT_abstract_origin %$func_label
+ DW_AT_low_pc main_label addr
+ DW_AT_high_pc main_label2 addr
+ DW_AT_call_file 1 data1
+ DW_AT_call_line $func_call data1
} {
DW_TAG_variable {
- {abstract_origin %$num_label}
- {location {addr $global_num_addr} SPECIAL_expr}
+ DW_AT_abstract_origin %$num_label
+ DW_AT_location {
+ DW_OP_addr $global_num_addr
+ } SPECIAL_expr
}
lexical_block {
- {low_pc scope_label1 addr}
- {high_pc scope_label2 addr}
+ DW_AT_low_pc scope_label1 addr
+ DW_AT_high_pc scope_label2 addr
} {
DW_TAG_variable {
- {abstract_origin %$value_label}
- {location {addr $global_value_addr} SPECIAL_expr}
+ DW_AT_abstract_origin %$value_label
+ DW_AT_location {
+ DW_OP_addr $global_value_addr
+ } SPECIAL_expr
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error-2.exp
index 25daae8..f517807 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error-2.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,10 +29,12 @@ Dwarf::assemble $asm_file {
declare_labels label1
cu {} {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
subprogram {
- {MACRO_AT_range { main }}
- {DW_AT_specification %$label1}
+ MACRO_AT_range { main }
+ DW_AT_specification %$label1
}
}
}
@@ -41,8 +43,8 @@ Dwarf::assemble $asm_file {
}
}
-if [build_executable "failed to prepare" $testfile \
- [list $asm_file $srcfile] {nodebug}] {
+if {[build_executable "failed to prepare" $testfile \
+ [list $asm_file $srcfile] {nodebug}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error.exp b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error.exp
index 5de2790..6d3d86b 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,23 +26,27 @@ Dwarf::assemble $asm_file {
declare_labels label1
cu {} {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
subprogram {
- {MACRO_AT_range { main }}
- {DW_AT_specification %$label1}
+ MACRO_AT_range { main }
+ DW_AT_specification %$label1
}
}
}
cu {} {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
label1:
}
}
}
-if [build_executable "failed to prepare" $testfile \
- [list $asm_file $srcfile] {nodebug}] {
+if {[build_executable "failed to prepare" $testfile \
+ [list $asm_file $srcfile] {nodebug}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-forth-and-back.exp b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-forth-and-back.exp
index 62674bd..b15d13d 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-forth-and-back.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-forth-and-back.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,29 +30,33 @@ Dwarf::assemble $asm_file {
declare_labels label1 label2
cu {} {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
subprogram {
- {MACRO_AT_range { main }}
- {DW_AT_specification %$label1}
+ MACRO_AT_range { main }
+ DW_AT_specification %$label1
}
label2: subprogram {
- {DW_AT_name main}
+ DW_AT_name main
}
}
}
cu {} {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
label1: subprogram {
- {DW_AT_specification %$label2}
+ DW_AT_specification %$label2
}
}
}
}
-if [prepare_for_testing "failed to prepare" $testfile \
- [list $asm_file $srcfile] {nodebug}] {
+if {[prepare_for_testing "failed to prepare" $testfile \
+ [list $asm_file $srcfile] {nodebug}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-symbol.exp b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-symbol.exp
index 13a6993..7fbe22e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-symbol.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-symbol.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,36 +27,36 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {stmt_list $L1 DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_stmt_list $L1 DW_FORM_sec_offset
} {
tag_variable {
- {name var1}
- {abstract_origin %$var_label}
- {const_value 1 DW_FORM_sdata}
+ DW_AT_name var1
+ DW_AT_abstract_origin %$var_label
+ DW_AT_const_value 1 DW_FORM_sdata
}
subprogram {
- {external 1 flag}
- {MACRO_AT_func {main}}
+ DW_AT_external 1 flag
+ MACRO_AT_func {main}
}
int_label: base_type {
- {byte_size 4 udata}
- {encoding @DW_ATE_signed}
- {name int}
+ DW_AT_byte_size 4 udata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
}
}
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {stmt_list $L2 DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_stmt_list $L2 DW_FORM_sec_offset
} {
var_label: tag_variable {
- {name "var1"}
- {type %$int_label}
- {decl_file 1}
- {decl_line 1}
+ DW_AT_name "var1"
+ DW_AT_type %$int_label
+ DW_AT_decl_file 1
+ DW_AT_decl_line 1
}
}
}
@@ -77,7 +77,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto main] {
+if {![runto main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-intercu.S b/gdb/testsuite/gdb.dwarf2/dw2-intercu.S
index 36e6031..879b4b0 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-intercu.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-intercu.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-intercu.exp b/gdb/testsuite/gdb.dwarf2/dw2-intercu.exp
index b81cb3e..f7ed241 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-intercu.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-intercu.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-intermix.S b/gdb/testsuite/gdb.dwarf2/dw2-intermix.S
index 1dd1071..04be4b6 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-intermix.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-intermix.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2005-2024 Free Software Foundation, Inc.
+ Copyright 2005-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-intermix.exp b/gdb/testsuite/gdb.dwarf2/dw2-intermix.exp
index 6fde81c..43b0028 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-intermix.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-intermix.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.c b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.c
index 1c106d3..ce22120 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.c
@@ -1,4 +1,4 @@
-/* Copyright 2020-2024 Free Software Foundation, Inc.
+/* Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp
index 6842013..4da14d8 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,16 +42,16 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name dw2-is-stmt.c}
- {low_pc 0 addr}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name dw2-is-stmt.c
+ DW_AT_low_pc 0 addr
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {name main}
- {low_pc $main_start addr}
- {high_pc "$main_start + $main_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc "$main_start + $main_len" addr
} {}
}
}
@@ -148,7 +148,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -179,7 +179,7 @@ foreach entry $locs {
# through. This is checking that the is-stmt marked lines are
# displayed differently (without addresses) to addresses that are
# mid-way through a line, or not marked as is-stmt.
-clean_restart $binfile
+clean_restart $::testfile
runto_main
foreach entry $locs {
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.c b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.c
index 97cda50..3e7c41f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.c
@@ -1,4 +1,4 @@
-/* Copyright 2020-2024 Free Software Foundation, Inc.
+/* Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp
index c13ed2a..ff92fbd 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,16 +42,16 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name dw2-is-stmt.c}
- {low_pc 0 addr}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name dw2-is-stmt.c
+ DW_AT_low_pc 0 addr
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {name main}
- {low_pc $main_start addr}
- {high_pc "$main_start + $main_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc "$main_start + $main_len" addr
} {}
}
}
@@ -99,7 +99,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -116,7 +116,7 @@ gdb_test "step" "/\\* main end \\*/" \
# Restart the test. This time, stop at a location we know is marked
# as a statement.
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto_main
gdb_breakpoint "*line_label_3"
@@ -129,7 +129,7 @@ gdb_test "step" "/\\* main end \\*/" \
# Restart the test, this time, step through line by line, ensure we
# only stop at the places where is-stmt is true.
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto_main
# Get the values of the labels where we expect to stop.
@@ -161,7 +161,7 @@ with_test_prefix "step to line_label_5" {
# Now restart the test, and place a breakpoint by line number. GDB
# should select the location that is marked as is-stmt.
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto_main
set linum [gdb_get_line_number "main, set var to 0"]
gdb_breakpoint "$srcfile:$linum"
@@ -171,7 +171,7 @@ gdb_assert { $ll3 == $pc } "check initial \$pc"
# Restart the test again, this time we will test stepping by
# instruction.
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto_main
# We will be at line_label_1 at this point - we already tested this
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.exp b/gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.exp
index c6399fe..88fda0d 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,29 +24,29 @@ set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {MACRO_AT_range {main}}
+ MACRO_AT_range {main}
} {
declare_labels integer_label
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
DW_TAG_subprogram {
- {MACRO_AT_func {main}}
- {DW_AT_external 1 flag}
+ MACRO_AT_func {main}
+ DW_AT_external 1 flag
} {
DW_TAG_lexical_block {
} {
DW_TAG_variable {
- {DW_AT_name testvar}
- {DW_AT_type :$integer_label}
- {DW_AT_external 1 flag}
- {DW_AT_location {
+ DW_AT_name testvar
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol main]
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.c b/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.c
index 35290d0..2a260ec 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.c
@@ -1,5 +1,5 @@
/*
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp b/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
index 9124aff..c51f710 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,21 +32,21 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name dw2-line-number-zero.c}
- {stmt_list $Llines DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name dw2-line-number-zero.c
+ DW_AT_stmt_list $Llines DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {MACRO_AT_func {main}}
+ DW_AT_external 1 flag
+ MACRO_AT_func {main}
}
subprogram {
- {external 1 flag}
- {MACRO_AT_func {bar1}}
+ DW_AT_external 1 flag
+ MACRO_AT_func {bar1}
}
subprogram {
- {external 1 flag}
- {MACRO_AT_func {bar2}}
+ DW_AT_external 1 flag
+ MACRO_AT_func {bar2}
}
}
}
@@ -113,7 +113,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -129,7 +129,7 @@ gdb_continue_to_breakpoint "bar2" "\[^\r\n\]*:41\r\n.*"
gdb_test "n" "foo \\(2\\);" "bar2, 1st next"
gdb_test "n" "foo \\(4\\);" "bar2, 2nd next"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-lines.c b/gdb/testsuite/gdb.dwarf2/dw2-lines.c
index 221d7b9..1ad9879 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-lines.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-lines.c
@@ -1,5 +1,5 @@
/*
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
index 4814f49..fbaa53e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ with_shared_gdb {
proc line_for { l } {
global srcfile
set line [gdb_get_line_number "$l:" $srcfile]
- return [expr $line + 1]
+ return [expr {$line + 1}]
}
# Execute test.
@@ -59,21 +59,21 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} {
cu { version $cv is_64 $cdw64 } {
compile_unit {
- {language @DW_LANG_C}
- {name $srcfile}
- {stmt_list $Llines DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
+ DW_AT_stmt_list $Llines DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {name main}
- {low_pc $main_start addr}
- {high_pc "$main_start + $main_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc "$main_start + $main_len" addr
}
subprogram {
- {external 1 flag}
- {name bar}
- {low_pc $bar_start addr}
- {high_pc "$bar_start + $bar_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name bar
+ DW_AT_low_pc $bar_start addr
+ DW_AT_high_pc "$bar_start + $bar_len" addr
}
}
}
@@ -119,7 +119,7 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} {
return -1
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -135,9 +135,9 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} {
# Add unique test prefix.
proc test { cv cdw64 lv ldw64 {string_form ""}} {
with_test_prefix cv=$cv {
- with_test_prefix cdw=[expr $cdw64 ? 64 : 32] {
+ with_test_prefix cdw=[expr {$cdw64 ? 64 : 32}] {
with_test_prefix lv=$lv {
- with_test_prefix ldw=[expr $ldw64 ? 64 : 32] {
+ with_test_prefix ldw=[expr {$ldw64 ? 64 : 32}] {
if { $string_form == "" } {
test_1 $cv $cdw64 $lv $ldw64
} else {
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust-main.cc b/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust-main.cc
index 189e60b..e4a89b1 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust-main.cc
+++ b/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust-main.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.S b/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.S
index 56b6f6b..c1f1e6f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.exp b/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.exp
index 5c5ffea..7627e8e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ standard_testfile .S
set executable ${testfile}
if {[prepare_for_testing_full "failed to prepare" \
- [list $testfile c++ $testfile-main.cc {c++ debug} \
+ [list $testfile c++ $testfile-main.cc {c++ nodebug} \
$srcfile {}]]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-main-no-line-number.exp b/gdb/testsuite/gdb.dwarf2/dw2-main-no-line-number.exp
index dbbe610..f23366d 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-main-no-line-number.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-main-no-line-number.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,12 +33,12 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name $srcfile}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
} {
subprogram {
- {external 1 flag}
- {MACRO_AT_func {main}}
+ DW_AT_external 1 flag
+ MACRO_AT_func {main}
}
}
}
@@ -49,7 +49,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.S b/gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.S
index 57307fb..8c87e3b 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.exp b/gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.exp
index 8fc83bc..05865f6 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,8 +24,8 @@ set additional_flags [gdb_target_symbol_prefix_flags_asm]
standard_testfile .S
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
- ${additional_flags}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
+ ${additional_flags}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.c b/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.c
index e27c5f4..518dba4 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp b/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp
index 6206fb3..998b614 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,8 +31,8 @@ Dwarf::assemble $asm_file {
# We should have either one of DW_TAG_compile_unit,
# DW_TAG_partial_unit, or DW_TAG_type_unit here.
subprogram {
- {external 1 flag}
- {MACRO_AT_func {main}}
+ DW_AT_external 1 flag
+ MACRO_AT_func {main}
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S b/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S
index 3d63384..06a93ac 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S
@@ -1,4 +1,4 @@
-/* Copyright 2010-2024 Free Software Foundation, Inc.
+/* Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -114,7 +114,11 @@ die221:
.byte 0x0
- .section .debug_str
+#ifdef __arm__
+ .section .debug_str,"MS",%progbits,1
+#else
+ .section .debug_str,"MS",@progbits,1
+#endif
.LASF1:
.string "2.mod"
.LASF0:
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.exp
index 8f44e8a..14bd200 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-multiple-debug-info.c b/gdb/testsuite/gdb.dwarf2/dw2-multiple-debug-info.c
index 5370a43..5371255 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-multiple-debug-info.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-multiple-debug-info.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-multiple-debug-info.exp b/gdb/testsuite/gdb.dwarf2/dw2-multiple-debug-info.exp
index 957f41f..0092969 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-multiple-debug-info.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-multiple-debug-info.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,6 +31,6 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" "$binfile" object \
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
gdb_test "ptype a" "type = class sp1::A .*"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-namespaceless-anonymous.c b/gdb/testsuite/gdb.dwarf2/dw2-namespaceless-anonymous.c
index b3eb5e5..c284bef 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-namespaceless-anonymous.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-namespaceless-anonymous.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-namespaceless-anonymous.exp b/gdb/testsuite/gdb.dwarf2/dw2-namespaceless-anonymous.exp
index 448af13..b0e07ca 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-namespaceless-anonymous.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-namespaceless-anonymous.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,26 +27,26 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
} {
declare_labels myint
myint: DW_TAG_base_type {
- {DW_AT_byte_size 1 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name myint}
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name myint
}
DW_TAG_namespace {} {
DW_TAG_variable {
- {DW_AT_name v}
- {DW_AT_linkage_name _ZN12_GLOBAL__N_11vE}
- {DW_AT_location {
+ DW_AT_name v
+ DW_AT_linkage_name _ZN12_GLOBAL__N_11vE
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol _ZN12_GLOBAL__N_11vE]
- } SPECIAL_expr}
- {DW_AT_type :$myint}
+ } SPECIAL_expr
+ DW_AT_type :$myint
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-no-code-cu.c b/gdb/testsuite/gdb.dwarf2/dw2-no-code-cu.c
index 337735e..adc5b82 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-no-code-cu.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-no-code-cu.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-no-code-cu.exp b/gdb/testsuite/gdb.dwarf2/dw2-no-code-cu.exp
index 6a1ac57..7ff8a8a9 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-no-code-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-no-code-cu.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
standard_testfile .c main.c
-if [prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2"] {
+if {[prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2"]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-noloc.c b/gdb/testsuite/gdb.dwarf2/dw2-noloc.c
index 4233224..c0b24f4 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-noloc.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-noloc.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2023 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp b/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
index bd74760..1ad4b45 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,167 +28,167 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name $srcfile}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
} {
declare_labels integer_label
set int_size [get_sizeof "int" 4]
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size $int_size DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
+ DW_AT_byte_size $int_size DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
DW_TAG_subprogram {
- {external 1 flag}
- {name main}
- {low_pc $main_start addr}
- {high_pc "$main_start + $main_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc "$main_start + $main_len" addr
}
DW_TAG_variable {
- {DW_AT_name file_locno_resolvable}
- {DW_AT_type :$integer_label}
+ DW_AT_name file_locno_resolvable
+ DW_AT_type :$integer_label
}
DW_TAG_variable {
- {DW_AT_name file_locno_unresolvable}
- {DW_AT_type :$integer_label}
+ DW_AT_name file_locno_unresolvable
+ DW_AT_type :$integer_label
}
DW_TAG_variable {
- {DW_AT_name file_locempty_resolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_location {} DW_FORM_block1}
+ DW_AT_name file_locempty_resolvable
+ DW_AT_type :$integer_label
+ DW_AT_location {} DW_FORM_block1
}
DW_TAG_variable {
- {DW_AT_name file_locempty_unresolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_location {} DW_FORM_block1}
+ DW_AT_name file_locempty_unresolvable
+ DW_AT_type :$integer_label
+ DW_AT_location {} DW_FORM_block1
}
DW_TAG_variable {
- {DW_AT_name file_locaddr_resolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_location {
+ DW_AT_name file_locaddr_resolvable
+ DW_AT_type :$integer_label
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol file_locaddr_resolvable]
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name file_locaddr_unresolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_location {
+ DW_AT_name file_locaddr_unresolvable
+ DW_AT_type :$integer_label
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol file_locaddr_resolvable]
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name file_extern_locno_resolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_external 1 flag}
+ DW_AT_name file_extern_locno_resolvable
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
}
DW_TAG_variable {
- {DW_AT_name file_extern_locno_unresolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_external 1 flag}
+ DW_AT_name file_extern_locno_unresolvable
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
}
DW_TAG_variable {
- {DW_AT_name file_extern_locempty_resolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_external 1 flag}
- {DW_AT_location {} DW_FORM_block1}
+ DW_AT_name file_extern_locempty_resolvable
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
+ DW_AT_location {} DW_FORM_block1
}
DW_TAG_variable {
- {DW_AT_name file_extern_locempty_unresolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_external 1 flag}
- {DW_AT_location {} DW_FORM_block1}
+ DW_AT_name file_extern_locempty_unresolvable
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
+ DW_AT_location {} DW_FORM_block1
}
DW_TAG_variable {
- {DW_AT_name file_extern_locaddr_resolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_external 1 flag}
- {DW_AT_location {
+ DW_AT_name file_extern_locaddr_resolvable
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol file_extern_locaddr_resolvable]
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name file_extern_locaddr_unresolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_external 1 flag}
- {DW_AT_location {
+ DW_AT_name file_extern_locaddr_unresolvable
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol file_extern_locaddr_resolvable]
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name main_local_locno_resolvable}
- {DW_AT_type :$integer_label}
+ DW_AT_name main_local_locno_resolvable
+ DW_AT_type :$integer_label
}
DW_TAG_variable {
- {DW_AT_name main_local_locno_unresolvable}
- {DW_AT_type :$integer_label}
+ DW_AT_name main_local_locno_unresolvable
+ DW_AT_type :$integer_label
}
DW_TAG_variable {
- {DW_AT_name main_local_locempty_resolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_location {} DW_FORM_block1}
+ DW_AT_name main_local_locempty_resolvable
+ DW_AT_type :$integer_label
+ DW_AT_location {} DW_FORM_block1
}
DW_TAG_variable {
- {DW_AT_name main_local_locempty_unresolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_location {} DW_FORM_block1}
+ DW_AT_name main_local_locempty_unresolvable
+ DW_AT_type :$integer_label
+ DW_AT_location {} DW_FORM_block1
}
DW_TAG_variable {
- {DW_AT_name main_local_locaddr_resolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_location {
+ DW_AT_name main_local_locaddr_resolvable
+ DW_AT_type :$integer_label
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol main_local_locaddr_resolvable]
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name main_local_locaddr_unresolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_location {
+ DW_AT_name main_local_locaddr_unresolvable
+ DW_AT_type :$integer_label
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol main_local_locaddr_resolvable]
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name main_extern_locno_resolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_external 1 flag}
+ DW_AT_name main_extern_locno_resolvable
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
}
DW_TAG_variable {
- {DW_AT_name main_extern_locno_unresolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_external 1 flag}
+ DW_AT_name main_extern_locno_unresolvable
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
}
DW_TAG_variable {
- {DW_AT_name main_extern_locempty_resolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_external 1 flag}
- {DW_AT_location {} DW_FORM_block1}
+ DW_AT_name main_extern_locempty_resolvable
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
+ DW_AT_location {} DW_FORM_block1
}
DW_TAG_variable {
- {DW_AT_name main_extern_locempty_unresolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_external 1 flag}
- {DW_AT_location {} DW_FORM_block1}
+ DW_AT_name main_extern_locempty_unresolvable
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
+ DW_AT_location {} DW_FORM_block1
}
DW_TAG_variable {
- {DW_AT_name main_extern_locaddr_resolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_external 1 flag}
- {DW_AT_location {
+ DW_AT_name main_extern_locaddr_resolvable
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol main_extern_locaddr_resolvable]
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name main_extern_locaddr_unresolvable}
- {DW_AT_type :$integer_label}
- {DW_AT_external 1 flag}
- {DW_AT_location {
+ DW_AT_name main_extern_locaddr_unresolvable
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol main_extern_locaddr_resolvable]
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
}
@@ -272,7 +272,7 @@ proc file_symbols {type} {
file_symbols no-run
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-inner.S b/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-inner.S
index 70376f7..6535681 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-inner.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-inner.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-outer.S b/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-outer.S
index 6241dad..6ae68f9 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-outer.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-outer.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap.exp b/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap.exp
index ffe424f..90941b2 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-op-call.S b/gdb/testsuite/gdb.dwarf2/dw2-op-call.S
index 8c37fa7..dcb7bc7 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-op-call.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-op-call.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-op-call.exp b/gdb/testsuite/gdb.dwarf2/dw2-op-call.exp
index 36e35be..26b2de2 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-op-call.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-op-call.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ gdb_test "p array2" " = 2" "array2 using DW_OP_call2"
gdb_test "p array3" " = 3" "array3 using DW_OP_call4"
# Location lists need PC.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test "p arraynoloc" " = <optimized out>"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.S b/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.S
index a271dbc..d054fc5 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.exp b/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.exp
index 8d436b7..cc8985b 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if { [prepare_for_testing "failed to prepare" "${test}" ${test}.S {nodebug}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-op-stack-value.S b/gdb/testsuite/gdb.dwarf2/dw2-op-stack-value.S
index cec2f86..825e9ad 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-op-stack-value.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-op-stack-value.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-op-stack-value.exp b/gdb/testsuite/gdb.dwarf2/dw2-op-stack-value.exp
index 3c66131..dce2079 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-op-stack-value.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-op-stack-value.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.c b/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.c
index 670aaa6..e7b2a1e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.c
@@ -1,4 +1,4 @@
-/* Copyright 2016-2024 Free Software Foundation, Inc.
+/* Copyright 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp b/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp
index d73f4a8..76b9591 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,82 +44,82 @@ proc build_test_program {} {
# Creating a CU with 4-byte addresses lets this test link on
# both 32- and 64-bit machines.
cu { addr_size 4 } {
-
+
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C99}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_C99
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
} {
declare_labels int_label struct_label pointer_label \
array_label
int_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
-
+
array_label: DW_TAG_array_type {
- {DW_AT_name foo__array_type}
- {DW_AT_type :$int_label}
+ DW_AT_name foo__array_type
+ DW_AT_type :$int_label
} {
DW_TAG_subrange_type {
- {DW_AT_type :$int_label}
- {DW_AT_lower_bound 0 DW_FORM_data1}
- {DW_AT_upper_bound 127 DW_FORM_data1}
- }
+ DW_AT_type :$int_label
+ DW_AT_lower_bound 0 DW_FORM_data1
+ DW_AT_upper_bound 127 DW_FORM_data1
+ }
}
-
+
struct_label: DW_TAG_structure_type {
- {DW_AT_name "foo"}
- {DW_AT_byte_size 12 DW_FORM_sdata}
+ DW_AT_name "foo"
+ DW_AT_byte_size 12 DW_FORM_sdata
} {
member {
- {name a}
- {type :$int_label}
- {data_member_location 0 data1}
+ DW_AT_name a
+ DW_AT_type :$int_label
+ DW_AT_data_member_location 0 data1
}
member {
- {name x}
- {type :$array_label}
- {data_member_location 4 data1}
+ DW_AT_name x
+ DW_AT_type :$array_label
+ DW_AT_data_member_location 4 data1
}
member {
- {name y}
- {type :$pointer_label}
- {data_member_location 8 data1}
+ DW_AT_name y
+ DW_AT_type :$pointer_label
+ DW_AT_data_member_location 8 data1
}
}
-
+
pointer_label: DW_TAG_pointer_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_type :$struct_label}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_type :$struct_label
}
-
+
DW_TAG_subprogram {
- {DW_AT_name func01}
- {DW_AT_type :$int_label}
- {external 1 flag}
- {MACRO_AT_func {func01}}
+ DW_AT_name func01
+ DW_AT_type :$int_label
+ DW_AT_external 1 flag
+ MACRO_AT_func {func01}
} {
DW_TAG_variable {
- {DW_AT_name ptr}
- {DW_AT_type :$pointer_label}
- {DW_AT_location {} DW_FORM_block1}
+ DW_AT_name ptr
+ DW_AT_type :$pointer_label
+ DW_AT_location {} DW_FORM_block1
}
}
-
+
DW_TAG_subprogram {
- {DW_AT_name main}
- {DW_AT_type :$int_label}
- {external 1 flag}
- {MACRO_AT_func {main}}
+ DW_AT_name main
+ DW_AT_type :$int_label
+ DW_AT_external 1 flag
+ MACRO_AT_func {main}
} {
}
}
}
}
-
+
set sources "$srcfile $asm_file"
if {[build_executable "failed to compile" $testfile $sources {nodebug}]} {
return -1
@@ -134,7 +134,7 @@ set re_address_class "@\[^\r\n\]+"
proc do_console_test {} {
global binfile
- clean_restart $binfile
+ clean_restart $::testfile
with_test_prefix "console" {
gdb_test_no_output "set print object on"
@@ -146,17 +146,17 @@ proc do_console_test {} {
if {![runto func01]} {
return -1
}
-
+
gdb_test "info addr ptr" "Symbol \"ptr\" is optimized out."
-
+
gdb_test "print ptr" "<optimized out>"
-
+
gdb_test "print *ptr" "value has been optimized out"
-
+
gdb_test "print ptr->a" "value has been optimized out"
-
+
gdb_test "print ptr->x" "value has been optimized out"
-
+
gdb_test "print ptr->y" "value has been optimized out"
}
}
@@ -171,19 +171,19 @@ proc do_mi_test {} {
global mi_gdb_prompt
global binfile
-
+
with_test_prefix "mi" {
- if {[mi_clean_restart $binfile]} {
+ if {[mi_clean_restart $::testfile]} {
return
}
-
+
# This causes GDB to dereference a pointer-to-structure when doing
# -var-create.
mi_gdb_test "-gdb-set print object on" ".*" "set print object on"
-
+
mi_gdb_test "-break-insert main" ".*" "insert breakpoint main"
mi_gdb_test "-break-insert func01" ".*" "insert breakpoint func01"
-
+
# Run to main. Use an explicit expect here since the limited
# debug info will result in output that isn't handled by the
# MI test utilities.
@@ -197,7 +197,7 @@ proc do_mi_test {} {
fail "$test (timeout)"
}
}
-
+
# Run to func01. Use an explicit expect here as above.
set test "continue to func01"
mi_send_resuming_command "exec-continue" "$test"
@@ -209,14 +209,14 @@ proc do_mi_test {} {
fail "$test (timeout)"
}
}
-
+
# Test that -var-create for 'ptr' is successful.
mi_create_varobj "var1" "ptr" "create varobj for ptr"
set struct_foo_ptr \
[string cat \
[string_to_regexp "struct foo *"] "( $::re_address_class)?"]
-
+
# Test that -var-list-children of 'ptr' is successful.
mi_list_varobj_children "var1" \
[list \
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
index 060b5b6..76266ed 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,15 +39,15 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name $srcfile}
- {stmt_list $Llines DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
+ DW_AT_stmt_list $Llines DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {name main}
- {low_pc $main_start}
- {high_pc $main_end addr}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start
+ DW_AT_high_pc $main_end addr
}
}
}
@@ -79,7 +79,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-param-error-main.c b/gdb/testsuite/gdb.dwarf2/dw2-param-error-main.c
index 3b547f6..43b55b4 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-param-error-main.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-param-error-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-param-error.S b/gdb/testsuite/gdb.dwarf2/dw2-param-error.S
index 8e7216f..8aa4453 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-param-error.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-param-error.S
@@ -1,4 +1,4 @@
-/* Copyright 2011-2024 Free Software Foundation, Inc.
+/* Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-param-error.exp b/gdb/testsuite/gdb.dwarf2/dw2-param-error.exp
index b303d6f..e142292 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-param-error.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-param-error.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" \
return -1
}
-if ![runto f] {
+if {![runto f]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-producer.S b/gdb/testsuite/gdb.dwarf2/dw2-producer.S
index 73b293b..fd3d1a5 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-producer.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-producer.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-producer.exp b/gdb/testsuite/gdb.dwarf2/dw2-producer.exp
index a98ebb5..27899cb 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-producer.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-producer.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.c b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.c
index d254703..08771d2 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp
index ef9dde8..cf94c71 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,21 +30,21 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name dw2-prologue-end.c}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name dw2-prologue-end.c
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {name foo}
- {low_pc foo_label addr}
- {high_pc foo_end addr}
+ DW_AT_external 1 flag
+ DW_AT_name foo
+ DW_AT_low_pc foo_label addr
+ DW_AT_high_pc foo_end addr
}
subprogram {
- {external 1 flag}
- {name bar}
- {low_pc bar_label addr}
- {high_pc bar_end addr}
+ DW_AT_external 1 flag
+ DW_AT_name bar
+ DW_AT_low_pc bar_label addr
+ DW_AT_high_pc bar_end addr
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.c b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.c
index a71b183..41de0f6 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp
index caa4086..740ec44 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,15 +32,15 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name dw2-prologue-end.c}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name dw2-prologue-end.c
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {name main}
- {low_pc $main_start addr}
- {high_pc "$main_start + $main_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc "$main_start + $main_len" addr
}
}
}
@@ -83,7 +83,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -91,10 +91,10 @@ set prologue_end_line [gdb_get_line_number "main assign o"]
gdb_test "frame" ".*main \\\(\\\) at \[^\r\n\]*:$prologue_end_line\r\n.*"
with_test_prefix "ignore-prologue-end" {
- clean_restart $binfile
+ clean_restart $::testfile
gdb_test_no_output "maintenance set ignore-prologue-end-flag on"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-2.c b/gdb/testsuite/gdb.dwarf2/dw2-ranges-2.c
index 5b6e130..746441f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-2.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-2.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-3.c b/gdb/testsuite/gdb.dwarf2/dw2-ranges-3.c
index b284411..46eeaba 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-3.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-3.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.c b/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.c
index ae413d3..0f3a83e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.c
@@ -1,5 +1,5 @@
/*
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
index 2be211f..5e1f6cd 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,22 +45,22 @@ Dwarf::assemble $asm_file {
# .debug_ranges data then the test achieves its objective.
cu { label cu_label } {
compile_unit {
- {language @DW_LANG_C}
- {name dw-ranges-base.c}
- {stmt_list $L DW_FORM_sec_offset}
- {ranges ${ranges_label} DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name dw-ranges-base.c
+ DW_AT_stmt_list $L DW_FORM_sec_offset
+ DW_AT_ranges ${ranges_label} DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {name main}
+ DW_AT_external 1 flag
+ DW_AT_name main
}
subprogram {
- {external 1 flag}
- {name frame2}
+ DW_AT_external 1 flag
+ DW_AT_name frame2
}
subprogram {
- {external 1 flag}
- {name frame3}
+ DW_AT_external 1 flag
+ DW_AT_name frame3
}
}
}
@@ -121,7 +121,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -163,7 +163,7 @@ gdb_test_multiple "maint info line-table gdb.dwarf2/dw2-ranges-base.c" \
exp_continue
}
-re "^$gdb_prompt $" {
- gdb_assert [expr $end_seq_count == 3] $gdb_test_name
+ gdb_assert [expr {$end_seq_count == 3}] $gdb_test_name
}
-re ".*linetable: \\(\\(struct linetable \\*\\) 0x0\\):\r\nNo line table.\r\n" {
exp_continue
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func-hi-cold.c b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func-hi-cold.c
index 666c438..e0afaed 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func-hi-cold.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func-hi-cold.c
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func-lo-cold.c b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func-lo-cold.c
index 68d9ca5..8b9eff1 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func-lo-cold.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func-lo-cold.c
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp
index c952e82..5e45255 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -70,49 +70,51 @@ proc do_test {suffix} {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name dw-ranges-func2.c}
- {stmt_list $L DW_FORM_sec_offset}
- {low_pc 0 addr}
- {ranges ${cu_ranges_label} DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name dw-ranges-func2.c
+ DW_AT_stmt_list $L DW_FORM_sec_offset
+ DW_AT_low_pc 0 addr
+ DW_AT_ranges ${cu_ranges_label} DW_FORM_sec_offset
} {
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size $int_size DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size $int_size DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
volatile_label: DW_TAG_volatile_type {
- {type :$integer_label}
+ DW_AT_type :$integer_label
}
DW_TAG_variable {
- {name e}
- {external 1 flag}
- {type :$volatile_label}
- {location {addr $e_var} SPECIAL_expr}
+ DW_AT_name e
+ DW_AT_external 1 flag
+ DW_AT_type :$volatile_label
+ DW_AT_location {
+ DW_OP_addr $e_var
+ } SPECIAL_expr
}
subprogram {
- {external 1 flag}
- {name main}
- {DW_AT_type :$integer_label}
- {low_pc $main_start addr}
- {high_pc $main_len DW_FORM_data4}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_type :$integer_label
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc $main_len DW_FORM_data4
}
subprogram {
- {external 1 flag}
- {name foo}
- {ranges ${func_ranges_label} DW_FORM_sec_offset}
+ DW_AT_external 1 flag
+ DW_AT_name foo
+ DW_AT_ranges ${func_ranges_label} DW_FORM_sec_offset
}
subprogram {
- {external 1 flag}
- {name bar}
- {low_pc $bar_start addr}
- {high_pc $bar_len DW_FORM_data4}
+ DW_AT_external 1 flag
+ DW_AT_name bar
+ DW_AT_low_pc $bar_start addr
+ DW_AT_high_pc $bar_len DW_FORM_data4
}
subprogram {
- {external 1 flag}
- {name baz}
- {low_pc $baz_start addr}
- {high_pc $baz_len DW_FORM_data4}
+ DW_AT_external 1 flag
+ DW_AT_name baz
+ DW_AT_low_pc $baz_start addr
+ DW_AT_high_pc $baz_len DW_FORM_data4
}
}
}
@@ -203,7 +205,7 @@ proc do_test {suffix} {
return -1
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -234,12 +236,12 @@ proc do_test {suffix} {
with_test_prefix "step-test-2" {
clean_restart ${testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
# Note that the RE used for the following test will fail when the
- # breakpoint has been set on multiple locations. E.g. "(2 locations)".
+ # breakpoint has been set on multiple locations. E.g. "(2 locations)".
# This is intentional since that behavior is one of the bugs that
# this test case tests for.
gdb_test "break foo" \
@@ -271,7 +273,7 @@ proc do_test {suffix} {
}
clean_restart ${testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -363,7 +365,7 @@ proc do_test {suffix} {
with_test_prefix "step-test-3" {
clean_restart ${testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -382,7 +384,7 @@ proc do_test {suffix} {
# Tests in the "enable_foo_cold_stepping" section, below, did
# not work prior to July, 2019. They had been disabled via
# use of the "enable_foo_cold_stepping" flag.
- #
+ #
# As noted elsewhere, this test case causes foo_cold,
# originally a separate function invoked via a subroutine
# call, to be considered as part of foo via use of
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c
index 20e97a3..1f595a1 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c
@@ -1,5 +1,5 @@
/*
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp
index 338e29d..85e7bb1 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,13 +44,13 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C_plus_plus}
- {name $srcfile}
- {ranges ${ranges_label} DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name $srcfile
+ DW_AT_ranges ${ranges_label} DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {name quux}
+ DW_AT_external 1 flag
+ DW_AT_name quux
}
}
}
@@ -70,7 +70,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto foo] {
+if {![runto foo]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning-main.c b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning-main.c
index ed610b1..e039ab5 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning-main.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning.c b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning.c
index 4c44801..de0dcd2 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning.c
@@ -1,4 +1,4 @@
-/* Copyright 2021-2024 Free Software Foundation, Inc.
+/* Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning.exp
index e62e4b2..d33fc5c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -61,31 +61,31 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name dw-ranges-psym.c}
- {low_pc 0 addr}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name dw-ranges-psym.c
+ DW_AT_low_pc 0 addr
} {
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size $int_size DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size $int_size DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
subprogram {
- {external 1 flag}
- {name foo}
- {ranges ${func_ranges_label} DW_FORM_sec_offset}
+ DW_AT_external 1 flag
+ DW_AT_name foo
+ DW_AT_ranges ${func_ranges_label} DW_FORM_sec_offset
}
subprogram {
- {external 1 flag}
- {name bar}
- {low_pc $bar_start addr}
- {high_pc $bar_len DW_FORM_data4}
+ DW_AT_external 1 flag
+ DW_AT_name bar
+ DW_AT_low_pc $bar_start addr
+ DW_AT_high_pc $bar_len DW_FORM_data4
}
subprogram {
- {external 1 flag}
- {name baz}
- {low_pc $baz_start addr}
- {high_pc $baz_len DW_FORM_data4}
+ DW_AT_external 1 flag
+ DW_AT_name baz
+ DW_AT_low_pc $baz_start addr
+ DW_AT_high_pc $baz_len DW_FORM_data4
}
}
}
@@ -109,7 +109,7 @@ clean_restart
gdb_load_no_complaints $binfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -117,10 +117,10 @@ if ![runto_main] {
# the hole is there in the symbol table, but not the partial symbol table,
# we run into:
# (gdb) bt
-# warning: (Internal error: pc 0x555555554619 in read in psymtab, \
+# warning: (Internal error: pc 0x555555554619 in read in psymtab,
# but not in symtab.)
# ...
-# (gdb)
+# (gdb)
gdb_test "break baz" \
"Breakpoint.*at.*"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.c b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.c
index 66f4743..324335e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.c
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp
index bb0b5db..c9df12a 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -63,35 +63,35 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name dw-ranges-psym.c}
- {low_pc 0 addr}
- {ranges ${cu_ranges_label} DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name dw-ranges-psym.c
+ DW_AT_low_pc 0 addr
+ DW_AT_ranges ${cu_ranges_label} DW_FORM_sec_offset
} {
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size $int_size DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size $int_size DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
volatile_label: DW_TAG_volatile_type {
- {type :$integer_label}
+ DW_AT_type :$integer_label
}
subprogram {
- {external 1 flag}
- {name someothername}
- {ranges ${func_ranges_label} DW_FORM_sec_offset}
+ DW_AT_external 1 flag
+ DW_AT_name someothername
+ DW_AT_ranges ${func_ranges_label} DW_FORM_sec_offset
}
subprogram {
- {external 1 flag}
- {name bar}
- {low_pc $bar_start addr}
- {high_pc $bar_len DW_FORM_data4}
+ DW_AT_external 1 flag
+ DW_AT_name bar
+ DW_AT_low_pc $bar_start addr
+ DW_AT_high_pc $bar_len DW_FORM_data4
}
subprogram {
- {external 1 flag}
- {name baz}
- {low_pc $baz_start addr}
- {high_pc $baz_len DW_FORM_data4}
+ DW_AT_external 1 flag
+ DW_AT_name baz
+ DW_AT_low_pc $baz_start addr
+ DW_AT_high_pc $baz_len DW_FORM_data4
}
}
}
@@ -119,7 +119,7 @@ if { [build_executable "failed to prepare" ${testfile} \
clean_restart
gdb_load_no_complaints $binfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges.c b/gdb/testsuite/gdb.dwarf2/dw2-ranges.c
index 51c4e79..28094d4 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp
index e9a11f3..c494474 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-func.c b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-func.c
index f3d09b9..47d39a8 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-func.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-func.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-main.c b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-main.c
index ed85e1e..413e993 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-main.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.S b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.S
index 982b572..789bc1c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp
index 7a40193..154023e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -48,7 +48,7 @@ if { [prepare_for_testing_full "failed to prepare" \
}
# First try referencing DW_AT_frame_base which is not defined.
-if [runto func_nofb] {
+if {[runto func_nofb]} {
gdb_test "p func_nofb_var" {Could not find the frame base for "func_nofb".} "func_nofb print"
gdb_test "bt full" " in main .* main_var = 1" "func_nofb backtrace"
}
@@ -58,7 +58,7 @@ clean_restart $executable
# And now try referencing DW_AT_frame_base defined using a self-reference
# (DW_OP_fbreg).
-if [runto func_loopfb] {
+if {[runto func_loopfb]} {
gdb_test "p func_loopfb_var" "DWARF-2 expression error: Loop detected .*" "func_loopfb print"
gdb_test "bt full" " in main .* main_var = 1" "func_loopfb backtrace"
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.S b/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.S
index a53d04a..ab956c7 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.S
@@ -1,5 +1,5 @@
/*
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.c b/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.c
index 7aacd1d..311fd2f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.c
@@ -1,5 +1,5 @@
/*
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp b/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp
index e32194a..2de7484 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug nopie}
return -1
}
-if ![runto stop_frame] {
+if {![runto stop_frame]} {
perror "Failed to stop in stop_frame"
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-regno-invalid.exp b/gdb/testsuite/gdb.dwarf2/dw2-regno-invalid.exp
index 6532aa2..7cfeb58 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-regno-invalid.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-regno-invalid.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,27 +27,27 @@ set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {MACRO_AT_range {main}}
+ MACRO_AT_range {main}
} {
declare_labels integer_label
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
DW_TAG_subprogram {
- {DW_AT_external 1 flag}
- {MACRO_AT_func {main}}
+ DW_AT_external 1 flag
+ MACRO_AT_func {main}
} {
DW_TAG_variable {
- {DW_AT_name bregx}
- {DW_AT_type :$integer_label}
- {DW_AT_external 1 flag}
- {DW_AT_location {
+ DW_AT_name bregx
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
+ DW_AT_location {
DW_OP_bregx 0xffffffff 0
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-restore.S b/gdb/testsuite/gdb.dwarf2/dw2-restore.S
index 71f80bd..50f7b37 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-restore.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-restore.S
@@ -1,5 +1,5 @@
/*
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-restore.exp b/gdb/testsuite/gdb.dwarf2/dw2-restore.exp
index ef09661..6c17b30 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-restore.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-restore.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if {[prepare_for_testing "failed to prepare" $testfile [list $srcfile] \
return -1
}
-if ![runto foo] {
+if {![runto foo]} {
return 0
}
gdb_test "continue" "$hex in foo \\(\\)"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-restrict.S b/gdb/testsuite/gdb.dwarf2/dw2-restrict.S
index f360b3f..cf86e6e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-restrict.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-restrict.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-restrict.c b/gdb/testsuite/gdb.dwarf2/dw2-restrict.c
index ee2edd4..c9f97c6 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-restrict.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-restrict.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp b/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp
index db80aa6..6afdb8c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.S b/gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.S
index cd14654..551dda7 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -160,7 +160,11 @@ d:
.byte 0
.byte 0
.byte 0
- .section .debug_str
+#ifdef __arm__
+ .section .debug_str,"MS",%progbits,1
+#else
+ .section .debug_str,"MS",@progbits,1
+#endif
.LASF2:
.string "GNU C 4.7.0 20110727 (experimental)"
.LASF0:
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.exp b/gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.exp
index 426908e..7543099 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.S b/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.S
index 052a1ed..2eb39ae 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.c b/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.c
index bc65cd4..41e5bf5 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.exp b/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.exp
index 7b07ec2..05de3c3 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
index eef8b2f..ffa88d6 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.c b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.c
index dd34134..8bb86d9 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp
index 78ac574..70c65be 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@ load_lib dwarf.exp
# Test multiple location breakpoints vs. prologue analysis on -O2 -g code.
# when the first statement of a function is an inlined function GDB could
# crash. Map of this testcase:
-#
+#
# File name Line number Starting address
# main.c 5 func_start
# other.c 1 func0
@@ -37,7 +37,7 @@ require dwarf2_support
standard_testfile
set executable ${testfile}
-if [is_ilp32_target] {
+if {[is_ilp32_target]} {
set ptrbits 32
} else {
set ptrbits 64
@@ -53,10 +53,10 @@ if { [build_executable ${testfile}.exp ${executable} \
# We need those symbols global to access them from the .S file.
set test "strip stub symbols"
set objcopy_program [gdb_find_objcopy]
-set result [catch "exec $objcopy_program \
+set result [catch {exec $objcopy_program \
-N func0 -N func1 -N func2 -N func3 -N func_start -N func_end \
-N fund0 -N fund1 -N fund2 -N fund3 -N fund -N fund_start \
- ${binfile}" output]
+ ${binfile}} output]
verbose "result is $result"
verbose "output is $output"
if {$result != 0} {
@@ -67,7 +67,7 @@ pass $test
clean_restart $executable
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-skipped-line-entries.exp b/gdb/testsuite/gdb.dwarf2/dw2-skipped-line-entries.exp
index 2c2b5ff..1d86c61 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-skipped-line-entries.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-skipped-line-entries.exp
@@ -40,14 +40,14 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name $::srcfile}
- {low_pc 0 addr}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $::srcfile
+ DW_AT_low_pc 0 addr
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {MACRO_AT_func {main}}
+ DW_AT_external 1 flag
+ MACRO_AT_func {main}
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.S b/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.S
index 7f51fc6..4681bca 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.S
@@ -1,4 +1,4 @@
-/* Copyright 2010-2024 Free Software Foundation, Inc.
+/* Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp b/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp
index d4762db..9d35631 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.c b/gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.c
index 5e4fe47..8cec66c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.exp b/gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.exp
index 7e7c4ad..d2f3a02 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -79,48 +79,48 @@ Dwarf::assemble $asm_file {
cu { version 4 } {
compile_unit {
- {producer "gcc"}
- {language @DW_LANG_C}
- {name ${srcfile}}
- {comp_dir /tmp}
- {stmt_list $lines_table DW_FORM_sec_offset}
- {low_pc 0 addr}
+ DW_AT_producer "gcc"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile}
+ DW_AT_comp_dir /tmp
+ DW_AT_stmt_list $lines_table DW_FORM_sec_offset
+ DW_AT_low_pc 0 addr
} {
bar_label: subprogram {
- {external 1 flag}
- {name bar}
- {decl_file 1 data1}
- {decl_line $bar_decl_line data1}
- {decl_column 1 data1}
- {inline 3 data1}
+ DW_AT_external 1 flag
+ DW_AT_name bar
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $bar_decl_line data1
+ DW_AT_decl_column 1 data1
+ DW_AT_inline 3 data1
}
baz_label: subprogram {
- {external 1 flag}
- {name baz}
- {decl_file 1 data1}
- {decl_line $baz_decl_line data1}
- {decl_column 1 data1}
- {inline 3 data1}
+ DW_AT_external 1 flag
+ DW_AT_name baz
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $baz_decl_line data1
+ DW_AT_decl_column 1 data1
+ DW_AT_inline 3 data1
}
subprogram {
- {name foo}
- {decl_file 1 data1}
- {decl_line $foo_decl_line data1}
- {decl_column 1 data1}
- {ranges ${ranges_label_foo} DW_FORM_sec_offset}
- {external 1 flag}
+ DW_AT_name foo
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $foo_decl_line data1
+ DW_AT_decl_column 1 data1
+ DW_AT_ranges ${ranges_label_foo} DW_FORM_sec_offset
+ DW_AT_external 1 flag
} {
inlined_subroutine {
- {abstract_origin %$bar_label}
- {call_file 1 data1}
- {call_line $foo_src_2 data1}
- {ranges ${ranges_label_bar} DW_FORM_sec_offset}
+ DW_AT_abstract_origin %$bar_label
+ DW_AT_call_file 1 data1
+ DW_AT_call_line $foo_src_2 data1
+ DW_AT_ranges ${ranges_label_bar} DW_FORM_sec_offset
}
inlined_subroutine {
- {abstract_origin %$baz_label}
- {call_file 1 data1}
- {call_line $foo_src_3 data1}
- {ranges ${ranges_label_baz} DW_FORM_sec_offset}
+ DW_AT_abstract_origin %$baz_label
+ DW_AT_call_file 1 data1
+ DW_AT_call_line $foo_src_3 data1
+ DW_AT_ranges ${ranges_label_baz} DW_FORM_sec_offset
}
}
}
@@ -183,7 +183,7 @@ if {[prepare_for_testing "failed to prepare" "${::testfile}" \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.c b/gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.c
index 7fdf1bb..0e0370e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.exp b/gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.exp
index 9128f87..05326a2 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -71,34 +71,34 @@ Dwarf::assemble $asm_file {
cu { version 4 } {
compile_unit {
- {producer "gcc"}
- {language @DW_LANG_C}
- {name ${srcfile}}
- {comp_dir /tmp}
- {stmt_list $lines_table DW_FORM_sec_offset}
- {low_pc 0 addr}
+ DW_AT_producer "gcc"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile}
+ DW_AT_comp_dir /tmp
+ DW_AT_stmt_list $lines_table DW_FORM_sec_offset
+ DW_AT_low_pc 0 addr
} {
bar_label: subprogram {
- {external 1 flag}
- {name bar}
- {decl_file 1 data1}
- {decl_line $bar_decl_line data1}
- {decl_column 1 data1}
- {inline 3 data1}
+ DW_AT_external 1 flag
+ DW_AT_name bar
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $bar_decl_line data1
+ DW_AT_decl_column 1 data1
+ DW_AT_inline 3 data1
}
subprogram {
- {name foo}
- {decl_file 1 data1}
- {decl_line $foo_decl_line data1}
- {decl_column 1 data1}
- {ranges ${ranges_label_foo} DW_FORM_sec_offset}
- {external 1 flag}
+ DW_AT_name foo
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $foo_decl_line data1
+ DW_AT_decl_column 1 data1
+ DW_AT_ranges ${ranges_label_foo} DW_FORM_sec_offset
+ DW_AT_external 1 flag
} {
inlined_subroutine {
- {abstract_origin %$bar_label}
- {call_file 1 data1}
- {call_line $foo_src_3 data1}
- {ranges ${ranges_label_bar} DW_FORM_sec_offset}
+ DW_AT_abstract_origin %$bar_label
+ DW_AT_call_file 1 data1
+ DW_AT_call_line $foo_src_3 data1
+ DW_AT_ranges ${ranges_label_bar} DW_FORM_sec_offset
}
}
}
@@ -166,7 +166,7 @@ if {[prepare_for_testing "failed to prepare" "${::testfile}" \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.c b/gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.c
index 9a31859..fbaf193 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.c
@@ -1,5 +1,5 @@
/*
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp b/gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp
index 55f4373..e9c405e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -50,17 +50,17 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name $srcfile}
- {stmt_list $Llines DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
+ DW_AT_stmt_list $Llines DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {MACRO_AT_func {main}}
+ DW_AT_external 1 flag
+ MACRO_AT_func {main}
}
subprogram {
- {external 1 flag}
- {MACRO_AT_func {bar}}
+ DW_AT_external 1 flag
+ MACRO_AT_func {bar}
}
}
}
@@ -102,7 +102,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-strp.S b/gdb/testsuite/gdb.dwarf2/dw2-strp.S
index 26adaee..db3e64f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-strp.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-strp.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -163,7 +163,11 @@
.byte 0x0 /* Terminator */
/* String table */
- .section .debug_str
+#ifdef __arm__
+ .section .debug_str,"MS",%progbits,1
+#else
+ .section .debug_str,"MS",@progbits,1
+#endif
.Lproducer:
.string "GNU C 3.3.3"
.Lchar_str:
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-strp.exp b/gdb/testsuite/gdb.dwarf2/dw2-strp.exp
index a2247a9..43a0eff 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-strp.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-strp.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp
index 96a5284..ccee277 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -54,23 +54,23 @@ Dwarf::assemble $asm_file {
cu {} {
partial_label: partial_unit {
- {stmt_list ${lines_label} DW_FORM_sec_offset}
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
} {
DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name myint}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name myint
}
}
}
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {DW_AT_name bla.c}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name bla.c
} {
imported_unit {
- {import $partial_label ref_addr}
+ DW_AT_import $partial_label ref_addr
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp
index dc4a788..3e34c3c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,11 +38,11 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
} {
imported_unit {
- {import $partial_label ref_addr}
+ DW_AT_import $partial_label ref_addr
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5-2.c b/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5-2.c
index 8f22096..e9b2d46 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5-2.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.c b/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.c
index d723d73..a76efac 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.exp b/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.exp
index 03c26e6..725d6c7 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.S b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.S
index 23bc7ad..e07e6f2 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.S
@@ -1,5 +1,5 @@
/*
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.c b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.c
index a0cdcfc..df96a4c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.c
@@ -1,5 +1,5 @@
/*
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp
index c2b95c8..5a6dc48 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if {[prepare_for_testing "failed to prepare" "$testfile" $srcfile {nodebug nopie
return -1
}
-if ![runto "stop_frame"] {
+if {![runto "stop_frame"]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unexpected-entry-pc.c b/gdb/testsuite/gdb.dwarf2/dw2-unexpected-entry-pc.c
index cf43727..9f1c900 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-unexpected-entry-pc.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-unexpected-entry-pc.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unexpected-entry-pc.exp b/gdb/testsuite/gdb.dwarf2/dw2-unexpected-entry-pc.exp
index 69e1ce6..3c85b99 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-unexpected-entry-pc.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-unexpected-entry-pc.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -46,7 +46,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
@@ -60,7 +60,7 @@ foreach foo {foo_1 foo_2 foo_3 foo_4 foo_5 foo_6} {
set foo_decl_line [gdb_get_line_number "foo decl line"]
set bar_call_line [gdb_get_line_number "bar call line"]
-if [is_ilp32_target] {
+if {[is_ilp32_target]} {
set ptr_type "data4"
} else {
set ptr_type "data8"
@@ -102,32 +102,32 @@ proc run_test { entry_label dwarf_version with_line_table } {
cu { version $dwarf_version } {
compile_unit {
- {producer "gcc"}
- {language @DW_LANG_C}
- {name $::srcfile}
- {comp_dir /tmp}
- {stmt_list $lines_table DW_FORM_sec_offset}
- {low_pc 0 addr}
+ DW_AT_producer "gcc"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $::srcfile
+ DW_AT_comp_dir /tmp
+ DW_AT_stmt_list $lines_table DW_FORM_sec_offset
+ DW_AT_low_pc 0 addr
} {
inline_func: subprogram {
- {name bar}
- {inline @DW_INL_declared_inlined}
+ DW_AT_name bar
+ DW_AT_inline @DW_INL_declared_inlined
}
subprogram {
- {name foo}
- {decl_file 1 data1}
- {decl_line $::foo_decl_line data1}
- {decl_column 1 data1}
- {low_pc $::foo_start addr}
- {high_pc $::foo_len $::ptr_type}
- {external 1 flag}
+ DW_AT_name foo
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line $::foo_decl_line data1
+ DW_AT_decl_column 1 data1
+ DW_AT_low_pc $::foo_start addr
+ DW_AT_high_pc $::foo_len $::ptr_type
+ DW_AT_external 1 flag
} {
inlined_subroutine {
- {abstract_origin %$inline_func}
- {call_file 1 data1}
- {call_line $::bar_call_line data1}
- {entry_pc $entry_label addr}
- {ranges ${ranges_label} DW_FORM_sec_offset}
+ DW_AT_abstract_origin %$inline_func
+ DW_AT_call_file 1 data1
+ DW_AT_call_line $::bar_call_line data1
+ DW_AT_entry_pc $entry_label addr
+ DW_AT_ranges ${ranges_label} DW_FORM_sec_offset
}
}
}
@@ -142,11 +142,11 @@ proc run_test { entry_label dwarf_version with_line_table } {
if {$with_line_table} {
program {
DW_LNE_set_address foo_label
- line [expr $::bar_call_line - 2]
+ line [expr {$::bar_call_line - 2}]
DW_LNS_copy
DW_LNE_set_address foo_0
- line [expr $::bar_call_line - 1]
+ line [expr {$::bar_call_line - 1}]
DW_LNS_copy
DW_LNE_set_address foo_1
@@ -202,7 +202,7 @@ proc run_test { entry_label dwarf_version with_line_table } {
return false
}
- if ![runto_main] {
+ if {![runto_main]} {
return false
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unresolved-main.c b/gdb/testsuite/gdb.dwarf2/dw2-unresolved-main.c
index 36cc797..614262a 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-unresolved-main.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-unresolved-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unresolved.S b/gdb/testsuite/gdb.dwarf2/dw2-unresolved.S
index 0ebfd64..ae9e712 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-unresolved.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-unresolved.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unresolved.exp b/gdb/testsuite/gdb.dwarf2/dw2-unresolved.exp
index 1e5127b..ae3c27a 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-unresolved.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-unresolved.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" "dw2-unresolved" \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type-foo.c b/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type-foo.c
index 76b8b15..6194df4 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type-foo.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type-foo.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.c b/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.c
index 7f3add0..bed9fd8 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp
index 82b5bf8..a21641e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -51,52 +51,52 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_Mips_Assembler}
+ DW_AT_language @DW_LANG_Mips_Assembler
} {
unspecified_type_label: unspecified_type {}
DW_TAG_subprogram {
- {name foo}
- {low_pc $foo_start addr}
- {high_pc $foo_end addr}
- {type :$unspecified_type_label}
+ DW_AT_name foo
+ DW_AT_low_pc $foo_start addr
+ DW_AT_high_pc $foo_end addr
+ DW_AT_type :$unspecified_type_label
}
}
}
cu {} {
compile_unit {
- {language @DW_LANG_Mips_Assembler}
- {producer "GNU AS 2.39.0"}
+ DW_AT_language @DW_LANG_Mips_Assembler
+ DW_AT_producer "GNU AS 2.39.0"
} {
DW_TAG_subprogram {
- {name bar}
- {low_pc $bar_start addr}
- {high_pc $bar_end addr}
+ DW_AT_name bar
+ DW_AT_low_pc $bar_start addr
+ DW_AT_high_pc $bar_end addr
}
}
}
cu { version 2 } {
compile_unit {
- {language @DW_LANG_Mips_Assembler}
- {producer "GNU AS 2.40.0"}
+ DW_AT_language @DW_LANG_Mips_Assembler
+ DW_AT_producer "GNU AS 2.40.0"
} {
DW_TAG_subprogram {
- {name foo2}
- {low_pc $foo2_start addr}
- {high_pc $foo2_end addr}
+ DW_AT_name foo2
+ DW_AT_low_pc $foo2_start addr
+ DW_AT_high_pc $foo2_end addr
}
}
}
}
-if [prepare_for_testing "failed to prepare" $testfile \
- "${asm_file} ${srcfile} ${srcfile2}" {}] {
+if {[prepare_for_testing "failed to prepare" $testfile \
+ "${asm_file} ${srcfile} ${srcfile2}" {}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.c b/gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.c
index 43952e5..cb62f95 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.exp b/gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.exp
index df5896c..3961abd 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ set asm_file [standard_output_file $srcfile2]
# For that, we ask GDB by debugging our test program. Any program
# would do, but since we already have one specifically for this
# testcase, might as well use that.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
set int_size [get_sizeof "int" -1]
@@ -59,49 +59,49 @@ proc run_test { field_name } {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
} {
declare_labels itype ptype stype
itype: DW_TAG_base_type {
- {DW_AT_byte_size $int_size DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
+ DW_AT_byte_size $int_size DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
stype: DW_TAG_structure_type {
- {DW_AT_name "foo"}
- {DW_AT_byte_size $int_size DW_FORM_sdata}
+ DW_AT_name "foo"
+ DW_AT_byte_size $int_size DW_FORM_sdata
} {
member {
- {name $field_name}
- {type :$itype}
- {data_member_location 0 data1}
+ DW_AT_name $field_name
+ DW_AT_type :$itype
+ DW_AT_data_member_location 0 data1
}
}
ptype: DW_TAG_pointer_type {
- {DW_AT_type :$stype}
+ DW_AT_type :$stype
}
DW_TAG_variable {
- {DW_AT_name obj}
- {DW_AT_type :$stype}
- {DW_AT_location {
+ DW_AT_name obj
+ DW_AT_type :$stype
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol obj]
- } SPECIAL_expr}
- {external 1 flag}
+ } SPECIAL_expr
+ DW_AT_external 1 flag
}
DW_TAG_variable {
- {DW_AT_name ptr}
- {DW_AT_type :$ptype}
- {DW_AT_location {
+ DW_AT_name ptr
+ DW_AT_type :$ptype
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol ptr]
- } SPECIAL_expr}
- {external 1 flag}
+ } SPECIAL_expr
+ DW_AT_external 1 flag
}
}
}
@@ -112,7 +112,7 @@ proc run_test { field_name } {
return -1
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.c b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.c
index 47fd822..ba0ac43 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
index c45d631..11c6329 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,51 +34,51 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name ${srcfile}}
- } {
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile}
+ } {
declare_labels int4_type struct_type
int4_type: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
struct_type: DW_TAG_structure_type {
- {DW_AT_name "foo_t" DW_FORM_strp}
- {DW_AT_byte_size 12 DW_FORM_sdata}
+ DW_AT_name "foo_t" DW_FORM_strp
+ DW_AT_byte_size 12 DW_FORM_sdata
} {
member {
- {name "aa" DW_FORM_strp}
- {type :$int4_type}
- {data_member_location 0 data1}
+ DW_AT_name "aa" DW_FORM_strp
+ DW_AT_type :$int4_type
+ DW_AT_data_member_location 0 data1
}
member {
- {name "bb" DW_FORM_strp}
- {type :$int4_type}
- {data_member_location 4 data1}
+ DW_AT_name "bb" DW_FORM_strp
+ DW_AT_type :$int4_type
+ DW_AT_data_member_location 4 data1
}
member {
- {name "cc" DW_FORM_strp}
- {type :$int4_type}
- {data_member_location 8 data1}
+ DW_AT_name "cc" DW_FORM_strp
+ DW_AT_type :$int4_type
+ DW_AT_data_member_location 8 data1
}
}
DW_TAG_variable {
- {DW_AT_name global_var DW_FORM_strp}
- {DW_AT_type :$struct_type}
- {DW_AT_location {
+ DW_AT_name global_var DW_FORM_strp
+ DW_AT_type :$struct_type
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol global_var]
- } SPECIAL_expr}
- {external 1 flag}
+ } SPECIAL_expr
+ DW_AT_external 1 flag
}
subprogram {
- {external 1 flag}
- {name main DW_FORM_strp}
- {MACRO_AT_range {main}}
+ DW_AT_external 1 flag
+ DW_AT_name main DW_FORM_strp
+ MACRO_AT_range {main}
}
}
}
@@ -89,7 +89,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.S b/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.S
index 9af14fc..aa76403 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp b/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp
index 9b89b8c..e4977dd 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,8 +19,8 @@ require dwarf2_support
standard_testfile .S main.c
-if [prepare_for_testing "failed to prepare" ${testfile} \
- [list $srcfile $srcfile2] {nodebug}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} \
+ [list $srcfile $srcfile2] {nodebug}]} {
return -1
}
@@ -34,7 +34,7 @@ test
save_vars { GDBFLAGS } {
set GDBFLAGS "$GDBFLAGS --readnow"
- clean_restart ${binfile}
+ clean_restart ${::testfile}
}
with_test_prefix "readnow" {
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.c b/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.c
index ca76236..20cbe2c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp b/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
index 5a0705f..e0ccd21 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,13 +34,13 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name dw2-vendor-extended-opcode.c}
- {stmt_list $Llines DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name dw2-vendor-extended-opcode.c
+ DW_AT_stmt_list $Llines DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {MACRO_AT_func {main}}
+ DW_AT_external 1 flag
+ MACRO_AT_func {main}
}
}
}
@@ -67,7 +67,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-weird-type-len.c b/gdb/testsuite/gdb.dwarf2/dw2-weird-type-len.c
index f3bd9c2..8372761 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-weird-type-len.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-weird-type-len.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-weird-type-len.exp b/gdb/testsuite/gdb.dwarf2/dw2-weird-type-len.exp
index fdda0e1..9109cc5 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-weird-type-len.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-weird-type-len.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,52 +35,52 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
} {
declare_labels integer_label foo_t_label bar_t_label
foo_t_label: DW_TAG_structure_type {
- {name foo_t}
- {byte_size 3 DW_FORM_sdata}
+ DW_AT_name foo_t
+ DW_AT_byte_size 3 DW_FORM_sdata
} {
member {
- {name field}
- {type :$integer_label}
- {data_member_location 0 DW_FORM_sdata}
+ DW_AT_name field
+ DW_AT_type :$integer_label
+ DW_AT_data_member_location 0 DW_FORM_sdata
}
}
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size 3 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size 3 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
bar_t_label: DW_TAG_structure_type {
- {name bar_t}
- {byte_size 3 DW_FORM_sdata}
+ DW_AT_name bar_t
+ DW_AT_byte_size 3 DW_FORM_sdata
} {
member {
- {name f}
- {type :$foo_t_label}
- {data_member_location 0 DW_FORM_sdata}
+ DW_AT_name f
+ DW_AT_type :$foo_t_label
+ DW_AT_data_member_location 0 DW_FORM_sdata
}
}
DW_TAG_subprogram {
- {name main}
- {low_pc $main_start addr}
- {high_pc $main_len data8}
- {DW_AT_type :$integer_label}
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc $main_len data8
+ DW_AT_type :$integer_label
}
DW_TAG_subprogram {
- {name get_bar}
- {low_pc $get_bar_start addr}
- {high_pc $get_bar_len data8}
- {DW_AT_type :$bar_t_label}
+ DW_AT_name get_bar
+ DW_AT_low_pc $get_bar_start addr
+ DW_AT_high_pc $get_bar_len data8
+ DW_AT_type :$bar_t_label
}
}
}
@@ -91,7 +91,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-wrong-mangled-name.c b/gdb/testsuite/gdb.dwarf2/dw2-wrong-mangled-name.c
index d93ce3f..e4dac47 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-wrong-mangled-name.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-wrong-mangled-name.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-wrong-mangled-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-wrong-mangled-name.exp
index 1b81276..a986b19 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-wrong-mangled-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-wrong-mangled-name.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,20 +33,20 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C_plus_plus}
- {name $srcfile}
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name $srcfile
} {
subprogram {
- {MACRO_AT_range {func_demangled_test}}
- {linkage_name "_FUNC_WRONG_MANGLED__"}
- {name "func_demangled_test"}
- {external 1 flag}
+ MACRO_AT_range {func_demangled_test}
+ DW_AT_linkage_name "_FUNC_WRONG_MANGLED__"
+ DW_AT_name "func_demangled_test"
+ DW_AT_external 1 flag
}
subprogram {
- {MACRO_AT_range {main}}
- {external 1 flag}
- {name main}
- {main_subprogram 1 flag}
+ MACRO_AT_range {main}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_main_subprogram 1 flag
}
}
}
@@ -57,7 +57,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-zero-range-shlib.c b/gdb/testsuite/gdb.dwarf2/dw2-zero-range-shlib.c
index d998435..5fe66a8 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-zero-range-shlib.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-zero-range-shlib.c
@@ -1,5 +1,5 @@
/*
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.c b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.c
index d2ed4a7..cd9f674 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.c
@@ -1,5 +1,5 @@
/*
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
index e2e4f24..d5faf6f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,8 @@ standard_testfile .c -shlib.c -dw.S
# Test for presence of complaint, with the lib relocated.
proc_with_prefix test_relocated { exec_path lib_path complaint_re readnow_p } {
- clean_restart $exec_path
+ clean_restart
+ gdb_load $exec_path
gdb_load_shlib $lib_path
if { ![runto_main] } {
@@ -95,13 +96,13 @@ foreach_with_prefix ranges_sect {ranges rnglists} {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name $srcfile2}
- {ranges ${ranges_label} DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile2
+ DW_AT_ranges ${ranges_label} DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {name foo}
+ DW_AT_external 1 flag
+ DW_AT_name foo
}
}
}
@@ -122,13 +123,13 @@ foreach_with_prefix ranges_sect {ranges rnglists} {
version 5
} {
compile_unit {
- {language @DW_LANG_C}
- {name $srcfile2}
- {ranges ${rnglists_label} DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile2
+ DW_AT_ranges ${rnglists_label} DW_FORM_sec_offset
} {
subprogram {
- {external 1 flag}
- {name foo}
+ DW_AT_external 1 flag
+ DW_AT_name foo
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.S b/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.S
index c5c0a1d..567e22b 100644
--- a/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.S
+++ b/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.S
@@ -1,4 +1,4 @@
-/* Copyright 2011-2024 Free Software Foundation, Inc.
+/* Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.exp b/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.exp
index 24dc132..256d13c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp b/gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp
index fd0b43f..1d9aed6 100644
--- a/gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" \
# Stress test gdb's handling of cached comp units, disable the cache.
gdb_test_no_output "maint set dwarf max-cache-age 0"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.cc b/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.cc
index 5c596d1..cbc70ef 100644
--- a/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.cc
+++ b/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.exp b/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.exp
index 3ef756d..ef5834e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.cc b/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.cc
index 7408b8d..1df0da2 100644
--- a/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.cc
+++ b/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp b/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp
index a7ca334..9a34157 100644
--- a/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dwp-sepdebug.c b/gdb/testsuite/gdb.dwarf2/dwp-sepdebug.c
index b1c4cae..17885d5 100644
--- a/gdb/testsuite/gdb.dwarf2/dwp-sepdebug.c
+++ b/gdb/testsuite/gdb.dwarf2/dwp-sepdebug.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dwp-sepdebug.exp b/gdb/testsuite/gdb.dwarf2/dwp-sepdebug.exp
index d7e49ca..e39da5d 100644
--- a/gdb/testsuite/gdb.dwarf2/dwp-sepdebug.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwp-sepdebug.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ standard_testfile
if { [build_executable ${testfile}.exp ${testfile} ${srcfile}] == -1 } {
return -1
}
-if ![remote_file host exists [standard_output_file ${testfile}.dwp]] {
+if {![remote_file host exists [standard_output_file ${testfile}.dwp]]} {
unsupported "testsuite run does not produce dwp files"
return 0
}
@@ -29,7 +29,7 @@ if ![remote_file host exists [standard_output_file ${testfile}.dwp]] {
# the name of a debuginfo only file. This file will be stored in the
# gdb.base/ subdirectory.
-if [gdb_gnu_strip_debug $binfile$EXEEXT] {
+if {[gdb_gnu_strip_debug $binfile$EXEEXT]} {
# check that you have a recent version of strip and objcopy installed
unsupported "cannot produce separate debug info files"
return -1
diff --git a/gdb/testsuite/gdb.dwarf2/dwp-symlink.c b/gdb/testsuite/gdb.dwarf2/dwp-symlink.c
index 95852ba..711fad8 100644
--- a/gdb/testsuite/gdb.dwarf2/dwp-symlink.c
+++ b/gdb/testsuite/gdb.dwarf2/dwp-symlink.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp b/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp
index cdf1968..c2202cb 100644
--- a/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,14 +16,14 @@
standard_testfile
remote_file host delete [standard_output_file ${testfile}.dwp]
-if [remote_file host exists [standard_output_file ${testfile}.dwp]] {
+if {[remote_file host exists [standard_output_file ${testfile}.dwp]]} {
unsupported "dwp file cannot be deleted"
return 0
}
if { [build_executable ${testfile}.exp ${testfile} ${srcfile}] == -1 } {
return -1
}
-if ![remote_file host exists [standard_output_file ${testfile}.dwp]] {
+if {![remote_file host exists [standard_output_file ${testfile}.dwp]]} {
unsupported "testsuite run does not produce dwp files"
return 0
}
@@ -34,11 +34,11 @@ remote_file host delete [standard_output_file ${thelink}]
remote_file host delete [standard_output_file ${thelink}.dwp]
# file link is only Tcl 8.4+.
remote_exec host "ln -sf ${testfile} [standard_output_file $thelink]"
-if ![remote_file host exists [standard_output_file $thelink]] {
+if {![remote_file host exists [standard_output_file $thelink]]} {
unsupported "host does not support symbolic links (binary symlink is missing)"
return 0
}
-if [remote_file host exists [standard_output_file $thelink.dwp]] {
+if {[remote_file host exists [standard_output_file $thelink.dwp]]} {
unsupported "host does not support symbolic links (we tried to delete a file and it is still there)"
return 0
}
@@ -55,11 +55,11 @@ gdb_test "ptype main" $main_type_re "binary symlink, dwp default"
gdb_exit
remote_exec host "mv -f [standard_output_file ${testfile}.dwp] [standard_output_file ${thelink}.dwp]"
-if [remote_file host exists [standard_output_file ${testfile}.dwp]] {
+if {[remote_file host exists [standard_output_file ${testfile}.dwp]]} {
unsupported "host does not support symbolic links (binary symlink exists)"
return 0
}
-if ![remote_file host exists [standard_output_file ${thelink}.dwp]] {
+if {![remote_file host exists [standard_output_file ${thelink}.dwp]]} {
unsupported "host does not support symbolic links (dwp symlink is missing)"
return 0
}
@@ -125,7 +125,7 @@ remote_exec host "ln -sf ${dwp_dwp_dir}/${dwp_real_dwp} ${dwp_symlink_dir}/${dwp
clean_restart "${dwp_symlink_dir}/${dwp_symlink_binary}"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dwz-unused-pu.exp b/gdb/testsuite/gdb.dwarf2/dwz-unused-pu.exp
index 1dd91ee..d9daedf 100644
--- a/gdb/testsuite/gdb.dwarf2/dwz-unused-pu.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwz-unused-pu.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,9 +28,11 @@ Dwarf::assemble $asm_file {
declare_labels partial_label int_label int_label2
cu {} {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
subprogram {
- {MACRO_AT_func { main }}
+ MACRO_AT_func { main }
}
}
}
@@ -38,15 +40,15 @@ Dwarf::assemble $asm_file {
cu {} {
partial_unit {} {
int_label: base_type {
- {name int}
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
+ DW_AT_name int
+ DW_AT_byte_size 4 sdata
+ DW_AT_encoding @DW_ATE_signed
}
constant {
- {name the_int}
- {type :$int_label}
- {const_value 99 data1}
+ DW_AT_name the_int
+ DW_AT_type :$int_label
+ DW_AT_const_value 99 data1
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dwz.exp b/gdb/testsuite/gdb.dwarf2/dwz.exp
index c44c572..872e3a2 100644
--- a/gdb/testsuite/gdb.dwarf2/dwz.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwz.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,59 +28,63 @@ Dwarf::assemble $asm_file {
cu {} {
partial_label: partial_unit {} {
subprogram {
- {MACRO_AT_func { main }}
+ MACRO_AT_func { main }
}
}
}
cu {} {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
int_label2: base_type {
- {name int}
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
+ DW_AT_name int
+ DW_AT_byte_size 4 sdata
+ DW_AT_encoding @DW_ATE_signed
}
constant {
- {name the_int}
- {type :$int_label2}
- {const_value 99 data1}
+ DW_AT_name the_int
+ DW_AT_type :$int_label2
+ DW_AT_const_value 99 data1
}
constant {
- {name other_int}
- {type :$int_label2}
- {const_value 99 data1}
+ DW_AT_name other_int
+ DW_AT_type :$int_label2
+ DW_AT_const_value 99 data1
}
}
}
cu {} {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
imported_unit {
- {import $partial_label ref_addr}
+ DW_AT_import $partial_label ref_addr
}
int_label: base_type {
- {name int}
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
+ DW_AT_name int
+ DW_AT_byte_size 4 sdata
+ DW_AT_encoding @DW_ATE_signed
}
constant {
- {name the_int}
- {type :$int_label}
- {const_value 23 data1}
+ DW_AT_name the_int
+ DW_AT_type :$int_label
+ DW_AT_const_value 23 data1
}
}
}
}
-if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}] {
+if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp b/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
index e54508a..080e999 100644
--- a/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,160 +13,5 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-load_lib dwarf.exp
-
-# This test can only be run on targets which support DWARF-2 and use gas.
-require dwarf2_support
-
-# No remote host testing either.
-require {!is_remote host}
-
-
-# Lots of source files since we test a few cases and make new files
-# for each.
-# The tests are:
-# ok - the main file refers to a dwz and the buildids match
-# mismatch - the buildids do not match
-# fallback - the buildids do not match but a match is found via buildid
-standard_testfile main.c \
- dwzbuildid-ok-base.S dwzbuildid-ok-sep.S \
- dwzbuildid-mismatch-base.S dwzbuildid-mismatch-sep.S \
- dwzbuildid-fallback-base.S dwzbuildid-fallback-sep.S \
- dwzbuildid-fallback-ok.S
-
-# Write some assembly that just has a .gnu_debugaltlink section.
-proc write_just_debugaltlink {filename dwzname buildid} {
- set asm_file [standard_output_file $filename]
-
- Dwarf::assemble $asm_file {
- upvar dwzname dwzname
- upvar buildid buildid
-
- gnu_debugaltlink $dwzname $buildid
-
- # Only the DWARF reader checks .gnu_debugaltlink, so make sure
- # there is a bit of DWARF in here.
- cu { label cu_start } {
- compile_unit {{language @DW_LANG_C}} {
- }
- }
- aranges {} cu_start {
- arange {} 0 0
- }
- }
-}
-
-# Write some DWARF that also sets the buildid.
-proc write_dwarf_file {filename buildid {value 99}} {
- set asm_file [standard_output_file $filename]
-
- Dwarf::assemble $asm_file {
- declare_labels int_label int_label2
-
- upvar buildid buildid
- upvar value value
-
- build_id $buildid
-
- cu { label cu_start } {
- compile_unit {{language @DW_LANG_C}} {
- int_label2: base_type {
- {name int}
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
- }
-
- constant {
- {name the_int}
- {type :$int_label2}
- {const_value $value data1}
- }
- }
- }
-
- aranges {} cu_start {
- arange {} 0 0
- }
- }
-}
-
-if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \
- object {nodebug}] != "" } {
- return -1
-}
-
-# The values don't really matter, just whether they are equal.
-set ok_prefix 01
-set ok_suffix 02030405060708091011121314151617181920
-set ok_suffix2 020304050607080910111213141516171819ff
-set ok_buildid ${ok_prefix}${ok_suffix}
-set ok_buildid2 ${ok_prefix}${ok_suffix2}
-set bad_buildid [string repeat ff 20]
-
-set debugdir [standard_output_file {}]
-set basedir $debugdir/.build-id
-file mkdir $basedir $basedir/$ok_prefix
-
-# Test where the separate debuginfo's buildid matches.
-write_just_debugaltlink $srcfile2 ${binfile}3.o $ok_buildid
-write_dwarf_file $srcfile3 $ok_buildid
-
-# Test where the separate debuginfo's buildid does not match.
-write_just_debugaltlink $srcfile4 ${binfile}5.o $ok_buildid
-write_dwarf_file $srcfile5 $bad_buildid
-
-# Test where the separate debuginfo's buildid does not match, but then
-# we find a match in the .build-id directory.
-write_just_debugaltlink $srcfile6 ${binfile}7.o $ok_buildid2
-# Use 77 as the value so that if we load the bad debuginfo, we will
-# see the wrong result.
-write_dwarf_file $srcfile7 $bad_buildid 77
-write_dwarf_file $srcfile8 $ok_buildid2
-
-# Compile everything.
-for {set i 2} {$i <= 8} {incr i} {
- if {[gdb_compile [standard_output_file [set srcfile$i]] \
- ${binfile}$i.o object nodebug] != ""} {
- return -1
- }
-}
-
-# Copy a file into the .build-id place for the "fallback" test.
-file copy -force -- ${binfile}8.o $basedir/$ok_prefix/$ok_suffix2.debug
-
-proc do_test {} {
- clean_restart
-
- gdb_test_no_output "set debug-file-directory $::debugdir" \
- "set debug-file-directory"
-
- gdb_load ${::binfile}-${::testname}
-
- if {![runto_main]} {
- return
- }
-
- if {$::testname == "mismatch"} {
- gdb_test "print the_int" \
- "(No symbol table is loaded|No symbol \"the_int\" in current context).*"
- } else {
- gdb_test "print the_int" " = 99"
- }
-}
-
-foreach_with_prefix testname { ok mismatch fallback } {
- if { $testname == "ok" } {
- set objs [list ${binfile}1.o ${binfile}2.o]
- } elseif { $testname == "mismatch" } {
- set objs [list ${binfile}1.o ${binfile}4.o]
- } elseif { $testname == "fallback" } {
- set objs [list ${binfile}1.o ${binfile}6.o]
- }
-
- if {[gdb_compile $objs ${binfile}-$testname executable {quiet}] != ""} {
- unsupported "compilation failed"
- continue
- }
-
- do_test
-}
+set scenario gnu
+source $srcdir/$subdir/dwzbuildid.tcl
diff --git a/gdb/testsuite/gdb.dwarf2/dwzbuildid.tcl b/gdb/testsuite/gdb.dwarf2/dwzbuildid.tcl
new file mode 100644
index 0000000..1aa889a
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dwzbuildid.tcl
@@ -0,0 +1,188 @@
+# Copyright 2013-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+require dwarf2_support
+
+# No remote host testing either.
+require {!is_remote host}
+
+
+# Lots of source files since we test a few cases and make new files
+# for each.
+# The tests are:
+# ok - the main file refers to a dwz and the buildids match
+# mismatch - the buildids do not match
+# fallback - the buildids do not match but a match is found via buildid
+standard_testfile main.c \
+ dwzbuildid-ok-base.S dwzbuildid-ok-sep.S \
+ dwzbuildid-mismatch-base.S dwzbuildid-mismatch-sep.S \
+ dwzbuildid-fallback-base.S dwzbuildid-fallback-sep.S \
+ dwzbuildid-fallback-ok.S
+
+# Write some assembly that just has a .gnu_debugaltlink section.
+proc write_just_debugaltlink {filename dwzname buildid} {
+ set asm_file [standard_output_file $filename]
+
+ Dwarf::assemble $asm_file {
+ upvar dwzname dwzname
+ upvar buildid buildid
+
+ if {$::scenario == "gnu"} {
+ gnu_debugaltlink $dwzname $buildid
+ } else {
+ debug_sup 0 $dwzname $buildid
+ }
+
+ # Only the DWARF reader checks .gnu_debugaltlink, so make sure
+ # there is a bit of DWARF in here.
+ cu { label cu_start } {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
+ }
+ }
+ aranges {} cu_start {
+ arange {} 0 0
+ }
+ }
+}
+
+# Write some DWARF that also sets the buildid.
+proc write_dwarf_file {filename buildid {value 99}} {
+ set asm_file [standard_output_file $filename]
+
+ Dwarf::assemble $asm_file {
+ declare_labels int_label int_label2
+
+ upvar buildid buildid
+ upvar value value
+
+ if {$::scenario == "gnu"} {
+ build_id $buildid
+ } else {
+ debug_sup 1 "" $buildid
+ }
+
+ cu { label cu_start } {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
+ int_label2: base_type {
+ DW_AT_name int
+ DW_AT_byte_size 4 sdata
+ DW_AT_encoding @DW_ATE_signed
+ }
+
+ constant {
+ DW_AT_name the_int
+ DW_AT_type :$int_label2
+ DW_AT_const_value $value data1
+ }
+ }
+ }
+
+ aranges {} cu_start {
+ arange {} 0 0
+ }
+ }
+}
+
+if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \
+ object {nodebug}] != "" } {
+ return -1
+}
+
+# The values don't really matter, just whether they are equal.
+set ok_prefix 01
+set ok_suffix 02030405060708091011121314151617181920
+set ok_suffix2 020304050607080910111213141516171819ff
+set ok_buildid ${ok_prefix}${ok_suffix}
+set ok_buildid2 ${ok_prefix}${ok_suffix2}
+set bad_buildid [string repeat ff 20]
+
+set debugdir [standard_output_file {}]
+set basedir $debugdir/.build-id
+file mkdir $basedir $basedir/$ok_prefix
+
+# Test where the separate debuginfo's buildid matches.
+write_just_debugaltlink $srcfile2 ${binfile}3.o $ok_buildid
+write_dwarf_file $srcfile3 $ok_buildid
+
+# Test where the separate debuginfo's buildid does not match.
+write_just_debugaltlink $srcfile4 ${binfile}5.o $ok_buildid
+write_dwarf_file $srcfile5 $bad_buildid
+
+# Test where the separate debuginfo's buildid does not match, but then
+# we find a match in the .build-id directory.
+write_just_debugaltlink $srcfile6 ${binfile}7.o $ok_buildid2
+# Use 77 as the value so that if we load the bad debuginfo, we will
+# see the wrong result.
+write_dwarf_file $srcfile7 $bad_buildid 77
+write_dwarf_file $srcfile8 $ok_buildid2
+
+# Compile everything.
+for {set i 2} {$i <= 8} {incr i} {
+ if {[gdb_compile [standard_output_file [set srcfile$i]] \
+ ${binfile}$i.o object nodebug] != ""} {
+ return -1
+ }
+}
+
+# Copy a file into the .build-id place for the "fallback" test.
+file copy -force -- ${binfile}8.o $basedir/$ok_prefix/$ok_suffix2.debug
+
+proc do_test {} {
+ clean_restart
+
+ gdb_test_no_output "set debug-file-directory $::debugdir" \
+ "set debug-file-directory"
+
+ gdb_load ${::binfile}-${::testname}
+
+ if {![runto_main]} {
+ return
+ }
+
+ if {$::testname == "mismatch"} {
+ gdb_test "print the_int" \
+ "(No symbol table is loaded|No symbol \"the_int\" in current context).*"
+ } else {
+ gdb_test "print the_int" " = 99"
+ }
+}
+
+set tests {ok mismatch}
+if {$scenario == "gnu"} {
+ lappend tests fallback
+}
+foreach_with_prefix testname $tests {
+ if { $testname == "ok" } {
+ set objs [list ${binfile}1.o ${binfile}2.o]
+ } elseif { $testname == "mismatch" } {
+ set objs [list ${binfile}1.o ${binfile}4.o]
+ } elseif { $testname == "fallback" } {
+ set objs [list ${binfile}1.o ${binfile}6.o]
+ }
+
+ if {[gdb_compile $objs ${binfile}-$testname executable {quiet}] != ""} {
+ unsupported "compilation failed"
+ continue
+ }
+
+ do_test
+}
diff --git a/gdb/testsuite/gdb.testsuite/lmap.exp b/gdb/testsuite/gdb.dwarf2/dwzbuildid5.exp
index 736f670..047626c 100644
--- a/gdb/testsuite/gdb.testsuite/lmap.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwzbuildid5.exp
@@ -1,4 +1,5 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2025 Free Software Foundation, Inc.
+
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -12,9 +13,5 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set one 1
-set l1 { $one 2 }
-set res1 [lmap item $l1 {expr $item + 1}]
-gdb_assert { [lindex $res1 0] == 2 }
-gdb_assert { [lindex $res1 1] == 3 }
-gdb_assert { $item == 2 }
+set scenario dwarf5
+source $srcdir/$subdir/dwzbuildid.tcl
diff --git a/gdb/testsuite/gdb.dwarf2/dwznolink.exp b/gdb/testsuite/gdb.dwarf2/dwznolink.exp
index cbabe8f..b568055 100644
--- a/gdb/testsuite/gdb.dwarf2/dwznolink.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwznolink.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,11 +30,13 @@ set asm_file [standard_output_file $srcfile2]
# one point, this caused gdb crashes.
Dwarf::assemble $asm_file {
cu {} {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
constant {
- {name 0 DW_FORM_GNU_strp_alt}
- {type 97 DW_FORM_GNU_ref_alt}
- {const_value 99 data1}
+ DW_AT_name 0 DW_FORM_GNU_strp_alt
+ DW_AT_type 97 DW_FORM_GNU_ref_alt
+ DW_AT_const_value 99 data1
}
}
}
@@ -49,5 +51,5 @@ if {[build_executable $testfile.exp $testfile \
clean_restart
gdb_test "file -readnow $binfile" \
- "could not read '.gnu_debugaltlink' section" \
+ "could not find supplementary DWARF file" \
"file $testfile"
diff --git a/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.c b/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.c
index b9fd4bd..84f13b9 100644
--- a/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.c
+++ b/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.exp b/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.exp
index 9de0261..1f95a65 100644
--- a/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.exp
+++ b/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -66,57 +66,57 @@ Dwarf::assemble $asm_file {
global srcfile
compile_unit {
- {producer "gcc" }
- {language @DW_LANG_Fortran90}
- {name ${srcfile}}
- {low_pc 0 addr}
- } {
+ DW_AT_producer "gcc"
+ DW_AT_language @DW_LANG_Fortran90
+ DW_AT_name ${srcfile}
+ DW_AT_low_pc 0 addr
+ } {
declare_labels array_type_label integer_type_label
- integer_type_label: DW_TAG_base_type {
- {DW_AT_byte_size $int_size DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
- }
+ integer_type_label: DW_TAG_base_type {
+ DW_AT_byte_size $int_size DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
+ }
array_type_label: DW_TAG_array_type {
- {DW_AT_type :$integer_type_label}
- {DW_AT_data_location {
+ DW_AT_type :$integer_type_label
+ DW_AT_data_location {
DW_OP_push_object_address
DW_OP_deref
- } SPECIAL_expr}
- {DW_AT_allocated {
+ } SPECIAL_expr
+ DW_AT_allocated {
DW_OP_lit0
- } SPECIAL_expr}
+ } SPECIAL_expr
} {
DW_TAG_subrange_type {
- {DW_AT_type :$integer_type_label}
- {DW_AT_lower_bound {
+ DW_AT_type :$integer_type_label
+ DW_AT_lower_bound {
DW_OP_skip -3
- } SPECIAL_expr}
- {DW_AT_upper_bound {
+ } SPECIAL_expr
+ DW_AT_upper_bound {
DW_OP_skip -3
- } SPECIAL_expr}
- {DW_AT_byte_stride {
+ } SPECIAL_expr
+ DW_AT_byte_stride {
DW_OP_skip -3
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
DW_TAG_variable {
- {DW_AT_location {
- DW_OP_addr [gdb_target_symbol dyn_object]
- } SPECIAL_expr}
- {name "dyn_object"}
- {type :$array_type_label}
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol dyn_object]
+ } SPECIAL_expr
+ DW_AT_name "dyn_object"
+ DW_AT_type :$array_type_label
}
subprogram {
- {external 1 flag}
- {DW_AT_name main}
- {DW_AT_low_pc $main_start DW_FORM_addr}
- {DW_AT_high_pc $main_end DW_FORM_addr}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start DW_FORM_addr
+ DW_AT_high_pc $main_end DW_FORM_addr
}
- }
+ }
}
}
@@ -129,7 +129,7 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dynamic-bit-offset.exp b/gdb/testsuite/gdb.dwarf2/dynamic-bit-offset.exp
new file mode 100644
index 0000000..072dd89
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dynamic-bit-offset.exp
@@ -0,0 +1,96 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test DW_AT_data_bit_offset with an expression. This is a DWARF
+# extension, but expected to be in DWARF 6. See
+# https://dwarfstd.org/issues/250501.1.html
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+require dwarf2_support
+
+standard_testfile ada-array-bound.c -debug.S
+
+# Set up the DWARF for the test.
+
+set asm_file [standard_output_file $srcfile2]
+Dwarf::assemble $asm_file {
+ global srcdir subdir srcfile
+
+ cu {} {
+ DW_TAG_compile_unit {
+ DW_AT_language @DW_LANG_Ada95
+ DW_AT_name $srcfile
+ } {
+ declare_labels byte array struct
+
+ byte: DW_TAG_base_type {
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name byte
+ }
+
+ array: DW_TAG_array_type {
+ DW_AT_name array_type
+ DW_AT_type :$byte
+ } {
+ DW_TAG_subrange_type {
+ DW_AT_type :$byte
+ DW_AT_upper_bound 3 DW_FORM_sdata
+ }
+ }
+
+ struct: DW_TAG_structure_type {
+ DW_AT_name discriminated
+ DW_AT_byte_size 4 DW_FORM_sdata
+ } {
+ DW_TAG_member {
+ DW_AT_name disc
+ DW_AT_type :$byte
+ DW_AT_data_member_location 0 DW_FORM_sdata
+ }
+
+ # We know this is always at offset 1 but use an
+ # expression just to test this code path. This is a
+ # DWARF extension. See
+ # https://dwarfstd.org/issues/250501.1.html.
+ DW_TAG_member {
+ DW_AT_name nums
+ DW_AT_type :$array
+ DW_AT_data_bit_offset {DW_OP_lit8} SPECIAL_expr
+ }
+ }
+
+ DW_TAG_variable {
+ DW_AT_name "value"
+ DW_AT_type :$struct
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "our_data"]
+ } SPECIAL_expr
+ }
+ }
+ }
+}
+
+if {[prepare_for_testing "failed to prepare" ${testfile} \
+ [list $srcfile $asm_file] {nodebug}]} {
+ return -1
+}
+
+gdb_test_no_output "set language ada"
+gdb_test "print value" \
+ [string_to_regexp " = (disc => 3, nums => (7, 11, 13))"]
diff --git a/gdb/testsuite/gdb.dwarf2/dynarr-ptr.c b/gdb/testsuite/gdb.dwarf2/dynarr-ptr.c
index 6cb9c6b..29e01d1 100644
--- a/gdb/testsuite/gdb.dwarf2/dynarr-ptr.c
+++ b/gdb/testsuite/gdb.dwarf2/dynarr-ptr.c
@@ -1,4 +1,4 @@
-/* Copyright 2014-2024 Free Software Foundation, Inc.
+/* Copyright 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp b/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp
index 3b7fb72..5312c96 100644
--- a/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,83 +34,83 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
- DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_Ada95}
- {DW_AT_name foo.adb}
- {DW_AT_comp_dir /tmp}
- } {
- declare_labels integer_label array_label array_ptr_label \
- array_typedef_label
- set ptr_size [get_sizeof "void *" 96]
+ DW_TAG_compile_unit {
+ DW_AT_language @DW_LANG_Ada95
+ DW_AT_name foo.adb
+ DW_AT_comp_dir /tmp
+ } {
+ declare_labels integer_label array_label array_ptr_label \
+ array_typedef_label
+ set ptr_size [get_sizeof "void *" 96]
set int_size [get_sizeof "int" 4]
- integer_label: DW_TAG_base_type {
- {DW_AT_byte_size $int_size DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
- }
+ integer_label: DW_TAG_base_type {
+ DW_AT_byte_size $int_size DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
+ }
array_label: DW_TAG_array_type {
- {DW_AT_name foo__array_type}
- {DW_AT_type :$integer_label}
- {external 1 flag}
+ DW_AT_name foo__array_type
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
} {
DW_TAG_subrange_type {
- {DW_AT_type :$integer_label}
- {DW_AT_lower_bound {
- DW_OP_push_object_address
- DW_OP_const1u [expr {2 * $int_size}]
- DW_OP_minus
- DW_OP_deref_size $int_size
- } SPECIAL_expr}
- {DW_AT_upper_bound {
- DW_OP_push_object_address
+ DW_AT_type :$integer_label
+ DW_AT_lower_bound {
+ DW_OP_push_object_address
+ DW_OP_const1u [expr {2 * $int_size}]
+ DW_OP_minus
+ DW_OP_deref_size $int_size
+ } SPECIAL_expr
+ DW_AT_upper_bound {
+ DW_OP_push_object_address
DW_OP_const1u $int_size
- DW_OP_minus
- DW_OP_deref_size $int_size
- } SPECIAL_expr}
+ DW_OP_minus
+ DW_OP_deref_size $int_size
+ } SPECIAL_expr
}
}
- array_ptr_label: DW_TAG_pointer_type {
- {DW_AT_byte_size $ptr_size DW_FORM_data1}
- {DW_AT_type :$array_label}
- }
- array_typedef_label: DW_TAG_typedef {
- {DW_AT_name "foo__array_ptr"}
- {DW_AT_type :$array_ptr_label}
- }
- DW_TAG_variable {
- {DW_AT_name foo__three_ptr}
- {DW_AT_type :$array_ptr_label}
- {DW_AT_location {
- DW_OP_addr [gdb_target_symbol table_1_ptr]
- } SPECIAL_expr}
- {external 1 flag}
- }
- DW_TAG_variable {
- {DW_AT_name foo__three_ptr_tdef}
- {DW_AT_type :$array_typedef_label}
- {DW_AT_location {
- DW_OP_addr [gdb_target_symbol table_1_ptr]
- } SPECIAL_expr}
- {external 1 flag}
- }
- DW_TAG_variable {
- {DW_AT_name foo__five_ptr}
- {DW_AT_type :$array_ptr_label}
- {DW_AT_location {
- DW_OP_addr [gdb_target_symbol table_2_ptr]
- } SPECIAL_expr}
- {external 1 flag}
- }
- DW_TAG_variable {
- {DW_AT_name foo__five_ptr_tdef}
- {DW_AT_type :$array_typedef_label}
- {DW_AT_location {
- DW_OP_addr [gdb_target_symbol table_2_ptr]
- } SPECIAL_expr}
- {external 1 flag}
- }
+ array_ptr_label: DW_TAG_pointer_type {
+ DW_AT_byte_size $ptr_size DW_FORM_data1
+ DW_AT_type :$array_label
+ }
+ array_typedef_label: DW_TAG_typedef {
+ DW_AT_name "foo__array_ptr"
+ DW_AT_type :$array_ptr_label
+ }
+ DW_TAG_variable {
+ DW_AT_name foo__three_ptr
+ DW_AT_type :$array_ptr_label
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol table_1_ptr]
+ } SPECIAL_expr
+ DW_AT_external 1 flag
+ }
+ DW_TAG_variable {
+ DW_AT_name foo__three_ptr_tdef
+ DW_AT_type :$array_typedef_label
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol table_1_ptr]
+ } SPECIAL_expr
+ DW_AT_external 1 flag
+ }
+ DW_TAG_variable {
+ DW_AT_name foo__five_ptr
+ DW_AT_type :$array_ptr_label
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol table_2_ptr]
+ } SPECIAL_expr
+ DW_AT_external 1 flag
+ }
+ DW_TAG_variable {
+ DW_AT_name foo__five_ptr_tdef
+ DW_AT_type :$array_typedef_label
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol table_2_ptr]
+ } SPECIAL_expr
+ DW_AT_external 1 flag
+ }
}
}
}
@@ -124,7 +124,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp b/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp
index e4e0288..7d8bc21 100644
--- a/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp
+++ b/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,28 +37,28 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C_plus_plus}
- {name "cu1"}
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name "cu1"
} {
DW_TAG_variable {
- {name foo}
- {type %$int_label}
- {const_value 1 DW_FORM_sdata}
+ DW_AT_name foo
+ DW_AT_type %$int_label
+ DW_AT_const_value 1 DW_FORM_sdata
}
}
}
cu {} {
compile_unit {
- {language @DW_LANG_C_plus_plus}
- {name "cu2"}
- {ranges ${ranges_label} sec_offset}
- {low_pc {[lindex $main_func 0]}}
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name "cu2"
+ DW_AT_ranges ${ranges_label} sec_offset
+ DW_AT_low_pc [lindex $main_func 0]
} {
int_label: base_type {
- {byte_size 4 udata}
- {encoding @DW_ATE_signed}
- {name int}
+ DW_AT_byte_size 4 udata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
}
}
@@ -84,7 +84,7 @@ gdb_test_multiple "ptype foo" "" {
}
}
-require {expr $cu1_expanded == 1}
+require {expr {$cu1_expanded == 1}}
# Now check that cu2 has an address range starting at main.
set cu2_blockvector_re \
diff --git a/gdb/testsuite/gdb.dwarf2/entry-value-typedef-aarch64.S b/gdb/testsuite/gdb.dwarf2/entry-value-typedef-aarch64.S
index 062925f..73898e6 100644
--- a/gdb/testsuite/gdb.dwarf2/entry-value-typedef-aarch64.S
+++ b/gdb/testsuite/gdb.dwarf2/entry-value-typedef-aarch64.S
@@ -1,5 +1,5 @@
/*
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/entry-value-typedef-amd64.S b/gdb/testsuite/gdb.dwarf2/entry-value-typedef-amd64.S
index f56147a..9b661cb 100644
--- a/gdb/testsuite/gdb.dwarf2/entry-value-typedef-amd64.S
+++ b/gdb/testsuite/gdb.dwarf2/entry-value-typedef-amd64.S
@@ -1,5 +1,5 @@
/*
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/entry-value-typedef.cpp b/gdb/testsuite/gdb.dwarf2/entry-value-typedef.cpp
index a7d0174..3d07635 100644
--- a/gdb/testsuite/gdb.dwarf2/entry-value-typedef.cpp
+++ b/gdb/testsuite/gdb.dwarf2/entry-value-typedef.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2022-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/entry-value-typedef.exp b/gdb/testsuite/gdb.dwarf2/entry-value-typedef.exp
index 1c185c0..f84f0f3 100644
--- a/gdb/testsuite/gdb.dwarf2/entry-value-typedef.exp
+++ b/gdb/testsuite/gdb.dwarf2/entry-value-typedef.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" "$binfile" executable {c++}] != ""}
return
}
-clean_restart $binfile
+clean_restart $::testfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.dwarf2/enum-type-c++.cc b/gdb/testsuite/gdb.dwarf2/enum-type-c++.cc
index 691c7fc..126ad2b 100644
--- a/gdb/testsuite/gdb.dwarf2/enum-type-c++.cc
+++ b/gdb/testsuite/gdb.dwarf2/enum-type-c++.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/enum-type-c++.exp b/gdb/testsuite/gdb.dwarf2/enum-type-c++.exp
index 4f9610c..0febe62 100644
--- a/gdb/testsuite/gdb.dwarf2/enum-type-c++.exp
+++ b/gdb/testsuite/gdb.dwarf2/enum-type-c++.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/enum-type.exp b/gdb/testsuite/gdb.dwarf2/enum-type.exp
index ec12db5..f077c0a 100644
--- a/gdb/testsuite/gdb.dwarf2/enum-type.exp
+++ b/gdb/testsuite/gdb.dwarf2/enum-type.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,41 +26,41 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
- } {
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
+ } {
declare_labels integer_label uinteger_label
- integer_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
- }
+ integer_label: DW_TAG_base_type {
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
+ }
- uinteger_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_unsigned}
- {DW_AT_name {unsigned int}}
- }
+ uinteger_label: DW_TAG_base_type {
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name {unsigned int}
+ }
DW_TAG_enumeration_type {
- {DW_AT_name E}
- {DW_AT_type :$integer_label}
+ DW_AT_name E
+ DW_AT_type :$integer_label
} {
DW_TAG_enumerator {
- {DW_AT_name ONE}
- {DW_AT_const_value 1 DW_FORM_sdata}
+ DW_AT_name ONE
+ DW_AT_const_value 1 DW_FORM_sdata
}
}
DW_TAG_enumeration_type {
- {DW_AT_name EU}
- {DW_AT_type :$uinteger_label}
+ DW_AT_name EU
+ DW_AT_type :$uinteger_label
} {
DW_TAG_enumerator {
- {DW_AT_name TWO}
- {DW_AT_const_value 2 DW_FORM_sdata}
+ DW_AT_name TWO
+ DW_AT_const_value 2 DW_FORM_sdata
}
}
}
@@ -68,34 +68,34 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
- {DW_AT_name tmp.c}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name tmp.c
+ DW_AT_comp_dir /tmp
} {
declare_labels integer_label forward
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
DW_TAG_enumeration_type {
- {DW_AT_specification :$forward}
+ DW_AT_specification :$forward
} {
DW_TAG_enumerator {
- {DW_AT_name val1}
- {DW_AT_const_value 1 DW_FORM_sdata}
+ DW_AT_name val1
+ DW_AT_const_value 1 DW_FORM_sdata
}
}
DW_TAG_namespace {
- {DW_AT_name ns}
+ DW_AT_name ns
} {
forward: DW_TAG_enumeration_type {
- {DW_AT_name e}
- {DW_AT_type :$integer_label}
- {DW_AT_declaration 1 flag}
+ DW_AT_name e
+ DW_AT_type :$integer_label
+ DW_AT_declaration 1 flag
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.c b/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.c
index 47fd822..ba0ac43 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.c
+++ b/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp b/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp
index 0bbe84e..5134420 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,53 +40,53 @@ Dwarf::assemble $asm_file {
set debug_addr_lbl [debug_addr_label]
compile_unit {
- {language @DW_LANG_C}
- {name ${srcfile}}
- {DW_AT_comp_dir ${objdir}}
- {DW_AT_GNU_dwo_id 0x1234 DW_FORM_data8}
- } {
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile}
+ DW_AT_comp_dir ${objdir}
+ DW_AT_GNU_dwo_id 0x1234 DW_FORM_data8
+ } {
declare_labels int4_type struct_type
int4_type: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
struct_type: DW_TAG_structure_type {
- {DW_AT_name "foo_t"}
- {DW_AT_byte_size 12 DW_FORM_sdata}
+ DW_AT_name "foo_t"
+ DW_AT_byte_size 12 DW_FORM_sdata
} {
member {
- {name "aa"}
- {type :$int4_type}
- {data_member_location 0 data1}
+ DW_AT_name "aa"
+ DW_AT_type :$int4_type
+ DW_AT_data_member_location 0 data1
}
member {
- {name "bb"}
- {type :$int4_type}
- {data_member_location 4 data1}
+ DW_AT_name "bb"
+ DW_AT_type :$int4_type
+ DW_AT_data_member_location 4 data1
}
member {
- {name "cc"}
- {type :$int4_type}
- {data_member_location 8 data1}
+ DW_AT_name "cc"
+ DW_AT_type :$int4_type
+ DW_AT_data_member_location 8 data1
}
}
DW_TAG_variable {
- {DW_AT_name global_var}
- {DW_AT_type :$struct_type}
- {DW_AT_location {
+ DW_AT_name global_var
+ DW_AT_type :$struct_type
+ DW_AT_location {
DW_OP_GNU_addr_index [gdb_target_symbol global_var]
- } SPECIAL_expr}
- {external 1 flag}
+ } SPECIAL_expr
+ DW_AT_external 1 flag
}
subprogram {
- {external 1 flag}
- {DW_AT_name main DW_FORM_string}
- {MACRO_AT_func {main}}
+ DW_AT_external 1 flag
+ DW_AT_name main DW_FORM_string
+ MACRO_AT_func {main}
}
}
}
@@ -94,11 +94,11 @@ Dwarf::assemble $asm_file {
# The information that will remain in the .o file.
cu {} {
compile_unit {
- {DW_AT_GNU_dwo_name ${binfile}.dwo DW_FORM_strp}
- {DW_AT_comp_dir ${objdir}}
- {DW_AT_GNU_dwo_id 0x1234 DW_FORM_data8}
- {DW_AT_GNU_addr_base $debug_addr_lbl}
- } {
+ DW_AT_GNU_dwo_name ${binfile}.dwo DW_FORM_strp
+ DW_AT_comp_dir ${objdir}
+ DW_AT_GNU_dwo_id 0x1234 DW_FORM_data8
+ DW_AT_GNU_addr_base $debug_addr_lbl
+ } {
# Nothing.
}
}
@@ -116,7 +116,7 @@ if { [build_executable_and_dwo_files "${testfile}.exp" ${binfile} {nodebug} \
# Now we can start GDB.
clean_restart ${testfile}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/fission-base.S b/gdb/testsuite/gdb.dwarf2/fission-base.S
index e009cef..b242197 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-base.S
+++ b/gdb/testsuite/gdb.dwarf2/fission-base.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/fission-base.c b/gdb/testsuite/gdb.dwarf2/fission-base.c
index 79dce8d..231e1b7 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-base.c
+++ b/gdb/testsuite/gdb.dwarf2/fission-base.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/fission-base.exp b/gdb/testsuite/gdb.dwarf2/fission-base.exp
index d4038cc..2f115d1 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-base.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-base.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,16 +28,16 @@ standard_testfile .S
set obj [standard_output_file "${testfile}.o"]
set dwo [standard_output_file "${testfile}.dwo"]
-if [build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \
- [list $srcfile \
- [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \
- $obj]] {
+if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \
+ [list $srcfile \
+ [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \
+ $obj]]} {
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/fission-dw-form-strx.exp b/gdb/testsuite/gdb.dwarf2/fission-dw-form-strx.exp
new file mode 100644
index 0000000..5f778e6
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/fission-dw-form-strx.exp
@@ -0,0 +1,88 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check support for a DW_FORM_strx attribute in a dwo file.
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+require dwarf2_support
+
+standard_testfile main.c -dw.S -dwo.S
+
+set main_asm_file [standard_output_file $srcfile2]
+set dwo_asm_file [standard_output_file $srcfile3]
+
+# Debug info in the main file.
+Dwarf::assemble $main_asm_file {
+ cu {
+ version 5
+ dwo_id 0xF00D
+ } {
+ compile_unit {
+ DW_AT_dwo_name ${::gdb_test_file_name}.dwo DW_FORM_strp
+ } {}
+ }
+}
+
+# Debug info in the DWO file.
+Dwarf::assemble $dwo_asm_file {
+ debug_str_offsets { dwo 1 } int
+
+ cu {
+ fission 1
+ version 5
+ dwo_id 0xF00D
+ } {
+ compile_unit {} {
+ declare_labels int4_type
+
+ int4_type: DW_TAG_base_type {
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name 0 DW_FORM_strx_id
+ }
+
+ DW_TAG_variable {
+ DW_AT_name global_var
+ DW_AT_type :$int4_type
+ DW_AT_location {
+ DW_OP_const1u 12
+ DW_OP_stack_value
+ } SPECIAL_expr
+ }
+ }
+ }
+}
+
+# Build main file.
+if { [build_executable "${testfile}.exp" $binfile \
+ [list ${srcfile} ${main_asm_file}] {nodebug}] } {
+ return
+}
+
+# Build DWO file.
+set dwo_file [standard_output_file ${testfile}.dwo]
+if { [gdb_compile_shlib $dwo_asm_file $dwo_file nodebug] != "" } {
+ return
+}
+
+if { [is_remote host] } {
+ gdb_remote_download host $dwo_file
+}
+
+clean_restart $::testfile
+
+gdb_test "ptype global_var" "type = int"
diff --git a/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.S b/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.S
index ac1d796..3748907 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.S
+++ b/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp b/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp
index 44c98a6..62f80a7 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,16 +33,17 @@ standard_testfile .S
set obj [standard_output_file "${testfile}.o"]
set dwo [standard_output_file "${testfile}.dwo"]
-if [build_executable_and_dwo_files "$testfile.exp" "${binfile}" \
- {nodebug pie} \
- [list $srcfile [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \
- $obj]] {
+if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" \
+ {nodebug pie} \
+ [list $srcfile \
+ [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \
+ $obj]]} {
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/fission-loclists.S b/gdb/testsuite/gdb.dwarf2/fission-loclists.S
index 9a5bf23..daa6945 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-loclists.S
+++ b/gdb/testsuite/gdb.dwarf2/fission-loclists.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/fission-loclists.exp b/gdb/testsuite/gdb.dwarf2/fission-loclists.exp
index e7e395b..991725e 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-loclists.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-loclists.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,16 +28,16 @@ standard_testfile .S
set obj [standard_output_file "${testfile}.o"]
set dwo [standard_output_file "${testfile}.dwo"]
-if [build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \
- [list $srcfile \
- [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \
- $obj]] {
+if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \
+ [list $srcfile \
+ [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \
+ $obj]]} {
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/fission-mix-2.c b/gdb/testsuite/gdb.dwarf2/fission-mix-2.c
index d557070..1702ed5 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-mix-2.c
+++ b/gdb/testsuite/gdb.dwarf2/fission-mix-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/fission-mix.c b/gdb/testsuite/gdb.dwarf2/fission-mix.c
index e4d4a70..d7e000c 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-mix.c
+++ b/gdb/testsuite/gdb.dwarf2/fission-mix.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/fission-mix.exp b/gdb/testsuite/gdb.dwarf2/fission-mix.exp
index 2079802..e6a430c 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-mix.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-mix.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ if {[gdb_compile "$objfile $objfile2" $binfile executable {debug}] != "" } {
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
gdb_test "break -q main" "Breakpoint .*"
diff --git a/gdb/testsuite/gdb.dwarf2/fission-mix.h b/gdb/testsuite/gdb.dwarf2/fission-mix.h
index 653ea50..d99497a 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-mix.h
+++ b/gdb/testsuite/gdb.dwarf2/fission-mix.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.c b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.c
index d546924..c1a2079 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.c
+++ b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp
index 567049a..e252c86 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -51,29 +51,29 @@ Dwarf::assemble $asm_file_1 {
set debug_addr_lbl [debug_addr_label]
compile_unit {
- {language @DW_LANG_C}
- {name ${srcfile}}
- {DW_AT_comp_dir ${objdir}}
- {DW_AT_GNU_dwo_id 0x1234 DW_FORM_data8}
- } {
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile}
+ DW_AT_comp_dir ${objdir}
+ DW_AT_GNU_dwo_id 0x1234 DW_FORM_data8
+ } {
int4_type: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
subprogram {
- {external 1 flag}
- {DW_AT_name func DW_FORM_string}
- {MACRO_AT_func {func}}
- {DW_AT_type :$int4_type}
+ DW_AT_external 1 flag
+ DW_AT_name func DW_FORM_string
+ MACRO_AT_func {func}
+ DW_AT_type :$int4_type
} {
DW_TAG_formal_parameter {
- {DW_AT_name arg}
- {DW_AT_type :$int4_type}
- {DW_AT_location {
+ DW_AT_name arg
+ DW_AT_type :$int4_type
+ DW_AT_location {
DW_OP_GNU_addr_index [gdb_target_symbol global_param]
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
}
@@ -100,12 +100,12 @@ Dwarf::assemble $asm_file_1 {
# The information that will remain in the .o file.
cu {} {
compile_unit {
- {DW_AT_GNU_dwo_name ${binfile}-1-dw.dwo DW_FORM_strp}
- {DW_AT_comp_dir ${objdir}}
- {DW_AT_GNU_dwo_id 0x1234 DW_FORM_data8}
- {DW_AT_GNU_addr_base $debug_addr_lbl}
- {stmt_list $lines_table DW_FORM_sec_offset}
- } {
+ DW_AT_GNU_dwo_name ${binfile}-1-dw.dwo DW_FORM_strp
+ DW_AT_comp_dir ${objdir}
+ DW_AT_GNU_dwo_id 0x1234 DW_FORM_data8
+ DW_AT_GNU_addr_base $debug_addr_lbl
+ DW_AT_stmt_list $lines_table DW_FORM_sec_offset
+ } {
# Nothing.
}
}
@@ -131,24 +131,24 @@ Dwarf::assemble $asm_file_2 {
set debug_addr_lbl [debug_addr_label]
compile_unit {
- {language @DW_LANG_C}
- {name ${srcfile}}
- {DW_AT_comp_dir ${objdir}}
- {DW_AT_GNU_dwo_id 0x4567 DW_FORM_data8}
- } {
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile}
+ DW_AT_comp_dir ${objdir}
+ DW_AT_GNU_dwo_id 0x4567 DW_FORM_data8
+ } {
int4_type: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
subprogram {
- {external 1 flag}
- {DW_AT_name main DW_FORM_string}
- {MACRO_AT_func {main}}
- {DW_AT_type :$int4_type}
- {DW_AT_decl_file 1 data1}
- {DW_AT_decl_line 29 data1}
+ DW_AT_external 1 flag
+ DW_AT_name main DW_FORM_string
+ MACRO_AT_func {main}
+ DW_AT_type :$int4_type
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line 29 data1
}
}
}
@@ -182,12 +182,12 @@ Dwarf::assemble $asm_file_2 {
# The information that will remain in the .o file.
cu {} {
compile_unit {
- {DW_AT_GNU_dwo_name ${binfile}-2-dw.dwo DW_FORM_strp}
- {DW_AT_comp_dir ${objdir}}
- {DW_AT_GNU_dwo_id 0x4567 DW_FORM_data8}
- {DW_AT_GNU_addr_base $debug_addr_lbl}
- {stmt_list $lines_table DW_FORM_sec_offset}
- } {
+ DW_AT_GNU_dwo_name ${binfile}-2-dw.dwo DW_FORM_strp
+ DW_AT_comp_dir ${objdir}
+ DW_AT_GNU_dwo_id 0x4567 DW_FORM_data8
+ DW_AT_GNU_addr_base $debug_addr_lbl
+ DW_AT_stmt_list $lines_table DW_FORM_sec_offset
+ } {
# Nothing.
}
}
@@ -196,16 +196,16 @@ Dwarf::assemble $asm_file_2 {
# Compile all of the input files, split the DWARF into the .dwo files.
set obj1 [standard_output_file "${testfile}-1-dw.o"]
set obj2 [standard_output_file "${testfile}-2-dw.o"]
-if [build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \
- [list $asm_file_1 [list nodebug split-dwo] $obj1] \
- [list $asm_file_2 [list nodebug split-dwo] $obj2] \
- [list $srcfile [list nodebug]]] {
+if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \
+ [list $asm_file_1 [list nodebug split-dwo] $obj1] \
+ [list $asm_file_2 [list nodebug split-dwo] $obj2] \
+ [list $srcfile [list nodebug]]]} {
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.c b/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.c
index 47fd822..ba0ac43 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.c
+++ b/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp b/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp
index 28cfa64..e2bae0a 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,53 +37,53 @@ Dwarf::assemble $asm_file {
set debug_addr_base [debug_addr_label]
compile_unit {
- {language @DW_LANG_C}
- {name ${srcfile}}
- {DW_AT_comp_dir .}
- {DW_AT_GNU_dwo_id 0x1234 DW_FORM_data8}
- } {
+ DW_AT_language @DW_LANG_C
+ DW_AT_name ${srcfile}
+ DW_AT_comp_dir .
+ DW_AT_GNU_dwo_id 0x1234 DW_FORM_data8
+ } {
declare_labels int4_type struct_type
int4_type: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
struct_type: DW_TAG_structure_type {
- {DW_AT_name "foo_t"}
- {DW_AT_byte_size 12 DW_FORM_sdata}
+ DW_AT_name "foo_t"
+ DW_AT_byte_size 12 DW_FORM_sdata
} {
member {
- {name "aa"}
- {type :$int4_type}
- {data_member_location 0 data1}
+ DW_AT_name "aa"
+ DW_AT_type :$int4_type
+ DW_AT_data_member_location 0 data1
}
member {
- {name "bb"}
- {type :$int4_type}
- {data_member_location 4 data1}
+ DW_AT_name "bb"
+ DW_AT_type :$int4_type
+ DW_AT_data_member_location 4 data1
}
member {
- {name "cc"}
- {type :$int4_type}
- {data_member_location 8 data1}
+ DW_AT_name "cc"
+ DW_AT_type :$int4_type
+ DW_AT_data_member_location 8 data1
}
}
DW_TAG_variable {
- {DW_AT_name global_var}
- {DW_AT_type :$struct_type}
- {DW_AT_location {
+ DW_AT_name global_var
+ DW_AT_type :$struct_type
+ DW_AT_location {
DW_OP_GNU_addr_index [gdb_target_symbol global_var]
- } SPECIAL_expr}
- {external 1 flag}
+ } SPECIAL_expr
+ DW_AT_external 1 flag
}
subprogram {
- {external 1 flag}
- {DW_AT_name main DW_FORM_string}
- {MACRO_AT_func {main}}
+ DW_AT_external 1 flag
+ DW_AT_name main DW_FORM_string
+ MACRO_AT_func {main}
}
}
}
@@ -91,11 +91,11 @@ Dwarf::assemble $asm_file {
# The information that will remain in the .o file.
cu {} {
compile_unit {
- {DW_AT_GNU_dwo_name ${gdb_test_file_name}.dwo DW_FORM_strp}
- {DW_AT_comp_dir .}
- {DW_AT_GNU_dwo_id 0x1234 DW_FORM_data8}
- {DW_AT_GNU_addr_base $debug_addr_base}
- } {
+ DW_AT_GNU_dwo_name ${gdb_test_file_name}.dwo DW_FORM_strp
+ DW_AT_comp_dir .
+ DW_AT_GNU_dwo_id 0x1234 DW_FORM_data8
+ DW_AT_GNU_addr_base $debug_addr_base
+ } {
# Nothing.
}
}
@@ -113,7 +113,7 @@ if { [build_executable_and_dwo_files "${testfile}.exp" ${testfile} {nodebug} \
# Now we can start GDB.
clean_restart ${testfile}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/fission-reread.S b/gdb/testsuite/gdb.dwarf2/fission-reread.S
index 279f6f3..18f4fa4 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-reread.S
+++ b/gdb/testsuite/gdb.dwarf2/fission-reread.S
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/fission-reread.exp b/gdb/testsuite/gdb.dwarf2/fission-reread.exp
index 1604594..8a12377 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-reread.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-reread.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,8 +38,8 @@ set dwo_options $options
lappend dwo_options split-dwo
lappend dwo_options additional_flags=-DDWO=\"$dwo\"
-if [build_executable_and_dwo_files "$testfile.exp" "${binfile}" $options \
- [list $srcfile $dwo_options $obj]] {
+if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" $options \
+ [list $srcfile $dwo_options $obj]]} {
return -1
}
@@ -62,7 +62,7 @@ pass "$testfile - unload"
remote_file target delete $dwo
save_vars { GDBFLAGS } {
append GDBFLAGS " -iex \"maint set dwarf synchronous on\""
- clean_restart $binfile
+ clean_restart $::testfile
}
set output_dir [standard_output_file ""]
set cmd "save gdb-index"
diff --git a/gdb/testsuite/gdb.dwarf2/fission-with-type-unit.c b/gdb/testsuite/gdb.dwarf2/fission-with-type-unit.c
new file mode 100644
index 0000000..42009be
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/fission-with-type-unit.c
@@ -0,0 +1,23 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+int
+main (int argc, char **argv)
+{
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.dwarf2/fission-with-type-unit.exp b/gdb/testsuite/gdb.dwarf2/fission-with-type-unit.exp
new file mode 100644
index 0000000..58cda29
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/fission-with-type-unit.exp
@@ -0,0 +1,109 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This test is meant to reproduce a bug where having a DWO file with a type unit
+# as the first unit would cause an internal error on CU expansion.
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+require dwarf2_support
+
+standard_testfile .c -dw.S -dwo.S
+
+set main_asm_file [standard_output_file $srcfile2]
+set dwo_asm_file [standard_output_file $srcfile3]
+
+# Debug info in the main file.
+Dwarf::assemble $main_asm_file {
+ cu {
+ version 5
+ dwo_id 0xF00D
+ } {
+ compile_unit {
+ DW_AT_dwo_name ${::gdb_test_file_name}.dwo DW_FORM_strp
+ } {}
+ }
+}
+
+# Debug info in the DWO file.
+Dwarf::assemble $dwo_asm_file {
+ tu {
+ fission 1
+ version 5
+ } 0xCAFE "the_type" {
+ type_unit {} {
+ the_type: base_type {
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
+ }
+ }
+ }
+
+ cu {
+ fission 1
+ version 5
+ dwo_id 0xF00D
+ } {
+ compile_unit {} {
+ declare_labels int4_type
+
+ int4_type: DW_TAG_base_type {
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
+ }
+
+ DW_TAG_variable {
+ DW_AT_name global_var
+ DW_AT_type :$int4_type
+ DW_AT_location {
+ DW_OP_const1u 12
+ DW_OP_stack_value
+ } SPECIAL_expr
+ }
+ }
+ }
+}
+
+# Build main file.
+if { [build_executable "${testfile}.exp" $binfile \
+ [list ${srcfile} ${main_asm_file}] {nodebug}] } {
+ return
+}
+
+# Build DWO file.
+set dwo_file [standard_output_file ${testfile}.dwo]
+if { [gdb_compile_shlib $dwo_asm_file $dwo_file nodebug] != "" } {
+ return
+}
+
+if { [is_remote host] } {
+ gdb_remote_download host $dwo_file
+}
+
+clean_restart ${testfile}
+
+# This would cause an internal error.
+gdb_test_no_output "maint expand-symtabs"
+
+# Sanity check that the CU was correctly loaded.
+gdb_test "print global_var" " = 12"
+
+# Test again just to see if the symbol can be found without having expanded the
+# symtab first.
+clean_restart ${testfile}
+gdb_test "print global_var" " = 12" "print global_var without symtab expansion"
diff --git a/gdb/testsuite/gdb.dwarf2/formdata16.exp b/gdb/testsuite/gdb.dwarf2/formdata16.exp
index ad1bcf8..96d8211 100644
--- a/gdb/testsuite/gdb.dwarf2/formdata16.exp
+++ b/gdb/testsuite/gdb.dwarf2/formdata16.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ standard_testfile main.c -dw.S
# We need to know the endianess in order
# to write some of the debugging info we'd like to generate.
-if [prepare_for_testing "failed to prepare for endianness test" ${testfile} ${srcfile}] {
+if {[prepare_for_testing "failed to prepare for endianness test" ${testfile} ${srcfile}]} {
return -1
}
@@ -50,33 +50,33 @@ Dwarf::assemble $asm_file {
declare_labels int_label sint_label
int_label: DW_TAG_base_type {
- {DW_AT_byte_size 16 DW_FORM_udata}
- {DW_AT_encoding @DW_ATE_unsigned}
- {DW_AT_name "__uint128"}
+ DW_AT_byte_size 16 DW_FORM_udata
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name "__uint128"
}
sint_label: DW_TAG_base_type {
- {DW_AT_byte_size 16 DW_FORM_udata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name "__int128"}
+ DW_AT_byte_size 16 DW_FORM_udata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name "__int128"
}
DW_TAG_variable {
- {name xxx}
- {type :$int_label}
- {const_value $pair DW_FORM_data16}
+ DW_AT_name xxx
+ DW_AT_type :$int_label
+ DW_AT_const_value $pair DW_FORM_data16
}
DW_TAG_variable {
- {name yyy}
- {type :$int_label}
- {const_value $pair2 DW_FORM_data16}
+ DW_AT_name yyy
+ DW_AT_type :$int_label
+ DW_AT_const_value $pair2 DW_FORM_data16
}
DW_TAG_variable {
- {name sss}
- {type :$sint_label}
- {const_value $negative DW_FORM_data16}
+ DW_AT_name sss
+ DW_AT_type :$sint_label
+ DW_AT_const_value $negative DW_FORM_data16
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/fortran-var-string.c b/gdb/testsuite/gdb.dwarf2/fortran-var-string.c
index 327371c..8eb264a 100644
--- a/gdb/testsuite/gdb.dwarf2/fortran-var-string.c
+++ b/gdb/testsuite/gdb.dwarf2/fortran-var-string.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/fortran-var-string.exp b/gdb/testsuite/gdb.dwarf2/fortran-var-string.exp
index 98c727a..5517375 100644
--- a/gdb/testsuite/gdb.dwarf2/fortran-var-string.exp
+++ b/gdb/testsuite/gdb.dwarf2/fortran-var-string.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,92 +40,92 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_Fortran90}
- {DW_AT_name fortran-var-string.f90}
- {DW_AT_comp_dir /tmp}
- } {
+ DW_AT_language @DW_LANG_Fortran90
+ DW_AT_name fortran-var-string.f90
+ DW_AT_comp_dir /tmp
+ } {
declare_labels integer_label string_label array_lb_label \
array_ub_label
DW_TAG_subprogram {
- {name main}
- {low_pc $main_helper_start addr}
- {high_pc $main_helper_len data8}
- {DW_AT_type :$integer_label}
- {DW_AT_decl_file 1 data1}
- {DW_AT_decl_line 1 data1}
+ DW_AT_name main
+ DW_AT_low_pc $main_helper_start addr
+ DW_AT_high_pc $main_helper_len data8
+ DW_AT_type :$integer_label
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line 1 data1
}
DW_TAG_subprogram {
- {name test_1_func}
- {low_pc $main_start addr}
- {high_pc $main_len data8}
- {DW_AT_type :$integer_label}
- {DW_AT_decl_file 1 data1}
- {DW_AT_decl_line 2 data1}
+ DW_AT_name test_1_func
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc $main_len data8
+ DW_AT_type :$integer_label
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line 2 data1
} {
formal_parameter {
- {name arg1}
- {type :$string_label}
+ DW_AT_name arg1
+ DW_AT_type :$string_label
}
}
DW_TAG_subprogram {
- {name test_2_func}
- {low_pc $main_start addr}
- {high_pc $main_len data8}
- {DW_AT_type :$integer_label}
- {DW_AT_decl_file 1 data1}
- {DW_AT_decl_line 3 data1}
+ DW_AT_name test_2_func
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc $main_len data8
+ DW_AT_type :$integer_label
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line 3 data1
} {
formal_parameter {
- {name arg1}
- {type :$array_ub_label}
+ DW_AT_name arg1
+ DW_AT_type :$array_ub_label
}
}
DW_TAG_subprogram {
- {name test_3_func}
- {low_pc $main_start addr}
- {high_pc $main_len data8}
- {DW_AT_type :$integer_label}
- {DW_AT_decl_file 1 data1}
- {DW_AT_decl_line 4 data1}
+ DW_AT_name test_3_func
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc $main_len data8
+ DW_AT_type :$integer_label
+ DW_AT_decl_file 1 data1
+ DW_AT_decl_line 4 data1
} {
formal_parameter {
- {name arg1}
- {type :$array_lb_label}
+ DW_AT_name arg1
+ DW_AT_type :$array_lb_label
}
}
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size $int_size DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size $int_size DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
string_label: DW_TAG_string_type {
- {DW_AT_byte_size $int_size DW_FORM_sdata}
- {DW_AT_name .str.arg}
- {DW_AT_string_length {} DW_FORM_block1}
+ DW_AT_byte_size $int_size DW_FORM_sdata
+ DW_AT_name .str.arg
+ DW_AT_string_length {} DW_FORM_block1
}
array_lb_label: DW_TAG_array_type {
- {DW_AT_ordering 1 data1}
- {DW_AT_type :$integer_label}
+ DW_AT_ordering 1 data1
+ DW_AT_type :$integer_label
} {
DW_TAG_subrange_type {
- {DW_AT_lower_bound {} DW_FORM_block1}
- {DW_AT_upper_bound 10 DW_FORM_data1}
+ DW_AT_lower_bound {} DW_FORM_block1
+ DW_AT_upper_bound 10 DW_FORM_data1
}
}
array_ub_label: DW_TAG_array_type {
- {DW_AT_ordering 1 data1}
- {DW_AT_type :$integer_label}
+ DW_AT_ordering 1 data1
+ DW_AT_type :$integer_label
} {
DW_TAG_subrange_type {
- {DW_AT_upper_bound {} DW_FORM_block1}
+ DW_AT_upper_bound {} DW_FORM_block1
}
}
}
@@ -141,7 +141,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp b/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp
index b734c30..7d55f73 100644
--- a/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp
@@ -1,4 +1,4 @@
-# Copyright 2023 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@ load_lib dwarf.exp
# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support
+require !readnow
standard_testfile main.c -debug.S
@@ -32,40 +33,40 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
+ DW_AT_language @DW_LANG_C_plus_plus
} {
# The new indexer has special code to compute the full
# name of an object that uses a specification that appears
# later in the DWARF.
DW_TAG_variable {
- {DW_AT_specification %$spec}
- {DW_AT_location {
+ DW_AT_specification %$spec
+ DW_AT_location {
DW_OP_const1u 23
DW_OP_stack_value
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
}
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
+ DW_AT_language @DW_LANG_C_plus_plus
} {
declare_labels myint
myint: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name myint}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name myint
}
DW_TAG_namespace {
- {DW_AT_name ns}
+ DW_AT_name ns
} {
spec: DW_TAG_variable {
- {DW_AT_name v}
- {DW_AT_type :$myint}
- {DW_AT_declaration 1 DW_FORM_flag_present}
+ DW_AT_name v
+ DW_AT_type :$myint
+ DW_AT_declaration 1 DW_FORM_flag_present
}
}
}
@@ -98,6 +99,11 @@ foreach_with_prefix worker_threads $worker_threads_list {
gdb_load $binfile
+ set index [have_index $binfile]
+ if { ![string eq $index ""] } {
+ return
+ }
+
gdb_test "pipe maint print objfiles | grep ns::v" \
"$ws+qualified:$ws+ns::v" \
"v has parent ns"
diff --git a/gdb/testsuite/gdb.dwarf2/forward-spec.exp b/gdb/testsuite/gdb.dwarf2/forward-spec.exp
index 5d41f87..e534da2 100644
--- a/gdb/testsuite/gdb.dwarf2/forward-spec.exp
+++ b/gdb/testsuite/gdb.dwarf2/forward-spec.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,9 +32,9 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
} {
declare_labels spec myint
@@ -43,26 +43,26 @@ Dwarf::assemble $asm_file {
# name of an object that uses a specification that appears
# later in the DWARF.
DW_TAG_variable {
- {DW_AT_specification :$spec}
- {DW_AT_location {
+ DW_AT_specification :$spec
+ DW_AT_location {
DW_OP_const1u 23
DW_OP_stack_value
- } SPECIAL_expr}
+ } SPECIAL_expr
}
myint: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name myint}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name myint
}
DW_TAG_namespace {
- {DW_AT_name ns}
+ DW_AT_name ns
} {
spec: DW_TAG_variable {
- {DW_AT_name v}
- {DW_AT_type :$myint}
- {DW_AT_declaration 1 DW_FORM_flag_present}
+ DW_AT_name v
+ DW_AT_type :$myint
+ DW_AT_declaration 1 DW_FORM_flag_present
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S b/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S
index 2d87d78..1909122 100644
--- a/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S
+++ b/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S
@@ -1,4 +1,4 @@
-/* Copyright 2020-2024 Free Software Foundation, Inc.
+/* Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp b/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp
index c3ac38a..ad19ce7 100644
--- a/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp
+++ b/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -46,44 +46,44 @@ Dwarf::assemble $dwarf_asm {
cu { label cu_label addr_size 4 } {
DW_TAG_compile_unit {
- {DW_AT_name $srcfile}
- {DW_AT_stmt_list $stmt_list DW_FORM_sec_offset}
- {DW_AT_language @DW_LANG_C99}
- {DW_AT_low_pc __cu_low_pc DW_FORM_addr}
- {DW_AT_high_pc __cu_high_pc DW_FORM_addr}
+ DW_AT_name $srcfile
+ DW_AT_stmt_list $stmt_list DW_FORM_sec_offset
+ DW_AT_language @DW_LANG_C99
+ DW_AT_low_pc __cu_low_pc DW_FORM_addr
+ DW_AT_high_pc __cu_high_pc DW_FORM_addr
} {
DW_TAG_subprogram {
- {DW_AT_name "_start"}
- {DW_AT_low_pc __start_low_pc DW_FORM_addr}
- {DW_AT_high_pc __start_high_pc DW_FORM_addr}
+ DW_AT_name "_start"
+ DW_AT_low_pc __start_low_pc DW_FORM_addr
+ DW_AT_high_pc __start_high_pc DW_FORM_addr
} {
DW_TAG_inlined_subroutine {
- {DW_AT_abstract_origin :$foo_subprogram}
- {DW_AT_low_pc __foo_low_pc DW_FORM_addr}
- {DW_AT_high_pc __foo_high_pc DW_FORM_addr}
- {DW_AT_call_file 1 DW_FORM_data1}
- {DW_AT_call_line 13 DW_FORM_data1}
+ DW_AT_abstract_origin :$foo_subprogram
+ DW_AT_low_pc __foo_low_pc DW_FORM_addr
+ DW_AT_high_pc __foo_high_pc DW_FORM_addr
+ DW_AT_call_file 1 DW_FORM_data1
+ DW_AT_call_line 13 DW_FORM_data1
} {
DW_TAG_inlined_subroutine {
- {DW_AT_abstract_origin :$bar_subprogram}
- {DW_AT_low_pc __bar_low_pc DW_FORM_addr}
- {DW_AT_high_pc __bar_high_pc DW_FORM_addr}
- {DW_AT_call_file 1 DW_FORM_data1}
- {DW_AT_call_line 7 DW_FORM_data1}
+ DW_AT_abstract_origin :$bar_subprogram
+ DW_AT_low_pc __bar_low_pc DW_FORM_addr
+ DW_AT_high_pc __bar_high_pc DW_FORM_addr
+ DW_AT_call_file 1 DW_FORM_data1
+ DW_AT_call_line 7 DW_FORM_data1
}
}
}
foo_subprogram: DW_TAG_subprogram {
- {DW_AT_name "foo"}
- {DW_AT_prototyped 1 DW_FORM_flag_present}
- {DW_AT_inline 0x1 DW_FORM_data1}
+ DW_AT_name "foo"
+ DW_AT_prototyped 1 DW_FORM_flag_present
+ DW_AT_inline 0x1 DW_FORM_data1
}
bar_subprogram: DW_TAG_subprogram {
- {DW_AT_name "bar"}
- {DW_AT_prototyped 1 DW_FORM_flag_present}
- {DW_AT_inline 0x1 DW_FORM_data1}
+ DW_AT_name "bar"
+ DW_AT_prototyped 1 DW_FORM_flag_present
+ DW_AT_inline 0x1 DW_FORM_data1
}
}
}
@@ -106,7 +106,7 @@ if { [build_executable ${testfile}.exp ${testfile} "$srcfile $dwarf_asm" \
return
}
-clean_restart $binfile
+clean_restart $::testfile
if { [gdb_starti_cmd] != 0 } {
fail "failed to run to first instruction"
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp b/gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp
index c0e0c66..9233637 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -56,7 +56,8 @@ if { [ensure_gdb_index $symlink] == -1 } {
# Ok, we have a copy of $binfile with an index.
# Restart gdb and verify the index was used.
-clean_restart $symlink
+clean_restart
+gdb_load $symlink
gdb_test "mt print objfiles ${testfile}" \
"(gdb_index|debug_names).*" \
"index used"
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-add-index.exp b/gdb/testsuite/gdb.dwarf2/gdb-add-index.exp
index cc95ba9..0fbd3a2 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-add-index.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-add-index.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ if { [ensure_gdb_index $binfile] == -1 } {
# Ok, we have a copy of $binfile with an index.
# Restart gdb and verify the index was used.
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test "mt print objfiles ${testfile}" \
"(gdb_index|debug_names).*" \
"index used"
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp b/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp
index 7083ab7..f0100b8 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp b/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp
index cbe456f..4e8199c 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index-tilde.exp b/gdb/testsuite/gdb.dwarf2/gdb-index-tilde.exp
index 54051c1..a8c5c39 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index-tilde.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index-tilde.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" ${srcfile}] } {
}
# Start GDB and load in the executable.
-clean_restart ${binfile}
+clean_restart ${::testfile}
# If the executable was built with an index, or lacks the debug
# information required to create an index, then we'll not be able to
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.c b/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.c
index 1035ac9..cd2fa1b 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.c
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp b/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp
index b97b554..a47d73a 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,6 +13,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# This test checks that .gdb_index is in use, which isn't the case
+# with readnow.
+require !readnow
+
standard_testfile
set flags {}
@@ -29,7 +33,7 @@ if { [ensure_gdb_index $binfile] != 1 } {
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
# Verify that .gdb_index section is not ignored.
set index [have_index $binfile]
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index.exp b/gdb/testsuite/gdb.dwarf2/gdb-index.exp
index 23d60da..41bd480 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -98,20 +98,24 @@ set test "check if index present"
set filter "gdb_index|debug_names|Psymtabs|Cooked"
set cmd "pipe mt print objfiles ${testfile} | grep -E \"$filter\""
set cmd_re [string_to_regexp $cmd]
+set testfile_with_index bla
gdb_test_multiple $cmd $test {
-re ^$cmd_re {
exp_continue
}
-re "gdb_index.*${gdb_prompt} $" {
- set binfile_with_index $binfile
+ set testfile_with_index $testfile
+ set binfile_with_index [standard_output_file $testfile_with_index]
set host_binfile_with_index [gdb_remote_download host $binfile]
}
-re "debug_names.*${gdb_prompt} $" {
- set binfile_with_index $binfile
+ set testfile_with_index $testfile
+ set binfile_with_index [standard_output_file $testfile_with_index]
set host_binfile_with_index [gdb_remote_download host $binfile]
}
-re "(Psymtabs|Cooked).*${gdb_prompt} $" {
lassign [local_add_gdb_index $binfile] binfile_with_index host_binfile_with_index
+ set testfile_with_index [file tail $binfile_with_index]
if { ${binfile_with_index} == "" } {
return -1
}
@@ -124,7 +128,7 @@ gdb_test_multiple $cmd $test {
# Ok, we have a copy of $binfile with an index.
# Restart gdb and verify the index was used.
-clean_restart ${binfile_with_index}
+clean_restart $testfile_with_index
gdb_test "mt print objfiles ${testfile}" \
"(gdb_index|debug_names).*" \
"index used"
@@ -140,7 +144,7 @@ if {[run_on_host "touch binary" touch $host_binfile_with_index]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test "mt print objfiles ${testfile}" \
diff --git a/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp b/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp
index 41e64b1..8ceaa4e 100644
--- a/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp
+++ b/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,54 +39,54 @@ proc test_1 { name dwarf_version offset_size addr_size ref_addr_size two_cu } {
is_64 $is_64
} {
compile_unit {
- { producer "GNU C 4.4.3" }
- { language @DW_LANG_C89 }
- { name 1.c }
+ DW_AT_producer "GNU C 4.4.3"
+ DW_AT_language @DW_LANG_C89
+ DW_AT_name 1.c
} {
declare_labels struct_label variable_label int_label pointer_label
int_label: base_type {
- { byte_size 4 DW_FORM_sdata }
- { DW_AT_encoding @DW_ATE_signed }
- { name int }
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
struct_label: structure_type {
- { name s }
- { byte_size 4 sdata }
+ DW_AT_name s
+ DW_AT_byte_size 4 sdata
} {
member {
- { name f }
- { type :$int_label }
- { data_member_location 0 data1 }
+ DW_AT_name f
+ DW_AT_type :$int_label
+ DW_AT_data_member_location 0 data1
}
}
pointer_label: pointer_type {
- { byte_size $Dwarf::_cu_addr_size sdata }
- { type :$struct_label }
+ DW_AT_byte_size $Dwarf::_cu_addr_size sdata
+ DW_AT_type :$struct_label
}
variable_label: DW_TAG_variable {
- { name v }
- { location {
+ DW_AT_name v
+ DW_AT_location {
DW_OP_implicit_value 0x1 0x1 0x1 0x1
- } SPECIAL_expr}
- { type :$struct_label "DW_FORM_ref$ref_addr_size" }
+ } SPECIAL_expr
+ DW_AT_type :$struct_label "DW_FORM_ref$ref_addr_size"
}
if { !$two_cu } {
subprogram {
- {MACRO_AT_func {main}}
- { type :$int_label }
- { external 1 flag }
+ MACRO_AT_func {main}
+ DW_AT_type :$int_label
+ DW_AT_external 1 flag
} {
DW_TAG_variable {
- { name p }
- { location {
- GNU_implicit_pointer $variable_label 0
- } SPECIAL_expr }
- { type :$pointer_label "DW_FORM_ref$ref_addr_size" }
+ DW_AT_name p
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer $variable_label 0
+ } SPECIAL_expr
+ DW_AT_type :$pointer_label "DW_FORM_ref$ref_addr_size"
}
}
}
@@ -100,21 +100,21 @@ proc test_1 { name dwarf_version offset_size addr_size ref_addr_size two_cu } {
is_64 $is_64
} {
compile_unit {
- { producer "GNU C 4.4.3" }
- { language @DW_LANG_C89 }
- { name 1.c }
+ DW_AT_producer "GNU C 4.4.3"
+ DW_AT_language @DW_LANG_C89
+ DW_AT_name 1.c
} {
subprogram {
- { MACRO_AT_func {main} }
- { type %$int_label }
- { external 1 flag }
+ MACRO_AT_func {main}
+ DW_AT_type %$int_label
+ DW_AT_external 1 flag
} {
DW_TAG_variable {
- { name p }
- { location {
- GNU_implicit_pointer $variable_label 0
- } SPECIAL_expr }
- { type %$pointer_label }
+ DW_AT_name p
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer $variable_label 0
+ } SPECIAL_expr
+ DW_AT_type %$pointer_label
}
}
}
@@ -125,11 +125,11 @@ proc test_1 { name dwarf_version offset_size addr_size ref_addr_size two_cu } {
# 32-bit targets do not support any of the testcases; keep quiet there.
set opts {quiet}
set executable ${testfile}-${name}
- if [prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" $opts] {
+ if {[prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" $opts]} {
return -1
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp
index 46022ce..86a08eb 100644
--- a/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp
+++ b/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,63 +25,63 @@ set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu { version 3 addr_size 4 } {
compile_unit {
- {producer "GNU C 4.4.3"}
- {language @DW_LANG_C89}
- {name 1.c}
+ DW_AT_producer "GNU C 4.4.3"
+ DW_AT_language @DW_LANG_C89
+ DW_AT_name 1.c
} {
declare_labels int_label struct_label pointer_label variable_label
int_label: base_type {
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
- {name int}
+ DW_AT_byte_size 4 sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
struct_label: structure_type {
- {name s}
- {byte_size 4 sdata}
+ DW_AT_name s
+ DW_AT_byte_size 4 sdata
} {
member {
- {name f}
- {type :$int_label}
- {data_member_location 0 data1}
+ DW_AT_name f
+ DW_AT_type :$int_label
+ DW_AT_data_member_location 0 data1
}
}
subprogram {
- {MACRO_AT_func { main }}
- {type :$int_label}
- {external 1 flag}
+ MACRO_AT_func { main }
+ DW_AT_type :$int_label
+ DW_AT_external 1 flag
} {
pointer_label: pointer_type {
- {byte_size 4 sdata}
- {type :$struct_label}
+ DW_AT_byte_size 4 sdata
+ DW_AT_type :$struct_label
}
variable_label: DW_TAG_variable {
- {name v}
- {location {} DW_FORM_block1}
- {type :$struct_label}
+ DW_AT_name v
+ DW_AT_location {} DW_FORM_block1
+ DW_AT_type :$struct_label
}
DW_TAG_variable {
- {name p}
- {location {
- GNU_implicit_pointer $variable_label 0
- } SPECIAL_expr}
- {type :$pointer_label}
+ DW_AT_name p
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer $variable_label 0
+ } SPECIAL_expr
+ DW_AT_type :$pointer_label
}
}
}
}
}
-if [prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}] {
+if {[prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}]} {
return -1
}
# DW_OP_GNU_implicit_pointer implementation requires a valid frame.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/implptr.c b/gdb/testsuite/gdb.dwarf2/implptr.c
index a6bfc22..14315e6 100644
--- a/gdb/testsuite/gdb.dwarf2/implptr.c
+++ b/gdb/testsuite/gdb.dwarf2/implptr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/implptr.exp b/gdb/testsuite/gdb.dwarf2/implptr.exp
index fa1b68e..da7bc28 100644
--- a/gdb/testsuite/gdb.dwarf2/implptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/implptr.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ set opts {}
lappend opts nopie
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS='gdb.dwarf2/implptr.exp COMPILE=1 CC_FOR_TARGET=gcc\ -m32'
set srcfile ${csrcfile}
lappend opts debug optimize=-O2
@@ -41,7 +41,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile $opts]} {
# Additional test to verify the referenced CU is not aged out.
gdb_test_no_output "maintenance set dwarf max-cache-age 0"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/implptrconst.exp b/gdb/testsuite/gdb.dwarf2/implptrconst.exp
index 541331c..3b01876 100644
--- a/gdb/testsuite/gdb.dwarf2/implptrconst.exp
+++ b/gdb/testsuite/gdb.dwarf2/implptrconst.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,51 +33,51 @@ Dwarf::assemble $asm_file {
declare_labels var_label ptr_label
byte_label: base_type {
- {name byte}
- {encoding @DW_ATE_signed}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name byte
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 1 DW_FORM_sdata
}
size_type_label: base_type {
- {name sizetype}
- {encoding @DW_ATE_unsigned}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name sizetype
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_byte_size 4 DW_FORM_sdata
}
array_label: array_type {
- {type :$byte_label}
+ DW_AT_type :$byte_label
} {
subrange_type {
- {type :$size_type_label}
- {upper_bound 7 DW_FORM_data1}
+ DW_AT_type :$size_type_label
+ DW_AT_upper_bound 7 DW_FORM_data1
}
}
var_label: DW_TAG_variable {
- {name b}
- {type :$array_label}
- {const_value rstuvwxy DW_FORM_block1}
+ DW_AT_name b
+ DW_AT_type :$array_label
+ DW_AT_const_value rstuvwxy DW_FORM_block1
}
ptr_label: pointer_type {
- {byte_size 4 DW_FORM_sdata}
- {type :$byte_label}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_type :$byte_label
}
DW_TAG_variable {
- {name c}
- {type :$ptr_label}
- {location {
- GNU_implicit_pointer $var_label 0
- } SPECIAL_expr}
+ DW_AT_name c
+ DW_AT_type :$ptr_label
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer $var_label 0
+ } SPECIAL_expr
}
DW_TAG_variable {
- {name d}
- {type :$ptr_label}
- {location {
- GNU_implicit_pointer $var_label 2
- } SPECIAL_expr}
+ DW_AT_name d
+ DW_AT_type :$ptr_label
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer $var_label 2
+ } SPECIAL_expr
}
}
}
@@ -88,7 +88,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/implptrpiece.exp b/gdb/testsuite/gdb.dwarf2/implptrpiece.exp
index 867789f..18d3a34 100644
--- a/gdb/testsuite/gdb.dwarf2/implptrpiece.exp
+++ b/gdb/testsuite/gdb.dwarf2/implptrpiece.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,66 +36,66 @@ Dwarf::assemble $asm_file {
declare_labels var_label
struct_label: structure_type {
- {name S}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name S
+ DW_AT_byte_size 4 DW_FORM_sdata
} {
member {
- {name a}
- {type :$short_type_label}
- {data_member_location 0 DW_FORM_sdata}
+ DW_AT_name a
+ DW_AT_type :$short_type_label
+ DW_AT_data_member_location 0 DW_FORM_sdata
}
member {
- {name b}
- {type :$char_type_label}
- {data_member_location 2 DW_FORM_sdata}
+ DW_AT_name b
+ DW_AT_type :$char_type_label
+ DW_AT_data_member_location 2 DW_FORM_sdata
}
member {
- {name c}
- {type :$char_type_label}
- {data_member_location 3 DW_FORM_sdata}
+ DW_AT_name c
+ DW_AT_type :$char_type_label
+ DW_AT_data_member_location 3 DW_FORM_sdata
}
}
short_type_label: base_type {
- {name "short int"}
- {encoding @DW_ATE_signed}
- {byte_size 2 DW_FORM_sdata}
+ DW_AT_name "short int"
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 2 DW_FORM_sdata
}
char_type_label: base_type {
- {name "signed char"}
- {encoding @DW_ATE_signed}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name "signed char"
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 1 DW_FORM_sdata
}
# See comment above to understand the pointer size.
ptr_label: pointer_type {
- {byte_size 2 DW_FORM_sdata}
- {type :$char_type_label}
+ DW_AT_byte_size 2 DW_FORM_sdata
+ DW_AT_type :$char_type_label
}
var_label: DW_TAG_variable {
- {name s}
- {type :$struct_label}
- {location {
- const2u 0x5678
- stack_value
- piece 2
- const1u 2
- stack_value
- piece 1
- const1u 3
- stack_value
- piece 1
- } SPECIAL_expr}
+ DW_AT_name s
+ DW_AT_type :$struct_label
+ DW_AT_location {
+ DW_OP_const2u 0x5678
+ DW_OP_stack_value
+ DW_OP_piece 2
+ DW_OP_const1u 2
+ DW_OP_stack_value
+ DW_OP_piece 1
+ DW_OP_const1u 3
+ DW_OP_stack_value
+ DW_OP_piece 1
+ } SPECIAL_expr
}
DW_TAG_variable {
- {name p}
- {type :$ptr_label}
- {location {
- GNU_implicit_pointer $var_label 2
- } SPECIAL_expr}
+ DW_AT_name p
+ DW_AT_type :$ptr_label
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer $var_label 2
+ } SPECIAL_expr
}
}
}
@@ -106,7 +106,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/implref-array.c b/gdb/testsuite/gdb.dwarf2/implref-array.c
index ad1f0ef..18130f2 100644
--- a/gdb/testsuite/gdb.dwarf2/implref-array.c
+++ b/gdb/testsuite/gdb.dwarf2/implref-array.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2016-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/implref-array.exp b/gdb/testsuite/gdb.dwarf2/implref-array.exp
index 7d6692b..5473a43 100644
--- a/gdb/testsuite/gdb.dwarf2/implref-array.exp
+++ b/gdb/testsuite/gdb.dwarf2/implref-array.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -51,7 +51,7 @@ Dwarf::assemble ${asm_file} {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
+ DW_AT_language @DW_LANG_C_plus_plus
} {
declare_labels int_label sizetype_label array_label variable_label ref_label
set int_size [get_sizeof "int" -1]
@@ -61,60 +61,64 @@ Dwarf::assemble ${asm_file} {
set addr_size [get_sizeof "void *" -1]
int_label: DW_TAG_base_type {
- {DW_AT_byte_size ${int_size} DW_FORM_udata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name "int"}
+ DW_AT_byte_size ${int_size} DW_FORM_udata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name "int"
}
sizetype_label: DW_TAG_base_type {
- {DW_AT_byte_size ${int_size} DW_FORM_udata}
- {DW_AT_encoding @DW_ATE_unsigned}
- {DW_AT_name "sizetype"}
+ DW_AT_byte_size ${int_size} DW_FORM_udata
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name "sizetype"
}
array_label: DW_TAG_array_type {
- {DW_AT_type :${int_label}}
+ DW_AT_type :${int_label}
} {
DW_TAG_subrange_type {
- {DW_AT_type :${sizetype_label}}
- {DW_AT_lower_bound 0 DW_FORM_udata}
- {DW_AT_upper_bound ${upper_bound} DW_FORM_udata}
+ DW_AT_type :${sizetype_label}
+ DW_AT_lower_bound 0 DW_FORM_udata
+ DW_AT_upper_bound ${upper_bound} DW_FORM_udata
}
}
ref_label: DW_TAG_reference_type {
- {DW_AT_byte_size ${addr_size} DW_FORM_udata}
- {DW_AT_type :${array_label}}
+ DW_AT_byte_size ${addr_size} DW_FORM_udata
+ DW_AT_type :${array_label}
}
variable_label: DW_TAG_variable {
- {DW_AT_name "array"}
- {DW_AT_type :${array_label}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "array"]} SPECIAL_expr}
+ DW_AT_name "array"
+ DW_AT_type :${array_label}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "array"]
+ } SPECIAL_expr
}
DW_TAG_subprogram {
- {MACRO_AT_func { "main" }}
- {DW_AT_type :${int_label}}
- {DW_AT_external 1 DW_FORM_flag}
+ MACRO_AT_func { "main" }
+ DW_AT_type :${int_label}
+ DW_AT_external 1 DW_FORM_flag
} {
DW_TAG_variable {
- {DW_AT_name "ref"}
- {DW_AT_type :${ref_label}}
- {DW_AT_location {DW_OP_GNU_implicit_pointer ${variable_label} 0} SPECIAL_expr}
+ DW_AT_name "ref"
+ DW_AT_type :${ref_label}
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer ${variable_label} 0
+ } SPECIAL_expr
}
}
}
}
}
-if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}] {
+if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
return -1
}
# DW_OP_GNU_implicit_pointer implementation requires a valid frame.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/implref-const.exp b/gdb/testsuite/gdb.dwarf2/implref-const.exp
index 0dfb3bd..bebc3b6 100644
--- a/gdb/testsuite/gdb.dwarf2/implref-const.exp
+++ b/gdb/testsuite/gdb.dwarf2/implref-const.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ set asm_file [standard_output_file ${srcfile2}]
# For that, we ask GDB by debugging our implref-const program.
# Any program would do, but since we already have implref-const
# specifically for this testcase, might as well use that.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
@@ -45,7 +45,7 @@ if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
Dwarf::assemble ${asm_file} {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
+ DW_AT_language @DW_LANG_C_plus_plus
} {
declare_labels int_label const_label variable_label ref_label
set int_size [get_sizeof "int" -1]
@@ -55,47 +55,49 @@ Dwarf::assemble ${asm_file} {
set var_value 42
int_label: DW_TAG_base_type {
- {DW_AT_byte_size ${int_size} DW_FORM_udata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name "int"}
+ DW_AT_byte_size ${int_size} DW_FORM_udata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name "int"
}
ref_label: DW_TAG_reference_type {
- {DW_AT_byte_size ${addr_size} DW_FORM_udata}
- {DW_AT_type :${int_label}}
+ DW_AT_byte_size ${addr_size} DW_FORM_udata
+ DW_AT_type :${int_label}
}
const_label: DW_TAG_const_type {
- {DW_AT_type :${ref_label}}
+ DW_AT_type :${ref_label}
}
DW_TAG_subprogram {
- {MACRO_AT_func { "main" }}
- {DW_AT_type :${int_label}}
- {DW_AT_external 1 DW_FORM_flag}
+ MACRO_AT_func { "main" }
+ DW_AT_type :${int_label}
+ DW_AT_external 1 DW_FORM_flag
} {
variable_label: DW_TAG_variable {
- {DW_AT_name "var"}
- {DW_AT_type :${int_label}}
- {DW_AT_const_value ${var_value} DW_FORM_udata}
+ DW_AT_name "var"
+ DW_AT_type :${int_label}
+ DW_AT_const_value ${var_value} DW_FORM_udata
}
DW_TAG_variable {
- {DW_AT_name "ref"}
- {DW_AT_type :${const_label}}
- {DW_AT_location {DW_OP_GNU_implicit_pointer ${variable_label} 0} SPECIAL_expr}
+ DW_AT_name "ref"
+ DW_AT_type :${const_label}
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer ${variable_label} 0
+ } SPECIAL_expr
}
}
}
}
}
-if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}] {
+if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
return -1
}
# DW_OP_GNU_implicit_pointer implementation requires a valid frame.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/implref-global.c b/gdb/testsuite/gdb.dwarf2/implref-global.c
index 3f38b46..13c5648 100644
--- a/gdb/testsuite/gdb.dwarf2/implref-global.c
+++ b/gdb/testsuite/gdb.dwarf2/implref-global.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2016-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/implref-global.exp b/gdb/testsuite/gdb.dwarf2/implref-global.exp
index 1cb0359..f4f4d03 100644
--- a/gdb/testsuite/gdb.dwarf2/implref-global.exp
+++ b/gdb/testsuite/gdb.dwarf2/implref-global.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ set asm_file [standard_output_file ${srcfile2}]
# For that, we ask GDB by debugging our implref-global program.
# Any program would do, but since we already have implref-global
# specifically for this testcase, might as well use that.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
@@ -47,7 +47,7 @@ if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
Dwarf::assemble ${asm_file} {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
+ DW_AT_language @DW_LANG_C_plus_plus
} {
declare_labels int_label variable_label ref_label
set int_size [get_sizeof "int" -1]
@@ -56,44 +56,48 @@ Dwarf::assemble ${asm_file} {
set addr_size [get_sizeof "void *" -1]
int_label: DW_TAG_base_type {
- {DW_AT_byte_size ${int_size} DW_FORM_udata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name "int"}
+ DW_AT_byte_size ${int_size} DW_FORM_udata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name "int"
}
ref_label: DW_TAG_reference_type {
- {DW_AT_byte_size ${addr_size} DW_FORM_udata}
- {DW_AT_type :${int_label}}
+ DW_AT_byte_size ${addr_size} DW_FORM_udata
+ DW_AT_type :${int_label}
}
variable_label: DW_TAG_variable {
- {DW_AT_name "global_var"}
- {DW_AT_type :${int_label}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "global_var"]} SPECIAL_expr}
+ DW_AT_name "global_var"
+ DW_AT_type :${int_label}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "global_var"]
+ } SPECIAL_expr
}
DW_TAG_subprogram {
- {MACRO_AT_func { "main" }}
- {DW_AT_type :${int_label}}
- {DW_AT_external 1 DW_FORM_flag}
+ MACRO_AT_func { "main" }
+ DW_AT_type :${int_label}
+ DW_AT_external 1 DW_FORM_flag
} {
DW_TAG_variable {
- {DW_AT_name "ref"}
- {DW_AT_type :${ref_label}}
- {DW_AT_location {DW_OP_GNU_implicit_pointer ${variable_label} 0} SPECIAL_expr}
+ DW_AT_name "ref"
+ DW_AT_type :${ref_label}
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer ${variable_label} 0
+ } SPECIAL_expr
}
}
}
}
}
-if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}] {
+if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
return -1
}
# DW_OP_GNU_implicit_pointer implementation requires a valid frame.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/implref-struct.c b/gdb/testsuite/gdb.dwarf2/implref-struct.c
index bc54a87..3888b32 100644
--- a/gdb/testsuite/gdb.dwarf2/implref-struct.c
+++ b/gdb/testsuite/gdb.dwarf2/implref-struct.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2016-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/implref-struct.exp b/gdb/testsuite/gdb.dwarf2/implref-struct.exp
index 69e1507..b0ea0a1 100644
--- a/gdb/testsuite/gdb.dwarf2/implref-struct.exp
+++ b/gdb/testsuite/gdb.dwarf2/implref-struct.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ set asm_file [standard_output_file ${srcfile2}]
# For that, we ask GDB by debugging our implref-struct program.
# Any program would do, but since we already have implref-struct
# specifically for this testcase, might as well use that.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}]} {
return -1
}
@@ -47,7 +47,7 @@ if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}]
Dwarf::assemble ${asm_file} {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
+ DW_AT_language @DW_LANG_C_plus_plus
} {
declare_labels int_label struct_label variable_label ref_label
set int_size [get_sizeof "int" -1]
@@ -61,74 +61,80 @@ Dwarf::assemble ${asm_file} {
set c_offset 8
int_label: DW_TAG_base_type {
- {DW_AT_byte_size ${int_size} DW_FORM_udata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name "int"}
+ DW_AT_byte_size ${int_size} DW_FORM_udata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name "int"
}
struct_label: DW_TAG_structure_type {
- {DW_AT_name "S"}
- {DW_AT_byte_size ${S_size} DW_FORM_udata}
+ DW_AT_name "S"
+ DW_AT_byte_size ${S_size} DW_FORM_udata
} {
DW_TAG_member {
- {DW_AT_name "a"}
- {DW_AT_type :${int_label}}
- {DW_AT_data_member_location 0 DW_FORM_udata}
+ DW_AT_name "a"
+ DW_AT_type :${int_label}
+ DW_AT_data_member_location 0 DW_FORM_udata
}
DW_TAG_member {
- {DW_AT_name "b"}
- {DW_AT_type :${int_label}}
- {DW_AT_data_member_location ${b_offset} DW_FORM_udata}
+ DW_AT_name "b"
+ DW_AT_type :${int_label}
+ DW_AT_data_member_location ${b_offset} DW_FORM_udata
}
DW_TAG_member {
- {DW_AT_name "c"}
- {DW_AT_type :${int_label}}
- {DW_AT_data_member_location ${c_offset} DW_FORM_udata}
+ DW_AT_name "c"
+ DW_AT_type :${int_label}
+ DW_AT_data_member_location ${c_offset} DW_FORM_udata
}
}
ref_label: DW_TAG_reference_type {
- {DW_AT_byte_size ${addr_size} DW_FORM_udata}
- {DW_AT_type :${struct_label}}
+ DW_AT_byte_size ${addr_size} DW_FORM_udata
+ DW_AT_type :${struct_label}
}
variable_label: DW_TAG_variable {
- {DW_AT_name "s1"}
- {DW_AT_type :${struct_label}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "s1"]} SPECIAL_expr}
+ DW_AT_name "s1"
+ DW_AT_type :${struct_label}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "s1"]
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name "s2"}
- {DW_AT_type :${struct_label}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "s2"]} SPECIAL_expr}
+ DW_AT_name "s2"
+ DW_AT_type :${struct_label}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "s2"]
+ } SPECIAL_expr
}
DW_TAG_subprogram {
- {MACRO_AT_func { "main" }}
- {DW_AT_type :${int_label}}
- {DW_AT_external 1 DW_FORM_flag}
+ MACRO_AT_func { "main" }
+ DW_AT_type :${int_label}
+ DW_AT_external 1 DW_FORM_flag
} {
DW_TAG_variable {
- {DW_AT_name "ref"}
- {DW_AT_type :${ref_label}}
- {DW_AT_location {DW_OP_GNU_implicit_pointer ${variable_label} 0} SPECIAL_expr}
+ DW_AT_name "ref"
+ DW_AT_type :${ref_label}
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer ${variable_label} 0
+ } SPECIAL_expr
}
}
}
}
}
-if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}] {
+if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
return -1
}
# DW_OP_GNU_implicit_pointer implementation requires a valid frame.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-abstract-const-value.exp b/gdb/testsuite/gdb.dwarf2/imported-unit-abstract-const-value.exp
index a5202ea..2f81317 100644
--- a/gdb/testsuite/gdb.dwarf2/imported-unit-abstract-const-value.exp
+++ b/gdb/testsuite/gdb.dwarf2/imported-unit-abstract-const-value.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ set asm_file [standard_output_file ${srcfile2}]
# We need to know the size of integer type in order
# to write some of the debugging info we'd like to generate.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
@@ -40,40 +40,40 @@ Dwarf::assemble $asm_file {
cu {} {
cu_label: partial_unit {
- {language @DW_LANG_C}
- {name "imported_unit.c"}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name "imported_unit.c"
} {
int_label: base_type {
- {byte_size $int_size sdata}
- {encoding @DW_ATE_signed}
- {name int}
+ DW_AT_byte_size $int_size sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
aaa_label: DW_TAG_variable {
- {name aaa}
- {type :$int_label}
- {const_value 1 DW_FORM_sdata}
+ DW_AT_name aaa
+ DW_AT_type :$int_label
+ DW_AT_const_value 1 DW_FORM_sdata
}
main_label: subprogram {
- {name main}
- {type :$int_label}
- {external 1 flag}
+ DW_AT_name main
+ DW_AT_type :$int_label
+ DW_AT_external 1 flag
}
}
}
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name "<artificial>"}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name "<artificial>"
} {
DW_TAG_variable {
- {abstract_origin %$aaa_label}
+ DW_AT_abstract_origin %$aaa_label
}
subprogram {
- {abstract_origin %$main_label}
- {MACRO_AT_range {main}}
+ DW_AT_abstract_origin %$main_label
+ MACRO_AT_range {main}
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp-alt.c b/gdb/testsuite/gdb.dwarf2/imported-unit-bp-alt.c
index 19d9adc..0f5cbb3 100644
--- a/gdb/testsuite/gdb.dwarf2/imported-unit-bp-alt.c
+++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp-alt.c
@@ -1,4 +1,4 @@
-/* Copyright 2020-2024 Free Software Foundation, Inc.
+/* Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp-c++.exp b/gdb/testsuite/gdb.dwarf2/imported-unit-bp-c++.exp
index f9a685a..3bf0f00 100644
--- a/gdb/testsuite/gdb.dwarf2/imported-unit-bp-c++.exp
+++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp-c++.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp-c.exp b/gdb/testsuite/gdb.dwarf2/imported-unit-bp-c.exp
index 037ae04..ef68ada 100644
--- a/gdb/testsuite/gdb.dwarf2/imported-unit-bp-c.exp
+++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp-c.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp-main.c b/gdb/testsuite/gdb.dwarf2/imported-unit-bp-main.c
index 204728c..0aa4639 100644
--- a/gdb/testsuite/gdb.dwarf2/imported-unit-bp-main.c
+++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
index 4a103fb..de1195a 100644
--- a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
+++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,34 +38,34 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @$lang}
- {name "<artificial>"}
+ DW_AT_language @$lang
+ DW_AT_name "<artificial>"
} {
imported_unit {
- {import %$cu_label}
+ DW_AT_import %$cu_label
}
}
}
cu {} {
cu_label: compile_unit {
- {producer "gcc"}
- {language @$lang}
- {name ${srcfile}}
- {comp_dir "/tmp"}
- {low_pc 0 addr}
- {stmt_list ${lines_label} DW_FORM_sec_offset}
+ DW_AT_producer "gcc"
+ DW_AT_language @$lang
+ DW_AT_name ${srcfile}
+ DW_AT_comp_dir "/tmp"
+ DW_AT_low_pc 0 addr
+ DW_AT_stmt_list ${lines_label} DW_FORM_sec_offset
} {
callee_subprog_label: subprogram {
- {external 1 flag}
- {name callee}
- {inline 3 data1}
+ DW_AT_external 1 flag
+ DW_AT_name callee
+ DW_AT_inline 3 data1
}
subprogram {
- {external 1 flag}
- {name func}
- {low_pc $func_start addr}
- {high_pc "$func_start + $func_len" addr}
+ DW_AT_external 1 flag
+ DW_AT_name func
+ DW_AT_low_pc $func_start addr
+ DW_AT_high_pc "$func_start + $func_len" addr
} {
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-c.exp b/gdb/testsuite/gdb.dwarf2/imported-unit-c.exp
index 521ccc3..6bfc8c7 100644
--- a/gdb/testsuite/gdb.dwarf2/imported-unit-c.exp
+++ b/gdb/testsuite/gdb.dwarf2/imported-unit-c.exp
@@ -10,7 +10,7 @@ set asm_file [standard_output_file ${srcfile2}]
# We need to know the size of integer and address types in order
# to write some of the debugging info we'd like to generate.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}]} {
return -1
}
@@ -22,52 +22,52 @@ Dwarf::assemble $asm_file {
# imported CU 1: inty unsigned
cu {} {
cu_label: compile_unit {
- {language @DW_LANG_C}
- {name "<artificial>"}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name "<artificial>"
} {
int_label: base_type {
- {byte_size $int_size sdata}
- {encoding @DW_ATE_unsigned}
- {name {unsigned int}}
+ DW_AT_byte_size $int_size sdata
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name {unsigned int}
+ }
+ DW_TAG_typedef {
+ DW_AT_name inty
+ DW_AT_type :$int_label
}
- DW_TAG_typedef {
- {DW_AT_name inty}
- {DW_AT_type :$int_label}
- }
}
}
# imported CU 2: inty signed
cu {} {
cu2_label: compile_unit {
- {language @DW_LANG_C}
- {name "<artificial>"}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name "<artificial>"
} {
int2_label: base_type {
- {byte_size $int_size sdata}
- {encoding @DW_ATE_signed}
- {name {int}}
+ DW_AT_byte_size $int_size sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name {int}
+ }
+ DW_TAG_typedef {
+ DW_AT_name inty
+ DW_AT_type :$int2_label
}
- DW_TAG_typedef {
- {DW_AT_name inty}
- {DW_AT_type :$int2_label}
- }
}
}
# main CU
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name "<artificial>"}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name "<artificial>"
} {
imported_unit {
- {import %$cu2_label}
+ DW_AT_import %$cu2_label
}
subprogram {
- {MACRO_AT_func {main}}
- {external 1 flag}
+ MACRO_AT_func {main}
+ DW_AT_external 1 flag
}
}
}
@@ -75,16 +75,16 @@ Dwarf::assemble $asm_file {
# foo CU
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name "<artificial>"}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name "<artificial>"
} {
imported_unit {
- {import %$cu_label}
+ DW_AT_import %$cu_label
}
subprogram {
- {MACRO_AT_func {foo}}
- {external 1 flag}
+ MACRO_AT_func {foo}
+ DW_AT_external 1 flag
}
}
}
@@ -96,7 +96,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-runto-main.exp b/gdb/testsuite/gdb.dwarf2/imported-unit-runto-main.exp
index 7150326..432386a 100644
--- a/gdb/testsuite/gdb.dwarf2/imported-unit-runto-main.exp
+++ b/gdb/testsuite/gdb.dwarf2/imported-unit-runto-main.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ set asm_file [standard_output_file ${srcfile2}]
# We need to know the size of integer types in order to write some of the
# debugging info we'd like to generate.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
@@ -37,31 +37,31 @@ Dwarf::assemble $asm_file {
cu {} {
cu_label: partial_unit {
- {language @DW_LANG_C}
- {name "imported_unit.c"}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name "imported_unit.c"
} {
int_label: base_type {
- {byte_size $int_size sdata}
- {encoding @DW_ATE_signed}
- {name int}
+ DW_AT_byte_size $int_size sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
main_label: subprogram {
- {name main}
- {type :$int_label}
- {external 1 flag}
+ DW_AT_name main
+ DW_AT_type :$int_label
+ DW_AT_external 1 flag
}
}
}
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name "<artificial>"}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name "<artificial>"
} {
subprogram {
- {abstract_origin %$main_label}
- {MACRO_AT_range {main}}
+ DW_AT_abstract_origin %$main_label
+ MACRO_AT_range {main}
}
}
}
@@ -77,6 +77,6 @@ if { [ensure_gdb_index $binfile] == -1 } {
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto main
diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit.c b/gdb/testsuite/gdb.dwarf2/imported-unit.c
index 60bb33e..5d49a7e 100644
--- a/gdb/testsuite/gdb.dwarf2/imported-unit.c
+++ b/gdb/testsuite/gdb.dwarf2/imported-unit.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit.exp b/gdb/testsuite/gdb.dwarf2/imported-unit.exp
index d97d64b..b51c07a 100644
--- a/gdb/testsuite/gdb.dwarf2/imported-unit.exp
+++ b/gdb/testsuite/gdb.dwarf2/imported-unit.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ set asm_file [standard_output_file ${srcfile2}]
# We need to know the size of integer and address types in order
# to write some of the debugging info we'd like to generate.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}]} {
return -1
}
@@ -52,27 +52,27 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C_plus_plus}
- {name "<artificial>"}
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name "<artificial>"
} {
imported_unit {
- {import %$cu_label}
+ DW_AT_import %$cu_label
}
subprogram {
- {abstract_origin %$main_label}
- {MACRO_AT_range {main}}
+ DW_AT_abstract_origin %$main_label
+ MACRO_AT_range {main}
} {
subprogram {
- {abstract_origin %$doit_label}
- {MACRO_AT_range {doit}}
+ DW_AT_abstract_origin %$doit_label
+ MACRO_AT_range {doit}
} {
formal_parameter {
- {abstract_origin %$doit_self_label}
+ DW_AT_abstract_origin %$doit_self_label
}
}
DW_TAG_variable {
- {abstract_origin %$foo_label}
- {location 4 data1}
+ DW_AT_abstract_origin %$foo_label
+ DW_AT_location 4 data1
}
}
}
@@ -80,43 +80,43 @@ Dwarf::assemble $asm_file {
cu {} {
cu_label: compile_unit {
- {language @DW_LANG_C_plus_plus}
- {name "imported_unit.c"}
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name "imported_unit.c"
} {
int_label: base_type {
- {byte_size $int_size sdata}
- {encoding @DW_ATE_signed}
- {name int}
+ DW_AT_byte_size $int_size sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
main_label: subprogram {
- {name main}
- {type :$int_label}
- {external 1 flag}
+ DW_AT_name main
+ DW_AT_type :$int_label
+ DW_AT_external 1 flag
} {
Foo_label: class_type {
- {name Foo}
- {byte_size 1 sdata}
+ DW_AT_name Foo
+ DW_AT_byte_size 1 sdata
} {
doit_label: subprogram {
- {name doit}
- {type :$int_label}
- {accessibility 1 DW_FORM_data1}
+ DW_AT_name doit
+ DW_AT_type :$int_label
+ DW_AT_accessibility 1 DW_FORM_data1
} {
doit_self_label: formal_parameter {
- {name this}
- {artificial 1 DW_FORM_flag_present}
- {type :$Foo_pointer_type}
+ DW_AT_name this
+ DW_AT_artificial 1 DW_FORM_flag_present
+ DW_AT_type :$Foo_pointer_type
}
}
Foo_pointer_type: pointer_type {
- {byte_size $addr_size sdata}
- {type :$Foo_label}
+ DW_AT_byte_size $addr_size sdata
+ DW_AT_type :$Foo_label
}
}
foo_label: DW_TAG_variable {
- {name foo}
- {type :$Foo_label}
+ DW_AT_name foo
+ DW_AT_type :$Foo_label
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/index.cc b/gdb/testsuite/gdb.dwarf2/index.cc
index 264ca79..e37e60b 100644
--- a/gdb/testsuite/gdb.dwarf2/index.cc
+++ b/gdb/testsuite/gdb.dwarf2/index.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp
index f338fd4..3f4dd07 100644
--- a/gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp
+++ b/gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,31 +32,31 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
} {
declare_labels int_type_label
# int
int_type_label: base_type {
- {name "int"}
- {encoding @DW_ATE_signed}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name "int"
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 DW_FORM_sdata
}
DW_TAG_subprogram {
- {MACRO_AT_func { main }}
- {DW_AT_external 1 flag}
+ MACRO_AT_func { main }
+ DW_AT_external 1 flag
} {
# A variable completely optimized out.
DW_TAG_variable {
- {name "opt_out"}
- {type :$int_type_label}
+ DW_AT_name "opt_out"
+ DW_AT_type :$int_type_label
}
DW_TAG_variable {
- {name const_bytes}
- {type :$int_type_label}
- {const_value "\x01\x01\x01\x01" DW_FORM_block1}
+ DW_AT_name const_bytes
+ DW_AT_type :$int_type_label
+ DW_AT_const_value "\x01\x01\x01\x01" DW_FORM_block1
}
}
}
@@ -68,7 +68,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/inline.c b/gdb/testsuite/gdb.dwarf2/inline.c
index 70013dc..a5b0d14 100644
--- a/gdb/testsuite/gdb.dwarf2/inline.c
+++ b/gdb/testsuite/gdb.dwarf2/inline.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/inline.exp b/gdb/testsuite/gdb.dwarf2/inline.exp
index 576229a..1aed55f 100644
--- a/gdb/testsuite/gdb.dwarf2/inline.exp
+++ b/gdb/testsuite/gdb.dwarf2/inline.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
standard_testfile .c
-if [prepare_for_testing "failed to prepare" $testfile $srcfile \
- {debug nowarnings}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
+ {debug nowarnings}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/inlined_subroutine-inheritance.exp b/gdb/testsuite/gdb.dwarf2/inlined_subroutine-inheritance.exp
index 88de108..7236662 100644
--- a/gdb/testsuite/gdb.dwarf2/inlined_subroutine-inheritance.exp
+++ b/gdb/testsuite/gdb.dwarf2/inlined_subroutine-inheritance.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,21 +38,21 @@ Dwarf::assemble $asm_file {
cu {} {
Db: compile_unit {
- {language @DW_LANG_C99}
- {name "<artificial>"}
+ DW_AT_language @DW_LANG_C99
+ DW_AT_name "<artificial>"
} {
D72f8: subprogram {
- {abstract_origin %$D272519}
- {low_pc 0xb9e20 addr}
- {high_pc 0x1f5 data4}
+ DW_AT_abstract_origin %$D272519
+ DW_AT_low_pc 0xb9e20 addr
+ DW_AT_high_pc 0x1f5 data4
} {
D736e: inlined_subroutine {
- {abstract_origin %$D26b227}
- {low_pc 0xb9efc addr}
- {high_pc 0xc data4}
+ DW_AT_abstract_origin %$D26b227
+ DW_AT_low_pc 0xb9efc addr
+ DW_AT_high_pc 0xc data4
} {
formal_parameter {
- {abstract_origin %$D274c42}
+ DW_AT_abstract_origin %$D274c42
}
}
}
@@ -61,53 +61,53 @@ Dwarf::assemble $asm_file {
cu {} {
D266465: compile_unit {
- {language @DW_LANG_C99}
+ DW_AT_language @DW_LANG_C99
} {
D266477: typedef {
- {name "size_t"}
- {type :$D266483}
+ DW_AT_name "size_t"
+ DW_AT_type :$D266483
}
D266483: base_type {
- {byte_size 8 sdata}
- {encoding @DW_ATE_unsigned}
+ DW_AT_byte_size 8 sdata
+ DW_AT_encoding @DW_ATE_unsigned
}
D266496: pointer_type {
- {byte_size 8 sdata}
+ DW_AT_byte_size 8 sdata
}
D266498: restrict_type {
- {type :$D266496}
+ DW_AT_type :$D266496
}
D266ad3: pointer_type {
- {byte_size 8 sdata}
- {type :$D266ade}
+ DW_AT_byte_size 8 sdata
+ DW_AT_type :$D266ade
}
D266ad9: restrict_type {
- {type :$D266ad3}
+ DW_AT_type :$D266ad3
}
D266ade: const_type {}
D26b227: subprogram {
- {external 1 flag}
- {name "memcpy"}
- {type :$D266496}
+ DW_AT_external 1 flag
+ DW_AT_name "memcpy"
+ DW_AT_type :$D266496
} {
D26b237: formal_parameter {
- {name "__dest"}
- {type :$D266498}
+ DW_AT_name "__dest"
+ DW_AT_type :$D266498
}
formal_parameter {
- {name "__src"}
- {type :$D266ad9}
+ DW_AT_name "__src"
+ DW_AT_type :$D266ad9
}
formal_parameter {
- {name "__len"}
- {type :$D266477}
+ DW_AT_name "__len"
+ DW_AT_type :$D266477
}
}
}
@@ -115,85 +115,85 @@ Dwarf::assemble $asm_file {
cu {} {
D26d8b1: compile_unit {
- {language @DW_LANG_C99}
+ DW_AT_language @DW_LANG_C99
} {
D26d8c3: typedef {
- {name "size_t"}
- {type :$D26d8cf}
+ DW_AT_name "size_t"
+ DW_AT_type :$D26d8cf
}
D26d8cf: base_type {
- {byte_size 8 sdata}
- {encoding @DW_ATE_unsigned}
- {name "long unsigned int"}
+ DW_AT_byte_size 8 sdata
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name "long unsigned int"
}
D26d944: pointer_type {
- {byte_size 8 sdata}
+ DW_AT_byte_size 8 sdata
}
D26d946: restrict_type {
- {type :$D26d944}
+ DW_AT_type :$D26d944
}
D26e103: structure_type {
- {name "__object"}
- {byte_size 12 sdata}
+ DW_AT_name "__object"
+ DW_AT_byte_size 12 sdata
} {
member {
- {name "__ob_next"}
- {type :$D26e145}
- {data_member_location 0 sdata}
+ DW_AT_name "__ob_next"
+ DW_AT_type :$D26e145
+ DW_AT_data_member_location 0 sdata
}
}
D26e145: pointer_type {
- {byte_size 8 sdata}
- {type :$D26e103}
+ DW_AT_byte_size 8 sdata
+ DW_AT_type :$D26e103
}
D26e415: typedef {
- {name "PyObject"}
- {type :$D26e103}
+ DW_AT_name "PyObject"
+ DW_AT_type :$D26e103
}
D26e48c: pointer_type {
- {byte_size 8 sdata}
- {type :$D26e415}
+ DW_AT_byte_size 8 sdata
+ DW_AT_type :$D26e415
}
D26df00: pointer_type {
- {byte_size 8 sdata}
- {type :$D26df0b}
+ DW_AT_byte_size 8 sdata
+ DW_AT_type :$D26df0b
}
D26df06: restrict_type {
- {type :$D26df00}
+ DW_AT_type :$D26df00
}
D26df0b: const_type {}
D272519: subprogram {
- {name "bytes_repeat"}
- {type :$D26e48c}
+ DW_AT_name "bytes_repeat"
+ DW_AT_type :$D26e48c
}
D274c1a: subprogram {
- {external 1 flag}
- {name "memcpy"}
- {type :$D26d944}
+ DW_AT_external 1 flag
+ DW_AT_name "memcpy"
+ DW_AT_type :$D26d944
} {
formal_parameter {
- {name "__dest"}
- {type :$D26d946}
+ DW_AT_name "__dest"
+ DW_AT_type :$D26d946
}
formal_parameter {
- {name "__src"}
- {type :$D26df06}
+ DW_AT_name "__src"
+ DW_AT_type :$D26df06
}
D274c42: formal_parameter {
- {name "__len"}
- {type :$D26d8c3}
+ DW_AT_name "__len"
+ DW_AT_type :$D26d8c3
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/intbits.c b/gdb/testsuite/gdb.dwarf2/intbits.c
index b203d2a..909d283 100644
--- a/gdb/testsuite/gdb.dwarf2/intbits.c
+++ b/gdb/testsuite/gdb.dwarf2/intbits.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2020-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -41,6 +41,9 @@ unsigned char be30_1_off[4] = { 0x80, 0, 0, 2 };
here, to catch any situation where gdb tries to use the memory. */
unsigned char u32_0[4] = { 0xff, 0xff, 0xff, 0xff };
+/* An 8 bit slot holding a 3 bit value. */
+unsigned char just_bit_0 = 5;
+
int
main (void)
{
diff --git a/gdb/testsuite/gdb.dwarf2/intbits.exp b/gdb/testsuite/gdb.dwarf2/intbits.exp
index 9f9cea1..c604123 100644
--- a/gdb/testsuite/gdb.dwarf2/intbits.exp
+++ b/gdb/testsuite/gdb.dwarf2/intbits.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ standard_testfile .c .S
set executable ${testfile}
set asm_file [standard_output_file ${srcfile2}]
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
@@ -33,139 +33,162 @@ if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
Dwarf::assemble ${asm_file} {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
+ DW_AT_language @DW_LANG_C_plus_plus
} {
declare_labels i7_type u1_type u17_type u31_type \
- u31_1_type u32_0_type u0_0_type be30_1_type
+ u31_1_type u32_0_type u0_0_type be30_1_type just_bit_type
i7_type: DW_TAG_base_type {
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_endianity @DW_END_little}
- {DW_AT_name "i7"}
- {DW_AT_byte_size 2 DW_FORM_udata}
- {DW_AT_bit_size 7 DW_FORM_implicit_const}
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_endianity @DW_END_little
+ DW_AT_name "i7"
+ DW_AT_byte_size 2 DW_FORM_udata
+ DW_AT_bit_size 7 DW_FORM_implicit_const
}
DW_TAG_variable {
- {DW_AT_name "v_i16_m1"}
- {DW_AT_type :${i7_type}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "i16_m1"]}
- SPECIAL_expr}
+ DW_AT_name "v_i16_m1"
+ DW_AT_type :${i7_type}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "i16_m1"]
+ } SPECIAL_expr
}
u1_type: DW_TAG_base_type {
- {DW_AT_encoding @DW_ATE_boolean}
- {DW_AT_endianity @DW_END_little}
- {DW_AT_name "u1"}
- {DW_AT_byte_size 2 DW_FORM_udata}
- {DW_AT_bit_size 1 DW_FORM_udata}
- {DW_AT_data_bit_offset 2 DW_FORM_udata}
+ DW_AT_encoding @DW_ATE_boolean
+ DW_AT_endianity @DW_END_little
+ DW_AT_name "u1"
+ DW_AT_byte_size 2 DW_FORM_udata
+ DW_AT_bit_size 1 DW_FORM_udata
+ DW_AT_data_bit_offset 2 DW_FORM_udata
}
DW_TAG_variable {
- {DW_AT_name "v_u16_1"}
- {DW_AT_type :${u1_type}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "u16_1"]}
- SPECIAL_expr}
+ DW_AT_name "v_u16_1"
+ DW_AT_type :${u1_type}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "u16_1"]
+ } SPECIAL_expr
}
u17_type: DW_TAG_base_type {
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_endianity @DW_END_little}
- {DW_AT_name "u17"}
- {DW_AT_byte_size 4 DW_FORM_udata}
- {DW_AT_bit_size 17 DW_FORM_udata}
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_endianity @DW_END_little
+ DW_AT_name "u17"
+ DW_AT_byte_size 4 DW_FORM_udata
+ DW_AT_bit_size 17 DW_FORM_udata
}
DW_TAG_variable {
- {DW_AT_name "v_u32_m2"}
- {DW_AT_type :${u17_type}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "u32_m2"]}
- SPECIAL_expr}
+ DW_AT_name "v_u32_m2"
+ DW_AT_type :${u17_type}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "u32_m2"]
+ } SPECIAL_expr
}
u31_type: DW_TAG_base_type {
- {DW_AT_encoding @DW_ATE_unsigned}
- {DW_AT_endianity @DW_END_little}
- {DW_AT_name "u31"}
- {DW_AT_byte_size 4 DW_FORM_udata}
- {DW_AT_bit_size 31 DW_FORM_udata}
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_endianity @DW_END_little
+ DW_AT_name "u31"
+ DW_AT_byte_size 4 DW_FORM_udata
+ DW_AT_bit_size 31 DW_FORM_udata
}
DW_TAG_variable {
- {DW_AT_name "v_u32_1"}
- {DW_AT_type :${u31_type}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "u32_1"]}
- SPECIAL_expr}
+ DW_AT_name "v_u32_1"
+ DW_AT_type :${u31_type}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "u32_1"]
+ } SPECIAL_expr
}
u31_1_type: DW_TAG_base_type {
- {DW_AT_encoding @DW_ATE_unsigned}
- {DW_AT_endianity @DW_END_little}
- {DW_AT_name "u31_1"}
- {DW_AT_byte_size 4 DW_FORM_udata}
- {DW_AT_bit_size 31 DW_FORM_udata}
- {DW_AT_data_bit_offset 1 DW_FORM_udata}
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_endianity @DW_END_little
+ DW_AT_name "u31_1"
+ DW_AT_byte_size 4 DW_FORM_udata
+ DW_AT_bit_size 31 DW_FORM_udata
+ DW_AT_data_bit_offset 1 DW_FORM_udata
}
DW_TAG_variable {
- {DW_AT_name "v_u32_1_off"}
- {DW_AT_type :${u31_1_type}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "u32_1_off"]}
- SPECIAL_expr}
+ DW_AT_name "v_u32_1_off"
+ DW_AT_type :${u31_1_type}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "u32_1_off"]
+ } SPECIAL_expr
}
be30_1_type: DW_TAG_base_type {
- {DW_AT_encoding @DW_ATE_unsigned}
- {DW_AT_endianity @DW_END_big}
- {DW_AT_name "be30_1"}
- {DW_AT_byte_size 4 DW_FORM_udata}
- {DW_AT_bit_size 30 DW_FORM_udata}
- {DW_AT_data_bit_offset 1 DW_FORM_udata}
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_endianity @DW_END_big
+ DW_AT_name "be30_1"
+ DW_AT_byte_size 4 DW_FORM_udata
+ DW_AT_bit_size 30 DW_FORM_udata
+ DW_AT_data_bit_offset 1 DW_FORM_udata
}
DW_TAG_variable {
- {DW_AT_name "v_be30_1_off"}
- {DW_AT_type :${be30_1_type}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "be30_1_off"]}
- SPECIAL_expr}
+ DW_AT_name "v_be30_1_off"
+ DW_AT_type :${be30_1_type}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "be30_1_off"]
+ } SPECIAL_expr
}
u32_0_type: DW_TAG_base_type {
- {DW_AT_encoding @DW_ATE_unsigned}
- {DW_AT_endianity @DW_END_little}
- {DW_AT_name "u32_0"}
- {DW_AT_byte_size 4 DW_FORM_udata}
- {DW_AT_bit_size 0 DW_FORM_udata}
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_endianity @DW_END_little
+ DW_AT_name "u32_0"
+ DW_AT_byte_size 4 DW_FORM_udata
+ DW_AT_bit_size 0 DW_FORM_udata
}
DW_TAG_variable {
- {DW_AT_name "v_u32_0"}
- {DW_AT_type :${u32_0_type}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "u32_0"]}
- SPECIAL_expr}
+ DW_AT_name "v_u32_0"
+ DW_AT_type :${u32_0_type}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "u32_0"]
+ } SPECIAL_expr
}
u0_0_type: DW_TAG_base_type {
- {DW_AT_encoding @DW_ATE_unsigned}
- {DW_AT_endianity @DW_END_little}
- {DW_AT_name "u0_0"}
- {DW_AT_byte_size 0 DW_FORM_udata}
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_endianity @DW_END_little
+ DW_AT_name "u0_0"
+ DW_AT_byte_size 0 DW_FORM_udata
}
DW_TAG_variable {
- {DW_AT_name "v_u0_0"}
- {DW_AT_type :${u0_0_type}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "u32_0"]}
- SPECIAL_expr}
+ DW_AT_name "v_u0_0"
+ DW_AT_type :${u0_0_type}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "u32_0"]
+ } SPECIAL_expr
+ }
+
+ just_bit_type: DW_TAG_base_type {
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name "just_bit_type"
+ DW_AT_bit_size 3 DW_FORM_udata
+ }
+
+ DW_TAG_variable {
+ DW_AT_name "v_just_bit"
+ DW_AT_type :${just_bit_type}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "just_bit_0"]
+ } SPECIAL_expr
}
}
}
@@ -197,3 +220,6 @@ gdb_test "x/4xb &v_u32_1_off" ":\t0x0e\t0x00\t0x00\t0x00"
gdb_test "print v_be30_1_off" "= 1"
gdb_test "print v_be30_1_off = 7" " = 7"
gdb_test "x/4xb &v_be30_1_off" ":\t0x00\t0x00\t0x00\t0x0e"
+
+gdb_test "print/x v_just_bit" " = 0x5"
+gdb_test "print/x (just_bit_type) 5" " = 0x5"
diff --git a/gdb/testsuite/gdb.dwarf2/loc-sec-offset.c b/gdb/testsuite/gdb.dwarf2/loc-sec-offset.c
index 2a03b79..a1ddb56 100644
--- a/gdb/testsuite/gdb.dwarf2/loc-sec-offset.c
+++ b/gdb/testsuite/gdb.dwarf2/loc-sec-offset.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/loc-sec-offset.exp b/gdb/testsuite/gdb.dwarf2/loc-sec-offset.exp
index 52ec70d..fb4bf3a 100644
--- a/gdb/testsuite/gdb.dwarf2/loc-sec-offset.exp
+++ b/gdb/testsuite/gdb.dwarf2/loc-sec-offset.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -53,27 +53,27 @@ foreach_with_prefix is_64 {false true} {
DW_TAG_compile_unit {
} {
int_type1: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_data1}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name "int"}
+ DW_AT_byte_size 4 DW_FORM_data1
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name "int"
}
DW_TAG_variable {
- {DW_AT_name "foo"}
- {DW_AT_location $foo_location_list DW_FORM_sec_offset}
- {DW_AT_type :$int_type1}
+ DW_AT_name "foo"
+ DW_AT_location $foo_location_list DW_FORM_sec_offset
+ DW_AT_type :$int_type1
}
DW_TAG_subprogram {
- {DW_AT_name "func1"}
- {DW_AT_low_pc $func1_addr}
- {DW_AT_high_pc $func1_len DW_FORM_udata}
+ DW_AT_name "func1"
+ DW_AT_low_pc $func1_addr
+ DW_AT_high_pc $func1_len DW_FORM_udata
}
DW_TAG_subprogram {
- {DW_AT_name "func2"}
- {DW_AT_low_pc $func2_addr}
- {DW_AT_high_pc $func2_len DW_FORM_udata}
+ DW_AT_name "func2"
+ DW_AT_low_pc $func2_addr
+ DW_AT_high_pc $func2_len DW_FORM_udata
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/local-var.exp b/gdb/testsuite/gdb.dwarf2/local-var.exp
index 6c53305..f0d68b6 100644
--- a/gdb/testsuite/gdb.dwarf2/local-var.exp
+++ b/gdb/testsuite/gdb.dwarf2/local-var.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/local-var.f90 b/gdb/testsuite/gdb.dwarf2/local-var.f90
index eea0b13..b0102a5 100644
--- a/gdb/testsuite/gdb.dwarf2/local-var.f90
+++ b/gdb/testsuite/gdb.dwarf2/local-var.f90
@@ -1,4 +1,4 @@
-! Copyright 2024 Free Software Foundation, Inc.
+! Copyright 2024-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c
index dc0da8f..ce4ed5e 100644
--- a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c
index f36d44d..3c07a3e 100644
--- a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
index 2001b28..1664e68 100644
--- a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -89,8 +89,8 @@ if {[gdb_compile_shlib $libsrc $lib_so \
# Value returned is $1 = (B *) $hex <g_>
# Note that this compilation is used for all GDB sessions.
set exec_options [list debug shlib=$lib_so]
-if [prepare_for_testing "failed to prepare" ${testfile} \
- ${::srcfile} $exec_options] {
+if {[prepare_for_testing "failed to prepare" ${testfile} \
+ ${::srcfile} $exec_options]} {
return -1
}
@@ -154,38 +154,38 @@ Dwarf::assemble ${asm_file} {
cu { label cu_label } {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
- {name ${::srcfile}}
- {stmt_list $L DW_FORM_sec_offset}
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name ${::srcfile}
+ DW_AT_stmt_list $L DW_FORM_sec_offset
} {
declare_labels int_label class_A_label class_B_label \
B_ptr_label
int_label: DW_TAG_base_type {
- {DW_AT_byte_size ${::long_size} DW_FORM_udata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name "int"}
+ DW_AT_byte_size ${::long_size} DW_FORM_udata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name "int"
}
class_A_label: DW_TAG_class_type {
- {DW_AT_name "A"}
- {DW_AT_byte_size ${::struct_A_size} DW_FORM_sdata}
+ DW_AT_name "A"
+ DW_AT_byte_size ${::struct_A_size} DW_FORM_sdata
} {
DW_TAG_member {
- {DW_AT_name "a"}
- {DW_AT_type :$int_label}
- {DW_AT_data_member_location ${::A_a} DW_FORM_udata}
+ DW_AT_name "a"
+ DW_AT_type :$int_label
+ DW_AT_data_member_location ${::A_a} DW_FORM_udata
}
DW_TAG_member {
- {DW_AT_name "x"}
- {DW_AT_type :$int_label}
- {DW_AT_data_member_location ${::A_x} DW_FORM_udata}
+ DW_AT_name "x"
+ DW_AT_type :$int_label
+ DW_AT_data_member_location ${::A_x} DW_FORM_udata
}
}
class_B_label: DW_TAG_class_type {
- {DW_AT_name "B"}
- {DW_AT_byte_size ${::struct_B_size} DW_FORM_sdata}
+ DW_AT_name "B"
+ DW_AT_byte_size ${::struct_B_size} DW_FORM_sdata
} {
# While there are easier / better ways to specify an
# offset used by DW_AT_data_member_location than that
@@ -201,45 +201,48 @@ Dwarf::assemble ${asm_file} {
# by decode_locdesc(); this is why those opcodes were
# chosen.
DW_TAG_inheritance {
- {DW_AT_type :$class_A_label}
- {DW_AT_data_member_location {
+ DW_AT_type :$class_A_label
+ DW_AT_data_member_location {
DW_OP_constu ${::B_a}
DW_OP_plus
DW_OP_pick 0
- DW_OP_drop} SPECIAL_expr}
- {DW_AT_accessibility 1 DW_FORM_data1}
+ DW_OP_drop
+ } SPECIAL_expr
+ DW_AT_accessibility 1 DW_FORM_data1
}
DW_TAG_member {
- {DW_AT_name "b"}
- {DW_AT_type :$int_label}
- {DW_AT_data_member_location ${::B_b} DW_FORM_udata}
+ DW_AT_name "b"
+ DW_AT_type :$int_label
+ DW_AT_data_member_location ${::B_b} DW_FORM_udata
}
DW_TAG_member {
- {DW_AT_name "x2"}
- {DW_AT_type :$int_label}
- {DW_AT_data_member_location ${::B_x2} DW_FORM_udata}
+ DW_AT_name "x2"
+ DW_AT_type :$int_label
+ DW_AT_data_member_location ${::B_x2} DW_FORM_udata
}
}
B_ptr_label: DW_TAG_pointer_type {
- {DW_AT_type :$class_B_label}
- {DW_AT_byte_size ${::addr_size} DW_FORM_sdata}
+ DW_AT_type :$class_B_label
+ DW_AT_byte_size ${::addr_size} DW_FORM_sdata
}
DW_TAG_variable {
- {DW_AT_name "g_A"}
- {DW_AT_type :$class_A_label}
- {DW_AT_external 1 flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "g_A"]} \
- SPECIAL_expr}
+ DW_AT_name "g_A"
+ DW_AT_type :$class_A_label
+ DW_AT_external 1 flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "g_A"]
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name "g_B"}
- {DW_AT_type :$class_B_label}
- {DW_AT_external 1 flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "g_B"]} \
- SPECIAL_expr}
+ DW_AT_name "g_B"
+ DW_AT_type :$class_B_label
+ DW_AT_external 1 flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "g_B"]
+ } SPECIAL_expr
}
# We can't use MACRO_AT for the definitions of foo and bar
@@ -247,23 +250,23 @@ Dwarf::assemble ${asm_file} {
# flags. Therefore, we list the name, low_pc, and high_pc
# explicitly.
DW_TAG_subprogram {
- {DW_AT_name foo}
- {DW_AT_low_pc $foo_start DW_FORM_addr}
- {DW_AT_high_pc $foo_end DW_FORM_addr}
- {DW_AT_type :${B_ptr_label}}
- {DW_AT_external 1 flag}
+ DW_AT_name foo
+ DW_AT_low_pc $foo_start DW_FORM_addr
+ DW_AT_high_pc $foo_end DW_FORM_addr
+ DW_AT_type :${B_ptr_label}
+ DW_AT_external 1 flag
}
DW_TAG_subprogram {
- {DW_AT_name bar}
- {DW_AT_low_pc $bar_start DW_FORM_addr}
- {DW_AT_high_pc $bar_end DW_FORM_addr}
- {DW_AT_type :${B_ptr_label}}
- {DW_AT_external 1 flag}
+ DW_AT_name bar
+ DW_AT_low_pc $bar_start DW_FORM_addr
+ DW_AT_high_pc $bar_end DW_FORM_addr
+ DW_AT_type :${B_ptr_label}
+ DW_AT_external 1 flag
} {
DW_TAG_formal_parameter {
- {DW_AT_name v}
- {DW_AT_type :${B_ptr_label}}
+ DW_AT_name v
+ DW_AT_type :${B_ptr_label}
}
}
}
@@ -330,7 +333,7 @@ if {[gdb_compile_shlib [list $libsrc $asm_file] $lib_so \
### Second GDB session.
with_test_prefix "second session" {
- clean_restart $binfile
+ clean_restart $::testfile
# Again, do whatever is necessary to make sure that the shared library is
# loaded for remote targets.
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h
index b1a1d75..68b2c60 100644
--- a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.c b/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.c
index 2a03b79..a1ddb56 100644
--- a/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.c
+++ b/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp b/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp
index cb64d5b..021129d 100644
--- a/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp
+++ b/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -57,30 +57,30 @@ foreach_with_prefix is_64 {false true} {
declare_labels int_type
DW_TAG_compile_unit {
- {DW_AT_loclists_base cu_table DW_FORM_sec_offset}
+ DW_AT_loclists_base cu_table DW_FORM_sec_offset
} {
int_type: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_data1}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name "int"}
+ DW_AT_byte_size 4 DW_FORM_data1
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name "int"
}
DW_TAG_variable {
- {DW_AT_name "foo"}
- {DW_AT_location 1 DW_FORM_loclistx}
- {DW_AT_type :$int_type}
+ DW_AT_name "foo"
+ DW_AT_location 1 DW_FORM_loclistx
+ DW_AT_type :$int_type
}
DW_TAG_subprogram {
- {DW_AT_name "func1"}
- {DW_AT_low_pc $func1_addr}
- {DW_AT_high_pc $func1_len DW_FORM_udata}
+ DW_AT_name "func1"
+ DW_AT_low_pc $func1_addr
+ DW_AT_high_pc $func1_len DW_FORM_udata
}
DW_TAG_subprogram {
- {DW_AT_name "func2"}
- {DW_AT_low_pc $func2_addr}
- {DW_AT_high_pc $func2_len DW_FORM_udata}
+ DW_AT_name "func2"
+ DW_AT_low_pc $func2_addr
+ DW_AT_high_pc $func2_len DW_FORM_udata
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/loclists-sec-offset.c b/gdb/testsuite/gdb.dwarf2/loclists-sec-offset.c
index 86dd740..e47cc5d 100644
--- a/gdb/testsuite/gdb.dwarf2/loclists-sec-offset.c
+++ b/gdb/testsuite/gdb.dwarf2/loclists-sec-offset.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/loclists-sec-offset.exp b/gdb/testsuite/gdb.dwarf2/loclists-sec-offset.exp
index ff55e24..e39ca19 100644
--- a/gdb/testsuite/gdb.dwarf2/loclists-sec-offset.exp
+++ b/gdb/testsuite/gdb.dwarf2/loclists-sec-offset.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -66,27 +66,27 @@ foreach_with_prefix is_64 {false true} {
DW_TAG_compile_unit {
} {
int_type1: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_data1}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name "int"}
+ DW_AT_byte_size 4 DW_FORM_data1
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name "int"
}
DW_TAG_variable {
- {DW_AT_name "foo"}
- {DW_AT_location $foo_location_list DW_FORM_sec_offset}
- {DW_AT_type :$int_type1}
+ DW_AT_name "foo"
+ DW_AT_location $foo_location_list DW_FORM_sec_offset
+ DW_AT_type :$int_type1
}
DW_TAG_subprogram {
- {DW_AT_name "func1"}
- {DW_AT_low_pc $func1_addr}
- {DW_AT_high_pc $func1_len DW_FORM_udata}
+ DW_AT_name "func1"
+ DW_AT_low_pc $func1_addr
+ DW_AT_high_pc $func1_len DW_FORM_udata
}
DW_TAG_subprogram {
- {DW_AT_name "func2"}
- {DW_AT_low_pc $func2_addr}
- {DW_AT_high_pc $func2_len DW_FORM_udata}
+ DW_AT_name "func2"
+ DW_AT_low_pc $func2_addr
+ DW_AT_high_pc $func2_len DW_FORM_udata
}
}
}
@@ -100,30 +100,30 @@ foreach_with_prefix is_64 {false true} {
is_64 $is_64
} {
DW_TAG_compile_unit {
- {DW_AT_loclists_base cu2_table DW_FORM_sec_offset}
+ DW_AT_loclists_base cu2_table DW_FORM_sec_offset
} {
int_type2: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_data1}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name "int"}
+ DW_AT_byte_size 4 DW_FORM_data1
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name "int"
}
DW_TAG_variable {
- {DW_AT_name "bar"}
- {DW_AT_location $bar_location_list DW_FORM_sec_offset}
- {DW_AT_type :$int_type2}
+ DW_AT_name "bar"
+ DW_AT_location $bar_location_list DW_FORM_sec_offset
+ DW_AT_type :$int_type2
}
DW_TAG_subprogram {
- {DW_AT_name "func3"}
- {DW_AT_low_pc $func3_addr}
- {DW_AT_high_pc $func3_len DW_FORM_udata}
+ DW_AT_name "func3"
+ DW_AT_low_pc $func3_addr
+ DW_AT_high_pc $func3_len DW_FORM_udata
}
DW_TAG_subprogram {
- {DW_AT_name "func4"}
- {DW_AT_low_pc $func4_addr}
- {DW_AT_high_pc $func4_len DW_FORM_udata}
+ DW_AT_name "func4"
+ DW_AT_low_pc $func4_addr
+ DW_AT_high_pc $func4_len DW_FORM_udata
}
}
}
@@ -138,27 +138,27 @@ foreach_with_prefix is_64 {false true} {
DW_TAG_compile_unit {
} {
int_type3: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_data1}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name "int"}
+ DW_AT_byte_size 4 DW_FORM_data1
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name "int"
}
DW_TAG_variable {
- {DW_AT_name "baz"}
- {DW_AT_location $baz_location_list DW_FORM_sec_offset}
- {DW_AT_type :$int_type3}
+ DW_AT_name "baz"
+ DW_AT_location $baz_location_list DW_FORM_sec_offset
+ DW_AT_type :$int_type3
}
DW_TAG_subprogram {
- {DW_AT_name "func5"}
- {DW_AT_low_pc $func5_addr}
- {DW_AT_high_pc $func5_len DW_FORM_udata}
+ DW_AT_name "func5"
+ DW_AT_low_pc $func5_addr
+ DW_AT_high_pc $func5_len DW_FORM_udata
}
DW_TAG_subprogram {
- {DW_AT_name "func6"}
- {DW_AT_low_pc $func6_addr}
- {DW_AT_high_pc $func6_len DW_FORM_udata}
+ DW_AT_name "func6"
+ DW_AT_low_pc $func6_addr
+ DW_AT_high_pc $func6_len DW_FORM_udata
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/loclists-start-end.c b/gdb/testsuite/gdb.dwarf2/loclists-start-end.c
index 2a03b79..a1ddb56 100644
--- a/gdb/testsuite/gdb.dwarf2/loclists-start-end.c
+++ b/gdb/testsuite/gdb.dwarf2/loclists-start-end.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/loclists-start-end.exp b/gdb/testsuite/gdb.dwarf2/loclists-start-end.exp
index 9d4804c..876a8b2 100644
--- a/gdb/testsuite/gdb.dwarf2/loclists-start-end.exp
+++ b/gdb/testsuite/gdb.dwarf2/loclists-start-end.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -48,30 +48,30 @@ foreach_with_prefix is_64 {false true} {
declare_labels int_type
DW_TAG_compile_unit {
- {DW_AT_loclists_base cu_table DW_FORM_sec_offset}
+ DW_AT_loclists_base cu_table DW_FORM_sec_offset
} {
int_type: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_data1}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name "int"}
+ DW_AT_byte_size 4 DW_FORM_data1
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name "int"
}
DW_TAG_variable {
- {DW_AT_name "foo"}
- {DW_AT_location 1 DW_FORM_loclistx}
- {DW_AT_type :$int_type}
+ DW_AT_name "foo"
+ DW_AT_location 1 DW_FORM_loclistx
+ DW_AT_type :$int_type
}
DW_TAG_subprogram {
- {DW_AT_name "func1"}
- {DW_AT_low_pc $func1_addr}
- {DW_AT_high_pc $func1_len DW_FORM_udata}
+ DW_AT_name "func1"
+ DW_AT_low_pc $func1_addr
+ DW_AT_high_pc $func1_len DW_FORM_udata
}
DW_TAG_subprogram {
- {DW_AT_name "func2"}
- {DW_AT_low_pc $func2_addr}
- {DW_AT_high_pc $func2_len DW_FORM_udata}
+ DW_AT_name "func2"
+ DW_AT_low_pc $func2_addr
+ DW_AT_high_pc $func2_len DW_FORM_udata
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/mac-fileno.S b/gdb/testsuite/gdb.dwarf2/mac-fileno.S
index e4c16ed..1a66895 100644
--- a/gdb/testsuite/gdb.dwarf2/mac-fileno.S
+++ b/gdb/testsuite/gdb.dwarf2/mac-fileno.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2005-2024 Free Software Foundation, Inc.
+ Copyright 2005-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/mac-fileno.exp b/gdb/testsuite/gdb.dwarf2/mac-fileno.exp
index 4a68c1a..94efd24 100644
--- a/gdb/testsuite/gdb.dwarf2/mac-fileno.exp
+++ b/gdb/testsuite/gdb.dwarf2/mac-fileno.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/macro-complaints.exp b/gdb/testsuite/gdb.dwarf2/macro-complaints.exp
index 01060b8..17e18c0 100644
--- a/gdb/testsuite/gdb.dwarf2/macro-complaints.exp
+++ b/gdb/testsuite/gdb.dwarf2/macro-complaints.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,20 +36,20 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_name $::srcfile}
- {DW_AT_macros $cu_macro1 DW_FORM_sec_offset}
- {DW_AT_stmt_list $L DW_FORM_sec_offset}
+ DW_AT_name $::srcfile
+ DW_AT_macros $cu_macro1 DW_FORM_sec_offset
+ DW_AT_stmt_list $L DW_FORM_sec_offset
} {
declare_labels int_type
int_type: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
DW_TAG_subprogram {
- {MACRO_AT_func {main}}
- {type :$int_type}
+ MACRO_AT_func {main}
+ DW_AT_type :$int_type
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw4.exp b/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw4.exp
new file mode 100644
index 0000000..d4407d7
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw4.exp
@@ -0,0 +1,75 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2022-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Generate binaries imitating different ways source file paths can be passed to
+# compilers. Test printing macros from those binaries.
+
+load_lib dwarf.exp
+
+require dwarf2_support
+
+# The do_test proc comes from macro-source-path.exp.tcl.
+source $srcdir/$subdir/macro-source-path.exp.tcl
+
+# When adding a test here, please consider adding an equivalent case to
+# `gdb.base/macro-source-path.exp`.
+
+# The following tests are based on the output of `clang-14 -gdwarf-4
+# -fdebug-macro -g3 <file>` (using its built-in assembler). With -gdwarf-4,
+# clang produces a .debug_macinfo section, not a .debug_macro section. But
+# this test still creates a .debug_macro section, that's good enough for what
+# we want to test.
+
+## test.c
+do_test filename 4 "test.c" 1 {
+} {
+ {"test.c" 0}
+}
+
+## ./test.c
+do_test dot-filename 4 "test.c" 1 {
+ "."
+} {
+ {"test.c" 1}
+}
+
+## ../cwd/test.c
+do_test dot-dot-cwd 4 "../cwd/test.c" 1 {
+ "../cwd"
+} {
+ {"test.c" 1}
+}
+
+## /tmp/cwd/test.c
+do_test absolute-cwd 4 "/tmp/cwd/test.c" 1 {
+} {
+ {"test.c" 0}
+}
+
+## ../other/test.c
+do_test dot-dot-other 4 "../other/test.c" 1 {
+ "../other"
+} {
+ {"test.c" 1}
+}
+
+## /tmp/other/test.c
+do_test absolute-other 4 "/tmp/other/test.c" 1 {
+ "/tmp"
+} {
+ {"other/test.c" 1}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw5.exp b/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw5.exp
new file mode 100644
index 0000000..23a40ba
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path-clang14-dw5.exp
@@ -0,0 +1,79 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2022-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Generate binaries imitating different ways source file paths can be passed to
+# compilers. Test printing macros from those binaries.
+
+load_lib dwarf.exp
+
+require dwarf2_support
+
+# The do_test proc comes from macro-source-path.exp.tcl.
+source $srcdir/$subdir/macro-source-path.exp.tcl
+
+# When adding a test here, please consider adding an equivalent case to
+# `gdb.base/macro-source-path.exp`.
+
+# The following tests are based on the output of `clang-14 -gdwarf-5
+# -fdebug-macro -g3 <file>` (using its built-in assembler)
+
+## test.c
+do_test filename 5 "test.c" 0 {
+ "/tmp/cwd"
+} {
+ {"test.c" 0}
+}
+
+## ./test.c
+do_test dot-filename 5 "test.c" 1 {
+ "/tmp/cwd"
+ "."
+} {
+ {"test.c" 0}
+ {"test.c" 1}
+}
+
+## ../cwd/test.c
+do_test dot-dot-cwd 5 "../cwd/test.c" 0 {
+ "/tmp/cwd"
+} {
+ {"../cwd/test.c" 0}
+}
+
+## /tmp/cwd/test.c
+do_test absolute-cwd 5 "/tmp/cwd/test.c" 1 {
+ "/tmp/cwd"
+} {
+ {"/tmp/cwd/test.c" 0}
+ {"test.c" 0}
+}
+
+## ../other/test.c
+do_test dot-dot-other 5 "../other/test.c" 0 {
+ "/tmp/cwd"
+} {
+ {"../other/test.c" 0}
+}
+
+## /tmp/other/test.c
+do_test absolute-other 5 "/tmp/other/test.c" 1 {
+ "/tmp/cwd"
+ "/tmp"
+} {
+ {"/tmp/other/test.c" 0}
+ {"other/test.c" 1}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld234-dw5.exp b/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld234-dw5.exp
new file mode 100644
index 0000000..99f7857
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld234-dw5.exp
@@ -0,0 +1,74 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2022-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Generate binaries imitating different ways source file paths can be passed to
+# compilers. Test printing macros from those binaries.
+
+load_lib dwarf.exp
+
+require dwarf2_support
+
+# The do_test proc comes from macro-source-path.exp.tcl.
+source $srcdir/$subdir/macro-source-path.exp.tcl
+
+# When adding a test here, please consider adding an equivalent case to
+# `gdb.base/macro-source-path.exp`.
+
+# The following tests are based on the output of `gcc -gdwarf-5 -g3 <file>`,
+# gcc 11 paired with gas from binutils 2.34 (Ubuntu 20.04). It generates a v5
+# .debug_macro section, but a v3 .debug_line section.
+
+## test.c
+do_test filename 3 "test.c" 1 {
+} {
+ {"test.c" 0}
+}
+
+## ./test.c
+do_test dot-filename 3 "./test.c" 1 {
+ "."
+} {
+ {"test.c" 1}
+}
+
+## ../cwd/test.c
+do_test dot-dot-cwd 3 "../cwd/test.c" 1 {
+ "../cwd"
+} {
+ {"test.c" 1}
+}
+
+## /tmp/cwd/test.c
+do_test absolute-cwd 3 "/tmp/cwd/test.c" 1 {
+ "/tmp/cwd"
+} {
+ {"test.c" 1}
+}
+
+## ../other/test.c
+do_test dot-dot-other 3 "../other/test.c" 1 {
+ "../other"
+} {
+ {"test.c" 1}
+}
+
+## /tmp/other/test.c
+do_test absolute-other 3 "/tmp/other/test.c" 1 {
+ "/tmp/other"
+} {
+ {"test.c" 1}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw4.exp b/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw4.exp
new file mode 100644
index 0000000..569b409
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw4.exp
@@ -0,0 +1,74 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2022-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Generate binaries imitating different ways source file paths can be passed to
+# compilers. Test printing macros from those binaries.
+
+load_lib dwarf.exp
+
+require dwarf2_support
+
+# The do_test proc comes from macro-source-path.exp.tcl.
+source $srcdir/$subdir/macro-source-path.exp.tcl
+
+# When adding a test here, please consider adding an equivalent case to
+# `gdb.base/macro-source-path.exp`.
+
+# The following tests are based on the output of `gcc -gdwarf-4 -g3 <file>`,
+# gcc 11 paired with gas from binutils 2.38. With -gdwarf-4, gcc generates a
+# v4 (pre-standard) .debug_macro section.
+
+## test.c
+do_test filename 4 "test.c" 1 {
+} {
+ {"test.c" 0}
+}
+
+## ./test.c
+do_test dot-filename 4 "./test.c" 1 {
+ "."
+} {
+ {"test.c" 1}
+}
+
+## ../cwd/test.c
+do_test dot-dot-cwd 4 "../cwd/test.c" 1 {
+ "../cwd"
+} {
+ {"test.c" 1}
+}
+
+## /tmp/cwd/test.c
+do_test absolute-cwd 4 "/tmp/cwd/test.c" 1 {
+ "/tmp/cwd"
+} {
+ {"test.c" 1}
+}
+
+## ../other/test.c
+do_test dot-dot-other 4 "../other/test.c" 1 {
+ "../other"
+} {
+ {"test.c" 1}
+}
+
+## /tmp/other/test.c
+do_test absolute-other 4 "/tmp/other/test.c" 1 {
+ "/tmp/other"
+} {
+ {"test.c" 1}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw5.exp b/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw5.exp
new file mode 100644
index 0000000..0517d29
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path-gcc11-ld238-dw5.exp
@@ -0,0 +1,85 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2022-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Generate binaries imitating different ways source file paths can be passed to
+# compilers. Test printing macros from those binaries.
+
+load_lib dwarf.exp
+
+require dwarf2_support
+
+# The do_test proc comes from macro-source-path.exp.tcl.
+source $srcdir/$subdir/macro-source-path.exp.tcl
+
+# When adding a test here, please consider adding an equivalent case to
+# `gdb.base/macro-source-path.exp`.
+
+# The following tests are based on the output of `gcc -gdwarf-5 -g3 <file>`,
+# gcc 11 paired with gas from binutils 2.38.
+
+## test.c
+do_test filename 5 "test.c" 1 {
+ "/tmp/cwd"
+} {
+ {"test.c" 0}
+ {"test.c" 0}
+}
+
+## ./test.c
+do_test dot-filename 5 "./test.c" 1 {
+ "/tmp/cwd"
+ "."
+} {
+ {"test.c" 1}
+ {"test.c" 1}
+}
+
+## ../cwd/test.c
+do_test dot-dot-cwd 5 "../cwd/test.c" 1 {
+ "/tmp/cwd"
+ "../cwd"
+} {
+ {"test.c" 1}
+ {"test.c" 1}
+}
+
+## /tmp/cwd/test.c
+do_test absolute-cwd 5 "/tmp/cwd/test.c" 1 {
+ "/tmp/cwd"
+ "/tmp/cwd"
+} {
+ {"test.c" 1}
+ {"test.c" 0}
+}
+
+## ../other/test.c
+do_test dot-dot-other 5 "../other/test.c" 1 {
+ "/tmp/cwd"
+ "../other"
+} {
+ {"test.c" 1}
+ {"test.c" 1}
+}
+
+## /tmp/other/test.c
+do_test absolute-other 5 "/tmp/other/test.c" 1 {
+ "/tmp/cwd"
+ "/tmp/other"
+} {
+ {"test.c" 1}
+ {"test.c" 1}
+}
diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path.c b/gdb/testsuite/gdb.dwarf2/macro-source-path.c
index 5bc5580..97766a9 100644
--- a/gdb/testsuite/gdb.dwarf2/macro-source-path.c
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path.exp b/gdb/testsuite/gdb.dwarf2/macro-source-path.exp
deleted file mode 100644
index fccfabd..0000000
--- a/gdb/testsuite/gdb.dwarf2/macro-source-path.exp
+++ /dev/null
@@ -1,407 +0,0 @@
-# This testcase is part of GDB, the GNU debugger.
-
-# Copyright 2022-2024 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Generate binaries imitating different ways source file paths can be passed to
-# compilers. Test printing macros from those binaries.
-
-load_lib dwarf.exp
-
-require dwarf2_support
-
-standard_testfile .c
-
-lassign [function_range main $srcdir/$subdir/$srcfile] \
- main_start main_len
-
-# Run one test.
-#
-# - TEST_NAME is the name of the test, used to differentiate the binaries.
-# - LINES_VERSION is the version of the version of the .debug_line section to
-# generate.
-# - DW_AT_NAME is the string to put in the compilation unit's DW_AT_name
-# attribute.
-# - MAIN_FILE_IDX is the file index the .debug_line and .debug_macro sections
-# will use to refer to the main file.
-# - DIRECTORIES is a list of directories to put in the .debug_line section
-# header
-# - FILE_NAMES is a list of {name, directory index} pairs describing the files
-# names to put in the .debug_line section header.
-
-proc do_test { test_name lines_version DW_AT_name main_file_idx directories
- file_names } {
- with_test_prefix "test_name=$test_name" {
- foreach_with_prefix is_64 {true false} {
- # So we can access them in Dwarf::assemble...
- set ::lines_version $lines_version
- set ::DW_AT_name $DW_AT_name
- set ::main_file_idx $main_file_idx
- set ::directories $directories
- set ::file_names $file_names
- set ::is_64 $is_64
- set 32_or_64 [expr $is_64 ? 64 : 32]
-
- set asm_file [standard_output_file ${::testfile}-${test_name}-${32_or_64}.S]
- Dwarf::assemble $asm_file {
- declare_labels Llines cu_macros
-
- # DW_AT_comp_dir is always the current working directory
- # from which the compiler was invoked. We pretend the compiler was
- # always launched from /tmp/cwd.
- set comp_dir "/tmp/cwd"
-
- cu {} {
- DW_TAG_compile_unit {
- {DW_AT_producer "My C Compiler"}
- {DW_AT_language @DW_LANG_C11}
- {DW_AT_name $::DW_AT_name}
- {DW_AT_comp_dir $comp_dir}
- {DW_AT_stmt_list $Llines DW_FORM_sec_offset}
- {DW_AT_macros $cu_macros DW_FORM_sec_offset}
- } {
- declare_labels int_type
-
- int_type: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
- }
-
- DW_TAG_subprogram {
- {MACRO_AT_func {main}}
- {type :$int_type}
- }
- }
- }
-
- # Define the .debug_line section.
- lines [list version $::lines_version] "Llines" {
- foreach directory $::directories {
- include_dir $directory
- }
-
- foreach file_name $::file_names {
- lassign $file_name name dir_index
- file_name $name $dir_index
- }
-
- # A line number program just good enough so that GDB can
- # figure out we are stopped in main.
- program {
- DW_LNS_set_file $::main_file_idx
- DW_LNE_set_address $::main_start
- line 10
- DW_LNS_copy
-
- DW_LNE_set_address "$::main_start + $::main_len"
- DW_LNE_end_sequence
- }
- }
-
- # Define the .debug_macro section.
- macro {
- cu_macros: unit {
- "debug-line-offset-label" $Llines
- "is-64" $::is_64
- } {
- # A macro defined outside the main file, as if it was defined
- # on the command line with -D.
- #
- # Clang has this bug where it puts the macros defined on
- # the command-line after the main file portion (see
- # PR 29034). We're not trying to replicate that here,
- # this is not in the scope of this test.
- define 0 "ONE 1"
- define_strp 0 "THREE 3"
- start_file 0 $::main_file_idx
- # A macro defined at line 1 of the main file.
- define 1 "TWO 2"
- end_file
- }
- }
- }
-
- if { [prepare_for_testing "failed to prepare" ${::testfile}-${test_name}-${32_or_64} \
- [list $::srcfile $asm_file] {nodebug}] } {
- return
- }
-
- with_complaints 5 {
- gdb_test_multiple "print main" "no complaints" {
- -wrap -re "During symbol reading: .*" {
- fail $gdb_test_name
- }
- -wrap -re "" {
- pass $gdb_test_name
- }
- }
- }
-
- if ![runto_main] {
- return
- }
-
- gdb_test "print ONE" " = 1"
- gdb_test "print TWO" " = 2"
- gdb_test "print THREE" " = 3"
- }
- }
-}
-
-# When adding a test here, please consider adding an equivalent case to the test
-# of the same name in gdb.base.
-
-# The following tests are based on the output of `gcc -gdwarf-5 -g3 <file>`,
-# gcc 11 paired with gas from binutils 2.38.
-
-## test.c
-do_test gcc11-ld238-dw5-filename 5 "test.c" 1 {
- "/tmp/cwd"
-} {
- {"test.c" 0}
- {"test.c" 0}
-}
-
-## ./test.c
-do_test gcc11-ld238-dw5-dot-filename 5 "./test.c" 1 {
- "/tmp/cwd"
- "."
-} {
- {"test.c" 1}
- {"test.c" 1}
-}
-
-## ../cwd/test.c
-do_test gcc11-ld238-dw5-dot-dot-cwd 5 "../cwd/test.c" 1 {
- "/tmp/cwd"
- "../cwd"
-} {
- {"test.c" 1}
- {"test.c" 1}
-}
-
-## /tmp/cwd/test.c
-do_test gcc11-ld238-dw5-absolute-cwd 5 "/tmp/cwd/test.c" 1 {
- "/tmp/cwd"
- "/tmp/cwd"
-} {
- {"test.c" 1}
- {"test.c" 0}
-}
-
-## ../other/test.c
-do_test gcc11-ld238-dw5-dot-dot-other 5 "../other/test.c" 1 {
- "/tmp/cwd"
- "../other"
-} {
- {"test.c" 1}
- {"test.c" 1}
-}
-
-## /tmp/other/test.c
-do_test gcc11-ld238-dw5-absolute-other 5 "/tmp/other/test.c" 1 {
- "/tmp/cwd"
- "/tmp/other"
-} {
- {"test.c" 1}
- {"test.c" 1}
-}
-
-# The following tests are based on the output of `gcc -gdwarf-4 -g3 <file>`,
-# gcc 11 paired with gas from binutils 2.38. With -gdwarf-4, gcc generates a
-# v4 (pre-standard) .debug_macro section.
-
-## test.c
-do_test gcc11-ld238-dw4-filename 4 "test.c" 1 {
-} {
- {"test.c" 0}
-}
-
-## ./test.c
-do_test gcc11-ld238-dw4-dot-filename 4 "./test.c" 1 {
- "."
-} {
- {"test.c" 1}
-}
-
-## ../cwd/test.c
-do_test gcc11-ld238-dw4-dot-dot-cwd 4 "../cwd/test.c" 1 {
- "../cwd"
-} {
- {"test.c" 1}
-}
-
-## /tmp/cwd/test.c
-do_test gcc11-ld238-dw4-absolute-cwd 4 "/tmp/cwd/test.c" 1 {
- "/tmp/cwd"
-} {
- {"test.c" 1}
-}
-
-## ../other/test.c
-do_test gcc11-ld238-dw4-dot-dot-other 4 "../other/test.c" 1 {
- "../other"
-} {
- {"test.c" 1}
-}
-
-## /tmp/other/test.c
-do_test gcc11-ld238-dw4-absolute-other 4 "/tmp/other/test.c" 1 {
- "/tmp/other"
-} {
- {"test.c" 1}
-}
-
-# The following tests are based on the output of `clang-14 -gdwarf-5
-# -fdebug-macro -g3 <file>` (using its built-in assembler)
-
-## test.c
-do_test clang14-dw5-filename 5 "test.c" 0 {
- "/tmp/cwd"
-} {
- {"test.c" 0}
-}
-
-## ./test.c
-do_test clang14-dw5-dot-filename 5 "test.c" 1 {
- "/tmp/cwd"
- "."
-} {
- {"test.c" 0}
- {"test.c" 1}
-}
-
-## ../cwd/test.c
-do_test clang14-dw5-dot-dot-cwd 5 "../cwd/test.c" 0 {
- "/tmp/cwd"
-} {
- {"../cwd/test.c" 0}
-}
-
-## /tmp/cwd/test.c
-do_test clang14-dw5-absolute-cwd 5 "/tmp/cwd/test.c" 1 {
- "/tmp/cwd"
-} {
- {"/tmp/cwd/test.c" 0}
- {"test.c" 0}
-}
-
-## ../other/test.c
-do_test clang14-dw5-dot-dot-other 5 "../other/test.c" 0 {
- "/tmp/cwd"
-} {
- {"../other/test.c" 0}
-}
-
-## /tmp/other/test.c
-do_test clang14-dw5-absolute-other 5 "/tmp/other/test.c" 1 {
- "/tmp/cwd"
- "/tmp"
-} {
- {"/tmp/other/test.c" 0}
- {"other/test.c" 1}
-}
-
-# The following tests are based on the output of `clang-14 -gdwarf-4
-# -fdebug-macro -g3 <file>` (using its built-in assembler). With -gdwarf-4,
-# clang produces a .debug_macinfo section, not a .debug_macro section. But
-# this test still creates a .debug_macro section, that's good enough for what
-# we want to test.
-
-## test.c
-do_test clang14-dw4-filename 4 "test.c" 1 {
-} {
- {"test.c" 0}
-}
-
-## ./test.c
-do_test clang14-dw4-dot-filename 4 "test.c" 1 {
- "."
-} {
- {"test.c" 1}
-}
-
-## ../cwd/test.c
-do_test clang14-dw4-dot-dot-cwd 4 "../cwd/test.c" 1 {
- "../cwd"
-} {
- {"test.c" 1}
-}
-
-## /tmp/cwd/test.c
-do_test clang14-dw4-absolute-cwd 4 "/tmp/cwd/test.c" 1 {
-} {
- {"test.c" 0}
-}
-
-## ../other/test.c
-do_test clang14-dw4-dot-dot-other 4 "../other/test.c" 1 {
- "../other"
-} {
- {"test.c" 1}
-}
-
-## /tmp/other/test.c
-do_test clang14-dw4-absolute-other 4 "/tmp/other/test.c" 1 {
- "/tmp"
-} {
- {"other/test.c" 1}
-}
-
-# The following tests are based on the output of `gcc -gdwarf-5 -g3 <file>`,
-# gcc 11 paired with gas from binutils 2.34 (Ubuntu 20.04). It generates a v5
-# .debug_macro section, but a v3 .debug_line section.
-
-## test.c
-do_test gcc11-ld234-dw5-filename 3 "test.c" 1 {
-} {
- {"test.c" 0}
-}
-
-## ./test.c
-do_test gcc11-ld234-dw5-dot-filename 3 "./test.c" 1 {
- "."
-} {
- {"test.c" 1}
-}
-
-## ../cwd/test.c
-do_test gcc11-ld234-dw5-dot-dot-cwd 3 "../cwd/test.c" 1 {
- "../cwd"
-} {
- {"test.c" 1}
-}
-
-## /tmp/cwd/test.c
-do_test gcc11-ld234-dw5-absolute-cwd 3 "/tmp/cwd/test.c" 1 {
- "/tmp/cwd"
-} {
- {"test.c" 1}
-}
-
-## ../other/test.c
-do_test gcc11-ld234-dw5-dot-dot-other 3 "../other/test.c" 1 {
- "../other"
-} {
- {"test.c" 1}
-}
-
-## /tmp/other/test.c
-do_test gcc11-ld234-dw5-absolute-other 3 "/tmp/other/test.c" 1 {
- "/tmp/other"
-} {
- {"test.c" 1}
-}
diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path.exp.tcl b/gdb/testsuite/gdb.dwarf2/macro-source-path.exp.tcl
new file mode 100644
index 0000000..df7101d
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/macro-source-path.exp.tcl
@@ -0,0 +1,161 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2022-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Generate binaries imitating different ways source file paths can be passed to
+# compilers. Test printing macros from those binaries.
+#
+# The entry points for this test are in the various
+# gdb.dwarf2/macro-source-path-*.exp files.
+
+standard_testfile macro-source-path.c
+
+lassign [function_range main $srcdir/$subdir/$srcfile] \
+ main_start main_len
+
+# Run one test.
+#
+# - TEST_NAME is the name of the test, used to differentiate the binaries.
+# - LINES_VERSION is the version of the version of the .debug_line section to
+# generate.
+# - DW_AT_NAME is the string to put in the compilation unit's DW_AT_name
+# attribute.
+# - MAIN_FILE_IDX is the file index the .debug_line and .debug_macro sections
+# will use to refer to the main file.
+# - DIRECTORIES is a list of directories to put in the .debug_line section
+# header
+# - FILE_NAMES is a list of {name, directory index} pairs describing the files
+# names to put in the .debug_line section header.
+
+proc do_test { test_name lines_version DW_AT_name main_file_idx directories
+ file_names } {
+ with_test_prefix "test_name=$test_name" {
+ foreach_with_prefix is_64 {true false} {
+ # So we can access them in Dwarf::assemble...
+ set ::lines_version $lines_version
+ set ::DW_AT_name $DW_AT_name
+ set ::main_file_idx $main_file_idx
+ set ::directories $directories
+ set ::file_names $file_names
+ set ::is_64 $is_64
+ set 32_or_64 [expr {$is_64 ? 64 : 32}]
+
+ set asm_file [standard_output_file ${::testfile}-${test_name}-${32_or_64}.S]
+ Dwarf::assemble $asm_file {
+ declare_labels Llines cu_macros
+
+ # DW_AT_comp_dir is always the current working directory
+ # from which the compiler was invoked. We pretend the compiler was
+ # always launched from /tmp/cwd.
+ set comp_dir "/tmp/cwd"
+
+ cu {} {
+ DW_TAG_compile_unit {
+ DW_AT_producer "My C Compiler"
+ DW_AT_language @DW_LANG_C11
+ DW_AT_name $::DW_AT_name
+ DW_AT_comp_dir $comp_dir
+ DW_AT_stmt_list $Llines DW_FORM_sec_offset
+ DW_AT_macros $cu_macros DW_FORM_sec_offset
+ } {
+ declare_labels int_type
+
+ int_type: DW_TAG_base_type {
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
+ }
+
+ DW_TAG_subprogram {
+ MACRO_AT_func {main}
+ DW_AT_type :$int_type
+ }
+ }
+ }
+
+ # Define the .debug_line section.
+ lines [list version $::lines_version] "Llines" {
+ foreach directory $::directories {
+ include_dir $directory
+ }
+
+ foreach file_name $::file_names {
+ lassign $file_name name dir_index
+ file_name $name $dir_index
+ }
+
+ # A line number program just good enough so that GDB can
+ # figure out we are stopped in main.
+ program {
+ DW_LNS_set_file $::main_file_idx
+ DW_LNE_set_address $::main_start
+ line 10
+ DW_LNS_copy
+
+ DW_LNE_set_address "$::main_start + $::main_len"
+ DW_LNE_end_sequence
+ }
+ }
+
+ # Define the .debug_macro section.
+ macro {
+ cu_macros: unit {
+ "debug-line-offset-label" $Llines
+ "is-64" $::is_64
+ } {
+ # A macro defined outside the main file, as if it was defined
+ # on the command line with -D.
+ #
+ # Clang has this bug where it puts the macros defined on
+ # the command-line after the main file portion (see
+ # PR 29034). We're not trying to replicate that here,
+ # this is not in the scope of this test.
+ define 0 "ONE 1"
+ define_strp 0 "THREE 3"
+ start_file 0 $::main_file_idx
+ # A macro defined at line 1 of the main file.
+ define 1 "TWO 2"
+ end_file
+ }
+ }
+ }
+
+ if { [prepare_for_testing "failed to prepare" ${::testfile}-${test_name}-${32_or_64} \
+ [list $::srcfile $asm_file] {nodebug}] } {
+ return
+ }
+
+ with_complaints 5 {
+ gdb_test_multiple "print main" "no complaints" {
+ -wrap -re "During symbol reading: .*" {
+ fail $gdb_test_name
+ }
+ -wrap -re "" {
+ pass $gdb_test_name
+ }
+ }
+ }
+
+ if {![runto_main]} {
+ return
+ }
+
+ gdb_test "print ONE" " = 1"
+ gdb_test "print TWO" " = 2"
+ gdb_test "print THREE" " = 3"
+ }
+ }
+}
diff --git a/gdb/testsuite/gdb.dwarf2/main-foo.c b/gdb/testsuite/gdb.dwarf2/main-foo.c
index 17ebbfe..43d185c 100644
--- a/gdb/testsuite/gdb.dwarf2/main-foo.c
+++ b/gdb/testsuite/gdb.dwarf2/main-foo.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/main-subprogram.c b/gdb/testsuite/gdb.dwarf2/main-subprogram.c
index 63a52b2..23a95d5 100644
--- a/gdb/testsuite/gdb.dwarf2/main-subprogram.c
+++ b/gdb/testsuite/gdb.dwarf2/main-subprogram.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/main-subprogram.exp b/gdb/testsuite/gdb.dwarf2/main-subprogram.exp
index bc4ce7f..0200316 100644
--- a/gdb/testsuite/gdb.dwarf2/main-subprogram.exp
+++ b/gdb/testsuite/gdb.dwarf2/main-subprogram.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,22 +31,22 @@ Dwarf::assemble $asm_file {
# so choose a language that isn't C and that gdb is unlikely
# to implement.
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_PLI}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
- } {
+ DW_AT_language @DW_LANG_PLI
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
+ } {
declare_labels type
- type: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
- }
+ type: DW_TAG_base_type {
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
+ }
DW_TAG_subprogram {
- {MACRO_AT_func {mymain}}
- {type :$type}
- {DW_AT_main_subprogram 1 flag}
+ MACRO_AT_func {mymain}
+ DW_AT_type :$type
+ DW_AT_main_subprogram 1 flag
} {
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/main.c b/gdb/testsuite/gdb.dwarf2/main.c
index 70399d4..b138220 100644
--- a/gdb/testsuite/gdb.dwarf2/main.c
+++ b/gdb/testsuite/gdb.dwarf2/main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/mega-enum.exp b/gdb/testsuite/gdb.dwarf2/mega-enum.exp
index 828987b..7817fbf 100644
--- a/gdb/testsuite/gdb.dwarf2/mega-enum.exp
+++ b/gdb/testsuite/gdb.dwarf2/mega-enum.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,21 +26,21 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
} {
declare_labels integer_label
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
DW_TAG_enumeration_type {
- {DW_AT_name mega_enum}
- {DW_AT_type :$integer_label}
+ DW_AT_name mega_enum
+ DW_AT_type :$integer_label
} {
# In the past gdb used a 'short' for the field count.
# But this fails if there are too many fields. If the
@@ -48,8 +48,8 @@ Dwarf::assemble $asm_file {
# so use a number that's just big enough.
for {set i 0} {$i < 65538} {incr i} {
DW_TAG_enumerator {
- {DW_AT_name DEI_$i}
- {DW_AT_const_value $i DW_FORM_sdata}
+ DW_AT_name DEI_$i
+ DW_AT_const_value $i DW_FORM_sdata
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.S b/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.S
index 2a1a295..2db922d 100644
--- a/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.S
+++ b/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp b/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp
index 21ad111..1bb36ea 100644
--- a/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp
+++ b/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/method-ptr.cc b/gdb/testsuite/gdb.dwarf2/method-ptr.cc
index eb032dd..fe2fba8 100644
--- a/gdb/testsuite/gdb.dwarf2/method-ptr.cc
+++ b/gdb/testsuite/gdb.dwarf2/method-ptr.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/method-ptr.exp b/gdb/testsuite/gdb.dwarf2/method-ptr.exp
index 9bb4776..828166f 100644
--- a/gdb/testsuite/gdb.dwarf2/method-ptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/method-ptr.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,48 +28,50 @@ Dwarf::assemble $asm_file {
declare_labels ptr_label subr_label memptr_label
cu {} {
- compile_unit {{language @DW_LANG_C_plus_plus}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C_plus_plus
+ } {
int_label: base_type {
- {name int}
- {encoding @DW_ATE_signed}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name int
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 DW_FORM_sdata
}
float_label: base_type {
- {name float}
- {encoding @DW_ATE_float}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name float
+ DW_AT_encoding @DW_ATE_float
+ DW_AT_byte_size 4 DW_FORM_sdata
}
struct_label: structure_type {
- {name S}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name S
+ DW_AT_byte_size 1 DW_FORM_sdata
}
ptr_label: pointer_type {
- {type :$struct_label}
+ DW_AT_type :$struct_label
}
subr_label: subroutine_type {
- {type :$int_label}
+ DW_AT_type :$int_label
} {
formal_parameter {
- {type :$ptr_label}
- {artificial 1 DW_FORM_flag_present}
+ DW_AT_type :$ptr_label
+ DW_AT_artificial 1 DW_FORM_flag_present
}
formal_parameter {
- {type :$float_label}
+ DW_AT_type :$float_label
}
}
memptr_label: ptr_to_member_type {
- {type :$subr_label}
- {containing_type :$struct_label}
+ DW_AT_type :$subr_label
+ DW_AT_containing_type :$struct_label
}
typedef {
- {name the_typedef}
- {type :$memptr_label}
+ DW_AT_name the_typedef
+ DW_AT_type :$memptr_label
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/missing-line-table.c b/gdb/testsuite/gdb.dwarf2/missing-line-table.c
index 1835057..f023288 100644
--- a/gdb/testsuite/gdb.dwarf2/missing-line-table.c
+++ b/gdb/testsuite/gdb.dwarf2/missing-line-table.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/missing-line-table.exp b/gdb/testsuite/gdb.dwarf2/missing-line-table.exp
index 77618de..977a016 100644
--- a/gdb/testsuite/gdb.dwarf2/missing-line-table.exp
+++ b/gdb/testsuite/gdb.dwarf2/missing-line-table.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,19 +38,19 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name missing-line-table.c}
- {stmt_list $Llines DW_FORM_sec_offset}
- {DW_AT_low_pc $::foo_start DW_FORM_addr}
- {DW_AT_high_pc $::main_end DW_FORM_addr}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name missing-line-table.c
+ DW_AT_stmt_list $Llines DW_FORM_sec_offset
+ DW_AT_low_pc $::foo_start DW_FORM_addr
+ DW_AT_high_pc $::main_end DW_FORM_addr
} {
subprogram {
- {external 1 flag}
- {MACRO_AT_func {main}}
+ DW_AT_external 1 flag
+ MACRO_AT_func {main}
}
subprogram {
- {external 1 flag}
- {MACRO_AT_func {foo}}
+ DW_AT_external 1 flag
+ MACRO_AT_func {foo}
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/missing-sig-type.exp b/gdb/testsuite/gdb.dwarf2/missing-sig-type.exp
index c1544eb..a3eaae9 100644
--- a/gdb/testsuite/gdb.dwarf2/missing-sig-type.exp
+++ b/gdb/testsuite/gdb.dwarf2/missing-sig-type.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,8 +30,8 @@ Dwarf::assemble $asm_file {
# This signature is intentionally wrong.
typedef_label: typedef {
- {name foo}
- {type 0xee22334455667788 ref_sig8 }
+ DW_AT_name foo
+ DW_AT_type 0xee22334455667788 ref_sig8
}
}
}
@@ -39,9 +39,9 @@ Dwarf::assemble $asm_file {
tu {} 0x1122334455667788 the_type {
type_unit {} {
the_type: base_type {
- {name int}
- {encoding @DW_ATE_signed}
- {byte_size 4 sdata}
+ DW_AT_name int
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 sdata
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/missing-type-name-for-templates.cc b/gdb/testsuite/gdb.dwarf2/missing-type-name-for-templates.cc
index a1a0a11..3901849 100644
--- a/gdb/testsuite/gdb.dwarf2/missing-type-name-for-templates.cc
+++ b/gdb/testsuite/gdb.dwarf2/missing-type-name-for-templates.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2022-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/missing-type-name-for-templates.exp b/gdb/testsuite/gdb.dwarf2/missing-type-name-for-templates.exp
index 869b29f..5d97ba4 100644
--- a/gdb/testsuite/gdb.dwarf2/missing-type-name-for-templates.exp
+++ b/gdb/testsuite/gdb.dwarf2/missing-type-name-for-templates.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,112 +40,112 @@ set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
+ DW_AT_language @DW_LANG_C_plus_plus
} {
declare_labels int float template_var1 template_var2 template_var3
int: DW_TAG_base_type {
- {DW_AT_name "int"}
- {DW_AT_byte_size 4 DW_FORM_data1}
- {DW_AT_encoding @DW_ATE_signed}
+ DW_AT_name "int"
+ DW_AT_byte_size 4 DW_FORM_data1
+ DW_AT_encoding @DW_ATE_signed
}
float: base_type {
- {DW_AT_name float}
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_float}
+ DW_AT_name float
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_float
}
DW_TAG_subprogram {
- {DW_AT_name "main"}
- {DW_AT_low_pc $::main_start DW_FORM_addr}
- {DW_AT_high_pc $::main_end DW_FORM_addr}
- {DW_AT_type :$int}
- {DW_AT_external 1 DW_FORM_flag}
+ DW_AT_name "main"
+ DW_AT_low_pc $::main_start DW_FORM_addr
+ DW_AT_high_pc $::main_end DW_FORM_addr
+ DW_AT_type :$int
+ DW_AT_external 1 DW_FORM_flag
} {
DW_TAG_variable {
- {DW_AT_name "var1"}
- {DW_AT_type :$template_var1}
+ DW_AT_name "var1"
+ DW_AT_type :$template_var1
}
DW_TAG_variable {
- {DW_AT_name "var2"}
- {DW_AT_type :$template_var2}
+ DW_AT_name "var2"
+ DW_AT_type :$template_var2
}
DW_TAG_variable {
- {DW_AT_name "var3"}
- {DW_AT_type :$template_var3}
+ DW_AT_name "var3"
+ DW_AT_type :$template_var3
}
}
# A variable whose type is a template instantiation with two
# template parameters, one unnamed.
template_var1: DW_TAG_structure_type {
- {DW_AT_name "template_var1<int, float>"}
+ DW_AT_name "template_var1<int, float>"
} {
DW_TAG_member {
- {DW_AT_name "me"}
- {DW_AT_type :$int}
+ DW_AT_name "me"
+ DW_AT_type :$int
}
DW_TAG_member {
- {DW_AT_name "me2"}
- {DW_AT_type :$float}
+ DW_AT_name "me2"
+ DW_AT_type :$float
}
DW_TAG_template_type_param {
- {DW_AT_type :$int}
+ DW_AT_type :$int
}
DW_TAG_template_type_param {
- {DW_AT_name "second"}
- {DW_AT_type :$float}
+ DW_AT_name "second"
+ DW_AT_type :$float
}
}
# A variable whose type is a template instantiation with two
# template parameters, both unnamed.
template_var2: DW_TAG_class_type {
- {DW_AT_name "template_var2<int, float>"}
+ DW_AT_name "template_var2<int, float>"
} {
DW_TAG_member {
- {DW_AT_name "me"}
- {DW_AT_type :$int}
+ DW_AT_name "me"
+ DW_AT_type :$int
}
DW_TAG_member {
- {DW_AT_name "me2"}
- {DW_AT_type :$float}
+ DW_AT_name "me2"
+ DW_AT_type :$float
}
DW_TAG_template_type_param {
- {DW_AT_type :$int}
+ DW_AT_type :$int
}
DW_TAG_template_type_param {
- {DW_AT_type :$float}
+ DW_AT_type :$float
}
}
# A variable whose type is a template instantiation with four
# template arguments, two types, two values, all unnamed.
template_var3: DW_TAG_structure_type {
- {DW_AT_name "template_var3<0, int, 11, float>"}
+ DW_AT_name "template_var3<0, int, 11, float>"
} {
DW_TAG_member {
- {DW_AT_name "me"}
- {DW_AT_type :$int}
+ DW_AT_name "me"
+ DW_AT_type :$int
}
DW_TAG_member {
- {DW_AT_name "me2"}
- {DW_AT_type :$float}
+ DW_AT_name "me2"
+ DW_AT_type :$float
}
DW_TAG_template_value_param {
- {DW_AT_type :$int}
- {DW_AT_const_value 0 DW_FORM_sdata}
+ DW_AT_type :$int
+ DW_AT_const_value 0 DW_FORM_sdata
}
DW_TAG_template_type_param {
- {DW_AT_type :$int}
+ DW_AT_type :$int
}
DW_TAG_template_value_param {
- {DW_AT_type :$int}
- {DW_AT_const_value 11 DW_FORM_sdata}
+ DW_AT_type :$int
+ DW_AT_const_value 11 DW_FORM_sdata
}
DW_TAG_template_type_param {
- {DW_AT_type :$float}
+ DW_AT_type :$float
}
}
}
@@ -157,7 +157,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/missing-type-name.exp b/gdb/testsuite/gdb.dwarf2/missing-type-name.exp
index 8789fbe..494ea7b 100644
--- a/gdb/testsuite/gdb.dwarf2/missing-type-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/missing-type-name.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,48 +44,52 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_producer "GNU C 8.1"}
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
- } {
+ DW_AT_producer "GNU C 8.1"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
+ } {
declare_labels main_type int_type ptr_type
main_type: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
}
int_type: DW_TAG_base_type {
- {DW_AT_byte_size 0 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
+ DW_AT_byte_size 0 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
}
ptr_type: DW_TAG_pointer_type {
- {DW_AT_type :$int_type}
+ DW_AT_type :$int_type
}
- DW_TAG_subprogram {
- {MACRO_AT_func func}
- {type :$int_type}
+ DW_TAG_subprogram {
+ MACRO_AT_func func
+ DW_AT_type :$int_type
}
- DW_TAG_subprogram {
- {MACRO_AT_func main}
- {type :$main_type}
+ DW_TAG_subprogram {
+ MACRO_AT_func main
+ DW_AT_type :$main_type
}
DW_TAG_variable {
- {DW_AT_name "var_a"}
- {DW_AT_type :$main_type}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "var_a"]} SPECIAL_expr}
+ DW_AT_name "var_a"
+ DW_AT_type :$main_type
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "var_a"]
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name "var_ptr"}
- {DW_AT_type :$ptr_type}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "var_ptr"]} SPECIAL_expr}
+ DW_AT_name "var_ptr"
+ DW_AT_type :$ptr_type
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "var_ptr"]
+ } SPECIAL_expr
}
}
}
@@ -96,7 +100,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/multidictionary.exp b/gdb/testsuite/gdb.dwarf2/multidictionary.exp
index 4c7dc0e..4fdf985 100644
--- a/gdb/testsuite/gdb.dwarf2/multidictionary.exp
+++ b/gdb/testsuite/gdb.dwarf2/multidictionary.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,40 +35,40 @@ Dwarf::assemble $asm_file {
cu {} {
D45d9: compile_unit {
- {language @DW_LANG_C_plus_plus}
- {name "SerialPortUtils.cpp"}
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name "SerialPortUtils.cpp"
} {
D5079: base_type {
- {byte_size 1 sdata}
- {encoding @DW_ATE_unsigned}
- {name "char"}
+ DW_AT_byte_size 1 sdata
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name "char"
}
D5080: const_type {
- {type :$D5079}
+ DW_AT_type :$D5079
}
D50a9: pointer_type {
- {byte_size 4 sdata}
- {type :$D5080}
+ DW_AT_byte_size 4 sdata
+ DW_AT_type :$D5080
}
D50af: const_type {
- {type :$D50a9}
+ DW_AT_type :$D50a9
}
D5ab2: subprogram {
- {external 1 flag}
- {linkage_name "_Z18SerialSyncWriteStrPKc"}
+ DW_AT_external 1 flag
+ DW_AT_linkage_name "_Z18SerialSyncWriteStrPKc"
} {
D5ac2: formal_parameter {
- {name "msg"}
- {type :$D50af}
+ DW_AT_name "msg"
+ DW_AT_type :$D50af
}
D5ace: lexical_block {} {
D5acf: DW_TAG_variable {
- {name "p"}
- {type :$D50a9}
+ DW_AT_name "p"
+ DW_AT_type :$D50a9
}
}
}
@@ -77,34 +77,34 @@ Dwarf::assemble $asm_file {
cu {} {
D2135f: compile_unit {
- {language @DW_LANG_C_plus_plus}
- {name "Main.cpp"}
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name "Main.cpp"
} {
D2216a: base_type {
- {byte_size 1 sdata}
- {encoding @DW_ATE_unsigned_char}
- {name "char"}
+ DW_AT_byte_size 1 sdata
+ DW_AT_encoding @DW_ATE_unsigned_char
+ DW_AT_name "char"
}
D22171: const_type {
- {type :$D2216a}
+ DW_AT_type :$D2216a
}
D226c4: pointer_type {
- {byte_size 4 sdata}
- {type :$D22171}
+ DW_AT_byte_size 4 sdata
+ DW_AT_type :$D22171
}
D226ca: const_type {
- {type :$D226c4}
+ DW_AT_type :$D226c4
}
D245da: subprogram {
- {name "PrintPanicMsg"}
+ DW_AT_name "PrintPanicMsg"
} {
D245e6: formal_parameter {
- {name "msg"}
- {type :$D226ca}
+ DW_AT_name "msg"
+ DW_AT_type :$D226ca
}
}
}
@@ -112,28 +112,28 @@ Dwarf::assemble $asm_file {
cu {} {
D41c21: compile_unit {
- {language @DW_LANG_C99}
- {name "<artificial>"}
+ DW_AT_language @DW_LANG_C99
+ DW_AT_name "<artificial>"
} {
- D42025: subprogram {
- {abstract_origin %$D245da}
- {low_pc 0x80b60 addr}
- {high_pc 0x6c data4}
- } {
+ D42025: subprogram {
+ DW_AT_abstract_origin %$D245da
+ DW_AT_low_pc 0x80b60 addr
+ DW_AT_high_pc 0x6c data4
+ } {
D42038: formal_parameter {
- {abstract_origin %$D245e6}
+ DW_AT_abstract_origin %$D245e6
}
D42045: inlined_subroutine {
- {abstract_origin %$D5ab2}
- {low_pc 0x8060 addr}
- {high_pc 0xc data4}
- } {
- D420b5: formal_parameter {
- {abstract_origin %$D5ac2}
- }
- }
- }
+ DW_AT_abstract_origin %$D5ab2
+ DW_AT_low_pc 0x8060 addr
+ DW_AT_high_pc 0xc data4
+ } {
+ D420b5: formal_parameter {
+ DW_AT_abstract_origin %$D5ac2
+ }
+ }
+ }
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/nameless-enum.exp b/gdb/testsuite/gdb.dwarf2/nameless-enum.exp
index 1610b7c..6d42fb7 100644
--- a/gdb/testsuite/gdb.dwarf2/nameless-enum.exp
+++ b/gdb/testsuite/gdb.dwarf2/nameless-enum.exp
@@ -27,25 +27,25 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_D}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_D
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
} {
declare_labels integer_label
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
DW_TAG_enumeration_type {
- {DW_AT_type :$integer_label}
- {DW_AT_enum_class 1 DW_FORM_flag}
+ DW_AT_type :$integer_label
+ DW_AT_enum_class 1 DW_FORM_flag
} {
DW_TAG_enumerator {
- {DW_AT_name VALUE}
- {DW_AT_const_value 17 DW_FORM_sdata}
+ DW_AT_name VALUE
+ DW_AT_const_value 17 DW_FORM_sdata
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/negative-data-member-location.c b/gdb/testsuite/gdb.dwarf2/negative-data-member-location.c
index 0a63995..f785630 100644
--- a/gdb/testsuite/gdb.dwarf2/negative-data-member-location.c
+++ b/gdb/testsuite/gdb.dwarf2/negative-data-member-location.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/negative-data-member-location.exp b/gdb/testsuite/gdb.dwarf2/negative-data-member-location.exp
index fdc681e..30c4f53 100644
--- a/gdb/testsuite/gdb.dwarf2/negative-data-member-location.exp
+++ b/gdb/testsuite/gdb.dwarf2/negative-data-member-location.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,33 +31,35 @@ set asm_file [standard_output_file ${srcfile2}]
Dwarf::assemble ${asm_file} {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C99}
- {DW_AT_producer "GNU C++17 11.1.0 -mtune=generic -march=x86-64 -g3 -O0"}
- {name ${::srcfile}}
+ DW_AT_language @DW_LANG_C99
+ DW_AT_producer "GNU C++17 11.1.0 -mtune=generic -march=x86-64 -g3 -O0"
+ DW_AT_name ${::srcfile}
} {
declare_labels int_label struct_label
int_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_udata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name "int"}
+ DW_AT_byte_size 4 DW_FORM_udata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name "int"
}
struct_label: DW_TAG_structure_type {
- {DW_AT_name "the_struct"}
- {DW_AT_byte_size 4 DW_FORM_udata}
+ DW_AT_name "the_struct"
+ DW_AT_byte_size 4 DW_FORM_udata
} {
DW_TAG_member {
- {DW_AT_name "field"}
- {DW_AT_type :$int_label}
- {DW_AT_data_member_location -1 DW_FORM_sdata}
+ DW_AT_name "field"
+ DW_AT_type :$int_label
+ DW_AT_data_member_location -1 DW_FORM_sdata
}
}
DW_TAG_variable {
- {DW_AT_name "s"}
- {DW_AT_type :$struct_label}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "s"]} SPECIAL_expr}
+ DW_AT_name "s"
+ DW_AT_type :$struct_label
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "s"]
+ } SPECIAL_expr
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp b/gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp
index 54cd199..05e625f 100644
--- a/gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp
+++ b/gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ if { [build_executable $testfile.exp $testfile [list $srcfile $asm_file]] } {
clean_restart
gdb_test_no_output "maint set dwarf synchronous on"
-set msg "\r\nwarning: could not find '\.gnu_debugaltlink' file for \[^\r\n\]*"
+set msg "\r\nwarning: could not find supplementary DWARF file \[^\r\n\]*"
gdb_test "file $binfile" "$msg" "file command"
set question "Load new symbol table from .*\? .y or n. "
diff --git a/gdb/testsuite/gdb.dwarf2/nonvar-access.exp b/gdb/testsuite/gdb.dwarf2/nonvar-access.exp
index 25078c6..604d7a0 100644
--- a/gdb/testsuite/gdb.dwarf2/nonvar-access.exp
+++ b/gdb/testsuite/gdb.dwarf2/nonvar-access.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,165 +31,165 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {DW_AT_name $srcfile}
+ DW_AT_name $srcfile
} {
declare_labels int_type_label char_type_label \
struct_s_label struct_t_label array_a9_label \
char_ptr_label implicit_a_label stack_b_label
int_type_label: base_type {
- {name "int"}
- {encoding @DW_ATE_signed}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name "int"
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 DW_FORM_sdata
}
char_type_label: base_type {
- {name "char"}
- {encoding @DW_ATE_unsigned}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name "char"
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_byte_size 1 DW_FORM_sdata
}
char_ptr_label: pointer_type {
- {type :$char_type_label}
+ DW_AT_type :$char_type_label
}
struct_s_label: structure_type {
- {name s}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name s
+ DW_AT_byte_size 4 DW_FORM_sdata
} {
member {
- {name a}
- {type :$int_type_label}
- {data_member_location 0 DW_FORM_udata}
- {bit_size 8 DW_FORM_udata}
+ DW_AT_name a
+ DW_AT_type :$int_type_label
+ DW_AT_data_member_location 0 DW_FORM_udata
+ DW_AT_bit_size 8 DW_FORM_udata
}
member {
- {name b}
- {type :$int_type_label}
- {data_bit_offset 8 DW_FORM_udata}
- {bit_size 24 DW_FORM_udata}
+ DW_AT_name b
+ DW_AT_type :$int_type_label
+ DW_AT_data_bit_offset 8 DW_FORM_udata
+ DW_AT_bit_size 24 DW_FORM_udata
}
}
struct_t_label: structure_type {
- {name t}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name t
+ DW_AT_byte_size 4 DW_FORM_sdata
} {
member {
- {name a}
- {type :$int_type_label}
- {data_member_location 0 DW_FORM_udata}
- {bit_size 9 DW_FORM_udata}
+ DW_AT_name a
+ DW_AT_type :$int_type_label
+ DW_AT_data_member_location 0 DW_FORM_udata
+ DW_AT_bit_size 9 DW_FORM_udata
}
member {
- {name b}
- {type :$int_type_label}
- {data_bit_offset 9 DW_FORM_udata}
- {bit_size 23 DW_FORM_udata}
+ DW_AT_name b
+ DW_AT_type :$int_type_label
+ DW_AT_data_bit_offset 9 DW_FORM_udata
+ DW_AT_bit_size 23 DW_FORM_udata
}
}
array_a9_label: array_type {
- {type :$char_type_label}
+ DW_AT_type :$char_type_label
} {
subrange_type {
- {type :$int_type_label}
- {upper_bound 8 DW_FORM_udata}
+ DW_AT_type :$int_type_label
+ DW_AT_upper_bound 8 DW_FORM_udata
}
}
DW_TAG_subprogram {
- {MACRO_AT_func {main}}
- {DW_AT_external 1 flag}
+ MACRO_AT_func {main}
+ DW_AT_external 1 flag
} {
# Simple variable without location.
DW_TAG_variable {
- {name undef_int}
- {type :$int_type_label}
+ DW_AT_name undef_int
+ DW_AT_type :$int_type_label
}
# Struct variable without location.
DW_TAG_variable {
- {name undef_s}
- {type :$struct_s_label}
+ DW_AT_name undef_s
+ DW_AT_type :$struct_s_label
}
# Composite location: byte-aligned pieces.
DW_TAG_variable {
- {name def_s}
- {type :$struct_s_label}
- {location {
- const1u 0
- stack_value
- bit_piece 8 0
- const1s -1
- stack_value
- bit_piece 24 0
- } SPECIAL_expr}
+ DW_AT_name def_s
+ DW_AT_type :$struct_s_label
+ DW_AT_location {
+ DW_OP_const1u 0
+ DW_OP_stack_value
+ DW_OP_bit_piece 8 0
+ DW_OP_const1s -1
+ DW_OP_stack_value
+ DW_OP_bit_piece 24 0
+ } SPECIAL_expr
}
# Composite location: non-byte-aligned pieces.
DW_TAG_variable {
- {name def_t}
- {type :$struct_t_label}
- {location {
- const2s -184
- stack_value
- bit_piece 9 0
- const4u 1752286
- stack_value
- bit_piece 23 0
- } SPECIAL_expr}
+ DW_AT_name def_t
+ DW_AT_type :$struct_t_label
+ DW_AT_location {
+ DW_OP_const2s -184
+ DW_OP_stack_value
+ DW_OP_bit_piece 9 0
+ DW_OP_const4u 1752286
+ DW_OP_stack_value
+ DW_OP_bit_piece 23 0
+ } SPECIAL_expr
}
# Composite location with some empty pieces.
DW_TAG_variable {
- {name part_def_a}
- {type :$array_a9_label}
- {location {
- piece 3
- const4u 0xf1927314
- stack_value
- piece 4
- piece 2
- } SPECIAL_expr}
+ DW_AT_name part_def_a
+ DW_AT_type :$array_a9_label
+ DW_AT_location {
+ DW_OP_piece 3
+ DW_OP_const4u 0xf1927314
+ DW_OP_stack_value
+ DW_OP_piece 4
+ DW_OP_piece 2
+ } SPECIAL_expr
}
# Implicit location: immediate value.
DW_TAG_variable {
- {name def_implicit_s}
- {type :$struct_s_label}
- {location {
- implicit_value 0x12 0x34 0x56 0x78
- } SPECIAL_expr}
+ DW_AT_name def_implicit_s
+ DW_AT_type :$struct_s_label
+ DW_AT_location {
+ DW_OP_implicit_value 0x12 0x34 0x56 0x78
+ } SPECIAL_expr
}
# Implicit location: immediate value for whole array, with
# excess bytes.
implicit_a_label: DW_TAG_variable {
- {name def_implicit_a}
- {type :$array_a9_label}
- {location {
- implicit_value 0x1 0x12 0x23 0x34 0x45 \
+ DW_AT_name def_implicit_a
+ DW_AT_type :$array_a9_label
+ DW_AT_location {
+ DW_OP_implicit_value 0x1 0x12 0x23 0x34 0x45 \
0x56 0x67 0x78 0x89 0x9a 0xab
- } SPECIAL_expr}
+ } SPECIAL_expr
}
# Implicit pointer into immediate value.
DW_TAG_variable {
- {name implicit_a_ptr}
- {type :$char_ptr_label}
- {location {
- implicit_pointer $implicit_a_label 5
- } SPECIAL_expr}
+ DW_AT_name implicit_a_ptr
+ DW_AT_type :$char_ptr_label
+ DW_AT_location {
+ DW_OP_implicit_pointer $implicit_a_label 5
+ } SPECIAL_expr
}
# Stack-value location.
stack_b_label: DW_TAG_variable {
- {name def_stack_b}
- {type :$struct_t_label}
- {location {
- const4u 0x1a2b3c4d
- stack_value
- } SPECIAL_expr}
+ DW_AT_name def_stack_b
+ DW_AT_type :$struct_t_label
+ DW_AT_location {
+ DW_OP_const4u 0x1a2b3c4d
+ DW_OP_stack_value
+ } SPECIAL_expr
}
# Implicit pointer into stack value.
DW_TAG_variable {
- {name implicit_b_ptr}
- {type :$char_ptr_label}
- {location {
- implicit_pointer $stack_b_label 1
- } SPECIAL_expr}
+ DW_AT_name implicit_b_ptr
+ DW_AT_type :$char_ptr_label
+ DW_AT_location {
+ DW_OP_implicit_pointer $stack_b_label 1
+ } SPECIAL_expr
}
}
}
@@ -201,7 +201,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/nostaticblock.exp b/gdb/testsuite/gdb.dwarf2/nostaticblock.exp
index e8d41f04..0d5943c 100644
--- a/gdb/testsuite/gdb.dwarf2/nostaticblock.exp
+++ b/gdb/testsuite/gdb.dwarf2/nostaticblock.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,8 +26,8 @@ set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {low_pc 0x104320 DW_FORM_addr}
- {high_pc 0x1045ed DW_FORM_addr}
+ DW_AT_low_pc 0x104320 DW_FORM_addr
+ DW_AT_high_pc 0x1045ed DW_FORM_addr
} {
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/nullptr_t.cc b/gdb/testsuite/gdb.dwarf2/nullptr_t.cc
index 6cd08eb..4220b0c 100644
--- a/gdb/testsuite/gdb.dwarf2/nullptr_t.cc
+++ b/gdb/testsuite/gdb.dwarf2/nullptr_t.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/nullptr_t.exp b/gdb/testsuite/gdb.dwarf2/nullptr_t.exp
index d6c2422..4af3655 100644
--- a/gdb/testsuite/gdb.dwarf2/nullptr_t.exp
+++ b/gdb/testsuite/gdb.dwarf2/nullptr_t.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ lappend opts debug
lappend opts c++
lappend opts additional_flags=-std=c++11
-if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile $opts]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/opaque-type-lookup-2.c b/gdb/testsuite/gdb.dwarf2/opaque-type-lookup-2.c
index 3d993d2..81991b9 100644
--- a/gdb/testsuite/gdb.dwarf2/opaque-type-lookup-2.c
+++ b/gdb/testsuite/gdb.dwarf2/opaque-type-lookup-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/opaque-type-lookup.exp b/gdb/testsuite/gdb.dwarf2/opaque-type-lookup.exp
index 0d0cc14..2564dae 100644
--- a/gdb/testsuite/gdb.dwarf2/opaque-type-lookup.exp
+++ b/gdb/testsuite/gdb.dwarf2/opaque-type-lookup.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,37 +44,37 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name opaque_before}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name opaque_before
} {
imported_unit {
- {import $partial_unit_with_opaque ref_addr}
+ DW_AT_import $partial_unit_with_opaque ref_addr
}
imported_unit {
- {import $partial_unit_defining_a ref_addr}
+ DW_AT_import $partial_unit_defining_a ref_addr
}
}
}
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name opaque_after}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name opaque_after
} {
imported_unit {
- {import $partial_unit_defining_b ref_addr}
+ DW_AT_import $partial_unit_defining_b ref_addr
}
imported_unit {
- {import $partial_unit_with_opaque ref_addr}
+ DW_AT_import $partial_unit_with_opaque ref_addr
}
}
}
cu {} {
partial_unit_with_opaque: partial_unit {
- {name "partial_unit_with_opaque"}
+ DW_AT_name "partial_unit_with_opaque"
} {
# Normally gdb doesn't add opaque types to the symbol table
# but there are times when it will, and in order to exercise
@@ -82,89 +82,89 @@ Dwarf::assemble $asm_file {
# By giving it a size of 1 we achieve this.
opaque_struct_a_label: structure_type {
- {name struct_a}
- {declaration 1 flag}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name struct_a
+ DW_AT_declaration 1 flag
+ DW_AT_byte_size 1 DW_FORM_sdata
}
opaque_struct_b_label: structure_type {
- {name struct_b}
- {declaration 1 flag}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name struct_b
+ DW_AT_declaration 1 flag
+ DW_AT_byte_size 1 DW_FORM_sdata
}
DW_TAG_variable {
- {name variable_a}
- {type :$opaque_struct_a_label}
- {external 1 flag}
- {declaration 1 flag}
+ DW_AT_name variable_a
+ DW_AT_type :$opaque_struct_a_label
+ DW_AT_external 1 flag
+ DW_AT_declaration 1 flag
}
DW_TAG_variable {
- {name variable_b}
- {type :$opaque_struct_b_label}
- {external 1 flag}
- {declaration 1 flag}
+ DW_AT_name variable_b
+ DW_AT_type :$opaque_struct_b_label
+ DW_AT_external 1 flag
+ DW_AT_declaration 1 flag
}
}
}
cu {} {
partial_unit_defining_a: partial_unit {
- {name "partial_unit_defining_a"}
+ DW_AT_name "partial_unit_defining_a"
} {
char_type1_label: base_type {
- {name "signed char"}
- {encoding @DW_ATE_signed}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name "signed char"
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 1 DW_FORM_sdata
}
struct_a_label: structure_type {
- {name struct_a}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name struct_a
+ DW_AT_byte_size 1 DW_FORM_sdata
} {
member {
- {name xyz}
- {type :$char_type1_label}
- {data_member_location 0 DW_FORM_sdata}
+ DW_AT_name xyz
+ DW_AT_type :$char_type1_label
+ DW_AT_data_member_location 0 DW_FORM_sdata
}
}
DW_TAG_variable {
- {name variable_a}
- {type :$struct_a_label}
- {external 1 flag}
- {linkage_name variable_a}
+ DW_AT_name variable_a
+ DW_AT_type :$struct_a_label
+ DW_AT_external 1 flag
+ DW_AT_linkage_name variable_a
}
}
}
cu {} {
partial_unit_defining_b: partial_unit {
- {name "partial_unit_defining_b"}
+ DW_AT_name "partial_unit_defining_b"
} {
char_type2_label: base_type {
- {name "signed char"}
- {encoding @DW_ATE_signed}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name "signed char"
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 1 DW_FORM_sdata
}
struct_b_label: structure_type {
- {name struct_b}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name struct_b
+ DW_AT_byte_size 1 DW_FORM_sdata
} {
member {
- {name xyz}
- {type :$char_type2_label}
- {data_member_location 0 DW_FORM_sdata}
+ DW_AT_name xyz
+ DW_AT_type :$char_type2_label
+ DW_AT_data_member_location 0 DW_FORM_sdata
}
}
DW_TAG_variable {
- {name variable_b}
- {type :$struct_b_label}
- {external 1 flag}
- {linkage_name variable_b}
+ DW_AT_name variable_b
+ DW_AT_type :$struct_b_label
+ DW_AT_external 1 flag
+ DW_AT_linkage_name variable_b
}
}
}
@@ -173,21 +173,21 @@ Dwarf::assemble $asm_file {
# so keep this separate.
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name main}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name main
} {
subprogram {
- {MACRO_AT_func { main }}
+ MACRO_AT_func { main }
}
}
}
}
-if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile} ${srcfile3}" {nodebug}] {
+if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile} ${srcfile3}" {nodebug}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/opt-out-not-implptr.exp b/gdb/testsuite/gdb.dwarf2/opt-out-not-implptr.exp
index 30bd91c..e4bc3dd 100644
--- a/gdb/testsuite/gdb.dwarf2/opt-out-not-implptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/opt-out-not-implptr.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,57 +30,57 @@ Dwarf::assemble $asm_file {
declare_labels i64_type i32_type i64_array i32_array
i64_type: base_type {
- {name "int64_t"}
- {encoding @DW_ATE_signed}
- {byte_size 8 DW_FORM_sdata}
+ DW_AT_name "int64_t"
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 8 DW_FORM_sdata
}
i32_type: base_type {
- {name "int32_t"}
- {encoding @DW_ATE_signed}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name "int32_t"
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 DW_FORM_sdata
}
i64_array: DW_TAG_array_type {
- {DW_AT_name array_type}
- {DW_AT_type :$i64_type}
+ DW_AT_name array_type
+ DW_AT_type :$i64_type
} {
DW_TAG_subrange_type {
- {DW_AT_type :$i64_type}
- {DW_AT_lower_bound 0 DW_FORM_data1}
- {DW_AT_upper_bound 3 DW_FORM_data1}
+ DW_AT_type :$i64_type
+ DW_AT_lower_bound 0 DW_FORM_data1
+ DW_AT_upper_bound 3 DW_FORM_data1
}
}
i32_array: DW_TAG_array_type {
- {DW_AT_name array_type}
- {DW_AT_type :$i32_type}
+ DW_AT_name array_type
+ DW_AT_type :$i32_type
} {
DW_TAG_subrange_type {
- {DW_AT_type :$i32_type}
- {DW_AT_lower_bound 0 DW_FORM_data1}
- {DW_AT_upper_bound 3 DW_FORM_data1}
+ DW_AT_type :$i32_type
+ DW_AT_lower_bound 0 DW_FORM_data1
+ DW_AT_upper_bound 3 DW_FORM_data1
}
}
DW_TAG_variable {
- {name i64_noptr}
- {type :$i64_array}
- {location {
+ DW_AT_name i64_noptr
+ DW_AT_type :$i64_array
+ DW_AT_location {
DW_OP_constu $::c64
DW_OP_stack_value
DW_OP_piece 8
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_variable {
- {name i32_noptr}
- {type :$i32_array}
- {location {
+ DW_AT_name i32_noptr
+ DW_AT_type :$i32_array
+ DW_AT_location {
DW_OP_constu $::c32
DW_OP_stack_value
DW_OP_piece 4
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.c b/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.c
index 6d3e8c8..059dda1 100644
--- a/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.c
+++ b/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp b/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp
index 7df68a9..0ae3612 100644
--- a/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp
+++ b/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,8 +25,8 @@ if { [build_executable "failed to prepare" $testfile $srcfile \
set host_binfile [gdb_remote_download host $binfile]
set has_index_section [exec_has_index_section $binfile]
-set uses_readnow [expr [string first "-readnow" $GDBFLAGS] != -1]
-set expecting_index_cache_use [expr !$has_index_section && !$uses_readnow]
+set uses_readnow [expr {[string first "-readnow" $GDBFLAGS] != -1}]
+set expecting_index_cache_use [expr {!$has_index_section && !$uses_readnow}]
lassign [remote_exec host mktemp -d] ret cache_dir
diff --git a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.S b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.S
index 7829dac..1c635ad 100644
--- a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.S
+++ b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.S
@@ -1,5 +1,5 @@
/*
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.c b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.c
index 0e7feaccc..a22efc7 100644
--- a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.c
+++ b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp
index db9f7b2..259e7e9 100644
--- a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp
+++ b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile $opts]} {
return -1
}
-if ![runto foo] {
+if {![runto foo]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/pieces.S b/gdb/testsuite/gdb.dwarf2/pieces.S
index 4f953f4..6f14e4d 100644
--- a/gdb/testsuite/gdb.dwarf2/pieces.S
+++ b/gdb/testsuite/gdb.dwarf2/pieces.S
@@ -1,5 +1,5 @@
/*
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/pieces.c b/gdb/testsuite/gdb.dwarf2/pieces.c
index b456693..8a7fb17 100644
--- a/gdb/testsuite/gdb.dwarf2/pieces.c
+++ b/gdb/testsuite/gdb.dwarf2/pieces.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2010-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/pieces.exp b/gdb/testsuite/gdb.dwarf2/pieces.exp
index d52ee5f..a08cd82 100644
--- a/gdb/testsuite/gdb.dwarf2/pieces.exp
+++ b/gdb/testsuite/gdb.dwarf2/pieces.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/pr10770.exp b/gdb/testsuite/gdb.dwarf2/pr10770.exp
index 07559b3..a822b7f 100644
--- a/gdb/testsuite/gdb.dwarf2/pr10770.exp
+++ b/gdb/testsuite/gdb.dwarf2/pr10770.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/pr11465.S b/gdb/testsuite/gdb.dwarf2/pr11465.S
index 1b7d48b..f3f2c57 100644
--- a/gdb/testsuite/gdb.dwarf2/pr11465.S
+++ b/gdb/testsuite/gdb.dwarf2/pr11465.S
@@ -1,4 +1,4 @@
-/* Copyright 2010-2024 Free Software Foundation, Inc.
+/* Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -344,7 +344,11 @@ die149: .uleb128 0x16 /* DW_TAG_variable */
.byte 0x0
.byte 0x0
.byte 0x0
- .section .debug_str
+#ifdef __arm__
+ .section .debug_str,"MS",%progbits,1
+#else
+ .section .debug_str,"MS",@progbits,1
+#endif
.LASF0:
.string "_ZN1N1fE"
.LASF7:
diff --git a/gdb/testsuite/gdb.dwarf2/pr11465.exp b/gdb/testsuite/gdb.dwarf2/pr11465.exp
index 5573c71..c5b5714 100644
--- a/gdb/testsuite/gdb.dwarf2/pr11465.exp
+++ b/gdb/testsuite/gdb.dwarf2/pr11465.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ require dwarf2_support
standard_testfile .S
-if [is_ilp32_target] {
+if {[is_ilp32_target]} {
set ptrbits 32
} else {
set ptrbits 64
diff --git a/gdb/testsuite/gdb.dwarf2/pr13961.S b/gdb/testsuite/gdb.dwarf2/pr13961.S
index 2423ee9..46088ba 100644
--- a/gdb/testsuite/gdb.dwarf2/pr13961.S
+++ b/gdb/testsuite/gdb.dwarf2/pr13961.S
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/pr13961.exp b/gdb/testsuite/gdb.dwarf2/pr13961.exp
index e4ea9d0..991ec65 100644
--- a/gdb/testsuite/gdb.dwarf2/pr13961.exp
+++ b/gdb/testsuite/gdb.dwarf2/pr13961.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/rnglists-multiple-cus.exp b/gdb/testsuite/gdb.dwarf2/rnglists-multiple-cus.exp
index 21161eb..d6cb4c1 100644
--- a/gdb/testsuite/gdb.dwarf2/rnglists-multiple-cus.exp
+++ b/gdb/testsuite/gdb.dwarf2/rnglists-multiple-cus.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -49,14 +49,14 @@ foreach_with_prefix is_64 {false true} {
is_64 $is_64
} {
DW_TAG_compile_unit {
- {DW_AT_ranges 1 DW_FORM_rnglistx}
- {DW_AT_rnglists_base cu_table DW_FORM_sec_offset}
+ DW_AT_ranges 1 DW_FORM_rnglistx
+ DW_AT_rnglists_base cu_table DW_FORM_sec_offset
} {
# This tests a DW_AT_ranges attribute of form DW_FORM_rnglistx on a
# function, which was buggy at some point.
DW_TAG_subprogram {
- {DW_AT_name "foo"}
- {DW_AT_ranges 2 DW_FORM_rnglistx}
+ DW_AT_name "foo"
+ DW_AT_ranges 2 DW_FORM_rnglistx
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/rnglists-sec-offset.exp b/gdb/testsuite/gdb.dwarf2/rnglists-sec-offset.exp
index 41c0397..5b12ae4 100644
--- a/gdb/testsuite/gdb.dwarf2/rnglists-sec-offset.exp
+++ b/gdb/testsuite/gdb.dwarf2/rnglists-sec-offset.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,11 +43,11 @@ foreach_with_prefix is_64 {false true} {
is_64 $is_64
} {
DW_TAG_compile_unit {
- {DW_AT_ranges $cu1_range_list DW_FORM_sec_offset}
+ DW_AT_ranges $cu1_range_list DW_FORM_sec_offset
} {
DW_TAG_subprogram {
- {DW_AT_name "foo"}
- {DW_AT_ranges $foo_range_list DW_FORM_sec_offset}
+ DW_AT_name "foo"
+ DW_AT_ranges $foo_range_list DW_FORM_sec_offset
}
}
}
@@ -61,12 +61,12 @@ foreach_with_prefix is_64 {false true} {
is_64 $is_64
} {
DW_TAG_compile_unit {
- {DW_AT_ranges $cu2_range_list DW_FORM_sec_offset}
- {DW_AT_rnglists_base cu2_table DW_FORM_sec_offset}
+ DW_AT_ranges $cu2_range_list DW_FORM_sec_offset
+ DW_AT_rnglists_base cu2_table DW_FORM_sec_offset
} {
DW_TAG_subprogram {
- {DW_AT_name "bar"}
- {DW_AT_ranges $bar_range_list DW_FORM_sec_offset}
+ DW_AT_name "bar"
+ DW_AT_ranges $bar_range_list DW_FORM_sec_offset
}
}
}
@@ -79,11 +79,11 @@ foreach_with_prefix is_64 {false true} {
is_64 $is_64
} {
DW_TAG_compile_unit {
- {DW_AT_ranges $cu3_range_list DW_FORM_sec_offset}
+ DW_AT_ranges $cu3_range_list DW_FORM_sec_offset
} {
DW_TAG_subprogram {
- {DW_AT_name "baz"}
- {DW_AT_ranges $baz_range_list DW_FORM_sec_offset}
+ DW_AT_name "baz"
+ DW_AT_ranges $baz_range_list DW_FORM_sec_offset
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/rust-enum.exp b/gdb/testsuite/gdb.dwarf2/rust-enum.exp
index 3bd892c..87e710e 100644
--- a/gdb/testsuite/gdb.dwarf2/rust-enum.exp
+++ b/gdb/testsuite/gdb.dwarf2/rust-enum.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,64 +30,64 @@ Dwarf::assemble $asm_file {
cu { addr_size 4 } {
compile_unit {
- {name file1.txt}
- {language @DW_LANG_Rust}
+ DW_AT_name file1.txt
+ DW_AT_language @DW_LANG_Rust
} {
uinteger_label: DW_TAG_base_type {
- {DW_AT_byte_size 1 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_unsigned}
- {DW_AT_name {unsigned integer}}
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name {unsigned integer}
}
one_label: structure_type {
- {name One}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name One
+ DW_AT_byte_size 1 DW_FORM_sdata
} {
member {
- {name __0}
- {type :$uinteger_label}
- {data_member_location 0 data1}
+ DW_AT_name __0
+ DW_AT_type :$uinteger_label
+ DW_AT_data_member_location 0 data1
}
}
two_label: structure_type {
- {name Two}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name Two
+ DW_AT_byte_size 1 DW_FORM_sdata
} {
member {
- {name __0}
- {type :$uinteger_label}
- {data_member_location 0 data1}
+ DW_AT_name __0
+ DW_AT_type :$uinteger_label
+ DW_AT_data_member_location 0 data1
}
}
simple_label: structure_type {
- {name Simple}
- {byte_size 2 DW_FORM_sdata}
+ DW_AT_name Simple
+ DW_AT_byte_size 2 DW_FORM_sdata
} {
variant_part {
- {discr :$discr_1_label DW_FORM_ref4}
+ DW_AT_discr :$discr_1_label DW_FORM_ref4
} {
discr_1_label: member {
- {type :$uinteger_label}
- {data_member_location 0 data1}
- {artificial 1 DW_FORM_flag_present}
+ DW_AT_type :$uinteger_label
+ DW_AT_data_member_location 0 data1
+ DW_AT_artificial 1 DW_FORM_flag_present
}
variant {
- {discr_value 65 udata}
+ DW_AT_discr_value 65 udata
} {
member {
- {type :$one_label}
- {data_member_location 1 data1}
+ DW_AT_type :$one_label
+ DW_AT_data_member_location 1 data1
}
}
variant {
} {
member {
- {type :$two_label}
- {data_member_location 1 data1}
+ DW_AT_type :$two_label
+ DW_AT_data_member_location 1 data1
}
}
}
@@ -96,14 +96,14 @@ Dwarf::assemble $asm_file {
# In PR rust/31005, a constant Rust enum value could not
# be correctly resolved.
DW_TAG_variable {
- {name constant_variable}
- {const_value 0x4141 udata}
- {type :$simple_label}
+ DW_AT_name constant_variable
+ DW_AT_const_value 0x4141 udata
+ DW_AT_type :$simple_label
}
DW_TAG_variable {
- {name constant_variable2}
- {const_value "AA" DW_FORM_block1}
- {type :$simple_label}
+ DW_AT_name constant_variable2
+ DW_AT_const_value "AA" DW_FORM_block1
+ DW_AT_type :$simple_label
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/self-spec.exp b/gdb/testsuite/gdb.dwarf2/self-spec.exp
index 6ed3cf3..c5818b8 100644
--- a/gdb/testsuite/gdb.dwarf2/self-spec.exp
+++ b/gdb/testsuite/gdb.dwarf2/self-spec.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,12 +26,14 @@ standard_testfile main.c .S
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
- compile_unit {{language @DW_LANG_C_plus_plus}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C_plus_plus
+ } {
# Check handling of self-referencing DIE.
declare_labels c1
c1: class_type {
- {name class1}
- {specification :$c1}
+ DW_AT_name class1
+ DW_AT_specification :$c1
}
# Check handling of self-referencing child DIE. Regression test
@@ -39,18 +41,18 @@ Dwarf::assemble $asm_file {
declare_labels f1 abstract_f1 f1_l
abstract_f1: subprogram {}
f1: subprogram {
- {MACRO_AT_func {main}}
- {abstract_origin :$abstract_f1}
+ MACRO_AT_func {main}
+ DW_AT_abstract_origin :$abstract_f1
} {
f1_l: label {
- {abstract_origin :$f1_l}
+ DW_AT_abstract_origin :$f1_l
}
}
}
}
}
-if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}] {
+if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/short-build-id.exp b/gdb/testsuite/gdb.dwarf2/short-build-id.exp
index f40d5e4..439b2b2 100644
--- a/gdb/testsuite/gdb.dwarf2/short-build-id.exp
+++ b/gdb/testsuite/gdb.dwarf2/short-build-id.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -50,17 +50,19 @@ proc run_test { buildid } {
build_id $buildid
cu { label cu_start } {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
int_label2: base_type {
- {name int}
- {byte_size 4 sdata}
- {encoding @DW_ATE_signed}
+ DW_AT_name int
+ DW_AT_byte_size 4 sdata
+ DW_AT_encoding @DW_ATE_signed
}
constant {
- {name the_int}
- {type :$int_label2}
- {const_value 99 data1}
+ DW_AT_name the_int
+ DW_AT_type :$int_label2
+ DW_AT_const_value 99 data1
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/shortpiece.exp b/gdb/testsuite/gdb.dwarf2/shortpiece.exp
index 4fcdfca..64d5b55 100644
--- a/gdb/testsuite/gdb.dwarf2/shortpiece.exp
+++ b/gdb/testsuite/gdb.dwarf2/shortpiece.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,90 +30,90 @@ Dwarf::assemble $asm_file {
declare_labels int_label ushort_label struct_label struct_label_2
int_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_udata}
- {DW_AT_encoding @DW_ATE_unsigned}
- {DW_AT_name "myint"}
+ DW_AT_byte_size 4 DW_FORM_udata
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name "myint"
}
ushort_label: DW_TAG_base_type {
- {DW_AT_byte_size 2 DW_FORM_udata}
- {DW_AT_encoding @DW_ATE_unsigned}
- {DW_AT_name "myushort"}
+ DW_AT_byte_size 2 DW_FORM_udata
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name "myushort"
}
struct_label: DW_TAG_structure_type {
- {DW_AT_name "S"}
- {DW_AT_byte_size 8 DW_FORM_udata}
+ DW_AT_name "S"
+ DW_AT_byte_size 8 DW_FORM_udata
} {
DW_TAG_member {
- {DW_AT_name "a"}
- {DW_AT_type :${int_label}}
- {DW_AT_data_member_location 0 DW_FORM_udata}
+ DW_AT_name "a"
+ DW_AT_type :${int_label}
+ DW_AT_data_member_location 0 DW_FORM_udata
}
DW_TAG_member {
- {DW_AT_name "b"}
- {DW_AT_type :${ushort_label}}
- {DW_AT_data_member_location 4 DW_FORM_udata}
+ DW_AT_name "b"
+ DW_AT_type :${ushort_label}
+ DW_AT_data_member_location 4 DW_FORM_udata
}
}
struct_label_2: DW_TAG_structure_type {
- {DW_AT_name "S_2"}
- {DW_AT_byte_size 6 DW_FORM_udata}
+ DW_AT_name "S_2"
+ DW_AT_byte_size 6 DW_FORM_udata
} {
DW_TAG_member {
- {DW_AT_name "a"}
- {DW_AT_type :${int_label}}
- {DW_AT_data_member_location 0 DW_FORM_udata}
+ DW_AT_name "a"
+ DW_AT_type :${int_label}
+ DW_AT_data_member_location 0 DW_FORM_udata
}
DW_TAG_member {
- {DW_AT_name "b"}
- {DW_AT_type :${ushort_label}}
- {DW_AT_data_member_location 4 DW_FORM_udata}
+ DW_AT_name "b"
+ DW_AT_type :${ushort_label}
+ DW_AT_data_member_location 4 DW_FORM_udata
}
}
DW_TAG_variable {
- {DW_AT_name "s1"}
- {DW_AT_type :${struct_label}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {
+ DW_AT_name "s1"
+ DW_AT_type :${struct_label}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
DW_OP_constu 1
DW_OP_stack_value
DW_OP_piece 4
DW_OP_constu 0
DW_OP_stack_value
DW_OP_piece 2
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name "s2"}
- {DW_AT_type :${struct_label}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {
+ DW_AT_name "s2"
+ DW_AT_type :${struct_label}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
DW_OP_constu 1
DW_OP_stack_value
DW_OP_piece 4
DW_OP_constu 0
DW_OP_stack_value
DW_OP_piece 8
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name "s3"}
- {DW_AT_type :${struct_label_2}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {
+ DW_AT_name "s3"
+ DW_AT_type :${struct_label_2}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
DW_OP_constu 0
DW_OP_stack_value
DW_OP_piece 4
DW_OP_constu 1
DW_OP_stack_value
DW_OP_piece 2
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/static-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/static-optimized-out.exp
index 00fbfa2..8b139fa 100644
--- a/gdb/testsuite/gdb.dwarf2/static-optimized-out.exp
+++ b/gdb/testsuite/gdb.dwarf2/static-optimized-out.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,21 +28,19 @@ set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {
- language @DW_LANG_C
- }
+ DW_AT_language @DW_LANG_C
} {
declare_labels integer_label
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
DW_TAG_variable {
- {name var}
- {type :$integer_label}
+ DW_AT_name var
+ DW_AT_type :$integer_label
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/staticvirtual.exp b/gdb/testsuite/gdb.dwarf2/staticvirtual.exp
index 6757bb3..792b851 100644
--- a/gdb/testsuite/gdb.dwarf2/staticvirtual.exp
+++ b/gdb/testsuite/gdb.dwarf2/staticvirtual.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,18 +25,22 @@ standard_testfile main.c -dw.S
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
- compile_unit {{language @DW_LANG_C_plus_plus}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C_plus_plus
+ } {
structure_type {
- {name S}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name S
+ DW_AT_byte_size 1 DW_FORM_sdata
} {
subprogram {
- {low_pc 0x1000 addr}
- {high_pc 0x2000 addr}
- {name ~S}
- {external 1 flag}
- {virtuality @DW_VIRTUALITY_virtual}
- {vtable_elem_location {const1u 1} SPECIAL_expr}
+ DW_AT_low_pc 0x1000 addr
+ DW_AT_high_pc 0x2000 addr
+ DW_AT_name ~S
+ DW_AT_external 1 flag
+ DW_AT_virtuality @DW_VIRTUALITY_virtual
+ DW_AT_vtable_elem_location {
+ DW_OP_const1u 1
+ } SPECIAL_expr
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/struct-decl.exp b/gdb/testsuite/gdb.dwarf2/struct-decl.exp
index 912a3c8..bc857a7 100644
--- a/gdb/testsuite/gdb.dwarf2/struct-decl.exp
+++ b/gdb/testsuite/gdb.dwarf2/struct-decl.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,9 +30,9 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_C_plus_plus
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
} {
declare_labels origin
@@ -42,14 +42,14 @@ Dwarf::assemble $asm_file {
# which meant that if a method referred back to them via a
# specification, it would get the wrong name.
DW_TAG_structure_type {
- {DW_AT_byte_size 8 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name the_type}
- {DW_AT_declaration 1 DW_FORM_flag_present}
+ DW_AT_byte_size 8 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name the_type
+ DW_AT_declaration 1 DW_FORM_flag_present
} {
origin: DW_TAG_subprogram {
- {DW_AT_name "method"}
- {DW_AT_declaration 1 DW_FORM_flag_present}
+ DW_AT_name "method"
+ DW_AT_declaration 1 DW_FORM_flag_present
}
}
@@ -57,8 +57,8 @@ Dwarf::assemble $asm_file {
# range that is valid in the program, so we use the main
# function's range.
DW_TAG_subprogram {
- {DW_AT_specification :$origin}
- {MACRO_AT_range main}
+ DW_AT_specification :$origin
+ MACRO_AT_range main
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp b/gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp
index 00af725..a527263 100644
--- a/gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp
+++ b/gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,18 +34,18 @@ Dwarf::assemble $asm_file {
declare_labels int_type
the_type_i: structure_type {
- {name s}
- {byte_size 4 sdata}
+ DW_AT_name s
+ DW_AT_byte_size 4 sdata
} {
member {
- {name i}
- {type :$int_type}
+ DW_AT_name i
+ DW_AT_type :$int_type
}
}
int_type: base_type {
- {name int}
- {encoding @DW_ATE_signed}
- {byte_size 4 sdata}
+ DW_AT_name int
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 sdata
}
}
}
@@ -55,18 +55,18 @@ Dwarf::assemble $asm_file {
declare_labels int_type
the_type_j: structure_type {
- {name s}
- {byte_size 4 sdata}
+ DW_AT_name s
+ DW_AT_byte_size 4 sdata
} {
member {
- {name j}
- {type :$int_type}
+ DW_AT_name j
+ DW_AT_type :$int_type
}
}
int_type: base_type {
- {name int}
- {encoding @DW_ATE_signed}
- {byte_size 4 sdata}
+ DW_AT_name int
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 sdata
}
}
}
@@ -88,32 +88,32 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name main.c}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name main.c
} {
structure_type {
- {name s}
- {signature 0x0000000000000001 ref_sig8}
- {declaration 1 flag}
+ DW_AT_name s
+ DW_AT_signature 0x0000000000000001 ref_sig8
+ DW_AT_declaration 1 flag
}
DW_TAG_subprogram {
- {MACRO_AT_func {main}}
+ MACRO_AT_func {main}
}
}
}
cu {} {
compile_unit {
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name foo.c}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name foo.c
} {
structure_type {
- {name s}
- {signature 0x0000000000000002 ref_sig8}
- {declaration 1 flag}
+ DW_AT_name s
+ DW_AT_signature 0x0000000000000002 ref_sig8
+ DW_AT_declaration 1 flag
}
DW_TAG_subprogram {
- {MACRO_AT_func {foo}}
+ MACRO_AT_func {foo}
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/struct-with-sig.exp b/gdb/testsuite/gdb.dwarf2/struct-with-sig.exp
index 57a2c2f..f2165ff 100644
--- a/gdb/testsuite/gdb.dwarf2/struct-with-sig.exp
+++ b/gdb/testsuite/gdb.dwarf2/struct-with-sig.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,32 +24,32 @@ set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name main.c}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name main.c
} {
structure_type {
- {name s}
- {signature 0x0000000000000001 ref_sig8}
- {declaration 1 flag}
+ DW_AT_name s
+ DW_AT_signature 0x0000000000000001 ref_sig8
+ DW_AT_declaration 1 flag
}
DW_TAG_subprogram {
- {MACRO_AT_func {main}}
+ MACRO_AT_func {main}
}
}
}
cu {} {
compile_unit {
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name foo.c}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name foo.c
} {
structure_type {
- {name s}
- {signature 0x0000000000000002 ref_sig8}
- {declaration 1 flag}
+ DW_AT_name s
+ DW_AT_signature 0x0000000000000002 ref_sig8
+ DW_AT_declaration 1 flag
}
DW_TAG_subprogram {
- {MACRO_AT_func {foo}}
+ MACRO_AT_func {foo}
}
}
}
@@ -59,18 +59,18 @@ Dwarf::assemble $asm_file {
declare_labels int_type
the_type_i: structure_type {
- {name s}
- {byte_size 4 sdata}
+ DW_AT_name s
+ DW_AT_byte_size 4 sdata
} {
member {
- {name i}
- {type :$int_type}
+ DW_AT_name i
+ DW_AT_type :$int_type
}
}
int_type: base_type {
- {name int}
- {encoding @DW_ATE_signed}
- {byte_size 4 sdata}
+ DW_AT_name int
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 sdata
}
}
}
@@ -80,18 +80,18 @@ Dwarf::assemble $asm_file {
declare_labels int_type
the_type_j: structure_type {
- {name s}
- {byte_size 4 sdata}
+ DW_AT_name s
+ DW_AT_byte_size 4 sdata
} {
member {
- {name j}
- {type :$int_type}
+ DW_AT_name j
+ DW_AT_type :$int_type
}
}
int_type: base_type {
- {name int}
- {encoding @DW_ATE_signed}
- {byte_size 4 sdata}
+ DW_AT_name int
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 sdata
}
}
}
@@ -113,7 +113,7 @@ set struct_s_j_re \
" int j;" \
"}"]
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/subrange-enum.exp b/gdb/testsuite/gdb.dwarf2/subrange-enum.exp
index 416c87a..339cb49 100644
--- a/gdb/testsuite/gdb.dwarf2/subrange-enum.exp
+++ b/gdb/testsuite/gdb.dwarf2/subrange-enum.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,43 +26,45 @@ standard_testfile main.c -dw.S
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
declare_labels integer_label enum_label subrange_label
- integer_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
- }
+ integer_label: DW_TAG_base_type {
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
+ }
enum_label: DW_TAG_enumeration_type {
- {DW_AT_name E}
- {DW_AT_type :$integer_label}
+ DW_AT_name E
+ DW_AT_type :$integer_label
} {
DW_TAG_enumerator {
- {DW_AT_name ONE}
- {DW_AT_const_value 1 DW_FORM_sdata}
+ DW_AT_name ONE
+ DW_AT_const_value 1 DW_FORM_sdata
}
DW_TAG_enumerator {
- {DW_AT_name TWO}
- {DW_AT_const_value 2 DW_FORM_sdata}
+ DW_AT_name TWO
+ DW_AT_const_value 2 DW_FORM_sdata
}
DW_TAG_enumerator {
- {DW_AT_name THREE}
- {DW_AT_const_value 3 DW_FORM_sdata}
+ DW_AT_name THREE
+ DW_AT_const_value 3 DW_FORM_sdata
}
}
subrange_label: DW_TAG_subrange_type {
- {lower_bound 1 DW_FORM_sdata}
- {upper_bound 2 DW_FORM_sdata}
- {type :$enum_label}
+ DW_AT_lower_bound 1 DW_FORM_sdata
+ DW_AT_upper_bound 2 DW_FORM_sdata
+ DW_AT_type :$enum_label
}
DW_TAG_variable {
- {name rangeval}
- {type :$subrange_label}
- {const_value 2 DW_FORM_udata}
+ DW_AT_name rangeval
+ DW_AT_type :$subrange_label
+ DW_AT_const_value 2 DW_FORM_udata
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/subrange.exp b/gdb/testsuite/gdb.dwarf2/subrange.exp
index d384fb6..3e0326f 100644
--- a/gdb/testsuite/gdb.dwarf2/subrange.exp
+++ b/gdb/testsuite/gdb.dwarf2/subrange.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,35 +25,37 @@ standard_testfile method-ptr.cc -dw.S
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
- compile_unit {{language @DW_LANG_Pascal83}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_Pascal83
+ } {
declare_labels byte_label typedef_label array_label
# A subrange's underlying type that is a typedef.
byte_label: base_type {
- {name byte}
- {encoding @DW_ATE_unsigned}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name byte
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_byte_size 1 DW_FORM_sdata
}
typedef_label: typedef {
- {name byte_typedef}
- {type :$byte_label}
+ DW_AT_name byte_typedef
+ DW_AT_type :$byte_label
}
array_label: array_type {
- {type :$byte_label}
+ DW_AT_type :$byte_label
} {
subrange_type {
- {lower_bound 0 DW_FORM_sdata}
- {upper_bound 191 DW_FORM_sdata}
- {byte_stride 2 DW_FORM_sdata}
- {type :$typedef_label}
+ DW_AT_lower_bound 0 DW_FORM_sdata
+ DW_AT_upper_bound 191 DW_FORM_sdata
+ DW_AT_byte_stride 2 DW_FORM_sdata
+ DW_AT_type :$typedef_label
}
}
typedef {
- {name TByteArray}
- {type :$array_label}
+ DW_AT_name TByteArray
+ DW_AT_type :$array_label
}
# This subrange's underlying type is signed, but the bounds are
@@ -61,21 +63,21 @@ Dwarf::assemble $asm_file {
declare_labels signed_byte_label subrange_with_buggy_negative_bounds_label
signed_byte_label: base_type {
- {name signed_byte}
- {encoding @DW_ATE_signed}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name signed_byte
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 1 DW_FORM_sdata
}
# The bounds mean -16 to -12.
subrange_with_buggy_negative_bounds_label: subrange_type {
- {lower_bound 0xf0 DW_FORM_udata}
- {upper_bound 0xf4 DW_FORM_udata}
- {type :$signed_byte_label}
+ DW_AT_lower_bound 0xf0 DW_FORM_udata
+ DW_AT_upper_bound 0xf4 DW_FORM_udata
+ DW_AT_type :$signed_byte_label
}
DW_TAG_variable {
- {name subrange_with_buggy_negative_bounds_variable}
- {type :$subrange_with_buggy_negative_bounds_label}
+ DW_AT_name subrange_with_buggy_negative_bounds_variable
+ DW_AT_type :$subrange_with_buggy_negative_bounds_label
}
# This subrange's base type is 16-bytes long (although the bounds fit in
@@ -83,19 +85,19 @@ Dwarf::assemble $asm_file {
declare_labels a_16_byte_integer_label a_16_byte_subrange_label
a_16_byte_integer_label: base_type {
- {byte_size 16 udata}
- {encoding @DW_ATE_signed}
+ DW_AT_byte_size 16 udata
+ DW_AT_encoding @DW_ATE_signed
}
a_16_byte_subrange_label: subrange_type {
- {lower_bound -9223372036854775808 DW_FORM_sdata}
- {upper_bound 9223372036854775807 DW_FORM_sdata}
- {type :$a_16_byte_integer_label}
+ DW_AT_lower_bound -9223372036854775808 DW_FORM_sdata
+ DW_AT_upper_bound 9223372036854775807 DW_FORM_sdata
+ DW_AT_type :$a_16_byte_integer_label
}
DW_TAG_variable {
- {name a_16_byte_subrange_variable}
- {type :$a_16_byte_subrange_label}
+ DW_AT_name a_16_byte_subrange_variable
+ DW_AT_type :$a_16_byte_subrange_label
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/symbol_needs_eval.c b/gdb/testsuite/gdb.dwarf2/symbol_needs_eval.c
index 0d64305..f22418c 100644
--- a/gdb/testsuite/gdb.dwarf2/symbol_needs_eval.c
+++ b/gdb/testsuite/gdb.dwarf2/symbol_needs_eval.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/symbol_needs_eval_fail.exp b/gdb/testsuite/gdb.dwarf2/symbol_needs_eval_fail.exp
index f7aed74..93b01fc 100644
--- a/gdb/testsuite/gdb.dwarf2/symbol_needs_eval_fail.exp
+++ b/gdb/testsuite/gdb.dwarf2/symbol_needs_eval_fail.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ if { [is_aarch64_target] } {
standard_testfile symbol_needs_eval.c ${gdb_test_file_name}-dw.S
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} {
return
}
@@ -63,23 +63,23 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_name symbol_needs_eval.c}
- {DW_AT_comp_dir /tmp}
+ DW_AT_name symbol_needs_eval.c
+ DW_AT_comp_dir /tmp
} {
declare_labels int_type_label
# define int type
int_type_label: DW_TAG_base_type {
- {DW_AT_name "int"}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_byte_size $int_size DW_FORM_sdata}
+ DW_AT_name "int"
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size $int_size DW_FORM_sdata
}
# define artificial variable a
DW_TAG_variable {
- {DW_AT_name a}
- {DW_AT_type :$int_type_label}
- {DW_AT_location {
+ DW_AT_name a
+ DW_AT_type :$int_type_label
+ DW_AT_location {
DW_OP_addr $exec_mask_var
DW_OP_deref_size $int_size
@@ -91,8 +91,8 @@ Dwarf::assemble $asm_file {
DW_OP_skip 3
DW_OP_bregx $dwarf_regnum 0
DW_OP_stack_value
- } SPECIAL_expr}
- {external 1 flag}
+ } SPECIAL_expr
+ DW_AT_external 1 flag
}
}
}
@@ -107,7 +107,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} \
# so an error should be reported.
gdb_test "print/d a" "No frame selected." "variable a can't be printed"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/symbol_needs_eval_timeout.exp b/gdb/testsuite/gdb.dwarf2/symbol_needs_eval_timeout.exp
index d8a27b6..0c33442 100644
--- a/gdb/testsuite/gdb.dwarf2/symbol_needs_eval_timeout.exp
+++ b/gdb/testsuite/gdb.dwarf2/symbol_needs_eval_timeout.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ if { [is_aarch64_target] } {
standard_testfile symbol_needs_eval.c ${gdb_test_file_name}-dw.S
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} {
return
}
@@ -63,40 +63,40 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_name symbol_needs_eval.c}
- {DW_AT_comp_dir /tmp}
+ DW_AT_name symbol_needs_eval.c
+ DW_AT_comp_dir /tmp
} {
declare_labels int_type_label
# define int type
int_type_label: DW_TAG_base_type {
- {DW_AT_name "int"}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_byte_size $int_size DW_FORM_sdata}
+ DW_AT_name "int"
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size $int_size DW_FORM_sdata
}
# add info for variable exec_mask
DW_TAG_variable {
- {DW_AT_name exec_mask}
- {DW_AT_type :$int_type_label}
- {DW_AT_location {
+ DW_AT_name exec_mask
+ DW_AT_type :$int_type_label
+ DW_AT_location {
DW_OP_addr $exec_mask_var
- } SPECIAL_expr}
- {external 1 flag}
+ } SPECIAL_expr
+ DW_AT_external 1 flag
}
# add info for subprogram main
DW_TAG_subprogram {
- {MACRO_AT_func { main }}
- {DW_AT_frame_base {
+ MACRO_AT_func { main }
+ DW_AT_frame_base {
DW_OP_regx $dwarf_regnum
- } SPECIAL_expr}
+ } SPECIAL_expr
} {
# define artificial variable a
DW_TAG_variable {
- {DW_AT_name a}
- {DW_AT_type :$int_type_label}
- {DW_AT_location {
+ DW_AT_name a
+ DW_AT_type :$int_type_label
+ DW_AT_location {
DW_OP_lit1
DW_OP_addr $exec_mask_var
DW_OP_deref_size $int_size
@@ -112,8 +112,8 @@ Dwarf::assemble $asm_file {
# conditional jump to DW_OP_drop
DW_OP_bra -9
DW_OP_stack_value
- } SPECIAL_expr}
- {external 1 flag}
+ } SPECIAL_expr
+ DW_AT_external 1 flag
}
}
}
@@ -125,7 +125,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/symtab-producer.exp b/gdb/testsuite/gdb.dwarf2/symtab-producer.exp
index ac16c95..2826ba7 100644
--- a/gdb/testsuite/gdb.dwarf2/symtab-producer.exp
+++ b/gdb/testsuite/gdb.dwarf2/symtab-producer.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,46 +26,46 @@ set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_producer "ACME Compiler Company"}
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name symtab-producer-dw.c}
- {DW_AT_comp_dir /tmp}
+ DW_AT_producer "ACME Compiler Company"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name symtab-producer-dw.c
+ DW_AT_comp_dir /tmp
} {
declare_labels integer_label
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
DW_TAG_variable {
- {DW_AT_name with_producer}
- {DW_AT_type :$integer_label}
- {DW_AT_external 1 flag}
- {DW_AT_const_value 42 DW_FORM_sdata}
+ DW_AT_name with_producer
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
+ DW_AT_const_value 42 DW_FORM_sdata
}
}
}
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name symtab-producer2-dw.c}
- {DW_AT_comp_dir /tmp}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name symtab-producer2-dw.c
+ DW_AT_comp_dir /tmp
} {
declare_labels integer_label
integer_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name integer}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name integer
}
DW_TAG_variable {
- {DW_AT_name without_producer}
- {DW_AT_type :$integer_label}
- {DW_AT_external 1 flag}
- {DW_AT_const_value 43 DW_FORM_sdata}
+ DW_AT_name without_producer
+ DW_AT_type :$integer_label
+ DW_AT_external 1 flag
+ DW_AT_const_value 43 DW_FORM_sdata
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/template-specification-full-name.exp b/gdb/testsuite/gdb.dwarf2/template-specification-full-name.exp
index c1656fe..507c344 100644
--- a/gdb/testsuite/gdb.dwarf2/template-specification-full-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/template-specification-full-name.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,19 +35,19 @@ Dwarf::assemble $asm_file {
cu { label cu_start } {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
+ DW_AT_language @DW_LANG_C_plus_plus
} {
declare_labels templated_subprogram int
int: DW_TAG_base_type {
- {DW_AT_name "int"}
- {DW_AT_byte_size 4 DW_FORM_data1}
- {DW_AT_encoding @DW_ATE_signed}
+ DW_AT_name "int"
+ DW_AT_byte_size 4 DW_FORM_data1
+ DW_AT_encoding @DW_ATE_signed
}
# The templated subprogram.
templated_subprogram: DW_TAG_subprogram {
- {DW_AT_name "apply"}
+ DW_AT_name "apply"
}
# The template specialization.
@@ -55,12 +55,12 @@ Dwarf::assemble $asm_file {
# The low and high PC are phony: we just need an address range that
# is valid in the program, so we use the main function's range.
DW_TAG_subprogram {
- {DW_AT_specification :$templated_subprogram}
- {MACRO_AT_range main}
+ DW_AT_specification :$templated_subprogram
+ MACRO_AT_range main
} {
DW_TAG_template_type_param {
- {DW_AT_name "T"}
- {DW_AT_type :$int DW_FORM_ref4}
+ DW_AT_name "T"
+ DW_AT_type :$int DW_FORM_ref4
}
}
}
@@ -76,7 +76,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/trace-crash.exp b/gdb/testsuite/gdb.dwarf2/trace-crash.exp
index 0aa098b..4f6a944 100644
--- a/gdb/testsuite/gdb.dwarf2/trace-crash.exp
+++ b/gdb/testsuite/gdb.dwarf2/trace-crash.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/typeddwarf-amd64.S b/gdb/testsuite/gdb.dwarf2/typeddwarf-amd64.S
index d088c03..0743827 100644
--- a/gdb/testsuite/gdb.dwarf2/typeddwarf-amd64.S
+++ b/gdb/testsuite/gdb.dwarf2/typeddwarf-amd64.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/typeddwarf.S b/gdb/testsuite/gdb.dwarf2/typeddwarf.S
index 98a9107..7f440cd 100644
--- a/gdb/testsuite/gdb.dwarf2/typeddwarf.S
+++ b/gdb/testsuite/gdb.dwarf2/typeddwarf.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/typeddwarf.exp b/gdb/testsuite/gdb.dwarf2/typeddwarf.exp
index 73088c9..0fa812a 100644
--- a/gdb/testsuite/gdb.dwarf2/typeddwarf.exp
+++ b/gdb/testsuite/gdb.dwarf2/typeddwarf.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ if { [prepare_for_testing "failed to prepare" "${test}" ${sfile} $opts] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -78,7 +78,7 @@ proc scan_gdb_tests {} {
continue
}
- eval $test_cmd
+ {*}$test_cmd
}
close $fd
}
diff --git a/gdb/testsuite/gdb.dwarf2/typedef-void-finish.exp b/gdb/testsuite/gdb.dwarf2/typedef-void-finish.exp
index 019c10a..a96c1ac 100644
--- a/gdb/testsuite/gdb.dwarf2/typedef-void-finish.exp
+++ b/gdb/testsuite/gdb.dwarf2/typedef-void-finish.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,29 +31,29 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_producer "GNU C 8.1"}
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
- } {
+ DW_AT_producer "GNU C 8.1"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
+ } {
declare_labels main_type void_typedef
main_type: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
}
void_typedef: DW_TAG_typedef {
- {name foo}
+ DW_AT_name foo
}
- DW_TAG_subprogram {
- {MACRO_AT_func {func}}
- {type :$void_typedef}
+ DW_TAG_subprogram {
+ MACRO_AT_func {func}
+ DW_AT_type :$void_typedef
}
- DW_TAG_subprogram {
- {MACRO_AT_func {main}}
- {type :$main_type}
+ DW_TAG_subprogram {
+ MACRO_AT_func {main}
+ DW_AT_type :$main_type
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/utf-rust.exp b/gdb/testsuite/gdb.dwarf2/utf-rust.exp
index 61ae4272..9ab9bf5 100644
--- a/gdb/testsuite/gdb.dwarf2/utf-rust.exp
+++ b/gdb/testsuite/gdb.dwarf2/utf-rust.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,19 +34,19 @@ Dwarf::assemble $asm_file {
# both 32- and 64-bit machines.
cu { addr_size 4 } {
compile_unit {
- {name file1.txt}
- {language @DW_LANG_Rust}
+ DW_AT_name file1.txt
+ DW_AT_language @DW_LANG_Rust
} {
- char_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_UTF}
- {DW_AT_name char}
- }
+ char_label: DW_TAG_base_type {
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_UTF
+ DW_AT_name char
+ }
DW_TAG_variable {
- {name cvalue}
- {type :$char_label}
- {const_value 97 DW_FORM_udata}
+ DW_AT_name cvalue
+ DW_AT_type :$char_label
+ DW_AT_const_value 97 DW_FORM_udata
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/valop.S b/gdb/testsuite/gdb.dwarf2/valop.S
index e9d4d47..37cdd49 100644
--- a/gdb/testsuite/gdb.dwarf2/valop.S
+++ b/gdb/testsuite/gdb.dwarf2/valop.S
@@ -1,5 +1,5 @@
/*
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/valop.exp b/gdb/testsuite/gdb.dwarf2/valop.exp
index 6632769..d8c19e7 100644
--- a/gdb/testsuite/gdb.dwarf2/valop.exp
+++ b/gdb/testsuite/gdb.dwarf2/valop.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if {[prepare_for_testing "failed to prepare" $testfile \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/var-access.c b/gdb/testsuite/gdb.dwarf2/var-access.c
index f557726..7058703 100644
--- a/gdb/testsuite/gdb.dwarf2/var-access.c
+++ b/gdb/testsuite/gdb.dwarf2/var-access.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/var-access.exp b/gdb/testsuite/gdb.dwarf2/var-access.exp
index 3a7bd70..8760465 100644
--- a/gdb/testsuite/gdb.dwarf2/var-access.exp
+++ b/gdb/testsuite/gdb.dwarf2/var-access.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -54,8 +54,8 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
} {
declare_labels char_type_label
declare_labels int_type_label short_type_label
@@ -64,184 +64,184 @@ Dwarf::assemble $asm_file {
# char
char_type_label: base_type {
- {name "char"}
- {encoding @DW_ATE_unsigned_char}
- {byte_size 1 DW_FORM_sdata}
+ DW_AT_name "char"
+ DW_AT_encoding @DW_ATE_unsigned_char
+ DW_AT_byte_size 1 DW_FORM_sdata
}
# int
int_type_label: base_type {
- {name "int"}
- {encoding @DW_ATE_signed}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name "int"
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 DW_FORM_sdata
}
# char [8]
array_a8_label: array_type {
- {type :$char_type_label}
+ DW_AT_type :$char_type_label
} {
subrange_type {
- {type :$int_type_label}
- {upper_bound 7 DW_FORM_udata}
+ DW_AT_type :$int_type_label
+ DW_AT_upper_bound 7 DW_FORM_udata
}
}
# struct s { char a, b, c, d; };
struct_s_label: structure_type {
- {name "s"}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name "s"
+ DW_AT_byte_size 4 DW_FORM_sdata
} {
member {
- {name "a"}
- {type :$char_type_label}
- {data_member_location 0 DW_FORM_udata}
+ DW_AT_name "a"
+ DW_AT_type :$char_type_label
+ DW_AT_data_member_location 0 DW_FORM_udata
}
member {
- {name "b"}
- {type :$char_type_label}
- {data_member_location 1 DW_FORM_udata}
+ DW_AT_name "b"
+ DW_AT_type :$char_type_label
+ DW_AT_data_member_location 1 DW_FORM_udata
}
member {
- {name "c"}
- {type :$char_type_label}
- {data_member_location 2 DW_FORM_udata}
+ DW_AT_name "c"
+ DW_AT_type :$char_type_label
+ DW_AT_data_member_location 2 DW_FORM_udata
}
member {
- {name "d"}
- {type :$char_type_label}
- {data_member_location 3 DW_FORM_udata}
+ DW_AT_name "d"
+ DW_AT_type :$char_type_label
+ DW_AT_data_member_location 3 DW_FORM_udata
}
}
# struct t { int u, x:9, y:13, z:10; };
struct_t_label: structure_type {
- {name "t"}
- {byte_size 8 DW_FORM_sdata}
+ DW_AT_name "t"
+ DW_AT_byte_size 8 DW_FORM_sdata
} {
member {
- {name "u"}
- {type :$int_type_label}
+ DW_AT_name "u"
+ DW_AT_type :$int_type_label
}
member {
- {name "x"}
- {type :$int_type_label}
- {data_member_location 4 DW_FORM_udata}
- {bit_size 9 DW_FORM_udata}
+ DW_AT_name "x"
+ DW_AT_type :$int_type_label
+ DW_AT_data_member_location 4 DW_FORM_udata
+ DW_AT_bit_size 9 DW_FORM_udata
}
member {
- {name "y"}
- {type :$int_type_label}
- {data_bit_offset 41 DW_FORM_udata}
- {bit_size 13 DW_FORM_udata}
+ DW_AT_name "y"
+ DW_AT_type :$int_type_label
+ DW_AT_data_bit_offset 41 DW_FORM_udata
+ DW_AT_bit_size 13 DW_FORM_udata
}
member {
- {name "z"}
- {type :$int_type_label}
- {data_bit_offset 54 DW_FORM_udata}
- {bit_size 10 DW_FORM_udata}
+ DW_AT_name "z"
+ DW_AT_type :$int_type_label
+ DW_AT_data_bit_offset 54 DW_FORM_udata
+ DW_AT_bit_size 10 DW_FORM_udata
}
}
# struct st { struct s s; struct t t; };
struct_st_label: structure_type {
- {name "st"}
- {byte_size 12 DW_FORM_udata}
+ DW_AT_name "st"
+ DW_AT_byte_size 12 DW_FORM_udata
} {
member {
- {name "s"}
- {type :$struct_s_label}
+ DW_AT_name "s"
+ DW_AT_type :$struct_s_label
}
member {
- {name "t"}
- {type :$struct_t_label}
- {data_member_location 4 DW_FORM_udata}
+ DW_AT_name "t"
+ DW_AT_type :$struct_t_label
+ DW_AT_data_member_location 4 DW_FORM_udata
}
}
DW_TAG_subprogram {
- {MACRO_AT_func { main }}
- {DW_AT_external 1 flag}
+ MACRO_AT_func { main }
+ DW_AT_external 1 flag
} {
# Simple memory location.
DW_TAG_variable {
- {name "a"}
- {type :$array_a8_label}
- {location {
- addr $buf_var
- } SPECIAL_expr}
+ DW_AT_name "a"
+ DW_AT_type :$array_a8_label
+ DW_AT_location {
+ DW_OP_addr $buf_var
+ } SPECIAL_expr
}
# Memory pieces: two bytes from &buf[2], and two bytes
# from &buf[0].
DW_TAG_variable {
- {name "s1"}
- {type :$struct_s_label}
- {location {
- addr $buf_var
- plus_uconst 2
- piece 2
- addr $buf_var
- piece 2
- } SPECIAL_expr}
+ DW_AT_name "s1"
+ DW_AT_type :$struct_s_label
+ DW_AT_location {
+ DW_OP_addr $buf_var
+ DW_OP_plus_uconst 2
+ DW_OP_piece 2
+ DW_OP_addr $buf_var
+ DW_OP_piece 2
+ } SPECIAL_expr
}
# Register- and memory pieces: one byte each from r0,
# &buf[4], r1, and &buf[5].
DW_TAG_variable {
- {name "s2"}
- {type :$struct_s_label}
- {location {
- regx [lindex $dwarf_regnum 0]
- piece 1
- addr "$buf_var + 4"
- piece 1
- regx [lindex $dwarf_regnum 1]
- piece 1
- addr "$buf_var + 5"
- piece 1
- } SPECIAL_expr}
+ DW_AT_name "s2"
+ DW_AT_type :$struct_s_label
+ DW_AT_location {
+ DW_OP_regx [lindex $dwarf_regnum 0]
+ DW_OP_piece 1
+ DW_OP_addr "$buf_var + 4"
+ DW_OP_piece 1
+ DW_OP_regx [lindex $dwarf_regnum 1]
+ DW_OP_piece 1
+ DW_OP_addr "$buf_var + 5"
+ DW_OP_piece 1
+ } SPECIAL_expr
}
# Memory pieces for bitfield access: 8 bytes optimized
# out, 3 bytes from &buf[3], and 1 byte from &buf[1].
DW_TAG_variable {
- {name "st1"}
- {type :$struct_st_label}
- {location {
- piece 8
- addr "$buf_var + 3"
- piece 3
- addr "$buf_var + 1"
- piece 1
- } SPECIAL_expr}
+ DW_AT_name "st1"
+ DW_AT_type :$struct_st_label
+ DW_AT_location {
+ DW_OP_piece 8
+ DW_OP_addr "$buf_var + 3"
+ DW_OP_piece 3
+ DW_OP_addr "$buf_var + 1"
+ DW_OP_piece 1
+ } SPECIAL_expr
}
# Register pieces for bitfield access: 4 bytes optimized
# out, 3 bytes from r0, and 1 byte from r1.
DW_TAG_variable {
- {name "t2"}
- {type :$struct_t_label}
- {location {
- piece 4
- regx [lindex $dwarf_regnum 0]
- piece 3
- regx [lindex $dwarf_regnum 1]
- piece 1
- } SPECIAL_expr}
+ DW_AT_name "t2"
+ DW_AT_type :$struct_t_label
+ DW_AT_location {
+ DW_OP_piece 4
+ DW_OP_regx [lindex $dwarf_regnum 0]
+ DW_OP_piece 3
+ DW_OP_regx [lindex $dwarf_regnum 1]
+ DW_OP_piece 1
+ } SPECIAL_expr
}
# One piece per bitfield, using piece offsets: 32 bits of
# an implicit value, 9 bits of a stack value, 13 bits of
# r0, and 10 bits of buf.
DW_TAG_variable {
- {name "t3"}
- {type :$struct_t_label}
- {location {
- implicit_value 0x12 0x34 0x56 0x78 0x9a
- bit_piece 32 4
- const2s -280
- stack_value
- bit_piece 9 2
- regx [lindex $dwarf_regnum 0]
- bit_piece 13 14
- addr $buf_var
- bit_piece 10 42
- } SPECIAL_expr}
+ DW_AT_name "t3"
+ DW_AT_type :$struct_t_label
+ DW_AT_location {
+ DW_OP_implicit_value 0x12 0x34 0x56 0x78 0x9a
+ DW_OP_bit_piece 32 4
+ DW_OP_const2s -280
+ DW_OP_stack_value
+ DW_OP_bit_piece 9 2
+ DW_OP_regx [lindex $dwarf_regnum 0]
+ DW_OP_bit_piece 13 14
+ DW_OP_addr $buf_var
+ DW_OP_bit_piece 10 42
+ } SPECIAL_expr
}
}
}
@@ -253,7 +253,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/variant.c b/gdb/testsuite/gdb.dwarf2/variant.c
index 33a8a82..3ebfb17 100644
--- a/gdb/testsuite/gdb.dwarf2/variant.c
+++ b/gdb/testsuite/gdb.dwarf2/variant.c
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/variant.exp b/gdb/testsuite/gdb.dwarf2/variant.exp
index cf6bc53..9c9716b 100644
--- a/gdb/testsuite/gdb.dwarf2/variant.exp
+++ b/gdb/testsuite/gdb.dwarf2/variant.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,125 +36,125 @@ Dwarf::assemble $asm_file {
# both 32- and 64-bit machines.
cu { addr_size 4 } {
compile_unit {
- {name file1.txt}
- {language @DW_LANG_Rust}
+ DW_AT_name file1.txt
+ DW_AT_language @DW_LANG_Rust
} {
- uinteger_label: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_unsigned}
- {DW_AT_name {unsigned integer}}
- }
-
- int8_label: DW_TAG_base_type {
- {DW_AT_byte_size 1 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name i8}
- }
+ uinteger_label: DW_TAG_base_type {
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_unsigned
+ DW_AT_name {unsigned integer}
+ }
+
+ int8_label: DW_TAG_base_type {
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name i8
+ }
float_label: base_type {
- {name float}
- {encoding @DW_ATE_float}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name float
+ DW_AT_encoding @DW_ATE_float
+ DW_AT_byte_size 4 DW_FORM_sdata
}
one_label: structure_type {
- {name One}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name One
+ DW_AT_byte_size 4 DW_FORM_sdata
} {
member {
- {name __0}
- {type :$uinteger_label}
- {data_member_location 0 data1}
+ DW_AT_name __0
+ DW_AT_type :$uinteger_label
+ DW_AT_data_member_location 0 data1
}
}
two_label: structure_type {
- {name Two}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name Two
+ DW_AT_byte_size 4 DW_FORM_sdata
} {
member {
- {name __0}
- {type :$float_label}
- {data_member_location 0 data1}
+ DW_AT_name __0
+ DW_AT_type :$float_label
+ DW_AT_data_member_location 0 data1
}
}
structure_type {
- {name Simple}
- {byte_size 8 DW_FORM_sdata}
+ DW_AT_name Simple
+ DW_AT_byte_size 8 DW_FORM_sdata
} {
variant_part {
- {discr :$discr_1_label DW_FORM_ref4}
+ DW_AT_discr :$discr_1_label DW_FORM_ref4
} {
discr_1_label: member {
- {type :$uinteger_label}
- {data_member_location 0 data1}
- {artificial 1 DW_FORM_flag_present}
+ DW_AT_type :$uinteger_label
+ DW_AT_data_member_location 0 data1
+ DW_AT_artificial 1 DW_FORM_flag_present
}
variant {
- {discr_value 23 udata}
+ DW_AT_discr_value 23 udata
} {
member {
- {type :$one_label}
- {data_member_location 4 data1}
+ DW_AT_type :$one_label
+ DW_AT_data_member_location 4 data1
}
}
variant {
- {discr_value 1 udata}
+ DW_AT_discr_value 1 udata
} {
member {
- {type :$two_label}
- {data_member_location 4 data1}
+ DW_AT_type :$two_label
+ DW_AT_data_member_location 4 data1
}
}
}
}
structure_type {
- {name Defaulted}
- {byte_size 8 DW_FORM_sdata}
+ DW_AT_name Defaulted
+ DW_AT_byte_size 8 DW_FORM_sdata
} {
variant_part {
- {discr :$discr_2_label DW_FORM_ref4}
+ DW_AT_discr :$discr_2_label DW_FORM_ref4
} {
discr_2_label: member {
- {type :$uinteger_label}
- {data_member_location 0 data1}
- {artificial 1 DW_FORM_flag_present}
+ DW_AT_type :$uinteger_label
+ DW_AT_data_member_location 0 data1
+ DW_AT_artificial 1 DW_FORM_flag_present
}
variant {
} {
member {
- {type :$one_label}
- {data_member_location 4 data1}
+ DW_AT_type :$one_label
+ DW_AT_data_member_location 4 data1
}
}
variant {
- {discr_value 1 udata}
+ DW_AT_discr_value 1 udata
} {
member {
- {type :$two_label}
- {data_member_location 4 data1}
+ DW_AT_type :$two_label
+ DW_AT_data_member_location 4 data1
}
}
}
}
structure_type {
- {name Univariant}
- {byte_size 8 DW_FORM_sdata}
+ DW_AT_name Univariant
+ DW_AT_byte_size 8 DW_FORM_sdata
} {
variant_part {
} {
variant {
} {
member {
- {type :$one_label}
- {data_member_location 4 data1}
+ DW_AT_type :$one_label
+ DW_AT_data_member_location 4 data1
}
}
}
@@ -163,24 +163,24 @@ Dwarf::assemble $asm_file {
# Rust won't emit a negative discriminant like this, but
# we want to test the code path anyway.
structure_type {
- {name Negative}
- {byte_size 8 DW_FORM_sdata}
+ DW_AT_name Negative
+ DW_AT_byte_size 8 DW_FORM_sdata
} {
variant_part {
- {discr :$discr_3_label DW_FORM_ref4}
+ DW_AT_discr :$discr_3_label DW_FORM_ref4
} {
discr_3_label: member {
- {type :$int8_label}
- {data_member_location 0 data1}
- {artificial 1 DW_FORM_flag_present}
+ DW_AT_type :$int8_label
+ DW_AT_data_member_location 0 data1
+ DW_AT_artificial 1 DW_FORM_flag_present
}
variant {
- {discr_value -1 sdata}
+ DW_AT_discr_value -1 sdata
} {
member {
- {type :$one_label}
- {data_member_location 4 data1}
+ DW_AT_type :$one_label
+ DW_AT_data_member_location 4 data1
}
}
@@ -190,8 +190,8 @@ Dwarf::assemble $asm_file {
variant {
} {
member {
- {type :$two_label}
- {data_member_location 4 data1}
+ DW_AT_type :$two_label
+ DW_AT_data_member_location 4 data1
}
}
}
@@ -205,7 +205,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto func] {
+if {![runto func]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/varval.c b/gdb/testsuite/gdb.dwarf2/varval.c
index f42e917..8e0050b 100644
--- a/gdb/testsuite/gdb.dwarf2/varval.c
+++ b/gdb/testsuite/gdb.dwarf2/varval.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/varval.exp b/gdb/testsuite/gdb.dwarf2/varval.exp
index 5c4af78..b8f532b 100644
--- a/gdb/testsuite/gdb.dwarf2/varval.exp
+++ b/gdb/testsuite/gdb.dwarf2/varval.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Test support for DW_OP_GNU_variable_value.
+# Test support for DW_OP_GNU_variable_value.
load_lib dwarf.exp
@@ -33,7 +33,7 @@ set asm_file [standard_output_file ${srcfile2}]
# For that, we ask GDB by debugging our varval program.
# Any program would do, but since we already have varval
# specifically for this testcase, might as well use that.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
set int_size [get_sizeof "int" -1]
@@ -44,13 +44,13 @@ proc setup_exec { arg_bad } {
global asm_file executable srcfile bad
set bad ${arg_bad}
- # Create the DWARF.
+ # Create the DWARF.
Dwarf::assemble ${asm_file} {
global bad int_size addr_size
cu {} {
DW_TAG_compile_unit {
- {DW_AT_language @DW_LANG_C_plus_plus}
+ DW_AT_language @DW_LANG_C_plus_plus
} {
declare_labels int_label ptr_label struct_label var_a_label \
var_b_label var_c_label var_p_label var_bad_label \
@@ -61,179 +61,193 @@ proc setup_exec { arg_bad } {
int_label: DW_TAG_base_type {
- {DW_AT_byte_size ${int_size} DW_FORM_udata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name "int"}
+ DW_AT_byte_size ${int_size} DW_FORM_udata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name "int"
}
ptr_label: DW_TAG_pointer_type {
- {DW_AT_type :$int_label}
+ DW_AT_type :$int_label
}
var_a_label: DW_TAG_variable {
- {DW_AT_name "var_a"}
- {DW_AT_type :${int_label}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "var_a"]} SPECIAL_expr}
+ DW_AT_name "var_a"
+ DW_AT_type :${int_label}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "var_a"]
+ } SPECIAL_expr
}
var_a_abstract_label: DW_TAG_variable {
- {DW_AT_type :${int_label}}
- {DW_AT_external 1 DW_FORM_flag}
+ DW_AT_type :${int_label}
+ DW_AT_external 1 DW_FORM_flag
}
var_b_label: DW_TAG_variable {
- {DW_AT_name "var_b"}
- {DW_AT_type :${int_label}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "var_b"]} SPECIAL_expr}
+ DW_AT_name "var_b"
+ DW_AT_type :${int_label}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "var_b"]
+ } SPECIAL_expr
}
var_c_label: DW_TAG_variable {
- {DW_AT_name "var_c"}
- {DW_AT_type :${int_label}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_const_value 53 DW_FORM_sdata}
+ DW_AT_name "var_c"
+ DW_AT_type :${int_label}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_const_value 53 DW_FORM_sdata
}
var_p_label: DW_TAG_variable {
- {DW_AT_name "var_p"}
- {DW_AT_type :${ptr_label}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "var_p"]} SPECIAL_expr}
+ DW_AT_name "var_p"
+ DW_AT_type :${ptr_label}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "var_p"]
+ } SPECIAL_expr
}
if { $bad } {
var_bad_label: DW_TAG_variable {
- {DW_AT_name "var_bad"}
- {DW_AT_type :${int_label}}
- {DW_AT_external 1 DW_FORM_flag}
+ DW_AT_name "var_bad"
+ DW_AT_type :${int_label}
+ DW_AT_external 1 DW_FORM_flag
}
}
struct_label: DW_TAG_structure_type {
- {DW_AT_byte_size 8*$int_size DW_FORM_sdata}
+ DW_AT_byte_size 8*$int_size DW_FORM_sdata
} {
DW_TAG_member {
- {DW_AT_name "a"}
- {DW_AT_type :$int_label}
- {DW_AT_data_member_location 0*$int_size DW_FORM_udata}
+ DW_AT_name "a"
+ DW_AT_type :$int_label
+ DW_AT_data_member_location 0*$int_size DW_FORM_udata
}
DW_TAG_member {
- {DW_AT_name "b"}
- {DW_AT_type :$int_label}
- {DW_AT_data_member_location 1*$int_size DW_FORM_udata}
+ DW_AT_name "b"
+ DW_AT_type :$int_label
+ DW_AT_data_member_location 1*$int_size DW_FORM_udata
}
DW_TAG_member {
- {DW_AT_name "c"}
- {DW_AT_type :$int_label}
- {DW_AT_data_member_location 2*$int_size DW_FORM_udata}
+ DW_AT_name "c"
+ DW_AT_type :$int_label
+ DW_AT_data_member_location 2*$int_size DW_FORM_udata
}
DW_TAG_member {
- {DW_AT_name "d"}
- {DW_AT_type :$int_label}
- {DW_AT_data_member_location 3*$int_size DW_FORM_udata}
+ DW_AT_name "d"
+ DW_AT_type :$int_label
+ DW_AT_data_member_location 3*$int_size DW_FORM_udata
}
DW_TAG_member {
- {DW_AT_name "e"}
- {DW_AT_type :$int_label}
- {DW_AT_data_member_location 4*$int_size DW_FORM_udata}
+ DW_AT_name "e"
+ DW_AT_type :$int_label
+ DW_AT_data_member_location 4*$int_size DW_FORM_udata
}
DW_TAG_member {
- {DW_AT_name "f"}
- {DW_AT_type :$int_label}
- {DW_AT_data_member_location 5*$int_size DW_FORM_udata}
+ DW_AT_name "f"
+ DW_AT_type :$int_label
+ DW_AT_data_member_location 5*$int_size DW_FORM_udata
}
DW_TAG_member {
- {DW_AT_name "g"}
- {DW_AT_type :$int_label}
- {DW_AT_data_member_location 6*$int_size DW_FORM_udata}
+ DW_AT_name "g"
+ DW_AT_type :$int_label
+ DW_AT_data_member_location 6*$int_size DW_FORM_udata
}
DW_TAG_member {
- {DW_AT_name "h"}
- {DW_AT_type :$int_label}
- {DW_AT_data_member_location 7*$int_size DW_FORM_udata}
+ DW_AT_name "h"
+ DW_AT_type :$int_label
+ DW_AT_data_member_location 7*$int_size DW_FORM_udata
}
}
var_s_label: DW_TAG_variable {
- {DW_AT_name "var_s"}
- {DW_AT_type :${struct_label}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "var_s"]} SPECIAL_expr}
+ DW_AT_name "var_s"
+ DW_AT_type :${struct_label}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "var_s"]
+ } SPECIAL_expr
}
var_untyped_label: DW_TAG_variable {
- {DW_AT_name "var_untyped"}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "var_b"]} SPECIAL_expr}
+ DW_AT_name "var_untyped"
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "var_b"]
+ } SPECIAL_expr
}
int_array_label: DW_TAG_array_type {
- {DW_AT_type :${int_label}}
+ DW_AT_type :${int_label}
} {
DW_TAG_subrange_type {}
}
varval3_decl_label: DW_TAG_variable {
- {DW_AT_name "varval3"}
- {DW_AT_type :${int_array_label}}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_declaration 1 DW_FORM_flag}
+ DW_AT_name "varval3"
+ DW_AT_type :${int_array_label}
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_declaration 1 DW_FORM_flag
}
int_array_of_1_label: DW_TAG_array_type {
- {DW_AT_type :${int_label}}
+ DW_AT_type :${int_label}
} {
DW_TAG_subrange_type {
- {DW_AT_type :$int_label}
- {DW_AT_upper_bound 0 DW_FORM_data1}
+ DW_AT_type :$int_label
+ DW_AT_upper_bound 0 DW_FORM_data1
}
}
varval3_def_label: DW_TAG_variable {
- {DW_AT_name "varval3"}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_type :${int_array_of_1_label}}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "var_a"]} SPECIAL_expr}
+ DW_AT_name "varval3"
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_type :${int_array_of_1_label}
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "var_a"]
+ } SPECIAL_expr
}
DW_TAG_subprogram {
- {MACRO_AT_func { "main" }}
- {DW_AT_type :${int_label}}
- {DW_AT_external 1 DW_FORM_flag}
+ MACRO_AT_func { "main" }
+ DW_AT_type :${int_label}
+ DW_AT_external 1 DW_FORM_flag
} {
varval_label: DW_TAG_variable {
- {DW_AT_name "varval"}
- {DW_AT_type :${int_label}}
- {DW_AT_location {
+ DW_AT_name "varval"
+ DW_AT_type :${int_label}
+ DW_AT_location {
DW_OP_GNU_variable_value ${var_a_label}
DW_OP_const1s 0
DW_OP_or
DW_OP_stack_value
- } SPECIAL_expr}
+ } SPECIAL_expr
}
varval2_label: DW_TAG_variable {
- {DW_AT_name "varval2"}
- {DW_AT_type :${int_label}}
- {DW_AT_location {
+ DW_AT_name "varval2"
+ DW_AT_type :${int_label}
+ DW_AT_location {
DW_OP_GNU_variable_value ${var_a_abstract_label}
DW_OP_stack_value
- } SPECIAL_expr}
+ } SPECIAL_expr
}
var_a_concrete_label: DW_TAG_variable {
- {DW_AT_abstract_origin :${var_a_abstract_label}}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "var_a"]} SPECIAL_expr}
+ DW_AT_abstract_origin :${var_a_abstract_label}
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "var_a"]
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name "constval"}
- {DW_AT_type :${int_label}}
- {DW_AT_location {
+ DW_AT_name "constval"
+ DW_AT_type :${int_label}
+ DW_AT_location {
DW_OP_GNU_variable_value ${var_c_label}
DW_OP_stack_value
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name "mixedval"}
- {DW_AT_type :${int_label}}
- {DW_AT_location {
+ DW_AT_name "mixedval"
+ DW_AT_type :${int_label}
+ DW_AT_location {
DW_OP_GNU_variable_value ${var_c_label}
DW_OP_GNU_variable_value ${var_b_label}
DW_OP_div
@@ -244,55 +258,55 @@ proc setup_exec { arg_bad } {
DW_OP_GNU_variable_value ${varval_label}
DW_OP_minus
DW_OP_stack_value
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name "pointerval"}
- {DW_AT_type :${ptr_label}}
- {DW_AT_location {
+ DW_AT_name "pointerval"
+ DW_AT_type :${ptr_label}
+ DW_AT_location {
DW_OP_GNU_variable_value ${var_p_label}
DW_OP_stack_value
- } SPECIAL_expr}
+ } SPECIAL_expr
}
if { $bad } {
DW_TAG_variable {
- {DW_AT_name "badval"}
- {DW_AT_type :${int_label}}
- {DW_AT_location {
+ DW_AT_name "badval"
+ DW_AT_type :${int_label}
+ DW_AT_location {
DW_OP_GNU_variable_value ${var_bad_label}
DW_OP_stack_value
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
DW_TAG_variable {
- {DW_AT_name "structval"}
- {DW_AT_type :${struct_label}}
- {DW_AT_location {
+ DW_AT_name "structval"
+ DW_AT_type :${struct_label}
+ DW_AT_location {
DW_OP_GNU_variable_value ${var_s_label}
DW_OP_stack_value
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name "untypedval"}
- {DW_AT_location {
+ DW_AT_name "untypedval"
+ DW_AT_location {
DW_OP_GNU_variable_value ${var_untyped_label}
DW_OP_stack_value
- } SPECIAL_expr}
+ } SPECIAL_expr
}
if { $bad } {
DW_TAG_variable {
- {DW_AT_name "bad_die_val1"}
- {DW_AT_location {
+ DW_AT_name "bad_die_val1"
+ DW_AT_location {
DW_OP_GNU_variable_value 0xabcdef11
DW_OP_stack_value
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name "bad_die_val2"}
- {DW_AT_location {
+ DW_AT_name "bad_die_val2"
+ DW_AT_location {
DW_OP_GNU_variable_value ${ptr_label}+1
DW_OP_stack_value
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
}
@@ -300,7 +314,7 @@ proc setup_exec { arg_bad } {
}
}
- if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}] {
+ if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
return -1
}
}
@@ -314,7 +328,7 @@ with_test_prefix "pre-main" {
}
# DW_OP_GNU_variable_value implementation requires a valid frame.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -343,11 +357,11 @@ if { [setup_exec 1] == -1 } {
}
# DW_OP_GNU_variable_value implementation requires a valid frame.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test "print badval" "value has been optimized out"
gdb_test "print bad_die_val1" \
- "invalid dwarf2 offset 0xabcdef11"
+ {DWARF Error: could not find unit containing offset 0xabcdef11 \[in module .*/varval\]}
gdb_test "print bad_die_val2" \
"Bad DW_OP_GNU_variable_value DIE\\."
diff --git a/gdb/testsuite/gdb.dwarf2/void-type.c b/gdb/testsuite/gdb.dwarf2/void-type.c
index 4b4241e..7c6a793 100644
--- a/gdb/testsuite/gdb.dwarf2/void-type.c
+++ b/gdb/testsuite/gdb.dwarf2/void-type.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/void-type.exp b/gdb/testsuite/gdb.dwarf2/void-type.exp
index c0adcc4..a747a71 100644
--- a/gdb/testsuite/gdb.dwarf2/void-type.exp
+++ b/gdb/testsuite/gdb.dwarf2/void-type.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,50 +38,54 @@ Dwarf::assemble $asm_file {
cu {} {
DW_TAG_compile_unit {
- {DW_AT_producer "Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.5.212 Build 20150212"}
- {DW_AT_language @DW_LANG_C}
- {DW_AT_name $srcfile}
- {DW_AT_comp_dir /tmp}
- } {
+ DW_AT_producer "Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.5.212 Build 20150212"
+ DW_AT_language @DW_LANG_C
+ DW_AT_name $srcfile
+ DW_AT_comp_dir /tmp
+ } {
declare_labels int_type void_type ptr_type
int_type: DW_TAG_base_type {
- {DW_AT_byte_size 4 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name int}
+ DW_AT_byte_size 4 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name int
}
void_type: DW_TAG_base_type {
- {DW_AT_byte_size 0 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name void}
+ DW_AT_byte_size 0 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name void
}
ptr_type: DW_TAG_pointer_type {
- {DW_AT_type :$void_type}
+ DW_AT_type :$void_type
}
- DW_TAG_subprogram {
- {MACRO_AT_func {func}}
- {type :$void_type}
+ DW_TAG_subprogram {
+ MACRO_AT_func {func}
+ DW_AT_type :$void_type
}
- DW_TAG_subprogram {
- {MACRO_AT_func {main}}
- {type :$int_type}
+ DW_TAG_subprogram {
+ MACRO_AT_func {main}
+ DW_AT_type :$int_type
}
DW_TAG_variable {
- {DW_AT_name "var_a"}
- {DW_AT_type :$int_type}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "var_a"]} SPECIAL_expr}
+ DW_AT_name "var_a"
+ DW_AT_type :$int_type
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "var_a"]
+ } SPECIAL_expr
}
DW_TAG_variable {
- {DW_AT_name "var_ptr"}
- {DW_AT_type :$ptr_type}
- {DW_AT_external 1 DW_FORM_flag}
- {DW_AT_location {DW_OP_addr [gdb_target_symbol "var_ptr"]} SPECIAL_expr}
+ DW_AT_name "var_ptr"
+ DW_AT_type :$ptr_type
+ DW_AT_external 1 DW_FORM_flag
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "var_ptr"]
+ } SPECIAL_expr
}
}
}
@@ -92,7 +96,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/watch-notconst.c b/gdb/testsuite/gdb.dwarf2/watch-notconst.c
index a174073..e1a5799 100644
--- a/gdb/testsuite/gdb.dwarf2/watch-notconst.c
+++ b/gdb/testsuite/gdb.dwarf2/watch-notconst.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/watch-notconst.exp b/gdb/testsuite/gdb.dwarf2/watch-notconst.exp
index e836858..e1ec87c 100644
--- a/gdb/testsuite/gdb.dwarf2/watch-notconst.exp
+++ b/gdb/testsuite/gdb.dwarf2/watch-notconst.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/watch-notconst2.S b/gdb/testsuite/gdb.dwarf2/watch-notconst2.S
index 3bb84b0..ca41de5 100644
--- a/gdb/testsuite/gdb.dwarf2/watch-notconst2.S
+++ b/gdb/testsuite/gdb.dwarf2/watch-notconst2.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.dwarf2/watch-notconst2.c b/gdb/testsuite/gdb.dwarf2/watch-notconst2.c
index 6541ddd..3c3b01e 100644
--- a/gdb/testsuite/gdb.dwarf2/watch-notconst2.c
+++ b/gdb/testsuite/gdb.dwarf2/watch-notconst2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/allocated.exp b/gdb/testsuite/gdb.fortran/allocated.exp
index 1d87bf7..7cf1367 100644
--- a/gdb/testsuite/gdb.fortran/allocated.exp
+++ b/gdb/testsuite/gdb.fortran/allocated.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/allocated.f90 b/gdb/testsuite/gdb.fortran/allocated.f90
index 5340970..537ad07 100644
--- a/gdb/testsuite/gdb.fortran/allocated.f90
+++ b/gdb/testsuite/gdb.fortran/allocated.f90
@@ -1,4 +1,4 @@
-! Copyright 2021-2024 Free Software Foundation, Inc.
+! Copyright 2021-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/array-bounds-high.exp b/gdb/testsuite/gdb.fortran/array-bounds-high.exp
index 7e9c43b..6f9e7dc 100644
--- a/gdb/testsuite/gdb.fortran/array-bounds-high.exp
+++ b/gdb/testsuite/gdb.fortran/array-bounds-high.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/array-bounds-high.f90 b/gdb/testsuite/gdb.fortran/array-bounds-high.f90
index 4d327a4..655eacc 100644
--- a/gdb/testsuite/gdb.fortran/array-bounds-high.f90
+++ b/gdb/testsuite/gdb.fortran/array-bounds-high.f90
@@ -1,4 +1,4 @@
-! Copyright 2020-2024 Free Software Foundation, Inc.
+! Copyright 2020-2025 Free Software Foundation, Inc.
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/array-bounds.exp b/gdb/testsuite/gdb.fortran/array-bounds.exp
index 46ee614..9efd95f 100644
--- a/gdb/testsuite/gdb.fortran/array-bounds.exp
+++ b/gdb/testsuite/gdb.fortran/array-bounds.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,8 +34,8 @@ if {![fortran_runto_main]} {
# GCC outputs incorrect range debug info for -m32, gcc PR debug/54934.
set expect_xfail \
[expr \
- [test_compiler_info {gfortran-*} f90] \
- && [is_ilp32_target]]
+ {[test_compiler_info {gfortran-*} f90]
+ && [is_ilp32_target]}]
set re_ok [string_to_regexp (4294967296:4294967297)]
set re_xfail [string_to_regexp (0:1)]
diff --git a/gdb/testsuite/gdb.fortran/array-bounds.f90 b/gdb/testsuite/gdb.fortran/array-bounds.f90
index 74b2f56..ad38998 100644
--- a/gdb/testsuite/gdb.fortran/array-bounds.f90
+++ b/gdb/testsuite/gdb.fortran/array-bounds.f90
@@ -1,4 +1,4 @@
-! Copyright 2012-2024 Free Software Foundation, Inc.
+! Copyright 2012-2025 Free Software Foundation, Inc.
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/array-element.exp b/gdb/testsuite/gdb.fortran/array-element.exp
index 65499aa..7a57955 100644
--- a/gdb/testsuite/gdb.fortran/array-element.exp
+++ b/gdb/testsuite/gdb.fortran/array-element.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/array-element.f b/gdb/testsuite/gdb.fortran/array-element.f
index 909e472..bb19975 100644
--- a/gdb/testsuite/gdb.fortran/array-element.f
+++ b/gdb/testsuite/gdb.fortran/array-element.f
@@ -1,4 +1,4 @@
-c Copyright 2005-2024 Free Software Foundation, Inc.
+c Copyright 2005-2025 Free Software Foundation, Inc.
c This program is free software; you can redistribute it and/or modify
c it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/array-indices.exp b/gdb/testsuite/gdb.fortran/array-indices.exp
index 0fb0080..66e5316 100644
--- a/gdb/testsuite/gdb.fortran/array-indices.exp
+++ b/gdb/testsuite/gdb.fortran/array-indices.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/array-no-bounds.exp b/gdb/testsuite/gdb.fortran/array-no-bounds.exp
index 09db081..778d555 100644
--- a/gdb/testsuite/gdb.fortran/array-no-bounds.exp
+++ b/gdb/testsuite/gdb.fortran/array-no-bounds.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/array-no-bounds.f90 b/gdb/testsuite/gdb.fortran/array-no-bounds.f90
index 6b253ce..bd791a3 100644
--- a/gdb/testsuite/gdb.fortran/array-no-bounds.f90
+++ b/gdb/testsuite/gdb.fortran/array-no-bounds.f90
@@ -1,4 +1,4 @@
-! Copyright 2021-2024 Free Software Foundation, Inc.
+! Copyright 2021-2025 Free Software Foundation, Inc.
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/array-repeat.exp b/gdb/testsuite/gdb.fortran/array-repeat.exp
index 1a7c013..6c34847 100644
--- a/gdb/testsuite/gdb.fortran/array-repeat.exp
+++ b/gdb/testsuite/gdb.fortran/array-repeat.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/array-repeat.f90 b/gdb/testsuite/gdb.fortran/array-repeat.f90
index a655b19..b5551ac 100644
--- a/gdb/testsuite/gdb.fortran/array-repeat.f90
+++ b/gdb/testsuite/gdb.fortran/array-repeat.f90
@@ -1,4 +1,4 @@
-! Copyright 2022-2024 Free Software Foundation, Inc.
+! Copyright 2022-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/array-slices-bad.exp b/gdb/testsuite/gdb.fortran/array-slices-bad.exp
index ac4a77d..c3c6766 100644
--- a/gdb/testsuite/gdb.fortran/array-slices-bad.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices-bad.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/array-slices-bad.f90 b/gdb/testsuite/gdb.fortran/array-slices-bad.f90
index 49d054c..a32140b 100644
--- a/gdb/testsuite/gdb.fortran/array-slices-bad.f90
+++ b/gdb/testsuite/gdb.fortran/array-slices-bad.f90
@@ -1,4 +1,4 @@
-! Copyright 2020-2024 Free Software Foundation, Inc.
+! Copyright 2020-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/array-slices-repeat.f90 b/gdb/testsuite/gdb.fortran/array-slices-repeat.f90
index 3f8d77a..8274dec 100644
--- a/gdb/testsuite/gdb.fortran/array-slices-repeat.f90
+++ b/gdb/testsuite/gdb.fortran/array-slices-repeat.f90
@@ -1,4 +1,4 @@
-! Copyright 2022-2024 Free Software Foundation, Inc.
+! Copyright 2022-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
index 5a0f040..72c7c5e 100644
--- a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
@@ -53,7 +53,7 @@ gdb_test_multiple $cmd $cmd {
# slice.
for { set j 1 } { $j < 6 } { incr j } {
for { set i 1 } { $i < 6 } { incr i } {
- set val [expr ((($i - 1) * 2) + (($j - 1) * 20)) + 1]
+ set val [expr {((($i - 1) * 2) + (($j - 1) * 20)) + 1}]
gdb_test "print ${varname} ($i,$j)" " = $val"
}
}
@@ -106,7 +106,7 @@ gdb_test "print str (26:1:-2)" " = 'zxvtrpnljhfdb'"
# existing value in memory.
gdb_test_no_output "set fortran repack-array-slices on"
set element_size [get_integer_valueof "sizeof (array (1,1))" "unknown"]
-set slice_size [expr $element_size * 4]
+set slice_size [expr {$element_size * 4}]
gdb_test_no_output "set max-value-size $slice_size"
gdb_test "print array (1:2, 1:2)" "= \\(\\(1, 2\\) \\(11, 12\\)\\)"
gdb_test "print array (2:3, 2:3)" "= \\(\\(12, 13\\) \\(22, 23\\)\\)"
diff --git a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.f90 b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.f90
index 6642346..e26eb7d 100644
--- a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.f90
+++ b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.f90
@@ -1,4 +1,4 @@
-! Copyright 2020-2024 Free Software Foundation, Inc.
+! Copyright 2020-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp
index 1fa6a5d..0a7851e 100644
--- a/gdb/testsuite/gdb.fortran/array-slices.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -56,9 +56,9 @@ proc array_slice_to_var { slice_str } {
proc run_test { repack } {
global binfile gdb_prompt
- clean_restart ${binfile}
+ clean_restart ${::testfile}
- if ![fortran_runto_main] {
+ if {![fortran_runto_main]} {
return -1
}
@@ -132,7 +132,7 @@ proc run_test { repack } {
}
}
- if ($found_final_breakpoint) {
+ if {$found_final_breakpoint} {
break
}
diff --git a/gdb/testsuite/gdb.fortran/array-slices.f90 b/gdb/testsuite/gdb.fortran/array-slices.f90
index 93a3a8e..7b84376 100644
--- a/gdb/testsuite/gdb.fortran/array-slices.f90
+++ b/gdb/testsuite/gdb.fortran/array-slices.f90
@@ -1,4 +1,4 @@
-! Copyright 2019-2024 Free Software Foundation, Inc.
+! Copyright 2019-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/associated.exp b/gdb/testsuite/gdb.fortran/associated.exp
index d401912..6d1a6d8 100644
--- a/gdb/testsuite/gdb.fortran/associated.exp
+++ b/gdb/testsuite/gdb.fortran/associated.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
@@ -50,7 +50,7 @@ while { $test_count < 500 } {
}
}
- if ($found_final_breakpoint) {
+ if {$found_final_breakpoint} {
break
}
diff --git a/gdb/testsuite/gdb.fortran/associated.f90 b/gdb/testsuite/gdb.fortran/associated.f90
index 1c5a168..d13ac40 100644
--- a/gdb/testsuite/gdb.fortran/associated.f90
+++ b/gdb/testsuite/gdb.fortran/associated.f90
@@ -1,4 +1,4 @@
-! Copyright 2021-2024 Free Software Foundation, Inc.
+! Copyright 2021-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/assumedrank.exp b/gdb/testsuite/gdb.fortran/assumedrank.exp
index 32fd9d2..ce53841 100644
--- a/gdb/testsuite/gdb.fortran/assumedrank.exp
+++ b/gdb/testsuite/gdb.fortran/assumedrank.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
untested "could not run to main"
return -1
}
@@ -64,7 +64,7 @@ while { $test_count < 500 } {
continue
}
- if ($found_final_breakpoint) {
+ if {$found_final_breakpoint} {
break
}
diff --git a/gdb/testsuite/gdb.fortran/assumedrank.f90 b/gdb/testsuite/gdb.fortran/assumedrank.f90
index dc656ef..a27b137 100644
--- a/gdb/testsuite/gdb.fortran/assumedrank.f90
+++ b/gdb/testsuite/gdb.fortran/assumedrank.f90
@@ -1,4 +1,4 @@
-! Copyright 2021-2024 Free Software Foundation, Inc.
+! Copyright 2021-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/backtrace.exp b/gdb/testsuite/gdb.fortran/backtrace.exp
index 5679b61..51f11db 100644
--- a/gdb/testsuite/gdb.fortran/backtrace.exp
+++ b/gdb/testsuite/gdb.fortran/backtrace.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/backtrace.f90 b/gdb/testsuite/gdb.fortran/backtrace.f90
index 0265c04..ff09b00 100644
--- a/gdb/testsuite/gdb.fortran/backtrace.f90
+++ b/gdb/testsuite/gdb.fortran/backtrace.f90
@@ -1,4 +1,4 @@
-! Copyright 2023-2024 Free Software Foundation, Inc.
+! Copyright 2023-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/block-data.exp b/gdb/testsuite/gdb.fortran/block-data.exp
index dcec475..4aae8c4 100644
--- a/gdb/testsuite/gdb.fortran/block-data.exp
+++ b/gdb/testsuite/gdb.fortran/block-data.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/block-data.f b/gdb/testsuite/gdb.fortran/block-data.f
index da383dc..5952f56 100644
--- a/gdb/testsuite/gdb.fortran/block-data.f
+++ b/gdb/testsuite/gdb.fortran/block-data.f
@@ -1,4 +1,4 @@
-! Copyright 2016-2024 Free Software Foundation, Inc.
+! Copyright 2016-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/call-no-debug-func.f90 b/gdb/testsuite/gdb.fortran/call-no-debug-func.f90
index 6098ab3..2f276b4 100644
--- a/gdb/testsuite/gdb.fortran/call-no-debug-func.f90
+++ b/gdb/testsuite/gdb.fortran/call-no-debug-func.f90
@@ -1,4 +1,4 @@
-! Copyright 2020-2024 Free Software Foundation, Inc.
+! Copyright 2020-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/call-no-debug-prog.f90 b/gdb/testsuite/gdb.fortran/call-no-debug-prog.f90
index 5fb08ed..a1d9328 100644
--- a/gdb/testsuite/gdb.fortran/call-no-debug-prog.f90
+++ b/gdb/testsuite/gdb.fortran/call-no-debug-prog.f90
@@ -1,4 +1,4 @@
-! Copyright 2020-2024 Free Software Foundation, Inc.
+! Copyright 2020-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/call-no-debug.exp b/gdb/testsuite/gdb.fortran/call-no-debug.exp
index 5707444..96ccdd7 100644
--- a/gdb/testsuite/gdb.fortran/call-no-debug.exp
+++ b/gdb/testsuite/gdb.fortran/call-no-debug.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ standard_testfile call-no-debug-prog.f90 call-no-debug-func.f90
load_lib fortran.exp
if {[prepare_for_testing_full "failed to prepare" \
- [list ${binfile} [list debug f90] \
+ [list $testfile [list debug f90] \
$srcfile [list debug f90] \
$srcfile2 [list nodebug f90]]]} {
return -1
@@ -67,7 +67,7 @@ proc find_mangled_name { name } {
set some_func [find_mangled_name "some_func"]
set string_func [find_mangled_name "string_func"]
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/charset.exp b/gdb/testsuite/gdb.fortran/charset.exp
index b0cb711..cd117d4 100644
--- a/gdb/testsuite/gdb.fortran/charset.exp
+++ b/gdb/testsuite/gdb.fortran/charset.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug addi
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.fortran/class-allocatable-array.exp b/gdb/testsuite/gdb.fortran/class-allocatable-array.exp
index 1a2f78d..d860b2c 100644
--- a/gdb/testsuite/gdb.fortran/class-allocatable-array.exp
+++ b/gdb/testsuite/gdb.fortran/class-allocatable-array.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/class-allocatable-array.f90 b/gdb/testsuite/gdb.fortran/class-allocatable-array.f90
index f08296e..3cdbde0 100644
--- a/gdb/testsuite/gdb.fortran/class-allocatable-array.f90
+++ b/gdb/testsuite/gdb.fortran/class-allocatable-array.f90
@@ -1,4 +1,4 @@
-! Copyright 2020-2024 Free Software Foundation, Inc.
+! Copyright 2020-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/common-block.exp b/gdb/testsuite/gdb.fortran/common-block.exp
index 889f730..f27f3ad 100644
--- a/gdb/testsuite/gdb.fortran/common-block.exp
+++ b/gdb/testsuite/gdb.fortran/common-block.exp
@@ -1,15 +1,15 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/gdb/testsuite/gdb.fortran/common-block.f90 b/gdb/testsuite/gdb.fortran/common-block.f90
index 8296d76..2335870 100644
--- a/gdb/testsuite/gdb.fortran/common-block.f90
+++ b/gdb/testsuite/gdb.fortran/common-block.f90
@@ -1,4 +1,4 @@
-! Copyright 2008-2024 Free Software Foundation, Inc.
+! Copyright 2008-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/completion.exp b/gdb/testsuite/gdb.fortran/completion.exp
index fabcc54..5038251 100644
--- a/gdb/testsuite/gdb.fortran/completion.exp
+++ b/gdb/testsuite/gdb.fortran/completion.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/completion.f90 b/gdb/testsuite/gdb.fortran/completion.f90
index 2bfda3a..596adf2 100644
--- a/gdb/testsuite/gdb.fortran/completion.f90
+++ b/gdb/testsuite/gdb.fortran/completion.f90
@@ -1,4 +1,4 @@
-! Copyright 2020-2024 Free Software Foundation, Inc.
+! Copyright 2020-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/complex.exp b/gdb/testsuite/gdb.fortran/complex.exp
index 33f88aa..5f416bf 100644
--- a/gdb/testsuite/gdb.fortran/complex.exp
+++ b/gdb/testsuite/gdb.fortran/complex.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/complex.f90 b/gdb/testsuite/gdb.fortran/complex.f90
index 4a33ef6..a154137 100644
--- a/gdb/testsuite/gdb.fortran/complex.f90
+++ b/gdb/testsuite/gdb.fortran/complex.f90
@@ -1,4 +1,4 @@
-! Copyright 2007-2024 Free Software Foundation, Inc.
+! Copyright 2007-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/debug-expr.exp b/gdb/testsuite/gdb.fortran/debug-expr.exp
index cd32819..d872ad6 100644
--- a/gdb/testsuite/gdb.fortran/debug-expr.exp
+++ b/gdb/testsuite/gdb.fortran/debug-expr.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/debug-expr.f90 b/gdb/testsuite/gdb.fortran/debug-expr.f90
index 1de872b..5b6feb3 100644
--- a/gdb/testsuite/gdb.fortran/debug-expr.f90
+++ b/gdb/testsuite/gdb.fortran/debug-expr.f90
@@ -1,4 +1,4 @@
-! Copyright 2020-2024 Free Software Foundation, Inc.
+! Copyright 2020-2025 Free Software Foundation, Inc.
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/derived-type-function.exp b/gdb/testsuite/gdb.fortran/derived-type-function.exp
index 9f09c98..0ead0dc 100644
--- a/gdb/testsuite/gdb.fortran/derived-type-function.exp
+++ b/gdb/testsuite/gdb.fortran/derived-type-function.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/derived-type-function.f90 b/gdb/testsuite/gdb.fortran/derived-type-function.f90
index bb5c57d..d5c8d29 100644
--- a/gdb/testsuite/gdb.fortran/derived-type-function.f90
+++ b/gdb/testsuite/gdb.fortran/derived-type-function.f90
@@ -1,4 +1,4 @@
-! Copyright 2016-2024 Free Software Foundation, Inc.
+! Copyright 2016-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/derived-type-striding.exp b/gdb/testsuite/gdb.fortran/derived-type-striding.exp
index 8354af1..86220b3 100644
--- a/gdb/testsuite/gdb.fortran/derived-type-striding.exp
+++ b/gdb/testsuite/gdb.fortran/derived-type-striding.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/derived-type-striding.f90 b/gdb/testsuite/gdb.fortran/derived-type-striding.f90
index 7dfe1fa..c869cb5 100644
--- a/gdb/testsuite/gdb.fortran/derived-type-striding.f90
+++ b/gdb/testsuite/gdb.fortran/derived-type-striding.f90
@@ -1,4 +1,4 @@
-! Copyright 2019-2024 Free Software Foundation, Inc.
+! Copyright 2019-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/derived-type.exp b/gdb/testsuite/gdb.fortran/derived-type.exp
index bd7c3ae..619c0e4 100644
--- a/gdb/testsuite/gdb.fortran/derived-type.exp
+++ b/gdb/testsuite/gdb.fortran/derived-type.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/derived-type.f90 b/gdb/testsuite/gdb.fortran/derived-type.f90
index 97fbc5c..6bcbaa8 100644
--- a/gdb/testsuite/gdb.fortran/derived-type.f90
+++ b/gdb/testsuite/gdb.fortran/derived-type.f90
@@ -1,4 +1,4 @@
-! Copyright 2006-2024 Free Software Foundation, Inc.
+! Copyright 2006-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/dot-ops.exp b/gdb/testsuite/gdb.fortran/dot-ops.exp
index 8b37843..83f47f1 100644
--- a/gdb/testsuite/gdb.fortran/dot-ops.exp
+++ b/gdb/testsuite/gdb.fortran/dot-ops.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/dynamic-ptype-whatis.exp b/gdb/testsuite/gdb.fortran/dynamic-ptype-whatis.exp
index e5fefe0..0bd0c26 100644
--- a/gdb/testsuite/gdb.fortran/dynamic-ptype-whatis.exp
+++ b/gdb/testsuite/gdb.fortran/dynamic-ptype-whatis.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/dynamic-ptype-whatis.f90 b/gdb/testsuite/gdb.fortran/dynamic-ptype-whatis.f90
index 00835ea..4d7cd09 100644
--- a/gdb/testsuite/gdb.fortran/dynamic-ptype-whatis.f90
+++ b/gdb/testsuite/gdb.fortran/dynamic-ptype-whatis.f90
@@ -1,4 +1,4 @@
-! Copyright 2021-2024 Free Software Foundation, Inc.
+! Copyright 2021-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/empty-string.exp b/gdb/testsuite/gdb.fortran/empty-string.exp
index a428eab..17ee5e5 100644
--- a/gdb/testsuite/gdb.fortran/empty-string.exp
+++ b/gdb/testsuite/gdb.fortran/empty-string.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/empty-string.f90 b/gdb/testsuite/gdb.fortran/empty-string.f90
index 1037cc9..e907378 100644
--- a/gdb/testsuite/gdb.fortran/empty-string.f90
+++ b/gdb/testsuite/gdb.fortran/empty-string.f90
@@ -1,4 +1,4 @@
-! Copyright 2022-2024 Free Software Foundation, Inc.
+! Copyright 2022-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/entry-point.exp b/gdb/testsuite/gdb.fortran/entry-point.exp
index 51550ad..650b9ef 100644
--- a/gdb/testsuite/gdb.fortran/entry-point.exp
+++ b/gdb/testsuite/gdb.fortran/entry-point.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/entry-point.f90 b/gdb/testsuite/gdb.fortran/entry-point.f90
index 1b5e5cd..6d85910 100644
--- a/gdb/testsuite/gdb.fortran/entry-point.f90
+++ b/gdb/testsuite/gdb.fortran/entry-point.f90
@@ -1,4 +1,4 @@
-! Copyright 2023-2024 Free Software Foundation, Inc.
+! Copyright 2023-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/exprs.exp b/gdb/testsuite/gdb.fortran/exprs.exp
index 6447530..323a2ab 100644
--- a/gdb/testsuite/gdb.fortran/exprs.exp
+++ b/gdb/testsuite/gdb.fortran/exprs.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1994-2024 Free Software Foundation, Inc.
+# Copyright (C) 1994-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -232,7 +232,7 @@ proc test_arithmetic_expressions {} {
gdb_test "p 6.0 / 3.0" " = 2" "real divided by real"
# Test exponentiation with various operands
-
+
gdb_test "p 2 ** 3" " = 8" "int powered by int"
gdb_test "p 2 ** 2 ** 3" " = 256" "combined exponentiation expression"
gdb_test "p (2 ** 2) ** 3" " = 64" "combined exponentiation expression in specified order"
diff --git a/gdb/testsuite/gdb.fortran/function-calls.exp b/gdb/testsuite/gdb.fortran/function-calls.exp
index e0b35d6..405a1a1 100644
--- a/gdb/testsuite/gdb.fortran/function-calls.exp
+++ b/gdb/testsuite/gdb.fortran/function-calls.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/function-calls.f90 b/gdb/testsuite/gdb.fortran/function-calls.f90
index 050ad6b..16d6f6a 100644
--- a/gdb/testsuite/gdb.fortran/function-calls.f90
+++ b/gdb/testsuite/gdb.fortran/function-calls.f90
@@ -1,4 +1,4 @@
-! Copyright 2019-2024 Free Software Foundation, Inc.
+! Copyright 2019-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/huge.F90 b/gdb/testsuite/gdb.fortran/huge.F90
index 3fb7577..2d36f2b 100644
--- a/gdb/testsuite/gdb.fortran/huge.F90
+++ b/gdb/testsuite/gdb.fortran/huge.F90
@@ -1,4 +1,4 @@
-! Copyright 2023-2024 Free Software Foundation, Inc.
+! Copyright 2023-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/huge.exp b/gdb/testsuite/gdb.fortran/huge.exp
index 78c1d52..03ebdaa 100644
--- a/gdb/testsuite/gdb.fortran/huge.exp
+++ b/gdb/testsuite/gdb.fortran/huge.exp
@@ -1,4 +1,4 @@
-# Copyright 2001-2024 Free Software Foundation, Inc.
+# Copyright 2001-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ load_lib fortran.exp
standard_testfile .F90
-set max [expr 2 * 1024 * 1024]
+set max [expr {2 * 1024 * 1024}]
set min 16
set opts {}
@@ -35,7 +35,7 @@ lappend opts debug
lappend opts f90
set compilation_succeeded 0
-for { set size [expr $max] } { $size >= $min } { set size [expr $size / 2] } {
+for { set size [expr {$max}] } { $size >= $min } { set size [expr {$size / 2}] } {
set try_opts [concat $opts [list additional_flags=-DCRASH_GDB=$size]]
with_test_prefix CRASH_GDB=$size {
if { [build_executable $testfile.exp $testfile $srcfile $try_opts] == -1 } {
@@ -46,10 +46,10 @@ for { set size [expr $max] } { $size >= $min } { set size [expr $size / 2] } {
set compilation_succeeded 1
break
}
-require {expr $compilation_succeeded}
+require {expr {$compilation_succeeded}}
# Start with a fresh gdb.
-clean_restart ${binfile}
+clean_restart ${::testfile}
save_vars { timeout } {
set timeout 30
@@ -92,6 +92,6 @@ save_vars { timeout } {
unsupported $test
} else {
# At 112 passes with and without the fix, so use 111.
- gdb_assert {$space_used < [expr 111 * 4 * $size] } $test
+ gdb_assert {$space_used < [expr {111 * 4 * $size}] } $test
}
}
diff --git a/gdb/testsuite/gdb.fortran/info-main.exp b/gdb/testsuite/gdb.fortran/info-main.exp
index 7d11235b..6cdfd15 100644
--- a/gdb/testsuite/gdb.fortran/info-main.exp
+++ b/gdb/testsuite/gdb.fortran/info-main.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ save_vars { GDBFLAGS } {
gdb_test "info main" "simple" "info main prior to start"
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/info-main.f90 b/gdb/testsuite/gdb.fortran/info-main.f90
index 46f6af3..5243c9e 100644
--- a/gdb/testsuite/gdb.fortran/info-main.f90
+++ b/gdb/testsuite/gdb.fortran/info-main.f90
@@ -1,4 +1,4 @@
-! Copyright 2023-2024 Free Software Foundation, Inc.
+! Copyright 2023-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/info-modules.exp b/gdb/testsuite/gdb.fortran/info-modules.exp
index c8ae736..5fc86b9 100644
--- a/gdb/testsuite/gdb.fortran/info-modules.exp
+++ b/gdb/testsuite/gdb.fortran/info-modules.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/info-types-2.f90 b/gdb/testsuite/gdb.fortran/info-types-2.f90
index fb9438b..67d0f18 100644
--- a/gdb/testsuite/gdb.fortran/info-types-2.f90
+++ b/gdb/testsuite/gdb.fortran/info-types-2.f90
@@ -1,4 +1,4 @@
-! Copyright 2019-2024 Free Software Foundation, Inc.
+! Copyright 2019-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/info-types.exp b/gdb/testsuite/gdb.fortran/info-types.exp
index ad2c988..dc3d35a 100644
--- a/gdb/testsuite/gdb.fortran/info-types.exp
+++ b/gdb/testsuite/gdb.fortran/info-types.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/info-types.f90 b/gdb/testsuite/gdb.fortran/info-types.f90
index 3f6cba8..448bc09 100644
--- a/gdb/testsuite/gdb.fortran/info-types.f90
+++ b/gdb/testsuite/gdb.fortran/info-types.f90
@@ -1,4 +1,4 @@
-! Copyright 2019-2024 Free Software Foundation, Inc.
+! Copyright 2019-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/intrinsic-precedence.c b/gdb/testsuite/gdb.fortran/intrinsic-precedence.c
index 6a839c7..6664e8f 100644
--- a/gdb/testsuite/gdb.fortran/intrinsic-precedence.c
+++ b/gdb/testsuite/gdb.fortran/intrinsic-precedence.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/intrinsic-precedence.exp b/gdb/testsuite/gdb.fortran/intrinsic-precedence.exp
index cb37a9a..93f1da9 100644
--- a/gdb/testsuite/gdb.fortran/intrinsic-precedence.exp
+++ b/gdb/testsuite/gdb.fortran/intrinsic-precedence.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/intrinsic-precedence.f90 b/gdb/testsuite/gdb.fortran/intrinsic-precedence.f90
index c43853c..c4f1052 100644
--- a/gdb/testsuite/gdb.fortran/intrinsic-precedence.f90
+++ b/gdb/testsuite/gdb.fortran/intrinsic-precedence.f90
@@ -1,4 +1,4 @@
-! Copyright 2023-2024 Free Software Foundation, Inc.
+! Copyright 2023-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/intrinsics.exp b/gdb/testsuite/gdb.fortran/intrinsics.exp
index 060bb53..a195256 100644
--- a/gdb/testsuite/gdb.fortran/intrinsics.exp
+++ b/gdb/testsuite/gdb.fortran/intrinsics.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/intrinsics.f90 b/gdb/testsuite/gdb.fortran/intrinsics.f90
index 4c4b4c9..8a810d2 100644
--- a/gdb/testsuite/gdb.fortran/intrinsics.f90
+++ b/gdb/testsuite/gdb.fortran/intrinsics.f90
@@ -1,4 +1,4 @@
-! Copyright 2019-2024 Free Software Foundation, Inc.
+! Copyright 2019-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/intvar-array.exp b/gdb/testsuite/gdb.fortran/intvar-array.exp
index 2e2f7f9..52314ed 100644
--- a/gdb/testsuite/gdb.fortran/intvar-array.exp
+++ b/gdb/testsuite/gdb.fortran/intvar-array.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/intvar-array.f90 b/gdb/testsuite/gdb.fortran/intvar-array.f90
index 9734655..3877833 100644
--- a/gdb/testsuite/gdb.fortran/intvar-array.f90
+++ b/gdb/testsuite/gdb.fortran/intvar-array.f90
@@ -1,4 +1,4 @@
-! Copyright 2021-2024 Free Software Foundation, Inc.
+! Copyright 2021-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/intvar-dynamic-types.exp b/gdb/testsuite/gdb.fortran/intvar-dynamic-types.exp
index e56e24e..201f020 100644
--- a/gdb/testsuite/gdb.fortran/intvar-dynamic-types.exp
+++ b/gdb/testsuite/gdb.fortran/intvar-dynamic-types.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/intvar-dynamic-types.f90 b/gdb/testsuite/gdb.fortran/intvar-dynamic-types.f90
index 1511e57..b96dfc6 100644
--- a/gdb/testsuite/gdb.fortran/intvar-dynamic-types.f90
+++ b/gdb/testsuite/gdb.fortran/intvar-dynamic-types.f90
@@ -1,4 +1,4 @@
-! Copyright 2020-2024 Free Software Foundation, Inc.
+! Copyright 2020-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/lbound-ubound.F90 b/gdb/testsuite/gdb.fortran/lbound-ubound.F90
index 3b93031..cd11b43 100644
--- a/gdb/testsuite/gdb.fortran/lbound-ubound.F90
+++ b/gdb/testsuite/gdb.fortran/lbound-ubound.F90
@@ -1,4 +1,4 @@
-! Copyright 2021-2024 Free Software Foundation, Inc.
+! Copyright 2021-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/lbound-ubound.exp b/gdb/testsuite/gdb.fortran/lbound-ubound.exp
index 781d361..75b8feb 100644
--- a/gdb/testsuite/gdb.fortran/lbound-ubound.exp
+++ b/gdb/testsuite/gdb.fortran/lbound-ubound.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
@@ -61,7 +61,7 @@ while { $test_count < 500 } {
}
}
- if ($found_dealloc_breakpoint) {
+ if {$found_dealloc_breakpoint} {
break
}
@@ -160,7 +160,7 @@ while { $test_count < 500 } {
# Finally, check that asking for a dimension above the valid
# range gives the expected error.
- set bad_dim [expr $upper_dim + 1]
+ set bad_dim [expr {$upper_dim + 1}]
gdb_test "p lbound ($array_name, $bad_dim)" \
"LBOUND dimension must be from 1 to $upper_dim" \
"check error message for lbound of dim = $bad_dim"
diff --git a/gdb/testsuite/gdb.fortran/library-module-lib.f90 b/gdb/testsuite/gdb.fortran/library-module-lib.f90
index 6bfb521..e50df77 100644
--- a/gdb/testsuite/gdb.fortran/library-module-lib.f90
+++ b/gdb/testsuite/gdb.fortran/library-module-lib.f90
@@ -1,4 +1,4 @@
-! Copyright 2010-2024 Free Software Foundation, Inc.
+! Copyright 2010-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/library-module-main.f90 b/gdb/testsuite/gdb.fortran/library-module-main.f90
index 0a61aca..c7d8b84 100644
--- a/gdb/testsuite/gdb.fortran/library-module-main.f90
+++ b/gdb/testsuite/gdb.fortran/library-module-main.f90
@@ -1,4 +1,4 @@
-! Copyright 2010-2024 Free Software Foundation, Inc.
+! Copyright 2010-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/library-module.exp b/gdb/testsuite/gdb.fortran/library-module.exp
index 647bcef..07867ee 100644
--- a/gdb/testsuite/gdb.fortran/library-module.exp
+++ b/gdb/testsuite/gdb.fortran/library-module.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@ load_lib fortran.exp
require allow_fortran_tests
-standard_testfile library-module-main.f90
+standard_testfile library-module-main.f90
set srclibfile ${testfile}-lib.f90
set libfile [standard_output_file ${testfile}-lib.so]
diff --git a/gdb/testsuite/gdb.fortran/limited-length.exp b/gdb/testsuite/gdb.fortran/limited-length.exp
index 942344b..9c65d48 100644
--- a/gdb/testsuite/gdb.fortran/limited-length.exp
+++ b/gdb/testsuite/gdb.fortran/limited-length.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -80,7 +80,7 @@ with_test_prefix "with standard max-value size" {
# Set the max-value-size so we can only print 50 elements.
set elements 50
set elem_size [get_valueof "/d" "sizeof(large_1d_array(1))" "*unknown*"]
-gdb_test_no_output "set max-value-size [expr $elem_size * $elements]"
+gdb_test_no_output "set max-value-size [expr {$elem_size * $elements}]"
with_test_prefix "with reduced max-value size" {
gdb_test "print large_4d_array" \
diff --git a/gdb/testsuite/gdb.fortran/limited-length.f90 b/gdb/testsuite/gdb.fortran/limited-length.f90
index 5feb86a..0b30bf9 100644
--- a/gdb/testsuite/gdb.fortran/limited-length.f90
+++ b/gdb/testsuite/gdb.fortran/limited-length.f90
@@ -1,6 +1,6 @@
! This testcase is part of GDB, the GNU debugger.
!
-! Copyright 2023-2024 Free Software Foundation, Inc.
+! Copyright 2023-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/logical.exp b/gdb/testsuite/gdb.fortran/logical.exp
index 19992b6..6a9cf14 100644
--- a/gdb/testsuite/gdb.fortran/logical.exp
+++ b/gdb/testsuite/gdb.fortran/logical.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/logical.f90 b/gdb/testsuite/gdb.fortran/logical.f90
index c86e6b0..16735bd 100644
--- a/gdb/testsuite/gdb.fortran/logical.f90
+++ b/gdb/testsuite/gdb.fortran/logical.f90
@@ -1,4 +1,4 @@
-! Copyright 2010-2024 Free Software Foundation, Inc.
+! Copyright 2010-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/max-depth.exp b/gdb/testsuite/gdb.fortran/max-depth.exp
index 02541ba..8d96aa2 100644
--- a/gdb/testsuite/gdb.fortran/max-depth.exp
+++ b/gdb/testsuite/gdb.fortran/max-depth.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/max-depth.f90 b/gdb/testsuite/gdb.fortran/max-depth.f90
index 41df598..9cf2f51 100644
--- a/gdb/testsuite/gdb.fortran/max-depth.f90
+++ b/gdb/testsuite/gdb.fortran/max-depth.f90
@@ -1,4 +1,4 @@
-! Copyright 2019-2024 Free Software Foundation, Inc.
+! Copyright 2019-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/mixed-lang-stack.c b/gdb/testsuite/gdb.fortran/mixed-lang-stack.c
index af3898e..25d859b 100644
--- a/gdb/testsuite/gdb.fortran/mixed-lang-stack.c
+++ b/gdb/testsuite/gdb.fortran/mixed-lang-stack.c
@@ -1,4 +1,4 @@
-/* Copyright 2020-2024 Free Software Foundation, Inc.
+/* Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/mixed-lang-stack.cpp b/gdb/testsuite/gdb.fortran/mixed-lang-stack.cpp
index 10a2753..2b2c5de 100644
--- a/gdb/testsuite/gdb.fortran/mixed-lang-stack.cpp
+++ b/gdb/testsuite/gdb.fortran/mixed-lang-stack.cpp
@@ -1,4 +1,4 @@
-/* Copyright 2020-2024 Free Software Foundation, Inc.
+/* Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
index eef84da..e3b9fb5 100644
--- a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
+++ b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ require allow_fortran_tests
standard_testfile mixed-lang-stack.c mixed-lang-stack.cpp mixed-lang-stack.f90
if {[prepare_for_testing_full "failed to prepare" \
- [list ${binfile} {debug f90 additional_flags=-lstdc++} \
+ [list $testfile {debug f90 additional_flags=-lstdc++} \
$srcfile {debug} \
$srcfile2 {debug c++ additional_flags=-std=c++11} \
$srcfile3 {debug f90}]]} {
@@ -43,9 +43,9 @@ proc run_tests { lang } {
with_test_prefix "lang=${lang}" {
global binfile hex have_index
- clean_restart ${binfile}
+ clean_restart ${::testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/mixed-lang-stack.f90 b/gdb/testsuite/gdb.fortran/mixed-lang-stack.f90
index 5577e5e..dd33a37 100644
--- a/gdb/testsuite/gdb.fortran/mixed-lang-stack.f90
+++ b/gdb/testsuite/gdb.fortran/mixed-lang-stack.f90
@@ -1,4 +1,4 @@
-! Copyright 2020-2024 Free Software Foundation, Inc.
+! Copyright 2020-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/module.exp b/gdb/testsuite/gdb.fortran/module.exp
index df7ee3b..2496f66 100644
--- a/gdb/testsuite/gdb.fortran/module.exp
+++ b/gdb/testsuite/gdb.fortran/module.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}] }
# Test automatic language detection before the inferior starts. It tests the
# effect of expected:
-# (gdb) show language
+# (gdb) show language
# The current source language is "auto; currently fortran".
gdb_test "p modmany::var_i" " = 14" "stopped language detection"
@@ -131,6 +131,6 @@ gdb_test "show language" {The current source language is "(auto; currently )?for
# gcc-4.4.2: The main program is always $fmain in .symtab so "runto" above
# works. But DWARF DW_TAG_subprogram contains the name specified by
# the "program" Fortran statement.
-if [gdb_breakpoint "module"] {
+if {[gdb_breakpoint "module"]} {
pass "setting breakpoint at module"
}
diff --git a/gdb/testsuite/gdb.fortran/module.f90 b/gdb/testsuite/gdb.fortran/module.f90
index 33a252b..186bd1c 100644
--- a/gdb/testsuite/gdb.fortran/module.f90
+++ b/gdb/testsuite/gdb.fortran/module.f90
@@ -1,4 +1,4 @@
-! Copyright 2009-2024 Free Software Foundation, Inc.
+! Copyright 2009-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/multi-dim.exp b/gdb/testsuite/gdb.fortran/multi-dim.exp
index eda2d6a..0a719fe 100644
--- a/gdb/testsuite/gdb.fortran/multi-dim.exp
+++ b/gdb/testsuite/gdb.fortran/multi-dim.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug f90}
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.fortran/multi-dim.f90 b/gdb/testsuite/gdb.fortran/multi-dim.f90
index b3bcb59..1e5e298 100644
--- a/gdb/testsuite/gdb.fortran/multi-dim.f90
+++ b/gdb/testsuite/gdb.fortran/multi-dim.f90
@@ -1,4 +1,4 @@
-! Copyright 2011-2024 Free Software Foundation, Inc.
+! Copyright 2011-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/namelist.exp b/gdb/testsuite/gdb.fortran/namelist.exp
index c3e4f3b..fce6314 100644
--- a/gdb/testsuite/gdb.fortran/namelist.exp
+++ b/gdb/testsuite/gdb.fortran/namelist.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,8 +38,8 @@ gdb_continue_to_breakpoint "Display namelist"
# DW_TAG_namelist is supported starting gcc 4.9.
set supported [expr \
- [test_compiler_info {gfortran-*} f90] \
- && [gcc_major_version {gfortran-*} f90] >= 4.9]
+ {[test_compiler_info {gfortran-*} f90]
+ && [gcc_major_version {gfortran-*} f90] >= 4.9}]
if { $supported } {
gdb_test "ptype nml" \
"type = Type nml\r\n *$int :: a\r\n *$int :: b\r\n *End Type nml"
diff --git a/gdb/testsuite/gdb.fortran/namelist.f90 b/gdb/testsuite/gdb.fortran/namelist.f90
index eda7a65..7e90231 100644
--- a/gdb/testsuite/gdb.fortran/namelist.f90
+++ b/gdb/testsuite/gdb.fortran/namelist.f90
@@ -1,4 +1,4 @@
-! Copyright (C) 2021-2024 Free Software Foundation, Inc.
+! Copyright (C) 2021-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/nested-funcs-2.exp b/gdb/testsuite/gdb.fortran/nested-funcs-2.exp
index 72d87bc..a350e62 100644
--- a/gdb/testsuite/gdb.fortran/nested-funcs-2.exp
+++ b/gdb/testsuite/gdb.fortran/nested-funcs-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/nested-funcs-2.f90 b/gdb/testsuite/gdb.fortran/nested-funcs-2.f90
index c1f0a3f..af9e228 100644
--- a/gdb/testsuite/gdb.fortran/nested-funcs-2.f90
+++ b/gdb/testsuite/gdb.fortran/nested-funcs-2.f90
@@ -1,4 +1,4 @@
-! Copyright 2019-2024 Free Software Foundation, Inc.
+! Copyright 2019-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/nested-funcs.exp b/gdb/testsuite/gdb.fortran/nested-funcs.exp
index e08a40a..c92a8c1 100755
--- a/gdb/testsuite/gdb.fortran/nested-funcs.exp
+++ b/gdb/testsuite/gdb.fortran/nested-funcs.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This testcase is supposed to test DWARF static link which is usually
-# used together with nested functions.
+# used together with nested functions.
require allow_fortran_tests
diff --git a/gdb/testsuite/gdb.fortran/nested-funcs.f90 b/gdb/testsuite/gdb.fortran/nested-funcs.f90
index f052b32..0d17041 100755
--- a/gdb/testsuite/gdb.fortran/nested-funcs.f90
+++ b/gdb/testsuite/gdb.fortran/nested-funcs.f90
@@ -1,4 +1,4 @@
-! Copyright 2016-2024 Free Software Foundation, Inc.
+! Copyright 2016-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/oop_extend_type.exp b/gdb/testsuite/gdb.fortran/oop_extend_type.exp
index 7e87674..9f443d9 100755
--- a/gdb/testsuite/gdb.fortran/oop_extend_type.exp
+++ b/gdb/testsuite/gdb.fortran/oop_extend_type.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
perror "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/oop_extend_type.f90 b/gdb/testsuite/gdb.fortran/oop_extend_type.f90
index d626ce1..94eb233 100755
--- a/gdb/testsuite/gdb.fortran/oop_extend_type.f90
+++ b/gdb/testsuite/gdb.fortran/oop_extend_type.f90
@@ -1,4 +1,4 @@
-! Copyright 2022-2024 Free Software Foundation, Inc.
+! Copyright 2022-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp b/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp
index dfff519..47ca74a 100644
--- a/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp
+++ b/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/pointer-to-pointer.f90 b/gdb/testsuite/gdb.fortran/pointer-to-pointer.f90
index 5451dc3..212dca7 100644
--- a/gdb/testsuite/gdb.fortran/pointer-to-pointer.f90
+++ b/gdb/testsuite/gdb.fortran/pointer-to-pointer.f90
@@ -1,4 +1,4 @@
-! Copyright 2020-2024 Free Software Foundation, Inc.
+! Copyright 2020-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/pointers.exp b/gdb/testsuite/gdb.fortran/pointers.exp
index dafea39..3f39bd9 100644
--- a/gdb/testsuite/gdb.fortran/pointers.exp
+++ b/gdb/testsuite/gdb.fortran/pointers.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/pointers.f90 b/gdb/testsuite/gdb.fortran/pointers.f90
index 2b55c6a..7706509 100644
--- a/gdb/testsuite/gdb.fortran/pointers.f90
+++ b/gdb/testsuite/gdb.fortran/pointers.f90
@@ -1,4 +1,4 @@
-! Copyright 2019-2024 Free Software Foundation, Inc.
+! Copyright 2019-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/print-formatted.exp b/gdb/testsuite/gdb.fortran/print-formatted.exp
index 32506c5..7d11a3c 100644
--- a/gdb/testsuite/gdb.fortran/print-formatted.exp
+++ b/gdb/testsuite/gdb.fortran/print-formatted.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/print-formatted.f90 b/gdb/testsuite/gdb.fortran/print-formatted.f90
index 18b161d..fc57ffc 100644
--- a/gdb/testsuite/gdb.fortran/print-formatted.f90
+++ b/gdb/testsuite/gdb.fortran/print-formatted.f90
@@ -1,4 +1,4 @@
-! Copyright 2014-2024 Free Software Foundation, Inc.
+! Copyright 2014-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/print_type.exp b/gdb/testsuite/gdb.fortran/print_type.exp
index eeb8c3b..6d2457f 100755
--- a/gdb/testsuite/gdb.fortran/print_type.exp
+++ b/gdb/testsuite/gdb.fortran/print_type.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/printing-types.exp b/gdb/testsuite/gdb.fortran/printing-types.exp
index 54843c9..f4072f8 100644
--- a/gdb/testsuite/gdb.fortran/printing-types.exp
+++ b/gdb/testsuite/gdb.fortran/printing-types.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/printing-types.f90 b/gdb/testsuite/gdb.fortran/printing-types.f90
index 83f60a6..b101077 100644
--- a/gdb/testsuite/gdb.fortran/printing-types.f90
+++ b/gdb/testsuite/gdb.fortran/printing-types.f90
@@ -1,4 +1,4 @@
-! Copyright 2017-2024 Free Software Foundation, Inc.
+! Copyright 2017-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/ptr-indentation.exp b/gdb/testsuite/gdb.fortran/ptr-indentation.exp
index 66c1761..1671627 100644
--- a/gdb/testsuite/gdb.fortran/ptr-indentation.exp
+++ b/gdb/testsuite/gdb.fortran/ptr-indentation.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/ptr-indentation.f90 b/gdb/testsuite/gdb.fortran/ptr-indentation.f90
index fdd3a51..82502f8 100644
--- a/gdb/testsuite/gdb.fortran/ptr-indentation.f90
+++ b/gdb/testsuite/gdb.fortran/ptr-indentation.f90
@@ -1,4 +1,4 @@
-! Copyright 2017-2024 Free Software Foundation, Inc.
+! Copyright 2017-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
index ed11c61..cb63c5f 100644
--- a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
+++ b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/ptype-on-functions.f90 b/gdb/testsuite/gdb.fortran/ptype-on-functions.f90
index b25d1f8..6563dd0 100644
--- a/gdb/testsuite/gdb.fortran/ptype-on-functions.f90
+++ b/gdb/testsuite/gdb.fortran/ptype-on-functions.f90
@@ -1,4 +1,4 @@
-! Copyright 2019-2024 Free Software Foundation, Inc.
+! Copyright 2019-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/rank.exp b/gdb/testsuite/gdb.fortran/rank.exp
index 57e3154..1fe20c6 100644
--- a/gdb/testsuite/gdb.fortran/rank.exp
+++ b/gdb/testsuite/gdb.fortran/rank.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
@@ -50,7 +50,7 @@ while { $test_count < 500 } {
}
}
- if ($found_final_breakpoint) {
+ if {$found_final_breakpoint} {
break
}
diff --git a/gdb/testsuite/gdb.fortran/rank.f90 b/gdb/testsuite/gdb.fortran/rank.f90
index 6762fa2..3e5c5db 100644
--- a/gdb/testsuite/gdb.fortran/rank.f90
+++ b/gdb/testsuite/gdb.fortran/rank.f90
@@ -1,4 +1,4 @@
-! Copyright 2021-2024 Free Software Foundation, Inc.
+! Copyright 2021-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/shape.exp b/gdb/testsuite/gdb.fortran/shape.exp
index ccc68f3..4bcc2e7 100644
--- a/gdb/testsuite/gdb.fortran/shape.exp
+++ b/gdb/testsuite/gdb.fortran/shape.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
@@ -50,7 +50,7 @@ while { $test_count < 500 } {
}
}
- if ($found_final_breakpoint) {
+ if {$found_final_breakpoint} {
break
}
diff --git a/gdb/testsuite/gdb.fortran/shape.f90 b/gdb/testsuite/gdb.fortran/shape.f90
index 8bfd345..0d3c807 100644
--- a/gdb/testsuite/gdb.fortran/shape.f90
+++ b/gdb/testsuite/gdb.fortran/shape.f90
@@ -1,4 +1,4 @@
-! Copyright 2021-2024 Free Software Foundation, Inc.
+! Copyright 2021-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/short-circuit-argument-list.exp b/gdb/testsuite/gdb.fortran/short-circuit-argument-list.exp
index ef7db8b..ab0411a 100644
--- a/gdb/testsuite/gdb.fortran/short-circuit-argument-list.exp
+++ b/gdb/testsuite/gdb.fortran/short-circuit-argument-list.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -48,12 +48,12 @@ reset_called_flags
# a(x,y) .OR./.AND. a(a,b) correctly.
foreach_with_prefix truth_table_index {1 2 3 4} {
gdb_test "p truth_table($truth_table_index, 1) .OR. truth_table($truth_table_index, 2)" \
- "[expr $truth_table_index > 1 ? \".TRUE.\" : \".FALSE.\"]"
+ "[expr {$truth_table_index > 1 ? ".TRUE." : ".FALSE."}]"
}
foreach_with_prefix truth_table_index {1 2 3 4} {
gdb_test "p truth_table($truth_table_index, 1) .AND. truth_table($truth_table_index, 2)" \
- "[expr $truth_table_index > 3 ? \".TRUE.\" : \".FALSE.\"]"
+ "[expr {$truth_table_index > 3 ? ".TRUE." : ".FALSE."}]"
}
# Vary number of function arguments to skip.
@@ -78,14 +78,14 @@ with_test_prefix "nested call not skipped" {
gdb_test "p function_one_arg(.FALSE. .OR. function_no_arg())" \
" = .TRUE."
gdb_test "p calls" \
- " = \\\( function_no_arg_called = [expr $prime + 1], function_no_arg_false_called = $prime, function_one_arg_called = [expr $prime + 1], function_two_arg_called = $prime, function_array_called = $prime \\\)"
+ " = \\\( function_no_arg_called = [expr {$prime + 1}], function_no_arg_false_called = $prime, function_one_arg_called = [expr {$prime + 1}], function_two_arg_called = $prime, function_array_called = $prime \\\)"
}
with_test_prefix "nested call skipped" {
gdb_test "p function_one_arg(.TRUE. .OR. function_no_arg())" \
" = .TRUE."
gdb_test "p calls" \
- " = \\\( function_no_arg_called = [expr $prime + 1], function_no_arg_false_called = $prime, function_one_arg_called = [expr $prime + 2], function_two_arg_called = $prime, function_array_called = $prime \\\)"
+ " = \\\( function_no_arg_called = [expr {$prime + 1}], function_no_arg_false_called = $prime, function_one_arg_called = [expr {$prime + 2}], function_two_arg_called = $prime, function_array_called = $prime \\\)"
}
# Vary number of components in the expression to skip.
diff --git a/gdb/testsuite/gdb.fortran/short-circuit-argument-list.f90 b/gdb/testsuite/gdb.fortran/short-circuit-argument-list.f90
index 143d1e6..72ec2e2 100644
--- a/gdb/testsuite/gdb.fortran/short-circuit-argument-list.f90
+++ b/gdb/testsuite/gdb.fortran/short-circuit-argument-list.f90
@@ -1,4 +1,4 @@
-! Copyright 2018-2024 Free Software Foundation, Inc.
+! Copyright 2018-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/size.exp b/gdb/testsuite/gdb.fortran/size.exp
index 925aeed..8cd702d 100644
--- a/gdb/testsuite/gdb.fortran/size.exp
+++ b/gdb/testsuite/gdb.fortran/size.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
@@ -55,7 +55,7 @@ while { $test_count < 600 } {
}
}
- if ($found_dealloc_breakpoint) {
+ if {$found_dealloc_breakpoint} {
break
}
diff --git a/gdb/testsuite/gdb.fortran/size.f90 b/gdb/testsuite/gdb.fortran/size.f90
index ec707a3..b7a2c61 100644
--- a/gdb/testsuite/gdb.fortran/size.f90
+++ b/gdb/testsuite/gdb.fortran/size.f90
@@ -1,4 +1,4 @@
-! Copyright 2021-2024 Free Software Foundation, Inc.
+! Copyright 2021-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/sizeof.exp b/gdb/testsuite/gdb.fortran/sizeof.exp
index be59a37..d7eeb38 100644
--- a/gdb/testsuite/gdb.fortran/sizeof.exp
+++ b/gdb/testsuite/gdb.fortran/sizeof.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
@@ -60,7 +60,7 @@ while { $test_count < 200 } {
}
}
- if ($found_final_breakpoint) {
+ if {$found_final_breakpoint} {
break
}
diff --git a/gdb/testsuite/gdb.fortran/sizeof.f90 b/gdb/testsuite/gdb.fortran/sizeof.f90
index b8490a1..8b7a6c0 100644
--- a/gdb/testsuite/gdb.fortran/sizeof.f90
+++ b/gdb/testsuite/gdb.fortran/sizeof.f90
@@ -1,4 +1,4 @@
-! Copyright 2024 Free Software Foundation, Inc.
+! Copyright 2024-2025 Free Software Foundation, Inc.
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/string-types.exp b/gdb/testsuite/gdb.fortran/string-types.exp
index 35b8654..b8a15ff 100644
--- a/gdb/testsuite/gdb.fortran/string-types.exp
+++ b/gdb/testsuite/gdb.fortran/string-types.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/string-types.f90 b/gdb/testsuite/gdb.fortran/string-types.f90
index fd94949..9f91d28 100644
--- a/gdb/testsuite/gdb.fortran/string-types.f90
+++ b/gdb/testsuite/gdb.fortran/string-types.f90
@@ -1,4 +1,4 @@
-! Copyright 2022-2024 Free Software Foundation, Inc.
+! Copyright 2022-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/subarray.exp b/gdb/testsuite/gdb.fortran/subarray.exp
index 70a7a23..cfa9d7a 100644
--- a/gdb/testsuite/gdb.fortran/subarray.exp
+++ b/gdb/testsuite/gdb.fortran/subarray.exp
@@ -1,4 +1,4 @@
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/subarray.f b/gdb/testsuite/gdb.fortran/subarray.f
index 14ba3bc..2ced37c 100644
--- a/gdb/testsuite/gdb.fortran/subarray.f
+++ b/gdb/testsuite/gdb.fortran/subarray.f
@@ -1,4 +1,4 @@
-c Copyright 2005-2024 Free Software Foundation, Inc.
+c Copyright 2005-2025 Free Software Foundation, Inc.
c This program is free software; you can redistribute it and/or modify
c it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/type-kinds.exp b/gdb/testsuite/gdb.fortran/type-kinds.exp
index a6f2aa4..7c98e7d 100644
--- a/gdb/testsuite/gdb.fortran/type-kinds.exp
+++ b/gdb/testsuite/gdb.fortran/type-kinds.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/type.f90 b/gdb/testsuite/gdb.fortran/type.f90
index 1b0e89c..00d8a7b 100644
--- a/gdb/testsuite/gdb.fortran/type.f90
+++ b/gdb/testsuite/gdb.fortran/type.f90
@@ -1,4 +1,4 @@
-! Copyright 2013-2024 Free Software Foundation, Inc.
+! Copyright 2013-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/types.exp b/gdb/testsuite/gdb.fortran/types.exp
index 494ed1e..03bc2ce 100644
--- a/gdb/testsuite/gdb.fortran/types.exp
+++ b/gdb/testsuite/gdb.fortran/types.exp
@@ -1,4 +1,4 @@
-# Copyright 1994-2024 Free Software Foundation, Inc.
+# Copyright 1994-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ proc test_integer_literal_types_accepted {} {
# Test various decimal values.
# Should be integer*4 probably.
- gdb_test "pt 123" "type = int"
+ gdb_test "pt 123" "type = int"
}
proc test_character_literal_types_accepted {} {
diff --git a/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp b/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp
index 01717b0..b766e1d 100644
--- a/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp
+++ b/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-array.exp b/gdb/testsuite/gdb.fortran/vla-array.exp
index 4ed2de7..7c2d48d 100644
--- a/gdb/testsuite/gdb.fortran/vla-array.exp
+++ b/gdb/testsuite/gdb.fortran/vla-array.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
untested "could not run to main"
return -1
}
@@ -34,12 +34,12 @@ gdb_continue_to_breakpoint "arr_vla1-print"
# GFortran emits DW_TAG_structure_type for strings and it has only
# DW_AT_declaration tag. This results in <incomplete type> in gdb.
-if [test_compiler_info "gfortran*" f90] { setup_xfail *-*-* gcc/101826 }
+if {[test_compiler_info "gfortran*" f90]} { setup_xfail *-*-* gcc/101826 }
gdb_test "print arr_vla1" \
" = \\\('vlaaryvlaary', 'vlaaryvlaary', 'vlaaryvlaary', 'vlaaryvlaary', 'vlaaryvlaary'\\\)" \
"print vla string array"
-if [test_compiler_info "gfortran*" f90] { setup_xfail *-*-* gcc/101826 }
+if {[test_compiler_info "gfortran*" f90]} { setup_xfail *-*-* gcc/101826 }
gdb_test "ptype arr_vla1" \
"type = character\\*12 \\(5\\)" \
"print variable length string array type"
diff --git a/gdb/testsuite/gdb.fortran/vla-array.f90 b/gdb/testsuite/gdb.fortran/vla-array.f90
index 56dd85b..8f62f22 100644
--- a/gdb/testsuite/gdb.fortran/vla-array.f90
+++ b/gdb/testsuite/gdb.fortran/vla-array.f90
@@ -1,4 +1,4 @@
-! Copyright 2024 Free Software Foundation, Inc.
+! Copyright 2024-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/vla-datatypes.exp b/gdb/testsuite/gdb.fortran/vla-datatypes.exp
index 8227f23..6f2bb3a 100644
--- a/gdb/testsuite/gdb.fortran/vla-datatypes.exp
+++ b/gdb/testsuite/gdb.fortran/vla-datatypes.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
# check that all fortran standard datatypes will be
# handled correctly when using as VLA's
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-datatypes.f90 b/gdb/testsuite/gdb.fortran/vla-datatypes.f90
index 776d4df..eff3f2c 100644
--- a/gdb/testsuite/gdb.fortran/vla-datatypes.f90
+++ b/gdb/testsuite/gdb.fortran/vla-datatypes.f90
@@ -1,4 +1,4 @@
-! Copyright 2015-2024 Free Software Foundation, Inc.
+! Copyright 2015-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/vla-history.exp b/gdb/testsuite/gdb.fortran/vla-history.exp
index 28bbba1..6dcc31c 100644
--- a/gdb/testsuite/gdb.fortran/vla-history.exp
+++ b/gdb/testsuite/gdb.fortran/vla-history.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
index 6f25560..9f63e60 100644
--- a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
+++ b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp b/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp
index 78b711b..6809d8c 100644
--- a/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp
+++ b/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp
index 446ef72..4c72d62 100644
--- a/gdb/testsuite/gdb.fortran/vla-ptype.exp
+++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
index b8ee9bd..ede677f 100644
--- a/gdb/testsuite/gdb.fortran/vla-sizeof.exp
+++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-sub.f90 b/gdb/testsuite/gdb.fortran/vla-sub.f90
index 04ed77a..f283e9a 100644
--- a/gdb/testsuite/gdb.fortran/vla-sub.f90
+++ b/gdb/testsuite/gdb.fortran/vla-sub.f90
@@ -1,4 +1,4 @@
-! Copyright 2015-2024 Free Software Foundation, Inc.
+! Copyright 2015-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/vla-type.exp b/gdb/testsuite/gdb.fortran/vla-type.exp
index d531205..b560d46 100755
--- a/gdb/testsuite/gdb.fortran/vla-type.exp
+++ b/gdb/testsuite/gdb.fortran/vla-type.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/vla-type.f90 b/gdb/testsuite/gdb.fortran/vla-type.f90
index c821bf8..1dbea6b 100755
--- a/gdb/testsuite/gdb.fortran/vla-type.f90
+++ b/gdb/testsuite/gdb.fortran/vla-type.f90
@@ -1,4 +1,4 @@
-! Copyright 2016-2024 Free Software Foundation, Inc.
+! Copyright 2016-2025 Free Software Foundation, Inc.
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp b/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp
index 64e86ac..7cd9cd8 100644
--- a/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp
+++ b/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp b/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp
index a717a45..ef40dff 100644
--- a/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp
+++ b/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub.exp b/gdb/testsuite/gdb.fortran/vla-value-sub.exp
index 23ee539..566125e 100644
--- a/gdb/testsuite/gdb.fortran/vla-value-sub.exp
+++ b/gdb/testsuite/gdb.fortran/vla-value-sub.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp
index a3f50d1..687b14c 100644
--- a/gdb/testsuite/gdb.fortran/vla-value.exp
+++ b/gdb/testsuite/gdb.fortran/vla-value.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla.f90 b/gdb/testsuite/gdb.fortran/vla.f90
index 8348814..3257c74 100644
--- a/gdb/testsuite/gdb.fortran/vla.f90
+++ b/gdb/testsuite/gdb.fortran/vla.f90
@@ -1,4 +1,4 @@
-! Copyright 2015-2024 Free Software Foundation, Inc.
+! Copyright 2015-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp
index a3c5584..8891eac 100644
--- a/gdb/testsuite/gdb.fortran/whatis_type.exp
+++ b/gdb/testsuite/gdb.fortran/whatis_type.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![fortran_runto_main] {
+if {![fortran_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.gdb/index-file.exp b/gdb/testsuite/gdb.gdb/index-file.exp
index c30f417..5229446 100644
--- a/gdb/testsuite/gdb.gdb/index-file.exp
+++ b/gdb/testsuite/gdb.gdb/index-file.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,9 +30,17 @@ if { $filename eq "" } {
return -1
}
+# If FILENAME is a libtool wrapper, then we need to get the path of the real
+# executable.
+set filename [selftest_libtool_get_real_gdb_executable $filename]
+if { $filename eq "" } {
+ return -1
+}
+
with_timeout_factor $timeout_factor {
# Start GDB, load FILENAME.
- clean_restart $filename
+ clean_restart
+ gdb_load $filename
}
# Record how many worker threads GDB is using.
@@ -99,7 +107,7 @@ proc check_symbol_table_usage { filename } {
_ _ _ symbol_table_offset shortcut_offset
# The length of the symbol hash table (in entries).
- set len [expr ($shortcut_offset - $symbol_table_offset) / 8]
+ set len [expr {($shortcut_offset - $symbol_table_offset) / 8}]
# Now walk the hash table and count how many entries are in use.
set offset $symbol_table_offset
@@ -119,7 +127,7 @@ proc check_symbol_table_usage { filename } {
close $fp
# Calculate how full the cache is.
- set pct [expr (100 * double($count)) / $len]
+ set pct [expr {(100 * double($count)) / $len}]
# Write our results out to the gdb.log.
verbose -log "Hash table size: $len"
@@ -145,7 +153,7 @@ if { $worker_threads > 1 } {
clean_restart
# Adjust the number of threads to use.
- set reduced_threads [expr $worker_threads / 2]
+ set reduced_threads [expr {$worker_threads / 2}]
gdb_test_no_output "maint set worker-threads $reduced_threads"
with_timeout_factor $timeout_factor {
diff --git a/gdb/testsuite/gdb.gdb/python-helper.cc b/gdb/testsuite/gdb.gdb/python-helper.cc
index 7f4a147..06f706c 100644
--- a/gdb/testsuite/gdb.gdb/python-helper.cc
+++ b/gdb/testsuite/gdb.gdb/python-helper.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.gdb/python-helper.exp b/gdb/testsuite/gdb.gdb/python-helper.exp
index d136d68..33243c9 100644
--- a/gdb/testsuite/gdb.gdb/python-helper.exp
+++ b/gdb/testsuite/gdb.gdb/python-helper.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -264,13 +264,31 @@ proc test_python_helper {} {
gdb_test -prompt $outer_prompt_re "print varobj_table" \
"htab_t with ${::decimal} elements"
+ set inferior_list_supported 1
+ set inferior_list_unsupported_re "type = intrusive_list"
+ gdb_test_multiple "what inferior_list" "" -prompt $outer_prompt_re {
+ -re -wrap $inferior_list_unsupported_re {
+ set inferior_list_supported 0
+ pass $gdb_test_name
+ }
+ -re -wrap "" {
+ pass $gdb_test_name
+ }
+ }
+
# Test the intrusive_list pretty-printer. A bug occurred in the
# pretty-printer for lists with more than one element. Verify that
# we see both elements of the inferior_list list being printed.
- gdb_test -prompt $outer_prompt_re "print inferior_list" "intrusive list of inferior = {.*, num = 1,.*, num = 2,.*}"
+ set test "print inferior_list"
+ if { $inferior_list_supported } {
+ gdb_test -prompt $outer_prompt_re $test \
+ "intrusive list of inferior = {.*, num = 1,.*, num = 2,.*}"
+ } else {
+ unsupported $test
+ }
return 0
}
# Use the self-test framework to run the test.
-do_self_tests captured_main test_python_helper
+do_self_tests test_python_helper
diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
index 1984f47..7fa320e 100644
--- a/gdb/testsuite/gdb.gdb/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -1,4 +1,4 @@
-# Copyright 1988-2024 Free Software Foundation, Inc.
+# Copyright 1988-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -56,7 +56,7 @@ proc test_with_self { } {
}
# start the "xgdb" process
- if [target_info exists gdb,noinferiorio] {
+ if {[target_info exists gdb,noinferiorio]} {
# With no way to interact with the inferior GDB, all we can do
# is let it run.
send_gdb "continue\n"
@@ -98,7 +98,7 @@ proc test_with_self { } {
}
# kill the xgdb process
- if ![target_info exists gdb,nointerrupts] {
+ if {![target_info exists gdb,nointerrupts]} {
set description "send ^C to child process"
send_gdb "\003"
# "Thread 1" is displayed iff Guile support is linked in.
@@ -147,7 +147,7 @@ proc test_with_self { } {
# Switch back to the GDB thread if Guile support is linked in.
# "signal SIGINT" could also switch the current thread.
gdb_test "thread 1" {\[Switching to thread 1 .*\].*}
-
+
# get a stack trace
#
# This fails on some linux systems for unknown reasons. On the
@@ -167,5 +167,5 @@ proc test_with_self { } {
save_vars { INTERNAL_GDBFLAGS } {
set INTERNAL_GDBFLAGS [string map {"-q" ""} $INTERNAL_GDBFLAGS]
- do_self_tests captured_main test_with_self
+ do_self_tests test_with_self
}
diff --git a/gdb/testsuite/gdb.gdb/unittest.c b/gdb/testsuite/gdb.gdb/unittest.c
index b1ce99c..a21818d 100644
--- a/gdb/testsuite/gdb.gdb/unittest.c
+++ b/gdb/testsuite/gdb.gdb/unittest.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.gdb/unittest.exp b/gdb/testsuite/gdb.gdb/unittest.exp
index e154c04..500389d 100644
--- a/gdb/testsuite/gdb.gdb/unittest.exp
+++ b/gdb/testsuite/gdb.gdb/unittest.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -63,7 +63,7 @@ proc run_selftests { binfile } {
gdb_exit
gdb_start
} else {
- clean_restart ${binfile}
+ clean_restart ${::testfile}
}
if { [is_remote host] } {
@@ -115,7 +115,7 @@ if { $self_tests_enabled && ![is_remote host] } {
# initialization order of GDB.
with_test_prefix "reversed initialization" {
save_vars { env(GDB_REVERSE_INIT_FUNCTIONS) } {
- if [info exists env(GDB_REVERSE_INIT_FUNCTIONS)] {
+ if {[info exists env(GDB_REVERSE_INIT_FUNCTIONS)]} {
unset env(GDB_REVERSE_INIT_FUNCTIONS)
} else {
set env(GDB_REVERSE_INIT_FUNCTIONS) 1
diff --git a/gdb/testsuite/gdb.go/basic-types.exp b/gdb/testsuite/gdb.go/basic-types.exp
index 1ba84fa..53ce4fa 100644
--- a/gdb/testsuite/gdb.go/basic-types.exp
+++ b/gdb/testsuite/gdb.go/basic-types.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ require allow_go_tests
proc test_integer_literal_types_accepted {} {
# Test various decimal values.
- gdb_test "pt 123" "type = int"
+ gdb_test "pt 123" "type = int"
gdb_test "pt void(42)" "type = void"
gdb_test "pt byte(42)" "type = uint8"
@@ -102,7 +102,7 @@ proc test_complex_literal_types_accepted {} {
clean_restart
-if [set_lang_go] {
+if {[set_lang_go]} {
test_integer_literal_types_accepted
test_logical_literal_types_accepted
test_character_literal_types_accepted
diff --git a/gdb/testsuite/gdb.go/chan.exp b/gdb/testsuite/gdb.go/chan.exp
index 0e5a2b8..7fb4cbe 100644
--- a/gdb/testsuite/gdb.go/chan.exp
+++ b/gdb/testsuite/gdb.go/chan.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.go/global-local-var-shadow.exp b/gdb/testsuite/gdb.go/global-local-var-shadow.exp
index 328cc24..1d3189e 100644
--- a/gdb/testsuite/gdb.go/global-local-var-shadow.exp
+++ b/gdb/testsuite/gdb.go/global-local-var-shadow.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.go/handcall.exp b/gdb/testsuite/gdb.go/handcall.exp
index 9bee367..0857fcd 100644
--- a/gdb/testsuite/gdb.go/handcall.exp
+++ b/gdb/testsuite/gdb.go/handcall.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.go/hello.exp b/gdb/testsuite/gdb.go/hello.exp
index c1eb87e..f90b846 100644
--- a/gdb/testsuite/gdb.go/hello.exp
+++ b/gdb/testsuite/gdb.go/hello.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.go/integers.exp b/gdb/testsuite/gdb.go/integers.exp
index 7837542..50ea9a8 100644
--- a/gdb/testsuite/gdb.go/integers.exp
+++ b/gdb/testsuite/gdb.go/integers.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,9 +44,9 @@ gdb_test "print i" ".* = 0" "print i before assigned to 1"
gdb_test "next" "i = 1" "next to 'i = 1' line"
gdb_test "next" "j = 2" "next to 'j = 2' line"
-# At that point,
+# At that point,
# i should be equal to 1
-gdb_test "print i" " = 1"
+gdb_test "print i" " = 1"
# but j should still be equal to zero
gdb_test "print j" " = 0" "test j value before assignment"
diff --git a/gdb/testsuite/gdb.go/max-depth.exp b/gdb/testsuite/gdb.go/max-depth.exp
index df136e3..e981959 100644
--- a/gdb/testsuite/gdb.go/max-depth.exp
+++ b/gdb/testsuite/gdb.go/max-depth.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.go/max-depth.go b/gdb/testsuite/gdb.go/max-depth.go
index f917cb5..50ed686 100644
--- a/gdb/testsuite/gdb.go/max-depth.go
+++ b/gdb/testsuite/gdb.go/max-depth.go
@@ -1,4 +1,4 @@
-// Copyright 2019-2024 Free Software Foundation, Inc.
+// Copyright 2019-2025 Free Software Foundation, Inc.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.go/methods.exp b/gdb/testsuite/gdb.go/methods.exp
index 6a42d34..6049440 100644
--- a/gdb/testsuite/gdb.go/methods.exp
+++ b/gdb/testsuite/gdb.go/methods.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.go/no-package.exp b/gdb/testsuite/gdb.go/no-package.exp
index 6737092..50a9ea2 100644
--- a/gdb/testsuite/gdb.go/no-package.exp
+++ b/gdb/testsuite/gdb.go/no-package.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.go/package.exp b/gdb/testsuite/gdb.go/package.exp
index f1640a8..180b48a 100644
--- a/gdb/testsuite/gdb.go/package.exp
+++ b/gdb/testsuite/gdb.go/package.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${testfile}2.go" "${binfile}2.o" object
untested "failed to compile"
return -1
}
-
+
if { [gdb_compile "${srcdir}/${subdir}/${testfile}1.go ${binfile}2.o" "${binfile}" executable "debug go libdir=[standard_output_file {}]"] != "" } {
untested "failed to compile"
return -1
diff --git a/gdb/testsuite/gdb.go/print.exp b/gdb/testsuite/gdb.go/print.exp
index 20ab041..a02b746 100644
--- a/gdb/testsuite/gdb.go/print.exp
+++ b/gdb/testsuite/gdb.go/print.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@ proc test_float_rejected {} {
clean_restart
-if [set_lang_go] {
+if {[set_lang_go]} {
test_float_accepted
test_float_rejected
} else {
diff --git a/gdb/testsuite/gdb.go/strings.exp b/gdb/testsuite/gdb.go/strings.exp
index 50e68c8..0aa6807 100644
--- a/gdb/testsuite/gdb.go/strings.exp
+++ b/gdb/testsuite/gdb.go/strings.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.go/types.exp b/gdb/testsuite/gdb.go/types.exp
index cc0c9ca..7a9dddd 100644
--- a/gdb/testsuite/gdb.go/types.exp
+++ b/gdb/testsuite/gdb.go/types.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.go/unsafe.exp b/gdb/testsuite/gdb.go/unsafe.exp
index 04f2141..74cf3be 100644
--- a/gdb/testsuite/gdb.go/unsafe.exp
+++ b/gdb/testsuite/gdb.go/unsafe.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/guile.exp b/gdb/testsuite/gdb.guile/guile.exp
index 7c8fb18..bd25d5f 100644
--- a/gdb/testsuite/gdb.guile/guile.exp
+++ b/gdb/testsuite/gdb.guile/guile.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-arch.c b/gdb/testsuite/gdb.guile/scm-arch.c
index 5b58959..f2a876d 100644
--- a/gdb/testsuite/gdb.guile/scm-arch.c
+++ b/gdb/testsuite/gdb.guile/scm-arch.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-arch.exp b/gdb/testsuite/gdb.guile/scm-arch.exp
index 2008683..752c2d8 100644
--- a/gdb/testsuite/gdb.guile/scm-arch.exp
+++ b/gdb/testsuite/gdb.guile/scm-arch.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return
}
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-block.c b/gdb/testsuite/gdb.guile/scm-block.c
index 03830c6..412a08a 100644
--- a/gdb/testsuite/gdb.guile/scm-block.c
+++ b/gdb/testsuite/gdb.guile/scm-block.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-block.exp b/gdb/testsuite/gdb.guile/scm-block.exp
index dcd0de6..65e2275 100644
--- a/gdb/testsuite/gdb.guile/scm-block.exp
+++ b/gdb/testsuite/gdb.guile/scm-block.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-breakpoint.c b/gdb/testsuite/gdb.guile/scm-breakpoint.c
index e5b7700..8ad3cd2 100644
--- a/gdb/testsuite/gdb.guile/scm-breakpoint.c
+++ b/gdb/testsuite/gdb.guile/scm-breakpoint.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-breakpoint.exp b/gdb/testsuite/gdb.guile/scm-breakpoint.exp
index 73e2413..3b90d99 100644
--- a/gdb/testsuite/gdb.guile/scm-breakpoint.exp
+++ b/gdb/testsuite/gdb.guile/scm-breakpoint.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ proc_with_prefix test_bkpt_basic { } {
# Start with a fresh gdb.
clean_restart ${testfile}
- if ![gdb_guile_runto_main] {
+ if {![gdb_guile_runto_main]} {
return
}
@@ -65,7 +65,7 @@ proc_with_prefix test_bkpt_basic { } {
"scm-breakpoint\.c:${mult_line}*" \
"check multiply breakpoint location"
- # Check hit and ignore counts.
+ # Check hit and ignore counts.
gdb_test "guile (print (breakpoint-hit-count mult-bkpt))" \
"= 1" "check multiply breakpoint hit count"
gdb_scm_test_silent_cmd "guile (set-breakpoint-ignore-count! mult-bkpt 4)" \
@@ -105,7 +105,7 @@ proc_with_prefix test_bkpt_deletion { } {
# Start with a fresh gdb.
clean_restart ${testfile}
- if ![gdb_guile_runto_main] {
+ if {![gdb_guile_runto_main]} {
return
}
@@ -141,7 +141,7 @@ proc_with_prefix test_bkpt_cond_and_cmds { } {
# Start with a fresh gdb.
clean_restart ${testfile}
- if ![gdb_guile_runto_main] {
+ if {![gdb_guile_runto_main]} {
return
}
@@ -188,7 +188,7 @@ proc_with_prefix test_bkpt_invisible { } {
# Start with a fresh gdb.
clean_restart ${testfile}
- if ![gdb_guile_runto_main] {
+ if {![gdb_guile_runto_main]} {
return
}
@@ -238,10 +238,10 @@ proc_with_prefix test_watchpoints { } {
clean_restart ${testfile}
# Disable hardware watchpoints if necessary.
- if [target_info exists gdb,no_hardware_watchpoints] {
+ if {[target_info exists gdb,no_hardware_watchpoints]} {
gdb_test_no_output "set can-use-hw-watchpoints 0" ""
}
- if ![gdb_guile_runto_main] {
+ if {![gdb_guile_runto_main]} {
return
}
@@ -273,10 +273,10 @@ proc_with_prefix test_bkpt_internal { } {
clean_restart ${testfile}
# Disable hardware watchpoints if necessary.
- if [target_info exists gdb,no_hardware_watchpoints] {
+ if {[target_info exists gdb,no_hardware_watchpoints]} {
gdb_test_no_output "set can-use-hw-watchpoints 0" ""
}
- if ![gdb_guile_runto_main] {
+ if {![gdb_guile_runto_main]} {
return
}
@@ -304,10 +304,10 @@ proc_with_prefix test_bkpt_eval_funcs { } {
clean_restart ${testfile}
# Disable hardware watchpoints if necessary.
- if [target_info exists gdb,no_hardware_watchpoints] {
+ if {[target_info exists gdb,no_hardware_watchpoints]} {
gdb_test_no_output "set can-use-hw-watchpoints 0" ""
}
- if ![gdb_guile_runto_main] {
+ if {![gdb_guile_runto_main]} {
return
}
@@ -451,7 +451,7 @@ proc_with_prefix test_bkpt_registration {} {
# Start with a fresh gdb.
clean_restart ${testfile}
- if ![gdb_guile_runto_main] {
+ if {![gdb_guile_runto_main]} {
return
}
@@ -490,7 +490,7 @@ proc_with_prefix test_bkpt_temporary { } {
# Start with a fresh gdb.
clean_restart ${testfile}
- if ![gdb_guile_runto_main] {
+ if {![gdb_guile_runto_main]} {
return 0
}
delete_breakpoints
@@ -556,7 +556,7 @@ proc_with_prefix test_catchpoints {} {
# Start with a fresh gdb.
clean_restart ${testfile}
- if ![gdb_guile_runto_main] {
+ if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-cmd.c b/gdb/testsuite/gdb.guile/scm-cmd.c
index c18c92a..6c4357c 100644
--- a/gdb/testsuite/gdb.guile/scm-cmd.c
+++ b/gdb/testsuite/gdb.guile/scm-cmd.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-cmd.exp b/gdb/testsuite/gdb.guile/scm-cmd.exp
index f019397..36abb00 100644
--- a/gdb/testsuite/gdb.guile/scm-cmd.exp
+++ b/gdb/testsuite/gdb.guile/scm-cmd.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return
}
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
@@ -71,6 +71,65 @@ gdb_test_multiline "input subcommand" \
gdb_test "prefix-cmd subcmd ugh" "subcmd output, arg = ugh" "call subcmd"
+# Create a sub-command using a partial, but still unique, prefix.
+
+gdb_test_multiline "sub-command using partial prefix" \
+ "guile" "" \
+ "(register-command! (make-command \"prefix subcmd2\"" "" \
+ " #:command-class COMMAND_OBSCURE" "" \
+ " #:invoke (lambda (self arg from-tty)" "" \
+ " (display (format #f \"subcmd2 output, arg = ~a\\n\" arg)))))" "" \
+ "end" ""
+
+gdb_test "prefix-cmd subcmd2 ugh" "subcmd2 output, arg = ugh" "call subcmd2"
+
+# Now create a second prefix, similar to the first.
+
+gdb_test_multiline "create prefix-xxx prefix command" \
+ "guile" "" \
+ "(register-command! (make-command \"prefix-xxx\"" "" \
+ " #:command-class COMMAND_OBSCURE" "" \
+ " #:completer-class COMPLETE_NONE" "" \
+ " #:prefix? #t))" "" \
+ "end" ""
+
+# Now create a sub-command using an ambiguous prefix.
+
+gdb_test_multiline "sub-command using ambiguous partial prefix" \
+ "guile" "" \
+ "(register-command! (make-command \"prefix subcmd3\"" "" \
+ " #:command-class COMMAND_OBSCURE" "" \
+ " #:invoke (lambda (self arg from-tty)" "" \
+ " (display (format #f \"subcmd3 output, arg = ~a\\n\" arg)))))" "" \
+ "end" \
+ [multi_line \
+ "Out of range: could not find command prefix 'prefix' in position 1: \"prefix subcmd3\"" \
+ "Error while executing Scheme code\\."]
+
+# Check for errors when creating a command with an unknown prefix.
+
+gdb_test_multiline "try to create 'unknown-prefix subcmd'" \
+ "guile" "" \
+ "(register-command! (make-command \"unknown-prefix subcmd\"" "" \
+ " #:command-class COMMAND_OBSCURE" "" \
+ " #:invoke (lambda (self arg from-tty)" "" \
+ " (display \"called unknown-prefix subcmd\"))))" "" \
+ "end" \
+ [multi_line \
+ "Out of range: could not find command prefix 'unknown-prefix' in position 1: \"unknown-prefix subcmd\"" \
+ "Error while executing Scheme code\\."]
+
+gdb_test_multiline "try to create 'prefix-cmd unknown-prefix subcmd'" \
+ "guile" "" \
+ "(register-command! (make-command \"prefix-cmd unknown-prefix subcmd\"" "" \
+ " #:command-class COMMAND_OBSCURE" "" \
+ " #:invoke (lambda (self arg from-tty)" "" \
+ " (display \"called prefix-cmd unknown-prefix subcmd\"))))" "" \
+ "end" \
+ [multi_line \
+ "Out of range: could not find command prefix 'prefix-cmd unknown-prefix' in position 1: \"prefix-cmd unknown-prefix subcmd\"" \
+ "Error while executing Scheme code\\."]
+
# Test a subcommand in an existing GDB prefix.
gdb_test_multiline "input new subcommand" \
diff --git a/gdb/testsuite/gdb.guile/scm-color.exp b/gdb/testsuite/gdb.guile/scm-color.exp
index 9fd7f38..4c6a9c2 100644
--- a/gdb/testsuite/gdb.guile/scm-color.exp
+++ b/gdb/testsuite/gdb.guile/scm-color.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,8 +19,12 @@
load_lib gdb-guile.exp
require allow_guile_tests
+require {!is_remote host}
-clean_restart
+# Start GDB with styling support.
+with_ansi_styling_terminal {
+ clean_restart
+}
gdb_install_guile_utils
gdb_install_guile_module
@@ -108,3 +112,8 @@ gdb_test [concat "guile " \
"\033\\\[31m\033\\\[42mred on green\033\\\[49m red on default\033\\\[39m" \
"escape sequences"
+# Ensure that turning styling off means no escape sequences.
+gdb_test_no_output "set style enabled off"
+gdb_test_no_output "guile (display (color-escape-sequence c_red #t))"
+gdb_test_no_output "guile (display (color-escape-sequence c_red #f))"
+gdb_test_no_output "set style enabled on"
diff --git a/gdb/testsuite/gdb.guile/scm-disasm.c b/gdb/testsuite/gdb.guile/scm-disasm.c
index 5b58959..f2a876d 100644
--- a/gdb/testsuite/gdb.guile/scm-disasm.c
+++ b/gdb/testsuite/gdb.guile/scm-disasm.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-disasm.exp b/gdb/testsuite/gdb.guile/scm-disasm.exp
index 68c1911..bd551ad 100644
--- a/gdb/testsuite/gdb.guile/scm-disasm.exp
+++ b/gdb/testsuite/gdb.guile/scm-disasm.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return
}
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-equal.c b/gdb/testsuite/gdb.guile/scm-equal.c
index 468d757..7101960 100644
--- a/gdb/testsuite/gdb.guile/scm-equal.c
+++ b/gdb/testsuite/gdb.guile/scm-equal.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-equal.exp b/gdb/testsuite/gdb.guile/scm-equal.exp
index 24ad1d0..2a87139 100644
--- a/gdb/testsuite/gdb.guile/scm-equal.exp
+++ b/gdb/testsuite/gdb.guile/scm-equal.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return
}
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-error-1.scm b/gdb/testsuite/gdb.guile/scm-error-1.scm
index 9c484de..16a8956 100644
--- a/gdb/testsuite/gdb.guile/scm-error-1.scm
+++ b/gdb/testsuite/gdb.guile/scm-error-1.scm
@@ -1,4 +1,4 @@
-;; Copyright (C) 2014-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2025 Free Software Foundation, Inc.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-error-2.scm b/gdb/testsuite/gdb.guile/scm-error-2.scm
index 79c343b..a02add5 100644
--- a/gdb/testsuite/gdb.guile/scm-error-2.scm
+++ b/gdb/testsuite/gdb.guile/scm-error-2.scm
@@ -1,4 +1,4 @@
-;; Copyright (C) 2014-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2025 Free Software Foundation, Inc.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-error.exp b/gdb/testsuite/gdb.guile/scm-error.exp
index fad7d50..824700a 100644
--- a/gdb/testsuite/gdb.guile/scm-error.exp
+++ b/gdb/testsuite/gdb.guile/scm-error.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-frame-args.c b/gdb/testsuite/gdb.guile/scm-frame-args.c
index f67fe6a..057f99f 100644
--- a/gdb/testsuite/gdb.guile/scm-frame-args.c
+++ b/gdb/testsuite/gdb.guile/scm-frame-args.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-frame-args.exp b/gdb/testsuite/gdb.guile/scm-frame-args.exp
index f4753f3..9c1e831 100644
--- a/gdb/testsuite/gdb.guile/scm-frame-args.exp
+++ b/gdb/testsuite/gdb.guile/scm-frame-args.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return
}
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-frame-args.scm b/gdb/testsuite/gdb.guile/scm-frame-args.scm
index 08d0462..1de4fcb 100644
--- a/gdb/testsuite/gdb.guile/scm-frame-args.scm
+++ b/gdb/testsuite/gdb.guile/scm-frame-args.scm
@@ -1,4 +1,4 @@
-;; Copyright (C) 2014-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2025 Free Software Foundation, Inc.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-frame-inline.c b/gdb/testsuite/gdb.guile/scm-frame-inline.c
index 64e845f..7b9cd05 100644
--- a/gdb/testsuite/gdb.guile/scm-frame-inline.c
+++ b/gdb/testsuite/gdb.guile/scm-frame-inline.c
@@ -1,6 +1,6 @@
/* This test is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-frame-inline.exp b/gdb/testsuite/gdb.guile/scm-frame-inline.exp
index f01af22..02884f7 100644
--- a/gdb/testsuite/gdb.guile/scm-frame-inline.exp
+++ b/gdb/testsuite/gdb.guile/scm-frame-inline.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-frame.exp b/gdb/testsuite/gdb.guile/scm-frame.exp
index bd54e63..821567e 100644
--- a/gdb/testsuite/gdb.guile/scm-frame.exp
+++ b/gdb/testsuite/gdb.guile/scm-frame.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
# The following tests require execution.
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
@@ -52,7 +52,7 @@ gdb_test "guile (print (frame-read-var bf1 \"b\"))" \
"\"bar\"" "test b"
# Test the read-var function in another block other than the current
-# block (in this case, the super block). Test thar read-var is reading
+# block (in this case, the super block). Test that read-var is reading
# the correct variables of i and f but they are the correct value and type.
gdb_scm_test_silent_cmd "guile (define sb (block-superblock (frame-block bf1)))" \
"get superblock"
diff --git a/gdb/testsuite/gdb.guile/scm-gsmob.exp b/gdb/testsuite/gdb.guile/scm-gsmob.exp
index c0b3eb5..6d9e384 100644
--- a/gdb/testsuite/gdb.guile/scm-gsmob.exp
+++ b/gdb/testsuite/gdb.guile/scm-gsmob.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-iterator.c b/gdb/testsuite/gdb.guile/scm-iterator.c
index 88b7d80..eec6145 100644
--- a/gdb/testsuite/gdb.guile/scm-iterator.c
+++ b/gdb/testsuite/gdb.guile/scm-iterator.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-iterator.exp b/gdb/testsuite/gdb.guile/scm-iterator.exp
index d82cb9b..188b5ef 100644
--- a/gdb/testsuite/gdb.guile/scm-iterator.exp
+++ b/gdb/testsuite/gdb.guile/scm-iterator.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-lazy-string.c b/gdb/testsuite/gdb.guile/scm-lazy-string.c
index 4eadb68..26f8a2f 100644
--- a/gdb/testsuite/gdb.guile/scm-lazy-string.c
+++ b/gdb/testsuite/gdb.guile/scm-lazy-string.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-lazy-string.exp b/gdb/testsuite/gdb.guile/scm-lazy-string.exp
index 7ce7eae..eaee001 100644
--- a/gdb/testsuite/gdb.guile/scm-lazy-string.exp
+++ b/gdb/testsuite/gdb.guile/scm-lazy-string.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
# The following tests require execution.
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-math.c b/gdb/testsuite/gdb.guile/scm-math.c
index 76f046e..4ff67a0 100644
--- a/gdb/testsuite/gdb.guile/scm-math.c
+++ b/gdb/testsuite/gdb.guile/scm-math.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-math.exp b/gdb/testsuite/gdb.guile/scm-math.exp
index 942ecf5..17b54d1 100644
--- a/gdb/testsuite/gdb.guile/scm-math.exp
+++ b/gdb/testsuite/gdb.guile/scm-math.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -167,21 +167,21 @@ proc test_value_numeric_ops {} {
# TCL 8.5 required here. Use lookup table instead?
proc get_max_int { size } {
- return [expr "(1 << ($size - 1)) - 1"]
+ return [expr {(1 << ($size - 1)) - 1}]
}
# Return the min signed int of size SIZE.
# TCL 8.5 required here. Use lookup table instead?
proc get_min_int { size } {
- return [expr "-(1 << ($size - 1))"]
+ return [expr {-(1 << ($size - 1))}]
}
# Return the max unsigned int of size SIZE.
# TCL 8.5 required here. Use lookup table instead?
proc get_max_uint { size } {
- return [expr "(1 << $size) - 1"]
+ return [expr {(1 << $size) - 1}]
}
# Helper routine for test_value_numeric_ranges.
@@ -252,7 +252,7 @@ proc test_value_numeric_ranges {} {
proc test_make_pointer_value { size } {
set max [get_max_uint $size]
- set max_hex [string repeat "f" [expr "$size / 4"]]
+ set max_hex [string repeat "f" [expr {$size / 4}]]
gdb_test "gu (print (make-value $max #:type void-pointer-type))" \
"= 0x$max_hex" "test make-value void* max"
@@ -337,7 +337,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c}]} {
return
}
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-objfile-script-gdb.in b/gdb/testsuite/gdb.guile/scm-objfile-script-gdb.in
index da37176..cb71fb6 100644
--- a/gdb/testsuite/gdb.guile/scm-objfile-script-gdb.in
+++ b/gdb/testsuite/gdb.guile/scm-objfile-script-gdb.in
@@ -1,4 +1,4 @@
-;; Copyright (C) 2011-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2025 Free Software Foundation, Inc.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-objfile-script.c b/gdb/testsuite/gdb.guile/scm-objfile-script.c
index ad9e421..1ce505d 100644
--- a/gdb/testsuite/gdb.guile/scm-objfile-script.c
+++ b/gdb/testsuite/gdb.guile/scm-objfile-script.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-objfile-script.exp b/gdb/testsuite/gdb.guile/scm-objfile-script.exp
index e4f5fbd..88cd18c 100644
--- a/gdb/testsuite/gdb.guile/scm-objfile-script.exp
+++ b/gdb/testsuite/gdb.guile/scm-objfile-script.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ gdb_load ${binfile}
# Verify gdb loaded the script.
gdb_test "info auto-load guile-scripts" "Yes.*/${testfile}-gdb.scm.*"
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-objfile.c b/gdb/testsuite/gdb.guile/scm-objfile.c
index e25c1cf..2fd2935 100644
--- a/gdb/testsuite/gdb.guile/scm-objfile.c
+++ b/gdb/testsuite/gdb.guile/scm-objfile.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-objfile.exp b/gdb/testsuite/gdb.guile/scm-objfile.exp
index e483acb..09256df 100644
--- a/gdb/testsuite/gdb.guile/scm-objfile.exp
+++ b/gdb/testsuite/gdb.guile/scm-objfile.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return
}
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-parameter.exp b/gdb/testsuite/gdb.guile/scm-parameter.exp
index eabd179..5483b81 100644
--- a/gdb/testsuite/gdb.guile/scm-parameter.exp
+++ b/gdb/testsuite/gdb.guile/scm-parameter.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ gdb_install_guile_utils
gdb_install_guile_module
proc scm_param_test_maybe_no_output { command pattern args } {
- if [string length $pattern] {
+ if {[string length $pattern]} {
gdb_test $command $pattern $args
} else {
gdb_test_no_output $command $args
@@ -39,7 +39,8 @@ if { [is_remote host] } {
gdb_test "guile (print (parameter-value \"directories\"))" \
"\\\$cdir.\\\$cwd"
} else {
- set escaped_directory [string_to_regexp "$srcdir/$subdir"]
+ set directory [host_file_normalize "$::srcdir/$::subdir"]
+ set escaped_directory [string_to_regexp $directory]
gdb_test "guile (print (parameter-value \"directories\"))" \
"$escaped_directory.\\\$cdir.\\\$cwd"
}
@@ -67,9 +68,19 @@ with_test_prefix "test-param" {
gdb_test_no_output "set print test-param off"
gdb_test "show print test-param" "The state of the Test Parameter is off." "show parameter off"
gdb_test "guile (print (parameter-value test-param))" "= #f" "parameter value, false"
- gdb_test "help show print test-param" "Show the state of the boolean test-param.*" "show help"
- gdb_test "help set print test-param" "Set the state of the boolean test-param.*" "set help"
- gdb_test "help set print" "set print test-param -- Set the state of the boolean test-param.*" "general help"
+ gdb_test "help show print test-param" \
+ [multi_line \
+ "^Show the state of the boolean test-param\\." \
+ "When enabled, test param does something useful\\. When disabled, does nothing\\."] \
+ "show help"
+ gdb_test "help set print test-param" \
+ [multi_line \
+ "^Set the state of the boolean test-param\\." \
+ "When enabled, test param does something useful\\. When disabled, does nothing\\."] \
+ "set help"
+ gdb_test "help set print" \
+ "set print test-param -- Set the state of the boolean test-param.*" \
+ "general help"
gdb_test "guile (print (parameter? test-param))" "= #t"
gdb_test "guile (print (parameter? 42))" "= #f"
@@ -99,7 +110,7 @@ with_test_prefix "test-enum-param" {
gdb_test_no_output "set print test-enum-param two"
gdb_test "show print test-enum-param" "The state of the enum is two." "show new value"
gdb_test "guile (print (parameter-value test-enum-param))" "two" "enum parameter value, two"
- gdb_test "set print test-enum-param three" "Undefined item: \"three\".*" "set invalid enum parameter"
+ gdb_test "set print test-enum-param three" "Undefined item: \"three\".*" "set invalid enum parameter"
}
# Test integer parameters.
@@ -295,7 +306,7 @@ with_test_prefix "test-file-param" {
gdb_test_no_output "set test-file-param bar.txt"
gdb_test "show test-file-param" "The name of the file is bar.txt." "show new value"
gdb_test "guile (print (parameter-value test-file-param))" "bar.txt" " new parameter value"
- gdb_test "set test-file-param" "Argument required.*"
+ gdb_test "set test-file-param" "Argument required.*"
}
# Test a parameter that is not documented.
@@ -314,9 +325,17 @@ with_test_prefix "test-undocumented-param" {
gdb_test "show print test-undoc-param" "The state of the Test Parameter is on." "show parameter on"
gdb_test_no_output "set print test-undoc-param off"
gdb_test "show print test-undoc-param" "The state of the Test Parameter is off." "show parameter off"
- gdb_test "help show print test-undoc-param" "This command is not documented." "show help"
- gdb_test "help set print test-undoc-param" "This command is not documented." "set help"
- gdb_test "help set print" "set print test-undoc-param -- This command is not documented.*" "general help"
+ gdb_test "help show print test-undoc-param" \
+ [multi_line \
+ "^Show the current value of 'print test-undoc-param'\\." \
+ "This command is not documented\\."] \
+ "show help"
+ gdb_test "help set print test-undoc-param" \
+ [multi_line \
+ "Set the current value of 'print test-undoc-param'\\." \
+ "This command is not documented\\."] \
+ "set help"
+ gdb_test "help set print" "set print test-undoc-param -- Set the current value of 'print test-undoc-param'\\..*" "general help"
}
# Test a parameter with a restricted range, where we need to notify the user
@@ -379,60 +398,218 @@ gdb_test_no_output "guile (register-parameter! prev-ambig)"
with_test_prefix "previously-ambiguous" {
gdb_test "guile (print (parameter-value prev-ambig))" "= #f" "parameter value, false"
- gdb_test "show print s" "Command is not documented is off." "show parameter off"
+ gdb_test "show print s" \
+ "The current value of 'print s' is off\\." "show parameter off"
gdb_test_no_output "set print s on"
- gdb_test "show print s" "Command is not documented is on." "show parameter on"
+ gdb_test "show print s" \
+ "The current value of 'print s' is on\\." "show parameter on"
gdb_test "guile (print (parameter-value prev-ambig))" "= #t" "parameter value, true"
- gdb_test "help show print s" "This command is not documented." "show help"
- gdb_test "help set print s" "This command is not documented." "set help"
- gdb_test "help set print" "set print s -- This command is not documented.*" "general help"
+ gdb_test "help show print s" \
+ [multi_line \
+ "^Show the current value of 'print s'\\." \
+ "This command is not documented\\."] \
+ "show help"
+ gdb_test "help set print s" \
+ [multi_line \
+ "Set the current value of 'print s'\\." \
+ "This command is not documented\\."] \
+ "set help"
+ gdb_test "help set print" \
+ "set print s -- Set the current value of 'print s'\\..*" \
+ "general help"
}
-rename scm_param_test_maybe_no_output ""
-
-# Test a color parameter.
+gdb_test_multiline "create set/show foo1 prefix commands" \
+ "guile" "" \
+ "(register-command! (make-command \"set foo1\"" "" \
+ " #:command-class COMMAND_OBSCURE" "" \
+ " #:prefix? #t))" "" \
+ "(register-command! (make-command \"show foo1\"" "" \
+ " #:command-class COMMAND_OBSCURE" "" \
+ " #:prefix? #t))" "" \
+ "end"
-with_ansi_styling_terminal {
- # This enables 256 colors support and disables colors approximation.
- setenv TERM xterm-256color
- setenv COLORTERM truecolor
+gdb_test_multiline "create set/show foo1 baz1 prefix commands" \
+ "guile" "" \
+ "(register-command! (make-command \"set foo1 baz1\"" "" \
+ " #:command-class COMMAND_OBSCURE" "" \
+ " #:prefix? #t))" "" \
+ "(register-command! (make-command \"show foo1 baz1\"" "" \
+ " #:command-class COMMAND_OBSCURE" "" \
+ " #:prefix? #t))" "" \
+ "end"
- # Start with a fresh gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
+gdb_test_multiline "create 'foo bar' parameter" \
+ "guile" "" \
+ "(register-parameter! (make-parameter \"foo bar\"" "" \
+ " #:command-class COMMAND_OBSCURE" "" \
+ " #:parameter-type PARAM_BOOLEAN" "" \
+ " #:show-func (lambda (self value)" "" \
+ " (format #f \"The state of 'foo bar' is ~a.\" value))" "" \
+ " #:initial-value #t))" "" \
+ "end"
- gdb_install_guile_utils
- gdb_install_guile_module
+gdb_test "show foo1 bar" "^The state of 'foo bar' is on\\." "show parameter 'foo bar'"
- # We use "." here instead of ":" so that this works on win32 too.
- set escaped_directory [string_to_regexp "$srcdir/$subdir"]
+gdb_test_multiline "create set/show foo2 prefix commands" \
+ "guile" "" \
+ "(register-command! (make-command \"set foo2\"" "" \
+ " #:command-class COMMAND_OBSCURE" "" \
+ " #:prefix? #t))" "" \
+ "(register-command! (make-command \"show foo2\"" "" \
+ " #:command-class COMMAND_OBSCURE" "" \
+ " #:prefix? #t))" "" \
+ "end" ""
+
+gdb_test_multiline "create ambiguous 'foo baz' parameter" \
+ "guile" "" \
+ "(register-parameter! (make-parameter \"foo baz\"" "" \
+ " #:command-class COMMAND_OBSCURE" "" \
+ " #:parameter-type PARAM_BOOLEAN" "" \
+ " #:show-func (lambda (self value)" "" \
+ " (format #f \"The state of 'foo baz' is ~a.\" value))" "" \
+ " #:initial-value #t))" "" \
+ "end" \
+ [multi_line \
+ "Out of range: could not find command prefix 'foo' in position 1: \"foo baz\"" \
+ "Error while executing Scheme code."]
- gdb_test_multiline "color gdb parameter" \
+with_test_prefix "empty doc string" {
+ gdb_test_multiline "empty doc string parameter" \
"guile" "" \
- "(define test-color-param" "" \
- " (make-parameter \"print test-color-param\"" "" \
- " #:command-class COMMAND_DATA" "" \
- " #:parameter-type PARAM_COLOR" "" \
- " #:doc \"When set, test param does something useful. When disabled, does nothing.\"" "" \
- " #:show-doc \"Show the state of the test-color-param.\"" "" \
- " #:set-doc \"Set the state of the test-color-param.\"" "" \
- " #:show-func (lambda (self value)" "" \
- " (format #f \"The state of the test-color-param is ~a.\" value))" "" \
- " #:initial-value (make-color \"green\")))" "" \
- "(register-parameter! test-color-param)" "" \
+ "(register-parameter! (make-parameter \"empty-doc-string\"" "" \
+ " #:command-class COMMAND_NONE" "" \
+ " #:parameter-type PARAM_ZINTEGER" "" \
+ " #:doc \"\"" "" \
+ " #:set-doc \"Set doc string.\"" "" \
+ " #:show-doc \"Show doc string.\"))" "" \
"end"
- with_test_prefix "test-color-param" {
- with_test_prefix "initial-value" {
- gdb_test "guile (print (parameter-value test-color-param))" "= #<gdb:color green COLORSPACE_ANSI_8COLOR>" "color parameter value (green)"
- gdb_test "show print test-color-param" "The state of the test-color-param is green." "show initial value"
- gdb_test_no_output "set print test-color-param 255"
- }
- with_test_prefix "new-value" {
- gdb_test "show print test-color-param" "The state of the test-color-param is 255." "show new value"
- gdb_test "guile (print (parameter-value test-color-param))" "= #<gdb:color 255 COLORSPACE_XTERM_256COLOR>" "color parameter value (255)"
- gdb_test "set print test-color-param 256" "integer 256 out of range.*" "set invalid color parameter"
+ gdb_test "help set empty-doc-string" "^Set doc string\\."
+ gdb_test "help show empty-doc-string" "^Show doc string\\."
+}
+
+with_test_prefix "set/show parameter" {
+ # This first set/show prefix command doesn't have an invoke
+ # method. As such, GDB installs the default invoke behaviour; set
+ # prints the full list of sub-commands, and show prints all the
+ # sub-command values.
+ gdb_test_multiline "Setup set/show parameter prefix with no invoke" \
+ "guile" "" \
+ "(register-command! (make-command \"set test-prefix\"" "" \
+ " #:prefix? #t" "" \
+ " #:command-class COMMAND_NONE))" ""\
+ "(register-command! (make-command \"show test-prefix\"" "" \
+ " #:prefix? #t" "" \
+ " #:command-class COMMAND_NONE))" ""\
+ "(register-parameter! (make-parameter \"test-prefix param-1\"" "" \
+ " #:command-class COMMAND_NONE" "" \
+ " #:parameter-type PARAM_BOOLEAN))" "" \
+ "(register-parameter! (make-parameter \"test-prefix param-2\"" "" \
+ " #:command-class COMMAND_NONE" "" \
+ " #:parameter-type PARAM_UINTEGER))" "" \
+ "(register-parameter! (make-parameter \"test-prefix param-3\"" "" \
+ " #:command-class COMMAND_NONE" "" \
+ " #:parameter-type PARAM_STRING))" "" \
+ "end" ""
+
+ gdb_test "set test-prefix" \
+ [multi_line \
+ "List of \"set test-prefix\" subcommands:" \
+ "" \
+ "set test-prefix param-1 -- Set the current value of 'test-prefix param-1'." \
+ "set test-prefix param-2 -- Set the current value of 'test-prefix param-2'." \
+ "set test-prefix param-3 -- Set the current value of 'test-prefix param-3'." \
+ "" \
+ "Type \"help set test-prefix\" followed by subcommand name for full documentation\\." \
+ "Type \"apropos word\" to search for commands related to \"word\"\\." \
+ "Type \"apropos -v word\" for full documentation of commands related to \"word\"\\." \
+ "Command name abbreviations are allowed if unambiguous\\."]
+
+ gdb_test "show test-prefix" \
+ [multi_line \
+ "test-prefix param-1: The current value of 'test-prefix param-1' is off\\." \
+ "test-prefix param-2: The current value of 'test-prefix param-2' is 0\\." \
+ "test-prefix param-3: The current value of 'test-prefix param-3' is \"\"\\."]
+
+ # This next set/show prefix has an invoke method, which will be
+ # called instead of the default behaviour tested above.
+ gdb_test_multiline "Setup set/show parameter prefix with invoke" \
+ "guile" "" \
+ "(register-command! (make-command \"set test-prefix-2\"" "" \
+ " #:prefix? #t" "" \
+ " #:command-class COMMAND_NONE" ""\
+ " #:invoke (lambda (self arg from-tty)" "" \
+ " (display \"invoke -- set\\n\"))))" "" \
+ "(register-command! (make-command \"show test-prefix-2\"" "" \
+ " #:prefix? #t" "" \
+ " #:command-class COMMAND_NONE" ""\
+ " #:invoke (lambda (self arg from-tty)" "" \
+ " (display \"invoke -- show\\n\"))))" "" \
+ "(register-parameter! (make-parameter \"test-prefix-2 param-1\"" "" \
+ " #:command-class COMMAND_NONE" "" \
+ " #:parameter-type PARAM_BOOLEAN))" "" \
+ "(register-parameter! (make-parameter \"test-prefix-2 param-2\"" "" \
+ " #:command-class COMMAND_NONE" "" \
+ " #:parameter-type PARAM_UINTEGER))" "" \
+ "(register-parameter! (make-parameter \"test-prefix-2 param-3\"" "" \
+ " #:command-class COMMAND_NONE" "" \
+ " #:parameter-type PARAM_STRING))" "" \
+ "end" ""
+
+ gdb_test "set test-prefix-2" "^invoke -- set"
+
+ gdb_test "show test-prefix-2" "^invoke -- show"
+}
+
+rename scm_param_test_maybe_no_output ""
+
+# Test a color parameter.
+
+if { ![is_remote host] } {
+ with_ansi_styling_terminal {
+
+ # This enables 256 colors support and disables colors approximation.
+ setenv TERM xterm-256color
+ setenv COLORTERM truecolor
+
+ # Start with a fresh gdb.
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+
+ gdb_install_guile_utils
+ gdb_install_guile_module
+
+ # We use "." here instead of ":" so that this works on win32 too.
+ set escaped_directory [string_to_regexp "$srcdir/$subdir"]
+
+ gdb_test_multiline "color gdb parameter" \
+ "guile" "" \
+ "(define test-color-param" "" \
+ " (make-parameter \"print test-color-param\"" "" \
+ " #:command-class COMMAND_DATA" "" \
+ " #:parameter-type PARAM_COLOR" "" \
+ " #:doc \"When set, test param does something useful. When disabled, does nothing.\"" "" \
+ " #:show-doc \"Show the state of the test-color-param.\"" "" \
+ " #:set-doc \"Set the state of the test-color-param.\"" "" \
+ " #:show-func (lambda (self value)" "" \
+ " (format #f \"The state of the test-color-param is ~a.\" value))" "" \
+ " #:initial-value (make-color \"green\")))" "" \
+ "(register-parameter! test-color-param)" "" \
+ "end"
+
+ with_test_prefix "test-color-param" {
+ with_test_prefix "initial-value" {
+ gdb_test "guile (print (parameter-value test-color-param))" "= #<gdb:color green COLORSPACE_ANSI_8COLOR>" "color parameter value (green)"
+ gdb_test "show print test-color-param" "The state of the test-color-param is green." "show initial value"
+ gdb_test_no_output "set print test-color-param 255"
+ }
+ with_test_prefix "new-value" {
+ gdb_test "show print test-color-param" "The state of the test-color-param is 255." "show new value"
+ gdb_test "guile (print (parameter-value test-color-param))" "= #<gdb:color 255 COLORSPACE_XTERM_256COLOR>" "color parameter value (255)"
+ gdb_test "set print test-color-param 256" "integer 256 out of range.*" "set invalid color parameter"
+ }
}
}
}
diff --git a/gdb/testsuite/gdb.guile/scm-ports.c b/gdb/testsuite/gdb.guile/scm-ports.c
index 59fd2bf..829419c 100644
--- a/gdb/testsuite/gdb.guile/scm-ports.c
+++ b/gdb/testsuite/gdb.guile/scm-ports.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-ports.exp b/gdb/testsuite/gdb.guile/scm-ports.exp
index 2f186dd..a0af289 100644
--- a/gdb/testsuite/gdb.guile/scm-ports.exp
+++ b/gdb/testsuite/gdb.guile/scm-ports.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return
}
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
@@ -84,7 +84,7 @@ foreach variation $port_variations {
# Test read/write of memory ports.
proc test_mem_port_rw { buffered } {
- if $buffered {
+ if {$buffered} {
set mode "r+"
} else {
set mode "r+0"
@@ -115,7 +115,7 @@ proc test_mem_port_rw { buffered } {
"define new-value"
gdb_test "guile (print (put-bytevector rw-mem-port (make-bytevector 1 new-value)))" \
"= #<unspecified>"
- if $buffered {
+ if {$buffered} {
# Value shouldn't be in memory yet.
gdb_test "guile (print (value=? (parse-and-eval \"*(char*) \$sp\") byte-at-sp))" \
"= #t" \
diff --git a/gdb/testsuite/gdb.guile/scm-pretty-print.c b/gdb/testsuite/gdb.guile/scm-pretty-print.c
index d59fbb6..cada6b7 100644
--- a/gdb/testsuite/gdb.guile/scm-pretty-print.c
+++ b/gdb/testsuite/gdb.guile/scm-pretty-print.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-pretty-print.exp b/gdb/testsuite/gdb.guile/scm-pretty-print.exp
index d782da5..62fb8e2 100644
--- a/gdb/testsuite/gdb.guile/scm-pretty-print.exp
+++ b/gdb/testsuite/gdb.guile/scm-pretty-print.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,9 +33,10 @@ proc run_lang_tests {exefile lang} {
set nl "\[\r\n\]+"
# Start with a fresh gdb.
- clean_restart $exefile
+ clean_restart
+ gdb_load $exefile
- if ![gdb_guile_runto_main] {
+ if {![gdb_guile_runto_main]} {
return
}
@@ -114,9 +115,9 @@ run_lang_tests "${binfile}-cxx" "c++"
# Run various other tests.
-clean_restart $binfile
+clean_restart $::testfile
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-pretty-print.scm b/gdb/testsuite/gdb.guile/scm-pretty-print.scm
index 432d61f..9388bca 100644
--- a/gdb/testsuite/gdb.guile/scm-pretty-print.scm
+++ b/gdb/testsuite/gdb.guile/scm-pretty-print.scm
@@ -1,4 +1,4 @@
-;; Copyright (C) 2008-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2025 Free Software Foundation, Inc.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-progspace.c b/gdb/testsuite/gdb.guile/scm-progspace.c
index 80fcda0..170249b 100644
--- a/gdb/testsuite/gdb.guile/scm-progspace.c
+++ b/gdb/testsuite/gdb.guile/scm-progspace.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-progspace.exp b/gdb/testsuite/gdb.guile/scm-progspace.exp
index 2ca61dd..fbc5b73 100644
--- a/gdb/testsuite/gdb.guile/scm-progspace.exp
+++ b/gdb/testsuite/gdb.guile/scm-progspace.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-section-script.c b/gdb/testsuite/gdb.guile/scm-section-script.c
index c42d7c0..0a8654f 100644
--- a/gdb/testsuite/gdb.guile/scm-section-script.c
+++ b/gdb/testsuite/gdb.guile/scm-section-script.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-section-script.exp b/gdb/testsuite/gdb.guile/scm-section-script.exp
index fb46ad7..3a68adc 100644
--- a/gdb/testsuite/gdb.guile/scm-section-script.exp
+++ b/gdb/testsuite/gdb.guile/scm-section-script.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -94,7 +94,7 @@ gdb_test "info auto-load guile-scripts ${testfile}" "Yes.*${testfile}.scm.*"
gdb_test "info auto-load guile-scripts no-script-matches-this" \
"No auto-load scripts matching no-script-matches-this."
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-section-script.scm b/gdb/testsuite/gdb.guile/scm-section-script.scm
index 205673b..a9a7c9e 100644
--- a/gdb/testsuite/gdb.guile/scm-section-script.scm
+++ b/gdb/testsuite/gdb.guile/scm-section-script.scm
@@ -1,4 +1,4 @@
-;; Copyright (C) 2010-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2025 Free Software Foundation, Inc.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-symbol.c b/gdb/testsuite/gdb.guile/scm-symbol.c
index 69b831a..23dcf82 100644
--- a/gdb/testsuite/gdb.guile/scm-symbol.c
+++ b/gdb/testsuite/gdb.guile/scm-symbol.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-symbol.exp b/gdb/testsuite/gdb.guile/scm-symbol.exp
index ad22a8b..2ddd3f0 100644
--- a/gdb/testsuite/gdb.guile/scm-symbol.exp
+++ b/gdb/testsuite/gdb.guile/scm-symbol.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -54,7 +54,7 @@ gdb_test "guile (print (symbol-value qq-var))" \
gdb_test "guile (print (symbol-needs-frame? qq-var))" \
"= #f" "print whether qq needs a frame"
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
@@ -141,9 +141,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}-cxx" executable "
return -1
}
-clean_restart ${binfile}-cxx
+clean_restart ${::testfile}-cxx
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
@@ -172,7 +172,7 @@ gdb_test "guile (print (= (symbol-addr-class cplusfunc) SYMBOL_LOC_BLOCK))" "= #
# test as it unloads the object file in GDB.
# Start with a fresh gdb.
clean_restart ${testfile}
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-symtab-2.c b/gdb/testsuite/gdb.guile/scm-symtab-2.c
index 464bb09..ba1c165 100644
--- a/gdb/testsuite/gdb.guile/scm-symtab-2.c
+++ b/gdb/testsuite/gdb.guile/scm-symtab-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-symtab.c b/gdb/testsuite/gdb.guile/scm-symtab.c
index 379af6b..b7dc369 100644
--- a/gdb/testsuite/gdb.guile/scm-symtab.c
+++ b/gdb/testsuite/gdb.guile/scm-symtab.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-symtab.exp b/gdb/testsuite/gdb.guile/scm-symtab.exp
index 91b5cb7..c19b460 100644
--- a/gdb/testsuite/gdb.guile/scm-symtab.exp
+++ b/gdb/testsuite/gdb.guile/scm-symtab.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if {[prepare_for_testing "failed to prepare" $testfile \
return
}
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
@@ -143,7 +143,7 @@ clean_restart ${testfile}
# Test find-pc-line.
# The following tests require execution.
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-type.c b/gdb/testsuite/gdb.guile/scm-type.c
index 2fa824c..cab4c71 100644
--- a/gdb/testsuite/gdb.guile/scm-type.c
+++ b/gdb/testsuite/gdb.guile/scm-type.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-type.exp b/gdb/testsuite/gdb.guile/scm-type.exp
index 3a4f2d0..d974c86 100644
--- a/gdb/testsuite/gdb.guile/scm-type.exp
+++ b/gdb/testsuite/gdb.guile/scm-type.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,13 +38,14 @@ proc build_inferior {exefile lang} {
proc restart_gdb {exefile} {
global srcdir subdir
- clean_restart $exefile
+ clean_restart
+ gdb_load $exefile
if { ![allow_guile_tests] } {
return 0
}
- if ![gdb_guile_runto_main] {
+ if {![gdb_guile_runto_main]} {
return 0
}
gdb_scm_test_silent_cmd "guile (use-modules (gdb iterator))" \
@@ -274,7 +275,7 @@ proc test_range {} {
if { [build_inferior "${binfile}" "c"] < 0 } {
return
}
-if ![restart_gdb "${binfile}"] {
+if {![restart_gdb "${binfile}"]} {
return
}
@@ -290,7 +291,7 @@ with_test_prefix "lang_c" {
if { [build_inferior "${binfile}-cxx" "c++"] < 0 } {
return
}
-if ![restart_gdb "${binfile}-cxx"] {
+if {![restart_gdb "${binfile}-cxx"]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-value-cc.cc b/gdb/testsuite/gdb.guile/scm-value-cc.cc
index 3c8ee23..2d7b389 100644
--- a/gdb/testsuite/gdb.guile/scm-value-cc.cc
+++ b/gdb/testsuite/gdb.guile/scm-value-cc.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-value-cc.exp b/gdb/testsuite/gdb.guile/scm-value-cc.exp
index 60e846f..f65be25 100644
--- a/gdb/testsuite/gdb.guile/scm-value-cc.exp
+++ b/gdb/testsuite/gdb.guile/scm-value-cc.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return
}
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.guile/scm-value.c b/gdb/testsuite/gdb.guile/scm-value.c
index abcb53f..c95b2a5 100644
--- a/gdb/testsuite/gdb.guile/scm-value.c
+++ b/gdb/testsuite/gdb.guile/scm-value.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/scm-value.exp b/gdb/testsuite/gdb.guile/scm-value.exp
index b743149..ea77d8f 100644
--- a/gdb/testsuite/gdb.guile/scm-value.exp
+++ b/gdb/testsuite/gdb.guile/scm-value.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -309,9 +309,10 @@ proc test_value_after_death {} {
proc test_subscript_regression {exefile lang} {
# Start with a fresh gdb.
- clean_restart ${exefile}
+ clean_restart
+ gdb_load ${exefile}
- if ![gdb_guile_runto_main ] {
+ if {![gdb_guile_runto_main ]} {
return
}
@@ -427,7 +428,7 @@ if { [build_inferior "${binfile}" "c"] < 0 } {
}
# Start with a fresh gdb.
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_install_guile_utils
gdb_install_guile_module
@@ -437,7 +438,7 @@ test_value_hash
# The following tests require execution.
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
@@ -446,7 +447,7 @@ test_inferior_function_call
test_strings
test_value_after_death
-# Test either C or C++ values.
+# Test either C or C++ values.
test_subscript_regression "${binfile}" "c"
diff --git a/gdb/testsuite/gdb.guile/source2.scm b/gdb/testsuite/gdb.guile/source2.scm
index 39a863b..0d02625 100644
--- a/gdb/testsuite/gdb.guile/source2.scm
+++ b/gdb/testsuite/gdb.guile/source2.scm
@@ -1,6 +1,6 @@
;; This testcase is part of GDB, the GNU debugger.
;;
-;; Copyright 2008-2024 Free Software Foundation, Inc.
+;; Copyright 2008-2025 Free Software Foundation, Inc.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/types-module.cc b/gdb/testsuite/gdb.guile/types-module.cc
index f3992c0..36e2866 100644
--- a/gdb/testsuite/gdb.guile/types-module.cc
+++ b/gdb/testsuite/gdb.guile/types-module.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.guile/types-module.exp b/gdb/testsuite/gdb.guile/types-module.exp
index dfd9422..e8412cc 100644
--- a/gdb/testsuite/gdb.guile/types-module.exp
+++ b/gdb/testsuite/gdb.guile/types-module.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $flags] } {
return -1
}
-if ![gdb_guile_runto_main] {
+if {![gdb_guile_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.linespec/3explicit.c b/gdb/testsuite/gdb.linespec/3explicit.c
index 5c4f242..58f7a98 100644
--- a/gdb/testsuite/gdb.linespec/3explicit.c
+++ b/gdb/testsuite/gdb.linespec/3explicit.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/base/one/header.h b/gdb/testsuite/gdb.linespec/base/one/header.h
index 55ce779..9877795 100644
--- a/gdb/testsuite/gdb.linespec/base/one/header.h
+++ b/gdb/testsuite/gdb.linespec/base/one/header.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/base/two/header.h b/gdb/testsuite/gdb.linespec/base/two/header.h
index 6fe8cae..0fc1f4f 100644
--- a/gdb/testsuite/gdb.linespec/base/two/header.h
+++ b/gdb/testsuite/gdb.linespec/base/two/header.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/break-ask.exp b/gdb/testsuite/gdb.linespec/break-ask.exp
index 2f786f2..c852c91 100644
--- a/gdb/testsuite/gdb.linespec/break-ask.exp
+++ b/gdb/testsuite/gdb.linespec/break-ask.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/break-asm-file.c b/gdb/testsuite/gdb.linespec/break-asm-file.c
index 7aff7cc..4b4157d 100644
--- a/gdb/testsuite/gdb.linespec/break-asm-file.c
+++ b/gdb/testsuite/gdb.linespec/break-asm-file.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/break-asm-file.exp b/gdb/testsuite/gdb.linespec/break-asm-file.exp
index 1044fc7..989b1a5 100644
--- a/gdb/testsuite/gdb.linespec/break-asm-file.exp
+++ b/gdb/testsuite/gdb.linespec/break-asm-file.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/break-asm-file0.S b/gdb/testsuite/gdb.linespec/break-asm-file0.S
index 507b270..05af2af 100644
--- a/gdb/testsuite/gdb.linespec/break-asm-file0.S
+++ b/gdb/testsuite/gdb.linespec/break-asm-file0.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/break-asm-file1.S b/gdb/testsuite/gdb.linespec/break-asm-file1.S
index 3056871..4523205 100644
--- a/gdb/testsuite/gdb.linespec/break-asm-file1.S
+++ b/gdb/testsuite/gdb.linespec/break-asm-file1.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/cp-completion-aliases.cc b/gdb/testsuite/gdb.linespec/cp-completion-aliases.cc
index 945a1e6..bf9dc0b 100644
--- a/gdb/testsuite/gdb.linespec/cp-completion-aliases.cc
+++ b/gdb/testsuite/gdb.linespec/cp-completion-aliases.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/cp-completion-aliases.exp b/gdb/testsuite/gdb.linespec/cp-completion-aliases.exp
index d8fbcfa..bc3f79c 100644
--- a/gdb/testsuite/gdb.linespec/cp-completion-aliases.exp
+++ b/gdb/testsuite/gdb.linespec/cp-completion-aliases.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/cp-replace-typedefs-ns-template.cc b/gdb/testsuite/gdb.linespec/cp-replace-typedefs-ns-template.cc
index af2e583..7dac71e 100644
--- a/gdb/testsuite/gdb.linespec/cp-replace-typedefs-ns-template.cc
+++ b/gdb/testsuite/gdb.linespec/cp-replace-typedefs-ns-template.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/cp-replace-typedefs-ns-template.exp b/gdb/testsuite/gdb.linespec/cp-replace-typedefs-ns-template.exp
index 214242f..db6ed69 100644
--- a/gdb/testsuite/gdb.linespec/cp-replace-typedefs-ns-template.exp
+++ b/gdb/testsuite/gdb.linespec/cp-replace-typedefs-ns-template.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -93,7 +93,7 @@ foreach loc {
"NS1::NS2::AliasTempl<int>::static_method<int>(NS1::NS2::object*)"
"NS1::NS2::AliasTempl<int>::static_method<int>(NS1::NS2::object_p)"
} {
- if [test_compiler_info gcc*] {
+ if {[test_compiler_info gcc*]} {
# While Clang emits "AliasTempl<int>" (etc.) typedefs, GCC
# emits "AliasTempl" typedefs with no template parameter info.
setup_xfail gcc/95437 *-*-*
@@ -104,7 +104,7 @@ foreach loc {
# instead of succeeding with e.g., "AliasTempl<int>" preserved in
# the location text. If that ever happens, we'll need to update
# these tests.
- if [test_compiler_info gcc*] {
+ if {[test_compiler_info gcc*]} {
check_setting_bp_fails "b $loc"
}
}
diff --git a/gdb/testsuite/gdb.linespec/cpcompletion.cc b/gdb/testsuite/gdb.linespec/cpcompletion.cc
index 5b050d3..b2eabd2 100644
--- a/gdb/testsuite/gdb.linespec/cpcompletion.cc
+++ b/gdb/testsuite/gdb.linespec/cpcompletion.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/cpcompletion.exp b/gdb/testsuite/gdb.linespec/cpcompletion.exp
index b5fc5eb..f33bd39 100644
--- a/gdb/testsuite/gdb.linespec/cpcompletion.exp
+++ b/gdb/testsuite/gdb.linespec/cpcompletion.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -779,7 +779,7 @@ proc test_makem_1 {arglist_list expected_list} {
send_log "expecting $expected_list\n"
# Do list equality via canonical strings.
- if {[expr {[list {*}$expected_list] eq [list {*}$result]}]} {
+ if {[string eq $expected_list eq $result]} {
pass "makem unit test: $arglist"
} else {
fail "makem unit test: $arglist"
@@ -1087,7 +1087,7 @@ proc_with_prefix incomplete-scope-colon {} {
"${explicit_source} -function ${fqc}$prototype${fqc}"] {
set complete_line "b $location"
set start [string first $range_ss $complete_line]
- set end [expr ($start + [string length $range_ss])]
+ set end [expr {($start + [string length $range_ss])}]
test_complete_prefix_range $complete_line $start $end
if {!$skip_check_bp} {
check_bp_locations_match_list "b $location" [list "$prototype"]
@@ -1200,7 +1200,7 @@ proc_with_prefix operator< {} {
"-function $function -label label1"] {
set cmd "b $location"
- set input_line [string range $cmd 0 [expr [string length $cmd] - 3]]
+ set input_line [string range $cmd 0 [expr {[string length $cmd] - 3}]]
test_gdb_complete_unique $input_line $cmd
test_gdb_complete_unique $cmd $cmd
diff --git a/gdb/testsuite/gdb.linespec/cpexplicit.cc b/gdb/testsuite/gdb.linespec/cpexplicit.cc
index 08c03d4..3f49086 100644
--- a/gdb/testsuite/gdb.linespec/cpexplicit.cc
+++ b/gdb/testsuite/gdb.linespec/cpexplicit.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/cpexplicit.exp b/gdb/testsuite/gdb.linespec/cpexplicit.exp
index 62033d5..bd414a4 100644
--- a/gdb/testsuite/gdb.linespec/cpexplicit.exp
+++ b/gdb/testsuite/gdb.linespec/cpexplicit.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/cpls-abi-tag.cc b/gdb/testsuite/gdb.linespec/cpls-abi-tag.cc
index 9cdd227..93cdb65 100644
--- a/gdb/testsuite/gdb.linespec/cpls-abi-tag.cc
+++ b/gdb/testsuite/gdb.linespec/cpls-abi-tag.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp b/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp
index ccc7723..9388c7f 100644
--- a/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp
+++ b/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [test_compiler_info gcc-*] } {
# cpls-abi-tag.cc:71:26: error:
# ‘abi_tag’ attribute applied to non-function ‘s’
# See gcc PR65046.
- require {expr [gcc_major_version] >= 5}
+ require {expr {[gcc_major_version] >= 5}}
}
if {[prepare_for_testing "failed to prepare" $testfile \
diff --git a/gdb/testsuite/gdb.linespec/cpls-hyphen.cc b/gdb/testsuite/gdb.linespec/cpls-hyphen.cc
index 0668f70..92fa8a2 100644
--- a/gdb/testsuite/gdb.linespec/cpls-hyphen.cc
+++ b/gdb/testsuite/gdb.linespec/cpls-hyphen.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/cpls-ops.cc b/gdb/testsuite/gdb.linespec/cpls-ops.cc
index 2efc42e..bf6da47 100644
--- a/gdb/testsuite/gdb.linespec/cpls-ops.cc
+++ b/gdb/testsuite/gdb.linespec/cpls-ops.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/cpls-ops.exp b/gdb/testsuite/gdb.linespec/cpls-ops.exp
index 7ffcc5c..7a004d7 100644
--- a/gdb/testsuite/gdb.linespec/cpls-ops.exp
+++ b/gdb/testsuite/gdb.linespec/cpls-ops.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/cpls.cc b/gdb/testsuite/gdb.linespec/cpls.cc
index 0ab7ad3..08f3fc4 100644
--- a/gdb/testsuite/gdb.linespec/cpls.cc
+++ b/gdb/testsuite/gdb.linespec/cpls.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/cpls2.cc b/gdb/testsuite/gdb.linespec/cpls2.cc
index ef7979f..96a42d0 100644
--- a/gdb/testsuite/gdb.linespec/cpls2.cc
+++ b/gdb/testsuite/gdb.linespec/cpls2.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/errors.exp b/gdb/testsuite/gdb.linespec/errors.exp
index 573bb56..d9fd9cf 100644
--- a/gdb/testsuite/gdb.linespec/errors.exp
+++ b/gdb/testsuite/gdb.linespec/errors.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/explicit.c b/gdb/testsuite/gdb.linespec/explicit.c
index 957de50..98748bb 100644
--- a/gdb/testsuite/gdb.linespec/explicit.c
+++ b/gdb/testsuite/gdb.linespec/explicit.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/explicit.exp b/gdb/testsuite/gdb.linespec/explicit.exp
index b257a98..b859b44 100644
--- a/gdb/testsuite/gdb.linespec/explicit.exp
+++ b/gdb/testsuite/gdb.linespec/explicit.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -608,7 +608,7 @@ namespace eval $testfile {
}
# Test interaction of condition command and explicit linespec conditons.
- clean_restart [standard_output_file $exefile]
+ clean_restart $exefile
set tst "condition_command overrides explicit linespec condition"
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.linespec/explicit2.c b/gdb/testsuite/gdb.linespec/explicit2.c
index 9591b8c..cd500d4 100644
--- a/gdb/testsuite/gdb.linespec/explicit2.c
+++ b/gdb/testsuite/gdb.linespec/explicit2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/keywords.c b/gdb/testsuite/gdb.linespec/keywords.c
index 3a6074f..b5abe6e 100644
--- a/gdb/testsuite/gdb.linespec/keywords.c
+++ b/gdb/testsuite/gdb.linespec/keywords.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/keywords.exp b/gdb/testsuite/gdb.linespec/keywords.exp
index d2596d2..b1df13a 100644
--- a/gdb/testsuite/gdb.linespec/keywords.exp
+++ b/gdb/testsuite/gdb.linespec/keywords.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if {[prepare_for_testing "failed to prepare" $exefile $srcfile {debug}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.linespec/line-breakpoint-outside-function.c b/gdb/testsuite/gdb.linespec/line-breakpoint-outside-function.c
index 93c4383..a1b48fe 100644
--- a/gdb/testsuite/gdb.linespec/line-breakpoint-outside-function.c
+++ b/gdb/testsuite/gdb.linespec/line-breakpoint-outside-function.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/line-breakpoint-outside-function.exp b/gdb/testsuite/gdb.linespec/line-breakpoint-outside-function.exp
index 946304a..120ee6c 100644
--- a/gdb/testsuite/gdb.linespec/line-breakpoint-outside-function.exp
+++ b/gdb/testsuite/gdb.linespec/line-breakpoint-outside-function.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ if {[build_executable "failed to prepare" ${testfile} ${srcfile} $opts]} {
}
proc do_test {} {
- clean_restart $::binfile
+ clean_restart $::testfile
# To make things easier, just so we don't have to deal with the question.
gdb_test_no_output "set breakpoint pending on"
diff --git a/gdb/testsuite/gdb.linespec/linespec.exp b/gdb/testsuite/gdb.linespec/linespec.exp
index 576d788..86b55bb 100644
--- a/gdb/testsuite/gdb.linespec/linespec.exp
+++ b/gdb/testsuite/gdb.linespec/linespec.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -194,6 +194,12 @@ gdb_test "break lspec.h:$line" \
"Breakpoint \[0-9\]+ at $hex: file .*lspec.h, line $line." \
"set breakpoint in f1"
+# This should only have a single location -- in no_multi_locs.
+set line [gdb_get_line_number no_multi_locs]
+gdb_test "break $line" \
+ "Breakpoint \[0-9\]+ at $hex: file .*$srcfile, line $line." \
+ "set breakpoint at no_multi_locs"
+
#
# Multi-inferior tests.
#
diff --git a/gdb/testsuite/gdb.linespec/ls-dollar.cc b/gdb/testsuite/gdb.linespec/ls-dollar.cc
index 8fd8a4a..093910e 100644
--- a/gdb/testsuite/gdb.linespec/ls-dollar.cc
+++ b/gdb/testsuite/gdb.linespec/ls-dollar.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/ls-dollar.exp b/gdb/testsuite/gdb.linespec/ls-dollar.exp
index 15952d7..e0d1795 100644
--- a/gdb/testsuite/gdb.linespec/ls-dollar.exp
+++ b/gdb/testsuite/gdb.linespec/ls-dollar.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/ls-errs.c b/gdb/testsuite/gdb.linespec/ls-errs.c
index 1dfccab..9c48c53 100644
--- a/gdb/testsuite/gdb.linespec/ls-errs.c
+++ b/gdb/testsuite/gdb.linespec/ls-errs.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/ls-errs.exp b/gdb/testsuite/gdb.linespec/ls-errs.exp
index 58125f3..56f9467 100644
--- a/gdb/testsuite/gdb.linespec/ls-errs.exp
+++ b/gdb/testsuite/gdb.linespec/ls-errs.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ proc do_test {lang} {
standard_testfile
set exefile $testfile
- if [info exists compiler_info] {
+ if {[info exists compiler_info]} {
# Unsetting compiler_info allows us to switch compilers
# used by prepare_for_testing.
unset compiler_info
@@ -89,9 +89,8 @@ proc do_test {lang} {
proc test_break {linespec msg_id args} {
global error_messages
- gdb_test "break $linespec" [string_to_regexp \
- [eval format \$error_messages($msg_id) \
- $args]] \
+ gdb_test "break $linespec" \
+ [string_to_regexp [format $error_messages($msg_id) {*}$args]] \
"'break $linespec'"
}
diff --git a/gdb/testsuite/gdb.linespec/lspec.cc b/gdb/testsuite/gdb.linespec/lspec.cc
index bb660fb..ab0a193 100644
--- a/gdb/testsuite/gdb.linespec/lspec.cc
+++ b/gdb/testsuite/gdb.linespec/lspec.cc
@@ -13,6 +13,8 @@ int body_elsewhere()
#include "body.h"
}
+void no_multi_locs () { {int var = 0;} }
+
int main()
{
return dupname(0) + m(0) + n(0) + f1() + f2() + body_elsewhere();
diff --git a/gdb/testsuite/gdb.linespec/macro-relative.c b/gdb/testsuite/gdb.linespec/macro-relative.c
index f0e18fe..6536157 100644
--- a/gdb/testsuite/gdb.linespec/macro-relative.c
+++ b/gdb/testsuite/gdb.linespec/macro-relative.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/macro-relative.exp b/gdb/testsuite/gdb.linespec/macro-relative.exp
index eafb7fe..c076e02 100644
--- a/gdb/testsuite/gdb.linespec/macro-relative.exp
+++ b/gdb/testsuite/gdb.linespec/macro-relative.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ clean_restart ${testfile}
# Test macros respect DW_AT_comp_dir.
# "list header_two_func" does not set exactly the one line we want.
-if ![runto header_two_func] {
+if {![runto header_two_func]} {
return -1
}
diff --git a/gdb/testsuite/gdb.linespec/skip-two.exp b/gdb/testsuite/gdb.linespec/skip-two.exp
index 180a7ce..cfd91da 100644
--- a/gdb/testsuite/gdb.linespec/skip-two.exp
+++ b/gdb/testsuite/gdb.linespec/skip-two.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if {[prepare_for_testing "failed to prepare" $execfile \
gdb_test "skip function dupname" \
{Function dupname will be skipped when stepping\.}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -63,7 +63,7 @@ gdb_test_no_output "skip delete 1"
gdb_test "skip file thefile.cc" \
{File thefile\.cc will be skipped when stepping\.}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.linespec/thread.c b/gdb/testsuite/gdb.linespec/thread.c
index 3f3d202..140f8e0 100644
--- a/gdb/testsuite/gdb.linespec/thread.c
+++ b/gdb/testsuite/gdb.linespec/thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.linespec/thread.exp b/gdb/testsuite/gdb.linespec/thread.exp
index 07df7fc..f5cdf8b 100644
--- a/gdb/testsuite/gdb.linespec/thread.exp
+++ b/gdb/testsuite/gdb.linespec/thread.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" $exefile $srcfile {debug}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.mi/array.f90 b/gdb/testsuite/gdb.mi/array.f90
index 5bfb910..f687b0d 100644
--- a/gdb/testsuite/gdb.mi/array.f90
+++ b/gdb/testsuite/gdb.mi/array.f90
@@ -1,4 +1,4 @@
-! Copyright 2006-2024 Free Software Foundation, Inc.
+! Copyright 2006-2025 Free Software Foundation, Inc.
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/basics.c b/gdb/testsuite/gdb.mi/basics.c
index 12e1203..31ddc4a 100644
--- a/gdb/testsuite/gdb.mi/basics.c
+++ b/gdb/testsuite/gdb.mi/basics.c
@@ -1,4 +1,4 @@
-/* Copyright 1999-2024 Free Software Foundation, Inc.
+/* Copyright 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame-func.c b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame-func.c
index a37307c..1f7930f 100644
--- a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame-func.c
+++ b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame-func.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame-main.c b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame-main.c
index 59b8b00..2b89666 100644
--- a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame-main.c
+++ b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.S b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.S
index 8842696..8b68213 100644
--- a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.S
+++ b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp
index b91f915..074defa 100644
--- a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp
+++ b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,11 +42,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $objsfile object {}] != ""
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
-if [mi_runto func_nofb_marker] {
+if {[mi_runto func_nofb_marker]} {
# First try referencing DW_AT_frame_base which is not defined.
mi_gdb_test "300-stack-list-locals --thread 1 --frame 1 --all-values" \
"300\\^done,locals=\\\[\{name=\"func_nofb_var\",value=\"\\\<error reading variable: Could not find the frame base for \\\\\"func_nofb\\\\\"\\\.\\\>\"\},\{name=\"func_nofb_var2\",value=\"\\\<error reading variable: Could not find the frame base for \\\\\"func_nofb\\\\\"\\\.\\\>\"\}\\\].*" \
@@ -54,13 +54,13 @@ if [mi_runto func_nofb_marker] {
}
# GDB could have crashed.
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
# And now try referencing DW_AT_frame_base defined using a self-reference
# (DW_OP_fbreg).
-if [mi_runto func_loopfb_marker] {
+if {[mi_runto func_loopfb_marker]} {
mi_gdb_test "301-stack-list-locals --thread 1 --frame 1 --all-values" \
"301\\^done,locals=\\\[\{name=\"func_loopfb_var\",value=\"\\\<error reading variable: DWARF-2 expression error: Loop detected.*\"\},\{name=\"func_loopfb_var2\",value=\"\\\<error reading variable: DWARF-2 expression error: Loop detected.*\"\}\\\]" \
"test func_loopfb_var"
diff --git a/gdb/testsuite/gdb.mi/gdb2549.exp b/gdb/testsuite/gdb.mi/gdb2549.exp
index fb3fbf7..5aabc3b 100644
--- a/gdb/testsuite/gdb.mi/gdb2549.exp
+++ b/gdb/testsuite/gdb.mi/gdb2549.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -94,7 +94,7 @@ proc register_tests { } {
register_test 666 t $binary
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
register_tests_no_exec
diff --git a/gdb/testsuite/gdb.mi/gdb669.exp b/gdb/testsuite/gdb.mi/gdb669.exp
index 645780a..da1db64 100644
--- a/gdb/testsuite/gdb.mi/gdb669.exp
+++ b/gdb/testsuite/gdb.mi/gdb669.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_runto_main
check_mi_and_console_threads "at main"
diff --git a/gdb/testsuite/gdb.mi/gdb680.exp b/gdb/testsuite/gdb.mi/gdb680.exp
index 162ebcc..bffdfa1 100644
--- a/gdb/testsuite/gdb.mi/gdb680.exp
+++ b/gdb/testsuite/gdb.mi/gdb680.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ proc do_test {count} {
"-data-list-register-names -1, try $count"
}
-# Tests a bug with ui-out and nested uiout types. When
+# Tests a bug with ui-out and nested uiout types. When
# an error is encountered building a nest typed, like
# lists or tuples, the uiout is not reset to some sane
# state. As a result, uiout still thinks it is building
diff --git a/gdb/testsuite/gdb.mi/gdb701.exp b/gdb/testsuite/gdb.mi/gdb701.exp
index fe6ad04..9ef6fb7 100644
--- a/gdb/testsuite/gdb.mi/gdb701.exp
+++ b/gdb/testsuite/gdb.mi/gdb701.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable debug] != ""} {
# If it doesn't, Bad Things Happen(TM).
# Run to main
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_runto_main
# Step over "foo = 0"
diff --git a/gdb/testsuite/gdb.mi/gdb792.exp b/gdb/testsuite/gdb.mi/gdb792.exp
index b11934b..a2d17aa 100644
--- a/gdb/testsuite/gdb.mi/gdb792.exp
+++ b/gdb/testsuite/gdb.mi/gdb792.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_runto_main
@@ -36,7 +36,7 @@ mi_create_varobj "var1" "a" "create var for class A"
mi_list_varobj_children "var1" {
{var1.public public 2}
- {var1.private private 2}
+ {var1.private private 2}
{var1.protected protected 2}
} "list children of class A"
diff --git a/gdb/testsuite/gdb.mi/interrupt-thread-group.c b/gdb/testsuite/gdb.mi/interrupt-thread-group.c
index 3fbb113..a8392c7 100644
--- a/gdb/testsuite/gdb.mi/interrupt-thread-group.c
+++ b/gdb/testsuite/gdb.mi/interrupt-thread-group.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/interrupt-thread-group.exp b/gdb/testsuite/gdb.mi/interrupt-thread-group.exp
index ee71831..5f9e49e 100644
--- a/gdb/testsuite/gdb.mi/interrupt-thread-group.exp
+++ b/gdb/testsuite/gdb.mi/interrupt-thread-group.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile \
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"set non-stop on\" -ex \"set mi-async\""
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
}
mi_detect_async
@@ -54,7 +54,7 @@ mi_send_resuming_command "exec-continue --thread-group i1" \
# We can't run a second inferior on stub targets. We can still test with one
# inferior and ensure that the command has the desired effect.
-set use_second_inferior [expr {![use_gdb_stub]}]
+set use_second_inferior [expr {![use_gdb_stub] && [allow_multi_inferior_tests]}]
if { $use_second_inferior } {
mi_gdb_test "-add-inferior" \
diff --git a/gdb/testsuite/gdb.mi/list-thread-groups-available.c b/gdb/testsuite/gdb.mi/list-thread-groups-available.c
index 77b2cc1..00b6974 100644
--- a/gdb/testsuite/gdb.mi/list-thread-groups-available.c
+++ b/gdb/testsuite/gdb.mi/list-thread-groups-available.c
@@ -1,4 +1,4 @@
-/* Copyright 2017-2024 Free Software Foundation, Inc.
+/* Copyright 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/list-thread-groups-available.exp b/gdb/testsuite/gdb.mi/list-thread-groups-available.exp
index 7f6ff2a..b68cca6 100644
--- a/gdb/testsuite/gdb.mi/list-thread-groups-available.exp
+++ b/gdb/testsuite/gdb.mi/list-thread-groups-available.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if [mi_gdb_start] {
+if {[mi_gdb_start]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/list-thread-groups-no-inferior.exp b/gdb/testsuite/gdb.mi/list-thread-groups-no-inferior.exp
index f27895f..867eb26 100644
--- a/gdb/testsuite/gdb.mi/list-thread-groups-no-inferior.exp
+++ b/gdb/testsuite/gdb.mi/list-thread-groups-no-inferior.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-add-inferior.exp b/gdb/testsuite/gdb.mi/mi-add-inferior.exp
index ebb669f..d7c959a 100644
--- a/gdb/testsuite/gdb.mi/mi-add-inferior.exp
+++ b/gdb/testsuite/gdb.mi/mi-add-inferior.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-mi_clean_restart ${binfile}
+mi_clean_restart ${::testfile}
# Start execution to establish a connection.
mi_runto_main
@@ -73,14 +73,31 @@ set inf_line [string range "${inf_line}" $idx end]
regexp "^(${decimal} \\(\[^)\]+\\))" $inf_line conn_info
set conn_pattern [string_to_regexp "${conn_info}"]
+# When using the 'remote' protocol, the connection cannot be shared
+# between the original inferior, and the inferior created by
+# 'add-inferior'. Remember, the 'remote' protocol doesn't allow new
+# inferiors to be started. As a result, some of GDB's output will
+# change.
+set is_remote_conn [string equal [target_info gdb_protocol] "remote"]
+
# Now add a new inferior, this should use the connection of the
# current inferior.
-mi_gdb_test "-add-inferior" \
- [multi_line "=thread-group-added,id=\"\[^\"\]+\"" \
- "~\"\\\[New inferior 2\\\]\\\\n\"" \
- "\~\"Added inferior 2 on connection ${conn_pattern}\\\\n\"" \
- "\\^done,inferior=\"\[^\"\]+\",connection=\{number=\"$decimal\",name=\"\[^\"\]+\"\}" ] \
- "mi add inferior"
+if { $is_remote_conn } {
+ mi_gdb_test "-add-inferior" \
+ [multi_line "=thread-group-added,id=\"\[^\"\]+\"" \
+ "~\"\\\[New inferior 2\\\]\\\\n\"" \
+ "&\"warning: can't share connection 1 \\(remote \[^\r\n\]+\\) between inferiors\\\\n\"" \
+ "\~\"Added inferior 2\\\\n\"" \
+ "\\^done,inferior=\"\[^\"\]+\"" ] \
+ "mi add inferior"
+} else {
+ mi_gdb_test "-add-inferior" \
+ [multi_line "=thread-group-added,id=\"\[^\"\]+\"" \
+ "~\"\\\[New inferior 2\\\]\\\\n\"" \
+ "\~\"Added inferior 2 on connection ${conn_pattern}\\\\n\"" \
+ "\\^done,inferior=\"\[^\"\]+\",connection=\{number=\"$decimal\",name=\"\[^\"\]+\"\}" ] \
+ "mi add inferior"
+}
# Now run 'info inferiors' again to check that the currently selected
# inferior has not changed.
@@ -107,7 +124,16 @@ gdb_test_multiple "info inferiors" \
}
-re "^~\"\\s+2\\s+\[^\r\n\]+\\s+${conn_pattern}\\s+\[^\r\n\]+\r\n" {
- set saw_new_inferior true
+ if { ! $is_remote_conn } {
+ set saw_new_inferior true
+ }
+ exp_continue
+ }
+
+ -re "^~\"\\s+2\\s+<null>\\s*\[^\r\n\]+\r\n" {
+ if { $is_remote_conn } {
+ set saw_new_inferior true
+ }
exp_continue
}
diff --git a/gdb/testsuite/gdb.mi/mi-async-run.c b/gdb/testsuite/gdb.mi/mi-async-run.c
index 16c9887..a5bedaa 100644
--- a/gdb/testsuite/gdb.mi/mi-async-run.c
+++ b/gdb/testsuite/gdb.mi/mi-async-run.c
@@ -1,4 +1,4 @@
-/* Copyright 2016-2024 Free Software Foundation, Inc.
+/* Copyright 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi-async-run.exp b/gdb/testsuite/gdb.mi/mi-async-run.exp
index 033768f..3df8769 100644
--- a/gdb/testsuite/gdb.mi/mi-async-run.exp
+++ b/gdb/testsuite/gdb.mi/mi-async-run.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ proc test_async_run {} {
set GDBFLAGS [concat $GDBFLAGS " -ex \"set mi-async on\""]
- if {[mi_clean_restart $binfile]} {
+ if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-async.exp b/gdb/testsuite/gdb.mi/mi-async.exp
index 74aff56..11ba52f 100644
--- a/gdb/testsuite/gdb.mi/mi-async.exp
+++ b/gdb/testsuite/gdb.mi/mi-async.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
save_vars { GDBFLAGS } {
set GDBFLAGS [concat $GDBFLAGS " -ex \"set mi-async on\""]
- if {[mi_clean_restart $binfile]} {
+ if {[mi_clean_restart $::testfile]} {
return
}
}
@@ -55,8 +55,8 @@ proc linux_async_tests {} {
global hex
set line_main_head [gdb_get_line_number "main ("]
- set line_main_body [expr $line_main_head + 2]
- set line_main_next [expr $line_main_head + 3]
+ set line_main_body [expr {$line_main_head + 2}]
+ set line_main_next [expr {$line_main_head + 3}]
mi_send_resuming_command_raw "start" "start: send"
mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" "$line_main_body" { "" "disp=\"del\"" } "start: stop"
diff --git a/gdb/testsuite/gdb.mi/mi-basics.exp b/gdb/testsuite/gdb.mi/mi-basics.exp
index d712188..3038a2c 100644
--- a/gdb/testsuite/gdb.mi/mi-basics.exp
+++ b/gdb/testsuite/gdb.mi/mi-basics.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
# procedures work, so it makes no sense using them here.
gdb_exit
-if [mi_gdb_start separate-inferior-tty] {
+if {[mi_gdb_start separate-inferior-tty]} {
return
}
@@ -61,9 +61,9 @@ proc test_mi_interpreter_selection {} {
# All this test expects is to get the prompt back
# with no syntax error message
- if ![mi_gdb_test "-gdb-version" "~\"GNU gdb.*" "acceptance of MI operations"] {
+ if {![mi_gdb_test "-gdb-version" "~\"GNU gdb.*" "acceptance of MI operations"]} {
return 1
- }
+ }
note "Skipping all other MI tests."
return 0
@@ -73,7 +73,7 @@ proc test_exec_and_symbol_mi_operatons {} {
global mi_gdb_prompt
global binfile testfile
- if [is_remote host] {
+ if {[is_remote host]} {
set filename ${testfile}
remote_download host ${binfile} ${filename}
} else {
@@ -84,8 +84,8 @@ proc test_exec_and_symbol_mi_operatons {} {
# Tests:
# -file-exec-and-symbols
- if [mi_gdb_test "-file-exec-and-symbols ${filename}" "\\\^done" \
- "file-exec-and-symbols operation"] {
+ if {[mi_gdb_test "-file-exec-and-symbols ${filename}" "\\\^done" \
+ "file-exec-and-symbols operation"]} {
note "Skipping all other MI tests."
return 0
}
@@ -144,7 +144,7 @@ proc test_dir_specification {} {
# Add to the search directories, display, then reset back to default
# Tests:
# -environment-directory arg
- # -environment-directory
+ # -environment-directory
# -environment-directory -r
mi_gdb_test "202-environment-directory ${testsubdir}" \
@@ -176,7 +176,7 @@ proc test_cwd_specification {} {
# The canonical name of the working directory may differ on a
# remote host from that on the build system.
- if ![is_remote host] {
+ if {![is_remote host]} {
mi_gdb_test "206-environment-pwd" \
"206\\\^done,cwd=\"${escapedobjdir}\"" \
"environment-pwd operation"
@@ -192,9 +192,9 @@ proc test_path_specification {} {
global envirodir
global expect_out
- # Add to the path, display, then reset
+ # Add to the path, display, then reset
# Tests:
- # -environment-path
+ # -environment-path
# -environment-path dir1 dir2
# -environment-path -r dir
# -environment-path -r
@@ -220,7 +220,7 @@ proc test_path_specification {} {
"210\\\^done,path=\"$orig_path\"" \
"environment-path -r operation"
-}
+}
proc test_setshow_inferior_tty {} {
global mi_gdb_prompt
diff --git a/gdb/testsuite/gdb.mi/mi-break-qualified.cc b/gdb/testsuite/gdb.mi/mi-break-qualified.cc
index c34fe1f..7c3a495 100644
--- a/gdb/testsuite/gdb.mi/mi-break-qualified.cc
+++ b/gdb/testsuite/gdb.mi/mi-break-qualified.cc
@@ -1,4 +1,4 @@
-/* Copyright 2020-2024 Free Software Foundation, Inc.
+/* Copyright 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi-break-qualified.exp b/gdb/testsuite/gdb.mi/mi-break-qualified.exp
index 20e2bb8..9adc2d9 100644
--- a/gdb/testsuite/gdb.mi/mi-break-qualified.exp
+++ b/gdb/testsuite/gdb.mi/mi-break-qualified.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -93,7 +93,7 @@ proc test_break_qualified {} {
"delete temp breakpoints"
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp
index aa8603f..2064efe 100644
--- a/gdb/testsuite/gdb.mi/mi-break.exp
+++ b/gdb/testsuite/gdb.mi/mi-break.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,17 +32,17 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
# Locate line numbers in basics.c.
set line_callee4_head [gdb_get_line_number "callee4 ("]
-set line_callee4_body [expr $line_callee4_head + 2]
+set line_callee4_body [expr {$line_callee4_head + 2}]
set line_callee3_head [gdb_get_line_number "callee3 ("]
-set line_callee3_body [expr $line_callee3_head + 2]
+set line_callee3_body [expr {$line_callee3_head + 2}]
set line_callee2_head [gdb_get_line_number "callee2 ("]
-set line_callee2_body [expr $line_callee2_head + 2]
+set line_callee2_body [expr {$line_callee2_head + 2}]
set line_callee1_head [gdb_get_line_number "callee1 ("]
-set line_callee1_body [expr $line_callee1_head + 2]
+set line_callee1_body [expr {$line_callee1_head + 2}]
set line_main_head [gdb_get_line_number "main ("]
-set line_main_body [expr $line_main_head + 2]
+set line_main_body [expr {$line_main_head + 2}]
set line_callme_head [gdb_get_line_number "callme ("]
-set line_callme_body [expr $line_callme_head + 2]
+set line_callme_body [expr {$line_callme_head + 2}]
set fullname "fullname=\"${fullname_syntax}${srcfile}\""
@@ -346,7 +346,7 @@ proc_with_prefix test_forced_conditions {} {
set loc [mi_make_breakpoint_loc -enabled "N"]
set args [list -cond "bad" -locations "\\\[$loc\\\]"]
- set bp [eval mi_make_breakpoint_multi $args]
+ set bp [mi_make_breakpoint_multi {*}$args]
mi_gdb_test "-break-insert -c bad --force-condition callme" \
"${warning}\\^done,$bp" \
@@ -362,7 +362,7 @@ proc_with_prefix test_forced_conditions {} {
"${warning}\\^done" \
"invalid condition is forced"
set args [list -cond "bad == 42" -locations "\\\[$loc\\\]"]
- set bp [eval mi_make_breakpoint_multi $args]
+ set bp [mi_make_breakpoint_multi {*}$args]
mi_gdb_test "-break-info 16" \
"\\^done,[mi_make_breakpoint_table [list $bp]]" \
"invalid condition is defined"
@@ -398,7 +398,7 @@ proc test_break {mi_mode} {
} else {
set start_ops ""
}
- if [mi_clean_restart $binfile $start_ops ] {
+ if {[mi_clean_restart $::testfile $start_ops ]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp b/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp
index 305c061..46561e4 100644
--- a/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp
+++ b/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -48,7 +48,7 @@ proc test_insert_delete_modify { } {
global lib_sl1 lib_sl2
global binfile
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
mi_load_shlibs $lib_sl1 $lib_sl2
@@ -184,7 +184,7 @@ proc test_pending_resolved { } {
global lib_sl1 lib_sl2
global mi_gdb_prompt
- if {[mi_clean_restart $binfile]} {
+ if {[mi_clean_restart $::testfile]} {
return
}
mi_load_shlibs $lib_sl1 $lib_sl2
@@ -279,7 +279,7 @@ proc test_auto_disable { } {
global lib_sl1 lib_sl2
global binfile
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
mi_load_shlibs $lib_sl1 $lib_sl2
diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.cc b/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.cc
index f5d45d6..e572f08 100644
--- a/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.cc
+++ b/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp b/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp
index 93ddad8..fe50cdc 100644
--- a/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp
+++ b/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug c++}] !=
proc make_breakpoints_pattern { expect_fixed_output bp_num loc1_en loc2_en } {
- if $expect_fixed_output {
+ if {$expect_fixed_output} {
return "bkpt=\{number=\"${bp_num}\",type=\"breakpoint\",.*,locations=\\\[\{number=\"${bp_num}\\.1\",enabled=\"${loc1_en}\",.*\},\{number=\"${bp_num}\\.2\",enabled=\"${loc2_en}\",.*\}\\\]\}"
} else {
return "bkpt=\{number=\"${bp_num}\",type=\"breakpoint\",.*\},\{number=\"${bp_num}\\.1\",enabled=\"${loc1_en}\",.*\},\{number=\"${bp_num}\\.2\",enabled=\"${loc2_en}\",.*\}"
@@ -56,11 +56,11 @@ proc do_test { mi_version use_fix_flag expect_fixed_output } {
global MIFLAGS decimal binfile
set MIFLAGS "-i=mi${mi_version}"
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
mi_runto_main
- if $use_fix_flag {
+ if {$use_fix_flag} {
mi_gdb_test "-fix-multi-location-breakpoint-output" "\\^done" \
"send -fix-multi-location-breakpoint-output"
}
diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-script.c b/gdb/testsuite/gdb.mi/mi-breakpoint-script.c
index 5677680..91b7727 100644
--- a/gdb/testsuite/gdb.mi/mi-breakpoint-script.c
+++ b/gdb/testsuite/gdb.mi/mi-breakpoint-script.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-script.exp b/gdb/testsuite/gdb.mi/mi-breakpoint-script.exp
index e8c06c4..e4242a3 100644
--- a/gdb/testsuite/gdb.mi/mi-breakpoint-script.exp
+++ b/gdb/testsuite/gdb.mi/mi-breakpoint-script.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" }
# script field, else expect it to output the broken pre-mi4 format.
proc make_pattern { expect_fixed_output } {
- if $expect_fixed_output {
+ if {$expect_fixed_output} {
return "bkpt=\{number=\"${::decimal}\",type=\"breakpoint\",.*,script=\\\[\"abc\",\"def\"\\\],.*"
} else {
return "bkpt=\{number=\"${::decimal}\",type=\"breakpoint\",.*,script=\\\{\"abc\",\"def\"\\\},.*"
@@ -51,10 +51,10 @@ proc do_test { mi_version use_fix_flag expect_fixed_output } {
save_vars { ::MIFLAGS } {
set ::MIFLAGS "-i=mi${mi_version}"
- mi_clean_restart $::binfile
+ mi_clean_restart $::testfile
}
- if $use_fix_flag {
+ if {$use_fix_flag} {
mi_gdb_test "-fix-breakpoint-script-output" "\\^done" \
"send -fix-multi-location-breakpoint-output"
}
diff --git a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc
index d41b55d..7fefcfc 100644
--- a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc
+++ b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.cc
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp
index 2205eed..802d0be 100644
--- a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp
+++ b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,11 +27,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
if {[mi_runto_main] < 0} {
return -1
}
-set libstdcxx_probe_tests_supported [expr ![mi_skip_libstdcxx_probe_tests]]
+set libstdcxx_probe_tests_supported [expr {![mi_skip_libstdcxx_probe_tests]}]
# Grab some line numbers we'll need.
set catch_1_lineno [gdb_get_line_number "Catch 1"]
@@ -46,7 +46,7 @@ proc restart_for_test {} {
global srcdir subdir binfile srcfile
global main_lineno
- if {[mi_clean_restart $binfile]} {
+ if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-catch-load-so.c b/gdb/testsuite/gdb.mi/mi-catch-load-so.c
index 217586e..8e7df6d 100644
--- a/gdb/testsuite/gdb.mi/mi-catch-load-so.c
+++ b/gdb/testsuite/gdb.mi/mi-catch-load-so.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-catch-load.c b/gdb/testsuite/gdb.mi/mi-catch-load.c
index 88ade39..d8c91a3 100644
--- a/gdb/testsuite/gdb.mi/mi-catch-load.c
+++ b/gdb/testsuite/gdb.mi/mi-catch-load.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-catch-load.exp b/gdb/testsuite/gdb.mi/mi-catch-load.exp
index a969b3f..3c36cc9 100644
--- a/gdb/testsuite/gdb.mi/mi-catch-load.exp
+++ b/gdb/testsuite/gdb.mi/mi-catch-load.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -36,7 +36,7 @@ gdb_download_shlib $binfile2
# test -catch-load
with_test_prefix "catch-load" {
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
mi_locate_shlib $binfile2
mi_runto_main
@@ -63,7 +63,7 @@ with_test_prefix "catch-load" {
# test -catch-unload
with_test_prefix "catch-unload" {
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
mi_locate_shlib $binfile2
mi_runto_main
diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp
index e8e80e9..7763689 100644
--- a/gdb/testsuite/gdb.mi/mi-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi-cli.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_gdb_test "-interpreter-exec" \
{\^error,msg="-interpreter-exec: Usage: -interpreter-exec interp command"} \
@@ -59,14 +59,14 @@ mi_gdb_test "-interpreter-exec console \"file $binfile\"" \
mi_runto_main
set line_main_head [gdb_get_line_number "main ("]
-set line_main_body [expr $line_main_head + 2]
+set line_main_body [expr {$line_main_head + 2}]
set line_main_hello [gdb_get_line_number "Hello, World!"]
-set line_main_return [expr $line_main_hello + 2]
-set line_main_callme_2 [expr $line_main_return + 1]
+set line_main_return [expr {$line_main_hello + 2}]
+set line_main_callme_2 [expr {$line_main_return + 1}]
set line_callee4_head [gdb_get_line_number "callee4 ("]
-set line_callee4_body [expr $line_callee4_head + 2]
-set line_callee4_next [expr $line_callee4_body + 1]
-set line_callee4_next_step [expr $line_callee4_next + 3]
+set line_callee4_body [expr {$line_callee4_head + 2}]
+set line_callee4_next [expr {$line_callee4_body + 1}]
+set line_callee4_next_step [expr {$line_callee4_next + 3}]
mi_gdb_test "-interpreter-exec console \"set args foobar\"" \
".*=cmd-param-changed,param=\"args\",value=\"foobar\".*\\^done" \
@@ -233,7 +233,7 @@ mi_gdb_test "-interpreter-exec console \"set listsize 10\"" \
"-interpreter-exec console \"set listsize 10\""
# "list" should show 10 lines centered on where the program stopped.
-set first_list_line [expr $line_main_callme_2 - 5]
+set first_list_line [expr {$line_main_callme_2 - 5}]
mi_gdb_test "-interpreter-exec console \"list\"" \
".*\~\"$first_list_line.*\\^done" \
"-interpreter-exec console \"list\" at basics.c:\$line_main_callme_2"
diff --git a/gdb/testsuite/gdb.mi/mi-cmd-error.exp b/gdb/testsuite/gdb.mi/mi-cmd-error.exp
index a4ef95c..81b3a23 100644
--- a/gdb/testsuite/gdb.mi/mi-cmd-error.exp
+++ b/gdb/testsuite/gdb.mi/mi-cmd-error.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -70,7 +70,9 @@ set cmdnames {
for {set i 0} {$i < [llength $procs]} {incr i} {
for {set j 0} {$j < [llength $procs]} {incr j} {
with_test_prefix "[lindex $cmdnames $i] first ($i x $j)" {
+ # tclint-disable-next-line command-args
with_test_prefix "1st" [lindex $procs $i]
+ # tclint-disable-next-line command-args
with_test_prefix "2nd" [lindex $procs $j]
}
}
diff --git a/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp b/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp
index d0d219f..24d12c1 100644
--- a/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp
+++ b/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ proc test_command_param_changed { } {
global binfile
with_test_prefix "cmd param" {
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
mi_runto_main
if { $scheduler_locking_supported } {
diff --git a/gdb/testsuite/gdb.mi/mi-cmd-user-context.c b/gdb/testsuite/gdb.mi/mi-cmd-user-context.c
index d74e161..dfc23b2 100644
--- a/gdb/testsuite/gdb.mi/mi-cmd-user-context.c
+++ b/gdb/testsuite/gdb.mi/mi-cmd-user-context.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-cmd-user-context.exp b/gdb/testsuite/gdb.mi/mi-cmd-user-context.exp
index 9224986..324de5a 100644
--- a/gdb/testsuite/gdb.mi/mi-cmd-user-context.exp
+++ b/gdb/testsuite/gdb.mi/mi-cmd-user-context.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ set main_break_line [gdb_get_line_number "main break line"]
set any "\[^\r\n\]*"
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_create_breakpoint "$srcfile:$main_break_line" "set breakpoint in main"
mi_run_cmd
mi_expect_stop "breakpoint-hit" "main" "" $srcfile $main_break_line \
diff --git a/gdb/testsuite/gdb.mi/mi-complete.cc b/gdb/testsuite/gdb.mi/mi-complete.cc
index 5f5aee5..89ddc21 100644
--- a/gdb/testsuite/gdb.mi/mi-complete.cc
+++ b/gdb/testsuite/gdb.mi/mi-complete.cc
@@ -1,4 +1,4 @@
-/* Copyright 2018-2024 Free Software Foundation, Inc.
+/* Copyright 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi-complete.exp b/gdb/testsuite/gdb.mi/mi-complete.exp
index 7fccaa2..ad29b3f 100644
--- a/gdb/testsuite/gdb.mi/mi-complete.exp
+++ b/gdb/testsuite/gdb.mi/mi-complete.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debu
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
# Don't run to main to avoid increasing the search scope to include
# debug info of shared libraries like glibc, libgcc, etc.
diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state-mt.c b/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state-mt.c
index a794834..6018fd3 100644
--- a/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state-mt.c
+++ b/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state-mt.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state-st.c b/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state-st.c
index 04e9a58..abe4e15 100644
--- a/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state-st.c
+++ b/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state-st.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.c b/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.c
index c862651..5a4a829 100644
--- a/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.c
+++ b/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.exp b/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.exp
index 98086af..7708a6d 100644
--- a/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.exp
+++ b/gdb/testsuite/gdb.mi/mi-condbreak-call-thr-state.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -59,7 +59,7 @@ proc test { variant } {
return -1
}
- if {[mi_clean_restart $binfile]} {
+ if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-fail.c b/gdb/testsuite/gdb.mi/mi-condbreak-fail.c
index 9c21ae5..330fe96 100644
--- a/gdb/testsuite/gdb.mi/mi-condbreak-fail.c
+++ b/gdb/testsuite/gdb.mi/mi-condbreak-fail.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-fail.exp b/gdb/testsuite/gdb.mi/mi-condbreak-fail.exp
index fdcfa9b..34e9494 100644
--- a/gdb/testsuite/gdb.mi/mi-condbreak-fail.exp
+++ b/gdb/testsuite/gdb.mi/mi-condbreak-fail.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ set MIFLAGS "-i=mi"
standard_testfile
-if [build_executable ${testfile}.exp ${binfile} ${srcfile}] {
+if {[build_executable ${testfile}.exp ${binfile} ${srcfile}]} {
return -1
}
@@ -35,7 +35,7 @@ if [build_executable ${testfile}.exp ${binfile} ${srcfile}] {
proc run_test { unwind_on_signal } {
- if {[mi_clean_restart $::binfile]} {
+ if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-throw.cc b/gdb/testsuite/gdb.mi/mi-condbreak-throw.cc
index c7aa232..afee5f6 100644
--- a/gdb/testsuite/gdb.mi/mi-condbreak-throw.cc
+++ b/gdb/testsuite/gdb.mi/mi-condbreak-throw.cc
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-throw.exp b/gdb/testsuite/gdb.mi/mi-condbreak-throw.exp
index 2d2392d..1b4f817 100644
--- a/gdb/testsuite/gdb.mi/mi-condbreak-throw.exp
+++ b/gdb/testsuite/gdb.mi/mi-condbreak-throw.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
# Check that when GDB fails to evaluate the condition of a conditional
# breakpoint we only get one *stopped notification. In this test case
# the breakpoint condition fails due to throwing an uncaught C++
-# excpetion.
+# exception.
require allow_cplus_tests
@@ -25,7 +25,7 @@ set MIFLAGS "-i=mi"
standard_testfile .cc
-if [build_executable ${testfile}.exp ${binfile} ${srcfile} {debug c++}] {
+if {[build_executable ${testfile}.exp ${binfile} ${srcfile} {debug c++}]} {
return -1
}
@@ -38,7 +38,7 @@ if [build_executable ${testfile}.exp ${binfile} ${srcfile} {debug c++}] {
proc run_test { unwind_on_exception } {
- if {[mi_clean_restart $::binfile]} {
+ if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-console.exp b/gdb/testsuite/gdb.mi/mi-console.exp
index 7d24328..710c2c8 100644
--- a/gdb/testsuite/gdb.mi/mi-console.exp
+++ b/gdb/testsuite/gdb.mi/mi-console.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -53,7 +53,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
@@ -91,5 +91,5 @@ mi_gdb_test "220-exec-next" \
set line [gdb_get_line_number "after-hello"]
mi_expect_stop "end-stepping-range" "main" "" ".*mi-console.c" $line "" \
"finished step over hello"
-
+
mi_gdb_exit
diff --git a/gdb/testsuite/gdb.mi/mi-corefile.c b/gdb/testsuite/gdb.mi/mi-corefile.c
index 9807c24..0e9a64e 100644
--- a/gdb/testsuite/gdb.mi/mi-corefile.c
+++ b/gdb/testsuite/gdb.mi/mi-corefile.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi-corefile.exp b/gdb/testsuite/gdb.mi/mi-corefile.exp
index 573f0ac..d663eec 100644
--- a/gdb/testsuite/gdb.mi/mi-corefile.exp
+++ b/gdb/testsuite/gdb.mi/mi-corefile.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,10 +29,11 @@ if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
set corefile [core_find $binfile {}]
if {$corefile == ""} {
+ untested "unable to create or find corefile"
return 0
}
-if [mi_gdb_start] {
+if {[mi_gdb_start]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-detach.exp b/gdb/testsuite/gdb.mi/mi-detach.exp
index 8f33e2a..b485a9b 100644
--- a/gdb/testsuite/gdb.mi/mi-detach.exp
+++ b/gdb/testsuite/gdb.mi/mi-detach.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} {
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_runto_main
mi_gdb_test "-target-detach" "=thread-exited,id=\"1\".*=thread-group-exited,id=\"i1\".*" "detach"
diff --git a/gdb/testsuite/gdb.mi/mi-disassemble.exp b/gdb/testsuite/gdb.mi/mi-disassemble.exp
index 1b4e919..6c6d05d 100644
--- a/gdb/testsuite/gdb.mi/mi-disassemble.exp
+++ b/gdb/testsuite/gdb.mi/mi-disassemble.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ proc test_disassembly_only {} {
global decimal
set line_main_head [gdb_get_line_number "main ("]
- set line_main_body [expr $line_main_head + 2]
+ set line_main_body [expr {$line_main_head + 2}]
# Test disassembly more only for the current function.
# Tests:
@@ -76,7 +76,7 @@ proc test_disassembly_with_opcodes {} {
global decimal
set line_main_head [gdb_get_line_number "main ("]
- set line_main_body [expr $line_main_head + 2]
+ set line_main_body [expr {$line_main_head + 2}]
# Test disassembly with opcodes for the current function.
# Tests:
@@ -106,7 +106,7 @@ proc test_disassembly_lines_limit {} {
global decimal
set line_main_head [gdb_get_line_number "main ("]
- set line_main_body [expr $line_main_head + 2]
+ set line_main_body [expr {$line_main_head + 2}]
# Test disassembly more only for the current function.
# Tests:
@@ -136,7 +136,7 @@ proc test_disassembly_mixed {} {
global fullname_syntax
set line_callee2_head [gdb_get_line_number "callee2 ("]
- set line_callee2_open_brace [expr $line_callee2_head + 1]
+ set line_callee2_open_brace [expr {$line_callee2_head + 1}]
# Test disassembly more only for the current function.
# Tests:
@@ -164,7 +164,7 @@ proc test_disassembly_mixed_with_opcodes {} {
global fullname_syntax
set line_callee2_head [gdb_get_line_number "callee2 ("]
- set line_callee2_open_brace [expr $line_callee2_head + 1]
+ set line_callee2_open_brace [expr {$line_callee2_head + 1}]
# Test disassembly mixed with opcodes for the current function.
# Tests:
@@ -192,8 +192,8 @@ proc test_disassembly_mixed_lines_limit {} {
global fullname_syntax
set line_main_head [gdb_get_line_number "main ("]
- set line_main_open_brace [expr $line_main_head + 1]
- set line_main_body [expr $line_main_head + 2]
+ set line_main_open_brace [expr {$line_main_head + 1}]
+ set line_main_body [expr {$line_main_head + 2}]
# Test disassembly more only for the current function.
# Tests:
@@ -220,7 +220,7 @@ proc test_disassembly_bogus_args {} {
global hex
set line_main_head [gdb_get_line_number "main ("]
- set line_main_body [expr $line_main_head + 2]
+ set line_main_body [expr {$line_main_head + 2}]
# Test that bogus input to disassembly command is rejected.
# Tests:
@@ -321,7 +321,7 @@ proc test_disassembly_opcode_format {} {
# Load the actual byte value from memory, and check it matches
# the opcode byte reported in the disassembler output.
- set addr 0x[format %x [expr $longest_insn_addr + $idx]]
+ set addr 0x[format %x [expr {$longest_insn_addr + $idx}]]
set actual [format %02x [mi_get_valueof "/x" "*((unsigned char *) $addr)" "XX"]]
gdb_assert [string equal $actual "$b"] \
"byte at $addr matches"
@@ -335,7 +335,7 @@ proc test_disassembly_opcode_format {} {
# Figure out an end address at which to stop the disassembly.
set byte_count [llength $split_bytes]
- set end_addr 0x[format %x [expr $longest_insn_addr + $byte_count]]
+ set end_addr 0x[format %x [expr {$longest_insn_addr + $byte_count}]]
set start_addr $longest_insn_addr
verbose -log "Instruction is ${byte_count} bytes, end address ${end_addr}"
@@ -345,7 +345,7 @@ proc test_disassembly_opcode_format {} {
"data-disassemble checking the opcodes bytes format"
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_runto_main
test_disassembly_only
test_disassembly_with_opcodes
diff --git a/gdb/testsuite/gdb.mi/mi-dlmopen.exp b/gdb/testsuite/gdb.mi/mi-dlmopen.exp
index a5743f8..0e1d0bc 100644
--- a/gdb/testsuite/gdb.mi/mi-dlmopen.exp
+++ b/gdb/testsuite/gdb.mi/mi-dlmopen.exp
@@ -65,9 +65,19 @@ if { $dyln_name eq "" } {
set bp_main [gdb_get_line_number "bp.main" $srcfile]
set bp_loaded [gdb_get_line_number "bp.loaded" $srcfile]
+# If the dynamic linker path contains a symlink, some instances show the real
+# path instead of the original path. Accept both.
+lassign [remote_exec target realpath "$dyln_name"] realpath_ret dyln_realpath_name
+
+if { $realpath_ret == 0 } {
+ set dyln_realpath_name [string trim $dyln_realpath_name]
+} else {
+ set dyln_realpath_name "not-a-valid-path"
+}
+
# Return true if FILENAME is the dynamic linker. Otherwise return false.
proc is_dyln { filename } {
- return [expr {$filename eq $::dyln_name}]
+ return [expr {$filename eq $::dyln_name || $filename eq $::dyln_realpath_name}]
}
# Run 'info sharedlibrary' and count the number of mappings that look
@@ -81,12 +91,12 @@ proc get_dyld_info {} {
set dyld_count 0
set dyld_start_addr ""
gdb_test_multiple "info sharedlibrary" "" {
- -re "~\"From\\s+To\\s+Syms\\s+Read\\s+Shared Object Library\\\\n\"\r\n" {
+ -re "~\"From\\s+To(\\s+Linker NS)?\\s+Syms\\s+Read\\s+Shared Object Library\\\\n\"\r\n" {
exp_continue
}
- -re "^~\"($::hex)\\s+$::hex\\s+\[^/\]+(/\[^\r\n\]+)\\\\n\"\r\n" {
+ -re "^~\"($::hex)\\s+${::hex}(\\s+$::decimal)?\\s+\[^/\]+(/\[^\r\n\]+)\\\\n\"\r\n" {
set addr $expect_out(1,string)
- set lib $expect_out(2,string)
+ set lib $expect_out(3,string)
if { [is_dyln $lib] } {
# This looks like it might be the dynamic linker.
@@ -122,7 +132,7 @@ proc get_dyld_info {} {
# number of unload events for the libraries created for this test, and
# additionally, check for dynamic linker unload events.
proc check_solib_unload_events {} {
- mi_clean_restart $::binfile
+ mi_clean_restart $::testfile
if {[mi_runto_main] == -1} {
return
diff --git a/gdb/testsuite/gdb.mi/mi-dprintf-modified.exp b/gdb/testsuite/gdb.mi/mi-dprintf-modified.exp
index c3e1bdf..0584a86 100644
--- a/gdb/testsuite/gdb.mi/mi-dprintf-modified.exp
+++ b/gdb/testsuite/gdb.mi/mi-dprintf-modified.exp
@@ -52,7 +52,7 @@ if { [build_executable "build exec" $binfile $srcfile $opts] == -1} {
set bp_line [gdb_get_line_number "Break here" $srcfile]
# Start the inferior.
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_runto_main
# Place a breakpoint at the dlopen() line.
diff --git a/gdb/testsuite/gdb.mi/mi-dprintf-pending.c b/gdb/testsuite/gdb.mi/mi-dprintf-pending.c
index 62a79f8..64011a0 100644
--- a/gdb/testsuite/gdb.mi/mi-dprintf-pending.c
+++ b/gdb/testsuite/gdb.mi/mi-dprintf-pending.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp
index 4cf6dec..3685e42 100644
--- a/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp
+++ b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,7 +39,7 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""}
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-dprintf-pendshr.c b/gdb/testsuite/gdb.mi/mi-dprintf-pendshr.c
index 7e8bcb9..66a2c3c 100644
--- a/gdb/testsuite/gdb.mi/mi-dprintf-pendshr.c
+++ b/gdb/testsuite/gdb.mi/mi-dprintf-pendshr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-dprintf.c b/gdb/testsuite/gdb.mi/mi-dprintf.c
index ff81018..85ad8cd 100644
--- a/gdb/testsuite/gdb.mi/mi-dprintf.c
+++ b/gdb/testsuite/gdb.mi/mi-dprintf.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
Contributed by Hui Zhu <hui@codesourcery.com>
This program is free software; you can redistribute it and/or modify
diff --git a/gdb/testsuite/gdb.mi/mi-dprintf.exp b/gdb/testsuite/gdb.mi/mi-dprintf.exp
index 8d523bc..5d2d508 100644
--- a/gdb/testsuite/gdb.mi/mi-dprintf.exp
+++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# Contributed by Hui Zhu <hui@codesourcery.com>
# This program is free software; you can redistribute it and/or modify
@@ -31,7 +31,7 @@ if {[build_executable $testfile.exp $testfile $srcfile $flags] == -1} {
set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
set dp_location1 [gdb_get_line_number "set dprintf 1 here"]
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_runto_main
set i 0
@@ -129,7 +129,7 @@ mi_continue_dprintf "gdb"
# The "call" style depends on having I/O functions available, so test.
set has_stderr_symbol [mi_gdb_is_stderr_available]
-if ![target_info exists gdb,noinferiorio] {
+if {![target_info exists gdb,noinferiorio]} {
# Now switch styles and rerun; in the absence of redirection the
# output should be the same.
@@ -165,7 +165,7 @@ gdb_expect {
}
}
-if $target_can_dprintf {
+if {$target_can_dprintf} {
if {[mi_run_cmd] < 0} {
# This likely means we failed to use target side commands in
# combination with software breakpoints. IOW, the target
@@ -174,7 +174,7 @@ if $target_can_dprintf {
unsupported "send dprintf to target"
}
- if $target_can_dprintf {
+ if {$target_can_dprintf} {
mi_expect_stop ".*" ".*" ".*" ".*" ".*" "" "mi expect stop"
mi_send_resuming_command "exec-continue" "mi 1st dprintf continue, agent"
diff --git a/gdb/testsuite/gdb.mi/mi-editing.exp b/gdb/testsuite/gdb.mi/mi-editing.exp
index fc27e4f..015069c 100644
--- a/gdb/testsuite/gdb.mi/mi-editing.exp
+++ b/gdb/testsuite/gdb.mi/mi-editing.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-eval.exp b/gdb/testsuite/gdb.mi/mi-eval.exp
index ad4211213..eafdf69 100644
--- a/gdb/testsuite/gdb.mi/mi-eval.exp
+++ b/gdb/testsuite/gdb.mi/mi-eval.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,15 +32,15 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
set line_callee4_head [gdb_get_line_number "callee4 ("]
-set line_callee4_body [expr $line_callee4_head + 2]
+set line_callee4_body [expr {$line_callee4_head + 2}]
mi_runto callee4
-mi_next_to "callee4" "" "basics.c" [expr $line_callee4_body + 1] "next at callee4"
+mi_next_to "callee4" "" "basics.c" [expr {$line_callee4_body + 1}] "next at callee4"
mi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A"
diff --git a/gdb/testsuite/gdb.mi/mi-exec-run.exp b/gdb/testsuite/gdb.mi/mi-exec-run.exp
index 6b01254..04283a1 100644
--- a/gdb/testsuite/gdb.mi/mi-exec-run.exp
+++ b/gdb/testsuite/gdb.mi/mi-exec-run.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,6 +30,8 @@ set MIFLAGS "-i=mi"
# cannot use it, then there is no point in running this testcase.
require !use_gdb_stub
+set have_startup_shell [have_startup_shell]
+
standard_testfile mi-start.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -57,7 +59,7 @@ proc test {inftty_mode mi_mode force_fail} {
lappend start_ops "separate-mi-tty"
}
- if [mi_gdb_start $start_ops] {
+ if {[mi_gdb_start $start_ops]} {
return
}
@@ -172,6 +174,9 @@ remote_exec target "chmod \"a-x\" $binfile.nox"
foreach_with_prefix inferior-tty {"main" "separate"} {
foreach_with_prefix mi {"main" "separate"} {
foreach_with_prefix force-fail {0 1} {
+ if { ${force-fail} && $have_startup_shell == -1 } {
+ continue
+ }
test ${inferior-tty} ${mi} ${force-fail}
}
}
diff --git a/gdb/testsuite/gdb.mi/mi-exit-code.c b/gdb/testsuite/gdb.mi/mi-exit-code.c
index a6c239b..3463e0d 100644
--- a/gdb/testsuite/gdb.mi/mi-exit-code.c
+++ b/gdb/testsuite/gdb.mi/mi-exit-code.c
@@ -1,4 +1,4 @@
-/* Copyright 1999-2024 Free Software Foundation, Inc.
+/* Copyright 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi-exit-code.exp b/gdb/testsuite/gdb.mi/mi-exit-code.exp
index d5e7c85..af2c6bd 100644
--- a/gdb/testsuite/gdb.mi/mi-exit-code.exp
+++ b/gdb/testsuite/gdb.mi/mi-exit-code.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ proc test_list_thread_groups { } {
"122\\^done,groups=\\\[\{id=\"i1\",type=\"process\"\}\]" \
"-list-thread-groups before run shows no exit-code"
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
with_test_prefix "first run" {
mi_runto_main
diff --git a/gdb/testsuite/gdb.mi/mi-file-transfer.exp b/gdb/testsuite/gdb.mi/mi-file-transfer.exp
index 6efc53d..51ecfce 100644
--- a/gdb/testsuite/gdb.mi/mi-file-transfer.exp
+++ b/gdb/testsuite/gdb.mi/mi-file-transfer.exp
@@ -1,5 +1,5 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-file.exp b/gdb/testsuite/gdb.mi/mi-file.exp
index 00d2888..9b03936 100644
--- a/gdb/testsuite/gdb.mi/mi-file.exp
+++ b/gdb/testsuite/gdb.mi/mi-file.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ proc test_file_list_exec_source_file {} {
# get the path and absolute path to the current executable
set line_main_head [gdb_get_line_number "main ("]
- set line_main_prologue [expr $line_main_head + 1]
+ set line_main_prologue [expr {$line_main_head + 1}]
set line_default $line_main_prologue
mi_gdb_test "111-file-list-exec-source-file" \
diff --git a/gdb/testsuite/gdb.mi/mi-fill-memory.exp b/gdb/testsuite/gdb.mi/mi-fill-memory.exp
index cb803f0..bf0bcb1 100644
--- a/gdb/testsuite/gdb.mi/mi-fill-memory.exp
+++ b/gdb/testsuite/gdb.mi/mi-fill-memory.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,13 +21,13 @@ load_lib mi-support.exp
set MIFLAGS "-i=mi"
standard_testfile "mi-read-memory"
-
+
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}.c" "${binfile}" executable {debug}] != "" } {
untested "failed to compile"
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_runto_main
mi_next_to "main" "" "mi-read-memory.c" "20" "next at main"
diff --git a/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90 b/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90
index ed1c304..57b1c95 100644
--- a/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90
+++ b/gdb/testsuite/gdb.mi/mi-fortran-modules-2.f90
@@ -1,4 +1,4 @@
-! Copyright 2009-2024 Free Software Foundation, Inc.
+! Copyright 2009-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
index 5441d8f..9b5d71a 100644
--- a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
+++ b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if {[build_executable "failed to prepare" ${testfile} \
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_runto_main
@@ -100,7 +100,7 @@ gdb_test_multiple $cmd $test -prompt $mi_gdb_prompt$ {
} else {
fail $gdb_test_name
}
- }
+ }
}
mi_gdb_test "105-symbol-info-module-functions --name _all" \
@@ -161,5 +161,5 @@ gdb_test_multiple $cmd $test -prompt $mi_gdb_prompt$ {
} else {
fail $gdb_test_name
}
- }
+ }
}
diff --git a/gdb/testsuite/gdb.mi/mi-fortran-modules.f90 b/gdb/testsuite/gdb.mi/mi-fortran-modules.f90
index 02067e3..d35e885 100644
--- a/gdb/testsuite/gdb.mi/mi-fortran-modules.f90
+++ b/gdb/testsuite/gdb.mi/mi-fortran-modules.f90
@@ -1,4 +1,4 @@
-! Copyright 2009-2024 Free Software Foundation, Inc.
+! Copyright 2009-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-frame-regs.exp b/gdb/testsuite/gdb.mi/mi-frame-regs.exp
index 0374ec0..d34f244 100644
--- a/gdb/testsuite/gdb.mi/mi-frame-regs.exp
+++ b/gdb/testsuite/gdb.mi/mi-frame-regs.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -62,7 +62,7 @@ proc_with_prefix do_floating_varobj_test {} {
global hex
global expect_out
- if {[mi_clean_restart $binfile]} {
+ if {[mi_clean_restart $::testfile]} {
fail "couldn't start gdb"
return
}
@@ -80,7 +80,7 @@ proc_with_prefix do_floating_varobj_test {} {
# Run to a breakpoint in each callee function in succession.
# Note that we can't use mi_runto because we need the
# breakpoint to be persistent, so we can use its address.
- set bpnum [expr $i + 1]
+ set bpnum [expr {$i + 1}]
mi_create_breakpoint \
"basics.c:callee$i" \
"insert breakpoint at basics.c:callee$i" \
@@ -101,7 +101,7 @@ proc_with_prefix do_floating_varobj_test {} {
if {$bpaddr == ""} { return }
# Check that the addresses are the same.
- gdb_assert [expr $bpaddr == $pcval] "\$pc equals address of breakpoint in callee$i"
+ gdb_assert [expr {$bpaddr == $pcval}] "\$pc equals address of breakpoint in callee$i"
}
}
@@ -113,7 +113,7 @@ proc_with_prefix do_fixed_varobj_test {} {
global srcfile binfile
global hex
- if {[mi_clean_restart $binfile] != 0} {
+ if {[mi_clean_restart $::testfile] != 0} {
fail "couldn't start gdb"
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp b/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp
index d8bb490..6c1dbec 100644
--- a/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp
+++ b/gdb/testsuite/gdb.mi/mi-fullname-deleted.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@ if { [gdb_compile "$srcfileabs" "${binfile}" executable {debug}] != "" } {
file delete -- $srcfileabs
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-hack-cli.exp b/gdb/testsuite/gdb.mi/mi-hack-cli.exp
index c084290..d71b95e 100644
--- a/gdb/testsuite/gdb.mi/mi-hack-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi-hack-cli.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-i-cmd.exp b/gdb/testsuite/gdb.mi/mi-i-cmd.exp
index 89d188f..be7d184 100644
--- a/gdb/testsuite/gdb.mi/mi-i-cmd.exp
+++ b/gdb/testsuite/gdb.mi/mi-i-cmd.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-info-os.exp b/gdb/testsuite/gdb.mi/mi-info-os.exp
index 21d70e8..79307f3 100644
--- a/gdb/testsuite/gdb.mi/mi-info-os.exp
+++ b/gdb/testsuite/gdb.mi/mi-info-os.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,12 +27,12 @@ require allow_xml_test
standard_testfile basics.c
-if [build_executable "Failed to build $testfile" $testfile $srcfile \
- debug] {
+if {[build_executable "Failed to build $testfile" $testfile $srcfile \
+ debug]} {
return -1;
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-info-sources-base.c b/gdb/testsuite/gdb.mi/mi-info-sources-base.c
index 8541b16..2a00b47 100644
--- a/gdb/testsuite/gdb.mi/mi-info-sources-base.c
+++ b/gdb/testsuite/gdb.mi/mi-info-sources-base.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-info-sources.c b/gdb/testsuite/gdb.mi/mi-info-sources.c
index 230641a..0ab1196 100644
--- a/gdb/testsuite/gdb.mi/mi-info-sources.c
+++ b/gdb/testsuite/gdb.mi/mi-info-sources.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-info-sources.exp b/gdb/testsuite/gdb.mi/mi-info-sources.exp
index ca85f8e..80ca596 100644
--- a/gdb/testsuite/gdb.mi/mi-info-sources.exp
+++ b/gdb/testsuite/gdb.mi/mi-info-sources.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if {[build_executable $testfile.exp $testfile \
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
set readnow_p [mi_readnow]
diff --git a/gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp b/gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp
index a3c97cc..3092b692 100644
--- a/gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp
+++ b/gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-language.exp b/gdb/testsuite/gdb.mi/mi-language.exp
index 7200213..2d64fa4 100644
--- a/gdb/testsuite/gdb.mi/mi-language.exp
+++ b/gdb/testsuite/gdb.mi/mi-language.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-linespec-err-cp.cc b/gdb/testsuite/gdb.mi/mi-linespec-err-cp.cc
index 232743c..65b584b 100644
--- a/gdb/testsuite/gdb.mi/mi-linespec-err-cp.cc
+++ b/gdb/testsuite/gdb.mi/mi-linespec-err-cp.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp b/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp
index 824596a..7eeb259 100644
--- a/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp
+++ b/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if {[build_executable "failed to prepare" $exefile $srcfile {debug c++}]} {
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
# Turn off the pending breakpoint queries.
mi_gdb_test "-interpreter-exec console \"set breakpoint pending off\"" \
diff --git a/gdb/testsuite/gdb.mi/mi-logging.exp b/gdb/testsuite/gdb.mi/mi-logging.exp
index 5cc3a97..7fad225 100644
--- a/gdb/testsuite/gdb.mi/mi-logging.exp
+++ b/gdb/testsuite/gdb.mi/mi-logging.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,12 +19,12 @@ set MIFLAGS "-i=mi"
standard_testfile basics.c
set opts {debug}
-if [build_executable $testfile.exp $testfile $srcfile $opts] {
+if {[build_executable $testfile.exp $testfile $srcfile $opts]} {
untested "failed to compile"
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
if {[mi_runto_main] < 0} {
return -1
@@ -51,7 +51,7 @@ close $chan
set mi_log_prompt "\[(\]gdb\[)\] \[\r\n\]+"
-if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
+if {[regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent]} {
pass "log file contents"
} else {
fail "log file contents"
@@ -74,7 +74,7 @@ set chan [open $milogfile]
set logcontent [read $chan]
close $chan
-if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
+if {[regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent]} {
pass "redirect log file contents"
} else {
fail "redirect log file contents"
diff --git a/gdb/testsuite/gdb.mi/mi-memory-changed.exp b/gdb/testsuite/gdb.mi/mi-memory-changed.exp
index 6d9e504..6d02c33 100644
--- a/gdb/testsuite/gdb.mi/mi-memory-changed.exp
+++ b/gdb/testsuite/gdb.mi/mi-memory-changed.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
load_lib mi-support.exp
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-multi-commands.exp b/gdb/testsuite/gdb.mi/mi-multi-commands.exp
index ce4379c..052d600 100644
--- a/gdb/testsuite/gdb.mi/mi-multi-commands.exp
+++ b/gdb/testsuite/gdb.mi/mi-multi-commands.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ proc run_test { args } {
global mi_gdb_prompt
global decimal
- if [mi_clean_restart "" $args] {
+ if {[mi_clean_restart "" $args]} {
return
}
@@ -90,7 +90,7 @@ proc run_test { args } {
# looking for. However, due to the unpredictable
# intermingling, it's much easier if we drop the ^ anchor.
# However, with this gone dejagnu would sometimes match the
- # second comand output before the first commands output.
+ # second command output before the first commands output.
#
# This approach just looks for the first command output, then,
# once that has been found, we start looking for the second
@@ -119,7 +119,7 @@ proc run_test { args } {
# checking different command lengths. The actual bug this
# test checks for would result in a timeout, so we don't want
# to risk lots more timeouts.
- if { ! [expr $seen_first_message && $seen_second_message ] } {
+ if { ! ($seen_first_message && $seen_second_message) } {
break
}
}
diff --git a/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp b/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp
index 35e37b4..4729033 100644
--- a/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp
+++ b/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"set non-stop on\""
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
}
mi_gdb_test "-gdb-set mi-async 1" ".*"
diff --git a/gdb/testsuite/gdb.mi/mi-nonstop.exp b/gdb/testsuite/gdb.mi/mi-nonstop.exp
index 609fbec..07cf899 100644
--- a/gdb/testsuite/gdb.mi/mi-nonstop.exp
+++ b/gdb/testsuite/gdb.mi/mi-nonstop.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"set non-stop on\""
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
}
mi_gdb_test "-gdb-set mi-async 1" ".*"
@@ -63,7 +63,7 @@ mi_check_thread_states {"running" "stopped" "stopped"} "thread state, stop 1"
mi_gdb_test "-thread-select 2" "\\^done.*" "select thread 2"
mi_create_varobj I_W0 "i" "create varobj in first thread"
mi_gdb_test "-thread-select 3" "\\^done.*" "select thread 3"
-mi_create_varobj I_W1 "i" "create varobj in second thread"
+mi_create_varobj I_W1 "i" "create varobj in second thread"
mi_nonstop_resume "exec-continue --thread 2" "resume 1"
mi_check_thread_states {"running" "running" "stopped"} "thread state, resume 1"
@@ -95,7 +95,7 @@ mi_expect_stop "breakpoint-hit" "break_at_me" "\[^\n\]*" "non-stop.c" "\[0-9\]*"
mi_expect_stop "breakpoint-hit" "break_at_me" ".*" "non-stop.c" ".*" {"" "disp=\"keep\""} "w1,i2 stop"
# At this point, thread 1 (main) is running, and worker threads are stopped.
-# Check that we can modify breakpoint condition, even when operating on a
+# Check that we can modify breakpoint condition, even when operating on a
# running thread.
mi_gdb_test "-break-condition --thread 1 2 id==1" "\\^done" "set condition, 1"
diff --git a/gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp b/gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp
index a83ae00..20936f1 100644
--- a/gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp
+++ b/gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" \
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"set non-stop on\""
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
}
mi_gdb_test "-gdb-set mi-async 1" ".*"
diff --git a/gdb/testsuite/gdb.mi/mi-nsintrall.exp b/gdb/testsuite/gdb.mi/mi-nsintrall.exp
index a02c8f9..8c8aef8 100644
--- a/gdb/testsuite/gdb.mi/mi-nsintrall.exp
+++ b/gdb/testsuite/gdb.mi/mi-nsintrall.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"set non-stop on\""
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
}
mi_gdb_test "-gdb-set mi-async 1" ".*"
diff --git a/gdb/testsuite/gdb.mi/mi-nsmoribund.exp b/gdb/testsuite/gdb.mi/mi-nsmoribund.exp
index 270dbc1..2307c2e 100644
--- a/gdb/testsuite/gdb.mi/mi-nsmoribund.exp
+++ b/gdb/testsuite/gdb.mi/mi-nsmoribund.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"set non-stop on\""
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
}
mi_gdb_test "-gdb-set mi-async 1" ".*"
diff --git a/gdb/testsuite/gdb.mi/mi-nsthrexec.exp b/gdb/testsuite/gdb.mi/mi-nsthrexec.exp
index dba7847..1f9d1ae 100644
--- a/gdb/testsuite/gdb.mi/mi-nsthrexec.exp
+++ b/gdb/testsuite/gdb.mi/mi-nsthrexec.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"set non-stop on\""
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
}
mi_gdb_test "-gdb-set mi-async 1" ".*"
diff --git a/gdb/testsuite/gdb.mi/mi-pending.c b/gdb/testsuite/gdb.mi/mi-pending.c
index 3e645ab..9bb1537 100644
--- a/gdb/testsuite/gdb.mi/mi-pending.c
+++ b/gdb/testsuite/gdb.mi/mi-pending.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-pending.exp b/gdb/testsuite/gdb.mi/mi-pending.exp
index 4358c18..4231671 100644
--- a/gdb/testsuite/gdb.mi/mi-pending.exp
+++ b/gdb/testsuite/gdb.mi/mi-pending.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ if { [gdb_compile_pthreads $srcdir/$subdir/$srcfile $binfile executable $exec_op
}
# Start with a fresh gdb.
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
mi_load_shlibs $lib_sl1
@@ -105,7 +105,7 @@ mi_expect_stop "breakpoint-hit" "pendfunc1" ".*" ".*" ".*" \
mi_send_resuming_command "exec-continue" "continuing execution to skip conditional bp"
-# We should not stop on the conditional breakpoint yet, but we stop on the original bp.
+# We should not stop on the conditional breakpoint yet, but we stop on the original bp.
mi_expect_stop "breakpoint-hit" "pendfunc1" ".*" ".*" ".*" \
{ "" "disp=\"keep\"" } \
"Run till MI pending breakpoint on pendfunc1 a second time"
diff --git a/gdb/testsuite/gdb.mi/mi-pendshr.c b/gdb/testsuite/gdb.mi/mi-pendshr.c
index c5c3315..1958260 100644
--- a/gdb/testsuite/gdb.mi/mi-pendshr.c
+++ b/gdb/testsuite/gdb.mi/mi-pendshr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-pendshr2.c b/gdb/testsuite/gdb.mi/mi-pendshr2.c
index b58504b..7019286 100644
--- a/gdb/testsuite/gdb.mi/mi-pendshr2.c
+++ b/gdb/testsuite/gdb.mi/mi-pendshr2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-pthreads.exp b/gdb/testsuite/gdb.mi/mi-pthreads.exp
index c151d43..13ea6ba 100644
--- a/gdb/testsuite/gdb.mi/mi-pthreads.exp
+++ b/gdb/testsuite/gdb.mi/mi-pthreads.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ proc check_mi_thread_command_set {} {
mi_runto done_making_threads
set thread_list [get_mi_thread_list "in check_mi_thread_command_set"]
-
+
mi_gdb_test "-thread-select" \
{\^error,msg="-thread-select: USAGE: threadnum."} \
"check_mi_thread_command_set: -thread-select"
@@ -63,7 +63,7 @@ if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $option
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-py-modify-bp.c b/gdb/testsuite/gdb.mi/mi-py-modify-bp.c
index e399d51..0b7ccc5 100644
--- a/gdb/testsuite/gdb.mi/mi-py-modify-bp.c
+++ b/gdb/testsuite/gdb.mi/mi-py-modify-bp.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-py-modify-bp.exp b/gdb/testsuite/gdb.mi/mi-py-modify-bp.exp
index 79fcf9f..5175899 100644
--- a/gdb/testsuite/gdb.mi/mi-py-modify-bp.exp
+++ b/gdb/testsuite/gdb.mi/mi-py-modify-bp.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if {[build_executable $testfile.exp $testfile $srcfile] == -1} {
set remote_python_file [gdb_remote_download host \
${srcdir}/${subdir}/${testfile}.py]
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_runto_main
# Delete all breakpoints, watchpoints, tracepoints, and catchpoints.
diff --git a/gdb/testsuite/gdb.mi/mi-py-modify-bp.py b/gdb/testsuite/gdb.mi/mi-py-modify-bp.py
index 242d94c..cbca71a 100644
--- a/gdb/testsuite/gdb.mi/mi-py-modify-bp.py
+++ b/gdb/testsuite/gdb.mi/mi-py-modify-bp.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-read-memory.exp b/gdb/testsuite/gdb.mi/mi-read-memory.exp
index f5466f9..4469123 100644
--- a/gdb/testsuite/gdb.mi/mi-read-memory.exp
+++ b/gdb/testsuite/gdb.mi/mi-read-memory.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_runto_main
mi_next_to "main" "" "mi-read-memory.c" "20" "next at main"
diff --git a/gdb/testsuite/gdb.mi/mi-record-changed.exp b/gdb/testsuite/gdb.mi/mi-record-changed.exp
index ce119f8..986efd9 100644
--- a/gdb/testsuite/gdb.mi/mi-record-changed.exp
+++ b/gdb/testsuite/gdb.mi/mi-record-changed.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
load_lib mi-support.exp
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_runto_main
diff --git a/gdb/testsuite/gdb.mi/mi-reg-undefined.S b/gdb/testsuite/gdb.mi/mi-reg-undefined.S
index 20c3a2b..4595570 100644
--- a/gdb/testsuite/gdb.mi/mi-reg-undefined.S
+++ b/gdb/testsuite/gdb.mi/mi-reg-undefined.S
@@ -1,4 +1,4 @@
-/* Copyright 2013-2024 Free Software Foundation, Inc.
+/* Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-reg-undefined.c b/gdb/testsuite/gdb.mi/mi-reg-undefined.c
index da93f2a..fbada64 100644
--- a/gdb/testsuite/gdb.mi/mi-reg-undefined.c
+++ b/gdb/testsuite/gdb.mi/mi-reg-undefined.c
@@ -1,4 +1,4 @@
-/* Copyright 2013-2024 Free Software Foundation, Inc.
+/* Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-reg-undefined.exp b/gdb/testsuite/gdb.mi/mi-reg-undefined.exp
index c43743d..d3ca0bc 100644
--- a/gdb/testsuite/gdb.mi/mi-reg-undefined.exp
+++ b/gdb/testsuite/gdb.mi/mi-reg-undefined.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,11 +29,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
-if ![mi_runto stop_frame] {
+if {![mi_runto stop_frame]} {
perror "Failed to stop in stop_frame"
return -1
}
diff --git a/gdb/testsuite/gdb.mi/mi-regs.exp b/gdb/testsuite/gdb.mi/mi-regs.exp
index 7ec63e2..aae00a6 100644
--- a/gdb/testsuite/gdb.mi/mi-regs.exp
+++ b/gdb/testsuite/gdb.mi/mi-regs.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -108,7 +108,7 @@ require {istarget "sparc-*-*"}
mi_clean_restart
sparc_register_tests_no_exec
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_runto_main
sparc_register_tests
diff --git a/gdb/testsuite/gdb.mi/mi-return.exp b/gdb/testsuite/gdb.mi/mi-return.exp
index dafa150..665be99 100644
--- a/gdb/testsuite/gdb.mi/mi-return.exp
+++ b/gdb/testsuite/gdb.mi/mi-return.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
@@ -40,8 +40,8 @@ proc test_return_simple {} {
global hex fullname_syntax srcfile
set line_callee3_head [gdb_get_line_number "callee3 ("]
- set line_callee3_call [expr $line_callee3_head + 2]
- set line_callee3_close_brace [expr $line_callee3_head + 3]
+ set line_callee3_call [expr {$line_callee3_head + 2}]
+ set line_callee3_close_brace [expr {$line_callee3_head + 3}]
mi_gdb_test "111-exec-return" "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"($line_callee3_call|$line_callee3_close_brace)\",arch=\"\[^\"\]+\"\}" "return from callee4 now"
}
diff --git a/gdb/testsuite/gdb.mi/mi-reverse.exp b/gdb/testsuite/gdb.mi/mi-reverse.exp
index 0a1f684..5f6eb3f 100644
--- a/gdb/testsuite/gdb.mi/mi-reverse.exp
+++ b/gdb/testsuite/gdb.mi/mi-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,14 +39,14 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
- if [mi_gdb_test "-interpreter-exec console record" \
- "=record-started,thread-group=\"i1\",method=\"full\"\r\n\\^done" \
- "Turn on process record"] {
+ if {[mi_gdb_test "-interpreter-exec console record" \
+ "=record-started,thread-group=\"i1\",method=\"full\"\r\n\\^done" \
+ "Turn on process record"]} {
warning "Fail to activate process record/replay, tests in this group will not be performed.\n"
return -1
}
@@ -54,20 +54,20 @@ if [supports_process_record] {
# Locate line numbers in basics.c.
set line_callee4_head [gdb_get_line_number "callee4 ("]
-set line_callee4_body [expr $line_callee4_head + 2]
+set line_callee4_body [expr {$line_callee4_head + 2}]
set line_callee3_head [gdb_get_line_number "callee3 ("]
-set line_callee3_body [expr $line_callee3_head + 2]
-set line_callee3_close [expr $line_callee3_head + 3]
+set line_callee3_body [expr {$line_callee3_head + 2}]
+set line_callee3_close [expr {$line_callee3_head + 3}]
set line_callee2_head [gdb_get_line_number "callee2 ("]
-set line_callee2_body [expr $line_callee2_head + 2]
-set line_callee2_close [expr $line_callee2_head + 3]
+set line_callee2_body [expr {$line_callee2_head + 2}]
+set line_callee2_close [expr {$line_callee2_head + 3}]
set line_callee1_head [gdb_get_line_number "callee1 ("]
-set line_callee1_body [expr $line_callee1_head + 2]
-set line_callee1_close [expr $line_callee1_head + 3]
+set line_callee1_body [expr {$line_callee1_head + 2}]
+set line_callee1_close [expr {$line_callee1_head + 3}]
set line_callme_head [gdb_get_line_number "callme"]
-set line_callme_body [expr $line_callme_head + 2]
+set line_callme_body [expr {$line_callme_head + 2}]
set line_main_head [gdb_get_line_number "main ("]
-set line_main_body [expr $line_main_head + 2]
+set line_main_body [expr {$line_main_head + 2}]
set line_main_hello [gdb_get_line_number "Hello, World!"]
set line_main_callme_1 [gdb_get_line_number "callme (1"]
diff --git a/gdb/testsuite/gdb.mi/mi-simplerun.exp b/gdb/testsuite/gdb.mi/mi-simplerun.exp
index 6071031..b34097e 100644
--- a/gdb/testsuite/gdb.mi/mi-simplerun.exp
+++ b/gdb/testsuite/gdb.mi/mi-simplerun.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
@@ -42,13 +42,13 @@ proc test_breakpoints_creation_and_listing {} {
global srcfile
set line_callee4_head [gdb_get_line_number "callee4 ("]
- set line_callee4_body [expr $line_callee4_head + 2]
+ set line_callee4_body [expr {$line_callee4_head + 2}]
set line_callee3_head [gdb_get_line_number "callee3 ("]
- set line_callee3_body [expr $line_callee3_head + 2]
+ set line_callee3_body [expr {$line_callee3_head + 2}]
set line_callee2_head [gdb_get_line_number "callee2 ("]
- set line_callee2_body [expr $line_callee2_head + 2]
+ set line_callee2_body [expr {$line_callee2_head + 2}]
set line_main_head [gdb_get_line_number "main ("]
- set line_main_body [expr $line_main_head + 2]
+ set line_main_body [expr {$line_main_head + 2}]
# Insert some breakpoints and list them
# Also, disable some so they do not interfere with other tests
@@ -96,7 +96,7 @@ proc test_breakpoints_creation_and_listing {} {
proc test_running_the_program {} {
set line_main_head [gdb_get_line_number "main ("]
- set line_main_body [expr $line_main_head + 2]
+ set line_main_body [expr {$line_main_head + 2}]
# Run the program without args, then specify srgs and rerun the program
# Tests:
@@ -115,14 +115,14 @@ proc test_controlled_execution {} {
global hex
set line_callee4_head [gdb_get_line_number "callee4 ("]
- set line_callee4_body [expr $line_callee4_head + 2]
+ set line_callee4_body [expr {$line_callee4_head + 2}]
set line_callee3_head [gdb_get_line_number "callee3 ("]
- set line_callee3_call [expr $line_callee3_head + 2]
- set line_callee3_close_brace [expr $line_callee3_head + 3]
+ set line_callee3_call [expr {$line_callee3_head + 2}]
+ set line_callee3_close_brace [expr {$line_callee3_head + 3}]
set line_callee1_head [gdb_get_line_number "callee1 ("]
- set line_callee1_body [expr $line_callee1_head + 2]
+ set line_callee1_body [expr {$line_callee1_head + 2}]
set line_main_head [gdb_get_line_number "main ("]
- set line_main_body [expr $line_main_head + 2]
+ set line_main_body [expr {$line_main_head + 2}]
# Continue execution until a breakpoint is reached, step into calls, verifying
# if the arguments are correctly shown, continue to the end of a called
@@ -133,7 +133,7 @@ proc test_controlled_execution {} {
# -exec-step
# -exec-finish
- mi_next_to "main" "" "basics.c" [expr $line_main_body + 1] "next at main"
+ mi_next_to "main" "" "basics.c" [expr {$line_main_body + 1}] "next at main"
# FIXME: A string argument is not printed right; should be fixed and
# we should look for the right thing here.
diff --git a/gdb/testsuite/gdb.mi/mi-solib.exp b/gdb/testsuite/gdb.mi/mi-solib.exp
index 737fc96..8ddca8d 100644
--- a/gdb/testsuite/gdb.mi/mi-solib.exp
+++ b/gdb/testsuite/gdb.mi/mi-solib.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-stack.c b/gdb/testsuite/gdb.mi/mi-stack.c
index 97701a9..ecf670e 100644
--- a/gdb/testsuite/gdb.mi/mi-stack.c
+++ b/gdb/testsuite/gdb.mi/mi-stack.c
@@ -1,4 +1,4 @@
-/* Copyright 1999-2024 Free Software Foundation, Inc.
+/* Copyright 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi-stack.exp b/gdb/testsuite/gdb.mi/mi-stack.exp
index 6127d83..ebd685f 100644
--- a/gdb/testsuite/gdb.mi/mi-stack.exp
+++ b/gdb/testsuite/gdb.mi/mi-stack.exp
@@ -1,4 +1,4 @@
-# Copyright 2000-2024 Free Software Foundation, Inc.
+# Copyright 2000-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
@@ -87,7 +87,7 @@ proc test_stack_args_listing {} {
# -stack-list-arguments 1
# -stack-list-arguments 1 1 1
# -stack-list-arguments 1 1 3
- # -stack-list-arguments
+ # -stack-list-arguments
# -stack-list-arguments 1 1 300
# -stack-list-arguments 2 1 1
# -stack-list-arguments --simple-values 1 1
diff --git a/gdb/testsuite/gdb.mi/mi-start.c b/gdb/testsuite/gdb.mi/mi-start.c
index 0cc6678..e7ce0a6 100644
--- a/gdb/testsuite/gdb.mi/mi-start.c
+++ b/gdb/testsuite/gdb.mi/mi-start.c
@@ -1,4 +1,4 @@
-/* Copyright 2013-2024 Free Software Foundation, Inc.
+/* Copyright 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi-start.exp b/gdb/testsuite/gdb.mi/mi-start.exp
index 7792078..d384230 100644
--- a/gdb/testsuite/gdb.mi/mi-start.exp
+++ b/gdb/testsuite/gdb.mi/mi-start.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-stepi.exp b/gdb/testsuite/gdb.mi/mi-stepi.exp
index 28aa293..f2871dc 100644
--- a/gdb/testsuite/gdb.mi/mi-stepi.exp
+++ b/gdb/testsuite/gdb.mi/mi-stepi.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ proc test_stepi_nexti {} {
global hex fullname_syntax srcfile
set line_main_head [gdb_get_line_number "main ("]
- set line_main_body [expr $line_main_head + 2]
+ set line_main_body [expr {$line_main_head + 2}]
set line_main_hello [gdb_get_line_number "Hello, World!"]
set line [mi_execute_to "exec-step-instruction" "end-stepping-range" "main" "" \
@@ -44,7 +44,7 @@ proc test_stepi_nexti {} {
pass "step-instruction at main, line check"
} else {
fail "step-instruction at main, line check"
- }
+ }
set line [mi_execute_to "exec-next-instruction" "end-stepping-range" "main" "" \
".*basics.c" "\[0-9\]+" "" "next-instruction at main"]
@@ -63,7 +63,7 @@ proc test_stepi_nexti {} {
}
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_runto_main
test_stepi_nexti
diff --git a/gdb/testsuite/gdb.mi/mi-stepn.c b/gdb/testsuite/gdb.mi/mi-stepn.c
index c52db0e..0029146 100644
--- a/gdb/testsuite/gdb.mi/mi-stepn.c
+++ b/gdb/testsuite/gdb.mi/mi-stepn.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-stepn.exp b/gdb/testsuite/gdb.mi/mi-stepn.exp
index c01fb22..85b2092 100644
--- a/gdb/testsuite/gdb.mi/mi-stepn.exp
+++ b/gdb/testsuite/gdb.mi/mi-stepn.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,11 +22,11 @@ set MIFLAGS "-i=mi"
standard_testfile
set opts {debug}
-if [build_executable ${testfile}.exp ${testfile} ${srcfile} $opts] {
+if {[build_executable ${testfile}.exp ${testfile} ${srcfile} $opts]} {
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
if {[mi_runto_main] < 0} {
return -1
diff --git a/gdb/testsuite/gdb.mi/mi-sym-info-1.c b/gdb/testsuite/gdb.mi/mi-sym-info-1.c
index fb1697d..42b5840 100644
--- a/gdb/testsuite/gdb.mi/mi-sym-info-1.c
+++ b/gdb/testsuite/gdb.mi/mi-sym-info-1.c
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi-sym-info-2.c b/gdb/testsuite/gdb.mi/mi-sym-info-2.c
index 05f0c80..ebf021f 100644
--- a/gdb/testsuite/gdb.mi/mi-sym-info-2.c
+++ b/gdb/testsuite/gdb.mi/mi-sym-info-2.c
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi-sym-info.exp b/gdb/testsuite/gdb.mi/mi-sym-info.exp
index 47ca515..6b0bf2d 100644
--- a/gdb/testsuite/gdb.mi/mi-sym-info.exp
+++ b/gdb/testsuite/gdb.mi/mi-sym-info.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ if {[build_executable "failed to prepare" ${testfile} \
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
# Don't run to main to avoid increasing the search scope to include
# debug info of shared libraries like libc, libgcc, etc.
diff --git a/gdb/testsuite/gdb.mi/mi-syn-frame.exp b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
index b059d12..11e208d 100644
--- a/gdb/testsuite/gdb.mi/mi-syn-frame.exp
+++ b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
mi_runto_main
@@ -91,7 +91,7 @@ mi_gdb_test "409-stack-list-frames 0 0" \
#
# Call bar() by hand, which should get an exception while running.
-#
+#
mi_gdb_test "410-data-evaluate-expression bar()" \
".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwind-on-signal on\\\\\".\\\\nEvaluation of the expression containing the function\\\\n\\(bar\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \
diff --git a/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.c b/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.c
index 8efcec0..f1aee80 100644
--- a/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.c
+++ b/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp b/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp
index 261ab7d..e07767c 100644
--- a/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp
+++ b/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,9 +24,9 @@ set MIFLAGS "-i=mi"
# We need to do things a little differently when using the remote protocol.
set is_remote \
- [expr [target_info exists gdb_protocol] \
- && ([string equal [target_info gdb_protocol] "remote"] \
- || [string equal [target_info gdb_protocol] "extended-remote"])]
+ [expr {[target_info exists gdb_protocol] \
+ && ([string equal [target_info gdb_protocol] "remote"] \
+ || [string equal [target_info gdb_protocol] "extended-remote"])}]
standard_testfile
@@ -47,7 +47,7 @@ foreach_mi_ui_mode mode {
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"maint set target-non-stop on\""
append GDBFLAGS " -ex \"set mi-async on\""
- mi_clean_restart $binfile $start_ops
+ mi_clean_restart $::testfile $start_ops
}
mi_runto_main
diff --git a/gdb/testsuite/gdb.mi/mi-thread-specific-bp.c b/gdb/testsuite/gdb.mi/mi-thread-specific-bp.c
index 8ee1339..c42f063 100644
--- a/gdb/testsuite/gdb.mi/mi-thread-specific-bp.c
+++ b/gdb/testsuite/gdb.mi/mi-thread-specific-bp.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp b/gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp
index 6026e7b..c8543f4 100644
--- a/gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp
+++ b/gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[mi_clean_restart]} {
standard_testfile
-if [build_executable ${testfile}.exp ${binfile} ${srcfile}] {
+if {[build_executable ${testfile}.exp ${binfile} ${srcfile}]} {
return -1
}
@@ -90,7 +90,7 @@ foreach_mi_ui_mode mode {
set start_ops ""
}
- if {[mi_clean_restart $binfile $start_ops]} {
+ if {[mi_clean_restart $::testfile $start_ops]} {
break
}
diff --git a/gdb/testsuite/gdb.mi/mi-threads-interrupt.c b/gdb/testsuite/gdb.mi/mi-threads-interrupt.c
index 7d0feb1..19cfe07 100644
--- a/gdb/testsuite/gdb.mi/mi-threads-interrupt.c
+++ b/gdb/testsuite/gdb.mi/mi-threads-interrupt.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-threads-interrupt.exp b/gdb/testsuite/gdb.mi/mi-threads-interrupt.exp
index 69eb55b..8aab3b8 100644
--- a/gdb/testsuite/gdb.mi/mi-threads-interrupt.exp
+++ b/gdb/testsuite/gdb.mi/mi-threads-interrupt.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ proc test_continue_interrupt { } {
global binfile
global async
- if {[mi_clean_restart $binfile]} {
+ if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-undefined-cmd.exp b/gdb/testsuite/gdb.mi/mi-undefined-cmd.exp
index a3a57af..be90e36 100644
--- a/gdb/testsuite/gdb.mi/mi-undefined-cmd.exp
+++ b/gdb/testsuite/gdb.mi/mi-undefined-cmd.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-until.exp b/gdb/testsuite/gdb.mi/mi-until.exp
index 0ce5abc..b027c76 100644
--- a/gdb/testsuite/gdb.mi/mi-until.exp
+++ b/gdb/testsuite/gdb.mi/mi-until.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
@@ -67,7 +67,7 @@ proc test_until {} {
# after foo is over.
set line [gdb_get_line_number "at-return"]
mi_execute_to "exec-until until.c:$line" "location-reached" "main" ""\
- ".*until.c" "([expr $line-2]|[expr $line-1])" ""\
+ ".*until.c" "([expr {$line-2}]|[expr {$line-1}])" ""\
"until after current function"
}
diff --git a/gdb/testsuite/gdb.mi/mi-var-block.exp b/gdb/testsuite/gdb.mi/mi-var-block.exp
index de10188..3914c3a 100644
--- a/gdb/testsuite/gdb.mi/mi-var-block.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-block.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-var-child-f.exp b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
index 441c3a0..4856e3d 100644
--- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-var-child.c b/gdb/testsuite/gdb.mi/mi-var-child.c
index f438315..692f9f5 100644
--- a/gdb/testsuite/gdb.mi/mi-var-child.c
+++ b/gdb/testsuite/gdb.mi/mi-var-child.c
@@ -1,4 +1,4 @@
-/* Copyright 1999-2024 Free Software Foundation, Inc.
+/* Copyright 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp
index 9a23335..c69b72a 100644
--- a/gdb/testsuite/gdb.mi/mi-var-child.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-child.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
@@ -667,7 +667,7 @@ mi_varobj_update * {} "update all vars. None changed"
# Step over "struct_declarations.integer = 123;"
mi_step_to do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_123 + 1] "step \$line_dct_123 + 1"
+ [expr {$line_dct_123 + 1}] "step \$line_dct_123 + 1"
# Test: c_variable-5.2
# Desc: check that integer changed
@@ -679,7 +679,7 @@ mi_varobj_update * {struct_declarations.integer} \
# bar = 2121;
# foo = &bar;
mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_123 + 4] {} "step \$line_dct_123 + 4"
+ [expr {$line_dct_123 + 4}] {} "step \$line_dct_123 + 4"
# Test: c_variable-5.3
# Desc: check that char_ptr changed
@@ -688,7 +688,7 @@ mi_varobj_update * {struct_declarations.char_ptr struct_declarations.char_ptr.\\
# Step over "struct_declarations.int_ptr_ptr = &foo;"
mi_step_to do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_123 + 5] "step \$line_dct_123 + 5"
+ [expr {$line_dct_123 + 5}] "step \$line_dct_123 + 5"
# Test: c_variable-5.4
# Desc: check that int_ptr_ptr and children changed
@@ -702,7 +702,7 @@ mi_varobj_update * {weird->int_ptr_ptr
# Step over "weird->long_array[0] = 1234;"
mi_step_to do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_123 + 6] "step \$line_dct_123 + 6"
+ [expr {$line_dct_123 + 6}] "step \$line_dct_123 + 6"
# Test: c_variable-5.5
# Desc: check that long_array[0] changed
@@ -711,7 +711,7 @@ mi_varobj_update * {struct_declarations.long_array.0} \
# Step over "struct_declarations.long_array[1] = 2345;"
mi_step_to do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_123 + 7] "step \$line_dct_123 + 7"
+ [expr {$line_dct_123 + 7}] "step \$line_dct_123 + 7"
# Test: c_variable-5.6
# Desc: check that long_array[1] changed
@@ -720,7 +720,7 @@ mi_varobj_update * {struct_declarations.long_array.1} \
# Step over "weird->long_array[2] = 3456;"
mi_step_to do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_123 + 8] "step \$line_dct_123 + 8"
+ [expr {$line_dct_123 + 8}] "step \$line_dct_123 + 8"
# Test: c_variable-5.7
# Desc: check that long_array[2] changed
@@ -754,7 +754,7 @@ mi_varobj_update * {struct_declarations.long_array.3
# Step over "weird->func_ptr = nothing";
mi_step_to do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_nothing + 1] "step \$line_dct_nothing + 1"
+ [expr {$line_dct_nothing + 1}] "step \$line_dct_nothing + 1"
# Test: c_variable-5.9
# Desc: check that func_ptr changed
@@ -763,19 +763,19 @@ mi_varobj_update * {struct_declarations.func_ptr} \
# Step over "weird->func_ptr_struct = nothing1"
mi_step_to do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_nothing + 2] "step \$line_dct_nothing + 2"
+ [expr {$line_dct_nothing + 2}] "step \$line_dct_nothing + 2"
mi_varobj_update * {struct_declarations.func_ptr_struct} \
"update all vars struct_declarations.func_ptr_struct changed"
# Step over "weird->func_ptr_ptr = nothing2"
mi_step_to do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_nothing + 3] "step \$line_dct_nothing + 3"
+ [expr {$line_dct_nothing + 3}] "step \$line_dct_nothing + 3"
mi_varobj_update * {struct_declarations.func_ptr_ptr} \
"update all vars struct_declarations.func_ptr_ptr changed"
# Step over "struct_declarations.long_array[10] = 3456";
mi_step_to do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_nothing + 4] "step \$line_dct_nothing + 4"
+ [expr {$line_dct_nothing + 4}] "step \$line_dct_nothing + 4"
mi_gdb_test "-var-update --no-values *" \
"\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.10\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
@@ -837,7 +837,7 @@ mi_gdb_test "-var-delete weird->int_ptr_ptr" \
set line_dct_snp0 [gdb_get_line_number "psnp = &snp0;"]
mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1"
+ [expr {$line_dct_snp0 + 1}] {} "step \$line_dct_snp0 + 1"
# Test: c_variable-5.10
# Desc: create psnp->char_ptr
@@ -987,7 +987,7 @@ mi_create_varobj "psnp->ptrs" "psnp->ptrs" \
# Test: c_variable-5.31
# Desc: children of psnp->ptrs
-mi_list_varobj_children "psnp->ptrs" {
+mi_list_varobj_children "psnp->ptrs" {
{psnp->ptrs.0 0 4 {struct _struct_n_pointer \*}}
{psnp->ptrs.1 1 4 {struct _struct_n_pointer \*}}
{psnp->ptrs.2 2 4 {struct _struct_n_pointer \*}}
@@ -1123,7 +1123,7 @@ mi_list_varobj_children "psnp->ptrs.0.next.next.ptrs" {
# Step over "snp0.char_ptr = &b3;"
mi_step_to do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2"
+ [expr {$line_dct_snp0 + 2}] "step \$line_dct_snp0 + 2"
# Test: c_variable-5.47
# Desc: check that psnp->char_ptr (and [0].char_ptr) changed
@@ -1136,7 +1136,7 @@ mi_varobj_update * {psnp->ptrs.0.char_ptr
# Step over "snp1.char_ptr = &c3;"
mi_step_to do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3"
+ [expr {$line_dct_snp0 + 3}] "step \$line_dct_snp0 + 3"
# Test: c_variable-5.48
# Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed
@@ -1150,7 +1150,7 @@ mi_varobj_update * {psnp->ptrs.0.next.char_ptr
# Step over "snp2.char_ptr = &a3;"
mi_step_to do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4"
+ [expr {$line_dct_snp0 + 4}] "step \$line_dct_snp0 + 4"
# Test: c_variable-5.49
# Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed
@@ -1160,7 +1160,7 @@ mi_varobj_update * {psnp->ptrs.0.next.next.char_ptr} \
# Step over "snp0.long_ptr = &y3;"
mi_step_to do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5"
+ [expr {$line_dct_snp0 + 5}] "step \$line_dct_snp0 + 5"
# Test: c_variable-5.50
# Desc: check that psnp->long_ptr (and [0].long_ptr) changed
@@ -1174,7 +1174,7 @@ mi_varobj_update * {psnp->ptrs.0.long_ptr psnp->long_ptr
# Step over "snp1.long_ptr = &x3;"
mi_step_to do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6"
+ [expr {$line_dct_snp0 + 6}] "step \$line_dct_snp0 + 6"
# Test: c_variable-5.51
# Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed
@@ -1191,7 +1191,7 @@ clear_xfail *-*-*
# Step over "snp2.long_ptr = &z3;"
mi_step_to do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7"
+ [expr {$line_dct_snp0 + 7}] "step \$line_dct_snp0 + 7"
# Test: c_variable-5.52
# Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed
diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
index 1f97200..850cb99 100644
--- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
@@ -150,7 +150,7 @@ mi_gdb_test "-var-update *" \
"update all vars: linteger changed"
# Step over "lpinteger = &linteger;"
-mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 1] "step at do_locals_tests, 2"
+mi_step_to "do_locals_tests" "" "var-cmd.c" [expr {$line_dlt_linteger + 1}] "step at do_locals_tests, 2"
# Test: c_variable-2.3
# Desc: check whether only lpinteger changed
@@ -159,7 +159,7 @@ mi_gdb_test "-var-update *" \
"update all vars: lpinteger changed"
# Step over "lcharacter = 'a';"
-mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 2] "step at do_locals_tests, 3"
+mi_step_to "do_locals_tests" "" "var-cmd.c" [expr {$line_dlt_linteger + 2}] "step at do_locals_tests, 3"
# Test: c_variable-2.4
# Desc: check whether only lcharacter changed
@@ -168,7 +168,7 @@ mi_gdb_test "-var-update *" \
"update all vars: lcharacter changed"
# Step over "lpcharacter = &lcharacter;"
-mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 3] "step at do_locals_tests, 4"
+mi_step_to "do_locals_tests" "" "var-cmd.c" [expr {$line_dlt_linteger + 3}] "step at do_locals_tests, 4"
# Test: c_variable-2.5
# Desc: check whether only lpcharacter changed
@@ -189,7 +189,7 @@ mi_gdb_test "-var-update *" \
# lsimple.character = 'a';
mi_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \
- "var-cmd.c" [expr $line_dlt_linteger + 12] "" "step at do_locals_tests, 5"
+ "var-cmd.c" [expr {$line_dlt_linteger + 12}] "" "step at do_locals_tests, 5"
# Test: c_variable-2.6
# Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer,
@@ -226,7 +226,7 @@ mi_gdb_test "-var-update *" \
# lsimple.character = 'b';
mi_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \
- "var-cmd.c" [expr $line_dlt_4321 + 8] "" "step at do_locals_tests, 7"
+ "var-cmd.c" [expr {$line_dlt_4321 + 8}] "" "step at do_locals_tests, 7"
# Test: c_variable-2.8
# Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer,
@@ -238,7 +238,7 @@ mi_gdb_test "-var-update *" \
"update all vars: lsimple and others changed"
-###
+###
#
# Test assignment to variables. More tests on assignment are in other files.
#
@@ -366,7 +366,7 @@ mi_gdb_test "-var-update *" \
# Check that assignment of function and array values
# promotes the assigned value to function pointer/data
-# pointer before comparing with the existing value,
+# pointer before comparing with the existing value,
# and does not incorrectly make the value as changed.
mi_gdb_test "-var-assign func do_block_tests" \
"\\^done,value=\"$hex <do_block_tests>\"" \
@@ -398,7 +398,7 @@ mi_gdb_test "-var-update *" \
######
-# End of assign tests
+# End of assign tests
#####
set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"]
@@ -418,7 +418,7 @@ mi_gdb_test "-var-create linteger * linteger" \
"create linteger"
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
- "var-cmd.c" [expr $line_subroutine1_body + 1] "step at subroutine1"
+ "var-cmd.c" [expr {$line_subroutine1_body + 1}] "step at subroutine1"
# Test: c_variable-2.12
# Desc: change global_simple.integer
@@ -434,7 +434,7 @@ mi_gdb_test "-var-update *" \
clear_xfail *-*-*
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
- "var-cmd.c" [expr $line_subroutine1_body + 2] "step at subroutine1, 2"
+ "var-cmd.c" [expr {$line_subroutine1_body + 2}] "step at subroutine1, 2"
# Test: c_variable-2.13
# Desc: change subroutine1 local i
@@ -443,7 +443,7 @@ mi_gdb_test "-var-update *" \
"update all vars: i changed"
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
- "var-cmd.c" [expr $line_subroutine1_body + 3] "step at subroutine1, 3"
+ "var-cmd.c" [expr {$line_subroutine1_body + 3}] "step at subroutine1, 3"
# Test: c_variable-2.14
# Desc: change do_locals_tests local llong
@@ -453,7 +453,7 @@ mi_gdb_test "-var-update *" \
set line_dlt_call_subroutine1 [gdb_get_line_number "subroutine1 (linteger, &llong);"]
mi_next_to "do_locals_tests" "" "var-cmd.c" \
- [expr $line_dlt_call_subroutine1 + 1] "next out of subroutine1"
+ [expr {$line_dlt_call_subroutine1 + 1}] "next out of subroutine1"
# Test: c_variable-2.15
# Desc: check for out of scope subroutine1 locals
@@ -560,7 +560,7 @@ mi_gdb_test "-var-update selected_a" \
"\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"int\",new_num_children=\"0\",has_more=\"0\"\}\\\]" \
"update selected_a in do_special_tests"
-if [is_remote host] {
+if {[is_remote host]} {
set filename ${testfile}
} else {
set filename ${binfile}
diff --git a/gdb/testsuite/gdb.mi/mi-var-cp.cc b/gdb/testsuite/gdb.mi/mi-var-cp.cc
index c40bdcf..5c4320e 100644
--- a/gdb/testsuite/gdb.mi/mi-var-cp.cc
+++ b/gdb/testsuite/gdb.mi/mi-var-cp.cc
@@ -1,4 +1,4 @@
-/* Copyright 2006-2024 Free Software Foundation, Inc.
+/* Copyright 2006-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-var-cp.exp b/gdb/testsuite/gdb.mi/mi-var-cp.exp
index b0c711c..eee1007 100644
--- a/gdb/testsuite/gdb.mi/mi-var-cp.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-cp.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-var-create-rtti.c b/gdb/testsuite/gdb.mi/mi-var-create-rtti.c
index a6f3025..2f11362 100644
--- a/gdb/testsuite/gdb.mi/mi-var-create-rtti.c
+++ b/gdb/testsuite/gdb.mi/mi-var-create-rtti.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp b/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp
index b5b0256..371d430 100644
--- a/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,11 +19,11 @@ set MIFLAGS "-i=mi"
standard_testfile .c
set opts {debug}
-if [build_executable $testfile.exp $testfile $srcfile $opts] {
+if {[build_executable $testfile.exp $testfile $srcfile $opts]} {
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
if {[mi_runto_main] < 0} {
return -1
diff --git a/gdb/testsuite/gdb.mi/mi-var-display.exp b/gdb/testsuite/gdb.mi/mi-var-display.exp
index b420d12..52a5276 100644
--- a/gdb/testsuite/gdb.mi/mi-var-display.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-display.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
@@ -96,7 +96,7 @@ mi_gdb_test "-var-evaluate-expression bar" \
# Desc: change value of bar
mi_gdb_test "-var-assign bar 3" \
"\\^done,value=\"0x3\"" \
- "assing to variable bar"
+ "assign to variable bar"
mi_gdb_test "-var-set-format bar decimal" \
"\\^done,format=\"decimal\",value=\"3\"" \
@@ -152,7 +152,7 @@ mi_gdb_test "-var-evaluate-expression foo" \
# Desc: change value of foo
mi_gdb_test "-var-assign foo 3" \
"\\^done,value=\"03\"" \
- "assing to variable foo"
+ "assign to variable foo"
mi_gdb_test "-var-set-format foo decimal" \
"\\^done,format=\"decimal\",value=\"3\"" \
@@ -624,8 +624,8 @@ mi_gdb_test "-var-list-children anone" \
# Record fp
-if ![mi_gdb_test "p/x \$fp" ".*($hex).*\\^done" "print FP register"] {
- set fp $expect_out(3,string)
+if {![mi_gdb_test "p/x \$fp" ".*($hex).*\\^done" "print FP register"]} {
+ set fp $expect_out(3,string)
}
mi_continue_to "incr_a"
diff --git a/gdb/testsuite/gdb.mi/mi-var-invalidate-shlib-lib.c b/gdb/testsuite/gdb.mi/mi-var-invalidate-shlib-lib.c
index f24b2d2..9ba19bb 100644
--- a/gdb/testsuite/gdb.mi/mi-var-invalidate-shlib-lib.c
+++ b/gdb/testsuite/gdb.mi/mi-var-invalidate-shlib-lib.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi-var-invalidate-shlib.c b/gdb/testsuite/gdb.mi/mi-var-invalidate-shlib.c
index 10daab6..a3ff6d8 100644
--- a/gdb/testsuite/gdb.mi/mi-var-invalidate-shlib.c
+++ b/gdb/testsuite/gdb.mi/mi-var-invalidate-shlib.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi-var-invalidate-shlib.exp b/gdb/testsuite/gdb.mi/mi-var-invalidate-shlib.exp
index 69e21db..7408db5 100644
--- a/gdb/testsuite/gdb.mi/mi-var-invalidate-shlib.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-invalidate-shlib.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-var-invalidate.exp b/gdb/testsuite/gdb.mi/mi-var-invalidate.exp
index 60e29a9..800c22f 100644
--- a/gdb/testsuite/gdb.mi/mi-var-invalidate.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-invalidate.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {d
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.c b/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.c
index 4ca8723..ae60aaf 100644
--- a/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.c
+++ b/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp b/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp
index b832fc3..597e2e0 100644
--- a/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-list-children-invalid-grandchild.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-var-rtti.cc b/gdb/testsuite/gdb.mi/mi-var-rtti.cc
index a9b3ee1..8e44c24 100644
--- a/gdb/testsuite/gdb.mi/mi-var-rtti.cc
+++ b/gdb/testsuite/gdb.mi/mi-var-rtti.cc
@@ -1,4 +1,4 @@
-/* Copyright 2012-2024 Free Software Foundation, Inc.
+/* Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-var-rtti.exp b/gdb/testsuite/gdb.mi/mi-var-rtti.exp
index 5060303..2482df7 100644
--- a/gdb/testsuite/gdb.mi/mi-var-rtti.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-rtti.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,11 +21,11 @@ set MIFLAGS "-i=mi"
standard_testfile .cc
set opts {debug c++}
-if [build_executable $testfile.exp $testfile $srcfile $opts] {
+if {[build_executable $testfile.exp $testfile $srcfile $opts]} {
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-vla-c99.exp b/gdb/testsuite/gdb.mi/mi-vla-c99.exp
index a8a77ac..5f23d05 100644
--- a/gdb/testsuite/gdb.mi/mi-vla-c99.exp
+++ b/gdb/testsuite/gdb.mi/mi-vla-c99.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# Contributed by Intel Corp. <keven.boell@intel.com>
#
@@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" \
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
index d0b4a22..81e2d89 100644
--- a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
+++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
# the type names can be printed differently.
set real [fortran_real4]
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-watch-nonstop.exp b/gdb/testsuite/gdb.mi/mi-watch-nonstop.exp
index b502798..36d7410 100644
--- a/gdb/testsuite/gdb.mi/mi-watch-nonstop.exp
+++ b/gdb/testsuite/gdb.mi/mi-watch-nonstop.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" }
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"set non-stop on\""
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
}
mi_gdb_test "-gdb-set mi-async 1" ".*"
diff --git a/gdb/testsuite/gdb.mi/mi-watch.exp b/gdb/testsuite/gdb.mi/mi-watch.exp
index cf97d41..1ddd94e 100644
--- a/gdb/testsuite/gdb.mi/mi-watch.exp
+++ b/gdb/testsuite/gdb.mi/mi-watch.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ proc test_watchpoint_creation_and_listing {} {
global hex
set line_callee4_head [gdb_get_line_number "callee4 ("]
- set line_callee4_body [expr $line_callee4_head + 2]
+ set line_callee4_body [expr {$line_callee4_head + 2}]
# Insert a watchpoint and list
# Tests:
@@ -68,7 +68,7 @@ proc test_awatch_creation_and_listing {} {
global hex
set line_main_head [gdb_get_line_number "main ("]
- set line_main_body [expr $line_main_head + 2]
+ set line_main_body [expr {$line_main_head + 2}]
# Insert an access watchpoint and list it
# Tests:
@@ -95,7 +95,7 @@ proc test_rwatch_creation_and_listing {} {
global hex
set line_main_head [gdb_get_line_number "main ("]
- set line_main_body [expr $line_main_head + 2]
+ set line_main_body [expr {$line_main_head + 2}]
# Insert a read watchpoint and list it.
# Tests:
@@ -121,9 +121,9 @@ proc test_watchpoint_triggering {} {
set line_callee4_return_0 [gdb_get_line_number "return 0;"]
set line_callee3_head [gdb_get_line_number "callee3 ("]
- set line_callee3_close_brace [expr $line_callee3_head + 3]
+ set line_callee3_close_brace [expr {$line_callee3_head + 3}]
- # Continue execution until the watchpoint is reached, continue again,
+ # Continue execution until the watchpoint is reached, continue again,
# to see the watchpoint go out of scope.
# Does:
# -exec-continue (Here wp triggers)
@@ -155,7 +155,7 @@ proc test_watchpoint_all {mi_mode type} {
} else {
set start_ops ""
}
- if [mi_clean_restart ${binfile} $start_ops] {
+ if {[mi_clean_restart ${::testfile} $start_ops]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.c b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.c
index 562236f..4ba8301 100644
--- a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.c
+++ b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp
index 8883f40..4b1d440 100644
--- a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp
+++ b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ set MIFLAGS "-i=mi2"
standard_testfile .s
set opts {}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.mi/mi2-amd64-entry-value.exp COMPILE=1"
set srcfile ${testfile}.c
lappend opts debug optimize=-O2
@@ -27,11 +27,11 @@ if [info exists COMPILE] {
require is_x86_64_m64_target
}
-if [build_executable ${testfile}.exp ${binfile} ${srcfile} $opts] {
+if {[build_executable ${testfile}.exp ${binfile} ${srcfile} $opts]} {
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.s b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.s
index cc5b809..bcc7775 100644
--- a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.s
+++ b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.s
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi2-cli-display.c b/gdb/testsuite/gdb.mi/mi2-cli-display.c
index b1019a0..a153b5c 100644
--- a/gdb/testsuite/gdb.mi/mi2-cli-display.c
+++ b/gdb/testsuite/gdb.mi/mi2-cli-display.c
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/mi2-cli-display.exp b/gdb/testsuite/gdb.mi/mi2-cli-display.exp
index 8c09397..993b87c 100644
--- a/gdb/testsuite/gdb.mi/mi2-cli-display.exp
+++ b/gdb/testsuite/gdb.mi/mi2-cli-display.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi2-prompt.exp b/gdb/testsuite/gdb.mi/mi2-prompt.exp
index 36f4b65..4c35074 100644
--- a/gdb/testsuite/gdb.mi/mi2-prompt.exp
+++ b/gdb/testsuite/gdb.mi/mi2-prompt.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi2-var-child.exp b/gdb/testsuite/gdb.mi/mi2-var-child.exp
index 0ca44ed..4ee19f0 100644
--- a/gdb/testsuite/gdb.mi/mi2-var-child.exp
+++ b/gdb/testsuite/gdb.mi/mi2-var-child.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
@@ -667,7 +667,7 @@ mi_varobj_update * {} "update all vars. None changed"
# Step over "struct_declarations.integer = 123;"
mi_step_to do_children_tests {} {.*var-cmd.c} \
- [expr $line_dct_123 + 1] "step \$line_dct_123 + 1"
+ [expr {$line_dct_123 + 1}] "step \$line_dct_123 + 1"
# Test: c_variable-5.2
# Desc: check that integer changed
@@ -679,7 +679,7 @@ mi_varobj_update * {struct_declarations.integer} \
# bar = 2121;
# foo = &bar;
mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
- [expr $line_dct_123 + 4] {} "step \$line_dct_123 + 4"
+ [expr {$line_dct_123 + 4}] {} "step \$line_dct_123 + 4"
# Test: c_variable-5.3
# Desc: check that char_ptr changed
@@ -689,7 +689,7 @@ mi_varobj_update * {struct_declarations.char_ptr
# Step over "struct_declarations.int_ptr_ptr = &foo;"
mi_step_to do_children_tests {} {.*var-cmd.c} \
- [expr $line_dct_123 + 5] "step \$line_dct_123 + 5"
+ [expr {$line_dct_123 + 5}] "step \$line_dct_123 + 5"
# Test: c_variable-5.4
# Desc: check that int_ptr_ptr and children changed
@@ -703,7 +703,7 @@ mi_varobj_update * {weird->int_ptr_ptr
# Step over "weird->long_array[0] = 1234;"
mi_step_to do_children_tests {} {.*var-cmd.c} \
- [expr $line_dct_123 + 6] "step \$line_dct_123 + 6"
+ [expr {$line_dct_123 + 6}] "step \$line_dct_123 + 6"
# Test: c_variable-5.5
# Desc: check that long_array[0] changed
@@ -712,7 +712,7 @@ mi_varobj_update * {struct_declarations.long_array.0} \
# Step over "struct_declarations.long_array[1] = 2345;"
mi_step_to do_children_tests {} {.*var-cmd.c} \
- [expr $line_dct_123 + 7] "step \$line_dct_123 + 7"
+ [expr {$line_dct_123 + 7}] "step \$line_dct_123 + 7"
# Test: c_variable-5.6
# Desc: check that long_array[1] changed
@@ -721,7 +721,7 @@ mi_varobj_update * {struct_declarations.long_array.1} \
# Step over "weird->long_array[2] = 3456;"
mi_step_to do_children_tests {} {.*var-cmd.c} \
- [expr $line_dct_123 + 8] "step \$line_dct_123 + 8"
+ [expr {$line_dct_123 + 8}] "step \$line_dct_123 + 8"
# Test: c_variable-5.7
# Desc: check that long_array[2] changed
@@ -755,7 +755,7 @@ mi_varobj_update * {struct_declarations.long_array.3
# Step over "weird->func_ptr = nothing;"
mi_step_to do_children_tests {} ".*${srcfile}" \
- [expr $line_dct_nothing + 1] "step \$line_dct_nothing + 1"
+ [expr {$line_dct_nothing + 1}] "step \$line_dct_nothing + 1"
# Test: c_variable-5.9
# Desc: check that func_ptr changed
@@ -777,7 +777,7 @@ mi_gdb_test "-var-delete weird->int_ptr_ptr" \
set line_dct_snp0 [gdb_get_line_number "psnp = &snp0;"]
mi_execute_to "exec-step 45" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
- [expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1"
+ [expr {$line_dct_snp0 + 1}] {} "step \$line_dct_snp0 + 1"
# Test: c_variable-5.10
# Desc: create psnp->char_ptr
@@ -928,7 +928,7 @@ mi_create_varobj "psnp->ptrs" "psnp->ptrs" \
# Test: c_variable-5.31
# Desc: children of psnp->ptrs
-mi_list_varobj_children "psnp->ptrs" {
+mi_list_varobj_children "psnp->ptrs" {
{psnp->ptrs.0 0 4 {struct _struct_n_pointer \*}}
{psnp->ptrs.1 1 4 {struct _struct_n_pointer \*}}
{psnp->ptrs.2 2 4 {struct _struct_n_pointer \*}}
@@ -1065,7 +1065,7 @@ mi_list_varobj_children "psnp->ptrs.0.next.next.ptrs" {
# Step over "snp0.char_ptr = &b3;"
mi_step_to do_children_tests {} {.*var-cmd.c} \
- [expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2"
+ [expr {$line_dct_snp0 + 2}] "step \$line_dct_snp0 + 2"
# Test: c_variable-5.47
# Desc: check that psnp->char_ptr (and [0].char_ptr) changed
@@ -1078,7 +1078,7 @@ mi_varobj_update * {psnp->ptrs.0.char_ptr
# Step over "snp1.char_ptr = &c3;"
mi_step_to do_children_tests {} {.*var-cmd.c} \
- [expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3"
+ [expr {$line_dct_snp0 + 3}] "step \$line_dct_snp0 + 3"
# Test: c_variable-5.48
# Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed
@@ -1092,7 +1092,7 @@ mi_varobj_update * {psnp->ptrs.0.next.char_ptr
# Step over "snp2.char_ptr = &a3;"
mi_step_to do_children_tests {} {.*var-cmd.c} \
- [expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4"
+ [expr {$line_dct_snp0 + 4}] "step \$line_dct_snp0 + 4"
# Test: c_variable-5.49
# Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed
@@ -1102,7 +1102,7 @@ mi_varobj_update * {psnp->ptrs.0.next.next.char_ptr} \
# Step over "snp0.long_ptr = &y3;"
mi_step_to do_children_tests {} {.*var-cmd.c} \
- [expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5"
+ [expr {$line_dct_snp0 + 5}] "step \$line_dct_snp0 + 5"
# Test: c_variable-5.50
# Desc: check that psnp->long_ptr (and [0].long_ptr) changed
@@ -1116,7 +1116,7 @@ mi_varobj_update * {psnp->ptrs.0.long_ptr psnp->long_ptr
# Step over "snp1.long_ptr = &x3;"
mi_step_to do_children_tests {} {.*var-cmd.c} \
- [expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6"
+ [expr {$line_dct_snp0 + 6}] "step \$line_dct_snp0 + 6"
# Test: c_variable-5.51
# Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed
@@ -1133,7 +1133,7 @@ clear_xfail *-*-*
# Step over "snp2.long_ptr = &z3;"
mi_step_to do_children_tests {} {.*var-cmd.c} \
- [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7"
+ [expr {$line_dct_snp0 + 7}] "step \$line_dct_snp0 + 7"
# Test: c_variable-5.52
# Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed
diff --git a/gdb/testsuite/gdb.mi/new-ui-bp-deleted.c b/gdb/testsuite/gdb.mi/new-ui-bp-deleted.c
index f41338d..4bcb21c 100644
--- a/gdb/testsuite/gdb.mi/new-ui-bp-deleted.c
+++ b/gdb/testsuite/gdb.mi/new-ui-bp-deleted.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp b/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp
index 9e52988..b5b748e 100644
--- a/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp
+++ b/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -51,7 +51,7 @@ foreach_mi_ui_mode mode {
set start_ops ""
}
- if [mi_gdb_start $start_ops] {
+ if {[mi_gdb_start $start_ops]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/new-ui-mi-sync.c b/gdb/testsuite/gdb.mi/new-ui-mi-sync.c
index c7f5ce7..2fb09b7 100644
--- a/gdb/testsuite/gdb.mi/new-ui-mi-sync.c
+++ b/gdb/testsuite/gdb.mi/new-ui-mi-sync.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp
index bf1365e..cda1e01 100644
--- a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp
+++ b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -69,7 +69,9 @@ proc do_test {sync_command} {
# in the separate MI UI. Note the "run" variant usually triggers
# =thread-group-started/=thread-created/=library-loaded as well.
with_spawn_id $gdb_main_spawn_id {
- gdb_test "add-inferior" "Added inferior 2 on connection .*"
+ # We don't need to share the connection with inferior 1 to
+ # trigger the async event.
+ gdb_test "add-inferior -no-connection" "Added inferior 2"
}
# Interrupt the program.
@@ -102,7 +104,7 @@ proc do_test {sync_command} {
}
foreach_with_prefix sync-command {"run" "continue"} {
- if {[mi_clean_restart $binfile "separate-mi-tty"] != 0} {
+ if {[mi_clean_restart $::testfile "separate-mi-tty"] != 0} {
fail "could not start gdb"
break
}
diff --git a/gdb/testsuite/gdb.mi/non-stop-exit.c b/gdb/testsuite/gdb.mi/non-stop-exit.c
index f001da1..d9ef970 100644
--- a/gdb/testsuite/gdb.mi/non-stop-exit.c
+++ b/gdb/testsuite/gdb.mi/non-stop-exit.c
@@ -1,5 +1,5 @@
/* Test program exit in non-stop mode.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/non-stop.c b/gdb/testsuite/gdb.mi/non-stop.c
index 75b2d60..03192c0 100644
--- a/gdb/testsuite/gdb.mi/non-stop.c
+++ b/gdb/testsuite/gdb.mi/non-stop.c
@@ -1,5 +1,5 @@
/* Test program for non-stop debugging.
- Copyright 1996-2024 Free Software Foundation, Inc.
+ Copyright 1996-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/ns-stale-regcache.c b/gdb/testsuite/gdb.mi/ns-stale-regcache.c
index eda7474..d573cb5 100644
--- a/gdb/testsuite/gdb.mi/ns-stale-regcache.c
+++ b/gdb/testsuite/gdb.mi/ns-stale-regcache.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/nsintrall.c b/gdb/testsuite/gdb.mi/nsintrall.c
index f362bda..36bef7e 100644
--- a/gdb/testsuite/gdb.mi/nsintrall.c
+++ b/gdb/testsuite/gdb.mi/nsintrall.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/nsmoribund.c b/gdb/testsuite/gdb.mi/nsmoribund.c
index 3a8c296..2acbffc 100644
--- a/gdb/testsuite/gdb.mi/nsmoribund.c
+++ b/gdb/testsuite/gdb.mi/nsmoribund.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/nsthrexec.c b/gdb/testsuite/gdb.mi/nsthrexec.c
index c6c288c..403aa31 100644
--- a/gdb/testsuite/gdb.mi/nsthrexec.c
+++ b/gdb/testsuite/gdb.mi/nsthrexec.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/pending.c b/gdb/testsuite/gdb.mi/pending.c
index addcd0f..d3a3f5a 100644
--- a/gdb/testsuite/gdb.mi/pending.c
+++ b/gdb/testsuite/gdb.mi/pending.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/pendshr1.c b/gdb/testsuite/gdb.mi/pendshr1.c
index 6628823..fcc568e 100644
--- a/gdb/testsuite/gdb.mi/pendshr1.c
+++ b/gdb/testsuite/gdb.mi/pendshr1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/pendshr2.c b/gdb/testsuite/gdb.mi/pendshr2.c
index e151399..518d194 100644
--- a/gdb/testsuite/gdb.mi/pendshr2.c
+++ b/gdb/testsuite/gdb.mi/pendshr2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/pr11022.c b/gdb/testsuite/gdb.mi/pr11022.c
index 1600f2a..81688ad 100644
--- a/gdb/testsuite/gdb.mi/pr11022.c
+++ b/gdb/testsuite/gdb.mi/pr11022.c
@@ -1,6 +1,6 @@
/* This test is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/pr11022.exp b/gdb/testsuite/gdb.mi/pr11022.exp
index cce58c0..1e01bf6 100644
--- a/gdb/testsuite/gdb.mi/pr11022.exp
+++ b/gdb/testsuite/gdb.mi/pr11022.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ proc test_memory_changed_observer { mi_command } {
with_test_prefix "${mi_command}" {
global srcfile binfile
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
mi_runto_main
set line_number [gdb_get_line_number "break here"]
diff --git a/gdb/testsuite/gdb.mi/print-simple-values.cc b/gdb/testsuite/gdb.mi/print-simple-values.cc
index 00f7fec..cccdba9 100644
--- a/gdb/testsuite/gdb.mi/print-simple-values.cc
+++ b/gdb/testsuite/gdb.mi/print-simple-values.cc
@@ -1,6 +1,6 @@
/* This test case is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/print-simple-values.exp b/gdb/testsuite/gdb.mi/print-simple-values.exp
index 149838a..023f87c 100644
--- a/gdb/testsuite/gdb.mi/print-simple-values.exp
+++ b/gdb/testsuite/gdb.mi/print-simple-values.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,11 +30,11 @@ lappend opts debug
lappend opts c++
lappend opts additional_flags=-std=c++11
-if [build_executable "failed to prepare" $testfile $srcfile $opts] {
+if {[build_executable "failed to prepare" $testfile $srcfile $opts]} {
return -1
}
-if [mi_clean_restart $binfile] {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/pthreads.c b/gdb/testsuite/gdb.mi/pthreads.c
index 47f32cf..8a6c5e8 100644
--- a/gdb/testsuite/gdb.mi/pthreads.c
+++ b/gdb/testsuite/gdb.mi/pthreads.c
@@ -1,5 +1,5 @@
/* Pthreads test program.
- Copyright 1996-2024 Free Software Foundation, Inc.
+ Copyright 1996-2025 Free Software Foundation, Inc.
Written by Keith Seitz of Red Hat.
Copied from gdb.threads/pthreads.c.
diff --git a/gdb/testsuite/gdb.mi/run-with-two-mi-uis.exp b/gdb/testsuite/gdb.mi/run-with-two-mi-uis.exp
index effc760..c9e352d 100644
--- a/gdb/testsuite/gdb.mi/run-with-two-mi-uis.exp
+++ b/gdb/testsuite/gdb.mi/run-with-two-mi-uis.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if {[build_executable $testfile.exp $testfile ${srcfile} "debug"] == -1} {
# UI_TO_RUN is the UI that should issue the run command.
proc do_test { ui_to_run } {
- if {[mi_clean_restart $::binfile "separate-mi-tty"] != 0} {
+ if {[mi_clean_restart $::testfile "separate-mi-tty"] != 0} {
fail "could not start gdb"
return
}
diff --git a/gdb/testsuite/gdb.mi/set-show.exp b/gdb/testsuite/gdb.mi/set-show.exp
new file mode 100644
index 0000000..0c28a5f
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/set-show.exp
@@ -0,0 +1,51 @@
+# Copyright 2021 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test the -gdb-set and -gdb-show commands.
+
+load_lib mi-support.exp
+set MIFLAGS "-i=mi"
+
+standard_testfile
+
+# Some parameters are per inferior. The value returned by -gdb-show for them
+# should be dependent on which is the current inferior.
+proc_with_prefix test_per_inferior_parameters { } {
+ mi_clean_restart
+
+ # Add a second inferior right away.
+ mi_gdb_test "-add-inferior" ".*\\^done,inferior=\"i2\"" "add inferior"
+
+ # Set distinct values on each inferior.
+ foreach_with_prefix inf {1 2} {
+ mi_gdb_test "-gdb-set --thread-group i${inf} inferior-tty /inf${inf}-tty" "\\^done" "set inferior-tty"
+ mi_gdb_test "-gdb-set --thread-group i${inf} cwd /inf${inf}-cwd" "\\^done" "set cwd"
+ mi_gdb_test "-gdb-set --thread-group i${inf} args /inf${inf}-args" "\\^done" "set args"
+ mi_gdb_test "-gdb-set --thread-group i${inf} remote exec-file /inf${inf}-ref" "\\^done" "set remote exec-file"
+ # Outputs a warning, ignore it.
+ mi_gdb_test "-gdb-set --thread-group i${inf} tdesc filename /inf${inf}-tf" ".*\\^done" "set tdesc filename"
+ }
+
+ # Check values on each inferior.
+ foreach_with_prefix inf {1 2} {
+ mi_gdb_test "-gdb-show --thread-group i${inf} inferior-tty" "\\^done,value=\"/inf${inf}-tty\"" "show inferior-tty"
+ mi_gdb_test "-gdb-show --thread-group i${inf} cwd" "\\^done,value=\"/inf${inf}-cwd\"" "show cwd"
+ mi_gdb_test "-gdb-show --thread-group i${inf} args" "\\^done,value=\"/inf${inf}-args\"" "show args"
+ mi_gdb_test "-gdb-show --thread-group i${inf} remote exec-file" "\\^done,value=\"/inf${inf}-ref\"" "show remote exec-file"
+ mi_gdb_test "-gdb-show --thread-group i${inf} tdesc filename" "\\^done,value=\"/inf${inf}-tf\"" "show tdesc filename"
+ }
+}
+
+test_per_inferior_parameters
diff --git a/gdb/testsuite/gdb.mi/solib-lib.c b/gdb/testsuite/gdb.mi/solib-lib.c
index 31ae6d3..66437ca 100644
--- a/gdb/testsuite/gdb.mi/solib-lib.c
+++ b/gdb/testsuite/gdb.mi/solib-lib.c
@@ -1,4 +1,4 @@
-/* Copyright 2011-2024 Free Software Foundation, Inc.
+/* Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/solib-main.c b/gdb/testsuite/gdb.mi/solib-main.c
index 1476fca..8aa9367 100644
--- a/gdb/testsuite/gdb.mi/solib-main.c
+++ b/gdb/testsuite/gdb.mi/solib-main.c
@@ -1,4 +1,4 @@
-/* Copyright 2011-2024 Free Software Foundation, Inc.
+/* Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.c b/gdb/testsuite/gdb.mi/user-selected-context-sync.c
index fc3cb15..843c54e 100644
--- a/gdb/testsuite/gdb.mi/user-selected-context-sync.c
+++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
index 675965f..8a4827f 100644
--- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
+++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,6 +40,8 @@ standard_testfile
# gdbserver modes are supported.
require !use_gdb_stub
+require allow_multi_inferior_tests
+
set compile_options "debug pthreads"
if {[build_executable $testfile.exp $testfile ${srcfile} ${compile_options}] == -1} {
untested "failed to compile"
@@ -111,7 +113,7 @@ proc make_cli_re { mode inf thread frame } {
}
set thread_re $all_stop_thread_re
- if [thread_is_running $mode $thread] {
+ if {[thread_is_running $mode $thread]} {
set thread_re "$thread_re\\\(running\\\)"
}
@@ -574,10 +576,8 @@ proc_with_prefix test_cli_thread { mode } {
match_re_or_ensure_no_output $mi_re "select thread, event on MI "
}
- # Do the 'thread' command to select the same thread. We shouldn't receive
- # an event on MI, since we won't actually switch thread.
-
- set mi_re ""
+ # Do the 'thread' command to select the same thread. We
+ # should see the same thread events.
with_spawn_id $gdb_main_spawn_id {
gdb_test "thread 1.2" $cli_re "select thread again"
@@ -587,6 +587,30 @@ proc_with_prefix test_cli_thread { mode } {
match_re_or_ensure_no_output $mi_re "select thread, event on MI again"
}
+ # Use the 'frame' command to select frame 1. In either mode
+ # the current thread is stopped, so this should work.
+ with_spawn_id $gdb_main_spawn_id {
+ gdb_test "frame 1" [make_cli_re $mode -1 -1 1] \
+ "select frame 1"
+ }
+
+ with_spawn_id $mi_spawn_id {
+ match_re_or_ensure_no_output [make_mi_re $mode 2 1 event] \
+ "select frame 1, event on MI"
+ }
+
+ # Reselect the current thread. GDB will switch back to
+ # frame #0, and send CLI and MI notifications.
+ with_spawn_id $gdb_main_spawn_id {
+ gdb_test "thread 1.2" $cli_re \
+ "select thread again, resetting frame"
+ }
+
+ with_spawn_id $mi_spawn_id {
+ match_re_or_ensure_no_output $mi_re \
+ "select thread again, resetting frame, event on MI"
+ }
+
# Try the 'thread' command without arguments.
set cli_re "\\\[Current thread is 1\\.2.*\\\]"
@@ -621,10 +645,9 @@ proc_with_prefix test_cli_thread { mode } {
match_re_or_ensure_no_output $mi_re "select thread, event on MI"
}
- # Do the 'thread' command to select the third thread again. Again, we
- # shouldn't receive an event on MI.
-
- set mi_re ""
+ # Do the 'thread' command to select the third thread again.
+ # We should get the same thread events again as selecting the
+ # same thread still resets the frame to #0.
with_spawn_id $gdb_main_spawn_id {
gdb_test "thread 1.3" $cli_re "select thread again"
@@ -634,6 +657,33 @@ proc_with_prefix test_cli_thread { mode } {
match_re_or_ensure_no_output $mi_re "select thread again, event on MI"
}
+ # In non-stop mode the current thread is still running, so we
+ # cannot change the selected frame.
+ if { $mode eq "all-stop" } {
+ # Use the 'frame' command to select frame 1.
+ with_spawn_id $gdb_main_spawn_id {
+ gdb_test "frame 1" [make_cli_re $mode -1 -1 1] \
+ "select frame 1"
+ }
+
+ with_spawn_id $mi_spawn_id {
+ match_re_or_ensure_no_output [make_mi_re $mode 3 1 event] \
+ "select frame 1, event on MI"
+ }
+
+ # Reselect the current thread. GDB will switch back to
+ # frame #0, and send CLI and MI notifications.
+ with_spawn_id $gdb_main_spawn_id {
+ gdb_test "thread 1.3" $cli_re \
+ "select thread again, resetting frame"
+ }
+
+ with_spawn_id $mi_spawn_id {
+ match_re_or_ensure_no_output $mi_re \
+ "select thread again, resetting frame, event on MI"
+ }
+ }
+
# Try the 'thread' command without arguments.
set cli_re "\\\[Current thread is 1\\.3 ${any}\\\]"
@@ -985,7 +1035,7 @@ proc_with_prefix test_mi_stack_select_frame { mode } {
# Now use the '-stack-select-frame' command with the --frame
# option, this verifies that even when the frame GDB would
- # swith to is the same as the frame specified with --frame, an
+ # switch to is the same as the frame specified with --frame, an
# event is still sent to the CLI.
set cli_re [make_cli_re $mode -1 -1 0]
@@ -1104,18 +1154,44 @@ proc_with_prefix test_cli_in_mi_thread { mode cli_in_mi_mode } {
match_re_or_ensure_no_output "$cli_re\r\n" "select thread, event on CLI"
}
- # Do the 'thread' command to select the same thread. We shouldn't
- # receive an event on CLI, since we won't actually switch thread.
-
- set mi_re [make_cli_in_mi_re $command $cli_in_mi_mode $mode 0 -1 1.2 2 0]
- set cli_re ""
+ # Do the 'thread' command to select the same thread. We
+ # should see the same thread events.
with_spawn_id $mi_spawn_id {
mi_gdb_test $command $mi_re "select thread again"
}
with_spawn_id $gdb_main_spawn_id {
- match_re_or_ensure_no_output $cli_re "select thread again, event on CLI"
+ match_re_or_ensure_no_output "$cli_re\r\n" "select thread again, event on CLI"
+ }
+
+ # In non-stop mode the current thread is still running, so we
+ # cannot change the selected frame. Use 'frame' command to
+ # select frame 1.
+ set f_command [make_cli_in_mi_command $cli_in_mi_mode "frame 1"]
+ set f_cli_re [make_cli_re $mode -1 -1 1]
+ set f_mi_re [make_cli_in_mi_re $f_command \
+ $cli_in_mi_mode $mode 1 -1 -1 2 1]
+
+ with_spawn_id $mi_spawn_id {
+ mi_gdb_test $f_command $f_mi_re "select frame 1"
+ }
+
+ with_spawn_id $gdb_main_spawn_id {
+ match_re_or_ensure_no_output "$f_cli_re\r\n" \
+ "select frame 1, event on CLI"
+ }
+
+ # Reselect the current thread. GDB will switch back to
+ # frame #0, and send CLI and MI notifications.
+ with_spawn_id $mi_spawn_id {
+ mi_gdb_test $command $mi_re \
+ "select thread again, resetting frame"
+ }
+
+ with_spawn_id $gdb_main_spawn_id {
+ match_re_or_ensure_no_output "$cli_re\r\n" \
+ "select thread again, resetting frame, event on CLI"
}
# Try the 'thread' command without arguments.
@@ -1155,24 +1231,49 @@ proc_with_prefix test_cli_in_mi_thread { mode cli_in_mi_mode } {
match_re_or_ensure_no_output "$cli_re\r\n" "select thread, event on CLI"
}
- # Do the 'thread' command to select the third thread again. Again, we
- # shouldn't receive an event on MI.
-
- if { $mode == "all-stop" } {
- set mi_re [make_cli_in_mi_re $command $cli_in_mi_mode $mode 0 -1 1.3 3 0]
- } else {
- set mi_re [make_cli_in_mi_re $command $cli_in_mi_mode $mode 0 -1 1.3 3 -1]
- }
- set cli_re ""
+ # Do the 'thread' command to select the third thread again.
+ # We should see the same thread events.
with_spawn_id $mi_spawn_id {
mi_gdb_test $command $mi_re "select thread again"
}
with_spawn_id $gdb_main_spawn_id {
- match_re_or_ensure_no_output $cli_re "select thread again, event on CLI"
+ match_re_or_ensure_no_output "$cli_re\r\n" "select thread again, event on CLI"
+ }
+
+ # In non-stop mode the current thread is now running, so we
+ # cannot switch frames. In all-stop mode all threads are
+ # stopped, so frame switching is fine.
+ if { $mode eq "all-stop" } {
+ # Use 'frame' command to select frame 1.
+ set f_command [make_cli_in_mi_command $cli_in_mi_mode "frame 1"]
+ set f_cli_re [make_cli_re $mode -1 -1 1]
+ set f_mi_re [make_cli_in_mi_re $f_command \
+ $cli_in_mi_mode $mode 1 -1 -1 3 1]
+ with_spawn_id $mi_spawn_id {
+ mi_gdb_test $f_command $f_mi_re "select frame 1"
+ }
+
+ with_spawn_id $gdb_main_spawn_id {
+ match_re_or_ensure_no_output "$f_cli_re\r\n" \
+ "select frame 1, event on CLI"
+ }
+
+ # Reselect the current thread. GDB will switch back to
+ # frame #0, and send CLI and MI notifications.
+ with_spawn_id $mi_spawn_id {
+ mi_gdb_test $command $mi_re \
+ "select thread again, resetting frame"
+ }
+
+ with_spawn_id $gdb_main_spawn_id {
+ match_re_or_ensure_no_output "$cli_re\r\n" \
+ "select thread again, resetting frame, event on CLI"
+ }
}
+
# Try the 'thread' command without arguments.
set command [make_cli_in_mi_command $cli_in_mi_mode "thread"]
@@ -1327,7 +1428,7 @@ foreach_with_prefix mode { "all-stop" "non-stop" } {
set GDBFLAGS [concat $GDBFLAGS " -ex \"set non-stop 1\""]
}
- if { [mi_clean_restart $binfile "separate-mi-tty"] != 0 } {
+ if { [mi_clean_restart $::testfile "separate-mi-tty"] != 0 } {
break
}
}
diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c
index 3aa5126..5171ae7 100644
--- a/gdb/testsuite/gdb.mi/var-cmd.c
+++ b/gdb/testsuite/gdb.mi/var-cmd.c
@@ -1,4 +1,4 @@
-/* Copyright 1999-2024 Free Software Foundation, Inc.
+/* Copyright 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.mi/vla.c b/gdb/testsuite/gdb.mi/vla.c
index ba7edac..3c9e087 100644
--- a/gdb/testsuite/gdb.mi/vla.c
+++ b/gdb/testsuite/gdb.mi/vla.c
@@ -2,7 +2,7 @@
Contributed by Intel Corp. <keven.boell@intel.com>
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/vla.f90 b/gdb/testsuite/gdb.mi/vla.f90
index 3420eb3..edd3bb5 100644
--- a/gdb/testsuite/gdb.mi/vla.f90
+++ b/gdb/testsuite/gdb.mi/vla.f90
@@ -1,4 +1,4 @@
-! Copyright 2015-2024 Free Software Foundation, Inc.
+! Copyright 2015-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/watch-nonstop.c b/gdb/testsuite/gdb.mi/watch-nonstop.c
index 6562f88..eacc40d 100644
--- a/gdb/testsuite/gdb.mi/watch-nonstop.c
+++ b/gdb/testsuite/gdb.mi/watch-nonstop.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.modula2/builtin-procedure-adr.exp b/gdb/testsuite/gdb.modula2/builtin-procedure-adr.exp
index 6588020..884ac37 100644
--- a/gdb/testsuite/gdb.modula2/builtin-procedure-adr.exp
+++ b/gdb/testsuite/gdb.modula2/builtin-procedure-adr.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.modula2/max-depth.c b/gdb/testsuite/gdb.modula2/max-depth.c
index 153c277..a6e7b5e 100644
--- a/gdb/testsuite/gdb.modula2/max-depth.c
+++ b/gdb/testsuite/gdb.modula2/max-depth.c
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.modula2/max-depth.exp b/gdb/testsuite/gdb.modula2/max-depth.exp
index 63f5bdd..28f348f 100644
--- a/gdb/testsuite/gdb.modula2/max-depth.exp
+++ b/gdb/testsuite/gdb.modula2/max-depth.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.modula2/multidim.c b/gdb/testsuite/gdb.modula2/multidim.c
index 4595e01..9632007 100644
--- a/gdb/testsuite/gdb.modula2/multidim.c
+++ b/gdb/testsuite/gdb.modula2/multidim.c
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.modula2/multidim.exp b/gdb/testsuite/gdb.modula2/multidim.exp
index 0a04f2c..3301412 100644
--- a/gdb/testsuite/gdb.modula2/multidim.exp
+++ b/gdb/testsuite/gdb.modula2/multidim.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.modula2/unbounded-array.exp b/gdb/testsuite/gdb.modula2/unbounded-array.exp
index a0eb23e..f11951b 100644
--- a/gdb/testsuite/gdb.modula2/unbounded-array.exp
+++ b/gdb/testsuite/gdb.modula2/unbounded-array.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.modula2/unbounded1.c b/gdb/testsuite/gdb.modula2/unbounded1.c
index 629fcc3..1629d0e 100644
--- a/gdb/testsuite/gdb.modula2/unbounded1.c
+++ b/gdb/testsuite/gdb.modula2/unbounded1.c
@@ -1,6 +1,6 @@
/* This test script is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/attach-no-multi-process.c b/gdb/testsuite/gdb.multi/attach-no-multi-process.c
index 4f3f9c5..819d234 100644
--- a/gdb/testsuite/gdb.multi/attach-no-multi-process.c
+++ b/gdb/testsuite/gdb.multi/attach-no-multi-process.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/attach-no-multi-process.exp b/gdb/testsuite/gdb.multi/attach-no-multi-process.exp
index daa6d70..2813fa9 100644
--- a/gdb/testsuite/gdb.multi/attach-no-multi-process.exp
+++ b/gdb/testsuite/gdb.multi/attach-no-multi-process.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ proc test {target_non_stop} {
"${::GDBFLAGS} -ex \"set remote multiprocess-feature-packet off\""
set ::GDBFLAGS \
"${::GDBFLAGS} -ex \"maint set target-non-stop ${target_non_stop}\""
- clean_restart ${binfile}
+ clean_restart ${::testfile}
}
# Start the first inferior.
@@ -59,7 +59,10 @@ proc test {target_non_stop} {
"switch to inferior 2"
set res [gdbserver_start "--multi" ""]
set gdbserver_gdbport [lindex $res 1]
- gdb_target_cmd "extended-remote" $gdbserver_gdbport
+ if { [gdb_target_cmd_ext "extended-remote" $gdbserver_gdbport] == 2 } {
+ unsupported "non-stop RSP"
+ return
+ }
# Start a program, then attach to it.
set spawn_id_list [spawn_wait_for_attach [list $binfile]]
diff --git a/gdb/testsuite/gdb.multi/attach-while-running.c b/gdb/testsuite/gdb.multi/attach-while-running.c
index 14e4a65..26f5eae 100644
--- a/gdb/testsuite/gdb.multi/attach-while-running.c
+++ b/gdb/testsuite/gdb.multi/attach-while-running.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/attach-while-running.exp b/gdb/testsuite/gdb.multi/attach-while-running.exp
index ca4fa63..4eb500e 100644
--- a/gdb/testsuite/gdb.multi/attach-while-running.exp
+++ b/gdb/testsuite/gdb.multi/attach-while-running.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,6 +37,7 @@
standard_testfile
require can_spawn_for_attach
+require allow_multi_inferior_tests
if { [build_executable "failed to prepare" ${testfile} ${srcfile}] } {
return
@@ -45,11 +46,11 @@ if { [build_executable "failed to prepare" ${testfile} ${srcfile}] } {
proc do_test {} {
save_vars { ::GDBFLAGS } {
append ::GDBFLAGS " -ex \"maint set target-non-stop on\""
- clean_restart $::binfile
+ clean_restart $::testfile
}
gdb_test -no-prompt-anchor "run &"
- gdb_test "add-inferior" "Added inferior 2 on connection 1 .*"
+ gdb_test -no-prompt-anchor "add-inferior" "Added inferior 2 on connection 1 .*"
gdb_test "inferior 2" "Switching to inferior 2 .*"
set spawn_id [spawn_wait_for_attach $::binfile]
diff --git a/gdb/testsuite/gdb.multi/base.exp b/gdb/testsuite/gdb.multi/base.exp
index 834d961..4268149 100644
--- a/gdb/testsuite/gdb.multi/base.exp
+++ b/gdb/testsuite/gdb.multi/base.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/bkpt-multi-exec.exp b/gdb/testsuite/gdb.multi/bkpt-multi-exec.exp
index 44a45a1..b2b4319 100644
--- a/gdb/testsuite/gdb.multi/bkpt-multi-exec.exp
+++ b/gdb/testsuite/gdb.multi/bkpt-multi-exec.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/bp-thread-specific.c b/gdb/testsuite/gdb.multi/bp-thread-specific.c
index c7516ad..f144500 100644
--- a/gdb/testsuite/gdb.multi/bp-thread-specific.c
+++ b/gdb/testsuite/gdb.multi/bp-thread-specific.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/bp-thread-specific.exp b/gdb/testsuite/gdb.multi/bp-thread-specific.exp
index 11dc248..3fe4c20 100644
--- a/gdb/testsuite/gdb.multi/bp-thread-specific.exp
+++ b/gdb/testsuite/gdb.multi/bp-thread-specific.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,6 +19,8 @@
# Also check that the correct thread-ids are used in the saved
# breakpoints file.
+require allow_multi_inferior_tests
+
# The plain remote target can't do multiple inferiors.
require !use_gdb_stub
diff --git a/gdb/testsuite/gdb.multi/checkpoint-multi.exp b/gdb/testsuite/gdb.multi/checkpoint-multi.exp
index e401e5e..54fd3ca 100644
--- a/gdb/testsuite/gdb.multi/checkpoint-multi.exp
+++ b/gdb/testsuite/gdb.multi/checkpoint-multi.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -781,7 +781,7 @@ with_test_prefix "background execution" {
gdb_test "info checkpoints" \
[multi_line \
"$checkpoints_header_re" \
- "\\* 1\\.0 y +$proc_re +at $::hex,.*" \
+ "\\* 1\\.0 y +$proc_re +at $::hex.*" \
" 1\\.1 n +$proc_re +at $::hex, file.*?$hello_c.*?" \
" 2\\.0 y +$proc_re +at $::hex, file.*?$goodbye_c.*?" \
" 2\\.1 n +$proc_re +at $::hex, file.*?$goodbye_c.*?"]
@@ -792,7 +792,7 @@ with_test_prefix "background execution" {
gdb_test "info checkpoints" \
[multi_line \
"$checkpoints_header_re" \
- " 1\\.0 y +$proc_re +at $::hex,.*" \
+ " 1\\.0 y +$proc_re +at $::hex.*" \
" 1\\.1 n +$proc_re +at $::hex, file.*?$hello_c.*?" \
" 2\\.0 n +$proc_re +at $::hex, file.*?$goodbye_c.*?" \
"\\* 2\\.1 y +$proc_re +at $::hex, file.*?$goodbye_c.*?"]
diff --git a/gdb/testsuite/gdb.multi/dummy-frame-restore.c b/gdb/testsuite/gdb.multi/dummy-frame-restore.c
index 6db0d30..1fc28eb 100644
--- a/gdb/testsuite/gdb.multi/dummy-frame-restore.c
+++ b/gdb/testsuite/gdb.multi/dummy-frame-restore.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/dummy-frame-restore.exp b/gdb/testsuite/gdb.multi/dummy-frame-restore.exp
index 0bc5e6a..4119e3f 100644
--- a/gdb/testsuite/gdb.multi/dummy-frame-restore.exp
+++ b/gdb/testsuite/gdb.multi/dummy-frame-restore.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,6 +19,8 @@ set executable ${testfile}
# The plain remote target can't do multiple inferiors.
require !use_gdb_stub
+require allow_multi_inferior_tests
+
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.multi/gdb-settings.c b/gdb/testsuite/gdb.multi/gdb-settings.c
index cb8b860..4caa75a 100644
--- a/gdb/testsuite/gdb.multi/gdb-settings.c
+++ b/gdb/testsuite/gdb.multi/gdb-settings.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/gdb-settings.exp b/gdb/testsuite/gdb.multi/gdb-settings.exp
index ec708dd..97961f5 100644
--- a/gdb/testsuite/gdb.multi/gdb-settings.exp
+++ b/gdb/testsuite/gdb.multi/gdb-settings.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ set run [expr {![use_gdb_stub]}]
set inferiors {1 2}
# Start all the inferiors.
-clean_restart $binfile
+clean_restart $::testfile
foreach_with_prefix inf $inferiors {
if { $inf > 1 } {
gdb_test "add-inferior -exec $binfile" "Added inferior 2.*" \
@@ -71,6 +71,7 @@ foreach_with_prefix inf $inferiors {
gdb_test_no_output "set args inf${inf}-args"
gdb_test_no_output "set cwd /inf${inf}-cwd"
gdb_test_no_output "set inferior-tty /inf${inf}-tty"
+ gdb_test_no_output "set remote exec-file /inf${inf}-remote-exec"
}
# Check settings are still correct for each inferior.
@@ -88,6 +89,9 @@ foreach_with_prefix inf $inferiors {
gdb_test "with inferior-tty tmp-value -- print 1" " = 1"
gdb_test "show inferior-tty" "/inf${inf}-tty.*"
+ gdb_test "with remote exec-file tmp-value -- print 1" " = 1"
+ gdb_test "show remote exec-file" "/inf${inf}-remote-exec.*"
+
# If the inferiors are running check $_gdb_setting_str and
# $_gdb_setting return the correct values.
if { $run } {
@@ -101,6 +105,11 @@ foreach_with_prefix inf $inferiors {
"\"/inf${inf}-tty\""
gdb_test {print $_gdb_setting("inferior-tty")} \
"\"/inf${inf}-tty\""
+
+ gdb_test {print $_gdb_setting_str("remote exec-file")} \
+ "\"/inf${inf}-remote-exec\""
+ gdb_test {print $_gdb_setting("remote exec-file")} \
+ "\"/inf${inf}-remote-exec\""
}
# Check the settings can be read from Python.
@@ -109,6 +118,8 @@ foreach_with_prefix inf $inferiors {
gdb_test "python print(gdb.parameter('cwd'))" "/inf${inf}-cwd"
gdb_test "python print(gdb.parameter('inferior-tty'))" \
"/inf${inf}-tty"
+ gdb_test "python print(gdb.parameter('remote exec-file'))" \
+ "/inf${inf}-remote-exec"
}
# Check the settings can be read from Guile.
@@ -119,5 +130,7 @@ foreach_with_prefix inf $inferiors {
"/inf${inf}-cwd"
gdb_test "guile (print (parameter-value \"inferior-tty\"))" \
"/inf${inf}-tty"
+ gdb_test "guile (print (parameter-value \"remote exec-file\"))" \
+ "/inf${inf}-remote-exec"
}
}
diff --git a/gdb/testsuite/gdb.multi/goodbye.c b/gdb/testsuite/gdb.multi/goodbye.c
index 6d0328b..8d4ff0c 100644
--- a/gdb/testsuite/gdb.multi/goodbye.c
+++ b/gdb/testsuite/gdb.multi/goodbye.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/hangout.c b/gdb/testsuite/gdb.multi/hangout.c
index 192e118..93c7fac 100644
--- a/gdb/testsuite/gdb.multi/hangout.c
+++ b/gdb/testsuite/gdb.multi/hangout.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/hello.c b/gdb/testsuite/gdb.multi/hello.c
index adb1b9d..9e95789 100644
--- a/gdb/testsuite/gdb.multi/hello.c
+++ b/gdb/testsuite/gdb.multi/hello.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/inferior-specific-bp-1.c b/gdb/testsuite/gdb.multi/inferior-specific-bp-1.c
index 16db062..5f906db 100644
--- a/gdb/testsuite/gdb.multi/inferior-specific-bp-1.c
+++ b/gdb/testsuite/gdb.multi/inferior-specific-bp-1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/inferior-specific-bp-2.c b/gdb/testsuite/gdb.multi/inferior-specific-bp-2.c
index 3a45c21..e67b4c8 100644
--- a/gdb/testsuite/gdb.multi/inferior-specific-bp-2.c
+++ b/gdb/testsuite/gdb.multi/inferior-specific-bp-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/inferior-specific-bp.exp b/gdb/testsuite/gdb.multi/inferior-specific-bp.exp
index 82cc924..6d2fc9e 100644
--- a/gdb/testsuite/gdb.multi/inferior-specific-bp.exp
+++ b/gdb/testsuite/gdb.multi/inferior-specific-bp.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,8 +22,10 @@ if {[use_gdb_stub]} {
}
set srcfile1 ${srcfile}
-set binfile1 ${binfile}-1
-set binfile2 ${binfile}-2
+set testfile1 $testfile-1
+set testfile2 $testfile-2
+set binfile1 [standard_output_file $testfile1]
+set binfile2 [standard_output_file $testfile2]
if {[build_executable ${testfile}.exp ${binfile1} "${srcfile1}"] != 0} {
return -1
@@ -34,7 +36,7 @@ if {[build_executable ${testfile}.exp ${binfile2} "${srcfile2}"] != 0} {
}
# Start the first inferior.
-clean_restart ${binfile1}
+clean_restart $testfile1
if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.multi/info-threads.exp b/gdb/testsuite/gdb.multi/info-threads.exp
index 3b00948..ec2a140 100644
--- a/gdb/testsuite/gdb.multi/info-threads.exp
+++ b/gdb/testsuite/gdb.multi/info-threads.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/interrupt-bg-exec.c b/gdb/testsuite/gdb.multi/interrupt-bg-exec.c
new file mode 100644
index 0000000..b5fa568
--- /dev/null
+++ b/gdb/testsuite/gdb.multi/interrupt-bg-exec.c
@@ -0,0 +1,47 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+
+volatile int wait_for_gdb = 1;
+
+void
+breakpt (void)
+{
+ /* Nothing. */
+}
+
+void
+all_started (void)
+{
+ /* Nothing. */
+}
+
+int
+main (void)
+{
+ alarm (360);
+
+ all_started ();
+
+ while (wait_for_gdb)
+ sleep (1);
+
+ breakpt ();
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.multi/interrupt-bg-exec.exp b/gdb/testsuite/gdb.multi/interrupt-bg-exec.exp
new file mode 100644
index 0000000..065a112
--- /dev/null
+++ b/gdb/testsuite/gdb.multi/interrupt-bg-exec.exp
@@ -0,0 +1,143 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# In all-stop mode, set one inferior running in the background, then
+# continue a second inferior. When the second inferior hits a breakpoint,
+# both inferiors should be stopped.
+
+# This tests the use of native and remote targets. If we try to run
+# it with a board that forces native targets to become remote, then
+# this doesn't really make sense (for this test).
+require {string equal [target_info gdb_protocol] ""}
+
+source $srcdir/$subdir/multi-target.exp.tcl
+
+load_lib gdbserver-support.exp
+
+require allow_gdbserver_tests
+
+# This overrides the call in multi-target.exp.tcl.
+standard_testfile
+
+if { [build_executable "failed to build" $testfile $srcfile] } {
+ return
+}
+
+# Start two inferiors, TARGET_TYPE_1 and TARGET_TYPE_2 are strings, either
+# 'extended-remote' or 'native', and control the connection type of each
+# inferior.
+#
+# Set the first inferior running in the background, then continue theA
+# second inferior allowing it to hit a breakpoint.
+#
+# Once the breakpoint is hit, both inferiors should be stopped.
+proc run_test { target_type_1 target_type_2 } {
+ cleanup_gdbservers
+
+ clean_restart
+
+ gdb_test "disconnect" ".*"
+
+ gdb_test_no_output "set sysroot"
+
+ # multi-target depends on target running in non-stop mode. Force it
+ # on for remote targets, until this is the default.
+ gdb_test_no_output "maint set target-non-stop on"
+
+ # Run in all-stop mode.
+ gdb_test_no_output "set non-stop off"
+
+ if {![add_inferior 2 $target_type_1 $::binfile]} {
+ return 0
+ }
+
+ if {![add_inferior 3 $target_type_2 $::binfile]} {
+ return 0
+ }
+
+ # Check we see all the expected threads.
+ gdb_test "info threads" \
+ [multi_line \
+ "\\s+Id\\s+Target Id\\s+Frame\\s*" \
+ "\\s+2\\.1\\s+\[^\r\n\]+" \
+ "\\*\\s+3\\.1\\s+\[^\r\n\]+"] \
+ "check expected threads exist"
+
+ # The breakpoint will be set in both inferiors, but only inferior 3
+ # will hit it as 'wait_for_gdb' is cleared only in that inferior.
+ gdb_breakpoint breakpt
+ gdb_test "thread apply 3.1 set wait_for_gdb = 0"
+
+ # Let inferior 2 run in the background.
+ gdb_test "thread 2.1"
+ gdb_test -no-prompt-anchor "continue&"
+
+ # Run inferior 3 until it hits a breakpoint.
+ gdb_test "thread 3.1"
+ gdb_test "continue" \
+ [multi_line \
+ "Thread 3\\.1 \[^\r\n\]+ hit Breakpoint \[^\r\n\]+, breakpt \\(\\) \[^\r\n\]+" \
+ "$::decimal\\s+\[^\r\n\]+"] \
+ "continue to breakpt function"
+
+ # Check the state of all threads. None should be running.
+ set saw_inferior_2 false
+ set saw_inferior_3 false
+ gdb_test_multiple "info threads" "check threads after stop" {
+ -re "^info threads\r\n" {
+ exp_continue
+ }
+
+ -re "^\\s+Id\\s+Target Id\\s+Frame\\s*\r\n" {
+ exp_continue
+ }
+
+ -re "^\\s+2\\.1\\s+\[^\r\n\]+\\s+\\(running\\)\\s*\r\n" {
+ # Don't count this as seeing inferior 2 as the thread is
+ # incorrectly still marked as running. By not setting the
+ # SAW_INFERIOR_2 flag this test will now fail.
+ exp_continue
+ }
+
+ -re "^\\s+2\\.1\\s+\[^\r\n\]+\r\n" {
+ set saw_inferior_2 true
+ exp_continue
+ }
+
+ -re "^\\*\\s+3\\.1\\s+\[^\r\n\]+\r\n" {
+ set saw_inferior_3 true
+ exp_continue
+ }
+
+ -re "^$::gdb_prompt $" {
+ gdb_assert { $saw_inferior_2 && $saw_inferior_3 } \
+ $gdb_test_name
+ }
+
+ -re "^\[^\r\n\]*\r\n" {
+ exp_continue
+ }
+ }
+}
+
+set all_target_types { extended-remote native }
+
+foreach_with_prefix target_type_1 $all_target_types {
+ foreach_with_prefix target_type_2 $all_target_types {
+ run_test $target_type_1 $target_type_2
+ }
+}
+
+multi_target_cleanup
diff --git a/gdb/testsuite/gdb.multi/multi-arch-exec.c b/gdb/testsuite/gdb.multi/multi-arch-exec.c
index bf8cfd4..98f6b15 100644
--- a/gdb/testsuite/gdb.multi/multi-arch-exec.c
+++ b/gdb/testsuite/gdb.multi/multi-arch-exec.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/multi-arch-exec.exp b/gdb/testsuite/gdb.multi/multi-arch-exec.exp
index a69e122..435efc5 100644
--- a/gdb/testsuite/gdb.multi/multi-arch-exec.exp
+++ b/gdb/testsuite/gdb.multi/multi-arch-exec.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ require !use_gdb_stub
# The 64-bit compile may succeed for i386-linux, but gdb won't be able
# to load the file.
-if [istarget "i?86-*linux*"] {
+if {[istarget "i?86-*linux*"]} {
return
}
@@ -69,9 +69,9 @@ proc append_arch2_options {options_var} {
}
}
- if [istarget "powerpc64*-*-*"] {
+ if {[istarget "powerpc64*-*-*"]} {
set march "-m64"
- } elseif [istarget "s390*-*-*"] {
+ } elseif {[istarget "s390*-*-*"]} {
set march "-m31"
} else {
set march "-m32"
diff --git a/gdb/testsuite/gdb.multi/multi-arch.exp b/gdb/testsuite/gdb.multi/multi-arch.exp
index 559bd7b..02c26ba 100644
--- a/gdb/testsuite/gdb.multi/multi-arch.exp
+++ b/gdb/testsuite/gdb.multi/multi-arch.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,12 +18,14 @@
set testfile "multi-arch"
+require allow_multi_inferior_tests
+
# The plain remote target can't do multiple inferiors.
require !use_gdb_stub
# The 64-bit compile may succeed for i386-linux, but gdb won't be able
# to load the file.
-if [istarget "i?86-*linux*"] {
+if {[istarget "i?86-*linux*"]} {
return
}
@@ -39,7 +41,7 @@ set binfile2 [standard_output_file ${exec2}]
# Build two executables, one for each arch.
-if [istarget "s390*-*-*"] {
+if {[istarget "s390*-*-*"]} {
set march1 "-m64"
set march2 "-m31"
} elseif { [istarget "aarch64*-*-*"] } {
@@ -51,11 +53,11 @@ if [istarget "s390*-*-*"] {
}
if { $march1 != "" } {
- require "have_compile_and_link_flag $march1"
+ require {have_compile_and_link_flag $march1}
}
if { $march2 != "" } {
- require "have_compile_and_link_flag $march2"
+ require {have_compile_and_link_flag $march2}
}
if { [build_executable "failed to prepare" ${exec1} "${srcfile1}" \
@@ -65,7 +67,7 @@ if { [build_executable "failed to prepare" ${exec1} "${srcfile1}" \
set options [list debug]
-if [istarget "aarch64*-*-*"] {
+if {[istarget "aarch64*-*-*"]} {
if {[arm_cc_for_target] != ""} {
lappend options "compiler=[arm_cc_for_target]"
} else {
diff --git a/gdb/testsuite/gdb.multi/multi-attach.c b/gdb/testsuite/gdb.multi/multi-attach.c
index 23160b6..3e1fd40 100644
--- a/gdb/testsuite/gdb.multi/multi-attach.c
+++ b/gdb/testsuite/gdb.multi/multi-attach.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/multi-attach.exp b/gdb/testsuite/gdb.multi/multi-attach.exp
index 4312636..210c8ca 100644
--- a/gdb/testsuite/gdb.multi/multi-attach.exp
+++ b/gdb/testsuite/gdb.multi/multi-attach.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,6 +17,8 @@
# Test attaching to multiple threaded programs.
+require allow_multi_inferior_tests
+
standard_testfile
require can_spawn_for_attach
diff --git a/gdb/testsuite/gdb.multi/multi-core-files-1.c b/gdb/testsuite/gdb.multi/multi-core-files-1.c
new file mode 100644
index 0000000..5d24367
--- /dev/null
+++ b/gdb/testsuite/gdb.multi/multi-core-files-1.c
@@ -0,0 +1,37 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2022-2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdlib.h>
+
+int
+bar ()
+{
+ abort ();
+ return 0;
+}
+
+int
+baz ()
+{
+ return bar ();
+}
+
+int
+main ()
+{
+ return baz ();
+}
diff --git a/gdb/testsuite/gdb.multi/multi-core-files-2.c b/gdb/testsuite/gdb.multi/multi-core-files-2.c
new file mode 100644
index 0000000..cc05dc6
--- /dev/null
+++ b/gdb/testsuite/gdb.multi/multi-core-files-2.c
@@ -0,0 +1,31 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2022-2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdlib.h>
+
+int
+foo ()
+{
+ abort ();
+ return 0;
+}
+
+int
+main ()
+{
+ return foo ();
+}
diff --git a/gdb/testsuite/gdb.multi/multi-core-files.exp b/gdb/testsuite/gdb.multi/multi-core-files.exp
new file mode 100644
index 0000000..ed83b81
--- /dev/null
+++ b/gdb/testsuite/gdb.multi/multi-core-files.exp
@@ -0,0 +1,171 @@
+# Copyright 2022-2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This script runs some basic tests that GDB can support multiple
+# inferiors each debugging different core files.
+#
+# We also check the behaviour of GDB if the user attempts to clone or
+# duplicate an inferior that is debugging a core file.
+
+standard_testfile -1.c -2.c
+
+set testfile1 "${testfile}-1"
+set testfile2 "${testfile}-2"
+
+set binfile1 [standard_output_file $testfile1]
+set binfile2 [standard_output_file $testfile2]
+
+if {[build_executable "build first executable" $binfile1 $srcfile] == -1} {
+ return
+}
+
+if {[build_executable "build second executable" $binfile2 $srcfile2] == -1} {
+ return
+}
+
+set corefile1 [core_find $binfile1]
+set corefile2 [core_find $binfile2]
+if { $corefile1 == "" || $corefile2 == "" } {
+ untested "Can't generate core files"
+ return
+}
+
+# Start GDB, and load the first executable and corefile into the first
+# inferior.
+clean_restart ${testfile1}
+gdb_test "core-file $corefile1" "Program terminated with .*" \
+ "load core file"
+gdb_test "bt" "bar \\(\\) at .*" \
+ "check backtrace in inferior 1"
+
+# The native-extended-remote board connects to the remote target as
+# soon as GDB is started, this means that connection 1 is to the
+# remote target, and the core target we create below will be
+# connection 2.
+#
+# In all other cases, the core target gets to be connection 1.
+if { [target_info gdb_protocol] == "extended-remote"} {
+ set conn_num 2
+} else {
+ set conn_num 1
+}
+
+# Try to use add-inferior and clone-inferior to create new
+# inferiors. In both cases this will try to share the core_target
+# between inferior 1 and the new inferior. As the core_target can't
+# be shared we should get a warning, and the inferior should be
+# created without a connection.
+gdb_test "add-inferior" \
+ [multi_line \
+ "\\\[New inferior 2\\\]" \
+ "warning: can't share connection ${conn_num} \\(core\\) between inferiors" \
+ "Added inferior 2"]
+gdb_test "clone-inferior" \
+ [multi_line \
+ "\\\[New inferior 3\\\]" \
+ "warning: can't share connection ${conn_num} \\(core\\) between inferiors" \
+ "Added inferior 3"]
+
+# Check the MI -add-inferior command. Do this using interpreter-exec.
+# We're not doing a full MI test here, just checking this one command.
+gdb_test "interpreter-exec mi \"-add-inferior\"" \
+ [multi_line \
+ "~\"\\\[New inferior 4\\\]..\"" \
+ "&\"warning: can't share connection ${conn_num} \\(core\\) between inferiors..\"" \
+ "~\"Added inferior 4..\"" \
+ "\\^done,inferior=\"\[^\"\]+\""]
+
+# Now check that none of the new inferiors have a connection.
+gdb_test "info inferiors" \
+ [multi_line \
+ "\\*\\s+1\\s+\[^\r\n\]+\\s+${conn_num} \\(core\\)\\s+\[^\r\n\]+.*" \
+ "\\s+2\\s+<null>\\s+" \
+ "\\s+3\\s+<null>\\s+\[^\r\n\]+" \
+ "\\s+4\\s+<null>\\s+"] \
+ "first info inferiors call"
+
+# Now use add-inferior and clone-inferior but this time with the
+# -no-connection option, this should avoid issuing the warning. We
+# also use interpreter-exec to test the MI version of this command.
+gdb_test "add-inferior -no-connection" \
+ [multi_line \
+ "\\\[New inferior 5\\\]" \
+ "Added inferior 5"]
+gdb_test "clone-inferior -no-connection" \
+ [multi_line \
+ "\\\[New inferior 6\\\]" \
+ "Added inferior 6"]
+gdb_test "interpreter-exec mi \"-add-inferior --no-connection\"" \
+ "\\\[New inferior 7\\\].*Added inferior 7.*"
+
+# Now check that none of the new inferiors have a connection.
+gdb_test "info inferiors" \
+ [multi_line \
+ "\\*\\s+1\\s+\[^\r\n\]+\\s+${conn_num} \\(core\\)\\s+\[^\r\n\]+.*" \
+ "\\s+2\\s+<null>\\s+" \
+ "\\s+3\\s+<null>\\s+\[^\r\n\]+" \
+ "\\s+4\\s+<null>\\s+" \
+ "\\s+5\\s+<null>\\s+" \
+ "\\s+6\\s+<null>\\s+\[^\r\n\]+" \
+ "\\s+7\\s+<null>\\s+"] \
+ "second info inferiors call"
+
+# Check after all the new inferiors have been created that we still
+# only have a single connection.
+gdb_test "info connections" \
+ "\\*\\s+${conn_num}\\s+\\s+core\\s+Local core dump file\\s*"
+
+# Now switch to inferior 2 and load the second executable and core
+# file. Check the backtrace for the presence of function 'foo', this
+# indicates we are seeing the correct core file.
+gdb_test "inferior 2" "Switching to inferior 2 .*"
+gdb_test "file $binfile2" \
+ "Reading symbols from .*" \
+ "Loaded second test binary"
+gdb_test "core-file $corefile2" \
+ "Program terminated with signal SIGABRT, Aborted.*" \
+ "Loaded second core file"
+gdb_test "bt" "foo \\(\\) at .*" \
+ "check backtrace in inferior 2"
+
+# Switch to inferior 3, this one was cloned from inferior 1, so is
+# already debugging the first binary file. Check its backtrace for
+# 'bar', which indicates we are debugging the correct core file.
+gdb_test "inferior 3" "Switching to inferior 3 .*"
+gdb_test "core-file $corefile1" \
+ "Program terminated with signal SIGABRT, Aborted.*" \
+ "Loaded first core file into inferior 3"
+gdb_test "bt" "bar \\(\\) at .*" \
+ "check backtrace in inferior 3"
+
+# Detach from some of the core files and delete some of the inferiors.
+gdb_test "detach" "No core file now\\." \
+ "detach from inferior 3 core file"
+gdb_test "inferior 2" "Switching to inferior 2 .*" \
+ "switch back to inferior 2"
+gdb_test_no_output "remove-inferiors 3 4"
+
+# Now detach in inferior 2, and delete the inferior.
+gdb_test "detach" "No core file now\\." \
+ "detach from inferior 2 core file"
+gdb_test "inferior 1" "Switching to inferior 1 .*" \
+ "switch back to inferior 1"
+gdb_test_no_output "remove-inferiors 2"
+
+# Finally, check that inferior 1 backtrace is still working.
+gdb_test "bt" "bar \\(\\) at .*" \
+ "check backtrace in inferior 1 again"
+gdb_test "detach" "No core file now\\." \
+ "detach from inferior 1 core file"
diff --git a/gdb/testsuite/gdb.multi/multi-exit.c b/gdb/testsuite/gdb.multi/multi-exit.c
index 27a14b7..65b18bc 100644
--- a/gdb/testsuite/gdb.multi/multi-exit.c
+++ b/gdb/testsuite/gdb.multi/multi-exit.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/multi-exit.exp b/gdb/testsuite/gdb.multi/multi-exit.exp
index 6ffbe5e..fcd7cd2 100644
--- a/gdb/testsuite/gdb.multi/multi-exit.exp
+++ b/gdb/testsuite/gdb.multi/multi-exit.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,6 +24,8 @@
standard_testfile
+require allow_multi_inferior_tests
+
require !use_gdb_stub
if {[build_executable "failed to prepare" $testfile $srcfile]} {
@@ -34,7 +36,7 @@ if {[build_executable "failed to prepare" $testfile $srcfile]} {
# Hence, go with the all-stop-on-top-of-non-stop mode.
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"maint set target-non-stop on\""
- clean_restart ${binfile}
+ clean_restart ${::testfile}
}
# Start inferior NUM.
diff --git a/gdb/testsuite/gdb.multi/multi-kill.c b/gdb/testsuite/gdb.multi/multi-kill.c
index f097eab..cf601cd 100644
--- a/gdb/testsuite/gdb.multi/multi-kill.c
+++ b/gdb/testsuite/gdb.multi/multi-kill.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/multi-kill.exp b/gdb/testsuite/gdb.multi/multi-kill.exp
index aa39712..1473372 100644
--- a/gdb/testsuite/gdb.multi/multi-kill.exp
+++ b/gdb/testsuite/gdb.multi/multi-kill.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,6 +24,8 @@
standard_testfile
+require allow_multi_inferior_tests
+
require !use_gdb_stub
if {[build_executable "failed to prepare" $testfile $srcfile {debug}]} {
@@ -34,7 +36,7 @@ if {[build_executable "failed to prepare" $testfile $srcfile {debug}]} {
# Hence, go with the all-stop-on-top-of-non-stop mode.
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"maint set target-non-stop on\""
- clean_restart ${binfile}
+ clean_restart ${::testfile}
}
# Wrap the entire test in a namespace to avoid contaminating other tests.
diff --git a/gdb/testsuite/gdb.multi/multi-re-run-1.c b/gdb/testsuite/gdb.multi/multi-re-run-1.c
index f10b0da..2cba30a 100644
--- a/gdb/testsuite/gdb.multi/multi-re-run-1.c
+++ b/gdb/testsuite/gdb.multi/multi-re-run-1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/multi-re-run-2.c b/gdb/testsuite/gdb.multi/multi-re-run-2.c
index d72162f..6a5d8d8 100644
--- a/gdb/testsuite/gdb.multi/multi-re-run-2.c
+++ b/gdb/testsuite/gdb.multi/multi-re-run-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/multi-re-run.exp b/gdb/testsuite/gdb.multi/multi-re-run.exp
index bf9a72c..bf83043 100644
--- a/gdb/testsuite/gdb.multi/multi-re-run.exp
+++ b/gdb/testsuite/gdb.multi/multi-re-run.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,25 +20,27 @@
# misbehave, including failing to load libthread_db.so. See PR
# gdb/25410.
+require allow_multi_inferior_tests
+
# Build two executables, with different symbols.
-set exec1 "multi-re-run-1"
+set testfile1 "multi-re-run-1"
set srcfile1 multi-re-run-1.c
-set binfile1 [standard_output_file ${exec1}]
+set binfile1 [standard_output_file $testfile1]
-set exec2 "multi-re-run-2"
+set testfile2 "multi-re-run-2"
set srcfile2 multi-re-run-2.c
-set binfile2 [standard_output_file ${exec2}]
+set binfile2 [standard_output_file $testfile2]
with_test_prefix "exec1" {
- if { [build_executable "failed to prepare" ${exec1} "${srcfile1}" \
+ if { [build_executable "failed to prepare" $testfile1 $srcfile1 \
[list pthreads debug]] } {
return -1
}
}
with_test_prefix "exec2" {
- if { [build_executable "failed to prepare" ${exec2} "${srcfile2}" \
+ if { [build_executable "failed to prepare" $testfile2 $srcfile2 \
[list pthreads debug]] } {
return -1
}
@@ -53,7 +55,7 @@ proc test_re_run {re_run_inf} {
global gdb_prompt
global last_loaded_file
- clean_restart ${binfile1}
+ clean_restart $::testfile1
delete_breakpoints
@@ -94,7 +96,7 @@ proc test_re_run {re_run_inf} {
foreach_with_prefix iter {1 2} {
delete_breakpoints
- if ![runto all_started] {
+ if {![runto all_started]} {
return 0
}
diff --git a/gdb/testsuite/gdb.multi/multi-remote-target.c b/gdb/testsuite/gdb.multi/multi-remote-target.c
new file mode 100644
index 0000000..6702a88
--- /dev/null
+++ b/gdb/testsuite/gdb.multi/multi-remote-target.c
@@ -0,0 +1,71 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <stdlib.h>
+#include <assert.h>
+
+/* This is a simple, empty function designed to be a stable target
+ for a GDB breakpoint. Both the parent and child processes will
+ call this function after the fork. */
+
+void
+breakpt (void)
+{
+ /* Nothing. */
+}
+
+int
+main (void)
+{
+ pid_t child_pid;
+
+ /* Create a new process. */
+ child_pid = fork ();
+
+ assert (child_pid >= 0);
+
+ if (child_pid == 0)
+ {
+ /* This is the child process. Call the breakpoint function. */
+ breakpt ();
+
+ exit (0);
+ }
+ else
+ {
+ /* This is the parent process. */
+ int child_status;
+
+ /* Call the breakpoint function. */
+ breakpt ();
+
+ /* Wait for the child process to terminate. */
+ waitpid (child_pid, &child_status, 0);
+
+ assert (WIFEXITED (child_status));
+ assert (WEXITSTATUS (child_status) == 0);
+
+ exit (0);
+ }
+
+ /* This line should not be reached. */
+ return 1;
+}
diff --git a/gdb/testsuite/gdb.multi/multi-remote-target.exp b/gdb/testsuite/gdb.multi/multi-remote-target.exp
new file mode 100644
index 0000000..bcd5395
--- /dev/null
+++ b/gdb/testsuite/gdb.multi/multi-remote-target.exp
@@ -0,0 +1,89 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that an attempt to share a 'remote' (not 'extended-remote')
+# will be prevented. But also make sure that the remote connection
+# can be shared after the inferior does a 'fork'.
+
+load_lib gdbserver-support.exp
+
+require allow_gdbserver_tests
+
+standard_testfile
+
+save_vars { GDBFLAGS } {
+ # If GDB and GDBserver are both running locally, set the sysroot to avoid
+ # reading files via the remote protocol (the `is_remote target` check is
+ # already done above).
+ if { ![is_remote host] && ![is_remote target] } {
+ set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\""
+ }
+ if {[prepare_for_testing "prepare" $testfile $srcfile] == -1} {
+ return
+ }
+}
+
+set target_binfile [gdb_remote_download target $binfile]
+
+# Make sure we're disconnected, in case we're testing with an
+# extended-remote board, therefore already connected.
+gdb_test "disconnect" ".*"
+
+# Start gdbserver and connect.
+set res [gdbserver_start "" $target_binfile]
+set gdbserver_addr [lindex $res 1]
+if { [gdb_target_cmd "remote" $gdbserver_addr] != 0 } {
+ unsupported "start gdbserver"
+ return
+}
+
+# The inferior will fork. The following commands force GDB to create
+# a new inferior to follow the child process. This ensures that GDB
+# is able to share the remote connection between inferiors after a
+# fork.
+gdb_test_no_output "set follow-fork-mode parent"
+gdb_test_no_output "set detach-on-fork off"
+gdb_breakpoint breakpt
+gdb_continue_to_breakpoint "runto breakpt function"
+
+# If we are using an extended-remote board, then an extended-remote
+# connection will have been setup when GDB initially started. We then
+# disconnected, and setup a basic 'remote' connection above. However,
+# the 'remote' connection will now be connection 2.
+#
+# For all other boards, the 'remote' connection will be number 1.
+if { [target_info gdb_protocol] == "extended-remote"} {
+ set conn_num 2
+} else {
+ set conn_num 1
+}
+
+# But as this is only a 'remote' (not 'extended-remote') connection,
+# then new inferiors cannot be started by the user. This means that
+# when the user does 'add-inferior' there is no point sharing the
+# remote connection with the new inferior, it can never run anything.
+gdb_test "add-inferior" \
+ [multi_line \
+ "warning: can't share connection $conn_num \\(remote \[^\r\n\]+\\) between inferiors" \
+ "Added inferior 3"] \
+ "connection is dropped when adding a new inferior"
+
+# Ensure the new inferior shows no connection.
+gdb_test "info inferiors" \
+ [multi_line \
+ "\\*\\s+1\\s+\[^\r\n\]+\\s+${conn_num} \\(remote \[^\r\n\]+\\)\\s+\[^\r\n\]+" \
+ "\\s+2\\s+\[^\r\n\]+\\s+${conn_num} \\(remote \[^\r\n\]+\\)\\s+\[^\r\n\]+" \
+ "\\s+3\\s+<null>\\s+"] \
+ "third inferior has no connection"
diff --git a/gdb/testsuite/gdb.multi/multi-target-continue.exp b/gdb/testsuite/gdb.multi/multi-target-continue.exp
index d4b2fc2..ed67ef6 100644
--- a/gdb/testsuite/gdb.multi/multi-target-continue.exp
+++ b/gdb/testsuite/gdb.multi/multi-target-continue.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/multi-target-info-inferiors.exp b/gdb/testsuite/gdb.multi/multi-target-info-inferiors.exp
index d69042d..b9cd212 100644
--- a/gdb/testsuite/gdb.multi/multi-target-info-inferiors.exp
+++ b/gdb/testsuite/gdb.multi/multi-target-info-inferiors.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -75,7 +75,7 @@ proc test_info_inferiors {multi_process} {
}
set ws "\[ \t\]+"
- global decimal binfile
+ global decimal binfile gcorefile
# Test "info connections" and "info inferior" by switching to each
# inferior one by one.
@@ -105,15 +105,19 @@ proc test_info_inferiors {multi_process} {
]
}
+ set gcorefile_re [string_to_regexp $gcorefile]
+
gdb_test "info inferiors" \
[multi_line \
"Num${ws}Description${ws}Connection${ws}Executable${ws}" \
"[inf_desc 1 $inf]1 \\(native\\)${ws}${binfile}${ws}" \
"[inf_desc 2 $inf]2 \\(extended-remote localhost:$decimal\\)${ws}${binfile}${ws}" \
"[inf_desc 3 $inf]3 \\(core\\)${ws}${binfile}${ws}" \
+ "${ws}core file ${gcorefile_re}" \
"[inf_desc 4 $inf]1 \\(native\\)${ws}${binfile}${ws}" \
"[inf_desc 5 $inf]4 \\(extended-remote localhost:$decimal\\)${ws}${binfile}${ws}" \
"[inf_desc 6 $inf]5 \\(core\\)${ws}${binfile}${ws}" \
+ "${ws}core file ${gcorefile_re}"
]
if { $::run_python_tests } {
diff --git a/gdb/testsuite/gdb.multi/multi-target-info-inferiors.py b/gdb/testsuite/gdb.multi/multi-target-info-inferiors.py
index 3fe7ea8..59557ae 100644
--- a/gdb/testsuite/gdb.multi/multi-target-info-inferiors.py
+++ b/gdb/testsuite/gdb.multi/multi-target-info-inferiors.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/multi-target-interrupt.exp b/gdb/testsuite/gdb.multi/multi-target-interrupt.exp
index ce844d0..eda606f 100644
--- a/gdb/testsuite/gdb.multi/multi-target-interrupt.exp
+++ b/gdb/testsuite/gdb.multi/multi-target-interrupt.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/multi-target-no-resumed.exp b/gdb/testsuite/gdb.multi/multi-target-no-resumed.exp
index b1203bd..4f93080 100644
--- a/gdb/testsuite/gdb.multi/multi-target-no-resumed.exp
+++ b/gdb/testsuite/gdb.multi/multi-target-no-resumed.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/multi-target-ping-pong-next.exp b/gdb/testsuite/gdb.multi/multi-target-ping-pong-next.exp
index 36f9d24..b7d1529 100644
--- a/gdb/testsuite/gdb.multi/multi-target-ping-pong-next.exp
+++ b/gdb/testsuite/gdb.multi/multi-target-ping-pong-next.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/multi-target-thread-find.exp b/gdb/testsuite/gdb.multi/multi-target-thread-find.exp
index 24d19d5..ba1ea95 100644
--- a/gdb/testsuite/gdb.multi/multi-target-thread-find.exp
+++ b/gdb/testsuite/gdb.multi/multi-target-thread-find.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/multi-target.c b/gdb/testsuite/gdb.multi/multi-target.c
index aae53c0..e3c365d 100644
--- a/gdb/testsuite/gdb.multi/multi-target.c
+++ b/gdb/testsuite/gdb.multi/multi-target.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/multi-target.exp.tcl b/gdb/testsuite/gdb.multi/multi-target.exp.tcl
index 4f29de8..1963db5 100644
--- a/gdb/testsuite/gdb.multi/multi-target.exp.tcl
+++ b/gdb/testsuite/gdb.multi/multi-target.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -53,7 +53,7 @@ proc add_inferior {num target binfile {gcorefile ""}} {
return 0
}
}
- if ![runto "all_started"] then {
+ if { ![runto "all_started"] } {
return 0
}
delete_breakpoints
@@ -65,9 +65,9 @@ proc prepare_core {} {
global gcorefile gcore_created
global binfile
- clean_restart ${binfile}
+ clean_restart ${::testfile}
- if ![runto all_started] then {
+ if { ![runto all_started] } {
return -1
}
@@ -114,7 +114,7 @@ proc setup {non-stop {multi_process ""}} {
# Make GDB read files from the local file system, not through the
# remote targets, to speed things up.
set ::GDBFLAGS "${::GDBFLAGS} -ex \"set sysroot\""
- clean_restart ${binfile}
+ clean_restart ${::testfile}
}
# multi-target depends on target running in non-stop mode. Force
@@ -123,13 +123,13 @@ proc setup {non-stop {multi_process ""}} {
gdb_test_no_output "set non-stop ${non-stop}"
- if {${multi_process} ne ""} then {
+ if {${multi_process} ne ""} {
gdb_test \
"set remote multiprocess-feature-packet $multi_process" \
"Support for the 'multiprocess-feature' packet on future remote targets is set to \"${multi_process}\"."
}
- if ![runto all_started] then {
+ if { ![runto all_started] } {
return 0
}
@@ -175,12 +175,16 @@ proc multi_target_prepare {} {
return 0
}
+ if {![allow_multi_inferior_tests]} {
+ return 0
+ }
+
# The plain remote target can't do multiple inferiors.
if {[target_info gdb_protocol] != ""} {
return 0
}
- if { [prepare_for_testing "failed to prepare" ${binfile} "${srcfile}" \
+ if { [prepare_for_testing "failed to prepare" $::testfile $srcfile \
{debug pthreads}] } {
return 0
}
diff --git a/gdb/testsuite/gdb.multi/multi-term-settings.c b/gdb/testsuite/gdb.multi/multi-term-settings.c
index e9e7e95..9079f76 100644
--- a/gdb/testsuite/gdb.multi/multi-term-settings.c
+++ b/gdb/testsuite/gdb.multi/multi-term-settings.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/multi-term-settings.exp b/gdb/testsuite/gdb.multi/multi-term-settings.exp
index 0aeba1f..2893d36 100644
--- a/gdb/testsuite/gdb.multi/multi-term-settings.exp
+++ b/gdb/testsuite/gdb.multi/multi-term-settings.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,9 +25,11 @@
standard_testfile
+require allow_multi_inferior_tests
+
require can_spawn_for_attach
-if [build_executable "failed to prepare" $testfile $srcfile {debug}] {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug}]} {
return -1
}
@@ -54,7 +56,7 @@ proc create_inferior {which_inf inf_how} {
# Run to main and delete breakpoints.
proc my_runto_main {} {
- if ![runto_main] {
+ if {![runto_main]} {
return 0
} else {
# Delete breakpoints otherwise GDB would try to step over
@@ -67,7 +69,7 @@ proc create_inferior {which_inf inf_how} {
}
if {$inf_how == "run"} {
- if [my_runto_main] {
+ if {[my_runto_main]} {
global inferior_spawn_id
return $inferior_spawn_id
}
@@ -78,7 +80,7 @@ proc create_inferior {which_inf inf_how} {
set inf_tty_name $spawn_out(slave,name)
gdb_test_no_output "tty $inf_tty_name" "tty TTY"
- if [my_runto_main] {
+ if {[my_runto_main]} {
return $inf_spawn_id
}
} elseif {$inf_how == "attach"} {
@@ -136,7 +138,7 @@ proc coretest {inf1_how inf2_how} {
global gdb_spawn_id
global decimal
- clean_restart $binfile
+ clean_restart $::testfile
with_test_prefix "inf1" {
set inf1_spawn_id [create_inferior 1 $inf1_how]
diff --git a/gdb/testsuite/gdb.multi/pending-bp-del-inferior.c b/gdb/testsuite/gdb.multi/pending-bp-del-inferior.c
index 1d03000..53dc9b2 100644
--- a/gdb/testsuite/gdb.multi/pending-bp-del-inferior.c
+++ b/gdb/testsuite/gdb.multi/pending-bp-del-inferior.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp b/gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp
index 12c0a84..781937d 100644
--- a/gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp
+++ b/gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp
@@ -1,4 +1,4 @@
-# Copyright 2023 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
#
# Return true after a successful setup, otherwise, return false.
proc test_setup {} {
- clean_restart $::binfile
+ clean_restart $::testfile
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.multi/pending-bp-lib.c b/gdb/testsuite/gdb.multi/pending-bp-lib.c
index c48e7f2..d34a103 100644
--- a/gdb/testsuite/gdb.multi/pending-bp-lib.c
+++ b/gdb/testsuite/gdb.multi/pending-bp-lib.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/pending-bp.c b/gdb/testsuite/gdb.multi/pending-bp.c
index 17d9181..c7e00ce 100644
--- a/gdb/testsuite/gdb.multi/pending-bp.c
+++ b/gdb/testsuite/gdb.multi/pending-bp.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/pending-bp.exp b/gdb/testsuite/gdb.multi/pending-bp.exp
index 2a0644b..30a75b9 100644
--- a/gdb/testsuite/gdb.multi/pending-bp.exp
+++ b/gdb/testsuite/gdb.multi/pending-bp.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ if { [build_executable "failed to prepare" $testfile $srcfile \
# 'breakpoint pending' flag is enabled, so pending breakpoints can be created
# without GDB prompting the user.
proc do_test_setup { inf_1_stop inf_2_stop } {
- clean_restart ${::binfile}
+ clean_restart ${::testfile}
gdb_locate_shlib $::binfile_lib
@@ -328,5 +328,7 @@ proc_with_prefix py_test_clear_thread {} {
# Run all the tests.
test_no_inf_display
test_pending_toggle
-py_test_toggle_thread
-py_test_clear_thread
+if { [allow_python_tests] } {
+ py_test_toggle_thread
+ py_test_clear_thread
+}
diff --git a/gdb/testsuite/gdb.multi/remote-with-running-inferior.c b/gdb/testsuite/gdb.multi/remote-with-running-inferior.c
new file mode 100644
index 0000000..a610eda
--- /dev/null
+++ b/gdb/testsuite/gdb.multi/remote-with-running-inferior.c
@@ -0,0 +1,38 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+
+int global_var = 123;
+
+void
+breakpt (void)
+{
+ /* Nothing. */
+}
+
+int
+main (void)
+{
+ for (int i = 0; i < 30; ++i)
+ {
+ sleep (1);
+ breakpt ();
+ }
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.multi/remote-with-running-inferior.exp b/gdb/testsuite/gdb.multi/remote-with-running-inferior.exp
new file mode 100644
index 0000000..43842ba
--- /dev/null
+++ b/gdb/testsuite/gdb.multi/remote-with-running-inferior.exp
@@ -0,0 +1,171 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Set an inferior running in the background (using "run&"), then
+# connect to gdbserver in a second inferior. When this test was added
+# there were two bugs in GDB. First, just connecting to gdbserver
+# while an inferior was running on a different connection type
+# (e.g. inferior 1 was native, and inferior 2 was gdbserver) would
+# trigger an assertion.
+#
+# Then, once the assertion was fixed, GDB would stop the thread from
+# the first inferior, but would fail to update it's state in GDB core,
+# this would leave the thread stopped, but GDB core thinking the
+# thread was running. Check this is fixed by looking at the 'info
+# threads' output after connecting to the remote target.
+
+# This tests the use of native and remote targets, and also depends on use
+# of the 'run' command. If we try to run it with a board that forces native
+# targets to become remote, then this test isn't going to work, especially
+# for 'remote' targets where 'run' is not supported.
+require {string equal [target_info gdb_protocol] ""}
+
+load_lib gdbserver-support.exp
+
+require allow_gdbserver_tests
+
+standard_testfile
+
+if { [build_executable "failed to build" $testfile $srcfile] } {
+ return
+}
+
+# Set non-stop mode based on NON_STOP. Start a native inferior running in
+# the background, then start a second, remote inferior. Based on the value
+# of NON_STOP we might expect the inferior thread to have been stopped.
+# Confirm inferior one is in the correct state, and that it can be
+# interrupted and/or resumed.
+proc run_test { target_non_stop non_stop } {
+ clean_restart $::testfile
+
+ # Setup non-stop settings.
+ gdb_test_no_output "maint set target-non-stop $target_non_stop"
+ gdb_test_no_output "set non-stop $non_stop"
+
+ # Start the first inferior running in the background.
+ gdb_test -no-prompt-anchor "run&" "Starting program: .*" "start background inferior"
+
+ # Add a second inferior.
+ gdb_test "add-inferior" "Added inferior 2.*"
+ gdb_test "inferior 2" "Switching to inferior 2.*"
+
+ # Setup the sysroot if possible. This will make connecting to
+ # gdbserver quicker.
+ if { ![is_remote host] && ![is_remote target] } {
+ gdb_test "set sysroot"
+ }
+
+ # Setup, and connect to, a remote target.
+ set target_exec [gdbserver_download_current_prog]
+ set res [gdbserver_start "" $target_exec]
+ set gdbserver_protocol [lindex $res 0]
+ set gdbserver_gdbport [lindex $res 1]
+ set res [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
+ gdb_assert {$res == 0} "connect to remote target"
+
+ # Check the info threads output. We're checking that we see the two
+ # threads we expect, that the correct thread (inferior two's thread)
+ # is current, and that none of the threads are running.
+ set state_inferior_1 ""
+ set state_inferior_2 ""
+ gdb_test_multiple "info threads" "" {
+ -re "^info threads\r\n" {
+ exp_continue
+ }
+
+ -re "^\\s+Id\\s+Target Id\\s+Frame\\s*\r\n" {
+ exp_continue
+ }
+
+ -re "^\\s+1\\.1\\s+\[^\r\n\]+\\(running\\)\r\n" {
+ set state_inferior_1 "running"
+ exp_continue
+ }
+
+ -re "^\\*\\s+2\\.1\\s+\[^\r\n\]+\\(running\\)\r\n" {
+ set state_inferior_2 "running"
+ exp_continue
+ }
+
+ -re "^\\s+1\\.1\\s+\[^\r\n\]+\r\n" {
+ set state_inferior_1 "stopped"
+ exp_continue
+ }
+
+ -re "^\\*\\s+2\\.1\\s+\[^\r\n\]+\r\n" {
+ set state_inferior_2 "stopped"
+ exp_continue
+ }
+
+ -re "^$::gdb_prompt $" {
+ if { $non_stop } {
+ gdb_assert { $state_inferior_1 == "running" \
+ && $state_inferior_2 == "stopped" } \
+ $gdb_test_name
+ } else {
+ gdb_assert { $state_inferior_1 == "stopped" \
+ && $state_inferior_2 == "stopped" } \
+ $gdb_test_name
+ }
+ }
+ }
+
+ # Allow inferior 2 to reach main. The confirms that inferior 2 can be
+ # set running again.
+ gdb_breakpoint main
+ gdb_continue_to_breakpoint "breakpoint in main"
+ gdb_test "bt 1" \
+ "#0\\s+main \\(\\) at\[^\r\n\]+" \
+ "check inferior 2 is in main"
+
+ # Switch to inferior 1 and allow it to continue. This is a
+ # critical part of the test. When the test was added a bug (in
+ # all-stop mode) would leave inferior 1 stopped, but GDB code
+ # would think the thread was running. As such. the thread
+ # couldn't be resumed again.
+ gdb_test "inferior 1" "Switching to inferior 1.*"
+
+ # In non-stop mode, thread 1.1 is correctly left running, so we
+ # need to stop it now.
+ if { $non_stop } {
+ gdb_test -no-prompt-anchor "interrupt"
+ gdb_test "p 1 + 1" " = 2" \
+ "simple print to resync output"
+ }
+
+ gdb_breakpoint breakpt
+ gdb_continue_to_breakpoint "continue to breakpoint in breakpt"
+ gdb_test "bt 1" \
+ [multi_line \
+ "#0\\s+breakpt \\(\\) at\[^\r\n\]+" \
+ "\\(More stack frames follow\\.\\.\\.\\)"] \
+ "check inferior 1 is in breakpt"
+
+ # Switch back to inferior 2. The testing infrastructure will try to
+ # use 'monitor exit' to close gdbserver. It helps if we are in the
+ # gdbserver inferior when the script finishes.
+ gdb_test "inferior 2" "Switching to inferior 2.*" \
+ "switch back to inferior 2"
+}
+
+# Multi-inferior support requires non-stop targets.
+foreach_with_prefix target_non_stop { auto on } {
+ # But it's OK if we're emulating all-stop mode on top of non-stop.
+ foreach_with_prefix non_stop { on off } {
+ run_test $target_non_stop $non_stop
+ }
+}
diff --git a/gdb/testsuite/gdb.multi/remove-inferiors.c b/gdb/testsuite/gdb.multi/remove-inferiors.c
index 1fc584b..4c037df 100644
--- a/gdb/testsuite/gdb.multi/remove-inferiors.c
+++ b/gdb/testsuite/gdb.multi/remove-inferiors.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/remove-inferiors.exp b/gdb/testsuite/gdb.multi/remove-inferiors.exp
index 0e81c80..52e6cb0 100644
--- a/gdb/testsuite/gdb.multi/remove-inferiors.exp
+++ b/gdb/testsuite/gdb.multi/remove-inferiors.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ proc add_inferior { expected_num message } {
proc test_remove_inferiors { } {
global binfile
- clean_restart ${binfile}
+ clean_restart ${::testfile}
# Add another inferior and switch to it.
add_inferior 2 "add second inferior"
diff --git a/gdb/testsuite/gdb.multi/run-only-second-inf.c b/gdb/testsuite/gdb.multi/run-only-second-inf.c
index 27a14b7..65b18bc 100644
--- a/gdb/testsuite/gdb.multi/run-only-second-inf.c
+++ b/gdb/testsuite/gdb.multi/run-only-second-inf.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/run-only-second-inf.exp b/gdb/testsuite/gdb.multi/run-only-second-inf.exp
index be1d0df..3645962 100644
--- a/gdb/testsuite/gdb.multi/run-only-second-inf.exp
+++ b/gdb/testsuite/gdb.multi/run-only-second-inf.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if {[build_executable "failed to prepare" $testfile $srcfile {debug}]} {
# So, start GDB with this setting.
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"maint set target-non-stop on\""
- clean_restart ${binfile}
+ clean_restart ${::testfile}
}
# Add and start the second inferior.
diff --git a/gdb/testsuite/gdb.multi/sched-multi-add-inferior.exp b/gdb/testsuite/gdb.multi/sched-multi-add-inferior.exp
new file mode 100644
index 0000000..9344c80
--- /dev/null
+++ b/gdb/testsuite/gdb.multi/sched-multi-add-inferior.exp
@@ -0,0 +1,109 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Start multiple inferiors while schedule-multiple is on. Make use of
+# the multi-target.exp.tcl support library for the helper procs, but
+# don't use its 'setup' proc as that only turns on schedule-multiple
+# after starting all the inferiors, and that is too late for this test.
+#
+# The specific bug that this test guards against was that, when a
+# native target starts and runs upto a breakpoint, the thread would
+# have its last signal recorded as SIGTRAP.
+#
+# When starting a gdbserver inferior (with schedule-multiple on) the
+# native target would also be resumed.
+#
+# However, GDBs 'run' command was failing to clear out the old signal
+# state from the native inferior, and so GDB would deliver a SIGTRAP
+# to that inferior, killing it.
+
+source $srcdir/$subdir/multi-target.exp.tcl
+
+if {![multi_target_prepare]} {
+ return
+}
+
+# Some breakpoint locations.
+set line1 [gdb_get_line_number "set break 1 here"]
+set line2 [gdb_get_line_number "set break 2 here"]
+
+# Start two inferiors using TARGET_TYPE_1 and TARGET_TYPE_2 (either
+# 'extended-remote' or 'native'). Due to the way that inferior 1 is
+# special (existing once GDB starts up), we just use the existing
+# helper functions to create inferiors 2 and 3 using these types, and
+# we leave inferior 1 unused.
+proc run_test { target_type_1 target_type_2 } {
+ cleanup_gdbservers
+
+ clean_restart
+
+ gdb_test_no_output "set sysroot"
+
+ # The schedule-multiple setting relies on all targets running in
+ # non-stop mode. Force it on for remote targets, until this is
+ # the default.
+ gdb_test_no_output "maint set target-non-stop on"
+
+ # Run in all-stop mode.
+ gdb_test_no_output "set non-stop off"
+
+ # Turn on schedule-multiple before starting any inferiors.
+ gdb_test_no_output "set schedule-multiple on"
+
+ if {![add_inferior 2 $target_type_1 $::binfile]} {
+ return 0
+ }
+
+ if {![add_inferior 3 $target_type_2 $::binfile]} {
+ return 0
+ }
+
+ # Check we see all the expected threads.
+ gdb_test "info threads" \
+ [multi_line \
+ "\\s+Id\\s+Target Id\\s+Frame\\s*" \
+ "\\s+2\\.1\\s+\[^\r\n\]+" \
+ "\\s+2\\.2\\s+\[^\r\n\]+" \
+ "\\*\\s+3\\.1\\s+\[^\r\n\]+" \
+ "\\s+3\\.2\\s+\[^\r\n\]+"]
+
+ # Ensure that all inferiors can be set running again.
+ gdb_test "break ${::srcfile}:${::line1} thread 3.1"
+ gdb_test "break ${::srcfile}:${::line2} thread 2.1"
+ gdb_test "continue" \
+ [multi_line \
+ "Thread 3\\.1 \[^\r\n\]+, main \\(\[^\r\n\]+\\) at \[^\r\n\]+" \
+ "$::decimal\\s+function1 \\(\\); /\\* set break 1 here \\*/"] \
+ "continue to function1"
+
+ # Unblock thread 2.1 and continue again. This time, thread 2.1
+ # will hit a breakpoint.
+ gdb_test "thread apply 2.1 set wait_for_gdb = 0" ".*"
+ gdb_test "continue" \
+ [multi_line \
+ "Thread 2\\.1 \[^\r\n\]+, main \\(\[^\r\n\]+\\) at \[^\r\n\]+" \
+ "$::decimal\\s+function2 \\(\\); /\\* set break 2 here \\*/"] \
+ "continue to function2"
+}
+
+set all_target_types { extended-remote native }
+
+foreach_with_prefix target_type_1 $all_target_types {
+ foreach_with_prefix target_type_2 $all_target_types {
+ run_test $target_type_1 $target_type_2
+ }
+}
+
+multi_target_cleanup
diff --git a/gdb/testsuite/gdb.multi/start-inferior-specific-other.c b/gdb/testsuite/gdb.multi/start-inferior-specific-other.c
index 2e907be..355fbb0 100644
--- a/gdb/testsuite/gdb.multi/start-inferior-specific-other.c
+++ b/gdb/testsuite/gdb.multi/start-inferior-specific-other.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/start-inferior-specific.c b/gdb/testsuite/gdb.multi/start-inferior-specific.c
index 91f7abc..0a47e0e 100644
--- a/gdb/testsuite/gdb.multi/start-inferior-specific.c
+++ b/gdb/testsuite/gdb.multi/start-inferior-specific.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/start-inferior-specific.exp b/gdb/testsuite/gdb.multi/start-inferior-specific.exp
index c2a8bdb..39621f0 100644
--- a/gdb/testsuite/gdb.multi/start-inferior-specific.exp
+++ b/gdb/testsuite/gdb.multi/start-inferior-specific.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,10 +25,13 @@
standard_testfile .c -other.c
+require allow_multi_inferior_tests
+
require !use_gdb_stub
set srcfile_other ${srcfile2}
-set binfile_other ${binfile}-other
+set testfile_other $testfile-other
+set binfile_other [standard_output_file $testfile_other]
if { [build_executable ${testfile}.exp ${binfile} "${srcfile}" {debug}] != 0 } {
return -1
@@ -46,7 +49,7 @@ proc do_test {} {
append ::GDBFLAGS " -ex \"maintenance set target-non-stop on\""
}
- clean_restart ${::binfile_other}
+ clean_restart $::testfile_other
}
gdb_test -no-prompt-anchor "run&" "Starting program: .*" "start background inferior"
diff --git a/gdb/testsuite/gdb.multi/stop-all-on-exit.c b/gdb/testsuite/gdb.multi/stop-all-on-exit.c
index 56df916..d672b07 100644
--- a/gdb/testsuite/gdb.multi/stop-all-on-exit.c
+++ b/gdb/testsuite/gdb.multi/stop-all-on-exit.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/stop-all-on-exit.exp b/gdb/testsuite/gdb.multi/stop-all-on-exit.exp
index 1ac5388c..47071f3 100644
--- a/gdb/testsuite/gdb.multi/stop-all-on-exit.exp
+++ b/gdb/testsuite/gdb.multi/stop-all-on-exit.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,6 +18,8 @@
# Test that in all-stop mode with multiple inferiors, GDB stops all
# threads upon receiving an exit event from one of the inferiors.
+require allow_multi_inferior_tests
+
# This is a test specific for a native target, where we use the
# "-exec" argument to "add-inferior" and we explicitly don't do
# "maint set target-non-stop on".
diff --git a/gdb/testsuite/gdb.multi/tids-gid-reset.c b/gdb/testsuite/gdb.multi/tids-gid-reset.c
index c894e30..68e3308 100644
--- a/gdb/testsuite/gdb.multi/tids-gid-reset.c
+++ b/gdb/testsuite/gdb.multi/tids-gid-reset.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/tids-gid-reset.exp b/gdb/testsuite/gdb.multi/tids-gid-reset.exp
index a366a35..1785ac2 100644
--- a/gdb/testsuite/gdb.multi/tids-gid-reset.exp
+++ b/gdb/testsuite/gdb.multi/tids-gid-reset.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -54,6 +54,8 @@ with_test_prefix "single-inferior" {
# non-extended gdbserver is not supported.
require !use_gdb_stub
+require allow_multi_inferior_tests
+
# Test with multiple inferiors. This time, since we restart inferior
# 1 while inferior 2 still has threads, then the new thread 1.1 should
# end up with GID == 3, since we won't be able to reset the global
diff --git a/gdb/testsuite/gdb.multi/tids.c b/gdb/testsuite/gdb.multi/tids.c
index 67f1074..811d803 100644
--- a/gdb/testsuite/gdb.multi/tids.c
+++ b/gdb/testsuite/gdb.multi/tids.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/tids.exp b/gdb/testsuite/gdb.multi/tids.exp
index 4f78884..436a38a 100644
--- a/gdb/testsuite/gdb.multi/tids.exp
+++ b/gdb/testsuite/gdb.multi/tids.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -124,6 +124,9 @@ with_test_prefix "single inferior" {
gdb_test "print \$_inferior_thread_count" " = 1"
}
+# The rest of the tests require running multiple inferiors.
+require allow_multi_inferior_tests
+
# "info threads" while there are multiple inferiors should show
# qualified thread IDs.
with_test_prefix "two inferiors" {
@@ -290,7 +293,7 @@ with_test_prefix "two inferiors" {
# Try both the convenience variable and the literal number.
foreach thr {"\$thr" "20" "1.20" "\$inf.1" "30.1" } {
set expected [string_to_regexp $thr]
- gdb_test "info threads $thr" "No threads match '${expected}'."
+ gdb_test "info threads $thr" "No threads matched\\."
# "info threads" works like a filter. If there's any other
# valid thread in the list, there's no error.
info_threads "$thr 1.1" "1.1"
@@ -412,7 +415,7 @@ with_test_prefix "two inferiors" {
# Check that we do parse the inferior number and don't confuse it.
gdb_test "info threads 3.1" \
- "No threads match '3.1'\."
+ "No threads matched\\."
}
if { [allow_python_tests] } {
diff --git a/gdb/testsuite/gdb.multi/watchpoint-multi-exit.c b/gdb/testsuite/gdb.multi/watchpoint-multi-exit.c
index 5bdbf89..4574dab 100644
--- a/gdb/testsuite/gdb.multi/watchpoint-multi-exit.c
+++ b/gdb/testsuite/gdb.multi/watchpoint-multi-exit.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/watchpoint-multi-exit.exp b/gdb/testsuite/gdb.multi/watchpoint-multi-exit.exp
index 688b145..a149407 100644
--- a/gdb/testsuite/gdb.multi/watchpoint-multi-exit.exp
+++ b/gdb/testsuite/gdb.multi/watchpoint-multi-exit.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,6 +17,8 @@
# watchpoints don't end up with stale locations, preventing resumption
# of other inferiors.
+require allow_fork_tests
+
standard_testfile
if {[build_executable "failed to build" $testfile $srcfile {debug}]} {
@@ -29,12 +31,12 @@ if {[build_executable "failed to build" $testfile $srcfile {debug}]} {
proc do_test {dispose} {
global binfile bkptno_numopt_re
- clean_restart $binfile
+ clean_restart $::testfile
gdb_test_no_output "set follow-fork child"
gdb_test_no_output "set detach-on-fork off"
- if ![runto "child_function"] {
+ if {![runto "child_function"]} {
return
}
diff --git a/gdb/testsuite/gdb.multi/watchpoint-multi.c b/gdb/testsuite/gdb.multi/watchpoint-multi.c
index 0c54144..4dd5bde 100644
--- a/gdb/testsuite/gdb.multi/watchpoint-multi.c
+++ b/gdb/testsuite/gdb.multi/watchpoint-multi.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.multi/watchpoint-multi.exp b/gdb/testsuite/gdb.multi/watchpoint-multi.exp
index 91e42d8..501f0a6 100644
--- a/gdb/testsuite/gdb.multi/watchpoint-multi.exp
+++ b/gdb/testsuite/gdb.multi/watchpoint-multi.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,6 +16,8 @@
standard_testfile
set executable ${testfile}
+require allow_multi_inferior_tests
+
# Multiple inferiors are needed, therefore both native and extended gdbserver
# modes are supported. Only non-extended gdbserver is not supported.
require !use_gdb_stub
@@ -36,7 +38,7 @@ gdb_test_no_output "set breakpoint always-inserted on"
# displaced-stepping is also needed as other GDB sometimes still removes the
# breakpoints, even with always-inserted on.
# Without the support this test just is not as thorough as it could be.
-if [support_displaced_stepping] {
+if {[support_displaced_stepping]} {
gdb_test_no_output "set displaced-stepping on"
}
diff --git a/gdb/testsuite/gdb.objc/basicclass.exp b/gdb/testsuite/gdb.objc/basicclass.exp
index f4410b4..9e40c71 100644
--- a/gdb/testsuite/gdb.objc/basicclass.exp
+++ b/gdb/testsuite/gdb.objc/basicclass.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -72,7 +72,7 @@ proc deduce_language_of_main {} {
proc do_objc_tests {} {
global binfile
- clean_restart $binfile
+ clean_restart $::testfile
deduce_language_of_main
}
diff --git a/gdb/testsuite/gdb.objc/nondebug.exp b/gdb/testsuite/gdb.objc/nondebug.exp
index c7565b8..9ca86ff 100644
--- a/gdb/testsuite/gdb.objc/nondebug.exp
+++ b/gdb/testsuite/gdb.objc/nondebug.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if {[gdb_compile_objc "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [
proc do_objc_tests {} {
global binfile
- clean_restart $binfile
+ clean_restart $::testfile
}
do_objc_tests
diff --git a/gdb/testsuite/gdb.objc/objcdecode.exp b/gdb/testsuite/gdb.objc/objcdecode.exp
index 6582d08..5414f0f 100644
--- a/gdb/testsuite/gdb.objc/objcdecode.exp
+++ b/gdb/testsuite/gdb.objc/objcdecode.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if {[gdb_compile_objc "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [
proc do_objc_tests {} {
global binfile
- clean_restart $binfile
+ clean_restart $::testfile
}
do_objc_tests
diff --git a/gdb/testsuite/gdb.objc/print.exp b/gdb/testsuite/gdb.objc/print.exp
index 0d67cef..e3f4177 100644
--- a/gdb/testsuite/gdb.objc/print.exp
+++ b/gdb/testsuite/gdb.objc/print.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -59,7 +59,7 @@ proc test_float_rejected {} {
clean_restart
-if [set_lang_objc] {
+if { [set_lang_objc] } {
test_float_accepted
test_float_rejected
} else {
diff --git a/gdb/testsuite/gdb.opencl/callfuncs.cl b/gdb/testsuite/gdb.opencl/callfuncs.cl
index bace910..c048aa9 100644
--- a/gdb/testsuite/gdb.opencl/callfuncs.cl
+++ b/gdb/testsuite/gdb.opencl/callfuncs.cl
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opencl/callfuncs.exp b/gdb/testsuite/gdb.opencl/callfuncs.exp
index e5f0aa5..6982461 100644
--- a/gdb/testsuite/gdb.opencl/callfuncs.exp
+++ b/gdb/testsuite/gdb.opencl/callfuncs.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,8 +21,9 @@ load_lib opencl.exp
require allow_opencl_tests
-set testfile "callfuncs"
-set clprogram [remote_download target ${srcdir}/${subdir}/${testfile}.cl]
+standard_testfile .cl
+
+set clprogram [remote_download target $srcdir/$subdir/$srcfile]
# Compile the generic OpenCL host app
if { [gdb_compile_opencl_hostapp "${clprogram}" "${testfile}" "" ] != "" } {
@@ -30,7 +31,7 @@ if { [gdb_compile_opencl_hostapp "${clprogram}" "${testfile}" "" ] != "" } {
return -1
}
-clean_restart [standard_testfile $testfile]
+clean_restart $testfile
# Set breakpoint at the OpenCL kernel
gdb_test "tbreak testkernel" \
diff --git a/gdb/testsuite/gdb.opencl/convs_casts.cl b/gdb/testsuite/gdb.opencl/convs_casts.cl
index da4ddf2..087d596 100644
--- a/gdb/testsuite/gdb.opencl/convs_casts.cl
+++ b/gdb/testsuite/gdb.opencl/convs_casts.cl
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opencl/convs_casts.exp b/gdb/testsuite/gdb.opencl/convs_casts.exp
index b267cbc..23a18d7 100644
--- a/gdb/testsuite/gdb.opencl/convs_casts.exp
+++ b/gdb/testsuite/gdb.opencl/convs_casts.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opencl/datatypes.cl b/gdb/testsuite/gdb.opencl/datatypes.cl
index 999defa..75845fa 100644
--- a/gdb/testsuite/gdb.opencl/datatypes.cl
+++ b/gdb/testsuite/gdb.opencl/datatypes.cl
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opencl/datatypes.exp b/gdb/testsuite/gdb.opencl/datatypes.exp
index 16243ad..78762da 100644
--- a/gdb/testsuite/gdb.opencl/datatypes.exp
+++ b/gdb/testsuite/gdb.opencl/datatypes.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opencl/operators.cl b/gdb/testsuite/gdb.opencl/operators.cl
index 19d509a..66e8870 100644
--- a/gdb/testsuite/gdb.opencl/operators.cl
+++ b/gdb/testsuite/gdb.opencl/operators.cl
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opencl/operators.exp b/gdb/testsuite/gdb.opencl/operators.exp
index 7890d80..bbf663d 100644
--- a/gdb/testsuite/gdb.opencl/operators.exp
+++ b/gdb/testsuite/gdb.opencl/operators.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opencl/vec_comps.cl b/gdb/testsuite/gdb.opencl/vec_comps.cl
index 6ba1c04..eb4f55d 100644
--- a/gdb/testsuite/gdb.opencl/vec_comps.cl
+++ b/gdb/testsuite/gdb.opencl/vec_comps.cl
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opencl/vec_comps.exp b/gdb/testsuite/gdb.opencl/vec_comps.exp
index c3d6d58..09c12ec 100644
--- a/gdb/testsuite/gdb.opencl/vec_comps.exp
+++ b/gdb/testsuite/gdb.opencl/vec_comps.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@ set have_cl_khr_fp16 [get_integer_valueof "have_cl_khr_fp16" 0]
# Sanity checks
proc check_basic { name type size } {
gdb_test "ptype ${name}" "type = ${type}16"
- gdb_test "p sizeof(${name})" " = [expr ${size} * 16]"
+ gdb_test "p sizeof(${name})" " = [expr {${size} * 16}]"
gdb_test "print/d ${name}" " = \\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15\\}"
}
@@ -227,40 +227,40 @@ proc check_type { name type alttype } {
}
proc check_sizeof { name size } {
- gdb_test "print sizeof (${name}.lo)" " = [expr $size * 8]"
- gdb_test "print sizeof (${name}.hi)" " = [expr $size * 8]"
- gdb_test "print sizeof (${name}.even)" " = [expr $size * 8]"
- gdb_test "print sizeof (${name}.odd)" " = [expr $size * 8]"
+ gdb_test "print sizeof (${name}.lo)" " = [expr {$size * 8}]"
+ gdb_test "print sizeof (${name}.hi)" " = [expr {$size * 8}]"
+ gdb_test "print sizeof (${name}.even)" " = [expr {$size * 8}]"
+ gdb_test "print sizeof (${name}.odd)" " = [expr {$size * 8}]"
- gdb_test "print sizeof (${name}.hi.even)" " = [expr $size * 4]"
- gdb_test "print sizeof (${name}.odd.odd.lo)" " = [expr $size * 2]"
+ gdb_test "print sizeof (${name}.hi.even)" " = [expr {$size * 4}]"
+ gdb_test "print sizeof (${name}.odd.odd.lo)" " = [expr {$size * 2}]"
gdb_test "print sizeof (${name}.even.hi.lo.odd)" " = $size"
gdb_test "print sizeof (${name}.x)" " = $size"
- gdb_test "print sizeof (${name}.xy)" " = [expr $size * 2]"
- gdb_test "print sizeof (${name}.xyz)" " = [expr $size * 4]"
- gdb_test "print sizeof (${name}.xyzw)" " = [expr $size * 4]"
+ gdb_test "print sizeof (${name}.xy)" " = [expr {$size * 2}]"
+ gdb_test "print sizeof (${name}.xyz)" " = [expr {$size * 4}]"
+ gdb_test "print sizeof (${name}.xyzw)" " = [expr {$size * 4}]"
gdb_test "print sizeof (${name}.xy.x)" " = $size"
- gdb_test "print sizeof (${name}.wzyx.yy)" " = [expr $size * 2]"
+ gdb_test "print sizeof (${name}.wzyx.yy)" " = [expr {$size * 2}]"
gdb_test "print sizeof (${name}.wzyx.yx.x)" " = $size"
gdb_test "print sizeof (${name}.xyzw.w)" " = $size"
gdb_test "print sizeof (${name}.s0)" " = $size"
- gdb_test "print sizeof (${name}.s01)" " = [expr $size * 2]"
- gdb_test "print sizeof (${name}.s012)" " = [expr $size * 4]"
- gdb_test "print sizeof (${name}.s0123)" " = [expr $size * 4]"
- gdb_test "print sizeof (${name}.s01234567)" " = [expr $size * 8]"
- gdb_test "print sizeof (${name}.s0123456789abcdef)" " = [expr $size * 16]"
-
- gdb_test "print sizeof (${name}.sfedcba98.S0246)" " = [expr $size * 4]"
- gdb_test "print sizeof (${name}.sfedcba98.S0246.s13)" " = [expr $size * 2]"
+ gdb_test "print sizeof (${name}.s01)" " = [expr {$size * 2}]"
+ gdb_test "print sizeof (${name}.s012)" " = [expr {$size * 4}]"
+ gdb_test "print sizeof (${name}.s0123)" " = [expr {$size * 4}]"
+ gdb_test "print sizeof (${name}.s01234567)" " = [expr {$size * 8}]"
+ gdb_test "print sizeof (${name}.s0123456789abcdef)" " = [expr {$size * 16}]"
+
+ gdb_test "print sizeof (${name}.sfedcba98.S0246)" " = [expr {$size * 4}]"
+ gdb_test "print sizeof (${name}.sfedcba98.S0246.s13)" " = [expr {$size * 2}]"
gdb_test "print sizeof (${name}.sfedcba98.S0246.s13.s0)" " = $size"
- gdb_test "print sizeof (${name}.s0123456789abcdef.s22)" " = [expr $size * 2]"
+ gdb_test "print sizeof (${name}.s0123456789abcdef.s22)" " = [expr {$size * 2}]"
- gdb_test "print sizeof (${name}.hi.s7654.wx)" " = [expr $size * 2]"
- gdb_test "print sizeof (${name}.s0123456789abcdef.even.lo)" " = [expr $size * 4]"
- gdb_test "print sizeof (${name}.odd.xyzw.s23)" " = [expr $size * 2]"
+ gdb_test "print sizeof (${name}.hi.s7654.wx)" " = [expr {$size * 2}]"
+ gdb_test "print sizeof (${name}.s0123456789abcdef.even.lo)" " = [expr {$size * 4}]"
+ gdb_test "print sizeof (${name}.odd.xyzw.s23)" " = [expr {$size * 2}]"
gdb_test "print sizeof (${name}.xyzw.hi.odd)" " = $size"
}
@@ -343,8 +343,8 @@ proc check_access { name } {
# lvalue tests
for {set i 0} {$i < 16} {incr i} {
- gdb_test_no_output "set variable ${name}.s[format "%x" $i] = [expr 15 - $i]"
- gdb_test "print/d ${name}.s[format "%x" $i]" " = [expr 15 - $i]"
+ gdb_test_no_output "set variable ${name}.s[format "%x" $i] = [expr {15 - $i}]"
+ gdb_test "print/d ${name}.s[format "%x" $i]" " = [expr {15 - $i}]"
}
gdb_test "print/d ${name}" " = \\{15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0\\}"
diff --git a/gdb/testsuite/gdb.opt/break-on-_exit.c b/gdb/testsuite/gdb.opt/break-on-_exit.c
index 688311e..e138556 100644
--- a/gdb/testsuite/gdb.opt/break-on-_exit.c
+++ b/gdb/testsuite/gdb.opt/break-on-_exit.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/break-on-_exit.exp b/gdb/testsuite/gdb.opt/break-on-_exit.exp
index 59fecaa..9295fea 100644
--- a/gdb/testsuite/gdb.opt/break-on-_exit.exp
+++ b/gdb/testsuite/gdb.opt/break-on-_exit.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
# for libc, then the breakpoint is set on the exec-local _exit@plt instead,
# and that functionality will also not be used.
#
-# We may get the required setup in case of a libc with misssing separate
+# We may get the required setup in case of a libc with missing separate
# debuginfo, but we want the same effect if that debuginfo is installed.
#
# So, we use -readnever to read minimal symbols, but not non-miminal symbols.
diff --git a/gdb/testsuite/gdb.opt/clobbered-registers-O2-2.c b/gdb/testsuite/gdb.opt/clobbered-registers-O2-2.c
index e0675cb..7ba817c 100644
--- a/gdb/testsuite/gdb.opt/clobbered-registers-O2-2.c
+++ b/gdb/testsuite/gdb.opt/clobbered-registers-O2-2.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/clobbered-registers-O2-3.c b/gdb/testsuite/gdb.opt/clobbered-registers-O2-3.c
index b55a613..803fc94 100644
--- a/gdb/testsuite/gdb.opt/clobbered-registers-O2-3.c
+++ b/gdb/testsuite/gdb.opt/clobbered-registers-O2-3.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/clobbered-registers-O2.c b/gdb/testsuite/gdb.opt/clobbered-registers-O2.c
index 5f5d7a1..713267b 100644
--- a/gdb/testsuite/gdb.opt/clobbered-registers-O2.c
+++ b/gdb/testsuite/gdb.opt/clobbered-registers-O2.c
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/clobbered-registers-O2.exp b/gdb/testsuite/gdb.opt/clobbered-registers-O2.exp
index 326dce7..c6457c7 100644
--- a/gdb/testsuite/gdb.opt/clobbered-registers-O2.exp
+++ b/gdb/testsuite/gdb.opt/clobbered-registers-O2.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/fortran-string.exp b/gdb/testsuite/gdb.opt/fortran-string.exp
index 87f42d8..bad25cd 100644
--- a/gdb/testsuite/gdb.opt/fortran-string.exp
+++ b/gdb/testsuite/gdb.opt/fortran-string.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/fortran-string.f90 b/gdb/testsuite/gdb.opt/fortran-string.f90
index 4e7d5c8..4aeb95c 100644
--- a/gdb/testsuite/gdb.opt/fortran-string.f90
+++ b/gdb/testsuite/gdb.opt/fortran-string.f90
@@ -1,4 +1,4 @@
-! Copyright 2009-2024 Free Software Foundation, Inc.
+! Copyright 2009-2025 Free Software Foundation, Inc.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/inline-break.c b/gdb/testsuite/gdb.opt/inline-break.c
index 9e31bd9..ed79a95 100644
--- a/gdb/testsuite/gdb.opt/inline-break.c
+++ b/gdb/testsuite/gdb.opt/inline-break.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/inline-break.exp b/gdb/testsuite/gdb.opt/inline-break.exp
index 9c57d22..0805f69 100644
--- a/gdb/testsuite/gdb.opt/inline-break.exp
+++ b/gdb/testsuite/gdb.opt/inline-break.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -209,7 +209,7 @@ foreach_with_prefix cmd [list "break" "tbreak"] {
# that we actually stop where we think we should.
for {set i 1} {$i < 4} {incr i} {
foreach inline {"not_inline" "inline"} {
- eval gdb_breakpoint "${inline}_func$i" $break_flags
+ gdb_breakpoint "${inline}_func$i" {*}$break_flags
}
}
@@ -247,7 +247,7 @@ foreach_with_prefix func {
"func_inline_caller"
"func_inline_callee"
} {
- clean_restart $binfile
+ clean_restart $::testfile
if {![runto_main]} {
continue
@@ -264,7 +264,7 @@ foreach_with_prefix func {
set line [gdb_get_line_number "break here"]
with_test_prefix "line number" {
- clean_restart $binfile
+ clean_restart $::testfile
if {![runto_main]} {
continue
@@ -288,7 +288,7 @@ with_test_prefix "line number" {
with_test_prefix "address" {
- clean_restart $binfile
+ clean_restart $::testfile
if {![runto_main]} {
continue
@@ -308,7 +308,7 @@ with_test_prefix "address" {
with_test_prefix "check alignment" {
- clean_restart $binfile
+ clean_restart $::testfile
if {![runto_main]} {
continue
diff --git a/gdb/testsuite/gdb.opt/inline-bt.c b/gdb/testsuite/gdb.opt/inline-bt.c
index 3999104..a020bd7 100644
--- a/gdb/testsuite/gdb.opt/inline-bt.c
+++ b/gdb/testsuite/gdb.opt/inline-bt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/inline-bt.exp b/gdb/testsuite/gdb.opt/inline-bt.exp
index 9e1fb19..79c48e8 100644
--- a/gdb/testsuite/gdb.opt/inline-bt.exp
+++ b/gdb/testsuite/gdb.opt/inline-bt.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/inline-cmds.c b/gdb/testsuite/gdb.opt/inline-cmds.c
index dac8e8b..f9c7d24 100644
--- a/gdb/testsuite/gdb.opt/inline-cmds.c
+++ b/gdb/testsuite/gdb.opt/inline-cmds.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/inline-cmds.exp b/gdb/testsuite/gdb.opt/inline-cmds.exp
index 7a9f2e0..4163d8f 100644
--- a/gdb/testsuite/gdb.opt/inline-cmds.exp
+++ b/gdb/testsuite/gdb.opt/inline-cmds.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -241,7 +241,7 @@ gdb_test "step" ".*set breakpoint 2 here.*" "step into finish marker"
# Some architectures will have one or more instructions after
# the call instruction which still are part of the call sequence,
-# so it should be expected to return to the caller line after issue
+# so it should be expected to return to the caller line after issue
# a 'finish' command.
gdb_test_multiple "finish" "finish from marker to func1" {
-re -wrap "func1 \\(\\);" {
@@ -335,7 +335,7 @@ proc mi_cli_step {cli_output_re message} {
# command run while the top interpreter is MI results in the expected
# CLI output sent to MI's console.
with_test_prefix "mi" {
- if [mi_gdb_start] {
+ if {[mi_gdb_start]} {
return
}
mi_gdb_load ${binfile}
diff --git a/gdb/testsuite/gdb.opt/inline-entry.c b/gdb/testsuite/gdb.opt/inline-entry.c
index 891b22a..e9e2ebd 100644
--- a/gdb/testsuite/gdb.opt/inline-entry.c
+++ b/gdb/testsuite/gdb.opt/inline-entry.c
@@ -1,4 +1,4 @@
-/* Copyright 2024 Free Software Foundation, Inc.
+/* Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/inline-entry.exp b/gdb/testsuite/gdb.opt/inline-entry.exp
index 16443c6..227131a 100644
--- a/gdb/testsuite/gdb.opt/inline-entry.exp
+++ b/gdb/testsuite/gdb.opt/inline-entry.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@
# case where DW_AT_entry_pc is not the first instruction of an inlined
# function, as can be the case in gcc 8.x with the
# -gstatement-frontiers work in place.
-require {expr ![is_c_compiler_gcc] || [supports_statement_frontiers]}
+require {expr {![is_c_compiler_gcc] || [supports_statement_frontiers]}}
standard_testfile
@@ -43,11 +43,11 @@ if { [supports_statement_frontiers] } {
lappend options additional_flags=-gstatement-frontiers
}
-if { [prepare_for_testing "failed to prepare" $binfile $srcfile $options] } {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile $options] } {
return
}
-if ![runto_main] {
+if { ![runto_main] } {
return
}
diff --git a/gdb/testsuite/gdb.opt/inline-locals.c b/gdb/testsuite/gdb.opt/inline-locals.c
index a673098..f78bea4 100644
--- a/gdb/testsuite/gdb.opt/inline-locals.c
+++ b/gdb/testsuite/gdb.opt/inline-locals.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/inline-locals.exp b/gdb/testsuite/gdb.opt/inline-locals.exp
index 358a8d2..6561cc3 100644
--- a/gdb/testsuite/gdb.opt/inline-locals.exp
+++ b/gdb/testsuite/gdb.opt/inline-locals.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/inline-markers.c b/gdb/testsuite/gdb.opt/inline-markers.c
index 02fd5df..764b0aa 100644
--- a/gdb/testsuite/gdb.opt/inline-markers.c
+++ b/gdb/testsuite/gdb.opt/inline-markers.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/inline-small-func.c b/gdb/testsuite/gdb.opt/inline-small-func.c
index 036f7ef..6f86b44 100644
--- a/gdb/testsuite/gdb.opt/inline-small-func.c
+++ b/gdb/testsuite/gdb.opt/inline-small-func.c
@@ -1,4 +1,4 @@
-/* Copyright 2020-2024 Free Software Foundation, Inc.
+/* Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/inline-small-func.exp b/gdb/testsuite/gdb.opt/inline-small-func.exp
index 9090e23..b04f957 100644
--- a/gdb/testsuite/gdb.opt/inline-small-func.exp
+++ b/gdb/testsuite/gdb.opt/inline-small-func.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if { ![runto_main] } {
return -1
}
diff --git a/gdb/testsuite/gdb.opt/inline-small-func.h b/gdb/testsuite/gdb.opt/inline-small-func.h
index 135a08a..10373fc 100644
--- a/gdb/testsuite/gdb.opt/inline-small-func.h
+++ b/gdb/testsuite/gdb.opt/inline-small-func.h
@@ -1,4 +1,4 @@
-/* Copyright 2020-2024 Free Software Foundation, Inc.
+/* Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/main.c b/gdb/testsuite/gdb.opt/main.c
index 75dd353..b6c34a2 100644
--- a/gdb/testsuite/gdb.opt/main.c
+++ b/gdb/testsuite/gdb.opt/main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/solib-intra-step-lib.c b/gdb/testsuite/gdb.opt/solib-intra-step-lib.c
index 928491b..688fa09 100644
--- a/gdb/testsuite/gdb.opt/solib-intra-step-lib.c
+++ b/gdb/testsuite/gdb.opt/solib-intra-step-lib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/solib-intra-step-main.c b/gdb/testsuite/gdb.opt/solib-intra-step-main.c
index d90f820..784c17d 100644
--- a/gdb/testsuite/gdb.opt/solib-intra-step-main.c
+++ b/gdb/testsuite/gdb.opt/solib-intra-step-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/solib-intra-step.exp b/gdb/testsuite/gdb.opt/solib-intra-step.exp
index 67f894c..9c6d6c5 100644
--- a/gdb/testsuite/gdb.opt/solib-intra-step.exp
+++ b/gdb/testsuite/gdb.opt/solib-intra-step.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_load_shlib $binfile_lib
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.opt/static-optimized-out.c b/gdb/testsuite/gdb.opt/static-optimized-out.c
index 2a50228..daeaf67 100644
--- a/gdb/testsuite/gdb.opt/static-optimized-out.c
+++ b/gdb/testsuite/gdb.opt/static-optimized-out.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.opt/static-optimized-out.exp b/gdb/testsuite/gdb.opt/static-optimized-out.exp
index bbf27c0..f9925e8 100644
--- a/gdb/testsuite/gdb.opt/static-optimized-out.exp
+++ b/gdb/testsuite/gdb.opt/static-optimized-out.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.pascal/case-insensitive-symbols.exp b/gdb/testsuite/gdb.pascal/case-insensitive-symbols.exp
index b80f597..9a50d64 100644
--- a/gdb/testsuite/gdb.pascal/case-insensitive-symbols.exp
+++ b/gdb/testsuite/gdb.pascal/case-insensitive-symbols.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.pascal/case-insensitive-symbols.pas b/gdb/testsuite/gdb.pascal/case-insensitive-symbols.pas
index df3f068..cb6755d 100644
--- a/gdb/testsuite/gdb.pascal/case-insensitive-symbols.pas
+++ b/gdb/testsuite/gdb.pascal/case-insensitive-symbols.pas
@@ -1,5 +1,5 @@
{
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.pascal/floats.exp b/gdb/testsuite/gdb.pascal/floats.exp
index d96fb9b..926c0c3 100644
--- a/gdb/testsuite/gdb.pascal/floats.exp
+++ b/gdb/testsuite/gdb.pascal/floats.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -48,9 +48,9 @@ gdb_test "next" "u := 78\\.3;" "next to 'u := 78.3' line"
gdb_test "next" "l := 1;" "next to 'l := 1' line"
gdb_test "next" "i := 1;" "next to 'i := 1' line"
-# At that point,
+# At that point,
# r should be equal to 1.25
-gdb_test "print r" " = 1\\.25"
+gdb_test "print r" " = 1\\.25"
# s should be equal to 2.2
gdb_test "print s" " = 2\\.(199.*|2|200.*)"
# t should be equal to -3.2
@@ -120,7 +120,7 @@ gdb_test "next" "s := sin\\(u\\);" "advance to 's := sin(u)' line"
gdb_test "print r" " = -1" "test cos(pi) is equal to -1"
gdb_test "next" "" "go past 's := sin(u)' line"
-set msg "Test sin(pi) is equal to 0"
+set msg "Test sin(pi) is equal to 0"
gdb_test_multiple "print s" $msg {
-re ".* = (0|-?\[0-9\]\\.\[0-9\]*\[eE\](-?\[0-9\]*))\[\r\n\]+$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.pascal/floats.pas b/gdb/testsuite/gdb.pascal/floats.pas
index 7bfe9e9..d8d96f1 100644
--- a/gdb/testsuite/gdb.pascal/floats.pas
+++ b/gdb/testsuite/gdb.pascal/floats.pas
@@ -1,5 +1,5 @@
{
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.pascal/gdb11492.exp b/gdb/testsuite/gdb.pascal/gdb11492.exp
index fdc62f5..67764c5 100644
--- a/gdb/testsuite/gdb.pascal/gdb11492.exp
+++ b/gdb/testsuite/gdb.pascal/gdb11492.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,9 +37,9 @@ if { [gdb_breakpoint ${srcfile}:${bp_location1}] } {
gdb_test "continue" ""
gdb_test "print integer_array" { = \{50, 51, 52, 53, 54, 55, 56, 57\}}
-gdb_test "print /s integer_array" " = '23456789'"
+gdb_test "print /s integer_array" " = '23456789'"
-gdb_test "print char_array" " = '23456789'"
+gdb_test "print char_array" " = '23456789'"
gdb_test "print /d char_array" { = \{50, 51, 52, 53, 54, 55, 56, 57\}}
gdb_test "print /x char_array" { = \{0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39\}}
# Use next two times to avoid GPC line numbering problem
diff --git a/gdb/testsuite/gdb.pascal/gdb11492.pas b/gdb/testsuite/gdb.pascal/gdb11492.pas
index 47206cd..ffaa52e 100644
--- a/gdb/testsuite/gdb.pascal/gdb11492.pas
+++ b/gdb/testsuite/gdb.pascal/gdb11492.pas
@@ -1,5 +1,5 @@
{
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.pascal/hello.exp b/gdb/testsuite/gdb.pascal/hello.exp
index 72eb8d6..ac10280 100644
--- a/gdb/testsuite/gdb.pascal/hello.exp
+++ b/gdb/testsuite/gdb.pascal/hello.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -46,7 +46,7 @@ gdb_test "print st" \
# This test also fails for gpc because the program
# stops after the string has been written
-# while it should stop before writing it
+# while it should stop before writing it
if { $pascal_compiler_is_gpc } {
setup_xfail *-*-*
}
diff --git a/gdb/testsuite/gdb.pascal/integers.exp b/gdb/testsuite/gdb.pascal/integers.exp
index 974de6f..12d15c8 100644
--- a/gdb/testsuite/gdb.pascal/integers.exp
+++ b/gdb/testsuite/gdb.pascal/integers.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,9 +43,9 @@ gdb_test "print i" ".* = 0" "print i before assigned to 1"
gdb_test "next" "i := 1;" "next to 'i := 1' line"
gdb_test "next" "j := 2;" "next to 'j := 2' line"
-# At that point,
+# At that point,
# i should be equal to 1
-gdb_test "print i" " = 1"
+gdb_test "print i" " = 1"
# but j should still be equal to zero
if { $pascal_compiler_is_gpc } {
setup_xfail *-*-*
@@ -59,7 +59,7 @@ gdb_test "next" "l := k;" "next to 'l := k' line"
gdb_test "print j" " = 2"
# k should be equal to 3
gdb_test "print k" " = 3"
-# But l shoud still be zero
+# But l should still be zero
if { $pascal_compiler_is_gpc } {
setup_xfail *-*-*
}
diff --git a/gdb/testsuite/gdb.pascal/integers.pas b/gdb/testsuite/gdb.pascal/integers.pas
index 33ce3b7..2f0f8e6 100644
--- a/gdb/testsuite/gdb.pascal/integers.pas
+++ b/gdb/testsuite/gdb.pascal/integers.pas
@@ -1,5 +1,5 @@
{
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.pascal/print.exp b/gdb/testsuite/gdb.pascal/print.exp
index 41671b9..18dff4b 100644
--- a/gdb/testsuite/gdb.pascal/print.exp
+++ b/gdb/testsuite/gdb.pascal/print.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -59,7 +59,7 @@ proc test_float_rejected {} {
clean_restart
-if [set_lang_pascal] {
+if { [set_lang_pascal] } {
test_float_accepted
test_float_rejected
} else {
diff --git a/gdb/testsuite/gdb.pascal/str-chars.exp b/gdb/testsuite/gdb.pascal/str-chars.exp
index 1e41b31..6cda9b6 100644
--- a/gdb/testsuite/gdb.pascal/str-chars.exp
+++ b/gdb/testsuite/gdb.pascal/str-chars.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.pascal/str-chars.pas b/gdb/testsuite/gdb.pascal/str-chars.pas
index 33f90bf..3d857cf 100644
--- a/gdb/testsuite/gdb.pascal/str-chars.pas
+++ b/gdb/testsuite/gdb.pascal/str-chars.pas
@@ -1,5 +1,5 @@
{
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.pascal/stub-method.exp b/gdb/testsuite/gdb.pascal/stub-method.exp
index 8b77d1e..4712eda 100644
--- a/gdb/testsuite/gdb.pascal/stub-method.exp
+++ b/gdb/testsuite/gdb.pascal/stub-method.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.pascal/stub-method.pas b/gdb/testsuite/gdb.pascal/stub-method.pas
index e5bd2a2..c1f168b 100644
--- a/gdb/testsuite/gdb.pascal/stub-method.pas
+++ b/gdb/testsuite/gdb.pascal/stub-method.pas
@@ -1,5 +1,5 @@
{
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.pascal/types.exp b/gdb/testsuite/gdb.pascal/types.exp
index 262045e..b4949f5 100644
--- a/gdb/testsuite/gdb.pascal/types.exp
+++ b/gdb/testsuite/gdb.pascal/types.exp
@@ -1,4 +1,4 @@
-# Copyright 1994-2024 Free Software Foundation, Inc.
+# Copyright 1994-2025 Free Software Foundation, Inc.
# Copyright 2007 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -25,7 +25,7 @@ proc test_integer_literal_types_accepted {} {
# Test various decimal values.
# Should be integer*4 probably.
- gdb_test "pt 123" "type = int"
+ gdb_test "pt 123" "type = int"
}
proc test_character_literal_types_accepted {} {
global gdb_prompt
diff --git a/gdb/testsuite/gdb.perf/backtrace.c b/gdb/testsuite/gdb.perf/backtrace.c
index f2416af..8ed87f0 100644
--- a/gdb/testsuite/gdb.perf/backtrace.c
+++ b/gdb/testsuite/gdb.perf/backtrace.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/backtrace.exp b/gdb/testsuite/gdb.perf/backtrace.exp
index a6b9b32..aea1e01 100644
--- a/gdb/testsuite/gdb.perf/backtrace.exp
+++ b/gdb/testsuite/gdb.perf/backtrace.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ set executable $testfile
set expfile $testfile.exp
# make check-perf RUNTESTFLAGS='backtrace.exp BACKTRACE_DEPTH=1024'
-if ![info exists BACKTRACE_DEPTH] {
+if {![info exists BACKTRACE_DEPTH]} {
set BACKTRACE_DEPTH 64
}
@@ -47,7 +47,7 @@ PerfTest::assemble {
} {
global binfile
- clean_restart $binfile
+ clean_restart $::testfile
if ![runto_main] {
return -1
diff --git a/gdb/testsuite/gdb.perf/backtrace.py b/gdb/testsuite/gdb.perf/backtrace.py
index cb4c0ca..12f297a 100644
--- a/gdb/testsuite/gdb.perf/backtrace.py
+++ b/gdb/testsuite/gdb.perf/backtrace.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/disassemble.exp b/gdb/testsuite/gdb.perf/disassemble.exp
index 740ffe3..09978db 100644
--- a/gdb/testsuite/gdb.perf/disassemble.exp
+++ b/gdb/testsuite/gdb.perf/disassemble.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/disassemble.py b/gdb/testsuite/gdb.perf/disassemble.py
index 7baa44f..49050c1 100644
--- a/gdb/testsuite/gdb.perf/disassemble.py
+++ b/gdb/testsuite/gdb.perf/disassemble.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gm-hello.cc b/gdb/testsuite/gdb.perf/gm-hello.cc
index 954454b..cce3215 100644
--- a/gdb/testsuite/gdb.perf/gm-hello.cc
+++ b/gdb/testsuite/gdb.perf/gm-hello.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gm-pervasive-typedef.cc b/gdb/testsuite/gdb.perf/gm-pervasive-typedef.cc
index eb3c0f2..f2c579d 100644
--- a/gdb/testsuite/gdb.perf/gm-pervasive-typedef.cc
+++ b/gdb/testsuite/gdb.perf/gm-pervasive-typedef.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gm-pervasive-typedef.h b/gdb/testsuite/gdb.perf/gm-pervasive-typedef.h
index dd31601..663b919 100644
--- a/gdb/testsuite/gdb.perf/gm-pervasive-typedef.h
+++ b/gdb/testsuite/gdb.perf/gm-pervasive-typedef.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gm-std.cc b/gdb/testsuite/gdb.perf/gm-std.cc
index 0d0d106..e84dcba 100644
--- a/gdb/testsuite/gdb.perf/gm-std.cc
+++ b/gdb/testsuite/gdb.perf/gm-std.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gm-std.h b/gdb/testsuite/gdb.perf/gm-std.h
index f286688..f53d5b6 100644
--- a/gdb/testsuite/gdb.perf/gm-std.h
+++ b/gdb/testsuite/gdb.perf/gm-std.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gm-use-cerr.cc b/gdb/testsuite/gdb.perf/gm-use-cerr.cc
index c86efa0..e651864 100644
--- a/gdb/testsuite/gdb.perf/gm-use-cerr.cc
+++ b/gdb/testsuite/gdb.perf/gm-use-cerr.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gm-utils.h b/gdb/testsuite/gdb.perf/gm-utils.h
index fe0bb35..50342a5 100644
--- a/gdb/testsuite/gdb.perf/gm-utils.h
+++ b/gdb/testsuite/gdb.perf/gm-utils.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster-null-lookup.py b/gdb/testsuite/gdb.perf/gmonster-null-lookup.py
index 0d5ba76..a4dafaa 100644
--- a/gdb/testsuite/gdb.perf/gmonster-null-lookup.py
+++ b/gdb/testsuite/gdb.perf/gmonster-null-lookup.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster-pervasive-typedef.py b/gdb/testsuite/gdb.perf/gmonster-pervasive-typedef.py
index 3e239f5..dc1fef5 100644
--- a/gdb/testsuite/gdb.perf/gmonster-pervasive-typedef.py
+++ b/gdb/testsuite/gdb.perf/gmonster-pervasive-typedef.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster-print-cerr.py b/gdb/testsuite/gdb.perf/gmonster-print-cerr.py
index 4f57b86..be4109c 100644
--- a/gdb/testsuite/gdb.perf/gmonster-print-cerr.py
+++ b/gdb/testsuite/gdb.perf/gmonster-print-cerr.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster-ptype-string.py b/gdb/testsuite/gdb.perf/gmonster-ptype-string.py
index 0c000ef..d4077b5 100644
--- a/gdb/testsuite/gdb.perf/gmonster-ptype-string.py
+++ b/gdb/testsuite/gdb.perf/gmonster-ptype-string.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster-runto-main.py b/gdb/testsuite/gdb.perf/gmonster-runto-main.py
index a183d68..0c1349b 100644
--- a/gdb/testsuite/gdb.perf/gmonster-runto-main.py
+++ b/gdb/testsuite/gdb.perf/gmonster-runto-main.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster-select-file.py b/gdb/testsuite/gdb.perf/gmonster-select-file.py
index 4708458..a03c2ec 100644
--- a/gdb/testsuite/gdb.perf/gmonster-select-file.py
+++ b/gdb/testsuite/gdb.perf/gmonster-select-file.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster1-null-lookup.exp b/gdb/testsuite/gdb.perf/gmonster1-null-lookup.exp
index 7d97dea..4d4029c 100644
--- a/gdb/testsuite/gdb.perf/gmonster1-null-lookup.exp
+++ b/gdb/testsuite/gdb.perf/gmonster1-null-lookup.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster1-pervasive-typedef.exp b/gdb/testsuite/gdb.perf/gmonster1-pervasive-typedef.exp
index 06e2989..ed38425 100644
--- a/gdb/testsuite/gdb.perf/gmonster1-pervasive-typedef.exp
+++ b/gdb/testsuite/gdb.perf/gmonster1-pervasive-typedef.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster1-print-cerr.exp b/gdb/testsuite/gdb.perf/gmonster1-print-cerr.exp
index dfda8a3..34c48b2 100644
--- a/gdb/testsuite/gdb.perf/gmonster1-print-cerr.exp
+++ b/gdb/testsuite/gdb.perf/gmonster1-print-cerr.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster1-ptype-string.exp b/gdb/testsuite/gdb.perf/gmonster1-ptype-string.exp
index 1a92a5e..44ec4ed 100644
--- a/gdb/testsuite/gdb.perf/gmonster1-ptype-string.exp
+++ b/gdb/testsuite/gdb.perf/gmonster1-ptype-string.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster1-runto-main.exp b/gdb/testsuite/gdb.perf/gmonster1-runto-main.exp
index 746e19d..e4fa51e 100644
--- a/gdb/testsuite/gdb.perf/gmonster1-runto-main.exp
+++ b/gdb/testsuite/gdb.perf/gmonster1-runto-main.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster1-select-file.exp b/gdb/testsuite/gdb.perf/gmonster1-select-file.exp
index 016ed52..f963cae 100644
--- a/gdb/testsuite/gdb.perf/gmonster1-select-file.exp
+++ b/gdb/testsuite/gdb.perf/gmonster1-select-file.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster1.cc b/gdb/testsuite/gdb.perf/gmonster1.cc
index d2b56f9..a714591 100644
--- a/gdb/testsuite/gdb.perf/gmonster1.cc
+++ b/gdb/testsuite/gdb.perf/gmonster1.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster1.exp b/gdb/testsuite/gdb.perf/gmonster1.exp
index 3af97d1..8bb748d 100644
--- a/gdb/testsuite/gdb.perf/gmonster1.exp
+++ b/gdb/testsuite/gdb.perf/gmonster1.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ load_lib gen-perf-test.exp
require allow_perf_tests
-if ![info exists MONSTER] {
+if {![info exists MONSTER]} {
set MONSTER "n"
}
diff --git a/gdb/testsuite/gdb.perf/gmonster2-null-lookup.exp b/gdb/testsuite/gdb.perf/gmonster2-null-lookup.exp
index 6ab450a..4e587cb 100644
--- a/gdb/testsuite/gdb.perf/gmonster2-null-lookup.exp
+++ b/gdb/testsuite/gdb.perf/gmonster2-null-lookup.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster2-pervasive-typedef.exp b/gdb/testsuite/gdb.perf/gmonster2-pervasive-typedef.exp
index 12293c4..12b50de 100644
--- a/gdb/testsuite/gdb.perf/gmonster2-pervasive-typedef.exp
+++ b/gdb/testsuite/gdb.perf/gmonster2-pervasive-typedef.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster2-print-cerr.exp b/gdb/testsuite/gdb.perf/gmonster2-print-cerr.exp
index cc462e7..48a43fa 100644
--- a/gdb/testsuite/gdb.perf/gmonster2-print-cerr.exp
+++ b/gdb/testsuite/gdb.perf/gmonster2-print-cerr.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster2-ptype-string.exp b/gdb/testsuite/gdb.perf/gmonster2-ptype-string.exp
index 97caef4..0d828e0 100644
--- a/gdb/testsuite/gdb.perf/gmonster2-ptype-string.exp
+++ b/gdb/testsuite/gdb.perf/gmonster2-ptype-string.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster2-runto-main.exp b/gdb/testsuite/gdb.perf/gmonster2-runto-main.exp
index 19d51d3..aacdac5 100644
--- a/gdb/testsuite/gdb.perf/gmonster2-runto-main.exp
+++ b/gdb/testsuite/gdb.perf/gmonster2-runto-main.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster2-select-file.exp b/gdb/testsuite/gdb.perf/gmonster2-select-file.exp
index 9778fa4..896aeba 100644
--- a/gdb/testsuite/gdb.perf/gmonster2-select-file.exp
+++ b/gdb/testsuite/gdb.perf/gmonster2-select-file.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster2.cc b/gdb/testsuite/gdb.perf/gmonster2.cc
index d2b56f9..a714591 100644
--- a/gdb/testsuite/gdb.perf/gmonster2.cc
+++ b/gdb/testsuite/gdb.perf/gmonster2.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/gmonster2.exp b/gdb/testsuite/gdb.perf/gmonster2.exp
index 367e413..7049bce 100644
--- a/gdb/testsuite/gdb.perf/gmonster2.exp
+++ b/gdb/testsuite/gdb.perf/gmonster2.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ load_lib gen-perf-test.exp
require allow_perf_tests
-if ![info exists MONSTER] {
+if {![info exists MONSTER]} {
set MONSTER "n"
}
diff --git a/gdb/testsuite/gdb.perf/lib/perftest/__init__.py b/gdb/testsuite/gdb.perf/lib/perftest/__init__.py
index d621e96..a02b558 100644
--- a/gdb/testsuite/gdb.perf/lib/perftest/__init__.py
+++ b/gdb/testsuite/gdb.perf/lib/perftest/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/lib/perftest/measure.py b/gdb/testsuite/gdb.perf/lib/perftest/measure.py
index 00a1a9a..0e06cad 100644
--- a/gdb/testsuite/gdb.perf/lib/perftest/measure.py
+++ b/gdb/testsuite/gdb.perf/lib/perftest/measure.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/lib/perftest/perftest.py b/gdb/testsuite/gdb.perf/lib/perftest/perftest.py
index 40ed9cc..6bcd81d 100644
--- a/gdb/testsuite/gdb.perf/lib/perftest/perftest.py
+++ b/gdb/testsuite/gdb.perf/lib/perftest/perftest.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/lib/perftest/reporter.py b/gdb/testsuite/gdb.perf/lib/perftest/reporter.py
index e04b2f6..3af6d17 100644
--- a/gdb/testsuite/gdb.perf/lib/perftest/reporter.py
+++ b/gdb/testsuite/gdb.perf/lib/perftest/reporter.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/lib/perftest/testresult.py b/gdb/testsuite/gdb.perf/lib/perftest/testresult.py
index 348cf8e..16f39fc 100644
--- a/gdb/testsuite/gdb.perf/lib/perftest/testresult.py
+++ b/gdb/testsuite/gdb.perf/lib/perftest/testresult.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/lib/perftest/utils.py b/gdb/testsuite/gdb.perf/lib/perftest/utils.py
index 9cff5f1..7544e67 100644
--- a/gdb/testsuite/gdb.perf/lib/perftest/utils.py
+++ b/gdb/testsuite/gdb.perf/lib/perftest/utils.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/single-step.c b/gdb/testsuite/gdb.perf/single-step.c
index 937d920..886477d 100644
--- a/gdb/testsuite/gdb.perf/single-step.c
+++ b/gdb/testsuite/gdb.perf/single-step.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/single-step.exp b/gdb/testsuite/gdb.perf/single-step.exp
index fae3ba4..8ec32d1 100644
--- a/gdb/testsuite/gdb.perf/single-step.exp
+++ b/gdb/testsuite/gdb.perf/single-step.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ set executable $testfile
set expfile $testfile.exp
# make check-perf RUNTESTFLAGS='single-step.exp SINGLE_STEP_COUNT=300'
-if ![info exists SINGLE_STEP_COUNT] {
+if {![info exists SINGLE_STEP_COUNT]} {
set SINGLE_STEP_COUNT 1000
}
@@ -39,7 +39,7 @@ PerfTest::assemble {
return 0
} {
global binfile
- clean_restart $binfile
+ clean_restart $::testfile
if ![runto_main] {
return -1
diff --git a/gdb/testsuite/gdb.perf/single-step.py b/gdb/testsuite/gdb.perf/single-step.py
index 70f4e76..c6b1443 100644
--- a/gdb/testsuite/gdb.perf/single-step.py
+++ b/gdb/testsuite/gdb.perf/single-step.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/skip-command.cc b/gdb/testsuite/gdb.perf/skip-command.cc
index e0d4bff..5df1e8e 100644
--- a/gdb/testsuite/gdb.perf/skip-command.cc
+++ b/gdb/testsuite/gdb.perf/skip-command.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/skip-command.exp b/gdb/testsuite/gdb.perf/skip-command.exp
index 3eac9c9..3a02cd5 100644
--- a/gdb/testsuite/gdb.perf/skip-command.exp
+++ b/gdb/testsuite/gdb.perf/skip-command.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,10 +33,10 @@ set skip_func_file [standard_output_file $srcfile2]
set expfile $testfile.exp
# make check-perf RUNTESTFLAGS='skip-command.exp SKIP_STEP_COUNT=1000 ...'
-if ![info exists SKIP_STEP_COUNT] {
+if {![info exists SKIP_STEP_COUNT]} {
set SKIP_STEP_COUNT 1000
}
-if ![info exists SKIP_DIRECTIVE_COUNT] {
+if {![info exists SKIP_DIRECTIVE_COUNT]} {
set SKIP_DIRECTIVE_COUNT 1000
}
@@ -91,7 +91,7 @@ proc write_skip_func_source { file_name func_name_prefix nr_funcs } {
proc run_skip_bench { kind text } {
global SKIP_STEP_COUNT SKIP_DIRECTIVE_COUNT
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -99,7 +99,7 @@ proc run_skip_bench { kind text } {
for { set i 0 } { $i < 5 } { incr i } {
with_test_prefix "iter $i" {
- set nr_skips [expr $i * $SKIP_DIRECTIVE_COUNT]
+ set nr_skips [expr {$i * $SKIP_DIRECTIVE_COUNT}]
install_skips $kind $text $nr_skips
gdb_test_python_run \
"SkipCommand\(\"skip-$kind-$nr_skips\", ${SKIP_STEP_COUNT}\)"
@@ -120,7 +120,7 @@ PerfTest::assemble {
return 0
} {
global binfile
- clean_restart $binfile
+ clean_restart $::testfile
return 0
} {
global SKIP_STEP_COUNT SKIP_DIRECTIVE_COUNT
diff --git a/gdb/testsuite/gdb.perf/skip-command.py b/gdb/testsuite/gdb.perf/skip-command.py
index 33df7f6..f0baf60 100644
--- a/gdb/testsuite/gdb.perf/skip-command.py
+++ b/gdb/testsuite/gdb.perf/skip-command.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/skip-prologue.c b/gdb/testsuite/gdb.perf/skip-prologue.c
index e45371e..d5b3730 100644
--- a/gdb/testsuite/gdb.perf/skip-prologue.c
+++ b/gdb/testsuite/gdb.perf/skip-prologue.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/skip-prologue.exp b/gdb/testsuite/gdb.perf/skip-prologue.exp
index 516e3d2..880a0f4 100644
--- a/gdb/testsuite/gdb.perf/skip-prologue.exp
+++ b/gdb/testsuite/gdb.perf/skip-prologue.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ set executable $testfile
set expfile $testfile.exp
# make check-perf RUNTESTFLAGS='skip-prologue.exp SKIP_PROLOGUE_COUNT=500'
-if ![info exists SKIP_PROLOGUE_COUNT] {
+if {![info exists SKIP_PROLOGUE_COUNT]} {
set SKIP_PROLOGUE_COUNT 500
}
@@ -51,7 +51,7 @@ PerfTest::assemble {
global binfile
global gdb_prompt
- clean_restart $binfile
+ clean_restart $::testfile
if ![runto_main] {
return -1
diff --git a/gdb/testsuite/gdb.perf/skip-prologue.py b/gdb/testsuite/gdb.perf/skip-prologue.py
index 8572a25..a41b7a7 100644
--- a/gdb/testsuite/gdb.perf/skip-prologue.py
+++ b/gdb/testsuite/gdb.perf/skip-prologue.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/solib.c b/gdb/testsuite/gdb.perf/solib.c
index 3ee6279..f7c6f4e 100644
--- a/gdb/testsuite/gdb.perf/solib.c
+++ b/gdb/testsuite/gdb.perf/solib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/solib.exp b/gdb/testsuite/gdb.perf/solib.exp
index 6ddb567..e7870f6 100644
--- a/gdb/testsuite/gdb.perf/solib.exp
+++ b/gdb/testsuite/gdb.perf/solib.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ set executable $testfile
set expfile $testfile.exp
# make check-perf RUNTESTFLAGS='solib.exp SOLIB_COUNT=1024'
-if ![info exists SOLIB_COUNT] {
+if {![info exists SOLIB_COUNT]} {
set SOLIB_COUNT 128
}
@@ -72,7 +72,7 @@ PerfTest::assemble {
} {
global binfile
- clean_restart $binfile
+ clean_restart $::testfile
if ![runto_main] {
return -1
diff --git a/gdb/testsuite/gdb.perf/solib.py b/gdb/testsuite/gdb.perf/solib.py
index 4700096..501eb69 100644
--- a/gdb/testsuite/gdb.perf/solib.py
+++ b/gdb/testsuite/gdb.perf/solib.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/template-breakpoints.cc b/gdb/testsuite/gdb.perf/template-breakpoints.cc
index a65e145..4ae389c 100644
--- a/gdb/testsuite/gdb.perf/template-breakpoints.cc
+++ b/gdb/testsuite/gdb.perf/template-breakpoints.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.perf/template-breakpoints.exp b/gdb/testsuite/gdb.perf/template-breakpoints.exp
index 125dd69..e5d21b2 100644
--- a/gdb/testsuite/gdb.perf/template-breakpoints.exp
+++ b/gdb/testsuite/gdb.perf/template-breakpoints.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ set executable $testfile
set expfile $testfile.exp
# make check-perf RUNTESTFLAGS='template-breakpoints.exp EXPANSION_DEPTH=40'
-if ![info exists EXPANSION_DEPTH] {
+if {![info exists EXPANSION_DEPTH]} {
set EXPANSION_DEPTH 40
}
@@ -47,7 +47,7 @@ PerfTest::assemble {
} {
global binfile
- clean_restart $binfile
+ clean_restart $::testfile
if ![runto_main] {
return -1
diff --git a/gdb/testsuite/gdb.perf/template-breakpoints.py b/gdb/testsuite/gdb.perf/template-breakpoints.py
index 1975856..494d571 100644
--- a/gdb/testsuite/gdb.perf/template-breakpoints.py
+++ b/gdb/testsuite/gdb.perf/template-breakpoints.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/amd64-py-framefilter-invalidarg.S b/gdb/testsuite/gdb.python/amd64-py-framefilter-invalidarg.S
index e24b85d..0280591 100644
--- a/gdb/testsuite/gdb.python/amd64-py-framefilter-invalidarg.S
+++ b/gdb/testsuite/gdb.python/amd64-py-framefilter-invalidarg.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/compare-enum-type-a.c b/gdb/testsuite/gdb.python/compare-enum-type-a.c
index 237552a..cf02a15 100644
--- a/gdb/testsuite/gdb.python/compare-enum-type-a.c
+++ b/gdb/testsuite/gdb.python/compare-enum-type-a.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/compare-enum-type-b.c b/gdb/testsuite/gdb.python/compare-enum-type-b.c
index 07c7fb8..4576dbb 100644
--- a/gdb/testsuite/gdb.python/compare-enum-type-b.c
+++ b/gdb/testsuite/gdb.python/compare-enum-type-b.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/compare-enum-type.exp b/gdb/testsuite/gdb.python/compare-enum-type.exp
index 7d6ac9d..5dd6a3d 100644
--- a/gdb/testsuite/gdb.python/compare-enum-type.exp
+++ b/gdb/testsuite/gdb.python/compare-enum-type.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/compare-enum-type.h b/gdb/testsuite/gdb.python/compare-enum-type.h
index 674ccb8..506e0c5 100644
--- a/gdb/testsuite/gdb.python/compare-enum-type.h
+++ b/gdb/testsuite/gdb.python/compare-enum-type.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/flexible-array-member.c b/gdb/testsuite/gdb.python/flexible-array-member.c
index d53bcd0..00e1313 100644
--- a/gdb/testsuite/gdb.python/flexible-array-member.c
+++ b/gdb/testsuite/gdb.python/flexible-array-member.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/flexible-array-member.exp b/gdb/testsuite/gdb.python/flexible-array-member.exp
index f684e68..3468ec8 100644
--- a/gdb/testsuite/gdb.python/flexible-array-member.exp
+++ b/gdb/testsuite/gdb.python/flexible-array-member.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/gdb_leak_detector.py b/gdb/testsuite/gdb.python/gdb_leak_detector.py
new file mode 100644
index 0000000..8f74b67
--- /dev/null
+++ b/gdb/testsuite/gdb.python/gdb_leak_detector.py
@@ -0,0 +1,121 @@
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Defines a base class, which can be sub-classed, in order to run
+# memory leak tests on some aspects of GDB's Python API. See the
+# comments on the gdb_leak_detector class for more details.
+
+import os
+import tracemalloc
+
+import gdb
+
+
+# This class must be sub-classed to create a memory leak test. The
+# sub-classes __init__ method should call the parent classes __init__
+# method, and the sub-class should override allocate() and
+# deallocate(). See the comments on the various methods below for
+# more details of required arguments and expected usage.
+class gdb_leak_detector:
+
+ # Class initialisation. FILENAME is the file in which the
+ # sub-class is defined, usually passed as just '__file__'. This
+ # is used when looking for memory allocations; only allocations in
+ # FILENAME are considered.
+ def __init__(self, filename):
+ self.filters = [tracemalloc.Filter(True, "*" + os.path.basename(filename))]
+
+ # Internal helper function to actually run the test. Calls the
+ # allocate() method to allocate an object from GDB's Python API.
+ # When CLEAR is True the object will then be deallocated by
+ # calling deallocate(), otherwise, deallocate() is not called.
+ #
+ # Finally, this function checks for any memory allocatios
+ # originating from 'self.filename' that have not been freed, and
+ # returns the total (in bytes) of the memory that has been
+ # allocated, but not freed.
+ def _do_test(self, clear):
+ # Start tracing, and take a snapshot of the current allocations.
+ tracemalloc.start()
+ snapshot1 = tracemalloc.take_snapshot()
+
+ # Generate the GDB Python API object by calling the allocate
+ # method.
+ self.allocate()
+
+ # Possibly clear the reference to the allocated object.
+ if clear:
+ self.deallocate()
+
+ # Now grab a second snapshot of memory allocations, and stop
+ # tracing memory allocations.
+ snapshot2 = tracemalloc.take_snapshot()
+ tracemalloc.stop()
+
+ # Filter the snapshots; we only care about allocations originating
+ # from this file.
+ snapshot1 = snapshot1.filter_traces(self.filters)
+ snapshot2 = snapshot2.filter_traces(self.filters)
+
+ # Compare the snapshots, this leaves only things that were
+ # allocated, but not deallocated since the first snapshot.
+ stats = snapshot2.compare_to(snapshot1, "traceback")
+
+ # Total up all the allocated things.
+ total = 0
+ for stat in stats:
+ total += stat.size_diff
+ return total
+
+ # Run the memory leak test. Prints 'PASS' if successful,
+ # otherwise, raises an exception (of type GdbError).
+ def run(self):
+ # The first time we run this some global state will be allocated which
+ # shows up as memory that is allocated, but not released. So, run the
+ # test once and discard the result.
+ self._do_test(True)
+
+ # Now run the test twice, the first time we clear our global reference
+ # to the allocated object, which should allow Python to deallocate the
+ # object. The second time we hold onto the global reference, preventing
+ # Python from performing the deallocation.
+ bytes_with_clear = self._do_test(True)
+ bytes_without_clear = self._do_test(False)
+
+ # If there are any allocations left over when we cleared the reference
+ # (and expected deallocation) then this indicates a leak.
+ if bytes_with_clear > 0:
+ raise gdb.GdbError("memory leak when object reference was released")
+
+ # If there are no allocations showing when we hold onto a reference,
+ # then this likely indicates that the testing infrastructure is broken,
+ # and we're no longer spotting the allocations at all.
+ if bytes_without_clear == 0:
+ raise gdb.GdbError("object is unexpectedly not showing as allocated")
+
+ # Print a PASS message that the TCL script can see.
+ print("PASS")
+
+ # Sub-classes must override this method. Allocate an object (or
+ # multiple objects) from GDB's Python API. Store references to
+ # these objects within SELF.
+ def allocate(self):
+ raise NotImplementedError("allocate() not implemented")
+
+ # Sub-classes must override this method. Deallocate the object(s)
+ # allocated by the allocate() method. All that is required is for
+ # the references created in allocate() to be set to None.
+ def deallocate(self):
+ raise NotImplementedError("allocate() not implemented")
diff --git a/gdb/testsuite/gdb.python/lib-types.cc b/gdb/testsuite/gdb.python/lib-types.cc
index c221693..3901a0b 100644
--- a/gdb/testsuite/gdb.python/lib-types.cc
+++ b/gdb/testsuite/gdb.python/lib-types.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/lib-types.exp b/gdb/testsuite/gdb.python/lib-types.exp
index de24517..168f497 100644
--- a/gdb/testsuite/gdb.python/lib-types.exp
+++ b/gdb/testsuite/gdb.python/lib-types.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/libpy-autoloaded-pretty-printers-in-newobjfile-event.so-gdb.py b/gdb/testsuite/gdb.python/libpy-autoloaded-pretty-printers-in-newobjfile-event.so-gdb.py
index 5b3a1b7..18407e2 100644
--- a/gdb/testsuite/gdb.python/libpy-autoloaded-pretty-printers-in-newobjfile-event.so-gdb.py
+++ b/gdb/testsuite/gdb.python/libpy-autoloaded-pretty-printers-in-newobjfile-event.so-gdb.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/lookup-type-block.exp b/gdb/testsuite/gdb.python/lookup-type-block.exp
new file mode 100644
index 0000000..7d04eb6
--- /dev/null
+++ b/gdb/testsuite/gdb.python/lookup-type-block.exp
@@ -0,0 +1,68 @@
+# Copyright (C) 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test the 'block' argument to gdb.lookup_type.
+
+load_lib gdb-python.exp
+
+require allow_python_tests
+
+standard_testfile lookup1.c lookup2.c
+
+if {[prepare_for_testing "failed to prepare" ${testfile} \
+ [list $srcfile $srcfile2]]} {
+ return
+}
+
+proc check_type {which type_name} {
+ if {$which == "one"} {
+ set fn_name function
+ } else {
+ set fn_name main
+ }
+
+ gdb_test_no_output \
+ "python block = gdb.decode_line(\"$fn_name\")\[1\]\[0\].symtab.static_block()" \
+ "compute block"
+ gdb_test_no_output \
+ "python ty = gdb.lookup_type(\"$type_name\", block).strip_typedefs()" \
+ "find the type"
+ gdb_test "python print(ty.fields()\[0\].name)" \
+ "$which" \
+ "examine first field"
+}
+
+proc check_all_types {} {
+ foreach_with_prefix which {one two} {
+ foreach_with_prefix type_name {
+ "struct the_struct"
+ "enum the_enum"
+ "union the_union"
+ "the_typedef"
+ } {
+ check_type $which $type_name
+ }
+ }
+}
+
+check_all_types
+
+if {![runto_main]} {
+ return
+}
+
+with_test_prefix "while running" {
+ check_all_types
+}
diff --git a/gdb/testsuite/gdb.python/lookup1.c b/gdb/testsuite/gdb.python/lookup1.c
new file mode 100644
index 0000000..488ffcb
--- /dev/null
+++ b/gdb/testsuite/gdb.python/lookup1.c
@@ -0,0 +1,44 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+struct the_struct {
+ int one;
+};
+
+struct the_struct struct1;
+
+enum the_enum {
+ one
+};
+
+enum the_enum enum1;
+
+union the_union {
+ int one;
+ void *ptr;
+};
+
+union the_union union1;
+
+typedef struct the_struct the_typedef;
+
+the_typedef typedef1;
+
+int function (void)
+{
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.python/lookup2.c b/gdb/testsuite/gdb.python/lookup2.c
new file mode 100644
index 0000000..63d1030
--- /dev/null
+++ b/gdb/testsuite/gdb.python/lookup2.c
@@ -0,0 +1,46 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+struct the_struct {
+ int two;
+};
+
+struct the_struct struct2;
+
+enum the_enum {
+ two
+};
+
+enum the_enum enum2;
+
+union the_union {
+ int two;
+ void *ptr;
+};
+
+union the_union union2;
+
+typedef struct the_struct the_typedef;
+
+the_typedef typedef2;
+
+extern int function (void);
+
+int main (void)
+{
+ return function ();
+}
diff --git a/gdb/testsuite/gdb.python/lotsa-lines.exp b/gdb/testsuite/gdb.python/lotsa-lines.exp
index b3e980a..537e6f8 100644
--- a/gdb/testsuite/gdb.python/lotsa-lines.exp
+++ b/gdb/testsuite/gdb.python/lotsa-lines.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/make-visualizer.exp b/gdb/testsuite/gdb.python/make-visualizer.exp
new file mode 100644
index 0000000..2c6b40d
--- /dev/null
+++ b/gdb/testsuite/gdb.python/make-visualizer.exp
@@ -0,0 +1,176 @@
+# Copyright (C) 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Tests for gdb.printing.make_visualizer; specifically that the
+# optimized-out and synthetic pointer cases work properly.
+
+load_lib dwarf.exp
+load_lib gdb-python.exp
+
+require dwarf2_support
+require allow_python_tests
+
+# Use a simple plain-"main" source file.
+standard_testfile py-progspace.c -dw.S
+
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} {
+ return
+}
+
+if {![runto_main]} {
+ return
+}
+
+# Get size to create fake DWARF for the test.
+set ptr_size [get_sizeof "void *" 96]
+
+set asm_file [standard_output_file ${srcfile2}]
+Dwarf::assemble $asm_file {
+ cu {} {
+ compile_unit {} {
+ declare_labels i32_type i32_array \
+ struct_label variable_label pointer_label
+
+ i32_type: DW_TAG_base_type {
+ DW_AT_name "int32_t"
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 DW_FORM_sdata
+ }
+
+ i32_array: DW_TAG_array_type {
+ DW_AT_name array_type
+ DW_AT_type :$i32_type
+ } {
+ DW_TAG_subrange_type {
+ DW_AT_type :$i32_type
+ DW_AT_lower_bound 0 DW_FORM_data1
+ DW_AT_upper_bound 3 DW_FORM_data1
+ }
+ }
+
+ # Used for testing optimized-out elements of an array.
+ DW_TAG_variable {
+ DW_AT_name i32_noptr
+ DW_AT_type :$i32_array
+ DW_AT_location {
+ DW_OP_constu 1779823878
+ DW_OP_stack_value
+ DW_OP_piece 4
+ } SPECIAL_expr
+ }
+
+ struct_label: DW_TAG_structure_type {
+ DW_AT_name i32_noptr
+ DW_AT_byte_size 4 DW_FORM_sdata
+ } {
+ DW_TAG_member {
+ DW_AT_name f
+ DW_AT_type :$i32_type
+ DW_AT_data_member_location 0 DW_FORM_data1
+ }
+ }
+
+ pointer_label: DW_TAG_pointer_type {
+ DW_AT_byte_size $::ptr_size DW_FORM_sdata
+ DW_AT_type :$struct_label
+ }
+
+ variable_label: DW_TAG_variable {
+ DW_AT_name v
+ DW_AT_location {
+ DW_OP_implicit_value 0x1 0x1 0x1 0x1
+ } SPECIAL_expr
+ DW_AT_type :$struct_label
+ }
+
+ # Used for testing synthetic pointers.
+ DW_TAG_variable {
+ DW_AT_name synthptr
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer $variable_label 0
+ } SPECIAL_expr
+ DW_AT_type :$pointer_label
+ }
+
+ # Optimized-out pointer.
+ DW_TAG_variable {
+ DW_AT_name optoutptr
+ DW_AT_location { } SPECIAL_expr
+ DW_AT_type :$pointer_label
+ }
+ }
+ }
+}
+
+if {[prepare_for_testing "failed to prepare" ${testfile} \
+ [list $srcfile $asm_file] {nodebug}]} {
+ return
+}
+
+# Need a frame to evaluate a synthetic pointer.
+if {![runto_main]} {
+ return
+}
+
+gdb_test_no_output "python import gdb"
+gdb_test_no_output "python import gdb.printing"
+
+gdb_test_no_output "python val = gdb.parse_and_eval('i32_noptr')" \
+ "fetch i32_noptr"
+gdb_test_no_output "python vz = gdb.printing.make_visualizer(val)" \
+ "create i32_noptr visualizer"
+gdb_test "python print(isinstance(vz, gdb.printing.NoOpArrayPrinter))" \
+ True \
+ "i32_noptr uses array printer"
+
+gdb_test_no_output "python vz1 = gdb.printing.make_visualizer(val\[0\])" \
+ "create visualizer for valid element"
+gdb_test "python print(isinstance(vz1, gdb.printing.NoOpScalarPrinter))" \
+ True \
+ "valid element uses scalar printer"
+gdb_test "python print(vz1.to_string())" \
+ 1779823878 \
+ "string form of valid element"
+
+gdb_test_no_output "python vz2 = gdb.printing.make_visualizer(val\[1\])" \
+ "create visualizer for optimized-out element"
+gdb_test "python print(isinstance(vz2, gdb.printing.NoOpScalarPrinter))" \
+ True \
+ "optimized-out element uses scalar printer"
+gdb_test "python print(vz2.to_string())" \
+ "<optimized out>" \
+ "string form of optimized-out element"
+
+gdb_test_no_output "python val2 = gdb.parse_and_eval('synthptr')" \
+ "fetch synthetic pointer"
+gdb_test_no_output "python vzv2 = gdb.printing.make_visualizer(val2)" \
+ "create synthetic pointer visualizer"
+gdb_test "python print(isinstance(vzv2, gdb.printing.NoOpPointerReferencePrinter))" \
+ True \
+ "synthetic pointer uses pointer printer"
+gdb_test "python print(vzv2.child(0)\[1\])" \
+ "{f = 16843009}" \
+ "child of synthetic pointer"
+
+gdb_test_no_output "python val3 = gdb.parse_and_eval('optoutptr')" \
+ "fetch optimized-out pointer"
+gdb_test_no_output "python vzv3 = gdb.printing.make_visualizer(val3)" \
+ "create optimized-out pointer visualizer"
+gdb_test "python print(isinstance(vzv3, gdb.printing.NoOpScalarPrinter))" \
+ True \
+ "optimized-out pointer uses scalar printer"
+gdb_test "python print(vzv3.to_string())" \
+ "<optimized out>" \
+ "string representation of optimized-out pointer"
diff --git a/gdb/testsuite/gdb.python/pretty-print-call-by-hand.c b/gdb/testsuite/gdb.python/pretty-print-call-by-hand.c
index 94121f5..88700a1 100644
--- a/gdb/testsuite/gdb.python/pretty-print-call-by-hand.c
+++ b/gdb/testsuite/gdb.python/pretty-print-call-by-hand.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp b/gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp
index e633e55..17b8afe 100644
--- a/gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp
+++ b/gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,7 +39,7 @@ proc start_test { breakpoint_comment } {
# Start with a fresh gdb.
# This is important because the test can crash GDB.
- clean_restart ${binfile}
+ clean_restart ${::testfile}
if {![runto_main]} {
untested "couldn't run to breakpoint"
diff --git a/gdb/testsuite/gdb.python/pretty-print-call-by-hand.py b/gdb/testsuite/gdb.python/pretty-print-call-by-hand.py
index f9289ef..3620354 100644
--- a/gdb/testsuite/gdb.python/pretty-print-call-by-hand.py
+++ b/gdb/testsuite/gdb.python/pretty-print-call-by-hand.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-arch-reg-groups.exp b/gdb/testsuite/gdb.python/py-arch-reg-groups.exp
index 3475bbc..2b0ac3e 100644
--- a/gdb/testsuite/gdb.python/py-arch-reg-groups.exp
+++ b/gdb/testsuite/gdb.python/py-arch-reg-groups.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-arch-reg-names.exp b/gdb/testsuite/gdb.python/py-arch-reg-names.exp
index 7c08168..99fb8ce 100644
--- a/gdb/testsuite/gdb.python/py-arch-reg-names.exp
+++ b/gdb/testsuite/gdb.python/py-arch-reg-names.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-arch.c b/gdb/testsuite/gdb.python/py-arch.c
index ec6874b..a630de4 100644
--- a/gdb/testsuite/gdb.python/py-arch.c
+++ b/gdb/testsuite/gdb.python/py-arch.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-arch.exp b/gdb/testsuite/gdb.python/py-arch.exp
index c294011..531ae50 100644
--- a/gdb/testsuite/gdb.python/py-arch.exp
+++ b/gdb/testsuite/gdb.python/py-arch.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -78,7 +78,7 @@ foreach size {0 1 2 3 4 8 16} {
} else {
set sign_result [lindex $sign_data 1]
}
- set fullsize [expr 8 * $size]
+ set fullsize [expr {8 * $size}]
gdb_test_no_output "python t = arch.integer_type($fullsize$sign)" \
"get integer type for $size$sign"
gdb_test "python print(t.sizeof)" "$size" \
diff --git a/gdb/testsuite/gdb.python/py-as-string.c b/gdb/testsuite/gdb.python/py-as-string.c
index ec05206..1997300 100644
--- a/gdb/testsuite/gdb.python/py-as-string.c
+++ b/gdb/testsuite/gdb.python/py-as-string.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-as-string.exp b/gdb/testsuite/gdb.python/py-as-string.exp
index 1a38d4b..2ad179d 100644
--- a/gdb/testsuite/gdb.python/py-as-string.exp
+++ b/gdb/testsuite/gdb.python/py-as-string.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.python/py-auto-load-chaining-f1.c b/gdb/testsuite/gdb.python/py-auto-load-chaining-f1.c
index 7fb1c5f..10baa8e 100644
--- a/gdb/testsuite/gdb.python/py-auto-load-chaining-f1.c
+++ b/gdb/testsuite/gdb.python/py-auto-load-chaining-f1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-auto-load-chaining-f1.o-gdb.py b/gdb/testsuite/gdb.python/py-auto-load-chaining-f1.o-gdb.py
index 0740de3..9641a86 100644
--- a/gdb/testsuite/gdb.python/py-auto-load-chaining-f1.o-gdb.py
+++ b/gdb/testsuite/gdb.python/py-auto-load-chaining-f1.o-gdb.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-auto-load-chaining-f2.c b/gdb/testsuite/gdb.python/py-auto-load-chaining-f2.c
index f2f3506..ef6c4a4 100644
--- a/gdb/testsuite/gdb.python/py-auto-load-chaining-f2.c
+++ b/gdb/testsuite/gdb.python/py-auto-load-chaining-f2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-auto-load-chaining-f2.o-gdb.py b/gdb/testsuite/gdb.python/py-auto-load-chaining-f2.o-gdb.py
index 2be5cb1..f1abc2c 100644
--- a/gdb/testsuite/gdb.python/py-auto-load-chaining-f2.o-gdb.py
+++ b/gdb/testsuite/gdb.python/py-auto-load-chaining-f2.o-gdb.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-auto-load-chaining.c b/gdb/testsuite/gdb.python/py-auto-load-chaining.c
index 50236c2..74ec04f 100644
--- a/gdb/testsuite/gdb.python/py-auto-load-chaining.c
+++ b/gdb/testsuite/gdb.python/py-auto-load-chaining.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-auto-load-chaining.exp b/gdb/testsuite/gdb.python/py-auto-load-chaining.exp
index b5aabd3..fbb95d9 100644
--- a/gdb/testsuite/gdb.python/py-auto-load-chaining.exp
+++ b/gdb/testsuite/gdb.python/py-auto-load-chaining.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -49,7 +49,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-lib.cc b/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-lib.cc
index 95312ca..c8eb2e6 100644
--- a/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-lib.cc
+++ b/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-lib.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-lib.h b/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-lib.h
index 4252d48..9e2bf4f 100644
--- a/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-lib.h
+++ b/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-lib.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-main.cc b/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-main.cc
index 717daf2..0beb0af 100644
--- a/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-main.cc
+++ b/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event-main.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.exp b/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.exp
index 73f66f4..3bd0494 100644
--- a/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.exp
+++ b/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.py b/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.py
index d63c087..7bbb860 100644
--- a/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.py
+++ b/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-bad-printers.c b/gdb/testsuite/gdb.python/py-bad-printers.c
index 17fe779..d10fde6 100644
--- a/gdb/testsuite/gdb.python/py-bad-printers.c
+++ b/gdb/testsuite/gdb.python/py-bad-printers.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-bad-printers.exp b/gdb/testsuite/gdb.python/py-bad-printers.exp
index cc51a6f..ab1a9ba 100644
--- a/gdb/testsuite/gdb.python/py-bad-printers.exp
+++ b/gdb/testsuite/gdb.python/py-bad-printers.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-bad-printers.py b/gdb/testsuite/gdb.python/py-bad-printers.py
index ac9c35e..c93923c 100644
--- a/gdb/testsuite/gdb.python/py-bad-printers.py
+++ b/gdb/testsuite/gdb.python/py-bad-printers.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-block.c b/gdb/testsuite/gdb.python/py-block.c
index d180d9b..3417e2d 100644
--- a/gdb/testsuite/gdb.python/py-block.c
+++ b/gdb/testsuite/gdb.python/py-block.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-bp-locations.c b/gdb/testsuite/gdb.python/py-bp-locations.c
index 98b9380..a261f26 100644
--- a/gdb/testsuite/gdb.python/py-bp-locations.c
+++ b/gdb/testsuite/gdb.python/py-bp-locations.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-bp-locations.exp b/gdb/testsuite/gdb.python/py-bp-locations.exp
index 4892947..b09a401 100644
--- a/gdb/testsuite/gdb.python/py-bp-locations.exp
+++ b/gdb/testsuite/gdb.python/py-bp-locations.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ save_vars { GDBFLAGS } {
clean_restart $testfile
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -79,7 +79,7 @@ gdb_test "python print(gdb.breakpoints()\[1\].locations\[0\])" \
"check repr of disabled breakpoint location"
gdb_continue_to_breakpoint "" ".*25.*"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-breakpoint-create-fail.c b/gdb/testsuite/gdb.python/py-breakpoint-create-fail.c
index bbb4ec2..a1a964c 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint-create-fail.c
+++ b/gdb/testsuite/gdb.python/py-breakpoint-create-fail.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-breakpoint-create-fail.exp b/gdb/testsuite/gdb.python/py-breakpoint-create-fail.exp
index 7840dba..4098a7a 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint-create-fail.exp
+++ b/gdb/testsuite/gdb.python/py-breakpoint-create-fail.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
}
clean_restart "${testfile}"
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.python/py-breakpoint-create-fail.py b/gdb/testsuite/gdb.python/py-breakpoint-create-fail.py
index f85de0f..470eaea 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint-create-fail.py
+++ b/gdb/testsuite/gdb.python/py-breakpoint-create-fail.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-breakpoint.c b/gdb/testsuite/gdb.python/py-breakpoint.c
index 9fe21ab..4e61d0e 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint.c
+++ b/gdb/testsuite/gdb.python/py-breakpoint.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp
index 6f9245c..9a901a3 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-breakpoint.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -707,7 +707,7 @@ proc_with_prefix test_bkpt_explicit_loc {} {
delete_breakpoints
gdb_test "python bp1 = gdb.Breakpoint (line=bp1)" \
- "RuntimeError.*: Line keyword should be an integer or a string.*" \
+ "RuntimeError.*: Line keyword should be an integer or a string\\.\r\n.*" \
"set explicit breakpoint by invalid line type"
delete_breakpoints
diff --git a/gdb/testsuite/gdb.python/py-caller-is.c b/gdb/testsuite/gdb.python/py-caller-is.c
index f7c36c1..b6fd8d5 100644
--- a/gdb/testsuite/gdb.python/py-caller-is.c
+++ b/gdb/testsuite/gdb.python/py-caller-is.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-caller-is.exp b/gdb/testsuite/gdb.python/py-caller-is.exp
index 301dd1b..0fdb80e 100644
--- a/gdb/testsuite/gdb.python/py-caller-is.exp
+++ b/gdb/testsuite/gdb.python/py-caller-is.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.python/py-charset.exp b/gdb/testsuite/gdb.python/py-charset.exp
index c7c4d02..0e98e07 100644
--- a/gdb/testsuite/gdb.python/py-charset.exp
+++ b/gdb/testsuite/gdb.python/py-charset.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-cmd-exception.c b/gdb/testsuite/gdb.python/py-cmd-exception.c
index 6cb2c2c..aa5ec04 100644
--- a/gdb/testsuite/gdb.python/py-cmd-exception.c
+++ b/gdb/testsuite/gdb.python/py-cmd-exception.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-cmd-exception.exp b/gdb/testsuite/gdb.python/py-cmd-exception.exp
index 0bfa13e..0333d13 100644
--- a/gdb/testsuite/gdb.python/py-cmd-exception.exp
+++ b/gdb/testsuite/gdb.python/py-cmd-exception.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-cmd-exception.py b/gdb/testsuite/gdb.python/py-cmd-exception.py
index d37257d..5a72b81 100644
--- a/gdb/testsuite/gdb.python/py-cmd-exception.py
+++ b/gdb/testsuite/gdb.python/py-cmd-exception.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-cmd-prompt.c b/gdb/testsuite/gdb.python/py-cmd-prompt.c
index 304503c..5f785f0 100644
--- a/gdb/testsuite/gdb.python/py-cmd-prompt.c
+++ b/gdb/testsuite/gdb.python/py-cmd-prompt.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-cmd-prompt.exp b/gdb/testsuite/gdb.python/py-cmd-prompt.exp
index ccb695f..3f392d1 100644
--- a/gdb/testsuite/gdb.python/py-cmd-prompt.exp
+++ b/gdb/testsuite/gdb.python/py-cmd-prompt.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-cmd-prompt.py b/gdb/testsuite/gdb.python/py-cmd-prompt.py
index b80a0c9..1be9f3f 100644
--- a/gdb/testsuite/gdb.python/py-cmd-prompt.py
+++ b/gdb/testsuite/gdb.python/py-cmd-prompt.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-cmd.c b/gdb/testsuite/gdb.python/py-cmd.c
index c18c92a..6c4357c 100644
--- a/gdb/testsuite/gdb.python/py-cmd.c
+++ b/gdb/testsuite/gdb.python/py-cmd.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp
index b083a80..1fa3c73 100644
--- a/gdb/testsuite/gdb.python/py-cmd.exp
+++ b/gdb/testsuite/gdb.python/py-cmd.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -278,13 +278,7 @@ gdb_test_multiline "input multi-line-output command" \
set test "verify pagination from test_multiline"
gdb_test_multiple "test_multiline" $test {
- -re "--Type <RET>" {
- exp_continue
- }
- -re " for more, q to quit" {
- exp_continue
- }
- -re ", c to continue without paging--$" {
+ -re "$pagination_prompt$" {
pass $test
}
}
@@ -328,4 +322,89 @@ proc_with_prefix test_command_redefining_itself {} {
"call command redefining itself 2"
}
+# Try to create commands using unknown prefixes and check GDB gives an
+# error. There's also a test in here for an ambiguous prefix, which
+# gives the same error.
+proc_with_prefix test_unknown_prefix {} {
+ clean_restart
+
+ gdb_test_no_output "python gdb.Command('foo1', gdb.COMMAND_NONE, prefix=True)"
+ gdb_test_no_output "python gdb.Command('foo cmd', gdb.COMMAND_NONE)"
+
+ foreach prefix { "xxx" "foo xxx" "foo1 xxx" } {
+ gdb_test "python gdb.Command('$prefix cmd', gdb.COMMAND_NONE)" \
+ [multi_line \
+ "Python Exception <class 'RuntimeError'>: Could not find command prefix $prefix\\." \
+ "Error occurred in Python: Could not find command prefix $prefix\\."]
+ }
+
+ gdb_test_no_output "python gdb.Command('foo2', gdb.COMMAND_NONE, prefix=True)"
+
+ foreach prefix { "foo" "foo xxx" "foo1 xxx" "foo2 xxx" } {
+ gdb_test "python gdb.Command('$prefix cmd2', gdb.COMMAND_NONE)" \
+ [multi_line \
+ "Python Exception <class 'RuntimeError'>: Could not find command prefix $prefix\\." \
+ "Error occurred in Python: Could not find command prefix $prefix\\."]
+ }
+}
+
+# Check what happens if a command object is called without an 'invoke'
+# method.
+proc_with_prefix test_deleting_invoke_methods {} {
+ clean_restart
+
+ gdb_test_multiline "create 'foo' prefix command" \
+ "python" "" \
+ "class test_prefix(gdb.Command):" "" \
+ " def __init__ (self):" "" \
+ " super().__init__ (\"foo\", gdb.COMMAND_USER, prefix=True)" "" \
+ " def invoke (self, arg, from_tty):" "" \
+ " print(\"In 'foo' invoke: %s\" % arg)" "" \
+ "foo = test_prefix()" "" \
+ "end" ""
+
+ gdb_test_multiline "create 'foo bar' command" \
+ "python" "" \
+ "class test_cmd(gdb.Command):" "" \
+ " def __init__ (self):" "" \
+ " super().__init__ (\"foo bar\", gdb.COMMAND_USER)" "" \
+ " def invoke (self, arg, from_tty):" "" \
+ " print(\"In 'foo bar' invoke: %s\" % arg)" "" \
+ "foo_bar = test_cmd()" "" \
+ "end" ""
+
+ gdb_test "foo def" "In 'foo' invoke: def" \
+ "call 'foo' with an unknown sub-command"
+
+ gdb_test "foo bar def" "In 'foo bar' invoke: def" \
+ "call 'foo bar' with arguments"
+
+ gdb_test_no_output "python del(foo_bar.__class__.invoke)" \
+ "delete invoke from test_cmd class"
+
+ with_test_prefix "after deleting test_cmd.invoke" {
+ gdb_test "foo def" "In 'foo' invoke: def" \
+ "call 'foo' with an unknown sub-command"
+
+ gdb_test "foo bar def" \
+ "^Python command object missing 'invoke' method\\." \
+ "call 'foo bar' with arguments"
+ }
+
+ gdb_test_no_output "python del(foo.__class__.invoke)" \
+ "delete invoke from test_prefix class"
+
+ with_test_prefix "after deleting test_prefix.invoke" {
+ gdb_test "foo def" \
+ "^Python command object missing 'invoke' method\\." \
+ "call 'foo' with an unknown sub-command"
+
+ gdb_test "foo bar def" \
+ "^Python command object missing 'invoke' method\\." \
+ "call 'foo bar' with arguments"
+ }
+}
+
test_command_redefining_itself
+test_unknown_prefix
+test_deleting_invoke_methods
diff --git a/gdb/testsuite/gdb.python/py-color-leak.exp b/gdb/testsuite/gdb.python/py-color-leak.exp
new file mode 100644
index 0000000..6d7fa7c
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-color-leak.exp
@@ -0,0 +1,28 @@
+# Copyright (C) 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This file is part of the GDB testsuite. It checks for memory leaks
+# associated with allocating gdb.Color objects.
+
+load_lib gdb-python.exp
+
+require allow_python_tests
+
+standard_testfile
+
+clean_restart
+
+gdb_py_run_memory_leak_test ${srcdir}/${subdir}/${testfile}.py \
+ "gdb.Color object deallocates correctly"
diff --git a/gdb/testsuite/gdb.python/py-color-leak.py b/gdb/testsuite/gdb.python/py-color-leak.py
new file mode 100644
index 0000000..28afd59
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-color-leak.py
@@ -0,0 +1,37 @@
+# Copyright (C) 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import sys
+
+# Avoid generating
+# src/gdb/testsuite/gdb.python/__pycache__/gdb_leak_detector.cpython-<n>.pyc.
+sys.dont_write_bytecode = True
+
+import gdb_leak_detector
+
+
+class color_leak_detector(gdb_leak_detector.gdb_leak_detector):
+ def __init__(self):
+ super().__init__(__file__)
+ self.color = None
+
+ def allocate(self):
+ self.color = gdb.Color("red")
+
+ def deallocate(self):
+ self.color = None
+
+
+color_leak_detector().run()
diff --git a/gdb/testsuite/gdb.python/py-color-pagination.exp b/gdb/testsuite/gdb.python/py-color-pagination.exp
new file mode 100644
index 0000000..6b10f9c
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-color-pagination.exp
@@ -0,0 +1,194 @@
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This file is part of the GDB testsuite. It tests gdb.Color and how this
+# interacts with GDB's pagination system. The test also tests gdb.Style
+# because the tests are very similar.
+
+load_lib gdb-python.exp
+
+require allow_python_tests
+require {!is_remote host}
+
+standard_testfile
+
+set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
+
+set str "<[string repeat - 78]>"
+
+# These define all the default attributes for a style: background
+# color, intensity, italics, and underlined.
+set other_attr ";49;22;23;24;27"
+
+# These colors set the foreground color only. Everything else is the
+# default.
+set black "(?:\033\\\[30${other_attr}m)"
+set red "(?:\033\\\[31${other_attr}m)"
+set green "(?:\033\\\[32${other_attr}m)"
+set yellow "(?:\033\\\[33${other_attr}m)"
+set blue "(?:\033\\\[34${other_attr}m)"
+set magenta "(?:\033\\\[35${other_attr}m)"
+set cyan "(?:\033\\\[36${other_attr}m)"
+set white "(?:\033\\\[37${other_attr}m)"
+
+set any_color "(?:${black}|${red}|${green}|${yellow}|${blue}|${magenta}|${cyan}|${white})"
+
+# Run the command 'TYPE-fill MODE' which fills the screen with output and
+# triggers the pagination prompt. Check that styling is applied correctly
+# to the output.
+proc test_pagination { type mode } {
+
+ # Start with a fresh GDB, but enable color support.
+ with_ansi_styling_terminal {
+ clean_restart
+ }
+
+ gdb_test_no_output "source $::pyfile" "source the script"
+
+ gdb_test_no_output "set width 80"
+ gdb_test_no_output "set height 15"
+
+ set saw_bad_color_handling false
+ set expected_restore_color ""
+ set last_color ""
+ gdb_test_multiple "$type-fill $mode" "" {
+ -re "^$type-fill $mode\r\n" {
+ exp_continue
+ }
+
+ -re "^(${::any_color})(${::any_color})$::str" {
+ # After a continuation prompt GDB will restore the previous
+ # color, and then we immediately switch to a new color.
+ set restored_color $expect_out(1,string)
+ if { $restored_color ne $expected_restore_color } {
+ set saw_bad_color_handling true
+ }
+ set last_color $expect_out(2,string)
+ exp_continue
+ }
+
+ -re "^(${::any_color})$::str" {
+ # This pattern matches printing STR in all cases that are not
+ # immediately after a pagination prompt. In this case there is
+ # a single escape sequence to set the color.
+ set last_color $expect_out(1,string)
+ exp_continue
+ }
+
+ -re "^\033\\\[${::decimal}m$::str" {
+ # This catches the case where the color's escape sequence has
+ # not been converted back into a full style. This indicates
+ # something went wrong in the pager_file::puts function.
+ set saw_bad_color_handling true
+ exp_continue
+ }
+
+ -re "^\033\\\[m$::pagination_prompt$" {
+ # After a pagination prompt we expect GDB to restore the last
+ # color.
+ set expected_restore_color $last_color
+
+ # Send '\n' to view more output.
+ send_gdb "\n"
+ exp_continue
+ }
+
+ -re "^$::pagination_prompt$" {
+ # After a pagination prompt we expect GDB to restore the last
+ # color.
+ set expected_restore_color $last_color
+
+ # If we didn't see a color reset sequence before the pagination
+ # prompt, then the prompt will have been printed in the wrong
+ # color, this is a GDB bug.
+ set saw_bad_color_handling true
+
+ # Send '\n' to view more output.
+ send_gdb "\n"
+ exp_continue
+ }
+
+ -re "^\r\n" {
+ # The matches the newline sent to the continuation prompt.
+ exp_continue
+ }
+
+ -re "^\033\\\[m\r\n$::gdb_prompt $" {
+ gdb_assert { !$saw_bad_color_handling } $gdb_test_name
+ }
+ }
+}
+
+# Run the command 'style-fill-v2' which fills the screen with output and
+# triggers the pagination prompt. Check that styling is applied correctly
+# to the output. This v2 command is exercising passing a style to
+# gdb.write() rather than passing the escape sequence for the style.
+proc test_pagination_v2 { } {
+ set saw_bad_color_handling false
+ set expected_restore_color ""
+ set last_color ""
+ gdb_test_multiple "style-fill-v2" "" {
+ -re "^style-fill-v2\r\n" {
+ exp_continue
+ }
+
+ -re "^(${::any_color}\033\\\[m)(${::any_color})$::str\033\\\[m" {
+ # After a continuation prompt GDB will restore the previous
+ # color, and then we immediately switch to a new color.
+ set restored_color $expect_out(1,string)
+ if { $restored_color ne $expected_restore_color } {
+ set saw_bad_color_handling true
+ }
+ set last_color $expect_out(2,string)
+ exp_continue
+ }
+
+ -re "^(${::any_color})$::str\033\\\[m" {
+ # This pattern matches printing STR in all cases that are not
+ # immediately after a pagination prompt. In this case there is
+ # a single escape sequence to set the color.
+ set last_color $expect_out(1,string)
+ exp_continue
+ }
+
+ -re "^$::pagination_prompt$" {
+ # After a pagination prompt we expect GDB to restore the last
+ # color, but this will then be disabled due to a styled
+ # gdb.write emitting a return to default style escape sequence.
+ set expected_restore_color "$last_color\033\[m"
+
+ # Send '\n' to view more output.
+ send_gdb "\n"
+ exp_continue
+ }
+
+ -re "^\r\n" {
+ # The matches the newline sent to the continuation prompt.
+ exp_continue
+ }
+
+ -re "^$::gdb_prompt $" {
+ gdb_assert { !$saw_bad_color_handling } $gdb_test_name
+ }
+ }
+}
+
+foreach_with_prefix type { color style } {
+ foreach_with_prefix mode { write print } {
+ test_pagination $type $mode
+ }
+}
+
+test_pagination_v2
diff --git a/gdb/testsuite/gdb.python/py-color-pagination.py b/gdb/testsuite/gdb.python/py-color-pagination.py
new file mode 100644
index 0000000..9cdc76c
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-color-pagination.py
@@ -0,0 +1,82 @@
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import gdb
+
+basic_colors = ["black", "red", "green", "yellow", "blue", "magenta", "cyan", "white"]
+
+
+def write(mode, text):
+ if mode == "write":
+ gdb.write(text)
+ else:
+ print(text, end="")
+
+
+class ColorTester(gdb.Command):
+ def __init__(self):
+ super().__init__("color-fill", gdb.COMMAND_USER)
+
+ def invoke(self, args, from_tty):
+ mode = args
+ str = "<" + "-" * 78 + ">"
+ for i in range(0, 20):
+ for color_name in basic_colors:
+ c = gdb.Color(color_name)
+ write(mode, c.escape_sequence(True))
+ write(mode, str)
+
+ default = gdb.Color("none")
+ write(mode, default.escape_sequence(True))
+ write(mode, "\n")
+
+
+class StyleTester(gdb.Command):
+ def __init__(self):
+ super().__init__("style-fill", gdb.COMMAND_USER)
+
+ def invoke(self, args, from_tty):
+ mode = args
+ str = "<" + "-" * 78 + ">"
+ for i in range(0, 20):
+ for color_name in basic_colors:
+ c = gdb.Color(color_name)
+ s = gdb.Style(foreground=c)
+ write(mode, s.escape_sequence())
+ write(mode, str)
+
+ default = gdb.Style()
+ write(mode, default.escape_sequence())
+ write(mode, "\n")
+
+
+class StyleTester2(gdb.Command):
+ def __init__(self):
+ super().__init__("style-fill-v2", gdb.COMMAND_USER)
+
+ def invoke(self, args, from_tty):
+ str = "<" + "-" * 78 + ">"
+ for i in range(0, 20):
+ for color_name in basic_colors:
+ c = gdb.Color(color_name)
+ s = gdb.Style(foreground=c)
+ gdb.write(str, style=s)
+
+ gdb.write("\n")
+
+
+ColorTester()
+StyleTester()
+StyleTester2()
diff --git a/gdb/testsuite/gdb.python/py-color.exp b/gdb/testsuite/gdb.python/py-color.exp
index eb62d7f..08089e5 100644
--- a/gdb/testsuite/gdb.python/py-color.exp
+++ b/gdb/testsuite/gdb.python/py-color.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,17 +13,22 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# This file is part of the GDB testsuite.
-# It tests gdb.parameter and gdb.Parameter.
+# This file is part of the GDB testsuite. It tests gdb.Color.
load_lib gdb-python.exp
require allow_python_tests
+require {!is_remote host}
-# Start with a fresh gdb.
-clean_restart
+# Start with a fresh GDB, but enable color support.
+with_ansi_styling_terminal {
+ clean_restart
+}
-gdb_test_no_output "python print_color_attrs = lambda c: print (c, c.colorspace, c.is_none, c.is_indexed, c.is_direct)" \
+gdb_test_no_output "python get_color_attrs = lambda c: \"%s %s %s %s %s\" % (str(c), c.colorspace, c.is_none, c.is_indexed, c.is_direct)" \
+ "get_color_attrs helper"
+
+gdb_test_no_output "python print_color_attrs = lambda c: print (get_color_attrs (c))" \
"print_color_attrs helper"
gdb_test_no_output "python c = gdb.Color ()" \
@@ -59,6 +64,15 @@ gdb_test "python print_color_attrs (c)" "green 1 False True False" \
gdb_test "python print (c.index)" "2" \
"print index of a basic color with ansi colorspace"
+# Create a color using keyword arguments, and check it matches the
+# non-keyword color.
+gdb_test_no_output "python c2 = gdb.Color (color_space = gdb.COLORSPACE_ANSI_8COLOR, value = 2)" \
+ "create color from basic index and ansi colorspace using keywords"
+gdb_test "python print(get_color_attrs (c) == get_color_attrs (c2))" "True" \
+ "check attributes match"
+gdb_test "python print(c.index == c2.index)" "True" \
+ "check index matches"
+
gdb_test_no_output "python c = gdb.Color (2, gdb.COLORSPACE_XTERM_256COLOR)" \
"create color from basic index and xterm256 colorspace"
gdb_test "python print_color_attrs (c)" "2 3 False True False" \
@@ -97,4 +111,54 @@ gdb_test [concat "python print (c_red.escape_sequence (True) + " \
"c_none.escape_sequence (True))"] \
"\033\\\[31m\033\\\[42mred on green\033\\\[49m red on default\033\\\[39m" \
"escape sequences"
-
+gdb_test [concat "python print (c_red.escape_sequence (is_foreground = True) + " \
+ "c_green.escape_sequence (is_foreground = False) + 'red on green' + " \
+ "c_none.escape_sequence (is_foreground = False) + ' red on default' + " \
+ "c_none.escape_sequence (is_foreground = True))"] \
+ "\033\\\[31m\033\\\[42mred on green\033\\\[49m red on default\033\\\[39m" \
+ "escape sequences using keyword arguments"
+
+# Ensure that turning styling off means no escape sequences.
+gdb_test_no_output "set style enabled off"
+gdb_test_no_output "python print (c_red.escape_sequence (True), end='')"
+gdb_test_no_output "python print (c_red.escape_sequence (False), end='')"
+gdb_test_no_output "set style enabled on"
+
+gdb_test_multiline "Try to sub-class gdb.Color" \
+ "python" "" \
+ "class my_color(gdb.Color):" "" \
+ " def __init__(self):" "" \
+ " super().__init__('red')" "" \
+ "end" \
+ [multi_line \
+ "Python Exception <class 'TypeError'>: type 'gdb\\.Color' is not an acceptable base type" \
+ "Error occurred in Python: type 'gdb\\.Color' is not an acceptable base type"]
+
+gdb_test_multiline "Setup a color parameter and non gdb.Color object" \
+ "python" "" \
+ "class my_param(gdb.Parameter):" "" \
+ " def __init__(self):" "" \
+ " super().__init__('color-param', gdb.COMMAND_NONE, gdb.PARAM_COLOR)" "" \
+ " self.value = gdb.Color('red')" "" \
+ "color_param = my_param()" "" \
+ " " "" \
+ "class bad_type:" "" \
+ " @property" "" \
+ " def __class__(self):" "" \
+ " raise RuntimeError('__class__ error for bad_type')" "" \
+ "bad_obj = bad_type()" "" \
+ "end" ""
+
+gdb_test_no_output "python color_param.value = gdb.Color('blue')" \
+ "set color parameter to blue"
+
+gdb_test "python color_param.value = bad_obj" \
+ [multi_line \
+ "Python Exception <class 'RuntimeError'>: color argument must be a gdb\\.Color object\\." \
+ "Error occurred in Python: color argument must be a gdb\\.Color object\\."] \
+ "set color parameter to a non-color type"
+
+gdb_test "python c_none.escape_sequence(c_red)" \
+ [multi_line \
+ "Python Exception <class 'TypeError'>: argument 1 must be bool, not gdb.Color" \
+ "Error occurred in Python: argument 1 must be bool, not gdb.Color"]
diff --git a/gdb/testsuite/gdb.python/py-completion.exp b/gdb/testsuite/gdb.python/py-completion.exp
index 9abe407..4c08db4 100644
--- a/gdb/testsuite/gdb.python/py-completion.exp
+++ b/gdb/testsuite/gdb.python/py-completion.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-completion.py b/gdb/testsuite/gdb.python/py-completion.py
index 1a39f6c..906b31e 100644
--- a/gdb/testsuite/gdb.python/py-completion.py
+++ b/gdb/testsuite/gdb.python/py-completion.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-connection-removed.exp b/gdb/testsuite/gdb.python/py-connection-removed.exp
index 28c71da..5056eb1 100644
--- a/gdb/testsuite/gdb.python/py-connection-removed.exp
+++ b/gdb/testsuite/gdb.python/py-connection-removed.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -58,8 +58,17 @@ if { [target_info exists gdb_protocol] } {
set connection_type "native"
}
-# Add an inferior that shares a connection with inferior 1.
-gdb_test "add-inferior" "Added inferior 2 on connection 1 \[^\r\n\]+"
+# Add an inferior that shares a connection with inferior 1. If we are
+# using a 'remote' connection then this cannot be shared with the new
+# inferior, so we get a warning, and a new inferior with no connection.
+if { $connection_type == "remote" } {
+ gdb_test "add-inferior" \
+ [multi_line \
+ "warning: can't share connection 1 \\(remote \[^\r\n\]+\\) between inferiors" \
+ "Added inferior 2"]
+} else {
+ gdb_test "add-inferior" "Added inferior 2 on connection 1 \[^\r\n\]+"
+}
# Add an inferior with no connection.
gdb_test "add-inferior -no-connection" "Added inferior 3"
diff --git a/gdb/testsuite/gdb.python/py-connection.c b/gdb/testsuite/gdb.python/py-connection.c
index a5530dd..a6e5093 100644
--- a/gdb/testsuite/gdb.python/py-connection.c
+++ b/gdb/testsuite/gdb.python/py-connection.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-connection.exp b/gdb/testsuite/gdb.python/py-connection.exp
index ca78b37..dbfe20f 100644
--- a/gdb/testsuite/gdb.python/py-connection.exp
+++ b/gdb/testsuite/gdb.python/py-connection.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-corefile.c b/gdb/testsuite/gdb.python/py-corefile.c
new file mode 100644
index 0000000..1334ff6
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-corefile.c
@@ -0,0 +1,25 @@
+/* Copyright 2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdlib.h>
+
+int
+main (void)
+{
+ /* With correct ulimit, etc. this should cause a core dump. */
+ abort ();
+}
diff --git a/gdb/testsuite/gdb.python/py-corefile.exp b/gdb/testsuite/gdb.python/py-corefile.exp
new file mode 100644
index 0000000..866b60a
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-corefile.exp
@@ -0,0 +1,281 @@
+# Copyright (C) 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This file is part of the GDB testsuite. It tests the core file
+# support in Python.
+
+require isnative
+
+load_lib gdb-python.exp
+
+require allow_python_tests
+
+standard_testfile
+
+if {[build_executable "build executable" $testfile $srcfile] == -1} {
+ return
+}
+
+set corefile [core_find $binfile]
+if {$corefile == ""} {
+ unsupported "couldn't create or find corefile"
+ return
+}
+
+# Create a copy of the corefile.
+set other_corefile [standard_output_file ${testfile}-other.core]
+remote_exec build "cp $corefile $other_corefile"
+
+clean_restart
+
+gdb_test_no_output "python inf = gdb.selected_inferior()" \
+ "capture current inferior"
+
+gdb_test "python print(inf.corefile)" "^None" \
+ "Inferior.corefile is None before loading a core file"
+
+gdb_test "core-file $corefile" ".*" \
+ "load core file"
+
+set file_re [string_to_regexp $corefile]
+gdb_test "python print(inf.corefile)" "^<gdb\\.Corefile inferior=1 filename='$file_re'>" \
+ "Inferior.corefile is a valid object after loading a core file"
+
+gdb_test_no_output "python core1=inf.corefile" "capture gdb.Corefile object"
+
+gdb_test "python print(core1.__dict__)" "^\\{\\}" \
+ "print Corefile.__dict__ when empty"
+
+gdb_test_no_output "python core1._my_attribute = \"Hello\"" \
+ "write new attribute into Corefile object"
+
+gdb_test "python print(core1._my_attribute)" "^Hello" \
+ "immediately read new attribute"
+
+gdb_test "python print(core1.__dict__)" "^\\{'_my_attribute': 'Hello'\\}" \
+ "print Corefile.__dict__ after adding an attribute"
+
+gdb_test "python print(core1.filename)" "^$file_re" \
+ "Corefile.filename attribute works as expected"
+
+gdb_test "python print(core1.is_valid())" "^True" \
+ "Corefile.is_valid() is True while corefile is loaded"
+
+gdb_test "core-file" "^No core file now\\." "unload current core file"
+
+gdb_test "python print(core1.is_valid())" "^False" \
+ "Corefile.is_valid() is False after corefile is unloaded"
+
+gdb_test "python print(core1.__dict__)" "^\\{'_my_attribute': 'Hello'\\}" \
+ "print Corefile.__dict__ with attribute when invalid"
+
+gdb_test "python print(core1)" "^<gdb\\.Corefile \\(invalid\\)>" \
+ "print an invalid gdb.Corefile object"
+
+gdb_test "python print(core1.filename)" \
+ [multi_line \
+ "Python Exception <class 'RuntimeError'>: Corefile no longer exists\\." \
+ "Error occurred in Python: Corefile no longer exists\\."] \
+ "error when reading filename from invalid Corefile"
+
+gdb_test "python print(inf.corefile)" "^None" \
+ "Inferior.corefile is None again after corefile unload"
+
+gdb_test "python print(core1._my_attribute)" "^Hello" \
+ "read new attribute from invalid core file"
+
+# Create a second inferior.
+gdb_test "add-inferior"
+gdb_test "inferior 2"
+
+with_test_prefix "in second inferior" {
+ gdb_test "core-file $corefile" ".*" \
+ "load core file"
+
+ gdb_test "python print(inf.corefile)" "^None" \
+ "first inferior still has no core file"
+
+ gdb_test_no_output "python core2=gdb.selected_inferior().corefile" \
+ "capture gdb.Corefile object"
+
+ # The _my_attribute was added to CORE1, not CORE2. Check it
+ # doesn't somehow appear on CORE2.
+ gdb_test "python print(core2._my_attribute)" \
+ "AttributeError.*: 'gdb\\.Corefile' object has no attribute '_my_attribute'" \
+ "try to read attribute that doesn't exist"
+
+ gdb_test "python print(core2.filename)" "^$file_re" \
+ "Corefile.filename attribute works as expected"
+
+ gdb_test "inferior 1"
+}
+
+# Read the name of the core file from the second program space while
+# the current program space is the first one.
+gdb_test "python print(core2.filename)" "^$file_re" \
+ "Corefile.filename attribute works from different progspace"
+
+# Load the other corefile into the first inferior.
+gdb_test "core $other_corefile" ".*" \
+ "load other corefile into inferior 1"
+
+# Delete the second inferior. We need to switch to the second
+# inferior and unload its corefile before we can do that. Then,
+# switch back to the first inferior, delete the second, and try to
+# read the filename of the core file from the (now deleted) second
+# inferior. We should get an error about the gdb.Corefile being
+# invalid.
+with_test_prefix "remove second inferior" {
+ gdb_test "inferior 2"
+
+ gdb_test "python print(inf.corefile.filename)" \
+ "^[string_to_regexp $other_corefile]" \
+ "read inferior 1 corefile when in inferior 2"
+
+ gdb_test_no_output "python core1=inf.corefile" \
+ "capture inferior 1 gdb.Corefile while in inferior 2"
+
+ # This is a new CORE1 object, check that _my_attribute is gone.
+ gdb_test "python print(core1._my_attribute)" \
+ "AttributeError.*: 'gdb\\.Corefile' object has no attribute '_my_attribute'" \
+ "try to read attribute that doesn't exist"
+
+ gdb_test "core-file"
+
+ gdb_test "python print(core2.filename)" \
+ [multi_line \
+ "Python Exception <class 'RuntimeError'>: Corefile no longer exists\\." \
+ "Error occurred in Python: Corefile no longer exists\\."] \
+ "error when reading filename from invalid Corefile"
+
+ gdb_test "inferior 1"
+
+ gdb_test "remove-inferiors 2"
+
+ gdb_test "python print(core2.is_valid())" "^False" \
+ "Corefile.is_valid() is False after corefile is unloaded, and Progspace is deleted"
+
+ gdb_test "python print(core2.filename)" \
+ [multi_line \
+ "Python Exception <class 'RuntimeError'>: Corefile no longer exists\\." \
+ "Error occurred in Python: Corefile no longer exists\\."] \
+ "error when reading filename of an invalid Corefile, from deleted program space"
+
+ gdb_test "python print(core1.is_valid())" "^True" \
+ "check inferior 1 core file is still valid"
+}
+
+# Test the Corefile.mapped_files() API. The Python script that is
+# sourced here implements 'info proc mappings' in Python using the
+# mapped_files API. The output from the built-in command, and the
+# Python command should be identical.
+with_test_prefix "test mapped files data" {
+ clean_restart
+
+ set remote_python_file \
+ [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
+
+ # Load the Python script into GDB.
+ gdb_test "source $remote_python_file" "^Success" \
+ "source python script"
+
+ # Load the core file.
+ gdb_test "core-file $corefile" ".*" \
+ "load core file"
+
+ # Two files to write the output to.
+ set out_1 [standard_output_file ${gdb_test_file_name}-out-1.txt]
+ set out_2 [standard_output_file ${gdb_test_file_name}-out-2.txt]
+
+ # Run the built-in command, then the new Python command, capture
+ # the output.
+ gdb_test "pipe info proc mappings | tee $out_1" ".*" \
+ "capture built-in mappings output"
+ gdb_test "pipe info proc py-mappings | tee $out_2" ".*" \
+ "capture Python based mappings data"
+
+ # Check the output is identical.
+ gdb_test "shell diff -s $out_1 $out_2" \
+ "Files \[^\r\n\]+-out-1.txt and \[^\r\n\]+-out-2.txt are identical" \
+ "diff input and output one"
+
+ # Check build-ids within the core file mapping data. I'm only
+ # aware of GNU/Linux placing the first page of each mapped ELF
+ # into the generated core file so that the build-id can be found.
+ if {[istarget *-*-linux*]} {
+ set results [list]
+ gdb_test_multiple "show-build-ids" "" {
+ -re "^show-build-ids\r\n" {
+ exp_continue
+ }
+ -re "^Objfile Build-Id\\s+Core File Build-Id\\s+File Name\\s*\r\n" {
+ exp_continue
+ }
+ -re "^(\\S+)\\s+(\\S+)\\s+(\[^\r\n\]+)\r\n" {
+ set objfile_build_id $expect_out(1,string)
+ set core_file_build_id $expect_out(2,string)
+ set file_name $expect_out(3,string)
+ lappend results [list $objfile_build_id \
+ $core_file_build_id \
+ $file_name]
+ exp_continue
+ }
+ -re "^$gdb_prompt " {
+ pass $gdb_test_name
+ }
+ }
+
+ set bad_count 0
+ foreach entry $results {
+ set objfile_build_id [lindex $entry 0]
+ set core_file_build_id [lindex $entry 1]
+ set file_name [lindex $entry 2]
+ if { $objfile_build_id ne $core_file_build_id } {
+ if { $core_file_build_id ne "None" } {
+ verbose -log "Mismatched build-ids $objfile_build_id vs $core_file_build_id for $file_name"
+ incr bad_count
+ } elseif { [expect_build_id_in_core_file $file_name] } {
+ verbose -log "Failed to find build-id for $file_name"
+ incr bad_count
+ } else {
+ verbose -log "This build-id was likely not in the core file"
+ }
+ }
+ }
+
+ gdb_assert { $bad_count == 0 } \
+ "found expected build-ids in core file"
+ }
+
+ # Check the is_main_executable flag in the mapping data.
+ gdb_test "check-main-executable" "^PASS"
+
+ # Check that the mapped files "list" is actually an immutable
+ # tuple.
+ gdb_test_no_output "python core = gdb.selected_inferior().corefile"
+ gdb_test_no_output "python mapped_files = core.mapped_files()"
+ gdb_test "python print(type(mapped_files))" \
+ "^<class 'tuple'>"
+ gdb_test "python mapped_files\[0\] = None" \
+ "'tuple' object does not support item assignment"
+ gdb_test "python print(mapped_files\[0\] is None)" "^False"
+
+ # And same for the list of regions for a mapped file.
+ gdb_test_no_output "python regions = mapped_files\[0\].regions"
+ gdb_test "python print(type(regions))" \
+ "^<class 'tuple'>"
+ gdb_test "python regions\[0\] = None" \
+ "'tuple' object does not support item assignment"
+}
diff --git a/gdb/testsuite/gdb.python/py-corefile.py b/gdb/testsuite/gdb.python/py-corefile.py
new file mode 100644
index 0000000..bfb1c82
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-corefile.py
@@ -0,0 +1,186 @@
+# Copyright (C) 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import pathlib
+
+
+class Mapping:
+ def __init__(self, mapping, region):
+ self._mapping = mapping
+ self._region = region
+
+ @property
+ def start(self):
+ return self._region.start
+
+ @property
+ def end(self):
+ return self._region.end
+
+ @property
+ def offset(self):
+ return self._region.file_offset
+
+ @property
+ def filename(self):
+ return self._mapping.filename
+
+
+def info_proc_mappings():
+ print("Mapped address spaces:")
+ print("")
+ format_str = "%-18s %-18s %-18s %-18s %s "
+ print(format_str % ("Start Addr", "End Addr", "Size", "Offset", "File"))
+
+ core = gdb.selected_inferior().corefile
+ mappings = core.mapped_files()
+
+ result = []
+ for m in mappings:
+ for r in m.regions:
+ result.append(Mapping(m, r))
+
+ result.sort(key=lambda x: x.start)
+ for r in result:
+ sz = r.end - r.start
+ print(
+ format_str
+ % (
+ "0x%016x" % r.start,
+ "0x%016x" % r.end,
+ "0x%-16x" % sz,
+ "0x%-16x" % r.offset,
+ "%s" % r.filename,
+ )
+ )
+
+
+class InfoProcPyMappings(gdb.Command):
+ def __init__(self):
+ gdb.Command.__init__(self, "info proc py-mappings", gdb.COMMAND_DATA)
+
+ def invoke(self, args, from_tty):
+ info_proc_mappings()
+
+
+InfoProcPyMappings()
+
+
+# Assume that a core file is currently loaded.
+#
+# Look through all the objfiles for the current inferior, and record
+# any that have a build-id.
+#
+# Then look through the core file mapped files. Look for entries that
+# correspond with the loaded objfiles. For these matching entries,
+# capture the build-id extracted from the core file.
+#
+# Finally, print a table with the build-id from the objfile, the
+# build-id from the core file, and the file name.
+#
+# This is then processed from the test script to check the build-ids
+# match.
+class ShowBuildIds(gdb.Command):
+ def __init__(self):
+ gdb.Command.__init__(self, "show-build-ids", gdb.COMMAND_DATA)
+
+ def invoke(self, args, from_tty):
+ inf = gdb.selected_inferior()
+ objfiles = inf.progspace.objfiles()
+
+ path_to_build_id = {}
+
+ # Initial length based on column headings.
+ longest_build_id = 18
+
+ for o in objfiles:
+ if not o.is_file or o.build_id is None or o.owner is not None:
+ continue
+ p = pathlib.Path(o.filename).resolve()
+ b = o.build_id
+ path_to_build_id[p] = {"objfile": b, "corefile": "missing"}
+ if len(b) > longest_build_id:
+ longest_build_id = len(b)
+
+ count = 0
+ core_mapped_files = inf.corefile.mapped_files()
+ for m in core_mapped_files:
+ p = pathlib.Path(m.filename).resolve()
+ b = m.build_id
+
+ if b is not None and len(b) > longest_build_id:
+ longest_build_id = len(b)
+
+ if p in path_to_build_id:
+ path_to_build_id[p]["corefile"] = b
+
+ format_str = (
+ "%-" + str(longest_build_id) + "s %-" + str(longest_build_id) + "s %s"
+ )
+
+ def make_title(string, length=0):
+ if length > 0:
+ padding_len = length - len(string)
+ else:
+ padding_len = 0
+
+ padding = " " * padding_len
+ style = gdb.Style("title")
+ return style.apply(string) + padding
+
+ print(
+ "%s %s %s"
+ % (
+ make_title("Objfile Build-Id", longest_build_id),
+ make_title("Core File Build-Id", longest_build_id),
+ make_title("File Name"),
+ )
+ )
+ for p, b in path_to_build_id.items():
+ print(format_str % (b["objfile"], b["corefile"], p))
+
+
+ShowBuildIds()
+
+
+class CheckMainExec(gdb.Command):
+ def __init__(self):
+ gdb.Command.__init__(self, "check-main-executable", gdb.COMMAND_DATA)
+
+ def invoke(self, args, from_tty):
+ inf = gdb.selected_inferior()
+ pspace = inf.progspace
+ exec_filename = pathlib.Path(pspace.executable_filename).resolve()
+
+ count = 0
+ core_mapped_files = inf.corefile.mapped_files()
+ for m in core_mapped_files:
+ if not m.is_main_executable:
+ continue
+
+ p = pathlib.Path(m.filename).resolve()
+
+ count += 1
+ assert exec_filename == p, "main exec filename mismatch"
+
+ assert count == 1, "invalid main executable count"
+
+ print("PASS")
+
+
+CheckMainExec()
+
+
+print("Success")
diff --git a/gdb/testsuite/gdb.python/py-disasm-exec.exp b/gdb/testsuite/gdb.python/py-disasm-exec.exp
index 546c4b8..a8dceec 100644
--- a/gdb/testsuite/gdb.python/py-disasm-exec.exp
+++ b/gdb/testsuite/gdb.python/py-disasm-exec.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-disasm-obj.exp b/gdb/testsuite/gdb.python/py-disasm-obj.exp
index 37ff965..55374ad 100644
--- a/gdb/testsuite/gdb.python/py-disasm-obj.exp
+++ b/gdb/testsuite/gdb.python/py-disasm-obj.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-disasm.c b/gdb/testsuite/gdb.python/py-disasm.c
index f267dbd..95c2d11 100644
--- a/gdb/testsuite/gdb.python/py-disasm.c
+++ b/gdb/testsuite/gdb.python/py-disasm.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-disasm.exp.tcl b/gdb/testsuite/gdb.python/py-disasm.exp.tcl
index 8ed634e..5f45747 100644
--- a/gdb/testsuite/gdb.python/py-disasm.exp.tcl
+++ b/gdb/testsuite/gdb.python/py-disasm.exp.tcl
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,14 +24,16 @@ standard_testfile py-disasm.c
if { $kind == "obj" } {
- set obj [standard_output_file ${gdb_test_file_name}.o]
+ set testfile $testfile.o
+ set binfile [standard_output_file $testfile]
- if { [gdb_compile "$srcdir/$subdir/$srcfile" $obj object "debug"] != "" } {
- untested "failed to compile object file [file tail $obj]"
+ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile object \
+ "debug"] != "" } {
+ untested "failed to compile object file $testfile"
return -1
}
- clean_restart $obj
+ clean_restart $testfile
} else {
@@ -152,7 +154,10 @@ set test_plans \
"Buffer returned from read_memory is sized $decimal instead of the expected $decimal"]] \
[list "ResultOfWrongType" \
[make_exception_pattern "TypeError" \
- "Result is not a DisassemblerResult."]] \
+ "Result from Disassembler must be gdb.DisassemblerResult, not Blah."]] \
+ [list "ResultOfVeryWrongType" \
+ [make_exception_pattern "TypeError" \
+ "Result from Disassembler must be gdb.DisassemblerResult, not Blah."]] \
[list "ErrorCreatingTextPart_NoArgs" \
[make_exception_pattern "TypeError" \
[missing_arg_pattern "style" 1]]] \
diff --git a/gdb/testsuite/gdb.python/py-disasm.py b/gdb/testsuite/gdb.python/py-disasm.py
index f105657..9761337 100644
--- a/gdb/testsuite/gdb.python/py-disasm.py
+++ b/gdb/testsuite/gdb.python/py-disasm.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -294,6 +294,24 @@ class ResultOfWrongType(TestDisassembler):
return self.Blah(1, "ABC")
+class ResultOfVeryWrongType(TestDisassembler):
+ """Return something that is not a DisassemblerResult from disassemble
+ method. The thing returned will raise an exception if used in an
+ isinstance() call, or in PyObject_IsInstance from C++.
+ """
+
+ class Blah:
+ def __init__(self):
+ pass
+
+ @property
+ def __class__(self):
+ raise RuntimeError("error from __class__ in Blah")
+
+ def disassemble(self, info):
+ return self.Blah()
+
+
class TaggingDisassembler(TestDisassembler):
"""A simple disassembler that just tags the output."""
diff --git a/gdb/testsuite/gdb.python/py-doc-reformat.exp b/gdb/testsuite/gdb.python/py-doc-reformat.exp
index 01671ed..519a314 100644
--- a/gdb/testsuite/gdb.python/py-doc-reformat.exp
+++ b/gdb/testsuite/gdb.python/py-doc-reformat.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-error.exp b/gdb/testsuite/gdb.python/py-error.exp
index 6eb9cc3..1e920c2 100644
--- a/gdb/testsuite/gdb.python/py-error.exp
+++ b/gdb/testsuite/gdb.python/py-error.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-error.py b/gdb/testsuite/gdb.python/py-error.py
index f63e3e7..b128707 100644
--- a/gdb/testsuite/gdb.python/py-error.py
+++ b/gdb/testsuite/gdb.python/py-error.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-event-load.c b/gdb/testsuite/gdb.python/py-event-load.c
index 1616ff7..10b65fb 100644
--- a/gdb/testsuite/gdb.python/py-event-load.c
+++ b/gdb/testsuite/gdb.python/py-event-load.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-event-load.exp b/gdb/testsuite/gdb.python/py-event-load.exp
index c3e10f6..dbb225f 100644
--- a/gdb/testsuite/gdb.python/py-event-load.exp
+++ b/gdb/testsuite/gdb.python/py-event-load.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,12 +20,6 @@ load_lib gdb-python.exp
require allow_shlib_tests allow_python_tests
-if {[get_compiler_info]} {
- warning "Could not get compiler info"
- untested "no compiler info"
- return -1
-}
-
standard_testfile .c
if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
executable {debug shlib_load}] != ""} {
diff --git a/gdb/testsuite/gdb.python/py-event-load.py b/gdb/testsuite/gdb.python/py-event-load.py
index cffd5c0..ac7c533 100644
--- a/gdb/testsuite/gdb.python/py-event-load.py
+++ b/gdb/testsuite/gdb.python/py-event-load.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-events-shlib.c b/gdb/testsuite/gdb.python/py-events-shlib.c
index 335bcdc..d77517a 100644
--- a/gdb/testsuite/gdb.python/py-events-shlib.c
+++ b/gdb/testsuite/gdb.python/py-events-shlib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-events.c b/gdb/testsuite/gdb.python/py-events.c
index 747d7a8..9ecdeb7 100644
--- a/gdb/testsuite/gdb.python/py-events.c
+++ b/gdb/testsuite/gdb.python/py-events.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp
index 85b55ae..b440ac4 100644
--- a/gdb/testsuite/gdb.python/py-events.exp
+++ b/gdb/testsuite/gdb.python/py-events.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-events.py b/gdb/testsuite/gdb.python/py-events.py
index ebc59df..0573b16 100644
--- a/gdb/testsuite/gdb.python/py-events.py
+++ b/gdb/testsuite/gdb.python/py-events.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-evsignal.exp b/gdb/testsuite/gdb.python/py-evsignal.exp
index 83b351f..22b13af 100644
--- a/gdb/testsuite/gdb.python/py-evsignal.exp
+++ b/gdb/testsuite/gdb.python/py-evsignal.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-evthreads.c b/gdb/testsuite/gdb.python/py-evthreads.c
index 5605d03..321a9b7 100644
--- a/gdb/testsuite/gdb.python/py-evthreads.c
+++ b/gdb/testsuite/gdb.python/py-evthreads.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-evthreads.exp b/gdb/testsuite/gdb.python/py-evthreads.exp
index c2310a1..0e9cd97 100644
--- a/gdb/testsuite/gdb.python/py-evthreads.exp
+++ b/gdb/testsuite/gdb.python/py-evthreads.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-exec-file.c b/gdb/testsuite/gdb.python/py-exec-file.c
index ca3e5ab..df3db4d 100644
--- a/gdb/testsuite/gdb.python/py-exec-file.c
+++ b/gdb/testsuite/gdb.python/py-exec-file.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-exec-file.exp b/gdb/testsuite/gdb.python/py-exec-file.exp
index f735757..139ce83 100644
--- a/gdb/testsuite/gdb.python/py-exec-file.exp
+++ b/gdb/testsuite/gdb.python/py-exec-file.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,8 +19,10 @@ load_lib gdb-python.exp
standard_testfile
-set binfile1 ${binfile}-a
-set binfile2 ${binfile}-b
+set testfile1 $testfile-a
+set binfile1 [standard_output_file $testfile1]
+set testfile2 $testfile-b
+set binfile2 [standard_output_file $testfile2]
if {[build_executable "failed to prepare first executable" \
$binfile1 $srcfile]} {
@@ -176,7 +178,7 @@ with_test_prefix "using 'symbol-file' command" {
# Check the executable_changed event when the executable changes on disk.
with_test_prefix "exec changes on disk" {
- clean_restart $binfile1
+ clean_restart $::testfile1
setup_exec_change_handler
diff --git a/gdb/testsuite/gdb.python/py-exec-mi.exp b/gdb/testsuite/gdb.python/py-exec-mi.exp
index 6b81644..96ee481 100644
--- a/gdb/testsuite/gdb.python/py-exec-mi.exp
+++ b/gdb/testsuite/gdb.python/py-exec-mi.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.python/py-explore-cc.exp b/gdb/testsuite/gdb.python/py-explore-cc.exp
index 94fae13..8c28d87 100644
--- a/gdb/testsuite/gdb.python/py-explore-cc.exp
+++ b/gdb/testsuite/gdb.python/py-explore-cc.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ A = <Enter 0 to explore this base class of type 'A'>.*\
i = <Enter 1 to explore this field of type 'int'>.*\
c = <Enter 2 to explore this field of type 'char'>.*"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-explore.c b/gdb/testsuite/gdb.python/py-explore.c
index 8f48ecb..5546eaf 100644
--- a/gdb/testsuite/gdb.python/py-explore.c
+++ b/gdb/testsuite/gdb.python/py-explore.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-explore.cc b/gdb/testsuite/gdb.python/py-explore.cc
index ea50ade..658979e 100644
--- a/gdb/testsuite/gdb.python/py-explore.cc
+++ b/gdb/testsuite/gdb.python/py-explore.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-explore.exp b/gdb/testsuite/gdb.python/py-explore.exp
index 93be521..df0f465 100644
--- a/gdb/testsuite/gdb.python/py-explore.exp
+++ b/gdb/testsuite/gdb.python/py-explore.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ proc array_description { value_name type } {
proc pointer_description { value_name type_name } {
set type_description "'$value_name' is a pointer to a value of type '$type_name'\.\[\r\n\]+"
- set prompt "Continue exploring it as a pointer to a single value \[\[\]y/n\[\]\]: "
+ set prompt "Continue exploring it as a pointer to a single value \[\[\]y/n\[\]\]: "
return "$type_description$prompt"
}
@@ -75,7 +75,7 @@ proc scalar_value { value_name value } {
set SS_fields [field_values {a = 10} {d = 100[.].*}]
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -125,7 +125,7 @@ gdb_test_multiple "explore darray_ref" "" {
}
}
}
- }
+ }
}
}
}
diff --git a/gdb/testsuite/gdb.python/py-failed-init.exp b/gdb/testsuite/gdb.python/py-failed-init.exp
index 1e0c10d..ee3dc7a 100644
--- a/gdb/testsuite/gdb.python/py-failed-init.exp
+++ b/gdb/testsuite/gdb.python/py-failed-init.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.c b/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.c
index 8f0e6bb..6bc7cb6 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.c
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.exp
index 4aed5c5..42aa572 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.exp
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.py b/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.py
index c6d6df6..8d8ca53 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.py
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.c b/gdb/testsuite/gdb.python/py-finish-breakpoint.c
index 45dcc98..237a152 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint.c
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
index 0316bc7..bec22ee 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -112,7 +112,7 @@ with_test_prefix "return to inlined function" {
}
#
-# Test FinishBreakpoint with no debug symbol
+# Test FinishBreakpoint with no debug symbol
#
with_test_prefix "no debug symbol" {
@@ -140,7 +140,7 @@ with_test_prefix "no debug symbol" {
}
#
-# Test FinishBreakpoint in function returned by longjmp
+# Test FinishBreakpoint in function returned by longjmp
#
with_test_prefix "function returned by longjump" {
@@ -166,7 +166,7 @@ with_test_prefix "function returned by longjump" {
}
#
-# Test FinishBreakpoint in BP condition evaluation
+# Test FinishBreakpoint in BP condition evaluation
# (finish in dummy frame)
#
@@ -194,7 +194,7 @@ with_test_prefix "finish in dummy frame" {
}
#
-# Test FinishBreakpoint in BP condition evaluation
+# Test FinishBreakpoint in BP condition evaluation
# (finish in normal frame)
#
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.py b/gdb/testsuite/gdb.python/py-finish-breakpoint.py
index dba0431..413489f 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint.py
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint2.cc b/gdb/testsuite/gdb.python/py-finish-breakpoint2.cc
index 3c4f143..af8801f 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint2.cc
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint2.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
index b837bb3..be81576 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ gdb_breakpoint [gdb_get_line_number "Break after exception 2"]
gdb_test "source $pyfile" ".*Python script imported.*" \
"import python scripts"
-
+
gdb_breakpoint "throw_exception_1"
#
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint2.py b/gdb/testsuite/gdb.python/py-finish-breakpoint2.py
index 47bb2dd..ae75e51 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint2.py
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint2.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-format-address.c b/gdb/testsuite/gdb.python/py-format-address.c
index 2a0e916..f8eced6 100644
--- a/gdb/testsuite/gdb.python/py-format-address.c
+++ b/gdb/testsuite/gdb.python/py-format-address.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-format-address.exp b/gdb/testsuite/gdb.python/py-format-address.exp
index ab8022c..2946314 100644
--- a/gdb/testsuite/gdb.python/py-format-address.exp
+++ b/gdb/testsuite/gdb.python/py-format-address.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,12 +27,14 @@ foreach func_name { foo bar } {
}
}
-set binary_foo [standard_output_file "${testfile}-foo"]
-set binary_bar [standard_output_file "${testfile}-bar"]
+set testfile_foo $testfile-foo
+set testfile_bar $testfile-bar
+set binary_foo [standard_output_file $testfile_foo]
+set binary_bar [standard_output_file $testfile_bar]
-clean_restart $binary_foo
+clean_restart $testfile_foo
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -51,7 +53,7 @@ gdb_test_multiple "info break 1" "" {
}
}
if { $next_addr == "UNKNOWN" || $next_addr == $main_addr } {
- set next_addr [format 0x%x [expr $main_addr + 1]]
+ set next_addr [format 0x%x [expr {$main_addr + 1}]]
}
verbose -log "main_addr: $main_addr"
diff --git a/gdb/testsuite/gdb.python/py-format-string.c b/gdb/testsuite/gdb.python/py-format-string.c
index c1f59eb..eed356f 100644
--- a/gdb/testsuite/gdb.python/py-format-string.c
+++ b/gdb/testsuite/gdb.python/py-format-string.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-format-string.exp b/gdb/testsuite/gdb.python/py-format-string.exp
index 9102391..f34108d 100644
--- a/gdb/testsuite/gdb.python/py-format-string.exp
+++ b/gdb/testsuite/gdb.python/py-format-string.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,7 +47,8 @@ proc build_inferior {exefile lang} {
proc prepare_gdb {exefile} {
global srcdir subdir srcfile testfile hex
- clean_restart $exefile
+ clean_restart
+ gdb_load $exefile
if {![runto_main]} {
return
@@ -109,7 +110,7 @@ proc get_cut_big_string { max } {
return "\"${whole_big_string}\""
}
- set cut_string [string range $whole_big_string 0 [expr $max - 1]]
+ set cut_string [string range $whole_big_string 0 [expr {$max - 1}]]
return "\"${cut_string}\"..."
}
@@ -1202,7 +1203,9 @@ with_test_prefix "format_string" {
set current_lang "c"
prepare_gdb "${binfile}"
test_all_common
- test_styling
+ if { ![is_remote host] } {
+ test_styling
+ }
}
}
}
diff --git a/gdb/testsuite/gdb.python/py-format-string.py b/gdb/testsuite/gdb.python/py-format-string.py
index e4f88b1..34b0124 100644
--- a/gdb/testsuite/gdb.python/py-format-string.py
+++ b/gdb/testsuite/gdb.python/py-format-string.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-frame-args.c b/gdb/testsuite/gdb.python/py-frame-args.c
index cbf89c7..4a7b089 100644
--- a/gdb/testsuite/gdb.python/py-frame-args.c
+++ b/gdb/testsuite/gdb.python/py-frame-args.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-frame-args.exp b/gdb/testsuite/gdb.python/py-frame-args.exp
index 4fc8f0a..12f1651 100644
--- a/gdb/testsuite/gdb.python/py-frame-args.exp
+++ b/gdb/testsuite/gdb.python/py-frame-args.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-frame-args.py b/gdb/testsuite/gdb.python/py-frame-args.py
index 04ab1ac..45476b1 100644
--- a/gdb/testsuite/gdb.python/py-frame-args.py
+++ b/gdb/testsuite/gdb.python/py-frame-args.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-frame-inline.c b/gdb/testsuite/gdb.python/py-frame-inline.c
index 691ade5..c02ddf3 100644
--- a/gdb/testsuite/gdb.python/py-frame-inline.c
+++ b/gdb/testsuite/gdb.python/py-frame-inline.c
@@ -1,6 +1,6 @@
/* This test is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-frame-inline.exp b/gdb/testsuite/gdb.python/py-frame-inline.exp
index ce3d309..d4a74a1 100644
--- a/gdb/testsuite/gdb.python/py-frame-inline.exp
+++ b/gdb/testsuite/gdb.python/py-frame-inline.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp
index 0f1528e..c1e3e33 100644
--- a/gdb/testsuite/gdb.python/py-frame.exp
+++ b/gdb/testsuite/gdb.python/py-frame.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -188,6 +188,21 @@ gdb_test "python print(gdb.selected_frame().read_register(list()))" \
".*Invalid type for register.*" \
"test Frame.read_register with list"
+gdb_test_multiline "setup a bad object" \
+ "python" "" \
+ "class bad_type:" "" \
+ " def __init__ (self):" "" \
+ " pass" "" \
+ " @property" "" \
+ " def __class__(self):" "" \
+ " raise RuntimeError('error from __class in bad_type')" "" \
+ "bad_object = bad_type()" "" \
+ "end" ""
+
+gdb_test "python print(gdb.selected_frame().read_register(bad_object))" \
+ ".*Invalid type for register.*" \
+ "test Frame.read_register with bad_type object"
+
# Compile again without debug info.
gdb_exit
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {}] } {
diff --git a/gdb/testsuite/gdb.python/py-framefilter-addr.c b/gdb/testsuite/gdb.python/py-framefilter-addr.c
index 6872c96..e356768 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-addr.c
+++ b/gdb/testsuite/gdb.python/py-framefilter-addr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-framefilter-addr.exp b/gdb/testsuite/gdb.python/py-framefilter-addr.exp
index dbc3250..27c1de3 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-addr.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter-addr.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-framefilter-addr.py b/gdb/testsuite/gdb.python/py-framefilter-addr.py
index c22d91c..513bf6f 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-addr.py
+++ b/gdb/testsuite/gdb.python/py-framefilter-addr.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-framefilter-gdb.py b/gdb/testsuite/gdb.python/py-framefilter-gdb.py
index ada7ad7..a725dce 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-gdb.py
+++ b/gdb/testsuite/gdb.python/py-framefilter-gdb.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-framefilter-invalidarg-gdb.py b/gdb/testsuite/gdb.python/py-framefilter-invalidarg-gdb.py
index fbe0c0d..51922fc 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-invalidarg-gdb.py
+++ b/gdb/testsuite/gdb.python/py-framefilter-invalidarg-gdb.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp
index 0e78f8d..c58dd01 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.py b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.py
index cb25cd9..b262968 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.py
+++ b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-framefilter-mi.c b/gdb/testsuite/gdb.python/py-framefilter-mi.c
index 35f21b2..cba2b65 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-mi.c
+++ b/gdb/testsuite/gdb.python/py-framefilter-mi.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-framefilter-mi.exp b/gdb/testsuite/gdb.python/py-framefilter-mi.exp
index c6644e5..03e5f90 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-mi.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter-mi.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
diff --git a/gdb/testsuite/gdb.python/py-framefilter.c b/gdb/testsuite/gdb.python/py-framefilter.c
index 135ead9..1b3d862 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.c
+++ b/gdb/testsuite/gdb.python/py-framefilter.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp
index 3a325bd..7cc8b01 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-framefilter.py b/gdb/testsuite/gdb.python/py-framefilter.py
index fb679f1..5c3790d 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.py
+++ b/gdb/testsuite/gdb.python/py-framefilter.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-function.exp b/gdb/testsuite/gdb.python/py-function.exp
index 6de3b34..e618a13 100644
--- a/gdb/testsuite/gdb.python/py-function.exp
+++ b/gdb/testsuite/gdb.python/py-function.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-inferior-leak.c b/gdb/testsuite/gdb.python/py-inferior-leak.c
index 7b7b92a..a8d19f2 100644
--- a/gdb/testsuite/gdb.python/py-inferior-leak.c
+++ b/gdb/testsuite/gdb.python/py-inferior-leak.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-inferior-leak.exp b/gdb/testsuite/gdb.python/py-inferior-leak.exp
index a068ebb..15216ee 100644
--- a/gdb/testsuite/gdb.python/py-inferior-leak.exp
+++ b/gdb/testsuite/gdb.python/py-inferior-leak.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,15 +24,5 @@ standard_testfile
clean_restart
-# Skip this test if the tracemalloc module is not available.
-if { ![gdb_py_module_available "tracemalloc"] } {
- unsupported "tracemalloc module not available"
- return
-}
-
-set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
-
-# Source the Python script, this runs the test (which is written
-# completely in Python), and either prints PASS, or throws an
-# exception.
-gdb_test "source ${pyfile}" "PASS" "source python script"
+gdb_py_run_memory_leak_test ${srcdir}/${subdir}/${testfile}.py \
+ "gdb.Inferior object deallocates correctly"
diff --git a/gdb/testsuite/gdb.python/py-inferior-leak.py b/gdb/testsuite/gdb.python/py-inferior-leak.py
index ae3629a..bf61668 100644
--- a/gdb/testsuite/gdb.python/py-inferior-leak.py
+++ b/gdb/testsuite/gdb.python/py-inferior-leak.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,100 +13,39 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import re
-import tracemalloc
-
-import gdb
-
-# A global variable in which we store a reference to the gdb.Inferior
-# object sent to us in the new_inferior event.
-inf = None
-
-
-# Register the new_inferior event handler.
-def new_inferior_handler(event):
- global inf
- inf = event.inferior
-
-
-gdb.events.new_inferior.connect(new_inferior_handler)
+import sys
-# A global filters list, we only care about memory allocations
-# originating from this script.
-filters = [tracemalloc.Filter(True, "*py-inferior-leak.py")]
+# Avoid generating
+# src/gdb/testsuite/gdb.python/__pycache__/gdb_leak_detector.cpython-<n>.pyc.
+sys.dont_write_bytecode = True
+import re
-# Add a new inferior, and return the number of the new inferior.
-def add_inferior():
- output = gdb.execute("add-inferior", False, True)
- m = re.search(r"Added inferior (\d+)", output)
- if m:
- num = int(m.group(1))
- else:
- raise RuntimeError("no match")
- return num
-
-
-# Run the test. When CLEAR is True we clear the global INF variable
-# before comparing the before and after memory allocation traces.
-# When CLEAR is False we leave INF set to reference the gdb.Inferior
-# object, thus preventing the gdb.Inferior from being deallocated.
-def test(clear):
- global filters, inf
-
- # Start tracing, and take a snapshot of the current allocations.
- tracemalloc.start()
- snapshot1 = tracemalloc.take_snapshot()
-
- # Create an inferior, this triggers the new_inferior event, which
- # in turn holds a reference to the new gdb.Inferior object in the
- # global INF variable.
- num = add_inferior()
- gdb.execute("remove-inferiors %s" % num)
-
- # Possibly clear the global INF variable.
- if clear:
- inf = None
-
- # Now grab a second snapshot of memory allocations, and stop
- # tracing memory allocations.
- snapshot2 = tracemalloc.take_snapshot()
- tracemalloc.stop()
+import gdb_leak_detector
- # Filter the snapshots; we only care about allocations originating
- # from this file.
- snapshot1 = snapshot1.filter_traces(filters)
- snapshot2 = snapshot2.filter_traces(filters)
- # Compare the snapshots, this leaves only things that were
- # allocated, but not deallocated since the first snapshot.
- stats = snapshot2.compare_to(snapshot1, "traceback")
+class inferior_leak_detector(gdb_leak_detector.gdb_leak_detector):
+ def __init__(self):
+ super().__init__(__file__)
+ self.inferior = None
+ self.__handler = lambda event: setattr(self, "inferior", event.inferior)
+ gdb.events.new_inferior.connect(self.__handler)
- # Total up all the deallocated things.
- total = 0
- for stat in stats:
- total += stat.size_diff
- return total
+ def __del__(self):
+ gdb.events.new_inferior.disconnect(self.__handler)
+ def allocate(self):
+ output = gdb.execute("add-inferior", False, True)
+ m = re.search(r"Added inferior (\d+)", output)
+ if m:
+ num = int(m.group(1))
+ else:
+ raise RuntimeError("no match")
-# The first time we run this some global state will be allocated which
-# shows up as memory that is allocated, but not released. So, run the
-# test once and discard the result.
-test(True)
+ gdb.execute("remove-inferiors %s" % num)
-# Now run the test twice, the first time we clear our global reference
-# to the gdb.Inferior object, which should allow Python to deallocate
-# the object. The second time we hold onto the global reference,
-# preventing Python from performing the deallocation.
-bytes_with_clear = test(True)
-bytes_without_clear = test(False)
+ def deallocate(self):
+ self.inferior = None
-# The bug that used to exist in GDB was that even when we released the
-# global reference the gdb.Inferior object would not be deallocated.
-if bytes_with_clear > 0:
- raise gdb.GdbError("memory leak when gdb.Inferior should be released")
-if bytes_without_clear == 0:
- raise gdb.GdbError("gdb.Inferior object is no longer allocated")
-# Print a PASS message that the test script can see.
-print("PASS")
+inferior_leak_detector().run()
diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp
index dbde7fe..58632f0 100644
--- a/gdb/testsuite/gdb.python/py-inferior.exp
+++ b/gdb/testsuite/gdb.python/py-inferior.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -318,7 +318,7 @@ with_test_prefix "large range" {
# For native targets, test a pattern straddling a chunk boundary.
-if [isnative] {
+if {[isnative]} {
with_test_prefix "straddling" {
gdb_test_no_output "set *(int32_t*) &search_buf\[${CHUNK_SIZE}-1\] = 0xfdb97531"
gdb_test_no_output "py pattern = pack('${python_pack_char}I', 0xfdb97531)"
diff --git a/gdb/testsuite/gdb.python/py-infthread.exp b/gdb/testsuite/gdb.python/py-infthread.exp
index 9b05165..40c90b4 100644
--- a/gdb/testsuite/gdb.python/py-infthread.exp
+++ b/gdb/testsuite/gdb.python/py-infthread.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-label-symbol-value.c b/gdb/testsuite/gdb.python/py-label-symbol-value.c
index 8f6258e..0e92d58 100644
--- a/gdb/testsuite/gdb.python/py-label-symbol-value.c
+++ b/gdb/testsuite/gdb.python/py-label-symbol-value.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-label-symbol-value.exp b/gdb/testsuite/gdb.python/py-label-symbol-value.exp
index a8360e6..07bc870 100644
--- a/gdb/testsuite/gdb.python/py-label-symbol-value.exp
+++ b/gdb/testsuite/gdb.python/py-label-symbol-value.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-lazy-string.c b/gdb/testsuite/gdb.python/py-lazy-string.c
index 805ba92..7eaf7fd 100644
--- a/gdb/testsuite/gdb.python/py-lazy-string.c
+++ b/gdb/testsuite/gdb.python/py-lazy-string.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-lazy-string.exp b/gdb/testsuite/gdb.python/py-lazy-string.exp
index d212e61..a6fdd77 100644
--- a/gdb/testsuite/gdb.python/py-lazy-string.exp
+++ b/gdb/testsuite/gdb.python/py-lazy-string.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
-if ![runto_main ] {
+if {![runto_main ]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-linetable-empty.c b/gdb/testsuite/gdb.python/py-linetable-empty.c
index 85e5588..0e6da2d 100644
--- a/gdb/testsuite/gdb.python/py-linetable-empty.c
+++ b/gdb/testsuite/gdb.python/py-linetable-empty.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-linetable-empty.exp b/gdb/testsuite/gdb.python/py-linetable-empty.exp
index 2b7f8be..f742d70 100644
--- a/gdb/testsuite/gdb.python/py-linetable-empty.exp
+++ b/gdb/testsuite/gdb.python/py-linetable-empty.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,11 +27,11 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name py-linetable-empty.c}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name py-linetable-empty.c
} {
subprogram {
- {MACRO_AT_func {main}}
+ MACRO_AT_func {main}
}
}
}
@@ -42,7 +42,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-linetable.S b/gdb/testsuite/gdb.python/py-linetable.S
index 5400bc0..f17faa7 100644
--- a/gdb/testsuite/gdb.python/py-linetable.S
+++ b/gdb/testsuite/gdb.python/py-linetable.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.python/py-linetable.c b/gdb/testsuite/gdb.python/py-linetable.c
index 68f3226..d44ffb5 100644
--- a/gdb/testsuite/gdb.python/py-linetable.c
+++ b/gdb/testsuite/gdb.python/py-linetable.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-linetable.exp b/gdb/testsuite/gdb.python/py-linetable.exp
index 5caa7c4..453ee7a 100644
--- a/gdb/testsuite/gdb.python/py-linetable.exp
+++ b/gdb/testsuite/gdb.python/py-linetable.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ require allow_python_tests
set opts {}
standard_testfile .S
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.python/py-linetable.exp COMPILE=1"
standard_testfile
lappend opts debug optimize=-O2
@@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-lookup-type.exp b/gdb/testsuite/gdb.python/py-lookup-type.exp
index 0b2f334..8673d56 100644
--- a/gdb/testsuite/gdb.python/py-lookup-type.exp
+++ b/gdb/testsuite/gdb.python/py-lookup-type.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-mi-cmd.exp b/gdb/testsuite/gdb.python/py-mi-cmd.exp
index db017c6..7c630f6 100644
--- a/gdb/testsuite/gdb.python/py-mi-cmd.exp
+++ b/gdb/testsuite/gdb.python/py-mi-cmd.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2024 Free Software Foundation, Inc.
+# Copyright (C) 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.python/py-mi-cmd.py b/gdb/testsuite/gdb.python/py-mi-cmd.py
index ad75c3b..7bfe188 100644
--- a/gdb/testsuite/gdb.python/py-mi-cmd.py
+++ b/gdb/testsuite/gdb.python/py-mi-cmd.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2024 Free Software Foundation, Inc.
+# Copyright (C) 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.python/py-mi-events-gdb.py b/gdb/testsuite/gdb.python/py-mi-events-gdb.py
index 94ecddb..ea5f470 100644
--- a/gdb/testsuite/gdb.python/py-mi-events-gdb.py
+++ b/gdb/testsuite/gdb.python/py-mi-events-gdb.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-mi-events.c b/gdb/testsuite/gdb.python/py-mi-events.c
index d3b727e..d5df385 100644
--- a/gdb/testsuite/gdb.python/py-mi-events.c
+++ b/gdb/testsuite/gdb.python/py-mi-events.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-mi-events.exp b/gdb/testsuite/gdb.python/py-mi-events.exp
index d5de247..a15ba0b 100644
--- a/gdb/testsuite/gdb.python/py-mi-events.exp
+++ b/gdb/testsuite/gdb.python/py-mi-events.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,7 +39,7 @@ mi_gdb_test "set auto-load safe-path ${remote_python_file}" \
{.*\^done} \
"set safe-path"
-if [is_remote host] {
+if {[is_remote host]} {
set filename ${testfile}
remote_download host ${binfile} ${filename}
} else {
diff --git a/gdb/testsuite/gdb.python/py-mi-notify.exp b/gdb/testsuite/gdb.python/py-mi-notify.exp
index 7776976..e7b1521 100644
--- a/gdb/testsuite/gdb.python/py-mi-notify.exp
+++ b/gdb/testsuite/gdb.python/py-mi-notify.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.python/py-mi-objfile-gdb.py b/gdb/testsuite/gdb.python/py-mi-objfile-gdb.py
index f5a032e..0ae75b0 100644
--- a/gdb/testsuite/gdb.python/py-mi-objfile-gdb.py
+++ b/gdb/testsuite/gdb.python/py-mi-objfile-gdb.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-mi-objfile.c b/gdb/testsuite/gdb.python/py-mi-objfile.c
index 59fd2bf..829419c 100644
--- a/gdb/testsuite/gdb.python/py-mi-objfile.c
+++ b/gdb/testsuite/gdb.python/py-mi-objfile.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-mi-objfile.exp b/gdb/testsuite/gdb.python/py-mi-objfile.exp
index 28b4589..c1edffe 100644
--- a/gdb/testsuite/gdb.python/py-mi-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-mi-objfile.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
# gdb will find it.
set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}]
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
@@ -41,7 +41,7 @@ mi_gdb_test "set auto-load safe-path ${remote_python_file}" \
{.*\^done} \
"set safe-path"
-if [is_remote host] {
+if {[is_remote host]} {
set filename ${testfile}
remote_download host ${binfile} ${filename}
} else {
diff --git a/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.c b/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.c
index 5e46442..6bd4b65 100644
--- a/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.c
+++ b/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp b/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp
index f7e072e..7a9124b 100644
--- a/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp
+++ b/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -29,7 +29,7 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" }
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
mi_gdb_test "source ${pyfile}" \
diff --git a/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.py b/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.py
index 889188f..e7638db 100644
--- a/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.py
+++ b/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-mi.exp b/gdb/testsuite/gdb.python/py-mi.exp
index dad909a..28d63c1 100644
--- a/gdb/testsuite/gdb.python/py-mi.exp
+++ b/gdb/testsuite/gdb.python/py-mi.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
return -1
}
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
return
}
@@ -345,7 +345,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}-cxx" \
return -1
}
-if {[mi_clean_restart ${binfile}-cxx]} {
+if {[mi_clean_restart ${::testfile}-cxx]} {
return
}
diff --git a/gdb/testsuite/gdb.python/py-missing-debug.c b/gdb/testsuite/gdb.python/py-missing-debug.c
index ca3e5ab..df3db4d 100644
--- a/gdb/testsuite/gdb.python/py-missing-debug.c
+++ b/gdb/testsuite/gdb.python/py-missing-debug.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-missing-debug.exp b/gdb/testsuite/gdb.python/py-missing-debug.exp
index dfc0a46..f028711 100644
--- a/gdb/testsuite/gdb.python/py-missing-debug.exp
+++ b/gdb/testsuite/gdb.python/py-missing-debug.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-missing-debug.py b/gdb/testsuite/gdb.python/py-missing-debug.py
index c1bafdd..c018d4d 100644
--- a/gdb/testsuite/gdb.python/py-missing-debug.py
+++ b/gdb/testsuite/gdb.python/py-missing-debug.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-missing-objfile-lib.c b/gdb/testsuite/gdb.python/py-missing-objfile-lib.c
index 8d740b4..179c329 100644
--- a/gdb/testsuite/gdb.python/py-missing-objfile-lib.c
+++ b/gdb/testsuite/gdb.python/py-missing-objfile-lib.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-missing-objfile.c b/gdb/testsuite/gdb.python/py-missing-objfile.c
index 953e1c0..c5e8a63 100644
--- a/gdb/testsuite/gdb.python/py-missing-objfile.c
+++ b/gdb/testsuite/gdb.python/py-missing-objfile.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-missing-objfile.exp b/gdb/testsuite/gdb.python/py-missing-objfile.exp
index 8afd547..2cc7dc8 100644
--- a/gdb/testsuite/gdb.python/py-missing-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-missing-objfile.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -79,6 +79,16 @@ proc setup_debugdir { dirname files } {
# executable (when EXEC_LOADED is true) and/or the library (when LIB_LOADED
# is true).
proc check_loaded_debug { exec_loaded lib_loaded } {
+ set re_warn \
+ [string_to_regexp \
+ "Warning: the current language does not match this frame."]
+ set cmd "set lang c"
+ gdb_test_multiple $cmd "" {
+ -re -wrap "${cmd}(\r\n$re_warn)?" {
+ pass $gdb_test_name
+ }
+ }
+
if { $exec_loaded } {
gdb_test "whatis global_exec_var" "^type = volatile struct exec_type"
@@ -124,7 +134,7 @@ proc clean_restart_load_python {} {
# For sanity, lets check that we can load the specify the executable
# and then load the core-file the easy way.
with_test_prefix "initial sanity check" {
- clean_restart $binfile
+ clean_restart $::testfile
load_core_file
check_loaded_debug true true
}
@@ -173,6 +183,11 @@ with_test_prefix "no objfiles available" {
check_loaded_debug false false
}
+# The following tests assume that the build-ids of binfile and libfile can be
+# found in the core file.
+require {expect_build_id_in_core_file $binfile}
+require {expect_build_id_in_core_file $libfile}
+
with_test_prefix "all objfiles available" {
# Another sanity check that GDB can find the files via the
# debug-file-directory.
diff --git a/gdb/testsuite/gdb.python/py-missing-objfile.py b/gdb/testsuite/gdb.python/py-missing-objfile.py
index 5bb8179..5efc36a 100644
--- a/gdb/testsuite/gdb.python/py-missing-objfile.py
+++ b/gdb/testsuite/gdb.python/py-missing-objfile.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-nested-maps.c b/gdb/testsuite/gdb.python/py-nested-maps.c
index 6cd78f7..a9480a3 100644
--- a/gdb/testsuite/gdb.python/py-nested-maps.c
+++ b/gdb/testsuite/gdb.python/py-nested-maps.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-nested-maps.exp b/gdb/testsuite/gdb.python/py-nested-maps.exp
index 752b3a3..884b259 100644
--- a/gdb/testsuite/gdb.python/py-nested-maps.exp
+++ b/gdb/testsuite/gdb.python/py-nested-maps.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2024 Free Software Foundation, Inc.
+# Copyright (C) 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-nested-maps.py b/gdb/testsuite/gdb.python/py-nested-maps.py
index ac04bbf..8d65fd8 100644
--- a/gdb/testsuite/gdb.python/py-nested-maps.py
+++ b/gdb/testsuite/gdb.python/py-nested-maps.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2024 Free Software Foundation, Inc.
+# Copyright (C) 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-objfile-script-gdb.py b/gdb/testsuite/gdb.python/py-objfile-script-gdb.py
index 17a4217..8666074 100644
--- a/gdb/testsuite/gdb.python/py-objfile-script-gdb.py
+++ b/gdb/testsuite/gdb.python/py-objfile-script-gdb.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-objfile-script.c b/gdb/testsuite/gdb.python/py-objfile-script.c
index ad9e421..1ce505d 100644
--- a/gdb/testsuite/gdb.python/py-objfile-script.c
+++ b/gdb/testsuite/gdb.python/py-objfile-script.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-objfile-script.exp b/gdb/testsuite/gdb.python/py-objfile-script.exp
index c8cd6ee..4e6f5b6 100644
--- a/gdb/testsuite/gdb.python/py-objfile-script.exp
+++ b/gdb/testsuite/gdb.python/py-objfile-script.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ gdb_load ${binfile}
# Verify gdb loaded the script.
gdb_test "info auto-load python-scripts" "Yes.*${testfile}-gdb.py.*"
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.python/py-objfile.c b/gdb/testsuite/gdb.python/py-objfile.c
index 1c38ff9..d721e0c 100644
--- a/gdb/testsuite/gdb.python/py-objfile.c
+++ b/gdb/testsuite/gdb.python/py-objfile.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ int global_var = 42;
static int __attribute__ ((used)) static_var = 50;
int
-main ()
+main (void)
{
int some_var = 0;
return 0;
diff --git a/gdb/testsuite/gdb.python/py-objfile.exp b/gdb/testsuite/gdb.python/py-objfile.exp
index 2f5b775..ce4e37a 100644
--- a/gdb/testsuite/gdb.python/py-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-objfile.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -68,7 +68,7 @@ gdb_test "python print (gdb.lookup_objfile (\"${testfile}\").lookup_static_symbo
"None" "lookup_static_symbol can handle nonexistent symbol"
set binfile_build_id [get_build_id $binfile]
-if [string compare $binfile_build_id ""] {
+if {[string compare $binfile_build_id ""]} {
verbose -log "binfile_build_id = $binfile_build_id"
gdb_test "python print (objfile.build_id)" "$binfile_build_id" \
"Get objfile build id"
@@ -119,7 +119,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile}2 ${srcfile} {nodebug l
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
@@ -144,7 +144,8 @@ gdb_test "python print (sep_objfile.owner.filename)" "${testfile}2" \
gdb_test "python print (sep_objfile.owner.username)" "${testfile}2" \
"Test user-name of owner of separate debug file"
-gdb_test "p main" "= {int \\(\\)} $hex <main>" \
+set re_prototype [string_to_regexp "int (void)"]
+gdb_test "p main" "= {$re_prototype} $hex <main>" \
"print main with debug info"
# Separate debug files are not findable.
@@ -157,12 +158,13 @@ if { [get_python_valueof "sep_objfile.build_id" "None"] != "None" } {
# An objfile that was a symlink to a differently named file is still
# findable with its original name.
# On Windows we don't have proper symlinks, so skip this.
-if ![ishost *-*-mingw*] {
+if {![ishost *-*-mingw*]} {
set symlink_binary [standard_output_file "symlink-binary"]
remote_exec host "rm -f ${symlink_binary}"
remote_exec host "ln -sf ${testfile} ${symlink_binary}"
- if [remote_file host exists "${symlink_binary}"] {
- clean_restart "${symlink_binary}"
+ if {[remote_file host exists "${symlink_binary}"]} {
+ clean_restart
+ gdb_load "${symlink_binary}"
gdb_test "python print (gdb.lookup_objfile (\"${symlink_binary}\").filename)" \
"${testfile}" "gdb.lookup_objfile of symlinked binary"
}
diff --git a/gdb/testsuite/gdb.python/py-parameter-prefix.exp b/gdb/testsuite/gdb.python/py-parameter-prefix.exp
new file mode 100644
index 0000000..eb09fe7
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-parameter-prefix.exp
@@ -0,0 +1,382 @@
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This file is part of the GDB testsuite. It tests
+# gdb.ParameterPrefix. See each of the test procs for a full
+# description of what is being tested.
+
+load_lib gdb-python.exp
+
+require allow_python_tests
+
+clean_restart
+
+# Helper proc to generate the output of 'show PREFIX' commands for the
+# case where the prefix command doesn't handle unknown sub-commands.
+# In this case GDB will list the value of every sub-command under
+# PREFIX.
+proc make_show_prefix_re { prefix } {
+ return "$prefix param-1:\\s+The current value of '$prefix param-1' is \"off\"\\."
+}
+
+# Helper proc to generate the help text that describes all of the sub
+# commands under PREFIX. The MODE is either 'set' or 'show'. This
+# output will appear for 'help MODE PREFIX' and also for 'set PREFIX'.
+proc make_sub_cmd_help_re { mode prefix } {
+ if { $mode == "set" } {
+ set word "Set"
+ } else {
+ set word "Show"
+ }
+
+ return \
+ [multi_line \
+ "List of \"$mode $prefix\" subcommands:" \
+ "" \
+ "$mode $prefix param-1 -- $word the current value of '$prefix param-1'\\." \
+ "" \
+ "Type \"help $mode $prefix\" followed by subcommand name for full documentation\\." \
+ "Type \"apropos word\" to search for commands related to \"word\"\\." \
+ "Type \"apropos -v word\" for full documentation of commands related to \"word\"\\." \
+ "Command name abbreviations are allowed if unambiguous\\."]
+}
+
+# Helper proc to generate the output of 'help MODE PREFIX', where MODE
+# will be either 'set' or 'show'. The HELP_TEXT is the expected help
+# text for this prefix command, this should not be a regexp, as this
+# proc converts the text to a regexp.
+#
+# Return a single regexp which should match the output.
+proc make_help_re { mode prefix help_text } {
+ set help_re [string_to_regexp $help_text]
+
+ return \
+ [multi_line \
+ "$help_re" \
+ "" \
+ [make_sub_cmd_help_re $mode $prefix]]
+}
+
+# Create gdb.ParameterPrefix without using a sub-class, both with, and
+# without a doc string. For the doc string case, test single line,
+# and multi-line doc strings.
+proc_with_prefix test_basic_usage {} {
+ gdb_test_multiline "some basic ParameterPrefix usage" \
+ "python" "" \
+ "gdb.ParameterPrefix('prefix-1', gdb.COMMAND_NONE)" "" \
+ "gdb.Parameter('prefix-1 param-1', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "gdb.Parameter('prefix-1 param-1', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "gdb.ParameterPrefix('prefix-2', gdb.COMMAND_NONE," "" \
+ " \"\"\"This is prefix-2 help string.\"\"\")" "" \
+ "gdb.Parameter('prefix-2 param-1', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "gdb.ParameterPrefix('prefix-3', gdb.COMMAND_NONE," "" \
+ " \"\"\"This is prefix-3 help string." "" \
+ " " "" \
+ " This help text spans multiple lines.\"\"\")" "" \
+ "gdb.Parameter('prefix-3 param-1', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "end"
+
+ foreach mode { "set" "show" } {
+ gdb_test "help $mode prefix-1" \
+ [make_help_re $mode "prefix-1" \
+ "This command is not documented."]
+
+ gdb_test "help $mode prefix-2" \
+ [make_help_re $mode "prefix-2" \
+ "This is prefix-2 help string."]
+
+ gdb_test "help $mode prefix-3" \
+ [make_help_re $mode "prefix-3" \
+ [multi_line \
+ "This is prefix-3 help string." \
+ "" \
+ "This help text spans multiple lines."]]
+
+ foreach prefix { prefix-1 prefix-2 prefix-3 } {
+ gdb_test "$mode $prefix xxx" \
+ "^Undefined $mode $prefix command: \"xxx\"\\. Try \"help $mode $prefix\"\\."
+ }
+ }
+
+ foreach prefix { prefix-1 prefix-2 prefix-3 } {
+ gdb_test "set $prefix" \
+ [make_sub_cmd_help_re "set" $prefix]
+
+ gdb_test "show $prefix" \
+ [make_show_prefix_re $prefix]
+ }
+}
+
+# Create a sub-class of gdb.ParameterPrefix, but don't do anything
+# particularly interesting. Again test the with and without
+# documentation string cases.
+proc_with_prefix test_simple_sub_class {} {
+ gdb_test_multiline "some basic ParameterPrefix usage" \
+ "python" "" \
+ "class BasicParamPrefix(gdb.ParameterPrefix):" "" \
+ " def __init__(self, name):" "" \
+ " super().__init__(name, gdb.COMMAND_NONE)" "" \
+ "BasicParamPrefix('prefix-4')" "" \
+ "gdb.Parameter('prefix-4 param-1', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "class BasicParamPrefixWithSingleLineDoc(gdb.ParameterPrefix):" "" \
+ " \"\"\"This is a single line doc string.\"\"\"" "" \
+ " def __init__(self, name):" "" \
+ " super().__init__(name, gdb.COMMAND_NONE)" "" \
+ "BasicParamPrefixWithSingleLineDoc('prefix-5')" "" \
+ "gdb.Parameter('prefix-5 param-1', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "class BasicParamPrefixWithMultiLineDoc(gdb.ParameterPrefix):" "" \
+ " \"\"\"This is a multi line doc string." "" \
+ " " "" \
+ " The rest of the doc string is here.\"\"\"" "" \
+ " def __init__(self, name):" "" \
+ " super().__init__(name, gdb.COMMAND_NONE)" "" \
+ "BasicParamPrefixWithMultiLineDoc('prefix-6')" "" \
+ "gdb.Parameter('prefix-6 param-1', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "class BasicParamPrefixWithDocParameter(gdb.ParameterPrefix):" "" \
+ " \"\"\"This is an unsused doc string.\"\"\"" "" \
+ " def __init__(self, name, doc):" "" \
+ " super().__init__(name, gdb.COMMAND_NONE, doc)" "" \
+ "BasicParamPrefixWithDocParameter('prefix-7'," "" \
+ " \"\"\"The doc string text is here.\"\"\")" "" \
+ "gdb.Parameter('prefix-7 param-1', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "end"
+
+ foreach mode { "set" "show" } {
+ gdb_test "help $mode prefix-4" \
+ [make_help_re $mode "prefix-4" \
+ "This command is not documented."]
+
+ gdb_test "help $mode prefix-5" \
+ [make_help_re $mode "prefix-5" \
+ "This is a single line doc string."]
+
+ gdb_test "help $mode prefix-6" \
+ [make_help_re $mode "prefix-6" \
+ [multi_line \
+ "This is a multi line doc string." \
+ "" \
+ "The rest of the doc string is here."]]
+
+ gdb_test "help $mode prefix-7" \
+ [make_help_re $mode "prefix-7" \
+ "The doc string text is here."]
+
+ foreach prefix { prefix-4 prefix-5 prefix-6 prefix-7 } {
+ gdb_test "$mode $prefix xxx" \
+ "^Undefined $mode $prefix command: \"xxx\"\\. Try \"help $mode $prefix\"\\."
+ }
+ }
+
+ foreach prefix { prefix-4 prefix-5 prefix-6 prefix-7 } {
+ gdb_test "set $prefix" \
+ [make_sub_cmd_help_re "set" $prefix]
+
+ gdb_test "show $prefix" \
+ [make_show_prefix_re $prefix]
+ }
+}
+
+# Create a sub-class of gdb.ParameterPrefix, and make use of
+# 'invoke_set' and 'invoke_show'. Test that the invoke method is
+# executed when expected, and that, by default, these invoke methods
+# repeat when the user issues an empty command.
+proc_with_prefix test_prefix_with_invoke {} {
+ gdb_test_multiline "ParameterPrefix with invoke_set" \
+ "python" "" \
+ "class PrefixWithInvokeSet(gdb.ParameterPrefix):" "" \
+ " def __init__(self, name):" "" \
+ " super().__init__(name, gdb.COMMAND_NONE)" "" \
+ " def invoke_set(self, args, from_tty):" "" \
+ " print(f\"invoke_set (a): \\\"{args}\\\" {from_tty}\")" "" \
+ "PrefixWithInvokeSet('prefix-8')" "" \
+ "gdb.Parameter('prefix-8 param-1', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "class PrefixWithInvokeShow(gdb.ParameterPrefix):" "" \
+ " def __init__(self, name):" "" \
+ " super().__init__(name, gdb.COMMAND_NONE)" "" \
+ " def invoke_show(self, args, from_tty):" "" \
+ " print(f\"invoke_show (b): \\\"{args}\\\" {from_tty}\")" "" \
+ "PrefixWithInvokeShow('prefix-9')" "" \
+ "gdb.Parameter('prefix-9 param-1', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "class PrefixWithBothInvoke(gdb.ParameterPrefix):" "" \
+ " def __init__(self, name):" "" \
+ " super().__init__(name, gdb.COMMAND_NONE)" "" \
+ " def invoke_set(self, args, from_tty):" "" \
+ " print(f\"invoke_set (c): \\\"{args}\\\" {from_tty}\")" "" \
+ " def invoke_show(self, args, from_tty):" "" \
+ " print(f\"invoke_show (d): \\\"{args}\\\" {from_tty}\")" "" \
+ "PrefixWithBothInvoke('prefix-10')" "" \
+ "gdb.Parameter('prefix-10 param-1', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "end"
+
+ gdb_test "set prefix-8 xxx yyy" \
+ "^invoke_set \\(a\\): \"xxx yyy\" True"
+
+ send_gdb "\n"
+ gdb_test "" "^\r\ninvoke_set \\(a\\): \"xxx yyy\" True" \
+ "repeat set prefix-8 xxx yyy"
+
+ gdb_test "show prefix-8 xxx yyy" \
+ "^Undefined show prefix-8 command: \"xxx yyy\"\\. Try \"help show prefix-8\"\\."
+
+ gdb_test "set prefix-9 xxx yyy" \
+ "^Undefined set prefix-9 command: \"xxx yyy\"\\. Try \"help set prefix-9\"\\."
+
+ gdb_test "show prefix-9 xxx yyy" \
+ "^invoke_show \\(b\\): \"xxx yyy\" True"
+
+ send_gdb "\n"
+ gdb_test "" "^\r\ninvoke_show \\(b\\): \"xxx yyy\" True" \
+ "repeat show prefix-9 xxx yyy"
+
+ gdb_test "set prefix-10 xxx yyy" \
+ "^invoke_set \\(c\\): \"xxx yyy\" True"
+
+ send_gdb "\n"
+ gdb_test "" "^\r\ninvoke_set \\(c\\): \"xxx yyy\" True" \
+ "repeat set prefix-10 xxx yyy"
+
+ gdb_test "show prefix-10 xxx yyy" \
+ "^invoke_show \\(d\\): \"xxx yyy\" True"
+
+ send_gdb "\n"
+ gdb_test "" "^\r\ninvoke_show \\(d\\): \"xxx yyy\" True" \
+ "repeat show prefix-10 xxx yyy"
+
+ gdb_test "set prefix-8" \
+ "^invoke_set \\(a\\): \"\" True"
+
+ gdb_test "show prefix-8" \
+ [make_show_prefix_re "prefix-8"]
+
+ gdb_test "set prefix-9" \
+ [make_sub_cmd_help_re "set" "prefix-9"]
+
+ gdb_test "show prefix-9" \
+ "^invoke_show \\(b\\): \"\" True"
+
+ gdb_test "set prefix-10" \
+ "^invoke_set \\(c\\): \"\" True"
+
+ gdb_test "show prefix-10" \
+ "^invoke_show \\(d\\): \"\" True"
+}
+
+# Create ParameterPrefix sub-classes that make use of the
+# dont_repeat() method. Check that the relevant set/show invoke
+# callback doesn't repeat when an empty command is used.
+proc_with_prefix test_dont_repeat {} {
+ gdb_test_multiline "ParameterPrefix with invoke_set and dont_repeat" \
+ "python" "" \
+ "class PrefixWithInvokeAndDoNotRepeatSet(gdb.ParameterPrefix):" "" \
+ " def __init__(self, name):" "" \
+ " super().__init__(name, gdb.COMMAND_NONE)" "" \
+ " def invoke_set(self, args, from_tty):" "" \
+ " self.dont_repeat()" "" \
+ " print(f\"invoke_set: \\\"{args}\\\" {from_tty}\")" "" \
+ " def invoke_show(self, args, from_tty):" "" \
+ " print(f\"invoke_show: \\\"{args}\\\" {from_tty}\")" "" \
+ "PrefixWithInvokeAndDoNotRepeatSet('prefix-11')" "" \
+ "gdb.Parameter('prefix-11 param-1', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "class PrefixWithInvokeAndDoNotRepeatShow(gdb.ParameterPrefix):" "" \
+ " def __init__(self, name):" "" \
+ " super().__init__(name, gdb.COMMAND_NONE)" "" \
+ " def invoke_set(self, args, from_tty):" "" \
+ " print(f\"invoke_set: \\\"{args}\\\" {from_tty}\")" "" \
+ " def invoke_show(self, args, from_tty):" "" \
+ " self.dont_repeat()" "" \
+ " print(f\"invoke_show: \\\"{args}\\\" {from_tty}\")" "" \
+ "PrefixWithInvokeAndDoNotRepeatShow('prefix-12')" "" \
+ "gdb.Parameter('prefix-12 param-1', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "end"
+
+ gdb_test "set prefix-11 xxx yyy" \
+ "^invoke_set: \"xxx yyy\" True"
+
+ send_gdb "\n"
+ gdb_test "" "^" \
+ "repeat set prefix-11 xxx yyy"
+
+ gdb_test "show prefix-11 xxx yyy" \
+ "^invoke_show: \"xxx yyy\" True"
+
+ send_gdb "\n"
+ gdb_test "" "invoke_show: \"xxx yyy\" True" \
+ "repeat show prefix-11 xxx yyy"
+
+ gdb_test "set prefix-12 xxx yyy" \
+ "^invoke_set: \"xxx yyy\" True"
+
+ send_gdb "\n"
+ gdb_test "" "^\r\ninvoke_set: \"xxx yyy\" True" \
+ "repeat set prefix-12 xxx yyy"
+
+ gdb_test "show prefix-12 xxx yyy" \
+ "^invoke_show: \"xxx yyy\" True"
+
+ send_gdb "\n"
+ gdb_test "" "^" \
+ "repeat show prefix-12 xxx yyy"
+}
+
+# Create a parameter prefixm, and immediately add another prefix under
+# the first. The important thing here is that the second prefix is
+# created into an otherwise empty prefix as this triggered a bug at
+# one point.
+proc_with_prefix test_nested {} {
+ gdb_test_multiline "Create nested parameter prefixes" \
+ "python" "" \
+ "gdb.ParameterPrefix('prefix-13', gdb.COMMAND_NONE)" "" \
+ "gdb.ParameterPrefix('prefix-13 prefix-14', gdb.COMMAND_NONE)" "" \
+ "gdb.Parameter('prefix-13 param-1', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "gdb.Parameter('prefix-13 param-2', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "gdb.Parameter('prefix-13 prefix-14 param-3', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "gdb.Parameter('prefix-13 prefix-14 param-4', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "end" ""
+
+ gdb_test "show prefix-13 prefix-14" \
+ [multi_line \
+ "^prefix-13 prefix-14 param-3: The current value of 'prefix-13 prefix-14 param-3' is \"off\"\\." \
+ "prefix-13 prefix-14 param-4: The current value of 'prefix-13 prefix-14 param-4' is \"off\"\\."]
+
+ gdb_test "show prefix-13" \
+ [multi_line \
+ "^prefix-13 param-1: The current value of 'prefix-13 param-1' is \"off\"\\." \
+ "prefix-13 param-2: The current value of 'prefix-13 param-2' is \"off\"\\." \
+ "prefix-13 prefix-14 param-3: The current value of 'prefix-13 prefix-14 param-3' is \"off\"\\." \
+ "prefix-13 prefix-14 param-4: The current value of 'prefix-13 prefix-14 param-4' is \"off\"\\."]
+
+ gdb_test "set prefix-13 prefix-14" \
+ [multi_line \
+ "" \
+ "set prefix-13 prefix-14 param-3 -- Set the current value of 'prefix-13 prefix-14 param-3'\\." \
+ "set prefix-13 prefix-14 param-4 -- Set the current value of 'prefix-13 prefix-14 param-4'\\." \
+ "" \
+ ".*"]
+
+ gdb_test "set prefix-13" \
+ [multi_line \
+ "" \
+ "set prefix-13 param-1 -- Set the current value of 'prefix-13 param-1'\\." \
+ "set prefix-13 param-2 -- Set the current value of 'prefix-13 param-2'\\." \
+ "set prefix-13 prefix-14 -- This command is not documented\\." \
+ "" \
+ ".*"]
+}
+
+test_basic_usage
+test_simple_sub_class
+test_prefix_with_invoke
+test_dont_repeat
+test_nested
diff --git a/gdb/testsuite/gdb.python/py-parameter.exp b/gdb/testsuite/gdb.python/py-parameter.exp
index 74e4178..a80fa19 100644
--- a/gdb/testsuite/gdb.python/py-parameter.exp
+++ b/gdb/testsuite/gdb.python/py-parameter.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ require allow_python_tests
clean_restart
proc py_param_test_maybe_no_output { command pattern args } {
- if [string length $pattern] {
+ if {[string length $pattern]} {
gdb_test $command $pattern $args
} else {
gdb_test_no_output $command $args
@@ -38,13 +38,17 @@ proc_with_prefix test_directories { } {
# doesn't set search directories on remote host.
set directories ".*\\\$cdir.\\\$cwd"
} else {
- set escaped_directory [string_to_regexp "$::srcdir/$::subdir"]
+ set directory [host_file_normalize "$::srcdir/$::subdir"]
+ set escaped_directory [string_to_regexp $directory]
set directories "$escaped_directory.\\\$cdir.\\\$cwd"
}
gdb_test "python print (gdb.parameter ('directories'))" $directories
}
proc_with_prefix test_data_directory { } {
+ # Proc assumes local host.
+ require {!is_remote host}
+
clean_restart
# Check we can correctly read the data-directory parameter. First,
@@ -187,6 +191,8 @@ proc_with_prefix test_enum_parameter { } {
# Test an color parameter.
proc_with_prefix test_color_parameter { } {
+ require {!is_remote host}
+
global env
with_ansi_styling_terminal {
# This enables 256 colors support and disables colors approximation.
@@ -346,6 +352,91 @@ proc_with_prefix test_really_undocumented_parameter { } {
"test general help"
}
+# Test a parameter in which the __doc__ string is empty or None.
+proc_with_prefix test_empty_doc_parameter {} {
+ gdb_test_multiline "empty __doc__ parameter" \
+ "python" "" \
+ "class EmptyDocParam(gdb.Parameter):" "" \
+ " __doc__ = \"\"" "" \
+ " def __init__(self, name):" "" \
+ " super ().__init__(name, gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ " self.value = True" "" \
+ "test_empty_doc_param = EmptyDocParam('print test-empty-doc-param')" ""\
+ "end"
+
+ # Setting the __doc__ string to empty means GDB will completely
+ # elide it from the output.
+ gdb_test "help set print test-empty-doc-param" \
+ "^Set the current value of 'print test-empty-doc-param'\\."
+
+ gdb_test_multiline "None __doc__ parameter" \
+ "python" "" \
+ "class NoneDocParam(gdb.Parameter):" "" \
+ " __doc__ = None" "" \
+ " def __init__(self, name):" "" \
+ " super ().__init__(name, gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ " self.value = True" "" \
+ "test_none_doc_param = NoneDocParam('print test-none-doc-param')" ""\
+ "end"
+
+ # Setting the __doc__ string to None, or anything else that isn't
+ # a string, causes GDB to use a default string instead.
+ gdb_test "help set print test-none-doc-param" \
+ [multi_line \
+ "^Set the current value of 'print test-none-doc-param'\\." \
+ "This command is not documented\\."]
+}
+
+# Test a parameter in which the set_doc/show_doc strings are either
+# empty, or None.
+proc_with_prefix test_empty_set_show_doc_parameter {} {
+ gdb_test_multiline "empty set/show doc parameter" \
+ "python" "" \
+ "class EmptySetShowParam(gdb.Parameter):" "" \
+ " set_doc = \"\"" "" \
+ " show_doc = \"\"" "" \
+ " def __init__(self, name):" "" \
+ " super ().__init__(name, gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ " self.value = True" "" \
+ "test_empty_set_show_param = EmptySetShowParam('print test-empty-set-show-param')" ""\
+ "end"
+
+ # Setting the set_doc/show_doc string to empty means GDB will use
+ # a suitable default string.
+ gdb_test "help set print test-empty-set-show-param" \
+ [multi_line \
+ "^Set the current value of 'print test-empty-set-show-param'\\." \
+ "This command is not documented\\."]
+
+ gdb_test "help show print test-empty-set-show-param" \
+ [multi_line \
+ "^Show the current value of 'print test-empty-set-show-param'\\." \
+ "This command is not documented\\."]
+
+ gdb_test_multiline "None set/show doc parameter" \
+ "python" "" \
+ "class NoneSetShowParam(gdb.Parameter):" "" \
+ " set_doc = None" "" \
+ " show_doc = None" "" \
+ " def __init__(self, name):" "" \
+ " super ().__init__(name, gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ " self.value = True" "" \
+ "test_none_set_show_param = NoneSetShowParam('print test-none-set-show-param')" ""\
+ "end"
+
+ # Setting the set_doc/show_doc string to None (or any non-string
+ # value) means GDB will use a suitable default string.
+ gdb_test "help set print test-none-set-show-param" \
+ [multi_line \
+ "^Set the current value of 'print test-none-set-show-param'\\." \
+ "This command is not documented\\."]
+
+ gdb_test "help show print test-none-set-show-param" \
+ [multi_line \
+ "^Show the current value of 'print test-none-set-show-param'\\." \
+ "This command is not documented\\."]
+}
+
# Test deprecated API. Do not use in your own implementations.
proc_with_prefix test_deprecated_api_parameter { } {
clean_restart
@@ -627,6 +718,38 @@ proc_with_prefix test_throwing_parameter { } {
"gdb.GdbError does not show Python stack"
}
+# Some parameters are per inferior. The value returned by gdb.parameter for
+# them should be dependent on which is the current inferior.
+proc_with_prefix test_per_inferior_parameters { } {
+ clean_restart
+
+ # Add a second inferior.
+ gdb_test "add-inferior" "Added inferior 2"
+
+ # Set some parameters on each inferior.
+ foreach_with_prefix inf {1 2} {
+ gdb_test "inferior ${inf}" "Switching to inferior ${inf}.*" \
+ "switch to inferior ${inf} before show"
+ gdb_test_no_output "set inferior-tty /inf${inf}-tty"
+ gdb_test_no_output "set cwd /inf${inf}-cwd"
+ gdb_test_no_output "set args /inf${inf}-args"
+ gdb_test_no_output "set remote exec-file /inf${inf}-ref"
+ # Outputs a warning, ignore it.
+ gdb_test "set tdesc filename /inf${inf}-tf"
+ }
+
+ # Check the values on each inferior.
+ foreach_with_prefix inf {1 2} {
+ gdb_test "inferior ${inf}" "Switching to inferior ${inf}.*" \
+ "switch to inferior ${inf} before set"
+ gdb_test "python print(gdb.parameter('inferior-tty'))" "/inf${inf}-tty"
+ gdb_test "python print(gdb.parameter('cwd'))" "/inf${inf}-cwd"
+ gdb_test "python print(gdb.parameter('args'))" "/inf${inf}-args"
+ gdb_test "python print(gdb.parameter('remote exec-file'))" "/inf${inf}-ref"
+ gdb_test "python print(gdb.parameter('tdesc filename'))" "/inf${inf}-tf"
+ }
+}
+
proc_with_prefix test_language {} {
gdb_test "python print(gdb.parameter('language'))" "auto" \
"print language parameter"
@@ -669,6 +792,104 @@ proc_with_prefix test_ambiguous_parameter {} {
"Parameter .* is ambiguous.*Error occurred in Python.*"
gdb_test "python print(gdb.parameter('test-ambiguous-value-1a'))" \
"Could not find parameter.*Error occurred in Python.*"
+
+ # Create command prefixs 'set foo1' and 'show foo1'.
+ gdb_test_no_output "python gdb.Command('set foo1', gdb.COMMAND_NONE, prefix=True)"
+ gdb_test_no_output "python gdb.Command('show foo1', gdb.COMMAND_NONE, prefix=True)"
+
+ # Create a parameter under 'foo1', but use a truncated prefix. At
+ # this point though, the prefix is not ambiguous.
+ gdb_test_no_output "python gdb.Parameter('foo bar', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)"
+ gdb_test "python print(gdb.parameter('foo1 bar'))" "False"
+
+ # Create another prefix command, similar in name to the first.
+ gdb_test_no_output "python gdb.Command('set foo2', gdb.COMMAND_NONE, prefix=True)"
+ gdb_test_no_output "python gdb.Command('show foo2', gdb.COMMAND_NONE, prefix=True)"
+
+ # An attempt to create a parameter using an ambiguous prefix will give an error.
+ gdb_test "python gdb.Parameter('foo baz', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" \
+ [multi_line \
+ "Python Exception <class 'RuntimeError'>: Could not find command prefix foo\\." \
+ "Error occurred in Python: Could not find command prefix foo\\."]
+}
+
+# Check that creating a gdb.Parameter with an unknown command prefix results in an error.
+proc_with_prefix test_unknown_prefix {} {
+ gdb_test_multiline "create parameter" \
+ "python" "" \
+ "class UnknownPrefixParam(gdb.Parameter):" "" \
+ " def __init__ (self, name):" "" \
+ " super().__init__ (name, gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ " self.value = True" "" \
+ "end"
+
+ foreach prefix { "unknown-prefix" "style unknown-prefix" "style disassembler unknown-prefix"} {
+ gdb_test "python UnknownPrefixParam('$prefix new-param')" \
+ [multi_line \
+ "Python Exception <class 'RuntimeError'>: Could not find command prefix $prefix\\." \
+ "Error occurred in Python: Could not find command prefix $prefix\\."]
+ }
+}
+
+# Test the default behaviour of a set/show parameter prefix command.
+proc_with_prefix test_set_show_parameters {} {
+ # This first set/show prefix command doesn't have an invoke
+ # method. As such, GDB installs the default invoke behaviour; set
+ # prints the full list of sub-commands, and show prints all the
+ # sub-command values.
+ gdb_test_multiline "Setup set/show parameter prefix with no invoke" \
+ "python" "" \
+ "class TestParamPrefix(gdb.Command):" "" \
+ " \"\"\"TestParamPrefix documentation string.\"\"\"" "" \
+ " def __init__(self, name):" "" \
+ " super().__init__(name, gdb.COMMAND_NONE, prefix = True)" "" \
+ "TestParamPrefix('set test-prefix')" "" \
+ "TestParamPrefix('show test-prefix')" "" \
+ "gdb.Parameter('test-prefix param-1', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "gdb.Parameter('test-prefix param-2', gdb.COMMAND_NONE, gdb.PARAM_INTEGER)" "" \
+ "gdb.Parameter('test-prefix param-3', gdb.COMMAND_NONE, gdb.PARAM_STRING)" "" \
+ "end"
+
+ gdb_test "set test-prefix" \
+ [multi_line \
+ "List of \"set test-prefix\" subcommands:" \
+ "" \
+ "set test-prefix param-1 -- Set the current value of 'test-prefix param-1'." \
+ "set test-prefix param-2 -- Set the current value of 'test-prefix param-2'." \
+ "set test-prefix param-3 -- Set the current value of 'test-prefix param-3'." \
+ "" \
+ "Type \"help set test-prefix\" followed by subcommand name for full documentation\\." \
+ "Type \"apropos word\" to search for commands related to \"word\"\\." \
+ "Type \"apropos -v word\" for full documentation of commands related to \"word\"\\." \
+ "Command name abbreviations are allowed if unambiguous\\."]
+
+ gdb_test "show test-prefix" \
+ [multi_line \
+ "test-prefix param-1: The current value of 'test-prefix param-1' is \"off\"\\." \
+ "test-prefix param-2: The current value of 'test-prefix param-2' is \"0\"\\." \
+ "test-prefix param-3: The current value of 'test-prefix param-3' is \"\"\\."]
+
+ # This next set/show prefix has an invoke method, which will be
+ # called instead of the default behaviour tested above.
+ gdb_test_multiline "Setup set/show parameter prefix with invoke" \
+ "python" "" \
+ "class TestParamPrefix(gdb.Command):" "" \
+ " \"\"\"TestParamPrefix documentation string.\"\"\"" "" \
+ " def __init__(self, name, mode):" "" \
+ " self._mode = mode" "" \
+ " super().__init__(self._mode + ' ' + name, gdb.COMMAND_NONE, prefix = True)" "" \
+ " def invoke(self, args, from_tty):" "" \
+ " print('invoke -- ' + self._mode)" "" \
+ "TestParamPrefix('test-prefix-2', 'set')" "" \
+ "TestParamPrefix('test-prefix-2', 'show')" "" \
+ "gdb.Parameter('test-prefix-2 param-1', gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)" "" \
+ "gdb.Parameter('test-prefix-2 param-2', gdb.COMMAND_NONE, gdb.PARAM_INTEGER)" "" \
+ "gdb.Parameter('test-prefix-2 param-3', gdb.COMMAND_NONE, gdb.PARAM_STRING)" "" \
+ "end"
+
+ gdb_test "set test-prefix-2" "^invoke -- set"
+
+ gdb_test "show test-prefix-2" "^invoke -- show"
}
test_directories
@@ -679,11 +900,16 @@ test_color_parameter
test_file_parameter
test_undocumented_parameter
test_really_undocumented_parameter
+test_empty_doc_parameter
+test_empty_set_show_doc_parameter
test_deprecated_api_parameter
test_gdb_parameter
test_integer_parameter
test_throwing_parameter
+test_per_inferior_parameters
test_language
test_ambiguous_parameter
+test_unknown_prefix
+test_set_show_parameters
rename py_param_test_maybe_no_output ""
diff --git a/gdb/testsuite/gdb.python/py-pending-frame-level.c b/gdb/testsuite/gdb.python/py-pending-frame-level.c
index dba64b8..56734ad 100644
--- a/gdb/testsuite/gdb.python/py-pending-frame-level.c
+++ b/gdb/testsuite/gdb.python/py-pending-frame-level.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-pending-frame-level.exp b/gdb/testsuite/gdb.python/py-pending-frame-level.exp
index dcefdce..4eb82c5 100644
--- a/gdb/testsuite/gdb.python/py-pending-frame-level.exp
+++ b/gdb/testsuite/gdb.python/py-pending-frame-level.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-pending-frame-level.py b/gdb/testsuite/gdb.python/py-pending-frame-level.py
index 7742fda..8a9783b 100644
--- a/gdb/testsuite/gdb.python/py-pending-frame-level.py
+++ b/gdb/testsuite/gdb.python/py-pending-frame-level.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-pp-cast.c b/gdb/testsuite/gdb.python/py-pp-cast.c
index be665bb..dcd4619 100644
--- a/gdb/testsuite/gdb.python/py-pp-cast.c
+++ b/gdb/testsuite/gdb.python/py-pp-cast.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-pp-cast.exp b/gdb/testsuite/gdb.python/py-pp-cast.exp
index 61c2fba..917547c 100644
--- a/gdb/testsuite/gdb.python/py-pp-cast.exp
+++ b/gdb/testsuite/gdb.python/py-pp-cast.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto break_function] {
+if {![runto break_function]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-pp-cast.py b/gdb/testsuite/gdb.python/py-pp-cast.py
index c071920..515aa77 100644
--- a/gdb/testsuite/gdb.python/py-pp-cast.py
+++ b/gdb/testsuite/gdb.python/py-pp-cast.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-pp-integral.c b/gdb/testsuite/gdb.python/py-pp-integral.c
index 1e13fc1..2c3afa1 100644
--- a/gdb/testsuite/gdb.python/py-pp-integral.c
+++ b/gdb/testsuite/gdb.python/py-pp-integral.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-pp-integral.exp b/gdb/testsuite/gdb.python/py-pp-integral.exp
index 0635e05..45645f9 100644
--- a/gdb/testsuite/gdb.python/py-pp-integral.exp
+++ b/gdb/testsuite/gdb.python/py-pp-integral.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto tick_tock] {
+if {![runto tick_tock]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-pp-integral.py b/gdb/testsuite/gdb.python/py-pp-integral.py
index 089ca5b..a87736c 100644
--- a/gdb/testsuite/gdb.python/py-pp-integral.py
+++ b/gdb/testsuite/gdb.python/py-pp-integral.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-pp-maint.c b/gdb/testsuite/gdb.python/py-pp-maint.c
index 3ef4f10..f40bbe5 100644
--- a/gdb/testsuite/gdb.python/py-pp-maint.c
+++ b/gdb/testsuite/gdb.python/py-pp-maint.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-pp-maint.exp b/gdb/testsuite/gdb.python/py-pp-maint.exp
index 1ee206c..bd26b91 100644
--- a/gdb/testsuite/gdb.python/py-pp-maint.exp
+++ b/gdb/testsuite/gdb.python/py-pp-maint.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -72,10 +72,10 @@ gdb_test "enable pretty-printer" \
"second enable of all pretty printers"
gdb_test "disable pretty-printer global lookup_function_lookup_test" \
- "1 printer disabled.*[expr $num_pp - 1] of $num_pp printers enabled"
+ "1 printer disabled.*[expr {$num_pp - 1}] of $num_pp printers enabled"
gdb_test "disable pretty-printer global pp-test;.*" \
- "[expr 5] printers disabled.*0 of $num_pp printers enabled"
+ "[expr {$num_pp - 1}] printers disabled.*0 of $num_pp printers enabled"
gdb_test "info pretty-printer global .*function" \
{.*function_lookup_test \[disabled\].*} \
@@ -101,10 +101,10 @@ gdb_test "enable pretty-printer global pp-test" \
"0 printers enabled.*1 of $num_pp printers enabled"
gdb_test "enable pretty-printer global pp-test;.*ss.*" \
- "2 printers enabled.*[expr $num_pp - 3] of $num_pp printers enabled"
+ "2 printers enabled.*[expr {$num_pp - 3}] of $num_pp printers enabled"
gdb_test "enable pretty-printer global pp-test;.*s.*" \
- "2 printers enabled.*[expr $num_pp - 1] of $num_pp printers enabled"
+ "2 printers enabled.*[expr {$num_pp - 1}] of $num_pp printers enabled"
gdb_test "enable pretty-printer global pp-test;.*" \
"1 printer enabled.*$num_pp of $num_pp printers enabled"
diff --git a/gdb/testsuite/gdb.python/py-pp-maint.py b/gdb/testsuite/gdb.python/py-pp-maint.py
index 91c193f..8b96cc0 100644
--- a/gdb/testsuite/gdb.python/py-pp-maint.py
+++ b/gdb/testsuite/gdb.python/py-pp-maint.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-pp-re-notag.c b/gdb/testsuite/gdb.python/py-pp-re-notag.c
index 1e13fc1..2c3afa1 100644
--- a/gdb/testsuite/gdb.python/py-pp-re-notag.c
+++ b/gdb/testsuite/gdb.python/py-pp-re-notag.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-pp-re-notag.exp b/gdb/testsuite/gdb.python/py-pp-re-notag.exp
index 0635e05..45645f9 100644
--- a/gdb/testsuite/gdb.python/py-pp-re-notag.exp
+++ b/gdb/testsuite/gdb.python/py-pp-re-notag.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto tick_tock] {
+if {![runto tick_tock]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-pp-re-notag.py b/gdb/testsuite/gdb.python/py-pp-re-notag.py
index 00bc5c7..32ea2c9 100644
--- a/gdb/testsuite/gdb.python/py-pp-re-notag.py
+++ b/gdb/testsuite/gdb.python/py-pp-re-notag.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-pp-registration.c b/gdb/testsuite/gdb.python/py-pp-registration.c
index b597f14..5a95917 100644
--- a/gdb/testsuite/gdb.python/py-pp-registration.c
+++ b/gdb/testsuite/gdb.python/py-pp-registration.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-pp-registration.exp b/gdb/testsuite/gdb.python/py-pp-registration.exp
index 4bfdf5e..d0d1fda 100644
--- a/gdb/testsuite/gdb.python/py-pp-registration.exp
+++ b/gdb/testsuite/gdb.python/py-pp-registration.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
set remote_python_file [gdb_remote_download host \
${srcdir}/${subdir}/${testfile}.py]
-if ![runto_main ] {
+if {![runto_main ]} {
return -1
}
@@ -40,7 +40,7 @@ proc prepare_test { } {
clean_restart ${testfile}
set run_to_here [gdb_get_line_number {break to inspect} ${testfile}.c ]
- if ![runto ${testfile}.c:$run_to_here] {
+ if {![runto ${testfile}.c:$run_to_here]} {
return 0
}
@@ -63,7 +63,7 @@ proc test_printers { s_prefix } {
# Test registration with verbose off.
with_test_prefix "verbose off" {
- if ![prepare_test] {
+ if {![prepare_test]} {
return -1
}
@@ -78,7 +78,7 @@ with_test_prefix "verbose off" {
# Test registration with verbose on.
with_test_prefix "verbose on" {
- if ![prepare_test] {
+ if {![prepare_test]} {
return -1
}
@@ -95,7 +95,7 @@ with_test_prefix "verbose on" {
# Exercise the "replace" argument to register_pretty_printer.
with_test_prefix "replace" {
- if ![prepare_test] {
+ if {![prepare_test]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-pp-registration.py b/gdb/testsuite/gdb.python/py-pp-registration.py
index 1b7eff8..e9f3dfb 100644
--- a/gdb/testsuite/gdb.python/py-pp-registration.py
+++ b/gdb/testsuite/gdb.python/py-pp-registration.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-prettyprint-stub-2.cc b/gdb/testsuite/gdb.python/py-prettyprint-stub-2.cc
index 1988cc0..592200b 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint-stub-2.cc
+++ b/gdb/testsuite/gdb.python/py-prettyprint-stub-2.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-prettyprint-stub.cc b/gdb/testsuite/gdb.python/py-prettyprint-stub.cc
index fc453d9..156532f 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint-stub.cc
+++ b/gdb/testsuite/gdb.python/py-prettyprint-stub.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-prettyprint-stub.exp b/gdb/testsuite/gdb.python/py-prettyprint-stub.exp
index 2dab863..1c1d010 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint-stub.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint-stub.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-prettyprint-stub.h b/gdb/testsuite/gdb.python/py-prettyprint-stub.h
index fa18165..cb17cb5 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint-stub.h
+++ b/gdb/testsuite/gdb.python/py-prettyprint-stub.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-prettyprint-stub.py b/gdb/testsuite/gdb.python/py-prettyprint-stub.py
index 2378f55..b66086c 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint-stub.py
+++ b/gdb/testsuite/gdb.python/py-prettyprint-stub.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.c b/gdb/testsuite/gdb.python/py-prettyprint.c
index 312420b..56c19ad 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.c
+++ b/gdb/testsuite/gdb.python/py-prettyprint.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp
index ec2bdc9..be2cecd 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,8 @@ proc run_lang_tests {exefile lang} {
set nl "\[\r\n\]+"
# Start with a fresh gdb.
- clean_restart $exefile
+ clean_restart
+ gdb_load $exefile
if {![runto_main]} {
return
@@ -52,11 +53,11 @@ proc run_lang_tests {exefile lang} {
${srcdir}/${subdir}/${testfile}.py]
gdb_test_no_output "source ${remote_python_file}" "load python file"
-
+
gdb_test "print ss" " = a=< a=<1> b=<$hex>> b=< a=<2> b=<$hex>>"
gdb_test "print ssa\[1\]" " = a=< a=<5> b=<$hex>> b=< a=<6> b=<$hex>>"
gdb_test "print ssa" " = {a=< a=<3> b=<$hex>> b=< a=<4> b=<$hex>>, a=< a=<5> b=<$hex>> b=< a=<6> b=<$hex>>}"
-
+
gdb_test "print arraystruct" " = {$nl *y = 7, *$nl *x = { a=<23> b=<$hex>, a=<24> b=<$hex>} *$nl *}"
# Test that when a pretty-printer returns a gdb.Value in its to_string, we
@@ -192,7 +193,7 @@ with_test_prefix c++ {
# Run various other tests.
-clean_restart $binfile
+clean_restart $::testfile
if {![runto_main]} {
return
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.py b/gdb/testsuite/gdb.python/py-prettyprint.py
index e4ac3e1..21c2569 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.py
+++ b/gdb/testsuite/gdb.python/py-prettyprint.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-progspace-events.c b/gdb/testsuite/gdb.python/py-progspace-events.c
index f8b2909..5c4dd4d 100644
--- a/gdb/testsuite/gdb.python/py-progspace-events.c
+++ b/gdb/testsuite/gdb.python/py-progspace-events.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-progspace-events.exp b/gdb/testsuite/gdb.python/py-progspace-events.exp
index 9dfc757..5ee9977 100644
--- a/gdb/testsuite/gdb.python/py-progspace-events.exp
+++ b/gdb/testsuite/gdb.python/py-progspace-events.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-progspace-events.py b/gdb/testsuite/gdb.python/py-progspace-events.py
index 23c6fc5..3a53fb16 100644
--- a/gdb/testsuite/gdb.python/py-progspace-events.py
+++ b/gdb/testsuite/gdb.python/py-progspace-events.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-progspace.c b/gdb/testsuite/gdb.python/py-progspace.c
index 80fcda0..170249b 100644
--- a/gdb/testsuite/gdb.python/py-progspace.c
+++ b/gdb/testsuite/gdb.python/py-progspace.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-progspace.exp b/gdb/testsuite/gdb.python/py-progspace.exp
index fe46537..822c079 100644
--- a/gdb/testsuite/gdb.python/py-progspace.exp
+++ b/gdb/testsuite/gdb.python/py-progspace.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -76,7 +76,7 @@ gdb_test "python print (blk.end >= ${pc_val})" "True" \
"block end is after \$pc"
# Check what happens when we ask for a block of an invalid address.
-if ![is_address_zero_readable] {
+if {![is_address_zero_readable]} {
gdb_test "python print (gdb.current_progspace ().block_for_pc (0))" "None"
}
diff --git a/gdb/testsuite/gdb.python/py-prompt.c b/gdb/testsuite/gdb.python/py-prompt.c
index c7657d7..6718bb1 100644
--- a/gdb/testsuite/gdb.python/py-prompt.c
+++ b/gdb/testsuite/gdb.python/py-prompt.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-prompt.exp b/gdb/testsuite/gdb.python/py-prompt.exp
index 614fe9d..01176a3 100644
--- a/gdb/testsuite/gdb.python/py-prompt.exp
+++ b/gdb/testsuite/gdb.python/py-prompt.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-rbreak-func2.c b/gdb/testsuite/gdb.python/py-rbreak-func2.c
index fdcece6..085d869 100644
--- a/gdb/testsuite/gdb.python/py-rbreak-func2.c
+++ b/gdb/testsuite/gdb.python/py-rbreak-func2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-rbreak.c b/gdb/testsuite/gdb.python/py-rbreak.c
index 1cc4561..4da4de4 100644
--- a/gdb/testsuite/gdb.python/py-rbreak.c
+++ b/gdb/testsuite/gdb.python/py-rbreak.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-rbreak.exp b/gdb/testsuite/gdb.python/py-rbreak.exp
index dca8731..fe1e0fc 100644
--- a/gdb/testsuite/gdb.python/py-rbreak.exp
+++ b/gdb/testsuite/gdb.python/py-rbreak.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2024 Free Software Foundation, Inc.
+# Copyright (C) 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-read-memory-leak.c b/gdb/testsuite/gdb.python/py-read-memory-leak.c
index 75035cd..0319268 100644
--- a/gdb/testsuite/gdb.python/py-read-memory-leak.c
+++ b/gdb/testsuite/gdb.python/py-read-memory-leak.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-read-memory-leak.exp b/gdb/testsuite/gdb.python/py-read-memory-leak.exp
index 52b072f..0b663d7 100644
--- a/gdb/testsuite/gdb.python/py-read-memory-leak.exp
+++ b/gdb/testsuite/gdb.python/py-read-memory-leak.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,19 +26,9 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-# Skip this test if the tracemalloc module is not available.
-if { ![gdb_py_module_available "tracemalloc"] } {
- unsupported "tracemalloc module not available"
- return
-}
-
-set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
-
-# Source the Python script, this runs the test (which is written
-# completely in Python), and either prints PASS, or throws an
-# exception.
-gdb_test "source ${pyfile}" "PASS" "source python script"
+gdb_py_run_memory_leak_test ${srcdir}/${subdir}/${testfile}.py \
+ "buffers returned by read_memory() deallocates correctly"
diff --git a/gdb/testsuite/gdb.python/py-read-memory-leak.py b/gdb/testsuite/gdb.python/py-read-memory-leak.py
index 430c5c2..89647cf 100644
--- a/gdb/testsuite/gdb.python/py-read-memory-leak.py
+++ b/gdb/testsuite/gdb.python/py-read-memory-leak.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,81 +13,27 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
-import tracemalloc
+import sys
-import gdb
+# Avoid generating
+# src/gdb/testsuite/gdb.python/__pycache__/gdb_leak_detector.cpython-<n>.pyc.
+sys.dont_write_bytecode = True
-# A global variable in which we store a reference to the memory buffer
-# returned from gdb.Inferior.read_memory().
-mem_buf = None
+import gdb_leak_detector
-# A global filters list, we only care about memory allocations
-# originating from this script.
-filters = [tracemalloc.Filter(True, "*" + os.path.basename(__file__))]
+class read_leak_detector(gdb_leak_detector.gdb_leak_detector):
+ def __init__(self):
+ super().__init__(__file__)
+ self.mem_buf = None
+ self.addr = gdb.parse_and_eval("px")
+ self.inf = gdb.inferiors()[0]
+ def allocate(self):
+ self.mem_buf = self.inf.read_memory(self.addr, 4096)
-# Run the test. When CLEAR is True we clear the global INF variable
-# before comparing the before and after memory allocation traces.
-# When CLEAR is False we leave INF set to reference the gdb.Inferior
-# object, thus preventing the gdb.Inferior from being deallocated.
-def test(clear):
- global filters, mem_buf
+ def deallocate(self):
+ self.mem_buf = None
- addr = gdb.parse_and_eval("px")
- inf = gdb.inferiors()[0]
- # Start tracing, and take a snapshot of the current allocations.
- tracemalloc.start()
- snapshot1 = tracemalloc.take_snapshot()
-
- # Read from the inferior, this allocate a memory buffer object.
- mem_buf = inf.read_memory(addr, 4096)
-
- # Possibly clear the global INF variable.
- if clear:
- mem_buf = None
-
- # Now grab a second snapshot of memory allocations, and stop
- # tracing memory allocations.
- snapshot2 = tracemalloc.take_snapshot()
- tracemalloc.stop()
-
- # Filter the snapshots; we only care about allocations originating
- # from this file.
- snapshot1 = snapshot1.filter_traces(filters)
- snapshot2 = snapshot2.filter_traces(filters)
-
- # Compare the snapshots, this leaves only things that were
- # allocated, but not deallocated since the first snapshot.
- stats = snapshot2.compare_to(snapshot1, "traceback")
-
- # Total up all the allocated things.
- total = 0
- for stat in stats:
- total += stat.size_diff
- return total
-
-
-# The first time we run this some global state will be allocated which
-# shows up as memory that is allocated, but not released. So, run the
-# test once and discard the result.
-test(True)
-
-# Now run the test twice, the first time we clear our global reference
-# to the memory buffer object, which should allow Python to deallocate
-# the object. The second time we hold onto the global reference,
-# preventing Python from performing the deallocation.
-bytes_with_clear = test(True)
-bytes_without_clear = test(False)
-
-# The bug that used to exist in GDB was that even when we released the
-# global reference the gdb.Inferior object would not be deallocated.
-if bytes_with_clear > 0:
- raise gdb.GdbError("memory leak when memory buffer should be released")
-if bytes_without_clear == 0:
- raise gdb.GdbError("memory buffer object is no longer allocated")
-
-# Print a PASS message that the test script can see.
-print("PASS")
+read_leak_detector().run()
diff --git a/gdb/testsuite/gdb.python/py-record-btrace-threads.c b/gdb/testsuite/gdb.python/py-record-btrace-threads.c
index 2c2ef32..5058ce1 100644
--- a/gdb/testsuite/gdb.python/py-record-btrace-threads.c
+++ b/gdb/testsuite/gdb.python/py-record-btrace-threads.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-record-btrace-threads.exp b/gdb/testsuite/gdb.python/py-record-btrace-threads.exp
index d723879..4a3b59fb 100644
--- a/gdb/testsuite/gdb.python/py-record-btrace-threads.exp
+++ b/gdb/testsuite/gdb.python/py-record-btrace-threads.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-record-btrace.c b/gdb/testsuite/gdb.python/py-record-btrace.c
index abc0dcf..10c0d41 100644
--- a/gdb/testsuite/gdb.python/py-record-btrace.c
+++ b/gdb/testsuite/gdb.python/py-record-btrace.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-record-btrace.exp b/gdb/testsuite/gdb.python/py-record-btrace.exp
index b035e14..207161d 100644
--- a/gdb/testsuite/gdb.python/py-record-btrace.exp
+++ b/gdb/testsuite/gdb.python/py-record-btrace.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ load_lib gdb-python.exp
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile $srcfile] { return -1 }
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} { return -1 }
if {![runto_main]} {
return -1
@@ -66,8 +66,8 @@ with_test_prefix "prepare record" {
set v [linux_kernel_version]
if { $v != {} } {
set have_xfail \
- [expr [version_compare [list 5 5 0] <= $v] \
- && [version_compare $v < [list 6 1 0]]]
+ [expr {[version_compare [list 5 5 0] <= $v] \
+ && [version_compare $v < [list 6 1 0]]}]
}
set nonl_re \[^\r\n\]
set xfail_re \
diff --git a/gdb/testsuite/gdb.python/py-record-full.c b/gdb/testsuite/gdb.python/py-record-full.c
index abc0dcf..10c0d41 100644
--- a/gdb/testsuite/gdb.python/py-record-full.c
+++ b/gdb/testsuite/gdb.python/py-record-full.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-record-full.exp b/gdb/testsuite/gdb.python/py-record-full.exp
index da38d1c..790e5b3 100644
--- a/gdb/testsuite/gdb.python/py-record-full.exp
+++ b/gdb/testsuite/gdb.python/py-record-full.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ load_lib gdb-python.exp
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile $srcfile] { return -1 }
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} { return -1 }
if {![runto_main]} {
return -1
diff --git a/gdb/testsuite/gdb.python/py-recurse-unwind.c b/gdb/testsuite/gdb.python/py-recurse-unwind.c
index 1ecdaa2..573ee3c 100644
--- a/gdb/testsuite/gdb.python/py-recurse-unwind.c
+++ b/gdb/testsuite/gdb.python/py-recurse-unwind.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-recurse-unwind.exp b/gdb/testsuite/gdb.python/py-recurse-unwind.exp
index 1c22dc2..a1d1462 100644
--- a/gdb/testsuite/gdb.python/py-recurse-unwind.exp
+++ b/gdb/testsuite/gdb.python/py-recurse-unwind.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-recurse-unwind.py b/gdb/testsuite/gdb.python/py-recurse-unwind.py
index 0b0004b..244c693 100644
--- a/gdb/testsuite/gdb.python/py-recurse-unwind.py
+++ b/gdb/testsuite/gdb.python/py-recurse-unwind.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.cc b/gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.cc
index 3403797..e3f71d0 100644
--- a/gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.cc
+++ b/gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.exp b/gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.exp
index 7e6f0d0..2e92756 100644
--- a/gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.exp
+++ b/gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-section-script.c b/gdb/testsuite/gdb.python/py-section-script.c
index 2d465c2..2d08cbc 100644
--- a/gdb/testsuite/gdb.python/py-section-script.c
+++ b/gdb/testsuite/gdb.python/py-section-script.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-section-script.exp b/gdb/testsuite/gdb.python/py-section-script.exp
index 206b8c6..369c887 100644
--- a/gdb/testsuite/gdb.python/py-section-script.exp
+++ b/gdb/testsuite/gdb.python/py-section-script.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -71,13 +71,13 @@ clean_restart
# Get the name of the binfile on the host; on a remote host this means
# stripping off any directory prefix.
-if [is_remote host] {
+if {[is_remote host]} {
set remote_binfile [file tail ${binfile}]
} else {
set remote_binfile ${binfile}
}
-if [ishost *-*-mingw*] {
+if {[ishost *-*-mingw*]} {
set remote_pathsep ";"
} else {
set remote_pathsep ":"
@@ -107,7 +107,7 @@ gdb_test "info auto-load python-scripts ${testfile}" "Yes.*${testfile}.py.*"
gdb_test "info auto-load python-scripts no-script-matches-this" \
"No auto-load scripts matching no-script-matches-this."
-if ![runto_main] {
+if {![runto_main]} {
return
}
@@ -126,7 +126,7 @@ gdb_test "test-cmd 1 2 3" "test-cmd output, arg = 1 2 3"
with_test_prefix "sepdebug" {
gdb_exit
- set result [catch "exec eu-strip -g -f ${binfile}.debug ${binfile}" output]
+ set result [catch {exec eu-strip -g -f ${binfile}.debug ${binfile}} output]
verbose "result is $result"
verbose "output is $output"
if {$result != 0 || $output != ""} {
diff --git a/gdb/testsuite/gdb.python/py-section-script.py b/gdb/testsuite/gdb.python/py-section-script.py
index 73230c9..d85221e 100644
--- a/gdb/testsuite/gdb.python/py-section-script.py
+++ b/gdb/testsuite/gdb.python/py-section-script.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-send-packet.c b/gdb/testsuite/gdb.python/py-send-packet.c
index 1c97790..abdb71b 100644
--- a/gdb/testsuite/gdb.python/py-send-packet.c
+++ b/gdb/testsuite/gdb.python/py-send-packet.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-send-packet.exp b/gdb/testsuite/gdb.python/py-send-packet.exp
index bbee5ac..6c2984f 100644
--- a/gdb/testsuite/gdb.python/py-send-packet.exp
+++ b/gdb/testsuite/gdb.python/py-send-packet.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-send-packet.py b/gdb/testsuite/gdb.python/py-send-packet.py
index 402b039..0a0b359 100644
--- a/gdb/testsuite/gdb.python/py-send-packet.py
+++ b/gdb/testsuite/gdb.python/py-send-packet.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-shared-sl.c b/gdb/testsuite/gdb.python/py-shared-sl.c
index be736c2..49032ad 100644
--- a/gdb/testsuite/gdb.python/py-shared-sl.c
+++ b/gdb/testsuite/gdb.python/py-shared-sl.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-shared.c b/gdb/testsuite/gdb.python/py-shared.c
index 4b23980..dc28f32 100644
--- a/gdb/testsuite/gdb.python/py-shared.c
+++ b/gdb/testsuite/gdb.python/py-shared.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-shared.exp b/gdb/testsuite/gdb.python/py-shared.exp
index 9be5aa4..d80e139 100644
--- a/gdb/testsuite/gdb.python/py-shared.exp
+++ b/gdb/testsuite/gdb.python/py-shared.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-source-styling-2.c b/gdb/testsuite/gdb.python/py-source-styling-2.c
new file mode 100644
index 0000000..aaa3d69
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-source-styling-2.c
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int
+main ()
+{ /* List this line. */
+ try
+ {}
+ catch (...)
+ {}
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.python/py-source-styling-2.exp b/gdb/testsuite/gdb.python/py-source-styling-2.exp
new file mode 100644
index 0000000..ebf7f32
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-source-styling-2.exp
@@ -0,0 +1,55 @@
+# Copyright (C) 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Compile a c++ file using a .c extension, and check that pygments uses c++
+# highlighting instead of c highlighting.
+
+require allow_python_tests
+
+load_lib gdb-python.exp
+
+standard_testfile py-source-styling-2.c
+
+set line_number [gdb_get_line_number "List this line."]
+
+set opts {}
+lappend opts debug
+lappend opts c++
+
+if { [build_executable "failed to build" $testfile $srcfile $opts] == -1 } {
+ return
+}
+
+with_ansi_styling_terminal {
+ clean_restart
+}
+
+gdb_test_no_output "maint set gnu-source-highlight enabled off"
+
+gdb_load $binfile
+
+require {gdb_py_module_available pygments}
+
+gdb_test_no_output "set style enabled on"
+
+gdb_test_multiple "list $line_number" "Styling of c++ keyword try" {
+ -re -wrap " try\r\n.*" {
+ # Unstyled.
+ fail $gdb_test_name
+ }
+ -re -wrap "" {
+ pass $gdb_test_name
+ }
+}
diff --git a/gdb/testsuite/gdb.python/py-source-styling.c b/gdb/testsuite/gdb.python/py-source-styling.c
index eda87a7..308da9c 100644
--- a/gdb/testsuite/gdb.python/py-source-styling.c
+++ b/gdb/testsuite/gdb.python/py-source-styling.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-source-styling.exp b/gdb/testsuite/gdb.python/py-source-styling.exp
index 8eed56b..e030768 100644
--- a/gdb/testsuite/gdb.python/py-source-styling.exp
+++ b/gdb/testsuite/gdb.python/py-source-styling.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -62,7 +62,7 @@ proc check_source_listing_styling { cmd expect_styled { testname "" } } {
# highlighting when GNU source highlight is not available (or is
# disabled, as is done in this test).
proc test_pygments_styling {} {
- clean_restart $::binfile
+ clean_restart $::testfile
# Remote host boards disable styling via GDB's command line. Turn
# it back on now.
@@ -75,7 +75,7 @@ proc test_pygments_styling {} {
return
}
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -91,7 +91,7 @@ proc test_pygments_styling {} {
# string, then set the correct host encoding, and try again. This
# time the conversion should succeed.
proc test_gdb_execute_non_utf8_source {} {
- clean_restart $::binfile
+ clean_restart $::testfile
# The default host charset is utf-8, the source code contains a
# non-utf-8 character, so this will fail.
@@ -117,7 +117,7 @@ proc test_gdb_execute_non_utf8_source {} {
# output to be returned via a string, and in other cases we ask for
# the output to be sent straight to stdout.
proc_with_prefix test_source_cache_style_tracking {} {
- clean_restart $::binfile
+ clean_restart $::testfile
# Remote host boards disable styling via GDB's command line. Turn
# it back on now.
diff --git a/gdb/testsuite/gdb.python/py-startup-opt.exp b/gdb/testsuite/gdb.python/py-startup-opt.exp
index 038814a..929c64d 100644
--- a/gdb/testsuite/gdb.python/py-startup-opt.exp
+++ b/gdb/testsuite/gdb.python/py-startup-opt.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,6 +17,7 @@
# initialized.
require allow_python_tests
+require {!is_remote host}
# Return a list containing two directory paths for newly created home
# directories.
diff --git a/gdb/testsuite/gdb.python/py-strfns.c b/gdb/testsuite/gdb.python/py-strfns.c
index 21988fe..c3b846d 100644
--- a/gdb/testsuite/gdb.python/py-strfns.c
+++ b/gdb/testsuite/gdb.python/py-strfns.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-strfns.exp b/gdb/testsuite/gdb.python/py-strfns.exp
index e8180ac..13b8d2e 100644
--- a/gdb/testsuite/gdb.python/py-strfns.exp
+++ b/gdb/testsuite/gdb.python/py-strfns.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.python/py-style-parameter-set.exp b/gdb/testsuite/gdb.python/py-style-parameter-set.exp
new file mode 100644
index 0000000..73d94d1
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-style-parameter-set.exp
@@ -0,0 +1,366 @@
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This file is part of the GDB testsuite. It tests gdb.StyleParameterSet.
+
+load_lib gdb-python.exp
+
+require allow_python_tests
+
+# Create a regexp that can be used to match the output of a 'show style
+# NAME' command. HAS_INTENSITY is a boolean and indicates if style NAME has
+# an intensity attribute.
+proc gen_show_style_re { name has_intensity } {
+ set output \
+ [list \
+ "style ${name} background: The \"${name}\" style background color is: none" \
+ "style ${name} foreground: The \"${name}\" style foreground color is: none"]
+
+ if { $has_intensity } {
+ lappend output \
+ "style ${name} intensity: The \"${name}\" style display intensity is: normal"
+ }
+
+ return [multi_line {*}$output]
+}
+
+# Create a regexp to match against the output of a 'set style NAME' command,
+# that is, a 'set' command that doesn't actually set an attribute of a
+# style, in this case GDB will print some useful help text. HAS_INTENSITY is
+# a boolean and indicates if style NAME has an intensity attribute or not.
+proc gen_set_style_re { name has_intensity } {
+ set output \
+ [list \
+ "List of \"set style $name\" subcommands:" \
+ "" \
+ "set style $name background -- Set the background color for this property\\." \
+ "set style $name foreground -- Set the foreground color for this property\\."]
+
+ if { $has_intensity } {
+ lappend output \
+ "set style $name intensity -- Set the display intensity for this property\\."
+ }
+
+ lappend output \
+ "" \
+ "Type \"help set style $name\" followed by subcommand name for full documentation\\." \
+ "Type \"apropos word\" to search for commands related to \"word\"\\." \
+ "Type \"apropos -v word\" for full documentation of commands related to \"word\"\\." \
+ "Command name abbreviations are allowed if unambiguous\\."
+
+ return [multi_line {*}$output]
+}
+
+# Create a regexp to match against the output of a 'help show style NAME'
+# command. HAS_INTENSITY is a boolean and indicates if style NAME has an
+# intensity attribute or not. DOC is a regexp that matches the doc string
+# for style NAME.
+proc gen_help_show_style_re { name has_intensity doc } {
+ set output \
+ [list \
+ $doc \
+ "" \
+ "List of \"show style ${name}\" subcommands:" \
+ "" \
+ "show style $name background -- Show the background color for this property\\." \
+ "show style $name foreground -- Show the foreground color for this property\\."]
+ if { $has_intensity } {
+ lappend output \
+ "show style $name intensity -- Show the display intensity for this property\\."
+ }
+
+ lappend output \
+ "" \
+ "Type \"help show style $name\" followed by subcommand name for full documentation\\." \
+ "Type \"apropos word\" to search for commands related to \"word\"\\." \
+ "Type \"apropos -v word\" for full documentation of commands related to \"word\"\\." \
+ "Command name abbreviations are allowed if unambiguous\\."
+
+ return [multi_line {*}$output]
+}
+
+# Create a regexp to match against the output of a 'help set style NAME'
+# command. HAS_INTENSITY is a boolean and indicates if style NAME has an
+# intensity attribute or not. DOC is a regexp that matches the doc string
+# for style NAME.
+proc gen_help_set_style_re { name has_intensity doc } {
+ return \
+ [multi_line \
+ $doc \
+ "" \
+ [gen_set_style_re $name $has_intensity]]
+}
+
+# Create styles with and without intensity. Use named and unnamed
+# argument passing, and vary the argument passing order. Create
+# styles with and without documentation.
+#
+# Confirm that the styles contain the expected sub-commands, and that
+# the documentation is as expected.
+proc_with_prefix test_basic_usage {} {
+ gdb_test_no_output \
+ "python style_1 = gdb.StyleParameterSet(\"style-1\")" \
+ "create style-1"
+
+ gdb_test_no_output \
+ "python style_2 = gdb.StyleParameterSet(add_intensity=True, name=\"style-2\")" \
+ "create style-2"
+
+ gdb_test_no_output \
+ "python style_3 = gdb.StyleParameterSet(name=\"style-3\", doc=\"Style-3 display styling.\\nThis is a multi-line documentation\\nstring describing style-3.\")" \
+ "create style-3"
+
+ gdb_test_no_output \
+ "python style_4 = gdb.StyleParameterSet(\"style-4\", add_intensity=False)" \
+ "create style-4"
+
+ foreach style { style-1 style-2 style-3 } {
+ gdb_test "show style $style" \
+ [gen_show_style_re $style true]
+ gdb_test "set style $style" \
+ [gen_set_style_re $style true]
+ }
+
+ gdb_test "show style style-4" \
+ [gen_show_style_re "style-4" false]
+
+ foreach style { style-1 style-2 } {
+ gdb_test "help show style $style" \
+ [gen_help_show_style_re $style true \
+ [multi_line \
+ "The $style display styling\\." \
+ "Configure $style colors and display intensity\\."]]
+
+
+ set out [gen_help_set_style_re $style true \
+ [multi_line \
+ "The $style display styling\\." \
+ "Configure $style colors and display intensity\\."]]
+
+ gdb_test "help set style $style" \
+ [gen_help_set_style_re $style true \
+ [multi_line \
+ "The $style display styling\\." \
+ "Configure $style colors and display intensity\\."]]
+ }
+
+ gdb_test "help show style style-3" \
+ [gen_help_show_style_re "style-3" true \
+ [multi_line \
+ "Style-3 display styling\\." \
+ "This is a multi-line documentation" \
+ "string describing style-3\\."]]
+
+ gdb_test "help show style style-4" \
+ [gen_help_show_style_re "style-4" false \
+ [multi_line \
+ "The style-4 display styling\\." \
+ "Configure style-4 colors and display intensity\\."]]
+
+ for { set i 1 } { $i < 5 } { incr i } {
+ gdb_test "python print(style_$i)" \
+ "<gdb.StyleParameterSet name='style-$i'>" \
+ "print repr of style_$i"
+ }
+
+ # There is no 'style-4 intensity' property.
+ gdb_test "show style style-4 foreground" \
+ "The \"style-4\" style foreground color is: none"
+ gdb_test "show style style-4 background" \
+ "The \"style-4\" style background color is: none"
+ gdb_test "show style style-4 intensity" \
+ "Undefined show style style-4 command: \"intensity\"\\. Try \"help show style style-4\"\\."
+
+ # There is a 'style-1 intensity' property.
+ gdb_test "show style style-1 foreground" \
+ "The \"style-1\" style foreground color is: none" \
+ "show style-1 foreground before changes"
+ gdb_test "show style style-1 background" \
+ "The \"style-1\" style background color is: none" \
+ "show style-1 background before changes"
+ gdb_test "show style style-1 intensity" \
+ "The \"style-1\" style display intensity is: normal" \
+ "show style-1 intensity before changes"
+
+ # Grab the gdb.Style objects from 'style-1'.
+ gdb_test_no_output "python s1 = style_1.style"
+ gdb_test_no_output "python s2 = style_1.value"
+
+ # Check both represent the same style.
+ gdb_test "python print(s1)" \
+ "<gdb.Style name='style-1', fg=none, bg=none, intensity=normal>" \
+ "print s1 style before changes"
+ gdb_test "python print(s2)" \
+ "<gdb.Style name='style-1', fg=none, bg=none, intensity=normal>" \
+ "print s2 style before changes"
+
+ gdb_test_no_output \
+ "python s1.foreground=gdb.Color('red')" "set foreground"
+ gdb_test_no_output \
+ "python s1.background=gdb.Color('blue')" "set background"
+ gdb_test_no_output \
+ "python s1.intensity=gdb.INTENSITY_DIM" "set intensity"
+
+ gdb_test "python print(s1)" \
+ "<gdb.Style name='style-1', fg=red, bg=blue, intensity=dim>" \
+ "print s1 style after first set of changes"
+ gdb_test "python print(s2)" \
+ "<gdb.Style name='style-1', fg=red, bg=blue, intensity=dim>" \
+ "print s2 style after first set of changes"
+
+ # Check the style properties have updated.
+ gdb_test "show style style-1 foreground" \
+ "The \"style-1\" style foreground color is: red" \
+ "show style-1 foreground after first set of changes"
+ gdb_test "show style style-1 background" \
+ "The \"style-1\" style background color is: blue" \
+ "show style-1 background after first set of changes"
+ gdb_test "show style style-1 intensity" \
+ "The \"style-1\" style display intensity is: dim" \
+ "show style-1 intensity after first set of changes"
+
+ # Change the style properties, check gdb.Style objects update.
+ gdb_test_no_output "set style style-1 foreground yellow"
+ gdb_test_no_output "set style style-1 background cyan"
+ gdb_test_no_output "set style style-1 intensity bold"
+
+ gdb_test "python print(s1)" \
+ "<gdb.Style name='style-1', fg=yellow, bg=cyan, intensity=bold>" \
+ "print s1 style after second set of changes"
+ gdb_test "python print(s2)" \
+ "<gdb.Style name='style-1', fg=yellow, bg=cyan, intensity=bold>" \
+ "print s2 style after second set of changes"
+
+ # Assign a gdb.Style to set 'style-1'. First create some unnamed
+ # style objects that can be used.
+ gdb_test_no_output \
+ "python uns1 = gdb.Style(foreground=gdb.Color('white'), background=gdb.Color('black'), intensity=gdb.INTENSITY_BOLD)" \
+ "create uns1"
+ gdb_test_no_output \
+ "python uns2 = gdb.Style(foreground=gdb.Color('black'), background=gdb.Color('white'), intensity=gdb.INTENSITY_DIM)" \
+ "create uns2"
+
+ gdb_test_no_output "python style_1.value = uns1"
+ gdb_test "show style style-1 foreground" \
+ "The \"style-1\" style foreground color is: white" \
+ "show style-1 foreground after assigning uns1"
+ gdb_test "show style style-1 background" \
+ "The \"style-1\" style background color is: black" \
+ "show style-1 background after assigning uns1"
+ gdb_test "show style style-1 intensity" \
+ "The \"style-1\" style display intensity is: bold" \
+ "show style-1 intensity after assigning uns1"
+
+ gdb_test_no_output "python style_1.style = uns2"
+ gdb_test "show style style-1 foreground" \
+ "The \"style-1\" style foreground color is: black" \
+ "show style-1 foreground after assigning uns2"
+ gdb_test "show style style-1 background" \
+ "The \"style-1\" style background color is: white" \
+ "show style-1 background after assigning uns2"
+ gdb_test "show style style-1 intensity" \
+ "The \"style-1\" style display intensity is: dim" \
+ "show style-1 intensity after assigning uns2"
+
+ # Assign a style with an intensity that is not 'NORMAL' to a
+ # StyleParameterSet that doesn't have an intensity. The new
+ # intensity setting should be ignored.
+ gdb_test_no_output "python style_4.style = uns1"
+ gdb_test "show style style-4 foreground" \
+ "The \"style-4\" style foreground color is: white" \
+ "show style-4 foreground after assigning uns1"
+ gdb_test "show style style-4 background" \
+ "The \"style-4\" style background color is: black" \
+ "show style-4 background after assigning uns1"
+ gdb_test "show style style-4 intensity" \
+ "Undefined show style style-4 command: \"intensity\"\\. Try \"help show style style-4\"\\." \
+ "show style-4 intensity after assigning uns1"
+
+ gdb_test "python print(style_4.style)" \
+ "<gdb.Style name='style-4', fg=white, bg=black, intensity=normal>" \
+ "print string repr of style_4's style"
+}
+
+# Test creating a style prefix with gdb.ParameterPrefix, then adding
+# some styles within the new prefix. Change the style through the CLI
+# and confirm that the associated Python object updated as expected.
+proc_with_prefix test_style_prefix {} {
+ gdb_test_no_output \
+ "python gdb.ParameterPrefix(\"style my-style-group\", gdb.COMMAND_NONE)"
+ gdb_test_no_output \
+ "python style_1 = gdb.StyleParameterSet(\"my-style-group style-1\")" \
+ "create style-1"
+ gdb_test_no_output \
+ "python style_2 = gdb.StyleParameterSet(\"my-style-group style-2\")" \
+ "create style-2"
+
+ gdb_test "python print(style_1.style)" \
+ "<gdb.Style name='my-style-group style-1', fg=none, bg=none, intensity=normal>" \
+ "print 'my-style-group style-1' style before changes"
+ gdb_test "python print(style_2.style)" \
+ "<gdb.Style name='my-style-group style-2', fg=none, bg=none, intensity=normal>" \
+ "print 'my-style-group style-2' style before changes"
+
+ gdb_test_no_output "set style my-style-group style-1 foreground red"
+ gdb_test_no_output "set style my-style-group style-1 background yellow"
+ gdb_test_no_output "set style my-style-group style-1 intensity bold"
+ gdb_test_no_output "set style my-style-group style-2 foreground black"
+ gdb_test_no_output "set style my-style-group style-2 background blue"
+ gdb_test_no_output "set style my-style-group style-2 intensity dim"
+
+ gdb_test "python print(style_1.style)" \
+ "<gdb.Style name='my-style-group style-1', fg=red, bg=yellow, intensity=bold>" \
+ "print 'my-style-group style-1' style after changes"
+ gdb_test "python print(style_2.style)" \
+ "<gdb.Style name='my-style-group style-2', fg=black, bg=blue, intensity=dim>" \
+ "print 'my-style-group style-2' style after changes"
+}
+
+# Test that gdb.StyleParameterSet.apply() works as expected.
+proc_with_prefix test_applying {} {
+ # Create a new StyleParameterSet, and adjust its settings.
+ gdb_test_no_output \
+ "python style_1 = gdb.StyleParameterSet(\"style-1\")" \
+ "create style-1"
+ gdb_test_no_output \
+ "python uns1 = gdb.Style(foreground=gdb.Color('red'), background=gdb.Color('blue'), intensity=gdb.INTENSITY_BOLD)" \
+ "create uns1"
+ gdb_test_no_output "python style_1 = uns1"
+
+ # When styling is off (which it currently is), no escape sequences
+ # should be added.
+ gdb_test \
+ "python print(style_1.apply('xxx'))" "^xxx" \
+ "apply StyleParameterSet to a string when styling is off"
+
+ # When styling is on, we should see an escape sequence added.
+ gdb_test "with style enabled on -- python print(style_1.apply('xxx'))" \
+ "\033\\\[31;44;1;23;24;27mxxx\033\\\[m" \
+ "apply a style when styling is on"
+}
+
+# Start GDB.
+with_ansi_styling_terminal {
+ clean_restart
+}
+
+# Turn styling off so that the output of 'show style ...' isn't styled, this
+# makes it easier to match the output.
+gdb_test_no_output "set style enabled off"
+
+# Run the tests.
+test_basic_usage
+test_style_prefix
+test_applying
diff --git a/gdb/testsuite/gdb.python/py-style.exp b/gdb/testsuite/gdb.python/py-style.exp
new file mode 100644
index 0000000..491e189
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-style.exp
@@ -0,0 +1,371 @@
+# Copyright (C) 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This file is part of the GDB testsuite. It tests gdb.Style.
+
+load_lib gdb-python.exp
+
+require allow_python_tests
+
+# Start GDB, allow styling.
+with_ansi_styling_terminal {
+ clean_restart
+}
+
+# Check the error for unknown style names.
+foreach unknown_style { "unknown-style" "disassembler unknown-style" } {
+ gdb_test "python filename_style = gdb.Style('$unknown_style')" \
+ [multi_line \
+ "Python Exception <class 'RuntimeError'>: style '$unknown_style' cannot be found\\." \
+ "Error occurred in Python: style '$unknown_style' cannot be found\\."] \
+ "attempt to create named style for '$unknown_style'"
+}
+
+# Check we can create a style using an abbreviated style name.
+gdb_test_no_output "python abbrev_style = gdb.Style('high')" \
+ "create style using abbreviated name 'high'"
+gdb_test "python print(abbrev_style)" \
+ "^<gdb.Style name='highlight', fg=red, bg=none, intensity=normal>" \
+ "print the 'highlight' style"
+
+gdb_test_no_output "python abbrev_style = gdb.Style('disas mnem')" \
+ "create style using abbreviated name 'disas mnem'"
+gdb_test "python print(abbrev_style)" \
+ "^<gdb.Style name='disassembler mnemonic', fg=green, bg=none, intensity=normal>" \
+ "print the 'disassembler mnemonic' style"
+
+# Creating a style using an ambiguous abbreviated name will give an error.
+gdb_test "python abbrev_style = gdb.Style('f')" \
+ [multi_line \
+ "Python Exception <class 'RuntimeError'>: style 'f' cannot be found\\." \
+ "Error occurred in Python: style 'f' cannot be found\\."] \
+ "create style using abbreviated name 'f'"
+
+# Check a couple of different styles can be read. The 'tui-border' is
+# interesting as there is no 'intensity' for this one, the gdb.Style
+# object will show this as gdb.INTENSITY_NORMAL. The disassembler
+# styles are interesting because they are two word style names, and
+# the comment style has a foreground and intensity set.
+foreach style_check { { "filename" green none NORMAL } \
+ { "title" none none BOLD } \
+ { "tui-border" cyan none NORMAL } \
+ { "disassembler address" blue none NORMAL } \
+ { "disassembler comment" white none DIM } } {
+ set style_name [lindex $style_check 0]
+ set fg [lindex $style_check 1]
+ set bg [lindex $style_check 2]
+ set intensity [lindex $style_check 3]
+
+ with_test_prefix "check style $style_name" {
+ gdb_test_no_output "python style_obj = gdb.Style('$style_name')" \
+ "create named style for $style_name"
+
+ gdb_test "python print(style_obj.foreground)" "^$fg" \
+ "print foreground color"
+ gdb_test "python print(style_obj.background)" "^$bg" \
+ "print background color"
+ gdb_test "python print(style_obj.intensity == gdb.INTENSITY_$intensity)" \
+ "^True" "print intensity"
+
+ gdb_test "python print(style_obj)" \
+ "^<gdb.Style name='$style_name', fg=$fg, bg=$bg, intensity=[string tolower $intensity]>" \
+ "print string representation"
+ }
+}
+
+# Check that the intensity of a named style with no intensity
+# (tui-border) cannot be changed.
+gdb_test_no_output "python tui_border_style = gdb.Style('tui-border')" \
+ "create named style for 'tui-border'"
+gdb_test "python tui_border_style.intensity = gdb.INTENSITY_BOLD" \
+ [multi_line \
+ "Python Exception <class 'ValueError'>: the intensity of style 'tui-border' is not writable\\." \
+ "Error occurred in Python: the intensity of style 'tui-border' is not writable\\."]
+
+# Change the attributes of a named style, check the settings update as
+# expected.
+gdb_test_no_output "python filename_style = gdb.Style('filename')" \
+ "create named style for 'filename'"
+gdb_test_no_output "python filename_style.foreground = gdb.Color('blue')" \
+ "assign blue to filename foreground color"
+gdb_test_no_output "python filename_style.background = gdb.Color('red')" \
+ "assign red to filename background color"
+gdb_test_no_output "python filename_style.intensity = gdb.INTENSITY_BOLD"
+
+# Use 'with style enabled off' so that there are no escape sequences
+# in the output.
+gdb_test "with style enabled off -- show style filename" \
+ [multi_line \
+ "style filename background: The \"filename\" style background color is: red" \
+ "style filename foreground: The \"filename\" style foreground color is: blue" \
+ "style filename intensity: The \"filename\" style display intensity is: bold"]
+
+gdb_test "python print(filename_style)" \
+ "^<gdb.Style name='filename', fg=blue, bg=red, intensity=bold>" \
+ "print string representation of filename_style"
+
+# Check some attempts to set the gdb.Style attributes to invalid types.
+foreach attr { foreground background } {
+ gdb_test "python filename_style.$attr = None" \
+ [multi_line \
+ "Python Exception <class 'TypeError'>: value must be gdb.Color, not NoneType" \
+ "Error occurred in Python: value must be gdb.Color, not NoneType"]
+
+ gdb_test "python filename_style.$attr = list()" \
+ [multi_line \
+ "Python Exception <class 'TypeError'>: value must be gdb.Color, not list" \
+ "Error occurred in Python: value must be gdb.Color, not list"]
+
+ gdb_test "python filename_style.$attr = 'red'" \
+ [multi_line \
+ "Python Exception <class 'TypeError'>: value must be gdb.Color, not str" \
+ "Error occurred in Python: value must be gdb.Color, not str"]
+}
+
+gdb_test "python filename_style.intensity = None" \
+ [multi_line \
+ "Python Exception <class 'TypeError'>: value must be a Long \\(a gdb.INTENSITY constant\\), not NoneType" \
+ "Error occurred in Python: value must be a Long \\(a gdb.INTENSITY constant\\), not NoneType"]
+
+gdb_test "python filename_style.intensity = 'dim'" \
+ [multi_line \
+ "Python Exception <class 'TypeError'>: value must be a Long \\(a gdb.INTENSITY constant\\), not str" \
+ "Error occurred in Python: value must be a Long \\(a gdb.INTENSITY constant\\), not str"]
+
+# Check attempts to set the intensity to an integer value work as
+# expected. This is mostly about testing invalid integer values, but
+# we do also check that 0, 1, and 2 work as expected, though it is bad
+# practice to use the raw integer value rather than the defined
+# constants.
+set intensity_str { NORMAL BOLD DIM }
+for { set i -3 } { $i < 6 } { incr i } {
+ if { $i < 0 || $i > 2 } {
+ gdb_test "python filename_style.intensity = $i" \
+ [multi_line \
+ "Python Exception <class 'ValueError'>: invalid 'intensity' value $i\\." \
+ "Error occurred in Python: invalid 'intensity' value $i\\."]
+ } else {
+ gdb_test_no_output "python filename_style.intensity = $i"
+
+ set str [lindex $intensity_str $i]
+ gdb_test "python print(filename_style.intensity == gdb.INTENSITY_$str)" \
+ "^True" "check filename_style intensity is $str"
+ }
+}
+
+# Check the filename style has changed as expected.
+gdb_test "python print(filename_style)" \
+ "^<gdb.Style name='filename', fg=blue, bg=red, intensity=dim>" \
+ "check filename_style is now dim"
+
+# Check Style.escape_sequence and Style.apply when styling is disabled.
+gdb_test_no_output "with style enabled off -- python print(filename_style.escape_sequence(), end='')" \
+ "print escape sequence when styling is off"
+gdb_test "with style enabled off -- python print(filename_style.apply('xxx'))" "^xxx" \
+ "apply style to a string when styling is off"
+
+# Now check the escape sequences are emitted as expected.
+gdb_test "python print(filename_style.escape_sequence())" \
+ "\033\\\[34;41;2;23;24;27m" \
+ "print escape sequence when styling is on"
+gdb_test "python print(filename_style.apply('xxx'))" \
+ "\033\\\[34;41;2;23;24;27mxxx\033\\\[m" \
+ "apply a style when styling is on"
+
+# Test creating a style from component parts.
+gdb_test_no_output "python my_style_1 = gdb.Style(gdb.Color('red'), gdb.Color('blue'), gdb.INTENSITY_BOLD)" \
+ "create my_style_1"
+gdb_test "python print(my_style_1)" \
+ "^<gdb.Style fg=red, bg=blue, intensity=bold>" \
+ "check my_style_1"
+
+gdb_test_no_output "python my_style_2 = gdb.Style(background = gdb.Color('blue'))" \
+ "create my_style_2"
+gdb_test "python print(my_style_2)" \
+ "^<gdb.Style fg=none, bg=blue, intensity=normal>" \
+ "check my_style_2"
+
+gdb_test_no_output "python my_style_3 = gdb.Style(intensity = gdb.INTENSITY_DIM)" \
+ "create my_style_3"
+gdb_test "python print(my_style_3)" \
+ "^<gdb.Style fg=none, bg=none, intensity=dim>" \
+ "check my_style_3"
+
+# The precise error message, about 'None' not being an integer, varies
+# with Python version. We just check that we get a TypeError and
+# assume that this is related to the argument type.
+gdb_test "python my_style_4 = gdb.Style(intensity = None)" \
+ [multi_line \
+ "Python Exception <class 'TypeError'>: \[^\r\n\]+" \
+ "Error occurred in Python: \[^\r\n\]+"] \
+ "attempt to create my_style_4"
+
+gdb_test "python my_style_5 = gdb.Style(foreground = list())" \
+ [multi_line \
+ "Python Exception <class 'TypeError'>: 'foreground' argument must be gdb.Color or None, not list\\." \
+ "Error occurred in Python: 'foreground' argument must be gdb.Color or None, not list\\."] \
+ "attempt to create my_style_5"
+
+gdb_test "python my_style_6 = gdb.Style(background = list())" \
+ [multi_line \
+ "Python Exception <class 'TypeError'>: 'background' argument must be gdb.Color or None, not list\\." \
+ "Error occurred in Python: 'background' argument must be gdb.Color or None, not list\\."] \
+ "attempt to create my_style_6"
+
+# Adjust the attributes of an unnamed style.
+gdb_test_no_output "python my_style_1.foreground = gdb.Color('green')" \
+ "change my_style_1.foreground to green"
+gdb_test_no_output "python my_style_1.background = gdb.Color('cyan')" \
+ "change my_style_1.background to cyan"
+gdb_test_no_output "python my_style_1.intensity = gdb.INTENSITY_DIM" \
+ "change my_style_1.intensity to dim"
+gdb_test "python print(my_style_1)" \
+ "^<gdb.Style fg=green, bg=cyan, intensity=dim>" \
+ "check my_style_1 after changes."
+
+# Setup some prefix commands under 'set/show style ...'. Each prefix
+# command is called 'new-style-X' where X is an integer; 1, 2, 3, or 4.
+for { set i 1 } { $i < 5 } { incr i } {
+ gdb_test_no_output "python gdb.Command('set style new-style-$i', gdb.COMMAND_NONE, prefix = True)" \
+ "create set style new-style-$i"
+ gdb_test_no_output "python gdb.Command('show style new-style-$i', gdb.COMMAND_NONE, prefix = True)" \
+ "create show style new-style-$i"
+}
+
+# A helper class for creating color settings under the 'new-style-X'
+# prefix commands. The NUM to the __init__ supplies the value of
+# 'X', and NAME is either 'foreground' or 'background'.
+gdb_test_multiline "Class to create color parameters" \
+ "python" "" \
+ "class color_param(gdb.Parameter):" "" \
+ " def __init__(self, num, name):" "" \
+ " super().__init__(f\"style new-style-{num} {name}\", gdb.COMMAND_NONE, gdb.PARAM_COLOR)" "" \
+ " self.value = gdb.Color()" "" \
+ "end" ""
+
+# A helper class for creating intensity settings under the new
+# 'new-style-X' prefix commands. The NUM in the __init__ supplies the
+# value of 'X'.
+gdb_test_multiline "Class to create intensity parameters" \
+ "python" "" \
+ "class intensity_param(gdb.Parameter):" "" \
+ " def __init__(self, num):" "" \
+ " super().__init__(f\"style new-style-{num} intensity\", gdb.COMMAND_NONE, gdb.PARAM_ENUM," "" \
+ " \[\"normal\", \"bold\", \"dim\"\])" "" \
+ " self.value = \"normal\"" "" \
+ "end" ""
+
+# Within 'style new-style-1' we only have a 'foreground' setting.
+# This will not be usable as a gdb.Style.
+gdb_test_no_output "python color_param(1, 'foreground')" \
+ "setup new-style-1 foreground"
+
+# Within 'style new-style-2' we only have a 'background' setting.
+# This will not be usable as a gdb.Style.
+gdb_test_no_output "python color_param(2, 'background')" \
+ "setup new-style-2 background"
+
+# Within 'style new-style-3' we have both a 'foreground' and
+# 'background' setting. Even though 'intensity' is missing, this is
+# still usable as a style.
+gdb_test_no_output "python color_param(3, 'foreground')" \
+ "setup new-style-3 foreground"
+gdb_test_no_output "python color_param(3, 'background')" \
+ "setup new-style-3 background"
+
+# Within 'style new-style-4' we have a 'foreground', 'background', and
+# 'intensity' setting. This is a complete style setting group.
+gdb_test_no_output "python color_param(4, 'foreground')" \
+ "setup new-style-4 foreground"
+gdb_test_no_output "python color_param(4, 'background')" \
+ "setup new-style-4 background"
+gdb_test_no_output "python intensity_param(4)" \
+ "setup new-style-4 intensity"
+
+# Trying to create a style for 'new-style-1' should fail.
+gdb_test "python my_style_7 = gdb.Style('new-style-1')" \
+ [multi_line \
+ "Python Exception <class 'RuntimeError'>: style 'new-style-1' missing 'background' component\\." \
+ "Error occurred in Python: style 'new-style-1' missing 'background' component\\."] \
+ "try to create style for new-style-1"
+
+# Trying to create a style for 'new-style-2' should fail.
+gdb_test "python my_style_8 = gdb.Style('new-style-2')" \
+ [multi_line \
+ "Python Exception <class 'RuntimeError'>: style 'new-style-2' missing 'foreground' component\\." \
+ "Error occurred in Python: style 'new-style-2' missing 'foreground' component\\."] \
+ "try to create style for new-style-2"
+
+# Trying to create a style for 'new-style-3' should succeed.
+gdb_test_no_output "python my_style_9 = gdb.Style('new-style-3')" \
+ "create a style for new-style-3"
+gdb_test "python print(my_style_9)" \
+ "^<gdb.Style name='new-style-3', fg=none, bg=none, intensity=normal>" \
+ "print my_style_9"
+
+# Trying to create a style for 'new-style-4' should succeed too.
+gdb_test_no_output "python my_style_10 = gdb.Style('new-style-4')" \
+ "create a style for new-style-4"
+gdb_test "python print(my_style_10)" \
+ "^<gdb.Style name='new-style-4', fg=none, bg=none, intensity=normal>" \
+ "print my_style_10"
+
+# Adjust the settings directly, and check the gdb.Style updates.
+gdb_test_no_output "set style new-style-4 intensity bold"
+gdb_test_no_output "set style new-style-4 foreground red"
+gdb_test_no_output "set style new-style-4 background blue"
+gdb_test "python print(my_style_10)" \
+ "^<gdb.Style name='new-style-4', fg=red, bg=blue, intensity=bold>" \
+ "print my_style_10, intensity updated"
+
+# Check the reference counting on 'gdb.Style.apply' when global styling is disabled.
+gdb_test_no_output "python input_text = \"this is a unique string that is unlikely to appear elsewhere 12345\"" \
+ "setup an input string"
+gdb_test_no_output "with style enabled off -- python output_text = filename_style.apply(input_text)" \
+ "create an ouput string by applying filename_style"
+gdb_test_no_output "python input_text = \"a totally different string that is also, hopefully, unique\"" \
+ "replace the input string"
+gdb_test "python print(output_text)" \
+ "^this is a unique string that is unlikely to appear elsewhere 12345" \
+ "check the output_text is still valid"
+
+# Test gdb.write passing in a style. Define a helper function to
+# ensure all output is flushed before we return to the prompt.
+gdb_test_multiline "create function to call gdb.write then flush" \
+ "python" "" \
+ "def write_and_flush(*args, **kwargs):" "" \
+ " gdb.write(*args, **kwargs)" "" \
+ " gdb.write(\"\\n\")" "" \
+ " gdb.flush(gdb.STDOUT)" "" \
+ "end" ""
+
+gdb_test "python write_and_flush(\"some text\")" \
+ "^some text" "unstyled text, no style passed"
+
+gdb_test "python write_and_flush(\"some text\", style=None)" \
+ "^some text" "unstyled text, pass style as None"
+
+gdb_test "python write_and_flush(\"some text\", style=filename_style)" \
+ "^\033\\\[34;41;2;23;24;27msome text\033\\\[m" \
+ "styled output, pass style by keyword"
+
+gdb_test "python write_and_flush(\"some text\", gdb.STDOUT, filename_style)" \
+ "^\033\\\[34;41;2;23;24;27msome text\033\\\[m" \
+ "styled output, pass style by position"
+
+gdb_test "python write_and_flush(\"some text\", style='filename')" \
+ [multi_line \
+ "Python Exception <class 'TypeError'>: 'style' argument must be gdb\\.Style or None, not str\\." \
+ "Error occurred in Python: 'style' argument must be gdb\\.Style or None, not str\\."]
diff --git a/gdb/testsuite/gdb.python/py-styled-execute.exp b/gdb/testsuite/gdb.python/py-styled-execute.exp
index 0b27c63..198dab5 100644
--- a/gdb/testsuite/gdb.python/py-styled-execute.exp
+++ b/gdb/testsuite/gdb.python/py-styled-execute.exp
@@ -17,6 +17,7 @@
# on the value of the third argument passed to gdb.execute.
require allow_python_tests
+require {!is_remote host}
load_lib gdb-python.exp
diff --git a/gdb/testsuite/gdb.python/py-sym-artificial.exp b/gdb/testsuite/gdb.python/py-sym-artificial.exp
index 3ae516c..831ebd2 100644
--- a/gdb/testsuite/gdb.python/py-sym-artificial.exp
+++ b/gdb/testsuite/gdb.python/py-sym-artificial.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,21 +27,21 @@ set asm_file [standard_output_file ${srcfile2}]
Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name py-sym-artificial.c}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name py-sym-artificial.c
} {
declare_labels signed
signed: DW_TAG_base_type {
- {DW_AT_byte_size 1 DW_FORM_sdata}
- {DW_AT_encoding @DW_ATE_signed}
- {DW_AT_name bool}
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_name bool
}
DW_TAG_variable {
- {name the_variable}
- {DW_AT_type :$signed}
- {artificial 1 DW_FORM_flag_present}
+ DW_AT_name the_variable
+ DW_AT_type :$signed
+ DW_AT_artificial 1 DW_FORM_flag_present
}
}
}
diff --git a/gdb/testsuite/gdb.python/py-symbol-2.c b/gdb/testsuite/gdb.python/py-symbol-2.c
index c895159..806bcca 100644
--- a/gdb/testsuite/gdb.python/py-symbol-2.c
+++ b/gdb/testsuite/gdb.python/py-symbol-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-symbol-3.c b/gdb/testsuite/gdb.python/py-symbol-3.c
index 6a95193..181c3fc 100644
--- a/gdb/testsuite/gdb.python/py-symbol-3.c
+++ b/gdb/testsuite/gdb.python/py-symbol-3.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-symbol.c b/gdb/testsuite/gdb.python/py-symbol.c
index b6b2cd6..41cc60d 100644
--- a/gdb/testsuite/gdb.python/py-symbol.c
+++ b/gdb/testsuite/gdb.python/py-symbol.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp
index 55cdebe..2029c28 100644
--- a/gdb/testsuite/gdb.python/py-symbol.exp
+++ b/gdb/testsuite/gdb.python/py-symbol.exp
@@ -44,7 +44,7 @@ if {!$readnow_p} {
}
# Restart so we don't have expanded symtabs after the previous test.
-clean_restart ${binfile}
+clean_restart ${::testfile}
# Test looking up a global symbol before we runto_main as this is the
# point where we don't have a current frame, and we don't want to
@@ -100,7 +100,6 @@ gdb_test_multiple $cmd "print value of rr" {
fail $gdb_test_name
}
}
-
gdb_test "python print (gdb.lookup_static_symbol ('rr').needs_frame)" \
"False" \
@@ -215,8 +214,10 @@ gdb_test "python print (t\[0\].symtab)" "${py_symbol_c}" "get symtab"
# C++ tests
# Recompile binary.
lappend opts c++
-if {[prepare_for_testing "failed to prepare" "${binfile}-cxx" \
- [list $srcfile $srcfile2] $opts]} {
+set testfile $testfile-cxx
+set binfile [standard_output_file $testfile]
+if { [prepare_for_testing "failed to prepare" $testfile \
+ [list $srcfile $srcfile2] $opts] } {
return -1
}
@@ -252,7 +253,7 @@ gdb_test "python print (cplusfunc.addr_class == gdb.SYMBOL_LOC_BLOCK)" "True" "t
# Test is_valid when the objfile is unloaded. This must be the last
# test as it unloads the object file in GDB.
# Start with a fresh gdb.
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.python/py-symtab.exp b/gdb/testsuite/gdb.python/py-symtab.exp
index 18d77a0..a4891f3 100644
--- a/gdb/testsuite/gdb.python/py-symtab.exp
+++ b/gdb/testsuite/gdb.python/py-symtab.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-sync-interp.c b/gdb/testsuite/gdb.python/py-sync-interp.c
index 9dabd28..f5fef95 100644
--- a/gdb/testsuite/gdb.python/py-sync-interp.c
+++ b/gdb/testsuite/gdb.python/py-sync-interp.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-sync-interp.exp b/gdb/testsuite/gdb.python/py-sync-interp.exp
index 9db7853..ea91cb2 100644
--- a/gdb/testsuite/gdb.python/py-sync-interp.exp
+++ b/gdb/testsuite/gdb.python/py-sync-interp.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-template.cc b/gdb/testsuite/gdb.python/py-template.cc
index 73b4982..4c306ac 100644
--- a/gdb/testsuite/gdb.python/py-template.cc
+++ b/gdb/testsuite/gdb.python/py-template.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-template.exp b/gdb/testsuite/gdb.python/py-template.exp
index bba80e3..a0f9d80 100644
--- a/gdb/testsuite/gdb.python/py-template.exp
+++ b/gdb/testsuite/gdb.python/py-template.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-thread-exited.c b/gdb/testsuite/gdb.python/py-thread-exited.c
index 3af93f9..dd859ce 100644
--- a/gdb/testsuite/gdb.python/py-thread-exited.c
+++ b/gdb/testsuite/gdb.python/py-thread-exited.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-thread-exited.exp b/gdb/testsuite/gdb.python/py-thread-exited.exp
index dda8470..0f47ce0 100644
--- a/gdb/testsuite/gdb.python/py-thread-exited.exp
+++ b/gdb/testsuite/gdb.python/py-thread-exited.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ gdb_test_no_output "source ${pyfile}" "load python file"
gdb_test "test-events" "Event testers registered."
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-thread-exited.py b/gdb/testsuite/gdb.python/py-thread-exited.py
index f813271..f725bd5 100644
--- a/gdb/testsuite/gdb.python/py-thread-exited.py
+++ b/gdb/testsuite/gdb.python/py-thread-exited.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,6 +26,8 @@ def thread_exited_handler(event):
global threadOneExit, threadTwoExit, mainThreadExit
print("{}".format(event))
assert isinstance(event, gdb.ThreadExitedEvent)
+ # Also check the inheritance.
+ assert isinstance(event, gdb.ThreadEvent)
if threadOneExit == "":
threadOneExit = "event type: thread-exited. global num: {}".format(
event.inferior_thread.global_num
diff --git a/gdb/testsuite/gdb.python/py-thrhandle.c b/gdb/testsuite/gdb.python/py-thrhandle.c
index f6dd6d2..69c0aaf 100644
--- a/gdb/testsuite/gdb.python/py-thrhandle.c
+++ b/gdb/testsuite/gdb.python/py-thrhandle.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-thrhandle.exp b/gdb/testsuite/gdb.python/py-thrhandle.exp
index 702a3a5..a959044 100644
--- a/gdb/testsuite/gdb.python/py-thrhandle.exp
+++ b/gdb/testsuite/gdb.python/py-thrhandle.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2024 Free Software Foundation, Inc.
+# Copyright (C) 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto_main
diff --git a/gdb/testsuite/gdb.python/py-type.c b/gdb/testsuite/gdb.python/py-type.c
index 7a0df8a..cc5fcb2 100644
--- a/gdb/testsuite/gdb.python/py-type.c
+++ b/gdb/testsuite/gdb.python/py-type.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp
index c9d4353..c32a5bd 100644
--- a/gdb/testsuite/gdb.python/py-type.exp
+++ b/gdb/testsuite/gdb.python/py-type.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,8 +33,9 @@ proc build_inferior {exefile lang} {
}
# Restart GDB.
-proc restart_gdb {exefile} {
- clean_restart $exefile
+proc restart_gdb {exefile} {
+ clean_restart
+ gdb_load $exefile
if {![runto_main]} {
return
@@ -134,7 +135,7 @@ proc test_fields {lang} {
# Test conversion to bool on scalar types
gdb_test "python print (not not st.type\['a'\].type)" "True"
-
+
# Test regression PR python/10805
gdb_py_test_silent_cmd "print (ar)" "print value(ar)" 1
gdb_py_test_silent_cmd "python ar = gdb.history (0)" "get value (ar) from history" 1
@@ -253,9 +254,9 @@ proc test_template {} {
|| [test_compiler_info {gcc-4-[0-4]-*}]} {
set have_older_gcc 1
}
- if $have_older_gcc { setup_xfail *-*-* }
+ if {$have_older_gcc} { setup_xfail *-*-* }
gdb_test "python print (ttype.template_argument(1))" "23"
- if $have_older_gcc { setup_xfail *-*-* }
+ if {$have_older_gcc} { setup_xfail *-*-* }
gdb_test "python print (isinstance(ttype.template_argument(1), gdb.Value))" \
"True"
diff --git a/gdb/testsuite/gdb.python/py-typeprint.cc b/gdb/testsuite/gdb.python/py-typeprint.cc
index af06b54..b77bd8a 100644
--- a/gdb/testsuite/gdb.python/py-typeprint.cc
+++ b/gdb/testsuite/gdb.python/py-typeprint.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-typeprint.exp b/gdb/testsuite/gdb.python/py-typeprint.exp
index 5fafe26..74d755f 100644
--- a/gdb/testsuite/gdb.python/py-typeprint.exp
+++ b/gdb/testsuite/gdb.python/py-typeprint.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-typeprint.py b/gdb/testsuite/gdb.python/py-typeprint.py
index 0fd2f0e..dc13210 100644
--- a/gdb/testsuite/gdb.python/py-typeprint.py
+++ b/gdb/testsuite/gdb.python/py-typeprint.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-unwind-inline.c b/gdb/testsuite/gdb.python/py-unwind-inline.c
index 6511a6b..1143e52 100644
--- a/gdb/testsuite/gdb.python/py-unwind-inline.c
+++ b/gdb/testsuite/gdb.python/py-unwind-inline.c
@@ -1,4 +1,4 @@
-/* Copyright 2019-2024 Free Software Foundation, Inc.
+/* Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-unwind-inline.exp b/gdb/testsuite/gdb.python/py-unwind-inline.exp
index 1ba1c14..74d4ead 100644
--- a/gdb/testsuite/gdb.python/py-unwind-inline.exp
+++ b/gdb/testsuite/gdb.python/py-unwind-inline.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2020-2024 Free Software Foundation, Inc.
+# Copyright (C) 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-unwind-inline.py b/gdb/testsuite/gdb.python/py-unwind-inline.py
index b0a8083..ca6b16e 100644
--- a/gdb/testsuite/gdb.python/py-unwind-inline.py
+++ b/gdb/testsuite/gdb.python/py-unwind-inline.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2020-2024 Free Software Foundation, Inc.
+# Copyright (C) 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-unwind-maint.c b/gdb/testsuite/gdb.python/py-unwind-maint.c
index 80dc9d9..1b99849 100644
--- a/gdb/testsuite/gdb.python/py-unwind-maint.c
+++ b/gdb/testsuite/gdb.python/py-unwind-maint.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-unwind-maint.exp b/gdb/testsuite/gdb.python/py-unwind-maint.exp
index 9e525f6..d9450ef 100644
--- a/gdb/testsuite/gdb.python/py-unwind-maint.exp
+++ b/gdb/testsuite/gdb.python/py-unwind-maint.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-unwind-maint.py b/gdb/testsuite/gdb.python/py-unwind-maint.py
index 1d049a9..4a109d5 100644
--- a/gdb/testsuite/gdb.python/py-unwind-maint.py
+++ b/gdb/testsuite/gdb.python/py-unwind-maint.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-unwind-user-regs.c b/gdb/testsuite/gdb.python/py-unwind-user-regs.c
index be7b2fd..edd9284 100644
--- a/gdb/testsuite/gdb.python/py-unwind-user-regs.c
+++ b/gdb/testsuite/gdb.python/py-unwind-user-regs.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-unwind-user-regs.exp b/gdb/testsuite/gdb.python/py-unwind-user-regs.exp
index b27e038..1a464f0 100644
--- a/gdb/testsuite/gdb.python/py-unwind-user-regs.exp
+++ b/gdb/testsuite/gdb.python/py-unwind-user-regs.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-unwind-user-regs.py b/gdb/testsuite/gdb.python/py-unwind-user-regs.py
index 7e331a8..c6a56b8 100644
--- a/gdb/testsuite/gdb.python/py-unwind-user-regs.py
+++ b/gdb/testsuite/gdb.python/py-unwind-user-regs.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-unwind.c b/gdb/testsuite/gdb.python/py-unwind.c
index 81132f4..f785c5e 100644
--- a/gdb/testsuite/gdb.python/py-unwind.c
+++ b/gdb/testsuite/gdb.python/py-unwind.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-unwind.exp b/gdb/testsuite/gdb.python/py-unwind.exp
index d5efc02..b416c2f 100644
--- a/gdb/testsuite/gdb.python/py-unwind.exp
+++ b/gdb/testsuite/gdb.python/py-unwind.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -245,6 +245,13 @@ with_test_prefix "frame-id 'pc' is invalid" {
"Python Exception <class 'ValueError'>: invalid literal for int\\(\\) with base 10: 'xyz'\r\n.*"
}
+with_test_prefix "bad object unwinder" {
+ gdb_test_no_output "python obj = bad_object_unwinder(\"bad-object\")"
+ gdb_test_no_output "python gdb.unwinder.register_unwinder(None, obj, replace=True)"
+ gdb_test "backtrace" \
+ "Python Exception <class 'gdb.error'>: an Unwinder should return gdb.UnwindInfo, not Blah\\.\r\n.*"
+}
+
# Gather information about every frame.
gdb_test_no_output "python capture_all_frame_information()"
gdb_test_no_output "python gdb.newest_frame().select()"
diff --git a/gdb/testsuite/gdb.python/py-unwind.py b/gdb/testsuite/gdb.python/py-unwind.py
index 62bfb09..0faccf2 100644
--- a/gdb/testsuite/gdb.python/py-unwind.py
+++ b/gdb/testsuite/gdb.python/py-unwind.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -267,4 +267,24 @@ class validating_unwinder(Unwinder):
return None
+class bad_object_unwinder(Unwinder):
+ def __init__(self, name):
+ super().__init__(name)
+
+ def __call__(self, pending_frame):
+
+ if pending_frame.level() != 1:
+ return None
+
+ class Blah:
+ def __init__(self):
+ pass
+
+ @property
+ def __class__(self):
+ raise RuntimeError("error in Blah.__class__")
+
+ return Blah()
+
+
print("Python script imported")
diff --git a/gdb/testsuite/gdb.python/py-value-cc.cc b/gdb/testsuite/gdb.python/py-value-cc.cc
index 08b9915..1a70943 100644
--- a/gdb/testsuite/gdb.python/py-value-cc.cc
+++ b/gdb/testsuite/gdb.python/py-value-cc.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-value-cc.exp b/gdb/testsuite/gdb.python/py-value-cc.exp
index b096c75..6d261fb 100644
--- a/gdb/testsuite/gdb.python/py-value-cc.exp
+++ b/gdb/testsuite/gdb.python/py-value-cc.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-value.c b/gdb/testsuite/gdb.python/py-value.c
index c9da6c2..f6dbf55 100644
--- a/gdb/testsuite/gdb.python/py-value.c
+++ b/gdb/testsuite/gdb.python/py-value.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,6 +19,14 @@
#include <stdlib.h>
#include <string.h>
+int long_array[] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49
+};
+
struct s
{
int a;
@@ -60,6 +68,7 @@ struct Derived : public Base {
Base *base = new Derived ();
Derived derived;
Base &base_ref = derived;
+struct str pod;
void ptr_ref(int*& rptr_int)
{
diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
index 8ab867a..087c8c2 100644
--- a/gdb/testsuite/gdb.python/py-value.exp
+++ b/gdb/testsuite/gdb.python/py-value.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -297,9 +297,9 @@ proc test_value_in_inferior {} {
gdb_test "print argc" " = $argc_value" "sanity check argc"
gdb_test "python print (argc_lazy.is_lazy)" "\r\nTrue" \
"python print (argc_lazy.is_lazy) the second time"
- gdb_test_no_output "set argc=[expr $argc_value + 1]" "change argc"
+ gdb_test_no_output "set argc=[expr {$argc_value + 1}]" "change argc"
gdb_test "python print (argc_notlazy)" "\r\n$argc_value"
- gdb_test "python print (argc_lazy)" "\r\n[expr $argc_value + 1]"
+ gdb_test "python print (argc_lazy)" "\r\n[expr {$argc_value + 1}]"
gdb_test "python print (argc_lazy.is_lazy)" "False"
# Test string fetches, both partial and whole.
@@ -431,7 +431,8 @@ proc test_value_after_death {} {
proc test_subscript_regression {exefile lang} {
# Start with a fresh gdb.
- clean_restart ${exefile}
+ clean_restart
+ gdb_load $exefile
if {![runto_main]} {
return
@@ -457,6 +458,8 @@ proc test_subscript_regression {exefile lang} {
"Derived \[*\]"
gdb_test "python print (gdb.parse_and_eval('base_ref').dynamic_type)" \
"Derived \[&\]"
+ gdb_test "python print (gdb.parse_and_eval('pod').dynamic_type)" \
+ "str"
# A static type case.
gdb_test "python print (gdb.parse_and_eval('5').dynamic_type)" \
"int"
@@ -595,7 +598,7 @@ proc test_value_from_buffer {} {
gdb_py_test_silent_cmd "python atpbig=tp.array(3)" "make bigger array type" 0
gdb_test "python vabig=gdb.Value(b,atpbig)" \
"ValueError.*: Size of type is larger than that of buffer object\..*" \
- "attempt to construct large value with small buffer"
+ "attempt to construct large value with small buffer"
gdb_test "python v=gdb.Value(2048,tp)" \
"TypeError.*: Object must support the python buffer protocol\..*" \
"attempt to construct value from buffer with non-buffer object"
@@ -680,6 +683,7 @@ proc_with_prefix test_value_bytes { } {
"python" "" \
"def check_value_bytes(var_name):" "" \
" val = gdb.parse_and_eval(var_name)" "" \
+ " assert not val.is_unavailable" "" \
" addr = val.address" "" \
" len = val.type.sizeof" "" \
" mem = gdb.selected_inferior().read_memory(addr, len)" "" \
@@ -762,13 +766,45 @@ proc test_assign {} {
"cannot assign to integer"
}
+# Test Value.is_unavailable
+proc test_unavailable {} {
+ set elem_size [get_valueof "/d" "sizeof(long_array\[0\])" "UNKNOWN" \
+ "get size of long_array element"]
+ set max [expr {$elem_size * 10}]
+
+ with_set "print elements" 5 {
+ with_max_value_size $max {
+ gdb_test "p long_array"
+
+ gdb_test_no_output "set print elements 15"
+
+ gdb_test_no_output "python v = gdb.history(0)"
+
+ gdb_test "python print(v.is_unavailable)" "^True" \
+ "overall object shows as unavailable"
+ for { set i 0 } { $i < 10 } { incr i } {
+ gdb_test "python print(v\[$i\].is_unavailable)" "^False" \
+ "array element $i is available"
+ gdb_test "python print(v\[$i\])" "^$i" \
+ "array element $i has correct value"
+ }
+ for { set i 10 } { $i < 15 } { incr i } {
+ gdb_test "python print(v\[$i\].is_unavailable)" "^True" \
+ "array element $i is unavailable"
+ gdb_test "python print(v\[$i\])" "^<unavailable>" \
+ "array element $i shows as unavailable"
+ }
+ }
+ }
+}
+
# Build C version of executable. C++ is built later.
if { [build_inferior "${binfile}" "c"] < 0 } {
return -1
}
# Start with a fresh gdb.
-clean_restart ${binfile}
+clean_restart ${::testfile}
test_history_count
test_value_creation
@@ -788,6 +824,7 @@ if {![runto_main]} {
return 0
}
+test_unavailable
test_value_in_inferior
test_value_from_buffer
test_value_sub_classes
@@ -797,7 +834,7 @@ test_assign
test_value_bytes
test_value_after_death
-# Test either C or C++ values.
+# Test either C or C++ values.
test_subscript_regression "${binfile}" "c"
@@ -809,3 +846,15 @@ if {[allow_cplus_tests]} {
test_subscript_regression "${binfile}-cxx" "c++"
}
}
+
+if {[allow_rust_tests]} {
+ gdb_test "set lang rust"
+
+ set cst 0x80000000000000000000000000000000
+ gdb_test "python print(int(gdb.parse_and_eval('${cst}u128')))" \
+ "170141183460469231731687303715884105728" \
+ "convert 128 bit unsigned constant to python int"
+ gdb_test "python print(int(gdb.parse_and_eval('${cst}i128')))" \
+ "-170141183460469231731687303715884105728" \
+ "convert 128 bit signed constant to python int"
+}
diff --git a/gdb/testsuite/gdb.python/py-varobj.c b/gdb/testsuite/gdb.python/py-varobj.c
index da72f9a..6117b35 100644
--- a/gdb/testsuite/gdb.python/py-varobj.c
+++ b/gdb/testsuite/gdb.python/py-varobj.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-varobj.exp b/gdb/testsuite/gdb.python/py-varobj.exp
index 4e0e64e..cf6a662 100644
--- a/gdb/testsuite/gdb.python/py-varobj.exp
+++ b/gdb/testsuite/gdb.python/py-varobj.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -25,7 +25,7 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != ""}
return -1
}
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
mi_gdb_test "source ${pyfile}" \
diff --git a/gdb/testsuite/gdb.python/py-varobj.py b/gdb/testsuite/gdb.python/py-varobj.py
index 9401514..3699bdf 100644
--- a/gdb/testsuite/gdb.python/py-varobj.py
+++ b/gdb/testsuite/gdb.python/py-varobj.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.python/py-warning.exp b/gdb/testsuite/gdb.python/py-warning.exp
new file mode 100644
index 0000000..6b26a4e
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-warning.exp
@@ -0,0 +1,63 @@
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test the gdb.warning() function.
+
+load_lib gdb-python.exp
+
+require allow_python_tests
+
+clean_restart
+
+# Basic usage.
+gdb_test "python gdb.warning(\"some text\")" \
+ "warning: some text"
+
+# Basic usage with named argument.
+gdb_test "python gdb.warning(text=\"a warning message\")" \
+ "warning: a warning message"
+
+# Make sure GDB prints format specifiers correctly.
+gdb_test "python gdb.warning(\"%s %d %p\")" \
+ "warning: %s %d %p"
+
+# Empty string gives an error.
+gdb_test "python gdb.warning(\"\")" \
+ [multi_line \
+ "Python Exception <class 'ValueError'>: Empty text string passed to gdb\\.warning" \
+ "Error occurred in Python: Empty text string passed to gdb\\.warning"]
+
+# Missing argument gives an error.
+set re1 \
+ [multi_line \
+ [string_to_regexp \
+ [concat \
+ "Python Exception <class 'TypeError'>:" \
+ "function missing required argument 'text' (pos 1)"]] \
+ [string_to_regexp \
+ [concat \
+ "Error occurred in Python:" \
+ "function missing required argument 'text' (pos 1)"]]]
+set re2 \
+ [multi_line \
+ [string_to_regexp \
+ [concat \
+ "Python Exception <class 'TypeError'>:" \
+ "Required argument 'text' (pos 1) not found"]] \
+ [string_to_regexp \
+ [concat \
+ "Error occurred in Python:" \
+ "Required argument 'text' (pos 1) not found"]]]
+gdb_test "python gdb.warning()" $re1|$re2
diff --git a/gdb/testsuite/gdb.python/py-watchpoint.c b/gdb/testsuite/gdb.python/py-watchpoint.c
index 05748b0..9b05601 100644
--- a/gdb/testsuite/gdb.python/py-watchpoint.c
+++ b/gdb/testsuite/gdb.python/py-watchpoint.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-watchpoint.exp b/gdb/testsuite/gdb.python/py-watchpoint.exp
index 9361956..ea21020 100644
--- a/gdb/testsuite/gdb.python/py-watchpoint.exp
+++ b/gdb/testsuite/gdb.python/py-watchpoint.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-watchpoint.py b/gdb/testsuite/gdb.python/py-watchpoint.py
index dbb2bfe..d25826f 100644
--- a/gdb/testsuite/gdb.python/py-watchpoint.py
+++ b/gdb/testsuite/gdb.python/py-watchpoint.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-xmethods.cc b/gdb/testsuite/gdb.python/py-xmethods.cc
index 99753dc..336762e 100644
--- a/gdb/testsuite/gdb.python/py-xmethods.cc
+++ b/gdb/testsuite/gdb.python/py-xmethods.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/py-xmethods.exp b/gdb/testsuite/gdb.python/py-xmethods.exp
index 55ec66c..5863ec5 100644
--- a/gdb/testsuite/gdb.python/py-xmethods.exp
+++ b/gdb/testsuite/gdb.python/py-xmethods.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-xmethods.py b/gdb/testsuite/gdb.python/py-xmethods.py
index a2b8d57..33bc41a 100644
--- a/gdb/testsuite/gdb.python/py-xmethods.py
+++ b/gdb/testsuite/gdb.python/py-xmethods.py
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/python-1.c b/gdb/testsuite/gdb.python/python-1.c
index be736c2..49032ad 100644
--- a/gdb/testsuite/gdb.python/python-1.c
+++ b/gdb/testsuite/gdb.python/python-1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/python.c b/gdb/testsuite/gdb.python/python.c
index fda271e..501b25f 100644
--- a/gdb/testsuite/gdb.python/python.c
+++ b/gdb/testsuite/gdb.python/python.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index 19c8958..020fc66 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -152,29 +152,17 @@ gdb_test_no_output "set height $lines"
set test "verify pagination beforehand"
gdb_test_multiple "python print (\"\\n\" * $lines)" $test {
- -re "--Type <RET>" {
- exp_continue
- }
- -re " for more, q to quit" {
- exp_continue
- }
- -re ", c to continue without paging--$" {
+ -re "$pagination_prompt$" {
pass $test
}
}
gdb_test "q" "Quit.*" "verify pagination beforehand: q"
-gdb_test "python if gdb.execute('python print (\"\\\\n\" * $lines)', to_string=True) == \"\\n\" * [expr $lines + 1]: print (\"yes\")" "yes" "gdb.execute does not page"
+gdb_test "python if gdb.execute('python print (\"\\\\n\" * $lines)', to_string=True) == \"\\n\" * [expr {$lines + 1}]: print (\"yes\")" "yes" "gdb.execute does not page"
set test "verify pagination afterwards"
gdb_test_multiple "python print (\"\\n\" * $lines)" $test {
- -re "--Type <RET>" {
- exp_continue
- }
- -re " for more, q to quit" {
- exp_continue
- }
- -re ", c to continue without paging--$" {
+ -re "$pagination_prompt$" {
pass $test
}
}
@@ -300,7 +288,7 @@ gdb_test "python gdb.write(\"Foo\\n\")" "Foo" "test default write"
gdb_test "python gdb.write(\"Error stream\\n\", stream=gdb.STDERR)" "Error stream" "test stderr write"
gdb_test "python gdb.write(\"Normal stream\\n\", stream=gdb.STDOUT)" "Normal stream" "test stdout write"
-if ![gdb_debug_enabled] {
+if {![gdb_debug_enabled]} {
gdb_test "python gdb.write(\"Log stream\\n\", stream=gdb.STDLOG)" "Log stream" "test stdlog write"
}
diff --git a/gdb/testsuite/gdb.python/source1 b/gdb/testsuite/gdb.python/source1
index 6d457b5..b704d92 100644
--- a/gdb/testsuite/gdb.python/source1
+++ b/gdb/testsuite/gdb.python/source1
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/source2.py b/gdb/testsuite/gdb.python/source2.py
index 79dc1c2..7ca0bb2 100644
--- a/gdb/testsuite/gdb.python/source2.py
+++ b/gdb/testsuite/gdb.python/source2.py
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/sys-exit.exp b/gdb/testsuite/gdb.python/sys-exit.exp
index 3396b8d..878cf93 100644
--- a/gdb/testsuite/gdb.python/sys-exit.exp
+++ b/gdb/testsuite/gdb.python/sys-exit.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/tui-window-disabled.c b/gdb/testsuite/gdb.python/tui-window-disabled.c
index 538c9e8..ed650ca 100644
--- a/gdb/testsuite/gdb.python/tui-window-disabled.c
+++ b/gdb/testsuite/gdb.python/tui-window-disabled.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/tui-window-disabled.exp b/gdb/testsuite/gdb.python/tui-window-disabled.exp
index 750520c..afc9570 100644
--- a/gdb/testsuite/gdb.python/tui-window-disabled.exp
+++ b/gdb/testsuite/gdb.python/tui-window-disabled.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/tui-window-disabled.py b/gdb/testsuite/gdb.python/tui-window-disabled.py
index aef6f2a..8d140c4 100644
--- a/gdb/testsuite/gdb.python/tui-window-disabled.py
+++ b/gdb/testsuite/gdb.python/tui-window-disabled.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/tui-window-factory.exp b/gdb/testsuite/gdb.python/tui-window-factory.exp
index 5d8189d..4780fe4 100644
--- a/gdb/testsuite/gdb.python/tui-window-factory.exp
+++ b/gdb/testsuite/gdb.python/tui-window-factory.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/tui-window-factory.py b/gdb/testsuite/gdb.python/tui-window-factory.py
index edd39a4..7593214 100644
--- a/gdb/testsuite/gdb.python/tui-window-factory.py
+++ b/gdb/testsuite/gdb.python/tui-window-factory.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/tui-window-names.exp b/gdb/testsuite/gdb.python/tui-window-names.exp
index 8236fc9..2a8db69 100644
--- a/gdb/testsuite/gdb.python/tui-window-names.exp
+++ b/gdb/testsuite/gdb.python/tui-window-names.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/tui-window.exp b/gdb/testsuite/gdb.python/tui-window.exp
index c521dcc..744a09a 100644
--- a/gdb/testsuite/gdb.python/tui-window.exp
+++ b/gdb/testsuite/gdb.python/tui-window.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2020-2024 Free Software Foundation, Inc.
+# Copyright (C) 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.python/tui-window.py b/gdb/testsuite/gdb.python/tui-window.py
index 0661acc..d03a8ce 100644
--- a/gdb/testsuite/gdb.python/tui-window.py
+++ b/gdb/testsuite/gdb.python/tui-window.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2020-2024 Free Software Foundation, Inc.
+# Copyright (C) 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.replay/connect.exp b/gdb/testsuite/gdb.replay/connect.exp
index 5790d38..f52f209 100644
--- a/gdb/testsuite/gdb.replay/connect.exp
+++ b/gdb/testsuite/gdb.replay/connect.exp
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
#
-# Starts a communication with gdbsever setting the remotelog file.
+# Starts a communication with gdbserver setting the remotelog file.
# Modifies the remotelog with update_log proc, injects an error message
# instead of the expected replay to the vMustReplyEmpty packet in order
# to test GDB reacts to the error response properly. After the remotelog
@@ -70,9 +70,8 @@ proc_with_prefix record_initial_logfile {} {
# Connect to gdbreply using the global REMOTELOG. Runs to a breakpoint
# in main.
proc_with_prefix replay_without_error {} {
- global binfile
global remotelog
- clean_restart $binfile
+ clean_restart $::testfile
# Make sure we're disconnected, in case we're testing with an
# extended-remote board, therefore already connected.
gdb_test "disconnect" ".*"
@@ -97,7 +96,6 @@ proc_with_prefix replay_without_error {} {
# copy of REMOTELOG. Attempt to connect to the remote and expect to see
# the error reported by GDB.
proc_with_prefix replay_with_mustreplyempty_error {} {
- global binfile
global remotelog
global testfile
set newline E.errtext
@@ -105,9 +103,9 @@ proc_with_prefix replay_with_mustreplyempty_error {} {
# Modify the log file by changing the *response* to
# the vMustReplayEmty packet to an error.
- update_log $remotelog $output_file "vMustReplyEmpty" $newline
+ update_log $remotelog $output_file "vMustReplyEmpty" $newline true
- clean_restart $binfile
+ clean_restart $::testfile
# Make sure we're disconnected, in case we're testing with an
# extended-remote board, therefore already connected.
gdb_test "disconnect" ".*"
diff --git a/gdb/testsuite/gdb.replay/fetch-exec-and-args.c b/gdb/testsuite/gdb.replay/fetch-exec-and-args.c
new file mode 100644
index 0000000..3dc01a2
--- /dev/null
+++ b/gdb/testsuite/gdb.replay/fetch-exec-and-args.c
@@ -0,0 +1,34 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2023-2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Simple test, do some work with the arguments so GDB has a chance to
+ break and check that the arguments are correct. */
+
+volatile int global_counter;
+
+int
+main (int argc, char *argv[])
+{
+ int i;
+
+ global_counter = 0; /* Break here. */
+
+ for (i = 0; i < argc; ++i)
+ argv[i] = (char *) 0;
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.replay/fetch-exec-and-args.exp b/gdb/testsuite/gdb.replay/fetch-exec-and-args.exp
new file mode 100644
index 0000000..c4fcba7
--- /dev/null
+++ b/gdb/testsuite/gdb.replay/fetch-exec-and-args.exp
@@ -0,0 +1,146 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#
+# Starts a communication with gdbserver setting the remotelog file.
+# Modifies the remotelog with update_log proc, injects an error message
+# instead of the expected replay to the vMustReplyEmpty packet in order
+# to test GDB reacts to the error response properly. After the remotelog
+# modification, this test restarts GDB and starts communication with gdbreply
+# instead of the gdbserver using the remotelog.
+
+load_lib gdbserver-support.exp
+load_lib gdbreplay-support.exp
+
+require allow_gdbserver_tests
+require has_gdbreplay
+
+standard_testfile
+
+if { [build_executable "failed to prepare" $testfile $srcfile] } {
+ return
+}
+
+# Connect to gdbserver and run to a breakpoint in main. Record the
+# remotelogfile into the REMOTELOG.
+proc_with_prefix record_initial_logfile { remotelog } {
+ clean_restart
+
+ # Make sure we're disconnected, in case we're testing with an
+ # extended-remote board, therefore already connected.
+ gdb_test "disconnect" ".*"
+
+ gdb_test_no_output "set sysroot" \
+ "setting sysroot before starting gdbserver"
+
+ # Start gdbserver.
+ set res [gdbserver_start "" "$::binfile a b c"]
+ set gdbserver_protocol [lindex $res 0]
+ set gdbserver_gdbport [lindex $res 1]
+
+ gdb_test_no_output "set remotelogfile $remotelog" \
+ "setup remotelogfile"
+
+ # Connect to gdbserver.
+ if {[gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport] != 0} {
+ unsupported "$testfile (couldn't connect to gdbserver)"
+ return
+ }
+
+ # If we're connecting as 'remote' then we can't use 'runto'.
+ gdb_breakpoint [gdb_get_line_number "Break here"]
+ gdb_continue_to_breakpoint "continuing to breakpoint"
+
+ gdb_test "show remote exec-file" \
+ "The remote exec-file is \"[string_to_regexp $::binfile]\"\\."
+ gdb_test "show args" \
+ "Argument list to give program being debugged when it is started is \"a b c\"\\."
+}
+
+proc update_log_file { src dst } {
+ # Get the reply to the qExecAndArgs packet.
+ set reply [get_reply_line $src "qExecAndArgs"]
+
+ # Remove the program name from the reply.
+ regsub "S;\[^;\]+;" $reply "S;;" reply
+
+ # Remove the leading "r $" as this is added back by update_log.
+ regsub "^r \\\$" $reply "" reply
+
+ # Write the new reply line into the modified log file.
+ update_log $src $dst "qExecAndArgs" $reply false
+}
+
+# Rerun REMOTELOG using gdbreplay. The log file has been modified so
+# that the qExecAndArgs packet reply no longer includes the program
+# name, this will look like 'S;;args;'. As a result, GDB should no
+# longer overwrite and existing remote exec-file setting.
+#
+# When REMOTE_EXEC is true set a remote exec-file value and check this
+# is retained after connecting to gdbreplay. When REMOTE_EXEC is
+# false, don't set a remote exec-file value, check that GDB shows the
+# remote exec-file as unset after connecting.
+proc_with_prefix replay_with_update_logfile { remotelog remote_exec } {
+ clean_restart
+
+ # Make sure we're disconnected, in case we're testing with an
+ # extended-remote board, therefore already connected.
+ gdb_test "disconnect" ".*"
+
+ gdb_test_no_output "set sysroot"
+
+ # If requested, set a remote exec-file.
+ if { $remote_exec } {
+ set fake_remote_exec "/xxx/yyy/zzz"
+ gdb_test_no_output "set remote exec-file $fake_remote_exec"
+ set exec_file_re \
+ "The remote exec-file is \"[string_to_regexp $fake_remote_exec]\"\\."
+ } else {
+ set exec_file_re \
+ "The remote exec-file is unset, the default remote executable will be used\\."
+ }
+
+ # Start gdbreplay.
+ set res [gdbreplay_start $remotelog]
+ set gdbserver_protocol [lindex $res 0]
+ set gdbserver_gdbport [lindex $res 1]
+
+ # Connect to gdbreplay.
+ gdb_assert {[gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport] == 0} \
+ "connect to gdbreplay"
+
+ # Same breakpoint and continue as when we recorded the log.
+ gdb_breakpoint [gdb_get_line_number "Break here"]
+ gdb_continue_to_breakpoint "continuing to breakpoint"
+
+ # Inspect GDB's state. With the modified logfile the executable
+ # was passed back as an empty string, indicating that the
+ # executable should not be changed.
+ gdb_test "show remote exec-file" \
+ $exec_file_re
+ gdb_test "show args" \
+ "Argument list to give program being debugged when it is started is \"a b c\"\\."
+}
+
+# The replay log is placed in 'replay.log'.
+set remotelog [standard_output_file replay.log]
+set remotelog_modified [standard_output_file replay-modified.log]
+
+record_initial_logfile $remotelog
+
+update_log_file $remotelog $remotelog_modified
+
+foreach_with_prefix set_remote_exec { true false } {
+ replay_with_update_logfile $remotelog_modified $set_remote_exec
+}
diff --git a/gdb/testsuite/gdb.replay/missing-thread.c b/gdb/testsuite/gdb.replay/missing-thread.c
new file mode 100644
index 0000000..8edb240
--- /dev/null
+++ b/gdb/testsuite/gdb.replay/missing-thread.c
@@ -0,0 +1,61 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <pthread.h>
+#include <assert.h>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdbool.h>
+
+pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t g_condvar = PTHREAD_COND_INITIALIZER;
+
+void *
+worker_function (void *arg)
+{
+ printf ("In worker, about to notify\n");
+ pthread_cond_signal (&g_condvar);
+
+ while (true)
+ sleep(1);
+
+ return NULL;
+}
+
+int
+main()
+{
+ pthread_t my_thread;
+
+ int result = pthread_create (&my_thread, NULL, worker_function, NULL);
+ assert (result == 0);
+
+ pthread_mutex_lock (&g_mutex);
+ pthread_cond_wait (&g_condvar, &g_mutex);
+
+ printf ("In main, have been woken.\n");
+ pthread_mutex_unlock (&g_mutex);
+
+ result = pthread_kill (my_thread, SIGTRAP);
+ assert (result == 0);
+
+ result = pthread_join (my_thread, NULL);
+ assert (result == 0);
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.replay/missing-thread.exp b/gdb/testsuite/gdb.replay/missing-thread.exp
new file mode 100644
index 0000000..6ee2e4c
--- /dev/null
+++ b/gdb/testsuite/gdb.replay/missing-thread.exp
@@ -0,0 +1,237 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+# This test confirms how GDB handles a badly behaving remote target. The
+# remote target reports a stop event (signal delivery), then, as GDB is
+# processing the stop it syncs the thread list with the remote.
+#
+# The badly behaving remote target was dropping the signaled thread from the
+# thread list at this point, that is, the thread appeared to exit before an
+# exit event had been sent to (and seen by) GDB.
+#
+# At one point this was causing an assertion failed. GDB would try to
+# process the signal stop event, and to do this would try to read some
+# registers. Reading registers requires a regcache, and GDB will only
+# create a regcache for a non-exited thread.
+
+load_lib gdbserver-support.exp
+load_lib gdbreplay-support.exp
+
+require allow_gdbserver_tests
+require has_gdbreplay
+
+standard_testfile
+
+if { [build_executable "failed to build exec" $testfile $srcfile {debug pthreads}] } {
+ return -1
+}
+
+# Start the inferior and record a remote log for our interaction with it.
+# All we do is start the inferior and wait for thread 2 to receive a signal.
+# Check that GDB correctly shows the signal as received. LOG_FILENAME is
+# where we should write the remote log.
+proc_with_prefix record_initial_logfile { log_filename } {
+ clean_restart $::testfile
+
+ # Make sure we're disconnected, in case we're testing with an
+ # extended-remote board, therefore already connected.
+ gdb_test "disconnect" ".*"
+
+ gdb_test_no_output "set sysroot" \
+ "setting sysroot before starting gdbserver"
+
+ # Start gdbserver like:
+ # gdbserver :PORT ....
+ set res [gdbserver_start "" $::binfile]
+ set gdbserver_protocol [lindex $res 0]
+ set gdbserver_gdbport [lindex $res 1]
+
+ gdb_test_no_output "set remotelogfile $log_filename" \
+ "setup remotelogfile"
+
+ # Connect to gdbserver.
+ if {![gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport] == 0} {
+ unsupported "$testfile (couldn't start gdbserver)"
+ return
+ }
+
+ gdb_breakpoint main
+ gdb_continue_to_breakpoint "continuing to main"
+
+ gdb_test "continue" \
+ "Thread $::decimal \[^\r\n\]+ received signal SIGTRAP, .*"
+
+ gdb_test "disconnect" ".*" \
+ "disconnect after seeing signal"
+}
+
+# Copy the remote log from IN_FILENAME to OUT_FILENAME, but modify one
+# particular line.
+#
+# The line to be modified is the last <threads>...</threads> line, this is
+# the reply from the remote that indicates the thread list. It is expected
+# that the thread list will contain two threads.
+#
+# When DROP_BOTH is true then both threads will be removed from the modified
+# line. Otherwise, only the second thread is removed.
+proc update_replay_log { in_filename out_filename drop_both } {
+ # Read IN_FILENAME into a list.
+ set fd [open $in_filename]
+ set data [read $fd]
+ close $fd
+ set lines [split $data "\n"]
+
+ # Find the last line in LINES that contains the <threads> list.
+ set idx -1
+ for { set i 0 } { $i < [llength $lines] } { incr i } {
+ if { [regexp "^r.*<threads>.*</threads>" [lindex $lines $i]] } {
+ set idx $i
+ }
+ }
+
+ # Modify the line by dropping the second thread. This does assume
+ # the thread order as seen in the <threads>...</threads> list, but
+ # this seems stable for now.
+ set line [lindex $lines $idx]
+ set fixed_log false
+ if {[regexp "^(r .*<threads>\\\\n)(<thread id.*/>\\\\n)(<thread id.*/>\\\\n)(</threads>.*)$" $line \
+ match part1 part2 part3 part4]} {
+ if { $drop_both } {
+ set line $part1$part4
+ } else {
+ set line $part1$part2$part4
+ }
+ set lines [lreplace $lines $idx $idx $line]
+ set fixed_log true
+ }
+
+ # Write all the lines to OUT_FILENAME
+ set fd [open $out_filename "w"]
+ foreach l $lines {
+ puts $fd $l
+ }
+ close $fd
+
+ # Did we manage to update the log file?
+ return $fixed_log
+}
+
+# Replay the test process using REMOTE_LOG as the logfile to replay. If
+# EXPECT_ERROR is true then after the final 'continue' we expect GDB to give
+# an error as the required thread is missing. When EXPECT_ERROR is false
+# then we expect the test to complete as normal. NON_STOP is eithe 'on' or
+# 'off' and indicates GDBs non-stop mode.
+proc_with_prefix replay_with_log { remote_log expect_error non_stop } {
+ clean_restart $::testfile
+
+ # Make sure we're disconnected, in case we're testing with an
+ # extended-remote board, therefore already connected.
+ gdb_test "disconnect" ".*"
+
+ gdb_test_no_output "set sysroot"
+
+ set res [gdbreplay_start $remote_log]
+ set gdbserver_protocol [lindex $res 0]
+ set gdbserver_gdbport [lindex $res 1]
+
+ # Connect to gdbserver.
+ if {![gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport] == 0} {
+ fail "couldn't connect to gdbreplay"
+ return
+ }
+
+ gdb_breakpoint main
+ gdb_continue_to_breakpoint "continuing to main"
+
+ if { $expect_error } {
+ set expected_output \
+ [list \
+ "\\\[Thread \[^\r\n\]+ exited\\\]" \
+ "warning: command aborted, Thread \[^\r\n\]+ unexpectedly exited after signal stop event"]
+
+ if { !$non_stop } {
+ lappend expected_output "\\\[Switching to Thread \[^\r\n\]+\\\]"
+ }
+
+ gdb_test "continue" [multi_line {*}$expected_output]
+ } else {
+ # This is the original behaviour, we see this when running
+ # with the unmodified log.
+ gdb_test "continue" \
+ "Thread ${::decimal}(?: \[^\r\n\]+)? received signal SIGTRAP, .*"
+ }
+
+ gdb_test "disconnect" ".*" \
+ "disconnect after seeing signal"
+}
+
+# Run the complete test cycle; generate an initial log file, modify the log
+# file, then check that GDB correctly handles replaying the modified log
+# file.
+#
+# NON_STOP is either 'on' or 'off' and indicates GDB's non-stop mode.
+proc run_test { non_stop } {
+ if { $non_stop } {
+ set suffix "-ns"
+ } else {
+ set suffix ""
+ }
+
+ # The replay log is placed in 'replay.log'.
+ set remote_log [standard_output_file replay${suffix}.log]
+ set missing_1_log [standard_output_file replay-missing-1${suffix}.log]
+ set missing_2_log [standard_output_file replay-missing-2${suffix}.log]
+
+ record_initial_logfile $remote_log
+
+ if { ![update_replay_log $remote_log $missing_1_log false] } {
+ fail "couldn't update remote replay log (drop 1 case)"
+ }
+
+ if { ![update_replay_log $remote_log $missing_2_log true] } {
+ fail "couldn't update remote replay log (drop 2 case)"
+ }
+
+ with_test_prefix "with unmodified log" {
+ # Replay with the unmodified log. This confirms that we can replay this
+ # scenario correctly.
+ replay_with_log $remote_log false $non_stop
+ }
+
+ with_test_prefix "missing 1 thread log" {
+ # Now replay with the modified log, this time the thread that receives
+ # the event should be missing from the thread list, GDB will give an
+ # error when the inferior stops.
+ replay_with_log $missing_1_log true $non_stop
+ }
+
+ with_test_prefix "missing 2 threads log" {
+ # When we drop both threads from the <threads> reply, GDB doesn't
+ # actually remove both threads from the inferior; an inferior must
+ # always have at least one thread. So in this case, as the primary
+ # thread is first, GDB drops this, then retains the second thread, which
+ # is the one we're stopping in, and so, we don't expect to see the error
+ # in this case.
+ replay_with_log $missing_2_log false $non_stop
+ }
+}
+
+# Run the test twice, with non-stop on and off.
+foreach_with_prefix non_stop { on off } {
+ save_vars { ::GDBFLAGS } {
+ append ::GDBFLAGS " -ex \"set non-stop $non_stop\""
+ run_test $non_stop
+ }
+}
diff --git a/gdb/testsuite/gdb.reverse/aarch64-mops.c b/gdb/testsuite/gdb.reverse/aarch64-mops.c
index 95318fe..2a07e37 100644
--- a/gdb/testsuite/gdb.reverse/aarch64-mops.c
+++ b/gdb/testsuite/gdb.reverse/aarch64-mops.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/aarch64-mops.exp b/gdb/testsuite/gdb.reverse/aarch64-mops.exp
index 05a991d..797a0c2 100644
--- a/gdb/testsuite/gdb.reverse/aarch64-mops.exp
+++ b/gdb/testsuite/gdb.reverse/aarch64-mops.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.S b/gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.S
index 0362feb..72c3691 100644
--- a/gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.S
+++ b/gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.c b/gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.c
index ed982eb..7412669 100644
--- a/gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.c
+++ b/gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.exp b/gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.exp
index 9775c99..b5878f0 100644
--- a/gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ require supports_reverse
set opts {}
standard_testfile .S
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.reverse/amd64-tailcall-reverse.exp COMPILE=1"
standard_testfile
lappend opts debug optimize=-O2
@@ -30,11 +30,11 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if [supports_process_record] {
+if {[supports_process_record]} {
gdb_test_no_output "record"
}
diff --git a/gdb/testsuite/gdb.reverse/break-precsave.exp b/gdb/testsuite/gdb.reverse/break-precsave.exp
index 6d9b312..c04f4ac 100644
--- a/gdb/testsuite/gdb.reverse/break-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/break-precsave.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/break-reverse.c b/gdb/testsuite/gdb.reverse/break-reverse.c
index 1c27c72..dfe0593 100644
--- a/gdb/testsuite/gdb.reverse/break-reverse.c
+++ b/gdb/testsuite/gdb.reverse/break-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/break-reverse.exp b/gdb/testsuite/gdb.reverse/break-reverse.exp
index 66e9712..6db7ce1 100644
--- a/gdb/testsuite/gdb.reverse/break-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/break-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ set end_location [gdb_get_line_number "end of main" ]
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/consecutive-precsave.exp b/gdb/testsuite/gdb.reverse/consecutive-precsave.exp
index 134d85b..3ccff48 100644
--- a/gdb/testsuite/gdb.reverse/consecutive-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/consecutive-precsave.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -79,7 +79,7 @@ set testmsg "stopped at bp, 2nd instr"
gdb_test_multiple "step" $testmsg {
-re -wrap "Breakpoint $decimal, ($hex) in foo.*" {
set stop_addr $expect_out(1,string)
- if {[eval expr "$foo2_addr == $stop_addr"]} {
+ if {$foo2_addr == $stop_addr} {
pass "stopped at bp, 2nd instr"
} else {
fail "stopped at bp, 2nd instr (wrong address)"
@@ -90,7 +90,7 @@ gdb_test_multiple "step" $testmsg {
set stop_addr_is_stmt [hex_in_list $stop_addr $is_stmt]
if { ! $stop_addr_is_stmt } {
fail "stopped at bp, 2nd instr (missing hex prefix)"
- } elseif {[eval expr "$foo2_addr == $stop_addr"]} {
+ } elseif {$foo2_addr == $stop_addr} {
pass "stopped at bp, 2nd instr"
} else {
fail "stopped at bp, 2nd instr (wrong address)"
@@ -112,7 +112,7 @@ set test_msg "stopped at bp in reverse, 1st instr"
gdb_test_multiple "step" "$test_msg" {
-re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" {
set stop_addr $expect_out(1,string)
- if {[eval expr "$foo1_addr == $stop_addr"]} {
+ if {$foo1_addr == $stop_addr} {
pass "$test_msg"
} else {
fail "$test_msg (wrong address)"
diff --git a/gdb/testsuite/gdb.reverse/consecutive-reverse.c b/gdb/testsuite/gdb.reverse/consecutive-reverse.c
index 778b311..1d01d16 100644
--- a/gdb/testsuite/gdb.reverse/consecutive-reverse.c
+++ b/gdb/testsuite/gdb.reverse/consecutive-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/consecutive-reverse.exp b/gdb/testsuite/gdb.reverse/consecutive-reverse.exp
index f5cbe06..7434efb 100644
--- a/gdb/testsuite/gdb.reverse/consecutive-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/consecutive-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
@@ -61,7 +61,7 @@ set testmsg "stopped at bp, 2nd instr"
gdb_test_multiple "step" $testmsg {
-re -wrap "Breakpoint $decimal, ($hex) in foo.*" {
set stop_addr $expect_out(1,string)
- if {[eval expr "$foo2_addr == $stop_addr"]} {
+ if {$foo2_addr == $stop_addr} {
pass "stopped at bp, 2nd instr"
} else {
fail "stopped at bp, 2nd instr (wrong address)"
@@ -72,7 +72,7 @@ gdb_test_multiple "step" $testmsg {
set stop_addr_is_stmt [hex_in_list $stop_addr $is_stmt]
if { ! $stop_addr_is_stmt } {
fail "stopped at bp, 2nd instr (missing hex prefix)"
- } elseif {[eval expr "$foo2_addr == $stop_addr"]} {
+ } elseif {$foo2_addr == $stop_addr} {
pass "stopped at bp, 2nd instr"
} else {
fail "stopped at bp, 2nd instr (wrong address)"
@@ -94,7 +94,7 @@ set test_msg "stopped at bp in reverse, 1st instr"
gdb_test_multiple "step" "$test_msg" {
-re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" {
set stop_addr $expect_out(1,string)
- if {[eval expr "$foo1_addr == $stop_addr"]} {
+ if {$foo1_addr == $stop_addr} {
pass "$test_msg"
} else {
fail "$test_msg (wrong address)"
diff --git a/gdb/testsuite/gdb.reverse/finish-precsave.exp b/gdb/testsuite/gdb.reverse/finish-precsave.exp
index fe77e36..2e76a46 100644
--- a/gdb/testsuite/gdb.reverse/finish-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/finish-precsave.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,12 +27,12 @@ if { [prepare_for_testing "failed to prepare" "$testfile" $srcfile] } {
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
-# Run until end, then save execution log.
+# Run until end, then save execution log.
set breakloc [gdb_get_line_number "end of main" "$srcfile"]
gdb_test "break $breakloc" \
diff --git a/gdb/testsuite/gdb.reverse/finish-reverse-bkpt.c b/gdb/testsuite/gdb.reverse/finish-reverse-bkpt.c
index f7a1bbf..f52f983 100644
--- a/gdb/testsuite/gdb.reverse/finish-reverse-bkpt.c
+++ b/gdb/testsuite/gdb.reverse/finish-reverse-bkpt.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/finish-reverse-bkpt.exp b/gdb/testsuite/gdb.reverse/finish-reverse-bkpt.exp
index e1137f6..586d236 100644
--- a/gdb/testsuite/gdb.reverse/finish-reverse-bkpt.exp
+++ b/gdb/testsuite/gdb.reverse/finish-reverse-bkpt.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -52,7 +52,7 @@ if {![runto_main]} {
return 0
}
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/finish-reverse-next.c b/gdb/testsuite/gdb.reverse/finish-reverse-next.c
index 6072409..5a46210 100644
--- a/gdb/testsuite/gdb.reverse/finish-reverse-next.c
+++ b/gdb/testsuite/gdb.reverse/finish-reverse-next.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/finish-reverse-next.exp b/gdb/testsuite/gdb.reverse/finish-reverse-next.exp
index 73a4124..07ba30c 100644
--- a/gdb/testsuite/gdb.reverse/finish-reverse-next.exp
+++ b/gdb/testsuite/gdb.reverse/finish-reverse-next.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@
# test only verified the reverse-finish command for a normal call that used
# the LEP.
-if ![supports_reverse] {
+if {![supports_reverse]} {
return
}
@@ -53,7 +53,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay.
gdb_test_no_output "record" "turn on process record for test1"
}
diff --git a/gdb/testsuite/gdb.reverse/finish-reverse.c b/gdb/testsuite/gdb.reverse/finish-reverse.c
index 82a7911..f4487df 100644
--- a/gdb/testsuite/gdb.reverse/finish-reverse.c
+++ b/gdb/testsuite/gdb.reverse/finish-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/finish-reverse.exp b/gdb/testsuite/gdb.reverse/finish-reverse.exp
index 470a58d..ff28bd8 100644
--- a/gdb/testsuite/gdb.reverse/finish-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/finish-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" "$testfile" $srcfile] } {
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/fstatat-reverse.c b/gdb/testsuite/gdb.reverse/fstatat-reverse.c
index bd8c4e3..d46fe91 100644
--- a/gdb/testsuite/gdb.reverse/fstatat-reverse.c
+++ b/gdb/testsuite/gdb.reverse/fstatat-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/fstatat-reverse.exp b/gdb/testsuite/gdb.reverse/fstatat-reverse.exp
index 396d40e..db2f5dc 100644
--- a/gdb/testsuite/gdb.reverse/fstatat-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/fstatat-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/func-map-to-same-line.c b/gdb/testsuite/gdb.reverse/func-map-to-same-line.c
index c88ad70..61b1efc 100644
--- a/gdb/testsuite/gdb.reverse/func-map-to-same-line.c
+++ b/gdb/testsuite/gdb.reverse/func-map-to-same-line.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/func-map-to-same-line.exp b/gdb/testsuite/gdb.reverse/func-map-to-same-line.exp
index 8f933eb..6c32d86 100644
--- a/gdb/testsuite/gdb.reverse/func-map-to-same-line.exp
+++ b/gdb/testsuite/gdb.reverse/func-map-to-same-line.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/getrandom.c b/gdb/testsuite/gdb.reverse/getrandom.c
index 532b549..e266c01 100644
--- a/gdb/testsuite/gdb.reverse/getrandom.c
+++ b/gdb/testsuite/gdb.reverse/getrandom.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/getrandom.exp b/gdb/testsuite/gdb.reverse/getrandom.exp
index 572356b..2756fa3 100644
--- a/gdb/testsuite/gdb.reverse/getrandom.exp
+++ b/gdb/testsuite/gdb.reverse/getrandom.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/getresuid-reverse.c b/gdb/testsuite/gdb.reverse/getresuid-reverse.c
index 6f4b8f8..f73947b 100644
--- a/gdb/testsuite/gdb.reverse/getresuid-reverse.c
+++ b/gdb/testsuite/gdb.reverse/getresuid-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/getresuid-reverse.exp b/gdb/testsuite/gdb.reverse/getresuid-reverse.exp
index 50d327a..37d070d 100644
--- a/gdb/testsuite/gdb.reverse/getresuid-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/getresuid-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/i386-avx-reverse.c b/gdb/testsuite/gdb.reverse/i386-avx-reverse.c
index 8156575..bf6cb77 100644
--- a/gdb/testsuite/gdb.reverse/i386-avx-reverse.c
+++ b/gdb/testsuite/gdb.reverse/i386-avx-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,6 +30,18 @@ char global_buf1[] = {0, 0, 0, 0, 0, 0, 0, 0,
char *dyn_buf0;
char *dyn_buf1;
+ /* Zero memory regions again, so that future tests can update them
+ without worry. */
+void
+reset_buffers ()
+{
+ for (int i = 0; i < 32; i++)
+ {
+ global_buf1[i] = 0;
+ dyn_buf1[i] = 0;
+ }
+}
+
int
vmov_test ()
{
@@ -168,6 +180,22 @@ vmov_test ()
asm volatile ("vmovapd %%xmm0, %0" : : "m"(*dyn_buf1));
asm volatile ("vmovaps %%ymm15, %0" : : "m"(*dyn_buf1));
+ /* Testing vmov[hl|lh]ps and vmov[h|l]pd. */
+ asm volatile ("vmovhlps %xmm1, %xmm8, %xmm0");
+ asm volatile ("vmovhlps %xmm1, %xmm2, %xmm15");
+ asm volatile ("vmovlhps %xmm1, %xmm8, %xmm0");
+ asm volatile ("vmovlhps %xmm1, %xmm2, %xmm15");
+
+ asm volatile ("vmovhps %0, %%xmm1, %%xmm0" : : "m"(buf0));
+ asm volatile ("vmovhps %%xmm0, %0" : "=m" (buf1));
+ asm volatile ("vmovhpd %0, %%xmm1, %%xmm15" : : "m"(global_buf0));
+ asm volatile ("vmovhpd %%xmm15, %0" : "=m" (global_buf1));
+ asm volatile ("vmovlpd %0, %%xmm1, %%xmm15" : : "m"(*dyn_buf0));
+ asm volatile ("vmovlpd %%xmm15, %0" : "=m" (*dyn_buf1));
+
+ asm volatile ("vmovddup %xmm1, %xmm15");
+ asm volatile ("vmovddup %ymm2, %ymm0");
+
/* We have a return statement to deal with
epilogue in different compilers. */
return 0; /* end vmov_test */
@@ -245,7 +273,7 @@ vpunpck_test ()
return 0; /* end vpunpck_test */
}
-/* Test if we can record vpbroadcast instructions. */
+/* Test if we can record vpbroadcast and vbroadcast instructions. */
int
vpbroadcast_test ()
{
@@ -268,6 +296,14 @@ vpbroadcast_test ()
asm volatile ("vpbroadcastq %xmm1, %ymm0");
asm volatile ("vpbroadcastq %xmm1, %ymm15");
+ asm volatile ("vbroadcastss %xmm1, %xmm0");
+ asm volatile ("vbroadcastss %xmm1, %ymm15");
+ asm volatile ("vbroadcastss %0, %%ymm0" : : "m" (global_buf0));
+ asm volatile ("vbroadcastss %0, %%xmm15": : "m" (*dyn_buf0));
+ asm volatile ("vbroadcastsd %xmm1, %ymm0");
+ asm volatile ("vbroadcastsd %0, %%ymm15": : "m" (global_buf0));
+ asm volatile ("vbroadcastf128 %0, %%ymm0" : : "m" (*dyn_buf0));
+
/* We have a return statement to deal with
epilogue in different compilers. */
return 0; /* end vpbroadcast_test */
@@ -372,6 +408,7 @@ arith_test ()
/* Using GDB, load these values onto registers for testing.
ymm0.v8_float = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5}
ymm1.v8_float = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5}
+ ymm2.v2_int128 = {0x0, 0x0}
ymm15.v2_int128 = {0x0, 0x0}
this way it's easy to confirm we're undoing things correctly. */
asm volatile ("vaddps %xmm0, %xmm1, %xmm15");
@@ -416,9 +453,318 @@ arith_test ()
asm volatile ("vmaxss %xmm0, %xmm1, %xmm15");
asm volatile ("vmaxsd %xmm0, %xmm1, %xmm15");
+ /* Some sanity checks for other arithmetic instructions. */
+ asm volatile ("vpaddb %xmm0, %xmm1, %xmm2");
+ asm volatile ("vpaddw %xmm0, %xmm1, %xmm15");
+ asm volatile ("vpaddd %ymm0, %ymm1, %ymm2");
+ asm volatile ("vpaddq %ymm0, %ymm1, %ymm15");
+
+ asm volatile ("vpmullw %xmm0, %xmm1, %xmm2");
+ asm volatile ("vpmulld %xmm0, %xmm1, %xmm15");
+ asm volatile ("vpmulhw %ymm0, %ymm1, %ymm2");
+ asm volatile ("vpmulhuw %ymm0, %ymm1, %ymm15");
+ asm volatile ("vpmuludq %ymm0, %ymm1, %ymm15");
+
+ asm volatile ("vxorps %xmm0, %xmm1, %xmm2");
+ asm volatile ("vxorpd %ymm0, %ymm1, %ymm2");
+ asm volatile ("vpand %xmm0, %xmm1, %xmm15");
+ asm volatile ("vpandn %ymm0, %ymm1, %ymm15");
+
+ asm volatile ("vpsadbw %xmm0, %xmm1, %xmm2");
+ asm volatile ("vpsadbw %ymm0, %ymm1, %ymm15");
+
return 0; /* end arith_test */
}
+int
+vaddsubpd_test ()
+{
+ /* start vaddsubpd_test */
+ /* YMM test. */
+ asm volatile ("vaddsubpd %ymm15,%ymm1,%ymm0");
+ asm volatile ("vaddsubpd %ymm0,%ymm1,%ymm15");
+ asm volatile ("vaddsubpd %ymm2,%ymm3,%ymm4");
+
+ /* XMM test. */
+ asm volatile ("vaddsubpd %xmm15,%xmm1,%xmm2");
+ asm volatile ("vaddsubpd %xmm0,%xmm1,%xmm10");
+ return 0; /* end vaddsubpd_test */
+}
+
+int
+vaddsubps_test ()
+{
+ /* start vaddsubps_test */
+ /* YMM test. */
+ asm volatile ("vaddsubps %ymm15,%ymm1,%ymm2");
+ asm volatile ("vaddsubps %ymm0,%ymm1,%ymm10");
+ asm volatile ("vaddsubps %ymm2,%ymm3,%ymm4");
+
+ /* XMM test. */
+ asm volatile ("vaddsubps %xmm0,%xmm1,%xmm15");
+ asm volatile ("vaddsubps %xmm15,%xmm1,%xmm0");
+ return 0; /* end vaddsubps_test */
+}
+
+
+/* Test record shifting instructions. */
+int
+shift_test ()
+{
+ /* start shift_test. */
+ /* Using GDB, load these values onto registers for testing.
+ ymm0.v2_int128 = {0, 0}
+ ymm1.v16_int16 = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}
+ xmm2.uint128 = 1
+ ymm15.v2_int128 = {0x0, 0x0}
+ this way it's easy to confirm we're undoing things correctly. */
+
+ asm volatile ("vpsllw $1, %xmm1, %xmm0");
+ asm volatile ("vpsllw %xmm2, %ymm1, %ymm0");
+ asm volatile ("vpslld $3, %ymm1, %ymm15");
+ asm volatile ("vpslld %xmm2, %xmm1, %xmm15");
+ asm volatile ("vpsllq $5, %xmm1, %xmm15");
+ asm volatile ("vpsllq %xmm2, %ymm1, %ymm15");
+
+ asm volatile ("vpsraw $1, %xmm1, %xmm0");
+ asm volatile ("vpsraw %xmm2, %ymm1, %ymm0");
+ asm volatile ("vpsrad $3, %ymm1, %ymm15");
+ asm volatile ("vpsrad %xmm2, %xmm1, %xmm15");
+
+ asm volatile ("vpsrlw $1, %xmm1, %xmm0");
+ asm volatile ("vpsrlw %xmm2, %ymm1, %ymm0");
+ asm volatile ("vpsrld $3, %ymm1, %ymm15");
+ asm volatile ("vpsrld %xmm2, %xmm1, %xmm15");
+ asm volatile ("vpsrlq $5, %xmm1, %xmm15");
+ asm volatile ("vpsrlq %xmm2, %ymm1, %ymm15");
+
+ /* The dq version is treated separately in the manual, so
+ we test it separately just to be sure. */
+ asm volatile ("vpslldq $1, %xmm1, %xmm0");
+ asm volatile ("vpslldq $2, %ymm1, %ymm0");
+ asm volatile ("vpslldq $3, %xmm1, %xmm15");
+ asm volatile ("vpslldq $4, %ymm1, %ymm15");
+
+ asm volatile ("vpsrldq $1, %xmm1, %xmm0");
+ asm volatile ("vpsrldq $2, %ymm1, %ymm0");
+ asm volatile ("vpsrldq $3, %xmm1, %xmm15");
+ asm volatile ("vpsrldq $4, %ymm1, %ymm15");
+
+ return 0; /* end shift_test */
+}
+
+int
+shuffle_test ()
+{
+ /* start shuffle_test. */
+ /* Using GDB, load these values onto registers for testing.
+ ymm0.v2_int128 = {0, 0}
+ ymm1.v16_int16 = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}
+ ymm2.v16_int15 = {17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}
+ ymm15.v2_int128 = {0x0, 0x0}
+ this way it's easy to confirm we're undoing things correctly. */
+
+ asm volatile ("vpshufb %xmm1, %xmm2, %xmm0");
+ asm volatile ("vpshufb %ymm1, %ymm2, %ymm15");
+ asm volatile ("vpshufd $1, %ymm2, %ymm0");
+ asm volatile ("vpshufd $2, %xmm2, %xmm15");
+
+ asm volatile ("vpshufhw $3, %xmm2, %xmm0");
+ asm volatile ("vpshufhw $4, %ymm2, %ymm15");
+ asm volatile ("vpshuflw $5, %ymm2, %ymm0");
+ asm volatile ("vpshuflw $6, %xmm2, %xmm15");
+
+ asm volatile ("vshufps $1, %xmm1, %xmm2, %xmm0");
+ asm volatile ("vshufps $2, %ymm1, %ymm2, %ymm15");
+ asm volatile ("vshufpd $4, %ymm1, %ymm2, %ymm0");
+ asm volatile ("vshufpd $8, %xmm1, %xmm2, %xmm15");
+
+ return 0; /* end shuffle_test */
+}
+
+int
+permute_test ()
+{
+ /* start permute_test. */
+ /* Using GDB, load these values onto registers for testing.
+ ymm0.v2_int128 = {0, 0}
+ ymm1.v16_int16 = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}
+ ymm2.v16_int16 = {17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}
+ ymm15.v2_int128 = {0x0, 0x0}
+ eax = 0
+ this way it's easy to confirm we're undoing things correctly. */
+ asm volatile ("vperm2f128 $1, %ymm1, %ymm2, %ymm0");
+ asm volatile ("vperm2f128 $0, %ymm1, %ymm2, %ymm15");
+ asm volatile ("vperm2i128 $1, %ymm2, %ymm1, %ymm0");
+ asm volatile ("vperm2i128 $0, %ymm2, %ymm1, %ymm15");
+
+ asm volatile ("vpermd %ymm1, %ymm2, %ymm0");
+ asm volatile ("vpermd %ymm1, %ymm2, %ymm15");
+ asm volatile ("vpermq $1, %ymm1, %ymm0");
+ asm volatile ("vpermq $0, %ymm2, %ymm15");
+
+ asm volatile ("vpermilpd %ymm1, %ymm2, %ymm0");
+ asm volatile ("vpermilpd %xmm1, %xmm2, %xmm15");
+ asm volatile ("vpermilpd $1, %ymm2, %ymm15");
+ asm volatile ("vpermilpd $0, %xmm2, %xmm0");
+ asm volatile ("vpermilps %ymm1, %ymm2, %ymm0");
+ asm volatile ("vpermilps %xmm1, %xmm2, %xmm15");
+ asm volatile ("vpermilps $1, %ymm2, %ymm15");
+ asm volatile ("vpermilps $0, %xmm2, %xmm0");
+
+ asm volatile ("vpermpd $0, %ymm1, %ymm15");
+ asm volatile ("vpermpd $0, %ymm2, %ymm0");
+ asm volatile ("vpermps %ymm1, %ymm2, %ymm0");
+ asm volatile ("vpermps %ymm1, %ymm2, %ymm15");
+
+ return 0; /* end permute_test */
+}
+
+int
+extract_insert_test ()
+{
+ /* start extract_insert_test. */
+ /* Using GDB, load these values onto registers for testing.
+ ymm0.v2_int128 = {0, 0}
+ ymm1.v16_int16 = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}
+ xmm2.uint128 = 0xcafe
+ ymm15.v2_int128 = {0x0, 0x0}
+ eax = 0
+ this way it's easy to confirm we're undoing things correctly. */
+
+ asm volatile ("vinserti128 $1, %xmm2, %ymm1, %ymm0");
+ asm volatile ("vinsertf128 $0, %xmm2, %ymm1, %ymm15");
+ asm volatile ("vextracti128 $1, %ymm1, %xmm0");
+ asm volatile ("vextractf128 $0, %ymm1, %xmm15");
+ asm volatile ("vinsertps $16, %xmm2, %xmm1, %xmm0");
+ asm volatile ("vextractps $0, %xmm2, %rax");
+
+ asm volatile ("vpextrb $5, %xmm1, %rax");
+ asm volatile ("vpextrb $4, %%xmm1, %0" : "=m" (global_buf1));
+ asm volatile ("vpextrd $3, %xmm1, %eax");
+ asm volatile ("vpextrd $2, %%xmm1, %0" : "=m" (global_buf1));
+ asm volatile ("vpextrq $1, %xmm1, %rax");
+ asm volatile ("vpextrq $0, %%xmm1, %0" : "=m" (global_buf1));
+
+ asm volatile ("vpinsrb $3, %rax, %xmm2, %xmm0");
+ asm volatile ("vpinsrw $2, %eax, %xmm2, %xmm15");
+ asm volatile ("vpinsrd $1, %eax, %xmm2, %xmm0");
+ asm volatile ("vpinsrq $0, %rax, %xmm2, %xmm15");
+
+ /* vpextrw has completely different mechanics to other vpextr
+ instructions, so separate them for ease of testing later. */
+ asm volatile ("vpextrw $1, %xmm1, %eax");
+ asm volatile ("vpextrw $1, %%xmm1, %0" : "=m" (global_buf1));
+
+ return 0; /* end extract_insert_test */
+}
+
+int
+blend_test ()
+{
+ /* start blend_test. */
+ /* Using GDB, load these values onto registers for testing.
+ ymm0.v2_int128 = {0, 0}
+ ymm1.v16_int16 = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}
+ ymm2.v16_int16 = {17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}
+ ymm15.v2_int128 = {0x0, 0x0}
+ this way it's easy to confirm we're undoing things correctly. */
+
+ asm volatile ("vblendps $5, %xmm1, %xmm2, %xmm0");
+ asm volatile ("vblendpd $10, %ymm1, %ymm2, %ymm15");
+ asm volatile ("vblendvps %ymm15, %ymm1, %ymm2, %ymm0");
+ asm volatile ("vblendvpd %xmm0, %xmm1, %xmm2, %xmm15");
+
+ asm volatile ("vpblendw $94, %ymm1, %ymm2, %ymm15");
+ asm volatile ("vpblendw $47, %xmm1, %xmm2, %xmm0");
+ asm volatile ("vpblendd $22, %ymm1, %ymm2, %ymm0");
+ asm volatile ("vpblendd $11, %xmm1, %xmm2, %xmm15");
+ asm volatile ("vpblendvb %xmm0, %xmm1, %xmm2, %xmm15");
+ asm volatile ("vpblendvb %ymm0, %ymm1, %ymm2, %ymm0");
+
+ return 0; /* end blend_test */
+}
+
+int
+compare_test ()
+{
+ /* start compare_test. */
+ /* Using GDB, load these values onto registers for testing.
+ xmm0.v4_float = {0, 1.5, 2, 0}
+ xmm1.v4_float = {0, 1, 2.5, -1}
+ xmm15.v4_float = {-1, -2, 10, 100}
+ eflags = 2
+ eflags can't be set to some values, if we set it to 0, it'll
+ be reset to 2, so set it to that directly to make results less
+ confusing.
+ this way it's easy to confirm we're undoing things correctly. */
+
+ asm volatile ("vcomisd %xmm0, %xmm1");
+ asm volatile ("vcomiss %xmm15, %xmm1");
+ asm volatile ("vucomiss %xmm1, %xmm15");
+ asm volatile ("vucomisd %xmm15, %xmm0");
+
+ return 0; /* end compare_test */
+}
+
+int
+pack_test ()
+{
+ /* start pack_test. */
+ /* Using GDB, load these values onto registers for testing.
+ xmm0.v4_float = {0, 1.5, 2, 0}
+ xmm1.v4_float = {0, 1, 2.5, -1}
+ xmm2.v4_float = {0, 1, 2.5, -1}
+ xmm15.v4_float = {-1, -2, 10, 100}
+ this way it's easy to confirm we're undoing things correctly. */
+
+ asm volatile ("vpacksswb %xmm1, %xmm2, %xmm0");
+ asm volatile ("vpacksswb %ymm1, %ymm2, %ymm15");
+ asm volatile ("vpackssdw %xmm1, %xmm2, %xmm15");
+ asm volatile ("vpackssdw %ymm1, %ymm2, %ymm0");
+ asm volatile ("vpackuswb %xmm1, %xmm2, %xmm0");
+ asm volatile ("vpackuswb %ymm1, %ymm2, %ymm15");
+ asm volatile ("vpackusdw %xmm1, %xmm2, %xmm15");
+ asm volatile ("vpackusdw %ymm1, %ymm2, %ymm0");
+
+ return 0; /* end pack_test */
+}
+
+int
+convert_test ()
+{
+ /* start convert_test. */
+ /* Using GDB, load these values onto registers for testing.
+ xmm0.v2_int128 = {0, 0}
+ xmm1.v4_float = {0, 1, 2.5, 10}
+ xmm15.v2_int128 = {0, 0}
+ ecx = -1
+ ebx = 0
+ this way it's easy to confirm we're undoing things correctly. */
+
+ asm volatile ("vcvtdq2ps %xmm1, %xmm0");
+ asm volatile ("vcvtdq2pd %xmm1, %xmm15");
+
+ asm volatile ("vcvtps2dq %xmm1, %xmm15");
+ asm volatile ("vcvtps2pd %xmm1, %xmm0");
+ asm volatile ("vcvtpd2ps %xmm1, %xmm15");
+ asm volatile ("vcvtpd2dq %xmm1, %xmm0");
+
+ asm volatile ("vcvtsd2si %xmm1, %rbx");
+ asm volatile ("vcvtsd2ss %xmm0, %xmm1, %xmm15");
+ asm volatile ("vcvtsi2sd %rcx, %xmm1, %xmm0");
+ asm volatile ("vcvtsi2ss %rcx, %xmm1, %xmm15");
+ asm volatile ("vcvtss2sd %xmm15, %xmm1, %xmm0");
+ asm volatile ("vcvtss2si %xmm1, %rbx");
+
+ asm volatile ("vcvttpd2dq %xmm1, %xmm0");
+ asm volatile ("vcvttps2dq %xmm1, %xmm15");
+ asm volatile ("vcvttsd2si %xmm0, %rbx");
+ asm volatile ("vcvttss2si %xmm1, %ecx");
+
+ return 0; /* end convert_test */
+}
+
/* This include is used to allocate the dynamic buffer and have
the pointers aligned to a 32-bit boundary, so we can test instructions
that require aligned memory. */
@@ -442,6 +788,7 @@ main ()
asm volatile ("vmovq %0, %%xmm15": : "m" (global_buf1));
vmov_test ();
+ reset_buffers ();
vpunpck_test ();
vpbroadcast_test ();
vzeroupper_test ();
@@ -449,5 +796,15 @@ main ()
vpcmpeq_test ();
vpmovmskb_test ();
arith_test ();
+ vaddsubpd_test ();
+ vaddsubps_test ();
+ shift_test ();
+ shuffle_test ();
+ permute_test ();
+ extract_insert_test ();
+ blend_test ();
+ compare_test ();
+ pack_test ();
+ convert_test ();
return 0; /* end of main */
}
diff --git a/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp b/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp
index f927960..b3550e2 100644
--- a/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2023 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -109,7 +109,7 @@ proc record_full_function {function} {
gdb_breakpoint $end temporary
gdb_continue_to_breakpoint "start ${function}_test"
- if [supports_process_record] {
+ if {[supports_process_record]} {
# Activate process record/replay.
gdb_test_no_output "record" "${function}: turn on process record"
}
@@ -149,6 +149,33 @@ global decimal
if {[record_full_function "vmov"] == true} {
# Now execute backwards, checking all instructions.
+ test_one_register "vmovddup" "ymm0" \
+ "0x3736353433323130c004000000000000, 0x0"
+ test_one_register "vmovddup" "ymm15" \
+ "0x2726252423222120, 0x0"
+ test_one_memory "vmovlpd" "dyn_buf1" \
+ "\\\{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28" \
+ true
+ test_one_register "vmovlpd" "ymm15" \
+ "0x1716151413121110c004000000000000, 0x0"
+ test_one_memory "vmovhpd" "global_buf1" \
+ "\\\{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18"
+ test_one_register "vmovhpd" "ymm15" \
+ "0xc004000000000000c004000000000000, 0x0"
+ test_one_memory "vmovhps" "buf1" \
+ "\\\{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x38"
+ test_one_register "vmovhps" "ymm0" \
+ "0xc004000000000000c004000000000000, 0x0"
+
+ test_one_register "vmovlhps" "ymm15" \
+ "0x0, 0x0"
+ test_one_register "vmovlhps" "ymm0" \
+ "0x0, 0x0"
+ test_one_register "vmovhlps" "ymm15" \
+ "0x2f2e2d2c2b2a29280000000000000000, 0x2f2e2d2c2b2a29282726252423222120"
+ test_one_register "vmovhlps" "ymm0" \
+ "0x2f2e2d2c2b2a29282726252423222120, 0x0"
+
# Explicitly test for the start of the array, since the value repeats.
test_one_memory "vmovaps" "dyn_buf1" \
"\\\{0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28" true
@@ -365,6 +392,24 @@ gdb_test_no_output "set \$xmm1.v2_int64 = {0x1716151413121110, 0x1f1e1d1c1b1a191
"set xmm1 for vpbroadcast"
gdb_test_no_output "set \$ymm15.v2_int128 = {0x0, 0x0}" "set xmm15 for vpbroadcast"
if {[record_full_function "vpbroadcast"] == true} {
+ test_one_register "vbroadcastf128" "ymm0" \
+ "0x17161514131211101716151413121110, 0x17161514131211101716151413121110"
+ test_one_register "vbroadcastsd" "ymm15" \
+ "0x23222120232221202322212023222120, 0x0"
+ test_one_register "vbroadcastsd" "ymm0" \
+ "0x13121110131211101312111013121110, 0x13121110131211101312111013121110"
+
+ test_one_register "vbroadcastss" "ymm15" \
+ "0x13121110131211101312111013121110, 0x13121110131211101312111013121110" \
+ "broadcast from memory"
+ test_one_register "vbroadcastss" "ymm0" \
+ "0x13121110131211101312111013121110, 0x0" \
+ "broadcast from memory"
+ test_one_register "vbroadcastss" "ymm15" \
+ "0x17161514131211101716151413121110, 0x17161514131211101716151413121110"
+ test_one_register "vbroadcastss" "ymm0" \
+ "0x17161514131211101716151413121110, 0x17161514131211101716151413121110"
+
test_one_register "vpbroadcastq" "ymm15" "0x13121110131211101312111013121110, 0x0"
test_one_register "vpbroadcastq" "ymm0" "0x13121110131211101312111013121110, 0x0"
@@ -397,7 +442,7 @@ gdb_test_no_output "set \$ymm15.v2_int128 = {0x0, 0xcafeface}" "set ymm15 for vp
if {[record_full_function "vzeroupper"] == true} {
# Since vzeroupper needs to save 8 or 16 registers, let's check what was
# actually recorded, instead of just undoing an instruction. Only
- # really check the values of egisters 0, 1, 2 and 15 because those are
+ # really check the values of registers 0, 1, 2 and 15 because those are
# the only ones we're setting.
gdb_test "maint print record-instruction" \
[multi_line "Register ymm0h changed: 74565" \
@@ -527,9 +572,43 @@ gdb_test_no_output \
"set \$ymm0.v8_float = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5}"
gdb_test_no_output \
"set \$ymm1.v8_float = {0, 1, 2, 3, 4, 5, 6, 7}"
+gdb_test_no_output "set \$ymm2.v2_int128 = {0,0}"
gdb_test_no_output "set \$ymm15.v2_int128 = {0,0}"
if {[record_full_function "arith"] == true} {
+ test_one_register "vpsadbw" "ymm15" \
+ "0x20000000200000004000003f000000, 0x100000001000000010000000100000"
+ test_one_register "vpsadbw" "ymm2" \
+ "0x20000000200000004000003f000000, 0x100000001000000010000000100000"
+ test_one_register "vpandn" "ymm15" \
+ "0x40400000400000003f80000000000000, 0x0"
+ test_one_register "vpand" "ymm15" \
+ "0x10080000000000000000000000000000, 0x10649c00000000001044480000000000"
+ test_one_register "vxorpd" "ymm2" \
+ "0x20000000200000004000003f000000, 0x0"
+ test_one_register "vxorps" "ymm2" \
+ "0x10280000100800000fd0000000000000, 0x10740000106400001054000010440000"
+
+ test_one_register "vpmuludq" "ymm15" \
+ "0x10280000100800000fd0000000000000, 0x10740000106400001054000010440000"
+ test_one_register "vpmulhuw" "ymm15" \
+ "0x0, 0x0"
+ test_one_register "vpmulhw" "ymm2" \
+ "0x18000000000000002000000000000000, 0x0"
+ test_one_register "vpmulld" "ymm15" \
+ "0x80a00000802000007f4000003f000000, 0x81d00000819000008150000081100000"
+ test_one_register "vpmullw" "ymm2" \
+ "0x80a00000802000007f4000003f000000, 0x81d00000819000008150000081100000"
+
+ test_one_register "vpaddq" "ymm15" \
+ "0x80a00000802000007f4000003f000000, 0x0"
+ test_one_register "vpaddd" "ymm2" \
+ "0x80a00000802000007e4000003f000000, 0x0"
+ test_one_register "vpaddw" "ymm15" \
+ "0x40400000400000003fc000003f000000, 0x0"
+ test_one_register "vpaddb" "ymm2" \
+ "0x0, 0x0"
+
test_one_register "vmaxsd" "ymm15" \
"0x40400000400000003f8000003f000000, 0x0" "ymm operation: "
test_one_register "vmaxss" "ymm15" \
@@ -626,3 +705,493 @@ if {[record_full_function "arith"] == true} {
}
gdb_test "finish" "Run till exit from.*arith_test.*" \
"leaving arith"
+
+# Preparation and testing vaddsubpd instructions
+
+gdb_test_no_output "set \$ymm15.v2_int128 = {0xcafeface, 0xcafeface}" \
+ "set ymm15 for vaddsubpd"
+gdb_test_no_output "set \$ymm0.v2_int128 = {0xcafeface, 0xcafeface}" \
+ "set ymm0 for vaddsubpd"
+gdb_test_no_output "set \$xmm2.uint128 = 0xbeef" \
+ "set xmm2 for vaddsubpd"
+gdb_test_no_output "set \$xmm10.uint128 = 0xbeef" \
+ "set xmm10 for vaddsubpd"
+gdb_test_no_output "set \$ymm3.v2_int128 = {0xcafeface, 0xcafeface}" \
+ "set ymm3 for vaddsubpd"
+gdb_test_no_output "set \$ymm4.v2_int128 = {0xcafeface, 0xcafeface}" \
+ "set ymm4 for vaddsubpd"
+
+if {[record_full_function "vaddsubpd"] == true} {
+ test_one_register "vaddsubpd" "xmm10" \
+ "0xbeef" "xmm10:"
+ test_one_register "vaddsubpd" "xmm2" \
+ "0xbeef" "xmm2:"
+ test_one_register "vaddsubpd" "ymm4" \
+ "0xcafeface, 0xcafeface" "ymm4: "
+ test_one_register "vaddsubpd" "ymm15" \
+ "0xcafeface, 0xcafeface" "ymm15: "
+ test_one_register "vaddsubpd" "ymm0" \
+ "0xcafeface, 0xcafeface" "ymm0: "
+
+ gdb_test "record stop" "Process record is stopped.*" \
+ "delete history for vaddsubpd_test"
+} else {
+ untested "couldn't run vaddsubpd tests"
+}
+gdb_test "finish" "Run till exit from.*vaddsubpd_test.*" \
+ "leaving vaddsubpd"
+
+# Preparation and testing vaddsubps instruction
+
+gdb_test_no_output "set \$ymm10.v2_int128 = {0xcafeface, 0xcafeface}" \
+ "set ymm10 for vaddsubps"
+gdb_test_no_output "set \$ymm2.v2_int128 = {0xcafeface, 0xcafeface}" \
+ "set ymm2 for vaddsubps"
+gdb_test_no_output "set \$xmm15.uint128 = 0xbeef" \
+ "set xmm15 for vaddsubps"
+gdb_test_no_output "set \$xmm0.uint128 = 0xbeef" \
+ "set xmm0 for vaddsubps"
+gdb_test_no_output "set \$ymm3.v2_int128 = {0xcafeface, 0xcafeface}" \
+ "set ymm3 for vaddsubps"
+gdb_test_no_output "set \$ymm4.v2_int128 = {0xcafeface, 0xcafeface}" \
+ "set ymm4 for vaddsubps"
+
+if {[record_full_function "vaddsubps"] == true} {
+ test_one_register "vaddsubps" "xmm0" \
+ "0xbeef" "xmm0: "
+ test_one_register "vaddsubps" "xmm15" \
+ "0xbeef" "xmm15: "
+ test_one_register "vaddsubps" "ymm4" \
+ "0xcafeface, 0xcafeface" "ymm4: "
+ test_one_register "vaddsubps" "ymm10" \
+ "0xcafeface, 0xcafeface" "ymm10: "
+ test_one_register "vaddsubps" "ymm2" \
+ "0xcafeface, 0xcafeface" "ymm2: "
+
+ gdb_test "record stop" "Process record is stopped.*" \
+ "delete history for vaddsubps_test"
+} else {
+ untested "couldn't run vaddsubps tests"
+}
+gdb_test "finish" "Run till exit from.*vaddsubps_test.*" \
+ "leaving vaddsubps"
+
+# Preparation and testing shifting instructions.
+gdb_test_no_output \
+ "set \$ymm0.v2_int128 = {0, 0}" "set ymm0 for shift"
+gdb_test_no_output \
+ "set \$ymm1.v16_int16 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}" \
+ "set ymm1 for shift"
+gdb_test_no_output "set \$xmm2.uint128 = 1" "set ymm2 for shift"
+gdb_test_no_output "set \$ymm15.v2_int128 = {0,0}" "set ymm15 for shift"
+
+if {[record_full_function "shift"] == true} {
+ test_one_register "vpsrldq" "ymm15" \
+ "0x80007000600050004000300, 0x0" \
+ "High ymm register: "
+ test_one_register "vpsrldq" "ymm15" \
+ "0x60005000400030002000100000000, 0xe000d000c000b000a000900000000" \
+ "High xmm register: "
+ test_one_register "vpsrldq" "ymm0" \
+ "0x800070006000500040003000200, 0x0" \
+ "Low ymm register: "
+ test_one_register "vpsrldq" "ymm0" \
+ "0x70006000500040003000200010000, 0xf000e000d000c000b000a00090000" \
+ "Low xmm register: "
+
+ test_one_register "vpslldq" "ymm15" \
+ "0x7000600050004000300020001000000, 0x0" \
+ "High ymm register: "
+ test_one_register "vpslldq" "ymm15" \
+ "0x40003800300020002000180010000, 0x80007800700060006000580050004" \
+ "High xmm register: "
+ test_one_register "vpslldq" "ymm0" \
+ "0x8000700060005000400030002000100, 0x0" \
+ "Low ymm register: "
+ test_one_register "vpslldq" "ymm0" \
+ "0x40003000300020002000100010000, 0x80007000700060006000500050004" \
+ "Low xmm register: "
+
+ test_one_register "vpsrlq" "ymm15" \
+ "0x4000380030000000200018001000, 0x0" \
+ "from register: "
+ test_one_register "vpsrlq" "ymm15" \
+ "0x40003000300020002000100010000, 0x0" \
+ "from constant: "
+ test_one_register "vpsrld" "ymm15" \
+ "0x100000000c0000000800000004000, 0x200010001c0010001800100014001" \
+ "from register: "
+ test_one_register "vpsrld" "ymm15" \
+ "0x40003000300020002000100010000, 0x0" \
+ "from constant: "
+ test_one_register "vpsrlw" "ymm0" \
+ "0x40003000300020002000100010000, 0x0" \
+ "from register: "
+ test_one_register "vpsrlw" "ymm0" \
+ "0x40003000300020002000100010000, 0x80007000700060006000500050004" \
+ "from constant: "
+
+ test_one_register "vpsrad" "ymm15" \
+ "0x100000000c0000000800000004000, 0x200010001c0010001800100014001" \
+ "from register: "
+ test_one_register "vpsrad" "ymm15" \
+ "0x10000e000c000a0008000600040002, 0x20001e001c001a0018001600140012" \
+ "from constant: "
+ test_one_register "vpsraw" "ymm0" \
+ "0x40003000300020002000100010000, 0x0" \
+ "from register: "
+ test_one_register "vpsraw" "ymm0" \
+ "0x10000e000c000a0008000600040002, 0x20001e001c001a0018001600140012" \
+ "from constant: "
+
+ test_one_register "vpsllq" "ymm15" \
+ "0x10000e000c000a00080006000400020, 0x0" \
+ "from register: "
+ test_one_register "vpsllq" "ymm15" \
+ "0x10000e000c000a0008000600040002, 0x0" \
+ "from constant: "
+ test_one_register "vpslld" "ymm15" \
+ "0x400038003000280020001800100008, 0x800078007000680060005800500048" \
+ "from register: "
+ test_one_register "vpslld" "ymm15" "0x0, 0x0" "from constant: "
+ test_one_register "vpsllw" "ymm0" \
+ "0x10000e000c000a0008000600040002, 0x0" \
+ "from register: "
+ test_one_register "vpsllw" "ymm0" "0x0, 0x0" "from constant: "
+
+ gdb_test "record stop" "Process record is stopped.*" \
+ "delete history for shift_test"
+} else {
+ untested "couldn't run shift tests"
+}
+gdb_test "finish" "Run till exit from.*shift_test.*" \
+ "leaving shift"
+
+# Preparation and testing shuffling instructions.
+gdb_test_no_output \
+ "set \$ymm0.v2_int128 = {0, 0}" "set ymm0 for shuffle"
+gdb_test_no_output \
+ "set \$ymm1.v16_int16 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}" \
+ "set ymm1 for shuffle"
+gdb_test_no_output "set \$ymm2.v16_int16 = {17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}" \
+ "set ymm2 for shuffle"
+gdb_test_no_output "set \$ymm15.v2_int128 = {0,0}" "set ymm15 for shuffle"
+
+if {[record_full_function "shuffle"] == true} {
+ test_one_register "vshufpd" "ymm15" \
+ "0x20001000200010012001100160015, 0xa0009000a0009001a0019001e001d" \
+ "high register: "
+ test_one_register "vshufpd" "ymm0" \
+ "0x20001000200010012001100140013, 0x0" \
+ "low register: "
+ test_one_register "vshufps" "ymm15" \
+ "0x180017001600150011001100120013, 0x0" \
+ "high register: "
+ test_one_register "vshufps" "ymm0" \
+ "0x180017001600150011001100120012, 0x20001f001e001d00190019001a001a" \
+ "low register: "
+
+ test_one_register "vpshuflw" "ymm15" \
+ "0x150015001600150014001300120011, 0x1d001d001e001d001c001b001a0019" \
+ "high register: "
+ test_one_register "vpshuflw" "ymm0" \
+ "0x150015001500180014001300120011, 0x0" \
+ "low register: "
+ test_one_register "vpshufhw" "ymm15" \
+ "0x120011001200110012001100160015, 0x0" \
+ "high register: "
+ test_one_register "vpshufhw" "ymm0" \
+ "0x120011001200110012001100140013, 0x1a0019001a0019001a0019001c001b" \
+ "low register: "
+
+ test_one_register "vpshufd" "ymm15" \
+ "0x11151100111411001113110011121100, 0x1919190019201900191f1900191e1900" \
+ "high register: "
+ test_one_register "vpshufd" "ymm0" \
+ "0x11151100111411001113110011121100, 0x0" \
+ "low register: "
+ test_one_register "vpshufb" "ymm15" "0x0, 0x0" "high register: "
+ test_one_register "vpshufb" "ymm0" "0x0, 0x0" "low register: "
+
+ gdb_test "record stop" "Process record is stopped.*" \
+ "delete history for shuffle_test"
+} else {
+ untested "couldn't run shuffle tests"
+}
+gdb_test "finish" "Run till exit from.*shuffle_test.*" \
+ "leaving shuffle"
+
+# Preparation and testing permute instructions.
+gdb_test_no_output \
+ "set \$ymm0.v2_int128 = {0, 0}" "set ymm0 for permute"
+gdb_test_no_output \
+ "set \$ymm1.v16_int16 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}" \
+ "set ymm1 for permute"
+gdb_test_no_output "set \$ymm2.v16_int16 = {17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}" \
+ "set ymm2 for permute"
+gdb_test_no_output "set \$ymm15.v2_int128 = {0,0}" "set ymm15 for permute"
+
+if {[record_full_function "permute"] == true} {
+ test_one_register "vpermps" "ymm15" \
+ "0x40003000200010004000300020001, 0x40003000200010004000300020001"
+ test_one_register "vpermps" "ymm0" \
+ "0x140013001200110014001300120011, 0x140013001200110014001300120011"
+ test_one_register "vpermpd" "ymm0" \
+ "0x120011001200110012001100120011, 0x0"
+ test_one_register "vpermpd" "ymm15" \
+ "0x120011001200110012001100140013, 0x1a0019001a0019001a0019001c001b"
+
+ test_one_register "vpermilps" "ymm0" \
+ "0x180017001400130018001700140013, 0x20001f001c001b0020001f001c001b" \
+ "register version"
+ test_one_register "vpermilps" "ymm15" \
+ "0x180017001400130018001700140013, 0x0" \
+ "register version"
+ test_one_register "vpermilps" "ymm15" \
+ "0x140013001200110018001700160015, 0x1c001b001a0019001c001b001a0019" \
+ "immediate version"
+ test_one_register "vpermilps" "ymm0" \
+ "0x140013001200110014001300120011, 0x0" \
+ "immediate version"
+
+ test_one_register "vpermilpd" "ymm0" \
+ "0x140013001200110014001300120011, 0x1c001b001a0019001c001b001a0019" \
+ "register version"
+ test_one_register "vpermilpd" "ymm15" \
+ "0x140013001200110014001300120011, 0x0" \
+ "register version"
+ test_one_register "vpermilpd" "ymm15" \
+ "0x140013001200110014001300120011, 0x140013001200110014001300120011" \
+ "immediate version"
+ test_one_register "vpermilpd" "ymm0" \
+ "0x40003000200010008000700060005, 0x40003000200010004000300020001" \
+ "immediate version"
+
+ test_one_register "vpermq" "ymm15" \
+ "0x10000f000c000b0008000700040003, 0x10000f000c000b0008000700040003"
+ test_one_register "vpermq" "ymm0" \
+ "0x10000f000c000b0008000700040003, 0x10000f000c000b0008000700040003"
+ test_one_register "vpermd" "ymm15" \
+ "0x80007000600050004000300020001, 0x80007000600050004000300020001"
+ test_one_register "vpermd" "ymm0" \
+ "0x10000f000e000d000c000b000a0009, 0x80007000600050004000300020001"
+
+ test_one_register "vperm2i128" "ymm15" \
+ "0x180017001600150014001300120011, 0x180017001600150014001300120011"
+ test_one_register "vperm2i128" "ymm0" \
+ "0x20001f001e001d001c001b001a0019, 0x180017001600150014001300120011"
+ test_one_register "vperm2f128" "ymm15" "0x0, 0x0"
+ test_one_register "vperm2f128" "ymm0" "0x0, 0x0"
+
+ gdb_test "record stop" "Process record is stopped.*" \
+ "delete history for permute_test"
+} else {
+ untested "couldn't run permute tests"
+}
+gdb_test "finish" "Run till exit from.*permute_test.*" \
+ "leaving permute"
+
+# Preparation and testing extract_insert instructions.
+gdb_test_no_output \
+ "set \$ymm0.v2_int128 = {0, 0}" "set ymm0 for extract_insert"
+gdb_test_no_output \
+ "set \$ymm1.v16_int16 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}" \
+ "set ymm1 for extract_insert"
+gdb_test_no_output "set \$xmm2.uint128 = 0xcafe" \
+ "set ymm2 for extract_insert"
+gdb_test_no_output "set \$ymm15.v2_int128 = {0,0}" "set ymm15 for extract_insert"
+gdb_test_no_output "set \$rax = 0" "set eax for extract_insert"
+
+if {[record_full_function "extract_insert"] == true} {
+ test_one_memory "vpextrw" "global_buf1" \
+ "\\\{0x1, 0x0, 0x2, 0x0, 0x3, 0x0, 0x4, 0x0 <repeats 25 times>"
+ test_one_general_register "vpextrw" "rax" "0x8000700060005"
+
+ test_one_register "vpinsrq" "ymm15" \
+ "0x50000cafe, 0x0"
+ test_one_register "vpinsrd" "ymm0" \
+ "0x500cafe, 0x0"
+ test_one_register "vpinsrw" "ymm15" \
+ "0x80007000600050004000300020001, 0x0"
+ test_one_register "vpinsrb" "ymm0" \
+ "0x80007000600050000cafe00020001, 0x0"
+
+ test_one_memory "vpextrq" "global_buf1" \
+ "\\\{0x5, 0x0, 0x6, 0x0 <repeats 29 times>"
+ test_one_general_register "vpextrq" "rax" "0x80007"
+ test_one_memory "vpextrd" "global_buf1" \
+ "\\\{0x3, 0x0 <repeats 31 times>"
+ test_one_general_register "vpextrd" "rax" "0x0"
+ test_one_memory "vpextrb" "global_buf1" \
+ "\\\{0x0 <repeats 32 times>"
+ test_one_general_register "vpextrb" "rax" "0xcafe"
+
+ test_one_general_register "vextractps" "eax" "0x0"
+ test_one_register "vinsertps" "ymm0" \
+ "0x10000f000e000d000c000b000a0009, 0x0"
+ test_one_register "vextractf128" "ymm15" \
+ "0xcafe, 0x10000f000e000d000c000b000a0009"
+ test_one_register "vextracti128" "ymm0" \
+ "0x80007000600050004000300020001, 0xcafe"
+ test_one_register "vinsertf128" "ymm15" \
+ "0x0, 0x0"
+ test_one_register "vinserti128" "ymm0" \
+ "0x0, 0x0"
+
+ gdb_test "record stop" "Process record is stopped.*" \
+ "delete history for extract_insert_test"
+} else {
+ untested "couldn't run extract_insert tests"
+}
+gdb_test "finish" "Run till exit from.*extract_insert_test.*" \
+ "leaving extract_insert"
+
+# Preparation and testing blend instructions.
+gdb_test_no_output \
+ "set \$ymm0.v2_int128 = {0, 0}" "set ymm0 for blend"
+gdb_test_no_output \
+ "set \$ymm1.v16_int16 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}" \
+ "set ymm1 for blend"
+gdb_test_no_output \
+ "set \$ymm2.v16_int16 = {17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}" \
+ "set ymm2 for blend"
+gdb_test_no_output "set \$ymm15.v2_int128 = {0,0}" "set ymm15 for blend"
+
+if {[record_full_function "blend"] == true} {
+ test_one_register "vpblendvb" "ymm0" \
+ "0x180017000600050004000300120011, 0x20001f001e001d001c001b000a0009"
+ test_one_register "vpblendvb" "ymm15" \
+ "0x80007001600150004000300020001, 0x0"
+ test_one_register "vpblendd" "ymm15" \
+ "0x180007001600050004000300020011, 0x20000f001e000d000c000b000a0019"
+ test_one_register "vpblendd" "ymm0" \
+ "0x180017000600150004000300020001, 0x0"
+ test_one_register "vpblendw" "ymm0" \
+ "0x180017001600150014001300120011, 0x20001f001e001d001c001b001a0019"
+ test_one_register "vpblendw" "ymm15" \
+ "0x180017001600150014001300120011, 0x0"
+
+ test_one_register "vblendvpd" "ymm15" \
+ "0x80007000600050014001300120011, 0x10000f000e000d001c001b001a0019"
+ test_one_register "vblendvps" "ymm0" \
+ "0x180017000600050014001300020001, 0x0"
+ test_one_register "vblendpd" "ymm15" "0x0, 0x0"
+ test_one_register "vblendps" "ymm0" "0x0, 0x0"
+
+ gdb_test "record stop" "Process record is stopped.*" \
+ "delete history for blend_test"
+} else {
+ untested "couldn't run blend tests"
+}
+gdb_test "finish" "Run till exit from.*blend_test.*" \
+ "leaving blend"
+
+# Preparation and testing compare instructions.
+gdb_test_no_output \
+ "set \$xmm0.v4_float = {0, 1.5, 2, 0}" "set ymm0 for compare"
+gdb_test_no_output \
+ "set \$xmm1.v4_float = {0, 1, 2.5, -1}" "set ymm1 for compare"
+gdb_test_no_output \
+ "set \$xmm15.v4_float = {-1, -2, 10, 100}" "set ymm15 for compare"
+gdb_test_no_output "set \$eflags = 2"
+
+if {[record_full_function "compare"] == true} {
+ test_one_general_register "vucomisd" "eflags" "0x203"
+ test_one_general_register "vucomiss" "eflags" "0x202"
+ test_one_general_register "vcomiss" "eflags" "0x203"
+ test_one_general_register "vcomisd" "eflags" "0x202"
+
+ gdb_test "record stop" "Process record is stopped.*" \
+ "delete history for compare_test"
+} else {
+ untested "couldn't run compare tests"
+}
+gdb_test "finish" "Run till exit from.*compare_test.*" \
+ "leaving compare"
+
+# Preparation and testing pack instructions.
+gdb_test_no_output \
+ "set \$ymm0.v2_int128 = {0, 0}" "set ymm0 for pack"
+gdb_test_no_output \
+ "set \$ymm1.v16_int16 = {0x1020, 0x1121, 0x1222, 0x1323, 0x1424, 0x1525, 0x1626, 0x1727, 0x1828, 0x1929, 0x1a2a, 0x1b2b, 0x1c2c, 0x1d2d, 0x1e2e, 0x1f2f}" \
+ "set ymm1 for pack"
+gdb_test_no_output \
+ "set \$ymm2.v16_int16 = {0x3040, 0x3141, 0x3242, 0x3343, 0x3444, 0x3545, 0x3646, 0x3747, 0x3848, 0x3949, 0x3a4a, 0x3b4b, 0x3c4c, 0x3d4d, 0x3e4e, 0x3f4f}" \
+ "set ymm2 for pack"
+gdb_test_no_output \
+ "set \$ymm15.v2_int128 = {0, 0}" "set ymm15 for pack"
+
+if {[record_full_function "pack"] == true} {
+ test_one_register "vpackusdw" "ymm0" \
+ "0xffffffffffffffffffffffffffffffff, 0x0"
+ test_one_register "vpackusdw" "ymm15" \
+ "0xffffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffffff"
+ test_one_register "vpackuswb" "ymm15" \
+ "0x7fff7fff7fff7fff7fff7fff7fff7fff, 0x0"
+ test_one_register "vpackuswb" "ymm0" \
+ "0x7fff7fff7fff7fff7fff7fff7fff7fff, 0x7fff7fff7fff7fff7fff7fff7fff7fff"
+ test_one_register "vpackssdw" "ymm0" \
+ "0x7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f, 0x0"
+ test_one_register "vpackssdw" "ymm15" \
+ "0x7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f, 0x7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f"
+ test_one_register "vpacksswb" "ymm15" "0x0, 0x0"
+ test_one_register "vpacksswb" "ymm0" "0x0, 0x0"
+
+ gdb_test "record stop" "Process record is stopped.*" \
+ "delete history for pack_test"
+} else {
+ untested "couldn't run pack tests"
+}
+gdb_test "finish" "Run till exit from.*pack_test.*" \
+ "leaving pack"
+
+# Preparation and testing converting instructions.
+gdb_test_no_output \
+ "set \$ymm0.v2_int128 = {0,0}" \
+ "set ymm0 for convert test"
+gdb_test_no_output \
+ "set \$ymm1.v8_float = {0, 1, 2.5, 10, -1, -2.5, 0}" \
+ "set ymm1 for convert test"
+gdb_test_no_output "set \$ymm15.v2_int128 = {0,0}" \
+ "set ymm15 for convert test"
+gdb_test_no_output "set \$ecx = -1" "set ecx for convert test"
+gdb_test_no_output "set \$ebx = 1" "set ebx for convert test"
+
+if {[record_full_function "convert"] == true} {
+ gdb_test "maint print record-instruction" ".*"
+ test_one_general_register "vcvttss2si" "ecx" "0xffffffff"
+ test_one_general_register "vcvttsd2si" "ebx" "0x0"
+ test_one_register "vcvttps2dq" "ymm15" \
+ "0x41200000402000003f8000004f800000, 0x0"
+ test_one_register "vcvttpd2dq" "ymm0" \
+ "0x412000004020000041f0000000000000, 0x0"
+ test_one_general_register "vcvtss2si" "ebx" "0x0"
+
+ test_one_register "vcvtss2sd" "ymm0" \
+ "0x412000004020000041efffffffe00000, 0x0"
+ test_one_register "vcvtsi2ss" "ymm15" \
+ "0x41200000402000003f80000000000000, 0x0"
+ test_one_register "vcvtsi2sd" "ymm0" \
+ "0x8000000000000, 0x0"
+ test_one_register "vcvtsd2ss" "ymm15" \
+ "0x490000023c000000, 0x0"
+ test_one_general_register "vcvtsd2si" "ebx" "0x1"
+
+ test_one_register "vcvtpd2dq" "ymm0" \
+ "0x3ff00000000000000000000000000000, 0x0"
+ test_one_register "vcvtpd2ps" "ymm15" \
+ "0xa000000020000000100000000, 0x0"
+ test_one_register "vcvtps2pd" "ymm0" \
+ "0x4e8240004e8040004e7e000000000000, 0x0"
+ test_one_register "vcvtps2dq" "ymm15" \
+ "0x41cfc000000000000000000000000000, 0x0"
+ test_one_register "vcvtdq2pd" "ymm15" "0x0, 0x0"
+ test_one_register "vcvtdq2ps" "ymm0" "0x0, 0x0"
+
+ gdb_test "record stop" "Process record is stopped.*" \
+ "delete history for convert_test"
+} else {
+ untested "couldn't run convert tests"
+}
+gdb_test "finish" "Run till exit from.*convert_test.*" \
+ "leaving convert"
diff --git a/gdb/testsuite/gdb.reverse/i386-precsave.exp b/gdb/testsuite/gdb.reverse/i386-precsave.exp
index 3b204fb..c9a3a7e 100644
--- a/gdb/testsuite/gdb.reverse/i386-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/i386-precsave.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/i386-reverse.c b/gdb/testsuite/gdb.reverse/i386-reverse.c
index 0af9ab9..3dd89d9 100644
--- a/gdb/testsuite/gdb.reverse/i386-reverse.c
+++ b/gdb/testsuite/gdb.reverse/i386-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/i386-reverse.exp b/gdb/testsuite/gdb.reverse/i386-reverse.exp
index 868e259..9aee9a4 100644
--- a/gdb/testsuite/gdb.reverse/i386-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/i386-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ set end_of_inc_dec_tests [gdb_get_line_number " end inc_dec_tests "]
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/i386-sse-reverse.c b/gdb/testsuite/gdb.reverse/i386-sse-reverse.c
index 63230f4..86219eb 100644
--- a/gdb/testsuite/gdb.reverse/i386-sse-reverse.c
+++ b/gdb/testsuite/gdb.reverse/i386-sse-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/i386-sse-reverse.exp b/gdb/testsuite/gdb.reverse/i386-sse-reverse.exp
index 8306a3f..aa4cfce 100644
--- a/gdb/testsuite/gdb.reverse/i386-sse-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/i386-sse-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@ set end_sse4_test [gdb_get_line_number " end sse4_test "]
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/i387-env-reverse.exp b/gdb/testsuite/gdb.reverse/i387-env-reverse.exp
index db004d2..f3350fc 100644
--- a/gdb/testsuite/gdb.reverse/i387-env-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/i387-env-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ set location [gdb_get_line_number "END I387-FLOAT-REVERSE"]
gdb_test_no_output "record" "Turn on process record"
# This can take awhile.
set oldtimeout $timeout
-set timeout [expr $oldtimeout + 120]
+set timeout [expr {$oldtimeout + 120}]
gdb_test "until $location" ".*$srcfile:$location.*" \
"record to end of main"
set timeout $oldtimeout
diff --git a/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp b/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp
index 0813229..05be297 100644
--- a/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/insn-reverse-aarch64.c b/gdb/testsuite/gdb.reverse/insn-reverse-aarch64.c
index 098ebef..8110215 100644
--- a/gdb/testsuite/gdb.reverse/insn-reverse-aarch64.c
+++ b/gdb/testsuite/gdb.reverse/insn-reverse-aarch64.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/insn-reverse-arm.c b/gdb/testsuite/gdb.reverse/insn-reverse-arm.c
index cd56260..10266b0 100644
--- a/gdb/testsuite/gdb.reverse/insn-reverse-arm.c
+++ b/gdb/testsuite/gdb.reverse/insn-reverse-arm.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/insn-reverse-x86.c b/gdb/testsuite/gdb.reverse/insn-reverse-x86.c
index 4213e40..2f13093 100644
--- a/gdb/testsuite/gdb.reverse/insn-reverse-x86.c
+++ b/gdb/testsuite/gdb.reverse/insn-reverse-x86.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/insn-reverse.c b/gdb/testsuite/gdb.reverse/insn-reverse.c
index b1fc5d4..9d3a725 100644
--- a/gdb/testsuite/gdb.reverse/insn-reverse.c
+++ b/gdb/testsuite/gdb.reverse/insn-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/insn-reverse.exp b/gdb/testsuite/gdb.reverse/insn-reverse.exp
index 6a2aafb..9e238f0 100644
--- a/gdb/testsuite/gdb.reverse/insn-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/insn-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -106,7 +106,7 @@ proc test { func testcase_nr } {
}
# Registers contents after each backward single step.
- for {set i [expr $count - 1]} {$i >= 0} {incr i -1} {
+ for {set i [expr {$count - 1}]} {$i >= 0} {incr i -1} {
gdb_test -nopass "reverse-stepi"
set post_regs($i) [capture_command_output "info all-registers" ""]
}
diff --git a/gdb/testsuite/gdb.reverse/machinestate-precsave.exp b/gdb/testsuite/gdb.reverse/machinestate-precsave.exp
index cedca0f..94d9723 100644
--- a/gdb/testsuite/gdb.reverse/machinestate-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/machinestate-precsave.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# This file is part of the GDB testsuite.
+# This file is part of the GDB testsuite.
# This test tests the restoration of various kinds of machine state
# to their original values with a process record log. We will execute
# the program forward while it changes various types of data, and
diff --git a/gdb/testsuite/gdb.reverse/machinestate.c b/gdb/testsuite/gdb.reverse/machinestate.c
index 6635769..bf4d95b 100644
--- a/gdb/testsuite/gdb.reverse/machinestate.c
+++ b/gdb/testsuite/gdb.reverse/machinestate.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/machinestate.exp b/gdb/testsuite/gdb.reverse/machinestate.exp
index b4edfa0..7edf517 100644
--- a/gdb/testsuite/gdb.reverse/machinestate.exp
+++ b/gdb/testsuite/gdb.reverse/machinestate.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# This file is part of the GDB testsuite.
+# This file is part of the GDB testsuite.
# This test tests the restoration of various kinds of machine state
# to their original values by reverse execution. We will execute
# the program forward while it changes various types of data, and
@@ -53,7 +53,7 @@ set endmain [gdb_get_line_number " end main " $srcfile]
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/maint-print-instruction.c b/gdb/testsuite/gdb.reverse/maint-print-instruction.c
index 6e6a062..f64d27d 100644
--- a/gdb/testsuite/gdb.reverse/maint-print-instruction.c
+++ b/gdb/testsuite/gdb.reverse/maint-print-instruction.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/maint-print-instruction.exp b/gdb/testsuite/gdb.reverse/maint-print-instruction.exp
index edee300..151c117 100644
--- a/gdb/testsuite/gdb.reverse/maint-print-instruction.exp
+++ b/gdb/testsuite/gdb.reverse/maint-print-instruction.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
# change is printed, since any instruction must have at least a change
# to the PC.
-if ![supports_reverse] {
+if {![supports_reverse]} {
return
}
@@ -52,7 +52,7 @@ if { ![runto_main] } {
#confirm that GDB doesn't go crazy if recording isn't enabled
test_print false "" "print before starting to record"
-if ![supports_process_record] {
+if {![supports_process_record]} {
# No point in testing the rest if we can't record anything
return
}
diff --git a/gdb/testsuite/gdb.reverse/map-to-same-line.c b/gdb/testsuite/gdb.reverse/map-to-same-line.c
index 7185955..4823776 100644
--- a/gdb/testsuite/gdb.reverse/map-to-same-line.c
+++ b/gdb/testsuite/gdb.reverse/map-to-same-line.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/map-to-same-line.exp b/gdb/testsuite/gdb.reverse/map-to-same-line.exp
index 067fe01..e31eef0 100644
--- a/gdb/testsuite/gdb.reverse/map-to-same-line.exp
+++ b/gdb/testsuite/gdb.reverse/map-to-same-line.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -48,16 +48,16 @@ Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {language @DW_LANG_C}
- {name map-to-same-line.c}
- {stmt_list $L DW_FORM_sec_offset}
- {low_pc 0 addr}
+ DW_AT_language @DW_LANG_C
+ DW_AT_name map-to-same-line.c
+ DW_AT_stmt_list $L DW_FORM_sec_offset
+ DW_AT_low_pc 0 addr
} {
subprogram {
- {external 1 flag}
- {name main}
- {low_pc $main_start addr}
- {high_pc $main_len DW_FORM_data4}
+ DW_AT_external 1 flag
+ DW_AT_name main
+ DW_AT_low_pc $main_start addr
+ DW_AT_high_pc $main_len DW_FORM_data4
}
}
}
diff --git a/gdb/testsuite/gdb.reverse/ms1.c b/gdb/testsuite/gdb.reverse/ms1.c
index 957b41b..4c4dda5 100644
--- a/gdb/testsuite/gdb.reverse/ms1.c
+++ b/gdb/testsuite/gdb.reverse/ms1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/next-reverse-bkpt-over-sr.c b/gdb/testsuite/gdb.reverse/next-reverse-bkpt-over-sr.c
index ce36a15..3619547 100644
--- a/gdb/testsuite/gdb.reverse/next-reverse-bkpt-over-sr.c
+++ b/gdb/testsuite/gdb.reverse/next-reverse-bkpt-over-sr.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/next-reverse-bkpt-over-sr.exp b/gdb/testsuite/gdb.reverse/next-reverse-bkpt-over-sr.exp
index 98cf530..574ab5e 100644
--- a/gdb/testsuite/gdb.reverse/next-reverse-bkpt-over-sr.exp
+++ b/gdb/testsuite/gdb.reverse/next-reverse-bkpt-over-sr.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -52,7 +52,7 @@ if {![runto_main]} {
return 0
}
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/pipe-reverse.c b/gdb/testsuite/gdb.reverse/pipe-reverse.c
index e7ea0f6..a4f04a2 100644
--- a/gdb/testsuite/gdb.reverse/pipe-reverse.c
+++ b/gdb/testsuite/gdb.reverse/pipe-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/pipe-reverse.exp b/gdb/testsuite/gdb.reverse/pipe-reverse.exp
index ccf5481..93ba3d1 100644
--- a/gdb/testsuite/gdb.reverse/pipe-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/pipe-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.c b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.c
index ee3d488..41baaf4 100644
--- a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.c
+++ b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.exp b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.exp
index 9da61d6..773388d 100644
--- a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.exp
+++ b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.c b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.c
index 2c0be65..511bc41 100644
--- a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.c
+++ b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp
index 06257f9..21dba82 100644
--- a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp
+++ b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/readv-reverse.c b/gdb/testsuite/gdb.reverse/readv-reverse.c
index 6104414..9b311ea 100644
--- a/gdb/testsuite/gdb.reverse/readv-reverse.c
+++ b/gdb/testsuite/gdb.reverse/readv-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/readv-reverse.exp b/gdb/testsuite/gdb.reverse/readv-reverse.exp
index 35d0d2e..4456340 100644
--- a/gdb/testsuite/gdb.reverse/readv-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/readv-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/recursion.c b/gdb/testsuite/gdb.reverse/recursion.c
index 38a02e3..fb73522 100644
--- a/gdb/testsuite/gdb.reverse/recursion.c
+++ b/gdb/testsuite/gdb.reverse/recursion.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/recursion.exp b/gdb/testsuite/gdb.reverse/recursion.exp
index 6d7e6d1..ca08930 100644
--- a/gdb/testsuite/gdb.reverse/recursion.exp
+++ b/gdb/testsuite/gdb.reverse/recursion.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/recvmsg-reverse.c b/gdb/testsuite/gdb.reverse/recvmsg-reverse.c
index a5d7341..44a7041 100644
--- a/gdb/testsuite/gdb.reverse/recvmsg-reverse.c
+++ b/gdb/testsuite/gdb.reverse/recvmsg-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/recvmsg-reverse.exp b/gdb/testsuite/gdb.reverse/recvmsg-reverse.exp
index 95d1165..af6f73f 100644
--- a/gdb/testsuite/gdb.reverse/recvmsg-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/recvmsg-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/rerun-prec.c b/gdb/testsuite/gdb.reverse/rerun-prec.c
index fae4768..803aea2 100644
--- a/gdb/testsuite/gdb.reverse/rerun-prec.c
+++ b/gdb/testsuite/gdb.reverse/rerun-prec.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/rerun-prec.exp b/gdb/testsuite/gdb.reverse/rerun-prec.exp
index af70d85..fd5efb2 100644
--- a/gdb/testsuite/gdb.reverse/rerun-prec.exp
+++ b/gdb/testsuite/gdb.reverse/rerun-prec.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/s390-mvcle.c b/gdb/testsuite/gdb.reverse/s390-mvcle.c
index e85e825..1c087b5 100644
--- a/gdb/testsuite/gdb.reverse/s390-mvcle.c
+++ b/gdb/testsuite/gdb.reverse/s390-mvcle.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/s390-mvcle.exp b/gdb/testsuite/gdb.reverse/s390-mvcle.exp
index 033d459..642be8f 100644
--- a/gdb/testsuite/gdb.reverse/s390-mvcle.exp
+++ b/gdb/testsuite/gdb.reverse/s390-mvcle.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/shr.h b/gdb/testsuite/gdb.reverse/shr.h
index 640b4f5..6263314 100644
--- a/gdb/testsuite/gdb.reverse/shr.h
+++ b/gdb/testsuite/gdb.reverse/shr.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/shr1.c b/gdb/testsuite/gdb.reverse/shr1.c
index 4451a7e..417d2a5 100644
--- a/gdb/testsuite/gdb.reverse/shr1.c
+++ b/gdb/testsuite/gdb.reverse/shr1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/shr2.c b/gdb/testsuite/gdb.reverse/shr2.c
index 761ef24..986df48 100644
--- a/gdb/testsuite/gdb.reverse/shr2.c
+++ b/gdb/testsuite/gdb.reverse/shr2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/sigall-precsave.exp b/gdb/testsuite/gdb.reverse/sigall-precsave.exp
index 902772a..552be4b 100644
--- a/gdb/testsuite/gdb.reverse/sigall-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/sigall-precsave.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -134,20 +134,20 @@ proc test_one_sig_reverse {prevsig} {
} else {
xfail "$testmsg (handled)"
}
- }
+ }
}
}
-clean_restart $binfile
+clean_restart $::testfile
runto gen_ABRT
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
-# Run until end, then save execution log.
+# Run until end, then save execution log.
set breakloc [gdb_get_line_number "end of main" "$srcfile"]
gdb_test "break $breakloc" \
@@ -299,7 +299,7 @@ gdb_test "continue" \
"get signal TERM"
gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM"
-gdb_test "continue" " end of main .*" "continue to sigall exit"
+gdb_test "continue" " end of main .*" "continue to sigall exit"
foreach sig [lreverse $signals] {
test_one_sig_reverse $sig
diff --git a/gdb/testsuite/gdb.reverse/sigall-reverse.c b/gdb/testsuite/gdb.reverse/sigall-reverse.c
index 55e9e0e..7053600 100644
--- a/gdb/testsuite/gdb.reverse/sigall-reverse.c
+++ b/gdb/testsuite/gdb.reverse/sigall-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/sigall-reverse.exp b/gdb/testsuite/gdb.reverse/sigall-reverse.exp
index 884b178..f9259a1 100644
--- a/gdb/testsuite/gdb.reverse/sigall-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/sigall-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -140,15 +140,15 @@ proc test_one_sig_reverse {prevsig} {
} else {
xfail "$testmsg (handled)"
}
- }
+ }
}
}
-clean_restart $binfile
+clean_restart $::testfile
runto gen_ABRT
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/singlejmp-reverse-nodebug.S b/gdb/testsuite/gdb.reverse/singlejmp-reverse-nodebug.S
index 3e5bcf9..d0f89d1 100644
--- a/gdb/testsuite/gdb.reverse/singlejmp-reverse-nodebug.S
+++ b/gdb/testsuite/gdb.reverse/singlejmp-reverse-nodebug.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/singlejmp-reverse-nodebug.c b/gdb/testsuite/gdb.reverse/singlejmp-reverse-nodebug.c
index 8290f40..0867a5e 100644
--- a/gdb/testsuite/gdb.reverse/singlejmp-reverse-nodebug.c
+++ b/gdb/testsuite/gdb.reverse/singlejmp-reverse-nodebug.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/singlejmp-reverse.S b/gdb/testsuite/gdb.reverse/singlejmp-reverse.S
index c4c1d6a..6641025 100644
--- a/gdb/testsuite/gdb.reverse/singlejmp-reverse.S
+++ b/gdb/testsuite/gdb.reverse/singlejmp-reverse.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/singlejmp-reverse.c b/gdb/testsuite/gdb.reverse/singlejmp-reverse.c
index c96662b..18b4032 100644
--- a/gdb/testsuite/gdb.reverse/singlejmp-reverse.c
+++ b/gdb/testsuite/gdb.reverse/singlejmp-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/singlejmp-reverse.exp b/gdb/testsuite/gdb.reverse/singlejmp-reverse.exp
index 7392356..8b9cb20 100644
--- a/gdb/testsuite/gdb.reverse/singlejmp-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/singlejmp-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@ require supports_reverse
standard_testfile ".S" "${gdb_test_file_name}-nodebug.S"
set executable ${testfile}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.reverse/singlejmp-reverse.exp COMPILE=1"
if { [build_executable_from_specs ${testfile}.exp $executable {} \
${testfile}.c {debug optimize=-O2} \
@@ -36,11 +36,11 @@ if [info exists COMPILE] {
clean_restart $executable
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if [supports_process_record] {
+if {[supports_process_record]} {
gdb_test_no_output "record"
}
diff --git a/gdb/testsuite/gdb.reverse/solib-precsave.exp b/gdb/testsuite/gdb.reverse/solib-precsave.exp
index c972e89..0b93501 100644
--- a/gdb/testsuite/gdb.reverse/solib-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/solib-precsave.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -52,7 +52,7 @@ if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable \
untested "failed to compile"
return -1
}
-
+
# Note: The test previously did "set debug-file-directory" to (try to)
# ensure the debug info for the dynamic loader and libc weren't found.
# This doesn't work if the debug info is in the .debug subdirectory.
@@ -60,7 +60,7 @@ if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable \
# and is no longer attempted. Instead, the test does not make assumptions
# about whether the debug info is present or not.
-clean_restart $binfile
+clean_restart $::testfile
gdb_load_shlib $library1
gdb_load_shlib $library2
@@ -140,7 +140,7 @@ gdb_test_multiple "reverse-step" "reverse-step into solib function one" {
pass $gdb_test_name
}
}
-# Depending on wether the closing } has a line associated, we might have
+# Depending on whether the closing } has a line associated, we might have
# different acceptable results here
gdb_test_multiple "reverse-step" "reverse-step within solib function one" {
-re -wrap "return y;.*" {
diff --git a/gdb/testsuite/gdb.reverse/solib-reverse.c b/gdb/testsuite/gdb.reverse/solib-reverse.c
index c1db8b8..a8fce2a 100644
--- a/gdb/testsuite/gdb.reverse/solib-reverse.c
+++ b/gdb/testsuite/gdb.reverse/solib-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/solib-reverse.exp b/gdb/testsuite/gdb.reverse/solib-reverse.exp
index 5ab418a..8991177 100644
--- a/gdb/testsuite/gdb.reverse/solib-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/solib-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $exec_opt
untested "failed to compile"
return -1
}
-
+
# Note: The test previously did "set debug-file-directory" to (try to)
# ensure the debug info for the dynamic loader and libc weren't found.
# This doesn't work if the debug info is in the .debug subdirectory.
@@ -52,13 +52,13 @@ if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $exec_opt
# and is no longer attempted. Instead, the test does not make assumptions
# about whether the debug info is present or not.
-clean_restart $binfile
+clean_restart $::testfile
gdb_load_shlib $library1
gdb_load_shlib $library2
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
@@ -116,7 +116,7 @@ gdb_test_multiple "reverse-step" "reverse-step into solib function one" {
pass $gdb_test_name
}
}
-# Depending on wether the closing } has a line associated, we might have
+# Depending on whether the closing } has a line associated, we might have
# different acceptable results here
gdb_test_multiple "reverse-step" "reverse-step within solib function one" {
-re -wrap "return y;.*" {
diff --git a/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.c b/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.c
index f6bb70b..a183b8d 100644
--- a/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.c
+++ b/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp b/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp
index e978e6e..21140c1 100644
--- a/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp
+++ b/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/step-precsave.exp b/gdb/testsuite/gdb.reverse/step-precsave.exp
index 0488008..d152454 100644
--- a/gdb/testsuite/gdb.reverse/step-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/step-precsave.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -69,7 +69,7 @@ with_timeout_factor 10 {
gdb_test "kill" "" "kill process, prepare to debug log file" \
"Kill the program being debugged\\? \\(y or n\\) " "y"
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test "record restore $precsave" \
"Restored records from core file .*" \
@@ -229,7 +229,7 @@ gdb_test_multiple "stepi" "$test_message" {
}
}
-re "ENTER CALLEE.*$gdb_prompt $" {
- send_gdb "stepi\n"
+ send_gdb "stepi\n"
exp_continue
}
-re "$pic_thunk_re.*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.reverse/step-reverse.c b/gdb/testsuite/gdb.reverse/step-reverse.c
index 307c0c3..980fe4a 100644
--- a/gdb/testsuite/gdb.reverse/step-reverse.c
+++ b/gdb/testsuite/gdb.reverse/step-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/step-reverse.exp b/gdb/testsuite/gdb.reverse/step-reverse.exp
index 4bfe289..78a11bf 100644
--- a/gdb/testsuite/gdb.reverse/step-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/step-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
@@ -191,7 +191,7 @@ gdb_test_multiple "stepi" "$test_message" {
}
}
-re "ENTER CALLEE.*$gdb_prompt $" {
- send_gdb "stepi\n"
+ send_gdb "stepi\n"
exp_continue
}
-re "$pic_thunk_re.*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.c b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.c
index 250abb8..c56763c 100644
--- a/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.c
+++ b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp
index 6d54683..c0b468a 100644
--- a/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp
+++ b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/time-reverse.c b/gdb/testsuite/gdb.reverse/time-reverse.c
index c4ce128..0e2a474 100644
--- a/gdb/testsuite/gdb.reverse/time-reverse.c
+++ b/gdb/testsuite/gdb.reverse/time-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/time-reverse.exp b/gdb/testsuite/gdb.reverse/time-reverse.exp
index 35415a0..58dcdde 100644
--- a/gdb/testsuite/gdb.reverse/time-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/time-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@
#
require supports_reverse
+require supports_process_record
standard_testfile
@@ -38,23 +39,49 @@ proc test {mode} {
return
}
- runto marker1
-
- if [supports_process_record] {
- # Activate process record/replay
- gdb_test_no_output "record" "turn on process record"
+ if { ![runto marker1] } {
+ return
}
+ # Activate process record/replay
+ gdb_test_no_output "record" "turn on process record"
+ gdb_test_no_output "set record full stop-at-limit on"
+ gdb_test_no_output "set record full insn-number-max 2000"
+
+ set re_srcfile [string_to_regexp $::srcfile]
+
gdb_test "break marker2" \
- "Breakpoint $::decimal at $::hex: file .*$::srcfile, line $::decimal.*" \
+ "Breakpoint $::decimal at $::hex: file .*$re_srcfile, line $::decimal.*" \
"set breakpoint at marker2"
- gdb_continue_to_breakpoint "marker2" ".*$::srcfile:.*"
+ set re_question \
+ [string_list_to_regexp \
+ "Do you want to auto delete previous execution log entries when" \
+ " record/replay buffer becomes full" \
+ { (record full stop-at-limit)?([y] or n)}]
+ set re_program_stopped \
+ [multi_line \
+ [string_to_regexp "Process record: stopped by user."] \
+ "" \
+ [string_to_regexp "Program stopped."]]
+ set re_marker2 [string_to_regexp "marker2 ()"]
+ gdb_test_multiple "continue" "continue to breakpoint: marker2" {
+ -re "$re_question " {
+ send_gdb "n\n"
+ exp_continue
+ }
+ -re -wrap "Breakpoint $::decimal, $re_marker2 .*" {
+ pass $gdb_test_name
+ }
+ -re -wrap "\r\n$re_program_stopped\r\n.*" {
+ unsupported $gdb_test_name
+ }
+ }
# Show how many instructions we've recorded.
gdb_test "info record" "Active record target: .*"
- gdb_test "reverse-continue" ".*$::srcfile:$::decimal.*" "reverse to marker1"
+ gdb_test "reverse-continue" ".*$re_srcfile:$::decimal.*" "reverse to marker1"
# If the variable was recorded properly, the old contents (-1)
# will be remembered. If not, new contents (current time) will be
diff --git a/gdb/testsuite/gdb.reverse/until-precsave.exp b/gdb/testsuite/gdb.reverse/until-precsave.exp
index 508dfa9..325e4a8 100644
--- a/gdb/testsuite/gdb.reverse/until-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/until-precsave.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
-# This file is part of the GDB testsuite. It tests 'until' and
+# This file is part of the GDB testsuite. It tests 'until' and
# 'advance' in precord logfile.
# This test suitable only for process record-replay
@@ -147,7 +147,7 @@ gdb_test "advance $bp_location19" \
"factorial .value=720.*${srcfile}:$bp_location19.*" \
"reverse-advance to final return of factorial"
-# Now do "until" across the recursive calls,
+# Now do "until" across the recursive calls,
# ending up in the same frame where we are now.
gdb_test "until $bp_location7" \
diff --git a/gdb/testsuite/gdb.reverse/until-reverse.c b/gdb/testsuite/gdb.reverse/until-reverse.c
index 62d99c2..f4b96be 100644
--- a/gdb/testsuite/gdb.reverse/until-reverse.c
+++ b/gdb/testsuite/gdb.reverse/until-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/until-reverse.exp b/gdb/testsuite/gdb.reverse/until-reverse.exp
index db6dc69..de138f5 100644
--- a/gdb/testsuite/gdb.reverse/until-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/until-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
-# This file is part of the GDB testsuite. It tests 'until' and
+# This file is part of the GDB testsuite. It tests 'until' and
# 'advance' in reverse debugging.
require supports_reverse
@@ -34,7 +34,7 @@ set bp_location21 [gdb_get_line_number "set breakpoint 21 here"]
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
@@ -120,7 +120,7 @@ gdb_test "advance $bp_location19" \
"factorial .value=720.*${srcfile}:$bp_location19.*" \
"reverse-advance to final return of factorial"
-# Now do "until" across the recursive calls,
+# Now do "until" across the recursive calls,
# ending up in the same frame where we are now.
gdb_test "until $bp_location7" \
diff --git a/gdb/testsuite/gdb.reverse/ur1.c b/gdb/testsuite/gdb.reverse/ur1.c
index 7ac56b6..3b1bb5f 100644
--- a/gdb/testsuite/gdb.reverse/ur1.c
+++ b/gdb/testsuite/gdb.reverse/ur1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1992-2024 Free Software Foundation, Inc.
+ Copyright 1992-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/waitpid-reverse.c b/gdb/testsuite/gdb.reverse/waitpid-reverse.c
index eab51b6..3877d8a 100644
--- a/gdb/testsuite/gdb.reverse/waitpid-reverse.c
+++ b/gdb/testsuite/gdb.reverse/waitpid-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/waitpid-reverse.exp b/gdb/testsuite/gdb.reverse/waitpid-reverse.exp
index 7b667d9..26c3c99 100644
--- a/gdb/testsuite/gdb.reverse/waitpid-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/waitpid-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.reverse/watch-precsave.exp b/gdb/testsuite/gdb.reverse/watch-precsave.exp
index 98f406f..75ab4b1 100644
--- a/gdb/testsuite/gdb.reverse/watch-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/watch-precsave.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/watch-reverse.c b/gdb/testsuite/gdb.reverse/watch-reverse.c
index c3a5ebd..b178a8b 100644
--- a/gdb/testsuite/gdb.reverse/watch-reverse.c
+++ b/gdb/testsuite/gdb.reverse/watch-reverse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.reverse/watch-reverse.exp b/gdb/testsuite/gdb.reverse/watch-reverse.exp
index fb783e9..567ae4a 100644
--- a/gdb/testsuite/gdb.reverse/watch-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/watch-reverse.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
runto_main
-if [supports_process_record] {
+if {[supports_process_record]} {
# Activate process record/replay
gdb_test_no_output "record" "turn on process record"
}
diff --git a/gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.cpp b/gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.cpp
new file mode 100644
index 0000000..d75bc76
--- /dev/null
+++ b/gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.cpp
@@ -0,0 +1,86 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef DEVICE
+
+#include <hip/hip_runtime.h>
+
+constexpr unsigned int NUM_BREAKPOINT_HITS = 5;
+
+static __device__ void
+break_here ()
+{
+}
+
+extern "C" __global__ void
+kernel ()
+{
+ for (int n = 0; n < NUM_BREAKPOINT_HITS; ++n)
+ break_here ();
+}
+
+#else
+
+#include <hip/hip_runtime.h>
+#include <unistd.h>
+
+constexpr unsigned int NUM_ITEMS_PER_BLOCK = 256;
+constexpr unsigned int NUM_BLOCKS = 128;
+constexpr unsigned int NUM_ITEMS = NUM_ITEMS_PER_BLOCK * NUM_BLOCKS;
+constexpr unsigned int NUM_LOAD_UNLOADS = 5;
+
+#define CHECK(cmd) \
+ { \
+ hipError_t error = cmd; \
+ if (error != hipSuccess) \
+ { \
+ fprintf (stderr, "error: '%s'(%d) at %s:%d\n", \
+ hipGetErrorString (error), error, __FILE__, __LINE__); \
+ exit (EXIT_FAILURE); \
+ } \
+ }
+
+int
+main (int argc, const char **argv)
+{
+ if (argc != 2)
+ {
+ fprintf (stderr, "Usage: %s <hip_module_path>\n", argv[0]);
+ return 1;
+ }
+
+ const auto module_path = argv[1];
+ hipModule_t module;
+ CHECK (hipModuleLoad (&module, module_path));
+
+ /* Launch the kernel. */
+ hipFunction_t function;
+ CHECK (hipModuleGetFunction (&function, module, "kernel"));
+ CHECK (hipModuleLaunchKernel (function, NUM_BLOCKS, 1, 1,
+ NUM_ITEMS_PER_BLOCK, 1, 1, 0, nullptr, nullptr,
+ nullptr));
+
+ /* Load and unload the module many times. */
+ for (int i = 0; i < NUM_LOAD_UNLOADS; ++i)
+ {
+ hipModule_t dummy_module;
+ CHECK (hipModuleLoad (&dummy_module, module_path));
+ CHECK (hipModuleUnload (dummy_module));
+ }
+}
+
+#endif
diff --git a/gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.exp b/gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.exp
new file mode 100644
index 0000000..e994884
--- /dev/null
+++ b/gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.exp
@@ -0,0 +1,69 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This file is part of GDB.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This test verifies what happens when a code object list update happens at the
+# same time as some wave stop events are reported. It was added following a
+# performance bug fix, where forward progress requirement disabled when
+# pulling events from amd-dbgapi in amd_dbgapi_target_breakpoint::check_status.
+#
+# The test launches a kernel that hits a breakpoint with an always false
+# condition a certain number of times. Meanwhile, the host loads and unloads
+# a code object in a loop, causing check_status to be called. The hope is that
+# check_status, when calling process_event_queue, will pull many WAVE_STOP
+# events from the kernel hitting the breakpoint.
+#
+# Without the appropriate fix (of disabling forward progress requirement in
+# check_status), GDB would hit the newly-added assert in process_event_queue,
+# which verifies that forward progress requirement is disabled. Even without
+# this assert, the test would likely time out (depending on the actual timeout
+# value).
+
+load_lib rocm.exp
+standard_testfile .cpp
+require allow_hipcc_tests
+
+# Build the host executable.
+if { [build_executable "failed to prepare" \
+ $testfile $srcfile {debug hip}] == -1 } {
+ return -1
+}
+
+set hipmodule_path [standard_output_file ${testfile}.co]
+
+# Build the kernel object file.
+if { [gdb_compile $srcdir/$subdir/$srcfile \
+ $hipmodule_path object \
+ { debug hip additional_flags=--genco additional_flags=-DDEVICE } ] != "" } {
+ return -1
+}
+
+proc do_test { } {
+ with_rocm_gpu_lock {
+ clean_restart
+ gdb_load $::binfile
+ gdb_test_no_output "set args $::hipmodule_path" "set args"
+
+ if { ![runto_main] } {
+ return
+ }
+
+ gdb_test "with breakpoint pending on -- break break_here if 0"
+ gdb_continue_to_end "continue to end" "continue" 1
+ }
+}
+
+do_test
diff --git a/gdb/testsuite/gdb.rocm/displaced-stepping.cpp b/gdb/testsuite/gdb.rocm/displaced-stepping.cpp
index b94e8ab..7adb646 100644
--- a/gdb/testsuite/gdb.rocm/displaced-stepping.cpp
+++ b/gdb/testsuite/gdb.rocm/displaced-stepping.cpp
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rocm/displaced-stepping.exp b/gdb/testsuite/gdb.rocm/displaced-stepping.exp
index cd50fec..d26e4c6 100644
--- a/gdb/testsuite/gdb.rocm/displaced-stepping.exp
+++ b/gdb/testsuite/gdb.rocm/displaced-stepping.exp
@@ -28,10 +28,11 @@ if {[build_executable "failed to prepare" $testfile $srcfile {hip}]} {
}
proc do_test {} {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
with_rocm_gpu_lock {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execee.cpp b/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execee.cpp
index 06a7589..6fbf55f 100644
--- a/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execee.cpp
+++ b/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execee.cpp
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execer.cpp b/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execer.cpp
index 09a4983..48267e3 100644
--- a/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execer.cpp
+++ b/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execer.cpp
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu.exp b/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu.exp
index 3e122f5..dfd1092 100644
--- a/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu.exp
+++ b/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This file is part of GDB.
@@ -21,6 +21,7 @@
load_lib rocm.exp
require allow_hipcc_tests
+require allow_fork_tests
standard_testfile -execer.cpp -execee.cpp
@@ -53,7 +54,8 @@ proc do_test { detach-on-fork follow-fork-mode fork_func } {
}
with_rocm_gpu_lock {
- clean_restart ${::binfile}-execer-${fork_func}
+ clean_restart
+ gdb_load ${::binfile}-execer-${fork_func}
gdb_test_no_output "set detach-on-fork ${detach-on-fork}"
gdb_test_no_output "set follow-fork-mode ${follow-fork-mode}"
diff --git a/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execee.cpp b/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execee.cpp
index fb1df66..116c3c9 100644
--- a/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execee.cpp
+++ b/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execee.cpp
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execer.cpp b/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execer.cpp
index f0e273b..2c8e743 100644
--- a/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execer.cpp
+++ b/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execer.cpp
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp b/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp
index 50efb4f..b14e2c7 100644
--- a/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp
+++ b/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This file is part of GDB.
@@ -20,6 +20,7 @@
load_lib rocm.exp
require allow_hipcc_tests
+require allow_fork_tests
standard_testfile -execer.cpp -execee.cpp
@@ -52,7 +53,8 @@ proc do_test { detach-on-fork follow-fork-mode fork_func } {
}
with_rocm_gpu_lock {
- clean_restart ${::binfile}-execer-${fork_func}
+ clean_restart
+ gdb_load ${::binfile}-execer-${fork_func}
gdb_test_no_output "set detach-on-fork ${detach-on-fork}"
gdb_test_no_output "set follow-fork-mode ${follow-fork-mode}"
diff --git a/gdb/testsuite/gdb.rocm/mi-attach.cpp b/gdb/testsuite/gdb.rocm/mi-attach.cpp
index da7659d..441d460 100644
--- a/gdb/testsuite/gdb.rocm/mi-attach.cpp
+++ b/gdb/testsuite/gdb.rocm/mi-attach.cpp
@@ -15,8 +15,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include <unistd.h>
#include <hip/hip_runtime.h>
+#include "gdb_watchdog.h"
__global__ void
kern ()
@@ -30,7 +30,7 @@ main ()
{
/* This program will run outside of GDB, make sure that if anything goes
wrong it eventually gets killed. */
- alarm (30);
+ gdb_watchdog (30);
kern<<<1, 1>>> ();
return hipDeviceSynchronize () != hipSuccess;
diff --git a/gdb/testsuite/gdb.rocm/mi-attach.exp b/gdb/testsuite/gdb.rocm/mi-attach.exp
index 2ca610c..37ce92a 100644
--- a/gdb/testsuite/gdb.rocm/mi-attach.exp
+++ b/gdb/testsuite/gdb.rocm/mi-attach.exp
@@ -13,10 +13,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+load_lib rocm.exp
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-require can_spawn_for_attach
+require can_spawn_for_attach allow_hipcc_tests
standard_testfile .cpp
diff --git a/gdb/testsuite/gdb.rocm/multi-inferior-gpu.cpp b/gdb/testsuite/gdb.rocm/multi-inferior-gpu.cpp
index e6be857..8952308 100644
--- a/gdb/testsuite/gdb.rocm/multi-inferior-gpu.cpp
+++ b/gdb/testsuite/gdb.rocm/multi-inferior-gpu.cpp
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp b/gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp
index 4c5e459..0ed11e8 100644
--- a/gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp
+++ b/gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,8 @@ if {[build_executable "failed to prepare" $testfile $srcfile {debug hip}]} {
}
proc do_test {} {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
gdb_test_no_output "set non-stop on"
gdb_test_no_output "set detach-on-fork off"
gdb_test_no_output "set follow-fork parent"
diff --git a/gdb/testsuite/gdb.rocm/precise-memory-exec.c b/gdb/testsuite/gdb.rocm/precise-memory-exec.c
index fb41846..a208f13 100644
--- a/gdb/testsuite/gdb.rocm/precise-memory-exec.c
+++ b/gdb/testsuite/gdb.rocm/precise-memory-exec.c
@@ -1,4 +1,4 @@
-/* Copyright 2021-2024 Free Software Foundation, Inc.
+/* Copyright 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.rocm/precise-memory-exec.exp b/gdb/testsuite/gdb.rocm/precise-memory-exec.exp
index 3a0301b..2472446 100644
--- a/gdb/testsuite/gdb.rocm/precise-memory-exec.exp
+++ b/gdb/testsuite/gdb.rocm/precise-memory-exec.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This file is part of GDB.
@@ -29,10 +29,11 @@ if {[build_executable "failed to prepare $testfile" $testfile $srcfile {debug}]}
}
proc do_test { follow-exec-mode } {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
with_rocm_gpu_lock {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.rocm/precise-memory-fork.c b/gdb/testsuite/gdb.rocm/precise-memory-fork.c
index 3db6c2f..2c3ca61 100644
--- a/gdb/testsuite/gdb.rocm/precise-memory-fork.c
+++ b/gdb/testsuite/gdb.rocm/precise-memory-fork.c
@@ -1,4 +1,4 @@
-/* Copyright 2021-2024 Free Software Foundation, Inc.
+/* Copyright 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.rocm/precise-memory-fork.exp b/gdb/testsuite/gdb.rocm/precise-memory-fork.exp
index f6a658a..7559aec 100644
--- a/gdb/testsuite/gdb.rocm/precise-memory-fork.exp
+++ b/gdb/testsuite/gdb.rocm/precise-memory-fork.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This file is part of GDB.
@@ -21,6 +21,7 @@
load_lib rocm.exp
require allow_hipcc_tests
+require allow_fork_tests
standard_testfile .c
@@ -29,7 +30,7 @@ if {[prepare_for_testing "failed to prepare $testfile" $testfile $srcfile {debug
}
with_rocm_gpu_lock {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.rocm/precise-memory-multi-inferiors.exp b/gdb/testsuite/gdb.rocm/precise-memory-multi-inferiors.exp
index de86eb2..058b085 100644
--- a/gdb/testsuite/gdb.rocm/precise-memory-multi-inferiors.exp
+++ b/gdb/testsuite/gdb.rocm/precise-memory-multi-inferiors.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This file is part of GDB.
@@ -30,7 +30,7 @@ proc test_per_inferior { } {
gdb_test "show amdgpu precise-memory" \
"AMDGPU precise memory access reporting is off \\(currently disabled\\)." \
"show initial value, inferior 1"
- if $::test_python {
+ if { $::test_python } {
gdb_test "python print(gdb.parameter(\"amdgpu precise-memory\"))" \
"False" \
"show initial value using Python, inferior 1"
@@ -40,7 +40,7 @@ proc test_per_inferior { } {
gdb_test "show amdgpu precise-memory" \
"AMDGPU precise memory access reporting is on \\(currently disabled\\)." \
"show new value, inferior 1"
- if $::test_python {
+ if { $::test_python } {
gdb_test "python print(gdb.parameter(\"amdgpu precise-memory\"))" \
"True" \
"show new value using Python, inferior 1"
@@ -52,7 +52,7 @@ proc test_per_inferior { } {
gdb_test "show amdgpu precise-memory" \
"AMDGPU precise memory access reporting is off \\(currently disabled\\)." \
"show initial value, inferior 2"
- if $::test_python {
+ if { $::test_python } {
gdb_test "python print(gdb.parameter(\"amdgpu precise-memory\"))" \
"False" \
"show initial value using Python, inferior 2"
diff --git a/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.cpp b/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.cpp
index ccb1e52..54ce6a3 100644
--- a/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.cpp
+++ b/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.cpp
@@ -1,4 +1,4 @@
-/* Copyright 2021-2024 Free Software Foundation, Inc.
+/* Copyright 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp b/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp
index d9b016e..70c26c6 100644
--- a/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp
+++ b/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This file is part of GDB.
@@ -29,10 +29,11 @@ if {[build_executable "failed to prepare" $testfile $srcfile {debug hip}]} {
}
proc do_test { } {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
with_rocm_gpu_lock {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.rocm/precise-memory.cpp b/gdb/testsuite/gdb.rocm/precise-memory.cpp
index 7a8c37e..a42c0ba 100644
--- a/gdb/testsuite/gdb.rocm/precise-memory.cpp
+++ b/gdb/testsuite/gdb.rocm/precise-memory.cpp
@@ -1,4 +1,4 @@
-/* Copyright 2021-2024 Free Software Foundation, Inc.
+/* Copyright 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.rocm/precise-memory.exp b/gdb/testsuite/gdb.rocm/precise-memory.exp
index 8c39f80..4ea41ba 100644
--- a/gdb/testsuite/gdb.rocm/precise-memory.exp
+++ b/gdb/testsuite/gdb.rocm/precise-memory.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This file is part of GDB.
@@ -28,10 +28,11 @@ if {[build_executable "failed to prepare" $testfile $srcfile {debug hip}]} {
}
proc do_test { } {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
with_rocm_gpu_lock {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -59,7 +60,7 @@ proc do_test { } {
return
}
- # Get to the begining of the GPU kernel without precise memory enabled.
+ # Get to the beginning of the GPU kernel without precise memory enabled.
with_test_prefix "goto gpu code" {
gdb_test_no_output "set amdgpu precise-memory off"
gdb_breakpoint "kernel" allow-pending
diff --git a/gdb/testsuite/gdb.rocm/simple.cpp b/gdb/testsuite/gdb.rocm/simple.cpp
index b94e8ab..7adb646 100644
--- a/gdb/testsuite/gdb.rocm/simple.cpp
+++ b/gdb/testsuite/gdb.rocm/simple.cpp
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rocm/simple.exp b/gdb/testsuite/gdb.rocm/simple.exp
index 11ba2a3..6b2f08e 100644
--- a/gdb/testsuite/gdb.rocm/simple.exp
+++ b/gdb/testsuite/gdb.rocm/simple.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,10 +27,11 @@ if {[build_executable "failed to prepare" $testfile $srcfile {debug hip}]} {
}
proc do_test {} {
- clean_restart $::binfile
+ clean_restart
+ gdb_load $::binfile
with_rocm_gpu_lock {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.rust/completion.exp b/gdb/testsuite/gdb.rust/completion.exp
index 1b0638a..eac5a43 100644
--- a/gdb/testsuite/gdb.rust/completion.exp
+++ b/gdb/testsuite/gdb.rust/completion.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/completion.rs b/gdb/testsuite/gdb.rust/completion.rs
index 1a9d805..70506ba 100644
--- a/gdb/testsuite/gdb.rust/completion.rs
+++ b/gdb/testsuite/gdb.rust/completion.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2023-2024 Free Software Foundation, Inc.
+// Copyright (C) 2023-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/dwindex.exp b/gdb/testsuite/gdb.rust/dwindex.exp
index de39c3a..a9e10e1 100644
--- a/gdb/testsuite/gdb.rust/dwindex.exp
+++ b/gdb/testsuite/gdb.rust/dwindex.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/dwindex.rs b/gdb/testsuite/gdb.rust/dwindex.rs
index 8f08dae..aa61846 100644
--- a/gdb/testsuite/gdb.rust/dwindex.rs
+++ b/gdb/testsuite/gdb.rust/dwindex.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2021-2024 Free Software Foundation, Inc.
+// Copyright (C) 2021-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/expr.exp b/gdb/testsuite/gdb.rust/expr.exp
index ca01c5f..a1b8286 100644
--- a/gdb/testsuite/gdb.rust/expr.exp
+++ b/gdb/testsuite/gdb.rust/expr.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/finish.exp b/gdb/testsuite/gdb.rust/finish.exp
index 1d52d5b..96545fb 100644
--- a/gdb/testsuite/gdb.rust/finish.exp
+++ b/gdb/testsuite/gdb.rust/finish.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/finish.rs b/gdb/testsuite/gdb.rust/finish.rs
index c0d7743..2f8095e 100644
--- a/gdb/testsuite/gdb.rust/finish.rs
+++ b/gdb/testsuite/gdb.rust/finish.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2023-2024 Free Software Foundation, Inc.
+// Copyright (C) 2023-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/fnfield.exp b/gdb/testsuite/gdb.rust/fnfield.exp
index f05b275..a45ae94 100644
--- a/gdb/testsuite/gdb.rust/fnfield.exp
+++ b/gdb/testsuite/gdb.rust/fnfield.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/fnfield.rs b/gdb/testsuite/gdb.rust/fnfield.rs
index ea15492..0520b35 100644
--- a/gdb/testsuite/gdb.rust/fnfield.rs
+++ b/gdb/testsuite/gdb.rust/fnfield.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2022-2024 Free Software Foundation, Inc.
+// Copyright (C) 2022-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/generics.exp b/gdb/testsuite/gdb.rust/generics.exp
index e5b6d13..d7a34bf 100644
--- a/gdb/testsuite/gdb.rust/generics.exp
+++ b/gdb/testsuite/gdb.rust/generics.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/generics.rs b/gdb/testsuite/gdb.rust/generics.rs
index da26999..38c1917 100644
--- a/gdb/testsuite/gdb.rust/generics.rs
+++ b/gdb/testsuite/gdb.rust/generics.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2016-2024 Free Software Foundation, Inc.
+// Copyright (C) 2016-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/main-crash.exp b/gdb/testsuite/gdb.rust/main-crash.exp
index 9efaf96..1d246ee 100644
--- a/gdb/testsuite/gdb.rust/main-crash.exp
+++ b/gdb/testsuite/gdb.rust/main-crash.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/main.rs b/gdb/testsuite/gdb.rust/main.rs
index 042b036..756dffb 100644
--- a/gdb/testsuite/gdb.rust/main.rs
+++ b/gdb/testsuite/gdb.rust/main.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2016-2024 Free Software Foundation, Inc.
+// Copyright (C) 2016-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/methods.exp b/gdb/testsuite/gdb.rust/methods.exp
index a14bbb6..0061b46 100644
--- a/gdb/testsuite/gdb.rust/methods.exp
+++ b/gdb/testsuite/gdb.rust/methods.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/methods.rs b/gdb/testsuite/gdb.rust/methods.rs
index eaeb5ef..e822bfd 100644
--- a/gdb/testsuite/gdb.rust/methods.rs
+++ b/gdb/testsuite/gdb.rust/methods.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2016-2024 Free Software Foundation, Inc.
+// Copyright (C) 2016-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/modules.exp b/gdb/testsuite/gdb.rust/modules.exp
index 25828ea..0874db3 100644
--- a/gdb/testsuite/gdb.rust/modules.exp
+++ b/gdb/testsuite/gdb.rust/modules.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ if {![runto ${srcfile}:$line]} {
# https://github.com/rust-lang/rust/issues/33121
# gdb_test "call f2()" "lambda f2"
-if ![target_info exists gdb,noinferiorio] {
+if { ![target_info exists gdb,noinferiorio] } {
gdb_test_stdio "call f3()" "mod1::inner::innest::f3"
gdb_test_stdio "call self::f2()" "mod1::inner::innest::f2"
gdb_test_stdio "call self::super::f2()" "mod1::inner::f2"
diff --git a/gdb/testsuite/gdb.rust/modules.rs b/gdb/testsuite/gdb.rust/modules.rs
index a2d7cbe..e5c3d03 100644
--- a/gdb/testsuite/gdb.rust/modules.rs
+++ b/gdb/testsuite/gdb.rust/modules.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2016-2024 Free Software Foundation, Inc.
+// Copyright (C) 2016-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/onetwoeight.exp b/gdb/testsuite/gdb.rust/onetwoeight.exp
index 8b73f16..8ae9d54 100644
--- a/gdb/testsuite/gdb.rust/onetwoeight.exp
+++ b/gdb/testsuite/gdb.rust/onetwoeight.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/onetwoeight.rs b/gdb/testsuite/gdb.rust/onetwoeight.rs
index 8135974..2b2e6ee 100644
--- a/gdb/testsuite/gdb.rust/onetwoeight.rs
+++ b/gdb/testsuite/gdb.rust/onetwoeight.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2023-2024 Free Software Foundation, Inc.
+// Copyright (C) 2023-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/pp.exp b/gdb/testsuite/gdb.rust/pp.exp
index f0468e3..aa989c0 100644
--- a/gdb/testsuite/gdb.rust/pp.exp
+++ b/gdb/testsuite/gdb.rust/pp.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/pp.py b/gdb/testsuite/gdb.rust/pp.py
index fbc0868..e29240d 100644
--- a/gdb/testsuite/gdb.rust/pp.py
+++ b/gdb/testsuite/gdb.rust/pp.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/pp.rs b/gdb/testsuite/gdb.rust/pp.rs
index 879bb6e..77313e8 100644
--- a/gdb/testsuite/gdb.rust/pp.rs
+++ b/gdb/testsuite/gdb.rust/pp.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2021-2024 Free Software Foundation, Inc.
+// Copyright (C) 2021-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/rawids.exp b/gdb/testsuite/gdb.rust/rawids.exp
index e86d054..9029e2f 100644
--- a/gdb/testsuite/gdb.rust/rawids.exp
+++ b/gdb/testsuite/gdb.rust/rawids.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/rawids.rs b/gdb/testsuite/gdb.rust/rawids.rs
index e94c578..98373da 100644
--- a/gdb/testsuite/gdb.rust/rawids.rs
+++ b/gdb/testsuite/gdb.rust/rawids.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2021-2024 Free Software Foundation, Inc.
+// Copyright (C) 2021-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/rust-start.exp b/gdb/testsuite/gdb.rust/rust-start.exp
index c5c7e24..1287d83 100644
--- a/gdb/testsuite/gdb.rust/rust-start.exp
+++ b/gdb/testsuite/gdb.rust/rust-start.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/rust-style.exp b/gdb/testsuite/gdb.rust/rust-style.exp
index 418f636..ae01ad6 100644
--- a/gdb/testsuite/gdb.rust/rust-style.exp
+++ b/gdb/testsuite/gdb.rust/rust-style.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/rust-style.rs b/gdb/testsuite/gdb.rust/rust-style.rs
index bb9873f..b4a36bd 100644
--- a/gdb/testsuite/gdb.rust/rust-style.rs
+++ b/gdb/testsuite/gdb.rust/rust-style.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2024 Free Software Foundation, Inc.
+// Copyright (C) 2020-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/simple.exp b/gdb/testsuite/gdb.rust/simple.exp
index e269e41..a236a30 100644
--- a/gdb/testsuite/gdb.rust/simple.exp
+++ b/gdb/testsuite/gdb.rust/simple.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/simple.rs b/gdb/testsuite/gdb.rust/simple.rs
index d9d6b32..cf51715 100644
--- a/gdb/testsuite/gdb.rust/simple.rs
+++ b/gdb/testsuite/gdb.rust/simple.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2016-2024 Free Software Foundation, Inc.
+// Copyright (C) 2016-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/traits.exp b/gdb/testsuite/gdb.rust/traits.exp
index a732536..82fc894 100644
--- a/gdb/testsuite/gdb.rust/traits.exp
+++ b/gdb/testsuite/gdb.rust/traits.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2024 Free Software Foundation, Inc.
+# Copyright (C) 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
}
set readelf_program [gdb_find_readelf]
-set result [catch "exec $readelf_program --debug-dump=info $binfile" output]
+set result [catch {exec $readelf_program --debug-dump=info $binfile} output]
if {$result != 0} {
untested "could not read [file tail ${binfile}] with readelf"
return
diff --git a/gdb/testsuite/gdb.rust/traits.rs b/gdb/testsuite/gdb.rust/traits.rs
index 64ab0be..14202c4 100644
--- a/gdb/testsuite/gdb.rust/traits.rs
+++ b/gdb/testsuite/gdb.rust/traits.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2024 Free Software Foundation, Inc.
+// Copyright (C) 2017-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/unicode.exp b/gdb/testsuite/gdb.rust/unicode.exp
index 0ad6001..a86e59f 100644
--- a/gdb/testsuite/gdb.rust/unicode.exp
+++ b/gdb/testsuite/gdb.rust/unicode.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/unicode.rs b/gdb/testsuite/gdb.rust/unicode.rs
index dd0791c..54a9dc5 100644
--- a/gdb/testsuite/gdb.rust/unicode.rs
+++ b/gdb/testsuite/gdb.rust/unicode.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2022-2024 Free Software Foundation, Inc.
+// Copyright (C) 2022-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/union.exp b/gdb/testsuite/gdb.rust/union.exp
index d229c59..55fe6db 100644
--- a/gdb/testsuite/gdb.rust/union.exp
+++ b/gdb/testsuite/gdb.rust/union.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2020-2024 Free Software Foundation, Inc.
+# Copyright (C) 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/union.rs b/gdb/testsuite/gdb.rust/union.rs
index c4c854a..c0872a5 100644
--- a/gdb/testsuite/gdb.rust/union.rs
+++ b/gdb/testsuite/gdb.rust/union.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2024 Free Software Foundation, Inc.
+// Copyright (C) 2020-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/unsized.exp b/gdb/testsuite/gdb.rust/unsized.exp
index ea5f281..f916145 100644
--- a/gdb/testsuite/gdb.rust/unsized.exp
+++ b/gdb/testsuite/gdb.rust/unsized.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2024 Free Software Foundation, Inc.
+# Copyright (C) 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/unsized.rs b/gdb/testsuite/gdb.rust/unsized.rs
index 6bbf199..d8d9082 100644
--- a/gdb/testsuite/gdb.rust/unsized.rs
+++ b/gdb/testsuite/gdb.rust/unsized.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2024 Free Software Foundation, Inc.
+// Copyright (C) 2017-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/unsized2.exp b/gdb/testsuite/gdb.rust/unsized2.exp
index 5b7be45..d4d5ea1 100644
--- a/gdb/testsuite/gdb.rust/unsized2.exp
+++ b/gdb/testsuite/gdb.rust/unsized2.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/unsized2.rs b/gdb/testsuite/gdb.rust/unsized2.rs
index 980a5fe..ee5eaee 100644
--- a/gdb/testsuite/gdb.rust/unsized2.rs
+++ b/gdb/testsuite/gdb.rust/unsized2.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2024 Free Software Foundation, Inc.
+// Copyright (C) 2024-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/watch.exp b/gdb/testsuite/gdb.rust/watch.exp
index e4fa6f9..a90abd7 100644
--- a/gdb/testsuite/gdb.rust/watch.exp
+++ b/gdb/testsuite/gdb.rust/watch.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2024 Free Software Foundation, Inc.
+# Copyright (C) 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.rust/watch.rs b/gdb/testsuite/gdb.rust/watch.rs
index 5301e44..bf2f95b 100644
--- a/gdb/testsuite/gdb.rust/watch.rs
+++ b/gdb/testsuite/gdb.rust/watch.rs
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2024 Free Software Foundation, Inc.
+// Copyright (C) 2017-2025 Free Software Foundation, Inc.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/abspath.exp b/gdb/testsuite/gdb.server/abspath.exp
index 83e4ad2..23d5d63 100644
--- a/gdb/testsuite/gdb.server/abspath.exp
+++ b/gdb/testsuite/gdb.server/abspath.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/argument-errors.exp b/gdb/testsuite/gdb.server/argument-errors.exp
new file mode 100644
index 0000000..45037bf
--- /dev/null
+++ b/gdb/testsuite/gdb.server/argument-errors.exp
@@ -0,0 +1,81 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test gdbserver prints a suitable message when argument values are
+# missing.
+
+load_lib gdbserver-support.exp
+
+standard_testfile
+
+require allow_gdbserver_tests
+
+set gdbserver [find_gdbserver]
+if { $gdbserver == "" } {
+ unsupported "could not find gdbserver"
+ return
+}
+
+# Start gdbserver using CMD_ARGS and a non-existent program name. We
+# expect to see an error message matching ERROR_RE from gdbserver.
+proc test_argument_error { cmd_args error_re } {
+ # Fire off gdbserver. gdbserver should give an error because
+ # --debug-file is missing its argument.
+ set spawn_id [remote_spawn target "$::gdbserver $cmd_args non-existing-program"]
+
+ set saw_expected_error false
+ set test "check gdbserver error: $cmd_args"
+ expect {
+ -i $spawn_id
+ -re $error_re {
+ set saw_expected_error true
+ exp_continue
+ }
+ eof {
+ gdb_assert $saw_expected_error $test
+ wait
+ }
+ timeout {
+ fail "$test (timeout)"
+ }
+ }
+
+ # expect defaults to spawn_id in many places. Avoid confusing any
+ # following code.
+ unset spawn_id
+}
+
+# Check that an argument that expects a value will not use a port, or
+# another argument, as its value.
+foreach arg { --debug-format --debug-file } {
+ test_argument_error "$arg stdio" \
+ "Missing argument value for: $arg"
+ test_argument_error "$arg :54321" \
+ "Missing argument value for: $arg"
+ test_argument_error "$arg -" \
+ "Missing argument value for: $arg"
+ test_argument_error "$arg --once -" \
+ "Missing argument value for: $arg"
+}
+
+# Test unknown argument handling.
+test_argument_error "--unknown -" \
+ "Unknown argument: --unknown"
+test_argument_error "-unknown -" \
+ "Unknown argument: -unknown"
+test_argument_error "--unknown=blah -" \
+ "Unknown argument: --unknown"
diff --git a/gdb/testsuite/gdb.server/attach-flag.exp b/gdb/testsuite/gdb.server/attach-flag.exp
index a3704de..2b3e345 100644
--- a/gdb/testsuite/gdb.server/attach-flag.exp
+++ b/gdb/testsuite/gdb.server/attach-flag.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/bkpt-other-inferior.exp b/gdb/testsuite/gdb.server/bkpt-other-inferior.exp
index 46c07d1..453be14 100644
--- a/gdb/testsuite/gdb.server/bkpt-other-inferior.exp
+++ b/gdb/testsuite/gdb.server/bkpt-other-inferior.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ standard_testfile server.c
require allow_gdbserver_tests
-if { [prepare_for_testing "failed to prepare" ${binfile} "${srcfile}" \
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
{debug pthreads}] } {
return
}
diff --git a/gdb/testsuite/gdb.server/build-id-seqno.c b/gdb/testsuite/gdb.server/build-id-seqno.c
index e2119ba7..ce81e8e 100644
--- a/gdb/testsuite/gdb.server/build-id-seqno.c
+++ b/gdb/testsuite/gdb.server/build-id-seqno.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/build-id-seqno.exp b/gdb/testsuite/gdb.server/build-id-seqno.exp
index 7db1f11..8475ccc 100644
--- a/gdb/testsuite/gdb.server/build-id-seqno.exp
+++ b/gdb/testsuite/gdb.server/build-id-seqno.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -90,13 +90,13 @@ proc load_binfile_check_debug_is_found { debuginfo_file testname } {
with_test_prefix "$testname" {
with_timeout_factor 5 {
# Probing for .build-id based debug files on remote
- # targets uses the vFile:stat packet by default, though
+ # targets uses the vFile:lstat packet by default, though
# there is a work around that avoids this which can be
# used if GDB is connected to an older gdbserver without
# 'stat' support.
#
# Check the work around works by disabling use of the
- # vFile:stat packet.
+ # vFile:lstat packet.
foreach_with_prefix stat_pkt {auto off} {
clean_restart
@@ -105,7 +105,7 @@ proc load_binfile_check_debug_is_found { debuginfo_file testname } {
gdb_test_no_output "set sysroot target:"
- gdb_test "set remote hostio-stat-packet $stat_pkt"
+ gdb_test "set remote hostio-lstat-packet $stat_pkt"
# Make sure we're disconnected, in case we're testing with an
# extended-remote board, therefore already connected.
diff --git a/gdb/testsuite/gdb.server/connect-stopped-target.c b/gdb/testsuite/gdb.server/connect-stopped-target.c
index cd4a9b2..7d13022 100644
--- a/gdb/testsuite/gdb.server/connect-stopped-target.c
+++ b/gdb/testsuite/gdb.server/connect-stopped-target.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/connect-stopped-target.exp b/gdb/testsuite/gdb.server/connect-stopped-target.exp
index 5e15a50..603782c 100644
--- a/gdb/testsuite/gdb.server/connect-stopped-target.exp
+++ b/gdb/testsuite/gdb.server/connect-stopped-target.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ proc do_test {nonstop} {
global gdb_prompt
global hex
- clean_restart $binfile
+ clean_restart $::testfile
# Make sure we're disconnected, in case we're testing with an
# extended-remote board, therefore already connected.
diff --git a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.c b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.c
index b1c4cae..17885d5 100644
--- a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.c
+++ b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp
index becd94d..01d7e46 100644
--- a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp
+++ b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -69,7 +69,7 @@ proc connect_no_symbol_file { sysroot action } {
} elseif { $action == "permission" } {
remote_exec target "chmod 000 $target_exec"
}
-
+
# Connect to GDBserver.
gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport
}
diff --git a/gdb/testsuite/gdb.server/connect-without-multi-process.c b/gdb/testsuite/gdb.server/connect-without-multi-process.c
index cd4a9b2..7d13022 100644
--- a/gdb/testsuite/gdb.server/connect-without-multi-process.c
+++ b/gdb/testsuite/gdb.server/connect-without-multi-process.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/connect-without-multi-process.exp b/gdb/testsuite/gdb.server/connect-without-multi-process.exp
index 872c8c9..f47e57e 100644
--- a/gdb/testsuite/gdb.server/connect-without-multi-process.exp
+++ b/gdb/testsuite/gdb.server/connect-without-multi-process.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ proc do_test {multiprocess} {
set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\""
}
- clean_restart $binfile
+ clean_restart $::testfile
}
# Make sure we're disconnected, in case we're testing with an
diff --git a/gdb/testsuite/gdb.server/exit-multiple-threads.c b/gdb/testsuite/gdb.server/exit-multiple-threads.c
index 5bf0fc8..9427e53 100644
--- a/gdb/testsuite/gdb.server/exit-multiple-threads.c
+++ b/gdb/testsuite/gdb.server/exit-multiple-threads.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/exit-multiple-threads.exp b/gdb/testsuite/gdb.server/exit-multiple-threads.exp
index 79ff176..48bb10f 100644
--- a/gdb/testsuite/gdb.server/exit-multiple-threads.exp
+++ b/gdb/testsuite/gdb.server/exit-multiple-threads.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,7 +45,8 @@ proc prepare_for_test { executable target_executable disable_multi_process } {
set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\""
}
- clean_restart ${executable}
+ clean_restart
+ gdb_load $executable
}
# Make sure we're disconnected, in case we're testing with an
@@ -69,7 +70,7 @@ proc prepare_for_test { executable target_executable disable_multi_process } {
set gdbserver_protocol [lindex $res 0]
set gdbserver_gdbport [lindex $res 1]
set res [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
- if ![gdb_assert {$res == 0} "connect"] {
+ if { ![gdb_assert {$res == 0} "connect"] } {
return
}
@@ -137,8 +138,8 @@ foreach_with_prefix test { exit signal } {
set func "run_${test}_test"
set executable "$binfile-${test}"
- if [build_executable "failed to prepare" $executable $srcfile \
- [list debug pthreads additional_flags=-D${def}]] {
+ if {[build_executable "failed to prepare" $executable $srcfile \
+ [list debug pthreads additional_flags=-D${def}]]} {
return -1
}
diff --git a/gdb/testsuite/gdb.server/ext-attach.c b/gdb/testsuite/gdb.server/ext-attach.c
index c7657d7..6718bb1 100644
--- a/gdb/testsuite/gdb.server/ext-attach.c
+++ b/gdb/testsuite/gdb.server/ext-attach.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/ext-attach.exp b/gdb/testsuite/gdb.server/ext-attach.exp
index 83589aa..6af2ede 100644
--- a/gdb/testsuite/gdb.server/ext-attach.exp
+++ b/gdb/testsuite/gdb.server/ext-attach.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ proc run_test { target_async target_non_stop to_disable } {
set ::GDBFLAGS "$::GDBFLAGS -ex \"set sysroot\""
}
- clean_restart $::binfile
+ clean_restart $::testfile
}
# Make sure we're disconnected, in case we're testing with an
diff --git a/gdb/testsuite/gdb.server/ext-restart.exp b/gdb/testsuite/gdb.server/ext-restart.exp
index 4516ade..1d8d3a1 100644
--- a/gdb/testsuite/gdb.server/ext-restart.exp
+++ b/gdb/testsuite/gdb.server/ext-restart.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/ext-run.exp b/gdb/testsuite/gdb.server/ext-run.exp
index 296af98..f4ff546 100644
--- a/gdb/testsuite/gdb.server/ext-run.exp
+++ b/gdb/testsuite/gdb.server/ext-run.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ save_vars { GDBFLAGS } {
set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\""
}
- clean_restart $binfile
+ clean_restart $::testfile
}
# Make sure we're disconnected, in case we're testing with an
diff --git a/gdb/testsuite/gdb.server/ext-wrapper.exp b/gdb/testsuite/gdb.server/ext-wrapper.exp
index c86acd2..8e3b8c5 100644
--- a/gdb/testsuite/gdb.server/ext-wrapper.exp
+++ b/gdb/testsuite/gdb.server/ext-wrapper.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/extended-remote-restart.c b/gdb/testsuite/gdb.server/extended-remote-restart.c
index a677436..8667b4f 100644
--- a/gdb/testsuite/gdb.server/extended-remote-restart.c
+++ b/gdb/testsuite/gdb.server/extended-remote-restart.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/extended-remote-restart.exp b/gdb/testsuite/gdb.server/extended-remote-restart.exp
index 0cfb383..a5ba53c 100644
--- a/gdb/testsuite/gdb.server/extended-remote-restart.exp
+++ b/gdb/testsuite/gdb.server/extended-remote-restart.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@ proc test_reload { do_kill_p follow_child_p } {
global decimal
global binfile
- clean_restart ${binfile}
+ clean_restart ${::testfile}
if {![runto_main]} {
return 0
@@ -70,7 +70,7 @@ proc test_reload { do_kill_p follow_child_p } {
set live_inf_ptn "process $decimal"
set dead_inf_ptn "<null>"
- if ${follow_child_p} {
+ if { $follow_child_p } {
gdb_test_no_output "set follow-fork child"
set parent_prefix " "
set child_prefix "\\*"
diff --git a/gdb/testsuite/gdb.server/fetch-exec-and-args.c b/gdb/testsuite/gdb.server/fetch-exec-and-args.c
new file mode 100644
index 0000000..3dc01a2
--- /dev/null
+++ b/gdb/testsuite/gdb.server/fetch-exec-and-args.c
@@ -0,0 +1,34 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2023-2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Simple test, do some work with the arguments so GDB has a chance to
+ break and check that the arguments are correct. */
+
+volatile int global_counter;
+
+int
+main (int argc, char *argv[])
+{
+ int i;
+
+ global_counter = 0; /* Break here. */
+
+ for (i = 0; i < argc; ++i)
+ argv[i] = (char *) 0;
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.server/fetch-exec-and-args.exp b/gdb/testsuite/gdb.server/fetch-exec-and-args.exp
new file mode 100644
index 0000000..7c7750e
--- /dev/null
+++ b/gdb/testsuite/gdb.server/fetch-exec-and-args.exp
@@ -0,0 +1,307 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2023 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test the qExecAndArgs packet, specifically, the argument fetching
+# component of the packet.
+
+# Skip test if target does not support argument passing.
+require {!target_info exists noargs}
+
+load_lib gdbserver-support.exp
+
+standard_testfile
+
+require allow_gdbserver_tests
+
+if {[build_executable "failed to build" $binfile $srcfile]} {
+ return
+}
+
+# Used as an override for extended_gdbserver_load_last_file in
+# configs/native-extended-gdbserver.exp, prevents the remote exec-file
+# from being set.
+proc do_nothing {} { return 0 }
+
+# Check the 'show args' output. If PACKET is 'on' then we expect to
+# see the arguments 'a b c', otherwise we don't expect to see any
+# arguments.
+proc check_show_args { packet } {
+ if { $packet } {
+ set args_re "a b c"
+ } else {
+ set args_re ""
+ }
+
+ gdb_test "show args" \
+ "Argument list to give program being debugged when it is started is \"$args_re\"\\."
+}
+
+# Check the 'show remote exec-file' output. PACKET is either 'on' or
+# 'off' and reflects whether the qExecAndArgs packet is turned on or
+# off. FILENAME is what we expect to see included in the output, and
+# is converted to a regexp by this function.
+proc check_remote_exec_file { packet filename } {
+ if { $filename eq "" } {
+ if { $packet } {
+ set remote_exec_re \
+ "The remote exec-file is unset, the remote has no default executable set\\."
+ } else {
+ set remote_exec_re \
+ "The remote exec-file is unset, the default remote executable will be used\\."
+ }
+ } else {
+ set remote_exec_re \
+ "The remote exec-file is \"[string_to_regexp $filename]\"\\."
+ }
+
+ gdb_test "show remote exec-file" $remote_exec_re
+}
+
+# Check the inferior has 4 arguments. Arg 0 will be the program name,
+# while 1, 2, and 3 should be a, b, and c respectively.
+proc check_full_args {} {
+ set exec_filename ""
+ gdb_test "print argc" " = 4"
+ gdb_test_multiple "print argv\[0\]" "" {
+ -re -wrap " = $::hex \"(.*/${::testfile})\"" {
+ set exec_filename $expect_out(1,string)
+ pass $gdb_test_name
+ }
+ }
+ gdb_test "print argv\[1\]" " = $::hex \"a\""
+ gdb_test "print argv\[2\]" " = $::hex \"b\""
+ gdb_test "print argv\[3\]" " = $::hex \"c\""
+
+ return $exec_filename
+}
+
+# Close and cleanup gdbserver process.
+proc cleanup_gdbserver {} {
+ catch {
+ close -i $server_spawn_id
+ wait -nowait -i $server_spawn_id
+ }
+}
+
+# Check that GDB can fetch the arguments from the remote using the
+# qExecAndArgs packet. When PACKET is 'on' we allow GDB to use the
+# packet, but when PACKET is 'off' we disable use of the qExecAndArgs
+# packet and ensure GDB falls back to the expected behaviour.
+proc_with_prefix test_exec_and_arg_fetch { packet } {
+ clean_restart $::testfile
+
+ # Make sure we're disconnected, in case we're testing with an
+ # extended-remote board, therefore already connected.
+ gdb_test "disconnect" ".*"
+
+ gdb_test "set remote fetch-exec-and-args ${packet}" \
+ "Support for the 'qExecAndArgs' packet on future remote targets is set to \"${packet}\"\\."
+
+ gdbserver_run "a b c"
+
+ gdb_breakpoint $::srcfile:[gdb_get_line_number "Break here"]
+ gdb_continue_to_breakpoint "run to breakpoint"
+
+ # Look in the inferior to check the arguments were passed
+ # correctly. We get back the name of the executable the inferior
+ # is running. If PACKET is 'on' then we expect GDB to have
+ # automatically fetched this executable name from the remote.
+ set exec_filename [check_full_args]
+ if { !$packet } {
+ set exec_filename ""
+ }
+
+ # Check 'show args' to ensure GDB sees the correct arguments.
+ check_show_args $packet
+
+ # Check 'show remote exec-file' to ensure GDB sees the correct
+ # filename.
+ check_remote_exec_file $packet $exec_filename
+
+ # Below this point we rely on restarting the inferior, which
+ # relies on the extended-remote protocol.
+ if {[target_info gdb_protocol] ne "extended-remote"} {
+ cleanup_gdbserver
+ return
+ }
+
+ with_test_prefix "rerun" {
+ # Don't restart GDB, but re-run the inferior.
+ gdb_run_cmd
+ gdb_test "" \
+ "Breakpoint $::decimal, main \\(\[^)\]+\\).*" \
+ "rerun until breakpoint in main"
+
+ # If the packet is enabled then we expect the arguments to
+ # still be correct, otherwise, we should have defaulted back
+ # to no additional arguments.
+ if { $packet } {
+ check_full_args
+ } else {
+ gdb_test "print argc" " = 1"
+ }
+
+ # Check 'show args' to ensure GDB sees the correct arguments.
+ check_show_args ${packet}
+
+ # Check 'show remote exec-file' to ensure GDB sees the correct
+ # filename.
+ check_remote_exec_file $packet $exec_filename
+ }
+
+ cleanup_gdbserver
+}
+
+# With the extended-remote target it is possible to start gdbserver
+# without specifying an inferior to run. In this case, gdbserver
+# should reply to the qExecAndArgs packet with a 'U' (for unset)
+# response. GDB should not override any currently set remote
+# executable or inferior arguments. The benefit of this is that a
+# user can set these values before connecting to gdbserver in this
+# case.
+proc_with_prefix test_exec_and_args_unset { packet } {
+ clean_restart
+
+ # Make sure we're disconnected, in case we're testing with an
+ # extended-remote board, therefore already connected.
+ gdb_test "disconnect" ".*"
+
+ # Enable or disable the qExecAndArgs packet.
+ gdb_test "set remote fetch-exec-and-args ${packet}" \
+ "Support for the 'qExecAndArgs' packet on future remote targets is set to \"${packet}\"\\."
+
+ # Setup a remote exec-file value, and some inferior arguments.
+ set fake_exec_name "/xxx/yyy/zzz"
+ set fake_args "1 2 3"
+ gdb_test_no_output "set remote exec-file $fake_exec_name"
+ gdb_test_no_output "set args $fake_args"
+
+ # Start gdbserver in extended-remote mode, don't specify an
+ # executable to start, or any inferior arguments.
+ set res [gdbserver_start "--multi" ""]
+ set gdbserver_protocol "extended-remote"
+ set gdbserver_gdbport [lindex $res 1]
+ gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport
+
+ # Check within GDB that connecting to the extended-remote target
+ # didn't clobber the remote exec-file or inferior arguments.
+ gdb_test "show remote exec-file" \
+ "The remote exec-file is \"[string_to_regexp $fake_exec_name]\"\\."
+ gdb_test "show args" \
+ "Argument list to give program being debugged when it is started is \"${fake_args}\"\\."
+
+ cleanup_gdbserver
+}
+
+# Start GDB and set 'remote exec-file' to some random file. Then
+# start gdbserver with the name of the actual executable. Connect to
+# gdbserver from GDB and check that GDB gives a warning about the
+# remove exec-file value having changed.
+proc_with_prefix test_remote_exec_warning {} {
+ clean_restart
+
+ gdb_test "disconnect" ".*"
+
+ # Set the file GDB is going to debug. For extended-remote boards
+ # this also sets the remote exec-file.
+ gdb_file_cmd $::binfile
+
+ set invalid_remote_exec "/xxx/yyy/zzz"
+ gdb_test_no_output "set remote exec-file $invalid_remote_exec"
+ check_remote_exec_file on $invalid_remote_exec
+
+ # Start gdbserver.
+ set test "start gdbserver"
+ set target_exec [gdbserver_download_current_prog]
+ set target_exec_and_args "$target_exec a b c"
+ set catchres [catch {set res [gdbserver_start "" "$target_exec_and_args"]} errmsg]
+ if { $catchres != 0 } {
+ fail "$test: $errmsg"
+ } else {
+ pass "$test"
+ }
+
+ # And connect to gdbserver. Check for the warning GDB emits when
+ # the remote exec-file is updated.
+ set gdbserver_protocol [lindex $res 0]
+ set gdbserver_gdbport [lindex $res 1]
+ set test "connect to gdbserver"
+ set extra_re "warning: updating 'remote exec-file' to '[string_to_regexp $target_exec]' to match remote target"
+ set res [gdb_target_cmd_ext $gdbserver_protocol $gdbserver_gdbport $extra_re]
+ if { $res == 0 } {
+ pass $test
+ } elseif { $res == 1 } {
+ fail $test
+ } else {
+ unsupported $test
+ }
+
+ cleanup_gdbserver
+}
+
+# Start GDB. When PACKET is 'off' disable the qExecAndArgs packet,
+# otherwise, when PACKET is 'on' enable the packet.
+#
+# Start gdbserver in extended-remote mode, but don't provide a
+# filename when starting gdbserver.
+#
+# Connect to the remote server, and check 'show remote exec-file'.
+proc_with_prefix test_server_with_no_exec { packet set_remote_exec } {
+ clean_restart
+
+ gdb_test "disconnect" ".*"
+
+ gdb_file_cmd $::binfile
+
+ gdb_test "set remote fetch-exec-and-args ${packet}" \
+ "Support for the 'qExecAndArgs' packet on future remote targets is set to \"${packet}\"\\."
+
+ # Start gdbserver.
+ set target_exec [gdbserver_download_current_prog]
+
+ if { $set_remote_exec } {
+ gdb_test_no_output "set remote exec-file $target_exec" \
+ "set remote exec-file"
+ set expected_filename $target_exec
+ } else {
+ set expected_filename ""
+ }
+
+ gdbserver_start_extended
+
+ check_remote_exec_file $packet $expected_filename
+}
+
+# This override prevents the remote exec-file from being set when
+# using the extended-remote protocol. This is harmless when using
+# other boards.
+with_override extended_gdbserver_load_last_file do_nothing {
+ # This override stops GDB connecting to the gdbserver as soon as
+ # GDB is started when testing with the extended-remote protocol.
+ with_override gdbserver_start_multi do_nothing {
+ foreach_with_prefix packet { on off } {
+ test_exec_and_args_unset $packet
+ test_exec_and_arg_fetch $packet
+
+ foreach_with_prefix set_remote_exec { true false } {
+ test_server_with_no_exec $packet $set_remote_exec
+ }
+ }
+
+ test_remote_exec_warning
+ }
+}
diff --git a/gdb/testsuite/gdb.server/file-transfer.exp b/gdb/testsuite/gdb.server/file-transfer.exp
index 0a80277..e56247f 100644
--- a/gdb/testsuite/gdb.server/file-transfer.exp
+++ b/gdb/testsuite/gdb.server/file-transfer.exp
@@ -1,5 +1,5 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/fileio-packets.exp b/gdb/testsuite/gdb.server/fileio-packets.exp
new file mode 100644
index 0000000..9435efd
--- /dev/null
+++ b/gdb/testsuite/gdb.server/fileio-packets.exp
@@ -0,0 +1,66 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test some remote file I/O. The associated Python script uses the
+# Python API to create and send vFile:* packets to gdbserver to
+# perform actions like 'stat'. The same action is then performed
+# directly from Python (e.g. a 'stat' is performed), and the results,
+# from gdbserver, and from the local syscall, are compared.
+
+load_lib gdb-python.exp
+load_lib gdbserver-support.exp
+
+require allow_python_tests
+require allow_gdbserver_tests
+require {!is_remote host}
+require {!is_remote target}
+
+standard_testfile
+
+clean_restart
+
+# Make sure we're disconnected, in case we're testing with an
+# extended-remote board, therefore already connected.
+gdb_test "disconnect" ".*"
+
+set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
+gdb_test_no_output "source $pyfile" "source the script"
+
+# Start gdbserver, but always in extended-remote mode, and then
+# connect to it from GDB.
+set res [gdbserver_start "--multi --once" ""]
+set gdbserver_protocol "extended-remote"
+set gdbserver_gdbport [lindex $res 1]
+gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport
+
+gdb_test_no_output "set python print-stack full"
+
+set test_file_1 [standard_output_file "test_file_1"]
+remote_exec host "touch $test_file_1"
+
+set test_file_2 [standard_output_file "test_file_2"]
+remote_exec host "ln -s $test_file_1 $test_file_2"
+
+gdb_test "python check_lstat(\"$test_file_1\")" "PASS" \
+ "check remote lstat works on a normal file"
+
+gdb_test "python check_lstat(\"$test_file_2\")" "PASS" \
+ "check remote lstat works on a symbolic link"
+
+gdb_test "python check_stat(\"$test_file_1\")" "PASS" \
+ "check remote stat works on a normal file"
+
+gdb_test "python check_stat(\"$test_file_2\")" "PASS" \
+ "check remote stat works on a symbolic link"
diff --git a/gdb/testsuite/gdb.server/fileio-packets.py b/gdb/testsuite/gdb.server/fileio-packets.py
new file mode 100644
index 0000000..f132e91
--- /dev/null
+++ b/gdb/testsuite/gdb.server/fileio-packets.py
@@ -0,0 +1,208 @@
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import stat
+
+
+# Hex encode INPUT_STRING in the same way that GDB does. Each
+# character in INPUT_STRING is expanded to its two digit hex
+# representation in the returned string.
+#
+# Only ASCII characters may appear in INPUT_STRING, this is more
+# restrictive than GDB, but is good enough for testing.
+def hex_encode(input_string):
+ byte_string = input_string.encode("ascii")
+ hex_string = byte_string.hex()
+ return hex_string
+
+
+# Binary remote data packets can contain some escaped bytes. Decode
+# the packet now.
+def unescape_remote_data(buf):
+ escaped = False
+ res = bytearray()
+ for b in buf:
+ if escaped:
+ res.append(b ^ 0x20)
+ escaped = False
+ elif b == ord("}"):
+ escaped = True
+ else:
+ res.append(b)
+ res = bytes(res)
+ return res
+
+
+# Decode the results of a remote stat like command from BUF. Returns
+# None if BUF is not a valid stat result (e.g. if it indicates an
+# error, or the buffer is too short). If BUF is valid then the fields
+# are decoded according to the GDB remote protocol and placed into a
+# dictionary, this dictionary is then returned.
+def decode_stat_reply(buf, byteorder="big"):
+
+ buf = unescape_remote_data(buf)
+
+ if (
+ buf[0] != ord("F")
+ or buf[1] != ord("4")
+ or buf[2] != ord("0")
+ or buf[3] != ord(";")
+ or len(buf) != 68
+ ):
+ l = len(buf)
+ print(f"decode_stat_reply failed: {buf}\t(length = {l})")
+ return None
+
+ # Discard the 'F40;' prefix. The rest is the 64 bytes of data to
+ # be decoded.
+ buf = buf[4:]
+
+ st_dev = int.from_bytes(buf[0:4], byteorder=byteorder)
+ st_ino = int.from_bytes(buf[4:8], byteorder=byteorder)
+ st_mode = int.from_bytes(buf[8:12], byteorder=byteorder)
+ st_nlink = int.from_bytes(buf[12:16], byteorder=byteorder)
+ st_uid = int.from_bytes(buf[16:20], byteorder=byteorder)
+ st_gid = int.from_bytes(buf[20:24], byteorder=byteorder)
+ st_rdev = int.from_bytes(buf[24:28], byteorder=byteorder)
+ st_size = int.from_bytes(buf[28:36], byteorder=byteorder)
+ st_blksize = int.from_bytes(buf[36:44], byteorder=byteorder)
+ st_blocks = int.from_bytes(buf[44:52], byteorder=byteorder)
+ st_atime = int.from_bytes(buf[52:56], byteorder=byteorder)
+ st_mtime = int.from_bytes(buf[56:60], byteorder=byteorder)
+ st_ctime = int.from_bytes(buf[60:64], byteorder=byteorder)
+
+ return {
+ "st_dev": st_dev,
+ "st_ino": st_ino,
+ "st_mode": st_mode,
+ "st_nlink": st_nlink,
+ "st_uid": st_uid,
+ "st_gid": st_gid,
+ "st_rdev": st_rdev,
+ "st_size": st_size,
+ "st_blksize": st_blksize,
+ "st_blocks": st_blocks,
+ "st_atime": st_atime,
+ "st_mtime": st_mtime,
+ "st_ctime": st_ctime,
+ }
+
+
+# Perform an lstat of remote file FILENAME, and create a dictionary of
+# the results, the keys are the fields of the stat structure.
+def remote_lstat(filename):
+ conn = gdb.selected_inferior().connection
+ if not isinstance(conn, gdb.RemoteTargetConnection):
+ raise gdb.GdbError("connection is the wrong type")
+
+ filename_hex = hex_encode(filename)
+ reply = conn.send_packet("vFile:lstat:%s" % filename_hex)
+
+ stat = decode_stat_reply(reply)
+ return stat
+
+
+# Perform a stat of remote file FILENAME, and create a dictionary of
+# the results, the keys are the fields of the stat structure.
+def remote_stat(filename):
+ conn = gdb.selected_inferior().connection
+ if not isinstance(conn, gdb.RemoteTargetConnection):
+ raise gdb.GdbError("connection is the wrong type")
+
+ filename_hex = hex_encode(filename)
+ reply = conn.send_packet("vFile:stat:%s" % filename_hex)
+
+ stat = decode_stat_reply(reply)
+ return stat
+
+
+# Convert a stat_result object to a dictionary that should match the
+# dictionary built from the remote protocol reply.
+def stat_result_to_dict(res):
+ # GDB doesn't support the S_IFLNK flag for the remote protocol, so
+ # clear that flag in the local results.
+ if stat.S_ISLNK(res.st_mode):
+ st_mode = stat.S_IMODE(res.st_mode)
+ else:
+ st_mode = res.st_mode
+
+ # GDB returns an integer for these fields, while Python returns a
+ # floating point value. Convert back to an integer to match GDB.
+ st_atime = int(res.st_atime)
+ st_mtime = int(res.st_mtime)
+ st_ctime = int(res.st_ctime)
+
+ return {
+ "st_dev": res.st_dev,
+ "st_ino": res.st_ino,
+ "st_mode": st_mode,
+ "st_nlink": res.st_nlink,
+ "st_uid": res.st_uid,
+ "st_gid": res.st_gid,
+ "st_rdev": res.st_rdev,
+ "st_size": res.st_size,
+ "st_blksize": res.st_blksize,
+ "st_blocks": res.st_blocks,
+ "st_atime": st_atime,
+ "st_mtime": st_mtime,
+ "st_ctime": st_ctime,
+ }
+
+
+# Perform an lstat of local file FILENAME, and create a dictionary of
+# the results, the keys are the fields of the stat structure.
+def local_lstat(filename):
+ res = os.lstat(filename)
+ return stat_result_to_dict(res)
+
+
+# Perform an lstat of local file FILENAME, and create a dictionary of
+# the results, the keys are the fields of the stat structure.
+def local_stat(filename):
+ res = os.stat(filename)
+ return stat_result_to_dict(res)
+
+
+# Perform a remote lstat using GDB, and a local lstat using os.lstat.
+# Compare the results to check they are the same.
+#
+# For this test to work correctly, gdbserver, and GDB (where this
+# Python script is running), must see the same filesystem.
+def check_lstat(filename):
+ s1 = remote_lstat(filename)
+ s2 = local_lstat(filename)
+
+ print(f"remote = {s1}")
+ print(f"local = {s2}")
+
+ assert s1 == s2
+ print("PASS")
+
+
+# Perform a remote stat using GDB, and a local stat using os.stat.
+# Compare the results to check they are the same.
+#
+# For this test to work correctly, gdbserver, and GDB (where this
+# Python script is running), must see the same filesystem.
+def check_stat(filename):
+ s1 = remote_stat(filename)
+ s2 = local_stat(filename)
+
+ print(f"remote = {s1}")
+ print(f"local = {s2}")
+
+ assert s1 == s2
+ print("PASS")
diff --git a/gdb/testsuite/gdb.server/inferior-args.c b/gdb/testsuite/gdb.server/inferior-args.c
new file mode 100644
index 0000000..3bc3ff7
--- /dev/null
+++ b/gdb/testsuite/gdb.server/inferior-args.c
@@ -0,0 +1,27 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2023-2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+
+int
+main (int argc, char **argv)
+{
+ for (int i = 0; i < argc; i++)
+ printf ("[%d] %s\n", i, argv[i]);
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.server/inferior-args.exp b/gdb/testsuite/gdb.server/inferior-args.exp
new file mode 100644
index 0000000..18ac5a3
--- /dev/null
+++ b/gdb/testsuite/gdb.server/inferior-args.exp
@@ -0,0 +1,156 @@
+# Copyright 2023-2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test passing inferior arguments on the gdbserver command line. Tests the
+# flags --no-startup-with-shell and --no-escape-args that change how GDB
+# interprets the arguments being passed.
+
+# This test relies on starting gdbserver using the pipe syntax. Not sure
+# how well this will run if part of this test is being run elsewhere.
+require {!is_remote target} {!is_remote host}
+
+load_lib gdbserver-support.exp
+
+standard_testfile
+
+require allow_gdbserver_tests
+
+set gdbserver [find_gdbserver]
+if { $gdbserver == "" } {
+ unsupported "could not find gdbserver"
+ return
+}
+
+standard_testfile
+if {[build_executable "failed to prepare" $testfile $srcfile]} {
+ return -1
+}
+
+# EXTENDED_P is a boolean, when true gdbserver is started with --multi, and
+# GDB connects using extended-remote protocol. Otherwise, no --multi flag
+# is passed, and GDB connects with the remote protocol.
+#
+# WITH_SHELL_P is a boolean, when true gdbserver starts the inferior using a
+# shell, when false gdbserver is passed the --no-startup-with-shell command
+# line option, and should not start the inferior through a shell.
+#
+# ESCAPE_P is a boolean, when true gdbserver applies escapes to the inferior
+# arguments, when false gdbserver is passed the --no-escape-args command
+# line option, and should not apply escaping to the inferior arguments.
+#
+# ARGLIST is a list of inferior arguments to add to the gdbserver command
+# line.
+#
+# RE_LIST is a list of patterns to match, one for each of ARGLIST. Once the
+# inferior is started we check that each argument matches its corresponding
+# entry in RE_LIST.
+proc do_test_inner { extended_p with_shell_p escape_p arglist re_list } {
+
+ clean_restart ${::testfile}
+
+ gdb_test_no_output "set sysroot"
+
+ # Make sure we're disconnected, in case we're testing with an
+ # extended-remote board, therefore already connected.
+ gdb_test "disconnect" ".*"
+
+ if { $extended_p } {
+ set protocol "extended-remote"
+ } else {
+ set protocol "remote"
+ }
+
+ if { $escape_p } {
+ set esc_opt ""
+ } else {
+ set esc_opt "--no-escape-args"
+ }
+
+ if { $with_shell_p } {
+ set shell_opt ""
+ } else {
+ set shell_opt "--no-startup-with-shell"
+ }
+
+ gdb_test "target ${protocol} | ${::gdbserver} --once ${esc_opt} ${shell_opt} - ${::binfile} ${arglist}" \
+ ".*" \
+ "start gdbserver over stdin"
+
+ gdb_breakpoint main
+ gdb_continue_to_breakpoint main
+
+ set expected_len [expr {1 + [llength $re_list]}]
+ gdb_test "print argc" \
+ "\\\$$::decimal = $expected_len" "check argc"
+
+ set i 1
+ foreach arg $re_list {
+ gdb_test "print argv\[$i\]" \
+ "\\\$$::decimal = $::hex \"$arg\"" \
+ "check argv\[$i\]"
+ incr i
+ }
+}
+
+# Wrapper around do_test_inner. NAME is the name of this test, used to make
+# the test names unique. ARGLIST is the list of inferior arguments to add
+# to the gdbserver command line.
+#
+# The optional RE_ESC_LIST is a list of patterns to match against the
+# inferior arguments once the inferior is started, one pattern for each
+# argument. If RE_ESC_LIST is not given then ARGLIST is reused, which
+# implies the arguments appear unmodified in the test output.
+#
+# The optional RE_NO_ESC_LIST is a list of patterns to match against the
+# inferior arguments when gdbserver is started with --no-escape-args or
+# --no-startup-with-shell. There should be one pattern for each argument.
+# If RE_NO_ESC_LIST is not given then RE_ESC_LIST is reused, which implies
+# there's no difference in how the arguments are printed.
+proc args_test { name arglist {re_esc_list {}} {re_no_esc_list {}} } {
+ if {[llength $re_esc_list] == 0} {
+ set re_esc_list $arglist
+ }
+
+ if {[llength $re_no_esc_list] == 0} {
+ set re_no_esc_list $re_esc_list
+ }
+
+ foreach_with_prefix extended_p { yes no } {
+ foreach_with_prefix startup_with_shell { on off } {
+ foreach_with_prefix escape_p { yes no } {
+ if { $escape_p || !$startup_with_shell } {
+ set re_list $re_esc_list
+ } else {
+ set re_list $re_no_esc_list
+ }
+
+ with_test_prefix "$name" {
+ do_test_inner $extended_p $startup_with_shell \
+ $escape_p $arglist $re_list
+ }
+ }
+ }
+ }
+}
+
+args_test "basic" {a b c}
+args_test "one empty" {1 "" 3}
+args_test "two empty" {1 "" "" 3}
+args_test "one with single quotes" {1 "''" 3}
+args_test "lone double quote" {"1" \" 3} {1 \\\\\" 3}
+save_vars { env(TEST) } {
+ set env(TEST) "ABCD"
+ args_test "shell variable" {\$TEST} {\\$TEST} {ABCD}
+}
diff --git a/gdb/testsuite/gdb.server/monitor-exit-quit.exp b/gdb/testsuite/gdb.server/monitor-exit-quit.exp
index a2fb1db..74842a0 100644
--- a/gdb/testsuite/gdb.server/monitor-exit-quit.exp
+++ b/gdb/testsuite/gdb.server/monitor-exit-quit.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ save_vars { GDBFLAGS } {
set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\""
}
- clean_restart $binfile
+ clean_restart $::testfile
}
# Make sure we're disconnected, in case we're testing with an
@@ -70,7 +70,7 @@ gdb_test_multiple "quit" "" {
# Cleanup, as in default_gdb_exit.
if { $do_cleanup } {
- if ![is_remote host] {
+ if { ![is_remote host] } {
remote_close host
}
unset gdb_spawn_id
diff --git a/gdb/testsuite/gdb.server/multi-ui-errors.c b/gdb/testsuite/gdb.server/multi-ui-errors.c
index a29f830..d058eef 100644
--- a/gdb/testsuite/gdb.server/multi-ui-errors.c
+++ b/gdb/testsuite/gdb.server/multi-ui-errors.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/multi-ui-errors.exp b/gdb/testsuite/gdb.server/multi-ui-errors.exp
index d6c9cf1..2cdf631 100644
--- a/gdb/testsuite/gdb.server/multi-ui-errors.exp
+++ b/gdb/testsuite/gdb.server/multi-ui-errors.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/no-thread-db.c b/gdb/testsuite/gdb.server/no-thread-db.c
index 032321a..be7d24f 100644
--- a/gdb/testsuite/gdb.server/no-thread-db.c
+++ b/gdb/testsuite/gdb.server/no-thread-db.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
Contributed by Intel Corporation.
diff --git a/gdb/testsuite/gdb.server/no-thread-db.exp b/gdb/testsuite/gdb.server/no-thread-db.exp
index 656fad1..9fd2090 100644
--- a/gdb/testsuite/gdb.server/no-thread-db.exp
+++ b/gdb/testsuite/gdb.server/no-thread-db.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corporation.
#
@@ -57,6 +57,8 @@ gdb_breakpoint ${srcfile}:[gdb_get_line_number "after tls assignment"]
gdb_continue_to_breakpoint "after tls assignment"
# Printing a tls variable should fail gracefully without a libthread_db.
+# Alternately, the correct answer might be printed due GDB's internal
+# TLS support for some targets.
set re_exec "\[^\r\n\]*[file tail $binfile]"
gdb_test "print foo" \
- "Cannot find thread-local storage for Thread \[^,\]+, executable file $re_exec:\[\r\n\]+Remote target failed to process qGetTLSAddr request"
+ "= 1|(?:Cannot find thread-local storage for Thread \[^,\]+, executable file $re_exec:\[\r\n\]+Remote target failed to process qGetTLSAddr request)"
diff --git a/gdb/testsuite/gdb.server/non-existing-program.exp b/gdb/testsuite/gdb.server/non-existing-program.exp
index 71b29c2..ec9c044 100644
--- a/gdb/testsuite/gdb.server/non-existing-program.exp
+++ b/gdb/testsuite/gdb.server/non-existing-program.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,6 +34,8 @@ if { $gdbserver == "" } {
# to spawn the program before opening the connection.
set spawn_id [remote_spawn target "$gdbserver stdio non-existing-program"]
+set eol {[\r\n]}
+
set msg "gdbserver exits cleanly"
set saw_exiting 0
expect {
@@ -51,7 +53,7 @@ expect {
exp_continue
}
# This is what we get on Windows.
- -re "Error creating process\r\n\r\nExiting\r\n" {
+ -re "Error creating process.*$eol+Exiting$eol+" {
set saw_exiting 1
exp_continue
}
diff --git a/gdb/testsuite/gdb.server/normal.c b/gdb/testsuite/gdb.server/normal.c
index 3fab53d..a9a452a 100644
--- a/gdb/testsuite/gdb.server/normal.c
+++ b/gdb/testsuite/gdb.server/normal.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/pread-offset-size.S b/gdb/testsuite/gdb.server/pread-offset-size.S
new file mode 100644
index 0000000..6ca8cf0
--- /dev/null
+++ b/gdb/testsuite/gdb.server/pread-offset-size.S
@@ -0,0 +1,29 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Here we are trying to create a large binary (> 2 GB),
+ 3742415472 bytes is about 3.5 gigabytes. */
+
+ .text
+ .globl _start
+_start:
+ .skip 3742415472
+ ret
+ .globl f
+ .type f, @function
+f:
+ ret
diff --git a/gdb/testsuite/gdb.server/pread-offset-size.exp b/gdb/testsuite/gdb.server/pread-offset-size.exp
new file mode 100644
index 0000000..54e67c5
--- /dev/null
+++ b/gdb/testsuite/gdb.server/pread-offset-size.exp
@@ -0,0 +1,49 @@
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Check that GDBserver's vFile::pread implementation is able to access
+# large files (> 2GB).
+
+load_lib gdbserver-support.exp
+
+require allow_gdbserver_tests
+
+standard_testfile .S
+
+if { [prepare_for_testing ${testfile}.exp $testfile \
+ $srcfile {debug additional_flags=-nostdlib} ] } {
+ return -1
+}
+
+clean_restart
+
+gdb_test_no_output "set remote exec-file $binfile" \
+ "set remote exec-file"
+
+# Make sure we're disconnected, in case we're testing with an
+# extended-remote board, therefore already connected.
+gdb_test "disconnect" ".*"
+
+set res [gdbserver_spawn ""]
+set gdbserver_protocol [lindex $res 0]
+set gdbserver_gdbport [lindex $res 1]
+
+gdb_test "target $gdbserver_protocol $gdbserver_gdbport" \
+ "Remote debugging using .*" \
+ "target $gdbserver_protocol"
+
+# If loading the large binary was successful, we should be able to
+# place a breakpoint on f.
+gdb_test "break f" "Breakpoint 1.*"
diff --git a/gdb/testsuite/gdb.server/reconnect-ctrl-c.c b/gdb/testsuite/gdb.server/reconnect-ctrl-c.c
index 695b55d..af8ed9b 100644
--- a/gdb/testsuite/gdb.server/reconnect-ctrl-c.c
+++ b/gdb/testsuite/gdb.server/reconnect-ctrl-c.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp b/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp
index 4cf0bb5..61aaaea 100644
--- a/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp
+++ b/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ save_vars { GDBFLAGS } {
set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\""
}
- if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+ if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
return -1
}
}
@@ -51,7 +51,7 @@ proc connect_continue_ctrl_c {} {
global gdbserver_protocol gdbserver_gdbport
set res [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
- if ![gdb_assert {$res == 0} "connect"] {
+ if { ![gdb_assert {$res == 0} "connect"] } {
return
}
diff --git a/gdb/testsuite/gdb.server/remote-read-msgs.c b/gdb/testsuite/gdb.server/remote-read-msgs.c
index bbcfb01..9369dd4 100644
--- a/gdb/testsuite/gdb.server/remote-read-msgs.c
+++ b/gdb/testsuite/gdb.server/remote-read-msgs.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/remote-read-msgs.exp b/gdb/testsuite/gdb.server/remote-read-msgs.exp
index e204655..6c6db21 100644
--- a/gdb/testsuite/gdb.server/remote-read-msgs.exp
+++ b/gdb/testsuite/gdb.server/remote-read-msgs.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/run-without-local-binary.exp b/gdb/testsuite/gdb.server/run-without-local-binary.exp
index 58548ff..0a5c538 100644
--- a/gdb/testsuite/gdb.server/run-without-local-binary.exp
+++ b/gdb/testsuite/gdb.server/run-without-local-binary.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/server-connect.exp b/gdb/testsuite/gdb.server/server-connect.exp
index 7617da6..8b53f61 100644
--- a/gdb/testsuite/gdb.server/server-connect.exp
+++ b/gdb/testsuite/gdb.server/server-connect.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/server-empty-exec-name.exp b/gdb/testsuite/gdb.server/server-empty-exec-name.exp
new file mode 100644
index 0000000..a9cb9ab
--- /dev/null
+++ b/gdb/testsuite/gdb.server/server-empty-exec-name.exp
@@ -0,0 +1,93 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test what happens if we try to start gdbserver with an empty string
+# for the executable name. In theory we could choose to accept this
+# for the extended-remote case, indeed, in the extended-remote case
+# it's OK to start gdbserver with no program name or arguments.
+#
+# But actually specifying an empty executable name seems different,
+# and wrong, so for now at least, we don't allow this. If that
+# position changes in the future, then this test will need updating.
+
+# Skip test if target does not support argument passing.
+require {!target_info exists noargs}
+
+load_lib gdbserver-support.exp
+
+standard_testfile
+
+require allow_gdbserver_tests
+
+set gdbserver [find_gdbserver]
+if { $gdbserver == "" } {
+ unsupported "could not find gdbserver"
+ return
+}
+
+clean_restart
+
+# Try starting gdbserver in extended, and non-extended mode.
+foreach_with_prefix proto { extended-remote remote } {
+
+ if { $proto eq "extended-remote" } {
+ set server_flag "--multi"
+ } else {
+ set server_flag ""
+ }
+
+ # Try starting gdbserver with and without arguments.
+ foreach_with_prefix args { " a b c" "" } {
+ # Start gdbserver on its own. This makes it easier to check
+ # the error message that gdbserver emits. The program name is
+ # the empty string. gdbserver should exit.
+ set gdbserver_cmd \
+ "$gdbserver $server_flag --once - \"\"${args}"
+
+ set spawn_id [remote_spawn target $gdbserver_cmd]
+ set testname "start gdbserver"
+ expect {
+ -i $spawn_id
+
+ -re "No program to debug\r\nExiting" { pass $testname }
+
+ eof { fail $testname }
+ timeout { fail $testname }
+ }
+
+ catch {
+ close -i $spawn_id
+ wait -nowait -i $spawn_id
+ }
+
+ # Try connecting to gdbserver from GDB. The connection should
+ # immediately close as gdbserver exits. The inferior should
+ # be left with no connection.
+ gdb_test "disconnect" ".*" \
+ "disconnect before remote connection"
+
+ gdb_test "target $proto | ${::gdbserver} $server_flag --once - \"\"${args}" \
+ [multi_line \
+ "Remote debugging using \\| \[^\r\n\]+" \
+ "Remote communication error\\. Target disconnected: .*"] \
+ "start gdbserver over stdin"
+
+ gdb_test "info inferiors" \
+ "\\*\\s+1\\s+<null>\\s*" \
+ "check inferior 1 has no connection"
+ }
+}
diff --git a/gdb/testsuite/gdb.server/server-exec-info.exp b/gdb/testsuite/gdb.server/server-exec-info.exp
index 6bfc3b7b..007290a 100644
--- a/gdb/testsuite/gdb.server/server-exec-info.exp
+++ b/gdb/testsuite/gdb.server/server-exec-info.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ load_lib gdbserver-support.exp
require allow_gdbserver_tests allow_shlib_tests
standard_testfile server.c
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.server/server-kill-python.exp b/gdb/testsuite/gdb.server/server-kill-python.exp
index a771e6f..a9027b7 100644
--- a/gdb/testsuite/gdb.server/server-kill-python.exp
+++ b/gdb/testsuite/gdb.server/server-kill-python.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/server-kill.c b/gdb/testsuite/gdb.server/server-kill.c
index cccc871..3f3c17e 100644
--- a/gdb/testsuite/gdb.server/server-kill.c
+++ b/gdb/testsuite/gdb.server/server-kill.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/server-kill.exp b/gdb/testsuite/gdb.server/server-kill.exp
index 4fc2509..f01f5e3 100644
--- a/gdb/testsuite/gdb.server/server-kill.exp
+++ b/gdb/testsuite/gdb.server/server-kill.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@ proc prepare {} {
set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\""
}
- clean_restart $binfile
+ clean_restart $::testfile
}
# Make sure we're disconnected, in case we're testing with an
@@ -82,7 +82,7 @@ proc kill_server {} {
# Test issuing "tstatus" right after the connection is dropped.
proc_with_prefix test_tstatus {} {
- if ![prepare] {
+ if {![prepare]} {
return
}
@@ -97,14 +97,14 @@ proc_with_prefix test_tstatus {} {
# Force GDB to talk with GDBserver, so that we can get the
# "connection closed" error.
- gdb_test "tstatus" {Remote connection closed|Remote communication error\. Target disconnected: Connection reset by peer\.}
+ gdb_test "tstatus" {Remote connection closed|Remote communication error\. Target disconnected: error while reading: Connection reset by peer\.}
}
# Test unwinding with no debug/unwind info, right after the connection
# is dropped.
proc_with_prefix test_unwind_nosyms {} {
- if ![prepare] {
+ if {![prepare]} {
return
}
@@ -121,7 +121,7 @@ proc_with_prefix test_unwind_nosyms {} {
# dropped.
proc_with_prefix test_unwind_syms {} {
- if ![prepare] {
+ if {![prepare]} {
return
}
@@ -133,7 +133,7 @@ proc_with_prefix test_unwind_syms {} {
# Test performing a stepi right after the connection is dropped.
proc_with_prefix test_stepi {} {
- if ![prepare] {
+ if {![prepare]} {
return
}
@@ -152,4 +152,3 @@ test_tstatus
test_unwind_nosyms
test_unwind_syms
test_stepi
-
diff --git a/gdb/testsuite/gdb.server/server-mon.exp b/gdb/testsuite/gdb.server/server-mon.exp
index 80e34a0..c46b37b 100644
--- a/gdb/testsuite/gdb.server/server-mon.exp
+++ b/gdb/testsuite/gdb.server/server-mon.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/server-pipe.exp b/gdb/testsuite/gdb.server/server-pipe.exp
index 3d73c2e..20ca0b0 100644
--- a/gdb/testsuite/gdb.server/server-pipe.exp
+++ b/gdb/testsuite/gdb.server/server-pipe.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
# the contents of the gdb.TargetConnection.details string.
proc do_test { target } {
global timeout
- clean_restart ${::binfile}
+ clean_restart ${::testfile}
# Make sure we're disconnected, in case we're testing with an
# extended-remote board, therefore already connected.
diff --git a/gdb/testsuite/gdb.server/server-run.exp b/gdb/testsuite/gdb.server/server-run.exp
index e81384f..53b3278 100644
--- a/gdb/testsuite/gdb.server/server-run.exp
+++ b/gdb/testsuite/gdb.server/server-run.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2005-2024 Free Software Foundation, Inc.
+# Copyright 2005-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ save_vars { GDBFLAGS } {
set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\""
}
- clean_restart $binfile
+ clean_restart $::testfile
}
# Make sure we're disconnected, in case we're testing with an
diff --git a/gdb/testsuite/gdb.server/server.c b/gdb/testsuite/gdb.server/server.c
index 40cee26..422e000 100644
--- a/gdb/testsuite/gdb.server/server.c
+++ b/gdb/testsuite/gdb.server/server.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2005-2024 Free Software Foundation, Inc.
+ Copyright 2005-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/solib-list-lib.c b/gdb/testsuite/gdb.server/solib-list-lib.c
index 5217995..04a1997 100644
--- a/gdb/testsuite/gdb.server/solib-list-lib.c
+++ b/gdb/testsuite/gdb.server/solib-list-lib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/solib-list-main.c b/gdb/testsuite/gdb.server/solib-list-main.c
index e9f1629..9eac9cf 100644
--- a/gdb/testsuite/gdb.server/solib-list-main.c
+++ b/gdb/testsuite/gdb.server/solib-list-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/solib-list.exp b/gdb/testsuite/gdb.server/solib-list.exp
index bbc5df4..4729967 100644
--- a/gdb/testsuite/gdb.server/solib-list.exp
+++ b/gdb/testsuite/gdb.server/solib-list.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/stop-reply-no-thread-multi.c b/gdb/testsuite/gdb.server/stop-reply-no-thread-multi.c
index be70716..36c754c 100644
--- a/gdb/testsuite/gdb.server/stop-reply-no-thread-multi.c
+++ b/gdb/testsuite/gdb.server/stop-reply-no-thread-multi.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/stop-reply-no-thread-multi.exp b/gdb/testsuite/gdb.server/stop-reply-no-thread-multi.exp
index 9d121c5f..f1c68a5 100644
--- a/gdb/testsuite/gdb.server/stop-reply-no-thread-multi.exp
+++ b/gdb/testsuite/gdb.server/stop-reply-no-thread-multi.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -54,7 +54,7 @@ proc run_test { target_non_stop disable_feature } {
set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\""
}
- clean_restart ${binfile}
+ clean_restart ${::testfile}
}
# Make sure we're disconnected, in case we're testing with an
@@ -78,7 +78,7 @@ proc run_test { target_non_stop disable_feature } {
"Support for the 'multiprocess-feature' packet on future remote targets is set to \"off\"."
set res [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
- if ![gdb_assert {$res == 0} "connect"] {
+ if { ![gdb_assert {$res == 0} "connect"] } {
return
}
diff --git a/gdb/testsuite/gdb.server/stop-reply-no-thread.c b/gdb/testsuite/gdb.server/stop-reply-no-thread.c
index 71d4209..117c438 100644
--- a/gdb/testsuite/gdb.server/stop-reply-no-thread.c
+++ b/gdb/testsuite/gdb.server/stop-reply-no-thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/stop-reply-no-thread.exp b/gdb/testsuite/gdb.server/stop-reply-no-thread.exp
index b30defc..aa77095 100644
--- a/gdb/testsuite/gdb.server/stop-reply-no-thread.exp
+++ b/gdb/testsuite/gdb.server/stop-reply-no-thread.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ proc run_test { disable_feature target_nonstop } {
set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\""
}
- clean_restart ${binfile}
+ clean_restart ${::testfile}
}
# Make sure we're disconnected, in case we're testing with an
@@ -70,7 +70,7 @@ proc run_test { disable_feature target_nonstop } {
gdb_test_no_output "maint set target-non-stop ${target_nonstop}"
set res [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
- if ![gdb_assert {$res == 0} "connect"] {
+ if { ![gdb_assert {$res == 0} "connect"] } {
return
}
diff --git a/gdb/testsuite/gdb.server/sysroot.c b/gdb/testsuite/gdb.server/sysroot.c
index 294fb7c..481beaf 100644
--- a/gdb/testsuite/gdb.server/sysroot.c
+++ b/gdb/testsuite/gdb.server/sysroot.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/sysroot.exp b/gdb/testsuite/gdb.server/sysroot.exp
index 7f5597d..ec6201c 100644
--- a/gdb/testsuite/gdb.server/sysroot.exp
+++ b/gdb/testsuite/gdb.server/sysroot.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/target-exec-file.c b/gdb/testsuite/gdb.server/target-exec-file.c
index cb8b860..4caa75a 100644
--- a/gdb/testsuite/gdb.server/target-exec-file.c
+++ b/gdb/testsuite/gdb.server/target-exec-file.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/target-exec-file.exp b/gdb/testsuite/gdb.server/target-exec-file.exp
index 9a24b7a..8705217 100644
--- a/gdb/testsuite/gdb.server/target-exec-file.exp
+++ b/gdb/testsuite/gdb.server/target-exec-file.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/twice-connect.c b/gdb/testsuite/gdb.server/twice-connect.c
index 5677680..91b7727 100644
--- a/gdb/testsuite/gdb.server/twice-connect.c
+++ b/gdb/testsuite/gdb.server/twice-connect.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/twice-connect.exp b/gdb/testsuite/gdb.server/twice-connect.exp
index 95a3599..3124137 100644
--- a/gdb/testsuite/gdb.server/twice-connect.exp
+++ b/gdb/testsuite/gdb.server/twice-connect.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/unittest.exp b/gdb/testsuite/gdb.server/unittest.exp
index 6272d21..367cecf 100644
--- a/gdb/testsuite/gdb.server/unittest.exp
+++ b/gdb/testsuite/gdb.server/unittest.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/wrapper.c b/gdb/testsuite/gdb.server/wrapper.c
index 885b653..a70f3f9 100644
--- a/gdb/testsuite/gdb.server/wrapper.c
+++ b/gdb/testsuite/gdb.server/wrapper.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.server/wrapper.exp b/gdb/testsuite/gdb.server/wrapper.exp
index 1ca19bf..0180338 100644
--- a/gdb/testsuite/gdb.server/wrapper.exp
+++ b/gdb/testsuite/gdb.server/wrapper.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.stabs/exclfwd.exp b/gdb/testsuite/gdb.stabs/exclfwd.exp
index 0359bbe..b2adbf8 100644
--- a/gdb/testsuite/gdb.stabs/exclfwd.exp
+++ b/gdb/testsuite/gdb.stabs/exclfwd.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.stabs/exclfwd.h b/gdb/testsuite/gdb.stabs/exclfwd.h
index 4d093f2..d9ce9ff 100644
--- a/gdb/testsuite/gdb.stabs/exclfwd.h
+++ b/gdb/testsuite/gdb.stabs/exclfwd.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.stabs/exclfwd1.c b/gdb/testsuite/gdb.stabs/exclfwd1.c
index d026e45..45fbd65 100644
--- a/gdb/testsuite/gdb.stabs/exclfwd1.c
+++ b/gdb/testsuite/gdb.stabs/exclfwd1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.stabs/exclfwd2.c b/gdb/testsuite/gdb.stabs/exclfwd2.c
index 5149269..9bd4a70 100644
--- a/gdb/testsuite/gdb.stabs/exclfwd2.c
+++ b/gdb/testsuite/gdb.stabs/exclfwd2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.stabs/gdb11479.c b/gdb/testsuite/gdb.stabs/gdb11479.c
index cd6d9ae..d094899 100644
--- a/gdb/testsuite/gdb.stabs/gdb11479.c
+++ b/gdb/testsuite/gdb.stabs/gdb11479.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
Contributed by Pierre Muller.
diff --git a/gdb/testsuite/gdb.stabs/gdb11479.exp b/gdb/testsuite/gdb.stabs/gdb11479.exp
index 12f60ee..2318c0f 100644
--- a/gdb/testsuite/gdb.stabs/gdb11479.exp
+++ b/gdb/testsuite/gdb.stabs/gdb11479.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.stabs/weird.def b/gdb/testsuite/gdb.stabs/weird.def
index 179b126..f809963 100644
--- a/gdb/testsuite/gdb.stabs/weird.def
+++ b/gdb/testsuite/gdb.stabs/weird.def
@@ -294,7 +294,7 @@ attr69:
# Using double quotes requires an escaping, as the stabs string
# is a double quote delimited string.
.stabs "constString2:c=s\"Double quote String2\"", N_LSYM,0,0, 0
-# Escaping sinlge quote with is easy
+# Escaping single quote with is easy
.stabs "constString3:c=s'String3 with embedded quote \' in the middle'", N_LSYM,0,0, 0
# Esaping double quotes is less clear...
.stabs "constString4:c=s\"String4 with embedded quote \\" in the middle\"", N_LSYM,0,0, 0
diff --git a/gdb/testsuite/gdb.stabs/weird.exp b/gdb/testsuite/gdb.stabs/weird.exp
index 4d1cd42..3bc6e0d 100644
--- a/gdb/testsuite/gdb.stabs/weird.exp
+++ b/gdb/testsuite/gdb.stabs/weird.exp
@@ -1,4 +1,4 @@
-# Copyright 1997-2024 Free Software Foundation, Inc.
+# Copyright 1997-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.testsuite/board-sanity.exp b/gdb/testsuite/gdb.testsuite/board-sanity.exp
index acf37df..7b9a19e 100644
--- a/gdb/testsuite/gdb.testsuite/board-sanity.exp
+++ b/gdb/testsuite/gdb.testsuite/board-sanity.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -44,7 +44,7 @@ proc test_remote { remote host_is_target } {
if { $host_is_target } {
set res [remote_file $other_remote exists $file]
gdb_assert { $res != $exists_ok } \
- "$other_remote copy does not exist"
+ "$other_remote copy does not exist"
}
}
@@ -80,7 +80,7 @@ proc test_remote { remote host_is_target } {
set build_file [remote_upload $remote $file]
gdb_assert { [string equal [file tail $build_file] $file] == 1 } \
"remote_upload returns valid value"
-
+
set res [remote_file $remote delete $file]
gdb_assert { [string equal $res $delete_ok] == 1 } \
"remove $remote copy"
@@ -92,7 +92,7 @@ proc test_remote { remote host_is_target } {
if { $host_is_target } {
set res [remote_file $other_remote exists $file]
gdb_assert { $res != $exists_ok } \
- "$other_remote copy does not exist"
+ "$other_remote copy does not exist"
}
set res [remote_file build exists $file]
diff --git a/gdb/testsuite/gdb.testsuite/capture-command-output.exp b/gdb/testsuite/gdb.testsuite/capture-command-output.exp
index 6828291..67d7b18 100644
--- a/gdb/testsuite/gdb.testsuite/capture-command-output.exp
+++ b/gdb/testsuite/gdb.testsuite/capture-command-output.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.testsuite/cond-wrap.exp b/gdb/testsuite/gdb.testsuite/cond-wrap.exp
index 3005b36..bc29c5a 100644
--- a/gdb/testsuite/gdb.testsuite/cond-wrap.exp
+++ b/gdb/testsuite/gdb.testsuite/cond-wrap.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.testsuite/dump-system-info.exp b/gdb/testsuite/gdb.testsuite/dump-system-info.exp
index 353f366..143f363 100644
--- a/gdb/testsuite/gdb.testsuite/dump-system-info.exp
+++ b/gdb/testsuite/gdb.testsuite/dump-system-info.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.testsuite/foreach_with_prefix.exp b/gdb/testsuite/gdb.testsuite/foreach_with_prefix.exp
index 2944273..03a2f68 100644
--- a/gdb/testsuite/gdb.testsuite/foreach_with_prefix.exp
+++ b/gdb/testsuite/gdb.testsuite/foreach_with_prefix.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.testsuite/gdb-caching-proc-consistency.exp b/gdb/testsuite/gdb.testsuite/gdb-caching-proc-consistency.exp
index 572ffb5..27f905e 100644
--- a/gdb/testsuite/gdb.testsuite/gdb-caching-proc-consistency.exp
+++ b/gdb/testsuite/gdb.testsuite/gdb-caching-proc-consistency.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -63,8 +63,8 @@ proc test_file { file } {
set fp [open $file]
while { [gets $fp line] >= 0 } {
- if [regexp -- "^gdb_caching_proc \[ \t\]*(\[^ \t\]*)" $line \
- match procname] {
+ if { [regexp -- "^gdb_caching_proc \[ \t\]*(\[^ \t\]*)" $line \
+ match procname] } {
lappend procnames $procname
}
}
@@ -95,7 +95,8 @@ proc test_file { file } {
}
if { $setup_gdb } {
- clean_restart $obj
+ clean_restart
+ gdb_load $obj
}
test_proc $procname
@@ -113,7 +114,7 @@ if { ![gdb_simple_compile $me $src executable] } {
}
# Test gdb_caching_procs in gdb/testsuite/lib/*.exp
-set files [eval glob -types f $srcdir/lib/*.exp]
+set files [glob -types f $srcdir/lib/*.exp]
set files [lsort $files]
foreach file $files {
test_file $file
diff --git a/gdb/testsuite/gdb.testsuite/gdb-caching-proc.exp b/gdb/testsuite/gdb.testsuite/gdb-caching-proc.exp
index 0b7cfae..6b46b1c 100644
--- a/gdb/testsuite/gdb.testsuite/gdb-caching-proc.exp
+++ b/gdb/testsuite/gdb.testsuite/gdb-caching-proc.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -22,23 +22,32 @@ gdb_caching_proc gdb_testsuite_gdb_caching_proc_exp_arg { arg } {
return $arg
}
+gdb_caching_proc gdb_testsuite_gdb_caching_proc_exp_arg_nested { arg } {
+ incr ::count
+ return [gdb_testsuite_gdb_caching_proc_exp_arg $arg]
+}
+
+# List of "expected $::count after running expression" and
+# "expression".
set assertions {
- { [gdb_testsuite_gdb_caching_proc_exp_noarg] == 1 }
- { [gdb_testsuite_gdb_caching_proc_exp_arg 1] == 1 }
- { [gdb_testsuite_gdb_caching_proc_exp_arg "foo foo"] == "foo foo" }
+ 1 { [gdb_testsuite_gdb_caching_proc_exp_noarg] == 1 }
+ 1 { [gdb_testsuite_gdb_caching_proc_exp_arg 1] == 1 }
+ 1 { [gdb_testsuite_gdb_caching_proc_exp_arg "foo foo"] == "foo foo" }
+ 1 { [gdb_testsuite_gdb_caching_proc_exp_arg_nested "foo foo"] == "foo foo" }
+ 2 { [gdb_testsuite_gdb_caching_proc_exp_arg_nested "bar bar"] == "bar bar" }
}
set assertion_nr 0
-foreach assertion $assertions {
+foreach {expected_count assertion} $assertions {
with_test_prefix $assertion_nr {
set ::count 0
gdb_assert $assertion
- gdb_assert { $::count == 1 }
+ gdb_assert { $::count == $expected_count }
with_test_prefix cached {
gdb_assert $assertion
- gdb_assert { $::count == 1 }
+ gdb_assert { $::count == $expected_count }
}
}
incr assertion_nr
diff --git a/gdb/testsuite/gdb.testsuite/gdb-test.exp b/gdb/testsuite/gdb.testsuite/gdb-test.exp
index a8aa53c..95555f8 100644
--- a/gdb/testsuite/gdb.testsuite/gdb-test.exp
+++ b/gdb/testsuite/gdb.testsuite/gdb-test.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.exp b/gdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.exp
new file mode 100644
index 0000000..a05ce61
--- /dev/null
+++ b/gdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.exp
@@ -0,0 +1,84 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test gdb_test_multiple -lbl, particularly with patterns that share a
+# common prefix.
+
+standard_testfile
+
+clean_restart
+
+gdb_test_no_output "source ${srcdir}/${subdir}/$testfile.gdb" \
+ "source gdb test script"
+
+set saw_prompt 0
+set saw_prefix 0
+set saw_command 0
+set saw_prefix_foo 0
+set saw_prefix_bar 0
+
+# #1 - We need anchors so that the "prefix foo" pattern below does not
+# match when the expect output buffer contains:
+#
+# "\r\nprefix xxx\r\n\prefix foo\r\n"
+#
+# #2 - We need an anchor on the prompt match as otherwise the prompt
+# regexp would match:
+#
+# "\r\nmeant-to-be-matched-by-lbl-2\r\nprefix xxx\r\n(gdb) "
+#
+# This test would fail if -lbl did not force the built-in prompt match
+# regexp to have an anchor as well, as without it, the built-in prompt
+# regexp would have the exact same issue as #2 above.
+
+gdb_test_multiple "command" "" -lbl {
+ -re "^command(?=\r\n)" {
+ verbose -log <COMMAND>
+ incr saw_command
+ exp_continue
+ }
+ -re "^\r\nprefix foo(?=\r\n)" {
+ verbose -log <PREFIX-FOO>
+ incr saw_prefix_foo
+ exp_continue
+ }
+ -re "^\r\nprefix bar(?=\r\n)" {
+ verbose -log <PREFIX-BAR>
+ incr saw_prefix_bar
+ exp_continue
+ }
+ -re "^\r\nprefix \[^\r\n\]*(?=\r\n)" {
+ verbose -log <PREFIX>
+ incr saw_prefix
+ exp_continue
+ }
+ -re "^\r\n$gdb_prompt $" {
+ verbose -log <PROMPT>
+ incr saw_prompt
+ pass $gdb_test_name
+ }
+}
+
+verbose -log "saw_command: $saw_command"
+verbose -log "saw_prefix_foo: $saw_prefix_foo"
+verbose -log "saw_prefix_bar: $saw_prefix_bar"
+verbose -log "saw_prefix: $saw_prefix"
+verbose -log "saw_prompt: $saw_prompt"
+
+gdb_assert {$saw_command == 1}
+gdb_assert {$saw_prefix_foo == 1}
+gdb_assert {$saw_prefix_bar == 1}
+gdb_assert {$saw_prefix == 3}
+gdb_assert {$saw_prompt == 1}
diff --git a/gdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.gdb b/gdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.gdb
new file mode 100755
index 0000000..8c94dfa
--- /dev/null
+++ b/gdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.gdb
@@ -0,0 +1,25 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+define command
+ echo prefix xxx\n
+ echo meant-to-be-matched-by-lbl-1\n
+ echo prefix foo\n
+ echo prefix bar\n
+ echo meant-to-be-matched-by-lbl-2\n
+ echo prefix xxx\n
+ echo prefix xxx\n
+ echo meant-to-be-matched-by-lbl-3\n
+end
diff --git a/gdb/testsuite/gdb.testsuite/mount-point-map.exp b/gdb/testsuite/gdb.testsuite/mount-point-map.exp
new file mode 100644
index 0000000..9e462bb
--- /dev/null
+++ b/gdb/testsuite/gdb.testsuite/mount-point-map.exp
@@ -0,0 +1,49 @@
+# Copyright 2025 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set unix_to_win {
+ /bin C:/msys64/usr/bin
+ /c C:
+ / C:/msys64
+}
+
+# Test that FROM is normalized to TO.
+
+proc test {from to} {
+ set got [host_file_normalize_mingw $from $::unix_to_win]
+ verbose -log "input: $from"
+ verbose -log "expected: $to"
+ verbose -log "got: $got"
+ gdb_assert {$got == $to} $from
+}
+
+# Drive letters always get a '/' suffix, other Windows file names do
+# not.
+test "/" "C:/msys64"
+test "/c" "C:/"
+test "/bin" "C:/msys64/usr/bin"
+
+# A file name that already starts with a drive letter.
+test "C:/msys64" "C:/msys64"
+
+# A subdir/subfile under each mount.
+test "/foo" "C:/msys64/foo"
+test "/c/foo" "C:/foo"
+test "/bin/foo" "C:/msys64/usr/bin/foo"
+
+# Test slash normalization.
+test "//" "C:/msys64"
+test "/c///foo//bar//" "C:/foo/bar"
+# We don't currently handle UNC paths.
+test "//server///" "C:/msys64/server"
diff --git a/gdb/testsuite/gdb.testsuite/parse_options_args.exp b/gdb/testsuite/gdb.testsuite/parse_options_args.exp
index 7239ef7..22a54a7 100644
--- a/gdb/testsuite/gdb.testsuite/parse_options_args.exp
+++ b/gdb/testsuite/gdb.testsuite/parse_options_args.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.testsuite/string-cat.exp b/gdb/testsuite/gdb.testsuite/string-cat.exp
index 057aeb2..94136e3 100644
--- a/gdb/testsuite/gdb.testsuite/string-cat.exp
+++ b/gdb/testsuite/gdb.testsuite/string-cat.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.testsuite/string_to_regexp.exp b/gdb/testsuite/gdb.testsuite/string_to_regexp.exp
index 4cafce3..0cb5296 100644
--- a/gdb/testsuite/gdb.testsuite/string_to_regexp.exp
+++ b/gdb/testsuite/gdb.testsuite/string_to_regexp.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/testsuite/gdb.testsuite/version-compare.exp b/gdb/testsuite/gdb.testsuite/version-compare.exp
new file mode 100644
index 0000000..8f2573e
--- /dev/null
+++ b/gdb/testsuite/gdb.testsuite/version-compare.exp
@@ -0,0 +1,74 @@
+# Copyright 2025 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check version_compare proc.
+
+proc eq { a b } {
+ with_test_prefix "$a == $b" {
+ gdb_assert { [version_compare $a == $b] }
+ gdb_assert { [version_compare $a <= $b] }
+ gdb_assert { [version_compare $a >= $b] }
+ gdb_assert { ![version_compare $a < $b] }
+ gdb_assert { ![version_compare $a > $b] }
+ }
+}
+
+proc lt { a b } {
+ with_test_prefix "$a < $b" {
+ gdb_assert { [version_compare $a < $b] }
+ gdb_assert { [version_compare $a <= $b] }
+ gdb_assert { [version_compare $b > $a] }
+ gdb_assert { [version_compare $b >= $a] }
+ gdb_assert { ![version_compare $a == $b] }
+ gdb_assert { ![version_compare $b == $a] }
+ gdb_assert { ![version_compare $a > $b] }
+ gdb_assert { ![version_compare $a >= $b] }
+ gdb_assert { ![version_compare $b < $a] }
+ gdb_assert { ![version_compare $b <= $a] }
+ }
+}
+
+# Equal, same length.
+eq {1 0} {1 0}
+
+# Smaller than, same length.
+lt {1 0} {1 1}
+lt {1 1} {2 0}
+
+# Smaller than, different length.
+lt {1 3} {2}
+lt {1} {2 0}
+
+# The question how v1 and v1.0 relate to each other is not a trivial one.
+#
+# For instance, Python considers v1 == v1.0:
+# $ test.py
+# #!/usr/bin/python3
+# from packaging.version import parse
+# v1_0 = parse("1.0")
+# v1 = parse("1")
+# print (v1 == v1_0)
+# $ ./test.py
+# True
+#
+# OTOH, version sort from coreutils considers v1 < v1.0:
+# $ cat bla.txt
+# 1.0
+# 1
+# $ sort -V bla.txt
+# 1
+# 1.0
+#
+# Proc version_compare seems to have taken the latter approach.
+lt {1} {1 0}
diff --git a/gdb/testsuite/gdb.testsuite/with-override.exp b/gdb/testsuite/gdb.testsuite/with-override.exp
index a0a4962..2a316f9 100644
--- a/gdb/testsuite/gdb.testsuite/with-override.exp
+++ b/gdb/testsuite/gdb.testsuite/with-override.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -42,6 +42,10 @@ with_test_prefix no-args {
gdb_assert { [foo] == 2 }
}
}
+
+ with_test_prefix "foo1 again" {
+ gdb_assert { [foo] == 1 }
+ }
}
with_test_prefix after {
@@ -50,11 +54,11 @@ with_test_prefix no-args {
}
proc foo { {a 0} } {
- return [expr $a + 1]
+ return [expr {$a + 1}]
}
proc foo_plus_1 { {a 0} } {
- return [expr $a + 2]
+ return [expr {$a + 2}]
}
with_test_prefix default-arg {
diff --git a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.c b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.c
index e22bf12..d4cde31 100644
--- a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.c
+++ b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp
index 42222c0..64d2f53 100644
--- a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp
+++ b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -51,10 +51,10 @@ proc test { non_stop } {
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"set non-stop $non_stop\""
- clean_restart ${binfile}
+ clean_restart ${::testfile}
}
- if ![runto setup_done] {
+ if {![runto setup_done]} {
return -1
}
@@ -74,42 +74,45 @@ proc test { non_stop } {
delete_breakpoints
# Start the second inferior.
- with_test_prefix "second inferior" {
- # With stub targets that do reload on run, if we let the new
- # inferior share inferior 1's connection, runto would
- # fail because GDB is already connected to something, like
- # e.g. with --target_board=native-gdbserver:
- #
- # (gdb) kill
- # ...
- # (gdb) target remote localhost:2348
- # Already connected to a remote target. Disconnect? (y or n)
- #
- # Instead, start the inferior with no connection, and let
- # gdb_load/runto spawn a new remote connection/gdbserver.
- #
- # OTOH, with extended-remote, we must let the new inferior
- # reuse the current connection, so that runto below can
- # issue the "run" command, and have the inferior run on the
- # remote target. If we forced no connection, then "run" would
- # either fail if "set auto-connect-native-target" is on, like
- # the native-extended-gdbserver board enforces, or it would
- # run the inferior on the native target, which isn't what is
- # being tested.
- #
- # Since it's reload_on_run targets that need special care, we
- # default to reusing the connection on most targets.
- if [target_info exists gdb,do_reload_on_run] {
- gdb_test "add-inferior -no-connection" "New inferior 2.*"
- } else {
- gdb_test "add-inferior" "New inferior 2.*"
- }
- gdb_test "inferior 2" "Switching to inferior 2 .*"
-
- gdb_load $binfile
-
- if ![runto setup_done] {
- return -1
+ if {[allow_multi_inferior_tests]} {
+ with_test_prefix "second inferior" {
+ # With stub targets that do reload on run, if we let the
+ # new inferior share inferior 1's connection, runto would
+ # fail because GDB is already connected to something, like
+ # e.g. with --target_board=native-gdbserver:
+ #
+ # (gdb) kill
+ # ...
+ # (gdb) target remote localhost:2348
+ # Already connected to a remote target. Disconnect? (y or n)
+ #
+ # Instead, start the inferior with no connection, and let
+ # gdb_load/runto spawn a new remote connection/gdbserver.
+ #
+ # OTOH, with extended-remote, we must let the new inferior
+ # reuse the current connection, so that runto below can
+ # issue the "run" command, and have the inferior run on
+ # the remote target. If we forced no connection, then
+ # "run" would either fail if "set
+ # auto-connect-native-target" is on, like the
+ # native-extended-gdbserver board enforces, or it would
+ # run the inferior on the native target, which isn't what
+ # is being tested.
+ #
+ # Since it's reload_on_run targets that need special care,
+ # we default to reusing the connection on most targets.
+ if {[target_info exists gdb,do_reload_on_run]} {
+ gdb_test "add-inferior -no-connection" "New inferior 2.*"
+ } else {
+ gdb_test "add-inferior" "New inferior 2.*"
+ }
+ gdb_test "inferior 2" "Switching to inferior 2 .*"
+
+ gdb_load $binfile
+
+ if {![runto setup_done]} {
+ return -1
+ }
}
}
@@ -158,13 +161,15 @@ proc test { non_stop } {
verbose -log "xxxxx: iteration $iter"
gdb_test -nopass "info threads"
- if {$inf == 1} {
- set inf 2
- } else {
- set inf 1
- }
+ if {[allow_multi_inferior_tests]} {
+ if {$inf == 1} {
+ set inf 2
+ } else {
+ set inf 1
+ }
- my_gdb_test "inferior $inf" ".*" "inferior $inf"
+ my_gdb_test "inferior $inf" ".*" "inferior $inf"
+ }
my_gdb_test "print global_var = 555" " = 555" \
"write to global_var"
@@ -182,7 +187,7 @@ proc test { non_stop } {
}
foreach non_stop { "off" "on" } {
- set stop_mode [expr ($non_stop=="off")?"all-stop":"non-stop"]
+ set stop_mode [expr {($non_stop=="off")?"all-stop":"non-stop"}]
with_test_prefix "$stop_mode" {
test $non_stop
}
diff --git a/gdb/testsuite/gdb.threads/async.c b/gdb/testsuite/gdb.threads/async.c
index b27b9b4..3f97c75 100644
--- a/gdb/testsuite/gdb.threads/async.c
+++ b/gdb/testsuite/gdb.threads/async.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/async.exp b/gdb/testsuite/gdb.threads/async.exp
index ba0377a..6347333 100644
--- a/gdb/testsuite/gdb.threads/async.exp
+++ b/gdb/testsuite/gdb.threads/async.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2024 Free Software Foundation, Inc.
+# Copyright (C) 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ proc test_current_thread {expected_thr} {
global gdb_prompt
global binfile
- clean_restart $binfile
+ clean_restart $::testfile
if {![runto "all_started"]} {
return
diff --git a/gdb/testsuite/gdb.threads/attach-into-signal.c b/gdb/testsuite/gdb.threads/attach-into-signal.c
index d998bb1..7299477 100644
--- a/gdb/testsuite/gdb.threads/attach-into-signal.c
+++ b/gdb/testsuite/gdb.threads/attach-into-signal.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/attach-into-signal.exp b/gdb/testsuite/gdb.threads/attach-into-signal.exp
index 91da960..ca452c1 100644
--- a/gdb/testsuite/gdb.threads/attach-into-signal.exp
+++ b/gdb/testsuite/gdb.threads/attach-into-signal.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@ proc corefunc { threadtype executable } {
# nonthreaded:
pass $test
verbose -log "$test succeeded on the attempt # $attempt of $attempts"
- set passes [expr $passes + 1]
+ set passes [expr {$passes + 1}]
}
-re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
set ok 0
@@ -84,11 +84,11 @@ proc corefunc { threadtype executable } {
if { $ok == 0} {
# We just lack the luck, we should try it again.
- set attempt [expr $attempt + 1]
+ set attempt [expr {$attempt + 1}]
} else {
pass $test
verbose -log "$test succeeded on the attempt # $attempt of $attempts"
- set passes [expr $passes + 1]
+ set passes [expr {$passes + 1}]
}
}
}] != 0 } {
diff --git a/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.c b/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.c
index 74a71c5..378853b 100644
--- a/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.c
+++ b/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp b/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
index 8883485..1b10d7e 100644
--- a/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
+++ b/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/attach-non-stop.c b/gdb/testsuite/gdb.threads/attach-non-stop.c
index f189954..6e3423b 100644
--- a/gdb/testsuite/gdb.threads/attach-non-stop.c
+++ b/gdb/testsuite/gdb.threads/attach-non-stop.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/attach-non-stop.exp b/gdb/testsuite/gdb.threads/attach-non-stop.exp
index eb12e6b..b8da5b1 100644
--- a/gdb/testsuite/gdb.threads/attach-non-stop.exp
+++ b/gdb/testsuite/gdb.threads/attach-non-stop.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ proc test {target_non_stop non_stop cmd} {
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"maint set target-non-stop $target_non_stop\""
append GDBFLAGS " -ex \"set non-stop $non_stop\""
- clean_restart $binfile
+ clean_restart $::testfile
}
set test_spawn_id [spawn_wait_for_attach $binfile]
diff --git a/gdb/testsuite/gdb.threads/attach-slow-waitpid.c b/gdb/testsuite/gdb.threads/attach-slow-waitpid.c
index 9cb9047..81bf13d 100644
--- a/gdb/testsuite/gdb.threads/attach-slow-waitpid.c
+++ b/gdb/testsuite/gdb.threads/attach-slow-waitpid.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/attach-slow-waitpid.exp b/gdb/testsuite/gdb.threads/attach-slow-waitpid.exp
index 942088f..a22187a 100644
--- a/gdb/testsuite/gdb.threads/attach-slow-waitpid.exp
+++ b/gdb/testsuite/gdb.threads/attach-slow-waitpid.exp
@@ -1,4 +1,4 @@
-# Copyright 2018-2024 Free Software Foundation, Inc.
+# Copyright 2018-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/attach-stopped.c b/gdb/testsuite/gdb.threads/attach-stopped.c
index 5a83af5..04ffc58 100644
--- a/gdb/testsuite/gdb.threads/attach-stopped.c
+++ b/gdb/testsuite/gdb.threads/attach-stopped.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp
index 0421ffc..0391914 100644
--- a/gdb/testsuite/gdb.threads/attach-stopped.exp
+++ b/gdb/testsuite/gdb.threads/attach-stopped.exp
@@ -1,4 +1,4 @@
-# Copyright 2008-2024 Free Software Foundation, Inc.
+# Copyright 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,13 +40,13 @@ proc corefunc { threadtype } {
set test_spawn_id [spawn_wait_for_attach $binfile]
set testpid [spawn_id_get_pid $test_spawn_id]
- # Stop the program
+ # Stop the program
remote_exec build "kill -s STOP ${testpid}"
- clean_restart $binfile
+ clean_restart $::testfile
# Verify that we can attach to the stopped process.
-
+
set test "$threadtype: attach2 to stopped, after setting file"
gdb_test_multiple "attach $testpid" "$test" {
-re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.threads/bp_in_thread.c b/gdb/testsuite/gdb.threads/bp_in_thread.c
index 0c5746d..9244efe 100644
--- a/gdb/testsuite/gdb.threads/bp_in_thread.c
+++ b/gdb/testsuite/gdb.threads/bp_in_thread.c
@@ -1,6 +1,6 @@
/* A small multi-threaded test case.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.threads/bp_in_thread.exp b/gdb/testsuite/gdb.threads/bp_in_thread.exp
index f31c5cd..5180c18 100644
--- a/gdb/testsuite/gdb.threads/bp_in_thread.exp
+++ b/gdb/testsuite/gdb.threads/bp_in_thread.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2004-2024 Free Software Foundation, Inc.
+# Copyright (C) 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
runto_main
diff --git a/gdb/testsuite/gdb.threads/break-while-running.c b/gdb/testsuite/gdb.threads/break-while-running.c
index 1483880..ad64f89 100644
--- a/gdb/testsuite/gdb.threads/break-while-running.c
+++ b/gdb/testsuite/gdb.threads/break-while-running.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/break-while-running.exp b/gdb/testsuite/gdb.threads/break-while-running.exp
index 4bec753..c1e1051 100644
--- a/gdb/testsuite/gdb.threads/break-while-running.exp
+++ b/gdb/testsuite/gdb.threads/break-while-running.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,12 +39,12 @@ proc test { update_thread_list always_inserted non_stop } {
global gdb_prompt
global decimal
- clean_restart $binfile
+ clean_restart $::testfile
gdb_test_no_output "set non-stop $non_stop"
gdb_test_no_output "set breakpoint always-inserted $always_inserted"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -152,8 +152,8 @@ proc test { update_thread_list always_inserted non_stop } {
foreach update_thread_list { true false } {
foreach always_inserted { "off" "on" } {
foreach non_stop { "off" "on" } {
- set stop_mode [expr ($non_stop=="off")?"all-stop":"non-stop"]
- set update_list_mode [expr ($update_thread_list)?"w/ithr":"wo/ithr"]
+ set stop_mode [expr {($non_stop=="off")?"all-stop":"non-stop"}]
+ set update_list_mode [expr {($update_thread_list)?"w/ithr":"wo/ithr"}]
with_test_prefix "$update_list_mode: always-inserted $always_inserted: $stop_mode" {
test $update_thread_list $always_inserted $non_stop
}
diff --git a/gdb/testsuite/gdb.threads/check-libthread-db.c b/gdb/testsuite/gdb.threads/check-libthread-db.c
index 608b21c..1a353c4 100644
--- a/gdb/testsuite/gdb.threads/check-libthread-db.c
+++ b/gdb/testsuite/gdb.threads/check-libthread-db.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/check-libthread-db.exp b/gdb/testsuite/gdb.threads/check-libthread-db.exp
index 6976fe6..6d63185 100644
--- a/gdb/testsuite/gdb.threads/check-libthread-db.exp
+++ b/gdb/testsuite/gdb.threads/check-libthread-db.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@ set initial_thread_re "($thread_re1|$thread_re2)"
with_test_prefix "user-initiated check" {
# User-initiated check with libthread_db not loaded.
- clean_restart ${binfile}
+ clean_restart ${::testfile}
gdb_test "maint show check-libthread-db" \
"Whether to check libthread_db at load time is off."
@@ -85,7 +85,7 @@ with_test_prefix "automated load-time check" {
# Automated load-time check with NPTL possibly uninitialized.
with_test_prefix "libpthread.so possibly not initialized" {
- clean_restart ${binfile}
+ clean_restart ${::testfile}
gdb_test_no_output "maint set check-libthread-db 1"
gdb_test_no_output "set debug libthread-db 1"
@@ -104,7 +104,7 @@ with_test_prefix "automated load-time check" {
# Automated load-time check with NPTL fully operational.
if { [can_spawn_for_attach] } {
with_test_prefix "libpthread.so fully initialized" {
- clean_restart ${binfile}
+ clean_restart ${::testfile}
gdb_test_no_output "maint set check-libthread-db 1"
gdb_test_no_output "set debug libthread-db 1"
diff --git a/gdb/testsuite/gdb.threads/clone-attach-detach.c b/gdb/testsuite/gdb.threads/clone-attach-detach.c
index b07f096..22af4c7 100644
--- a/gdb/testsuite/gdb.threads/clone-attach-detach.c
+++ b/gdb/testsuite/gdb.threads/clone-attach-detach.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/clone-attach-detach.exp b/gdb/testsuite/gdb.threads/clone-attach-detach.exp
index de1f6a4..b0f5e52 100644
--- a/gdb/testsuite/gdb.threads/clone-attach-detach.exp
+++ b/gdb/testsuite/gdb.threads/clone-attach-detach.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
# clone as proxy for when libthread_db is not available.
# This only works on targets with the Linux kernel.
-if ![istarget *-*-linux*] {
+if {![istarget *-*-linux*]} {
return
}
@@ -27,7 +27,7 @@ require can_spawn_for_attach
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} {
return -1
}
@@ -74,7 +74,7 @@ set attempts 3
for {set attempt 1} {$attempt <= $attempts} {incr attempt} {
with_test_prefix "bg attach $attempt" {
- gdb_test "attach $testpid &" \
+ gdb_test -no-prompt-anchor "attach $testpid &" \
"Attaching to program.*process $testpid.*" \
"attach"
diff --git a/gdb/testsuite/gdb.threads/clone-new-thread-event.c b/gdb/testsuite/gdb.threads/clone-new-thread-event.c
index d2cc90b..53c1b24 100644
--- a/gdb/testsuite/gdb.threads/clone-new-thread-event.c
+++ b/gdb/testsuite/gdb.threads/clone-new-thread-event.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/clone-new-thread-event.exp b/gdb/testsuite/gdb.threads/clone-new-thread-event.exp
index 55538c6..6b6b0a2 100644
--- a/gdb/testsuite/gdb.threads/clone-new-thread-event.exp
+++ b/gdb/testsuite/gdb.threads/clone-new-thread-event.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/clone-thread_db.c b/gdb/testsuite/gdb.threads/clone-thread_db.c
index 50843de..1118554 100644
--- a/gdb/testsuite/gdb.threads/clone-thread_db.c
+++ b/gdb/testsuite/gdb.threads/clone-thread_db.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/clone-thread_db.exp b/gdb/testsuite/gdb.threads/clone-thread_db.exp
index 24b744f..12349e2 100644
--- a/gdb/testsuite/gdb.threads/clone-thread_db.exp
+++ b/gdb/testsuite/gdb.threads/clone-thread_db.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,17 +16,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This only works on targets with the Linux kernel.
-if ![istarget *-*-linux*] {
+if {![istarget *-*-linux*]} {
return
}
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/continue-pending-after-query.c b/gdb/testsuite/gdb.threads/continue-pending-after-query.c
index 41ec499..2bd09f6 100644
--- a/gdb/testsuite/gdb.threads/continue-pending-after-query.c
+++ b/gdb/testsuite/gdb.threads/continue-pending-after-query.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/continue-pending-after-query.exp b/gdb/testsuite/gdb.threads/continue-pending-after-query.exp
index 7f2a60a..1da2e23 100644
--- a/gdb/testsuite/gdb.threads/continue-pending-after-query.exp
+++ b/gdb/testsuite/gdb.threads/continue-pending-after-query.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -51,7 +51,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}
proc test {} {
global srcfile gdb_prompt
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/continue-pending-status.c b/gdb/testsuite/gdb.threads/continue-pending-status.c
index cd35826..00f0a94 100644
--- a/gdb/testsuite/gdb.threads/continue-pending-status.c
+++ b/gdb/testsuite/gdb.threads/continue-pending-status.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/continue-pending-status.exp b/gdb/testsuite/gdb.threads/continue-pending-status.exp
index 32da7ec..447b683 100644
--- a/gdb/testsuite/gdb.threads/continue-pending-status.exp
+++ b/gdb/testsuite/gdb.threads/continue-pending-status.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,11 +21,11 @@ require {!target_info exists gdb,nointerrupts}
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/corethreads.c b/gdb/testsuite/gdb.threads/corethreads.c
index ef9946f..cb576bc 100644
--- a/gdb/testsuite/gdb.threads/corethreads.c
+++ b/gdb/testsuite/gdb.threads/corethreads.c
@@ -1,4 +1,4 @@
-/* Copyright 2011-2024 Free Software Foundation, Inc.
+/* Copyright 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.threads/corethreads.exp b/gdb/testsuite/gdb.threads/corethreads.exp
index 4175948..0011dc3 100644
--- a/gdb/testsuite/gdb.threads/corethreads.exp
+++ b/gdb/testsuite/gdb.threads/corethreads.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@ if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executa
set corefile [core_find $binfile]
if {$corefile == ""} {
+ untested "unable to create or find corefile"
return 0
}
diff --git a/gdb/testsuite/gdb.threads/create-fail.c b/gdb/testsuite/gdb.threads/create-fail.c
index e4cd27e..e7976b1 100644
--- a/gdb/testsuite/gdb.threads/create-fail.c
+++ b/gdb/testsuite/gdb.threads/create-fail.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/create-fail.exp b/gdb/testsuite/gdb.threads/create-fail.exp
index 908f095..5d633f9 100644
--- a/gdb/testsuite/gdb.threads/create-fail.exp
+++ b/gdb/testsuite/gdb.threads/create-fail.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ for {set i 1} {$i <= $iterations} {incr i} {
clean_restart ${executable}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/current-lwp-dead.c b/gdb/testsuite/gdb.threads/current-lwp-dead.c
index 4aa15a2..e2d149d 100644
--- a/gdb/testsuite/gdb.threads/current-lwp-dead.c
+++ b/gdb/testsuite/gdb.threads/current-lwp-dead.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/current-lwp-dead.exp b/gdb/testsuite/gdb.threads/current-lwp-dead.exp
index 9951994..c8364df 100644
--- a/gdb/testsuite/gdb.threads/current-lwp-dead.exp
+++ b/gdb/testsuite/gdb.threads/current-lwp-dead.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,6 +47,6 @@ gdb_breakpoint $line
gdb_continue_to_breakpoint "fn_return" ".*at-fn_return.*"
# Confirm thread 2 is really gone.
-gdb_test "info threads 2" "No threads match '2'\\."
+gdb_test "info threads 2" "No threads matched\\."
gdb_continue_to_end "" continue 1
diff --git a/gdb/testsuite/gdb.threads/del-pending-thread-bp-lib.c b/gdb/testsuite/gdb.threads/del-pending-thread-bp-lib.c
index 15d1b98..d34a103 100644
--- a/gdb/testsuite/gdb.threads/del-pending-thread-bp-lib.c
+++ b/gdb/testsuite/gdb.threads/del-pending-thread-bp-lib.c
@@ -1,4 +1,4 @@
-/* Copyright 2023 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/del-pending-thread-bp.c b/gdb/testsuite/gdb.threads/del-pending-thread-bp.c
index 6fc76db..85b3db5 100644
--- a/gdb/testsuite/gdb.threads/del-pending-thread-bp.c
+++ b/gdb/testsuite/gdb.threads/del-pending-thread-bp.c
@@ -1,4 +1,4 @@
-/* Copyright 2023 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/del-pending-thread-bp.exp b/gdb/testsuite/gdb.threads/del-pending-thread-bp.exp
index 14a91a4..bdc519f 100644
--- a/gdb/testsuite/gdb.threads/del-pending-thread-bp.exp
+++ b/gdb/testsuite/gdb.threads/del-pending-thread-bp.exp
@@ -1,4 +1,4 @@
-# Copyright 2023 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
gdb_locate_shlib $binfile_lib
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.threads/detach-step-over.c b/gdb/testsuite/gdb.threads/detach-step-over.c
index 17fcd50..5559ce1 100644
--- a/gdb/testsuite/gdb.threads/detach-step-over.c
+++ b/gdb/testsuite/gdb.threads/detach-step-over.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/detach-step-over.exp b/gdb/testsuite/gdb.threads/detach-step-over.exp
index ddaad34..98b412c 100644
--- a/gdb/testsuite/gdb.threads/detach-step-over.exp
+++ b/gdb/testsuite/gdb.threads/detach-step-over.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -50,6 +50,8 @@
require can_spawn_for_attach
+require allow_multi_inferior_tests
+
standard_testfile
set bp_lineno [gdb_get_line_number "Set breakpoint here"]
@@ -64,7 +66,7 @@ proc start_gdb_for_test {condition_eval target_non_stop non_stop displaced} {
append ::GDBFLAGS " -ex \"set non-stop $non_stop\""
append ::GDBFLAGS " -ex \"set displaced $displaced\""
append ::GDBFLAGS " -ex \"set schedule-multiple on\""
- clean_restart $::binfile
+ clean_restart $::testfile
}
gdb_test_no_output "set breakpoint condition-evaluation $condition_eval"
@@ -227,7 +229,7 @@ proc_with_prefix test_detach_command {condition_eval target_non_stop non_stop di
set running_count 0
set interrupted 0
- set running_expected [expr ($::n_threads + 1) * 2]
+ set running_expected [expr {($::n_threads + 1) * 2}]
gdb_test_multiple "info threads" "threads running" {
-re "\\(running\\)" {
incr running_count
@@ -355,7 +357,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile $options] == -1}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c b/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c
index be6f18e..c17a152 100644
--- a/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c
+++ b/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/dlopen-libpthread.c b/gdb/testsuite/gdb.threads/dlopen-libpthread.c
index 0475ac7..aa724e7 100644
--- a/gdb/testsuite/gdb.threads/dlopen-libpthread.c
+++ b/gdb/testsuite/gdb.threads/dlopen-libpthread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/dlopen-libpthread.exp b/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
index 0343f7e..13a2532 100644
--- a/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
+++ b/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/execl.c b/gdb/testsuite/gdb.threads/execl.c
index 7880041..86a065c 100644
--- a/gdb/testsuite/gdb.threads/execl.c
+++ b/gdb/testsuite/gdb.threads/execl.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/execl.exp b/gdb/testsuite/gdb.threads/execl.exp
index 194438b..a42dce9 100644
--- a/gdb/testsuite/gdb.threads/execl.exp
+++ b/gdb/testsuite/gdb.threads/execl.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile1}" executable {deb
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if { [is_remote target] } {
gdb_remote_download target $binfile1
}
diff --git a/gdb/testsuite/gdb.threads/execl1.c b/gdb/testsuite/gdb.threads/execl1.c
index 553923b..5177ac0 100644
--- a/gdb/testsuite/gdb.threads/execl1.c
+++ b/gdb/testsuite/gdb.threads/execl1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/foll-fork-other-thread.c b/gdb/testsuite/gdb.threads/foll-fork-other-thread.c
index bd8617a..6213cd8 100644
--- a/gdb/testsuite/gdb.threads/foll-fork-other-thread.c
+++ b/gdb/testsuite/gdb.threads/foll-fork-other-thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/foll-fork-other-thread.exp b/gdb/testsuite/gdb.threads/foll-fork-other-thread.exp
index 3c6a056..29ec34c 100644
--- a/gdb/testsuite/gdb.threads/foll-fork-other-thread.exp
+++ b/gdb/testsuite/gdb.threads/foll-fork-other-thread.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,6 +17,8 @@
# another thread, in different combinations of "set follow-fork
# parent/child", and other execution modes.
+require allow_fork_tests
+
standard_testfile
# Line where to stop the main thread.
@@ -44,7 +46,7 @@ proc do_test { fork_func follow target-non-stop non-stop displaced-stepping } {
save_vars { ::GDBFLAGS } {
append ::GDBFLAGS " -ex \"maintenance set target-non-stop ${target-non-stop}\""
append ::GDBFLAGS " -ex \"set non-stop ${non-stop}\""
- clean_restart ${::binfile}-${fork_func}
+ clean_restart ${::testfile}-${fork_func}
}
gdb_test_no_output "set displaced-stepping ${displaced-stepping}"
diff --git a/gdb/testsuite/gdb.threads/fork-child-threads.c b/gdb/testsuite/gdb.threads/fork-child-threads.c
index 7e55e9c..209ba7f 100644
--- a/gdb/testsuite/gdb.threads/fork-child-threads.c
+++ b/gdb/testsuite/gdb.threads/fork-child-threads.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/fork-child-threads.exp b/gdb/testsuite/gdb.threads/fork-child-threads.exp
index 8f13970..d1b413c 100644
--- a/gdb/testsuite/gdb.threads/fork-child-threads.exp
+++ b/gdb/testsuite/gdb.threads/fork-child-threads.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,10 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Only GNU/Linux is known to support `set follow-fork-mode child'.
-if { ! [istarget "*-*-linux*"] } {
- return 0
-}
+require allow_fork_tests
standard_testfile
@@ -24,7 +21,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.threads/fork-plus-threads.c b/gdb/testsuite/gdb.threads/fork-plus-threads.c
index 4e3e9d4..f12c936 100644
--- a/gdb/testsuite/gdb.threads/fork-plus-threads.c
+++ b/gdb/testsuite/gdb.threads/fork-plus-threads.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/fork-plus-threads.exp b/gdb/testsuite/gdb.threads/fork-plus-threads.exp
index c08b4c1..c41b164 100644
--- a/gdb/testsuite/gdb.threads/fork-plus-threads.exp
+++ b/gdb/testsuite/gdb.threads/fork-plus-threads.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,6 +20,8 @@
#
# See https://sourceware.org/bugzilla/show_bug.cgi?id=18600
+require allow_fork_tests
+
# In remote mode, we cannot continue debugging after all
# inferiors have terminated, and this test requires that.
if { [target_info exists gdb_protocol]
@@ -74,7 +76,7 @@ proc do_test { detach-on-fork } {
set saw_cannot_remove_breakpoints 0
set saw_thread_stopped 0
- set expected_num_inferior_exits [expr ${detach-on-fork} == "off" ? 11 : 1]
+ set expected_num_inferior_exits [expr {${detach-on-fork} == "off" ? 11 : 1}]
# Flags indicating if we have see the exit for each inferior.
for {set i 1} {$i <= $expected_num_inferior_exits} {incr i} {
diff --git a/gdb/testsuite/gdb.threads/fork-thread-pending.c b/gdb/testsuite/gdb.threads/fork-thread-pending.c
index a9b557a..99bd821 100644
--- a/gdb/testsuite/gdb.threads/fork-thread-pending.c
+++ b/gdb/testsuite/gdb.threads/fork-thread-pending.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/fork-thread-pending.exp b/gdb/testsuite/gdb.threads/fork-thread-pending.exp
index d31a347..e0e3625 100644
--- a/gdb/testsuite/gdb.threads/fork-thread-pending.exp
+++ b/gdb/testsuite/gdb.threads/fork-thread-pending.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,11 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Only GNU/Linux is known to support `set follow-fork-mode child'.
-#
-if { ! [istarget "*-*-linux*"] } {
- return 0
-}
+require allow_fork_tests
standard_testfile
@@ -25,7 +21,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return 0
@@ -79,7 +75,7 @@ gdb_test_multiple "info threads" "$test" {
# Start over, but this time, don't switch away from the fork event thread.
-clean_restart $binfile
+clean_restart $::testfile
if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.c b/gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.c
index aaee143..9926b6f 100644
--- a/gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.c
+++ b/gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.exp b/gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.exp
index 66311fe..d65fe83d 100644
--- a/gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.exp
+++ b/gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,6 +16,8 @@
# This test verifies that several threads forking while another thread
# is constantly stepping over a breakpoint is properly handled.
+require allow_fork_tests
+
standard_testfile
set linenum [gdb_get_line_number "set break here"]
@@ -35,7 +37,7 @@ proc probe_displaced_stepping_support {} {
global binfile gdb_prompt
with_test_prefix "probe displaced-stepping support" {
- clean_restart $binfile
+ clean_restart $::testfile
gdb_test_no_output "set displaced on"
if {![runto_main]} {
@@ -74,7 +76,7 @@ proc do_test { cond_bp_target detach_on_fork displaced } {
save_vars { GDBFLAGS } {
set GDBFLAGS [concat $GDBFLAGS " -ex \"set non-stop on\""]
- clean_restart $binfile
+ clean_restart $::testfile
}
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.threads/gcore-stale-thread.c b/gdb/testsuite/gdb.threads/gcore-stale-thread.c
index ca5538c..39b23c7 100644
--- a/gdb/testsuite/gdb.threads/gcore-stale-thread.c
+++ b/gdb/testsuite/gdb.threads/gcore-stale-thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/gcore-stale-thread.exp b/gdb/testsuite/gdb.threads/gcore-stale-thread.exp
index 2f41982..396ea29 100644
--- a/gdb/testsuite/gdb.threads/gcore-stale-thread.exp
+++ b/gdb/testsuite/gdb.threads/gcore-stale-thread.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/gcore-thread.exp b/gdb/testsuite/gdb.threads/gcore-thread.exp
index f4572c4..f32e9b4 100644
--- a/gdb/testsuite/gdb.threads/gcore-thread.exp
+++ b/gdb/testsuite/gdb.threads/gcore-thread.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -123,7 +123,7 @@ proc load_core { filename } {
}
# FIXME: now what can we test about the thread state?
- # We do not know for certain that there should be at least
+ # We do not know for certain that there should be at least
# three threads, because who knows what kind of many-to-one
# mapping various OS's may do? Let's assume that there must
# be at least two threads:
diff --git a/gdb/testsuite/gdb.threads/hand-call-in-threads.c b/gdb/testsuite/gdb.threads/hand-call-in-threads.c
index 777e4fb..2b98964 100644
--- a/gdb/testsuite/gdb.threads/hand-call-in-threads.c
+++ b/gdb/testsuite/gdb.threads/hand-call-in-threads.c
@@ -1,6 +1,6 @@
/* Test case for hand function calls in multi-threaded program.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.threads/hand-call-in-threads.exp b/gdb/testsuite/gdb.threads/hand-call-in-threads.exp
index cde2b2d..f9c9e87 100644
--- a/gdb/testsuite/gdb.threads/hand-call-in-threads.exp
+++ b/gdb/testsuite/gdb.threads/hand-call-in-threads.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2004-2024 Free Software Foundation, Inc.
+# Copyright (C) 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ proc get_dummy_frame_number { } {
return ""
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if { ![runto_main] } {
return 0
@@ -74,7 +74,7 @@ gdb_test "show scheduler-locking" ".* locking scheduler .* is \"on\"." "show sch
# stop without returning.
# Add one for the main thread.
-set total_nr_threads [expr $NR_THREADS + 1]
+set total_nr_threads [expr {$NR_THREADS + 1}]
# Thread numbering in gdb is origin-1, so begin numbering at 1.
for { set i 1 } { $i <= $total_nr_threads } { incr i } {
diff --git a/gdb/testsuite/gdb.threads/hand-call-new-thread.c b/gdb/testsuite/gdb.threads/hand-call-new-thread.c
index e475b9b..ed2d7ef 100644
--- a/gdb/testsuite/gdb.threads/hand-call-new-thread.c
+++ b/gdb/testsuite/gdb.threads/hand-call-new-thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/hand-call-new-thread.exp b/gdb/testsuite/gdb.threads/hand-call-new-thread.exp
index 89492f4..479c2ff 100644
--- a/gdb/testsuite/gdb.threads/hand-call-new-thread.exp
+++ b/gdb/testsuite/gdb.threads/hand-call-new-thread.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,11 +18,11 @@
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.threads/ia64-sigill.c b/gdb/testsuite/gdb.threads/ia64-sigill.c
index 183f376..366e0fd 100644
--- a/gdb/testsuite/gdb.threads/ia64-sigill.c
+++ b/gdb/testsuite/gdb.threads/ia64-sigill.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/ia64-sigill.exp b/gdb/testsuite/gdb.threads/ia64-sigill.exp
index 79233ee..46954de 100644
--- a/gdb/testsuite/gdb.threads/ia64-sigill.exp
+++ b/gdb/testsuite/gdb.threads/ia64-sigill.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" ${binfile} executable
clean_restart $testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/inf-thr-count.c b/gdb/testsuite/gdb.threads/inf-thr-count.c
index 055ad7e..e3abea3 100644
--- a/gdb/testsuite/gdb.threads/inf-thr-count.c
+++ b/gdb/testsuite/gdb.threads/inf-thr-count.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/inf-thr-count.exp b/gdb/testsuite/gdb.threads/inf-thr-count.exp
index 1c85c95..4508be2 100644
--- a/gdb/testsuite/gdb.threads/inf-thr-count.exp
+++ b/gdb/testsuite/gdb.threads/inf-thr-count.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,33 +43,31 @@ if {[build_executable "failed to prepare" $testfile $srcfile \
# Start GDB. Ensure we are in non-stop mode as we need to read from
# the inferior while it is running.
save_vars {GDBFLAGS} {
- append GDBFLAGS " -ex \"set non-stop on\""
- clean_restart $binfile
+ append GDBFLAGS { -ex "set non-stop on"}
+ clean_restart $::testfile
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_breakpoint breakpt
gdb_continue_to_breakpoint "first breakpt call"
+set re_var [string_to_regexp "$"]$decimal
+
# Check we can see a single thread to begin with.
-gdb_test "p \$_inferior_thread_count" \
- "^\\\$$::decimal = 1" \
- "only one thread in \$_inferior_thread_count"
+gdb_test {p $_inferior_thread_count} \
+ "^$re_var = 1" \
+ {only one thread in $_inferior_thread_count}
# We don't want thread events, it makes it harder to match GDB's
# output.
gdb_test_no_output "set print thread-events off"
# Continue the program in the background.
-set test "continue&"
-gdb_test_multiple "continue&" $test {
- -re "Continuing\\.\r\n$gdb_prompt " {
- pass $test
- }
-}
+gdb_test -no-prompt-anchor "continue&" \
+ [string_to_regexp "Continuing."]
# Read the 'stage' flag from the inferior. This is initially 0, but
# will be set to 1 once the extra thread has been created, and then 2
@@ -88,8 +86,17 @@ proc wait_for_stage { num } {
set failure_count 0
set cmd "print /d stage"
set stage_flag 0
+
+ set re_int -?$::decimal
+
+ set re_msg \
+ [multi_line \
+ "Cannot execute this command while the target is running" \
+ {Use the "interrupt" command to stop the target} \
+ [string_to_regexp "and then try again."]]
+
gdb_test_multiple "$cmd" "wait for 'stage' flag to be $num" {
- -re -wrap "^Cannot execute this command while the target is running\\.\r\nUse the \"interrupt\" command to stop the target\r\nand then try again\\." {
+ -re -wrap ^$re_msg {
fail "$gdb_test_name (can't read asynchronously)"
gdb_test_no_output "interrupt"
@@ -101,7 +108,7 @@ proc wait_for_stage { num } {
}
}
- -re -wrap "^\\$\[0-9\]* = (\[-\]*\[0-9\]*).*" {
+ -re -wrap "^$::re_var = ($re_int).*" {
set stage_flag $expect_out(1,string)
if {$stage_flag != $num} {
set stage_flag 0
@@ -131,8 +138,8 @@ if {![wait_for_stage 1]} {
if {[target_info exists gdb_protocol]
&& ([target_info gdb_protocol] == "remote"
|| [target_info gdb_protocol] == "extended-remote")} {
- set new_thread_re "\\\[New Thread \[^\r\n\]+\\\]\r\n"
- set exit_thread_re "\\\[Thread \[^\r\n\]+ exited\\\]\r\n"
+ set new_thread_re {\[New Thread [^\r\n]+\]\r\n}
+ set exit_thread_re {\[Thread [^\r\n]+ exited\]\r\n}
} else {
set new_thread_re ""
set exit_thread_re ""
@@ -141,9 +148,9 @@ if {[target_info exists gdb_protocol]
# This is the test we actually care about. Check that the
# $_inferior_thread_count convenience variable shows the correct
# thread count; the new thread should be visible.
-gdb_test "with print thread-events on -- p \$_inferior_thread_count" \
- "^${new_thread_re}\\\$$::decimal = 2" \
- "second thread visible in \$_inferior_thread_count"
+gdb_test {with print thread-events on -- p $_inferior_thread_count} \
+ "^${new_thread_re}$re_var = 2" \
+ {second thread visible in $_inferior_thread_count}
# Set a variable in the inferior, this will cause the second thread to
# exit.
@@ -157,19 +164,25 @@ if {![wait_for_stage 2]} {
}
# Check that the second thread has gone away.
-gdb_test "with print thread-events on -- p \$_inferior_thread_count" \
- "^${exit_thread_re}\\\$$::decimal = 1" \
- "back to one thread visible in \$_inferior_thread_count"
+gdb_test {with print thread-events on -- p $_inferior_thread_count} \
+ "^${exit_thread_re}$re_var = 1" \
+ {back to one thread visible in $_inferior_thread_count}
# Set a variable in the inferior, this will cause the second thread to
# exit.
-gdb_test_no_output "set variable spin = 0" \
+gdb_test_no_output -no-prompt-anchor "set variable spin = 0" \
"set 'spin' flag to allow main thread to exit"
# When the second thread exits, the main thread joins with it, and
# then proceeds to hit the breakpt function again.
+set re_breakpt [string_to_regexp "breakpt ()"]
+set re \
+ [multi_line \
+ "Thread 1 \[^\r\n\]+ hit Breakpoint $decimal, $re_breakpt\[^\r\n\]+" \
+ "\[^\r\n\]+" \
+ ""]
gdb_test_multiple "" "wait for main thread to stop" {
- -re "Thread 1 \[^\r\n\]+ hit Breakpoint $decimal, breakpt \\(\\)\[^\r\n\]+\r\n\[^\r\n\]+\r\n" {
+ -re $re {
pass $gdb_test_name
}
}
diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.c b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.c
index 38a5bc2..d954fa2 100644
--- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.c
+++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.exp b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.exp
index b5c0d84..35a1fe5 100644
--- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.exp
+++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -53,7 +53,7 @@ proc start_gdb_and_runto_main { target_async target_non_stop } {
append ::GDBFLAGS \
" -ex \"maintenance set target-async ${target_async}\""
- clean_restart ${::binfile}
+ clean_restart ${::testfile}
}
if { ![runto_main] } {
diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c
index d0707cd..52921cd 100644
--- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c
+++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp
index feec37b..ed98998 100644
--- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp
+++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ proc start_gdb_and_runto_main { target_async target_non_stop } {
append ::GDBFLAGS \
" -ex \"maintenance set target-async ${target_async}\""
- clean_restart ${::binfile}
+ clean_restart ${::testfile}
}
if { ![runto_main] } {
@@ -141,6 +141,8 @@ proc_with_prefix run_kill_and_restart_test { target_async target_non_stop } {
gdb_start_cmd
}
+set re_thread_exited {\[Thread [^\r\n]+ exited\]}
+
# Create a conditional breakpoint which includes a call to a function that
# segfaults. Run GDB and check what happens when the inferior segfaults
# during the inferior call.
@@ -176,7 +178,8 @@ proc_with_prefix run_bp_cond_segfaults { target_async target_non_stop } {
"To change this behavior use \"set unwind-on-signal on\"\\." \
"Evaluation of the expression containing the function" \
"\\(function_that_segfaults\\) will be abandoned\\." \
- "When the function is done executing, GDB will silently stop\\."]
+ "When the function is done executing, GDB will silently stop\\.(" \
+ "$::re_thread_exited)?"]
}
# Create a conditional breakpoint which includes a call to a function that
@@ -210,7 +213,8 @@ proc_with_prefix run_bp_cond_hits_breakpoint { target_async target_non_stop } {
"The program being debugged stopped while in a function called from GDB\\." \
"Evaluation of the expression containing the function" \
"\\(function_with_breakpoint\\) will be abandoned\\." \
- "When the function is done executing, GDB will silently stop\\."]
+ "When the function is done executing, GDB will silently stop\\.(" \
+ "$::re_thread_exited)?"]
}
foreach_with_prefix target_async { "on" "off" } {
diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.c b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.c
index 0b045f8..b26a63d 100644
--- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.c
+++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.c
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.exp b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.exp
index 2c3623e..bc12fb4 100644
--- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.exp
+++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ proc start_gdb_and_runto_main { target_async target_non_stop } {
append ::GDBFLAGS \
" -ex \"maintenance set target-async ${target_async}\""
- clean_restart ${::binfile}
+ clean_restart ${::testfile}
}
if { ![runto_main] } {
diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.c b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.c
index 415eaea..a5fb3c2 100644
--- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.c
+++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp
index 8f17f13..03c6959 100644
--- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp
+++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -52,7 +52,7 @@ proc run_test { target_async target_non_stop non_stop other_thread_bp unwind } {
append ::GDBFLAGS " -ex \"maint non-stop $non_stop\""
append ::GDBFLAGS " -ex \"maintenance set target-async ${target_async}\""
- clean_restart ${::binfile}
+ clean_restart ${::testfile}
}
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.threads/infcall-thread-announce.c b/gdb/testsuite/gdb.threads/infcall-thread-announce.c
index 90bf95e..ca39cf0 100644
--- a/gdb/testsuite/gdb.threads/infcall-thread-announce.c
+++ b/gdb/testsuite/gdb.threads/infcall-thread-announce.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/infcall-thread-announce.exp b/gdb/testsuite/gdb.threads/infcall-thread-announce.exp
index e22245e..59a5bcf 100644
--- a/gdb/testsuite/gdb.threads/infcall-thread-announce.exp
+++ b/gdb/testsuite/gdb.threads/infcall-thread-announce.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/info-threads-cur-sal-2.c b/gdb/testsuite/gdb.threads/info-threads-cur-sal-2.c
index 20b0f45..1306a05 100644
--- a/gdb/testsuite/gdb.threads/info-threads-cur-sal-2.c
+++ b/gdb/testsuite/gdb.threads/info-threads-cur-sal-2.c
@@ -1,4 +1,4 @@
-/* Copyright 2013-2024 Free Software Foundation, Inc.
+/* Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/info-threads-cur-sal.c b/gdb/testsuite/gdb.threads/info-threads-cur-sal.c
index 787fb53..cb75325 100644
--- a/gdb/testsuite/gdb.threads/info-threads-cur-sal.c
+++ b/gdb/testsuite/gdb.threads/info-threads-cur-sal.c
@@ -1,4 +1,4 @@
-/* Copyright 2007-2024 Free Software Foundation, Inc.
+/* Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp b/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp
index 664c962..784caf9 100644
--- a/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp
+++ b/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[gdb_compile_pthreads \
clean_restart ${executable}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/info-threads-options.c b/gdb/testsuite/gdb.threads/info-threads-options.c
new file mode 100644
index 0000000..2c4cd85
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/info-threads-options.c
@@ -0,0 +1,77 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2022-2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <pthread.h>
+
+#define NUM 4
+
+static pthread_barrier_t threads_started_barrier;
+
+static void
+stop_here ()
+{
+}
+
+static void
+spin ()
+{
+ while (1)
+ usleep (1);
+}
+
+static void *
+work (void *arg)
+{
+ int id = *(int *) arg;
+
+ pthread_barrier_wait (&threads_started_barrier);
+
+ if (id % 2 == 0)
+ stop_here ();
+ else
+ spin ();
+
+ pthread_exit (NULL);
+}
+
+int
+main ()
+{
+ /* Ensure we stop if GDB crashes and DejaGNU fails to kill us. */
+ alarm (10);
+
+ pthread_t threads[NUM];
+ int ids[NUM];
+
+ pthread_barrier_init (&threads_started_barrier, NULL, NUM + 1);
+
+ for (int i = 0; i < NUM; i++)
+ {
+ ids[i] = i;
+ pthread_create (&threads[i], NULL, work, &ids[i]);
+ }
+
+ /* Wait until all threads are seen running. */
+ pthread_barrier_wait (&threads_started_barrier);
+
+ stop_here ();
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.threads/info-threads-options.exp b/gdb/testsuite/gdb.threads/info-threads-options.exp
new file mode 100644
index 0000000..b322261
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/info-threads-options.exp
@@ -0,0 +1,131 @@
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test the filter flags of the "info threads" command.
+
+standard_testfile
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
+ executable debug] != "" } {
+ return -1
+}
+
+save_vars { GDBFLAGS } {
+ append GDBFLAGS " -ex \"set non-stop on\""
+ clean_restart $::testfile
+}
+
+if {![runto_main]} {
+ return -1
+}
+
+gdb_breakpoint "stop_here"
+gdb_test_multiple "continue -a&" "" {
+ -re "Continuing.\r\n$gdb_prompt " {
+ pass $gdb_test_name
+ }
+}
+
+set expected_hits 3
+set fill "\[^\r\n\]+"
+set num_hits 0
+gdb_test_multiple "" "hit the breakpoint" -lbl {
+ -re "\r\nThread ${fill} hit Breakpoint ${decimal}," {
+ incr num_hits
+ if {$num_hits < $expected_hits} {
+ exp_continue
+ }
+ }
+}
+gdb_assert {$num_hits == $expected_hits} "expected threads hit the bp"
+
+# Count the number of running/stopped threads reported
+# by the "info threads" command. We also capture thread ids
+# for additional tests.
+set running_tid "invalid"
+set stopped_tid "invalid"
+
+set eol "(?=\r\n)"
+
+foreach_with_prefix flag {"" "-running" "-stopped" "-running -stopped"} {
+ set num_running 0
+ set num_stopped 0
+ gdb_test_multiple "info threads $flag" "info threads $flag" -lbl {
+ -re "Id${fill}Target Id${fill}Frame${fill}${eol}" {
+ exp_continue
+ }
+ -re "^\r\n. (${decimal})${fill}Thread ${fill}.running.${eol}" {
+ incr num_running
+ set running_tid $expect_out(1,string)
+ exp_continue
+ }
+ -re "^\r\n. (${decimal})${fill}Thread ${fill}stop_here ${fill}${eol}" {
+ incr num_stopped
+ set stopped_tid $expect_out(1,string)
+ exp_continue
+ }
+ -re "^\r\n$gdb_prompt $" {
+ pass $gdb_test_name
+ }
+ }
+
+ if {$flag eq "-running"} {
+ gdb_assert {$num_running == 2} "num running"
+ gdb_assert {$num_stopped == 0} "num stopped"
+ } elseif {$flag eq "-stopped"} {
+ gdb_assert {$num_running == 0} "num running"
+ gdb_assert {$num_stopped == 3} "num stopped"
+ } else {
+ gdb_assert {$num_running == 2} "num running"
+ gdb_assert {$num_stopped == 3} "num stopped"
+ }
+}
+
+verbose -log "running_tid=$running_tid, stopped_tid=$stopped_tid"
+
+# Test specifying thread ids.
+gdb_test "info threads -running $stopped_tid" \
+ "No threads matched\\." \
+ "info thread -running for a stopped thread"
+gdb_test "info threads -stopped $running_tid" \
+ "No threads matched\\." \
+ "info thread -stopped for a running thread"
+
+set ws "\[ \t\]+"
+foreach tid "\"$running_tid\" \"$running_tid $stopped_tid\"" {
+ gdb_test "info threads -running $tid" \
+ [multi_line \
+ "${ws}Id${ws}Target Id${ws}Frame${ws}" \
+ "${ws}${running_tid}${ws}Thread ${fill}.running."] \
+ "info thread -running with [llength $tid] thread ids"
+}
+
+foreach tid "\"$stopped_tid\" \"$stopped_tid $running_tid\"" {
+ gdb_test "info threads -stopped $tid" \
+ [multi_line \
+ "${ws}Id${ws}Target Id${ws}Frame${ws}" \
+ "${ws}${stopped_tid}${ws}Thread ${fill} stop_here ${fill}"] \
+ "info thread -stopped with [llength $tid] thread ids"
+}
+
+gdb_test_multiple "info threads -stopped -running $stopped_tid $running_tid" \
+ "filter flags and tids combined" {
+ -re -wrap ".*stop_here.*running.*" {
+ pass $gdb_test_name
+ }
+ -re -wrap ".*running.*stop_here.*" {
+ pass $gdb_test_name
+ }
+}
diff --git a/gdb/testsuite/gdb.threads/interrupt-while-step-over.c b/gdb/testsuite/gdb.threads/interrupt-while-step-over.c
index 172a95b..c89e84e 100644
--- a/gdb/testsuite/gdb.threads/interrupt-while-step-over.c
+++ b/gdb/testsuite/gdb.threads/interrupt-while-step-over.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/interrupt-while-step-over.exp b/gdb/testsuite/gdb.threads/interrupt-while-step-over.exp
index 89c1d06..d3f328b 100644
--- a/gdb/testsuite/gdb.threads/interrupt-while-step-over.exp
+++ b/gdb/testsuite/gdb.threads/interrupt-while-step-over.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -84,7 +84,7 @@ proc test_one_iteration {} {
exp_continue
}
-re "$gdb_prompt " {
- if ![gdb_assert $saw_continuing $test] {
+ if {![gdb_assert $saw_continuing $test]} {
return 1
}
}
@@ -101,7 +101,7 @@ proc test_one_iteration {} {
exp_continue
}
-re "$gdb_prompt " {
- if ![gdb_assert {$running_count == $NUM_THREADS} $test] {
+ if {![gdb_assert {$running_count == $NUM_THREADS} $test]} {
return 1
}
}
@@ -151,7 +151,7 @@ proc test_one_iteration {} {
exp_continue
}
-re "$gdb_prompt " {
- if ![gdb_assert {$running_count == 0} $test] {
+ if {![gdb_assert {$running_count == 0} $test]} {
return 1
}
}
@@ -169,12 +169,12 @@ proc testdriver {displaced} {
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"set non-stop on\""
- clean_restart $binfile
+ clean_restart $::testfile
}
gdb_test_no_output "set displaced-stepping $displaced"
- if ![runto all_started] {
+ if {![runto all_started]} {
return
}
set break_line [gdb_get_line_number "set breakpoint here"]
diff --git a/gdb/testsuite/gdb.threads/interrupted-hand-call.c b/gdb/testsuite/gdb.threads/interrupted-hand-call.c
index e6eae5e..fb6d140 100644
--- a/gdb/testsuite/gdb.threads/interrupted-hand-call.c
+++ b/gdb/testsuite/gdb.threads/interrupted-hand-call.c
@@ -1,6 +1,6 @@
/* Test case for hand function calls interrupted by a signal in another thread.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.threads/interrupted-hand-call.exp b/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
index 81221b4..15c48b1 100644
--- a/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
+++ b/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2004-2024 Free Software Foundation, Inc.
+# Copyright (C) 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if { ![runto_main] } {
return 0
diff --git a/gdb/testsuite/gdb.threads/kill.c b/gdb/testsuite/gdb.threads/kill.c
index 4003d81..5b60f14 100644
--- a/gdb/testsuite/gdb.threads/kill.c
+++ b/gdb/testsuite/gdb.threads/kill.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/kill.exp b/gdb/testsuite/gdb.threads/kill.exp
index fa87ddc..72f829c 100644
--- a/gdb/testsuite/gdb.threads/kill.exp
+++ b/gdb/testsuite/gdb.threads/kill.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ standard_testfile
proc test {threaded} {
global testfile srcfile decimal
- with_test_prefix [expr ($threaded)?"threaded":"non-threaded"] {
+ with_test_prefix [expr {($threaded)?"threaded":"non-threaded"}] {
set options {debug}
if {$threaded} {
diff --git a/gdb/testsuite/gdb.threads/killed-outside.c b/gdb/testsuite/gdb.threads/killed-outside.c
index 1ae88ff..6e5c2d4 100644
--- a/gdb/testsuite/gdb.threads/killed-outside.c
+++ b/gdb/testsuite/gdb.threads/killed-outside.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/killed-outside.exp b/gdb/testsuite/gdb.threads/killed-outside.exp
index 35f7dc1..9edb8d2 100644
--- a/gdb/testsuite/gdb.threads/killed-outside.exp
+++ b/gdb/testsuite/gdb.threads/killed-outside.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2020-2024 Free Software Foundation, Inc.
+# Copyright (C) 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/killed.c b/gdb/testsuite/gdb.threads/killed.c
index 928a7d4..5476a1d 100644
--- a/gdb/testsuite/gdb.threads/killed.c
+++ b/gdb/testsuite/gdb.threads/killed.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/killed.exp b/gdb/testsuite/gdb.threads/killed.exp
index 0b89552..635ffc8 100644
--- a/gdb/testsuite/gdb.threads/killed.exp
+++ b/gdb/testsuite/gdb.threads/killed.exp
@@ -1,4 +1,4 @@
-# Copyright 2002-2024 Free Software Foundation, Inc.
+# Copyright 2002-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@
# There is absolutely no warranty for GDB. Type "show warranty" for details.
# This GDB was configured as "i686-pc-linux-gnu"...
# (gdb) run
-# Starting program: /home/jimb/foo/play/killed
+# Starting program: /home/jimb/foo/play/killed
# [New Thread 1024 (LWP 6487)]
# [New Thread 2049 (LWP 6488)]
# [New Thread 1026 (LWP 6489)]
@@ -42,17 +42,17 @@
# Cannot find thread 2049: generic error
# (gdb) The program is running. Exit anyway? (y or n) y
# Cannot find thread 2049: generic error
-# (gdb)
+# (gdb)
# [7]+ Stopped $D6/gdb/gdb -nw killed
# $ kill %7
-#
+#
# [7]+ Stopped $D6/gdb/gdb -nw killed
# $ kill -9 %7
-#
+#
# [7]+ Stopped $D6/gdb/gdb -nw killed
-# $
+# $
# [7]+ Killed $D6/gdb/gdb -nw killed
-# $
+# $
standard_testfile
@@ -62,7 +62,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_run_cmd
gdb_test "" "" "run program to completion"
diff --git a/gdb/testsuite/gdb.threads/leader-exit-attach.exp b/gdb/testsuite/gdb.threads/leader-exit-attach.exp
index 5334de2..2df4a18 100644
--- a/gdb/testsuite/gdb.threads/leader-exit-attach.exp
+++ b/gdb/testsuite/gdb.threads/leader-exit-attach.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ set testpid [spawn_id_get_pid $test_spawn_id]
# Wait a bit for the leader thread to exit, before attaching.
sleep 2
-clean_restart ${binfile}
+clean_restart ${::testfile}
# Save this early as we may not be able to talk with GDBserver anymore
# when we need to check it.
diff --git a/gdb/testsuite/gdb.threads/leader-exit.c b/gdb/testsuite/gdb.threads/leader-exit.c
index 333c53c..dbbb719 100644
--- a/gdb/testsuite/gdb.threads/leader-exit.c
+++ b/gdb/testsuite/gdb.threads/leader-exit.c
@@ -1,6 +1,6 @@
/* Clean exit of the thread group leader should not break GDB.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/leader-exit.exp b/gdb/testsuite/gdb.threads/leader-exit.exp
index daddc15..85039b8 100644
--- a/gdb/testsuite/gdb.threads/leader-exit.exp
+++ b/gdb/testsuite/gdb.threads/leader-exit.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2024 Free Software Foundation, Inc.
+# Copyright (C) 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
clean_restart ${executable}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/linux-dp.exp b/gdb/testsuite/gdb.threads/linux-dp.exp
index de44ea5..c0ef9c7 100644
--- a/gdb/testsuite/gdb.threads/linux-dp.exp
+++ b/gdb/testsuite/gdb.threads/linux-dp.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test_no_output "set print sevenbit-strings"
runto_main
@@ -117,7 +117,7 @@ for {set i 0} {$i < 5} {incr i} {
} else {
fail "create philosopher: $i"
}
-
+
set threads_after {}
gdb_test_multiple "info threads" "info threads after: $i" {
-re "info threads\r\n" {
@@ -172,7 +172,7 @@ for {set i 1} {$i < $nthreads} {incr i} {
append info_threads_ptn "$i *Thread .*"
}
append info_threads_ptn "\[\r\n\]+$gdb_prompt $"
-set info_threads_manager_ptn "[expr $nthreads + 1] *Thread .*$info_threads_ptn"
+set info_threads_manager_ptn "[expr {$nthreads + 1}] *Thread .*$info_threads_ptn"
gdb_test_multiple "info threads" "info threads 2" {
-re "$info_threads_manager_ptn" {
@@ -241,7 +241,7 @@ for {set i 0} {$only_five > 0 && $i < 10} {incr i} {
-re ".*$gdb_prompt $" {
set only_five 0
}
- timeout {
+ timeout {
set only_five -1
}
}
@@ -331,7 +331,7 @@ set any_interesting 0
catch {unset seen}
array set seen {}
for {set i 1} {$i <= $nthreads} {incr i} {
- if [check_philosopher_stack $i seen] {
+ if {[check_philosopher_stack $i seen]} {
set any_interesting 1
}
}
diff --git a/gdb/testsuite/gdb.threads/local-watch-wrong-thread.c b/gdb/testsuite/gdb.threads/local-watch-wrong-thread.c
index 73bf88b..e623ec2 100644
--- a/gdb/testsuite/gdb.threads/local-watch-wrong-thread.c
+++ b/gdb/testsuite/gdb.threads/local-watch-wrong-thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/local-watch-wrong-thread.exp b/gdb/testsuite/gdb.threads/local-watch-wrong-thread.exp
index fcefb2b..a63f0be 100644
--- a/gdb/testsuite/gdb.threads/local-watch-wrong-thread.exp
+++ b/gdb/testsuite/gdb.threads/local-watch-wrong-thread.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if {[gdb_compile_pthreads \
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test_no_output "set can-use-hw-watchpoints 1" ""
diff --git a/gdb/testsuite/gdb.threads/main-thread-exit-during-detach.c b/gdb/testsuite/gdb.threads/main-thread-exit-during-detach.c
index 50849d9..5981470 100644
--- a/gdb/testsuite/gdb.threads/main-thread-exit-during-detach.c
+++ b/gdb/testsuite/gdb.threads/main-thread-exit-during-detach.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/main-thread-exit-during-detach.exp b/gdb/testsuite/gdb.threads/main-thread-exit-during-detach.exp
index 2a9320a..1ce0194 100644
--- a/gdb/testsuite/gdb.threads/main-thread-exit-during-detach.exp
+++ b/gdb/testsuite/gdb.threads/main-thread-exit-during-detach.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -50,7 +50,7 @@ if {[build_executable "failed to prepare" $testfile $srcfile \
proc run_test { spawn_inferior } {
save_vars { ::GDBFLAGS } {
append ::GDBFLAGS " -ex \"set non-stop on\""
- clean_restart $::binfile
+ clean_restart $::testfile
}
# Setup the inferior. When complete the main thread (#1) will
diff --git a/gdb/testsuite/gdb.threads/manythreads.c b/gdb/testsuite/gdb.threads/manythreads.c
index dd3c8a4..97a91de 100644
--- a/gdb/testsuite/gdb.threads/manythreads.c
+++ b/gdb/testsuite/gdb.threads/manythreads.c
@@ -1,5 +1,5 @@
/* Manythreads test program.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
Written by Jeff Johnston <jjohnstn@redhat.com>
Contributed by Red Hat
diff --git a/gdb/testsuite/gdb.threads/manythreads.exp b/gdb/testsuite/gdb.threads/manythreads.exp
index e660506..0a09897 100644
--- a/gdb/testsuite/gdb.threads/manythreads.exp
+++ b/gdb/testsuite/gdb.threads/manythreads.exp
@@ -1,5 +1,5 @@
# manythreads.exp -- Expect script to test stopping many threads
-# Copyright (C) 2004-2024 Free Software Foundation, Inc.
+# Copyright (C) 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ require {!target_info exists gdb,nointerrupts}
standard_testfile
set opts { debug }
-if [info exists DEBUG] {
+if {[info exists DEBUG]} {
# make check RUNTESTFLAGS='gdb.threads/manythreads.exp DEBUG=1'
lappend opts "additional_flags=-DDEBUG"
}
@@ -31,7 +31,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test_no_output "set print sevenbit-strings"
runto_main
diff --git a/gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp b/gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp
index 1c1eb89..c42c1a9 100644
--- a/gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp
+++ b/gdb/testsuite/gdb.threads/multi-create-ns-info-thr.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2024 Free Software Foundation, Inc.
+# Copyright (C) 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}
gdb_test_no_output "set pagination off"
gdb_test_no_output "set non-stop on"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/multi-create.c b/gdb/testsuite/gdb.threads/multi-create.c
index 42fae3f..2706f37 100644
--- a/gdb/testsuite/gdb.threads/multi-create.c
+++ b/gdb/testsuite/gdb.threads/multi-create.c
@@ -1,5 +1,5 @@
/* Create threads from multiple threads in parallel.
- Copyright 2007-2024 Free Software Foundation, Inc.
+ Copyright 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.threads/multi-create.exp b/gdb/testsuite/gdb.threads/multi-create.exp
index 49aa3a6..cb86aac 100644
--- a/gdb/testsuite/gdb.threads/multi-create.exp
+++ b/gdb/testsuite/gdb.threads/multi-create.exp
@@ -1,5 +1,5 @@
# multi-create.exp -- Test creating many threads in parallel
-# Copyright (C) 2007-2024 Free Software Foundation, Inc.
+# Copyright (C) 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto_main
# Run to the beginning of create_function several times. Make sure
diff --git a/gdb/testsuite/gdb.threads/multiple-step-overs.c b/gdb/testsuite/gdb.threads/multiple-step-overs.c
index 424696a..694dd97 100644
--- a/gdb/testsuite/gdb.threads/multiple-step-overs.c
+++ b/gdb/testsuite/gdb.threads/multiple-step-overs.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/multiple-step-overs.exp b/gdb/testsuite/gdb.threads/multiple-step-overs.exp
index dde874d..c3456c2 100644
--- a/gdb/testsuite/gdb.threads/multiple-step-overs.exp
+++ b/gdb/testsuite/gdb.threads/multiple-step-overs.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ proc setup {} {
with_test_prefix "setup" {
clean_restart $executable
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/multiple-successive-infcall.c b/gdb/testsuite/gdb.threads/multiple-successive-infcall.c
index 7ba702a..38e1931 100644
--- a/gdb/testsuite/gdb.threads/multiple-successive-infcall.c
+++ b/gdb/testsuite/gdb.threads/multiple-successive-infcall.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/multiple-successive-infcall.exp b/gdb/testsuite/gdb.threads/multiple-successive-infcall.exp
index 4a97179..2694ce5 100644
--- a/gdb/testsuite/gdb.threads/multiple-successive-infcall.exp
+++ b/gdb/testsuite/gdb.threads/multiple-successive-infcall.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-clean_restart "${binfile}"
+clean_restart "${::testfile}"
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.threads/names.c b/gdb/testsuite/gdb.threads/names.c
index 55a99ef..6a26709 100644
--- a/gdb/testsuite/gdb.threads/names.c
+++ b/gdb/testsuite/gdb.threads/names.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/names.exp b/gdb/testsuite/gdb.threads/names.exp
index cf94e42..808fa24 100644
--- a/gdb/testsuite/gdb.threads/names.exp
+++ b/gdb/testsuite/gdb.threads/names.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,11 +20,11 @@ require {!target_info exists gdb,no_thread_names}
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}]} {
return -1
}
-if ![runto "all_threads_ready"] {
+if {![runto "all_threads_ready"]} {
return
}
diff --git a/gdb/testsuite/gdb.threads/next-bp-other-thread.c b/gdb/testsuite/gdb.threads/next-bp-other-thread.c
index cf313cb..0268578 100644
--- a/gdb/testsuite/gdb.threads/next-bp-other-thread.c
+++ b/gdb/testsuite/gdb.threads/next-bp-other-thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/next-bp-other-thread.exp b/gdb/testsuite/gdb.threads/next-bp-other-thread.exp
index 8e79150..293b100 100644
--- a/gdb/testsuite/gdb.threads/next-bp-other-thread.exp
+++ b/gdb/testsuite/gdb.threads/next-bp-other-thread.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,9 +28,9 @@ if {[build_executable "failed to prepare" $testfile $srcfile \
# Test all "set scheduler-locking" variants.
foreach schedlock {"off" "step" "on" } {
with_test_prefix "schedlock=$schedlock" {
- clean_restart $binfile
+ clean_restart $::testfile
- if ![runto_main] {
+ if {![runto_main]} {
continue
}
diff --git a/gdb/testsuite/gdb.threads/next-fork-exec-other-thread.c b/gdb/testsuite/gdb.threads/next-fork-exec-other-thread.c
index 7694a89..968affa 100644
--- a/gdb/testsuite/gdb.threads/next-fork-exec-other-thread.c
+++ b/gdb/testsuite/gdb.threads/next-fork-exec-other-thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/next-fork-exec-other-thread.exp b/gdb/testsuite/gdb.threads/next-fork-exec-other-thread.exp
index 3413605..82e85a6 100644
--- a/gdb/testsuite/gdb.threads/next-fork-exec-other-thread.exp
+++ b/gdb/testsuite/gdb.threads/next-fork-exec-other-thread.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,6 +25,8 @@
# 20.04.5 LTS with 32-bit kernel + 32-bit userland. It was NOT reproducible
# using a circa 2023 Raspberry Pi OS w/ 64-bit kernel and 32-bit userland.
+require allow_fork_tests
+
standard_testfile
# Line where to stop the main thread.
@@ -65,7 +67,7 @@ proc do_test { fork_func target-non-stop non-stop displaced-stepping } {
save_vars { ::GDBFLAGS } {
append ::GDBFLAGS " -ex \"maintenance set target-non-stop ${target-non-stop}\""
append ::GDBFLAGS " -ex \"set non-stop ${non-stop}\""
- clean_restart ${::binfile}-${fork_func}
+ clean_restart ${::testfile}-${fork_func}
}
gdb_test_no_output "set displaced-stepping ${displaced-stepping}"
diff --git a/gdb/testsuite/gdb.threads/next-fork-other-thread.c b/gdb/testsuite/gdb.threads/next-fork-other-thread.c
index fec874c..7bf3b14 100644
--- a/gdb/testsuite/gdb.threads/next-fork-other-thread.c
+++ b/gdb/testsuite/gdb.threads/next-fork-other-thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/next-fork-other-thread.exp b/gdb/testsuite/gdb.threads/next-fork-other-thread.exp
index 5526f4e..9349091 100644
--- a/gdb/testsuite/gdb.threads/next-fork-other-thread.exp
+++ b/gdb/testsuite/gdb.threads/next-fork-other-thread.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,6 +16,8 @@
# Test doing a "next" on a thread during which forks or vforks happen in other
# threads.
+require allow_fork_tests
+
standard_testfile
# Line where to stop the main thread.
@@ -56,7 +58,7 @@ proc do_test { fork_func target-non-stop non-stop displaced-stepping } {
save_vars { ::GDBFLAGS } {
append ::GDBFLAGS " -ex \"maintenance set target-non-stop ${target-non-stop}\""
append ::GDBFLAGS " -ex \"set non-stop ${non-stop}\""
- clean_restart ${::binfile}-${fork_func}
+ clean_restart ${::testfile}-${fork_func}
}
gdb_test_no_output "set displaced-stepping ${displaced-stepping}"
diff --git a/gdb/testsuite/gdb.threads/next-while-other-thread-longjmps.c b/gdb/testsuite/gdb.threads/next-while-other-thread-longjmps.c
index b170cb7..26ae6ca 100644
--- a/gdb/testsuite/gdb.threads/next-while-other-thread-longjmps.c
+++ b/gdb/testsuite/gdb.threads/next-while-other-thread-longjmps.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/next-while-other-thread-longjmps.exp b/gdb/testsuite/gdb.threads/next-while-other-thread-longjmps.exp
index 2b77cfd..fd4aebb 100644
--- a/gdb/testsuite/gdb.threads/next-while-other-thread-longjmps.exp
+++ b/gdb/testsuite/gdb.threads/next-while-other-thread-longjmps.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/no-unwaited-for-left.c b/gdb/testsuite/gdb.threads/no-unwaited-for-left.c
index 2e86479..2539cde 100644
--- a/gdb/testsuite/gdb.threads/no-unwaited-for-left.c
+++ b/gdb/testsuite/gdb.threads/no-unwaited-for-left.c
@@ -1,4 +1,4 @@
-/* Copyright 2007-2024 Free Software Foundation, Inc.
+/* Copyright 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/no-unwaited-for-left.exp b/gdb/testsuite/gdb.threads/no-unwaited-for-left.exp
index e04cd6b..96b5433 100644
--- a/gdb/testsuite/gdb.threads/no-unwaited-for-left.exp
+++ b/gdb/testsuite/gdb.threads/no-unwaited-for-left.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2024 Free Software Foundation, Inc.
+# Copyright (C) 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
clean_restart ${executable}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-1.c b/gdb/testsuite/gdb.threads/non-ldr-exc-1.c
index 005808a..4cac632 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-1.c
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
index df0bf16..7d2956d 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ proc do_test { lock_sched nonstop } {
clean_restart ${executable}
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-2.c b/gdb/testsuite/gdb.threads/non-ldr-exc-2.c
index 4026a74..a1b4dc2 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-2.c
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
index de63df3..bb66644 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ proc do_test { lock_sched nonstop } {
clean_restart ${executable}
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-3.c b/gdb/testsuite/gdb.threads/non-ldr-exc-3.c
index 7b4d0c6..68b9ae3 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-3.c
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-3.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
index a91d667..4490b30 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ proc do_test { lock_sched nonstop } {
clean_restart ${executable}
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-4.c b/gdb/testsuite/gdb.threads/non-ldr-exc-4.c
index 62dc86e..3719190 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-4.c
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-4.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
index b9d2eaa..533e14f 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ proc do_test { lock_sched nonstop } {
clean_restart ${executable}
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exit.c b/gdb/testsuite/gdb.threads/non-ldr-exit.c
index e644b81..9536b4a 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exit.c
+++ b/gdb/testsuite/gdb.threads/non-ldr-exit.c
@@ -1,6 +1,6 @@
/* Clean exit of the thread group leader should not break GDB.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exit.exp b/gdb/testsuite/gdb.threads/non-ldr-exit.exp
index bb8b56b..4dd1b79 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exit.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exit.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/non-stop-fair-events.c b/gdb/testsuite/gdb.threads/non-stop-fair-events.c
index 96adecd..3e7441d 100644
--- a/gdb/testsuite/gdb.threads/non-stop-fair-events.c
+++ b/gdb/testsuite/gdb.threads/non-stop-fair-events.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/non-stop-fair-events.exp b/gdb/testsuite/gdb.threads/non-stop-fair-events.exp
index 1ebb886..788a7e8 100644
--- a/gdb/testsuite/gdb.threads/non-stop-fair-events.exp
+++ b/gdb/testsuite/gdb.threads/non-stop-fair-events.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile $options] == -1}
gdb_test_no_output "set non-stop on"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/omp-par-scope.c b/gdb/testsuite/gdb.threads/omp-par-scope.c
index 5f061f0..626ca16 100644
--- a/gdb/testsuite/gdb.threads/omp-par-scope.c
+++ b/gdb/testsuite/gdb.threads/omp-par-scope.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/omp-par-scope.exp b/gdb/testsuite/gdb.threads/omp-par-scope.exp
index 48f81d3..2a097f5 100644
--- a/gdb/testsuite/gdb.threads/omp-par-scope.exp
+++ b/gdb/testsuite/gdb.threads/omp-par-scope.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if { [test_compiler_info "clang*"] } {
set have_nested_function_support 0
set opts {openmp debug}
-if [support_nested_function_tests] {
+if {[support_nested_function_tests]} {
lappend opts "additional_flags=-DHAVE_NESTED_FUNCTION_SUPPORT"
set have_nested_function_support 1
}
@@ -191,7 +191,7 @@ with_test_prefix "multi_scope" {
# Nested functions in C are a GNU extension, so only do the nested function
# tests if compiling with -DHAVE_NESTED_FUNCTION_SUPPORT was successful.
-if $have_nested_function_support {
+if {$have_nested_function_support} {
with_test_prefix "nested_func" {
gdb_breakpoint [gdb_get_line_number "nested_func: tn="]
diff --git a/gdb/testsuite/gdb.threads/omp-task.c b/gdb/testsuite/gdb.threads/omp-task.c
index 515e4a1..bc0ab90 100644
--- a/gdb/testsuite/gdb.threads/omp-task.c
+++ b/gdb/testsuite/gdb.threads/omp-task.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/omp-task.exp b/gdb/testsuite/gdb.threads/omp-task.exp
index 3e8e170..a889c84 100644
--- a/gdb/testsuite/gdb.threads/omp-task.exp
+++ b/gdb/testsuite/gdb.threads/omp-task.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/pending-fork-event-detach-ns.c b/gdb/testsuite/gdb.threads/pending-fork-event-detach-ns.c
index f7fdd42..af15b9f 100644
--- a/gdb/testsuite/gdb.threads/pending-fork-event-detach-ns.c
+++ b/gdb/testsuite/gdb.threads/pending-fork-event-detach-ns.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/pending-fork-event-detach-ns.exp b/gdb/testsuite/gdb.threads/pending-fork-event-detach-ns.exp
index e3cb4ae..9cc4978 100644
--- a/gdb/testsuite/gdb.threads/pending-fork-event-detach-ns.exp
+++ b/gdb/testsuite/gdb.threads/pending-fork-event-detach-ns.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,6 +29,8 @@
# parent thread from waitpid'ing it, preventing the main thread from joining
# it, prevent it from writing the flag file, failing the test.
+require allow_fork_tests
+
standard_testfile
if { [is_remote target] } {
@@ -50,7 +52,7 @@ proc do_test { } {
save_vars { ::GDBFLAGS } {
append ::GDBFLAGS " -ex \"set non-stop on\""
- clean_restart $::binfile
+ clean_restart $::testfile
}
if { ![runto break_here_first] } {
diff --git a/gdb/testsuite/gdb.threads/pending-fork-event-detach-touch-file.c b/gdb/testsuite/gdb.threads/pending-fork-event-detach-touch-file.c
index 84a505c..fdce1cb 100644
--- a/gdb/testsuite/gdb.threads/pending-fork-event-detach-touch-file.c
+++ b/gdb/testsuite/gdb.threads/pending-fork-event-detach-touch-file.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/pending-fork-event-detach.c b/gdb/testsuite/gdb.threads/pending-fork-event-detach.c
index 1c0a07d..4ce4abd 100644
--- a/gdb/testsuite/gdb.threads/pending-fork-event-detach.c
+++ b/gdb/testsuite/gdb.threads/pending-fork-event-detach.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/pending-fork-event-detach.exp b/gdb/testsuite/gdb.threads/pending-fork-event-detach.exp
index 4b16eaa..fa86488 100644
--- a/gdb/testsuite/gdb.threads/pending-fork-event-detach.exp
+++ b/gdb/testsuite/gdb.threads/pending-fork-event-detach.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,6 +34,8 @@
# event, and erroneously create a new inferior for it. Once fixed, the child
# process' thread is hidden by whoever holds the pending fork event.
+require allow_fork_tests
+
standard_testfile .c -touch-file.c
set touch_file_bin $binfile-touch-file
@@ -91,7 +93,8 @@ proc do_test { target-non-stop who_forks fork_function stop_mode } {
save_vars { ::GDBFLAGS } {
append ::GDBFLAGS " -ex \"maintenance set target-non-stop ${target-non-stop}\""
- clean_restart $this_binfile
+ clean_restart
+ gdb_load $this_binfile
}
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.threads/pending-step.c b/gdb/testsuite/gdb.threads/pending-step.c
index 795e8f5..3bd091c 100644
--- a/gdb/testsuite/gdb.threads/pending-step.c
+++ b/gdb/testsuite/gdb.threads/pending-step.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/pending-step.exp b/gdb/testsuite/gdb.threads/pending-step.exp
index 64b421b..d31f879 100644
--- a/gdb/testsuite/gdb.threads/pending-step.exp
+++ b/gdb/testsuite/gdb.threads/pending-step.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -54,7 +54,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.threads/print-threads.exp b/gdb/testsuite/gdb.threads/print-threads.exp
index 6fae36a..a3fcba3 100644
--- a/gdb/testsuite/gdb.threads/print-threads.exp
+++ b/gdb/testsuite/gdb.threads/print-threads.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1996-2024 Free Software Foundation, Inc.
+# Copyright (C) 1996-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
# Now we can proceed with the real testing.
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test_no_output "set print sevenbit-strings"
#gdb_test_no_output "set print address off"
@@ -50,13 +50,13 @@ proc test_all_threads { name kill } {
set j 0
gdb_test_multiple "continue" "all threads ran once" {
-re "Breakpoint \[0-9\]+, thread_function \\(arg=.*\\) at .*print-threads.c:\[0-9\]+.*$gdb_prompt" {
- set i [expr $i + 1]
+ set i [expr {$i + 1}]
pass "hit thread_function breakpoint, $i"
send_gdb "continue\n"
exp_continue
}
-re "Breakpoint \[0-9\]+, .* kill \\(.*\\) .*$gdb_prompt" {
- set j [expr $j + 1]
+ set j [expr {$j + 1}]
if { $kill == 1 } {
pass "hit kill breakpoint, $j"
} else {
@@ -96,7 +96,7 @@ runto_main
gdb_test "break thread_function" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*print-threads.c, line \[0-9\]*\\." "break thread_function, 2"
gdb_test_no_output "set var slow = 1"
# Extend the timeout for slower tests.
-set timeout [expr $oldtimeout + 120]
+set timeout [expr {$oldtimeout + 120}]
test_all_threads "slow" 0
set timeout $oldtimeout
@@ -105,6 +105,6 @@ gdb_test "break thread_function" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*p
gdb_test_no_output "set var slow = 1" "set var slow = 1, 2"
gdb_breakpoint "kill"
# Extend the timeout for slower tests.
-set timeout [expr $oldtimeout + 120]
+set timeout [expr {$oldtimeout + 120}]
test_all_threads "slow with kill breakpoint" 1
set timeout $oldtimeout
diff --git a/gdb/testsuite/gdb.threads/process-dies-while-detaching.c b/gdb/testsuite/gdb.threads/process-dies-while-detaching.c
index f9acc1f..2de535b 100644
--- a/gdb/testsuite/gdb.threads/process-dies-while-detaching.c
+++ b/gdb/testsuite/gdb.threads/process-dies-while-detaching.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp b/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp
index 5c54a36..63ddfec 100644
--- a/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp
+++ b/gdb/testsuite/gdb.threads/process-dies-while-detaching.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -43,6 +43,7 @@
# threads are reaped. We test that as well.
standard_testfile
+set testfile_base $testfile
# Test that GDBserver exits.
@@ -187,7 +188,7 @@ proc do_detach {multi_process cmd child_exit} {
perror "unhandled command: $cmd"
}
} else {
- if $is_remote {
+ if {$is_remote} {
set extra "\r\nEnding remote debugging\."
} else {
set extra ""
@@ -214,9 +215,9 @@ proc test_detach {multi_process cmd} {
with_test_prefix "detach" {
global binfile
- clean_restart ${binfile}
+ clean_restart ${::testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -242,9 +243,9 @@ proc test_detach_watch {wp multi_process cmd} {
with_test_prefix "watchpoint:$wp" {
global binfile decimal
- clean_restart ${binfile}
+ clean_restart ${::testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -290,9 +291,9 @@ proc test_detach_killed_outside {multi_process cmd} {
with_test_prefix "killed outside" {
global binfile
- clean_restart ${binfile}
+ clean_restart ${::testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -334,14 +335,15 @@ proc do_test {multi_process cmd} {
return
}
- set binfile [standard_output_file ${testfile}-$multi_process-$cmd]
+ set testfile $::testfile_base-$multi_process-$cmd
+ set binfile [standard_output_file $testfile]
set options {debug pthreads}
if {$multi_process} {
lappend options "additional_flags=-DMULTIPROCESS"
}
if {[build_executable "failed to build" \
- $testfile-$multi_process-$cmd $srcfile $options] == -1} {
+ $testfile $srcfile $options] == -1} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/process-dies-while-handling-bp.c b/gdb/testsuite/gdb.threads/process-dies-while-handling-bp.c
index 738f150..887956c 100644
--- a/gdb/testsuite/gdb.threads/process-dies-while-handling-bp.c
+++ b/gdb/testsuite/gdb.threads/process-dies-while-handling-bp.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/process-dies-while-handling-bp.exp b/gdb/testsuite/gdb.threads/process-dies-while-handling-bp.exp
index 4ff68a6..a990dc9 100644
--- a/gdb/testsuite/gdb.threads/process-dies-while-handling-bp.exp
+++ b/gdb/testsuite/gdb.threads/process-dies-while-handling-bp.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ proc do_test { non_stop cond_bp_target } {
save_vars { GDBFLAGS } {
set GDBFLAGS [concat $GDBFLAGS " -ex \"set non-stop $non_stop\""]
- clean_restart $binfile
+ clean_restart $::testfile
}
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.c b/gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.c
index bd998f9..e3a4153 100644
--- a/gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.c
+++ b/gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.exp b/gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.exp
index 6b509f3..ec4dbd8 100644
--- a/gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.exp
+++ b/gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/pthread_cond_wait.c b/gdb/testsuite/gdb.threads/pthread_cond_wait.c
index a131981..e1e513e 100644
--- a/gdb/testsuite/gdb.threads/pthread_cond_wait.c
+++ b/gdb/testsuite/gdb.threads/pthread_cond_wait.c
@@ -1,6 +1,6 @@
/* A small multi-threaded test case.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.threads/pthread_cond_wait.exp b/gdb/testsuite/gdb.threads/pthread_cond_wait.exp
index 03c5a58..e11b904 100644
--- a/gdb/testsuite/gdb.threads/pthread_cond_wait.exp
+++ b/gdb/testsuite/gdb.threads/pthread_cond_wait.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2004-2024 Free Software Foundation, Inc.
+# Copyright (C) 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
# bug-gdb@gnu.org
# This file verifies that GDB is able to compute a backtrace for a thread
-# being blocked on a call to pthread_cond_wait().
+# being blocked on a call to pthread_cond_wait().
standard_testfile
@@ -25,7 +25,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto_main
gdb_test "break break_me" \
@@ -36,7 +36,7 @@ gdb_test "continue" \
".*Breakpoint 2, break_me ().*" \
"run to break_me"
-#
+#
# Backtrace all threads, find the one running noreturn, and
# verify that we are able to get a sensible backtrace, including
# the frame for the pthread_cond_wait() call.
diff --git a/gdb/testsuite/gdb.threads/pthreads.c b/gdb/testsuite/gdb.threads/pthreads.c
index 74d37cf..f84f273 100644
--- a/gdb/testsuite/gdb.threads/pthreads.c
+++ b/gdb/testsuite/gdb.threads/pthreads.c
@@ -1,5 +1,5 @@
/* Pthreads test program.
- Copyright 1996-2024 Free Software Foundation, Inc.
+ Copyright 1996-2025 Free Software Foundation, Inc.
Written by Fred Fish of Cygnus Support
Contributed by Cygnus Support
diff --git a/gdb/testsuite/gdb.threads/pthreads.exp b/gdb/testsuite/gdb.threads/pthreads.exp
index 4a63a53..04ae91e2 100644
--- a/gdb/testsuite/gdb.threads/pthreads.exp
+++ b/gdb/testsuite/gdb.threads/pthreads.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1996-2024 Free Software Foundation, Inc.
+# Copyright (C) 1996-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test_no_output "set print sevenbit-strings"
#gdb_test_no_output "set print address off"
diff --git a/gdb/testsuite/gdb.threads/queue-signal.c b/gdb/testsuite/gdb.threads/queue-signal.c
index 9351248..7caf5f7 100644
--- a/gdb/testsuite/gdb.threads/queue-signal.c
+++ b/gdb/testsuite/gdb.threads/queue-signal.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/queue-signal.exp b/gdb/testsuite/gdb.threads/queue-signal.exp
index 536cf97..6ab8bbb 100644
--- a/gdb/testsuite/gdb.threads/queue-signal.exp
+++ b/gdb/testsuite/gdb.threads/queue-signal.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,9 +20,9 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.threads/reconnect-signal.c b/gdb/testsuite/gdb.threads/reconnect-signal.c
index 14d95a5..3be516e 100644
--- a/gdb/testsuite/gdb.threads/reconnect-signal.c
+++ b/gdb/testsuite/gdb.threads/reconnect-signal.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/reconnect-signal.exp b/gdb/testsuite/gdb.threads/reconnect-signal.exp
index ccaf082..ce64610 100644
--- a/gdb/testsuite/gdb.threads/reconnect-signal.exp
+++ b/gdb/testsuite/gdb.threads/reconnect-signal.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/schedlock-new-thread.c b/gdb/testsuite/gdb.threads/schedlock-new-thread.c
index cd4a2a5..06af905 100644
--- a/gdb/testsuite/gdb.threads/schedlock-new-thread.c
+++ b/gdb/testsuite/gdb.threads/schedlock-new-thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/schedlock-new-thread.exp b/gdb/testsuite/gdb.threads/schedlock-new-thread.exp
index 665838d..0937e2a 100644
--- a/gdb/testsuite/gdb.threads/schedlock-new-thread.exp
+++ b/gdb/testsuite/gdb.threads/schedlock-new-thread.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
standard_testfile .c
foreach_with_prefix schedlock {off on} {
- set sl [expr $schedlock == "on" ? 1 : 0]
+ set sl [expr {$schedlock == "on" ? 1 : 0}]
if { [build_executable "failed to prepare" $testfile-$sl \
$srcfile \
[list debug pthreads additional_flags=-DSCHEDLOCK=$sl]] \
@@ -30,8 +30,8 @@ foreach_with_prefix schedlock {off on} {
proc test {non-stop schedlock} {
save_vars ::GDBFLAGS {
append ::GDBFLAGS " -ex \"set non-stop ${non-stop}\""
- set sl [expr $schedlock == "on" ? 1 : 0]
- clean_restart $::binfile-$sl
+ set sl [expr {$schedlock == "on" ? 1 : 0}]
+ clean_restart $::testfile-$sl
}
set linenum1 [gdb_get_line_number "set break 1 here"]
diff --git a/gdb/testsuite/gdb.threads/schedlock-thread-exit.c b/gdb/testsuite/gdb.threads/schedlock-thread-exit.c
index ae5bde7..9aa452d 100644
--- a/gdb/testsuite/gdb.threads/schedlock-thread-exit.c
+++ b/gdb/testsuite/gdb.threads/schedlock-thread-exit.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/schedlock-thread-exit.exp b/gdb/testsuite/gdb.threads/schedlock-thread-exit.exp
index e894387..137f652 100644
--- a/gdb/testsuite/gdb.threads/schedlock-thread-exit.exp
+++ b/gdb/testsuite/gdb.threads/schedlock-thread-exit.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if { [build_executable "failed to prepare" ${testfile} ${srcfile} \
}
proc do_test { } {
- clean_restart $::binfile
+ clean_restart $::testfile
# One of the launched threads will report a stop on thread_func. Some
# others will also stop on thread_func and have a pending status.
diff --git a/gdb/testsuite/gdb.threads/schedlock.c b/gdb/testsuite/gdb.threads/schedlock.c
index 2ca7a1a..2a25558 100644
--- a/gdb/testsuite/gdb.threads/schedlock.c
+++ b/gdb/testsuite/gdb.threads/schedlock.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/schedlock.exp b/gdb/testsuite/gdb.threads/schedlock.exp
index 4e99961..1257868 100644
--- a/gdb/testsuite/gdb.threads/schedlock.exp
+++ b/gdb/testsuite/gdb.threads/schedlock.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1996-2024 Free Software Foundation, Inc.
+# Copyright (C) 1996-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ proc get_args { description } {
global NUM
set pattern "(\[0-9\]+)"
- for {set i 1} {[expr $i < $NUM]} {incr i} {
+ for {set i 1} {$i < $NUM} {incr i} {
append pattern ", (\[0-9\]+)"
}
@@ -51,7 +51,7 @@ proc get_args { description } {
pass $test
set result ""
- for {set i 1} {[expr $i <= $NUM]} {incr i} {
+ for {set i 1} {[expr {$i <= $NUM}]} {incr i} {
lappend result $expect_out($i,string)
}
return $result
@@ -122,7 +122,7 @@ proc my_continue { msg } {
proc step_ten_loops { cmd } {
global gdb_prompt
- for {set i 0} {[expr $i < 10]} {set i [expr $i + 1]} {
+ for {set i 0} {$i < 10} {incr i} {
set other_step 0
set test "$cmd to increment, $i"
gdb_test_multiple $cmd $test {
@@ -183,7 +183,7 @@ my_continue "initial"
set cont_args [get_args "after initial"]
set bad 0
-for {set i 0} {[expr $i < $NUM]} {set i [expr $i + 1]} {
+for {set i 0} {$i < $NUM} {incr i} {
if {[lindex $start_args $i] == [lindex $cont_args $i]} {
incr bad
}
@@ -233,7 +233,7 @@ proc check_result { cmd before_thread before_args locked } {
} else {
if {$i == $before_thread} {
if {$cmd == "continue"
- || [lindex $before_args $i] == [expr [lindex $after_args $i] - 10]} {
+ || [lindex $before_args $i] == [lindex $after_args $i] - 10} {
pass "$test"
} else {
fail "$test (wrong amount)"
diff --git a/gdb/testsuite/gdb.threads/siginfo-threads.c b/gdb/testsuite/gdb.threads/siginfo-threads.c
index 22c6038..ed1afb7 100644
--- a/gdb/testsuite/gdb.threads/siginfo-threads.c
+++ b/gdb/testsuite/gdb.threads/siginfo-threads.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/siginfo-threads.exp b/gdb/testsuite/gdb.threads/siginfo-threads.exp
index cf43a83..253c4c0 100644
--- a/gdb/testsuite/gdb.threads/siginfo-threads.exp
+++ b/gdb/testsuite/gdb.threads/siginfo-threads.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" \
clean_restart $testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/signal-command-handle-nopass.c b/gdb/testsuite/gdb.threads/signal-command-handle-nopass.c
index 548d0d3..fec4176 100644
--- a/gdb/testsuite/gdb.threads/signal-command-handle-nopass.c
+++ b/gdb/testsuite/gdb.threads/signal-command-handle-nopass.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/signal-command-handle-nopass.exp b/gdb/testsuite/gdb.threads/signal-command-handle-nopass.exp
index 808006a..6d344e3 100644
--- a/gdb/testsuite/gdb.threads/signal-command-handle-nopass.exp
+++ b/gdb/testsuite/gdb.threads/signal-command-handle-nopass.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ proc test { step_over } {
global srcfile binfile tdlabel_re
with_test_prefix "step-over $step_over" {
- clean_restart ${binfile}
+ clean_restart ${::testfile}
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.threads/signal-command-multiple-signals-pending.c b/gdb/testsuite/gdb.threads/signal-command-multiple-signals-pending.c
index 3c49cf5..1d3004a 100644
--- a/gdb/testsuite/gdb.threads/signal-command-multiple-signals-pending.c
+++ b/gdb/testsuite/gdb.threads/signal-command-multiple-signals-pending.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/signal-command-multiple-signals-pending.exp b/gdb/testsuite/gdb.threads/signal-command-multiple-signals-pending.exp
index 5f47d75..acb018b 100644
--- a/gdb/testsuite/gdb.threads/signal-command-multiple-signals-pending.exp
+++ b/gdb/testsuite/gdb.threads/signal-command-multiple-signals-pending.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ proc test { schedlock } {
global srcfile binfile tdlabel_re
with_test_prefix "schedlock $schedlock" {
- clean_restart ${binfile}
+ clean_restart ${::testfile}
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.threads/signal-delivered-right-thread.c b/gdb/testsuite/gdb.threads/signal-delivered-right-thread.c
index 2c10e57..55e68a2 100644
--- a/gdb/testsuite/gdb.threads/signal-delivered-right-thread.c
+++ b/gdb/testsuite/gdb.threads/signal-delivered-right-thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/signal-delivered-right-thread.exp b/gdb/testsuite/gdb.threads/signal-delivered-right-thread.exp
index 71a8598..9de0908 100644
--- a/gdb/testsuite/gdb.threads/signal-delivered-right-thread.exp
+++ b/gdb/testsuite/gdb.threads/signal-delivered-right-thread.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ proc test { command } {
global srcfile binfile tdlabel_re
with_test_prefix "$command" {
- clean_restart ${binfile}
+ clean_restart ${::testfile}
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.threads/signal-sigtrap.c b/gdb/testsuite/gdb.threads/signal-sigtrap.c
index 7c903a1..7547f4a 100644
--- a/gdb/testsuite/gdb.threads/signal-sigtrap.c
+++ b/gdb/testsuite/gdb.threads/signal-sigtrap.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/signal-sigtrap.exp b/gdb/testsuite/gdb.threads/signal-sigtrap.exp
index 8058a5b..849d628 100644
--- a/gdb/testsuite/gdb.threads/signal-sigtrap.exp
+++ b/gdb/testsuite/gdb.threads/signal-sigtrap.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ proc test { sigtrap_thread } {
global srcfile binfile tdlabel_re
with_test_prefix "sigtrap thread $sigtrap_thread" {
- clean_restart ${binfile}
+ clean_restart ${::testfile}
if {![runto "thread_function"]} {
return 0
diff --git a/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.c b/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.c
index 74da73e..f103258 100644
--- a/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.c
+++ b/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp b/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
index 3b1e4b7..b7a110d 100644
--- a/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
+++ b/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -51,7 +51,7 @@ proc get_value {var test} {
clean_restart $executable
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/sigstep-threads.c b/gdb/testsuite/gdb.threads/sigstep-threads.c
index e6e63cc..3210bae 100644
--- a/gdb/testsuite/gdb.threads/sigstep-threads.c
+++ b/gdb/testsuite/gdb.threads/sigstep-threads.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/sigstep-threads.exp b/gdb/testsuite/gdb.threads/sigstep-threads.exp
index d0032b3..9aed9e3 100644
--- a/gdb/testsuite/gdb.threads/sigstep-threads.exp
+++ b/gdb/testsuite/gdb.threads/sigstep-threads.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executa
clean_restart $executable
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -65,7 +65,7 @@ for {set i 0} {$i < 100} {incr i} {
set step_at $now
}
}
- if $failed {
+ if {$failed} {
return
}
}
diff --git a/gdb/testsuite/gdb.threads/sigthread.exp b/gdb/testsuite/gdb.threads/sigthread.exp
index 024fc08..dea8eb8 100644
--- a/gdb/testsuite/gdb.threads/sigthread.exp
+++ b/gdb/testsuite/gdb.threads/sigthread.exp
@@ -1,5 +1,5 @@
# sigthread.exp -- Expect script to test thread and signal interaction
-# Copyright (C) 2007-2024 Free Software Foundation, Inc.
+# Copyright (C) 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.threads/slow-waitpid.c b/gdb/testsuite/gdb.threads/slow-waitpid.c
index 280b109..f98b798 100644
--- a/gdb/testsuite/gdb.threads/slow-waitpid.c
+++ b/gdb/testsuite/gdb.threads/slow-waitpid.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2018-2024 Free Software Foundation, Inc.
+ Copyright 2018-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/staticthreads.c b/gdb/testsuite/gdb.threads/staticthreads.c
index 1a38716..579f59d 100644
--- a/gdb/testsuite/gdb.threads/staticthreads.c
+++ b/gdb/testsuite/gdb.threads/staticthreads.c
@@ -1,6 +1,6 @@
/* This test program is part of GDB, The GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
Originally written by Jeff Johnston <jjohnstn@redhat.com>,
contributed by Red Hat
diff --git a/gdb/testsuite/gdb.threads/staticthreads.exp b/gdb/testsuite/gdb.threads/staticthreads.exp
index 320bbbb..44cc686 100644
--- a/gdb/testsuite/gdb.threads/staticthreads.exp
+++ b/gdb/testsuite/gdb.threads/staticthreads.exp
@@ -1,6 +1,6 @@
# static.exp -- test script, for GDB, the GNU debugger.
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ foreach_with_prefix have_tls { "-DHAVE_TLS" "" } {
}
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test_no_output "set print sevenbit-strings"
@@ -51,7 +51,7 @@ gdb_test_multiple "continue" "$test" {
kfail gdb/1328 "$test"
}
}
-
+
# See if handle SIG32 helps (a little) with a static multi-threaded
# program.
@@ -59,7 +59,7 @@ gdb_test_multiple "continue" "$test" {
set sig "SIG32"
# SIGRTMIN is 37 on hppa-linux
-if [istarget hppa*-*-*] {
+if {[istarget hppa*-*-*]} {
set sig "SIG37"
}
@@ -94,11 +94,11 @@ gdb_test_multiple "quit" "$test" {
pass "$test"
}
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if { "$have_tls" != "" } {
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
gdb_breakpoint [gdb_get_line_number "tlsvar-is-set"]
diff --git a/gdb/testsuite/gdb.threads/step-N-all-progress.c b/gdb/testsuite/gdb.threads/step-N-all-progress.c
index 9f7b6a1..10a0e24 100644
--- a/gdb/testsuite/gdb.threads/step-N-all-progress.c
+++ b/gdb/testsuite/gdb.threads/step-N-all-progress.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/step-N-all-progress.exp b/gdb/testsuite/gdb.threads/step-N-all-progress.exp
index 2ef7c0b..031e36a 100644
--- a/gdb/testsuite/gdb.threads/step-N-all-progress.exp
+++ b/gdb/testsuite/gdb.threads/step-N-all-progress.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ proc test {non-stop target-non-stop} {
save_vars ::GDBFLAGS {
append ::GDBFLAGS " -ex \"maintenance set target-non-stop ${target-non-stop}\""
append ::GDBFLAGS " -ex \"set non-stop ${non-stop}\""
- clean_restart $::binfile
+ clean_restart $::testfile
}
if { ![runto_main] } {
diff --git a/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.c b/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.c
index 71cbdc0..8950250 100644
--- a/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.c
+++ b/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp b/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp
index 7726c7f..82861a9 100644
--- a/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp
+++ b/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
@@ -55,7 +55,7 @@ gdb_test_no_output "next&" "next& over inf loop"
set test "switch to main thread"
gdb_test_multiple "thread 1" $test {
-re "Cannot execute this command while the target is running.*$gdb_prompt $" {
-
+
# With remote targets, we can't send any other remote packet
# until the target stops. Switching thread wants to ask the
# remote side whether the thread is alive.
diff --git a/gdb/testsuite/gdb.threads/step-over-exec-execd.c b/gdb/testsuite/gdb.threads/step-over-exec-execd.c
index dc40255..bbb929e 100644
--- a/gdb/testsuite/gdb.threads/step-over-exec-execd.c
+++ b/gdb/testsuite/gdb.threads/step-over-exec-execd.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/step-over-exec.c b/gdb/testsuite/gdb.threads/step-over-exec.c
index 3b1b265..14ea203 100644
--- a/gdb/testsuite/gdb.threads/step-over-exec.c
+++ b/gdb/testsuite/gdb.threads/step-over-exec.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/step-over-exec.exp b/gdb/testsuite/gdb.threads/step-over-exec.exp
index e5cab9e..22b9a13 100644
--- a/gdb/testsuite/gdb.threads/step-over-exec.exp
+++ b/gdb/testsuite/gdb.threads/step-over-exec.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -71,11 +71,12 @@ proc do_test { execr_thread different_text_segments displaced_stepping } {
return -1
}
- clean_restart ${execr_binfile}
+ clean_restart
+ gdb_load $execr_binfile
gdb_test_no_output "set displaced-stepping $displaced_stepping"
- if ![runto_main] {
+ if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.c b/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.c
index c467e51..37b4f32 100644
--- a/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.c
+++ b/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp b/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp
index 88a6f15..3a96e0e 100644
--- a/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp
+++ b/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ proc do_test {displaced command} {
with_test_prefix "displaced=$displaced: $command" {
clean_restart $executable
- if ![runto_main] {
+ if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.threads/step-over-thread-exit-while-stop-all-threads.c b/gdb/testsuite/gdb.threads/step-over-thread-exit-while-stop-all-threads.c
index c456bc0..144def6 100644
--- a/gdb/testsuite/gdb.threads/step-over-thread-exit-while-stop-all-threads.c
+++ b/gdb/testsuite/gdb.threads/step-over-thread-exit-while-stop-all-threads.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/step-over-thread-exit-while-stop-all-threads.exp b/gdb/testsuite/gdb.threads/step-over-thread-exit-while-stop-all-threads.exp
index d37c44f..fdd2b27 100644
--- a/gdb/testsuite/gdb.threads/step-over-thread-exit-while-stop-all-threads.exp
+++ b/gdb/testsuite/gdb.threads/step-over-thread-exit-while-stop-all-threads.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [build_executable "failed to prepare" $testfile \
proc test {displaced-stepping target-non-stop} {
save_vars ::GDBFLAGS {
append ::GDBFLAGS " -ex \"maintenance set target-non-stop ${target-non-stop}\""
- clean_restart $::binfile
+ clean_restart $::testfile
}
gdb_test_no_output "set displaced-stepping ${displaced-stepping}"
diff --git a/gdb/testsuite/gdb.threads/step-over-thread-exit.c b/gdb/testsuite/gdb.threads/step-over-thread-exit.c
index df64724..c6a8ff0 100644
--- a/gdb/testsuite/gdb.threads/step-over-thread-exit.c
+++ b/gdb/testsuite/gdb.threads/step-over-thread-exit.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/step-over-thread-exit.exp b/gdb/testsuite/gdb.threads/step-over-thread-exit.exp
index 98cc94e..8ed2b21 100644
--- a/gdb/testsuite/gdb.threads/step-over-thread-exit.exp
+++ b/gdb/testsuite/gdb.threads/step-over-thread-exit.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -55,7 +55,7 @@ proc test {step_over_mode non-stop target-non-stop schedlock cmd ns_stop_all} {
save_vars ::GDBFLAGS {
append ::GDBFLAGS " -ex \"maintenance set target-non-stop ${target-non-stop}\""
append ::GDBFLAGS " -ex \"set non-stop ${non-stop}\""
- clean_restart $::binfile
+ clean_restart $::testfile
}
if { $step_over_mode == "none" } {
diff --git a/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.c b/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.c
index 1266530..f17ce67 100644
--- a/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.c
+++ b/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2014-2024 Free Software Foundation, Inc.
+ Copyright 2014-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp b/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp
index 38444365..0e99656 100644
--- a/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp
+++ b/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ proc do_test { displaced with_bp } {
global gdb_prompt
global hex
- if ${with_bp} {
+ if {${with_bp}} {
set prefix "with thread-specific bp"
} else {
set prefix "no thread-specific bp"
@@ -49,7 +49,7 @@ proc do_test { displaced with_bp } {
with_test_prefix $command {
clean_restart $executable
- if ![runto_main] {
+ if {![runto_main]} {
continue
}
@@ -106,7 +106,7 @@ proc do_test { displaced with_bp } {
gdb_test "p watch_me = 0" " = 0" "clear watch_me"
gdb_test "watch watch_me" "Hardware watchpoint .*"
- if ${with_bp} {
+ if {${with_bp}} {
gdb_test "b *$after_address_triggers_watch thread 1" \
"Breakpoint .*" \
"set breakpoint specific to thread 1"
diff --git a/gdb/testsuite/gdb.threads/stepi-over-clone.c b/gdb/testsuite/gdb.threads/stepi-over-clone.c
index f188853..e2aa2e5 100644
--- a/gdb/testsuite/gdb.threads/stepi-over-clone.c
+++ b/gdb/testsuite/gdb.threads/stepi-over-clone.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/stepi-over-clone.exp b/gdb/testsuite/gdb.threads/stepi-over-clone.exp
index b93cfe6..e0b14cb 100644
--- a/gdb/testsuite/gdb.threads/stepi-over-clone.exp
+++ b/gdb/testsuite/gdb.threads/stepi-over-clone.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -58,8 +58,8 @@ gdb_test "continue" \
# Return true if INSN is a syscall instruction.
proc is_syscall_insn { insn } {
- if [istarget x86_64-*-* ] {
- return { $insn == "syscall" }
+ if {[istarget x86_64-*-* ]} {
+ return [string equal $insn "syscall"]
} else {
error "port me"
}
@@ -76,7 +76,7 @@ gdb_test_multiple "disassemble" "" {
-re "^(?:=>)?\\s+(${hex})\\s+<\\+${decimal}>:\\s+(\[^\r\n\]+)\r\n" {
set addr $expect_out(1,string)
set insn [string trim $expect_out(2,string)]
- if [is_syscall_insn $insn] {
+ if {[is_syscall_insn $insn]} {
verbose -log "Found a syscall at: $addr"
lappend syscall_addrs $addr
}
@@ -106,7 +106,7 @@ proc test {non_stop displaced third_thread} {
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"set non-stop $non_stop\""
append GDBFLAGS " -ex \"set displaced $displaced\""
- clean_restart $binfile
+ clean_restart $::testfile
}
runto_main
diff --git a/gdb/testsuite/gdb.threads/stepi-random-signal.c b/gdb/testsuite/gdb.threads/stepi-random-signal.c
index f113cc5..bea43ce 100644
--- a/gdb/testsuite/gdb.threads/stepi-random-signal.c
+++ b/gdb/testsuite/gdb.threads/stepi-random-signal.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/stepi-random-signal.exp b/gdb/testsuite/gdb.threads/stepi-random-signal.exp
index 5c5229d..a2d7743 100644
--- a/gdb/testsuite/gdb.threads/stepi-random-signal.exp
+++ b/gdb/testsuite/gdb.threads/stepi-random-signal.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if { [gdb_compile_pthreads \
clean_restart $executable
# Start the second thread.
-if ![runto start] {
+if {![runto start]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/stop-with-handle.c b/gdb/testsuite/gdb.threads/stop-with-handle.c
index bee985d..34fbabc 100644
--- a/gdb/testsuite/gdb.threads/stop-with-handle.c
+++ b/gdb/testsuite/gdb.threads/stop-with-handle.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/stop-with-handle.exp b/gdb/testsuite/gdb.threads/stop-with-handle.exp
index 3b34ae2..2980449 100644
--- a/gdb/testsuite/gdb.threads/stop-with-handle.exp
+++ b/gdb/testsuite/gdb.threads/stop-with-handle.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/switch-threads.c b/gdb/testsuite/gdb.threads/switch-threads.c
index 71001b6..cfc6703 100644
--- a/gdb/testsuite/gdb.threads/switch-threads.c
+++ b/gdb/testsuite/gdb.threads/switch-threads.c
@@ -1,6 +1,6 @@
/* A minimal multi-threaded test case.
- Copyright 2003-2024 Free Software Foundation, Inc.
+ Copyright 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.threads/switch-threads.exp b/gdb/testsuite/gdb.threads/switch-threads.exp
index 9cb3435..1f67a45 100644
--- a/gdb/testsuite/gdb.threads/switch-threads.exp
+++ b/gdb/testsuite/gdb.threads/switch-threads.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto_main
diff --git a/gdb/testsuite/gdb.threads/thread-bp-deleted.c b/gdb/testsuite/gdb.threads/thread-bp-deleted.c
index 8efcec0..f1aee80 100644
--- a/gdb/testsuite/gdb.threads/thread-bp-deleted.c
+++ b/gdb/testsuite/gdb.threads/thread-bp-deleted.c
@@ -1,4 +1,4 @@
-/* Copyright 2023-2024 Free Software Foundation, Inc.
+/* Copyright 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.threads/thread-bp-deleted.exp b/gdb/testsuite/gdb.threads/thread-bp-deleted.exp
index 3851f8f..19b5001 100644
--- a/gdb/testsuite/gdb.threads/thread-bp-deleted.exp
+++ b/gdb/testsuite/gdb.threads/thread-bp-deleted.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,14 +31,15 @@ if {[build_executable "failed to prepare" $testfile $srcfile \
# We need to do things a little differently when using the remote protocol.
set is_remote \
- [expr [target_info exists gdb_protocol] \
- && ([string equal [target_info gdb_protocol] "remote"] \
- || [string equal [target_info gdb_protocol] "extended-remote"])]
+ [expr \
+ {[target_info exists gdb_protocol]
+ && ([string equal [target_info gdb_protocol] "remote"]
+ || [string equal [target_info gdb_protocol] "extended-remote"])}]
# This test requires background execution, which relies on non-stop mode.
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"maint set target-non-stop on\""
- clean_restart ${binfile}
+ clean_restart ${::testfile}
}
if {![runto_main]} {
@@ -147,7 +148,7 @@ if {$is_remote} {
exp_continue
}
- -re "No threads match '99'\\.\r\n$gdb_prompt $" {
+ -re "No threads matched\\.\r\n$gdb_prompt $" {
if {!$saw_thread_exited && !$saw_bp_deleted && $attempt_count > 0} {
sleep 1
incr attempt_count -1
diff --git a/gdb/testsuite/gdb.threads/thread-execl.c b/gdb/testsuite/gdb.threads/thread-execl.c
index c6c288c..2d312d4 100644
--- a/gdb/testsuite/gdb.threads/thread-execl.c
+++ b/gdb/testsuite/gdb.threads/thread-execl.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,8 +25,9 @@ static const char *image;
void *
thread_execler (void *arg)
{
- /* Exec ourselves again. */
- if (execl (image, image, NULL) == -1)
+ /* Exec ourselves again. Pass an extra argument so that the
+ post-exec image knows to not re-exec yet again. */
+ if (execl (image, image, "1", NULL) == -1)
{
perror ("execl");
abort ();
@@ -40,6 +41,11 @@ main (int argc, char **argv)
{
pthread_t thread;
+ /* An extra argument means we're in the post-exec image, so we're
+ done. Don't re-exec again. */
+ if (argc > 1)
+ exit (0);
+
image = argv[0];
pthread_create (&thread, NULL, thread_execler, NULL);
diff --git a/gdb/testsuite/gdb.threads/thread-execl.exp b/gdb/testsuite/gdb.threads/thread-execl.exp
index 32c4fcf..d1c80df 100644
--- a/gdb/testsuite/gdb.threads/thread-execl.exp
+++ b/gdb/testsuite/gdb.threads/thread-execl.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,13 +35,13 @@ proc do_test { schedlock } {
set prefix "schedlock $schedlock"
}
with_test_prefix "$prefix" {
- clean_restart ${binfile}
+ clean_restart ${::testfile}
if {$schedlock == "non-stop"} {
gdb_test_no_output "set non-stop 1"
}
- if ![runto_main] {
+ if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.threads/thread-find.exp b/gdb/testsuite/gdb.threads/thread-find.exp
index 6bc26bf..171b94b 100644
--- a/gdb/testsuite/gdb.threads/thread-find.exp
+++ b/gdb/testsuite/gdb.threads/thread-find.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test_no_output "set print sevenbit-strings"
runto_main
diff --git a/gdb/testsuite/gdb.threads/thread-specific-bp.c b/gdb/testsuite/gdb.threads/thread-specific-bp.c
index 66105af..425eb5a 100644
--- a/gdb/testsuite/gdb.threads/thread-specific-bp.c
+++ b/gdb/testsuite/gdb.threads/thread-specific-bp.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/thread-specific-bp.exp b/gdb/testsuite/gdb.threads/thread-specific-bp.exp
index e7641d2..8f48b61 100644
--- a/gdb/testsuite/gdb.threads/thread-specific-bp.exp
+++ b/gdb/testsuite/gdb.threads/thread-specific-bp.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -118,7 +118,7 @@ proc check_thread_specific_breakpoint {non_stop} {
foreach_with_prefix non_stop {on off} {
save_vars { GDBFLAGS } {
append GDBFLAGS " -ex \"set non-stop $non_stop\""
- clean_restart $binfile
+ clean_restart $::testfile
}
check_thread_specific_breakpoint $non_stop
diff --git a/gdb/testsuite/gdb.threads/thread-specific.c b/gdb/testsuite/gdb.threads/thread-specific.c
index 179f6f7..e680251 100644
--- a/gdb/testsuite/gdb.threads/thread-specific.c
+++ b/gdb/testsuite/gdb.threads/thread-specific.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004-2024 Free Software Foundation, Inc.
+ Copyright 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/thread-specific.exp b/gdb/testsuite/gdb.threads/thread-specific.exp
index 26bba8b..d1e6f4d 100644
--- a/gdb/testsuite/gdb.threads/thread-specific.exp
+++ b/gdb/testsuite/gdb.threads/thread-specific.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -62,7 +62,7 @@ proc get_thread_list { } {
return $thr_list
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test_no_output "set print sevenbit-strings"
gdb_test_no_output "set width 0"
diff --git a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
index 11d9fb2..dc74714 100644
--- a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
+++ b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2024 Free Software Foundation, Inc.
+# Copyright (C) 2008-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if { ![runto_main] } {
return 0
diff --git a/gdb/testsuite/gdb.threads/thread_check.c b/gdb/testsuite/gdb.threads/thread_check.c
index 1958410..2863f0a 100644
--- a/gdb/testsuite/gdb.threads/thread_check.c
+++ b/gdb/testsuite/gdb.threads/thread_check.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2004-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/thread_check.exp b/gdb/testsuite/gdb.threads/thread_check.exp
index 658f15e..6378e8a 100644
--- a/gdb/testsuite/gdb.threads/thread_check.exp
+++ b/gdb/testsuite/gdb.threads/thread_check.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2004-2024 Free Software Foundation, Inc.
+# Copyright (C) 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,16 +15,16 @@
# This file was written by Manoj Iyer. (manjo@austin.ibm.com)
# Test break points and single step on thread functions.
-#
+#
# Test Purpose:
-# - Test that breakpoints, continue in a threaded application works.
+# - Test that breakpoints, continue in a threaded application works.
# On powerpc64-unknown-linux-gnu system, running kernel version
# 2.6.5-7.71-pseries64 this test is known to fail due to kernel bug
# in ptrace system call.
#
# Test Strategy:
# - thread_check.c creates 2 threads
-# - start gdb
+# - start gdb
# - create 2 breakpoints #1 main() #2 tf() (the thread function)
# - run gdb till #1 main() breakpoint is reached
# - continue to breakpoint #2 tf()
@@ -39,7 +39,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return 1
@@ -62,7 +62,7 @@ gdb_test "continue" \
".*Breakpoint 2,.*tf.*at.*$srcfile:.*" \
"continue to tf"
-#
+#
# backtrace from thread function.
#
gdb_test "backtrace" \
diff --git a/gdb/testsuite/gdb.threads/thread_events.c b/gdb/testsuite/gdb.threads/thread_events.c
index 598633b..d7a6c09 100644
--- a/gdb/testsuite/gdb.threads/thread_events.c
+++ b/gdb/testsuite/gdb.threads/thread_events.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2007-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/thread_events.exp b/gdb/testsuite/gdb.threads/thread_events.exp
index ca51abe..91539e0 100644
--- a/gdb/testsuite/gdb.threads/thread_events.exp
+++ b/gdb/testsuite/gdb.threads/thread_events.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2024 Free Software Foundation, Inc.
+# Copyright (C) 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/threadapply.c b/gdb/testsuite/gdb.threads/threadapply.c
index d21974d..5dccaa4 100644
--- a/gdb/testsuite/gdb.threads/threadapply.c
+++ b/gdb/testsuite/gdb.threads/threadapply.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/threadapply.exp b/gdb/testsuite/gdb.threads/threadapply.exp
index df72909..de264b6 100644
--- a/gdb/testsuite/gdb.threads/threadapply.exp
+++ b/gdb/testsuite/gdb.threads/threadapply.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
#
# Run to `main' where we begin our tests.
@@ -60,7 +60,7 @@ gdb_test "thread apply all backthread" "Thread ..*\\\$\[0-9]+ = 0x14.*Thread ..*
# Go into the thread_function to check that a simple "thread apply"
# does not change the selected frame.
gdb_test "step" "thread_function.*" "step to the thread_function"
-gdb_test "up" ".*in main.*" "go up in the stack frame"
+gdb_test "up" ".*in main.*" "go up in the stack frame"
gdb_test "thread apply all print 1" "Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1" "run a simple print command on all threads"
gdb_test "down" "#0.*thread_function.*" "go down and check selected frame"
@@ -73,9 +73,9 @@ proc thr_apply_detach {thread_set} {
global binfile
global break_line
- clean_restart ${binfile}
+ clean_restart ${::testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -104,7 +104,7 @@ proc kill_and_remove_inferior {thread_set} {
# The test starts multiple inferiors, therefore non-extended
# remote is not supported.
- if [use_gdb_stub] {
+ if {[use_gdb_stub]} {
unsupported "using gdb stub"
return
}
@@ -112,7 +112,7 @@ proc kill_and_remove_inferior {thread_set} {
set any "\[^\r\n\]*"
set ws "\[ \t\]\+"
- clean_restart ${binfile}
+ clean_restart ${::testfile}
with_test_prefix "start inferior 1" {
runto_main
@@ -224,6 +224,8 @@ proc kill_and_remove_inferior {thread_set} {
# Test both "all" and a thread list, because those are implemented as
# different commands in GDB.
-foreach_with_prefix thread_set {"all" "1.1"} {
- kill_and_remove_inferior $thread_set
+if {[allow_multi_inferior_tests]} {
+ foreach_with_prefix thread_set {"all" "1.1"} {
+ kill_and_remove_inferior $thread_set
+ }
}
diff --git a/gdb/testsuite/gdb.threads/threadcrash.c b/gdb/testsuite/gdb.threads/threadcrash.c
index e476ae7..4109340 100644
--- a/gdb/testsuite/gdb.threads/threadcrash.c
+++ b/gdb/testsuite/gdb.threads/threadcrash.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/threadcrash.exp b/gdb/testsuite/gdb.threads/threadcrash.exp
index 6da7073..d57f437 100644
--- a/gdb/testsuite/gdb.threads/threadcrash.exp
+++ b/gdb/testsuite/gdb.threads/threadcrash.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2023 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -132,8 +132,9 @@ proc do_full_test {} {
set pthread_kill ".*"
}
- for {set i 0} {$i < $thread_count } {incr i} {
- set thread_num [expr [llength $test_list] - $i]
+ set loop_iterations [llength $test_list]
+ for {set i 0} {$i < $loop_iterations } {incr i} {
+ set thread_num [expr {$loop_iterations - $i}]
set type [lindex $test_list $i]
if { $type == 1 } {
@@ -237,7 +238,7 @@ proc_with_prefix test_corefile {} {
proc_with_prefix test_gcore {} {
- clean_restart "$::binfile"
+ clean_restart "$::testfile"
gdb_test "handle SIGUSR1 nostop print pass" \
".*SIGUSR1.*No.*Yes.*Yes.*User defined signal 1" \
@@ -270,12 +271,12 @@ proc_with_prefix test_gcore {} {
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile $srcfile \
- {debug pthreads}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
+ {debug pthreads}]} {
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test_no_output "set backtrace limit unlimited"
diff --git a/gdb/testsuite/gdb.threads/threads-after-exec.c b/gdb/testsuite/gdb.threads/threads-after-exec.c
index 1278e48..feb44d3 100644
--- a/gdb/testsuite/gdb.threads/threads-after-exec.c
+++ b/gdb/testsuite/gdb.threads/threads-after-exec.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/threads-after-exec.exp b/gdb/testsuite/gdb.threads/threads-after-exec.exp
index 32aec6b..a6a3fb7 100644
--- a/gdb/testsuite/gdb.threads/threads-after-exec.exp
+++ b/gdb/testsuite/gdb.threads/threads-after-exec.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,11 +19,11 @@
standard_testfile .c
proc do_test { } {
- if [prepare_for_testing "failed to prepare" $::testfile $::srcfile {debug pthreads}] {
+ if {[prepare_for_testing "failed to prepare" $::testfile $::srcfile {debug pthreads}]} {
return -1
}
- if ![runto_main] {
+ if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.threads/threxit-hop-specific.c b/gdb/testsuite/gdb.threads/threxit-hop-specific.c
index 1cbb1d2..afc887a 100644
--- a/gdb/testsuite/gdb.threads/threxit-hop-specific.c
+++ b/gdb/testsuite/gdb.threads/threxit-hop-specific.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/threxit-hop-specific.exp b/gdb/testsuite/gdb.threads/threxit-hop-specific.exp
index fc6a787..b55e80c 100644
--- a/gdb/testsuite/gdb.threads/threxit-hop-specific.exp
+++ b/gdb/testsuite/gdb.threads/threxit-hop-specific.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2024 Free Software Foundation, Inc.
+# Copyright (C) 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto_main
diff --git a/gdb/testsuite/gdb.threads/tid-reuse.c b/gdb/testsuite/gdb.threads/tid-reuse.c
index e8fb778..041a285 100644
--- a/gdb/testsuite/gdb.threads/tid-reuse.c
+++ b/gdb/testsuite/gdb.threads/tid-reuse.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/tid-reuse.exp b/gdb/testsuite/gdb.threads/tid-reuse.exp
index f89185c..ca5edc1 100644
--- a/gdb/testsuite/gdb.threads/tid-reuse.exp
+++ b/gdb/testsuite/gdb.threads/tid-reuse.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile { debug pthreads
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -72,6 +72,6 @@ delete_breakpoints
gdb_breakpoint "after_reuse_time"
# Higher than what the test program sleeps before exiting.
-set timeout [expr $reuse_time * 2]
+set timeout [expr {$reuse_time * 2}]
gdb_continue_to_breakpoint "after_reuse_time"
diff --git a/gdb/testsuite/gdb.threads/tls-core.c b/gdb/testsuite/gdb.threads/tls-core.c
index a645575..b748369 100644
--- a/gdb/testsuite/gdb.threads/tls-core.c
+++ b/gdb/testsuite/gdb.threads/tls-core.c
@@ -1,6 +1,6 @@
/* This test is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/tls-core.exp b/gdb/testsuite/gdb.threads/tls-core.exp
index 32433f5..587ae61 100644
--- a/gdb/testsuite/gdb.threads/tls-core.exp
+++ b/gdb/testsuite/gdb.threads/tls-core.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ set core_supported [expr {$corefile != ""}]
# Generate a core file with "gcore".
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto thread_proc
@@ -43,7 +43,7 @@ proc tls_core_test {supported corefile} {
upvar host_triplet host_triplet
upvar binfile binfile
- clean_restart ${binfile}
+ clean_restart ${::testfile}
set test "load core file"
if {$supported} {
diff --git a/gdb/testsuite/gdb.threads/tls-nodebug-pie.c b/gdb/testsuite/gdb.threads/tls-nodebug-pie.c
index 4dac62e..c86a95a 100644
--- a/gdb/testsuite/gdb.threads/tls-nodebug-pie.c
+++ b/gdb/testsuite/gdb.threads/tls-nodebug-pie.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/tls-nodebug-pie.exp b/gdb/testsuite/gdb.threads/tls-nodebug-pie.exp
index c5a7f66..44c12f5 100644
--- a/gdb/testsuite/gdb.threads/tls-nodebug-pie.exp
+++ b/gdb/testsuite/gdb.threads/tls-nodebug-pie.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.threads/tls-nodebug.exp b/gdb/testsuite/gdb.threads/tls-nodebug.exp
index c78623d..971f26c 100644
--- a/gdb/testsuite/gdb.threads/tls-nodebug.exp
+++ b/gdb/testsuite/gdb.threads/tls-nodebug.exp
@@ -1,5 +1,5 @@
# tls.exp -- Expect script to test thread-local storage without debuginfo
-# Copyright (C) 2006-2024 Free Software Foundation, Inc.
+# Copyright (C) 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
index c48923f..9287f16 100644
--- a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c b/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
index 8178f5c..201697b 100644
--- a/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2006-2024 Free Software Foundation, Inc.
+ Copyright 2006-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug.exp b/gdb/testsuite/gdb.threads/tls-sepdebug.exp
index 4a322e0..fb684c9 100644
--- a/gdb/testsuite/gdb.threads/tls-sepdebug.exp
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug.exp
@@ -1,4 +1,4 @@
-# Copyright 2006-2024 Free Software Foundation, Inc.
+# Copyright 2006-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -83,7 +83,7 @@ foreach library_path [list $absdir [relative_filename [pwd] $absdir]] \
gdb_load ${binmainfile}
- if ![runto_main] {
+ if {![runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.threads/tls-shared.exp b/gdb/testsuite/gdb.threads/tls-shared.exp
index 9d39686..66dd52f 100644
--- a/gdb/testsuite/gdb.threads/tls-shared.exp
+++ b/gdb/testsuite/gdb.threads/tls-shared.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if { [gdb_compile_shlib_pthreads ${srcdir}/${subdir}/${srcfile_lib} ${binfile_li
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_load_shlib ${binfile_lib}
if {![runto_main]} {
@@ -52,6 +52,6 @@ gdb_test "break $line_number" \
gdb_test "continue" \
"main .* at .*:.*return 0.*break here to check result.*" \
"continue to break"
-# This is more of a gcc/glibc test, really.
+# This is more of a gcc/glibc test, really.
#
gdb_test "print result" "3"
diff --git a/gdb/testsuite/gdb.threads/tls-so_extern.c b/gdb/testsuite/gdb.threads/tls-so_extern.c
index be1cf59..cc7af64 100644
--- a/gdb/testsuite/gdb.threads/tls-so_extern.c
+++ b/gdb/testsuite/gdb.threads/tls-so_extern.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/tls-so_extern.exp b/gdb/testsuite/gdb.threads/tls-so_extern.exp
index 6bc5572..a0aa5f8 100644
--- a/gdb/testsuite/gdb.threads/tls-so_extern.exp
+++ b/gdb/testsuite/gdb.threads/tls-so_extern.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ if { [gdb_compile_shlib_pthreads ${srcdir}/${subdir}/${srcfile_lib} ${binfile_li
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_load_shlib ${binfile_lib}
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.threads/tls-so_extern_main.c b/gdb/testsuite/gdb.threads/tls-so_extern_main.c
index 3dc806f..9829d7a 100644
--- a/gdb/testsuite/gdb.threads/tls-so_extern_main.c
+++ b/gdb/testsuite/gdb.threads/tls-so_extern_main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/tls-var-main.c b/gdb/testsuite/gdb.threads/tls-var-main.c
index ef744b7..9b8f057 100644
--- a/gdb/testsuite/gdb.threads/tls-var-main.c
+++ b/gdb/testsuite/gdb.threads/tls-var-main.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/tls-var.c b/gdb/testsuite/gdb.threads/tls-var.c
index 448135e..5be9be9 100644
--- a/gdb/testsuite/gdb.threads/tls-var.c
+++ b/gdb/testsuite/gdb.threads/tls-var.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/tls-var.exp b/gdb/testsuite/gdb.threads/tls-var.exp
index cd56dcd..8d8b82e 100644
--- a/gdb/testsuite/gdb.threads/tls-var.exp
+++ b/gdb/testsuite/gdb.threads/tls-var.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${objfile} object {debug}] != "
clean_restart ${executable}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.threads/tls.exp b/gdb/testsuite/gdb.threads/tls.exp
index c6fdb6f..3dbc802 100644
--- a/gdb/testsuite/gdb.threads/tls.exp
+++ b/gdb/testsuite/gdb.threads/tls.exp
@@ -1,5 +1,5 @@
# tls.exp -- Expect script to test thread-local storage
-# Copyright (C) 1992-2024 Free Software Foundation, Inc.
+# Copyright (C) 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -56,7 +56,7 @@ proc get_me_variable {tnum} {
fail "$tnum thread print me"
}
timeout {
- fail "$tnum thread print me (timeout)"
+ fail "$tnum thread print me (timeout)"
}
}
return ${value_of_me}
@@ -116,8 +116,8 @@ proc select_thread {thread} {
### Do a backtrace for the current thread, and check that the 'spin' routine
### is in it. This means we have one of the threads we created, rather
-### than the main thread. Record the thread in the spin_threads
-### array. Also remember the level of the 'spin' routine in the backtrace, for
+### than the main thread. Record the thread in the spin_threads
+### array. Also remember the level of the 'spin' routine in the backtrace, for
### later use.
proc check_thread_stack {number spin_threads spin_threads_level} {
global gdb_prompt
@@ -148,18 +148,18 @@ proc check_thread_stack {number spin_threads spin_threads_level} {
pass "backtrace of thread number $number not relevant"
}
timeout {
- fail "backtrace of thread number $number (timeout)"
+ fail "backtrace of thread number $number (timeout)"
}
}
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test_multiple "print a_thread_local" "" {
-re -wrap "Cannot find thread-local variables on this target" {
kfail "gdb/25807" $gdb_test_name
}
- -re -wrap "Cannot read .a_thread_local. without registers" {
+ -re -wrap "Cannot (?:read|find address of TLS symbol) .a_thread_local. without registers" {
pass $gdb_test_name
}
}
@@ -169,7 +169,7 @@ if {![runto_main]} {
}
# Set a breakpoint at the "spin" routine to
-# test the thread local's value.
+# test the thread local's value.
#
gdb_test "b [gdb_get_line_number "here we know tls value"]" \
".*Breakpoint 2.*tls.*" "set breakpoint at all threads"
@@ -247,7 +247,7 @@ array set spin_threads_level {}
unset spin_threads_level
# For each thread check its backtrace to see if it is stopped at the
-# spin routine.
+# spin routine.
for {set i 1} {$i <= $no_of_threads} {incr i} {
check_thread_stack $i spin_threads spin_threads_level
}
@@ -268,7 +268,7 @@ foreach i [array names spin_threads] {
# any intermediate point in spin, too, but that is much less
# likely.
gdb_test "up $level" ".*spin.*sem_(wait|post).*" "thread $i up"
- check_thread_local $i
+ check_thread_local $i
}
}
@@ -278,7 +278,7 @@ if {$thrs_in_spin == 0} {
gdb_test "continue" ".*Breakpoint 4.*before exit.*" "threads exited"
-send_gdb "info thread\n"
+send_gdb "info thread\n"
gdb_expect {
-re ".* 1 *${tdlabel_re}.*2 *${tdlabel_re}.*$gdb_prompt $" {
fail "too many threads left at end"
diff --git a/gdb/testsuite/gdb.threads/tls2.c b/gdb/testsuite/gdb.threads/tls2.c
index f4d7177..4d1b685 100644
--- a/gdb/testsuite/gdb.threads/tls2.c
+++ b/gdb/testsuite/gdb.threads/tls2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008-2024 Free Software Foundation, Inc.
+ Copyright 2008-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/vfork-follow-child-exec.c b/gdb/testsuite/gdb.threads/vfork-follow-child-exec.c
index 7340073..9bad522 100644
--- a/gdb/testsuite/gdb.threads/vfork-follow-child-exec.c
+++ b/gdb/testsuite/gdb.threads/vfork-follow-child-exec.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/vfork-follow-child-exec.exp b/gdb/testsuite/gdb.threads/vfork-follow-child-exec.exp
index 9c47308..7c2b309 100644
--- a/gdb/testsuite/gdb.threads/vfork-follow-child-exec.exp
+++ b/gdb/testsuite/gdb.threads/vfork-follow-child-exec.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2024 Free Software Foundation, Inc.
+# Copyright (C) 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,6 +16,8 @@
# Test following a vfork child that execs, when the vfork parent is a
# threaded program, and it's a non-main thread that vforks.
+require allow_fork_tests
+
standard_testfile
if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}]} {
@@ -28,7 +30,7 @@ if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}]}
proc test_vfork {detach} {
global binfile
- clean_restart $binfile
+ clean_restart $::testfile
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.threads/vfork-follow-child-exit.c b/gdb/testsuite/gdb.threads/vfork-follow-child-exit.c
index fce9b92..ad972a1 100644
--- a/gdb/testsuite/gdb.threads/vfork-follow-child-exit.c
+++ b/gdb/testsuite/gdb.threads/vfork-follow-child-exit.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2019-2024 Free Software Foundation, Inc.
+ Copyright 2019-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/vfork-follow-child-exit.exp b/gdb/testsuite/gdb.threads/vfork-follow-child-exit.exp
index e593b6c..a5e7475 100644
--- a/gdb/testsuite/gdb.threads/vfork-follow-child-exit.exp
+++ b/gdb/testsuite/gdb.threads/vfork-follow-child-exit.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2024 Free Software Foundation, Inc.
+# Copyright (C) 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,6 +16,8 @@
# Test following a vfork child that exits, when the vfork parent is a
# threaded program, and it's a non-main thread that vforks.
+require allow_fork_tests
+
standard_testfile
if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}]} {
@@ -28,7 +30,7 @@ if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}]}
proc test_vfork {detach} {
global binfile
- clean_restart $binfile
+ clean_restart $::testfile
if {![runto_main]} {
return 0
diff --git a/gdb/testsuite/gdb.threads/vfork-multi-inferior-sleep.c b/gdb/testsuite/gdb.threads/vfork-multi-inferior-sleep.c
index c416e99..58e5c3f 100644
--- a/gdb/testsuite/gdb.threads/vfork-multi-inferior-sleep.c
+++ b/gdb/testsuite/gdb.threads/vfork-multi-inferior-sleep.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/vfork-multi-inferior.c b/gdb/testsuite/gdb.threads/vfork-multi-inferior.c
index ae0aab0..e62f1ec 100644
--- a/gdb/testsuite/gdb.threads/vfork-multi-inferior.c
+++ b/gdb/testsuite/gdb.threads/vfork-multi-inferior.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/vfork-multi-inferior.exp b/gdb/testsuite/gdb.threads/vfork-multi-inferior.exp
index 4b45ee8..1f87427 100644
--- a/gdb/testsuite/gdb.threads/vfork-multi-inferior.exp
+++ b/gdb/testsuite/gdb.threads/vfork-multi-inferior.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,6 +25,10 @@
# To catch the bug, this test verifies that we can hit a breakpoint after a
# vfork call, while a second inferior runs in the background.
+require allow_fork_tests
+
+require allow_multi_inferior_tests
+
require !use_gdb_stub
standard_testfile .c -sleep.c
diff --git a/gdb/testsuite/gdb.threads/vfork-multi-thread.c b/gdb/testsuite/gdb.threads/vfork-multi-thread.c
index 0818868..0bc8575 100644
--- a/gdb/testsuite/gdb.threads/vfork-multi-thread.c
+++ b/gdb/testsuite/gdb.threads/vfork-multi-thread.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2022-2024 Free Software Foundation, Inc.
+ Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/vfork-multi-thread.exp b/gdb/testsuite/gdb.threads/vfork-multi-thread.exp
index 59e0298..fce974b 100644
--- a/gdb/testsuite/gdb.threads/vfork-multi-thread.exp
+++ b/gdb/testsuite/gdb.threads/vfork-multi-thread.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,6 +30,8 @@
# breakpoints are removed, so the main thread would miss the breakpoint and run
# until exit.
+require allow_fork_tests
+
standard_testfile
if { [build_executable "failed to prepare" ${testfile} ${srcfile} {debug pthreads}] } {
@@ -57,7 +59,7 @@ proc do_test { target-non-stop non-stop follow-fork-mode detach-on-fork schedule
save_vars { ::GDBFLAGS } {
append ::GDBFLAGS " -ex \"maintenance set target-non-stop ${target-non-stop}\""
append ::GDBFLAGS " -ex \"set non-stop ${non-stop}\""
- clean_restart ${::binfile}
+ clean_restart ${::testfile}
}
gdb_test_no_output "set follow-fork-mode ${follow-fork-mode}"
diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-child.c b/gdb/testsuite/gdb.threads/watchpoint-fork-child.c
index 8562b42..0fa3686 100644
--- a/gdb/testsuite/gdb.threads/watchpoint-fork-child.c
+++ b/gdb/testsuite/gdb.threads/watchpoint-fork-child.c
@@ -1,6 +1,6 @@
/* Test case for forgotten hw-watchpoints after fork()-off of a process.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c b/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c
index eb65d45..0919b95 100644
--- a/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c
+++ b/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c
@@ -1,6 +1,6 @@
/* Test case for forgotten hw-watchpoints after fork()-off of a process.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-parent.c b/gdb/testsuite/gdb.threads/watchpoint-fork-parent.c
index 02c2c11..229d775 100644
--- a/gdb/testsuite/gdb.threads/watchpoint-fork-parent.c
+++ b/gdb/testsuite/gdb.threads/watchpoint-fork-parent.c
@@ -1,6 +1,6 @@
/* Test case for forgotten hw-watchpoints after fork()-off of a process.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-st.c b/gdb/testsuite/gdb.threads/watchpoint-fork-st.c
index 42d2192..5438503 100644
--- a/gdb/testsuite/gdb.threads/watchpoint-fork-st.c
+++ b/gdb/testsuite/gdb.threads/watchpoint-fork-st.c
@@ -1,6 +1,6 @@
/* Test case for forgotten hw-watchpoints after fork()-off of a process.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork.exp b/gdb/testsuite/gdb.threads/watchpoint-fork.exp
index b9f21b5..68fc99e 100644
--- a/gdb/testsuite/gdb.threads/watchpoint-fork.exp
+++ b/gdb/testsuite/gdb.threads/watchpoint-fork.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,6 +21,8 @@
# must be done before starting the test so as to not disrupt the execution
# of the actual test.
+require allow_fork_tests
+
set allow_hw_watchpoint_tests_p [allow_hw_watchpoint_tests]
set testfile watchpoint-fork
@@ -67,7 +69,7 @@ proc test {type symbol} {
# Testcase uses it for the `follow-fork-mode child' type.
gdb_test "handle SIGUSR1 nostop noprint pass" "No\[ \t\]+No\[ \t\]+Yes.*"
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -124,7 +126,7 @@ proc test {type symbol} {
# Testcase uses it for the `follow-fork-mode child' type.
gdb_test "handle SIGUSR1 nostop noprint pass" "No\[ \t\]+No\[ \t\]+Yes.*"
- if ![runto_main] {
+ if {![runto_main]} {
return
}
@@ -163,7 +165,7 @@ proc test {type symbol} {
test parent FOLLOW_PARENT
# Only GNU/Linux is known to support `set follow-fork-mode child'.
-if [istarget "*-*-linux*"] {
+if {[istarget "*-*-linux*"]} {
test child FOLLOW_CHILD
} else {
untested "${testfile}: child"
diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork.h b/gdb/testsuite/gdb.threads/watchpoint-fork.h
index b46db7f..50cf36c 100644
--- a/gdb/testsuite/gdb.threads/watchpoint-fork.h
+++ b/gdb/testsuite/gdb.threads/watchpoint-fork.h
@@ -1,6 +1,6 @@
/* Test case for forgotten hw-watchpoints after fork()-off of a process.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.c b/gdb/testsuite/gdb.threads/watchthreads-reorder.c
index 056d38e..82ab14d 100644
--- a/gdb/testsuite/gdb.threads/watchthreads-reorder.c
+++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
index 00e532b..067986a 100644
--- a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ foreach reorder {0 1} { with_test_prefix "reorder$reorder" {
gdb_test "set can-use-hw-watchpoints 1"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -72,7 +72,7 @@ foreach reorder {0 1} { with_test_prefix "reorder$reorder" {
"Hardware read watchpoint \[0-9\]+: thread\[12\]_rwatch\r\n\r\nValue = 0\r\n0x\[0-9a-f\]+ in thread\[12\]_func .*" \
"continue a"
- if $reorder {
+ if {$reorder} {
# GDB orders watchpoints by their addresses so inserting new variables
# with lower addresses will shift the former watchpoints to higher
# debug registers.
diff --git a/gdb/testsuite/gdb.threads/watchthreads.c b/gdb/testsuite/gdb.threads/watchthreads.c
index 2b0bdbc..0c2877d 100644
--- a/gdb/testsuite/gdb.threads/watchthreads.c
+++ b/gdb/testsuite/gdb.threads/watchthreads.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/watchthreads.exp b/gdb/testsuite/gdb.threads/watchthreads.exp
index 3adec13..e2d629d 100644
--- a/gdb/testsuite/gdb.threads/watchthreads.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
gdb_test_no_output "set can-use-hw-watchpoints 1" ""
#
@@ -67,11 +67,11 @@ for {set i 0} {$i < 30} {incr i} {
# At least one hardware watchpoint was hit. Check if both were.
set string $expect_out(1,string)
- if [regexp "Hardware watchpoint 2: args\\\[0\\\]\[^\r\]*\r\[^\r\]*\r\[^\r\]*Old value = $args_0\[^\r\]*\r\[^\r\]*New value = [expr $args_0+1]\r" $string] {
+ if {[regexp "Hardware watchpoint 2: args\\\[0\\\]\[^\r\]*\r\[^\r\]*\r\[^\r\]*Old value = $args_0\[^\r\]*\r\[^\r\]*New value = [expr {$args_0+1}]\r" $string]} {
incr args_0
incr test_flag_0
}
- if [regexp "Hardware watchpoint 3: args\\\[1\\\]\[^\r\]*\r\[^\r\]*\r\[^\r\]*Old value = $args_1\[^\r\]*\r\[^\r\]*New value = [expr $args_1+1]\r" $string] {
+ if {[regexp "Hardware watchpoint 3: args\\\[1\\\]\[^\r\]*\r\[^\r\]*\r\[^\r\]*Old value = $args_1\[^\r\]*\r\[^\r\]*New value = [expr {$args_1+1}]\r" $string]} {
incr args_1
incr test_flag_1
}
@@ -97,7 +97,7 @@ for {set i 0} {$i < 30} {incr i} {
}
}
- if [ regexp "$expected_loc" $string ] {
+ if {[ regexp "$expected_loc" $string ]} {
set test_flag 1
} else {
fail "threaded watch loop"
@@ -140,23 +140,23 @@ if { $test_flag == 1 } {
# Verify that we hit first watchpoint in main thread.
set message "first watchpoint on args\[0\] hit"
if { $args_0 > 0 } {
- pass $message
+ pass $message
} else {
- fail $message
+ fail $message
}
# Verify that we hit second watchpoint in main thread.
set message "first watchpoint on args\[1\] hit"
if { $args_1 > 0 } {
- pass $message
+ pass $message
} else {
- fail $message
+ fail $message
}
# Verify that we hit first watchpoint in child thread.
set message "watchpoint on args\[0\] hit in thread"
if { $args_0 > 1 } {
- pass $message
+ pass $message
} else {
fail $message
}
@@ -164,9 +164,9 @@ if { $args_0 > 1 } {
# Verify that we hit second watchpoint in child thread.
set message "watchpoint on args\[1\] hit in thread"
if { $args_1 > 1 } {
- pass $message
+ pass $message
} else {
- fail $message
+ fail $message
}
# Verify that all watchpoint hits are accounted for.
@@ -174,12 +174,12 @@ set message "combination of threaded watchpoints = 30"
if { [target_no_stopped_data] } {
# See above. If we allow two watchpoints to be hit at once, we
# may have more than 30 hits total.
- set result [expr $args_0 + $args_1 >= 30]
+ set result [expr {$args_0 + $args_1 >= 30}]
} else {
- set result [expr $args_0 + $args_1 == 30]
+ set result [expr {$args_0 + $args_1 == 30}]
}
if { $result } {
- pass $message
+ pass $message
} else {
- fail $message
+ fail $message
}
diff --git a/gdb/testsuite/gdb.threads/watchthreads2.c b/gdb/testsuite/gdb.threads/watchthreads2.c
index dddad19..ee67566 100644
--- a/gdb/testsuite/gdb.threads/watchthreads2.c
+++ b/gdb/testsuite/gdb.threads/watchthreads2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/watchthreads2.exp b/gdb/testsuite/gdb.threads/watchthreads2.exp
index ee97bfe..a31c1a7 100644
--- a/gdb/testsuite/gdb.threads/watchthreads2.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads2.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test_no_output "set can-use-hw-watchpoints 1" ""
@@ -89,7 +89,7 @@ set x_thread_loc "thread_function \\\(arg=.*\\\) at .*watchthreads.c:$x_inc_line
# X is incremented under a mutex, so we should get NR_THREADS * X_INCR_COUNT
# hits.
-set limit [expr $NR_THREADS*$X_INCR_COUNT]
+set limit [expr {$NR_THREADS*$X_INCR_COUNT}]
set x_count 0
set done 0
@@ -102,7 +102,7 @@ for {set i 0} {!$done && $i < $limit} {incr i} {
-re "(.*Hardware watchpoint.*)$gdb_prompt $" {
set string $expect_out(1,string)
- if [regexp "Hardware watchpoint 3: x\[^\r\]*\r\[^\r\]*\r\[^\r\]*Old value = $x_count\[^\r\]*\r\[^\r\]*New value = [expr $x_count+1]\r" $string] {
+ if {[regexp "Hardware watchpoint 3: x\[^\r\]*\r\[^\r\]*\r\[^\r\]*Old value = $x_count\[^\r\]*\r\[^\r\]*New value = [expr {$x_count+1}]\r" $string]} {
incr x_count
set test_flag 1
} else {
diff --git a/gdb/testsuite/gdb.threads/wp-replication.c b/gdb/testsuite/gdb.threads/wp-replication.c
index 0629a7e..d37d3e0 100644
--- a/gdb/testsuite/gdb.threads/wp-replication.c
+++ b/gdb/testsuite/gdb.threads/wp-replication.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.threads/wp-replication.exp b/gdb/testsuite/gdb.threads/wp-replication.exp
index b73c6c5..1b63d57 100644
--- a/gdb/testsuite/gdb.threads/wp-replication.exp
+++ b/gdb/testsuite/gdb.threads/wp-replication.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
# Force hardware watchpoints to be used.
gdb_test_no_output "set can-use-hw-watchpoints 1" ""
@@ -126,7 +126,7 @@ gdb_test_no_output "set var test_ready=1" \
"set var test_ready=1"
# Set the number of expected watchpoint triggers.
-set TRIGGERS [expr "$NR_THREADS * $hwatch_count * $NR_TRIGGERS_PER_THREAD"]
+set TRIGGERS [expr {$NR_THREADS * $hwatch_count * $NR_TRIGGERS_PER_THREAD}]
# Move the threads and hit the watchpoints TRIGGERS times.
for { set i 1 } { $i <= $TRIGGERS } { incr i } {
diff --git a/gdb/testsuite/gdb.trace/actions-changed.c b/gdb/testsuite/gdb.trace/actions-changed.c
index aafecc0..2d9c5b9 100644
--- a/gdb/testsuite/gdb.trace/actions-changed.c
+++ b/gdb/testsuite/gdb.trace/actions-changed.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/actions-changed.exp b/gdb/testsuite/gdb.trace/actions-changed.exp
index b636f59..ef5acba 100644
--- a/gdb/testsuite/gdb.trace/actions-changed.exp
+++ b/gdb/testsuite/gdb.trace/actions-changed.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -161,11 +161,11 @@ proc test_actions_changed { } {
clean_restart $testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "current target does not support trace"
return -1
}
diff --git a/gdb/testsuite/gdb.trace/actions.c b/gdb/testsuite/gdb.trace/actions.c
index 56906b6..0ecae59 100644
--- a/gdb/testsuite/gdb.trace/actions.c
+++ b/gdb/testsuite/gdb.trace/actions.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1998-2024 Free Software Foundation, Inc.
+ Copyright 1998-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/actions.exp b/gdb/testsuite/gdb.trace/actions.exp
index 9455103..89db2a6 100644
--- a/gdb/testsuite/gdb.trace/actions.exp
+++ b/gdb/testsuite/gdb.trace/actions.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ if {$baseline == -1} {
return
}
-set testline1 [expr $baseline + 7]
+set testline1 [expr {$baseline + 7}]
#
# test actions command
@@ -165,8 +165,8 @@ gdb_test_multiple "info tracepoints" "5.5c: verify NO actions for first tracepoi
# 5.6 actions for invalid tracepoint number
-gdb_test "actions [expr $trcpt2 + $trcpt3]" \
- "No tracepoint number [expr $trcpt2 + $trcpt3]." \
+gdb_test "actions [expr {$trcpt2 + $trcpt3}]" \
+ "No tracepoint number [expr {$trcpt2 + $trcpt3}]." \
"5.6: actions for invalid tracepoint number"
# 5.7 invalid action (other than 'collect', 'while-stepping' or 'end')
@@ -245,7 +245,7 @@ if {[gdb_test "" "Breakpoint .*" "run to main"] != 0} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
diff --git a/gdb/testsuite/gdb.trace/ax.exp b/gdb/testsuite/gdb.trace/ax.exp
index 24f4fcd..cc40853 100644
--- a/gdb/testsuite/gdb.trace/ax.exp
+++ b/gdb/testsuite/gdb.trace/ax.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
return -1
}
-clean_restart $binfile
+clean_restart $testfile
runto_main
gdb_test "maint agent 12" ".*const8 12.*pop.*end.*"
diff --git a/gdb/testsuite/gdb.trace/backtrace.exp b/gdb/testsuite/gdb.trace/backtrace.exp
index 4f1b856..7707edb 100644
--- a/gdb/testsuite/gdb.trace/backtrace.exp
+++ b/gdb/testsuite/gdb.trace/backtrace.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,12 +23,12 @@ set expfile $testfile.exp
require gdb_trace_common_supports_arch
-if [prepare_for_testing "failed to prepare" $executable $srcfile \
- [list debug nowarnings nopie]] {
+if {[prepare_for_testing "failed to prepare" $executable $srcfile \
+ [list debug nowarnings nopie]]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -155,13 +155,13 @@ gdb_test_no_output "tstop" ""
proc gdb_backtrace_tdp_1 { msg } {
global gdb_prompt
-
+
# We are in a trace frame at which we didn't collect anything
# except $PC. Therefore we expect to be able to identify stack
# frame #0, but that's about all. In particular we do not expect
# to be able to display the function's arguments or locals, and we
# do not expect to be able to identify the caller of this function.
-
+
gdb_test "backtrace" \
"#0\[\t \]+gdb_recursion_test.*depth=.*" \
"$msg"
diff --git a/gdb/testsuite/gdb.trace/basic-libipa.c b/gdb/testsuite/gdb.trace/basic-libipa.c
index bbcfb01..9369dd4 100644
--- a/gdb/testsuite/gdb.trace/basic-libipa.c
+++ b/gdb/testsuite/gdb.trace/basic-libipa.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2024 Free Software Foundation, Inc.
+ Copyright 2024-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/basic-libipa.exp b/gdb/testsuite/gdb.trace/basic-libipa.exp
index 0da94af..27be96b 100644
--- a/gdb/testsuite/gdb.trace/basic-libipa.exp
+++ b/gdb/testsuite/gdb.trace/basic-libipa.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -42,7 +42,7 @@ save_vars { env(ASAN_OPTIONS) } {
# LD_PRELOAD.
append_environment_default ASAN_OPTIONS verify_asan_link_order 0
- clean_restart $binfile
+ clean_restart $testfile
}
if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.trace/change-loc-1.c b/gdb/testsuite/gdb.trace/change-loc-1.c
index 06f9cde..2d69173 100644
--- a/gdb/testsuite/gdb.trace/change-loc-1.c
+++ b/gdb/testsuite/gdb.trace/change-loc-1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/change-loc-2.c b/gdb/testsuite/gdb.trace/change-loc-2.c
index 3f88978..ea6a79f 100644
--- a/gdb/testsuite/gdb.trace/change-loc-2.c
+++ b/gdb/testsuite/gdb.trace/change-loc-2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/change-loc.c b/gdb/testsuite/gdb.trace/change-loc.c
index 0598000..92bdc2d 100644
--- a/gdb/testsuite/gdb.trace/change-loc.c
+++ b/gdb/testsuite/gdb.trace/change-loc.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp
index a01cb712..12b862c 100644
--- a/gdb/testsuite/gdb.trace/change-loc.exp
+++ b/gdb/testsuite/gdb.trace/change-loc.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -44,7 +44,7 @@ clean_restart $executable
gdb_load_shlib $lib_sl1
gdb_load_shlib $lib_sl2
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -64,7 +64,7 @@ proc tracepoint_change_loc_1 { trace_type } {
global gdb_prompt
clean_restart ${testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
gdb_test_no_output "delete break 1"
@@ -88,7 +88,7 @@ proc tracepoint_change_loc_1 { trace_type } {
set test "set tracepoint on set_tracepoint"
gdb_test_multiple "${trace_type} set_tracepoint" $test {
-re "Target returns error code .* too far .*$gdb_prompt $" {
- if [string equal $trace_type "ftrace"] {
+ if {[string equal $trace_type "ftrace"]} {
# The target was unable to install the fast tracepoint
# (e.g., jump pad too far from tracepoint).
pass "$test (too far)"
@@ -113,7 +113,7 @@ proc tracepoint_change_loc_1 { trace_type } {
set test "continue to marker 2"
gdb_test_multiple "continue" $test {
-re "Target returns error code .* too far .*$gdb_prompt $" {
- if [string equal $trace_type "ftrace"] {
+ if {[string equal $trace_type "ftrace"]} {
# Expected if the target was unable to install the
# fast tracepoint (e.g., jump pad too far from
# tracepoint).
@@ -230,7 +230,7 @@ proc tracepoint_change_loc_2 { trace_type } {
pass "tstart"
}
-re "Target returns error code .* too far .*$gdb_prompt $" {
- if [string equal $trace_type "ftrace"] {
+ if {[string equal $trace_type "ftrace"]} {
# The target was unable to install the fast tracepoint
# (e.g., jump pad too far from tracepoint).
pass "$test (too far)"
@@ -291,12 +291,12 @@ proc tracepoint_install_in_trace_disabled { trace_type } {
global gdb_prompt
# This test only makes sense with remote targets.
- if ![gdb_protocol_is_remote] {
+ if {![gdb_protocol_is_remote]} {
return
}
clean_restart ${testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.trace/change-loc.h b/gdb/testsuite/gdb.trace/change-loc.h
index 956dca9..1f6ce07 100644
--- a/gdb/testsuite/gdb.trace/change-loc.h
+++ b/gdb/testsuite/gdb.trace/change-loc.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/circ.c b/gdb/testsuite/gdb.trace/circ.c
index fab1b83..45ae869 100644
--- a/gdb/testsuite/gdb.trace/circ.c
+++ b/gdb/testsuite/gdb.trace/circ.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1998-2024 Free Software Foundation, Inc.
+ Copyright 1998-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/circ.exp b/gdb/testsuite/gdb.trace/circ.exp
index 41d4c81..73802a9 100644
--- a/gdb/testsuite/gdb.trace/circ.exp
+++ b/gdb/testsuite/gdb.trace/circ.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nowarning
#
# Set a tracepoint on given func. The tracepoint is set at entry
-# address and not 'after prologue' address because we use
+# address and not 'after prologue' address because we use
# 'tfind pc func' to find the corresponding trace frame afterwards,
# and that looks for entry address.
proc set_a_tracepoint { func } {
diff --git a/gdb/testsuite/gdb.trace/collection.c b/gdb/testsuite/gdb.trace/collection.c
index 8379b7d..660d7c8 100644
--- a/gdb/testsuite/gdb.trace/collection.c
+++ b/gdb/testsuite/gdb.trace/collection.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 1998-2024 Free Software Foundation, Inc.
+ Copyright 1998-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/collection.exp b/gdb/testsuite/gdb.trace/collection.exp
index 9c6d3f5..a60b720 100644
--- a/gdb/testsuite/gdb.trace/collection.exp
+++ b/gdb/testsuite/gdb.trace/collection.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nowarning
return -1
}
-# Tests:
+# Tests:
# 1) $args
# 2) function args by name
# 3) $locs
@@ -701,7 +701,7 @@ proc gdb_trace_collection_test {} {
gdb_collect_registers_test "\$$fpreg, \$$spreg, \$$pcreg"
gdb_collect_globals_test
gdb_collect_global_in_pieces_test
-
+
#
# Expression tests:
#
@@ -747,7 +747,7 @@ proc gdb_trace_collection_test {} {
# x[(y, z)] (tests comma expression) (ditto)
# cast expr
# stack data
-
+
gdb_collect_expression_test globals_test_func \
"globalstruct.memberi" "82" "a.b"
gdb_collect_expression_test globals_test_func \
diff --git a/gdb/testsuite/gdb.trace/deltrace.exp b/gdb/testsuite/gdb.trace/deltrace.exp
index 94ab663..61f5ef6 100644
--- a/gdb/testsuite/gdb.trace/deltrace.exp
+++ b/gdb/testsuite/gdb.trace/deltrace.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ if {$baseline == -1} {
fail "could not find gdb_recursion_test function"
return
}
-set testline1 [expr $baseline + 4]
+set testline1 [expr {$baseline + 4}]
#
# test "delete tracepoints" command
@@ -185,11 +185,11 @@ gdb_test_multiple "delete tracepoint $trcpt1 $trcpt2 $trcpt3" \
gdb_test "info tracepoints" \
"No tracepoints." \
- "3.3c: verify delete three tracepoints"
+ "3.3c: verify delete three tracepoints"
# 3.4 delete invalid tracepoint number
-gdb_test "delete tracepoint [expr $trcpt2 + $trcpt3]" \
- "No breakpoint number [expr $trcpt2 + $trcpt3]." \
+gdb_test "delete tracepoint [expr {$trcpt2 + $trcpt3}]" \
+ "No breakpoint number [expr {$trcpt2 + $trcpt3}]." \
"3.4: delete invalid tracepoint number"
# 3.5 delete tracepoint number zero
diff --git a/gdb/testsuite/gdb.trace/disconnected-tracing.c b/gdb/testsuite/gdb.trace/disconnected-tracing.c
index 27b5281..b712139 100644
--- a/gdb/testsuite/gdb.trace/disconnected-tracing.c
+++ b/gdb/testsuite/gdb.trace/disconnected-tracing.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/disconnected-tracing.exp b/gdb/testsuite/gdb.trace/disconnected-tracing.exp
index 3c26f15..9a09a66 100644
--- a/gdb/testsuite/gdb.trace/disconnected-tracing.exp
+++ b/gdb/testsuite/gdb.trace/disconnected-tracing.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,16 +27,16 @@ if { [info proc gdb_reconnect] == "" } {
return -1
}
-if [prepare_for_testing "failed to prepare" $executable $srcfile \
- {debug nowarnings}] {
+if {[prepare_for_testing "failed to prepare" $executable $srcfile \
+ {debug nowarnings}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
@@ -51,7 +51,7 @@ proc disconnected_tracing { } {
# Start with a fresh gdb.
clean_restart ${executable}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -113,7 +113,7 @@ proc disconnected_tfind { } {
# Start with a fresh gdb.
clean_restart ${executable}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.trace/entry-values.c b/gdb/testsuite/gdb.trace/entry-values.c
index 3f0111c..a7d40f7 100644
--- a/gdb/testsuite/gdb.trace/entry-values.c
+++ b/gdb/testsuite/gdb.trace/entry-values.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/entry-values.exp b/gdb/testsuite/gdb.trace/entry-values.exp
index 82ae5a8..6c22708 100644
--- a/gdb/testsuite/gdb.trace/entry-values.exp
+++ b/gdb/testsuite/gdb.trace/entry-values.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ if {[gdb_compile [list ${binfile}1.o] \
return -1
}
-clean_restart ${binfile}1
+clean_restart ${testfile}1
set returned_from_foo ""
@@ -90,61 +90,63 @@ Dwarf::assemble $asm_file {
set bar_length [lindex $bar_result 1]
cu {} {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
int_label: base_type {
- {name int}
- {encoding @DW_ATE_signed}
- {byte_size 4 DW_FORM_sdata}
+ DW_AT_name int
+ DW_AT_encoding @DW_ATE_signed
+ DW_AT_byte_size 4 DW_FORM_sdata
}
foo_label: subprogram {
- {decl_file 0 udata}
- {MACRO_AT_func { foo }}
+ DW_AT_decl_file 0 udata
+ MACRO_AT_func { foo }
} {
formal_parameter {
- {type :$int_label}
- {name i}
- {location {DW_OP_reg0} SPECIAL_expr}
+ DW_AT_type :$int_label
+ DW_AT_name i
+ DW_AT_location {DW_OP_reg0} SPECIAL_expr
}
formal_parameter {
- {type :$int_label}
- {name j}
- {location {DW_OP_reg1} SPECIAL_expr}
+ DW_AT_type :$int_label
+ DW_AT_name j
+ DW_AT_location {DW_OP_reg1} SPECIAL_expr
}
}
subprogram {
- {name bar}
- {decl_file 0 udata}
- {low_pc $bar_start addr}
- {high_pc "$bar_start + $bar_length" addr}
- {GNU_all_call_sites 1 sdata}
+ DW_AT_name bar
+ DW_AT_decl_file 0 udata
+ DW_AT_low_pc $bar_start addr
+ DW_AT_high_pc "$bar_start + $bar_length" addr
+ DW_AT_GNU_all_call_sites 1 sdata
} {
formal_parameter {
- {type :$int_label}
- {name i}
+ DW_AT_type :$int_label
+ DW_AT_name i
}
GNU_call_site {
- {low_pc "$bar_start + $returned_from_foo" addr}
- {abstract_origin :$foo_label}
+ DW_AT_low_pc "$bar_start + $returned_from_foo" addr
+ DW_AT_abstract_origin :$foo_label
} {
# Faked entry values are reference to variables 'global1'
# and 'global2' and faked locations are register 0 and
# register 1.
GNU_call_site_parameter {
- {location {DW_OP_reg0} SPECIAL_expr}
- {GNU_call_site_value {
- addr global1
- deref_size 4
- } SPECIAL_expr}
+ DW_AT_location {DW_OP_reg0} SPECIAL_expr
+ DW_AT_GNU_call_site_value {
+ DW_OP_addr global1
+ DW_OP_deref_size 4
+ } SPECIAL_expr
}
GNU_call_site_parameter {
- {location {DW_OP_reg1} SPECIAL_expr}
- {GNU_call_site_value {
- addr global2
- deref_size 4
- } SPECIAL_expr}
+ DW_AT_location {DW_OP_reg1} SPECIAL_expr
+ DW_AT_GNU_call_site_value {
+ DW_OP_addr global2
+ DW_OP_deref_size 4
+ } SPECIAL_expr
}
}
}
@@ -163,7 +165,7 @@ if {[gdb_compile [list ${binfile}1.o ${binfile}2.o] \
clean_restart ${testfile}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -193,15 +195,15 @@ gdb_test_sequence "bt" "bt, 2" {
# Restart GDB and trace.
-clean_restart $binfile
+clean_restart $testfile
load_lib "trace-support.exp"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
diff --git a/gdb/testsuite/gdb.trace/ftrace-lock.c b/gdb/testsuite/gdb.trace/ftrace-lock.c
index 0d401c6..04b73d8 100644
--- a/gdb/testsuite/gdb.trace/ftrace-lock.c
+++ b/gdb/testsuite/gdb.trace/ftrace-lock.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/ftrace-lock.exp b/gdb/testsuite/gdb.trace/ftrace-lock.exp
index 637d5eb..42e8711 100644
--- a/gdb/testsuite/gdb.trace/ftrace-lock.exp
+++ b/gdb/testsuite/gdb.trace/ftrace-lock.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -22,7 +22,7 @@ require gdb_trace_common_supports_arch
standard_testfile
# make check RUNTESTFLAGS='gdb.trace/ftrace-lock.exp NUM_THREADS=2'
-if ![info exists NUM_THREADS] {
+if {![info exists NUM_THREADS]} {
set NUM_THREADS 2
}
@@ -32,16 +32,16 @@ set options [list debug pthreads [gdb_target_symbol_prefix_flags] \
additional_flags=-DNUM_THREADS=$NUM_THREADS]
with_test_prefix "runtime trace support check" {
- if { [prepare_for_testing "prepare for testing" ${binfile}-check \
+ if { [prepare_for_testing "prepare for testing" ${testfile}-check \
$srcfile $options] } {
return
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
- if ![gdb_target_supports_trace] {
+ if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
@@ -55,11 +55,11 @@ set remote_libipa [gdb_load_shlib $libipa]
lappend options shlib=$libipa
if { [prepare_for_testing "prepare for testing with libipa" \
- $binfile $srcfile $options] } {
+ $testfile $srcfile $options] } {
return
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.trace/ftrace.c b/gdb/testsuite/gdb.trace/ftrace.c
index f0175e3..30a988f 100644
--- a/gdb/testsuite/gdb.trace/ftrace.c
+++ b/gdb/testsuite/gdb.trace/ftrace.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/ftrace.exp b/gdb/testsuite/gdb.trace/ftrace.exp
index 408cd37..3192bdd 100644
--- a/gdb/testsuite/gdb.trace/ftrace.exp
+++ b/gdb/testsuite/gdb.trace/ftrace.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -25,16 +25,16 @@ set additional_flags [gdb_target_symbol_prefix_flags]
require gdb_trace_common_supports_arch
-if [prepare_for_testing "failed to prepare" $executable $srcfile \
- [list debug $additional_flags]] {
+if {[prepare_for_testing "failed to prepare" $executable $srcfile \
+ [list debug $additional_flags]]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
@@ -54,7 +54,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
}
clean_restart ${executable}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
@@ -130,7 +130,7 @@ proc test_fast_tracepoints {} {
set minaddr [exec sh -c "cat /proc/sys/vm/mmap_min_addr"]
- if { [expr $minaddr > 64512] } {
+ if {$minaddr > 64512} {
warning "mmap_min_addr > 64512, fast tracepoint will fail"
warning "do \"sudo sysctl -w vm.mmap_min_addr=32768\" to adjust"
}
@@ -190,7 +190,7 @@ proc test_fast_tracepoints {} {
# fast tracepoints RSP feature, and confirm fast tracepoints
# can no longer be downloaded.
set test "fast tracepoint could not be downloaded with the feature disabled"
- if [gdb_protocol_is_remote] {
+ if {[gdb_protocol_is_remote]} {
gdb_test "set remote fast-tracepoints-packet off"
gdb_test_multiple "tstart" $test {
diff --git a/gdb/testsuite/gdb.trace/infotrace.exp b/gdb/testsuite/gdb.trace/infotrace.exp
index f1c9cdf..47121ca 100644
--- a/gdb/testsuite/gdb.trace/infotrace.exp
+++ b/gdb/testsuite/gdb.trace/infotrace.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -66,8 +66,8 @@ gdb_test "info tracepoint $asm_test_num" \
"2.2b: info tracepoint $asm_test_num (gdb_asm_test)"
# 2.3 info tracepoint (invalid tracepoint number)
-gdb_test "info tracepoint [expr $c_test_num + $asm_test_num]" \
- "No tracepoint matching '[expr $c_test_num + $asm_test_num]'." \
+gdb_test "info tracepoint [expr {$c_test_num + $asm_test_num}]" \
+ "No tracepoint matching '[expr {$c_test_num + $asm_test_num}]'." \
"2.3: info tracepoint (invalid tracepoint number)"
# 2.4 info tracepoints (list of numbers)
diff --git a/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp b/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp
index 88f00c2..1aaf27c 100644
--- a/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp
+++ b/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,11 +23,11 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] }
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "current target does not support trace"
return -1
}
@@ -37,7 +37,7 @@ gdb_exit
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-mi_clean_restart $binfile
+mi_clean_restart $testfile
mi_runto_main
mi_gdb_test "-break-insert end" \
diff --git a/gdb/testsuite/gdb.trace/mi-trace-save.exp b/gdb/testsuite/gdb.trace/mi-trace-save.exp
index 9548082..c95d0cd 100644
--- a/gdb/testsuite/gdb.trace/mi-trace-save.exp
+++ b/gdb/testsuite/gdb.trace/mi-trace-save.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
index 7e56958..34013fb 100644
--- a/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
+++ b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,11 +21,11 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug nopi
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "current target does not support trace"
return -1
}
@@ -35,7 +35,7 @@ gdb_exit
load_lib mi-support.exp
set MIFLAGS "-i=mi"
-mi_clean_restart $binfile
+mi_clean_restart $testfile
mi_runto_main
mi_gdb_test "-break-insert marker" \
@@ -129,16 +129,16 @@ proc test_trace_unavailable { data_source } {
set pcnum -1
set gpr0num -1
- if [is_amd64_regs_target] {
+ if {[is_amd64_regs_target]} {
set pcnum 16
set gpr0num 0
- } elseif [is_x86_like_target] {
+ } elseif {[is_x86_like_target]} {
set pcnum 8
set gpr0num 0
- } elseif [is_aarch64_target] {
+ } elseif {[is_aarch64_target]} {
set pcnum 32
set gpr0num 0
- } elseif [istarget "powerpc*-*-*"] {
+ } elseif {[istarget "powerpc*-*-*"]} {
set pcnum 64
set gpr0num 0
} elseif { [istarget "s390*-*-*"] } {
diff --git a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
index 2ce514f..029869b 100644
--- a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
+++ b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,11 +45,10 @@ remote_file target delete $tfile_basic
proc test_tfind_tfile { } {
with_test_prefix "tfile" {
- global binfile
global decimal
global tfile_basic
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
mi_gdb_test "-target-select tfile ${tfile_basic}" \
".*=breakpoint-created,bkpt=\{number=\"${decimal}\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"write_basic_trace_file\".*\\^connected" \
@@ -79,7 +78,7 @@ proc test_tfind_tfile { } {
# If tracefile is generated successfully, copy tracefile to host and
# run tests.
-if [generate_tracefile $binfile] {
+if {[generate_tracefile $binfile]} {
if {!$purely_local} {
# Copy tracefile from target to host.
remote_download host [remote_upload target tfile-basic.tf] \
@@ -92,8 +91,8 @@ if [generate_tracefile $binfile] {
# Change to a different test case in order to run it on target, and get
# several traceframes.
standard_testfile status-stop.c
-append testfile -1
-append binfile -1
+append testfile "-1"
+append binfile "-1"
set executable $testfile
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
@@ -106,11 +105,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
clean_restart $executable
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "current target does not support trace"
return -1
}
@@ -120,9 +119,8 @@ gdb_exit
proc test_tfind_remote { } {
with_test_prefix "remote" {
global decimal
- global binfile
- mi_clean_restart $binfile
+ mi_clean_restart $::testfile
mi_runto_main
mi_gdb_test "-break-insert end" "\\^done.*" "break end"
diff --git a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
index dee7142..da62563 100644
--- a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
+++ b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -89,9 +89,7 @@ proc test_reconnect { } {
}
}
- global binfile
-
- if {[mi_clean_restart $binfile]} {
+ if {[mi_clean_restart $::testfile]} {
return
}
@@ -155,11 +153,10 @@ proc test_pending_resolved { } {
with_test_prefix "pending resolved" {
global decimal hex
global executable
- global binfile
global lib_sl1 lib_sl2
global mi_gdb_prompt
- if {[mi_clean_restart $binfile]} {
+ if {[mi_clean_restart $::testfile]} {
return
}
mi_load_shlibs $lib_sl1 $lib_sl2
@@ -231,11 +228,11 @@ clean_restart $executable
gdb_load_shlib $lib_sl1
gdb_load_shlib $lib_sl2
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "current target does not support trace"
return -1
}
diff --git a/gdb/testsuite/gdb.trace/mi-tsv-changed.exp b/gdb/testsuite/gdb.trace/mi-tsv-changed.exp
index 50d325a..c69ae89 100644
--- a/gdb/testsuite/gdb.trace/mi-tsv-changed.exp
+++ b/gdb/testsuite/gdb.trace/mi-tsv-changed.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ proc test_create_delete_modify_tsv { } {
global srcdir subdir
global mi_gdb_prompt
- if [mi_gdb_start] {
+ if {[mi_gdb_start]} {
return
}
mi_gdb_load ${binfile}
@@ -67,17 +67,17 @@ proc test_create_delete_modify_tsv { } {
# Test target supports tracepoints or not.
clean_restart $testfile
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
- if ![gdb_target_supports_trace] {
+ if {![gdb_target_supports_trace]} {
unsupported "current target does not support trace"
return -1
}
gdb_exit
- if {[mi_clean_restart $binfile]} {
+ if {[mi_clean_restart $::testfile]} {
return
}
@@ -145,7 +145,7 @@ proc test_upload_tsv { } {
return 0
}
- clean_restart $testfile
+ clean_restart $::testfile
if {![runto_main]} {
return 0
}
@@ -175,8 +175,7 @@ proc test_upload_tsv { } {
}
}
- global binfile
- if {[mi_clean_restart $binfile]} {
+ if {[mi_clean_restart $::testfile]} {
return
}
@@ -202,12 +201,12 @@ proc test_upload_tsv { } {
}
}
- if $tsv1_created {
+ if {$tsv1_created} {
pass "tsv1 created"
} else {
fail "tsv1 created"
}
- if $tsv2_created {
+ if {$tsv2_created} {
pass "tsv2 created"
} else {
fail "tsv2 created"
@@ -223,11 +222,11 @@ proc test_upload_tsv { } {
clean_restart $testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "current target does not support trace"
return -1
}
diff --git a/gdb/testsuite/gdb.trace/no-attach-trace.c b/gdb/testsuite/gdb.trace/no-attach-trace.c
index 23e7fdc..f48ff23 100644
--- a/gdb/testsuite/gdb.trace/no-attach-trace.c
+++ b/gdb/testsuite/gdb.trace/no-attach-trace.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2015-2024 Free Software Foundation, Inc.
+ Copyright 2015-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/no-attach-trace.exp b/gdb/testsuite/gdb.trace/no-attach-trace.exp
index c993844..5f7795d 100644
--- a/gdb/testsuite/gdb.trace/no-attach-trace.exp
+++ b/gdb/testsuite/gdb.trace/no-attach-trace.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ gdb_test "trace main" \
gdb_test "tstart" "Target returns error code.*\."
with_test_prefix "after tstart" {
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
}
diff --git a/gdb/testsuite/gdb.trace/packetlen.exp b/gdb/testsuite/gdb.trace/packetlen.exp
index 1110b31..52a34b9 100644
--- a/gdb/testsuite/gdb.trace/packetlen.exp
+++ b/gdb/testsuite/gdb.trace/packetlen.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
return -1
}
-clean_restart $binfile
+clean_restart $testfile
gdb_test "tstop" ".*" ""
gdb_test "tfind none" ".*" ""
runto_main
diff --git a/gdb/testsuite/gdb.trace/passc-dyn.exp b/gdb/testsuite/gdb.trace/passc-dyn.exp
index a5f55d9..2c7698a 100644
--- a/gdb/testsuite/gdb.trace/passc-dyn.exp
+++ b/gdb/testsuite/gdb.trace/passc-dyn.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
return -1
}
-clean_restart $binfile
+clean_restart $testfile
runto_main
if {![gdb_target_supports_trace]} {
@@ -52,16 +52,16 @@ if {$baseline == -1} {
# define relative source line numbers:
# all subsequent line numbers are relative to this first one (baseline)
-set testline2 [expr $baseline + 4]
-set testline3 [expr $baseline + 5]
-set testline4 [expr $baseline + 6]
+set testline2 [expr {$baseline + 4}]
+set testline3 [expr {$baseline + 5}]
+set testline4 [expr {$baseline + 6}]
#
# test passcount command semantics (live test)
#
## Set three tracepoints with three different passcounts.
-## Verify that the experiment stops after the one with the
+## Verify that the experiment stops after the one with the
## lowest passcount is hit.
gdb_delete_tracepoints
@@ -125,7 +125,7 @@ with_test_prefix "trace_frame 4" {
}
## We should now be at the last frame, because this frame's passcount
-## should have caused collection to stop. If we do a tfind now,
+## should have caused collection to stop. If we do a tfind now,
## it should fail.
gdb_test "tfind" "failed to find.*" "4.5: dynamic passcount test"
diff --git a/gdb/testsuite/gdb.trace/passcount.exp b/gdb/testsuite/gdb.trace/passcount.exp
index 1408c19c..37d5c09 100644
--- a/gdb/testsuite/gdb.trace/passcount.exp
+++ b/gdb/testsuite/gdb.trace/passcount.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ if {$baseline == -1} {
return
}
-set testline1 [expr $baseline + 3]
+set testline1 [expr {$baseline + 3}]
#
# test "passcount" command
@@ -212,8 +212,8 @@ gdb_test "info tracepoints" \
# 4.8 set passcount for invalid tracepoint
-gdb_test "passcount 1 [expr $trcpt2 + $trcpt3]" \
- "No tracepoint number [expr $trcpt2 + $trcpt3]." \
+gdb_test "passcount 1 [expr {$trcpt2 + $trcpt3}]" \
+ "No tracepoint number [expr {$trcpt2 + $trcpt3}]." \
"4.8: invalid tracepoint number in passcount"
# 4.9 help passcount
diff --git a/gdb/testsuite/gdb.trace/pending.c b/gdb/testsuite/gdb.trace/pending.c
index c638794..dedf35d 100644
--- a/gdb/testsuite/gdb.trace/pending.c
+++ b/gdb/testsuite/gdb.trace/pending.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/pending.exp b/gdb/testsuite/gdb.trace/pending.exp
index 66209ad..fdf321b 100644
--- a/gdb/testsuite/gdb.trace/pending.exp
+++ b/gdb/testsuite/gdb.trace/pending.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -46,11 +46,11 @@ clean_restart $executable
gdb_load_shlib $lib_sl1
gdb_load_shlib $lib_sl2
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "current target does not support trace"
return -1
}
@@ -138,7 +138,7 @@ proc pending_tracepoint_works { trace_type } {
pass $test
}
-re "Target returns error code .* too far .*$gdb_prompt $" {
- if [string equal $trace_type "ftrace"] {
+ if {[string equal $trace_type "ftrace"]} {
# The target was unable to install the fast tracepoint
# (e.g., jump pad too far from tracepoint).
pass "$test (too far)"
@@ -179,7 +179,7 @@ proc pending_tracepoint_resolved_during_trace { trace_type } \
# Start with a fresh gdb.
clean_restart $executable
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -206,7 +206,7 @@ proc pending_tracepoint_resolved_during_trace { trace_type } \
set test "continue to marker 2"
gdb_test_multiple "continue" $test {
-re "Target returns error code .* too far .*$gdb_prompt $" {
- if [string equal $trace_type "ftrace"] {
+ if {[string equal $trace_type "ftrace"]} {
# Expected if the target was unable to install the
# fast tracepoint (e.g., jump pad too far from
# tracepoint).
@@ -247,7 +247,7 @@ proc pending_tracepoint_installed_during_trace { trace_type } \
# Start with a fresh gdb.
clean_restart $executable
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -278,7 +278,7 @@ proc pending_tracepoint_installed_during_trace { trace_type } \
set test "continue to marker 2"
gdb_test_multiple "continue" $test {
-re "Target returns error code .* too far .*$gdb_prompt $" {
- if [string equal $trace_type "ftrace"] {
+ if {[string equal $trace_type "ftrace"]} {
# Expected if the target was unable to install the
# fast tracepoint (e.g., jump pad too far from
# tracepoint).
@@ -320,7 +320,7 @@ proc pending_tracepoint_disconnect_during_trace { trace_type } \
# Start with a fresh gdb.
clean_restart $executable
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -367,7 +367,7 @@ proc pending_tracepoint_disconnect_after_resolved { trace_type } \
# Start with a fresh gdb.
clean_restart $executable
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -419,7 +419,7 @@ proc pending_tracepoint_with_action_resolved { trace_type } \
# Start with a fresh gdb.
clean_restart $executable
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -449,7 +449,7 @@ proc pending_tracepoint_with_action_resolved { trace_type } \
set test "continue to marker 2"
gdb_test_multiple "continue" $test {
-re "Target returns error code .* too far .*$gdb_prompt $" {
- if [string equal $trace_type "ftrace"] {
+ if {[string equal $trace_type "ftrace"]} {
# Expected if the target was unable to install the
# fast tracepoint (e.g., jump pad too far from
# tracepoint).
diff --git a/gdb/testsuite/gdb.trace/pendshr1.c b/gdb/testsuite/gdb.trace/pendshr1.c
index f6d32b8..dbd4093 100644
--- a/gdb/testsuite/gdb.trace/pendshr1.c
+++ b/gdb/testsuite/gdb.trace/pendshr1.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/pendshr2.c b/gdb/testsuite/gdb.trace/pendshr2.c
index c838e38..3556cc6 100644
--- a/gdb/testsuite/gdb.trace/pendshr2.c
+++ b/gdb/testsuite/gdb.trace/pendshr2.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/pr16508.exp b/gdb/testsuite/gdb.trace/pr16508.exp
index ed55e9d..37405ff 100644
--- a/gdb/testsuite/gdb.trace/pr16508.exp
+++ b/gdb/testsuite/gdb.trace/pr16508.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -17,16 +17,16 @@ load_lib "trace-support.exp"
standard_testfile read-memory.c
set executable $testfile
-if [prepare_for_testing "failed to prepare for trace tests" \
- $executable $srcfile [list debug]] {
+if {[prepare_for_testing "failed to prepare for trace tests" \
+ $executable $srcfile [list debug]]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
diff --git a/gdb/testsuite/gdb.trace/qtro.c b/gdb/testsuite/gdb.trace/qtro.c
index 8c5348a..882d0b6 100644
--- a/gdb/testsuite/gdb.trace/qtro.c
+++ b/gdb/testsuite/gdb.trace/qtro.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/qtro.exp b/gdb/testsuite/gdb.trace/qtro.exp
index 60f73d7..cf3ade6 100644
--- a/gdb/testsuite/gdb.trace/qtro.exp
+++ b/gdb/testsuite/gdb.trace/qtro.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,13 +30,13 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nopie}]}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# Check whether the target supports tracepoints.
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "current target does not support trace"
return -1
}
diff --git a/gdb/testsuite/gdb.trace/range-stepping.c b/gdb/testsuite/gdb.trace/range-stepping.c
index 9ffce73..0ba1c38 100644
--- a/gdb/testsuite/gdb.trace/range-stepping.c
+++ b/gdb/testsuite/gdb.trace/range-stepping.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/range-stepping.exp b/gdb/testsuite/gdb.trace/range-stepping.exp
index 373a0bf..915f0a2 100644
--- a/gdb/testsuite/gdb.trace/range-stepping.exp
+++ b/gdb/testsuite/gdb.trace/range-stepping.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,21 +19,21 @@ load_lib "range-stepping-support.exp"
standard_testfile
set executable $testfile
-if [prepare_for_testing "failed to prepare" $executable $srcfile \
- {debug nowarnings}] {
+if {[prepare_for_testing "failed to prepare" $executable $srcfile \
+ {debug nowarnings}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
-if ![gdb_range_stepping_enabled] {
+if {![gdb_range_stepping_enabled]} {
unsupported "range stepping not supported by the target"
return -1
}
@@ -79,7 +79,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
clean_restart ${executable}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.trace/read-memory.c b/gdb/testsuite/gdb.trace/read-memory.c
index be0fe6d..481c4d2 100644
--- a/gdb/testsuite/gdb.trace/read-memory.c
+++ b/gdb/testsuite/gdb.trace/read-memory.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/read-memory.exp b/gdb/testsuite/gdb.trace/read-memory.exp
index c42bac0..b369b40 100644
--- a/gdb/testsuite/gdb.trace/read-memory.exp
+++ b/gdb/testsuite/gdb.trace/read-memory.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,11 +21,11 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nopie}]}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
@@ -37,7 +37,7 @@ proc set_tracepoint_and_collect { } {
# Start with a fresh gdb.
clean_restart ${testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
gdb_breakpoint "end" qualified
diff --git a/gdb/testsuite/gdb.trace/report.exp b/gdb/testsuite/gdb.trace/report.exp
index 7146599..0b964d6 100644
--- a/gdb/testsuite/gdb.trace/report.exp
+++ b/gdb/testsuite/gdb.trace/report.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
untested "failed to compile"
return -1
}
-clean_restart $binfile
+clean_restart $testfile
runto_main
if {![gdb_target_supports_trace]} {
@@ -100,7 +100,7 @@ all tests in this module will fail."
untested "couldn't match pattern"
set return_me 1
all tests in this module will fail."
- }
+ }
}
if {$return_me == 1} {
@@ -288,27 +288,27 @@ proc use_collected_data { data_source } {
exp_continue
}
-re "^\[^\r\n\]* line $testline1 .tracepoint .$tdp1\\)\r\n" {
- set linecount1 [expr $linecount1 + 1]
+ set linecount1 [expr {$linecount1 + 1}]
exp_continue
}
-re "^\[^\r\n\]* line $testline2 .tracepoint .$tdp2\\)\r\n" {
- set linecount2 [expr $linecount2 + 1]
+ set linecount2 [expr {$linecount2 + 1}]
exp_continue
}
-re "^\[^\r\n\]* line $testline3 .tracepoint .$tdp3\\)\r\n" {
- set linecount3 [expr $linecount3 + 1]
+ set linecount3 [expr {$linecount3 + 1}]
exp_continue
}
-re "^\[^\r\n\]* line $testline4 .tracepoint .$tdp4\\)\r\n" {
- set linecount4 [expr $linecount4 + 1]
+ set linecount4 [expr {$linecount4 + 1}]
exp_continue
}
-re "^\[^\r\n\]* line $testline5 .tracepoint .$tdp5\\)\r\n" {
- set linecount5 [expr $linecount5 + 1]
+ set linecount5 [expr {$linecount5 + 1}]
exp_continue
}
-re "^\[^\r\n\]* line $testline6 .tracepoint .$tdp6\\)\r\n" {
- set linecount6 [expr $linecount6 + 1]
+ set linecount6 [expr {$linecount6 + 1}]
exp_continue
}
-re "^No trace frame found\r\n$gdb_prompt $" {
@@ -328,7 +328,7 @@ proc use_collected_data { data_source } {
gdb_test_multiple "while \$trace_frame != -1\n printf \"tracepoint #\%d, FP 0x\%08x, SP 0x\%08x, PC 0x%08x\\n\", \$tracepoint, \$fp, \$sp, \$pc\n tfind tracepoint\n end" "12.2: trace report #2" {
-re "tracepoint #$tdp2, FP $hex, SP $hex, PC $hex" {
- set linecount2 [expr $linecount2 + 1]
+ set linecount2 [expr {$linecount2 + 1}]
exp_continue
}
-re ".*$gdb_prompt $" {
@@ -348,7 +348,7 @@ proc use_collected_data { data_source } {
gdb_test_multiple "while \$trace_frame != -1\n printf \"TDP #\%d, frame \%d: depth = \%d, q1 = \%d\\n\", \$tracepoint, \$trace_frame, depth, q1\n tfind tracepoint\n end" "12.3: trace report #3" {
-re "TDP #$tdp3, frame $decimal: depth = $decimal, q1 = $decimal" {
- set linecount3 [expr $linecount3 + 1]
+ set linecount3 [expr {$linecount3 + 1}]
exp_continue
}
-re ".*$gdb_prompt $" {
@@ -368,7 +368,7 @@ proc use_collected_data { data_source } {
gdb_test_multiple "while \$trace_frame != -1\n printf \"TDP #\%d, frame %d: char_test = \%d, long_test = \%d\\n\", \$tracepoint, \$trace_frame, gdb_char_test, gdb_long_test\n tfind tracepoint\n end" "12.4: trace report #4" {
-re "TDP #$tdp6, frame $decimal: char_test = $arg1, long_test = $arg3" {
- set linecount6 [expr $linecount6 + 1]
+ set linecount6 [expr {$linecount6 + 1}]
exp_continue
}
-re ".*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.trace/save-trace.exp b/gdb/testsuite/gdb.trace/save-trace.exp
index f30b5b5..31d9768 100644
--- a/gdb/testsuite/gdb.trace/save-trace.exp
+++ b/gdb/testsuite/gdb.trace/save-trace.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,12 +37,12 @@ if {$baseline == -1} {
return
}
-set testline1 [expr $baseline + 4]
-set testline2 [expr $baseline + 5]
-set testline3 [expr $baseline + 6]
-set testline4 [expr $baseline + 7]
-set testline5 [expr $baseline + 8]
-set testline6 [expr $baseline + 9]
+set testline1 [expr {$baseline + 4}]
+set testline2 [expr {$baseline + 5}]
+set testline3 [expr {$baseline + 6}]
+set testline4 [expr {$baseline + 7}]
+set testline5 [expr {$baseline + 8}]
+set testline6 [expr {$baseline + 9}]
#
# test save-trace command
@@ -53,7 +53,7 @@ set testline6 [expr $baseline + 9]
gdb_delete_tracepoints
foreach x { 1 2 3 4 5 6 } {
- set testline [expr \$testline$x]
+ set testline [subst \$testline$x]
set trcpt [gdb_gettpnum $testline]
set trcpt$x $trcpt
gdb_test "passcount $x" \
diff --git a/gdb/testsuite/gdb.trace/signal.c b/gdb/testsuite/gdb.trace/signal.c
index f0e526c..183b3bb 100644
--- a/gdb/testsuite/gdb.trace/signal.c
+++ b/gdb/testsuite/gdb.trace/signal.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/signal.exp b/gdb/testsuite/gdb.trace/signal.exp
index 6f0e520..31cd9cd 100644
--- a/gdb/testsuite/gdb.trace/signal.exp
+++ b/gdb/testsuite/gdb.trace/signal.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,11 +36,11 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
@@ -62,7 +62,7 @@ if { [istarget "i\[34567\]86-*-linux*"] || [istarget "x86_64-*-linux*"] } {
# Start with a fresh gdb.
clean_restart ${testfile}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
@@ -153,7 +153,7 @@ with_test_prefix "iterations equals to counter" {
# Record the hit times of each tracepoint in this array.
array set tracepoint_hits { }
-for { set i $tpnum } { $i < [expr $tpnum + 2] } { incr i } {
+for { set i $tpnum } { $i < $tpnum + 2 } { incr i } {
set tracepoint_hits($i) 0
}
@@ -162,7 +162,7 @@ while { 1 } {
set idx 0
gdb_test_multiple $test $test {
-re "Found trace frame $decimal, tracepoint ($decimal).*\r\n$gdb_prompt $" {
- set idx [expr $expect_out(1,string)]
+ set idx [expr {$expect_out(1,string)}]
incr tracepoint_hits($idx)
}
-re "Target failed to find requested trace frame\..*\r\n$gdb_prompt $" {
@@ -176,7 +176,7 @@ while { 1 } {
# Step 3, check the number of collections on each tracepoint.
-for { set i $tpnum } { $i < [expr $tpnum + 2] } { incr i } {
+for { set i $tpnum } { $i < $tpnum + 2 } { incr i } {
if { $tracepoint_hits($i) == $iterations } {
pass "tracepoint $i hit $iterations times"
diff --git a/gdb/testsuite/gdb.trace/stap-trace.c b/gdb/testsuite/gdb.trace/stap-trace.c
index 5274828..e816fa6 100644
--- a/gdb/testsuite/gdb.trace/stap-trace.c
+++ b/gdb/testsuite/gdb.trace/stap-trace.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/stap-trace.exp b/gdb/testsuite/gdb.trace/stap-trace.exp
index c1e4b6e..37e2e4b 100644
--- a/gdb/testsuite/gdb.trace/stap-trace.exp
+++ b/gdb/testsuite/gdb.trace/stap-trace.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/status-stop.c b/gdb/testsuite/gdb.trace/status-stop.c
index 8a5d478..35fa43a 100644
--- a/gdb/testsuite/gdb.trace/status-stop.c
+++ b/gdb/testsuite/gdb.trace/status-stop.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/status-stop.exp b/gdb/testsuite/gdb.trace/status-stop.exp
index a980b69..a390dd9 100644
--- a/gdb/testsuite/gdb.trace/status-stop.exp
+++ b/gdb/testsuite/gdb.trace/status-stop.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -19,16 +19,16 @@ set executable $testfile
set expfile $testfile.exp
-if [prepare_for_testing "failed to prepare" $executable $srcfile \
- {debug nowarnings}] {
+if {[prepare_for_testing "failed to prepare" $executable $srcfile \
+ {debug nowarnings}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
@@ -42,7 +42,7 @@ proc test_tstart_tstop_tstart { } {
# Start with a fresh gdb.
clean_restart ${executable}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -70,7 +70,7 @@ proc test_tstart_tstart { } {
# Start with a fresh gdb.
clean_restart ${executable}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -96,7 +96,7 @@ proc test_buffer_full_tstart { } {
# Start with a fresh gdb.
clean_restart ${executable}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.trace/strace.c b/gdb/testsuite/gdb.trace/strace.c
index 9430a2c..6c6a785 100644
--- a/gdb/testsuite/gdb.trace/strace.c
+++ b/gdb/testsuite/gdb.trace/strace.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/strace.exp b/gdb/testsuite/gdb.trace/strace.exp
index ef243a4..96ef4de 100644
--- a/gdb/testsuite/gdb.trace/strace.exp
+++ b/gdb/testsuite/gdb.trace/strace.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -45,7 +45,7 @@ proc strace_remove_socket { action } {
# Restart with a fresh gdb.
clean_restart $executable
gdb_load_shlib $libipa
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -130,7 +130,7 @@ proc strace_info_marker { } {
# Restart with a fresh gdb.
clean_restart $executable
gdb_load_shlib $libipa
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -166,7 +166,7 @@ proc strace_probe_marker { } {
# Restart with a fresh gdb.
clean_restart $executable
gdb_load_shlib $libipa
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -205,7 +205,7 @@ proc strace_trace_on_same_addr { type } {
# Restart with a fresh gdb.
clean_restart $executable
gdb_load_shlib $libipa
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -241,7 +241,7 @@ proc strace_trace_on_same_addr { type } {
pass $test
}
-re ".*\r\n$gdb_prompt $" {
- if [string equal $type "ftrace"] {
+ if {[string equal $type "ftrace"]} {
# The instruction may be not long enough to set a fast
# tracepoint. Skip the rest of this test.
return -1
@@ -256,7 +256,7 @@ proc strace_trace_on_same_addr { type } {
pass $test
}
-re ".*\r\n$gdb_prompt $" {
- if [string equal $type "ftrace"] {
+ if {[string equal $type "ftrace"]} {
# The instruction may be not long enough to set a fast
# tracepoint. Skip the rest of this test.
return -1
@@ -268,7 +268,7 @@ proc strace_trace_on_same_addr { type } {
gdb_breakpoint "end" qualified
- if [string equal $type "break"] {
+ if {[string equal $type "break"]} {
gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
"continue to bar"
gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
@@ -308,7 +308,7 @@ proc strace_trace_on_diff_addr { } {
# Restart with a fresh gdb.
clean_restart $executable
gdb_load_shlib $libipa
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -367,7 +367,7 @@ if { [istarget "x86_64-*-linux*"] || [istarget "i\[34567\]86-*-linux*"] } {
clean_restart $executable
gdb_load_shlib $libipa
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
if {![gdb_target_supports_trace]} {
diff --git a/gdb/testsuite/gdb.trace/tfile.c b/gdb/testsuite/gdb.trace/tfile.c
index 5ec5248..76ed462 100644
--- a/gdb/testsuite/gdb.trace/tfile.c
+++ b/gdb/testsuite/gdb.trace/tfile.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/tfile.exp b/gdb/testsuite/gdb.trace/tfile.exp
index 36ceaea..4d156f7 100644
--- a/gdb/testsuite/gdb.trace/tfile.exp
+++ b/gdb/testsuite/gdb.trace/tfile.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -61,7 +61,7 @@ if {!$purely_local} {
remote_download host [remote_upload target tfile-error.tf] tfile-error.tf
}
-clean_restart $binfile
+clean_restart $testfile
# Program has presumably exited, now target a trace file it created.
@@ -121,7 +121,7 @@ gdb_test "info registers" "The program has no registers now\." \
# Now start afresh, using only a trace file.
-clean_restart $binfile
+clean_restart $testfile
gdb_test "target tfile $tfile_error" "Created tracepoint.*" \
"target tfile [file tail $tfile_error]"
diff --git a/gdb/testsuite/gdb.trace/tfind.exp b/gdb/testsuite/gdb.trace/tfind.exp
index 5dba88b..53e97be 100644
--- a/gdb/testsuite/gdb.trace/tfind.exp
+++ b/gdb/testsuite/gdb.trace/tfind.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" "$binfile" \
return -1
}
-clean_restart $binfile
+clean_restart $testfile
# 6.2 test help tstart
gdb_test "help tstart" \
@@ -75,11 +75,11 @@ if {$baseline == -1} {
return
}
-set testline1 [expr $baseline + 1]
-set testline2 [expr $baseline + 5]
-set testline3 [expr $baseline + 6]
-set testline4 [expr $baseline + 7]
-set testline5 [expr $baseline + 8]
+set testline1 [expr {$baseline + 1}]
+set testline2 [expr {$baseline + 5}]
+set testline3 [expr {$baseline + 6}]
+set testline4 [expr {$baseline + 7}]
+set testline5 [expr {$baseline + 8}]
#
# test tfind command
@@ -351,7 +351,7 @@ gdb_test "tfind line NoSuChFiLe.c:$baseline" \
"No source file named.*" \
"8.27: tfind line in bad source file"
-# 8.32 tfind invalid subcommand (tfind foo)
+# 8.32 tfind invalid subcommand (tfind foo)
## check error
gdb_test "tfind NoSuChOpTiOn 21" \
"No symbol.*|\[Ww\]arning.*|\[Ee\]rror.*" \
diff --git a/gdb/testsuite/gdb.trace/trace-break.c b/gdb/testsuite/gdb.trace/trace-break.c
index d36a60f..466c41e 100644
--- a/gdb/testsuite/gdb.trace/trace-break.c
+++ b/gdb/testsuite/gdb.trace/trace-break.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/trace-break.exp b/gdb/testsuite/gdb.trace/trace-break.exp
index 635155c..a2a79d8 100644
--- a/gdb/testsuite/gdb.trace/trace-break.exp
+++ b/gdb/testsuite/gdb.trace/trace-break.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -23,16 +23,16 @@ set additional_flags [gdb_target_symbol_prefix_flags]
require gdb_trace_common_supports_arch
-if [prepare_for_testing "failed to prepare" $executable $srcfile \
- [list debug $additional_flags]] {
+if {[prepare_for_testing "failed to prepare" $executable $srcfile \
+ [list debug $additional_flags]]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
@@ -47,7 +47,7 @@ proc break_trace_same_addr_1 { trace_type option } \
# Start with a fresh gdb.
clean_restart ${executable}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -81,7 +81,7 @@ proc break_trace_same_addr_2 { trace_type1 trace_type2 option } \
# Start with a fresh gdb.
clean_restart ${executable}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -119,7 +119,7 @@ proc break_trace_same_addr_3 { trace_type option } \
# Start with a fresh gdb.
clean_restart ${executable}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -156,7 +156,7 @@ proc break_trace_same_addr_4 { trace_type option } \
# Start with a fresh gdb.
clean_restart ${executable}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -199,7 +199,7 @@ proc break_trace_same_addr_5 { trace1 trace2 trace3 trace3_at_first_loc } \
# Start with a fresh gdb.
clean_restart ${executable}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -222,7 +222,7 @@ proc break_trace_same_addr_5 { trace1 trace2 trace3 trace3_at_first_loc } \
gdb_test "continue" "Continuing\\.\[ \r\n\]+(Thread .* hit )?Breakpoint.*" \
"continue to marker"
- if [string equal $trace3_at_first_loc "1"] {
+ if {[string equal $trace3_at_first_loc "1"]} {
gdb_test "${trace3} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
"${trace3} set_point 2"
} else {
@@ -272,7 +272,7 @@ proc break_trace_same_addr_6 { trace1 enable1 trace2 enable2 } \
# Start with a fresh gdb.
clean_restart ${executable}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -300,7 +300,7 @@ proc break_trace_same_addr_6 { trace1 enable1 trace2 enable2 } \
gdb_test_no_output "tstop"
- if [string equal $enable1 "enable"] {
+ if {[string equal $enable1 "enable"]} {
gdb_test "tfind tracepoint 4" "Found trace frame \[0-9\], tracepoint .*" \
"tfind test frame of tracepoint 4"
gdb_test "tdump" \
@@ -313,7 +313,7 @@ proc break_trace_same_addr_6 { trace1 enable1 trace2 enable2 } \
"tfind test frame of tracepoint 4"
}
- if [string equal $enable2 "enable"] {
+ if {[string equal $enable2 "enable"]} {
gdb_test "tfind tracepoint 5" "Found trace frame \[0-9\], tracepoint .*" \
"tfind test frame of tracepoint 5"
gdb_test "tdump" \
@@ -359,7 +359,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
}
clean_restart ${executable}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.trace/trace-buffer-size.c b/gdb/testsuite/gdb.trace/trace-buffer-size.c
index fbce4f4..44753b1 100644
--- a/gdb/testsuite/gdb.trace/trace-buffer-size.c
+++ b/gdb/testsuite/gdb.trace/trace-buffer-size.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/trace-buffer-size.exp b/gdb/testsuite/gdb.trace/trace-buffer-size.exp
index 880ffc6..153439f 100644
--- a/gdb/testsuite/gdb.trace/trace-buffer-size.exp
+++ b/gdb/testsuite/gdb.trace/trace-buffer-size.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,16 +17,16 @@ load_lib "trace-support.exp"
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile $srcfile \
- {debug nowarnings}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
+ {debug nowarnings}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
diff --git a/gdb/testsuite/gdb.trace/trace-common.h b/gdb/testsuite/gdb.trace/trace-common.h
index 47471d3..427a289 100644
--- a/gdb/testsuite/gdb.trace/trace-common.h
+++ b/gdb/testsuite/gdb.trace/trace-common.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/trace-condition.c b/gdb/testsuite/gdb.trace/trace-condition.c
index b702ec4..4290f9b 100644
--- a/gdb/testsuite/gdb.trace/trace-condition.c
+++ b/gdb/testsuite/gdb.trace/trace-condition.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/trace-condition.exp b/gdb/testsuite/gdb.trace/trace-condition.exp
index 17acda8..0463656 100644
--- a/gdb/testsuite/gdb.trace/trace-condition.exp
+++ b/gdb/testsuite/gdb.trace/trace-condition.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -25,16 +25,16 @@ set additional_flags [gdb_target_symbol_prefix_flags]
require gdb_trace_common_supports_arch
-if [prepare_for_testing "failed to prepare" $executable $srcfile \
- [list debug $additional_flags]] {
+if {[prepare_for_testing "failed to prepare" $executable $srcfile \
+ [list debug $additional_flags]]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
@@ -55,7 +55,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
clean_restart ${executable}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
@@ -69,7 +69,7 @@ proc test_tracepoints { trace_command condition num_frames { kfail_proc 0 } } {
clean_restart ${executable}
- if ![runto_main] {
+ if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/gdb.trace/trace-enable-disable.c b/gdb/testsuite/gdb.trace/trace-enable-disable.c
index b6f5254..a03b8e8 100644
--- a/gdb/testsuite/gdb.trace/trace-enable-disable.c
+++ b/gdb/testsuite/gdb.trace/trace-enable-disable.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/trace-enable-disable.exp b/gdb/testsuite/gdb.trace/trace-enable-disable.exp
index c2c8381..92d664b 100644
--- a/gdb/testsuite/gdb.trace/trace-enable-disable.exp
+++ b/gdb/testsuite/gdb.trace/trace-enable-disable.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -32,11 +32,11 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable $options] != ""
clean_restart ${testfile}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
@@ -64,7 +64,7 @@ proc test_tracepoint_enable_disable { tracepoint_cmd } {
set expected 0
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
diff --git a/gdb/testsuite/gdb.trace/trace-mt.c b/gdb/testsuite/gdb.trace/trace-mt.c
index 8296051..668e91b 100644
--- a/gdb/testsuite/gdb.trace/trace-mt.c
+++ b/gdb/testsuite/gdb.trace/trace-mt.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2012-2024 Free Software Foundation, Inc.
+ Copyright 2012-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/trace-mt.exp b/gdb/testsuite/gdb.trace/trace-mt.exp
index 7246ddc..ec6eaed 100644
--- a/gdb/testsuite/gdb.trace/trace-mt.exp
+++ b/gdb/testsuite/gdb.trace/trace-mt.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -22,32 +22,32 @@ set additional_flags [gdb_target_symbol_prefix_flags]
require gdb_trace_common_supports_arch
with_test_prefix "runtime trace support check" {
- if { [prepare_for_testing "prepare for testing" ${binfile} $srcfile \
+ if { [prepare_for_testing "prepare for testing" $testfile $srcfile \
[list debug pthreads $additional_flags]] } {
return
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
- if ![gdb_target_supports_trace] {
+ if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
}
-proc step_over_tracepoint { binfile trace_type } \
+proc step_over_tracepoint { testfile trace_type } \
{with_test_prefix "step over $trace_type" \
{
global hex
# Start with a fresh gdb.
- clean_restart $binfile
+ clean_restart $testfile
# Make sure inferior is running in all-stop mode.
gdb_test_no_output "set non-stop 0"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
@@ -63,14 +63,14 @@ proc step_over_tracepoint { binfile trace_type } \
# Set breakpoint and tracepoint at the same address.
-proc break_trace_same_addr { binfile trace_type option } \
+proc break_trace_same_addr { testfile trace_type option } \
{with_test_prefix "$trace_type $option" \
{
global hex
# Start with a fresh gdb.
- clean_restart $binfile
- if ![runto_main] {
+ clean_restart $testfile
+ if {![runto_main]} {
return -1
}
@@ -96,10 +96,10 @@ proc break_trace_same_addr { binfile trace_type option } \
}}
foreach break_always_inserted { "on" "off" } {
- break_trace_same_addr $binfile "trace" ${break_always_inserted}
+ break_trace_same_addr $testfile "trace" ${break_always_inserted}
}
-step_over_tracepoint $binfile "trace"
+step_over_tracepoint $testfile "trace"
require allow_shlib_tests
@@ -108,13 +108,13 @@ set libipa [get_in_proc_agent]
set remote_libipa [gdb_load_shlib $libipa]
# Compile test case again with IPA.
-set binfile_ipa ${binfile}-ipa
-if { [prepare_for_testing "prepare for testing" $binfile_ipa $srcfile \
+set testfile_ipa $testfile-ipa
+if { [prepare_for_testing "prepare for testing" $testfile_ipa $srcfile \
[list debug pthreads $additional_flags shlib=$libipa]] } {
return
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
@@ -122,8 +122,8 @@ if { [gdb_test "info sharedlibrary" ".*${remote_libipa}.*" "IPA loaded"] != 0 }
untested "could not find IPA lib loaded"
} else {
foreach break_always_inserted { "on" "off" } {
- break_trace_same_addr $binfile_ipa "ftrace" ${break_always_inserted}
+ break_trace_same_addr $testfile_ipa "ftrace" ${break_always_inserted}
}
- step_over_tracepoint $binfile_ipa "ftrace"
+ step_over_tracepoint $testfile_ipa "ftrace"
}
diff --git a/gdb/testsuite/gdb.trace/trace-unavailable.c b/gdb/testsuite/gdb.trace/trace-unavailable.c
index a56ca39..e298083 100644
--- a/gdb/testsuite/gdb.trace/trace-unavailable.c
+++ b/gdb/testsuite/gdb.trace/trace-unavailable.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/tracecmd.exp b/gdb/testsuite/gdb.trace/tracecmd.exp
index 688980c..275772b 100644
--- a/gdb/testsuite/gdb.trace/tracecmd.exp
+++ b/gdb/testsuite/gdb.trace/tracecmd.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,8 +36,8 @@ if {$baseline == -1} {
return
}
-set testline1 [expr $baseline + 1]
-set testline2 [expr $baseline + 3]
+set testline1 [expr {$baseline + 1}]
+set testline2 [expr {$baseline + 3}]
#
# test "help tracepoints"
@@ -45,7 +45,7 @@ set testline2 [expr $baseline + 3]
set helpcnt 0
test_class_help "tracepoints" {
- "Tracing of program execution without stopping the program\.[\r\n\]+"
+ "Tracing of program execution without stopping the program\.[\r\n\]+"
} {} "1.0: help tracepoints"
#
diff --git a/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.c b/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.c
index 5eda8e4..a61021f 100644
--- a/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.c
+++ b/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.exp b/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.exp
index 3eeb5bb..5f9159c 100644
--- a/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.exp
+++ b/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -23,11 +23,11 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
diff --git a/gdb/testsuite/gdb.trace/tspeed.c b/gdb/testsuite/gdb.trace/tspeed.c
index 35782aa..edd9052 100644
--- a/gdb/testsuite/gdb.trace/tspeed.c
+++ b/gdb/testsuite/gdb.trace/tspeed.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/tspeed.exp b/gdb/testsuite/gdb.trace/tspeed.exp
index c74680b..2578c9e 100644
--- a/gdb/testsuite/gdb.trace/tspeed.exp
+++ b/gdb/testsuite/gdb.trace/tspeed.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@ load_lib "trace-support.exp"
require allow_shlib_tests
-# Do not run if gdbsever debug is enabled - the output file is many Gb.
-if [gdbserver_debug_enabled] {
+# Do not run if gdbserver debug is enabled - the output file is many Gb.
+if {[gdbserver_debug_enabled]} {
return 0
}
@@ -33,11 +33,11 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable $options] != ""
clean_restart ${testfile}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
diff --git a/gdb/testsuite/gdb.trace/tstatus.exp b/gdb/testsuite/gdb.trace/tstatus.exp
index af0985f..2b4aa5a 100644
--- a/gdb/testsuite/gdb.trace/tstatus.exp
+++ b/gdb/testsuite/gdb.trace/tstatus.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Free Software Foundation, Inc.
+# Copyright 2011-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -20,16 +20,16 @@ set expfile tstatus.exp
require gdb_trace_common_supports_arch
-if [prepare_for_testing "failed to prepare" $executable $srcfile \
- [list debug]] {
+if {[prepare_for_testing "failed to prepare" $executable $srcfile \
+ [list debug]]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
diff --git a/gdb/testsuite/gdb.trace/tsv.exp b/gdb/testsuite/gdb.trace/tsv.exp
index 7a605c4..3fe6867 100644
--- a/gdb/testsuite/gdb.trace/tsv.exp
+++ b/gdb/testsuite/gdb.trace/tsv.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
return -1
}
-clean_restart $binfile
+clean_restart $testfile
# PR gdb/21352: Command tsave does not support -r argument
gdb_test "tsave -r" "Argument required \\\(file in which to save trace data\\\)\." \
@@ -193,7 +193,7 @@ gdb_test_multiple "target ctf ${tracefile}.ctf" "" {
}
# Restart.
-clean_restart ${binfile}
+clean_restart $testfile
if {![runto_main]} {
return
@@ -201,7 +201,7 @@ if {![runto_main]} {
# If there are predefined TSVs, test these predefined TSVs are correctly
# uploaded.
-if [target_info exists gdb,predefined_tsv] {
+if {[target_info exists gdb,predefined_tsv]} {
set tsv [target_info gdb,predefined_tsv]
# Test predefined TSVs are uploaded.
diff --git a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.c b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.c
index 83fc376..0bb28d9 100644
--- a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.c
+++ b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2013-2024 Free Software Foundation, Inc.
+ Copyright 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
index ce0165c..e62a539 100644
--- a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
+++ b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,165 +32,167 @@ Dwarf::assemble $asm_file {
declare_labels uchar_label struct_s_label foo_label struct_t_label bar_label
cu {} {
- compile_unit {{language @DW_LANG_C}} {
+ compile_unit {
+ DW_AT_language @DW_LANG_C
+ } {
uchar_label: DW_TAG_base_type {
- {name "unsigned char"}
- {byte_size 1 DW_FORM_sdata}
- {encoding @DW_ATE_unsigned_char}
+ DW_AT_name "unsigned char"
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_encoding @DW_ATE_unsigned_char
}
struct_s_label: DW_TAG_structure_type {
- {name s}
- {byte_size 3 DW_FORM_sdata}
- {decl_file 0 DW_FORM_udata}
- {decl_line 1 DW_FORM_udata}
+ DW_AT_name s
+ DW_AT_byte_size 3 DW_FORM_sdata
+ DW_AT_decl_file 0 DW_FORM_udata
+ DW_AT_decl_line 1 DW_FORM_udata
} {
DW_TAG_member {
- {name a}
- {type :$uchar_label}
- {data_member_location {
+ DW_AT_name a
+ DW_AT_type :$uchar_label
+ DW_AT_data_member_location {
DW_OP_plus_uconst 0
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_member {
- {name b}
- {type :$uchar_label}
- {data_member_location {
+ DW_AT_name b
+ DW_AT_type :$uchar_label
+ DW_AT_data_member_location {
DW_OP_plus_uconst 1
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_member {
- {name c}
- {type :$uchar_label}
- {data_member_location {
+ DW_AT_name c
+ DW_AT_type :$uchar_label
+ DW_AT_data_member_location {
DW_OP_plus_uconst 2
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
struct_t_label: DW_TAG_structure_type {
- {name t}
- {byte_size 3 DW_FORM_sdata}
- {decl_file 0 DW_FORM_udata}
- {decl_line 1 DW_FORM_udata}
+ DW_AT_name t
+ DW_AT_byte_size 3 DW_FORM_sdata
+ DW_AT_decl_file 0 DW_FORM_udata
+ DW_AT_decl_line 1 DW_FORM_udata
} {
DW_TAG_member {
- {name a}
- {type :$uchar_label}
- {data_member_location {
+ DW_AT_name a
+ DW_AT_type :$uchar_label
+ DW_AT_data_member_location {
DW_OP_plus_uconst 0
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_member {
- {name b}
- {type :$uchar_label}
- {byte_size 1 DW_FORM_sdata}
- {bit_size 1 DW_FORM_sdata}
- {bit_offset 7 DW_FORM_sdata}
- {data_member_location {
+ DW_AT_name b
+ DW_AT_type :$uchar_label
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_bit_size 1 DW_FORM_sdata
+ DW_AT_bit_offset 7 DW_FORM_sdata
+ DW_AT_data_member_location {
DW_OP_plus_uconst 1
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_member {
- {name c}
- {type :$uchar_label}
- {byte_size 1 DW_FORM_sdata}
- {bit_size 1 DW_FORM_sdata}
- {bit_offset 6 DW_FORM_sdata}
- {data_member_location {
+ DW_AT_name c
+ DW_AT_type :$uchar_label
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_bit_size 1 DW_FORM_sdata
+ DW_AT_bit_offset 6 DW_FORM_sdata
+ DW_AT_data_member_location {
DW_OP_plus_uconst 1
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_member {
- {name d}
- {type :$uchar_label}
- {byte_size 1 DW_FORM_sdata}
- {bit_size 1 DW_FORM_sdata}
- {bit_offset 5 DW_FORM_sdata}
- {data_member_location {
+ DW_AT_name d
+ DW_AT_type :$uchar_label
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_bit_size 1 DW_FORM_sdata
+ DW_AT_bit_offset 5 DW_FORM_sdata
+ DW_AT_data_member_location {
DW_OP_plus_uconst 1
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_member {
- {name e}
- {type :$uchar_label}
- {byte_size 1 DW_FORM_sdata}
- {bit_size 1 DW_FORM_sdata}
- {bit_offset 4 DW_FORM_sdata}
- {data_member_location {
+ DW_AT_name e
+ DW_AT_type :$uchar_label
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_bit_size 1 DW_FORM_sdata
+ DW_AT_bit_offset 4 DW_FORM_sdata
+ DW_AT_data_member_location {
DW_OP_plus_uconst 1
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_member {
- {name f}
- {type :$uchar_label}
- {byte_size 1 DW_FORM_sdata}
- {bit_size 1 DW_FORM_sdata}
- {bit_offset 3 DW_FORM_sdata}
- {data_member_location {
+ DW_AT_name f
+ DW_AT_type :$uchar_label
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_bit_size 1 DW_FORM_sdata
+ DW_AT_bit_offset 3 DW_FORM_sdata
+ DW_AT_data_member_location {
DW_OP_plus_uconst 1
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_member {
- {name g}
- {type :$uchar_label}
- {byte_size 1 DW_FORM_sdata}
- {bit_size 1 DW_FORM_sdata}
- {bit_offset 2 DW_FORM_sdata}
- {data_member_location {
+ DW_AT_name g
+ DW_AT_type :$uchar_label
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_bit_size 1 DW_FORM_sdata
+ DW_AT_bit_offset 2 DW_FORM_sdata
+ DW_AT_data_member_location {
DW_OP_plus_uconst 1
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_member {
- {name h}
- {type :$uchar_label}
- {byte_size 1 DW_FORM_sdata}
- {bit_size 1 DW_FORM_sdata}
- {bit_offset 1 DW_FORM_sdata}
- {data_member_location {
+ DW_AT_name h
+ DW_AT_type :$uchar_label
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_bit_size 1 DW_FORM_sdata
+ DW_AT_bit_offset 1 DW_FORM_sdata
+ DW_AT_data_member_location {
DW_OP_plus_uconst 1
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_member {
- {name i}
- {type :$uchar_label}
- {byte_size 1 DW_FORM_sdata}
- {bit_size 1 DW_FORM_sdata}
- {bit_offset 0 DW_FORM_sdata}
- {data_member_location {
+ DW_AT_name i
+ DW_AT_type :$uchar_label
+ DW_AT_byte_size 1 DW_FORM_sdata
+ DW_AT_bit_size 1 DW_FORM_sdata
+ DW_AT_bit_offset 0 DW_FORM_sdata
+ DW_AT_data_member_location {
DW_OP_plus_uconst 1
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_member {
- {name j}
- {type :$uchar_label}
- {data_member_location {
+ DW_AT_name j
+ DW_AT_type :$uchar_label
+ DW_AT_data_member_location {
DW_OP_plus_uconst 2
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
DW_TAG_subprogram {
- {name foo}
- {decl_file 0 udata}
- {low_pc foo_start_lbl addr}
- {high_pc foo_end_lbl addr}
+ DW_AT_name foo
+ DW_AT_decl_file 0 udata
+ DW_AT_low_pc foo_start_lbl addr
+ DW_AT_high_pc foo_end_lbl addr
} {
DW_TAG_formal_parameter {
- {type :$struct_s_label}
- {name x}
- {location {
+ DW_AT_type :$struct_s_label
+ DW_AT_name x
+ DW_AT_location {
DW_OP_lit0
DW_OP_stack_value
DW_OP_piece 2
DW_OP_reg0
DW_OP_piece 1
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_formal_parameter {
- {type :$struct_s_label}
- {name y}
- {location {
+ DW_AT_type :$struct_s_label
+ DW_AT_name y
+ DW_AT_location {
DW_OP_lit0
DW_OP_stack_value
DW_OP_piece 1
@@ -199,32 +201,32 @@ Dwarf::assemble $asm_file {
DW_OP_lit0
DW_OP_stack_value
DW_OP_piece 1
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_formal_parameter {
- {type :$struct_s_label}
- {name z}
- {location {
+ DW_AT_type :$struct_s_label
+ DW_AT_name z
+ DW_AT_location {
DW_OP_reg0
DW_OP_piece 1
DW_OP_lit0
DW_OP_stack_value
DW_OP_piece 2
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
DW_TAG_subprogram {
- {name bar}
- {decl_file 0 udata}
- {low_pc bar_start_lbl addr}
- {high_pc bar_end_lbl addr}
+ DW_AT_name bar
+ DW_AT_decl_file 0 udata
+ DW_AT_low_pc bar_start_lbl addr
+ DW_AT_high_pc bar_end_lbl addr
} {
DW_TAG_formal_parameter {
- {type :$struct_t_label}
- {name x}
- {location {
+ DW_AT_type :$struct_t_label
+ DW_AT_name x
+ DW_AT_location {
DW_OP_lit0
DW_OP_stack_value
DW_OP_piece 1
@@ -236,12 +238,12 @@ Dwarf::assemble $asm_file {
DW_OP_lit0
DW_OP_stack_value
DW_OP_piece 1
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_formal_parameter {
- {type :$struct_t_label}
- {name y}
- {location {
+ DW_AT_type :$struct_t_label
+ DW_AT_name y
+ DW_AT_location {
DW_OP_lit0
DW_OP_stack_value
DW_OP_piece 1
@@ -256,12 +258,12 @@ Dwarf::assemble $asm_file {
DW_OP_lit0
DW_OP_stack_value
DW_OP_piece 1
- } SPECIAL_expr}
+ } SPECIAL_expr
}
DW_TAG_formal_parameter {
- {type :$struct_t_label}
- {name z}
- {location {
+ DW_AT_type :$struct_t_label
+ DW_AT_name z
+ DW_AT_location {
DW_OP_lit0
DW_OP_stack_value
DW_OP_piece 1
@@ -273,7 +275,7 @@ Dwarf::assemble $asm_file {
DW_OP_lit0
DW_OP_stack_value
DW_OP_piece 1
- } SPECIAL_expr}
+ } SPECIAL_expr
}
}
@@ -292,11 +294,11 @@ if { [gdb_compile [list ${binfile}1.o ${binfile}2.o] ${binfile} \
clean_restart ${testfile}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
diff --git a/gdb/testsuite/gdb.trace/unavailable.cc b/gdb/testsuite/gdb.trace/unavailable.cc
index 2ea548e..f4bd6ac 100644
--- a/gdb/testsuite/gdb.trace/unavailable.cc
+++ b/gdb/testsuite/gdb.trace/unavailable.cc
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2002-2024 Free Software Foundation, Inc.
+ Copyright 2002-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
index 83a327b..9d4955f 100644
--- a/gdb/testsuite/gdb.trace/unavailable.exp
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -302,12 +302,12 @@ proc gdb_unavailable_registers_test_1 { } {
# Test reading uncollected pseudo-registers. The set of which
# depends on target.
- if [is_amd64_regs_target] {
+ if {[is_amd64_regs_target]} {
# Check the raw register first.
test_register_unavailable "\$rax"
test_register_unavailable "\$eax"
test_register_unavailable "\$ax"
- } elseif [is_x86_like_target] {
+ } elseif {[is_x86_like_target]} {
# Check the raw register first.
test_register_unavailable "\$eax"
test_register_unavailable "\$ax"
diff --git a/gdb/testsuite/gdb.trace/while-dyn.exp b/gdb/testsuite/gdb.trace/while-dyn.exp
index 05e546a..3940ff6 100644
--- a/gdb/testsuite/gdb.trace/while-dyn.exp
+++ b/gdb/testsuite/gdb.trace/while-dyn.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
return -1
}
-clean_restart $binfile
+clean_restart $testfile
runto_main
if {![gdb_target_supports_trace]} {
diff --git a/gdb/testsuite/gdb.trace/while-stepping.exp b/gdb/testsuite/gdb.trace/while-stepping.exp
index 81069d0..5a082a3 100644
--- a/gdb/testsuite/gdb.trace/while-stepping.exp
+++ b/gdb/testsuite/gdb.trace/while-stepping.exp
@@ -1,4 +1,4 @@
-# Copyright 1998-2024 Free Software Foundation, Inc.
+# Copyright 1998-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -105,7 +105,7 @@ if {[gdb_test "" "Breakpoint .*" "run to main"] != 0} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
diff --git a/gdb/testsuite/gdb.tui/basic.exp b/gdb/testsuite/gdb.tui/basic.exp
index ecb91de..8ecc91a 100644
--- a/gdb/testsuite/gdb.tui/basic.exp
+++ b/gdb/testsuite/gdb.tui/basic.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -112,5 +112,9 @@ set re_noattr "\[^<\]"
set status_window_line 15
set status [Term::get_line_with_attrs $status_window_line]
-gdb_assert { [regexp "^<reverse:1>$re_noattr*<reverse:0>$" $status] == 1} \
+verbose -log "status line: '$status'"
+
+# The status line uses standout, which may translate to different attributes
+# depending on the terminal settings. Just check for at least one attribute.
+gdb_assert { [regexp "^<.*>(exec|extended-r)" $status] == 1 } \
"status window: reverse"
diff --git a/gdb/testsuite/gdb.tui/break.exp b/gdb/testsuite/gdb.tui/break.exp
index 274d292..77b2695 100644
--- a/gdb/testsuite/gdb.tui/break.exp
+++ b/gdb/testsuite/gdb.tui/break.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/color-prompt.exp b/gdb/testsuite/gdb.tui/color-prompt.exp
index 9ed8c47..af6e467 100644
--- a/gdb/testsuite/gdb.tui/color-prompt.exp
+++ b/gdb/testsuite/gdb.tui/color-prompt.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,18 +15,16 @@
# Check using a prompt with color in TUI.
+require allow_tui_tests
+
tuiterm_env
Term::clean_restart 24 80
-# Set colored prompt.
if {![Term::enter_tui]} {
unsupported "TUI not supported"
return
}
-Term::command "set prompt \\033\[31m(gdb) \\033\[0m"
-
-set line [Term::get_line_with_attrs $Term::_cur_row]
-gdb_assert { [regexp "^<fg:red>$gdb_prompt <fg:default> *$" $line] } \
- "prompt with color"
+set tui 1
+source $srcdir/$subdir/color-prompt.exp.tcl
diff --git a/gdb/testsuite/gdb.tui/color-prompt.exp.tcl b/gdb/testsuite/gdb.tui/color-prompt.exp.tcl
new file mode 100644
index 0000000..e6f4d3b
--- /dev/null
+++ b/gdb/testsuite/gdb.tui/color-prompt.exp.tcl
@@ -0,0 +1,80 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check using a prompt with color in TUI ($tui == 0) or CLI ($tui == 0).
+
+set csi [string cat {\033} "\["]
+set rl_prompt_start_ignore {\001}
+set rl_prompt_end_ignore {\002}
+
+foreach_with_prefix rl_prompt_start_end_ignore { 0 1 } {
+ set color_on [string cat $csi 31m]
+ set color_off [string cat $csi 0m]
+
+ if { $rl_prompt_start_end_ignore } {
+ set color_on \
+ [string cat \
+ $rl_prompt_start_ignore \
+ $color_on \
+ $rl_prompt_end_ignore]
+ set color_off \
+ [string cat \
+ $rl_prompt_start_ignore \
+ $color_off \
+ $rl_prompt_end_ignore]
+ }
+
+ # Set prompt with color.
+ set prompt "${color_on}(gdb) $color_off"
+ Term::command "set prompt $prompt"
+
+ # Check the color.
+ set line [Term::get_line_with_attrs $Term::_cur_row]
+ gdb_assert { [regexp "^<fg:red>$gdb_prompt <fg:default> *$" $line] } \
+ "prompt with color"
+
+ # Type a string.
+ set cmd "some long command"
+ send_gdb $cmd
+ Term::wait_for_line ^[string_to_regexp "(gdb) $cmd"] 23
+
+ # Send ^A, aka C-a, trigger beginning-of-line.
+ send_gdb "\001"
+ if { $tui || $rl_prompt_start_end_ignore } {
+ Term::wait_for_line ^[string_to_regexp "(gdb) $cmd"] 6
+ } else {
+ # Without the markers, readline may get the cursor position wrong, so
+ # match less strict.
+ Term::wait_for_line ^[string_to_regexp "(gdb) $cmd"]
+ }
+ Term::dump_screen
+
+ # Type something else to flush out the effect of the ^A.
+ set prefix "A"
+ send_gdb $prefix
+ if { $tui || $rl_prompt_start_end_ignore } {
+ Term::wait_for_line ^[string_to_regexp "(gdb) $prefix$cmd"] 7
+ } else {
+ # Without the markers, readline may get the cursor position wrong, so
+ # match less strict.
+ Term::wait_for_line [string_to_regexp "$prefix"]
+ }
+
+ # Abort command line editing, and regenerate prompt.
+ send_gdb "\003"
+
+ # Reset prompt to default prompt.
+ Term::command "set prompt (gdb) "
+}
diff --git a/gdb/testsuite/gdb.tui/compact-source.exp b/gdb/testsuite/gdb.tui/compact-source.exp
index 79c8c85..31bc1dc 100644
--- a/gdb/testsuite/gdb.tui/compact-source.exp
+++ b/gdb/testsuite/gdb.tui/compact-source.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
return -1
}
-Term::clean_restart 24 80 $binfile
+Term::clean_restart 24 80 $testfile
gdb_test_no_output "maint set tui-left-margin-verbose on"
gdb_test_no_output "set tui compact-source on"
@@ -55,9 +55,9 @@ set re_border "\\|"
set max_line_nr_in_source_file [llength $src_list]
# Ensure there are more lines in the window than in the source file.
-set src_window_lines [expr $max_line_nr_in_source_file + 2]
+set src_window_lines [expr {$max_line_nr_in_source_file + 2}]
# Account for border size.
-set src_window_size [expr $src_window_lines + 2]
+set src_window_size [expr {$src_window_lines + 2}]
Term::command "wh src $src_window_size"
set re_left_margin "___4_"
@@ -65,6 +65,6 @@ set re_left_margin "___4_"
Term::check_contents "compact source format" \
"$re_border$re_left_margin$re_line_four *$re_border"
-set re_left_margin "___0*[expr $max_line_nr_in_source_file + 1]_"
+set re_left_margin "___0*[expr {$max_line_nr_in_source_file + 1}]_"
Term::check_contents_not "no surplus line number" \
"$re_border$re_left_margin *$re_border"
diff --git a/gdb/testsuite/gdb.tui/completion.exp b/gdb/testsuite/gdb.tui/completion.exp
index e79c468..7d126e0 100644
--- a/gdb/testsuite/gdb.tui/completion.exp
+++ b/gdb/testsuite/gdb.tui/completion.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/corefile-run.exp b/gdb/testsuite/gdb.tui/corefile-run.exp
index f96ead9..657fc83 100644
--- a/gdb/testsuite/gdb.tui/corefile-run.exp
+++ b/gdb/testsuite/gdb.tui/corefile-run.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,6 +18,8 @@
#
# Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1765117
+require gcore_cmd_available
+
tuiterm_env
standard_testfile tui-layout.c
diff --git a/gdb/testsuite/gdb.tui/empty.exp b/gdb/testsuite/gdb.tui/empty.exp
index 1adf30b..19196e8 100644
--- a/gdb/testsuite/gdb.tui/empty.exp
+++ b/gdb/testsuite/gdb.tui/empty.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -65,7 +65,7 @@ set layouts {
proc check_boxes {boxes} {
set boxno 1
foreach box $boxes {
- eval Term::check_box [list "box $boxno"] $box
+ Term::check_box "box $boxno" {*}$box
incr boxno
}
}
diff --git a/gdb/testsuite/gdb.tui/esc-match.exp b/gdb/testsuite/gdb.tui/esc-match.exp
new file mode 100644
index 0000000..db78ebe
--- /dev/null
+++ b/gdb/testsuite/gdb.tui/esc-match.exp
@@ -0,0 +1,48 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test that the ANSI escape sequence matcher works
+# character-by-character.
+
+load_lib gdb-python.exp
+require allow_python_tests allow_tui_tests
+
+tuiterm_env
+
+Term::clean_restart 24 80
+
+set remote_python_file [gdb_remote_download host \
+ ${srcdir}/${subdir}/esc-match.py]
+gdb_test_no_output "source ${remote_python_file}" \
+ "source esc-match.py"
+
+if {![Term::enter_tui]} {
+ unsupported "TUI not supported"
+ return
+}
+
+Term::command "python print_it()"
+
+Term::dump_screen
+
+set text [Term::get_all_lines]
+# We should not see the control sequence here.
+gdb_assert {![regexp -- "\\\[35;1mOUTPUT\\\[m" $text]} \
+ "output visible without control sequences"
+
+# Also check the styling.
+set text [Term::get_region 0 1 78 23 "\n" true]
+gdb_assert {[regexp -- "<fg:magenta>.*OUTPUT" $text]} \
+ "output is magenta"
diff --git a/gdb/testsuite/gdb.tui/esc-match.py b/gdb/testsuite/gdb.tui/esc-match.py
new file mode 100644
index 0000000..7816002
--- /dev/null
+++ b/gdb/testsuite/gdb.tui/esc-match.py
@@ -0,0 +1,26 @@
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import sys
+
+# Some text to print that includes styling.
+OUT = "\033[35;1mOUTPUT\033[m"
+
+
+def print_it():
+ # Print to stderr avoids any buffering, showing the bug.
+ for c in OUT:
+ print(c, end="", file=sys.stderr)
+ print(file=sys.stderr)
diff --git a/gdb/testsuite/gdb.tui/gdb.sh b/gdb/testsuite/gdb.tui/gdb.sh
new file mode 100755
index 0000000..32a4e8a
--- /dev/null
+++ b/gdb/testsuite/gdb.tui/gdb.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+printf "foo\033(%%5"
+
+read -r _
diff --git a/gdb/testsuite/gdb.tui/info-win.exp b/gdb/testsuite/gdb.tui/info-win.exp
index 4d71f04..fd880b3 100644
--- a/gdb/testsuite/gdb.tui/info-win.exp
+++ b/gdb/testsuite/gdb.tui/info-win.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/list-before.exp b/gdb/testsuite/gdb.tui/list-before.exp
index 2474365..3323c85 100644
--- a/gdb/testsuite/gdb.tui/list-before.exp
+++ b/gdb/testsuite/gdb.tui/list-before.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/list.exp b/gdb/testsuite/gdb.tui/list.exp
index 74b2c51..d24479f 100644
--- a/gdb/testsuite/gdb.tui/list.exp
+++ b/gdb/testsuite/gdb.tui/list.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/long-prompt.exp b/gdb/testsuite/gdb.tui/long-prompt.exp
index 1116b57..c4cb2c3 100644
--- a/gdb/testsuite/gdb.tui/long-prompt.exp
+++ b/gdb/testsuite/gdb.tui/long-prompt.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/main-2.exp b/gdb/testsuite/gdb.tui/main-2.exp
index 1dcb3cf..2bc6b8d 100644
--- a/gdb/testsuite/gdb.tui/main-2.exp
+++ b/gdb/testsuite/gdb.tui/main-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ if { [build_executable "failed to prepare" $testfile $srcfile ] == -1} {
return -1
}
-Term::clean_restart 24 80 $binfile
+Term::clean_restart 24 80 $testfile
if {![runto_main]} {
perror "test suppressed"
@@ -41,7 +41,7 @@ if {![Term::enter_tui]} {
set line " return 0;"
set nr [gdb_get_line_number $line]
-set screen_line [Term::get_line_with_attrs 6]
+set screen_line [Term::get_string_with_attrs 6 11 79]
verbose -log "screen line 6: '$screen_line'"
-gdb_assert { [regexp "$nr <reverse:1>$line<reverse:0>" $screen_line] } \
+gdb_assert { [regexp "<reverse:1>$line<reverse:0>" $screen_line] } \
"highlighted line in middle of source window"
diff --git a/gdb/testsuite/gdb.tui/main-one-line.c b/gdb/testsuite/gdb.tui/main-one-line.c
index 60744a9..442865c 100644
--- a/gdb/testsuite/gdb.tui/main-one-line.c
+++ b/gdb/testsuite/gdb.tui/main-one-line.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/main.exp b/gdb/testsuite/gdb.tui/main.exp
index 4213035..e49da35 100644
--- a/gdb/testsuite/gdb.tui/main.exp
+++ b/gdb/testsuite/gdb.tui/main.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,7 +43,10 @@ if {![Term::enter_tui]} {
}
send_gdb "file [standard_output_file $testfile]\n"
-gdb_assert { [Term::wait_for "Reading symbols from"] } "file command"
+# Matching the output is difficult because it may or may not wrap. Simply
+# match the resulting prompt.
+gdb_assert { [Term::wait_for ""] } "file command"
+
Term::check_contents "show main after file" \
[string_to_regexp "|___[format %06d $nr]_$line"]
diff --git a/gdb/testsuite/gdb.tui/narrow.exp b/gdb/testsuite/gdb.tui/narrow.exp
index 2efa440..b721475 100644
--- a/gdb/testsuite/gdb.tui/narrow.exp
+++ b/gdb/testsuite/gdb.tui/narrow.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/new-layout.exp b/gdb/testsuite/gdb.tui/new-layout.exp
index f838814..6a4c68f 100644
--- a/gdb/testsuite/gdb.tui/new-layout.exp
+++ b/gdb/testsuite/gdb.tui/new-layout.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,15 +45,12 @@ gdb_test "tui new-layout example src 1 src 1" \
gdb_test "tui new-layout example src 1" \
"New layout does not contain the \"cmd\" window"
-# Avoid unbalanced curly braces problems with tcl 8.5.
-if { [tcl_version_at_least 8 6] } {
- gdb_test "tui new-layout example src 1\}" \
- "Extra '\}' in layout specification"
- gdb_test "tui new-layout example {src 1} 1\}" \
- "Extra '\}' in layout specification"
- gdb_test "tui new-layout example \{src 1" \
- "Missing '\}' in layout specification"
-}
+gdb_test "tui new-layout example src 1\}" \
+ "Extra '\}' in layout specification"
+gdb_test "tui new-layout example {src 1} 1\}" \
+ "Extra '\}' in layout specification"
+gdb_test "tui new-layout example \{src 1" \
+ "Missing '\}' in layout specification"
# Each entry of this list describes a layout, and some associated
# tests. The items within each entry are:
@@ -84,7 +81,7 @@ set layouts \
proc check_boxes {boxes} {
set boxno 1
foreach box $boxes {
- eval Term::check_box [list "box $boxno"] $box
+ Term::check_box "box $boxno" {*}$box
incr boxno
}
}
@@ -150,4 +147,7 @@ Term::check_box "before cmd_only: src box in src layout" 0 0 80 15
Term::command "layout cmd_only"
Term::command "layout src"
+
+# Flush out and check the resulting src box.
+Term::command "print 1"
Term::check_box "after cmd_only: src box in src layout" 0 0 80 15
diff --git a/gdb/testsuite/gdb.tui/pr30056.exp b/gdb/testsuite/gdb.tui/pr30056.exp
index 11e198d..22278e3 100644
--- a/gdb/testsuite/gdb.tui/pr30056.exp
+++ b/gdb/testsuite/gdb.tui/pr30056.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,67 +22,72 @@ require {have_host_locale C.UTF-8}
tuiterm_env
+standard_testfile tui-long-line.c
+
+if { [build_executable "failed to prepare" $testfile $srcfile] == -1 } {
+ return
+}
+
save_vars { env(LC_ALL) } {
setenv LC_ALL C.UTF-8
# Start terminal.
- Term::clean_restart 24 80
-
- # Start TUI.
- if {![Term::enter_tui]} {
- unsupported "TUI not supported"
- return
- }
-
- # Send "^R", starting reverse-i-search.
- send_gdb "\022"
- Term::wait_for_region_contents 0 $Term::_cur_row $Term::_cols 1 \
- [string_to_regexp "(reverse-i-search)`': "]
-
- # Send "xyz".
- send_gdb "xyz"
- Term::wait_for_region_contents 0 $Term::_cur_row $Term::_cols 1 \
- [string_to_regexp "(failed reverse-i-search)`xyz': "]
-
- # Send arrow-right.
- send_gdb "\033\[C"
+ Term::clean_restart 24 80 $testfile
+}
- # We need to the arrow-right to be processed by readline, before we
- # send the following ^C. Waiting 1 ms seems to do that.
- after 1
+# Start TUI.
+if {![Term::enter_tui]} {
+ unsupported "TUI not supported"
+ return
+}
- # Send ^C.
+# Send "^R", starting reverse-i-search.
+send_gdb "\022"
+gdb_assert { [Term::wait_for_region_contents 0 $Term::_cur_row $Term::_cols 1 \
+ [string_to_regexp "(reverse-i-search)`': "]] } \
+ "reverse-i-search"
+
+# Send "xyz".
+send_gdb "xyz"
+gdb_assert { [Term::wait_for_region_contents 0 $Term::_cur_row $Term::_cols 1 \
+ [string_to_regexp "(failed reverse-i-search)`xyz': "]] } \
+ "xyz"
+
+# Send arrow-right.
+send_gdb "\033\[C"
+# Wait for arrow-right effect.
+gdb_assert { [Term::wait_for_region_contents 1 1 78 13 \
+ [string_to_regexp " ain (void)"]] } "arrow right"
+
+# Send ^C.
+send_gdb "\003"
+gdb_assert { [Term::wait_for "Quit"] } "Control-C"
+
+set test "Control-C aborts isearch"
+
+# Send "xyz", again.
+send_gdb "xyz"
+# Wait for xyx to appear.
+gdb_assert { [Term::wait_for_region_contents \
+ 0 $Term::_cur_row $Term::_cols 1 "xyz"] } \
+ "xyz, again"
+
+if { [Term::check_region_contents_p 0 $Term::_cur_row $Term::_cols 1 \
+ "^$gdb_prompt xyz"] } {
+ pass $test
+
+ # Send ^C to clear the command line.
send_gdb "\003"
- gdb_assert { [Term::wait_for "Quit"] } "Control-C"
-
- # Uncomment this to simulate that PR cli/30498 is fixed.
- #send_gdb "\007"
-
- set test "Control-C aborts isearch"
-
- # Send "xyz", again.
- send_gdb "xyz"
- # Wait for xyx to appear.
- Term::wait_for_region_contents 0 $Term::_cur_row $Term::_cols 1 "xyz"
-
- if { [Term::check_region_contents_p 0 $Term::_cur_row $Term::_cols 1 \
- "^$gdb_prompt xyz"] } {
- pass $test
-
- # Send ^C to clear the command line.
- send_gdb "\003"
- } else {
- # Sending ^C currently doesn't abort the i-search. PR cli/30498 is
- # open about this.
- kfail cli/30498 $test
-
- # At this point we don't have a reponsive prompt. Send ^G to abort
- # the i-search.
- send_gdb "\007"
- }
-
- # We need a reponsive prompt here, to deal with the "monitor exit"
- # that native-extended-gdbserver will send. Check that we have a
- # responsive prompt.
- Term::command "echo \\n"
+} else {
+ # Sending ^C currently doesn't abort the i-search.
+ fail $test
+
+ # At this point we don't have a responsive prompt. Send ^G to abort
+ # the i-search.
+ send_gdb "\007"
}
+
+# We need a responsive prompt here, to deal with the "monitor exit"
+# that native-extended-gdbserver will send. Check that we have a
+# responsive prompt.
+Term::command "echo \\n"
diff --git a/gdb/testsuite/gdb.tui/regs.exp b/gdb/testsuite/gdb.tui/regs.exp
index 183c2ea..fbc93fd 100644
--- a/gdb/testsuite/gdb.tui/regs.exp
+++ b/gdb/testsuite/gdb.tui/regs.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/reread.exp b/gdb/testsuite/gdb.tui/reread.exp
index 9f16bee..c8b0beb 100644
--- a/gdb/testsuite/gdb.tui/reread.exp
+++ b/gdb/testsuite/gdb.tui/reread.exp
@@ -1,4 +1,4 @@
-# Copyright 2024 Free Software Foundation, Inc.
+# Copyright 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/resize-2.exp b/gdb/testsuite/gdb.tui/resize-2.exp
index 729e1ee..4262dc9 100644
--- a/gdb/testsuite/gdb.tui/resize-2.exp
+++ b/gdb/testsuite/gdb.tui/resize-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/resize-one-line.exp b/gdb/testsuite/gdb.tui/resize-one-line.exp
index bdb7e01..bd89c17 100644
--- a/gdb/testsuite/gdb.tui/resize-one-line.exp
+++ b/gdb/testsuite/gdb.tui/resize-one-line.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/resize.exp b/gdb/testsuite/gdb.tui/resize.exp
index 1fa86f5..e13b269 100644
--- a/gdb/testsuite/gdb.tui/resize.exp
+++ b/gdb/testsuite/gdb.tui/resize.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/scroll.exp b/gdb/testsuite/gdb.tui/scroll.exp
index 6fba0e1..3c17e71 100644
--- a/gdb/testsuite/gdb.tui/scroll.exp
+++ b/gdb/testsuite/gdb.tui/scroll.exp
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Free Software Foundation, Inc.
+# Copyright 2021-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/secondary-prompt.exp b/gdb/testsuite/gdb.tui/secondary-prompt.exp
index 63e62db..d92bb78 100644
--- a/gdb/testsuite/gdb.tui/secondary-prompt.exp
+++ b/gdb/testsuite/gdb.tui/secondary-prompt.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/single-key-2.exp b/gdb/testsuite/gdb.tui/single-key-2.exp
index efaaf03..33a8b14 100644
--- a/gdb/testsuite/gdb.tui/single-key-2.exp
+++ b/gdb/testsuite/gdb.tui/single-key-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/single-key.exp b/gdb/testsuite/gdb.tui/single-key.exp
index f821941..a3887e0 100644
--- a/gdb/testsuite/gdb.tui/single-key.exp
+++ b/gdb/testsuite/gdb.tui/single-key.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/small-term.exp b/gdb/testsuite/gdb.tui/small-term.exp
index 9ed150e..0ff8027 100644
--- a/gdb/testsuite/gdb.tui/small-term.exp
+++ b/gdb/testsuite/gdb.tui/small-term.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/source-search.c b/gdb/testsuite/gdb.tui/source-search.c
new file mode 100644
index 0000000..2320c5c
--- /dev/null
+++ b/gdb/testsuite/gdb.tui/source-search.c
@@ -0,0 +1,127 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int
+main (void)
+{
+ /* Line 21 */
+ /* Line 22 */
+ /* Line 23 */
+ /* Line 24 */
+ /* Line 25 */
+ /* Line 26 */
+ /* Line 27 */
+ /* Line 28 */
+ /* Line 29 */
+ /* Line 30 */
+ /* Line 31 */
+ /* Line 32 */
+ /* Line 33 */
+ /* Line 34 */
+ /* Line 35 */
+ /* Line 36 */
+ /* Line 37 */
+ /* Line 38 */
+ /* Line 39 */
+ /* Line 40 */
+ /* Line 41 */
+ /* Line 42 */
+ /* Line 43 */
+ /* Line 44 */
+ /* Line 45 */
+ /* Line 46 */
+ /* Line 47 */
+ /* Line 48 */
+ /* Line 49 */
+ /* Line 50 */
+ /* Line 51 */
+ /* Line 52 */
+ /* Line 53 */
+ /* Line 54 */
+ /* Line 55 */
+ /* Line 56 */
+ /* Line 57 */
+ /* Line 58 */
+ /* Line 59 */
+ /* Line 60 */
+ /* Line 61 */
+ /* Line 62 */
+ /* Line 63 */
+ /* Line 64 */
+ /* Line 65 */
+ /* Line 66 */
+ /* Line 67 */
+ /* Line 68 */
+ /* Line 69 */
+ /* Line 70 */
+ /* Line 71 */
+ /* Line 72 */
+ /* Line 73 */
+ /* Line 74 */
+ /* Line 75 */
+ /* Line 76 */
+ /* Line 77 */
+ /* Line 78 */
+ /* Line 79 */
+ /* Line 80 */
+ /* Line 81 */
+ /* Line 82 */
+ /* Line 83 */
+ /* Line 84 */
+ /* Line 85 */
+ /* Line 86 */
+ /* Line 87 */
+ /* Line 88 */
+ /* Line 89 */
+ /* Line 90 */
+ /* Line 91 */
+ /* Line 92 */
+ /* Line 93 */
+ /* Line 94 */
+ /* Line 95 */
+ /* Line 96 */
+ /* Line 97 */
+ /* Line 98 */
+ /* Line 99 */
+ /* Line 100 */
+ /* Line 101 */
+ /* Line 102 */
+ /* Line 103 */
+ /* Line 104 */
+ /* Line 105 */
+ /* Line 106 */
+ /* Line 107 */
+ /* Line 108 */
+ /* Line 109 */
+ /* Line 110 */
+ /* Line 111 */
+ /* Line 112 */
+ /* Line 113 */
+ /* Line 114 */
+ /* Line 115 */
+ /* Line 116 */
+ /* Line 117 */
+ /* Line 118 */
+ /* Line 119 */
+ /* Line 120 */
+ /* Line 121 */
+ /* Line 122 */
+ /* Line 123 */
+ /* Line 124 */
+ /* Line 125 */
+ return 0;
+} /* Last line. */
diff --git a/gdb/testsuite/gdb.tui/source-search.exp b/gdb/testsuite/gdb.tui/source-search.exp
new file mode 100644
index 0000000..4fcdca3
--- /dev/null
+++ b/gdb/testsuite/gdb.tui/source-search.exp
@@ -0,0 +1,72 @@
+# Copyright 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test forward-search and reverse-search within the TUI src window.
+
+tuiterm_env
+
+standard_testfile .c
+
+if {[build_executable "failed to build" ${testfile} ${srcfile}] == -1} {
+ return
+}
+
+Term::clean_restart 24 80 $testfile
+if {![Term::enter_tui]} {
+ unsupported "TUI not supported"
+ return
+}
+
+proc check_src_window { testname first_line } {
+ set last_line [expr {$first_line + 12}]
+ Term::check_box_contents $testname 0 0 80 15 \
+ "^\\s+${first_line}\\s+.*\\s+${last_line}\\s+/\\* Line ${last_line} \\*/\\s+$"
+
+}
+
+# Initialise the src window so that it is displaying known contents.
+# Check that the expected contents are displayed.
+Term::command "list 20"
+set first_line 15
+check_src_window "initial src contents" $first_line
+
+# Search forward. Searches are from the last line displayed, so this
+# will move the next source line onto the screen each time.
+for { set i 1 } { $i < 4 } { incr i } {
+ incr first_line
+ Term::command "forward-search Line"
+ check_src_window "src windows after forward-search $i" $first_line
+}
+
+# Reverse search. Like forward-search, but move backward through the
+# source.
+for { set i 1 } { $i < 3 } { incr i } {
+ incr first_line -1
+ Term::command "reverse-search Line"
+ check_src_window "src windows after reverse-search $i" $first_line
+}
+
+# Until there are no matching lines left.
+Term::command "reverse-search Line"
+gdb_assert {[regexp -- "^Expression not found\\s+$" [Term::get_line 22]]} \
+ "check start of source was reached"
+
+Term::command "forward-search Last line"
+Term::check_box_contents "forward-search to end of file" 0 0 80 15 \
+ "^\\s+122\\s+.*/\\* Last line\\. \\*/\\s+$"
+
+Term::command "reverse-search This testcase is part"
+Term::check_box_contents "reverse-search to start of file" 0 0 80 15 \
+ "^\\s+1\\s+.*\\s+13\\s+GNU General Public License for more details\\.\\s+$"
diff --git a/gdb/testsuite/gdb.tui/tui-disasm-long-lines.c b/gdb/testsuite/gdb.tui/tui-disasm-long-lines.c
index 514abf5..74b03eb 100644
--- a/gdb/testsuite/gdb.tui/tui-disasm-long-lines.c
+++ b/gdb/testsuite/gdb.tui/tui-disasm-long-lines.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/tui-disasm-long-lines.exp b/gdb/testsuite/gdb.tui/tui-disasm-long-lines.exp
index e0ed682..7a9841f 100644
--- a/gdb/testsuite/gdb.tui/tui-disasm-long-lines.exp
+++ b/gdb/testsuite/gdb.tui/tui-disasm-long-lines.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "$binfile" \
}
}
-Term::clean_restart 24 80 $binfile
+Term::clean_restart 24 80 $testfile
if {![Term::prepare_for_tui]} {
unsupported "TUI not supported"
return
diff --git a/gdb/testsuite/gdb.tui/tui-disasm-styling.exp b/gdb/testsuite/gdb.tui/tui-disasm-styling.exp
index 513d787..6859744 100644
--- a/gdb/testsuite/gdb.tui/tui-disasm-styling.exp
+++ b/gdb/testsuite/gdb.tui/tui-disasm-styling.exp
@@ -37,12 +37,15 @@ proc check_asm_output { expect_styled testname } {
$testname
}
-Term::clean_restart 24 80 $binfile
+Term::clean_restart 24 80 $testfile
if {![Term::enter_tui]} {
unsupported "TUI not supported"
return
}
+# Proc enter_tui switches off styling, re-enable it.
+Term::command "set style enabled on"
+
Term::command "layout asm"
Term::check_box "asm box" 0 0 80 15
diff --git a/gdb/testsuite/gdb.tui/tui-focus.c b/gdb/testsuite/gdb.tui/tui-focus.c
index cb8b860..4caa75a 100644
--- a/gdb/testsuite/gdb.tui/tui-focus.c
+++ b/gdb/testsuite/gdb.tui/tui-focus.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/tui-focus.exp b/gdb/testsuite/gdb.tui/tui-focus.exp
index 2377ce2..50a3315 100644
--- a/gdb/testsuite/gdb.tui/tui-focus.exp
+++ b/gdb/testsuite/gdb.tui/tui-focus.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ foreach spec {{src true} {cmd true} {status true} {regs false} \
lassign $spec window valid_p
with_test_prefix "window=$window" {
- Term::clean_restart 24 80 $binfile
+ Term::clean_restart 24 80 $testfile
if {![Term::prepare_for_tui]} {
unsupported "TUI not supported"
return
@@ -73,9 +73,9 @@ foreach spec {{src true} {cmd true} {status true} {regs false} \
}
}
-# Use the Python TUI API to exercise some of the ambigous window name
+# Use the Python TUI API to exercise some of the ambiguous window name
# handling parts of the 'focus' command.
-Term::clean_restart 24 80 $binfile
+Term::clean_restart 24 80 $testfile
if {[allow_python_tests]} {
# Create a very simple tui window.
gdb_py_test_silent_cmd \
diff --git a/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.S b/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.S
index bbca380..6e36152 100644
--- a/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.S
+++ b/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,8 +20,11 @@ _start:
.rept 5
nop
.endr
+
+#ifndef __CYGWIN__
#ifdef __arm__
.section .note.GNU-stack,"",%progbits
#else
.section .note.GNU-stack,"",@progbits
#endif
+#endif
diff --git a/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.exp b/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.exp
index 09afa5c..e21914b 100644
--- a/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.exp
+++ b/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,9 +20,13 @@ tuiterm_env
standard_testfile tui-layout-asm-short-prog.S
-if {[build_executable "failed to prepare" ${testfile} ${srcfile} \
- {debug additional_flags=-nostdlib \
- additional_flags=-nostartfiles}] == -1} {
+set opts {}
+lappend opts debug
+lappend opts additional_flags=-static
+lappend opts additional_flags=-nostdlib
+lappend opts ldflags=-nostartfiles
+
+if { [build_executable "failed to prepare" $testfile $srcfile $opts] == -1 } {
return -1
}
@@ -53,7 +57,7 @@ gdb_assert { [string match "|___0x*" $first_line] } \
# Scroll forward a large amount, this should take us to the last
# instruction in the program.
-Term::command "+ 13"
+Term::command "+ 15"
Term::check_box_contents "check asm box contents again" 0 0 80 15 \
[multi_line \
"^___$hex\[^\r\n\]+" \
@@ -61,6 +65,6 @@ Term::check_box_contents "check asm box contents again" 0 0 80 15 \
# Now scroll backward again, we should return to the start of the
# program.
-Term::command "- 13"
+Term::command "- 15"
gdb_assert {[string eq "$first_line" [Term::get_line 1]]} \
"check first line is back"
diff --git a/gdb/testsuite/gdb.tui/tui-layout-asm.exp b/gdb/testsuite/gdb.tui/tui-layout-asm.exp
index 91566ca..333276e 100644
--- a/gdb/testsuite/gdb.tui/tui-layout-asm.exp
+++ b/gdb/testsuite/gdb.tui/tui-layout-asm.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +24,9 @@ if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
return -1
}
-# PPC currently needs a minimum window width of 90 to work correctly.
+# The wider the window is, the less line truncation happens, so matching
+# pre-scroll to post-scroll lines is more accurate. But 100% accurate line
+# matching isn't a goal of the test-case.
set tui_asm_window_width 90
Term::clean_restart 24 ${tui_asm_window_width} $testfile
@@ -33,15 +35,41 @@ if {![Term::prepare_for_tui]} {
return
}
-# Helper proc, returns a count of the ' ' characters in STRING.
-proc count_whitespace { string } {
- return [expr {[llength [split $string { }]] - 1}]
-}
-
# This puts us into TUI mode, and should display the ASM window.
Term::command_no_prompt_prefix "layout asm"
Term::check_box_contents "check asm box contents" 0 0 ${tui_asm_window_width} 15 "<main>"
+set re_border [string_to_regexp "|"]
+
+proc drop_borders { line } {
+ # Drop left border.
+ set line [regsub -- ^$::re_border $line {}]
+ # Drop right border.
+ set line [regsub -- $::re_border$ $line {}]
+
+ return $line
+}
+
+proc lines_match { line1 line2 } {
+ set line1 [drop_borders $line1]
+ set line2 [drop_borders $line2]
+
+ foreach line [list $line1 $line2] re [list $line2 $line1] {
+ # Convert to regexp.
+ set re [string_to_regexp $re]
+
+ # Ignore whitespace mismatches.
+ regsub -all {\s+} $re {\s+} re
+
+ # Allow a substring match.
+ if { [regexp -- $re $line] } {
+ return 1
+ }
+ }
+
+ return 0
+}
+
# Scroll the ASM window down using the down arrow key. In an ideal
# world we'd like to use PageDown here, but currently our terminal
# library doesn't support such advanced things.
@@ -58,51 +86,55 @@ while (1) {
# below will just timeout. So for now we avoid testing the edge
# case.
if {[regexp -- "^\\| +\\|$" $line]} {
- # Second line is blank, we're at the end of the assembler.
- pass $testname
+ # Second line is blank, we're at the end of the assembly.
+ pass "$testname (end of assembly reached)"
break
}
# Send the down key to GDB.
send_gdb "\033\[B"
incr down_count
- set re_line [string_to_regexp $line]
- # Ignore whitespace mismatches.
- regsub -all {\s+} $re_line {\s+} re_line
+
+ # Get address from the line.
+ regexp \
+ [join \
+ [list \
+ ^ \
+ $re_border \
+ {\s+} \
+ ($hex) \
+ {\s+}] \
+ ""] \
+ $line \
+ match \
+ address
+
+ # Regexp to match line containing address.
+ set re_line \
+ [join \
+ [list \
+ ^ \
+ $re_border \
+ {\s+} \
+ $address \
+ {\s+} \
+ {[^\r\n]+} \
+ $re_border \
+ $] \
+ ""]
+
if {[Term::wait_for $re_line] \
- && [regexp $re_line [Term::get_line 1]]} {
+ && [lines_match $line [Term::get_line 1]]} {
# We scrolled successfully.
} else {
- if {[count_whitespace ${line}] != \
- [count_whitespace [Term::get_line 1]]} {
- # GDB's TUI assembler display will widen columns based on
- # the longest item that appears in a column on any line.
- # As we have just scrolled, and so revealed a new line, it
- # is possible that the width of some columns has changed.
- #
- # As a result it is possible that part of the line we were
- # expected to see in the output is now off the screen. And
- # this test will fail.
- #
- # This is unfortunate, but, right now, there's no easy way
- # to "lock" the format of the TUI assembler window. The
- # only option appears to be making the window width wider,
- # this can be done by adjusting TUI_ASM_WINDOW_WIDTH.
- verbose -log "WARNING: The following failure is probably due to the TUI window"
- verbose -log " width. See the comments in the test script for more"
- verbose -log " details."
- }
-
fail "$testname (scroll failed)"
Term::dump_screen
break
}
- if { $down_count > 250 } {
- # Maybe we should accept this as a pass in case a target
- # really does have loads of assembler to scroll through.
- fail "$testname (too much assembler)"
- Term::dump_screen
+ if { $down_count > 25 } {
+ # We've scrolled enough, we're done.
+ pass "$testname (scroll limit reached)"
break
}
}
diff --git a/gdb/testsuite/gdb.tui/tui-layout.c b/gdb/testsuite/gdb.tui/tui-layout.c
index 83d59d7..c69fe32 100644
--- a/gdb/testsuite/gdb.tui/tui-layout.c
+++ b/gdb/testsuite/gdb.tui/tui-layout.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2017-2024 Free Software Foundation, Inc.
+ Copyright 2017-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/tui-layout.exp b/gdb/testsuite/gdb.tui/tui-layout.exp
index 1c682b9..f604871 100644
--- a/gdb/testsuite/gdb.tui/tui-layout.exp
+++ b/gdb/testsuite/gdb.tui/tui-layout.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
# happens to be in after a call to clean_restart.
proc test_layout_or_focus {layout_name terminal execution} {
- global binfile gdb_prompt
+ global gdb_prompt
set dumb_terminal [string equal $terminal "dumb"]
@@ -48,9 +48,9 @@ proc test_layout_or_focus {layout_name terminal execution} {
save_vars { env(TERM) } {
setenv TERM $terminal
if {$dumb_terminal} {
- clean_restart $binfile
+ clean_restart $::testfile
} else {
- Term::clean_restart 24 80 $binfile
+ Term::clean_restart 24 80 $::testfile
if {![Term::prepare_for_tui]} {
unsupported "TUI not supported"
return
diff --git a/gdb/testsuite/gdb.tui/tui-long-line.c b/gdb/testsuite/gdb.tui/tui-long-line.c
new file mode 100644
index 0000000..8f1d6eb
--- /dev/null
+++ b/gdb/testsuite/gdb.tui/tui-long-line.c
@@ -0,0 +1,24 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+
+int
+main (void)
+{
+ /* This is a comment that is meant to be longer than the usual 80 characters width of a tuiterm. */
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.tui/tui-missing-src.exp b/gdb/testsuite/gdb.tui/tui-missing-src.exp
index 2310c1d..ae98775 100644
--- a/gdb/testsuite/gdb.tui/tui-missing-src.exp
+++ b/gdb/testsuite/gdb.tui/tui-missing-src.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,6 +27,7 @@
# Check if start command is supported.
require !use_gdb_stub
+require allow_tui_tests
tuiterm_env
@@ -64,10 +65,8 @@ f2 (int x)
close $fd
# Step 3: Compile the source files.
-if { [gdb_compile "${srcfiles}" "${binfile}" \
- executable {debug additional_flags=-O0}] != "" } {
- untested "failed to compile"
- return -1
+if { [build_executable "failed to prepare" $testfile $srcfiles] == -1 } {
+ return
}
# Step 4: Remove the main.c file.
diff --git a/gdb/testsuite/gdb.tui/tui-mode-switch.exp b/gdb/testsuite/gdb.tui/tui-mode-switch.exp
new file mode 100644
index 0000000..c605962
--- /dev/null
+++ b/gdb/testsuite/gdb.tui/tui-mode-switch.exp
@@ -0,0 +1,57 @@
+require allow_tui_tests
+
+tuiterm_env
+
+if { [ishost *-*-*bsd*] } {
+ # We need support for alternate screen, and xterm doesn't have it.
+ set term xterm-clear
+} else {
+ set term xterm
+}
+
+Term::with_term $term {
+ Term::clean_restart 12 40
+}
+
+if {![Term::prepare_for_tui]} {
+ unsupported "TUI not supported"
+ return 0
+}
+
+# Generate prompt.
+Term::gen_prompt
+
+# Move to last line.
+for { set i 1 } { $i <= 11 } { incr i } {
+ send_gdb "\n"
+ Term::wait_for ""
+}
+
+# Type "foo".
+send_gdb "foo"
+set line { 0 11 40 1 }
+gdb_assert { [Term::wait_for_region_contents {*}$line "^$gdb_prompt foo"] } \
+ "type foo"
+
+# Enter TUI.
+send_gdb "\030\001"
+gdb_assert { [Term::wait_for ""] } "enter TUI"
+
+# Exit TUI.
+send_gdb "\030\001"
+gdb_assert { [Term::wait_for ""] } "exit TUI"
+
+# Type b.
+send_gdb "b"
+gdb_assert { [Term::wait_for_region_contents {*}$line "^$gdb_prompt b"] } \
+ "type b"
+
+# Check that we don't see "boo".
+gdb_assert { ![Term::check_region_contents_p {*}$line "^$gdb_prompt boo"] } \
+ "no boo"
+Term::dump_screen
+
+# We need an empty prompt here, to deal with the "monitor exit" that
+# native-extended-gdbserver will send. Send a backspace.
+send_gdb "\010"
+Term::wait_for ""
diff --git a/gdb/testsuite/gdb.tui/tui-nl-filtered-output.exp b/gdb/testsuite/gdb.tui/tui-nl-filtered-output.exp
index 52aa7ac..db11f60 100644
--- a/gdb/testsuite/gdb.tui/tui-nl-filtered-output.exp
+++ b/gdb/testsuite/gdb.tui/tui-nl-filtered-output.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/tuiterm-2.exp b/gdb/testsuite/gdb.tui/tuiterm-2.exp
index bf82958..9e3ddc7 100644
--- a/gdb/testsuite/gdb.tui/tuiterm-2.exp
+++ b/gdb/testsuite/gdb.tui/tuiterm-2.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -106,6 +106,84 @@ with_override Term::accept_gdb_output test_accept_gdb_output {
}
gdb_assert { [Term::wait_for ""] }
}
+
+ with_test_prefix "Term::wait_for 2" {
+ Term::_setup 4 20
+ set send_cnt 0
+ set expect_send {}
+ set action_cnt 0
+ set actions {
+ {
+ Term::_move_cursor 0 0
+
+ Term::_insert "${::border}(gdb) "
+ set pos $Term::_cur_col
+
+ Term::_insert "foo"
+
+ Term::_move_cursor 19 0
+ Term::_insert "$::border"
+
+ Term::_move_cursor $pos 0
+ }
+ {
+ Term::_move_cursor 0 1
+
+ Term::_insert "${::border}(gdb) "
+ set pos $Term::_cur_col
+
+ Term::_move_cursor 19 1
+ Term::_insert "$::border"
+
+ Term::_move_cursor $pos 1
+ }
+ }
+
+ # Wait for a prompt.
+ gdb_assert { [Term::wait_for ""] }
+
+ # The first action sets the cursor after the prompt on the
+ # first line. The second action sets the cursor after the
+ # prompt on the second line. Check that wait_for returns
+ # after the second action, not the first.
+ gdb_assert { $Term::_cur_row == 1 }
+ }
}
}
}
+
+proc_with_prefix unrecognized_escape_sequence {} {
+ if { [spawn $::srcdir/$::subdir/gdb.sh] == 0 } {
+ unsupported "cannot spawn gdb.sh"
+ return
+ }
+ switch_gdb_spawn_id $spawn_id
+
+ Term::_setup 4 20
+
+ save_vars ::timeout {
+ set ::timeout 1
+
+ set line { 0 0 20 1 }
+
+ # Parse "foo".
+ gdb_assert { [Term::wait_for_region_contents \
+ {*}$line \
+ [string_to_regexp "foo"]] } \
+ "foo"
+
+ # Parse "\033(%5".
+ gdb_assert { ![Term::accept_gdb_output 0] } \
+ "fail to parse escape sequence"
+ gdb_assert { [Term::wait_for_region_contents \
+ {*}$line \
+ [string_to_regexp "^\[(%5"]] } \
+ "echoed escape sequence"
+ }
+ Term::dump_screen
+
+ close $spawn_id
+ clear_gdb_spawn_id
+}
+
+unrecognized_escape_sequence
diff --git a/gdb/testsuite/gdb.tui/tuiterm.exp b/gdb/testsuite/gdb.tui/tuiterm.exp
index cf87ee2..a91643e 100644
--- a/gdb/testsuite/gdb.tui/tuiterm.exp
+++ b/gdb/testsuite/gdb.tui/tuiterm.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -102,7 +102,7 @@ proc test_backspace {} {
Term::_move_cursor 1 2
- Term::_ctl_0x08
+ Term::_ctl_0x08 0
check "backspace one" {
"abcdefgh"
"ijklmnop"
@@ -111,13 +111,22 @@ proc test_backspace {} {
} 0 2
# Cursor should not move if it is already at column 0.
- Term::_ctl_0x08
+ Term::_ctl_0x08 0
check "backspace 2" {
"abcdefgh"
"ijklmnop"
"qrstuvwx"
"yz01234 "
} 0 2
+
+ # Cursor should wrap to previous line.
+ Term::_ctl_0x08 1
+ check "backspace 3" {
+ "abcdefgh"
+ "ijklmnop"
+ "qrstuvwx"
+ "yz01234 "
+ } 7 1
}
proc test_linefeed { } {
@@ -435,6 +444,30 @@ proc test_horizontal_absolute { } {
"qrstuvwx"
"yz01234 "
} 3 2
+
+ Term::_csi_G 8
+ check "cursor horizontal absolute 3" {
+ "abcdefgh"
+ "ijklmnop"
+ "qrstuvwx"
+ "yz01234 "
+ } 7 2
+
+ Term::_csi_G 9
+ check "cursor horizontal absolute 4" {
+ "abcdefgh"
+ "ijklmnop"
+ "qrstuvwx"
+ "yz01234 "
+ } 7 2
+
+ Term::_csi_`
+ check "horizontal position absolute 1" {
+ "abcdefgh"
+ "ijklmnop"
+ "qrstuvwx"
+ "yz01234 "
+ } 0 2
}
proc test_cursor_position { } {
@@ -620,13 +653,21 @@ proc test_cursor_backward_tabulation { } {
}
proc test_repeat { } {
- Term::_move_cursor 2 1
- set Term::_last_char X
+ Term::_move_cursor 0 1
- Term::_csi_b 3
+ Term::_insert "xxX"
+ gdb_assert { $Term::_last_char == "X" }
+ check "insert" {
+ "abcdefgh"
+ "xxXlmnop"
+ "qrstuvwx"
+ "yz01234 "
+ } 3 1
+
+ Term::_csi_b 2
check "repeat" {
"abcdefgh"
- "ijXXXnop"
+ "xxXXXnop"
"qrstuvwx"
"yz01234 "
} 5 1
@@ -750,6 +791,15 @@ proc test_attrs {} {
set line [Term::get_line_with_attrs 0]
gdb_assert { [regexp $re $line] } "attribute: $attr"
}
+
+ # Regression test: Check that _csi_m works without arguments.
+ setup_terminal 4 1
+ Term::_csi_m 7
+ Term::_insert "a"
+ Term::_csi_m
+ Term::_insert "a"
+ set line [Term::get_line_with_attrs 0]
+ gdb_assert { [string equal $line "<reverse:1>a<reverse:0>a "] }
}
# Run proc TEST_PROC_NAME with a "small" terminal.
@@ -757,7 +807,7 @@ proc test_attrs {} {
proc run_one_test_small { test_proc_name } {
save_vars { env(TERM) stty_init } {
setup_small
- eval $test_proc_name
+ $test_proc_name
}
}
@@ -766,7 +816,7 @@ proc run_one_test_small { test_proc_name } {
proc run_one_test_large { test_proc_name } {
save_vars { env(TERM) stty_init } {
setup_large
- eval $test_proc_name
+ $test_proc_name
}
}
diff --git a/gdb/testsuite/gdb.tui/winheight.exp b/gdb/testsuite/gdb.tui/winheight.exp
index e06a934..38c7bcc 100644
--- a/gdb/testsuite/gdb.tui/winheight.exp
+++ b/gdb/testsuite/gdb.tui/winheight.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -99,14 +99,14 @@ Term::check_box "check for asm window" 0 0 80 15
# The test then switches to the 'split' layout, and calculates the
# expected window sizes.
foreach_with_prefix cmd_size {20 12 5} {
- set src_size_before [expr 24 - ${cmd_size} - 1]
- set split_size [expr (24 - ${cmd_size}) / 2]
+ set src_size_before [expr {24 - ${cmd_size} - 1}]
+ set split_size [expr {(24 - ${cmd_size}) / 2}]
if { $split_size < 3 } {
# The minimum window size is 3, so force that.
set src_size_after 3
set asm_size_after 3
- } elseif { [expr $split_size % 2] == 0 } {
+ } elseif { $split_size % 2 == 0 } {
# The remaining space can be divided evenly between the two
# windows.
set src_size_after ${split_size}
@@ -115,7 +115,7 @@ foreach_with_prefix cmd_size {20 12 5} {
# The space can't be divided evenly, the asm window will get
# the extra line.
set src_size_after ${split_size}
- set asm_size_after [expr ${split_size} + 1]
+ set asm_size_after [expr {${split_size} + 1}]
}
Term::command "layout src"
@@ -125,5 +125,6 @@ foreach_with_prefix cmd_size {20 12 5} {
# Both windows should be of equal size, which will be their minimum.
Term::command "layout split"
Term::check_box "check for src window in split" 0 0 80 ${src_size_after}
- Term::check_box "check for asm window in split" 0 [expr ${src_size_after} - 1] 80 ${asm_size_after}
+ Term::check_box "check for asm window in split" \
+ 0 [expr {${src_size_after} - 1}] 80 ${asm_size_after}
}
diff --git a/gdb/testsuite/gdb.tui/winwidth.exp b/gdb/testsuite/gdb.tui/winwidth.exp
index 525e7ad..d9170d8 100644
--- a/gdb/testsuite/gdb.tui/winwidth.exp
+++ b/gdb/testsuite/gdb.tui/winwidth.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.tui/wrap-line.exp b/gdb/testsuite/gdb.tui/wrap-line.exp
index d3020bf..ef166f7 100644
--- a/gdb/testsuite/gdb.tui/wrap-line.exp
+++ b/gdb/testsuite/gdb.tui/wrap-line.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,11 +37,11 @@ proc fill_line { width } {
# Take into account that the prompt also takes space.
set prefix [string length "(gdb) "]
- set start [expr $prefix + 1]
+ set start [expr {$prefix + 1}]
# Print chars.
for { set i $start } { $i <= $width } { incr i } {
- set c [expr $i % 10]
+ set c [expr {$i % 10}]
send_gdb $c
append res $c
}
@@ -59,7 +59,7 @@ proc test_wrap { wrap_width tui } {
set str [fill_line $wrap_width]
# Remaining space on line.
- set space [string repeat " " [expr $::cols - $wrap_width]]
+ set space [string repeat " " [expr {$::cols - $wrap_width}]]
# Now print the first char we expect to wrap.
send_gdb "W"
@@ -104,29 +104,35 @@ proc test_wrap_cli_tui { auto_detected_width } {
set re1 "Number of characters gdb thinks are in a line is ($::decimal)\\."
set re2 \
"Number of characters readline reports are in a line is ($::decimal)\\."
+ set re3 \
+ "Readline wrapping mode: (\[a-z\]+) \[\^\r\n]*"
set cmd "maint info screen"
set re \
[multi_line \
"^$re1" \
$re2 \
- ".*"]
+ ".*" \
+ $re3]
gdb_test_multiple $cmd "" {
-re -wrap $re {
set gdb_width $expect_out(1,string)
set readline_width $expect_out(2,string)
+ set wrapping_mode $expect_out(3,string)
pass $gdb_test_name
}
}
- gdb_assert { $gdb_width == $::cols } "width"
+ if { $wrapping_mode == "readline" } {
+ gdb_assert { $gdb_width == $::cols } "width"
- # TERM=ansi, so readline hides the last column.
- gdb_assert { $gdb_width == [expr $readline_width + 1] }
+ # TERM=ansi, so readline hides the last column.
+ gdb_assert { $gdb_width == [expr $readline_width + 1] }
- with_test_prefix cli {
- set wrap_width $readline_width
+ with_test_prefix cli {
+ set wrap_width $readline_width
- test_wrap $wrap_width 0
+ test_wrap $wrap_width 0
+ }
}
with_test_prefix tui {
@@ -159,7 +165,7 @@ with_test_prefix width-hard-coded {
}
with_test_prefix width-auto-detected {
- Term::with_tuiterm {*}$dims {
+ Term::with_tuiterm $lines $cols {
save_vars { ::INTERNAL_GDBFLAGS } {
# Avoid "set width 0" argument.
set INTERNAL_GDBFLAGS \
@@ -172,7 +178,7 @@ with_test_prefix width-auto-detected {
set test "startup prompt"
gdb_test_multiple "" $test {
- -re "^$gdb_prompt $" {
+ -re "^(\033\\\[6n)?$gdb_prompt $" {
pass "$test"
}
}
diff --git a/gdb/testsuite/gdb.xml/bad-include.xml b/gdb/testsuite/gdb.xml/bad-include.xml
index f7a2b72..cd9cce3 100644
--- a/gdb/testsuite/gdb.xml/bad-include.xml
+++ b/gdb/testsuite/gdb.xml/bad-include.xml
@@ -1 +1 @@
-<xi:include href="nonexistant.xml"/>
+<xi:include href="nonexistent.xml"/>
diff --git a/gdb/testsuite/gdb.xml/maint-xml-dump.exp b/gdb/testsuite/gdb.xml/maint-xml-dump.exp
index 7ba2753..d7fa51d 100644
--- a/gdb/testsuite/gdb.xml/maint-xml-dump.exp
+++ b/gdb/testsuite/gdb.xml/maint-xml-dump.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.xml/maint_print_struct.exp b/gdb/testsuite/gdb.xml/maint_print_struct.exp
index ffc1f61..011c685 100644
--- a/gdb/testsuite/gdb.xml/maint_print_struct.exp
+++ b/gdb/testsuite/gdb.xml/maint_print_struct.exp
@@ -1,6 +1,6 @@
# This testcase is part of GDB, the GNU debugger.
#
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
#
# Contributed by Intel Corp. <walfred.tedeschi@intel.com>
#
diff --git a/gdb/testsuite/gdb.xml/maint_print_struct.xml b/gdb/testsuite/gdb.xml/maint_print_struct.xml
index 6a4a7c4..ccf6cf7 100644
--- a/gdb/testsuite/gdb.xml/maint_print_struct.xml
+++ b/gdb/testsuite/gdb.xml/maint_print_struct.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gdb/testsuite/gdb.xml/tdesc-arch.exp b/gdb/testsuite/gdb.xml/tdesc-arch.exp
index 6c8c592..21784e7 100644
--- a/gdb/testsuite/gdb.xml/tdesc-arch.exp
+++ b/gdb/testsuite/gdb.xml/tdesc-arch.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.xml/tdesc-errors.exp b/gdb/testsuite/gdb.xml/tdesc-errors.exp
index 265bb05..cf5129f 100644
--- a/gdb/testsuite/gdb.xml/tdesc-errors.exp
+++ b/gdb/testsuite/gdb.xml/tdesc-errors.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.xml/tdesc-regs.exp b/gdb/testsuite/gdb.xml/tdesc-regs.exp
index 61efb96..e091721 100644
--- a/gdb/testsuite/gdb.xml/tdesc-regs.exp
+++ b/gdb/testsuite/gdb.xml/tdesc-regs.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.xml/tdesc-reload.c b/gdb/testsuite/gdb.xml/tdesc-reload.c
index 27a14b7..65b18bc 100644
--- a/gdb/testsuite/gdb.xml/tdesc-reload.c
+++ b/gdb/testsuite/gdb.xml/tdesc-reload.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.xml/tdesc-reload.exp b/gdb/testsuite/gdb.xml/tdesc-reload.exp
index fe0ce94..7500f7f 100644
--- a/gdb/testsuite/gdb.xml/tdesc-reload.exp
+++ b/gdb/testsuite/gdb.xml/tdesc-reload.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.xml/tdesc-xinclude.exp b/gdb/testsuite/gdb.xml/tdesc-xinclude.exp
index aabc6d9..b934c80 100644
--- a/gdb/testsuite/gdb.xml/tdesc-xinclude.exp
+++ b/gdb/testsuite/gdb.xml/tdesc-xinclude.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@ set_arch "includes.xml" \
# This file contains a missing include. We should warn the user about
# it.
set_arch "bad-include.xml" \
- "warning:.*Could not load XML document \"nonexistant.xml\"$common_warn"
+ "warning:.*Could not load XML document \"nonexistent.xml\"$common_warn"
# Make sure we detect infinite loops, eventually.
set_arch "loop.xml" \
diff --git a/gdb/testsuite/lib/aarch64-scalable.exp b/gdb/testsuite/lib/aarch64-scalable.exp
index 2ba7d15..e06b339 100644
--- a/gdb/testsuite/lib/aarch64-scalable.exp
+++ b/gdb/testsuite/lib/aarch64-scalable.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ proc sve_value_pattern { state vl byte_fpsimd byte_sve } {
append data $brace_open
if { $state == "fpsimd" || $state == "za" } {
if { $vl > 16 } {
- set sve_repeat_count [expr $vl - 16]
+ set sve_repeat_count [expr {$vl - 16}]
append data "$byte_fpsimd <repeats 16 times>, 0 <repeats $sve_repeat_count times>"
} else {
append data "$byte_fpsimd <repeats 16 times>"
@@ -95,7 +95,7 @@ proc state_id_to_state_string { state } {
# The state is one of fpsimd, sve, ssve, za and za_ssve.
#
proc test_id_to_state { id } {
- set state [expr $id / 25]
+ set state [expr {$id / 25}]
return [state_id_to_state_string $state]
}
@@ -104,14 +104,14 @@ proc test_id_to_state { id } {
# Given a test ID, return the associated vector length.
#
proc test_id_to_vl { id } {
- return [expr 16 << (($id / 5) % 5)]
+ return [expr {16 << (($id / 5) % 5)}]
}
#
# Given a test ID, return the associated streaming vector length.
#
proc test_id_to_svl { id } {
- return [expr 16 << ($id % 5)]
+ return [expr {16 << ($id % 5)}]
}
#
@@ -135,14 +135,14 @@ proc check_sve_regs { byte state vl svl } {
if {$vl == 16} {
set z_pattern [string_to_regexp [1d_array_value_pattern $byte $vl]]
} else {
- set z_repeats [expr $vl - 16]
+ set z_repeats [expr {$vl - 16}]
set z_pattern [string_to_regexp "{$byte <repeats 16 times>, 0 <repeats $z_repeats times>}"]
}
} else {
set z_pattern [string_to_regexp [1d_array_value_pattern $byte $vl]]
}
}
- set p_size [expr $z_size / 8]
+ set p_size [expr {$z_size / 8}]
# If there is no SVE/SSVE state, the contents of the Z/P/FFR registers
# are zero.
@@ -174,7 +174,7 @@ proc check_sme_regs { byte state svl } {
# ZA contents are only available when the ZA state is enabled. Otherwise
# the ZA contents are unavailable (zeroed out).
set za_pattern ""
- set expected_za_size [expr $svl * $svl]
+ set expected_za_size [expr {$svl * $svl}]
if {$state != "za" && $state != "za_ssve"} {
set byte 0
@@ -217,15 +217,15 @@ proc check_state { state vl svl } {
# each byte.
# Check VG to make sure it is correct
- set expected_vg [expr $vl / 8]
+ set expected_vg [expr {$vl / 8}]
# If streaming mode is enabled, then vg is actually svg.
if {$state == "ssve" || $state == "za_ssve"} {
- set expected_vg [expr $svl / 8]
+ set expected_vg [expr {$svl / 8}]
}
gdb_test "print \$vg" " = ${expected_vg}"
# Check SVG to make sure it is correct
- set expected_svg [expr $svl / 8]
+ set expected_svg [expr {$svl / 8}]
gdb_test "print \$svg" " = ${expected_svg}"
# Check the value of SVCR.
@@ -251,7 +251,7 @@ proc check_state { state vl svl } {
check_sme_regs 170 $state $svl
# Check SME2 registers
- if [is_sme2_available] {
+ if {[is_sme2_available]} {
# The SME2 ZT0 register will always be zero, except when ZA is active.
set sme2_byte 0
if {$state == "za" || $state == "za_ssve"} {
diff --git a/gdb/testsuite/lib/aarch64-test-sme.c b/gdb/testsuite/lib/aarch64-test-sme.c
index 2925b48..c5d7a8a 100644
--- a/gdb/testsuite/lib/aarch64-test-sme.c
+++ b/gdb/testsuite/lib/aarch64-test-sme.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/aarch64-test-sve.c b/gdb/testsuite/lib/aarch64-test-sve.c
index d558a40..3eed754 100644
--- a/gdb/testsuite/lib/aarch64-test-sve.c
+++ b/gdb/testsuite/lib/aarch64-test-sve.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2023-2024 Free Software Foundation, Inc.
+ Copyright 2023-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/aarch64.exp b/gdb/testsuite/lib/aarch64.exp
index 602120a..0d3ed83 100644
--- a/gdb/testsuite/lib/aarch64.exp
+++ b/gdb/testsuite/lib/aarch64.exp
@@ -1,4 +1,4 @@
-# Copyright 2023-2024 Free Software Foundation, Inc.
+# Copyright 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -78,7 +78,7 @@ proc initialize_1d_array { name byte elements } {
append data $byte
# If this isn't the last element, add a comma.
- if {[expr $element + 1] < $elements} {
+ if {$element + 1 < $elements} {
append data ", "
}
}
@@ -101,7 +101,7 @@ proc initialize_2d_array { name byte rows columns } {
set brace_open "{"
set brace_close "}"
- if {[expr $rows * $columns] <= 256} {
+ if {$rows * $columns <= 256} {
# Build the assignment in a single shot, as we have a maximum of 256
# elements.
for {set row 0} {$row < $rows} {incr row} {
@@ -111,7 +111,7 @@ proc initialize_2d_array { name byte rows columns } {
append data $byte
# If this isn't the last column, add a comma.
- if {[expr $column + 1] < $columns} {
+ if {$column + 1 < $columns} {
append data ", "
}
}
@@ -119,7 +119,7 @@ proc initialize_2d_array { name byte rows columns } {
append data $brace_close
# If this isn't the last row, add a comma.
- if {[expr $row + 1] < $rows} {
+ if {$row + 1 < $rows} {
append data ","
}
}
diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
index e1a3a23..04aaee1 100644
--- a/gdb/testsuite/lib/ada.exp
+++ b/gdb/testsuite/lib/ada.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -111,7 +111,7 @@ proc gdb_compile_ada_1 {source dest type options} {
# gdb_compile to determine whether the build has succeeded or not.
# We therefore simply check whether the dest file has been created
# or not. Unless not present, the build has succeeded.
- if [file exists $dest] { set result "" }
+ if {[file exists $dest]} { set result "" }
return $result
}
@@ -220,7 +220,8 @@ proc gnat_runtime_has_debug_info_1 { shared } {
return 0
}
- clean_restart $dst
+ clean_restart
+ gdb_load $dst
if { ! [runto "GNAT_Debug_Info_Test"] } {
return 0
diff --git a/gdb/testsuite/lib/append_gdb_boards_dir.exp b/gdb/testsuite/lib/append_gdb_boards_dir.exp
index 4aedba9..fadb372 100644
--- a/gdb/testsuite/lib/append_gdb_boards_dir.exp
+++ b/gdb/testsuite/lib/append_gdb_boards_dir.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/attributes.h b/gdb/testsuite/lib/attributes.h
index 5dabd03..626c226 100644
--- a/gdb/testsuite/lib/attributes.h
+++ b/gdb/testsuite/lib/attributes.h
@@ -1,6 +1,6 @@
/* This file is part of GDB, the GNU debugger.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/build-piece.exp b/gdb/testsuite/lib/build-piece.exp
index 879fbf3..7de1f51 100644
--- a/gdb/testsuite/lib/build-piece.exp
+++ b/gdb/testsuite/lib/build-piece.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/cache.exp b/gdb/testsuite/lib/cache.exp
index ca3dca2..f578072 100644
--- a/gdb/testsuite/lib/cache.exp
+++ b/gdb/testsuite/lib/cache.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,26 +24,9 @@ proc ignore_pass { msg } {
# Call proc real_name and return the result, while ignoring calls to pass.
proc gdb_do_cache_wrap {real_name args} {
- if { [info procs save_pass] != "" } {
- return [uplevel 2 $real_name]
+ with_override pass ignore_pass {
+ return [uplevel 2 [list $real_name {*}$args]]
}
-
- rename pass save_pass
- rename ignore_pass pass
-
- set code [catch {uplevel 2 [list $real_name {*}$args]} result]
-
- rename pass ignore_pass
- rename save_pass pass
-
- if {$code == 1} {
- global errorInfo errorCode
- return -code error -errorinfo $errorInfo -errorcode $errorCode $result
- } elseif {$code > 1} {
- return -code $code $result
- }
-
- return $result
}
# Global written to by gdb_exit_called proc. Is set to true to
@@ -295,6 +278,7 @@ proc gdb_do_cache {name args} {
proc gdb_caching_proc {name arglist body} {
# Define the underlying proc that we'll call.
set real_name gdb_real__$name
+ # tclint-disable-next-line command-args
proc $real_name $arglist $body
# Define the advertised proc.
@@ -303,5 +287,6 @@ proc gdb_caching_proc {name arglist body} {
lappend caching_proc_body $$arg
}
set caching_proc_body [join $caching_proc_body]
+ # tclint-disable-next-line command-args
proc $name $arglist $caching_proc_body
}
diff --git a/gdb/testsuite/lib/check-test-names.exp b/gdb/testsuite/lib/check-test-names.exp
index 11aed63..9921172 100644
--- a/gdb/testsuite/lib/check-test-names.exp
+++ b/gdb/testsuite/lib/check-test-names.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -97,7 +97,7 @@ namespace eval ::CheckTestNames {
set pos [string first ": " $message]
if { $pos > -1 } {
# The '+ 2' is so we skip the ': ' we found above.
- return [string range $message [expr $pos + 2] end]
+ return [string range $message [expr {$pos + 2}] end]
}
return $message
@@ -120,11 +120,11 @@ namespace eval ::CheckTestNames {
proc check { message } {
set message [ _strip_status $message ]
- if [ _check_paths $message ] {
+ if {[ _check_paths $message ]} {
clone_output "PATH: $message"
}
- if [ _check_duplicates $message ] {
+ if {[ _check_duplicates $message ]} {
clone_output "DUPLICATE: $message"
}
@@ -146,7 +146,7 @@ namespace eval ::CheckTestNames {
# If ARGS is the empty list then we don't want to pass a single
# empty string as a parameter here.
- eval "CheckTestNames::log_summary $args"
+ CheckTestNames::log_summary {*}$args
if { [llength $args] == 0 } {
set which "count"
@@ -184,10 +184,10 @@ foreach nm {pass fail xfail kfail xpass kpass unresolved untested \
# Create new global log_summary to replace Dejagnu's.
proc log_summary { args } {
- eval "CheckTestNames::do_log_summary $args"
+ CheckTestNames::do_log_summary {*}$args
}
# Create new global reset_vars to replace Dejagnu's.
proc reset_vars {} {
- eval "CheckTestNames::do_reset_vars"
+ CheckTestNames::do_reset_vars
}
diff --git a/gdb/testsuite/lib/cl_util.c b/gdb/testsuite/lib/cl_util.c
index 048346b..e5eb369 100644
--- a/gdb/testsuite/lib/cl_util.c
+++ b/gdb/testsuite/lib/cl_util.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/cl_util.h b/gdb/testsuite/lib/cl_util.h
index 3d03c84..6034518 100644
--- a/gdb/testsuite/lib/cl_util.h
+++ b/gdb/testsuite/lib/cl_util.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/compile-support.exp b/gdb/testsuite/lib/compile-support.exp
index 6d7a4ce..8472d8d 100644
--- a/gdb/testsuite/lib/compile-support.exp
+++ b/gdb/testsuite/lib/compile-support.exp
@@ -1,4 +1,4 @@
-# Copyright 2015-2024 Free Software Foundation, Inc.
+# Copyright 2015-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -265,7 +265,7 @@ namespace eval ::CompileExpression {
if {[string match $cmd "print"]} {
if {!$is_explicit} {
- eval setup_failures_ $fail_print
+ setup_failures_ {*}$fail_print
return [compile_command_ "compile print $exp" $result $tst]
}
} else {
@@ -274,11 +274,11 @@ namespace eval ::CompileExpression {
} else {
set command "compile code $varName_ = $exp"
}
- eval setup_failures_ $fail_compile
+ setup_failures_ {*}$fail_compile
if {![compile_command_ $command "" $tst]} {
return 0
}
- eval setup_failures_ $fail_value
+ setup_failures_ {*}$fail_value
gdb_test "p $varName_" "= $result" "result of $tst"
}
return 1
@@ -292,11 +292,11 @@ namespace eval ::CompileExpression {
proc setup_failures_ {how args} {
switch -nocase $how {
xfail {
- eval setup_xfail $args
+ setup_xfail {*}$args
}
kfail {
- eval setup_kfail $args
+ setup_kfail {*}$args
}
default {
diff --git a/gdb/testsuite/lib/compiler.F90 b/gdb/testsuite/lib/compiler.F90
index 07f9852..b92b9c6 100644
--- a/gdb/testsuite/lib/compiler.F90
+++ b/gdb/testsuite/lib/compiler.F90
@@ -1,4 +1,4 @@
-/* Copyright 2022-2024 Free Software Foundation, Inc.
+/* Copyright 2022-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/compiler.c b/gdb/testsuite/lib/compiler.c
index 0749435..e457fba 100644
--- a/gdb/testsuite/lib/compiler.c
+++ b/gdb/testsuite/lib/compiler.c
@@ -1,6 +1,6 @@
/* This test file is part of GDB, the GNU debugger.
- Copyright 1995-2024 Free Software Foundation, Inc.
+ Copyright 1995-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/compiler.cc b/gdb/testsuite/lib/compiler.cc
index aa46228..ee2280f 100755
--- a/gdb/testsuite/lib/compiler.cc
+++ b/gdb/testsuite/lib/compiler.cc
@@ -1,6 +1,6 @@
/* This test file is part of GDB, the GNU debugger.
- Copyright 1995-2024 Free Software Foundation, Inc.
+ Copyright 1995-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp
index 5f0f619..8ddf53d 100644
--- a/gdb/testsuite/lib/completion-support.exp
+++ b/gdb/testsuite/lib/completion-support.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -400,7 +400,7 @@ proc index_after {needle haystack} {
if {$start == -1} {
error "could not find \"$needle\" in \"$haystack\""
}
- return [expr $start + [string length $needle]]
+ return [expr {$start + [string length $needle]}]
}
# Create a breakpoint using BREAK_COMMAND, and return the number
diff --git a/gdb/testsuite/lib/cp-support.exp b/gdb/testsuite/lib/cp-support.exp
index d883309..ded4cf8 100644
--- a/gdb/testsuite/lib/cp-support.exp
+++ b/gdb/testsuite/lib/cp-support.exp
@@ -1,6 +1,6 @@
# This test code is part of GDB, the GNU debugger.
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -41,7 +41,8 @@ set ::debug_cp_test_ptype_class false
proc cp_check_errata { expected_string actual_string errata_table } {
foreach erratum $errata_table {
if { "$expected_string" == [lindex $erratum 0]
- && "$actual_string" == [lindex $erratum 1] } then {
+ && "$actual_string" == [lindex $erratum 1] } {
+ # tclint-disable-next-line command-args
eval [lindex $erratum 2]
}
}
@@ -156,7 +157,7 @@ namespace eval ::cp_support_internal {
# format of the errata table. Note: the errata entries are not subject to
# demangler syntax adjustment, so you have to make a bigger table
# with lines for each output variation.
-#
+#
# IN_PTYPE_ARG are arguments to pass to ptype. The default is "/r".
#
# RECURSIVE_QID is used internally to call this procedure recursively
@@ -231,7 +232,7 @@ namespace eval ::cp_support_internal {
# gcc 3.4.1 -gstabs+
# gcc HEAD 20040731 -gdwarf-2
# gcc HEAD 20040731 -gstabs+
-#
+#
# TODO
#
# Tagless structs.
@@ -705,7 +706,7 @@ proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table
# Update the count in list_synth.
- incr synth_count
+ incr synth_count
set synth [list $synth_count $synth_access "$synth_re"]
set list_synth [lreplace $list_synth $isynth $isynth $synth]
diff --git a/gdb/testsuite/lib/d-support.exp b/gdb/testsuite/lib/d-support.exp
index 3edb664..0714b40 100644
--- a/gdb/testsuite/lib/d-support.exp
+++ b/gdb/testsuite/lib/d-support.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,11 +17,12 @@
# The result is 1 (true) for success, 0 (false) for failure.
proc set_lang_d {} {
- if [gdb_test_no_output "set language d"] {
+ if {[gdb_test_no_output "set language d"]} {
return 0
}
- if [gdb_test "show language" ".* source language is \"d\"." \
- "set language to \"d\""] {
+ if {[gdb_test "show language" \
+ [string_to_regexp {The current source language is "d".}] \
+ {set language to "d"}]} {
return 0
}
return 1
diff --git a/gdb/testsuite/lib/dap-support.exp b/gdb/testsuite/lib/dap-support.exp
index 5c192e5..5c078ca 100644
--- a/gdb/testsuite/lib/dap-support.exp
+++ b/gdb/testsuite/lib/dap-support.exp
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Free Software Foundation, Inc.
+# Copyright 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -117,6 +117,7 @@ proc dap_to_ton {obj} {
# Format the object OBJ, in TON format, as JSON and send it to gdb.
proc _dap_send_ton {obj} {
+ # tclint-disable-next-line command-args
set json [namespace eval ton::2json $obj]
# FIXME this is wrong for non-ASCII characters.
set len [string length $json]
@@ -170,7 +171,7 @@ proc _dap_read_json {} {
}
if {$seen_timeout} {
- error "timeout reading json header"
+ error "timeout reading json header"
}
if {$seen_eof} {
error "eof reading json header"
@@ -200,7 +201,7 @@ proc _dap_read_json {} {
}
if {$seen_timeout} {
- error "timeout reading json header"
+ error "timeout reading json header"
}
if {$seen_eof} {
error "eof reading json header"
@@ -211,6 +212,7 @@ proc _dap_read_json {} {
global last_ton
set last_ton [ton::json2ton $json]
+ # tclint-disable-next-line command-args
return [namespace eval ton::2dict $last_ton]
}
@@ -229,9 +231,9 @@ proc dap_read_response {cmd num} {
set d [_dap_read_json]
if {[dict get $d type] == "response"} {
if {[dict get $d request_seq] != $num} {
- error "saw wrong request_seq in $obj"
+ error "saw wrong request_seq in $d"
} elseif {[dict get $d command] != $cmd} {
- error "saw wrong command in $obj"
+ error "saw wrong command in $d"
} else {
return [list $d $result]
}
@@ -443,7 +445,7 @@ proc dap_search_output {name rx events} {
# key/value pairs given in ARGS. NAME is used as the test name.
proc dap_match_values {name d args} {
foreach {key value} $args {
- if {[eval dict get [list $d] $key] != $value} {
+ if {[dict get $d {*}$key] != $value} {
fail "$name (checking $key)"
return ""
}
@@ -494,7 +496,7 @@ proc dap_wait_for_event_and_check {name type args} {
set result [_dap_wait_for_event $type]
set event [lindex $result 0]
- eval dap_match_values [list $name $event] $args
+ dap_match_values $name $event {*}$args
return $result
}
diff --git a/gdb/testsuite/lib/data-structures.exp b/gdb/testsuite/lib/data-structures.exp
index 461a11c..ccf7e81 100644
--- a/gdb/testsuite/lib/data-structures.exp
+++ b/gdb/testsuite/lib/data-structures.exp
@@ -1,4 +1,4 @@
-# Copyright 2017-2024 Free Software Foundation, Inc.
+# Copyright 2017-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/debuginfod-support.exp b/gdb/testsuite/lib/debuginfod-support.exp
index 0096448..ad6963e 100644
--- a/gdb/testsuite/lib/debuginfod-support.exp
+++ b/gdb/testsuite/lib/debuginfod-support.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
# Return true if the debuginfod tests should be run, otherwise, return
# false.
proc allow_debuginfod_tests {} {
- if [is_remote host] {
+ if {[is_remote host]} {
return false
}
@@ -37,7 +37,7 @@ proc allow_debuginfod_tests {} {
# (installed by ASan) exist on startup. That makes TCL's exec throw an
# error. This is dealt with by the --quiet in INTERNAL_GDBFLAGS.
if { [string first "with-debuginfod" \
- [eval exec $::GDB $::INTERNAL_GDBFLAGS \
+ [exec $::GDB {*}$::INTERNAL_GDBFLAGS \
--configuration]] == -1 } {
return false
}
@@ -189,7 +189,7 @@ proc start_debuginfod { db debugdir } {
proc stop_debuginfod { } {
global debuginfod_spawn_id
- if [info exists debuginfod_spawn_id] {
+ if {[info exists debuginfod_spawn_id]} {
kill_wait_spawned_process $debuginfod_spawn_id
unset debuginfod_spawn_id
}
diff --git a/gdb/testsuite/lib/dg-add-core-file-count.sh b/gdb/testsuite/lib/dg-add-core-file-count.sh
index b4cb6b9..115cf51 100755
--- a/gdb/testsuite/lib/dg-add-core-file-count.sh
+++ b/gdb/testsuite/lib/dg-add-core-file-count.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This file is part of GDB.
diff --git a/gdb/testsuite/lib/dtrace.exp b/gdb/testsuite/lib/dtrace.exp
index fb6204f..2456ba9 100644
--- a/gdb/testsuite/lib/dtrace.exp
+++ b/gdb/testsuite/lib/dtrace.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@
# This function returns -1 on failure, 0 otherwise
proc dtrace_build_usdt_test_program {} {
global testfile hex objdir srcdir srcfile subdir binfile
-
+
# Make sure that dtrace is installed, it is the real one (not the
# script installed by SystemTap, for example) and of the right
# version (>= 0.4.0). If it is not then use pdtrace instead.
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index 7dcf13f..55f33d4 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ proc extract_dwo_information { object_file dwo_file } {
set objcopy [gdb_find_objcopy]
set command "$objcopy --extract-dwo $object_file $dwo_file"
verbose -log "Executing $command"
- set result [catch "exec $command" output]
+ set result [catch {exec {*}$command} output]
verbose -log "objcopy --extract-dwo output: $output"
if { $result == 1 } {
return -1
@@ -52,7 +52,7 @@ proc strip_dwo_information { filename } {
set objcopy [gdb_find_objcopy]
set command "$objcopy --strip-dwo $filename"
verbose -log "Executing $command"
- set result [catch "exec $command" output]
+ set result [catch {exec {*}$command} output]
verbose -log "objcopy --strip-dwo output: $output"
if { $result == 1 } {
return -1
@@ -126,7 +126,7 @@ proc build_executable_and_dwo_files { testname executable options args } {
}
# Must be run on local host due to use of objcopy.
- if [is_remote host] {
+ if {[is_remote host]} {
return -1
}
@@ -406,7 +406,7 @@ proc function_range { func src {options {debug}} } {
set start $expect_out(1,string)
set end $expect_out(2,string)
- set func_length [expr $func_length + $end - $start]
+ set func_length [expr {$func_length + $end - $start}]
}
}
@@ -461,16 +461,13 @@ proc get_func_info { name {options {debug}} } {
#
# proc DW_TAG_mumble {{attrs {}} {children {}}} { ... }
#
-# ATTRS is an optional list of attributes.
-# It is run through 'subst' in the caller's context before processing.
+# ATTRS holds optional attributes. It is just Tcl code and is
+# evaluated in the caller's context. Each attribute is a proc of the
+# form:
#
-# Each attribute in the list has one of two forms:
-# 1. { NAME VALUE }
-# 2. { NAME VALUE FORM }
+# proc DW_AT_mumble {value {form {}}} { ... }
#
-# In each case, NAME is the attribute's name.
-# This can either be the full name, like 'DW_AT_name', or a shortened
-# name, like 'name'. These are fully equivalent.
+# Only the full name can be used here.
#
# Besides DWARF standard attributes, assembler supports 'macro' attribute
# which will be substituted by one or more standard or macro attributes.
@@ -491,10 +488,9 @@ proc get_func_info { name {options {debug}} } {
# section automatically.
#
# If FORM is 'SPECIAL_expr', then VALUE is treated as a location
-# expression. The effective form is then DW_FORM_block or DW_FORM_exprloc
-# for DWARF version >= 4, and VALUE is passed to the (internal)
-# '_location' proc to be translated.
-# This proc implements a miniature DW_OP_ assembler.
+# expression. The effective form is then DW_FORM_block or
+# DW_FORM_exprloc for DWARF version >= 4, and VALUE is treated as
+# code, using DW_OP_* procs and evaluated in the appropriate scope.
#
# If FORM is not given, it is guessed:
# * If VALUE starts with the "@" character, the rest of VALUE is
@@ -522,12 +518,8 @@ namespace eval Dwarf {
# Constants from dwarf2.h.
variable _constants
- # DW_AT short names.
- variable _AT
# DW_FORM short names.
variable _FORM
- # DW_OP short names.
- variable _OP
# The current output file.
variable _output_file
@@ -592,11 +584,19 @@ namespace eval Dwarf {
# otherwise false.
variable _cu_is_fission
+ # When assembling, this is used to stash the level in which any
+ # code should be evaluated.
+ variable _level
+
+ # Variables used when processing a location expression. These are
+ # set by _location and may be used by the various DW_OP-handlers.
+ variable _loc_dwarf_version
+ variable _loc_addr_size
+ variable _loc_offset_size
+
proc _process_one_constant {name value} {
variable _constants
- variable _AT
variable _FORM
- variable _OP
set _constants($name) $value
@@ -616,6 +616,7 @@ namespace eval Dwarf {
# Create two procedures for the tag. These call
# _handle_DW_TAG with the full tag name baked in; this
# does all the actual work.
+ # tclint-disable-next-line command-args
proc $name {{attrs {}} {children {}}} \
"_handle_DW_TAG $name \$attrs \$children"
@@ -628,12 +629,15 @@ namespace eval Dwarf {
error "duplicate proc name: from $name"
}
+ # tclint-disable-next-line command-args
proc $name2 {{attrs {}} {children {}}} \
"_handle_DW_TAG $name \$attrs \$children"
}
AT {
- set _AT($name2) $name
+ # tclint-disable-next-line command-args
+ proc $name {value {form {}}} \
+ "_handle_DW_AT $name \$value \$form"
}
FORM {
@@ -641,7 +645,18 @@ namespace eval Dwarf {
}
OP {
- set _OP($name2) $name
+ set handler _handle_default_OP
+ if {[llength [info procs _handle_DW_OP_$name2]] > 0} {
+ set handler _handle_DW_OP_$name2
+ }
+ # Each DW_OP_* proc emits the opcode and then
+ # delegates to the argument handler.
+ # tclint-disable-next-line command-args
+ proc $name {args} [format {
+ variable _constants
+ _op .byte $_constants(%s) %s
+ %s {*}$args
+ } $name $name $handler]
}
default {
@@ -678,6 +693,11 @@ namespace eval Dwarf {
}
}
close $fd
+
+ variable _constants
+
+ # Add DW_FORM_strx_id as alias of DW_FORM_strx.
+ _process_one_constant DW_FORM_strx_id $_constants(DW_FORM_strx)
}
proc _quote {string} {
@@ -823,6 +843,12 @@ namespace eval Dwarf {
DW_FORM_indirect -
DW_FORM_exprloc -
+ # Generate a DW_FORM_str index, but assume generation of .debug_str and
+ # .debug_str_offsets is taken care of elsewhere.
+ DW_FORM_strx_id {
+ _op .uleb128 $value
+ }
+
DW_FORM_strx -
DW_FORM_strx1 -
DW_FORM_strx2 -
@@ -906,11 +932,27 @@ namespace eval Dwarf {
return $name
}
- proc _handle_attribute { attr_name attr_value attr_form } {
+ # Implementation of all the DW_AT_* procs.
+ proc _handle_DW_AT {attr_name attr_value attr_form} {
variable _abbrev_section
variable _constants
variable _cu_version
+ if {$attr_form == ""} {
+ set attr_form [_guess_form $attr_value attr_value]
+ if { $attr_form eq "" } {
+ set attr_form [_default_form $attr_name]
+ }
+ if { $attr_form eq "" } {
+ error "No form for $attr_name $attr_value"
+ }
+ } elseif { [string index $attr_value 0] == ":" } {
+ # It is a label, get its value.
+ _guess_form $attr_value attr_value
+ }
+
+ set attr_form [_map_name $attr_form _FORM]
+
_handle_DW_FORM $attr_form $attr_value
_defer_output $_abbrev_section {
@@ -931,9 +973,8 @@ namespace eval Dwarf {
}
}
- # Handle macro attribute MACRO_AT_range.
-
- proc _handle_macro_at_range { attr_value } {
+ # Handle extension attribute MACRO_AT_range.
+ proc MACRO_AT_range { attr_value } {
variable _cu_is_fission
if {[llength $attr_value] != 1} {
@@ -950,19 +991,17 @@ namespace eval Dwarf {
set form DW_FORM_GNU_addr_index
}
- _handle_attribute DW_AT_low_pc [lindex $result 0] $form
- _handle_attribute DW_AT_high_pc \
- "[lindex $result 0] + [lindex $result 1]" $form
+ DW_AT_low_pc [lindex $result 0] $form
+ DW_AT_high_pc "[lindex $result 0] + [lindex $result 1]" $form
}
- # Handle macro attribute MACRO_AT_func.
-
- proc _handle_macro_at_func { attr_value } {
+ # Handle extension attribute MACRO_AT_func.
+ proc MACRO_AT_func { attr_value } {
if {[llength $attr_value] != 1} {
error "usage: MACRO_AT_func { func file }"
}
- _handle_attribute DW_AT_name [lindex $attr_value 0] DW_FORM_string
- _handle_macro_at_range $attr_value
+ DW_AT_name [lindex $attr_value 0] DW_FORM_string
+ MACRO_AT_range $attr_value
}
# Return the next available abbrev number in the current CU's abbrev
@@ -992,47 +1031,8 @@ namespace eval Dwarf {
_op .uleb128 $my_abbrev "Abbrev ($tag_name)"
- foreach attr $attrs {
- set attr_name [_map_name [lindex $attr 0] _AT]
-
- # When the length of ATTR is greater than 2, the last
- # element of the list must be a form. The second through
- # the penultimate elements are joined together and
- # evaluated using subst. This allows constructs such as
- # [gdb_target_symbol foo] to be used.
-
- if {[llength $attr] > 2} {
- set attr_value [uplevel 2 [list subst [join [lrange $attr 1 end-1]]]]
- } else {
- set attr_value [uplevel 2 [list subst [lindex $attr 1]]]
- }
-
- if { [string equal "MACRO_AT_func" $attr_name] } {
- _handle_macro_at_func $attr_value
- } elseif { [string equal "MACRO_AT_range" $attr_name] } {
- _handle_macro_at_range $attr_value
- } else {
- if {[llength $attr] > 2} {
- set attr_form [uplevel 2 [list subst [lindex $attr end]]]
-
- if { [string index $attr_value 0] == ":" } {
- # It is a label, get its value.
- _guess_form $attr_value attr_value
- }
- } else {
- set attr_form [_guess_form $attr_value attr_value]
- if { $attr_form eq "" } {
- set attr_form [_default_form $attr_name]
- }
- if { $attr_form eq "" } {
- error "No form for $attr_name $attr_value"
- }
- }
- set attr_form [_map_name $attr_form _FORM]
-
- _handle_attribute $attr_name $attr_value $attr_form
- }
- }
+ variable _level
+ uplevel $_level $attrs
_defer_output $_abbrev_section {
# Terminator.
@@ -1041,7 +1041,7 @@ namespace eval Dwarf {
}
if {$has_children} {
- uplevel 2 $children
+ uplevel $_level $children
# Terminate children.
_op .byte 0x0 "Terminate children"
@@ -1061,7 +1061,10 @@ namespace eval Dwarf {
}
proc _section {name {flags ""} {type ""}} {
- if {$flags == "" && $type == ""} {
+ if {$name == ".debug_str"} {
+ # Hard-code this because it's always desirable.
+ _emit " .section $name, \"MS\", %progbits, 1"
+ } elseif {$flags == "" && $type == ""} {
_emit " .section $name"
} elseif {$type == ""} {
_emit " .section $name, \"$flags\""
@@ -1080,7 +1083,7 @@ namespace eval Dwarf {
if {![info exists _deferred_output($_defer)]} {
set _deferred_output($_defer) ""
- eval _section $section_spec
+ _section {*}$section_spec
}
uplevel $body
@@ -1205,6 +1208,7 @@ namespace eval Dwarf {
upvar $name label_var
set label_var [new_label $text]
+ # tclint-disable-next-line command-args
proc ${name}: {args} [format {
define_label %s
uplevel $args
@@ -1226,190 +1230,211 @@ namespace eval Dwarf {
}
}
- # This is a miniature assembler for location expressions. It is
- # suitable for use in the attributes to a DIE. Its output is
- # prefixed with "=" to make it automatically use DW_FORM_block.
- #
- # BODY is split by lines, and each line is taken to be a list.
#
- # DWARF_VERSION is the DWARF version for the section where the location
- # description is found.
+ # Handlers for DW_OP_* opcodes.
#
- # ADDR_SIZE is the length in bytes (4 or 8) of an address on the target
- # machine (typically found in the header of the section where the location
- # description is found).
+ # A handler is only needed if the opcode requires a parameter, or
+ # some sort of special handling. Generic code handles emitting
+ # the actual opcode itself, so a handler should not do this.
#
- # OFFSET_SIZE is the length in bytes (4 or 8) of an offset into a DWARF
- # section. This typically depends on whether 32-bit or 64-bit DWARF is
- # used, as indicated in the header of the section where the location
- # description is found.
+ # Handlers are found by name when parsing the .def file. If a
+ # handler isn't found, the default (_handle_default_OP) is used.
#
- # (FIXME should use 'info complete' here.)
- # Each list's first element is the opcode, either short or long
- # forms are accepted.
- # FIXME argument handling
- # FIXME move docs
- proc _location { body dwarf_version addr_size offset_size } {
- variable _constants
- foreach line [split $body \n] {
- # Ignore blank lines, and allow embedded comments.
- if {[lindex $line 0] == "" || [regexp -- {^[ \t]*#} $line]} {
- continue
- }
- set opcode [_map_name [lindex $line 0] _OP]
- _op .byte $_constants($opcode) $opcode
+ proc _handle_DW_OP_addr {size} {
+ variable _loc_addr_size
+ _op .${_loc_addr_size}byte $size
+ }
- array unset argvec *
- switch -exact -- $opcode {
- DW_OP_addr {
- _get_args $line $opcode size
- _op .${addr_size}byte $argvec(size)
- }
+ proc _handle_DW_OP_GNU_addr_index {symbol} {
+ variable _debug_addr_index
+ variable _cu_addr_size
- DW_OP_GNU_addr_index {
- variable _debug_addr_index
- variable _cu_addr_size
+ _op .uleb128 ${_debug_addr_index}
+ incr _debug_addr_index
- _op .uleb128 ${_debug_addr_index}
- incr _debug_addr_index
+ _defer_output .debug_addr {
+ _op .${_cu_addr_size}byte $symbol
+ }
+ }
- _defer_output .debug_addr {
- _op .${_cu_addr_size}byte [lindex $line 1]
- }
- }
+ proc _handle_DW_OP_regx {register} {
+ _op .uleb128 $register
+ }
- DW_OP_regx {
- _get_args $line $opcode register
- _op .uleb128 $argvec(register)
- }
+ proc _handle_DW_OP_pick {const} {
+ _op .byte $const
+ }
+ proc _handle_DW_OP_const1u {const} {
+ _op .byte $const
+ }
+ proc _handle_DW_OP_const1s {const} {
+ _op .byte $const
+ }
- DW_OP_pick -
- DW_OP_const1u -
- DW_OP_const1s {
- _get_args $line $opcode const
- _op .byte $argvec(const)
- }
+ proc _handle_DW_OP_const2u {const} {
+ _op .2byte $const
+ }
+ proc _handle_DW_OP_const2s {const} {
+ _op .2byte $const
+ }
- DW_OP_const2u -
- DW_OP_const2s {
- _get_args $line $opcode const
- _op .2byte $argvec(const)
- }
+ proc _handle_DW_OP_const4u {const} {
+ _op .4byte $const
+ }
+ proc _handle_DW_OP_const4s {const} {
+ _op .4byte $const
+ }
- DW_OP_const4u -
- DW_OP_const4s {
- _get_args $line $opcode const
- _op .4byte $argvec(const)
- }
+ proc _handle_DW_OP_const8u {const} {
+ _op .8byte $const
+ }
+ proc _handle_DW_OP_const8s {const} {
+ _op .8byte $const
+ }
- DW_OP_const8u -
- DW_OP_const8s {
- _get_args $line $opcode const
- _op .8byte $argvec(const)
- }
+ proc _handle_DW_OP_constu {const} {
+ _op .uleb128 $const
+ }
+ proc _handle_DW_OP_consts {const} {
+ _op .sleb128 $const
+ }
- DW_OP_constu {
- _get_args $line $opcode const
- _op .uleb128 $argvec(const)
- }
- DW_OP_consts {
- _get_args $line $opcode const
- _op .sleb128 $argvec(const)
- }
+ proc _handle_DW_OP_plus_uconst {const} {
+ _op .uleb128 $const
+ }
- DW_OP_plus_uconst {
- _get_args $line $opcode const
- _op .uleb128 $argvec(const)
- }
+ proc _handle_DW_OP_piece {size} {
+ _op .uleb128 $size
+ }
- DW_OP_piece {
- _get_args $line $opcode size
- _op .uleb128 $argvec(size)
- }
+ proc _handle_DW_OP_bit_piece {size offset} {
+ _op .uleb128 $size
+ _op .uleb128 $offset
+ }
- DW_OP_bit_piece {
- _get_args $line $opcode size offset
- _op .uleb128 $argvec(size)
- _op .uleb128 $argvec(offset)
- }
+ proc _handle_DW_OP_skip {label} {
+ _op .2byte $label
+ }
+ proc _handle_DW_OP_bra {label} {
+ _op .2byte $label
+ }
- DW_OP_skip -
- DW_OP_bra {
- _get_args $line $opcode label
- _op .2byte $argvec(label)
- }
+ proc _handle_DW_OP_entry_value {body} {
+ variable _loc_dwarf_version
+ variable _loc_addr_size
+ variable _loc_offset_size
- DW_OP_implicit_value {
- set l1 [new_label "value_start"]
- set l2 [new_label "value_end"]
- _op .uleb128 "$l2 - $l1"
- define_label $l1
- foreach value [lrange $line 1 end] {
- switch -regexp -- $value {
- {^0x[[:xdigit:]]{1,2}$} {_op .byte $value}
- {^0x[[:xdigit:]]{4}$} {_op .2byte $value}
- {^0x[[:xdigit:]]{8}$} {_op .4byte $value}
- {^0x[[:xdigit:]]{16}$} {_op .8byte $value}
- default {
- error "bad value '$value' in DW_OP_implicit_value"
- }
- }
- }
- define_label $l2
+ set l1 [new_label "expr_start"]
+ set l2 [new_label "expr_end"]
+ _op .uleb128 "$l2 - $l1" "expression"
+ define_label $l1
+ variable _level
+ uplevel $_level [list _location $body $_loc_dwarf_version \
+ $_loc_addr_size $_loc_offset_size]
+ define_label $l2
+ }
+
+ proc _handle_DW_OP_implicit_value {args} {
+ set l1 [new_label "value_start"]
+ set l2 [new_label "value_end"]
+ _op .uleb128 "$l2 - $l1"
+ define_label $l1
+ foreach value $args {
+ switch -regexp -- $value {
+ {^0x[[:xdigit:]]{1,2}$} {_op .byte $value}
+ {^0x[[:xdigit:]]{4}$} {_op .2byte $value}
+ {^0x[[:xdigit:]]{8}$} {_op .4byte $value}
+ {^0x[[:xdigit:]]{16}$} {_op .8byte $value}
+ default {
+ error "bad value '$value' in DW_OP_implicit_value"
}
+ }
+ }
+ define_label $l2
+ }
- DW_OP_implicit_pointer -
- DW_OP_GNU_implicit_pointer {
- _get_args $line $opcode label offset
+ proc _handle_DW_OP_implicit_pointer {label offset} {
+ variable _loc_dwarf_version
+ variable _loc_addr_size
+ variable _loc_offset_size
+ # Here label is a section offset.
+ if { $_loc_dwarf_version == 2 } {
+ _op .${_loc_addr_size}byte $label
+ } else {
+ _op_offset $_loc_offset_size $label
+ }
+ _op .sleb128 $offset
+ }
- # Here label is a section offset.
- if { $dwarf_version == 2 } {
- _op .${addr_size}byte $argvec(label)
- } else {
- _op_offset $offset_size $argvec(label)
- }
- _op .sleb128 $argvec(offset)
- }
+ proc _handle_DW_OP_GNU_implicit_pointer {label offset} {
+ _handle_DW_OP_implicit_pointer $label $offset
+ }
- DW_OP_GNU_variable_value {
- _get_args $line $opcode label
+ proc _handle_DW_OP_GNU_variable_value {label} {
+ variable _loc_addr_size
+ variable _loc_offset_size
+ variable _loc_dwarf_version
+ # Here label is a section offset.
+ if { $_loc_dwarf_version == 2 } {
+ _op .${_loc_addr_size}byte $label
+ } else {
+ _op_offset $_loc_offset_size $label
+ }
+ }
- # Here label is a section offset.
- if { $dwarf_version == 2 } {
- _op .${addr_size}byte $argvec(label)
- } else {
- _op_offset $offset_size $argvec(label)
- }
- }
+ proc _handle_DW_OP_deref_size {size} {
+ _op .byte $size
+ }
- DW_OP_deref_size {
- _get_args $line $opcode size
- _op .byte $argvec(size)
- }
+ proc _handle_DW_OP_bregx {register offset} {
+ _op .uleb128 $register
+ _op .sleb128 $offset
+ }
- DW_OP_bregx {
- _get_args $line $opcode register offset
- _op .uleb128 $argvec(register)
- _op .sleb128 $argvec(offset)
- }
+ proc _handle_DW_OP_fbreg {offset} {
+ _op .sleb128 $offset
+ }
- DW_OP_fbreg {
- _get_args $line $opcode offset
- _op .sleb128 $argvec(offset)
- }
+ proc _handle_DW_OP_fbreg {reg} {
+ _op .sleb128 $reg
+ }
- DW_OP_fbreg {
- _op .sleb128 [lindex $line 1]
- }
+ proc _handle_default_OP {} {
+ # Do nothing; if arguments are passed, Tcl will cause an
+ # error.
+ }
- default {
- if {[llength $line] > 1} {
- error "Unimplemented: operands in location for $opcode"
- }
- }
- }
- }
+ # This is a miniature assembler for location expressions. It is
+ # suitable for use in the attributes to a DIE.
+ #
+ # BODY is evaluated as code in the appropriate scope.
+ #
+ # DWARF_VERSION is the DWARF version for the section where the location
+ # description is found.
+ #
+ # ADDR_SIZE is the length in bytes (4 or 8) of an address on the target
+ # machine (typically found in the header of the section where the location
+ # description is found).
+ #
+ # OFFSET_SIZE is the length in bytes (4 or 8) of an offset into a DWARF
+ # section. This typically depends on whether 32-bit or 64-bit DWARF is
+ # used, as indicated in the header of the section where the location
+ # description is found.
+ #
+ # FIXME move docs
+ proc _location { body dwarf_version addr_size offset_size } {
+ variable _loc_dwarf_version
+ set _loc_dwarf_version $dwarf_version
+
+ variable _loc_addr_size
+ set _loc_addr_size $addr_size
+
+ variable _loc_offset_size
+ set _loc_offset_size $offset_size
+
+ variable _level
+ uplevel $_level $body
}
# Return a label that references the current position in the
@@ -1441,6 +1466,17 @@ namespace eval Dwarf {
# default = default
# fission 0|1 - boolean indicating if generating Fission debug info
# default = 0
+ # dwo_id - The value to use as the dwo_id field of skeleton and
+ # split_compile unit headers. May only be used with DWARF
+ # version 5.
+ #
+ # If a dwo_id value is specified (is non-zero), this unit is
+ # assumed to be part of a skeleton/split_unit pair. The unit
+ # type will be chosen according to the `fission` value.
+ #
+ # When using DWARF version 5 and fission is non-zero, it is
+ # mandatory to provide a non-zero dwo_id value.
+ # default = 0
# label <label>
# - string indicating label to be defined at the start
# of the CU header.
@@ -1457,23 +1493,26 @@ namespace eval Dwarf {
variable _cu_addr_size
variable _cu_offset_size
variable _cu_is_fission
+ variable _level
# Establish the defaults.
set is_64 0
set _cu_version 4
set _cu_addr_size default
set _cu_is_fission 0
+ set dwo_id 0
set section ".debug_info"
set _abbrev_section ".debug_abbrev"
set label ""
foreach { name value } $options {
- set value [uplevel 1 "subst \"$value\""]
+ set value [uplevel $_level "subst \"$value\""]
switch -exact -- $name {
is_64 { set is_64 $value }
version { set _cu_version $value }
addr_size { set _cu_addr_size $value }
fission { set _cu_is_fission $value }
+ dwo_id { set dwo_id $value }
label { set label $value }
default { error "unknown option $name" }
}
@@ -1524,19 +1563,49 @@ namespace eval Dwarf {
# The CU header for DWARF 4 and 5 are slightly different.
if { $_cu_version == 5 } {
- _op .byte 0x1 "DW_UT_compile"
+ # The presence of a DWO_ID indicates that we generate a skeleton
+ # or split_compile unit.
+ if { $dwo_id != 0 } {
+ if { $_cu_is_fission } {
+ set unit_type_name "DW_UT_split_compile"
+ } else {
+ set unit_type_name "DW_UT_skeleton"
+ }
+ } else {
+ set unit_type_name "DW_UT_compile"
+ }
+
+ _op .byte $_constants($unit_type_name) $unit_type_name
_op .byte $_cu_addr_size "Pointer size"
_op_offset $_cu_offset_size $my_abbrevs Abbrevs
+
+ # Output DWO ID, if specified.
+ if { $dwo_id != 0 } {
+ _op .8byte $dwo_id "DWO_ID"
+ } else {
+ # To help catch user errors: if the caller asked to put this
+ # unit in the DWO file but didn't provide a DWO ID, it is likely
+ # an error.
+ if { $_cu_is_fission } {
+ error "DWO ID not specified for DWARF 5 split compile"
+ }
+ }
} else {
_op_offset $_cu_offset_size $my_abbrevs Abbrevs
_op .byte $_cu_addr_size "Pointer size"
+
+ # For DWARF versions < 5, the DWO ID is not in the unit header,
+ # so it makes not sense to specify one.
+ if { $dwo_id != 0 } {
+ error "DWO ID specified for DWARF < 5 unit"
+ }
}
_defer_output $_abbrev_section {
define_label $my_abbrevs
}
- uplevel $body
+ uplevel $_level $body
_defer_output $_abbrev_section {
# Emit the terminator.
@@ -1572,6 +1641,7 @@ namespace eval Dwarf {
variable _cu_addr_size
variable _cu_offset_size
variable _cu_is_fission
+ variable _level
# Establish the defaults.
set is_64 0
@@ -1583,7 +1653,7 @@ namespace eval Dwarf {
set label ""
foreach { name value } $options {
- set value [uplevel 1 "subst \"$value\""]
+ set value [uplevel $_level "subst \"$value\""]
switch -exact -- $name {
is_64 { set is_64 $value }
version { set _cu_version $value }
@@ -1606,7 +1676,7 @@ namespace eval Dwarf {
}
if { $_cu_is_fission } {
set section "$section.dwo"
- set _abbrev_section "$section.dwo"
+ set _abbrev_section "$_abbrev_section.dwo"
}
_section $section
@@ -1646,7 +1716,7 @@ namespace eval Dwarf {
_op .8byte $signature Signature
if { $type_label != "" } {
- uplevel declare_labels $type_label
+ uplevel $_level declare_labels $type_label
upvar $type_label my_type_label
if {$is_64} {
_op .8byte "$my_type_label - $_cu_label"
@@ -1665,7 +1735,7 @@ namespace eval Dwarf {
define_label $my_abbrevs
}
- uplevel $body
+ uplevel $_level $body
_defer_output $_abbrev_section {
# Emit the terminator.
@@ -1738,7 +1808,8 @@ namespace eval Dwarf {
}
}
- uplevel $body
+ variable _level
+ uplevel $_level $body
}
# Emit a DWARF .debug_rnglists section.
@@ -1758,7 +1829,7 @@ namespace eval Dwarf {
parse_options {{"is-64" "false"}}
- if [is_64_target] {
+ if {[is_64_target]} {
set _debug_rnglists_addr_size 8
} else {
set _debug_rnglists_addr_size 4
@@ -1787,7 +1858,8 @@ namespace eval Dwarf {
}
with_override Dwarf::table Dwarf::_rnglists_table {
- uplevel $body
+ variable _level
+ uplevel $_level $body
}
}
@@ -1813,6 +1885,7 @@ namespace eval Dwarf {
variable _debug_rnglists_addr_size
variable _debug_rnglists_offset_size
variable _debug_rnglists_is_64_dwarf
+ variable _level
parse_options {
{post-header-label ""}
@@ -1826,7 +1899,7 @@ namespace eval Dwarf {
# lists there are to generate the header and offset table.
set lists_ops [_defer_to_string {
with_override Dwarf::list_ Dwarf::_rnglists_list {
- uplevel $body
+ uplevel $_level $body
}
}]
@@ -1900,6 +1973,7 @@ namespace eval Dwarf {
proc _rnglists_list { body } {
variable _debug_rnglists_list_count
+ variable _level
# Define a label for this list. It is used to build the offset
# array later.
@@ -1907,7 +1981,7 @@ namespace eval Dwarf {
define_label $list_label
with_override Dwarf::start_end Dwarf::_rnglists_start_end {
- uplevel $body
+ uplevel $_level $body
}
# Emit end of list.
@@ -1943,10 +2017,11 @@ namespace eval Dwarf {
variable _debug_loclists_addr_size
variable _debug_loclists_offset_size
variable _debug_loclists_is_64_dwarf
+ variable _level
parse_options {{"is-64" "false"}}
- if [is_64_target] {
+ if {[is_64_target]} {
set _debug_loclists_addr_size 8
} else {
set _debug_loclists_addr_size 4
@@ -1975,7 +2050,7 @@ namespace eval Dwarf {
}
with_override Dwarf::table Dwarf::_loclists_table {
- uplevel $body
+ uplevel $_level $body
}
}
@@ -2001,6 +2076,7 @@ namespace eval Dwarf {
variable _debug_loclists_addr_size
variable _debug_loclists_offset_size
variable _debug_loclists_is_64_dwarf
+ variable _level
parse_options {
{post-header-label ""}
@@ -2014,7 +2090,7 @@ namespace eval Dwarf {
# lists there are to generate the header and offset table.
set lists_ops [_defer_to_string {
with_override Dwarf::list_ Dwarf::_loclists_list {
- uplevel $body
+ uplevel $_level $body
}
}]
@@ -2090,6 +2166,7 @@ namespace eval Dwarf {
proc _loclists_list { body } {
variable _debug_loclists_list_count
+ variable _level
# Count the location descriptions in this list.
variable _debug_loclists_locdesc_count 0
@@ -2102,7 +2179,7 @@ namespace eval Dwarf {
with_override Dwarf::start_length Dwarf::_loclists_start_length {
with_override Dwarf::base_address Dwarf::_loclists_base_address {
with_override Dwarf::start_end Dwarf::_loclists_start_end {
- uplevel $body
+ uplevel $_level $body
}}}
# Emit end of list.
@@ -2123,8 +2200,9 @@ namespace eval Dwarf {
variable _debug_loclists_table_count
variable _debug_loclists_list_count
variable _debug_loclists_locdesc_count
+ variable _level
- set locdesc [uplevel [list subst $locdesc]]
+ set locdesc [uplevel $_level [list subst $locdesc]]
_op .byte 0x08 "DW_LLE_start_length"
@@ -2157,8 +2235,9 @@ namespace eval Dwarf {
variable _debug_loclists_table_count
variable _debug_loclists_list_count
variable _debug_loclists_locdesc_count
+ variable _level
- set locdesc [uplevel [list subst $locdesc]]
+ set locdesc [uplevel $_level [list subst $locdesc]]
_op .byte 0x07 "DW_LLE_start_end"
@@ -2195,10 +2274,11 @@ namespace eval Dwarf {
# (see `_macro_unit`) to generate macro units.
proc macro { body } {
+ variable _level
_section ".debug_macro"
with_override Dwarf::unit Dwarf::_macro_unit {
- uplevel $body
+ uplevel $_level $body
}
}
@@ -2234,19 +2314,19 @@ namespace eval Dwarf {
set flags 0
if { ${is-64} } {
- set flags [expr $flags | 0x1]
+ set flags [expr {$flags | 0x1}]
}
variable _mu_offset_size
- set _mu_offset_size [expr ${is-64} ? 8 : 4]
+ set _mu_offset_size [expr {${is-64} ? 8 : 4}]
if { ${debug-line-offset-label} != "" } {
- set flags [expr $flags | 0x2]
+ set flags [expr {$flags | 0x2}]
}
_op .byte $flags "flags"
if { ${debug-line-offset-label} != "" } {
- _op_offset [expr ${is-64} ? 8 : 4] ${debug-line-offset-label} \
+ _op_offset [expr {${is-64} ? 8 : 4}] ${debug-line-offset-label} \
"debug_line offset"
}
@@ -2254,7 +2334,8 @@ namespace eval Dwarf {
with_override Dwarf::define Dwarf::_macro_unit_define {
with_override Dwarf::start_file Dwarf::_macro_unit_start_file {
with_override Dwarf::end_file Dwarf::_macro_unit_end_file {
- uplevel $body
+ variable _level
+ uplevel $_level $body
}}}}
_op .byte 0x0 "# End macro unit"
@@ -2446,7 +2527,7 @@ namespace eval Dwarf {
lappend _line_include_dirs $dirname
if { $Dwarf::_line_unit_version >= 5 } {
- return [expr [llength $_line_include_dirs] - 1]
+ return [expr {[llength $_line_include_dirs] - 1}]
} else {
return [llength $_line_include_dirs]
}
@@ -2459,9 +2540,9 @@ namespace eval Dwarf {
variable _line_file_names
lappend _line_file_names $filename $diridx
- set nr_filenames [expr [llength $_line_file_names] / 2]
+ set nr_filenames [expr {[llength $_line_file_names] / 2}]
if { $Dwarf::_line_unit_version >= 5 } {
- return [expr $nr_filenames - 1]
+ return [expr {$nr_filenames - 1}]
} else {
return $nr_filenames
}
@@ -2509,7 +2590,7 @@ namespace eval Dwarf {
string_ptr:
_op .ascii [_quote $dirname]
}
- _op_offset [expr $_line_is_64 ? 8 : 4] $string_ptr
+ _op_offset [expr {$_line_is_64 ? 8 : 4}] $string_ptr
}
}
}
@@ -2532,7 +2613,7 @@ namespace eval Dwarf {
_op .uleb128 0x0f \
"file_name_entry_format (form: DW_FORM_udata)"
- set nr_files [expr [llength $_line_file_names] / 2]
+ set nr_files [expr {[llength $_line_file_names] / 2}]
_op .byte $nr_files "file_names_count"
foreach { filename diridx } $_line_file_names {
@@ -2546,7 +2627,7 @@ namespace eval Dwarf {
string_ptr:
_op .ascii [_quote $filename]
}
- _op_offset [expr $_line_is_64 ? 8 : 4] $string_ptr
+ _op_offset [expr {$_line_is_64 ? 8 : 4}] $string_ptr
}
}
_op .uleb128 $diridx
@@ -2684,21 +2765,21 @@ namespace eval Dwarf {
variable _line
_op .byte 3 DW_LNS_advance_line
_op .sleb128 ${offset}
- set _line [expr $_line + $offset]
+ set _line [expr {$_line + $offset}]
}
# A pseudo line number program instruction, that can be used instead
# of DW_LNS_advance_line. Rather than writing:
- # {DW_LNS_advance_line [expr $line1 - 1]}
- # {DW_LNS_advance_line [expr $line2 - $line1]}
- # {DW_LNS_advance_line [expr $line3 - $line2]}
+ # {DW_LNS_advance_line [expr {$line1 - 1}]}
+ # {DW_LNS_advance_line [expr {$line2 - $line1}]}
+ # {DW_LNS_advance_line [expr {$line3 - $line2}]}
# we can just write:
# {line $line1}
# {line $line2}
# {line $line3}
proc line {line} {
variable _line
- set offset [expr $line - $_line]
+ set offset [expr {$line - $_line}]
DW_LNS_advance_line $offset
}
@@ -2716,7 +2797,8 @@ namespace eval Dwarf {
}
}
- uplevel $body
+ variable _level
+ uplevel $_level $body
rename include_dir ""
rename file_name ""
@@ -2860,12 +2942,12 @@ namespace eval Dwarf {
incr offset
# Padding.
- set tuple_size [expr 2 * $_addr_size + $_seg_size]
+ set tuple_size [expr {2 * $_addr_size + $_seg_size}]
if {$tuple_size == 0} {
set tuple_size 1
}
while { 1 } {
- if { [expr $offset % $tuple_size] == 0 } {
+ if { $offset % $tuple_size == 0 } {
break
}
_op .byte 0 "Pad to $tuple_size byte boundary"
@@ -2873,7 +2955,8 @@ namespace eval Dwarf {
}
# Range tuples.
- uplevel $body
+ variable _level
+ uplevel $_level $body
# Terminator tuple.
set comment "Terminator"
@@ -2969,8 +3052,9 @@ namespace eval Dwarf {
# Introduce command 'entry'.
with_override Dwarf::entry Dwarf::_loc_entry {
+ variable _level
# Emit entries.
- uplevel $body
+ uplevel $_level $body
}
# Determine how to emit addresses.
@@ -3006,9 +3090,27 @@ namespace eval Dwarf {
}
}
+ # Emit a .debug_sup section with the given file name and build-id.
+ # The buildid should be represented as a hexadecimal string, like
+ # "ffeeddcc".
+ proc debug_sup {is_sup filename buildid} {
+ _defer_output .debug_sup {
+ # The version.
+ _op .2byte 0x5
+ # Supplementary marker.
+ _op .byte $is_sup
+ _op .ascii [_quote $filename]
+ set len [expr {[string length $buildid] / 2}]
+ _op .uleb128 $len
+ foreach {a b} [split $buildid {}] {
+ _op .byte 0x$a$b
+ }
+ }
+ }
+
proc _note {type name hexdata} {
- set namelen [expr [string length $name] + 1]
- set datalen [expr [string length $hexdata] / 2]
+ set namelen [expr {[string length $name] + 1}]
+ set datalen [expr {[string length $hexdata] / 2}]
# Name size.
_op .4byte $namelen
@@ -3048,13 +3150,16 @@ namespace eval Dwarf {
# Emit a dummy CU.
proc dummy_cu {} {
- # Generate a CU with default options and empty body.
- cu {label dummy_cu} {
- compile_unit {}
- }
+ variable _level
+ uplevel $_level {
+ # Generate a CU with default options and empty body.
+ cu {label dummy_cu} {
+ compile_unit {}
+ }
- # Generate an .debug_aranges entry for the dummy CU.
- aranges {} dummy_cu {
+ # Generate an .debug_aranges entry for the dummy CU.
+ aranges {} dummy_cu {
+ }
}
}
@@ -3139,7 +3244,8 @@ namespace eval Dwarf {
with_override Dwarf::cu Dwarf::_debug_names_cu {
with_override Dwarf::tu Dwarf::_debug_names_tu {
with_override Dwarf::name Dwarf::_debug_names_name {
- uplevel $body
+ variable _level
+ uplevel $_level $body
}}}
# Header - CU / TU / foreign TU count.
@@ -3305,6 +3411,58 @@ namespace eval Dwarf {
debug_names_end:
}
+ # Add the strings in ARGS to the .debug_str section, and create a
+ # .debug_str_offsets section pointing to those strings.
+ # Current options are:
+ # dwo 0|1 - boolean indicating if the sections have the dwo suffix.
+ # default = 0 (no .dwo suffix)
+ # base_offset label
+ # - generate label, to be used in DW_AT_str_offsets_base.
+ # default = "" (don't generate a label).
+ proc debug_str_offsets { options args } {
+ parse_options {
+ { dwo 0 }
+ { base_offset "" }
+ }
+
+ if { $dwo } {
+ _section .debug_str.dwo
+ } else {
+ _section .debug_str
+ }
+
+ set num 0
+ foreach arg $args {
+ set str_label [_compute_label "str_${num}"]
+ define_label $str_label
+ _op .asciz \"$arg\" ".debug_str_offsets string $num"
+ incr num
+ }
+
+ declare_labels debug_str_offsets_start debug_str_offsets_end
+ set initial_length "$debug_str_offsets_end - $debug_str_offsets_start"
+
+ if { $dwo } {
+ _section .debug_str_offsets.dwo
+ } else {
+ _section .debug_str_offsets
+ }
+ _op .4byte $initial_length "Initial_length"
+ debug_str_offsets_start:
+ _op .2byte 0x5 "version"
+ _op .2byte 0x0 "padding"
+ if { $base_offset != "" } {
+ $base_offset:
+ }
+ set num 0
+ foreach arg $args {
+ set str_label [_compute_label "str_${num}"]
+ _op .4byte $str_label "string $num"
+ incr num
+ }
+ debug_str_offsets_end:
+ }
+
# The top-level interface to the DWARF assembler.
# OPTIONS is a list with an even number of elements containing
# option-name and option-value pairs.
@@ -3349,11 +3507,14 @@ namespace eval Dwarf {
variable _line_header_end_label
variable _debug_ranges_64_bit
variable _debug_addr_index
+ variable _level
if { [llength $options] == 1 } {
set options [list filename [lindex $options 0]]
}
+ set _level "#[info level]"
+
parse_options {
{ filename "" }
{ file_id "" }
@@ -3385,13 +3546,14 @@ namespace eval Dwarf {
# Dummy CU at the start to ensure that the first CU in $body is not
# the first in .debug_info.
if { $add_dummy_cus } {
- dummy_cu
+ uplevel $_level dummy_cu
}
with_shared_gdb {
# Not "uplevel" here, because we want to evaluate in this
# namespace. This is somewhat bad because it means we can't
# readily refer to outer variables.
+ # tclint-disable-next-line command-args
eval $body
}
diff --git a/gdb/testsuite/lib/fortran.exp b/gdb/testsuite/lib/fortran.exp
index cddcc3a..7572388 100644
--- a/gdb/testsuite/lib/fortran.exp
+++ b/gdb/testsuite/lib/fortran.exp
@@ -1,6 +1,6 @@
# This test code is part of GDB, the GNU debugger.
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,11 +19,12 @@
# The result is 1 (true) for success, 0 (false) for failure.
proc set_lang_fortran {} {
- if [gdb_test_no_output "set language fortran"] {
+ if {[gdb_test_no_output "set language fortran"]} {
return 0
}
- if [gdb_test "show language" ".* source language is \"fortran\"." \
- "set language to \"fortran\""] {
+ if {[gdb_test "show language" \
+ [string_to_regexp {The current source language is "fortran".}] \
+ {set language to "fortran"}]} {
return 0
}
return 1
diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
index 62913cb..3064c3e 100644
--- a/gdb/testsuite/lib/future.exp
+++ b/gdb/testsuite/lib/future.exp
@@ -1,4 +1,4 @@
-# Copyright 2004-2024 Free Software Foundation, Inc.
+# Copyright 2004-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,11 +27,11 @@ proc gdb_find_gnatmake {} {
set root "$tool_root_dir/gcc"
set GM ""
- if ![is_remote host] {
+ if {![is_remote host]} {
set file [lookfor_file $root gnatmake]
if { $file != "" } {
set GM "$file -I$root/ada/rts --GCC=$root/xgcc --GNATBIND=$root/gnatbind --GNATLINK=$root/gnatlink -cargs -B$root -largs --GCC=$root/xgcc -margs";
- }
+ }
}
if {$GM == ""} {
@@ -39,7 +39,7 @@ proc gdb_find_gnatmake {} {
}
return $GM
-}
+}
proc gdb_find_gdc {} {
global tool_root_dir
@@ -138,7 +138,7 @@ proc gdb_find_hipcc {} {
proc gdb_find_ldd {} {
global LDD_FOR_TARGET
- if [info exists LDD_FOR_TARGET] {
+ if {[info exists LDD_FOR_TARGET]} {
set ldd $LDD_FOR_TARGET
} else {
set ldd "ldd"
@@ -148,7 +148,7 @@ proc gdb_find_ldd {} {
proc gdb_find_objcopy {} {
global OBJCOPY_FOR_TARGET
- if [info exists OBJCOPY_FOR_TARGET] {
+ if {[info exists OBJCOPY_FOR_TARGET]} {
set objcopy $OBJCOPY_FOR_TARGET
} else {
set objcopy [transform objcopy]
@@ -159,7 +159,7 @@ proc gdb_find_objcopy {} {
# find target objdump
proc gdb_find_objdump {} {
global OBJDUMP_FOR_TARGET
- if [info exists OBJDUMP_FOR_TARGET] {
+ if {[info exists OBJDUMP_FOR_TARGET]} {
set objdump $OBJDUMP_FOR_TARGET
} else {
set objdump [transform objdump]
@@ -169,7 +169,7 @@ proc gdb_find_objdump {} {
proc gdb_find_readelf {} {
global READELF_FOR_TARGET
- if [info exists READELF_FOR_TARGET] {
+ if {[info exists READELF_FOR_TARGET]} {
set readelf $READELF_FOR_TARGET
} else {
set readelf [transform readelf]
@@ -179,7 +179,7 @@ proc gdb_find_readelf {} {
proc gdb_find_eu-unstrip {} {
global EU_UNSTRIP_FOR_TARGET
- if [info exists EU_UNSTRIP_FOR_TARGET] {
+ if {[info exists EU_UNSTRIP_FOR_TARGET]} {
set eu_unstrip $EU_UNSTRIP_FOR_TARGET
} else {
set eu_unstrip [transform eu-unstrip]
@@ -482,7 +482,7 @@ proc gdb_default_target_compile_1 {source destfile type options} {
}
if {[isnative]} {
# This is a lose.
- catch "glob -nocomplain $tool_root_dir/libstdc++/libstdc++.so* $tool_root_dir/libstdc++/libstdc++.sl" tmp
+ catch {glob -nocomplain $tool_root_dir/libstdc++/libstdc++.so* $tool_root_dir/libstdc++/libstdc++.sl} tmp
if { ${tmp} != "" } {
if {[regexp ".*solaris2.*" $target_triplet]} {
# Solaris 2
@@ -749,19 +749,6 @@ if { [array size use_gdb_compile] != 0 } {
rename gdb_default_target_compile ""
}
-
-# Provide 'lreverse' missing in Tcl before 7.5.
-
-if {[info procs lreverse] == ""} {
- proc lreverse { arg } {
- set retval {}
- while { [llength $retval] < [llength $arg] } {
- lappend retval [lindex $arg end-[llength $retval]]
- }
- return $retval
- }
-}
-
# Various ccache versions provide incorrect debug info such as ignoring
# different current directory, breaking GDB testsuite.
set env(CCACHE_DISABLE) 1
diff --git a/gdb/testsuite/lib/gdb-guile.exp b/gdb/testsuite/lib/gdb-guile.exp
index 412dd56..9205312 100644
--- a/gdb/testsuite/lib/gdb-guile.exp
+++ b/gdb/testsuite/lib/gdb-guile.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ proc gdb_scm_test_silent_cmd { cmd name {report_pass 1} } {
-re "Backtrace.*$gdb_prompt $" { fail $name }
-re "ERROR.*$gdb_prompt $" { fail $name }
-re "Undefined command: .*$gdb_prompt $" { fail $name }
- -re "$gdb_prompt $" { if $report_pass { pass $name } }
+ -re "$gdb_prompt $" { if {$report_pass} { pass $name } }
}
}
@@ -85,7 +85,7 @@ proc gdb_install_guile_module { } {
# The result is the same as for runto_main.
proc gdb_guile_runto_main { } {
- if ![runto_main] {
+ if {![runto_main]} {
return 0
}
diff --git a/gdb/testsuite/lib/gdb-python.exp b/gdb/testsuite/lib/gdb-python.exp
index a820c87..e026c1b 100644
--- a/gdb/testsuite/lib/gdb-python.exp
+++ b/gdb/testsuite/lib/gdb-python.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -77,3 +77,24 @@ proc gdb_py_module_available { name } {
return ${available}
}
+
+# Run a memory leak test within the Python script FILENAME. This proc
+# checks that the required Python modules are available, sets up the
+# syspath so that the helper module can be found (in the same
+# directory as FILENAME), then loads FILENAME to run the test.
+proc gdb_py_run_memory_leak_test { filename testname } {
+ if { ![gdb_py_module_available "tracemalloc"] } {
+ unsupported "$testname (tracemalloc module not available)"
+ }
+
+ gdb_test_no_output -nopass "python import sys"
+ gdb_test_no_output -nopass \
+ "python sys.path.insert(0, \"[file dirname $filename]\")" \
+ "setup sys.path"
+
+ set pyfile [gdb_remote_download host ${filename}]
+
+ # Source the Python script, this runs the test, and either prints
+ # PASS, or throws an exception.
+ gdb_test "source ${pyfile}" "^PASS" $testname
+}
diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp
index b8ab30a..f4506a1 100644
--- a/gdb/testsuite/lib/gdb-utils.exp
+++ b/gdb/testsuite/lib/gdb-utils.exp
@@ -1,4 +1,4 @@
-# Copyright 2014-2024 Free Software Foundation, Inc.
+# Copyright 2014-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,10 +20,10 @@
proc gdb_init_commands {} {
set commands ""
- if [target_info exists gdb_init_command] {
+ if {[target_info exists gdb_init_command]} {
lappend commands [target_info gdb_init_command]
}
- if [target_info exists gdb_init_commands] {
+ if {[target_info exists gdb_init_commands]} {
set commands [concat $commands [target_info gdb_init_commands]]
}
return $commands
@@ -70,6 +70,8 @@ proc style {str style} {
set fg 39
set bg 49
set intensity 22
+ set italic 23
+ set underline 24
set reverse 27
switch -exact -- $style {
title { set intensity 1 }
@@ -84,7 +86,7 @@ proc style {str style} {
line-number { set intensity 2 }
none { return $str }
}
- return "\033\\\[${fg};${bg};${intensity};${reverse}m${str}\033\\\[m"
+ return "\033\\\[${fg};${bg};${intensity};${italic};${underline};${reverse}m${str}\033\\\[m"
}
# gdb_get_bp_addr num
@@ -117,7 +119,10 @@ proc gdb_get_bp_addr { num } {
# Compare the version numbers in L1 to those in L2 using OP, and
# return 1 if the comparison is true. OP can be "<", "<=", ">", ">=",
-# or "==". It is ok if the lengths of the lists differ.
+# or "==".
+# It is ok if the lengths of the lists differ, but note that we have
+# "{1} < {1 0}" instead of "{1} == {1 0}". See also
+# gdb.testsuite/version-compare.exp.
proc version_compare { l1 op l2 } {
switch -exact $op {
@@ -160,6 +165,7 @@ proc version_compare { l1 op l2 } {
if {$v1 == $v2} {
continue
}
+ # tclint-disable-next-line unbraced-expr
return [expr $v1 $op $v2]
}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 59967c7..ef6a8f8 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1,4 +1,4 @@
-# Copyright 1992-2024 Free Software Foundation, Inc.
+# Copyright 1992-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,6 +15,8 @@
# This file was written by Fred Fish. (fnf@cygnus.com)
+package require Tcl 8.6.2
+
# Generic gdb subroutines that should work for any target. If these
# need to be modified for any target, it can be done with a variable
# or by passing arguments.
@@ -134,7 +136,7 @@ proc load_lib { file } {
set known_globals($varname) 1
}
- set code [catch "saved_load_lib $file" result]
+ set code [catch {saved_load_lib $file} result]
foreach varname [info globals] {
if { ![info exists known_globals($varname)] } {
@@ -173,11 +175,11 @@ global GDB_DATA_DIRECTORY
# so input/output is done on gdbserver's tty.
global inferior_spawn_id
-if [info exists TOOL_EXECUTABLE] {
+if {[info exists TOOL_EXECUTABLE]} {
set GDB $TOOL_EXECUTABLE
}
-if ![info exists GDB] {
- if ![is_remote host] {
+if {![info exists GDB]} {
+ if {![is_remote host]} {
set GDB [findfile $base_dir/../../gdb/gdb "$base_dir/../../gdb/gdb" [transform gdb]]
} else {
set GDB [transform gdb]
@@ -186,7 +188,7 @@ if ![info exists GDB] {
# If the user specifies GDB on the command line, and doesn't
# specify GDB_DATA_DIRECTORY, then assume we're testing an
# installed GDB, and let it use its own configured data directory.
- if ![info exists GDB_DATA_DIRECTORY] {
+ if {![info exists GDB_DATA_DIRECTORY]} {
set GDB_DATA_DIRECTORY ""
}
}
@@ -195,7 +197,7 @@ verbose "using GDB = $GDB" 2
# The data directory the testing GDB will use. By default, assume
# we're testing a non-installed GDB in the build directory. Users may
# also explicitly override the -data-directory from the command line.
-if ![info exists GDB_DATA_DIRECTORY] {
+if {![info exists GDB_DATA_DIRECTORY]} {
set GDB_DATA_DIRECTORY [file normalize "[pwd]/../data-directory"]
}
verbose "using GDB_DATA_DIRECTORY = $GDB_DATA_DIRECTORY" 2
@@ -223,7 +225,7 @@ proc has_gcore_script {} {
# - append new flags, not overwrite
# - restore the original value when done
global GDBFLAGS
-if ![info exists GDBFLAGS] {
+if {![info exists GDBFLAGS]} {
set GDBFLAGS ""
}
verbose "using GDBFLAGS = $GDBFLAGS" 2
@@ -248,7 +250,7 @@ proc append_gdb_data_directory_option {cmdline} {
# `-data-directory' points to the data directory, usually in the build
# directory.
global INTERNAL_GDBFLAGS
-if ![info exists INTERNAL_GDBFLAGS] {
+if {![info exists INTERNAL_GDBFLAGS]} {
set INTERNAL_GDBFLAGS \
[join [list \
"-nw" \
@@ -269,6 +271,13 @@ if ![info exists INTERNAL_GDBFLAGS] {
}
set INTERNAL_GDBFLAGS [append_gdb_data_directory_option $INTERNAL_GDBFLAGS]
+
+ # Handle the case that "interactive-mode auto" reports off.
+ append INTERNAL_GDBFLAGS { -iex "set interactive-mode on"}
+
+ if { [ishost "*-*-mingw*"] } {
+ append INTERNAL_GDBFLAGS { --binary-output}
+ }
}
# The variable gdb_prompt is a regexp which matches the gdb prompt.
@@ -280,27 +289,30 @@ if {![info exists gdb_prompt]} {
set gdb_prompt "\\(gdb\\)"
}
-# A regexp that matches the pagination prompt.
-set pagination_prompt \
+# The pagination prompt.
+set pagination_prompt_str \
"--Type <RET> for more, q to quit, c to continue without paging--"
-# The variable fullname_syntax_POSIX is a regexp which matches a POSIX
-# absolute path ie. /foo/
+# A regexp that matches the pagination prompt.
+set pagination_prompt [string_to_regexp $pagination_prompt_str]
+
+# The variable fullname_syntax_POSIX is a regexp which matches a POSIX
+# absolute path ie. "/foo/".
set fullname_syntax_POSIX {/[^\n]*/}
-# The variable fullname_syntax_UNC is a regexp which matches a Windows
-# UNC path ie. \\D\foo\
+# The variable fullname_syntax_UNC is a regexp which matches a Windows
+# UNC path ie. "\\D\foo\".
set fullname_syntax_UNC {\\\\[^\\]+\\[^\n]+\\}
-# The variable fullname_syntax_DOS_CASE is a regexp which matches a
+# The variable fullname_syntax_DOS_CASE is a regexp which matches a
# particular DOS case that GDB most likely will output
-# ie. \foo\, but don't match \\.*\
+# ie. "\foo\", but don't match "\\.*\".
set fullname_syntax_DOS_CASE {\\[^\\][^\n]*\\}
# The variable fullname_syntax_DOS is a regexp which matches a DOS path
-# ie. a:\foo\ && a:foo\
+# ie. "a:\foo\" && "a:foo\".
set fullname_syntax_DOS {[a-zA-Z]:[^\n]*\\}
# The variable fullname_syntax is a regexp which matches what GDB considers
-# an absolute path. It is currently debatable if the Windows style paths
-# d:foo and \abc should be considered valid as an absolute path.
-# Also, the purpse of this regexp is not to recognize a well formed
+# an absolute path. It is currently debatable if the Windows style paths
+# "d:foo" and "\abc" should be considered valid as an absolute path.
+# Also, the purpose of this regexp is not to recognize a well formed
# absolute path, but to say with certainty that a path is absolute.
set fullname_syntax "($fullname_syntax_POSIX|$fullname_syntax_UNC|$fullname_syntax_DOS_CASE|$fullname_syntax_DOS)"
@@ -308,7 +320,7 @@ set fullname_syntax "($fullname_syntax_POSIX|$fullname_syntax_UNC|$fullname_synt
global EXEEXT
global env
-if ![info exists env(EXEEXT)] {
+if {![info exists env(EXEEXT)]} {
set EXEEXT ""
} else {
set EXEEXT $env(EXEEXT)
@@ -346,14 +358,14 @@ proc default_gdb_version {} {
global inotify_pid
if {[info exists inotify_pid]} {
- eval exec kill $inotify_pid
+ exec kill $inotify_pid
}
set output [remote_exec host "$GDB $INTERNAL_GDBFLAGS --version"]
set tmp [lindex $output 1]
set version ""
regexp " \[0-9\]\[^ \t\n\r\]+" "$tmp" version
- if ![is_remote host] {
+ if {![is_remote host]} {
clone_output "[which $GDB] version $version $INTERNAL_GDBFLAGS $GDBFLAGS\n"
} else {
clone_output "$GDB on remote host version $version $INTERNAL_GDBFLAGS $GDBFLAGS\n"
@@ -394,7 +406,7 @@ proc gdb_unload { {msg "file"} } {
# Many of the tests depend on setting breakpoints at various places and
# running until that breakpoint is reached. At times, we want to start
-# with a clean-slate with respect to breakpoints, so this utility proc
+# with a clean-slate with respect to breakpoints, so this utility proc
# lets us do this without duplicating this code everywhere.
#
@@ -453,7 +465,7 @@ proc target_can_use_run_cmd { {target_description ""} } {
error "invalid argument: $target_description"
}
- if [target_info exists use_gdb_stub] {
+ if {[target_info exists use_gdb_stub]} {
# In this case, when we connect, the inferior is already
# running.
return 0
@@ -497,8 +509,8 @@ proc gdb_run_cmd { {inferior_args {}} } {
}
}
- if $use_gdb_stub {
- if [target_info exists gdb,do_reload_on_run] {
+ if {$use_gdb_stub} {
+ if {[target_info exists gdb,do_reload_on_run]} {
if { [gdb_reload $inferior_args] != 0 } {
return -1
}
@@ -510,7 +522,7 @@ proc gdb_run_cmd { {inferior_args {}} } {
return 0
}
- if [target_info exists gdb,start_symbol] {
+ if {[target_info exists gdb,start_symbol]} {
set start [target_info gdb,start_symbol]
} else {
set start "start"
@@ -521,11 +533,11 @@ proc gdb_run_cmd { {inferior_args {}} } {
# Cap (re)start attempts at three to ensure that this loop
# always eventually fails. Don't worry about trying to be
# clever and not send a command when it has failed.
- if [expr $start_attempt > 3] {
+ if {$start_attempt > 3} {
perror "Jump to start() failed (retry count exceeded)"
return -1
}
- set start_attempt [expr $start_attempt + 1]
+ set start_attempt [expr {$start_attempt + 1}]
gdb_expect 30 {
-re "Continuing at \[^\r\n\]*\[\r\n\]" {
set start_attempt 0
@@ -559,7 +571,7 @@ proc gdb_run_cmd { {inferior_args {}} } {
return 0
}
- if [target_info exists gdb,do_reload_on_run] {
+ if {[target_info exists gdb,do_reload_on_run]} {
if { [gdb_reload $inferior_args] != 0 } {
return -1
}
@@ -608,7 +620,7 @@ proc gdb_start_cmd { {inferior_args {}} } {
}
}
- if $use_gdb_stub {
+ if {$use_gdb_stub} {
return -1
}
@@ -651,7 +663,7 @@ proc gdb_starti_cmd { {inferior_args {}} } {
}
}
- if $use_gdb_stub {
+ if {$use_gdb_stub} {
return -1
}
@@ -726,7 +738,7 @@ proc gdb_breakpoint { linespec args } {
return 0
}
}
- -re "Make breakpoint pending.*y or \\\[n\\\]. $" {
+ -re "Make breakpoint pending.*y or \\\[n\\\]. $" {
send_gdb "$pending_response\n"
exp_continue
}
@@ -741,7 +753,7 @@ proc gdb_breakpoint { linespec args } {
pass $test_name
}
return 1
-}
+}
# Set breakpoint at function and run gdb until it breaks there.
# Since this is the only breakpoint that will be set, if it stops
@@ -787,7 +799,7 @@ proc runto { linespec args } {
}
gdb_run_cmd
-
+
# the "at foo.c:36" output we get with -g.
# the "in func" output we get without -g.
gdb_expect {
@@ -816,19 +828,19 @@ proc runto { linespec args } {
gdb_internal_error_resync
return 0
}
- -re "$gdb_prompt $" {
+ -re "$gdb_prompt $" {
if { $print_fail } {
fail $test_name
}
return 0
}
- eof {
+ eof {
if { $print_fail } {
fail "$test_name (eof)"
}
return 0
}
- timeout {
+ timeout {
if { $print_fail } {
fail "$test_name (timeout)"
}
@@ -1026,7 +1038,10 @@ proc command_to_message { command } {
# should not be anchored at the end of the buffer. This means that the
# pattern can match even if there is stuff output after the prompt. Does not
# have any effect if -prompt is specified.
-# -lbl specifies that line-by-line matching will be used.
+# -lbl specifies that line-by-line matching will be used. This means
+# that lines from GDB not matched by any pattern will be consumed from
+# the output buffer. This helps avoid buffer overflows and timeouts
+# when testing verbose commands.
# EXPECT_ARGUMENTS will be fed to expect in addition to the standard
# patterns. Pattern elements will be evaluated in the caller's
# context; action elements will be executed in the caller's context.
@@ -1037,7 +1052,7 @@ proc command_to_message { command } {
# 1 if the test failed, according to a built-in failure pattern
# 0 if only user-supplied patterns matched
# -1 if there was an internal error.
-#
+#
# You can use this function thus:
#
# gdb_test_multiple "print foo" "test foo" {
@@ -1124,6 +1139,7 @@ proc gdb_test_multiple { command message args } {
global any_spawn_id
set line_by_line 0
+ set lbl_anchor_re ""
set prompt_regexp ""
set prompt_anchor 1
for {set i 0} {$i < [llength $args]} {incr i} {
@@ -1133,6 +1149,7 @@ proc gdb_test_multiple { command message args } {
set prompt_regexp [lindex $args $i]
} elseif { $arg == "-lbl" } {
set line_by_line 1
+ set lbl_anchor_re "^"
} elseif { $arg == "-no-prompt-anchor" } {
set prompt_anchor 0
} else {
@@ -1140,7 +1157,7 @@ proc gdb_test_multiple { command message args } {
break
}
}
- if { [expr $i + 1] < [llength $args] } {
+ if {$i + 1 < [llength $args]} {
error "Too many arguments to gdb_test_multiple"
} elseif { ![info exists user_code] } {
error "Too few arguments to gdb_test_multiple"
@@ -1152,15 +1169,15 @@ proc gdb_test_multiple { command message args } {
set message [command_to_message $command]
}
- if [string match "*\[\r\n\]" $command] {
+ if {[string match "*\[\r\n\]" $command]} {
error "Invalid trailing newline in \"$command\" command"
}
- if [string match "*\[\003\004\]" $command] {
+ if {[string match "*\[\003\004\]" $command]} {
error "Invalid trailing control code in \"$command\" command"
}
- if [string match "*\[\r\n\]*" $message] {
+ if {[string match "*\[\r\n\]*" $message]} {
error "Invalid newline in \"$message\" test"
}
@@ -1285,7 +1302,7 @@ proc gdb_test_multiple { command message args } {
while { "$string" != "" } {
set foo [string first "\n" "$string"]
set len [string length "$string"]
- if { $foo < [expr $len - 1] } {
+ if {$foo < $len - 1} {
set str [string range "$string" 0 $foo]
if { [send_gdb "$str"] != "" } {
verbose -log "Couldn't send $command to GDB."
@@ -1301,7 +1318,7 @@ proc gdb_test_multiple { command message args } {
-notransfer -re "$multi_line_re$" { verbose "partial: match" 3 }
timeout { verbose "partial: timeout" 3 }
}
- set string [string range "$string" [expr $foo + 1] end]
+ set string [string range "$string" [expr {$foo + 1}] end]
set multi_line_re "$multi_line_re.*\[\r\n\] *>"
} else {
break
@@ -1391,7 +1408,7 @@ proc gdb_test_multiple { command message args } {
fail "$errmsg"
set result -1
}
- -re "\r\n$prompt_regexp" {
+ -re "${lbl_anchor_re}\r\n$prompt_regexp" {
if {![string match "" $message]} {
fail "$message"
}
@@ -1586,8 +1603,8 @@ proc gdb_test { args } {
set message [command_to_message $command]
}
- set prompt [fill_in_default_prompt $prompt [expr !${no-prompt-anchor}]]
- set nl [expr ${nonl} ? {""} : {"\r\n"}]
+ set prompt [fill_in_default_prompt $prompt [expr {!${no-prompt-anchor}}]]
+ set nl [expr {${nonl} ? "" : "\r\n"}]
set saw_question 0
@@ -1663,76 +1680,9 @@ proc python_version_at_least { major minor } {
# Return 1 if tcl version used is at least MAJOR.MINOR.PATCHLEVEL.
proc tcl_version_at_least { major minor {patchlevel 0} } {
- global tcl_patchLevel
- regexp {^([0-9]+)\.([0-9]+)\.([0-9]+)$} \
- $tcl_patchLevel dummy \
- tcl_version_major tcl_version_minor tcl_version_patchlevel
- return \
- [version_compare \
- [list \
- $major \
- $minor \
- $patchlevel] \
- <= \
- [list \
- $tcl_version_major \
- $tcl_version_minor \
- $tcl_version_patchlevel]]
-}
-
-if { [tcl_version_at_least 8 5] == 0 } {
- # lrepeat was added in tcl 8.5. Only add if missing.
- proc lrepeat { n element } {
- if { [string is integer -strict $n] == 0 } {
- error "expected integer but got \"$n\""
- }
- if { $n < 0 } {
- error "bad count \"$n\": must be integer >= 0"
- }
- set res [list]
- for {set i 0} {$i < $n} {incr i} {
- lappend res $element
- }
- return $res
- }
-}
-
-if { [tcl_version_at_least 8 6] == 0 } {
- # lmap was added in tcl 8.6. Only add if missing.
-
- # Note that we only implement the simple variant for now.
- proc lmap { varname list body } {
- set res {}
- foreach val $list {
- uplevel 1 "set $varname $val"
- lappend res [uplevel 1 $body]
- }
-
- return $res
- }
-
- # ::tcl_platform(pathSeparator) was added in 8.6.
- switch $::tcl_platform(platform) {
- windows {
- set ::tcl_platform(pathSeparator) ;
- }
- default {
- set ::tcl_platform(pathSeparator) :
- }
- }
-}
-
-if { [tcl_version_at_least 8 6 2] == 0 } {
- # string cat was added in tcl 8.6.2. Only add if missing.
-
- rename string tcl_proc_string
-
- proc string { what args } {
- if { $what == "cat" } {
- return [join $args ""]
- }
- return [tcl_proc_string $what {*}$args]
- }
+ set current_version [package require Tcl]
+ set min_version "$major.$minor.$patchlevel"
+ return [expr {[package vcompare $current_version $min_version] >= 0}]
}
# gdb_test_no_output [-prompt PROMPT_REGEXP] [-nopass] COMMAND [MESSAGE]
@@ -1758,7 +1708,7 @@ proc gdb_test_no_output { args } {
set args [lassign $args command message]
check_no_args_left
- set prompt [fill_in_default_prompt $prompt [expr !${no-prompt-anchor}]]
+ set prompt [fill_in_default_prompt $prompt [expr {!${no-prompt-anchor}}]]
set command_regex [string_to_regexp $command]
return [gdb_test_multiple $command $message -prompt $prompt {
@@ -2010,7 +1960,7 @@ proc gdb_test_exact { args } {
# string pattern.
set pattern [lindex $args 1]
- if [string match $pattern ""] {
+ if {[string match $pattern ""]} {
set pattern [string_to_regexp [lindex $args 0]]
} else {
set pattern [string_to_regexp [lindex $args 1]]
@@ -2194,7 +2144,7 @@ proc gdb_test_debug_expr { cmd output {testname "" }} {
proc gdb_print_expr_at_depths {exp outputs} {
for { set depth 0 } { $depth <= [llength $outputs] } { incr depth } {
if { $depth == [llength $outputs] } {
- set expected_result [lindex $outputs [expr [llength $outputs] - 1]]
+ set expected_result [lindex $outputs [expr {[llength $outputs] - 1}]]
set depth_string "unlimited"
} else {
set expected_result [lindex $outputs $depth]
@@ -2237,10 +2187,213 @@ proc gdb_assert { condition {message ""} } {
return $res
}
+# Comparison command for "lsort -command". Sorts two strings by
+# descending file name length.
+
+proc compare_length_desc {a b} {
+ expr {[string length $b] - [string length $a]}
+}
+
+# Fill in and return the global cache for Windows <=> Unix mount point
+# mappings, for Windows.
+#
+# Calling external processes on MSYS2/Cygwin is expensive so instead
+# of calling "cygpath -ua $FILENAME" or "cygpath -ma $FILENAME" for
+# every file name, we extract the Windows and Unix file names of each
+# mount point using the 'mount' command output, and cache the
+# mappings, for both directions.
+
+gdb_caching_proc get_mount_point_map {} {
+ array set win_to_unix {}
+ array set unix_to_win {}
+
+ # The 'mount' command provides all mappings. The general format
+ # is: 'WindowsFileName on UnixFileName type ...'
+ #
+ # For example:
+ # 'C:/msys64 on / type ntfs (binary,auto)'
+ # 'C: on /c type ntfs (binary,posix=0,user,noumount,auto)'
+ set mount_output [exec mount]
+
+ foreach line [split $mount_output \n] {
+ if {[regexp {^(.+) on (.+) type } $line -> win_filename unix_filename]} {
+ set win_to_unix($win_filename) $unix_filename
+ set unix_to_win($unix_filename) $win_filename
+ }
+ }
+
+ # Sort each mapping's keys by descending file name length,
+ # otherwise we wouldn't be able to look for '/foo' in '/' (for
+ # example).
+
+ set sorted_win {}
+ foreach k [lsort -command compare_length_desc [array names win_to_unix]] {
+ lappend sorted_win $k $win_to_unix($k)
+ }
+
+ set sorted_unix {}
+ foreach k [lsort -command compare_length_desc [array names unix_to_win]] {
+ lappend sorted_unix $k $unix_to_win($k)
+ }
+
+ # Return both sorted lists: {win => unix} {unix => win}
+ return [list $sorted_win $sorted_unix]
+}
+
+# Normalize backward slashes to forward slashes.
+
+proc normalize_slashes {filename} {
+ return [string map {\\ /} $filename]
+}
+
+# Sanitize a host file name, without making it absolute or resolving
+# symlinks. On native Windows, this normalizes slashes to forward
+# slashes, and makes sure that if the file name starts with a drive
+# letter, it is upper case. On other systems, it just returns the
+# file name unmodified.
+
+proc host_file_sanitize {filename} {
+ if {[ishost *-*-mingw*]} {
+ set filename [normalize_slashes $filename]
+
+ # If the file name starts with a drive letter, uppercase it.
+ if {[regexp {^([a-zA-Z]):(/.*)?} $filename -> drive rest]} {
+ set filename "[string toupper $drive]:$rest"
+ }
+ }
+
+ return $filename
+}
+
+# Normalize a file name for the build machine. If running native
+# Windows GDB, this converts a Windows file name to the corresponding
+# Unix filename, per the mount table. For example, this replaces
+# 'c:/foo' with '/c/foo' (on MSYS2) or '/cygdrive/c/foo' (on Cygwin).
+# On other systems, it just wraps "file normalize".
+
+proc build_file_normalize {filename} {
+ if {[ishost *-*-mingw*]} {
+ set filename [host_file_sanitize $filename]
+
+ # Handle Windows => Unix mount point conversion. We assume
+ # there are no symlinks to resolve, which is a reasonable
+ # assumption for native Windows testing.
+
+ # Get Windows => Unix map.
+ lassign [get_mount_point_map] win_to_unix _
+
+ foreach {win_filename unix_filename} $win_to_unix {
+ if {[string equal -length [string length $win_filename] \
+ $win_filename $filename]} {
+ set rest [string range $filename \
+ [string length $win_filename] end]
+ return "${unix_filename}$rest"
+ }
+ }
+ }
+
+ return [file normalize $filename]
+}
+
+# Normalize a file name for the host machine and native Windows GDB.
+# This converts a Unix file name to a Windows filename,
+# per the mount table. E.g., '/c/foo' (on MSYS2) or '/cygdrive/c/foo'
+# (on Cygwin) is converted to 'c:/foo'.
+
+proc host_file_normalize_mingw {filename unix_to_win} {
+ set filename [host_file_sanitize $filename]
+
+ # If the file name already starts with a drive letter (e.g.,
+ # C:/foo), we're done. Don't let it fallthrough to "file
+ # normalize", which would misinterpret it as a relative file
+ # name.
+ if {[regexp {^[A-Z]:/} $filename]} {
+ return $filename
+ }
+
+ # Collapse all repeated forward slashes.
+ set filename [regsub -all {//+} $filename {/}]
+
+ # Strip trailing slash, except for root.
+ if {$filename ne "/" && [string match */ $filename]} {
+ set filename [string range $filename 0 end-1]
+ }
+
+ foreach {unix_filename win_filename} $unix_to_win {
+ set mount_len [string length $unix_filename]
+ if {[string equal -length $mount_len $unix_filename $filename]} {
+ if {$unix_filename eq "/"} {
+ if {$filename eq "/"} {
+ return "$win_filename"
+ } else {
+ return "$win_filename$filename"
+ }
+ } elseif {[string length $filename] == $mount_len} {
+ # Like "cygpath -ma" if the file name resolves to a
+ # drive letter, append a slash, to make it unambiguous
+ # that we resolved to the root of the drive and not
+ # the drive's current directory.
+ if {[string match {[A-Za-z]:} $win_filename]} {
+ return "$win_filename/"
+ } else {
+ return "$win_filename"
+ }
+ } elseif {[string index $filename $mount_len] eq "/"} {
+ set rest [string range $filename $mount_len end]
+ return "$win_filename$rest"
+ }
+ }
+ }
+
+ return [file normalize $filename]
+}
+
+# Normalize a file name for the host machine. If running native
+# Windows GDB, this converts a Unix file name to a Windows filename,
+# per the mount table. E.g., '/c/foo' (on MSYS2) or '/cygdrive/c/foo'
+# (on Cygwin) is converted to 'c:/foo'.
+
+proc host_file_normalize {filename} {
+ if {[ishost *-*-mingw*]} {
+ # Get Unix => Windows map.
+ lassign [get_mount_point_map] _ unix_to_win
+ return [host_file_normalize_mingw $filename $unix_to_win]
+ }
+
+ return [file normalize $filename]
+}
+
+# Wrapper around "file join" that handles host-specific details.
+#
+# For Cygwin/MSYS2's Tcl, file names that start with a drive letter
+# are not considered absolute file names, thus 'file join "c:/" "d:/"'
+# returns "c:/d:". This procedure thus detects absolute Windows-style
+# file names, and treats them as absolute, bypassing "file join".
+
+proc host_file_join {args} {
+ if {[isbuild *-*-mingw*]} {
+ set result ""
+ foreach filename $args {
+ set filename [host_file_sanitize $filename]
+
+ # If the file name starts with drive letter and colon
+ # (e.g., "C:/"), treat it as absolute.
+ if {[regexp {^[A-Z]:/} $filename]} {
+ set result $filename
+ } else {
+ set result [file join $result $filename]
+ }
+ }
+ return $result
+ } else {
+ return [file join {*}$args]
+ }
+}
+
proc gdb_reinitialize_dir { subdir } {
global gdb_prompt
- if [is_remote host] {
+ if {[is_remote host]} {
return ""
}
send_gdb "dir\n"
@@ -2251,7 +2404,8 @@ proc gdb_reinitialize_dir { subdir } {
}
gdb_expect 60 {
-re "Source directories searched.*$gdb_prompt $" {
- send_gdb "dir $subdir\n"
+ set dir [host_file_normalize $subdir]
+ send_gdb "dir $dir\n"
gdb_expect 60 {
-re "Source directories searched.*$gdb_prompt $" {
verbose "Dir set to $subdir"
@@ -2281,7 +2435,7 @@ proc default_gdb_exit {} {
global gdb_spawn_id inferior_spawn_id
global inotify_log_file
- if ![info exists gdb_spawn_id] {
+ if {![info exists gdb_spawn_id]} {
return
}
@@ -2301,7 +2455,8 @@ proc default_gdb_exit {} {
}
}
- if { [is_remote host] && [board_info host exists fileid] } {
+ if { ([is_remote host] && [board_info host exists fileid])
+ || [istarget *-*-mingw*] } {
send_gdb "quit\n"
gdb_expect 10 {
-re "y or n" {
@@ -2313,8 +2468,10 @@ proc default_gdb_exit {} {
}
}
- if ![is_remote host] {
- remote_close host
+ if {![is_remote host]} {
+ if {[catch { remote_close host } message]} {
+ warning "closing gdb failed with: $message"
+ }
}
unset gdb_spawn_id
unset ::gdb_tty_name
@@ -2364,7 +2521,7 @@ proc gdb_file_cmd { arg {kill_flag 1} } {
global gdb_file_cmd_debug_info gdb_file_cmd_msg
set gdb_file_cmd_debug_info "fail"
- if [is_remote host] {
+ if {[is_remote host]} {
set arg [remote_download host $arg]
if { $arg == "" } {
perror "download failed"
@@ -2503,11 +2660,11 @@ proc default_gdb_spawn { } {
verbose "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS"
gdb_write_cmd_file "$GDB $INTERNAL_GDBFLAGS $GDBFLAGS"
- if [info exists gdb_spawn_id] {
+ if {[info exists gdb_spawn_id]} {
return 0
}
- if ![is_remote host] {
+ if {![is_remote host]} {
if {[which $GDB] == 0} {
perror "$GDB does not exist."
exit 1
@@ -2533,7 +2690,7 @@ proc default_gdb_start { } {
global gdb_spawn_id
global inferior_spawn_id
- if [info exists gdb_spawn_id] {
+ if {[info exists gdb_spawn_id]} {
return 0
}
@@ -2577,6 +2734,17 @@ proc default_gdb_start { } {
# Output with -q, and bracketed paste mode enabled, see above.
verbose "GDB initialized."
}
+ -re "^\033\\\[6n$gdb_prompt $" {
+ # With MSYS2 and TERM={xterm,ansi}, I get:
+ #
+ # builtin_spawn gdb -q ...
+ # ^[[6n(gdb)
+ #
+ # We set TERM to dumb by default to avoid this, but some
+ # test-cases set TERM to xterm or ansi, in which case we get this
+ # output.
+ verbose "GDB initialized."
+ }
-re "$gdb_prompt $" {
perror "GDB never initialized."
unset gdb_spawn_id
@@ -2599,7 +2767,7 @@ proc default_gdb_start { } {
send_gdb "set height 0\n"
gdb_expect 10 {
- -re "$gdb_prompt $" {
+ -re "$gdb_prompt $" {
verbose "Setting height to 0." 2
}
timeout {
@@ -2823,11 +2991,6 @@ gdb_caching_proc allow_dap_tests {} {
return 0
}
- # ton.tcl uses "string is entier", supported starting tcl 8.6.
- if { ![tcl_version_at_least 8 6] } {
- return 0
- }
-
# With set auto-connect-native-target off, we run into:
# +++ run
# Traceback (most recent call last):
@@ -2959,6 +3122,10 @@ gdb_caching_proc allow_dlmopen_tests {} {
# Return 1 if we should allow TUI-related tests.
gdb_caching_proc allow_tui_tests {} {
+ if { [istarget *-*-mingw*] } {
+ # Avoid "Cannot enable the TUI when output is not a terminal".
+ return 0
+ }
set output [remote_exec host $::GDB "$::INTERNAL_GDBFLAGS --configuration"]
return [expr {[string first "--enable-tui" $output] != -1}]
}
@@ -3075,6 +3242,7 @@ proc foreach_with_prefix {var list body} {
# within 'with_test_prefix "$proc_name" { ... }'.
proc proc_with_prefix {name arguments body} {
# Define the advertised proc.
+ # tclint-disable-next-line command-args
proc $name $arguments [list with_test_prefix $name $body]
}
@@ -3137,8 +3305,8 @@ proc save_vars { vars body } {
# name may be a not-yet-interpolated string like env($foo)
set var [uplevel 1 list $var]
- if [uplevel 1 [list info exists $var]] {
- if [uplevel 1 [list array exists $var]] {
+ if {[uplevel 1 [list info exists $var]]} {
+ if {[uplevel 1 [list array exists $var]]} {
set saved_arrays($var) [uplevel 1 [list array get $var]]
} else {
set saved_scalars($var) [uplevel 1 [list set $var]]
@@ -3310,14 +3478,14 @@ proc with_gdb_cwd { dir body } {
}
verbose -log "Switching to directory $dir (saved CWD: $saved_dir)."
- if ![gdb_cd $dir] {
+ if {![gdb_cd $dir]} {
return
}
set code [catch {uplevel 1 $body} result]
verbose -log "Switching back to $saved_dir."
- if ![gdb_cd $saved_dir] {
+ if {![gdb_cd $saved_dir]} {
return
}
@@ -3495,7 +3663,7 @@ proc clear_gdb_spawn_id {} {
proc with_spawn_id { spawn_id body } {
global gdb_spawn_id
- if [info exists gdb_spawn_id] {
+ if {[info exists gdb_spawn_id]} {
set saved_spawn_id $gdb_spawn_id
}
@@ -3503,7 +3671,7 @@ proc with_spawn_id { spawn_id body } {
set code [catch {uplevel 1 $body} result]
- if [info exists saved_spawn_id] {
+ if {[info exists saved_spawn_id]} {
switch_gdb_spawn_id $saved_spawn_id
} else {
clear_gdb_spawn_id
@@ -3541,7 +3709,7 @@ proc get_largest_timeout {} {
upvar 2 timeout timeout
set tmt 0
- if [info exists timeout] {
+ if {[info exists timeout]} {
set tmt $timeout
}
if { [info exists gtimeout] && $gtimeout > $tmt } {
@@ -3567,7 +3735,7 @@ proc with_timeout_factor { factor body } {
set savedtimeout $timeout
- set timeout [expr [get_largest_timeout] * $factor]
+ set timeout [expr {[get_largest_timeout] * $factor}]
set code [catch {uplevel 1 $body} result]
set timeout $savedtimeout
@@ -3729,7 +3897,7 @@ proc can_single_step_to_signal_handler {} {
proc supports_process_record {} {
- if [target_info exists gdb,use_precord] {
+ if {[target_info exists gdb,use_precord]} {
return [target_info gdb,use_precord]
}
@@ -3738,7 +3906,8 @@ proc supports_process_record {} {
|| [istarget "aarch64*-*-linux*"]
|| [istarget "loongarch*-*-linux*"]
|| [istarget "powerpc*-*-linux*"]
- || [istarget "s390*-*-linux*"] } {
+ || [istarget "s390*-*-linux*"]
+ || [istarget "riscv*-*-*"] } {
return 1
}
@@ -3749,7 +3918,7 @@ proc supports_process_record {} {
proc supports_reverse {} {
- if [target_info exists gdb,can_reverse] {
+ if {[target_info exists gdb,can_reverse]} {
return [target_info gdb,can_reverse]
}
@@ -3758,7 +3927,8 @@ proc supports_reverse {} {
|| [istarget "aarch64*-*-linux*"]
|| [istarget "loongarch*-*-linux*"]
|| [istarget "powerpc*-*-linux*"]
- || [istarget "s390*-*-linux*"] } {
+ || [istarget "s390*-*-linux*"]
+ || [istarget "riscv*-*-*"] } {
return 1
}
@@ -3918,12 +4088,12 @@ proc is_x86_like_target {} {
if {![istarget "x86_64-*-*"] && ![istarget i?86-*]} {
return 0
}
- return [expr [is_ilp32_target] && ![is_amd64_regs_target]]
+ return [expr {[is_ilp32_target] && ![is_amd64_regs_target]}]
}
# Return 1 if this target is an x86_64 with -m64.
proc is_x86_64_m64_target {} {
- return [expr [istarget x86_64-*-* ] && [is_lp64_target]]
+ return [expr {[istarget x86_64-*-* ] && [is_lp64_target]}]
}
# Return 1 if this target is an arm or aarch32 on aarch64.
@@ -3956,7 +4126,7 @@ proc is_aarch64_target {} {
return 0
}
- return [expr ![is_aarch32_target]]
+ return [expr {![is_aarch32_target]}]
}
# Return 1 if displaced stepping is supported on target, otherwise, return 0.
@@ -4027,7 +4197,7 @@ gdb_caching_proc libc_has_debug_info {} {
}
}
-# Run a test on the target to see if it supports vmx hardware. Return 1 if so,
+# Run a test on the target to see if it supports vmx hardware. Return 1 if so,
# 0 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite.
gdb_caching_proc allow_altivec_tests {} {
@@ -4047,9 +4217,9 @@ gdb_caching_proc allow_altivec_tests {} {
}
# Make sure we have a compiler that understands altivec.
- if [test_compiler_info gcc*] {
+ if {[test_compiler_info gcc*]} {
set compile_flags "additional_flags=-maltivec"
- } elseif [test_compiler_info xlc*] {
+ } elseif {[test_compiler_info xlc*]} {
set compile_flags "additional_flags=-qaltivec"
} else {
verbose "Could not compile with altivec support, returning 0" 2
@@ -4080,11 +4250,11 @@ gdb_caching_proc allow_altivec_tests {} {
gdb_run_cmd
gdb_expect {
-re ".*Illegal instruction.*${gdb_prompt} $" {
- verbose -log "\n$me altivec hardware not detected"
+ verbose -log "\n$me altivec hardware not detected"
set allow_vmx_tests 0
}
-re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
- verbose -log "\n$me: altivec hardware detected"
+ verbose -log "\n$me: altivec hardware detected"
set allow_vmx_tests 1
}
default {
@@ -4162,9 +4332,9 @@ gdb_caching_proc allow_vsx_tests {} {
}
# Make sure we have a compiler that understands altivec.
- if [test_compiler_info gcc*] {
+ if {[test_compiler_info gcc*]} {
set compile_flags "additional_flags=-mvsx"
- } elseif [test_compiler_info xlc*] {
+ } elseif {[test_compiler_info xlc*]} {
set compile_flags "additional_flags=-qasm=gcc"
} else {
verbose "Could not compile with vsx support, returning 0" 2
@@ -4264,6 +4434,76 @@ gdb_caching_proc allow_tsx_tests {} {
return $allow_tsx_tests
}
+# Run a test on the target to check if it supports x86 shadow stack. Return 1
+# if shadow stack is enabled, 0 otherwise.
+
+gdb_caching_proc allow_ssp_tests {} {
+ global srcdir subdir gdb_prompt hex
+
+ set me "allow_ssp_tests"
+
+ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
+ verbose "$me: target known to not support shadow stack."
+ return 0
+ }
+
+ # There is no need to check the actual HW in addition to ptrace support.
+ # We need both checks and ptrace will tell us about the HW state.
+ set compile_flags "{additional_flags=-fcf-protection=return}"
+ set src { int main() { return 0; } }
+ if {![gdb_simple_compile $me $src executable $compile_flags]} {
+ return 0
+ }
+
+ save_vars { ::env(GLIBC_TUNABLES) } {
+
+ append_environment GLIBC_TUNABLES "glibc.cpu.hwcaps" "SHSTK"
+
+ # No error message, compilation succeeded so now run it via gdb.
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load $obj
+ if {![runto_main]} {
+ remote_file build delete $obj
+ return 0
+ }
+ set shadow_stack_disabled_re "(<unavailable>)"
+ if {[istarget *-*-linux*]} {
+ # Starting with v6.6, the Linux kernel supports CET shadow stack.
+ # Dependent on the target we can see a nullptr or "<unavailable>"
+ # when shadow stack is supported by HW and the Linux kernel but
+ # not enabled for the current thread (for example due to a lack
+ # of compiler or glibc support for -fcf-protection).
+ set shadow_stack_disabled_re "$shadow_stack_disabled_re|(.*0x0)"
+ }
+
+ set allow_ssp_tests 0
+ gdb_test_multiple "print \$pl3_ssp" "test shadow stack support" {
+ -re -wrap "(.*$hex)((?!(.*0x0)).)" {
+ verbose -log "$me: Shadow stack support detected."
+ set allow_ssp_tests 1
+ }
+ -re -wrap $shadow_stack_disabled_re {
+ # In case shadow stack is not enabled (for example due to a
+ # lack of compiler or glibc support for -fcf-protection).
+ verbose -log "$me: Shadow stack is not enabled."
+ }
+ -re -wrap "void" {
+ # In case we don't have hardware or kernel support.
+ verbose -log "$me: No shadow stack support."
+ }
+ }
+
+ gdb_exit
+ }
+
+ remote_file build delete $obj
+
+ verbose "$me: returning $allow_ssp_tests" 2
+ return $allow_ssp_tests
+}
+
# Run a test on the target to see if it supports avx512bf16. Return 1 if so,
# 0 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite.
@@ -4406,7 +4646,8 @@ gdb_caching_proc allow_lam_tests {} {
# No error message, compilation succeeded so now run it via gdb.
set allow_lam_tests 0
- clean_restart $obj
+ clean_restart
+ gdb_load $obj
gdb_run_cmd
gdb_expect {
-re ".*$inferior_exited_re with code.*${gdb_prompt} $" {
@@ -4454,7 +4695,7 @@ gdb_caching_proc allow_btrace_tests {} {
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $obj
- if ![runto_main] {
+ if {![runto_main]} {
return 0
}
# In case of an unexpected output, we return 2 as a fail value.
@@ -4505,7 +4746,7 @@ gdb_caching_proc allow_btrace_pt_tests {} {
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $obj
- if ![runto_main] {
+ if {![runto_main]} {
return 0
}
# In case of an unexpected output, we return 2 as a fail value.
@@ -4563,7 +4804,7 @@ gdb_caching_proc allow_btrace_ptw_tests {} {
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load "$obj"
- if ![runto_main] {
+ if {![runto_main]} {
return 1
}
@@ -4631,7 +4872,7 @@ gdb_caching_proc allow_btrace_pt_event_trace_tests {} {
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load "$obj"
- if ![runto_main] {
+ if {![runto_main]} {
return 0
}
@@ -4689,7 +4930,8 @@ gdb_caching_proc allow_aarch64_sve_tests {} {
}
# Compilation succeeded so now run it via gdb.
- clean_restart $obj
+ clean_restart
+ gdb_load $obj
gdb_run_cmd
gdb_expect {
-re ".*Illegal instruction.*${gdb_prompt} $" {
@@ -4749,7 +4991,8 @@ gdb_caching_proc aarch64_initialize_sve_information { } {
return [array get supported_vl]
}
- clean_restart $test_exec
+ clean_restart
+ gdb_load $test_exec
if {![runto_main]} {
return [array get supported_vl]
@@ -4846,7 +5089,8 @@ gdb_caching_proc allow_aarch64_sme_tests {} {
}
# Compilation succeeded so now run it via gdb.
- clean_restart $obj
+ clean_restart
+ gdb_load $obj
gdb_run_cmd
gdb_expect {
-re ".*Illegal instruction.*${gdb_prompt} $" {
@@ -4906,7 +5150,8 @@ gdb_caching_proc aarch64_initialize_sme_information { } {
return [array get supported_svl]
}
- clean_restart $test_exec
+ clean_restart
+ gdb_load $test_exec
if {![runto_main]} {
return [array get supported_svl]
@@ -5000,7 +5245,8 @@ gdb_caching_proc allow_aarch64_mops_tests {} {
}
# Compilation succeeded so now run it via gdb.
- clean_restart $obj
+ clean_restart
+ gdb_load $obj
gdb_run_cmd
gdb_expect {
-re ".*$inferior_exited_re with code 01.*${gdb_prompt} $" {
@@ -5023,6 +5269,61 @@ gdb_caching_proc allow_aarch64_mops_tests {} {
return $allow_mops_tests
}
+# Run a test on the target to see if it supports AArch64 GCS extensions.
+# Return 1 if so, 0 if it does not. Note this causes a restart of GDB.
+
+gdb_caching_proc allow_aarch64_gcs_tests {} {
+ global srcdir subdir gdb_prompt inferior_exited_re
+
+ set me "allow_aarch64_gcs_tests"
+
+ if { ![is_aarch64_target]} {
+ return 0
+ }
+
+ # Compile a program that tests the GCS feature.
+ set src {
+ #include <stdbool.h>
+ #include <sys/auxv.h>
+
+ /* Feature check for Guarded Control Stack. */
+ #ifndef HWCAP_GCS
+ #define HWCAP_GCS (1ULL << 32)
+ #endif
+
+ int main (void) {
+ bool gcs_supported = getauxval (AT_HWCAP) & HWCAP_GCS;
+
+ /* Return success if GCS is supported. */
+ return !gcs_supported;
+ }
+ }
+
+ if {![gdb_simple_compile $me $src executable]} {
+ return 0
+ }
+
+ # Compilation succeeded so now run it via gdb.
+ set allow_gcs_tests 0
+ clean_restart
+ gdb_load $obj
+ gdb_run_cmd
+ gdb_expect {
+ -re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
+ verbose -log "\n$me: gcs support detected"
+ set allow_gcs_tests 1
+ }
+ -re ".*$inferior_exited_re with code 01.*${gdb_prompt} $" {
+ verbose -log "\n$me: gcs support not detected"
+ }
+ }
+ gdb_exit
+ remote_file build delete $obj
+
+ verbose "$me: returning $allow_gcs_tests" 2
+ return $allow_gcs_tests
+}
+
# A helper that compiles a test case to see if __int128 is supported.
proc gdb_int128_helper {lang} {
return [gdb_can_simple_compile "i128-for-$lang" {
@@ -5043,12 +5344,12 @@ gdb_caching_proc has_int128_cxx {} {
# Return true if the IFUNC feature is supported.
gdb_caching_proc allow_ifunc_tests {} {
- if [gdb_can_simple_compile ifunc {
+ if {[gdb_can_simple_compile ifunc {
extern void f_ ();
typedef void F (void);
F* g (void) { return &f_; }
void f () __attribute__ ((ifunc ("g")));
- } object] {
+ } object]} {
return 1
} else {
return 0
@@ -5056,7 +5357,7 @@ gdb_caching_proc allow_ifunc_tests {} {
}
# Return whether we should skip tests for showing inlined functions in
-# backtraces. Requires get_compiler_info and get_debug_format.
+# backtraces. Requires get_debug_format.
proc skip_inline_frame_tests {} {
# GDB only recognizes inlining information in DWARF.
@@ -5075,7 +5376,7 @@ proc skip_inline_frame_tests {} {
}
# Return whether we should skip tests for showing variables from
-# inlined functions. Requires get_compiler_info and get_debug_format.
+# inlined functions. Requires get_debug_format.
proc skip_inline_var_tests {} {
# GDB only recognizes inlining information in DWARF.
@@ -5086,6 +5387,40 @@ proc skip_inline_var_tests {} {
return 0
}
+# Return whether we allow running fork-related testcases. Targets
+# that don't even have any concept of fork will just fail to compile
+# the testcases and skip the tests that way if this returns true for
+# them. Unix targets that do have a fork system call, but don't
+# support intercepting forks will want to return false here, otherwise
+# the testcases that exercise fork may hit a number of long cascading
+# time out sequences.
+
+proc allow_fork_tests {} {
+ if {[istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"]} {
+ return 0
+ }
+
+ return 1
+}
+
+# Return whether we allow running testcases that want to debug
+# multiple inferiors with the same target. Not all targets support
+# this. Note that some tests add a second inferior but never start
+# it. Those tests should not be skipped due to this proc returning
+# false.
+
+proc allow_multi_inferior_tests {} {
+ if {[istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"]} {
+ return 0
+ }
+
+ if {[use_gdb_stub]} {
+ return 0
+ }
+
+ return 1
+}
+
# Return a 1 if we should run tests that require hardware breakpoints
proc allow_hw_breakpoint_tests {} {
@@ -5096,9 +5431,9 @@ proc allow_hw_breakpoint_tests {} {
}
# These targets support hardware breakpoints natively
- if { [istarget "i?86-*-*"]
+ if { [istarget "i?86-*-*"]
|| [istarget "x86_64-*-*"]
- || [istarget "ia64-*-*"]
+ || [istarget "ia64-*-*"]
|| [istarget "arm*-*-*"]
|| [istarget "aarch64*-*-*"]
|| [istarget "s390*-*-*"] } {
@@ -5120,9 +5455,9 @@ proc allow_hw_watchpoint_tests {} {
# Note, not all Power 9 processors support hardware watchpoints due to a HW
# bug. Use has_hw_wp_support to check do a runtime check for hardware
# watchpoint support on Powerpc.
- if { [istarget "i?86-*-*"]
+ if { [istarget "i?86-*-*"]
|| [istarget "x86_64-*-*"]
- || [istarget "ia64-*-*"]
+ || [istarget "ia64-*-*"]
|| [istarget "arm*-*-*"]
|| [istarget "aarch64*-*-*"]
|| ([istarget "powerpc*-*-linux*"] && [has_hw_wp_support])
@@ -5210,7 +5545,7 @@ proc skip_libstdcxx_probe_tests_prompt { prompt_regexp } {
-re "\r\n$prompt_regexp" {
}
}
- set skip [expr !$supported]
+ set skip [expr {!$supported}]
return $skip
}
@@ -5281,7 +5616,7 @@ proc is_any_target {args} {
proc use_gdb_stub {} {
global use_gdb_stub
- if [info exists use_gdb_stub] {
+ if {[info exists use_gdb_stub]} {
return $use_gdb_stub
}
@@ -5313,14 +5648,6 @@ gdb_caching_proc target_is_gdbserver {} {
return $is_gdbserver
}
-# N.B. compiler_info is intended to be local to this file.
-# Call test_compiler_info with no arguments to fetch its value.
-# Yes, this is counterintuitive when there's get_compiler_info,
-# but that's the current API.
-if [info exists compiler_info] {
- unset compiler_info
-}
-
# Figure out what compiler I am using.
# The result is cached so only the first invocation runs the compiler.
#
@@ -5338,7 +5665,7 @@ if [info exists compiler_info] {
#
# [ catch "exec $compiler -E $ifile > $binfile.ci" exec_output ]
# source $binfile.ci
-#
+#
# This avoids the problem with -E and -o together. This almost works
# if the build machine is the same as the host machine, which is
# usually true of the targets which are not gcc. But this code does
@@ -5363,7 +5690,7 @@ if [info exists compiler_info] {
# Unfortunately, expect logs the output of the command as it goes by,
# and dejagnu helpfully prints a second copy of it right afterwards.
# So I turn off expect logging for a moment.
-#
+#
# [ gdb_compile $ifile $ciexe_file executable $args ]
# [ remote_exec $ciexe_file ]
# [ source $ci_file.out ]
@@ -5372,8 +5699,18 @@ if [info exists compiler_info] {
# I didn't get desperate enough to try this.
#
# -- chastain 2004-01-06
+#
+# Returns "unsupported" if LANGUAGE is not supported, and "unknown" if
+# LANGUAGE is supported but extracting the information out of the
+# compiler for LANGUAGE failed. Otherwise returns the compiler we're
+# using for LANGUAGE.
proc get_compiler_info {{language "c"}} {
+ # Split to a helper procedure because gdb_caching_proc does not
+ # support optional arguments.
+ return [get_compiler_info_1 $language]
+}
+gdb_caching_proc get_compiler_info_1 {language} {
# For compiler.c, compiler.cc and compiler.F90.
global srcdir
@@ -5382,13 +5719,8 @@ proc get_compiler_info {{language "c"}} {
global outdir
global tool
- # These come from compiler.c, compiler.cc or compiler.F90.
- gdb_persistent_global compiler_info_cache
-
- if [info exists compiler_info_cache($language)] {
- # Already computed.
- return 0
- }
+ # 'compiler_info' comes from evaluating the result of
+ # preprocessing compiler.c, compiler.cc or compiler.F90.
# Choose which file to preprocess.
if { $language == "c++" } {
@@ -5399,14 +5731,14 @@ proc get_compiler_info {{language "c"}} {
set ifile "${srcdir}/lib/compiler.c"
} else {
perror "Unable to fetch compiler version for language: $language"
- return -1
+ return "unsupported"
}
# Run $ifile through the right preprocessor.
# Toggle gdb.log to keep the compiler output out of the log.
set saved_log [log_file -info]
log_file
- if [is_remote host] {
+ if {[is_remote host]} {
# We have to use -E and -o together, despite the comments
# above, because of how DejaGnu handles remote host testing.
set ppout [standard_temp_file compiler.i]
@@ -5423,7 +5755,7 @@ proc get_compiler_info {{language "c"}} {
set ifile $tofile
set cppout [ gdb_compile "${ifile}" "" preprocess [list "$language" quiet getting_compiler_info] ]
}
- eval log_file $saved_log
+ log_file {*}$saved_log
# Eval the output.
set unknown 0
@@ -5435,6 +5767,7 @@ proc get_compiler_info {{language "c"}} {
} elseif { [ regexp "^\[\n\r\t \]*set\[\n\r\t \]" "$cppline" ] } {
# eval this line
verbose "get_compiler_info: $cppline" 2
+ # tclint-disable-next-line command-args
eval "$cppline"
} elseif { [ regexp {[fc]lang.*warning.*'-fdiagnostics-color=never'} "$cppline"] } {
# Both flang preprocessors (llvm flang and classic flang) print a
@@ -5451,7 +5784,7 @@ proc get_compiler_info {{language "c"}} {
}
# Set to unknown if for some reason compiler_info didn't get defined.
- if ![info exists compiler_info] {
+ if {![info exists compiler_info]} {
verbose -log "get_compiler_info: compiler_info not provided"
set compiler_info "unknown"
}
@@ -5461,26 +5794,25 @@ proc get_compiler_info {{language "c"}} {
set compiler_info "unknown"
}
- set compiler_info_cache($language) $compiler_info
-
# Log what happened.
verbose -log "get_compiler_info: $compiler_info"
- return 0
+ return $compiler_info
}
-# Return the compiler_info string if no arg is provided.
-# Otherwise the argument is a glob-style expression to match against
-# compiler_info.
+# Return the compiler_info string if COMPILER is not provided.
+# Otherwise COMPILER is a glob-style expression to match against
+# compiler_info, and this returns true/false depending on whether the
+# expression matches or not.
proc test_compiler_info { {compiler ""} {language "c"} } {
- gdb_persistent_global compiler_info_cache
+ set compiler_info [get_compiler_info $language]
- if [get_compiler_info $language] {
+ if {$compiler_info == "unsupported"} {
# An error will already have been printed in this case. Just
# return a suitable result depending on how the user called
# this function.
- if [string match "" $compiler] {
+ if {[string match "" $compiler]} {
return ""
} else {
return false
@@ -5488,11 +5820,11 @@ proc test_compiler_info { {compiler ""} {language "c"} } {
}
# If no arg, return the compiler_info string.
- if [string match "" $compiler] {
- return $compiler_info_cache($language)
+ if {[string match "" $compiler]} {
+ return $compiler_info
}
- return [string match $compiler $compiler_info_cache($language)]
+ return [string match $compiler $compiler_info]
}
# Return true if the C compiler is GCC, otherwise, return false.
@@ -5530,7 +5862,7 @@ proc gcc_major_version { {compiler "gcc-*"} {language "c"} } {
proc current_target_name { } {
global target_info
- if [info exists target_info(target,name)] {
+ if {[info exists target_info(target,name)]} {
set answer $target_info(target,name)
} else {
set answer ""
@@ -5556,7 +5888,7 @@ proc gdb_wrapper_init { args } {
set result [build_wrapper "testglue.o"]
if { $result != "" } {
set gdb_wrapper_file [lindex $result 0]
- if ![is_remote host] {
+ if {![is_remote host]} {
set gdb_wrapper_file [file join [pwd] $gdb_wrapper_file]
}
set gdb_wrapper_flags [lindex $result 1]
@@ -5665,6 +5997,10 @@ proc gdb_simple_compile {name code {type object} {compile_flags {}} {object obj}
set ext "d"
break
}
+ if { "$flag" eq "rust" } {
+ set ext "rs"
+ break
+ }
}
set src [standard_temp_file $name.$ext]
set obj [standard_temp_file $name.$postfix]
@@ -5971,7 +6307,7 @@ proc gdb_compile {source dest type options} {
foreach opt $options {
if {[regexp {^shlib=(.*)} $opt dummy_var shlib_name]
&& $type == "executable"} {
- if [test_compiler_info "xlc-*"] {
+ if {[test_compiler_info "xlc-*"]} {
# IBM xlc compiler doesn't accept shared library named other
# than .so: use "-Wl," to bypass this
lappend source "-Wl,$shlib_name"
@@ -6098,7 +6434,7 @@ proc gdb_compile {source dest type options} {
}
set options $new_options
- if [info exists GDB_TESTCASE_OPTIONS] {
+ if {[info exists GDB_TESTCASE_OPTIONS]} {
lappend options "additional_flags=$GDB_TESTCASE_OPTIONS"
}
verbose "options are $options"
@@ -6117,7 +6453,7 @@ proc gdb_compile {source dest type options} {
# to disable compiler warnings.
set nowarnings [lsearch -exact $options nowarnings]
if {$nowarnings != -1} {
- if [target_info exists gdb,nowarnings_flag] {
+ if {[target_info exists gdb,nowarnings_flag]} {
set flag "additional_flags=[target_info gdb,nowarnings_flag]"
} else {
set flag "additional_flags=-w"
@@ -6129,7 +6465,7 @@ proc gdb_compile {source dest type options} {
# to enable PIE executables.
set pie [lsearch -exact $options pie]
if {$pie != -1} {
- if [target_info exists gdb,pie_flag] {
+ if {[target_info exists gdb,pie_flag]} {
set flag "additional_flags=[target_info gdb,pie_flag]"
} else {
# For safety, use fPIE rather than fpie. On AArch64, m68k, PowerPC
@@ -6142,7 +6478,7 @@ proc gdb_compile {source dest type options} {
}
set options [lreplace $options $pie $pie $flag]
- if [target_info exists gdb,pie_ldflag] {
+ if {[target_info exists gdb,pie_ldflag]} {
set flag "ldflags=[target_info gdb,pie_ldflag]"
} else {
set flag "ldflags=-pie"
@@ -6154,14 +6490,14 @@ proc gdb_compile {source dest type options} {
# flags to disable PIE executables.
set nopie [lsearch -exact $options nopie]
if {$nopie != -1} {
- if [target_info exists gdb,nopie_flag] {
+ if {[target_info exists gdb,nopie_flag]} {
set flag "additional_flags=[target_info gdb,nopie_flag]"
} else {
set flag "additional_flags=-fno-pie"
}
set options [lreplace $options $nopie $nopie $flag]
- if [target_info exists gdb,nopie_ldflag] {
+ if {[target_info exists gdb,nopie_ldflag]} {
set flag "ldflags=[target_info gdb,nopie_ldflag]"
} else {
set flag "ldflags=-no-pie"
@@ -6243,7 +6579,10 @@ proc gdb_compile {source dest type options} {
}
}
- cond_wrap [expr $pie != -1 || $nopie != -1] \
+ # Automatically handle includes in testsuite/lib/.
+ auto_lappend_include_files options $source
+
+ cond_wrap [expr {$pie != -1 || $nopie != -1}] \
with_PIE_multilib_flags_filtered {
set result [target_compile $source $dest $type $options]
}
@@ -6264,7 +6603,7 @@ proc gdb_compile {source dest type options} {
regsub "\[\r\n\]*$" "$result" "" result
regsub "^\[\r\n\]*" "$result" "" result
-
+
if { $type == "executable" && $result == "" \
&& ($nopie != -1 || $pie != -1) } {
set is_pie [exec_is_pie "$dest"]
@@ -6380,7 +6719,7 @@ proc gdb_compile_shlib_1 {sources dest options} {
lappend objects $source
continue
}
-
+
set sourcebase [file tail $source]
if { $ada } {
@@ -6414,7 +6753,7 @@ proc gdb_compile_shlib_1 {sources dest options} {
set idx [lsearch $link_options "ada"]
set link_options [lreplace $link_options $idx $idx]
}
- if [test_compiler_info "xlc-*"] {
+ if {[test_compiler_info "xlc-*"]} {
lappend link_options "additional_flags=-qmkshrobj"
} else {
lappend link_options "additional_flags=-shared"
@@ -6595,6 +6934,7 @@ proc send_gdb { string {type standard}} {
proc send_inferior { string } {
global inferior_spawn_id
+ # tclint-disable-next-line command-args
if {[catch "send -i $inferior_spawn_id -- \$string" errorInfo]} {
return "$errorInfo"
} else {
@@ -6615,7 +6955,7 @@ proc gdb_expect { args } {
# A timeout argument takes precedence, otherwise of all the timeouts
# select the largest.
- if [info exists atimeout] {
+ if {[info exists atimeout]} {
set tmt $atimeout
} else {
set tmt [get_largest_timeout]
@@ -6653,7 +6993,7 @@ proc gdb_expect_list {test sentinel list} {
while { ${index} < [llength ${list}] } {
set pattern [lindex ${list} ${index}]
- set index [expr ${index} + 1]
+ incr index
verbose -log "gdb_expect_list pattern: /$pattern/" 2
if { ${index} == [llength ${list}] } {
if { ${ok} } {
@@ -6778,7 +7118,20 @@ gdb_caching_proc can_spawn_for_attach {} {
set me "can_spawn_for_attach"
set src {
- #include <unistd.h>
+ #ifdef _WIN32
+ # include <windows.h>
+ #else
+ # include <unistd.h>
+ #endif
+
+ #ifdef _WIN32
+ unsigned
+ sleep (unsigned seconds)
+ {
+ Sleep (seconds * 1000);
+ return 0;
+ }
+ #endif
int
main (void)
@@ -6848,7 +7201,7 @@ proc gdb_attach { testpid args } {
# Return 1 if GDB managed to start and attach to the process, 0 otherwise.
proc_with_prefix gdb_spawn_attach_cmdline { testpid } {
- if ![can_spawn_for_attach] {
+ if {![can_spawn_for_attach]} {
# The caller should have checked can_spawn_for_attach itself
# before getting here.
error "can't spawn for attach with this target/board"
@@ -6901,7 +7254,7 @@ proc kill_wait_spawned_process { proc_spawn_id } {
remote_exec build "kill -9 ${pid}"
verbose -log "closing ${proc_spawn_id}"
- catch "close -i $proc_spawn_id"
+ catch {close -i $proc_spawn_id}
verbose -log "waiting for ${proc_spawn_id}"
# If somehow GDB ends up still attached to the process here, a
@@ -6919,7 +7272,7 @@ proc kill_wait_spawned_process { proc_spawn_id } {
proc spawn_id_get_pid { spawn_id } {
set testpid [exp_pid -i $spawn_id]
- if { [istarget "*-*-cygwin*"] } {
+ if { [istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"] } {
# testpid is the Cygwin PID, GDB uses the Windows PID, which
# might be different due to the way fork/exec works.
set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
@@ -6953,7 +7306,7 @@ proc spawn_wait_for_attach_1 { executable_list } {
# this when [can_spawn_for_attach] is false.
proc spawn_wait_for_attach { executable_list } {
- if ![can_spawn_for_attach] {
+ if {![can_spawn_for_attach]} {
# The caller should have checked can_spawn_for_attach itself
# before getting here.
error "can't spawn for attach with this target/board"
@@ -6970,7 +7323,7 @@ proc spawn_wait_for_attach { executable_list } {
proc gdb_load_cmd { args } {
global gdb_prompt
- if [target_info exists gdb_load_timeout] {
+ if {[target_info exists gdb_load_timeout]} {
set loadtimeout [target_info gdb_load_timeout]
} else {
set loadtimeout 1600
@@ -7006,6 +7359,24 @@ proc gdb_load_cmd { args } {
return -1
}
+# Return non-zero if 'gcore' command is available.
+gdb_caching_proc gcore_cmd_available { } {
+ gdb_exit
+ gdb_start
+
+ # Does this gdb support gcore?
+ gdb_test_multiple "help gcore" "" {
+ -re -wrap "Undefined command: .*" {
+ return 0
+ }
+ -re -wrap "Save a core file .*" {
+ return 1
+ }
+ }
+
+ return 0
+}
+
# Invoke "gcore". CORE is the name of the core file to write. TEST
# is the name of the test case. This will return 1 if the core file
# was created, 0 otherwise. If this fails to make a core file because
@@ -7209,7 +7580,7 @@ proc gdb_download_shlib { file } {
proc gdb_locate_shlib { file } {
global gdb_spawn_id
- if ![info exists gdb_spawn_id] {
+ if {![info exists gdb_spawn_id]} {
perror "gdb_load_shlib: GDB is not running"
}
@@ -7371,13 +7742,13 @@ proc clean_standard_output_dir {} {
}
# Directory containing the standard output files.
- set standard_output_dir [file normalize [standard_output_file ""]]
+ set standard_output_dir [build_standard_output_file ""]
# Ensure that standard_output_dir is clean, or only contains
# gdb.log / gdb.sum.
set log_file_info [split [log_file -info]]
set log_file [file normalize [lindex $log_file_info end]]
- if { $log_file == [file normalize [standard_output_file gdb.log]] } {
+ if { $log_file == [file normalize [build_standard_output_file gdb.log]] } {
# Dir already contains active gdb.log. Don't remove the dir, but
# check that it's clean otherwise.
set res [glob -directory $standard_output_dir -tails *]
@@ -7409,7 +7780,7 @@ proc default_gdb_init { test_file_name } {
global cleanfiles_target
global cleanfiles_host
global pf_prefix
-
+
# Reset the timeout value to the default. This way, any testcase
# that changes the timeout value without resetting it cannot affect
# the timeout used in subsequent testcases.
@@ -7452,7 +7823,7 @@ proc default_gdb_init { test_file_name } {
global banned_variables
global banned_procedures
global banned_traced
- if (!$banned_traced) {
+ if {!$banned_traced} {
foreach banned_var $banned_variables {
global "$banned_var"
trace add variable "$banned_var" write error
@@ -7470,6 +7841,22 @@ proc default_gdb_init { test_file_name } {
setenv LC_CTYPE C
setenv LANG C
+ # With MSYS2 and TERM={xterm,ansi}, I get:
+ #
+ # builtin_spawn gdb -q ...
+ # ^[[6n(gdb)
+ #
+ # While we're addressing this in default_gdb_start, this is not specific
+ # to gdb, other tools produce the same CSI sequence, and consequently we
+ # run into trouble in other places (like get_compiler_info).
+ #
+ # Set TERM to dumb to prevent the '^[[6n' from occurring.
+ #
+ # We could do this only for ishost *-*-mingw*, but that introduces
+ # inconsistency between platforms, with test-cases passing on one platform
+ # but failing on the other. So, we do this for all platforms.
+ setenv TERM dumb
+
# Don't let a .inputrc file or an existing setting of INPUTRC mess
# up the test results. Certain tests (style tests and TUI tests)
# want to set the terminal to a non-"dumb" value, and for those we
@@ -7546,26 +7933,26 @@ proc default_gdb_init { test_file_name } {
if { $gdb_wrapper_target != [current_target_name] } {
set gdb_wrapper_initialized 0
}
-
+
# Unlike most tests, we have a small number of tests that generate
# a very large amount of output. We therefore increase the expect
# buffer size to be able to contain the entire test output. This
# is especially needed by gdb.base/info-macros.exp.
match_max -d 65536
- # Also set this value for the currently running GDB.
+ # Also set this value for the currently running GDB.
match_max [match_max -d]
# We want to add the name of the TCL testcase to the PASS/FAIL messages.
set pf_prefix "[file tail [file dirname $test_file_name]]/[file tail $test_file_name]:"
global gdb_prompt
- if [target_info exists gdb_prompt] {
+ if {[target_info exists gdb_prompt]} {
set gdb_prompt [target_info gdb_prompt]
} else {
set gdb_prompt "\\(gdb\\)"
}
global use_gdb_stub
- if [info exists use_gdb_stub] {
+ if {[info exists use_gdb_stub]} {
unset use_gdb_stub
}
@@ -7607,31 +7994,48 @@ proc default_gdb_init { test_file_name } {
proc make_gdb_parallel_path { args } {
global GDB_PARALLEL objdir
- set joiner [list "file" "join" $objdir]
+ set joiner [list $objdir]
if { [info exists GDB_PARALLEL] && $GDB_PARALLEL != "yes" } {
lappend joiner $GDB_PARALLEL
}
set joiner [concat $joiner $args]
- return [eval $joiner]
+ return [file join {*}$joiner]
}
# Turn BASENAME into a full file name in the standard output
-# directory. It is ok if BASENAME is the empty string; in this case
-# the directory is returned.
+# directory, as seen from the build machine. I.e., as seen from the
+# system driving DejaGnu. (E.g., if DejaGnu is being driven by MSYS2
+# to test native Windows GDB, the "build" file names should be file
+# names TCL understands, i.e., Unix file names.) It is OK if BASENAME
+# is the empty string; in this case the directory is returned.
-proc standard_output_file {basename} {
+proc build_standard_output_file {basename} {
global objdir subdir gdb_test_file_name
set dir [make_gdb_parallel_path outputs $subdir $gdb_test_file_name]
file mkdir $dir
- # If running on MinGW, replace /c/foo with c:/foo
- if { [ishost *-*-mingw*] } {
- set dir [exec sh -c "cd ${dir} && pwd -W"]
- }
return [file join $dir $basename]
}
-# Turn BASENAME into a file name on host.
+# Turn BASENAME into a full file name in the standard output
+# directory, as seen from a non-remote host. I.e., assuming the build
+# and the host share the filesystem. E.g., if DejaGnu is being driven
+# by MSYS2 to test native Windows GDB, the "host" file names should be
+# file names GDB understands, i.e., Windows file names. It is OK if
+# BASENAME is the empty string; in this case the directory is
+# returned.
+
+proc standard_output_file {basename} {
+ global objdir subdir gdb_test_file_name
+
+ set dir [make_gdb_parallel_path outputs $subdir $gdb_test_file_name]
+ file mkdir $dir
+ set dir [host_file_normalize $dir]
+ return [host_file_join $dir $basename]
+}
+
+# Like standard_output_file, but handles remote hosts. Turn BASENAME
+# into a file name on (potentially remote) host.
proc host_standard_output_file { basename } {
if { [is_remote host] } {
@@ -7805,7 +8209,7 @@ proc standard_testfile {args} {
# the same timeout as the default dejagnu timeout, unless the user has
# already provided a specific value (probably through a site.exp file).
global gdb_test_timeout
-if ![info exists gdb_test_timeout] {
+if {![info exists gdb_test_timeout]} {
set gdb_test_timeout $timeout
}
@@ -7864,9 +8268,12 @@ proc gdb_cleanup_globals {} {
# proc.
set temp [interp create]
if { [interp eval $temp "info procs ::unknown"] != "" } {
+ # tclint-disable-next-line command-args
set old_args [interp eval $temp "info args ::unknown"]
+ # tclint-disable-next-line command-args
set old_body [interp eval $temp "info body ::unknown"]
- eval proc gdb_tcl_unknown {$old_args} {$old_body}
+ # tclint-disable-next-line command-args
+ proc gdb_tcl_unknown $old_args $old_body
}
interp delete $temp
unset temp
@@ -7901,11 +8308,11 @@ proc gdb_finish { } {
gdb_exit
if { [llength $cleanfiles_target] > 0 } {
- eval remote_file target delete $cleanfiles_target
+ remote_file target delete {*}$cleanfiles_target
set cleanfiles_target {}
}
if { [llength $cleanfiles_host] > 0 } {
- eval remote_file host delete $cleanfiles_host
+ remote_file host delete {*}$cleanfiles_host
set cleanfiles_host {}
}
@@ -7914,7 +8321,7 @@ proc gdb_finish { } {
global banned_variables
global banned_procedures
global banned_traced
- if ($banned_traced) {
+ if {$banned_traced} {
foreach banned_var $banned_variables {
global "$banned_var"
trace remove variable "$banned_var" write error
@@ -7978,7 +8385,7 @@ proc get_debug_format { } {
proc test_debug_format {format} {
global debug_format
- return [expr [string match $format $debug_format] != 0]
+ return [expr {[string match $format $debug_format] != 0}]
}
# Like setup_xfail, but takes the name of a debug format (DWARF 1,
@@ -8000,7 +8407,7 @@ proc setup_xfail_format { format } {
#
# Search the source file FILE, and return the line number of the
# first line containing TEXT. If no match is found, an error is thrown.
-#
+#
# TEXT is a string literal, not a regular expression.
#
# The default value of FILE is "$srcdir/$subdir/$srcfile". If FILE is
@@ -8012,18 +8419,18 @@ proc setup_xfail_format { format } {
#
# Use this function to keep your test scripts independent of the
# exact line numbering of the source file. Don't write:
-#
+#
# send_gdb "break 20"
-#
-# This means that if anyone ever edits your test's source file,
+#
+# This means that if anyone ever edits your test's source file,
# your test could break. Instead, put a comment like this on the
# source file line you want to break at:
-#
+#
# /* breakpoint spot: frotz.exp: test name */
-#
+#
# and then write, in your test script (which we assume is named
# frotz.exp):
-#
+#
# send_gdb "break [gdb_get_line_number "frotz.exp: test name"]\n"
#
# (Yes, Tcl knows how to handle the nested quotes and brackets.
@@ -8031,7 +8438,7 @@ proc setup_xfail_format { format } {
# $ tclsh
# % puts "foo [lindex "bar baz" 1]"
# foo baz
-# %
+# %
# Tcl is quite clever, for a little stringy language.)
#
# ===
@@ -8148,7 +8555,7 @@ proc gdb_continue_to_end {{mssg ""} {command continue} {allow_extra 0}} {
if { [target_info exists exit_is_reliable] } {
set exit_is_reliable [target_info exit_is_reliable]
} else {
- set exit_is_reliable [expr ! $use_gdb_stub]
+ set exit_is_reliable [expr {! $use_gdb_stub}]
}
if { ! $exit_is_reliable } {
@@ -8170,7 +8577,7 @@ proc gdb_continue_to_end {{mssg ""} {command continue} {allow_extra 0}} {
proc rerun_to_main {} {
global gdb_prompt use_gdb_stub
- if $use_gdb_stub {
+ if {$use_gdb_stub} {
gdb_run_cmd
gdb_expect {
-re ".*Breakpoint .*main .*$gdb_prompt $"\
@@ -8268,7 +8675,7 @@ proc exec_is_pie { executable } {
# registers.
gdb_caching_proc allow_float_test {} {
- if [target_info exists gdb,skip_float_tests] {
+ if {[target_info exists gdb,skip_float_tests]} {
return 0
}
@@ -8366,7 +8773,7 @@ gdb_caching_proc allow_float_test {} {
# due to lack of stdio support.
proc gdb_skip_stdio_test { msg } {
- if [target_info exists gdb,noinferiorio] {
+ if {[target_info exists gdb,noinferiorio]} {
verbose "Skipping test '$msg': no inferior i/o."
return 1
}
@@ -8478,7 +8885,7 @@ gdb_caching_proc gdb_has_argv0 {} {
-re "${gdb_prompt} $" {
}
}
-
+
gdb_test_no_output "set print elements $old_elements" ""
gdb_test_no_output "set print repeats $old_repeats" ""
@@ -8545,7 +8952,7 @@ proc get_build_id { filename } {
} else {
set tmp [standard_output_file "${filename}-tmp"]
set objcopy_program [gdb_find_objcopy]
- set result [catch "exec $objcopy_program -j .note.gnu.build-id -O binary $filename $tmp" output]
+ set result [catch {exec $objcopy_program -j .note.gnu.build-id -O binary $filename $tmp} output]
verbose "result is $result"
verbose "output is $output"
if {$result == 1} {
@@ -8614,7 +9021,7 @@ proc gdb_gnu_strip_debug { dest args } {
# Get rid of the debug info, and store result in stripped_file
# something like gdb/testsuite/gdb.base/blah.stripped.
- set result [catch "exec $strip_to_file_program --strip-debug ${dest} -o ${stripped_file}" output]
+ set result [catch {exec $strip_to_file_program --strip-debug ${dest} -o ${stripped_file}} output]
verbose "result is $result"
verbose "output is $output"
if {$result == 1} {
@@ -8628,7 +9035,7 @@ proc gdb_gnu_strip_debug { dest args } {
# Get rid of everything but the debug info, and store result in debug_file
# This will be in the .debug subdirectory, see above.
- set result [catch "exec $strip_to_file_program --only-keep-debug ${dest} -o ${debug_file}" output]
+ set result [catch {exec $strip_to_file_program --only-keep-debug ${dest} -o ${debug_file}} output]
verbose "result is $result"
verbose "output is $output"
if {$result == 1} {
@@ -8641,7 +9048,7 @@ proc gdb_gnu_strip_debug { dest args } {
# objcopy or strip to remove the symbol table without also removing the
# debugging sections, so this is as close as we can get.
if {[lsearch -exact $args "no-main"] != -1} {
- set result [catch "exec $objcopy_program -N main ${debug_file} ${debug_file}-tmp" output]
+ set result [catch {exec $objcopy_program -N main ${debug_file} ${debug_file}-tmp} output]
verbose "result is $result"
verbose "output is $output"
if {$result == 1} {
@@ -8656,7 +9063,7 @@ proc gdb_gnu_strip_debug { dest args } {
# section to the stripped_file, containing a pointer to the
# debug_file.
if {[lsearch -exact $args "no-debuglink"] == -1} {
- set result [catch "exec $objcopy_program --add-gnu-debuglink=${debug_file} ${stripped_file} ${stripped_file}-tmp" output]
+ set result [catch {exec $objcopy_program --add-gnu-debuglink=${debug_file} ${stripped_file} ${stripped_file}-tmp} output]
verbose "result is $result"
verbose "output is $output"
if {$result == 1} {
@@ -8744,12 +9151,12 @@ proc test_user_defined_class_help { {list_of_commands {}} {testname {}} } {
# element is abbreviation of.
# The command must be a prefix command. EXPECTED_INITIAL_LINES
# are regular expressions that should match the beginning of output,
-# before the list of subcommands. The presence of
+# before the list of subcommands. The presence of
# subcommand list and standard epilogue will be tested automatically.
proc test_prefix_command_help { command_list expected_initial_lines args } {
global help_list_trailer
- set command [lindex $command_list 0]
- if {[llength $command_list]>1} {
+ set command [lindex $command_list 0]
+ if {[llength $command_list]>1} {
set full_command [lindex $command_list 1]
} else {
set full_command $command
@@ -8793,7 +9200,7 @@ proc build_executable_from_specs {testname executable options args} {
# gdb_compile_shlib and gdb_compile_shlib_pthreads do not use the 3rd
# parameter. They also requires $sources while gdb_compile and
# gdb_compile_pthreads require $objects. Moreover they ignore any options.
- if [string match gdb_compile_shlib* $func] {
+ if {[string match gdb_compile_shlib* $func]} {
set sources_path {}
foreach {s local_options} $args {
if {[regexp "^/" "$s"]} {
@@ -8851,7 +9258,7 @@ proc build_executable { testname executable {sources ""} {options {debug}} } {
lappend arglist $source $options
}
- return [eval build_executable_from_specs $arglist]
+ return [build_executable_from_specs {*}$arglist]
}
# Starts fresh GDB binary and loads an optional executable into GDB.
@@ -8885,6 +9292,10 @@ proc clean_restart {{executable ""}} {
gdb_reinitialize_dir $srcdir/$subdir
if {$executable != ""} {
+ if { [file pathtype $executable] == "absolute" } {
+ error "absolute path used"
+ }
+
set binfile [standard_output_file ${executable}]
return [gdb_load ${binfile}]
}
@@ -8902,7 +9313,7 @@ proc clean_restart {{executable ""}} {
# Returns 0 on success, non-zero on failure.
proc prepare_for_testing_full {testname args} {
foreach spec $args {
- if {[eval build_executable_from_specs [list $testname] $spec] == -1} {
+ if {[build_executable_from_specs $testname {*}$spec] == -1} {
return -1
}
set executable [lindex $spec 0]
@@ -9135,8 +9546,9 @@ gdb_caching_proc target_endianness {} {
return 0
}
- clean_restart $obj
- if ![runto_main] {
+ clean_restart
+ gdb_load $obj
+ if {![runto_main]} {
return 0
}
set res [get_endianness]
@@ -9158,12 +9570,12 @@ proc relative_filename {root full} {
set len [llength $root_split]
- if {[eval file join $root_split]
- != [eval file join [lrange $full_split 0 [expr {$len - 1}]]]} {
+ if {[file join {*}$root_split]
+ != [file join {*}[lrange $full_split 0 [expr {$len - 1}]]]} {
error "$full not a subdir of $root"
}
- return [eval file join [lrange $full_split $len end]]
+ return [file join {*}[lrange $full_split $len end]]
}
# If GDB_PARALLEL exists, then set up the parallel-mode directories.
@@ -9261,7 +9673,13 @@ proc remove_core {pid {test ""}} {
}
}
-proc core_find {binfile {deletefiles {}} {arg ""}} {
+# Runs ${binfile} expecting it to crash and generate a core file.
+# If DELETEFILES is provided, remove these files after running the program.
+# If ARG is provided, pass it as a command line argument to the program.
+# If OUTPUT_FILE is provided, save the program output to it.
+# Returns the name of the core dump, or empty string if not found.
+
+proc core_find {binfile {deletefiles {}} {arg ""} {output_file "/dev/null"}} {
global objdir subdir
set destcore "$binfile.core"
@@ -9283,10 +9701,16 @@ proc core_find {binfile {deletefiles {}} {arg ""}} {
set found 0
set coredir [standard_output_file coredir.[getpid]]
file mkdir $coredir
- catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile} ${arg}; true) >/dev/null 2>&1\""
+ # tclint-disable command-args
+ catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile} ${arg}; true) >${output_file} 2>&1\""
# remote_exec host "${binfile}"
- foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" {
- if [remote_file build exists $i] {
+ set binfile_basename [file tail $binfile]
+ foreach i [list \
+ ${coredir}/core \
+ ${coredir}/core.coremaker.c \
+ ${coredir}/${binfile_basename}.core \
+ ${coredir}/${binfile_basename}.exe.core] {
+ if {[remote_file build exists $i]} {
remote_exec build "mv $i $destcore"
set found 1
}
@@ -9308,21 +9732,22 @@ proc core_find {binfile {deletefiles {}} {arg ""}} {
# ulimit here if we didn't find a core file above.
# Oh, I should mention that any "braindamaged" non-Unix system has
# the same problem. I like the cd bit too, it's really neat'n stuff.
+ # tclint-disable command-args
catch "system \"(cd ${objdir}/${subdir}; ${binfile}; true) >/dev/null 2>&1\""
foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" {
- if [remote_file build exists $i] {
+ if {[remote_file build exists $i]} {
remote_exec build "mv $i $destcore"
set found 1
}
}
}
- # Try to clean up after ourselves.
+ # Try to clean up after ourselves.
foreach deletefile $deletefiles {
remote_file build delete [file join $coredir $deletefile]
}
remote_exec build "rmdir $coredir"
-
+
if { $found == 0 } {
warning "can't generate a core file - core tests suppressed - check ulimit -c"
return ""
@@ -9344,7 +9769,7 @@ gdb_caching_proc gdb_target_symbol_prefix {} {
set prefix ""
set objdump_program [gdb_find_objdump]
- set result [catch "exec $objdump_program --syms $obj" output]
+ set result [catch {exec $objdump_program --syms $obj} output]
if { $result == 0 \
&& ![regexp -lineanchor \
@@ -9369,8 +9794,9 @@ gdb_caching_proc target_supports_scheduler_locking {} {
return 0
}
- clean_restart $obj
- if ![runto_main] {
+ clean_restart
+ gdb_load $obj
+ if {![runto_main]} {
return 0
}
@@ -9447,7 +9873,7 @@ proc gdb_target_symbol { symbol } {
# surrounding the prefix. It is used to define the macro
# SYMBOL_PREFIX for assembly language files. Another version, below,
# is used for symbols in inline assembler in C/C++ files.
-#
+#
# The lack of quotes in this version (_asm) makes it possible to
# define supporting macros in the .S file. (The version which
# uses quotes for the prefix won't work for such files since it's
@@ -9495,7 +9921,7 @@ proc run_on_host { test program args } {
if {[llength $args] > 1 && [lindex $args 1] == ""} {
set args [lreplace $args 1 1 "/dev/null"]
}
- set result [eval remote_exec host [list $program] $args]
+ set result [remote_exec host $program {*}$args]
verbose "result is $result"
set status [lindex $result 0]
set output [lindex $result 1]
@@ -9583,11 +10009,11 @@ proc parse_list { level listname argset prefix eval } {
set result [lsearch -exact $args $pattern]
if {$result != -1} {
- set value [lindex $args [expr $result+1]]
+ set value [lindex $args [expr {$result+1}]]
if { $eval } {
- set value [uplevel [expr $level + 1] [list subst $value]]
+ set value [uplevel [expr {$level + 1}] [list subst $value]]
}
- set args [lreplace $args $result [expr $result+1]]
+ set args [lreplace $args $result [expr {$result+1}]]
} else {
set value [lindex $argument 1]
if { $eval } {
@@ -9763,6 +10189,7 @@ proc gdb_define_cmd {command command_list} {
# relative path name, and, we sometimes need to close/reopen the log
# after changing the current directory. See get_compiler_info.
+# tclint-disable redefined-builtin
rename cd builtin_cd
proc cd { dir } {
@@ -9774,7 +10201,7 @@ proc cd { dir } {
set log_file_flags ""
set log_file_file ""
foreach arg [ split "$log_file_info" " "] {
- if [string match "-*" $arg] {
+ if {[string match "-*" $arg]} {
lappend log_file_flags $arg
} else {
lappend log_file_file $arg
@@ -9827,9 +10254,9 @@ proc gdb_debug_enabled { } {
# If not already read, get the debug setting from environment or board setting.
if {![info exists gdbdebug]} {
global env
- if [info exists env(GDB_DEBUG)] {
+ if {[info exists env(GDB_DEBUG)]} {
set gdbdebug $env(GDB_DEBUG)
- } elseif [target_info exists gdb,debug] {
+ } elseif {[target_info exists gdb,debug]} {
set gdbdebug [target_info gdb,debug]
} else {
return 0
@@ -9846,7 +10273,7 @@ proc gdb_debug_init { } {
global gdb_prompt
- if ![gdb_debug_enabled] {
+ if {![gdb_debug_enabled]} {
return;
}
@@ -9884,12 +10311,16 @@ proc gdb_stdin_log_init { } {
gdb_persistent_global in_file
if {[info exists in_file]} {
- # Close existing file.
- catch "close $in_file"
+ # Close existing file.
+ catch {close $in_file}
}
set logfile [standard_output_file_with_gdb_instance gdb.in]
set in_file [open $logfile w]
+
+ verbose -log ""
+ verbose -log "Starting logfile: $logfile"
+ verbose -log ""
}
# Write to the file for logging gdb input.
@@ -9927,7 +10358,7 @@ proc gdb_write_cmd_file { cmdline } {
set logfile [standard_output_file_with_gdb_instance gdb.cmd]
set cmd_file [open $logfile w]
puts $cmd_file $cmdline
- catch "close $cmd_file"
+ catch {close $cmd_file}
}
# Compare contents of FILE to string STR. Pass with MSG if equal, otherwise
@@ -10103,7 +10534,7 @@ proc add_gdb_index { program {style ""} } {
global srcdir GDB env
set contrib_dir "$srcdir/../contrib"
set env(GDB) [append_gdb_data_directory_option $GDB]
- set result [catch "exec $contrib_dir/gdb-add-index.sh $style $program" output]
+ set result [catch {exec $contrib_dir/gdb-add-index.sh {*}$style $program} output]
if { $result != 0 } {
verbose -log "result is $result"
verbose -log "output is $output"
@@ -10247,7 +10678,7 @@ proc hex_in_list { val hexlist } {
set re 0x0*$val
set index [lsearch -regexp $hexlist $re]
- return [expr $index != -1]
+ return [expr {$index != -1}]
}
# As info args, but also add the default values.
@@ -10295,14 +10726,16 @@ proc with_override { name override body } {
# Install the override.
set new_args [info_args_with_defaults $override]
set new_body [info body $override]
- eval proc $name {$new_args} {$new_body}
+ # tclint-disable-next-line command-args
+ proc $name $new_args $new_body
# Execute body.
set code [catch {uplevel 1 $body} result]
# Restore old proc if it existed on entry, else delete it.
if { $existed } {
- eval proc $name {$old_args} {$old_body}
+ # tclint-disable-next-line command-args
+ proc $name $old_args $old_body
} else {
rename $name ""
}
@@ -10323,7 +10756,11 @@ proc with_override { name override body } {
proc with_ansi_styling_terminal { body } {
save_vars { ::env(TERM) ::env(NO_COLOR) ::env(COLORTERM) } {
# Set environment variables to allow styling.
- setenv TERM ansi
+ if { [ishost *-*-*bsd*] } {
+ setenv TERM ansiw
+ } else {
+ setenv TERM ansi
+ }
unset -nocomplain ::env(NO_COLOR)
unset -nocomplain ::env(COLORTERM)
@@ -10625,7 +11062,7 @@ gdb_caching_proc has_hw_wp_support {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load "$obj"
- if ![runto_main] {
+ if {![runto_main]} {
gdb_exit
remote_file build delete $obj
@@ -10712,7 +11149,7 @@ gdb_caching_proc arm_cc_for_target {} {
# produced binary actually runs on the system before declaring
# we've found the right compiler.
- if [istarget "*-linux*-*"] {
+ if {[istarget "*-linux*-*"]} {
set compilers {
arm-linux-gnueabi-gcc
arm-none-linux-gnueabi-gcc
@@ -10856,7 +11293,8 @@ gdb_caching_proc have_epilogue_line_info {} {
return False
}
- clean_restart $obj
+ clean_restart
+ gdb_load $obj
gdb_test_multiple "info line 6" "epilogue test" {
-re -wrap ".*starts at address.*and ends at.*" {
@@ -10999,6 +11437,66 @@ proc lappend_include_file { flags file } {
}
}
+# Helper for auto_lappend_include_files that handles one source file,
+# and tracks the list of already-visited files.
+
+proc auto_lappend_include_files_1 {flags source {visited {}}} {
+ upvar $flags up_flags
+ upvar $visited up_visited
+ global srcdir
+
+ set ext [string tolower [file extension $source]]
+ if {$ext ni {".c" ".cpp" ".cc" ".h" ".s"}} {
+ return
+ }
+
+ if {[catch {open $source r} fh err]} {
+ error "Failed to open file '$source': $err"
+ }
+ set contents [read $fh]
+ close $fh
+
+ lappend up_visited $source
+
+ # Match lines like:
+ # #include "gdb_foo.h"
+ set re "^\\s*#include\\s+\"(.*)\""
+
+ foreach line [split $contents "\n"] {
+ if {[regexp $re $line -> basename]} {
+ set lib_file "$srcdir/lib/$basename"
+
+ # If already processed, skip.
+ if {[lsearch -exact $up_visited $lib_file] != -1} {
+ continue
+ }
+
+ if {![file exists $lib_file]} {
+ continue
+ }
+
+ # Append to include list, and recurse into the included
+ # file.
+ lappend_include_file up_flags $lib_file
+ auto_lappend_include_files_1 up_flags $lib_file up_visited
+ }
+ }
+}
+
+# Automatically handle includes under gdb/testsuite/lib/.
+#
+# For each source file in SOURCES, look for #include directives
+# including files that live in testsuite/lib/. For each such included
+# file, call lappend_include_file for it.
+
+proc auto_lappend_include_files {flags sources} {
+ upvar $flags up_flags
+ set visited {}
+ foreach src $sources {
+ auto_lappend_include_files_1 up_flags $src visited
+ }
+}
+
# Return a list of supported host locales.
gdb_caching_proc host_locales { } {
@@ -11034,7 +11532,7 @@ proc have_host_locale { locale } {
set locale [string map { "-" "" } $locale]
set idx [lsearch [host_locales] $locale]
- return [expr $idx != -1]
+ return [expr {$idx != -1}]
}
# Return 1 if we can use '#include <$file>' in source file.
@@ -11062,7 +11560,7 @@ gdb_caching_proc root_user {} {
regexp -all ".*uid=(\[0-9\]+).*" $output dummy uid
- return [expr $uid == 0]
+ return [expr {$uid == 0}]
}
# Return nul-terminated string read from section SECTION of EXEC. Return ""
@@ -11076,7 +11574,7 @@ proc section_get {exec section} {
set command "exec $objcopy_program -O binary --set-section-flags $section=A --change-section-address $section=0 -j $section $exec $tmp"
verbose -log "command is $command"
- set result [catch $command output]
+ set result [catch {{*}$command} output]
verbose -log "result is $result"
verbose -log "output is $output"
if {$result == 1} {
@@ -11093,11 +11591,68 @@ proc section_get {exec section} {
verbose -log "section $section not found"
return ""
}
- set retval [string range $data 0 [expr $len - 1]]
+ set retval [string range $data 0 [expr {$len - 1}]]
verbose -log "section $section is <$retval>"
return $retval
}
+# Return true if we expect the build-id from FILENAME to be included
+# in a core file.
+#
+# On GNU/Linux, when creating a core file, the kernel places the first
+# page of an ELF into the core file. If the build-id is within that
+# page then GDB can find the build-id from the core file.
+#
+# This proc checks that the target is GNU/Linux, and then uses readelf
+# to find the offset of the build-id within the ELF. If there is a
+# build-id, and it is within the first page, then return true.
+# Otherwise, return false.
+
+proc expect_build_id_in_core_file { filename } {
+ # I'm not sure if other kernels take care to add the first page of
+ # each ELF into the core file. If they do then this test can be
+ # relaxed.
+ if {![istarget *-*-linux*]} {
+ return false
+ }
+
+ # Use readelf to find the build-id note in FILENAME.
+ set readelf_program [gdb_find_readelf]
+ set cmd [list $readelf_program -WS $filename | grep ".note.gnu.build-id"]
+ set res [catch {exec {*}$cmd} output]
+ verbose -log "running: $cmd"
+ verbose -log "result: $res"
+ verbose -log "output: $output"
+ if { $res != 0 } {
+ return false
+ }
+
+ # Extract the OFFSET from the readelf output.
+ set res [regexp {NOTE[ \t]+([0-9a-f]+)[ \t]+([0-9a-f]+)} \
+ $output dummy addr offset]
+ if { $res != 1 } {
+ return false
+ }
+
+ # Convert OFFSET to decimal.
+ set offset [expr {[subst 0x$offset]}]
+
+ # Now figure out the page size. This should be fine for Linux
+ # hosts, see the istarget check above.
+ if {[catch {exec getconf PAGESIZE} page_size]} {
+ # Failed to fetch page size.
+ return false
+ }
+
+ # If the build-id is within the first page, then we expect the
+ # kernel to include it in the core file. There is actually a
+ # kernel setting (see coredump_filter) that could prevent this,
+ # but the default behaviour is to include the first page of the
+ # ELF, so for now, we just assume this is on.
+ verbose -log "Page size is $page_size, Offset is $offset"
+ return [expr {$offset < $page_size}]
+}
+
# Return 1 if the compiler supports __builtin_trap, else return 0.
gdb_caching_proc have_builtin_trap {} {
@@ -11110,5 +11665,46 @@ gdb_caching_proc have_builtin_trap {} {
} executable]
}
+# Return 1 if there is a startup shell. Return -1 if there's no startup shell.
+# Return -1 otherwise.
+
+gdb_caching_proc have_startup_shell {} {
+ if { [is_remote target] } {
+ # For remote debugging targets, there is no guarantee that a "shell"
+ # is used.
+ return -1
+ }
+
+
+ gdb_exit
+ gdb_start
+
+ set re_on \
+ [string_to_regexp "Use of shell to start subprocesses is on."]
+ set re_off \
+ [string_to_regexp "Use of shell to start subprocesses is off."]
+ set re_cmd_unsupported \
+ [string_to_regexp \
+ {Undefined show command: "startup-with-shell". Try "help show".}]
+
+ set supported -1
+ gdb_test_multiple "show startup-with-shell" "" {
+ -re -wrap $re_on {
+ set supported 1
+ }
+ -re -wrap $re_off {
+ set supported 0
+ }
+ -re -wrap $re_cmd_unsupported {
+ }
+ -re -wrap "" {
+ }
+ }
+
+ gdb_exit
+
+ return $supported
+}
+
# Always load compatibility stuff.
load_lib future.exp
diff --git a/gdb/testsuite/lib/gdb_watchdog.h b/gdb/testsuite/lib/gdb_watchdog.h
new file mode 100644
index 0000000..15d63e7
--- /dev/null
+++ b/gdb/testsuite/lib/gdb_watchdog.h
@@ -0,0 +1,75 @@
+/* This file is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Set a watchdog that aborts the testcase after a timeout. */
+
+#ifndef GDB_WATCHDOG_H
+#define GDB_WATCHDOG_H
+
+/* Forward declaration to make sure the definitions have the right
+ prototype, at least in C. */
+static void gdb_watchdog (unsigned int seconds);
+
+static const char _gdb_watchdog_msg[]
+ = "gdb_watchdog: timeout expired - aborting test\n";
+
+#ifdef _WIN32
+#include <windows.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+static VOID CALLBACK
+_gdb_watchdog_timer_routine (PVOID lpParam, BOOLEAN TimerOrWaitFired)
+{
+ fputs (_gdb_watchdog_msg, stderr);
+ abort ();
+}
+
+static void
+gdb_watchdog (unsigned int seconds)
+{
+ HANDLE timer;
+
+ if (!CreateTimerQueueTimer (&timer, NULL,
+ _gdb_watchdog_timer_routine, NULL,
+ seconds * 1000, 0, 0))
+ abort ();
+}
+
+#else /* POSIX systems */
+
+#include <unistd.h>
+#include <signal.h>
+#include <stdlib.h>
+
+static void
+_gdb_sigalrm_handler (int signo)
+{
+ write (2, _gdb_watchdog_msg, sizeof (_gdb_watchdog_msg) - 1);
+ abort ();
+}
+
+static void
+gdb_watchdog (unsigned int seconds)
+{
+ signal (SIGALRM, _gdb_sigalrm_handler);
+ alarm (seconds);
+}
+
+#endif
+
+#endif /* GDB_WATCHDOG_H */
diff --git a/gdb/testsuite/lib/gdbreplay-support.exp b/gdb/testsuite/lib/gdbreplay-support.exp
index fc4dc52..2a43ede 100644
--- a/gdb/testsuite/lib/gdbreplay-support.exp
+++ b/gdb/testsuite/lib/gdbreplay-support.exp
@@ -45,7 +45,7 @@ proc gdbreplay_write_cmd_file { cmdline } {
set logfile [standard_output_file_with_gdb_instance gdbreplay.cmd]
set cmd_file [open $logfile w]
puts $cmd_file $cmdline
- catch "close $cmd_file"
+ catch {close $cmd_file}
}
# Start gdbreplay using REMOTELOG as the log file. Return a list of
@@ -57,7 +57,7 @@ proc gdbreplay_start { remotelog } {
set portnum [get_portnum]
# Extract the protocol
- if [target_info exists gdb_protocol] {
+ if {[target_info exists gdb_protocol]} {
set protocol [target_info gdb_protocol]
} else {
set protocol "remote"
@@ -115,29 +115,62 @@ proc gdbreplay_start { remotelog } {
#
# update_log $logname "${logname}.updated" "vMustReplyEmpty" "E.failed"
-proc update_log { filename_in filename_out match_regexp newline } {
+proc update_log { filename_in filename_out match_regexp newline truncate } {
set fh_in [open $filename_in r]
set fh_out [open $filename_out w]
while { [gets $fh_in line] >= 0 } {
# Print the line to the file.
puts $fh_out $line
- if { [regexp $match_regexp $line] } {
- # print out NEWLINE.
+
+ # If this line matches, then inject NEWLINE.
+ if { $match_regexp ne "" && [regexp $match_regexp $line] } {
+ # Print out NEWLINE.
puts $fh_out "r +\$${newline}"
- # Don't truncate the file, otherwise gdbreplay will
- # close the connection early and this might impact
- # what GDB does. We want GDB to get a chance to
- # process the error.
- puts $fh_out "c q"
- puts $fh_out "w \$qTStatus#49"
- puts $fh_out "End of log"
+ # Discard the line this just replaced.
+ gets $fh_in line
- break
+ if { $truncate } {
+ # Don't truncate the file, otherwise gdbreplay will
+ # close the connection early and this might impact
+ # what GDB does. We want GDB to get a chance to
+ # process the error.
+ puts $fh_out "c q"
+ puts $fh_out "w \$qTStatus#49"
+ puts $fh_out "End of log"
+
+ break
+ }
+
+ # Clear MATCH_REGEXP so no further lines will match.
+ set match_regexp ""
}
}
close $fh_out
close $fh_in
}
+
+# Return the line immediately after the first line in FILENAME that
+# matches MATCH_REGEXP. If MATCH_REGEXP matches a packet sent from
+# GDB to gdbserver, then the line returned should be the reply packet.
+#
+# If anything goes wrong, e.g. MATCH_REGEXP doesn't match anything,
+# then an empty string is returned.
+
+proc get_reply_line { filename match_regexp } {
+ set fh_in [open $filename r]
+ set reply ""
+
+ while { [gets $fh_in line] >= 0 } {
+ if { [regexp $match_regexp $line] } {
+ gets $fh_in reply
+ break
+ }
+ }
+
+ close $fh_in
+
+ return $reply
+}
diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
index 346c9b9..0652b35 100644
--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -1,4 +1,4 @@
-# Copyright 2000-2024 Free Software Foundation, Inc.
+# Copyright 2000-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@
#
# set_board_info sockethost
# The name of the host computer whose socket is being used.
-# Defaults to "localhost". Note: old gdbserver requires
+# Defaults to "localhost". Note: old gdbserver requires
# that you define this, but libremote/gdbserver does not.
#
# set_board_info gdb,socketport
@@ -69,7 +69,7 @@ proc gdb_target_cmd_ext { targetname serialport {additional_text ""} } {
}
-re "Non-stop mode requested, but remote does not support non-stop.*$gdb_prompt $" {
verbose "remote does not support non-stop"
- return 1
+ return 2
}
-re "Remote MIPS debugging.*$additional_text.*$gdb_prompt" {
verbose "Set target to $targetname"
@@ -125,8 +125,8 @@ proc gdb_target_cmd_ext { targetname serialport {additional_text ""} } {
# Like gdb_target_cmd_ext, but returns 0 on success, 1 on failure.
proc gdb_target_cmd { args } {
- set res [eval gdb_target_cmd_ext $args]
- return [expr $res == 0 ? 0 : 1]
+ set res [gdb_target_cmd_ext {*}$args]
+ return [expr {$res == 0 ? 0 : 1}]
}
# Return a usable port number.
@@ -174,7 +174,7 @@ proc get_portnum {} {
set portnum $initial_portnum
}
- set next_portnum [expr $portnum + 1]
+ set next_portnum [expr {$portnum + 1}]
set fd [open $portnum_file w]
puts $fd $next_portnum
@@ -190,11 +190,11 @@ proc find_gdbserver { } {
global GDB
global GDBSERVER
- if [info exists GDBSERVER] {
+ if {[info exists GDBSERVER]} {
return ${GDBSERVER}
}
- if [target_info exists gdb_server_prog] {
+ if {[target_info exists gdb_server_prog]} {
return [target_info gdb_server_prog]
}
@@ -315,7 +315,7 @@ proc gdbserver_start { options arguments } {
# have the possible connection prefix stripped. This is
# because gdbserver currently doesn't recognize the prefixes.
regsub -all "^\(tcp:|udp:|tcp4:|udp4:|tcp6:|udp6:\)" $debughost_tmp "" debughost_gdbserver
- } elseif [target_info exists sockethost] {
+ } elseif {[target_info exists sockethost]} {
set debughost [target_info sockethost]
set debughost_gdbserver $debughost
} else {
@@ -326,19 +326,19 @@ proc gdbserver_start { options arguments } {
# Some boards use a different value for the port that is passed to
# gdbserver and the port that is passed to the "target remote" command.
# One example is the stdio gdbserver support.
- if [target_info exists gdb,get_remote_address] {
+ if {[target_info exists gdb,get_remote_address]} {
set get_remote_address [target_info gdb,get_remote_address]
} else {
set get_remote_address gdbserver_default_get_remote_address
}
- if [target_info exists gdbserver,get_comm_port] {
+ if {[target_info exists gdbserver,get_comm_port]} {
set get_comm_port [target_info gdbserver,get_comm_port]
} else {
set get_comm_port gdbserver_default_get_comm_port
}
# Extract the protocol
- if [target_info exists gdb_protocol] {
+ if {[target_info exists gdb_protocol]} {
set protocol [target_info gdb_protocol]
} else {
set protocol "remote"
@@ -362,7 +362,7 @@ proc gdbserver_start { options arguments } {
}
# Enable debug if set.
- if [gdbserver_debug_enabled] {
+ if {[gdbserver_debug_enabled]} {
global gdbserverdebug
set enabled 0
foreach entry [split $gdbserverdebug ,] {
@@ -490,13 +490,13 @@ proc close_gdbserver {} {
verbose "Quitting GDBserver"
- catch "close -i $server_spawn_id"
+ catch {close -i $server_spawn_id}
# If gdbserver misbehaves, and ignores the close, waiting for it
# without the -nowait flag will cause testing to hang. Passing
# -nowait makes expect tell Tcl to wait for the process in the
# background.
- catch "wait -nowait -i $server_spawn_id"
+ catch {wait -nowait -i $server_spawn_id}
clean_up_spawn_id target $server_spawn_id
unset server_spawn_id
}
@@ -710,11 +710,11 @@ proc gdbserver_debug_enabled { } {
global gdbserverdebug
# If not already read, get the debug setting from environment or board setting.
- if ![info exists gdbserverdebug] {
+ if {![info exists gdbserverdebug]} {
global env
- if [info exists env(GDBSERVER_DEBUG)] {
+ if {[info exists env(GDBSERVER_DEBUG)]} {
set gdbserverdebug $env(GDBSERVER_DEBUG)
- } elseif [target_info exists gdbserver,debug] {
+ } elseif {[target_info exists gdbserver,debug]} {
set gdbserverdebug [target_info gdbserver,debug]
} else {
return 0
@@ -731,7 +731,7 @@ proc gdbserver_write_cmd_file { cmdline } {
set logfile [standard_output_file_with_gdb_instance gdbserver.cmd]
set cmd_file [open $logfile w]
puts $cmd_file $cmdline
- catch "close $cmd_file"
+ catch {close $cmd_file}
}
# Override gdb_debug_init so that we can set replay logging in GDB if required.
@@ -743,7 +743,7 @@ proc gdb_debug_init { } {
global gdbserverdebug
global gdb_prompt
- if [gdbserver_debug_enabled] {
+ if {[gdbserver_debug_enabled]} {
foreach entry [split $gdbserverdebug ,] {
if { $entry == "replay" || $entry == "all"} {
set replayfile [standard_output_file_with_gdb_instance gdbserver.replay]
diff --git a/gdb/testsuite/lib/gen-perf-test.exp b/gdb/testsuite/lib/gen-perf-test.exp
index a4debf8..feee2db 100644
--- a/gdb/testsuite/lib/gen-perf-test.exp
+++ b/gdb/testsuite/lib/gen-perf-test.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -51,12 +51,12 @@
# not clear that's simpler than our chosen mechanism which is to record
# sums of all the inputs, and detect if an input has changed that way.
-if ![info exists CAT_PROGRAM] {
+if {![info exists CAT_PROGRAM]} {
set CAT_PROGRAM "/bin/cat"
}
# TODO(dje): Time md5sum vs sha1sum with our testcases.
-if ![info exists SHA1SUM_PROGRAM] {
+if {![info exists SHA1SUM_PROGRAM]} {
set SHA1SUM_PROGRAM "/usr/bin/sha1sum"
}
@@ -295,7 +295,7 @@ namespace eval GenPerfTest {
}
set values $self($p)
for { set i 0 } { $i < $n - 1 } { incr i } {
- if { [lindex $values $i] > [lindex $values [expr $i + 1]] } {
+ if { [lindex $values $i] > [lindex $values [expr {$i + 1}]] } {
error "Values of parameter $p are not increasing"
}
}
@@ -322,7 +322,7 @@ namespace eval GenPerfTest {
nr_methods - nr_static_methods -
nr_inline_methods - nr_static_inline_methods
{
- if ![string is integer $value] {
+ if {![string is integer $value]} {
error "Non-integer value $value for key $key in class_specs: $class_specs"
}
}
@@ -397,7 +397,7 @@ namespace eval GenPerfTest {
proc _classes_enabled_p { self_var run_nr } {
upvar 1 $self_var self
set class_specs [_get_param $self(class_specs) $run_nr]
- return [expr [llength $class_specs] > 0]
+ return [expr {[llength $class_specs] > 0}]
}
# Spaces in file names are a pain, remove them.
@@ -428,7 +428,7 @@ namespace eval GenPerfTest {
# description file.
set bindir [file dirname $self(binfile)]
# Put the pieces in a subdirectory, there are a lot of them.
- if $static {
+ if {$static} {
return "$bindir/pieces"
} else {
set run_name [_convert_spaces [lindex $self(run_names) $run_nr]]
@@ -691,7 +691,7 @@ namespace eval GenPerfTest {
# C is the iteration number, from the "count" field from the class spec.
proc _make_class_name { so_nr cu_nr name c } {
- set class_name [lindex $name [expr [llength $name] - 1]]
+ set class_name [lindex $name [expr {[llength $name] - 1}]]
if { "$so_nr" != "" } {
set prefix "shlib${so_nr}_"
} else {
@@ -717,7 +717,7 @@ namespace eval GenPerfTest {
set nr_static_members [_get_class_spec $spec nr_static_members]
set nr_methods [_get_class_spec $spec nr_methods]
set nr_static_methods [_get_class_spec $spec nr_static_methods]
- set depth [expr [llength $name] - 1]
+ set depth [expr {[llength $name] - 1}]
for { set c 0 } { $c < $count } { incr c } {
puts $f ""
for { set i 0 } { $i < $depth } { incr i } {
@@ -750,7 +750,7 @@ namespace eval GenPerfTest {
_write_inline_methods self $f $so_nr $cu_nr $spec $c
_write_static_inline_methods self $f $so_nr $cu_nr $spec $c
puts $f "\};"
- for { set i [expr $depth - 1] } { $i >= 0 } { incr i -1 } {
+ for { set i [expr {$depth - 1}] } { $i >= 0 } { incr i -1 } {
puts $f ""
puts $f "\} // [lindex $name $i]"
}
@@ -782,7 +782,7 @@ namespace eval GenPerfTest {
foreach spec $class_specs {
set count [_get_class_spec $spec count]
set name [_get_class_spec $spec name]
- set depth [expr [llength $name] - 1]
+ set depth [expr {[llength $name] - 1}]
for { set c 0 } { $c < $count } { incr c } {
for { set i 0 } { $i < $depth } { incr i } {
puts $f ""
@@ -792,7 +792,7 @@ namespace eval GenPerfTest {
_write_static_members self $f $so_nr $cu_nr $spec $c
_write_methods self $f $so_nr $cu_nr $spec $c
_write_static_methods self $f $so_nr $cu_nr $spec $c
- for { set i [expr $depth - 1] } { $i >= 0 } { incr i -1 } {
+ for { set i [expr {$depth - 1}] } { $i >= 0 } { incr i -1 } {
puts $f ""
puts $f "\} // [lindex $name $i]"
}
@@ -854,7 +854,7 @@ namespace eval GenPerfTest {
puts $f ""
puts $f "#ifndef $header_macro"
puts $f "#define $header_macro"
- if [_classes_enabled_p self $run_nr] {
+ if {[_classes_enabled_p self $run_nr]} {
_write_class_definitions self $f $static $run_nr $so_nr $cu_nr
}
puts $f ""
@@ -875,7 +875,7 @@ namespace eval GenPerfTest {
_write_extern_globals self $f $run_nr "" $cu_nr
_write_static_functions self $f $run_nr
_write_extern_functions self $f $run_nr "" $cu_nr
- if [_classes_enabled_p self $run_nr] {
+ if {[_classes_enabled_p self $run_nr]} {
_write_class_implementations self $f $static $run_nr "" $cu_nr
}
close $f
@@ -917,7 +917,7 @@ namespace eval GenPerfTest {
_write_extern_globals self $f $run_nr "shlib${so_nr}_" $cu_nr
_write_static_functions self $f $run_nr
_write_extern_functions self $f $run_nr "shlib${so_nr}_" $cu_nr
- if [_classes_enabled_p self $run_nr] {
+ if {[_classes_enabled_p self $run_nr]} {
_write_class_implementations self $f $static $run_nr $so_nr $cu_nr
}
close $f
@@ -998,8 +998,8 @@ namespace eval GenPerfTest {
set vars { CC_FOR_TARGET CXX_FOR_TARGET CFLAGS_FOR_TARGET }
foreach v $vars {
global $v
- if [info exists $v] {
- eval set value $$v
+ if {[info exists $v]} {
+ set value [subst $$v]
puts $f "$v: $value"
}
}
@@ -1049,7 +1049,7 @@ namespace eval GenPerfTest {
}
}
verbose -log "_gen_sha1sum_for_inputs: summing $source_files $header_paths $inputs"
- set catch_result [catch "exec $CAT_PROGRAM $source_files $header_paths $inputs | $SHA1SUM_PROGRAM" output]
+ set catch_result [catch {exec $CAT_PROGRAM $source_files $header_paths $inputs | $SHA1SUM_PROGRAM} output]
return [list $catch_result $output]
}
@@ -1100,10 +1100,10 @@ namespace eval GenPerfTest {
return "sha1sum generation error: [lindex $sha1sum 1]"
}
set sha1sum [lindex $sha1sum 1]
- if ![file exists $dest] {
+ if {![file exists $dest]} {
file delete $sha1sum_file
}
- if [file exists $sha1sum_file] {
+ if {[file exists $sha1sum_file]} {
set last_sha1sum [_read_file $sha1sum_file]
verbose -log "last: $last_sha1sum, new: $sha1sum"
if { $sha1sum == $last_sha1sum } {
@@ -1234,10 +1234,10 @@ namespace eval GenPerfTest {
set static [_static_object_files_p self]
verbose -log "_compile_pieces: static flag: $static"
file mkdir "[file dirname $self(binfile)]/pieces"
- if $static {
+ if {$static} {
# All the generated pieces look the same (run over run) so just
# build all the shlibs of the last run (which is the largest).
- set last_run [expr $nr_runs - 1]
+ set last_run [expr {$nr_runs - 1}]
set nr_gen_shlibs [_get_param $self(nr_gen_shlibs) $last_run]
set object_dir [_make_object_dir_name self $static ignored]
file mkdir $object_dir
@@ -1412,7 +1412,7 @@ namespace eval GenPerfTest {
proc standard_compile_driver { exp_file_name make_config_thunk_name } {
global GDB_PERFTEST_MODE GDB_PERFTEST_SUBMODE
- if ![info exists GDB_PERFTEST_SUBMODE] {
+ if {![info exists GDB_PERFTEST_SUBMODE]} {
# Probably a plain "make check-perf", nothing to do.
# Give the user a reason why we're not running this test.
verbose -log "Test must be compiled/run in separate steps."
@@ -1504,6 +1504,6 @@ namespace eval GenPerfTest {
}
}
-if ![info exists PERF_TEST_COMPILE_PARALLELISM] {
+if {![info exists PERF_TEST_COMPILE_PARALLELISM]} {
set PERF_TEST_COMPILE_PARALLELISM $GenPerfTest::DEFAULT_PERF_TEST_COMPILE_PARALLELISM
}
diff --git a/gdb/testsuite/lib/go.exp b/gdb/testsuite/lib/go.exp
index 4525d77..dcf7ffa 100644
--- a/gdb/testsuite/lib/go.exp
+++ b/gdb/testsuite/lib/go.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,11 +20,12 @@
# The result is 1 (true) for success, 0 (false) for failure.
proc set_lang_go {} {
- if [gdb_test_no_output "set language go"] {
+ if {[gdb_test_no_output "set language go"]} {
return 0
}
- if [gdb_test "show language" ".* source language is \"go\"." \
- "set language to \"go\""] {
+ if {[gdb_test "show language" \
+ [string_to_regexp {The current source language is "go".}] \
+ {set language to "go"}]} {
return 0
}
return 1
diff --git a/gdb/testsuite/lib/jit-elf-helpers.exp b/gdb/testsuite/lib/jit-elf-helpers.exp
index 4d9c055..1f0a0d2 100644
--- a/gdb/testsuite/lib/jit-elf-helpers.exp
+++ b/gdb/testsuite/lib/jit-elf-helpers.exp
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Free Software Foundation, Inc.
+# Copyright 2020-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -91,7 +91,7 @@ proc compile_and_download_n_jit_so {jit_solib_basename jit_solib_srcfile \
# do symbol renaming by munging on ELF symbol table, and that
# wouldn't work for .debug sections. Also, output for "info
# function" changes when debug info is present.
- set addr [format 0x%x [expr $jit_load_address + $jit_load_increment * [expr $i-1]]]
+ set addr [format 0x%x [expr {$jit_load_address + $jit_load_increment * ($i - 1)}]]
# Use "text_segment=..." to ask the linker to relocate everything in the
# compiled shared library against a fixed base address. Combined
diff --git a/gdb/testsuite/lib/memory.exp b/gdb/testsuite/lib/memory.exp
index 6675641..b8aadb6 100644
--- a/gdb/testsuite/lib/memory.exp
+++ b/gdb/testsuite/lib/memory.exp
@@ -1,4 +1,4 @@
-# Copyright 2012-2024 Free Software Foundation, Inc.
+# Copyright 2012-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 206971c..eac9c47 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Free Software Foundation, Inc.
+# Copyright 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -65,7 +65,7 @@ proc mi_uncatched_gdb_exit {} {
sid_exit
}
- if ![info exists gdb_spawn_id] {
+ if {![info exists gdb_spawn_id]} {
return
}
@@ -99,7 +99,7 @@ proc mi_uncatched_gdb_exit {} {
close -i $mi_spawn_id
}
- if ![is_remote host] {
+ if {![is_remote host]} {
remote_close host
}
unset gdb_spawn_id
@@ -256,7 +256,7 @@ proc default_mi_gdb_start { { flags {} } } {
sid_start
}
- if [info exists gdb_spawn_id] {
+ if {[info exists gdb_spawn_id]} {
return 0
}
@@ -340,12 +340,12 @@ proc default_mi_gdb_start { { flags {} } } {
# baseboard file.
#
proc mi_gdb_start { args } {
- return [eval default_mi_gdb_start $args]
+ return [default_mi_gdb_start {*}$args]
}
# Many of the tests depend on setting breakpoints at various places and
# running until that breakpoint is reached. At times, we want to start
-# with a clean-slate with respect to breakpoints, so this utility proc
+# with a clean-slate with respect to breakpoints, so this utility proc
# lets us do this without duplicating this code everywhere.
#
@@ -386,7 +386,7 @@ proc mi_gdb_reinitialize_dir { subdir } {
global mi_gdb_prompt
global MIFLAGS
- if [is_remote host] {
+ if {[is_remote host]} {
return ""
}
@@ -487,7 +487,7 @@ proc mi_gdb_file_cmd { arg } {
set last_loaded_file $arg
- if [is_remote host] {
+ if {[is_remote host]} {
set arg [remote_download host $arg]
if { $arg == "" } {
error "download failed"
@@ -553,7 +553,7 @@ proc mi_gdb_target_load { } {
global GDB
global mi_gdb_prompt
- if [target_info exists gdb_load_timeout] {
+ if {[target_info exists gdb_load_timeout]} {
set loadtimeout [target_info gdb_load_timeout]
} else {
set loadtimeout 1600
@@ -700,11 +700,11 @@ proc mi_gdb_test { args } {
set message $command
}
- if [llength $args]==4 {
+ if {[llength $args] == 4} {
set ipattern [lindex $args 3]
}
- if [llength $args]==5 {
+ if {[llength $args] == 5} {
set question_string [lindex $args 3]
set response_string [lindex $args 4]
} else {
@@ -729,7 +729,7 @@ proc mi_gdb_test { args } {
while { "$string" != "" } {
set foo [string first "\n" "$string"]
set len [string length "$string"]
- if { $foo < [expr $len - 1] } {
+ if {$foo < $len - 1} {
set str [string range "$string" 0 $foo]
if { [send_gdb "$str"] != "" } {
perror "Couldn't send $command to GDB."
@@ -738,7 +738,7 @@ proc mi_gdb_test { args } {
-re "\[\r\n\]" { }
timeout { }
}
- set string [string range "$string" [expr $foo + 1] end]
+ set string [string range "$string" [expr {$foo + 1}] end]
} else {
break
}
@@ -750,11 +750,11 @@ proc mi_gdb_test { args } {
}
}
- if [info exists timeout] {
+ if {[info exists timeout]} {
set tmt $timeout
} else {
global timeout
- if [info exists timeout] {
+ if {[info exists timeout]} {
set tmt $timeout
} else {
set tmt 60
@@ -786,13 +786,13 @@ proc mi_gdb_test { args } {
# and $expect_out(2,string) is the MI output command.
# If $expect_out(1,string) is "", then there was no MI input command here.
- # NOTE, there is no trailing anchor because with GDB/MI,
- # asynchronous responses can happen at any point, causing more
- # data to be available. Normally an anchor is used to make
- # sure the end of the output is matched, however, $mi_gdb_prompt
- # is just as good of an anchor since mi_gdb_test is meant to
- # match a single mi output command. If a second GDB/MI output
- # response is sent, it will be in the buffer for the next
+ # NOTE, there is no trailing anchor because with GDB/MI,
+ # asynchronous responses can happen at any point, causing more
+ # data to be available. Normally an anchor is used to make
+ # sure the end of the output is matched, however, $mi_gdb_prompt
+ # is just as good of an anchor since mi_gdb_test is meant to
+ # match a single mi output command. If a second GDB/MI output
+ # response is sent, it will be in the buffer for the next
# time mi_gdb_test is called.
if {![string match "" $message]} {
pass "$message"
@@ -863,7 +863,7 @@ proc mi_gdb_test { args } {
# If the GDB output matched, compare the inferior output.
if { $result == 0 } {
- if [ info exists ipattern ] {
+ if {[ info exists ipattern ]} {
if { ![target_info exists gdb,noinferiorio] } {
global gdb_spawn_id inferior_spawn_id
@@ -957,8 +957,8 @@ proc mi_run_cmd_full {use_mi_command args} {
return -1
}
- if $use_gdb_stub {
- if [target_info exists gdb,do_reload_on_run] {
+ if {$use_gdb_stub} {
+ if {[target_info exists gdb,do_reload_on_run]} {
send_gdb "${run_prefix}continue\n"
gdb_expect 60 {
-re "${run_match}\\^running\[\r\n\]+\\*running,thread-id=\"\[^\"\]+\"\r\n$mi_gdb_prompt" {}
@@ -968,7 +968,7 @@ proc mi_run_cmd_full {use_mi_command args} {
return 0
}
- if [target_info exists gdb,start_symbol] {
+ if {[target_info exists gdb,start_symbol]} {
set start [target_info gdb,start_symbol]
} else {
set start "start"
@@ -1010,14 +1010,14 @@ proc mi_run_cmd_full {use_mi_command args} {
# -exec-continue, as appropriate. ARGS are passed verbatim to
# mi_run_cmd_full.
proc mi_run_cmd {args} {
- return [eval mi_run_cmd_full 1 $args]
+ return [mi_run_cmd_full 1 {*}$args]
}
# A wrapper for mi_run_cmd_full which uses the CLI commands 'run' and
# 'continue', as appropriate. ARGS are passed verbatim to
# mi_run_cmd_full.
proc mi_run_with_cli {args} {
- return [eval mi_run_cmd_full 0 $args]
+ return [mi_run_cmd_full 0 {*}$args]
}
# Starts fresh GDB binary and loads an optional executable into GDB.
@@ -1044,6 +1044,9 @@ proc mi_clean_restart {{executable ""} {flags {}}} {
mi_gdb_reinitialize_dir $srcdir/$subdir
if {$executable != ""} {
+ if { [file pathtype $executable] == "absolute" } {
+ error "absolute path used"
+ }
set binfile [standard_output_file ${executable}]
return [mi_gdb_load ${binfile}]
}
@@ -1285,7 +1288,7 @@ proc mi_expect_stop { reason func args file line extra test } {
set r "reason=$reason,"
} else {
set r "reason=\"$reason\","
- }
+ }
}
@@ -1394,7 +1397,7 @@ proc mi_continue_to {func} {
# returns the breakpoint regexp from that procedure.
proc mi_create_breakpoint {location test args} {
- set bp [eval mi_make_breakpoint $args]
+ set bp [mi_make_breakpoint {*}$args]
mi_gdb_test "222-break-insert $location" "222\\^done,$bp" $test
return $bp
}
@@ -1403,7 +1406,7 @@ proc mi_create_breakpoint {location test args} {
# locations using mi_make_breakpoint_multi instead.
proc mi_create_breakpoint_multi {location test args} {
- set bp [eval mi_make_breakpoint_multi $args]
+ set bp [mi_make_breakpoint_multi {*}$args]
mi_gdb_test "222-break-insert $location" "222\\^done,$bp" $test
return $bp
}
@@ -1411,7 +1414,7 @@ proc mi_create_breakpoint_multi {location test args} {
# Like mi_create_breakpoint, but creates a pending breakpoint.
proc mi_create_breakpoint_pending {location test args} {
- set bp [eval mi_make_breakpoint_pending $args]
+ set bp [mi_make_breakpoint_pending {*}$args]
mi_gdb_test "222-break-insert $location" ".*\r\n222\\^done,$bp" $test
return $bp
}
@@ -1706,16 +1709,16 @@ proc mi_prepare_inline_tests { filename } {
set prefix [string range $content 0 $start]
set prefix_newlines [count_newlines $prefix]
- set line_number [expr $line_number+$prefix_newlines]
+ set line_number [expr {$line_number+$prefix_newlines}]
set comment_line $line_number
- set comment [string range $content [expr $start+3] [expr $end-1]]
+ set comment [string range $content [expr {$start+3}] [expr {$end-1}]]
set comment_newlines [count_newlines $comment]
- set line_number [expr $line_number+$comment_newlines]
+ set line_number [expr {$line_number+$comment_newlines}]
set comment [string trim $comment]
- set content [string range $content [expr $end+3] \
+ set content [string range $content [expr {$end+3}] \
[string length $content]]
lappend mi_autotest_data [list $comment $comment_line]
} else {
@@ -1907,7 +1910,7 @@ proc mi_run_inline_test { testcase } {
foreach c $commands {
set statements [lindex $c 0]
set line [lindex $c 1]
- set line [expr $line-1]
+ set line [expr {$line-1}]
# We want gdb to be stopped at the expression immediately
# before the comment. If this is the first comment, the
@@ -1946,6 +1949,7 @@ proc mi_run_inline_test { testcase } {
# have direct access to global variables that the
# main 'exp' file has set up. But it's not yet clear,
# will need more experience to be sure.
+ # tclint-disable-next-line command-args
eval $statements
}
@@ -2004,7 +2008,7 @@ proc check_mi_and_console_threads_1 { name } {
# GDB will return a list of thread ids and some more info:
#
- # (gdb)
+ # (gdb)
# -interpreter-exec console "info threads"
# ~" 4 Thread 2051 (LWP 7734) 0x401166b1 in __libc_nanosleep () at __libc_nanosleep:-1"
# ~" 3 Thread 1026 (LWP 7733) () at __libc_nanosleep:-1"
@@ -2099,7 +2103,7 @@ proc check_mi_and_console_threads { name } {
proc mi_locate_shlib { file } {
global mi_spawn_id
- if ![info exists mi_spawn_id] {
+ if {![info exists mi_spawn_id]} {
perror "mi_locate_shlib: GDB is not running"
}
@@ -2279,19 +2283,23 @@ namespace eval ::varobj_tree {
proc mi_varobj_tree_dump_variable {variable_name {cmd send_log} {term "\n"}} {
upvar #0 $variable_name varobj
+ # tclint-disable-next-line command-args
eval "$cmd \"VAR = $variable_name$term\""
# Explicitly encode the array indices, since outputting them
# in some logical order is better than what "array names" might
# return.
foreach idx {obj_name parent display_name type path_expr} {
+ # tclint-disable-next-line command-args
eval "$cmd \"\t$idx = $varobj($idx)$term\""
}
# Output children
set num [llength $varobj(children)]
+ # tclint-disable-next-line command-args
eval "$cmd \"\tnum_children = $num$term\""
if {$num > 0} {
+ # tclint-disable-next-line command-args
eval "$cmd \"\tchildren = $varobj(children)$term\""
}
}
@@ -2683,7 +2691,7 @@ proc mi_make_info_frame_regexp {args} {
proc mi_info_frame { test args } {
parse_some_args {{frame ""} {thread ""}}
- set re [eval mi_make_info_frame_regexp $args]
+ set re [mi_make_info_frame_regexp {*}$args]
set cmd "235-stack-info-frame"
if {$frame ne ""} {
@@ -2919,7 +2927,7 @@ proc mi_get_valueof { fmt exp default {test ""} } {
proc foreach_mi_ui_mode { var_name body } {
upvar 1 $var_name var
- if [gdb_debug_enabled] {
+ if {[gdb_debug_enabled]} {
# gdb debug doesn't work for separate-mi-tty.
set modes {"main"}
} else {
diff --git a/gdb/testsuite/lib/my-syscalls.S b/gdb/testsuite/lib/my-syscalls.S
index 19df0ca..c514b32 100644
--- a/gdb/testsuite/lib/my-syscalls.S
+++ b/gdb/testsuite/lib/my-syscalls.S
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/my-syscalls.h b/gdb/testsuite/lib/my-syscalls.h
index 8de28ae..03c6f7e 100644
--- a/gdb/testsuite/lib/my-syscalls.h
+++ b/gdb/testsuite/lib/my-syscalls.h
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2020-2024 Free Software Foundation, Inc.
+ Copyright 2020-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/notty-wrap b/gdb/testsuite/lib/notty-wrap
index 93b81fb..3011753 100755
--- a/gdb/testsuite/lib/notty-wrap
+++ b/gdb/testsuite/lib/notty-wrap
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2021-2024 Free Software Foundation, Inc.
+# Copyright (C) 2021-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/testsuite/lib/objc.exp b/gdb/testsuite/lib/objc.exp
index 1378f56..cb59ca1 100644
--- a/gdb/testsuite/lib/objc.exp
+++ b/gdb/testsuite/lib/objc.exp
@@ -1,6 +1,6 @@
# This test code is part of GDB, the GNU debugger.
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,11 +19,12 @@
# The result is 1 (true) for success, 0 (false) for failure.
proc set_lang_objc {} {
- if [gdb_test_no_output "set language objective-c"] {
+ if {[gdb_test_no_output "set language objective-c"]} {
return 0
}
- if [gdb_test "show language" ".* source language is \"objective-c\"." \
- "set language to \"objective-c\""] {
+ if {[gdb_test "show language" \
+ [string_to_regexp {The current source language is "objective-c".}] \
+ {set language to "objective-c"}]} {
return 0
}
return 1
diff --git a/gdb/testsuite/lib/opencl.exp b/gdb/testsuite/lib/opencl.exp
index caa0e1e..2a5300e 100644
--- a/gdb/testsuite/lib/opencl.exp
+++ b/gdb/testsuite/lib/opencl.exp
@@ -1,4 +1,4 @@
-# Copyright 2010-2024 Free Software Foundation, Inc.
+# Copyright 2010-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/opencl_hostapp.c b/gdb/testsuite/lib/opencl_hostapp.c
index 7637a0f..c39995f 100644
--- a/gdb/testsuite/lib/opencl_hostapp.c
+++ b/gdb/testsuite/lib/opencl_hostapp.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2010-2024 Free Software Foundation, Inc.
+ Copyright 2010-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp
index 236eca1..12f8a2f 100644
--- a/gdb/testsuite/lib/pascal.exp
+++ b/gdb/testsuite/lib/pascal.exp
@@ -1,4 +1,4 @@
-# Copyright 2007-2024 Free Software Foundation, Inc.
+# Copyright 2007-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,11 +26,11 @@ set pascal_init_done 0
# Second, environment variable FPC is checked
# if present, Free Pascal compiler is assumed to be the value of
# that environment variable.
-# Third, gpc executable is searched using `which gpc`
-# Lastly, fpc executable is searched using `which fpc`
+# Third, gpc executable is searched using `which gpc`
+# Lastly, fpc executable is searched using `which fpc`
# Using environment variable allows to force
# which compiler is used in testsuite
-
+
proc pascal_init {} {
global pascal_init_done
gdb_persistent_global pascal_compiler_is_gpc
@@ -38,7 +38,7 @@ proc pascal_init {} {
gdb_persistent_global gpc_compiler
gdb_persistent_global fpc_compiler
global env
-
+
if { $pascal_init_done == 1 } {
return
}
@@ -48,7 +48,7 @@ proc pascal_init {} {
set gpc_compiler [transform gpc]
set fpc_compiler [transform fpc]
- if ![is_remote host] {
+ if {![is_remote host]} {
if { [info exists env(GPC)] } {
set pascal_compiler_is_gpc 1
set gpc_compiler $env(GPC)
@@ -66,7 +66,7 @@ proc pascal_init {} {
}
}
set pascal_init_done 1
-}
+}
proc gpc_compile {source destfile type options} {
global gpc_compiler
@@ -80,21 +80,21 @@ proc gpc_compile {source destfile type options} {
if { $type == "preprocess" } {
append add_flags " -E"
}
-
+
if { $type == "assembly" } {
append add_flags " -S"
}
foreach i $options {
if { $i == "debug" } {
- if [board_info $dest exists debug_flags] {
+ if {[board_info $dest exists debug_flags]} {
append add_flags " [board_info $dest debug_flags]"
} else {
append add_flags " -g"
}
}
if { $i == "class" } {
- if [board_info $dest exists pascal_class_flags] {
+ if {[board_info $dest exists pascal_class_flags]} {
append add_flags " [board_info $dest pascal_class_flags]"
} else {
append add_flags " --extended-syntax"
@@ -118,21 +118,21 @@ proc fpc_compile {source destfile type options} {
if { $type == "preprocess" } {
return "Free Pascal can not preprocess"
}
-
+
if { $type == "assembly" } {
append add_flags " -al"
}
foreach i $options {
if { $i == "debug" } {
- if [board_info $dest exists debug_flags] {
+ if {[board_info $dest exists debug_flags]} {
append add_flags " [board_info $dest debug_flags]"
} else {
append add_flags " -g"
}
}
if { $i == "class" } {
- if [board_info $dest exists pascal_class_flags] {
+ if {[board_info $dest exists pascal_class_flags]} {
append add_flags " [board_info $dest pascal_class_flags]"
} else {
append add_flags " -Mobjfpc"
@@ -149,7 +149,7 @@ proc gdb_compile_pascal {source destfile type options} {
global pascal_compiler_is_gpc
global pascal_compiler_is_fpc
- if { $pascal_init_done == 0 } {
+ if { $pascal_init_done == 0 } {
pascal_init
}
@@ -164,7 +164,7 @@ proc gdb_compile_pascal {source destfile type options} {
return "No pascal compiler. Compilation failed."
}
- if ![file exists $destfile] {
+ if {![file exists $destfile]} {
unsupported "Pascal compilation failed: $result"
return "Pascal compilation failed."
}
@@ -174,11 +174,12 @@ proc gdb_compile_pascal {source destfile type options} {
# The result is 1 (true) for success, 0 (false) for failure.
proc set_lang_pascal {} {
- if [gdb_test_no_output "set language pascal"] {
+ if {[gdb_test_no_output "set language pascal"]} {
return 0
}
- if [gdb_test "show language" ".* source language is \"pascal\"." \
- "set language to \"pascal\""] {
+ if {[gdb_test "show language" \
+ [string_to_regexp {The current source language is "pascal".}] \
+ {set language to "pascal"}]} {
return 0
}
return 1
diff --git a/gdb/testsuite/lib/pdtrace.in b/gdb/testsuite/lib/pdtrace.in
index 08b9efa..a629ff6 100755
--- a/gdb/testsuite/lib/pdtrace.in
+++ b/gdb/testsuite/lib/pdtrace.in
@@ -2,7 +2,7 @@
# A Poor (but Free) Man's dtrace
#
-# Copyright (C) 2014-2024 Free Software Foundation, Inc.
+# Copyright (C) 2014-2025 Free Software Foundation, Inc.
#
# Contributed by Oracle, Inc.
#
diff --git a/gdb/testsuite/lib/perftest.exp b/gdb/testsuite/lib/perftest.exp
index b4c997a..68022f9 100644
--- a/gdb/testsuite/lib/perftest.exp
+++ b/gdb/testsuite/lib/perftest.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -90,11 +90,12 @@ namespace eval PerfTest {
proc assemble {compile startup run} {
global GDB_PERFTEST_MODE
- if ![info exists GDB_PERFTEST_MODE] {
+ if {![info exists GDB_PERFTEST_MODE]} {
return
}
if { [string compare $GDB_PERFTEST_MODE "run"] != 0 } {
+ # tclint-disable-next-line command-args
if { [eval compile {$compile}] } {
untested "failed to compile"
return
@@ -108,7 +109,8 @@ namespace eval PerfTest {
verbose -log "PerfTest::assemble, startup ..."
- if [eval startup {$startup}] {
+ # tclint-disable-next-line command-args
+ if {[eval startup {$startup}]} {
fail "startup"
return
}
@@ -119,7 +121,8 @@ namespace eval PerfTest {
verbose -log "PerfTest::assemble, run ..."
- if [eval run {$run}] {
+ # tclint-disable-next-line command-args
+ if {[eval run {$run}]} {
fail "run"
}
@@ -134,7 +137,7 @@ namespace eval PerfTest {
proc allow_perf_tests { } {
global GDB_PERFTEST_MODE
- if [info exists GDB_PERFTEST_MODE] {
+ if {[info exists GDB_PERFTEST_MODE]} {
if { "$GDB_PERFTEST_MODE" != "compile"
&& "$GDB_PERFTEST_MODE" != "run"
&& "$GDB_PERFTEST_MODE" != "both" } {
diff --git a/gdb/testsuite/lib/precise-aligned-alloc.c b/gdb/testsuite/lib/precise-aligned-alloc.c
index 4f55ffd..b914afe 100644
--- a/gdb/testsuite/lib/precise-aligned-alloc.c
+++ b/gdb/testsuite/lib/precise-aligned-alloc.c
@@ -1,6 +1,6 @@
/* This test file is part of GDB, the GNU debugger.
- Copyright 2021-2024 Free Software Foundation, Inc.
+ Copyright 2021-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/prelink-support.exp b/gdb/testsuite/lib/prelink-support.exp
index 3aaea0a..beadd61 100644
--- a/gdb/testsuite/lib/prelink-support.exp
+++ b/gdb/testsuite/lib/prelink-support.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ proc symlink_resolve {file} {
verbose -log "Resolved symlink $file targeting $target as $src2"
set file $src2
- set loop [expr $loop + 1]
+ set loop [expr {$loop + 1}]
if {$loop > 30} {
fail "looping symlink resolution for $file"
return ""
@@ -49,7 +49,7 @@ proc file_copy {src dest} {
set test "copy [file tail $src] to [file tail $dest]"
set command "file copy -force -- $src $dest"
verbose -log "command is $command"
- if [catch $command] {
+ if {[catch {{*}$command}]} {
fail $test
return 0
} else {
@@ -99,7 +99,7 @@ proc build_executable_own_libs {testname executable sources options {interp ""}
set ldd [gdb_find_ldd]
set command "$ldd $binfile"
set test "ldd $executable"
- set result [catch "exec $command" output]
+ set result [catch {exec {*}$command} output]
verbose -log "result of $command is $result"
verbose -log "output of $command is $output"
if {$result != 0 || $output == ""} {
@@ -173,7 +173,7 @@ proc prelink_no {arg {name {}}} {
set test "unprelink $name"
set command "exec /usr/sbin/prelink -uN $arg"
verbose -log "command is $command"
- set result [catch $command output]
+ set result [catch {{*}$command} output]
verbose -log "result is $result"
verbose -log "output is $output"
if {$result == 1 && [regexp {^(couldn't execute "/usr/sbin/prelink[^\r\n]*": no such file or directory\n?)*$} $output]} {
@@ -182,14 +182,14 @@ proc prelink_no {arg {name {}}} {
# have already been prelinked).
set test "$test (missing /usr/sbin/prelink)"
foreach bin [split $arg] {
- if [string match "-*" $bin] {
+ if {[string match "-*" $bin]} {
# Skip prelink options.
continue
}
set readelf_program [gdb_find_readelf]
set command "exec $readelf_program -WS $bin"
verbose -log "command is $command"
- set result [catch $command output]
+ set result [catch {{*}$command} output]
verbose -log "result is $result"
verbose -log "output is $output"
if {$result != 0 || [string match {* .gnu.prelink_undo *} $output]} {
@@ -204,7 +204,7 @@ proc prelink_no {arg {name {}}} {
verbose -log "$name has been now unprelinked"
set command "exec /usr/sbin/prelink -uN $arg"
verbose -log "command is $command"
- set result [catch $command output]
+ set result [catch {{*}$command} output]
verbose -log "result is $result"
verbose -log "output is $output"
}
@@ -230,7 +230,7 @@ proc prelink_yes {arg {name ""}} {
# Try to unprelink it first so that, if it has been already prelinked
# before, we get a different address now, making the new result unaffected
# by any previous prelinking.
- if ![prelink_no $arg "$name pre-unprelink"] {
+ if {![prelink_no $arg "$name pre-unprelink"]} {
return 0
}
@@ -251,7 +251,7 @@ proc prelink_yes {arg {name ""}} {
set command "exec /usr/sbin/prelink -qNR --no-exec-shield $arg"
verbose -log "command is $command"
- set result [catch $command output]
+ set result [catch {{*}$command} output]
verbose -log "result is $result"
verbose -log "output is $output"
if {$result == 1 && [regexp {^(couldn't execute "/usr/sbin/prelink[^\r\n]*": no such file or directory\n?)*$} $output]} {
diff --git a/gdb/testsuite/lib/prompt.exp b/gdb/testsuite/lib/prompt.exp
index 51997b3..0473d69 100644
--- a/gdb/testsuite/lib/prompt.exp
+++ b/gdb/testsuite/lib/prompt.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,11 +44,11 @@ proc default_prompt_gdb_start { } {
verbose "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS"
gdb_write_cmd_file "$GDB $INTERNAL_GDBFLAGS $GDBFLAGS"
- if [info exists gdb_spawn_id] {
+ if {[info exists gdb_spawn_id]} {
return 0
}
- if ![is_remote host] {
+ if {![is_remote host]} {
if {[which $GDB] == 0} {
perror "$GDB does not exist."
exit 1
diff --git a/gdb/testsuite/lib/range-stepping-support.exp b/gdb/testsuite/lib/range-stepping-support.exp
index 1f1f9d7..27587e5 100644
--- a/gdb/testsuite/lib/range-stepping-support.exp
+++ b/gdb/testsuite/lib/range-stepping-support.exp
@@ -1,4 +1,4 @@
-# Copyright 2013-2024 Free Software Foundation, Inc.
+# Copyright 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/read1.c b/gdb/testsuite/lib/read1.c
index 29570c9..c4c9ee2 100644
--- a/gdb/testsuite/lib/read1.c
+++ b/gdb/testsuite/lib/read1.c
@@ -1,6 +1,6 @@
/* This is part of GDB, the GNU debugger.
- Copyright 2011-2024 Free Software Foundation, Inc.
+ Copyright 2011-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/rocm.exp b/gdb/testsuite/lib/rocm.exp
index 5164f1e..d3f201c 100644
--- a/gdb/testsuite/lib/rocm.exp
+++ b/gdb/testsuite/lib/rocm.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2024 Free Software Foundation, Inc.
+# Copyright (C) 2019-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/rust-support.exp b/gdb/testsuite/lib/rust-support.exp
index 971a4a6..7087e82 100644
--- a/gdb/testsuite/lib/rust-support.exp
+++ b/gdb/testsuite/lib/rust-support.exp
@@ -1,4 +1,4 @@
-# Copyright 2016-2024 Free Software Foundation, Inc.
+# Copyright 2016-2025 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,11 +16,12 @@
# Auxiliary function to set the language to Rust.
# The result is 1 (true) for success, 0 (false) for failure.
proc set_lang_rust {} {
- if [gdb_test_no_output "set language rust"] {
+ if {[gdb_test_no_output "set language rust"]} {
return 0
}
- if [gdb_test "show language" ".* source language is \"rust\"." \
- "set language to \"rust\""] {
+ if {[gdb_test "show language" \
+ [string_to_regexp {The current source language is "rust".}] \
+ {set language to "rust"}]} {
return 0
}
return 1
diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp
index 0d76e2f..d0905eb 100644
--- a/gdb/testsuite/lib/selftest-support.exp
+++ b/gdb/testsuite/lib/selftest-support.exp
@@ -1,4 +1,4 @@
-# Copyright 2003-2024 Free Software Foundation, Inc.
+# Copyright 2003-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
# Find a pathname to a file that we would execute if the shell was asked
# to run $arg using the current PATH.
-proc find_gdb { arg } {
+proc _selftest_find_gdb { arg } {
# If the arg directly specifies an existing executable file, then
# simply use it.
@@ -36,65 +36,163 @@ proc find_gdb { arg } {
return $arg
}
-# A helper proc that sets up for self-testing.
-# EXECUTABLE is the gdb to use.
-# FUNCTION is the function to break in, either captured_main
-# or captured_command_loop.
-# Return 0 in case of success, -1 in case of failure, and -2 in case of
-# skipping the test-case.
+# Return true if the GDB under test is installed (as opposed to a GDB in its
+# build directory).
-proc selftest_setup { executable function } {
- global gdb_prompt
- global INTERNAL_GDBFLAGS
+proc _selftest_gdb_is_installed {} {
+ # If GDB_DATA_DIRECTORY is empty, assume that it is an installed GDB. It is
+ # not a perfectly accurate check, but should be good enough.
+ return [expr {"$::GDB_DATA_DIRECTORY" == ""}]
+}
+
+# Return true if the libtool binary is present on the host.
+
+proc _selftest_has_libtool {} {
+ lassign [remote_exec host "sh -c \"command -v libtool\""] status output
+ return [expr {$status == 0}]
+}
+
+# If GDB is executed from a build tree, run libtool to obtain the real
+# executable path for EXECUTABLE, which may be a libtool wrapper. Return
+# the path on success. On failure, issue an UNTESTED test result and return
+# an empty string.
+#
+# If GDB is executed from an installed location, return EXECUTABLE unchanged.
+#
+# If libtool is not present on the host system, return EXECUTABLE unchanged.
+# The test might still work, because the GDB binary is not always a libtool
+# wrapper.
+
+proc selftest_libtool_get_real_gdb_executable { executable } {
+ if {[_selftest_gdb_is_installed]} {
+ return $executable
+ }
- # load yourself into the debugger
+ if {![_selftest_has_libtool]} {
+ return $executable
+ }
+
+ lassign [remote_exec host libtool "--mode=execute echo -n $executable"] \
+ status executable
+
+ if { $status != 0 } {
+ untested "failed to run libtool"
+ return ""
+ }
- global gdb_file_cmd_debug_info
- set gdb_file_cmd_debug_info "unset"
+ return $executable
+}
+
+# Return true if EXECUTABLE has debug info.
+#
+# If it doesn't, or if it's not possible to determine, issue an UNTESTED test
+# result and return false.
+
+proc _selftest_check_executable_debug_info { executable } {
+ set ::gdb_file_cmd_debug_info "unset"
+ set result true
+
+ # On Cygwin (at least), gdb/gdb.exe is a libtool wrapper (which happens to
+ # be a PE executable). The real binary is gdb/.libs/gdb.exe. If we load
+ # gdb/gdb.exe, we won't see any debug info and conclude that we can't run
+ # the test. Obtain the real executable path using libtool.
+ #
+ # At the time of writing, we don't see a libtool wrapper generated on Linux.
+ # But if there was one, it would be a shell script, and it would not be
+ # possible to load it in gdb. This conversion would therefore also be
+ # necessary.
+ #
+ # If testing against an installed GDB, then there won't be a libtool
+ # wrapper, no need to convert.
+ set executable [selftest_libtool_get_real_gdb_executable $executable]
+
+ if { $executable == "" } {
+ # selftest_libtool_get_real_gdb_executable already records an UNTESTED
+ # on failure.
+ return false
+ }
- set result [gdb_load $executable]
+ gdb_start
- if {$result != 0} {
- return -1
+ if {[gdb_load $executable] != 0} {
+ untested "failed to load executable when checking for debug info"
+ set result false
}
- if {$gdb_file_cmd_debug_info != "debug"} {
+ if {$::gdb_file_cmd_debug_info != "debug"} {
untested "no debug information, skipping testcase."
- return -2
+ set result false
}
- # Set a breakpoint at $function.
+ gdb_exit
+
+ return $result
+}
+
+# A helper proc that sets up for self-testing.
+#
+# Assumes that the inferior GDB is already loaded in the top-level GDB.
+#
+# Return 0 in case of success, -1 in case of failure, and -2 in case of
+# skipping the test-case.
+
+proc _selftest_setup { } {
+ global gdb_prompt
+ global INTERNAL_GDBFLAGS
+
+ # Set a breakpoint at main
+ set function main
if { [gdb_breakpoint $function "no-message"] != 1 } {
untested "Cannot set breakpoint at $function, skipping testcase."
return -2
}
+ # Debugging on Windows shows random threads starting and exiting,
+ # interfering with the tests. Disable them, since they are not useful here.
+ gdb_test_no_output "set print thread-events off"
+
# run yourself
set description "run until breakpoint at $function"
+ set re_hs {[^\r\n]+}
+ set re_args [string cat \
+ [string_to_regexp "("] \
+ $re_hs \
+ [string_to_regexp ")"]]
+ set re_pass \
+ [multi_line \
+ "Starting program: $re_hs" \
+ ".*" \
+ [string cat "Breakpoint $::decimal, $function $re_args at" \
+ " ${re_hs}gdb.c:$re_hs"] \
+ ".*"]
+ set re_xfail \
+ [multi_line \
+ "Starting program: $re_hs" \
+ ".*" \
+ "Breakpoint $::decimal, $function $re_args$re_hs" \
+ ".*"]
gdb_test_multiple "run $INTERNAL_GDBFLAGS" "$description" {
- -re "Starting program.*Breakpoint \[0-9\]+,.*$function \\(.*\\).* at .*main.c:.*$gdb_prompt $" {
- pass "$description"
- }
- -re "Starting program.*Breakpoint \[0-9\]+,.*$function \\(.*\\).*$gdb_prompt $" {
- xfail "$description (line numbers scrambled?)"
- }
- -re "vfork: No more processes.*$gdb_prompt $" {
- fail "$description (out of virtual memory)"
- return -1
- }
- -re ".*$gdb_prompt $" {
- fail "$description"
- return -1
- }
+ -re -wrap $re_pass {
+ pass $description
+ }
+ -re -wrap $re_xfail {
+ xfail "$description (line numbers scrambled?)"
+ }
+ -re -wrap "vfork: No more processes.*" {
+ fail "$description (out of virtual memory)"
+ return -1
+ }
+ -re -wrap "" {
+ fail $description
+ return -1
+ }
}
return 0
}
-# Prepare for running a self-test by moving the GDB executable to a
-# location where we can use it as the inferior. Return the filename
-# of the new location.
+# Return the location of the gdb executable to test.
#
# If the current testing setup is not suitable for running a
# self-test, then return an empty string.
@@ -108,58 +206,60 @@ proc selftest_prepare {} {
# ... or seemingly testing with a cross debugger? Likely GDB
# wouldn't be able to debug itself then...
- if ![isnative] {
+ if {![isnative]} {
return
}
# ... or with a stub-like server? I.e., gdbserver + "target
# remote"? In that case we won't be able to pass command line
- # arguments to GDB, and selftest_setup wants to do exactly that.
- if [use_gdb_stub] {
+ # arguments to GDB, and _selftest_setup wants to do exactly that.
+ if {[use_gdb_stub]} {
return
}
- # Run the test with self. Copy the file executable file in case
- # this OS doesn't like to edit its own text space.
-
- set gdb_fullpath [find_gdb $::GDB]
-
- if {[is_remote host]} {
- set xgdb x$::tool
- } else {
- set xgdb [standard_output_file x$::tool]
- }
-
- # Remove any old copy lying around.
- remote_file host delete $xgdb
-
- set filename [remote_download host $gdb_fullpath $xgdb]
-
- return $filename
+ return [_selftest_find_gdb $::GDB]
}
# A simple way to run some self-tests.
-proc do_self_tests {function body} {
+proc do_self_tests {body} {
set file [selftest_prepare]
if { $file eq "" } {
return
}
- gdb_start
+ # Check if the gdb executable has debug info.
+ if { ![_selftest_check_executable_debug_info $file] } {
+ return
+ }
+
+ # FILE might be a libtool wrapper. In order to debug the real thing, pass
+ # FILE on the command-line of the top-level gdb, and run under
+ # `libtool --mode=execute. libtool will replace FILE with the path to the
+ # real executable and set any path required for it to find its dependent
+ # libraries.
+ #
+ # If testing against an installed GDB, there won't be a libtool wrapper.
+ save_vars { ::GDB ::GDBFLAGS } {
+ if { ![_selftest_gdb_is_installed] && [_selftest_has_libtool] } {
+ set ::GDB "libtool --mode=execute $::GDB"
+ }
+
+ set ::GDBFLAGS "$::GDBFLAGS $file"
+ gdb_start
+ }
# When debugging GDB with GDB, some operations can take a relatively long
# time, especially if the build is non-optimized. Bump the timeout for the
# duration of the test.
with_timeout_factor 10 {
- set result [selftest_setup $file $function]
+ set result [_selftest_setup]
if {$result == 0} {
set result [uplevel $body]
}
}
gdb_exit
- catch "remote_file host delete $file"
if {$result == -1} {
warning "Couldn't test self"
diff --git a/gdb/testsuite/lib/set_unbuffered_mode.c b/gdb/testsuite/lib/set_unbuffered_mode.c
index 0c92d55..f0604a0 100644
--- a/gdb/testsuite/lib/set_unbuffered_mode.c
+++ b/gdb/testsuite/lib/set_unbuffered_mode.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/lib/sym-info-cmds.exp b/gdb/testsuite/lib/sym-info-cmds.exp
index 9714529..c94b06f 100644
--- a/gdb/testsuite/lib/sym-info-cmds.exp
+++ b/gdb/testsuite/lib/sym-info-cmds.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/lib/trace-support.exp b/gdb/testsuite/lib/trace-support.exp
index 770a930..46dff2f 100644
--- a/gdb/testsuite/lib/trace-support.exp
+++ b/gdb/testsuite/lib/trace-support.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2024 Free Software Foundation, Inc.
+# Copyright (C) 1998-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,19 +24,19 @@
# Used in many tests, kept here to avoid duplication.
#
-if [is_amd64_regs_target] {
+if {[is_amd64_regs_target]} {
set fpreg "rbp"
set spreg "rsp"
set pcreg "rip"
-} elseif [is_x86_like_target] {
+} elseif {[is_x86_like_target]} {
set fpreg "ebp"
set spreg "esp"
set pcreg "eip"
-} elseif [is_aarch64_target] {
+} elseif {[is_aarch64_target]} {
set fpreg "x29"
set spreg "sp"
set pcreg "pc"
-} elseif [istarget "powerpc*-*-*"] {
+} elseif {[istarget "powerpc*-*-*"]} {
set fpreg "r31"
set spreg "r1"
set pcreg "pc"
@@ -109,7 +109,7 @@ proc gdb_target_supports_trace { } {
# Procedure: gdb_delete_tracepoints
# Many of the tests depend on setting tracepoints at various places and
# running until that tracepoint is reached. At times, we want to start
-# with a clean slate with respect to tracepoints, so this utility proc
+# with a clean slate with respect to tracepoints, so this utility proc
# lets us do this without duplicating this code everywhere.
#
@@ -123,9 +123,9 @@ proc gdb_delete_tracepoints {} {
exp_continue
}
-re ".*$gdb_prompt $" { # This happens if there were no tracepoints }
- timeout {
- perror "Delete all tracepoints in delete_tracepoints (timeout)"
- return
+ timeout {
+ perror "Delete all tracepoints in delete_tracepoints (timeout)"
+ return
}
}
send_gdb "info tracepoints\n"
@@ -174,7 +174,7 @@ proc gdb_trace_setactions_command { actions_command testname tracepoint args } {
-re "\(.*\)\[\r\n\]+\[ \t]*>$" {
if { $expected_result != "" } {
regsub "^\[^\r\n\]+\[\r\n\]+" "$expect_out(1,string)" "" out
- if ![regexp $expected_result $out] {
+ if {![regexp $expected_result $out]} {
set passfail "fail"
}
set expected_result ""
@@ -192,7 +192,7 @@ proc gdb_trace_setactions_command { actions_command testname tracepoint args } {
}
-re "\(.*\)$gdb_prompt $" {
if { $expected_result != "" } {
- if ![regexp $expected_result $expect_out(1,string)] {
+ if {![regexp $expected_result $expect_out(1,string)]} {
set passfail "fail"
}
set expected_result ""
@@ -219,20 +219,20 @@ proc gdb_trace_setactions_command { actions_command testname tracepoint args } {
# gdb_trace_setactions_command.
#
proc gdb_trace_setactions { testname tracepoint args } {
- eval gdb_trace_setactions_command "actions" {$testname} {$tracepoint} $args
+ gdb_trace_setactions_command "actions" $testname $tracepoint {*}$args
}
# Define actions for a tracepoint, using the "commands" command. See
# gdb_trace_setactions_command.
#
proc gdb_trace_setcommands { testname tracepoint args } {
- eval gdb_trace_setactions_command "commands" {$testname} {$tracepoint} $args
+ gdb_trace_setactions_command "commands" $testname $tracepoint {*}$args
}
#
# Procedure: gdb_tfind_test
# Find a specified trace frame.
-# Arguments:
+# Arguments:
# testname -- identifying string for pass/fail output
# tfind_arg -- frame (line, PC, etc.) identifier
# exp_res -- Expected result of frame test
@@ -371,9 +371,9 @@ proc gdb_find_recursion_test_baseline { filename } {
proc allow_in_proc_agent {} {
global objdir
- if [target_info exists in_proc_agent] {
+ if {[target_info exists in_proc_agent]} {
return 1
- } elseif [file exists "$objdir/../../gdbserver/libinproctrace.so"] {
+ } elseif {[file exists "$objdir/../../gdbserver/libinproctrace.so"]} {
return 1
} else {
return 0
@@ -385,7 +385,7 @@ proc allow_in_proc_agent {} {
proc get_in_proc_agent {} {
global objdir
- if [target_info exists in_proc_agent] {
+ if {[target_info exists in_proc_agent]} {
return [target_info in_proc_agent]
} else {
return $objdir/../../gdbserver/libinproctrace.so
@@ -403,7 +403,7 @@ proc generate_tracefile { binfile } {
# Alternatively, load the binary and run it. If target doesn't
# have fileio capabilities, tracefile can't be generated. Skip
# the test.
- if [target_info exists gdb,nofileio] {
+ if {[target_info exists gdb,nofileio]} {
return 0
}
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index 4aa1ea2..68fd677 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Free Software Foundation, Inc.
+# Copyright 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,1264 +33,1690 @@ namespace eval Term {
variable _resize_count
- proc _log { what } {
- verbose "+++ $what"
- }
+ variable _TERM
+ set _TERM ""
- # Call BODY, then log WHAT along with the original and new cursor position.
- proc _log_cur { what body } {
- variable _cur_row
- variable _cur_col
+ variable _alternate
+ variable _alternate_setup
+ set _alternate 0
+ set _alternate_setup 0
+}
+
+proc Term::_log { what } {
+ verbose "+++ $what"
+}
- set orig_cur_row $_cur_row
- set orig_cur_col $_cur_col
+# Call BODY, then log WHAT along with the original and new cursor position.
+proc Term::_log_cur { what body } {
+ variable _cur_row
+ variable _cur_col
- uplevel $body
+ set orig_cur_row $_cur_row
+ set orig_cur_col $_cur_col
+
+ set code [catch {uplevel $body} result]
- _log "$what, cursor: ($orig_cur_row, $orig_cur_col) -> ($_cur_row, $_cur_col)"
+ _log "$what, cursor: ($orig_cur_row, $orig_cur_col) -> ($_cur_row, $_cur_col)"
+
+ if { $code == 1 } {
+ global errorInfo errorCode
+ return -code $code -errorinfo $errorInfo -errorcode $errorCode $result
+ } else {
+ return -code $code $result
}
+}
- # If ARG is empty, return DEF: otherwise ARG. This is useful for
- # defaulting arguments in CSIs.
- proc _default {arg def} {
- if {$arg == ""} {
- return $def
- }
- return $arg
+# If ARG is empty, return DEF: otherwise ARG. This is useful for
+# defaulting arguments in CSIs.
+proc Term::_default {arg def} {
+ if {$arg == ""} {
+ return $def
}
+ return $arg
+}
- # Erase in the line Y from SX to just before EX.
- proc _clear_in_line {sx ex y} {
- variable _attrs
- variable _chars
- set lattr [array get _attrs]
- while {$sx < $ex} {
- set _chars($sx,$y) [list " " $lattr]
- incr sx
- }
+# Erase in the line Y from SX to just before EX.
+proc Term::_clear_in_line {sx ex y} {
+ variable _attrs
+ variable _chars
+ set lattr [array get _attrs]
+ while {$sx < $ex} {
+ set _chars($sx,$y) [list " " $lattr]
+ incr sx
}
+}
- # Erase the lines from SY to just before EY.
- proc _clear_lines {sy ey} {
- variable _cols
- while {$sy < $ey} {
- _clear_in_line 0 $_cols $sy
- incr sy
- }
+# Erase the lines from SY to just before EY.
+proc Term::_clear_lines {sy ey} {
+ variable _cols
+ while {$sy < $ey} {
+ _clear_in_line 0 $_cols $sy
+ incr sy
}
+}
+
+# Beep.
+proc Term::_ctl_0x07 {} {
+}
+
+# Return 1 if tuiterm has the bw/auto_left_margin enabled.
+proc Term::_have_bw {} {
+ return [expr \
+ { [string equal $Term::_TERM "ansiw"] \
+ || [string equal $Term::_TERM "ansis"] }]
+}
- # Beep.
- proc _ctl_0x07 {} {
+# Backspace.
+proc Term::_ctl_0x08 { {bw -1} } {
+ if { $bw == -1 } {
+ set bw [_have_bw]
}
+ _log_cur "Backspace, bw == $bw" {
+ variable _cur_col
+ variable _cur_row
+ variable _cols
- # Backspace.
- proc _ctl_0x08 {} {
- _log_cur "Backspace" {
- variable _cur_col
+ if { $_cur_col > 0 } {
+ # No wrapping needed.
+ incr _cur_col -1
+ return
+ }
- if {$_cur_col > 0} {
- incr _cur_col -1
- }
+ if { ! $bw } {
+ # Wrapping not enabled.
+ return
}
+
+ if { $_cur_row == 0 } {
+ # Can't wrap.
+ return
+ }
+
+ # Wrap to previous line.
+ set _cur_col [expr $_cols - 1]
+ incr _cur_row -1
}
+}
- # Linefeed.
- proc _ctl_0x0a {} {
- _log_cur "Line feed" {
- variable _cur_row
- variable _rows
- variable _cols
- variable _chars
-
- incr _cur_row 1
- while {$_cur_row >= $_rows} {
- # Scroll the display contents. We scroll one line at
- # a time here; as _cur_row was only increased by one,
- # a single line scroll should be enough to put the
- # cursor back on the screen. But we wrap the
- # scrolling inside a while loop just to be on the safe
- # side.
- for {set y 0} {$y < [expr $_rows - 1]} {incr y} {
- set next_y [expr $y + 1]
- for {set x 0} {$x < $_cols} {incr x} {
- set _chars($x,$y) $_chars($x,$next_y)
- }
- }
+# Linefeed.
+proc Term::_ctl_0x0a {} {
+ _log_cur "Line feed" {
+ variable _cur_row
+ variable _rows
+ variable _cols
+ variable _chars
- incr _cur_row -1
+ incr _cur_row 1
+ while {$_cur_row >= $_rows} {
+ # Scroll the display contents. We scroll one line at
+ # a time here; as _cur_row was only increased by one,
+ # a single line scroll should be enough to put the
+ # cursor back on the screen. But we wrap the
+ # scrolling inside a while loop just to be on the safe
+ # side.
+ for {set y 0} {$y < [expr $_rows - 1]} {incr y} {
+ set next_y [expr $y + 1]
+ for {set x 0} {$x < $_cols} {incr x} {
+ set _chars($x,$y) $_chars($x,$next_y)
+ }
}
+
+ incr _cur_row -1
}
}
+}
- # Carriage return.
- proc _ctl_0x0d {} {
- _log_cur "Carriage return" {
- variable _cur_col
+# Carriage return.
+proc Term::_ctl_0x0d {} {
+ _log_cur "Carriage return" {
+ variable _cur_col
- set _cur_col 0
- }
+ set _cur_col 0
}
+}
- # Insert Character.
- #
- # https://vt100.net/docs/vt510-rm/ICH.html
- proc _csi_@ {args} {
- set n [_default [lindex $args 0] 1]
+# Designate G0 Character Set, USASCII (ESC ( B)
+#
+# https://invisible-island.net/xterm/ctlseqs/ctlseqs.html (see "ESC ( C", case C = B)
+proc Term::_esc_0x28_B {} {
+ _log "ignored: G0: USASCII"
+}
- _log_cur "Insert Character ($n)" {
- variable _cur_col
- variable _cur_row
- variable _cols
- variable _chars
+# Designate G0 Character Set, DEC Special Character and Line Drawing Set (ESC ( 0)
+#
+# https://invisible-island.net/xterm/ctlseqs/ctlseqs.html (see "ESC ( C", case C = 0)
+proc Term::_esc_0x28_0 {} {
+ _log "ignored: G0: DEC Special Character and Line Drawing Set"
+}
- # Move characters right of the cursor right by N positions,
- # starting with the rightmost one.
- for {set in_col [expr $_cols - $n - 1]} {$in_col >= $_cur_col} {incr in_col -1} {
- set out_col [expr $in_col + $n]
- set _chars($out_col,$_cur_row) $_chars($in_col,$_cur_row)
- }
+# DECKPAM (Application Keypad, ESC =)
+#
+# https://vt100.net/docs/vt510-rm/DECKPAM.html
+proc Term::_esc_0x3d {} {
+ _log "ignored: Application Keypad"
+}
+
+# DECKPNM (Normal Keypad, ESC >)
+#
+# https://vt100.net/docs/vt510-rm/DECKPNM.html
+proc Term::_esc_0x3e {} {
+ _log "ignored: Normal Keypad"
+}
- # Write N blank spaces starting from the cursor.
- _clear_in_line $_cur_col [expr $_cur_col + $n] $_cur_row
+# Insert Character.
+#
+# https://vt100.net/docs/vt510-rm/ICH.html
+proc Term::_csi_@ {args} {
+ set n [_default [lindex $args 0] 1]
+
+ _log_cur "Insert Character ($n)" {
+ variable _cur_col
+ variable _cur_row
+ variable _cols
+ variable _chars
+
+ # Move characters right of the cursor right by N positions,
+ # starting with the rightmost one.
+ for {set in_col [expr $_cols - $n - 1]} {$in_col >= $_cur_col} {incr in_col -1} {
+ set out_col [expr $in_col + $n]
+ set _chars($out_col,$_cur_row) $_chars($in_col,$_cur_row)
}
+
+ # Write N blank spaces starting from the cursor.
+ _clear_in_line $_cur_col [expr $_cur_col + $n] $_cur_row
}
+}
- # Cursor Up.
- #
- # https://vt100.net/docs/vt510-rm/CUU.html
- proc _csi_A {args} {
- set arg [_default [lindex $args 0] 1]
+# Horizontal Position Absolute.
+#
+# https://vt100.net/docs/vt510-rm/HPA.html
+proc Term::_csi_` {args} {
+ # Same as Cursor Horizontal Absolute.
+ return [Term::_csi_G {*}$args]
+}
- _log_cur "Cursor Up ($arg)" {
- variable _cur_row
+# Cursor Up.
+#
+# https://vt100.net/docs/vt510-rm/CUU.html
+proc Term::_csi_A {args} {
+ set arg [_default [lindex $args 0] 1]
- set _cur_row [expr {max ($_cur_row - $arg, 0)}]
- }
+ _log_cur "Cursor Up ($arg)" {
+ variable _cur_row
+
+ set _cur_row [expr {max ($_cur_row - $arg, 0)}]
}
+}
- # Cursor Down.
- #
- # https://vt100.net/docs/vt510-rm/CUD.html
- proc _csi_B {args} {
- set arg [_default [lindex $args 0] 1]
+# Cursor Down.
+#
+# https://vt100.net/docs/vt510-rm/CUD.html
+proc Term::_csi_B {args} {
+ set arg [_default [lindex $args 0] 1]
- _log_cur "Cursor Down ($arg)" {
- variable _cur_row
- variable _rows
+ _log_cur "Cursor Down ($arg)" {
+ variable _cur_row
+ variable _rows
- set _cur_row [expr {min ($_cur_row + $arg, $_rows - 1)}]
- }
+ set _cur_row [expr {min ($_cur_row + $arg, $_rows - 1)}]
}
+}
- # Cursor Forward.
- #
- # https://vt100.net/docs/vt510-rm/CUF.html
- proc _csi_C {args} {
- set arg [_default [lindex $args 0] 1]
+# Cursor Forward.
+#
+# https://vt100.net/docs/vt510-rm/CUF.html
+proc Term::_csi_C {args} {
+ set arg [_default [lindex $args 0] 1]
- _log_cur "Cursor Forward ($arg)" {
- variable _cur_col
- variable _cols
+ _log_cur "Cursor Forward ($arg)" {
+ variable _cur_col
+ variable _cols
- set _cur_col [expr {min ($_cur_col + $arg, $_cols - 1)}]
- }
+ set _cur_col [expr {min ($_cur_col + $arg, $_cols - 1)}]
}
+}
- # Cursor Backward.
- #
- # https://vt100.net/docs/vt510-rm/CUB.html
- proc _csi_D {args} {
- set arg [_default [lindex $args 0] 1]
+# Cursor Backward.
+#
+# https://vt100.net/docs/vt510-rm/CUB.html
+proc Term::_csi_D {args} {
+ set arg [_default [lindex $args 0] 1]
- _log_cur "Cursor Backward ($arg)" {
- variable _cur_col
+ _log_cur "Cursor Backward ($arg)" {
+ variable _cur_col
- set _cur_col [expr {max ($_cur_col - $arg, 0)}]
- }
+ set _cur_col [expr {max ($_cur_col - $arg, 0)}]
}
+}
- # Cursor Next Line.
- #
- # https://vt100.net/docs/vt510-rm/CNL.html
- proc _csi_E {args} {
- set arg [_default [lindex $args 0] 1]
+# Cursor Next Line.
+#
+# https://vt100.net/docs/vt510-rm/CNL.html
+proc Term::_csi_E {args} {
+ set arg [_default [lindex $args 0] 1]
- _log_cur "Cursor Next Line ($arg)" {
- variable _cur_col
- variable _cur_row
- variable _rows
+ _log_cur "Cursor Next Line ($arg)" {
+ variable _cur_col
+ variable _cur_row
+ variable _rows
- set _cur_col 0
- set _cur_row [expr {min ($_cur_row + $arg, $_rows - 1)}]
- }
+ set _cur_col 0
+ set _cur_row [expr {min ($_cur_row + $arg, $_rows - 1)}]
}
+}
- # Cursor Previous Line.
- #
- # https://vt100.net/docs/vt510-rm/CPL.html
- proc _csi_F {args} {
- set arg [_default [lindex $args 0] 1]
+# Cursor Previous Line.
+#
+# https://vt100.net/docs/vt510-rm/CPL.html
+proc Term::_csi_F {args} {
+ set arg [_default [lindex $args 0] 1]
- _log_cur "Cursor Previous Line ($arg)" {
- variable _cur_col
- variable _cur_row
- variable _rows
+ _log_cur "Cursor Previous Line ($arg)" {
+ variable _cur_col
+ variable _cur_row
+ variable _rows
- set _cur_col 0
- set _cur_row [expr {max ($_cur_row - $arg, 0)}]
- }
+ set _cur_col 0
+ set _cur_row [expr {max ($_cur_row - $arg, 0)}]
}
+}
- # Cursor Horizontal Absolute.
- #
- # https://vt100.net/docs/vt510-rm/CHA.html
- proc _csi_G {args} {
- set arg [_default [lindex $args 0] 1]
+# Cursor Horizontal Absolute.
+#
+# https://vt100.net/docs/vt510-rm/CHA.html
+proc Term::_csi_G {args} {
+ set arg [_default [lindex $args 0] 1]
- _log_cur "Cursor Horizontal Absolute ($arg)" {
- variable _cur_col
- variable _cols
+ _log_cur "Cursor Horizontal Absolute ($arg)" {
+ variable _cur_col
+ variable _cols
- set _cur_col [expr {min ($arg - 1, $_cols)}]
- }
+ set _cur_col [expr {min ($arg, $_cols)} - 1]
}
+}
- # Cursor Position.
- #
- # https://vt100.net/docs/vt510-rm/CUP.html
- proc _csi_H {args} {
- set row [_default [lindex $args 0] 1]
- set col [_default [lindex $args 1] 1]
+# Cursor Position.
+#
+# https://vt100.net/docs/vt510-rm/CUP.html
+proc Term::_csi_H {args} {
+ set row [_default [lindex $args 0] 1]
+ set col [_default [lindex $args 1] 1]
- _log_cur "Cursor Position ($row, $col)" {
- variable _cur_col
- variable _cur_row
+ _log_cur "Cursor Position ($row, $col)" {
+ variable _cur_col
+ variable _cur_row
- set _cur_row [expr {$row - 1}]
- set _cur_col [expr {$col - 1}]
- }
+ set _cur_row [expr {$row - 1}]
+ set _cur_col [expr {$col - 1}]
}
+}
- # Cursor Horizontal Forward Tabulation.
- #
- # https://vt100.net/docs/vt510-rm/CHT.html
- proc _csi_I {args} {
- set n [_default [lindex $args 0] 1]
+# Cursor Horizontal Forward Tabulation.
+#
+# https://vt100.net/docs/vt510-rm/CHT.html
+proc Term::_csi_I {args} {
+ set n [_default [lindex $args 0] 1]
- _log_cur "Cursor Horizontal Forward Tabulation ($n)" {
- variable _cur_col
- variable _cols
+ _log_cur "Cursor Horizontal Forward Tabulation ($n)" {
+ variable _cur_col
+ variable _cols
- incr _cur_col [expr {$n * 8 - $_cur_col % 8}]
- if {$_cur_col >= $_cols} {
- set _cur_col [expr {$_cols - 1}]
- }
+ incr _cur_col [expr {$n * 8 - $_cur_col % 8}]
+ if {$_cur_col >= $_cols} {
+ set _cur_col [expr {$_cols - 1}]
}
}
+}
- # Erase in Display.
- #
- # https://vt100.net/docs/vt510-rm/ED.html
- proc _csi_J {args} {
- set arg [_default [lindex $args 0] 0]
-
- _log_cur "Erase in Display ($arg)" {
- variable _cur_col
- variable _cur_row
- variable _rows
- variable _cols
-
- if {$arg == 0} {
- # Cursor (inclusive) to end of display.
- _clear_in_line $_cur_col $_cols $_cur_row
- _clear_lines [expr {$_cur_row + 1}] $_rows
- } elseif {$arg == 1} {
- # Beginning of display to cursor (inclusive).
- _clear_lines 0 $_cur_row
- _clear_in_line 0 [expr $_cur_col + 1] $_cur_row
- } elseif {$arg == 2} {
- # Entire display.
- _clear_lines 0 $_rows
- }
+# Erase in Display.
+#
+# https://vt100.net/docs/vt510-rm/ED.html
+proc Term::_csi_J {args} {
+ set arg [_default [lindex $args 0] 0]
+
+ _log_cur "Erase in Display ($arg)" {
+ variable _cur_col
+ variable _cur_row
+ variable _rows
+ variable _cols
+
+ if {$arg == 0} {
+ # Cursor (inclusive) to end of display.
+ _clear_in_line $_cur_col $_cols $_cur_row
+ _clear_lines [expr {$_cur_row + 1}] $_rows
+ } elseif {$arg == 1} {
+ # Beginning of display to cursor (inclusive).
+ _clear_lines 0 $_cur_row
+ _clear_in_line 0 [expr $_cur_col + 1] $_cur_row
+ } elseif {$arg == 2} {
+ # Entire display.
+ _clear_lines 0 $_rows
}
}
+}
- # Erase in Line.
- #
- # https://vt100.net/docs/vt510-rm/EL.html
- proc _csi_K {args} {
- set arg [_default [lindex $args 0] 0]
+# Erase in Line.
+#
+# https://vt100.net/docs/vt510-rm/EL.html
+proc Term::_csi_K {args} {
+ set arg [_default [lindex $args 0] 0]
- _log_cur "Erase in Line ($arg)" {
- variable _cur_col
- variable _cur_row
- variable _cols
+ _log_cur "Erase in Line ($arg)" {
+ variable _cur_col
+ variable _cur_row
+ variable _cols
- if {$arg == 0} {
- # Cursor (inclusive) to end of line.
- _clear_in_line $_cur_col $_cols $_cur_row
- } elseif {$arg == 1} {
- # Beginning of line to cursor (inclusive).
- _clear_in_line 0 [expr $_cur_col + 1] $_cur_row
- } elseif {$arg == 2} {
- # Entire line.
- _clear_in_line 0 $_cols $_cur_row
- }
+ if {$arg == 0} {
+ # Cursor (inclusive) to end of line.
+ _clear_in_line $_cur_col $_cols $_cur_row
+ } elseif {$arg == 1} {
+ # Beginning of line to cursor (inclusive).
+ _clear_in_line 0 [expr $_cur_col + 1] $_cur_row
+ } elseif {$arg == 2} {
+ # Entire line.
+ _clear_in_line 0 $_cols $_cur_row
}
}
+}
- # Insert Line
- #
- # https://vt100.net/docs/vt510-rm/IL.html
- proc _csi_L {args} {
- set arg [_default [lindex $args 0] 1]
+# Insert Line
+#
+# https://vt100.net/docs/vt510-rm/IL.html
+proc Term::_csi_L {args} {
+ set arg [_default [lindex $args 0] 1]
- _log_cur "Insert Line ($arg)" {
- variable _cur_col
- variable _cur_row
- variable _rows
- variable _cols
- variable _chars
+ _log_cur "Insert Line ($arg)" {
+ variable _cur_col
+ variable _cur_row
+ variable _rows
+ variable _cols
+ variable _chars
- set y [expr $_rows - 2]
- set next_y [expr $y + $arg]
- while {$y >= $_cur_row} {
- for {set x 0} {$x < $_cols} {incr x} {
- set _chars($x,$next_y) $_chars($x,$y)
- }
- incr y -1
- incr next_y -1
+ set y [expr $_rows - 2]
+ set next_y [expr $y + $arg]
+ while {$y >= $_cur_row} {
+ for {set x 0} {$x < $_cols} {incr x} {
+ set _chars($x,$next_y) $_chars($x,$y)
}
-
- _clear_lines $_cur_row [expr $_cur_row + $arg]
+ incr y -1
+ incr next_y -1
}
+
+ _clear_lines $_cur_row [expr $_cur_row + $arg]
}
+}
- # Delete line.
- #
- # https://vt100.net/docs/vt510-rm/DL.html
- proc _csi_M {args} {
- set count [_default [lindex $args 0] 1]
+# Delete line.
+#
+# https://vt100.net/docs/vt510-rm/DL.html
+proc Term::_csi_M {args} {
+ set count [_default [lindex $args 0] 1]
- _log_cur "Delete line ($count)" {
- variable _cur_row
- variable _rows
- variable _cols
- variable _chars
+ _log_cur "Delete line ($count)" {
+ variable _cur_row
+ variable _rows
+ variable _cols
+ variable _chars
- set y $_cur_row
- set next_y [expr {$y + $count}]
- while {$next_y < $_rows} {
- for {set x 0} {$x < $_cols} {incr x} {
- set _chars($x,$y) $_chars($x,$next_y)
- }
- incr y
- incr next_y
+ set y $_cur_row
+ set next_y [expr {$y + $count}]
+ while {$next_y < $_rows} {
+ for {set x 0} {$x < $_cols} {incr x} {
+ set _chars($x,$y) $_chars($x,$next_y)
}
- _clear_lines $y $_rows
+ incr y
+ incr next_y
}
+ _clear_lines $y $_rows
}
+}
- # Delete Character.
- #
- # https://vt100.net/docs/vt510-rm/DCH.html
- proc _csi_P {args} {
- set count [_default [lindex $args 0] 1]
-
- _log_cur "Delete character ($count)" {
- variable _cur_row
- variable _cur_col
- variable _chars
- variable _cols
+# Delete Character.
+#
+# https://vt100.net/docs/vt510-rm/DCH.html
+proc Term::_csi_P {args} {
+ set count [_default [lindex $args 0] 1]
- # Move all characters right of the cursor N positions left.
- set out_col [expr $_cur_col]
- set in_col [expr $_cur_col + $count]
+ _log_cur "Delete character ($count)" {
+ variable _cur_row
+ variable _cur_col
+ variable _chars
+ variable _cols
- while {$in_col < $_cols} {
- set _chars($out_col,$_cur_row) $_chars($in_col,$_cur_row)
- incr in_col
- incr out_col
- }
+ # Move all characters right of the cursor N positions left.
+ set out_col [expr $_cur_col]
+ set in_col [expr $_cur_col + $count]
- # Clear the rest of the line.
- _clear_in_line $out_col $_cols $_cur_row
+ while {$in_col < $_cols} {
+ set _chars($out_col,$_cur_row) $_chars($in_col,$_cur_row)
+ incr in_col
+ incr out_col
}
+
+ # Clear the rest of the line.
+ _clear_in_line $out_col $_cols $_cur_row
}
+}
- # Pan Down
- #
- # https://vt100.net/docs/vt510-rm/SU.html
- proc _csi_S {args} {
- set count [_default [lindex $args 0] 1]
+# Pan Down
+#
+# https://vt100.net/docs/vt510-rm/SU.html
+proc Term::_csi_S {args} {
+ set count [_default [lindex $args 0] 1]
- _log_cur "Pan Down ($count)" {
- variable _cur_col
- variable _cur_row
- variable _cols
- variable _rows
- variable _chars
+ _log_cur "Pan Down ($count)" {
+ variable _cur_col
+ variable _cur_row
+ variable _cols
+ variable _rows
+ variable _chars
- # The following code is written without consideration for
- # the scroll margins. At this time this comment was
- # written the tuiterm library doesn't support the scroll
- # margins. If/when that changes, then the following will
- # need to be updated.
+ # The following code is written without consideration for
+ # the scroll margins. At this time this comment was
+ # written the tuiterm library doesn't support the scroll
+ # margins. If/when that changes, then the following will
+ # need to be updated.
- set dy 0
- set y $count
+ set dy 0
+ set y $count
- while {$y < $_rows} {
- for {set x 0} {$x < $_cols} {incr x} {
- set _chars($x,$dy) $_chars($x,$y)
- }
- incr y 1
- incr dy 1
+ while {$y < $_rows} {
+ for {set x 0} {$x < $_cols} {incr x} {
+ set _chars($x,$dy) $_chars($x,$y)
}
-
- _clear_lines $dy $_rows
+ incr y 1
+ incr dy 1
}
+
+ _clear_lines $dy $_rows
}
+}
- # Pan Up
- #
- # https://vt100.net/docs/vt510-rm/SD.html
- proc _csi_T {args} {
- set count [_default [lindex $args 0] 1]
+# Pan Up
+#
+# https://vt100.net/docs/vt510-rm/SD.html
+proc Term::_csi_T {args} {
+ set count [_default [lindex $args 0] 1]
- _log_cur "Pan Up ($count)" {
- variable _cur_col
- variable _cur_row
- variable _cols
- variable _rows
- variable _chars
+ _log_cur "Pan Up ($count)" {
+ variable _cur_col
+ variable _cur_row
+ variable _cols
+ variable _rows
+ variable _chars
- # The following code is written without consideration for
- # the scroll margins. At this time this comment was
- # written the tuiterm library doesn't support the scroll
- # margins. If/when that changes, then the following will
- # need to be updated.
+ # The following code is written without consideration for
+ # the scroll margins. At this time this comment was
+ # written the tuiterm library doesn't support the scroll
+ # margins. If/when that changes, then the following will
+ # need to be updated.
- set y [expr $_rows - $count]
- set dy $_rows
+ set y [expr $_rows - $count]
+ set dy $_rows
- while {$dy >= $count} {
- for {set x 0} {$x < $_cols} {incr x} {
- set _chars($x,$dy) $_chars($x,$y)
- }
- incr y -1
- incr dy -1
+ while {$dy >= $count} {
+ for {set x 0} {$x < $_cols} {incr x} {
+ set _chars($x,$dy) $_chars($x,$y)
}
-
- _clear_lines 0 $count
+ incr y -1
+ incr dy -1
}
+
+ _clear_lines 0 $count
}
+}
- # Erase chars.
- #
- # https://vt100.net/docs/vt510-rm/ECH.html
- proc _csi_X {args} {
- set n [_default [lindex $args 0] 1]
+# Erase chars.
+#
+# https://vt100.net/docs/vt510-rm/ECH.html
+proc Term::_csi_X {args} {
+ set n [_default [lindex $args 0] 1]
- _log_cur "Erase chars ($n)" {
- # Erase characters but don't move cursor.
- variable _cur_col
- variable _cur_row
- variable _attrs
- variable _chars
+ _log_cur "Erase chars ($n)" {
+ # Erase characters but don't move cursor.
+ variable _cur_col
+ variable _cur_row
+ variable _attrs
+ variable _chars
- set lattr [array get _attrs]
- set x $_cur_col
- for {set i 0} {$i < $n} {incr i} {
- set _chars($x,$_cur_row) [list " " $lattr]
- incr x
- }
+ set lattr [array get _attrs]
+ set x $_cur_col
+ for {set i 0} {$i < $n} {incr i} {
+ set _chars($x,$_cur_row) [list " " $lattr]
+ incr x
}
}
+}
- # Cursor Backward Tabulation.
- #
- # https://vt100.net/docs/vt510-rm/CBT.html
- proc _csi_Z {args} {
- set n [_default [lindex $args 0] 1]
+# Cursor Backward Tabulation.
+#
+# https://vt100.net/docs/vt510-rm/CBT.html
+proc Term::_csi_Z {args} {
+ set n [_default [lindex $args 0] 1]
- _log_cur "Cursor Backward Tabulation ($n)" {
- variable _cur_col
+ _log_cur "Cursor Backward Tabulation ($n)" {
+ variable _cur_col
- set _cur_col [expr {max (int (($_cur_col - 1) / 8) * 8 - ($n - 1) * 8, 0)}]
- }
+ set _cur_col [expr {max (int (($_cur_col - 1) / 8) * 8 - ($n - 1) * 8, 0)}]
}
+}
- # Repeat.
- #
- # https://www.xfree86.org/current/ctlseqs.html (See `(REP)`)
- proc _csi_b {args} {
- set n [_default [lindex $args 0] 1]
+# Repeat.
+#
+# https://www.xfree86.org/current/ctlseqs.html (See `(REP)`)
+proc Term::_csi_b {args} {
+ set n [_default [lindex $args 0] 1]
- _log_cur "Repeat ($n)" {
- variable _last_char
+ _log_cur "Repeat ($n)" {
+ variable _last_char
- _insert [string repeat $_last_char $n]
- }
+ _insert [string repeat $_last_char $n]
}
+}
- # Vertical Line Position Absolute.
- #
- # https://vt100.net/docs/vt510-rm/VPA.html
- proc _csi_d {args} {
- set row [_default [lindex $args 0] 1]
+# Vertical Line Position Absolute.
+#
+# https://vt100.net/docs/vt510-rm/VPA.html
+proc Term::_csi_d {args} {
+ set row [_default [lindex $args 0] 1]
- _log_cur "Vertical Line Position Absolute ($row)" {
- variable _cur_row
- variable _rows
+ _log_cur "Vertical Line Position Absolute ($row)" {
+ variable _cur_row
+ variable _rows
- set _cur_row [expr min ($row - 1, $_rows - 1)]
- }
+ set _cur_row [expr min ($row - 1, $_rows - 1)]
}
+}
- # Reset the attributes in attributes array UPVAR_NAME to the default values.
- proc _reset_attrs { upvar_name } {
- upvar $upvar_name var
- array set var {
- intensity normal
- fg default
- bg default
- underline 0
- reverse 0
- invisible 0
- blinking 0
+# Set Mode (SM, CSI h)
+#
+# https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
+proc Term::_csi_h { args } {
+ foreach item $args {
+ switch -exact -- $item {
+ 4 {
+ # Insert Mode (IRM)
+ _log "ignored: insert mode"
+ }
+ default {
+ error unsupported
+ }
}
}
+}
- # Translate the color numbers as used in proc _csi_m to a name.
- proc _color_attr { n } {
- switch -exact -- $n {
- 0 {
- return black
+# Reset Mode (RM, CSI l)
+#
+# https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
+proc Term::_csi_l { args } {
+ foreach item $args {
+ switch -exact -- $item {
+ 4 {
+ # Replace Mode (IRM)
+ _log "ignored: replace mode"
+ }
+ default {
+ error unsupported
}
+ }
+ }
+}
+
+# Set Scrolling Region (DECSTBM, CSI Ps ; Ps r)
+#
+# https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
+proc Term::_csi_r { top bottom } {
+ _log "ignored: set scrolling region"
+}
+
+# Window manipulation (XTWINOPS, CSI Ps ; Ps ; Ps t)
+#
+# https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
+proc Term::_csi_t { arg1 arg2 arg3 } {
+ if { $arg1 == 22 && $arg2 == 0 && $arg3 == 0 } {
+ _log "ignored: Save xterm icon and window title on stack"
+ return
+ }
+
+ if { $arg1 == 23 && $arg2 == 0 && $arg3 == 0 } {
+ _log "ignored: Restore xterm icon and window title from stack"
+ return
+ }
+
+ error unsupported
+}
+
+# DECSET (CSI ? h)
+#
+# https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
+proc Term::_csi_0x3f_h { args } {
+ foreach item $args {
+ switch -exact -- $item {
1 {
- return red
+ _log "ignored: Application Cursor Keys"
}
- 2 {
- return green
+ 7 {
+ _log "ignored: autowrap mode"
}
- 3 {
- return yellow
+ 1000 {
+ _log "ignored: Send Mouse X & Y on button press and release"
}
- 4 {
- return blue
+ 1006 {
+ _log "ignored: Enable SGR Mouse Mode"
}
- 5 {
- return magenta
+ 1049 {
+ _log "switch to alternate screen"
+ _set_alternate 1
}
- 6 {
- return cyan
+ default {
+ error unsupported
+ }
+ }
+ }
+}
+
+# DECRST (CSI ? l)
+#
+# https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
+proc Term::_csi_0x3f_l { args } {
+ foreach item $args {
+ switch -exact -- $item {
+ 1 {
+ _log "ignored: Normal Cursor Keys"
}
7 {
- return white
+ _log "ignored: no autowrap mode"
+ }
+ 1000 {
+ _log "ignored: Don't send Mouse X & Y on button press and release"
+ }
+ 1006 {
+ _log "ignored: Disable SGR Mouse Mode"
+ }
+ 1049 {
+ _log "switch from alternate screen"
+ _set_alternate 0
+ }
+ default {
+ error "unsupported"
}
- default { error "unsupported color number: $n" }
}
}
+}
- # Select Graphic Rendition.
- #
- # https://vt100.net/docs/vt510-rm/SGR.html
- proc _csi_m {args} {
- _log_cur "Select Graphic Rendition ([join $args {, }])" {
- variable _attrs
+# Reset the attributes in attributes array UPVAR_NAME to the default values.
+proc Term::_reset_attrs { upvar_name } {
+ upvar $upvar_name var
+ array set var {
+ intensity normal
+ fg default
+ bg default
+ underline 0
+ reverse 0
+ invisible 0
+ blinking 0
+ }
+}
- foreach item $args {
- switch -exact -- $item {
- "" - 0 {
- _reset_attrs _attrs
- }
- 1 {
- set _attrs(intensity) bold
- }
- 2 {
- set _attrs(intensity) dim
- }
- 4 {
- set _attrs(underline) 1
- }
- 5 {
- set _attrs(blinking) 1
- }
- 7 {
- set _attrs(reverse) 1
- }
- 8 {
- set _attrs(invisible) 1
- }
- 22 {
- set _attrs(intensity) normal
- }
- 24 {
- set _attrs(underline) 0
- }
- 25 {
- set _attrs(blinking) 0
- }
- 27 {
- set _attrs(reverse) 0
- }
- 28 {
- set _attrs(invisible) 0
- }
- 30 - 31 - 32 - 33 - 34 - 35 - 36 - 37 {
- set _attrs(fg) [_color_attr [expr $item - 30]]
- }
- 39 {
- set _attrs(fg) default
- }
- 40 - 41 - 42 - 43 - 44 - 45 - 46 - 47 {
- set _attrs(bg) [_color_attr [expr $item - 40]]
- }
- 49 {
- set _attrs(bg) default
- }
+# Translate the color numbers as used in proc _csi_m to a name.
+proc Term::_color_attr { n } {
+ switch -exact -- $n {
+ 0 {
+ return black
+ }
+ 1 {
+ return red
+ }
+ 2 {
+ return green
+ }
+ 3 {
+ return yellow
+ }
+ 4 {
+ return blue
+ }
+ 5 {
+ return magenta
+ }
+ 6 {
+ return cyan
+ }
+ 7 {
+ return white
+ }
+ default { error "unsupported color number: $n" }
+ }
+}
+
+# Select Graphic Rendition.
+#
+# https://vt100.net/docs/vt510-rm/SGR.html
+proc Term::_csi_m {args} {
+ if { [llength $args] == 0 } {
+ # Apply default.
+ set args [list 0]
+ }
+
+ _log_cur "Select Graphic Rendition ([join $args {, }])" {
+ variable _attrs
+
+ foreach item $args {
+ switch -exact -- $item {
+ "" - 0 {
+ _reset_attrs _attrs
+ }
+ 1 {
+ set _attrs(intensity) bold
+ }
+ 2 {
+ set _attrs(intensity) dim
+ }
+ 4 {
+ set _attrs(underline) 1
+ }
+ 5 {
+ set _attrs(blinking) 1
+ }
+ 7 {
+ set _attrs(reverse) 1
+ }
+ 8 {
+ set _attrs(invisible) 1
+ }
+ 22 {
+ set _attrs(intensity) normal
+ }
+ 24 {
+ set _attrs(underline) 0
+ }
+ 25 {
+ set _attrs(blinking) 0
+ }
+ 27 {
+ set _attrs(reverse) 0
+ }
+ 28 {
+ set _attrs(invisible) 0
+ }
+ 30 - 31 - 32 - 33 - 34 - 35 - 36 - 37 {
+ set _attrs(fg) [_color_attr [expr $item - 30]]
+ }
+ 39 {
+ set _attrs(fg) default
+ }
+ 40 - 41 - 42 - 43 - 44 - 45 - 46 - 47 {
+ set _attrs(bg) [_color_attr [expr $item - 40]]
+ }
+ 49 {
+ set _attrs(bg) default
}
}
}
}
+}
- # Insert string at the cursor location.
- proc _insert {str} {
- _log_cur "Inserted string '$str'" {
- _log "Inserting string '$str'"
-
- variable _cur_col
- variable _cur_row
- variable _rows
- variable _cols
- variable _attrs
- variable _chars
- set lattr [array get _attrs]
- foreach char [split $str {}] {
- _log_cur " Inserted char '$char'" {
- set _chars($_cur_col,$_cur_row) [list $char $lattr]
- incr _cur_col
- if {$_cur_col >= $_cols} {
- set _cur_col 0
- incr _cur_row
- if {$_cur_row >= $_rows} {
- error "FIXME scroll"
- }
+# Request Terminal Parameters (DECREQTPARM)
+#
+# https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
+# https://vt100.net/docs/vt100-ug/chapter3.html
+proc Term::_csi_x {} {
+ # Ignore.
+}
+
+# Insert string at the cursor location.
+proc Term::_insert {str} {
+ _log_cur "Inserted string '$str'" {
+ _log "Inserting string '$str'"
+
+ variable _cur_col
+ variable _cur_row
+ variable _rows
+ variable _cols
+ variable _attrs
+ variable _chars
+ set lattr [array get _attrs]
+ foreach char [split $str {}] {
+ _log_cur " Inserted char '$char'" {
+ set _chars($_cur_col,$_cur_row) [list $char $lattr]
+ incr _cur_col
+ if {$_cur_col >= $_cols} {
+ set _cur_col 0
+ incr _cur_row
+ if {$_cur_row >= $_rows} {
+ error "FIXME scroll"
}
}
}
}
+
+ variable _last_char
+ set _last_char [string index $str end]
}
+}
- # Move the cursor to the (0-based) COL and ROW positions.
- proc _move_cursor { col row } {
- variable _cols
- variable _rows
- variable _cur_col
- variable _cur_row
+# Move the cursor to the (0-based) COL and ROW positions.
+proc Term::_move_cursor { col row } {
+ variable _cols
+ variable _rows
+ variable _cur_col
+ variable _cur_row
- if { $col < 0 || $col >= $_cols } {
- error "_move_cursor: invalid col value: $col"
- }
+ if { $col < 0 || $col >= $_cols } {
+ error "_move_cursor: invalid col value: $col"
+ }
+
+ if { $row < 0 || $row >= $_rows } {
+ error "_move_cursor: invalid row value: $row"
+ }
- if { $row < 0 || $row >= $_rows } {
- error "_move_cursor: invalid row value: $row"
- }
+ set _cur_col $col
+ set _cur_row $row
+}
- set _cur_col $col
- set _cur_row $row
+# Enable or disable alternate screen.
+proc Term::_set_alternate { enable } {
+ variable _alternate
+ if { $enable == $_alternate } {
+ return
}
+ set _alternate $enable
- # Initialize.
- proc _setup {rows cols} {
- global stty_init
- set stty_init "rows $rows columns $cols"
+ variable _attrs
+ variable _chars
+ variable _cur_col
+ variable _cur_row
- variable _rows
- variable _cols
- variable _cur_col
- variable _cur_row
- variable _attrs
- variable _resize_count
+ variable _save_attrs
+ variable _save_chars
+ variable _save_cur_col
+ variable _save_cur_row
- set _rows $rows
- set _cols $cols
- set _cur_col 0
- set _cur_row 0
- set _resize_count 0
- _reset_attrs _attrs
-
- _clear_lines 0 $_rows
- }
-
- # Accept some output from gdb and update the screen.
- # Return 1 if successful, or 0 if a timeout occurred.
- proc accept_gdb_output { } {
- global expect_out
- gdb_expect {
- -re "^\[\x07\x08\x0a\x0d\]" {
- scan $expect_out(0,string) %c val
- set hexval [format "%02x" $val]
- _log "wait_for: _ctl_0x${hexval}"
- _ctl_0x${hexval}
- }
- -re "^\x1b(\[0-9a-zA-Z\])" {
- _log "wait_for: unsupported escape"
- error "unsupported escape"
- }
- -re "^\x1b\\\[(\[0-9;\]*)(\[a-zA-Z@\])" {
- set cmd $expect_out(2,string)
- set params [split $expect_out(1,string) ";"]
- _log "wait_for: _csi_$cmd <<<$expect_out(1,string)>>>"
- eval _csi_$cmd $params
- }
- -re "^\[^\x07\x08\x0a\x0d\x1b\]+" {
- _insert $expect_out(0,string)
- variable _last_char
- set _last_char [string index $expect_out(0,string) end]
- }
+ variable _alternate_setup
- timeout {
- # Assume a timeout means we somehow missed the
- # expected result, and carry on.
- warning "timeout in accept_gdb_output"
- dump_screen
- return 0
- }
- }
+ if { $_alternate_setup } {
+ set tmp $_save_chars
+ }
+ set _save_chars [array get _chars]
+ if { $_alternate_setup } {
+ array set _chars $tmp
+ }
- return 1
+ if { $_alternate_setup } {
+ set tmp $_save_attrs
+ }
+ set _save_attrs [array get _attrs]
+ if { $_alternate_setup } {
+ array set _attrs $tmp
}
- # Print arg using "verbose -log" if DEBUG_TUI_MATCHING == 1.
- proc debug_tui_matching { arg } {
- set debug 0
- if { [info exists ::DEBUG_TUI_MATCHING] } {
- set debug $::DEBUG_TUI_MATCHING
- }
+ if { $_alternate_setup } {
+ set tmp $_save_cur_col
+ }
+ set _save_cur_col $_cur_col
+ if { $_alternate_setup } {
+ set _cur_col $tmp
+ }
- if { ! $debug } {
- return
- }
+ if { $_alternate_setup } {
+ set tmp $_save_cur_row
+ }
+ set _save_cur_row $_cur_row
+ if { $_alternate_setup } {
+ set _cur_row $tmp
+ }
- verbose -log "$arg"
+ if { ! $_alternate_setup } {
+ variable _rows
+ variable _cols
+ _setup $_rows $_cols
+ set _alternate_setup 1
}
+}
- # Accept some output from gdb and update the screen. WAIT_FOR is
- # a regexp matching the line to wait for. Return 0 on timeout, 1
- # on success.
- proc wait_for {wait_for} {
- global gdb_prompt
- variable _cur_col
- variable _cur_row
+# Initialize.
+proc Term::_setup {rows cols} {
+ global stty_init
+ set stty_init "rows $rows columns $cols"
+
+ variable _rows
+ variable _cols
+ variable _cur_col
+ variable _cur_row
+ variable _attrs
+ variable _resize_count
+
+ set _rows $rows
+ set _cols $cols
+ set _cur_col 0
+ set _cur_row 0
+ set _resize_count 0
+ _reset_attrs _attrs
- set fn "wait_for"
+ _clear_lines 0 $_rows
+}
- set prompt_wait_for "(^|\\|)$gdb_prompt \$"
- if { $wait_for == "" } {
- set wait_for $prompt_wait_for
+# Accept some output from gdb and update the screen.
+# Return 1 if successful, or 0 if a timeout occurred.
+proc Term::accept_gdb_output { {warn 1} } {
+ global expect_out
+
+ set ctls "\x07\x08\x0a\x0d"
+ set esc "\x1b"
+ set re_ctls "\[$ctls\]"
+ set re_others "\[^$esc$ctls\]"
+ set have_esc 0
+ gdb_expect {
+ -re ^$re_ctls {
+ scan $expect_out(0,string) %c val
+ set hexval [format "%02x" $val]
+ _log "wait_for: _ctl_0x${hexval}"
+ _ctl_0x${hexval}
+ }
+ -re "^$esc" {
+ _log "wait_for: ESC"
+ set have_esc 1
+ }
+ -re "^$re_others+" {
+ _insert $expect_out(0,string)
+ }
+
+ timeout {
+ # Assume a timeout means we somehow missed the
+ # expected result, and carry on.
+ warning "timeout in accept_gdb_output"
+ dump_screen
+ return 0
}
+ }
- debug_tui_matching "$fn: regexp: '$wait_for'"
+ if { !$have_esc } {
+ return 1
+ }
- while 1 {
- if { [accept_gdb_output] == 0 } {
- return 0
- }
+ set re_csi [string_to_regexp "\["]
+ set have_csi 0
+ gdb_expect {
+ -re "^(\[0-9a-zA-Z\])" {
+ _log "wait_for: unsupported escape"
+ error "unsupported escape"
+ }
+ -re "^(\[\\(\])(\[a-zA-Z\])" {
+ scan $expect_out(1,string) %c val
+ set hexval [format "%02x" $val]
+ set cmd $expect_out(2,string)
+ _esc_0x${hexval}_$cmd
+ }
+ -re "^(\[=>\])" {
+ scan $expect_out(1,string) %c val
+ set hexval [format "%02x" $val]
+ _esc_0x$hexval
+ }
+ -re "^$re_csi" {
+ _log "wait_for: CSI"
+ set have_csi 1
+ }
- # If the cursor appears just after the prompt, return. It
- # isn't reliable to check this only after an insertion,
- # because curses may make "unusual" redrawing decisions.
- if {$wait_for == "$prompt_wait_for"} {
- set prev [get_line $_cur_row $_cur_col]
- } else {
- set prev [get_line $_cur_row]
- }
- if {[regexp -- $wait_for $prev]} {
- debug_tui_matching "$fn: match: '$prev'"
- if {$wait_for == "$prompt_wait_for"} {
- break
- }
- set wait_for $prompt_wait_for
- debug_tui_matching "$fn: regexp prompt: '$wait_for'"
- } else {
- debug_tui_matching "$fn: mismatch: '$prev'"
+ timeout {
+ # Assume a timeout means we somehow missed the
+ # expected result, and carry on.
+ if { $warn } {
+ warning "timeout in accept_gdb_output following ESC"
+ dump_screen
}
+ _insert "^\["
+ return 0
}
+ }
+ if { !$have_csi } {
return 1
}
- # Accept some output from gdb and update the screen. Wait for the screen
- # region X/Y/WIDTH/HEIGTH to matches REGEXP. Return 0 on timeout, 1 on
- # success.
- proc wait_for_region_contents {x y width height regexp} {
- while 1 {
- if { [accept_gdb_output] == 0 } {
- return 0
- }
-
- if { [check_region_contents_p $x $y $width $height $regexp] } {
- break
+ set re_csi_prefix {[?]}
+ set re_csi_args {[0-9;]}
+ set re_csi_cmd {[a-zA-Z@`]}
+ gdb_expect {
+ -re "^($re_csi_cmd)" {
+ set cmd $expect_out(1,string)
+ _log "wait_for: _csi_$cmd"
+ _csi_$cmd
+ }
+ -re "^($re_csi_args*)($re_csi_cmd)" {
+ set params [split $expect_out(1,string) ";"]
+ set cmd $expect_out(2,string)
+ _log "wait_for: _csi_$cmd <<<$params>>>"
+ _csi_$cmd {*}$params
+ }
+ -re "^($re_csi_prefix?)($re_csi_args*)($re_csi_cmd)" {
+ set prefix $expect_out(1,string)
+ set params [split $expect_out(2,string) ";"]
+ set cmd $expect_out(3,string)
+ scan $prefix %c val
+ set hexval [format "%02x" $val]
+ _log "wait_for: _csi_0x${hexval}_$cmd <<<$expect_out(1,string)>>>"
+ _csi_0x${hexval}_$cmd {*}$params
+ }
+
+ timeout {
+ # Assume a timeout means we somehow missed the
+ # expected result, and carry on.
+ if { $warn } {
+ warning "timeout in accept_gdb_output following CSI"
+ dump_screen
}
+ _insert "^\[\["
+ return 0
}
+ }
- return 1
+ return 1
+}
+
+# Print arg using "verbose -log" if DEBUG_TUI_MATCHING == 1.
+proc Term::debug_tui_matching { arg } {
+ set debug 0
+ if { [info exists ::DEBUG_TUI_MATCHING] } {
+ set debug $::DEBUG_TUI_MATCHING
}
- # Setup the terminal with dimensions ROWSxCOLS, TERM=ansi, and execute
- # BODY.
- proc with_tuiterm {rows cols body} {
- global env stty_init
- save_vars {env(TERM) env(NO_COLOR) stty_init} {
- setenv TERM ansi
- setenv NO_COLOR ""
- _setup $rows $cols
+ if { ! $debug } {
+ return
+ }
- uplevel $body
- }
+ verbose -log "$arg"
+}
+
+# Accept some output from gdb and update the screen. WAIT_FOR is
+# a regexp matching the line to wait for. Return 0 on timeout, 1
+# on success.
+proc Term::wait_for {wait_for} {
+ global gdb_prompt
+ variable _cur_col
+ variable _cur_row
+
+ set fn "wait_for"
+
+ set prompt_wait_for "(^|\\|)$gdb_prompt \$"
+ if { $wait_for == "" } {
+ set wait_for $prompt_wait_for
}
- # Like ::clean_restart, but ensures that gdb starts in an
- # environment where the TUI can work. ROWS and COLS are the size
- # of the terminal. EXECUTABLE, if given, is passed to
- # clean_restart.
- proc clean_restart {rows cols {executable {}}} {
- with_tuiterm $rows $cols {
- save_vars { ::GDBFLAGS } {
- # Make GDB not print the directory names. Use this setting to
- # remove the differences in test runs due to varying directory
- # names.
- append ::GDBFLAGS " -ex \"set filename-display basename\""
+ debug_tui_matching "$fn: regexp: '$wait_for'"
- if {$executable == ""} {
- ::clean_restart
- } else {
- ::clean_restart $executable
- }
- }
+ while 1 {
+ if { [accept_gdb_output] == 0 } {
+ return 0
+ }
- ::gdb_test_no_output "set pagination off"
+ # If the cursor appears just after the prompt, return. It
+ # isn't reliable to check this only after an insertion,
+ # because curses may make "unusual" redrawing decisions.
+ if {$wait_for == "$prompt_wait_for"} {
+ set prev [get_line $_cur_row $_cur_col]
+ } else {
+ set prev [get_line $_cur_row]
}
- }
- # Generate prompt on TUIterm.
- proc gen_prompt {} {
- # Generate a prompt.
- send_gdb "echo\n"
+ if { ![regexp -- $wait_for $prev] } {
+ debug_tui_matching "$fn: mismatch: '$prev'"
+ continue
+ }
- # Drain the output before the prompt.
- gdb_expect {
- -re "echo\r\n" {
+ if {$wait_for == "$prompt_wait_for"} {
+ # We've detected that the cursor is just after the prompt.
+ # Now check that there's nothing else on the line.
+ set prev [get_line $_cur_row]
+ if { ![regexp -- "(^|\\|)$gdb_prompt +($|\\||\\+)" $prev] } {
+ debug_tui_matching "$fn: mismatch: '$prev'"
+ continue
}
}
- # Interpret prompt using TUIterm.
- wait_for ""
- }
+ debug_tui_matching "$fn: match: '$prev'"
- # Setup ready for starting the tui, but don't actually start it.
- # Returns 1 on success, 0 if TUI tests should be skipped.
- proc prepare_for_tui {} {
- if { [is_remote host] } {
- # In clean_restart, we're using "setenv TERM ansi", which has
- # effect on build. If we have [is_remote host] == 0, so
- # build == host, then it also has effect on host. But for
- # [is_remote host] == 1, it has no effect on host.
- return 0
+ if {$wait_for == "$prompt_wait_for"} {
+ # Matched the prompt, we're done.
+ break
}
- if {![allow_tui_tests]} {
+ # Now try to match the prompt.
+ set wait_for $prompt_wait_for
+ debug_tui_matching "$fn: regexp prompt: '$wait_for'"
+ }
+
+ return 1
+}
+
+# Accept some output from gdb and update the screen. Wait for the screen
+# region X/Y/WIDTH/HEIGTH to matches REGEXP. Return 0 on timeout, 1 on
+# success.
+proc Term::wait_for_region_contents {x y width height regexp} {
+ while 1 {
+ if { [accept_gdb_output] == 0 } {
return 0
}
- gdb_test_no_output "set tui border-kind ascii"
- gdb_test_no_output "maint set tui-resize-message on"
- return 1
+ if { [check_region_contents_p $x $y $width $height $regexp] } {
+ break
+ }
}
- # Start the TUI. Returns 1 on success, 0 if TUI tests should be
- # skipped.
- proc enter_tui {} {
- if {![prepare_for_tui]} {
+ return 1
+}
+
+# Accept some output from gdb and update the screen. Wait for the current
+# screen line to match REGEXP and cursor position POS, unless POS is empty.
+# Return 0 on timeout, 1 on success.
+proc Term::wait_for_line { regexp {pos ""} } {
+ variable _cur_row
+ variable _cur_col
+ variable _cols
+
+ while 1 {
+ if { [accept_gdb_output] == 0 } {
return 0
}
- command_no_prompt_prefix "tui enable"
- return 1
- }
+ if { ![check_region_contents_p 0 $_cur_row $_cols 1 $regexp] } {
+ continue
+ }
- # Send the command CMD to gdb, then wait for a gdb prompt to be
- # seen in the TUI. CMD should not end with a newline -- that will
- # be supplied by this function.
- proc command {cmd} {
- global gdb_prompt
- send_gdb "$cmd\n"
- set str [string_to_regexp $cmd]
- set str "(^|\\|)$gdb_prompt $str"
- wait_for $str
- }
-
- # As proc command, but don't wait for an initial prompt. This is used for
- # initial terminal commands, where there's no prompt yet.
- proc command_no_prompt_prefix {cmd} {
- gen_prompt
- command $cmd
- }
-
- # Apply the attribute list in ATTRS to attributes array UPVAR_NAME.
- # Return a string annotating the changed attributes.
- proc apply_attrs { upvar_name attrs } {
- set res ""
- upvar $upvar_name var
- foreach { attr val } $attrs {
- if { $var($attr) != $val } {
- append res "<$attr:$val>"
- set var($attr) $val
- }
+ if { $pos == "" || $_cur_col == $pos } {
+ break
}
+ }
- return $res
+ return 1
+}
+
+# In BODY, when using Term::with_tuiterm, use TERM instead of the default.
+
+proc Term::with_term { term body } {
+ save_vars { Term::_TERM } {
+ set Term::_TERM $term
+ uplevel $body
}
+}
- # Return the text of screen line N. Lines are 0-based. If C is given,
- # stop before column C. Columns are also zero-based. If ATTRS, annotate
- # with attributes.
- proc get_line_1 {n c attrs} {
- variable _rows
- # This can happen during resizing, if the cursor seems to
- # temporarily be off-screen.
- if {$n >= $_rows} {
- return ""
+# Setup the terminal with dimensions ROWSxCOLS, TERM=ansi, and execute
+# BODY.
+proc Term::with_tuiterm {rows cols body} {
+ global env stty_init
+ variable _TERM
+ save_vars {env(TERM) env(NO_COLOR) stty_init} {
+ if { $Term::_TERM != "" } {
+ setenv TERM $Term::_TERM
+ } elseif { [ishost *-*-*bsd*] } {
+ setenv TERM ansiw
+ } else {
+ setenv TERM ansi
}
+ # Save active TERM variable.
+ set Term::_TERM $env(TERM)
- set result ""
- variable _cols
- variable _chars
- set c [_default $c $_cols]
- set x 0
- if { $attrs } {
- _reset_attrs line_attrs
- }
- while {$x < $c} {
- if { $attrs } {
- set char_attrs [lindex $_chars($x,$n) 1]
- append result [apply_attrs line_attrs $char_attrs]
+ setenv NO_COLOR ""
+ _setup $rows $cols
+
+ uplevel $body
+ }
+}
+
+# Like ::clean_restart, but ensures that gdb starts in an
+# environment where the TUI can work. ROWS and COLS are the size
+# of the terminal. EXECUTABLE, if given, is passed to
+# clean_restart.
+proc Term::clean_restart {rows cols {executable {}}} {
+ with_tuiterm $rows $cols {
+ save_vars { ::GDBFLAGS } {
+ # Make GDB not print the directory names. Use this setting to
+ # remove the differences in test runs due to varying directory
+ # names.
+ append ::GDBFLAGS " -ex \"set filename-display basename\""
+
+ if {$executable == ""} {
+ ::clean_restart
+ } else {
+ ::clean_restart $executable
}
- append result [lindex $_chars($x,$n) 0]
- incr x
}
- if { $attrs } {
- _reset_attrs zero_attrs
- set char_attrs [array get zero_attrs]
- append result [apply_attrs line_attrs $char_attrs]
+
+ ::gdb_test_no_output "set pagination off"
+ }
+}
+
+# Generate prompt on TUIterm.
+proc Term::gen_prompt {} {
+ # Generate a prompt.
+ send_gdb "echo\n"
+
+ # Drain the output before the prompt.
+ gdb_expect {
+ -re "echo\r\n" {
}
- return $result
}
- # Return the text of screen line N, without attributes. Lines are
- # 0-based. If C is given, stop before column C. Columns are also
- # zero-based.
- proc get_line {n {c ""} } {
- return [get_line_1 $n $c 0]
+ # Interpret prompt using TUIterm.
+ wait_for ""
+}
+
+# Setup ready for starting the tui, but don't actually start it.
+# Returns 1 on success, 0 if TUI tests should be skipped.
+proc Term::prepare_for_tui {} {
+ if { [is_remote host] } {
+ # In clean_restart, we're using "setenv TERM ansi", which has
+ # effect on build. If we have [is_remote host] == 0, so
+ # build == host, then it also has effect on host. But for
+ # [is_remote host] == 1, it has no effect on host.
+ return 0
}
- # As get_line, but annotate with attributes.
- proc get_line_with_attrs {n {c ""}} {
- return [get_line_1 $n $c 1]
+ if {![allow_tui_tests]} {
+ return 0
}
- # Get just the character at (X, Y).
- proc get_char {x y} {
- variable _chars
- return [lindex $_chars($x,$y) 0]
+ gdb_test_no_output "set tui border-kind ascii"
+ gdb_test_no_output "maint set tui-resize-message on"
+ # When matching GDB output using Term::wait_for, the number of
+ # matching attempts in wait_for can be influenced by CLI styling.
+ # Disable it by default to avoid this.
+ gdb_test_no_output "set style enabled off"
+ return 1
+}
+
+# Start the TUI. Returns 1 on success, 0 if TUI tests should be
+# skipped.
+proc Term::enter_tui {} {
+ if {![prepare_for_tui]} {
+ return 0
}
- # Get the entire screen as a string.
- proc get_all_lines {} {
- variable _rows
- variable _cols
- variable _chars
+ command_no_prompt_prefix "tui enable"
+ return 1
+}
- set result ""
- for {set y 0} {$y < $_rows} {incr y} {
- for {set x 0} {$x < $_cols} {incr x} {
- append result [lindex $_chars($x,$y) 0]
- }
- append result "\n"
+# Send the command CMD to gdb, then wait for a gdb prompt to be
+# seen in the TUI. CMD should not end with a newline -- that will
+# be supplied by this function.
+proc Term::command {cmd} {
+ global gdb_prompt
+ send_gdb "$cmd\n"
+ set str [string_to_regexp $cmd]
+ set str "(^|\\|)$gdb_prompt $str"
+ wait_for $str
+}
+
+# As proc command, but don't wait for an initial prompt. This is used for
+# initial terminal commands, where there's no prompt yet.
+proc Term::command_no_prompt_prefix {cmd} {
+ gen_prompt
+ command $cmd
+}
+
+# Apply the attribute list in ATTRS to attributes array UPVAR_NAME.
+# Return a string annotating the changed attributes.
+proc Term::apply_attrs { upvar_name attrs } {
+ set res ""
+ upvar $upvar_name var
+ foreach { attr val } $attrs {
+ if { $var($attr) != $val } {
+ append res "<$attr:$val>"
+ set var($attr) $val
}
+ }
- return $result
+ return $res
+}
+
+# Return the text of screen line N. Lines are 0-based. Start at column
+# X. If C is non-empty, stop before column C. Columns are also
+# zero-based. If ATTRS, annotate with attributes.
+proc Term::get_string {n x c {attrs 0}} {
+ variable _rows
+ # This can happen during resizing, if the cursor seems to
+ # temporarily be off-screen.
+ if {$n >= $_rows} {
+ return ""
}
- # Get the text just before the cursor.
- proc get_current_line {} {
- variable _cur_col
- variable _cur_row
- return [get_line $_cur_row $_cur_col]
+ set result ""
+ variable _cols
+ variable _chars
+ set c [_default $c $_cols]
+ if { $attrs } {
+ _reset_attrs line_attrs
}
+ while {$x < $c} {
+ if { $attrs } {
+ set char_attrs [lindex $_chars($x,$n) 1]
+ append result [apply_attrs line_attrs $char_attrs]
+ }
+ append result [lindex $_chars($x,$n) 0]
+ incr x
+ }
+ if { $attrs } {
+ _reset_attrs zero_attrs
+ set char_attrs [array get zero_attrs]
+ append result [apply_attrs line_attrs $char_attrs]
+ }
+ return $result
+}
- # Helper function for check_box. Returns empty string if the box
- # is found, description of why not otherwise.
- proc _check_box {x y width height} {
- set x2 [expr {$x + $width - 1}]
- set y2 [expr {$y + $height - 1}]
+# Return the text of screen line N. Lines are 0-based. Start at column
+# X. If C is non-empty, stop before column C. Columns are also
+# zero-based. Annotate with attributes.
+proc Term::get_string_with_attrs { n x c } {
+ return [get_string $n $x $c 1]
+}
- verbose -log "_check_box x=$x, y=$y, x2=$x2, y2=$y2, width=$width, height=$height"
+# Return the text of screen line N. Lines are 0-based. If C is
+# non-empty, stop before column C. Columns are also zero-based. If
+# ATTRS, annotate with attributes.
+proc Term::get_line_1 {n c attrs} {
+ return [get_string $n 0 $c $attrs]
+}
- set c [get_char $x $y]
- if {$c != "+"} {
- return "ul corner is $c, not +"
- }
+# Return the text of screen line N, without attributes. Lines are
+# 0-based. If C is given, stop before column C. Columns are also
+# zero-based.
+proc Term::get_line {n {c ""} } {
+ return [get_line_1 $n $c 0]
+}
- set c [get_char $x $y2]
- if {$c != "+"} {
- return "ll corner is $c, not +"
- }
+# As get_line, but annotate with attributes.
+proc Term::get_line_with_attrs {n {c ""}} {
+ return [get_line_1 $n $c 1]
+}
- set c [get_char $x2 $y]
- if {$c != "+"} {
- return "ur corner is $c, not +"
- }
+# Get just the character at (X, Y).
+proc Term::get_char {x y} {
+ variable _chars
+ return [lindex $_chars($x,$y) 0]
+}
- set c [get_char $x2 $y2]
- if {$c != "+"} {
- return "lr corner is $c, not +"
- }
+# Get the entire screen as a string.
+proc Term::get_all_lines {} {
+ variable _rows
+ variable _cols
+ variable _chars
- # Note we do not check the full horizonal borders of the box.
- # The top will contain a title, and the bottom may as well, if
- # it is overlapped by some other border. However, at most a
- # title should appear as '+-VERY LONG TITLE-+', so we can
- # check for the '+-' on the left, and '-+' on the right.
- set c [get_char [expr {$x + 1}] $y]
- if {$c != "-"} {
- return "ul title padding is $c, not -"
+ set result ""
+ for {set y 0} {$y < $_rows} {incr y} {
+ for {set x 0} {$x < $_cols} {incr x} {
+ append result [lindex $_chars($x,$y) 0]
}
+ append result "\n"
+ }
- set c [get_char [expr {$x2 - 1}] $y]
- if {$c != "-"} {
- return "ul title padding is $c, not -"
- }
+ return $result
+}
- # Now check the vertical borders.
- for {set i [expr {$y + 1}]} {$i < $y2 - 1} {incr i} {
- set c [get_char $x $i]
- if {$c != "|"} {
- return "left side $i is $c, not |"
- }
+# Get the text just before the cursor.
+proc Term::get_current_line {} {
+ variable _cur_col
+ variable _cur_row
+ return [get_line $_cur_row $_cur_col]
+}
- set c [get_char $x2 $i]
- if {$c != "|"} {
- return "right side $i is $c, not |"
- }
- }
+# Helper function for check_box. Returns empty string if the box
+# is found, description of why not otherwise.
+proc Term::_check_box {x y width height} {
+ set x2 [expr {$x + $width - 1}]
+ set y2 [expr {$y + $height - 1}]
- return ""
+ verbose -log "_check_box x=$x, y=$y, x2=$x2, y2=$y2, width=$width, height=$height"
+
+ set c [get_char $x $y]
+ if {$c != "+"} {
+ return "ul corner is $c, not +"
}
- # Check for a box at the given coordinates.
- proc check_box {test_name x y width height} {
- dump_box $x $y $width $height
- set why [_check_box $x $y $width $height]
- if {$why == ""} {
- pass $test_name
- } else {
- fail "$test_name ($why)"
- }
+ set c [get_char $x $y2]
+ if {$c != "+"} {
+ return "ll corner is $c, not +"
}
- # Wait until a box appears at the given coordinates.
- proc wait_for_box {test_name x y width height} {
- while 1 {
- if { [accept_gdb_output] == 0 } {
- return 0
- }
+ set c [get_char $x2 $y]
+ if {$c != "+"} {
+ return "ur corner is $c, not +"
+ }
- set why [_check_box $x $y $width $height]
- if {$why == ""} {
- pass $test_name
- break
- }
- }
+ set c [get_char $x2 $y2]
+ if {$c != "+"} {
+ return "lr corner is $c, not +"
}
- # Check whether the text contents of the terminal match the
- # regular expression. Note that text styling is not considered.
- proc check_contents {test_name regexp} {
- dump_screen
- set contents [get_all_lines]
- gdb_assert {[regexp -- $regexp $contents]} $test_name
+ # Note we do not check the full horizonal borders of the box.
+ # The top will contain a title, and the bottom may as well, if
+ # it is overlapped by some other border. However, at most a
+ # title should appear as '+-VERY LONG TITLE-+', so we can
+ # check for the '+-' on the left, and '-+' on the right.
+ set c [get_char [expr {$x + 1}] $y]
+ if {$c != "-"} {
+ return "ul title padding is $c, not -"
}
- # As check_contents, but check that the text contents of the terminal does
- # not match the regular expression.
- proc check_contents_not {test_name regexp} {
- dump_screen
- set contents [get_all_lines]
- gdb_assert {![regexp -- $regexp $contents]} $test_name
+ set c [get_char [expr {$x2 - 1}] $y]
+ if {$c != "-"} {
+ return "ul title padding is $c, not -"
}
- # Get the region of the screen described by X, Y, WIDTH, and
- # HEIGHT, and separate the lines using SEP. If ATTRS is true then
- # include attribute information in the output.
- proc get_region { x y width height sep { attrs false } } {
- variable _chars
+ # Now check the vertical borders.
+ for {set i [expr {$y + 1}]} {$i < $y2 - 1} {incr i} {
+ set c [get_char $x $i]
+ if {$c != "|"} {
+ return "left side $i is $c, not |"
+ }
- if { $attrs } {
- _reset_attrs region_attrs
+ set c [get_char $x2 $i]
+ if {$c != "|"} {
+ return "right side $i is $c, not |"
}
+ }
- # Grab the contents of the box, join each line together
- # using $sep.
- set result ""
- for {set yy $y} {$yy < [expr {$y + $height}]} {incr yy} {
- if {$yy > $y} {
- # Add the end of line sequence only if this isn't the
- # first line.
- append result $sep
- }
- for {set xx $x} {$xx < [expr {$x + $width}]} {incr xx} {
- if { $attrs } {
- set char_attrs [lindex $_chars($xx,$yy) 1]
- append result [apply_attrs region_attrs $char_attrs]
- }
+ return ""
+}
- append result [get_char $xx $yy]
- }
+# Check for a box at the given coordinates.
+proc Term::check_box {test_name x y width height} {
+ dump_box $x $y $width $height
+ set why [_check_box $x $y $width $height]
+ if {$why == ""} {
+ pass $test_name
+ } else {
+ fail "$test_name ($why)"
+ }
+}
+
+# Wait until a box appears at the given coordinates.
+proc Term::wait_for_box {test_name x y width height} {
+ while 1 {
+ if { [accept_gdb_output] == 0 } {
+ return 0
}
- if { $attrs } {
- _reset_attrs zero_attrs
- set char_attrs [array get zero_attrs]
- append result [apply_attrs region_attrs $char_attrs]
+
+ set why [_check_box $x $y $width $height]
+ if {$why == ""} {
+ pass $test_name
+ break
}
- return $result
}
+}
- # Check that the region of the screen described by X, Y, WIDTH,
- # and HEIGHT match REGEXP. This is like check_contents except
- # only part of the screen is checked. This can be used to check
- # the contents within a box (though check_box_contents is a better
- # choice for boxes with a border). Return 1 if check succeeded.
- proc check_region_contents_p { x y width height regexp } {
- variable _chars
- dump_box $x $y $width $height
+# Check whether the text contents of the terminal match the
+# regular expression. Note that text styling is not considered.
+proc Term::check_contents {test_name regexp} {
+ dump_screen
+ set contents [get_all_lines]
+ gdb_assert {[regexp -- $regexp $contents]} $test_name
+}
- # Now grab the contents of the box, join each line together
- # with a '\r\n' sequence and match against REGEXP.
- set result [get_region $x $y $width $height "\r\n"]
- return [regexp -- $regexp $result]
- }
+# As check_contents, but check that the text contents of the terminal does
+# not match the regular expression.
+proc Term::check_contents_not {test_name regexp} {
+ dump_screen
+ set contents [get_all_lines]
+ gdb_assert {![regexp -- $regexp $contents]} $test_name
+}
- # Check that the region of the screen described by X, Y, WIDTH,
- # and HEIGHT match REGEXP. As check_region_contents_p, but produce
- # a pass/fail message.
- proc check_region_contents { test_name x y width height regexp } {
- set ok [check_region_contents_p $x $y $width $height $regexp]
- gdb_assert {$ok} $test_name
- }
+# Get the region of the screen described by X, Y, WIDTH, and
+# HEIGHT, and separate the lines using SEP. If ATTRS is true then
+# include attribute information in the output.
+proc Term::get_region { x y width height sep { attrs false } } {
+ variable _chars
- # Check the contents of a box on the screen. This is a little
- # like check_contents, but doesn't check the whole screen
- # contents, only the contents of a single box. This procedure
- # includes (effectively) a call to check_box to ensure there is a
- # box where expected, if there is then the contents of the box are
- # matched against REGEXP.
- proc check_box_contents {test_name x y width height regexp} {
- variable _chars
+ if { $attrs } {
+ _reset_attrs region_attrs
+ }
- dump_box $x $y $width $height
- set why [_check_box $x $y $width $height]
- if {$why != ""} {
- fail "$test_name (box check: $why)"
- return
+ # Grab the contents of the box, join each line together
+ # using $sep.
+ set result ""
+ for {set yy $y} {$yy < $y + $height} {incr yy} {
+ if {$yy > $y} {
+ # Add the end of line sequence only if this isn't the
+ # first line.
+ append result $sep
}
+ for {set xx $x} {$xx < $x + $width} {incr xx} {
+ if { $attrs } {
+ set char_attrs [lindex $_chars($xx,$yy) 1]
+ append result [apply_attrs region_attrs $char_attrs]
+ }
- check_region_contents $test_name [expr {$x + 1}] [expr {$y + 1}] \
- [expr {$width - 2}] [expr {$height - 2}] $regexp
+ append result [get_char $xx $yy]
+ }
+ }
+ if { $attrs } {
+ _reset_attrs zero_attrs
+ set char_attrs [array get zero_attrs]
+ append result [apply_attrs region_attrs $char_attrs]
}
+ return $result
+}
- # A debugging function to dump the current screen, with line
- # numbers. If ATTRS, annotate with attributes.
- proc dump_screen { {attrs 0} } {
- variable _rows
- variable _cols
- variable _cur_row
- variable _cur_col
+# Check that the region of the screen described by X, Y, WIDTH,
+# and HEIGHT match REGEXP. This is like check_contents except
+# only part of the screen is checked. This can be used to check
+# the contents within a box (though check_box_contents is a better
+# choice for boxes with a border). Return 1 if check succeeded.
+proc Term::check_region_contents_p { x y width height regexp } {
+ variable _chars
+ dump_box $x $y $width $height
- verbose -log "Screen Dump (size $_cols columns x $_rows rows, cursor at column $_cur_col, row $_cur_row):"
+ # Now grab the contents of the box, join each line together
+ # with a '\r\n' sequence and match against REGEXP.
+ set result [get_region $x $y $width $height "\r\n"]
+ return [regexp -- $regexp $result]
+}
- for {set y 0} {$y < $_rows} {incr y} {
- set fmt [format %5d $y]
- verbose -log "$fmt [get_line_1 $y "" $attrs]"
- }
+# Check that the region of the screen described by X, Y, WIDTH,
+# and HEIGHT match REGEXP. As check_region_contents_p, but produce
+# a pass/fail message.
+proc Term::check_region_contents { test_name x y width height regexp } {
+ set ok [check_region_contents_p $x $y $width $height $regexp]
+ gdb_assert {$ok} $test_name
+}
+
+# Check the contents of a box on the screen. This is a little
+# like check_contents, but doesn't check the whole screen
+# contents, only the contents of a single box. This procedure
+# includes (effectively) a call to check_box to ensure there is a
+# box where expected, if there is then the contents of the box are
+# matched against REGEXP.
+proc Term::check_box_contents {test_name x y width height regexp} {
+ variable _chars
+
+ dump_box $x $y $width $height
+ set why [_check_box $x $y $width $height]
+ if {$why != ""} {
+ fail "$test_name (box check: $why)"
+ return
}
- # As dump_screen, but with attributes annotation.
- proc dump_screen_with_attrs {} {
- return [dump_screen 1]
+ check_region_contents $test_name [expr {$x + 1}] [expr {$y + 1}] \
+ [expr {$width - 2}] [expr {$height - 2}] $regexp
+}
+
+# A debugging function to dump the current screen, with line
+# numbers. If ATTRS, annotate with attributes.
+proc Term::dump_screen { {attrs 0} } {
+ variable _rows
+ variable _cols
+ variable _cur_row
+ variable _cur_col
+
+ verbose -log "Screen Dump (size $_cols columns x $_rows rows, cursor at column $_cur_col, row $_cur_row):"
+
+ for {set y 0} {$y < $_rows} {incr y} {
+ set fmt [format %5d $y]
+ verbose -log "$fmt [get_line_1 $y {} $attrs]"
}
+}
- # A debugging function to dump a box from the current screen, with line
- # numbers.
- proc dump_box { x y width height } {
- verbose -log "Box Dump ($width x $height) @ ($x, $y):"
- set region [get_region $x $y $width $height "\n"]
- set lines [split $region "\n"]
- set nr $y
- foreach line $lines {
- set fmt [format %5d $nr]
- verbose -log "$fmt $line"
- incr nr
- }
+# As dump_screen, but with attributes annotation.
+proc Term::dump_screen_with_attrs {} {
+ return [dump_screen 1]
+}
+
+# A debugging function to dump a box from the current screen, with line
+# numbers.
+proc Term::dump_box { x y width height } {
+ verbose -log "Box Dump ($width x $height) @ ($x, $y):"
+ set region [get_region $x $y $width $height "\n"]
+ set lines [split $region "\n"]
+ set nr $y
+ foreach line $lines {
+ set fmt [format %5d $nr]
+ verbose -log "$fmt $line"
+ incr nr
}
+}
- # Resize the terminal.
- proc _do_resize {rows cols} {
- variable _chars
- variable _rows
- variable _cols
+# Resize the terminal.
+proc Term::_do_resize {rows cols} {
+ variable _chars
+ variable _rows
+ variable _cols
- set old_rows [expr {min ($_rows, $rows)}]
- set old_cols [expr {min ($_cols, $cols)}]
+ set old_rows [expr {min ($_rows, $rows)}]
+ set old_cols [expr {min ($_cols, $cols)}]
- # Copy locally.
- array set local_chars [array get _chars]
- unset _chars
+ # Copy locally.
+ array set local_chars [array get _chars]
+ unset _chars
- set _rows $rows
- set _cols $cols
- _clear_lines 0 $_rows
+ set _rows $rows
+ set _cols $cols
+ _clear_lines 0 $_rows
- for {set x 0} {$x < $old_cols} {incr x} {
- for {set y 0} {$y < $old_rows} {incr y} {
- set _chars($x,$y) $local_chars($x,$y)
- }
+ for {set x 0} {$x < $old_cols} {incr x} {
+ for {set y 0} {$y < $old_rows} {incr y} {
+ set _chars($x,$y) $local_chars($x,$y)
}
}
+}
- proc resize {rows cols {wait_for_msg 1}} {
- variable _rows
- variable _cols
- variable _resize_count
+proc Term::resize {rows cols {wait_for_msg 1}} {
+ variable _rows
+ variable _cols
+ variable _resize_count
- # expect handles each argument to stty separately. This means
- # that gdb will see SIGWINCH twice. Rather than rely on this
- # behavior (which, after all, could be changed), we make it
- # explicit here. This also simplifies waiting for the redraw.
- _do_resize $rows $_cols
- stty rows $_rows < $::gdb_tty_name
- if { $wait_for_msg } {
- wait_for "@@ resize done $_resize_count, size = ${_cols}x${rows}"
- }
- incr _resize_count
- _do_resize $_rows $cols
- stty columns $_cols < $::gdb_tty_name
- if { $wait_for_msg } {
- wait_for "@@ resize done $_resize_count, size = ${_cols}x${rows}"
- }
- incr _resize_count
- }
+ # expect handles each argument to stty separately. This means
+ # that gdb will see SIGWINCH twice. Rather than rely on this
+ # behavior (which, after all, could be changed), we make it
+ # explicit here. This also simplifies waiting for the redraw.
+ _do_resize $rows $_cols
+ stty rows $_rows < $::gdb_tty_name
+ if { $wait_for_msg } {
+ wait_for "@@ resize done $_resize_count, size = ${_cols}x${rows}"
+ }
+ incr _resize_count
+ _do_resize $_rows $cols
+ stty columns $_cols < $::gdb_tty_name
+ if { $wait_for_msg } {
+ wait_for "@@ resize done $_resize_count, size = ${_cols}x${rows}"
+ }
+ incr _resize_count
}
diff --git a/gdb/testsuite/lib/unbuffer_output.c b/gdb/testsuite/lib/unbuffer_output.c
index a286e3f..cdaa227 100644
--- a/gdb/testsuite/lib/unbuffer_output.c
+++ b/gdb/testsuite/lib/unbuffer_output.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/testsuite/lib/valgrind.exp b/gdb/testsuite/lib/valgrind.exp
index c952e92..aad0a3b 100644
--- a/gdb/testsuite/lib/valgrind.exp
+++ b/gdb/testsuite/lib/valgrind.exp
@@ -1,4 +1,4 @@
-# Copyright 2009-2024 Free Software Foundation, Inc.
+# Copyright 2009-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/make-check-all.sh b/gdb/testsuite/make-check-all.sh
index 28a89b6..ab72574 100755
--- a/gdb/testsuite/make-check-all.sh
+++ b/gdb/testsuite/make-check-all.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-# Copyright (C) 2023-2024 Free Software Foundation, Inc.
+# Copyright (C) 2023-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -74,6 +74,7 @@ target_boards=(
cc-with-gnu-debuglink
debug-types
dwarf4-gdb-index
+ dwarf5-fission-debug-types
dwarf64
fission
fission-dwp
@@ -191,7 +192,7 @@ do_tests ()
# Run make check.
make $maketarget \
- RUNTESTFLAGS="${rtf[*]} ${tests[*]}" \
+ RUNTESTFLAGS="${rtf[*]}" TESTS="${tests[*]}" \
2>&1 \
| summary
@@ -215,7 +216,7 @@ do_tests ()
cp gdb.sum gdb.log "$dir"
# Record the 'make check' command to enable easy re-running.
- echo "make $maketarget RUNTESTFLAGS=\"${rtf[*]} ${tests[*]}\"" \
+ echo "make $maketarget RUNTESTFLAGS=\"${rtf[*]}\" TESTS=\"${tests[*]}\"" \
> "$dir/make-check.sh"
fi
}
diff --git a/gdb/testsuite/print-ts.py b/gdb/testsuite/print-ts.py
index 0a832ba..67a5bfd 100755
--- a/gdb/testsuite/print-ts.py
+++ b/gdb/testsuite/print-ts.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-# Copyright (C) 2018-2024 Free Software Foundation, Inc.
+# Copyright (C) 2018-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/thread-fsm.h b/gdb/thread-fsm.h
index 36efee7..e8da890 100644
--- a/gdb/thread-fsm.h
+++ b/gdb/thread-fsm.h
@@ -1,5 +1,5 @@
/* Thread command's finish-state machine, for GDB, the GNU debugger.
- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+ Copyright (C) 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/thread-iter.c b/gdb/thread-iter.c
index 601d23c..ca6720a 100644
--- a/gdb/thread-iter.c
+++ b/gdb/thread-iter.c
@@ -1,6 +1,6 @@
/* Thread iterators and ranges for GDB, the GNU debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/thread-iter.h b/gdb/thread-iter.h
index 8953721..cdf9b2d 100644
--- a/gdb/thread-iter.h
+++ b/gdb/thread-iter.h
@@ -1,5 +1,5 @@
/* Thread iterators and ranges for GDB, the GNU debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,15 +21,12 @@
#include "gdbsupport/filtered-iterator.h"
#include "gdbsupport/iterator-range.h"
-#include "gdbsupport/next-iterator.h"
-#include "gdbsupport/reference-to-pointer-iterator.h"
#include "gdbsupport/safe-iterator.h"
/* A forward iterator that iterates over a given inferior's
threads. */
-using inf_threads_iterator
- = reference_to_pointer_iterator<intrusive_list<thread_info>::iterator>;
+using inf_threads_iterator = intrusive_list<thread_info>::iterator;
/* A forward iterator that iterates over all threads of all
inferiors. */
@@ -38,9 +35,9 @@ class all_threads_iterator
{
public:
typedef all_threads_iterator self_type;
- typedef struct thread_info *value_type;
- typedef struct thread_info *&reference;
- typedef struct thread_info **pointer;
+ typedef struct thread_info value_type;
+ typedef struct thread_info &reference;
+ typedef struct thread_info *pointer;
typedef std::forward_iterator_tag iterator_category;
typedef int difference_type;
@@ -56,7 +53,7 @@ public:
: m_thr (nullptr)
{}
- thread_info *operator* () const { return m_thr; }
+ reference operator* () const { return *m_thr; }
all_threads_iterator &operator++ ()
{
@@ -87,9 +84,9 @@ class all_matching_threads_iterator
{
public:
typedef all_matching_threads_iterator self_type;
- typedef struct thread_info *value_type;
- typedef struct thread_info *&reference;
- typedef struct thread_info **pointer;
+ typedef struct thread_info value_type;
+ typedef struct thread_info &reference;
+ typedef struct thread_info *pointer;
typedef std::forward_iterator_tag iterator_category;
typedef int difference_type;
@@ -101,7 +98,7 @@ public:
/* Create a one-past-end iterator. */
all_matching_threads_iterator () = default;
- thread_info *operator* () const { return m_thr; }
+ reference operator* () const { return *m_thr; }
all_matching_threads_iterator &operator++ ()
{
@@ -149,9 +146,9 @@ private:
struct non_exited_thread_filter
{
- bool operator() (struct thread_info *thr) const
+ bool operator() (struct thread_info &thr) const
{
- return thr->state != THREAD_EXITED;
+ return thr.state != THREAD_EXITED;
}
};
@@ -240,7 +237,12 @@ public:
{}
all_non_exited_threads_iterator begin () const
- { return all_non_exited_threads_iterator (m_filter_target, m_filter_ptid); }
+ {
+ all_matching_threads_iterator begin (m_filter_target, m_filter_ptid);
+
+ return all_non_exited_threads_iterator (std::move (begin));
+ }
+
all_non_exited_threads_iterator end () const
{ return all_non_exited_threads_iterator (); }
diff --git a/gdb/thread.c b/gdb/thread.c
index 8a34671..472f419 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -1,6 +1,6 @@
/* Multi-process/thread control for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
Contributed by Lynx Real-Time Systems, Inc. Los Gatos, CA.
@@ -33,7 +33,6 @@
#include "regcache.h"
#include "btrace.h"
-#include <ctype.h>
#include <sys/types.h>
#include <signal.h>
#include "ui-out.h"
@@ -559,9 +558,9 @@ delete_thread_silent (thread_info *thread)
struct thread_info *
find_thread_global_id (int global_id)
{
- for (thread_info *tp : all_threads ())
- if (tp->global_num == global_id)
- return tp;
+ for (thread_info &tp : all_threads ())
+ if (tp.global_num == global_id)
+ return &tp;
return NULL;
}
@@ -569,9 +568,9 @@ find_thread_global_id (int global_id)
static struct thread_info *
find_thread_id (struct inferior *inf, int thr_num)
{
- for (thread_info *tp : inf->threads ())
- if (tp->per_inf_num == thr_num)
- return tp;
+ for (thread_info &tp : inf->threads ())
+ if (tp.per_inf_num == thr_num)
+ return &tp;
return NULL;
}
@@ -604,9 +603,9 @@ find_thread_by_handle (gdb::array_view<const gdb_byte> handle,
struct thread_info *
iterate_over_threads (gdb::function_view<bool (struct thread_info *)> callback)
{
- for (thread_info *tp : all_threads_safe ())
- if (callback (tp))
- return tp;
+ for (thread_info &tp : all_threads_safe ())
+ if (callback (&tp))
+ return &tp;
return NULL;
}
@@ -616,7 +615,7 @@ iterate_over_threads (gdb::function_view<bool (struct thread_info *)> callback)
bool
any_thread_p ()
{
- for (thread_info *tp ATTRIBUTE_UNUSED : all_threads ())
+ for (thread_info &tp ATTRIBUTE_UNUSED : all_threads ())
return true;
return false;
}
@@ -640,8 +639,8 @@ live_threads_count (void)
int
valid_global_thread_id (int global_id)
{
- for (thread_info *tp : all_threads ())
- if (tp->global_num == global_id)
+ for (thread_info &tp : all_threads ())
+ if (tp.global_num == global_id)
return 1;
return 0;
@@ -673,8 +672,8 @@ any_thread_of_inferior (inferior *inf)
if (inf == current_inferior () && inferior_ptid != null_ptid)
return inferior_thread ();
- for (thread_info *tp : inf->non_exited_threads ())
- return tp;
+ for (thread_info &tp : inf->non_exited_threads ())
+ return &tp;
return NULL;
}
@@ -700,12 +699,12 @@ any_live_thread_of_inferior (inferior *inf)
return curr_tp;
}
- for (thread_info *tp : inf->non_exited_threads ())
+ for (thread_info &tp : inf->non_exited_threads ())
{
- if (!tp->executing ())
- return tp;
+ if (!tp.executing ())
+ return &tp;
- tp_executing = tp;
+ tp_executing = &tp;
}
/* If both the current thread and all live threads are executing,
@@ -758,12 +757,12 @@ prune_threads (void)
{
scoped_restore_current_thread restore_thread;
- for (thread_info *tp : all_threads_safe ())
+ for (thread_info &tp : all_threads_safe ())
{
- switch_to_inferior_no_thread (tp->inf);
+ switch_to_inferior_no_thread (tp.inf);
- if (!thread_alive (tp))
- delete_thread (tp);
+ if (!thread_alive (&tp))
+ delete_thread (&tp);
}
}
@@ -772,9 +771,9 @@ prune_threads (void)
void
delete_exited_threads (void)
{
- for (thread_info *tp : all_threads_safe ())
- if (tp->state == THREAD_EXITED)
- delete_thread (tp);
+ for (thread_info &tp : all_threads_safe ())
+ if (tp.state == THREAD_EXITED)
+ delete_thread (&tp);
}
/* Return true value if stack temporaries are enabled for the thread
@@ -857,8 +856,8 @@ thread_change_ptid (process_stratum_target *targ,
void
set_resumed (process_stratum_target *targ, ptid_t ptid, bool resumed)
{
- for (thread_info *tp : all_non_exited_threads (targ, ptid))
- tp->set_resumed (resumed);
+ for (thread_info &tp : all_non_exited_threads (targ, ptid))
+ tp.set_resumed (resumed);
}
/* Helper for set_running, that marks one thread either running or
@@ -921,8 +920,8 @@ set_running (process_stratum_target *targ, ptid_t ptid, bool running)
multiple *running notifications just fine. */
bool any_started = false;
- for (thread_info *tp : all_non_exited_threads (targ, ptid))
- if (set_running_thread (tp, running))
+ for (thread_info &tp : all_non_exited_threads (targ, ptid))
+ if (set_running_thread (&tp, running))
any_started = true;
if (any_started)
@@ -932,8 +931,8 @@ set_running (process_stratum_target *targ, ptid_t ptid, bool running)
void
set_executing (process_stratum_target *targ, ptid_t ptid, bool executing)
{
- for (thread_info *tp : all_non_exited_threads (targ, ptid))
- tp->set_executing (executing);
+ for (thread_info &tp : all_non_exited_threads (targ, ptid))
+ tp.set_executing (executing);
/* It only takes one running thread to spawn more threads. */
if (executing)
@@ -955,8 +954,8 @@ threads_are_executing (process_stratum_target *target)
void
set_stop_requested (process_stratum_target *targ, ptid_t ptid, bool stop)
{
- for (thread_info *tp : all_non_exited_threads (targ, ptid))
- tp->stop_requested = stop;
+ for (thread_info &tp : all_non_exited_threads (targ, ptid))
+ tp.stop_requested = stop;
/* Call the stop requested observer so other components of GDB can
react to this request. */
@@ -969,8 +968,8 @@ finish_thread_state (process_stratum_target *targ, ptid_t ptid)
{
bool any_started = false;
- for (thread_info *tp : all_non_exited_threads (targ, ptid))
- if (set_running_thread (tp, tp->executing ()))
+ for (thread_info &tp : all_non_exited_threads (targ, ptid))
+ if (set_running_thread (&tp, tp.executing ()))
any_started = true;
if (any_started)
@@ -1038,6 +1037,37 @@ pc_in_thread_step_range (CORE_ADDR pc, struct thread_info *thread)
&& pc < thread->control.step_range_end);
}
+/* The options for the "info threads" command. */
+
+struct info_threads_opts
+{
+ /* For "-gid". */
+ bool show_global_ids = false;
+ /* For "-running". */
+ bool show_running_threads = false;
+ /* For "-stopped". */
+ bool show_stopped_threads = false;
+};
+
+static const gdb::option::option_def info_threads_option_defs[] = {
+
+ gdb::option::flag_option_def<info_threads_opts> {
+ "gid",
+ [] (info_threads_opts *opts) { return &opts->show_global_ids; },
+ N_("Show global thread IDs."),
+ },
+ gdb::option::flag_option_def<info_threads_opts> {
+ "running",
+ [] (info_threads_opts *opts) { return &opts->show_running_threads; },
+ N_("Show running threads only."),
+ },
+ gdb::option::flag_option_def<info_threads_opts> {
+ "stopped",
+ [] (info_threads_opts *opts) { return &opts->show_stopped_threads; },
+ N_("Show stopped threads only."),
+ },
+};
+
/* Helper for print_thread_info. Returns true if THR should be
printed. If REQUESTED_THREADS, a list of GDB ids/ranges, is not
NULL, only print THR if its ID is included in the list. GLOBAL_IDS
@@ -1046,11 +1076,13 @@ pc_in_thread_step_range (CORE_ADDR pc, struct thread_info *thread)
is a thread from the process PID. Otherwise, threads from all
attached PIDs are printed. If both REQUESTED_THREADS is not NULL
and PID is not -1, then the thread is printed if it belongs to the
- specified process. Otherwise, an error is raised. */
+ specified process. Otherwise, an error is raised. OPTS is the
+ options of the "info threads" command. */
static bool
-should_print_thread (const char *requested_threads, int default_inf_num,
- int global_ids, int pid, struct thread_info *thr)
+should_print_thread (const char *requested_threads,
+ const info_threads_opts &opts, int default_inf_num,
+ int global_ids, int pid, thread_info *thr)
{
if (requested_threads != NULL && *requested_threads != '\0')
{
@@ -1075,7 +1107,17 @@ should_print_thread (const char *requested_threads, int default_inf_num,
if (thr->state == THREAD_EXITED)
return false;
- return true;
+ bool is_stopped = (thr->state == THREAD_STOPPED);
+ if (opts.show_stopped_threads && is_stopped)
+ return true;
+
+ bool is_running = (thr->state == THREAD_RUNNING);
+ if (opts.show_running_threads && is_running)
+ return true;
+
+ /* If the user did not pass a filter flag, show the thread. */
+ return (!opts.show_stopped_threads
+ && !opts.show_running_threads);
}
/* Return the string to display in "info threads"'s "Target Id"
@@ -1104,8 +1146,8 @@ thread_target_id_str (thread_info *tp)
static void
do_print_thread (ui_out *uiout, const char *requested_threads,
- int global_ids, int pid, int show_global_ids,
- int default_inf_num, thread_info *tp,
+ const info_threads_opts &opts, int global_ids,
+ int pid, int default_inf_num, thread_info *tp,
thread_info *current_thread)
{
int core;
@@ -1114,7 +1156,7 @@ do_print_thread (ui_out *uiout, const char *requested_threads,
if (current_thread != nullptr)
switch_to_thread (current_thread);
- if (!should_print_thread (requested_threads, default_inf_num,
+ if (!should_print_thread (requested_threads, opts, default_inf_num,
global_ids, pid, tp))
return;
@@ -1130,7 +1172,7 @@ do_print_thread (ui_out *uiout, const char *requested_threads,
uiout->field_string ("id-in-tg", print_thread_id (tp));
}
- if (show_global_ids || uiout->is_mi_like_p ())
+ if (opts.show_global_ids || uiout->is_mi_like_p ())
uiout->field_signed ("id", tp->global_num);
/* Switch to the thread (and inferior / target). */
@@ -1191,23 +1233,22 @@ do_print_thread (ui_out *uiout, const char *requested_threads,
static void
print_thread (ui_out *uiout, const char *requested_threads,
- int global_ids, int pid, int show_global_ids,
+ const info_threads_opts &opts, int global_ids, int pid,
int default_inf_num, thread_info *tp, thread_info *current_thread)
{
do_with_buffered_output (do_print_thread, uiout, requested_threads,
- global_ids, pid, show_global_ids,
- default_inf_num, tp, current_thread);
+ opts, global_ids, pid, default_inf_num, tp,
+ current_thread);
}
/* Like print_thread_info, but in addition, GLOBAL_IDS indicates
whether REQUESTED_THREADS is a list of global or per-inferior
- thread ids. */
+ thread ids. OPTS is the options of the "info threads" command. */
static void
print_thread_info_1 (struct ui_out *uiout, const char *requested_threads,
- int global_ids, int pid,
- int show_global_ids)
+ const info_threads_opts &opts, int global_ids, int pid)
{
int default_inf_num = current_inferior ()->num;
@@ -1235,48 +1276,49 @@ print_thread_info_1 (struct ui_out *uiout, const char *requested_threads,
list_emitter.emplace (uiout, "threads");
else
{
- int n_threads = 0;
+ int n_matching_threads = 0;
/* The width of the "Target Id" column. Grown below to
accommodate the largest entry. */
size_t target_id_col_width = 17;
- for (thread_info *tp : all_threads ())
+ for (thread_info &tp : all_threads ())
{
+ any_thread = true;
+
/* In case REQUESTED_THREADS contains $_thread. */
if (current_thread != nullptr)
switch_to_thread (current_thread);
- if (!should_print_thread (requested_threads, default_inf_num,
- global_ids, pid, tp))
+ if (!should_print_thread (requested_threads, opts,
+ default_inf_num, global_ids, pid, &tp))
continue;
/* Switch inferiors so we're looking at the right
target stack. */
- switch_to_inferior_no_thread (tp->inf);
+ switch_to_inferior_no_thread (tp.inf);
target_id_col_width
= std::max (target_id_col_width,
- thread_target_id_str (tp).size ());
+ thread_target_id_str (&tp).size ());
- ++n_threads;
+ ++n_matching_threads;
}
- if (n_threads == 0)
+ if (n_matching_threads == 0)
{
- if (requested_threads == NULL || *requested_threads == '\0')
+ if (!any_thread)
uiout->message (_("No threads.\n"));
else
- uiout->message (_("No threads match '%s'.\n"),
- requested_threads);
+ uiout->message (_("No threads matched.\n"));
return;
}
- table_emitter.emplace (uiout, show_global_ids ? 5 : 4,
- n_threads, "threads");
+ table_emitter.emplace (uiout, opts.show_global_ids ? 5 : 4,
+ n_matching_threads, "threads");
uiout->table_header (1, ui_left, "current", "");
uiout->table_header (4, ui_left, "id-in-tg", "Id");
- if (show_global_ids)
+ if (opts.show_global_ids)
uiout->table_header (4, ui_left, "id", "GId");
uiout->table_header (target_id_col_width, ui_left,
"target-id", "Target Id");
@@ -1285,15 +1327,13 @@ print_thread_info_1 (struct ui_out *uiout, const char *requested_threads,
}
for (inferior *inf : all_inferiors ())
- for (thread_info *tp : inf->threads ())
+ for (thread_info &tp : inf->threads ())
{
- any_thread = true;
-
- if (tp == current_thread && tp->state == THREAD_EXITED)
+ if (&tp == current_thread && tp.state == THREAD_EXITED)
current_exited = true;
- print_thread (uiout, requested_threads, global_ids, pid,
- show_global_ids, default_inf_num, tp, current_thread);
+ print_thread (uiout, requested_threads, opts, global_ids, pid,
+ default_inf_num, &tp, current_thread);
}
/* This end scope restores the current thread and the frame
@@ -1322,27 +1362,10 @@ void
print_thread_info (struct ui_out *uiout, const char *requested_threads,
int pid)
{
- print_thread_info_1 (uiout, requested_threads, 1, pid, 0);
+ info_threads_opts opts;
+ print_thread_info_1 (uiout, requested_threads, opts, 1, pid);
}
-/* The options for the "info threads" command. */
-
-struct info_threads_opts
-{
- /* For "-gid". */
- bool show_global_ids = false;
-};
-
-static const gdb::option::option_def info_threads_option_defs[] = {
-
- gdb::option::flag_option_def<info_threads_opts> {
- "gid",
- [] (info_threads_opts *opts) { return &opts->show_global_ids; },
- N_("Show global thread IDs."),
- },
-
-};
-
/* Create an option_def_group for the "info threads" options, with
IT_OPTS as context. */
@@ -1367,7 +1390,7 @@ info_threads_command (const char *arg, int from_tty)
gdb::option::process_options
(&arg, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp);
- print_thread_info_1 (current_uiout, arg, 0, -1, it_opts.show_global_ids);
+ print_thread_info_1 (current_uiout, arg, it_opts, 0, -1);
}
/* Completer for the "info threads" command. */
@@ -1723,8 +1746,8 @@ thread_apply_all_command (const char *cmd, int from_tty)
std::vector<thread_info_ref> thr_list_cpy;
thr_list_cpy.reserve (tc);
- for (thread_info *tp : all_non_exited_threads ())
- thr_list_cpy.push_back (thread_info_ref::new_reference (tp));
+ for (thread_info &tp : all_non_exited_threads ())
+ thr_list_cpy.push_back (thread_info_ref::new_reference (&tp));
gdb_assert (thr_list_cpy.size () == tc);
auto *sorter = (ascending
@@ -1784,7 +1807,7 @@ thread_apply_command_completer (cmd_list_element *ignore,
/* Check if we're past a valid thread ID list already. */
if (parser.finished ()
- && cmd > text && !isspace (cmd[-1]))
+ && cmd > text && !c_isspace (cmd[-1]))
return;
/* We're past the thread ID list, advance word point. */
@@ -1847,7 +1870,7 @@ thread_apply_command (const char *tidlist, int from_tty)
if (*cmd == '\0')
error (_("Please specify a command following the thread ID list"));
- if (tidlist == cmd || isdigit (cmd[0]))
+ if (tidlist == cmd || c_isdigit (cmd[0]))
invalid_thread_id_error (cmd);
scoped_restore_current_thread restore_thread;
@@ -1954,21 +1977,10 @@ thread_command (const char *tidstr, int from_tty)
}
else
{
- ptid_t previous_ptid = inferior_ptid;
-
thread_select (tidstr, parse_thread_id (tidstr, NULL));
- /* Print if the thread has not changed, otherwise an event will
- be sent. */
- if (inferior_ptid == previous_ptid)
- {
- print_selected_thread_frame (current_uiout,
- USER_SELECTED_THREAD
- | USER_SELECTED_FRAME);
- }
- else
- notify_user_selected_context_changed
- (USER_SELECTED_THREAD | USER_SELECTED_FRAME);
+ notify_user_selected_context_changed
+ (USER_SELECTED_THREAD | USER_SELECTED_FRAME);
}
}
@@ -2008,38 +2020,38 @@ thread_find_command (const char *arg, int from_tty)
update_thread_list ();
- for (thread_info *tp : all_threads ())
+ for (thread_info &tp : all_threads ())
{
- switch_to_inferior_no_thread (tp->inf);
+ switch_to_inferior_no_thread (tp.inf);
- if (tp->name () != nullptr && re_exec (tp->name ()))
+ if (tp.name () != nullptr && re_exec (tp.name ()))
{
gdb_printf (_("Thread %s has name '%s'\n"),
- print_thread_id (tp), tp->name ());
+ print_thread_id (&tp), tp.name ());
match++;
}
- tmp = target_thread_name (tp);
+ tmp = target_thread_name (&tp);
if (tmp != NULL && re_exec (tmp))
{
gdb_printf (_("Thread %s has target name '%s'\n"),
- print_thread_id (tp), tmp);
+ print_thread_id (&tp), tmp);
match++;
}
- std::string name = target_pid_to_str (tp->ptid);
+ std::string name = target_pid_to_str (tp.ptid);
if (!name.empty () && re_exec (name.c_str ()))
{
gdb_printf (_("Thread %s has target id '%s'\n"),
- print_thread_id (tp), name.c_str ());
+ print_thread_id (&tp), name.c_str ());
match++;
}
- tmp = target_extra_thread_info (tp);
+ tmp = target_extra_thread_info (&tp);
if (tmp != NULL && re_exec (tmp))
{
gdb_printf (_("Thread %s has extra info '%s'\n"),
- print_thread_id (tp), tmp);
+ print_thread_id (&tp), tmp);
match++;
}
}
@@ -2141,9 +2153,9 @@ update_threads_executing (void)
return;
}
- for (thread_info *tp : inf->non_exited_threads ())
+ for (thread_info &tp : inf->non_exited_threads ())
{
- if (tp->executing ())
+ if (tp.executing ())
{
targ->threads_executing = true;
return;
@@ -2287,9 +2299,7 @@ static const struct internalvar_funcs inferior_thread_count_funcs =
NULL,
};
-void _initialize_thread ();
-void
-_initialize_thread ()
+INIT_GDB_FILE (thread)
{
static struct cmd_list_element *thread_apply_list = NULL;
cmd_list_element *c;
diff --git a/gdb/tic6x-linux-tdep.c b/gdb/tic6x-linux-tdep.c
index c214178..5b3d402 100644
--- a/gdb/tic6x-linux-tdep.c
+++ b/gdb/tic6x-linux-tdep.c
@@ -1,5 +1,5 @@
/* GNU/Linux on TI C6x target support.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
Contributed by Yao Qi <yao@codesourcery.com>
This file is part of GDB.
@@ -169,7 +169,7 @@ tic6x_uclinux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
linux_init_abi (info, gdbarch, 0);
/* Shared library handling. */
- set_gdbarch_so_ops (gdbarch, &dsbt_so_ops);
+ set_gdbarch_make_solib_ops (gdbarch, make_dsbt_solib_ops);
tdep->syscall_next_pc = tic6x_linux_syscall_next_pc;
@@ -203,9 +203,7 @@ tic6x_uclinux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
&tic6x_linux_rt_sigreturn_tramp_frame);
}
-void _initialize_tic6x_linux_tdep ();
-void
-_initialize_tic6x_linux_tdep ()
+INIT_GDB_FILE (tic6x_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_tic6x, 0, GDB_OSABI_LINUX,
tic6x_uclinux_init_abi);
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index c7e42b1..56d3098 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -1,6 +1,6 @@
/* Target dependent code for GDB on TI C6x systems.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 2010-2025 Free Software Foundation, Inc.
Contributed by Andrew Jenner <andrew@codesourcery.com>
Contributed by Yao Qi <yao@codesourcery.com>
@@ -1267,7 +1267,7 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
dwarf2_frame_set_init_reg (gdbarch, tic6x_dwarf2_frame_init_reg);
/* Single stepping. */
- set_gdbarch_software_single_step (gdbarch, tic6x_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, tic6x_software_single_step);
/* Call dummy code. */
set_gdbarch_frame_align (gdbarch, tic6x_frame_align);
@@ -1293,9 +1293,7 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_tic6x_tdep ();
-void
-_initialize_tic6x_tdep ()
+INIT_GDB_FILE (tic6x_tdep)
{
gdbarch_register (bfd_arch_tic6x, tic6x_gdbarch_init);
}
diff --git a/gdb/tic6x-tdep.h b/gdb/tic6x-tdep.h
index 03a8a3e..35e36a6 100644
--- a/gdb/tic6x-tdep.h
+++ b/gdb/tic6x-tdep.h
@@ -1,5 +1,5 @@
/* GNU/Linux on TI C6x target support.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
Contributed by Yao Qi <yao@codesourcery.com>
This file is part of GDB.
diff --git a/gdb/tid-parse.c b/gdb/tid-parse.c
index 442d5b3..e0b9093 100644
--- a/gdb/tid-parse.c
+++ b/gdb/tid-parse.c
@@ -1,6 +1,6 @@
/* TID parsing for GDB, the GNU debugger.
- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+ Copyright (C) 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,7 +20,6 @@
#include "tid-parse.h"
#include "inferior.h"
#include "gdbthread.h"
-#include <ctype.h>
/* See tid-parse.h. */
@@ -118,10 +117,10 @@ parse_thread_id (const char *tidstr, const char **end)
inf = current_inferior ();
thread_info *tp = nullptr;
- for (thread_info *it : inf->threads ())
- if (it->per_inf_num == thr_num)
+ for (thread_info &it : inf->threads ())
+ if (it.per_inf_num == thr_num)
{
- tp = it;
+ tp = &it;
break;
}
@@ -184,7 +183,7 @@ tid_range_parser::finished () const
or we are not in a range and not in front of an integer, negative
integer, convenience var or negative convenience var. */
return (*m_cur_tok == '\0'
- || !(isdigit (*m_cur_tok)
+ || !(c_isdigit (*m_cur_tok)
|| *m_cur_tok == '$'
|| *m_cur_tok == '*'));
case STATE_THREAD_RANGE:
@@ -261,7 +260,7 @@ tid_range_parser::get_tid_or_range (int *inf_num,
m_qualified = true;
p = dot + 1;
- if (isspace (*p))
+ if (c_isspace (*p))
return false;
}
else
@@ -272,7 +271,7 @@ tid_range_parser::get_tid_or_range (int *inf_num,
}
m_range_parser.init (p);
- if (p[0] == '*' && (p[1] == '\0' || isspace (p[1])))
+ if (p[0] == '*' && (p[1] == '\0' || c_isspace (p[1])))
{
/* Setup the number range parser to return numbers in the
whole [1,INT_MAX] range. */
diff --git a/gdb/tid-parse.h b/gdb/tid-parse.h
index f971f91..752bf6b 100644
--- a/gdb/tid-parse.h
+++ b/gdb/tid-parse.h
@@ -1,6 +1,6 @@
/* TID parsing for GDB, the GNU debugger.
- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+ Copyright (C) 2015-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/tilegx-linux-nat.c b/gdb/tilegx-linux-nat.c
index 5755e70..99f2cc4 100644
--- a/gdb/tilegx-linux-nat.c
+++ b/gdb/tilegx-linux-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux TILE-Gx.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -163,9 +163,7 @@ tilegx_linux_nat_target::store_registers (struct regcache *regcache,
perror_with_name (_("Couldn't write registers"));
}
-void _initialize_tile_linux_nat ();
-void
-_initialize_tile_linux_nat ()
+INIT_GDB_FILE (tile_linux_nat)
{
linux_target = &the_tilegx_linux_nat_target;
add_inf_child_target (&the_tilegx_linux_nat_target);
diff --git a/gdb/tilegx-linux-tdep.c b/gdb/tilegx-linux-tdep.c
index cec2be2..f54e280 100644
--- a/gdb/tilegx-linux-tdep.c
+++ b/gdb/tilegx-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux on Tilera TILE-Gx processors.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -19,6 +19,7 @@
#include "osabi.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
#include "glibc-tdep.h"
#include "solib-svr4.h"
#include "symtab.h"
@@ -119,11 +120,9 @@ tilegx_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU/Linux uses SVR4-style shared libraries. */
if (arch_size == 32)
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
else
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- linux_lp64_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_lp64_svr4_solib_ops);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
@@ -134,9 +133,7 @@ tilegx_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
}
-void _initialize_tilegx_linux_tdep ();
-void
-_initialize_tilegx_linux_tdep ()
+INIT_GDB_FILE (tilegx_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_tilegx, bfd_mach_tilegx, GDB_OSABI_LINUX,
tilegx_linux_init_abi);
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index e2247d7..a153f65 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the Tilera TILE-Gx processor.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1021,9 +1021,7 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_tilegx_tdep ();
-void
-_initialize_tilegx_tdep ()
+INIT_GDB_FILE (tilegx_tdep)
{
gdbarch_register (bfd_arch_tilegx, tilegx_gdbarch_init);
}
diff --git a/gdb/tilegx-tdep.h b/gdb/tilegx-tdep.h
index 5430281..012b2e5 100644
--- a/gdb/tilegx-tdep.h
+++ b/gdb/tilegx-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for the Tilera TILE-Gx processor.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/top.c b/gdb/top.c
index b2575bc..f5b9fdc 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1,6 +1,6 @@
/* Top level stuff for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -34,6 +34,7 @@
#include "value.h"
#include "language.h"
#include "terminal.h"
+#include "gdbsupport/cleanups.h"
#include "gdbsupport/job-control.h"
#include "annotate.h"
#include "completer.h"
@@ -68,7 +69,6 @@
#include "event-top.h"
#include <sys/stat.h>
-#include <ctype.h>
#include "ui-out.h"
#include "cli-out.h"
#include "tracepoint.h"
@@ -381,7 +381,7 @@ check_frame_language_change (void)
/* Warn the user if the working language does not match the language
of the current frame. Only warn the user if we are actually
running the program, i.e. there is a stack. */
- /* FIXME: This should be cacheing the frame and only running when
+ /* FIXME: This should be caching the frame and only running when
the frame changes. */
if (warn_frame_lang_mismatch && has_stack_frames ())
@@ -415,7 +415,7 @@ wait_sync_command_done (void)
point. */
scoped_enable_commit_resumed enable ("sync wait");
- while (gdb_do_one_event () >= 0)
+ while (current_interpreter ()->do_one_event () >= 0)
if (ui->prompt_state != PROMPT_BLOCKED)
break;
}
@@ -1031,7 +1031,7 @@ gdb_readline_wrapper (const char *prompt)
(*after_char_processing_hook) ();
gdb_assert (after_char_processing_hook == NULL);
- while (gdb_do_one_event () >= 0)
+ while (current_interpreter ()->do_one_event () >= 0)
if (gdb_readline_wrapper_done)
break;
@@ -1311,7 +1311,7 @@ print_gdb_version (struct ui_file *stream, bool interactive)
/* Second line is a copyright notice. */
gdb_printf (stream,
- "Copyright (C) 2024 Free Software Foundation, Inc.\n");
+ "Copyright (C) 2025 Free Software Foundation, Inc.\n");
/* Following the copyright is a brief statement that the program is
free software, that users are free to copy and change it on
@@ -1595,6 +1595,11 @@ This GDB was configured as follows:\n\
--with-system-gdbinit-dir=%s%s\n\
"), SYSTEM_GDBINIT_DIR, SYSTEM_GDBINIT_DIR_RELOCATABLE ? " (relocatable)" : "");
+#ifdef SUPPORTED_BINARY_FILE_FORMATS
+ gdb_printf (stream, _("\
+ --enable-binary-file-formats=%s\n"), SUPPORTED_BINARY_FILE_FORMATS);
+#endif
+
/* We assume "relocatable" will be printed at least once, thus we always
print this text. It's a reasonably safe assumption for now. */
gdb_printf (stream, _("\n\
@@ -2347,9 +2352,7 @@ gdb_init ()
init_colorsupport_var ();
}
-void _initialize_top ();
-void
-_initialize_top ()
+INIT_GDB_FILE (top)
{
/* Determine a default value for the history filename. */
const char *tmpenv = getenv ("GDBHISTFILE");
diff --git a/gdb/top.h b/gdb/top.h
index 166845e..41af51a 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -1,6 +1,6 @@
/* Top level stuff for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/tracectf.c b/gdb/tracectf.c
index b4997f8..c2231ff 100644
--- a/gdb/tracectf.c
+++ b/gdb/tracectf.c
@@ -1,6 +1,6 @@
/* CTF format support.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
Contributed by Hui Zhu <hui_zhu@mentor.com>
Contributed by Yao Qi <yao@codesourcery.com>
@@ -28,7 +28,6 @@
#include "inferior.h"
#include "gdbthread.h"
#include "tracefile.h"
-#include <ctype.h>
#include <algorithm>
#include "gdbsupport/filestuff.h"
#include "gdbarch.h"
@@ -1174,7 +1173,7 @@ ctf_target_open (const char *args, int from_tty)
merge_uploaded_trace_state_variables (&uploaded_tsvs);
merge_uploaded_tracepoints (&uploaded_tps);
- post_create_inferior (from_tty);
+ post_create_inferior (from_tty, true);
}
/* This is the implementation of target_ops method to_close. Destroy
@@ -1717,9 +1716,7 @@ ctf_target::traceframe_info ()
/* module initialization */
-void _initialize_ctf ();
-void
-_initialize_ctf ()
+INIT_GDB_FILE (ctf)
{
#if HAVE_LIBBABELTRACE
add_target (ctf_target_info, ctf_target_open,
diff --git a/gdb/tracectf.h b/gdb/tracectf.h
index 9f821c5..0d08ed7 100644
--- a/gdb/tracectf.h
+++ b/gdb/tracectf.h
@@ -1,6 +1,6 @@
/* CTF format support.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index b59b5c7..a45001c 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -1,6 +1,6 @@
/* Trace file TFILE format support in GDB.
- Copyright (C) 1997-2024 Free Software Foundation, Inc.
+ Copyright (C) 1997-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -194,12 +194,12 @@ tfile_write_status (struct trace_file_writer *self,
if (ts->start_time)
{
fprintf (writer->fp, ";starttime:%s",
- phex_nz (ts->start_time, sizeof (ts->start_time)));
+ phex_nz (ts->start_time));
}
if (ts->stop_time)
{
fprintf (writer->fp, ";stoptime:%s",
- phex_nz (ts->stop_time, sizeof (ts->stop_time)));
+ phex_nz (ts->stop_time));
}
if (ts->notes != NULL)
{
@@ -254,7 +254,7 @@ tfile_write_uploaded_tp (struct trace_file_writer *self,
char buf[MAX_TRACE_UPLOAD];
fprintf (writer->fp, "tp T%x:%s:%c:%x:%x",
- utp->number, phex_nz (utp->addr, sizeof (utp->addr)),
+ utp->number, phex_nz (utp->addr),
(utp->enabled ? 'E' : 'D'), utp->step, utp->pass);
if (utp->type == bp_fast_tracepoint)
fprintf (writer->fp, ":F%x", utp->orig_size);
@@ -265,10 +265,10 @@ tfile_write_uploaded_tp (struct trace_file_writer *self,
fprintf (writer->fp, "\n");
for (const auto &act : utp->actions)
fprintf (writer->fp, "tp A%x:%s:%s\n",
- utp->number, phex_nz (utp->addr, sizeof (utp->addr)), act.get ());
+ utp->number, phex_nz (utp->addr), act.get ());
for (const auto &act : utp->step_actions)
fprintf (writer->fp, "tp S%x:%s:%s\n",
- utp->number, phex_nz (utp->addr, sizeof (utp->addr)), act.get ());
+ utp->number, phex_nz (utp->addr), act.get ());
if (utp->at_string)
{
encode_source_string (utp->number, utp->addr,
@@ -290,7 +290,7 @@ tfile_write_uploaded_tp (struct trace_file_writer *self,
fprintf (writer->fp, "tp Z%s\n", buf);
}
fprintf (writer->fp, "tp V%x:%s:%x:%s\n",
- utp->number, phex_nz (utp->addr, sizeof (utp->addr)),
+ utp->number, phex_nz (utp->addr),
utp->hit_count,
phex_nz (utp->traceframe_usage,
sizeof (utp->traceframe_usage)));
@@ -567,7 +567,7 @@ tfile_target_open (const char *arg, int from_tty)
merge_uploaded_tracepoints (&uploaded_tps);
- post_create_inferior (from_tty);
+ post_create_inferior (from_tty, true);
}
/* Interpret the given line from the definitions part of the trace
@@ -1116,9 +1116,7 @@ tfile_append_tdesc_line (const char *line)
trace_tdesc += "\n";
}
-void _initialize_tracefile_tfile ();
-void
-_initialize_tracefile_tfile ()
+INIT_GDB_FILE (tracefile_tfile)
{
add_target (tfile_target_info, tfile_target_open,
filename_maybe_quoted_completer);
diff --git a/gdb/tracefile.c b/gdb/tracefile.c
index 2d89ab7..19b4d1e 100644
--- a/gdb/tracefile.c
+++ b/gdb/tracefile.c
@@ -1,6 +1,6 @@
/* Trace file support in GDB.
- Copyright (C) 1997-2024 Free Software Foundation, Inc.
+ Copyright (C) 1997-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -473,9 +473,7 @@ tracefile_target::get_trace_status (struct trace_status *ts)
return -1;
}
-void _initialize_tracefile ();
-void
-_initialize_tracefile ()
+INIT_GDB_FILE (tracefile)
{
add_com ("tsave", class_trace, tsave_command, _("\
Save the trace data to a file.\n\
diff --git a/gdb/tracefile.h b/gdb/tracefile.h
index 028f70d..de7f8ea 100644
--- a/gdb/tracefile.h
+++ b/gdb/tracefile.h
@@ -1,5 +1,5 @@
/* Tracefile declarations
- Copyright (C) 2014-2024 Free Software Foundation, Inc.
+ Copyright (C) 2014-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index ca6f616..879e4a6 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -1,6 +1,6 @@
/* Tracing functionality for remote targets in custom GDB protocol
- Copyright (C) 1997-2024 Free Software Foundation, Inc.
+ Copyright (C) 1997-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -208,16 +208,16 @@ set_tracepoint_num (int num)
static void
set_traceframe_context (const frame_info_ptr &trace_frame)
{
- CORE_ADDR trace_pc;
+ std::optional<CORE_ADDR> trace_pc;
struct symbol *traceframe_fun;
symtab_and_line traceframe_sal;
/* Save as globals for internal use. */
if (trace_frame != NULL
- && get_frame_pc_if_available (trace_frame, &trace_pc))
+ && (trace_pc = get_frame_pc_if_available (trace_frame)))
{
- traceframe_sal = find_pc_line (trace_pc, 0);
- traceframe_fun = find_pc_function (trace_pc);
+ traceframe_sal = find_pc_line (*trace_pc, 0);
+ traceframe_fun = find_pc_function (*trace_pc);
/* Save linenumber as "$trace_line", a debugger variable visible to
users. */
@@ -308,12 +308,12 @@ validate_trace_state_variable_name (const char *name)
/* All digits in the name is reserved for value history
references. */
- for (p = name; isdigit (*p); p++)
+ for (p = name; c_isdigit (*p); p++)
;
if (*p == '\0')
error (_("$%s is not a valid trace state variable name"), name);
- for (p = name; isalnum (*p) || *p == '_'; p++)
+ for (p = name; c_isalnum (*p) || *p == '_'; p++)
;
if (*p != '\0')
error (_("$%s is not a valid trace state variable name"), name);
@@ -339,7 +339,7 @@ trace_variable_command (const char *args, int from_tty)
error (_("Name of trace variable should start with '$'"));
name_start = p;
- while (isalnum (*p) || *p == '_')
+ while (c_isalnum (*p) || *p == '_')
p++;
std::string name (name_start, p - name_start);
@@ -689,14 +689,14 @@ validate_actionline (const char *line, tracepoint *t)
(exp->op.get ()));
sym = vvop->get_symbol ();
- if (sym->aclass () == LOC_CONST)
+ if (sym->loc_class () == LOC_CONST)
{
error (_("constant `%s' (value %s) "
"will not be collected."),
sym->print_name (),
plongest (sym->value_longest ()));
}
- else if (sym->aclass () == LOC_OPTIMIZED_OUT)
+ else if (sym->loc_class () == LOC_OPTIMIZED_OUT)
{
error (_("`%s' is optimized away "
"and cannot be collected."),
@@ -916,11 +916,11 @@ collection_list::collect_symbol (struct symbol *sym,
int treat_as_expr = 0;
len = check_typedef (sym->type ())->length ();
- switch (sym->aclass ())
+ switch (sym->loc_class ())
{
default:
gdb_printf ("%s: don't know symbol class %d\n",
- sym->print_name (), sym->aclass ());
+ sym->print_name (), sym->loc_class ());
break;
case LOC_CONST:
gdb_printf ("constant %s (value %s) will not be collected.\n",
@@ -2508,12 +2508,12 @@ info_scope_command (const char *args_in, int from_tty)
gdb_stdout);
else
{
- switch (sym->aclass ())
+ switch (sym->loc_class ())
{
default:
case LOC_UNDEF: /* Messed up symbol? */
gdb_printf ("a bogus symbol, class %d.\n",
- sym->aclass ());
+ sym->loc_class ());
count--; /* Don't count this one. */
continue;
case LOC_CONST:
@@ -2818,7 +2818,7 @@ encode_source_string (int tpnum, ULONGEST addr,
if (80 + strlen (srctype) > buf_size)
error (_("Buffer too small for source encoding"));
sprintf (buf, "%x:%s:%s:%x:%x:",
- tpnum, phex_nz (addr, sizeof (addr)),
+ tpnum, phex_nz (addr),
srctype, 0, (int) strlen (src));
if (strlen (buf) + strlen (src) * 2 >= buf_size)
error (_("Source string too long for buffer"));
@@ -3919,9 +3919,7 @@ static const struct internalvar_funcs sdata_funcs =
cmd_list_element *while_stepping_cmd_element = nullptr;
/* module initialization */
-void _initialize_tracepoint ();
-void
-_initialize_tracepoint ()
+INIT_GDB_FILE (tracepoint)
{
struct cmd_list_element *c;
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
index 029813b..94a7105 100644
--- a/gdb/tracepoint.h
+++ b/gdb/tracepoint.h
@@ -1,5 +1,5 @@
/* Data structures associated with tracepoints in GDB.
- Copyright (C) 1997-2024 Free Software Foundation, Inc.
+ Copyright (C) 1997-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c
index 35bf02e..470f31d 100644
--- a/gdb/trad-frame.c
+++ b/gdb/trad-frame.c
@@ -1,6 +1,6 @@
/* Traditional frame unwind support, for GDB the GNU Debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/trad-frame.h b/gdb/trad-frame.h
index abbc631..9039e8b 100644
--- a/gdb/trad-frame.h
+++ b/gdb/trad-frame.h
@@ -1,6 +1,6 @@
/* Traditional frame unwind support, for GDB the GNU Debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/tramp-frame.c b/gdb/tramp-frame.c
index 9353cf6..0e31ad3 100644
--- a/gdb/tramp-frame.c
+++ b/gdb/tramp-frame.c
@@ -1,6 +1,6 @@
/* Signal trampoline unwinder, for GDB the GNU Debugger.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/tramp-frame.h b/gdb/tramp-frame.h
index a7288c1..2044441 100644
--- a/gdb/tramp-frame.h
+++ b/gdb/tramp-frame.h
@@ -1,6 +1,6 @@
/* Signal trampoline unwinder.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/transform.m4 b/gdb/transform.m4
index ef2c41c..d7ee188 100644
--- a/gdb/transform.m4
+++ b/gdb/transform.m4
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2024 Free Software Foundation, Inc.
+# Copyright (C) 2015-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
diff --git a/gdb/tsan-suppressions.txt b/gdb/tsan-suppressions.txt
index fb654c4..ae221ed 100644
--- a/gdb/tsan-suppressions.txt
+++ b/gdb/tsan-suppressions.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/tui/tui-command.c b/gdb/tui/tui-command.c
index 677721d..9bd33e2 100644
--- a/gdb/tui/tui-command.c
+++ b/gdb/tui/tui-command.c
@@ -1,6 +1,6 @@
/* Specific command window processing.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
diff --git a/gdb/tui/tui-command.h b/gdb/tui/tui-command.h
index 61f8cf3..2f82291 100644
--- a/gdb/tui/tui-command.h
+++ b/gdb/tui/tui-command.h
@@ -1,6 +1,6 @@
/* Specific command window processing.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index 962dbc5..7d1d055 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -1,6 +1,6 @@
/* TUI data manipulation routines.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 6f2087b..dd33a59 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -1,6 +1,6 @@
/* TUI data manipulation routines.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index bb1ff7b..07453b4 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -1,6 +1,6 @@
/* Disassembly display.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
@@ -100,6 +100,9 @@ tui_disassemble (struct gdbarch *gdbarch,
{
bool term_out = disassembler_styling && gdb_stdout->can_emit_style_escape ();
string_file gdb_dis_out (term_out);
+ struct ui_file *stream = (addr_size == nullptr
+ ? (decltype (stream))&null_stream
+ : (decltype (stream))&gdb_dis_out);
/* Must start with an empty list. */
asm_lines.clear ();
@@ -108,11 +111,13 @@ tui_disassemble (struct gdbarch *gdbarch,
for (int i = 0; i < count; ++i)
{
tui_asm_line tal;
- CORE_ADDR orig_pc = pc;
+
+ /* Save the instruction address. */
+ tal.addr = pc;
try
{
- pc = pc + gdb_print_insn (gdbarch, pc, &gdb_dis_out, NULL);
+ pc += gdb_print_insn (gdbarch, pc, stream, NULL);
}
catch (const gdb_exception_error &except)
{
@@ -124,25 +129,24 @@ tui_disassemble (struct gdbarch *gdbarch,
return pc;
}
+ /* If that's all we need, continue. */
+ if (addr_size == nullptr)
+ {
+ asm_lines.push_back (std::move (tal));
+ continue;
+ }
+
/* Capture the disassembled instruction. */
tal.insn = gdb_dis_out.release ();
/* And capture the address the instruction is at. */
- tal.addr = orig_pc;
- print_address (gdbarch, orig_pc, &gdb_dis_out);
+ print_address (gdbarch, tal.addr, &gdb_dis_out);
tal.addr_string = gdb_dis_out.release ();
+ tal.addr_size = (term_out
+ ? len_without_escapes (tal.addr_string)
+ : tal.addr_string.size ());
- if (addr_size != nullptr)
- {
- size_t new_size;
-
- if (term_out)
- new_size = len_without_escapes (tal.addr_string);
- else
- new_size = tal.addr_string.size ();
- *addr_size = std::max (*addr_size, new_size);
- tal.addr_size = new_size;
- }
+ *addr_size = std::max (*addr_size, tal.addr_size);
asm_lines.push_back (std::move (tal));
}
@@ -546,9 +550,7 @@ run_tests ()
} /* namespace selftests */
#endif /* GDB_SELF_TEST */
-void _initialize_tui_disasm ();
-void
-_initialize_tui_disasm ()
+INIT_GDB_FILE (tui_disasm)
{
#if GDB_SELF_TEST
selftests::register_test ("tui-disasm", selftests::tui::disasm::run_tests);
diff --git a/gdb/tui/tui-disasm.h b/gdb/tui/tui-disasm.h
index 4279bb0..173cc8b 100644
--- a/gdb/tui/tui-disasm.h
+++ b/gdb/tui/tui-disasm.h
@@ -1,6 +1,6 @@
/* Disassembly display.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
diff --git a/gdb/tui/tui-file.c b/gdb/tui/tui-file.c
index 17ac138..df6f503 100644
--- a/gdb/tui/tui-file.c
+++ b/gdb/tui/tui-file.c
@@ -1,5 +1,5 @@
/* UI_FILE - a generic STDIO like output stream.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,7 +21,7 @@
#include "tui/tui-command.h"
void
-tui_file::puts (const char *linebuffer)
+tui_file::do_puts (const char *linebuffer)
{
tui_puts (linebuffer);
if (!m_buffered)
@@ -29,7 +29,7 @@ tui_file::puts (const char *linebuffer)
}
void
-tui_file::write (const char *buf, long length_buf)
+tui_file::do_write (const char *buf, long length_buf)
{
tui_write (buf, length_buf);
if (!m_buffered)
@@ -41,5 +41,5 @@ tui_file::flush ()
{
if (m_buffered)
tui_cmd_win ()->refresh_window ();
- stdio_file::flush ();
+ escape_buffering_file::flush ();
}
diff --git a/gdb/tui/tui-file.h b/gdb/tui/tui-file.h
index 6178a90..b6dc058 100644
--- a/gdb/tui/tui-file.h
+++ b/gdb/tui/tui-file.h
@@ -1,5 +1,5 @@
/* TUI_FILE - a STDIO-like output stream for the TUI.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -23,18 +23,21 @@
/* A STDIO-like output stream for the TUI. */
-class tui_file : public stdio_file
+class tui_file : public escape_buffering_file
{
public:
tui_file (FILE *stream, bool buffered)
- : stdio_file (stream),
+ : escape_buffering_file (stream),
m_buffered (buffered)
{}
- void write (const char *buf, long length_buf) override;
- void puts (const char *) override;
void flush () override;
+protected:
+
+ void do_write (const char *buf, long length_buf) override;
+ void do_puts (const char *) override;
+
private:
/* True if this stream is buffered. */
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index 69294cc..024fedd 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -1,6 +1,6 @@
/* GDB hooks for TUI.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -262,9 +262,7 @@ tui_remove_hooks (void)
tui_attach_detach_observers (false);
}
-void _initialize_tui_hooks ();
-void
-_initialize_tui_hooks ()
+INIT_GDB_FILE (tui_hooks)
{
/* Install the permanent hooks. */
gdb::observers::new_objfile.attach (tui_new_objfile_hook, "tui-hooks");
diff --git a/gdb/tui/tui-hooks.h b/gdb/tui/tui-hooks.h
index 21ba169..6fee785 100644
--- a/gdb/tui/tui-hooks.h
+++ b/gdb/tui/tui-hooks.h
@@ -1,6 +1,6 @@
/* External/Public TUI hools header file, for GDB the GNU debugger.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c
index 25761be..3d0e152 100644
--- a/gdb/tui/tui-interp.c
+++ b/gdb/tui/tui-interp.c
@@ -1,6 +1,6 @@
/* TUI Interpreter definitions for GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -161,9 +161,7 @@ tui_interp_factory (const char *name)
return new tui_interp (name);
}
-void _initialize_tui_interp ();
-void
-_initialize_tui_interp ()
+INIT_GDB_FILE (tui_interp)
{
interp_factory_register (INTERP_TUI, tui_interp_factory);
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index b3ede07..84cad93 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -1,6 +1,6 @@
/* TUI support I/O functions.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
@@ -319,6 +319,10 @@ tui_apply_style (WINDOW *w, ui_file_style style)
wattron (w, A_NORMAL);
wattroff (w, A_BOLD);
wattroff (w, A_DIM);
+#ifdef A_ITALIC
+ wattroff (w, A_ITALIC);
+#endif
+ wattroff (w, A_UNDERLINE);
wattroff (w, A_REVERSE);
if (last_color_pair != -1)
wattroff (w, COLOR_PAIR (last_color_pair));
@@ -366,6 +370,14 @@ tui_apply_style (WINDOW *w, ui_file_style style)
gdb_assert_not_reached ("invalid intensity");
}
+#ifdef A_ITALIC
+ if (style.is_italic ())
+ wattron (w, A_ITALIC);
+#endif
+
+ if (style.is_underline ())
+ wattron (w, A_UNDERLINE);
+
if (style.is_reverse ())
wattron (w, A_REVERSE);
diff --git a/gdb/tui/tui-io.h b/gdb/tui/tui-io.h
index 66b3b90..aa931f8 100644
--- a/gdb/tui/tui-io.h
+++ b/gdb/tui/tui-io.h
@@ -1,6 +1,6 @@
/* TUI support I/O functions.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 3fac65f..95d20fb 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -1,6 +1,6 @@
/* TUI layout window management.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
@@ -37,7 +37,6 @@
#include "tui/tui-layout.h"
#include "tui/tui-source.h"
#include "gdb_curses.h"
-#include "gdbsupport/gdb-safe-ctype.h"
/* The layouts. */
static std::vector<std::unique_ptr<tui_layout_split>> layouts;
@@ -381,14 +380,14 @@ tui_register_window (const char *name, window_factory &&factory)
for (const char &c : name_copy)
{
- if (ISSPACE (c))
+ if (c_isspace (c))
error (_("invalid whitespace character in window name"));
- if (!ISALNUM (c) && strchr ("-_.", c) == nullptr)
+ if (!c_isalnum (c) && strchr ("-_.", c) == nullptr)
error (_("invalid character '%c' in window name"), c);
}
- if (!ISALPHA (name_copy[0]))
+ if (!c_isalpha (name_copy[0]))
error (_("window name must start with a letter, not '%c'"), name_copy[0]);
/* We already check above for all the builtin window names. If we get
@@ -1294,9 +1293,7 @@ tui_new_layout_command (const char *spec, int from_tty)
/* Function to initialize gdb commands, for tui window layout
manipulation. */
-void _initialize_tui_layout ();
-void
-_initialize_tui_layout ()
+INIT_GDB_FILE (tui_layout)
{
struct cmd_list_element *layout_cmd
= add_basic_prefix_cmd ("layout", class_tui, _("\
diff --git a/gdb/tui/tui-layout.h b/gdb/tui/tui-layout.h
index 107b123..6046bb6 100644
--- a/gdb/tui/tui-layout.h
+++ b/gdb/tui/tui-layout.h
@@ -1,6 +1,6 @@
/* TUI layout window management.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
diff --git a/gdb/tui/tui-location.c b/gdb/tui/tui-location.c
index 8e63d4f..24a14fb 100644
--- a/gdb/tui/tui-location.c
+++ b/gdb/tui/tui-location.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/tui/tui-location.h b/gdb/tui/tui-location.h
index 5eda4bd..eecefbc 100644
--- a/gdb/tui/tui-location.h
+++ b/gdb/tui/tui-location.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 5158c06..ac2757a 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -1,6 +1,6 @@
/* TUI display registers in window.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
@@ -566,9 +566,7 @@ tui_reggroup_completer (struct cmd_list_element *ignore,
complete_on_enum (tracker, extra, text, word);
}
-void _initialize_tui_regs ();
-void
-_initialize_tui_regs ()
+INIT_GDB_FILE (tui_regs)
{
struct cmd_list_element **tuicmd, *cmd;
diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h
index 48f6aa0..5f7afa6 100644
--- a/gdb/tui/tui-regs.h
+++ b/gdb/tui/tui-regs.h
@@ -1,6 +1,6 @@
/* TUI display registers in window.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 2ef0308..e2dff84 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -1,6 +1,6 @@
/* TUI display source window.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
diff --git a/gdb/tui/tui-source.h b/gdb/tui/tui-source.h
index 10702b2..626ac40 100644
--- a/gdb/tui/tui-source.h
+++ b/gdb/tui/tui-source.h
@@ -1,6 +1,6 @@
/* TUI display source window.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
diff --git a/gdb/tui/tui-status.c b/gdb/tui/tui-status.c
index fa2d07c..1e09975 100644
--- a/gdb/tui/tui-status.c
+++ b/gdb/tui/tui-status.c
@@ -1,6 +1,6 @@
/* TUI status line.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
@@ -271,10 +271,14 @@ tui_show_frame_info (const frame_info_ptr &fi)
symtab_and_line sal = find_frame_sal (fi);
const char *func_name;
+ std::optional<CORE_ADDR> tmp_pc = get_frame_pc_if_available (fi);
/* find_frame_sal does not always set PC, but we want to ensure
that it is available in the SAL. */
- if (get_frame_pc_if_available (fi, &sal.pc))
- func_name = tui_get_function_from_frame (fi);
+ if (tmp_pc.has_value ())
+ {
+ sal.pc = *tmp_pc;
+ func_name = tui_get_function_from_frame (fi);
+ }
else
func_name = _("<unavailable>");
@@ -325,9 +329,7 @@ tui_update_command (const char *arg, int from_tty)
/* Function to initialize gdb commands, for tui window stack
manipulation. */
-void _initialize_tui_stack ();
-void
-_initialize_tui_stack ()
+INIT_GDB_FILE (tui_stack)
{
add_com ("update", class_tui, tui_update_command,
_("\
diff --git a/gdb/tui/tui-status.h b/gdb/tui/tui-status.h
index 8b507fd..2a84732 100644
--- a/gdb/tui/tui-status.h
+++ b/gdb/tui/tui-status.h
@@ -1,6 +1,6 @@
/* TUI status line.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 95639f5..b411d07 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -1,6 +1,6 @@
/* TUI window generic functions.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
@@ -45,7 +45,6 @@
#include "tui/tui-win.h"
#include "gdb_curses.h"
-#include <ctype.h>
#include "readline/readline.h"
#include <signal.h>
#include <string_view>
@@ -1041,7 +1040,7 @@ parse_scrolling_args (const char *arg,
/* Process the number of lines to scroll. */
std::string copy = arg;
buf_ptr = &copy[0];
- if (isdigit (*buf_ptr))
+ if (c_isdigit (*buf_ptr))
{
char *num_str;
@@ -1091,9 +1090,7 @@ bool tui_left_margin_verbose = false;
/* Function to initialize gdb commands, for tui window
manipulation. */
-void _initialize_tui_win ();
-void
-_initialize_tui_win ()
+INIT_GDB_FILE (tui_win)
{
static struct cmd_list_element *tui_setlist;
static struct cmd_list_element *tui_showlist;
diff --git a/gdb/tui/tui-win.h b/gdb/tui/tui-win.h
index 1521993..64153cf 100644
--- a/gdb/tui/tui-win.h
+++ b/gdb/tui/tui-win.h
@@ -1,6 +1,6 @@
/* TUI window generic functions.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index 90fdaceb..de4ef52 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -1,6 +1,6 @@
/* General window behavior.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
diff --git a/gdb/tui/tui-wingeneral.h b/gdb/tui/tui-wingeneral.h
index b037e79..0e0e5fe 100644
--- a/gdb/tui/tui-wingeneral.h
+++ b/gdb/tui/tui-wingeneral.h
@@ -1,6 +1,6 @@
/* General window behavior.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index b5889a8..2fe4914 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -1,6 +1,6 @@
/* TUI display source/assembly window.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
@@ -26,7 +26,6 @@
#include "value.h"
#include "source.h"
#include "objfiles.h"
-#include "gdbsupport/gdb-safe-ctype.h"
#include "tui/tui.h"
#include "tui/tui-data.h"
@@ -109,7 +108,7 @@ tui_copy_source_line (const char **ptr, int *length)
}
else if (c == '\t')
process_tab ();
- else if (ISCNTRL (c))
+ else if (c_iscntrl (c))
{
result.push_back ('^');
result.push_back (c + 0100);
@@ -461,7 +460,9 @@ tui_source_window_base::rerender ()
/* find_frame_sal does not always set SAL.PC, but we want to ensure
that it is available in the SAL before updating the window. */
- get_frame_pc_if_available (frame, &sal.pc);
+ std::optional<CORE_ADDR> tmp_pc = get_frame_pc_if_available (frame);
+ if (tmp_pc.has_value ())
+ sal.pc = *tmp_pc;
maybe_update (get_frame_arch (frame), sal);
update_exec_info (false);
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index deae786..b531f0e 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -1,6 +1,6 @@
/* TUI display source/assembly window.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 491fcb1..01aee2f 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -1,6 +1,6 @@
/* General functions for the WDB TUI.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
@@ -67,7 +67,12 @@ show_tui_debug (struct ui_file *file, int from_tty,
/* Tells whether the TUI is active or not. */
bool tui_active = false;
-static bool tui_finish_init = true;
+
+/* Tells whether the TUI should do deferred curses initialization.
+ If TRIBOOL_TRUE, then yes. If TRIBOOL_FALSE. then no (because
+ initialization is already done). If TRIBOOL_UNKNOWN, then no (because
+ initialization failed). */
+static tribool tui_finish_init = TRIBOOL_TRUE;
enum tui_key_mode tui_current_key_mode = TUI_COMMAND_MODE;
@@ -120,6 +125,19 @@ tui_rl_switch_mode (int notused1, int notused2)
}
else
{
+ /* If we type "foo", entering it into the readline buffer
+
+ (gdb) foo
+ ^
+ and then switch to TUI and back, we may get back
+
+ (gdb) foo
+ ^
+ which is confusing because "foo" is no longer part of the
+ readline buffer. Fix this by clearing it before switching to
+ TUI. */
+ rl_clear_visible_line ();
+
/* If tui_enable throws, we'll re-prep below. */
rl_deprep_terminal ();
tui_enable ();
@@ -392,7 +410,13 @@ tui_enable (void)
/* To avoid to initialize curses when gdb starts, there is a deferred
curses initialization. This initialization is made only once
and the first time the curses mode is entered. */
- if (tui_finish_init)
+ if (tui_finish_init == TRIBOOL_UNKNOWN)
+ {
+ /* Initialization failed before, just throw a generic error, don't try
+ again. */
+ error (_("Cannot enable the TUI"));
+ }
+ else if (tui_finish_init == TRIBOOL_TRUE)
{
WINDOW *w;
SCREEN *s;
@@ -412,6 +436,9 @@ tui_enable (void)
if (!gdb_stderr->isatty ())
error (_("Cannot enable the TUI when output is not a terminal"));
+ /* Don't try initialization again. */
+ tui_finish_init = TRIBOOL_UNKNOWN;
+
s = newterm (NULL, stdout, stdin);
#ifdef __MINGW32__
/* The MinGW port of ncurses requires $TERM to be unset in order
@@ -470,7 +497,7 @@ tui_enable (void)
tui_set_win_focus_to (tui_src_win ());
keypad (tui_cmd_win ()->handle.get (), TRUE);
wrefresh (tui_cmd_win ()->handle.get ());
- tui_finish_init = false;
+ tui_finish_init = TRIBOOL_FALSE;
}
else
{
@@ -604,9 +631,7 @@ tui_get_command_dimension (unsigned int *width,
return true;
}
-void _initialize_tui ();
-void
-_initialize_tui ()
+INIT_GDB_FILE (tui)
{
struct cmd_list_element **tuicmd;
diff --git a/gdb/tui/tui.h b/gdb/tui/tui.h
index 319bd2e..3a9d955 100644
--- a/gdb/tui/tui.h
+++ b/gdb/tui/tui.h
@@ -1,6 +1,6 @@
/* External/Public TUI Header File.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
diff --git a/gdb/type-codes.def b/gdb/type-codes.def
index 50af1ae..e52650d 100644
--- a/gdb/type-codes.def
+++ b/gdb/type-codes.def
@@ -1,6 +1,6 @@
/* Type codes for GDB.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/type-stack.c b/gdb/type-stack.c
index 09348df..b9266b8 100644
--- a/gdb/type-stack.c
+++ b/gdb/type-stack.c
@@ -1,6 +1,6 @@
/* Type stack for GDB parser.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,7 +20,6 @@
#include "type-stack.h"
#include "gdbtypes.h"
-#include "parser-defs.h"
/* See type-stack.h. */
@@ -51,7 +50,7 @@ type_stack::insert (enum type_pieces tp)
/* See type-stack.h. */
void
-type_stack::insert (struct expr_builder *pstate, const char *string)
+type_stack::insert (struct gdbarch *gdbarch, const char *string)
{
union type_stack_elt element;
int slot;
@@ -67,8 +66,7 @@ type_stack::insert (struct expr_builder *pstate, const char *string)
element.piece = tp_space_identifier;
insert_into (slot, element);
element.int_val
- = address_space_name_to_type_instance_flags (pstate->gdbarch (),
- string);
+ = address_space_name_to_type_instance_flags (gdbarch, string);
insert_into (slot, element);
}
diff --git a/gdb/type-stack.h b/gdb/type-stack.h
index 87c0fe2..eeb2f35 100644
--- a/gdb/type-stack.h
+++ b/gdb/type-stack.h
@@ -1,6 +1,6 @@
/* Type stack for GDB parser.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -26,34 +26,49 @@
struct type;
struct expr_builder;
-/* For parsing of complicated types.
- An array should be preceded in the list by the size of the array. */
+/* The kind of element on the stack of types and qualifiers, used for
+ parsing complicated types. */
enum type_pieces
- {
- tp_end = -1,
- tp_pointer,
- tp_reference,
- tp_rvalue_reference,
- tp_array,
- tp_function,
- tp_function_with_arguments,
- tp_const,
- tp_volatile,
- tp_space_identifier,
- tp_atomic,
- tp_restrict,
- tp_type_stack,
- tp_kind
- };
-
-/* The stack can contain either an enum type_pieces or an int. */
+{
+ /* This is returned by pop() to indicate that the stack is empty.
+ Note that it may not be pushed by the user. */
+ tp_end = -1,
+ tp_pointer,
+ tp_reference,
+ tp_rvalue_reference,
+ /* An array type, where the dimension is pushed on the stack as
+ well. */
+ tp_array,
+ tp_function,
+ /* A function with argument types; the types are also pushed on the
+ stack. */
+ tp_function_with_arguments,
+ tp_const,
+ tp_volatile,
+ /* An address space identifier. The address space is also pushed on
+ the stack. */
+ tp_space_identifier,
+ tp_atomic,
+ tp_restrict,
+ /* A separate type stack, which is also pushed onto this type
+ stack. */
+ tp_type_stack,
+ /* Fortran-specific, specifies the kind. */
+ tp_kind,
+};
+
+/* Items on the type stack. */
union type_stack_elt
- {
- enum type_pieces piece;
- int int_val;
- struct type_stack *stack_val;
- std::vector<struct type *> *typelist_val;
- };
+{
+ /* An ordinary type qualifier. */
+ enum type_pieces piece;
+ /* An integer value. Currently only used for address spaces. */
+ int int_val;
+ /* Another type stack. */
+ struct type_stack *stack_val;
+ /* A list of types. */
+ std::vector<struct type *> *typelist_val;
+};
/* The type stack is an instance of this structure. */
@@ -80,18 +95,31 @@ public:
void insert (enum type_pieces tp);
+ /* Push an ordinary element on the type stack. This can be used for
+ any element that doesn't require any extra data. */
void push (enum type_pieces tp)
{
+ /* tp_end can only be returned by this class, not pushed. The
+ others require a payload on the stack and so can only be pushed
+ by the appropriate method. */
+ gdb_assert (tp != tp_end);
+ gdb_assert (!requires_payload (tp));
type_stack_elt elt;
elt.piece = tp;
m_elements.push_back (elt);
}
- void push (int n)
+ /* Push an element and an integer value onto the stack. The integer
+ value is pushed first, followed by TP. Only piece kinds that
+ accept an integer argument are allowed. */
+ void push (enum type_pieces tp, int n)
{
+ gdb_assert (tp == tp_array || tp == tp_space_identifier || tp == tp_kind);
type_stack_elt elt;
elt.int_val = n;
m_elements.push_back (elt);
+ elt.piece = tp;
+ m_elements.push_back (elt);
}
/* Push the type stack STACK as an element on this type stack. */
@@ -101,11 +129,12 @@ public:
type_stack_elt elt;
elt.stack_val = stack;
m_elements.push_back (elt);
- push (tp_type_stack);
+ elt.piece = tp_type_stack;
+ m_elements.push_back (elt);
}
- /* Push a function type with arguments onto the global type stack.
- LIST holds the argument types. If the final item in LIST is NULL,
+ /* Push a function type with arguments onto this type stack. LIST
+ holds the argument types. If the final item in LIST is NULL,
then the function will be varargs. */
void push (std::vector<struct type *> *list)
@@ -113,35 +142,51 @@ public:
type_stack_elt elt;
elt.typelist_val = list;
m_elements.push_back (elt);
- push (tp_function_with_arguments);
+ elt.piece = tp_function_with_arguments;
+ m_elements.push_back (elt);
}
+ /* Pop the topmost element of the stack and return it.
+
+ If the stack is empty, tp_end is returned.
+
+ If the topmost element requires a payload -- for example,
+ tp_array takes an integer parameter -- then the value is returned
+ but *not* popped from the stack. Instead the appropriate
+ payload-specific pop_* method (e.g., pop_int) must then be
+ called. This somewhat odd approach ensures that the stack can't
+ be put into an invalid state. */
enum type_pieces pop ()
{
if (m_elements.empty ())
return tp_end;
type_stack_elt elt = m_elements.back ();
- m_elements.pop_back ();
+ if (!requires_payload (elt.piece))
+ m_elements.pop_back ();
return elt.piece;
}
int pop_int ()
{
- if (m_elements.empty ())
- {
- /* "Can't happen". */
- return 0;
- }
+ gdb_assert (m_elements.size () >= 2);
type_stack_elt elt = m_elements.back ();
m_elements.pop_back ();
+ type_pieces tp = elt.piece;
+ gdb_assert (tp == tp_array || tp == tp_space_identifier || tp == tp_kind);
+ elt = m_elements.back ();
+ m_elements.pop_back ();
return elt.int_val;
}
std::vector<struct type *> *pop_typelist ()
{
- gdb_assert (!m_elements.empty ());
+ gdb_assert (m_elements.size () >= 2);
type_stack_elt elt = m_elements.back ();
m_elements.pop_back ();
+ type_pieces tp = elt.piece;
+ gdb_assert (tp == tp_function_with_arguments);
+ elt = m_elements.back ();
+ m_elements.pop_back ();
return elt.typelist_val;
}
@@ -149,9 +194,13 @@ public:
struct type_stack *pop_type_stack ()
{
- gdb_assert (!m_elements.empty ());
+ gdb_assert (m_elements.size () >= 2);
type_stack_elt elt = m_elements.back ();
m_elements.pop_back ();
+ type_pieces tp = elt.piece;
+ gdb_assert (tp == tp_type_stack);
+ elt = m_elements.back ();
+ m_elements.pop_back ();
return elt.stack_val;
}
@@ -163,7 +212,7 @@ public:
stack is a tp_pointer, and the new values are inserted above the
first item. */
- void insert (struct expr_builder *pstate, const char *string);
+ void insert (struct gdbarch *gdbarch, const char *string);
/* Append the elements of the type stack FROM to the type stack
THIS. Always returns THIS. */
@@ -188,9 +237,9 @@ public:
private:
- /* A helper function for insert_type and insert_type_address_space.
- This does work of expanding the type stack and inserting the new
- element, ELEMENT, into the stack at location SLOT. */
+ /* A helper function for the insert methods. This does work of
+ expanding the type stack and inserting the new element, ELEMENT,
+ into the stack at location SLOT. */
void insert_into (int slot, union type_stack_elt element)
{
@@ -198,6 +247,14 @@ private:
m_elements.insert (m_elements.begin () + slot, element);
}
+ /* Return true if TP requires some payload element. */
+ bool requires_payload (type_pieces tp) const
+ {
+ return (tp == tp_array || tp == tp_kind || tp == tp_type_stack
+ || tp == tp_function_with_arguments
+ || tp == tp_space_identifier);
+ }
+
/* Elements on the stack. */
std::vector<union type_stack_elt> m_elements;
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 6494103..42fbf38 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -1,6 +1,6 @@
/* Language independent support for printing types for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -31,7 +31,6 @@
#include "cp-abi.h"
#include "typeprint.h"
#include "valprint.h"
-#include <ctype.h>
#include "cli/cli-utils.h"
#include "extension.h"
#include "completer.h"
@@ -219,7 +218,7 @@ typedef_hash_table::add_template_parameters (struct type *t)
struct decl_field *tf;
/* We only want type-valued template parameters in the hash. */
- if (TYPE_TEMPLATE_ARGUMENT (t, i)->aclass () != LOC_TYPEDEF)
+ if (TYPE_TEMPLATE_ARGUMENT (t, i)->loc_class () != LOC_TYPEDEF)
continue;
tf = XOBNEW (&m_storage, struct decl_field);
@@ -367,7 +366,7 @@ whatis_exp (const char *exp, int show)
{
int seen_one = 0;
- for (++exp; *exp && !isspace (*exp); ++exp)
+ for (++exp; *exp && !c_isspace (*exp); ++exp)
{
switch (*exp)
{
@@ -413,7 +412,7 @@ whatis_exp (const char *exp, int show)
if (!*exp && !seen_one)
error (_("flag expected"));
- if (!isspace (*exp))
+ if (!c_isspace (*exp))
error (_("expected space after format"));
exp = skip_spaces (exp);
}
@@ -735,9 +734,7 @@ Display of struct members offsets and sizes in hexadecimal is %s\n"),
value);
}
-void _initialize_typeprint ();
-void
-_initialize_typeprint ()
+INIT_GDB_FILE (typeprint)
{
struct cmd_list_element *c;
diff --git a/gdb/typeprint.h b/gdb/typeprint.h
index 7f1fbf4..21931e7 100644
--- a/gdb/typeprint.h
+++ b/gdb/typeprint.h
@@ -1,5 +1,5 @@
/* Language independent support for printing types for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/ui-file.c b/gdb/ui-file.c
index e9d3a90..2e5c06f 100644
--- a/gdb/ui-file.c
+++ b/gdb/ui-file.c
@@ -1,6 +1,6 @@
/* UI_FILE - a generic STDIO like output stream.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -88,18 +88,6 @@ ui_file::emit_style_escape (const ui_file_style &style)
/* See ui-file.h. */
void
-ui_file::reset_style ()
-{
- if (can_emit_style_escape ())
- {
- m_applied_style = ui_file_style ();
- this->puts (m_applied_style.to_ansi ().c_str ());
- }
-}
-
-/* See ui-file.h. */
-
-void
ui_file::printchar (int c, int quoter, bool async_safe)
{
char buf[4];
@@ -420,7 +408,7 @@ tee_file::can_emit_style_escape ()
/* See ui-file.h. */
void
-no_terminal_escape_file::write (const char *buf, long length_buf)
+escape_buffering_file::write (const char *buf, long length_buf)
{
std::string copy (buf, length_buf);
this->puts (copy.c_str ());
@@ -429,7 +417,60 @@ no_terminal_escape_file::write (const char *buf, long length_buf)
/* See ui-file.h. */
void
-no_terminal_escape_file::puts (const char *buf)
+escape_buffering_file::puts (const char *buf)
+{
+ std::string local_buffer;
+ if (!m_buffer.empty ())
+ {
+ gdb_assert (m_buffer[0] == '\033');
+ m_buffer += buf;
+ /* If we need to keep buffering, we'll handle that below. */
+ local_buffer = std::move (m_buffer);
+ buf = local_buffer.c_str ();
+ }
+
+ while (*buf != '\0')
+ {
+ const char *esc = strchr (buf, '\033');
+ if (esc == nullptr)
+ break;
+
+ /* First, write out any prefix. */
+ if (esc > buf)
+ {
+ do_write (buf, esc - buf);
+ buf = esc;
+ }
+
+ int n_read = 0;
+ ansi_escape_result seen = examine_ansi_escape (esc, &n_read);
+ if (seen == ansi_escape_result::INCOMPLETE)
+ {
+ /* Start buffering. */
+ m_buffer = buf;
+ return;
+ }
+ else if (seen == ansi_escape_result::NO_MATCH)
+ {
+ /* Just emit the ESC . */
+ n_read = 1;
+ }
+ else
+ gdb_assert (seen == ansi_escape_result::MATCHED);
+
+ do_write (esc, n_read);
+ buf += n_read;
+ }
+
+ /* If there is any data remaining in BUF, we can flush it now. */
+ if (*buf != '\0')
+ do_puts (buf);
+}
+
+/* See ui-file.h. */
+
+void
+no_terminal_escape_file::do_puts (const char *buf)
{
while (*buf != '\0')
{
@@ -450,6 +491,13 @@ no_terminal_escape_file::puts (const char *buf)
}
void
+no_terminal_escape_file::do_write (const char *buf, long len)
+{
+ std::string copy (buf, len);
+ do_puts (copy.c_str ());
+}
+
+void
timestamped_file::write (const char *buf, long len)
{
if (debug_timestamp)
diff --git a/gdb/ui-file.h b/gdb/ui-file.h
index 5379bb3..1219bde 100644
--- a/gdb/ui-file.h
+++ b/gdb/ui-file.h
@@ -1,5 +1,5 @@
/* UI_FILE - a generic STDIO like output stream.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -123,9 +123,6 @@ public:
/* Emit an ANSI style escape for STYLE. */
virtual void emit_style_escape (const ui_file_style &style);
- /* Rest the current output style to the empty style. */
- virtual void reset_style ();
-
/* Print STR, bypassing any paging that might be done by this
ui_file. Note that nearly no code should call this -- it's
intended for use by gdb_printf, but nothing else. */
@@ -353,12 +350,6 @@ public:
m_two->emit_style_escape (style);
}
- void reset_style () override
- {
- m_one->reset_style ();
- m_two->reset_style ();
- }
-
void puts_unfiltered (const char *str) override
{
m_one->puts_unfiltered (str);
@@ -371,28 +362,58 @@ private:
ui_file *m_two;
};
+/* A ui_file implementation that buffers terminal escape sequences.
+ Note that this does not buffer in general -- it only buffers when
+ an incomplete but potentially recognizable escape sequence is
+ started. */
+
+class escape_buffering_file : public stdio_file
+{
+public:
+ using stdio_file::stdio_file;
+
+ /* Like the stdio_file methods but these forward to do_write and
+ do_puts, respectively. */
+ void write (const char *buf, long length_buf) override final;
+ void puts (const char *linebuffer) override final;
+
+ /* This class does not override 'flush'. While it does have an
+ internal buffer, it does not really make sense to flush the
+ buffer until an escape sequence has been fully processed. */
+
+protected:
+
+ /* Called to output some text. If the text contains a recognizable
+ terminal escape sequence, then it is guaranteed to be complete.
+ "Recognizable" here means that examine_ansi_escape did not return
+ INCOMPLETE. */
+ virtual void do_puts (const char *buf) = 0;
+ virtual void do_write (const char *buf, long len) = 0;
+
+private:
+
+ /* Buffer used only for incomplete escape sequences. */
+ std::string m_buffer;
+};
+
/* A ui_file implementation that filters out terminal escape
sequences. */
-class no_terminal_escape_file : public stdio_file
+class no_terminal_escape_file : public escape_buffering_file
{
public:
no_terminal_escape_file ()
{
}
- /* Like the stdio_file methods, but these filter out terminal escape
- sequences. */
- void write (const char *buf, long length_buf) override;
- void puts (const char *linebuffer) override;
-
void emit_style_escape (const ui_file_style &style) override
{
}
- void reset_style () override
- {
- }
+protected:
+
+ void do_puts (const char *linebuffer) override;
+ void do_write (const char *buf, long len) override;
};
/* A base class for ui_file types that wrap another ui_file. */
@@ -419,10 +440,6 @@ public:
void emit_style_escape (const ui_file_style &style) override
{ m_stream->emit_style_escape (style); }
- /* Rest the current output style to the empty style. */
- void reset_style () override
- { m_stream->reset_style (); }
-
int fd () const override
{ return m_stream->fd (); }
diff --git a/gdb/ui-out.c b/gdb/ui-out.c
index 41ce6ef..7683927 100644
--- a/gdb/ui-out.c
+++ b/gdb/ui-out.c
@@ -1,6 +1,6 @@
/* Output generating routines for GDB.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
Written by Fernando Nasser for Cygnus.
@@ -586,7 +586,7 @@ ui_out::vmessage (const ui_file_style &in_style, const char *format,
for (auto &&piece : fpieces)
{
- const char *current_substring = piece.string;
+ const char *current_substring = fpieces.piece_str (piece);
gdb_assert (piece.n_int_args >= 0 && piece.n_int_args <= 2);
int intvals[2] = { 0, 0 };
diff --git a/gdb/ui-out.h b/gdb/ui-out.h
index 5d03281..1796e9c 100644
--- a/gdb/ui-out.h
+++ b/gdb/ui-out.h
@@ -1,6 +1,6 @@
/* Output generating routines for GDB.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
Written by Fernando Nasser for Cygnus.
diff --git a/gdb/ui-style.c b/gdb/ui-style.c
index f0a8e81..d450c3e 100644
--- a/gdb/ui-style.c
+++ b/gdb/ui-style.c
@@ -1,5 +1,5 @@
/* Styling for ui_file
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,12 +21,14 @@
#include "gdbsupport/gdb_regex.h"
/* A regular expression that is used for matching ANSI terminal escape
- sequences. */
+ sequences. Note that this will actually match any prefix of such a
+ sequence. This property is used so that other code can buffer
+ incomplete sequences as needed. */
static const char ansi_regex_text[] =
- /* Introduction. */
- "^\033\\["
-#define DATA_SUBEXP 1
+ /* Introduction. Only the escape character is truly required. */
+ "^\033(\\["
+#define DATA_SUBEXP 2
/* Capture parameter and intermediate bytes. */
"("
/* Parameter bytes. */
@@ -36,16 +38,17 @@ static const char ansi_regex_text[] =
/* End the first capture. */
")"
/* The final byte. */
-#define FINAL_SUBEXP 2
- "([\x40-\x7e])";
+#define FINAL_SUBEXP 3
+ "([\x40-\x7e]))?";
/* The number of subexpressions to allocate space for, including the
"0th" whole match subexpression. */
-#define NUM_SUBEXPRESSIONS 3
+#define NUM_SUBEXPRESSIONS 4
/* The compiled form of ansi_regex_text. */
-static regex_t ansi_regex;
+static compiled_regex ansi_regex (ansi_regex_text, REG_EXTENDED,
+ _("Error in ANSI terminal escape sequences regex"));
/* This maps 8-color palette to RGB triples. The values come from
plain linux terminal. */
@@ -287,6 +290,16 @@ ui_file_style::to_ansi () const
else
result.append (std::to_string (m_intensity));
result.push_back (';');
+ if (m_italic)
+ result.append ("3");
+ else
+ result.append ("23");
+ result.push_back (';');
+ if (m_underline)
+ result.append ("4");
+ else
+ result.append ("24");
+ result.push_back (';');
if (m_reverse)
result.push_back ('7');
else
@@ -364,12 +377,21 @@ ui_file_style::parse (const char *buf, size_t *n_read)
{
regmatch_t subexps[NUM_SUBEXPRESSIONS];
- int match = regexec (&ansi_regex, buf, ARRAY_SIZE (subexps), subexps, 0);
+ int match = ansi_regex.exec (buf, ARRAY_SIZE (subexps), subexps, 0);
if (match == REG_NOMATCH)
{
*n_read = 0;
return false;
}
+
+ /* If the final subexpression did not match, then that means there
+ was an incomplete sequence. These are ignored here. */
+ if (subexps[FINAL_SUBEXP].rm_so == -1)
+ {
+ *n_read = 0;
+ return false;
+ }
+
/* Other failures mean the regexp is broken. */
gdb_assert (match == 0);
/* The regexp is anchored. */
@@ -423,6 +445,14 @@ ui_file_style::parse (const char *buf, size_t *n_read)
/* Dim. */
m_intensity = DIM;
break;
+ case 3:
+ /* Italic. */
+ m_italic = true;
+ break;
+ case 4:
+ /* Underline. */
+ m_underline = true;
+ break;
case 7:
/* Reverse. */
m_reverse = true;
@@ -434,6 +464,14 @@ ui_file_style::parse (const char *buf, size_t *n_read)
/* Normal. */
m_intensity = NORMAL;
break;
+ case 23:
+ /* Non-italic. */
+ m_italic = false;
+ break;
+ case 24:
+ /* Non-underline. */
+ m_underline = false;
+ break;
case 27:
/* Inverse off. */
m_reverse = false;
@@ -526,27 +564,25 @@ ui_file_style::parse (const char *buf, size_t *n_read)
/* See ui-style.h. */
-bool
-skip_ansi_escape (const char *buf, int *n_read)
+ansi_escape_result
+examine_ansi_escape (const char *buf, int *n_read)
{
+ gdb_assert (*buf == '\033');
+
regmatch_t subexps[NUM_SUBEXPRESSIONS];
- int match = regexec (&ansi_regex, buf, ARRAY_SIZE (subexps), subexps, 0);
- if (match == REG_NOMATCH || buf[subexps[FINAL_SUBEXP].rm_so] != 'm')
- return false;
+ int match = ansi_regex.exec (buf, ARRAY_SIZE (subexps), subexps, 0);
+ if (match == REG_NOMATCH)
+ return ansi_escape_result::NO_MATCH;
- *n_read = subexps[FINAL_SUBEXP].rm_eo;
- return true;
-}
+ if (subexps[FINAL_SUBEXP].rm_so == -1)
+ return ansi_escape_result::INCOMPLETE;
-void _initialize_ui_style ();
-void
-_initialize_ui_style ()
-{
- int code = regcomp (&ansi_regex, ansi_regex_text, REG_EXTENDED);
- /* If the regular expression was incorrect, it was a programming
- error. */
- gdb_assert (code == 0);
+ if (buf[subexps[FINAL_SUBEXP].rm_so] != 'm')
+ return ansi_escape_result::NO_MATCH;
+
+ *n_read = subexps[FINAL_SUBEXP].rm_eo;
+ return ansi_escape_result::MATCHED;
}
/* See ui-style.h. */
@@ -558,7 +594,11 @@ colorsupport ()
{
std::vector<color_space> result = {color_space::MONOCHROME};
- int colors = tgetnum ("Co");
+ /* ncurses versions prior to 6.1 (and other curses
+ implementations) declare the tgetnum argument to be
+ 'char *', so we need the const_cast, since C++ will not
+ implicitly convert. */
+ int colors = tgetnum (const_cast<char*> ("Co"));
if (colors >= 8)
result.push_back (color_space::ANSI_8COLOR);
if (colors >= 16)
diff --git a/gdb/ui-style.h b/gdb/ui-style.h
index 4e99496..64f710b 100644
--- a/gdb/ui-style.h
+++ b/gdb/ui-style.h
@@ -1,5 +1,5 @@
/* Styling for ui_file
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -266,7 +266,9 @@ struct ui_file_style
return (m_foreground == other.m_foreground
&& m_background == other.m_background
&& m_intensity == other.m_intensity
- && m_reverse == other.m_reverse);
+ && m_reverse == other.m_reverse
+ && m_italic == other.m_italic
+ && m_underline == other.m_underline);
}
bool operator!= (const ui_file_style &other) const
@@ -284,7 +286,9 @@ struct ui_file_style
return (m_foreground == NONE
&& m_background == NONE
&& m_intensity == NORMAL
- && !m_reverse);
+ && !m_reverse
+ && !m_italic
+ && !m_underline);
}
/* Return true if this style specified reverse display; false
@@ -330,6 +334,38 @@ struct ui_file_style
return m_intensity;
}
+ /* Set the intensity of this style. */
+ void set_intensity (intensity i)
+ {
+ m_intensity = i;
+ }
+
+ /* Return true if this style specified italic display; false
+ otherwise. */
+ bool is_italic () const
+ {
+ return m_italic;
+ }
+
+ /* Set/clear the italic display flag. */
+ void set_italic (bool italic)
+ {
+ m_italic = italic;
+ }
+
+ /* Return true if this style specified underline display; false
+ otherwise. */
+ bool is_underline () const
+ {
+ return m_underline;
+ }
+
+ /* Set/clear the underline display flag. */
+ void set_underline (bool underline)
+ {
+ m_underline = underline;
+ }
+
/* Parse an ANSI escape sequence in BUF, modifying this style. BUF
must begin with an ESC character. Return true if an escape
sequence was successfully parsed; false otherwise. In either
@@ -351,14 +387,40 @@ private:
color m_foreground = NONE;
color m_background = NONE;
intensity m_intensity = NORMAL;
+ bool m_italic = false;
+ bool m_underline = false;
bool m_reverse = false;
};
+/* Possible results for checking an ANSI escape sequence. */
+enum class ansi_escape_result
+{
+ /* The escape sequence is definitely not recognizable. */
+ NO_MATCH,
+
+ /* The escape sequence might be recognizable with more input. */
+ INCOMPLETE,
+
+ /* The escape sequence is definitely recognizable. */
+ MATCHED,
+};
+
+/* Examine an ANSI escape sequence in BUF. BUF must begin with an ESC
+ character. Return a value indicating whether the sequence was
+ recognizable. If MATCHED is returned, then N_READ is updated to
+ reflect the number of chars read from BUF. */
+
+extern ansi_escape_result examine_ansi_escape (const char *buf, int *n_read);
+
/* Skip an ANSI escape sequence in BUF. BUF must begin with an ESC
character. Return true if an escape sequence was successfully
skipped; false otherwise. If an escape sequence was skipped,
N_READ is updated to reflect the number of chars read from BUF. */
-extern bool skip_ansi_escape (const char *buf, int *n_read);
+static inline bool
+skip_ansi_escape (const char *buf, int *n_read)
+{
+ return examine_ansi_escape (buf, n_read) == ansi_escape_result::MATCHED;
+}
#endif /* GDB_UI_STYLE_H */
diff --git a/gdb/ui.c b/gdb/ui.c
index 88a3a14..cd23399 100644
--- a/gdb/ui.c
+++ b/gdb/ui.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2023-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -237,9 +237,7 @@ new_ui_command (const char *args, int from_tty)
gdb_printf ("New UI allocated\n");
}
-void _initialize_ui ();
-void
-_initialize_ui ()
+INIT_GDB_FILE (ui)
{
cmd_list_element *c = add_cmd ("new-ui", class_support, new_ui_command, _("\
Create a new UI.\n\
diff --git a/gdb/ui.h b/gdb/ui.h
index 3380bf2..61bfd2d 100644
--- a/gdb/ui.h
+++ b/gdb/ui.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2023-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -227,7 +227,9 @@ using ui_range = next_range<ui>;
static inline
ui_range all_uis ()
{
- return ui_range (ui_list);
+ next_iterator<ui> begin (ui_list);
+
+ return ui_range (std::move (begin));
}
#endif /* GDB_UI_H */
diff --git a/gdb/unittests/array-view-selftests.c b/gdb/unittests/array-view-selftests.c
index cc3fcfd..914800a 100644
--- a/gdb/unittests/array-view-selftests.c
+++ b/gdb/unittests/array-view-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for array_view for GDB, the GNU debugger.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -695,9 +695,7 @@ run_copy_tests ()
} /* namespace array_view_tests */
} /* namespace selftests */
-void _initialize_array_view_selftests ();
-void
-_initialize_array_view_selftests ()
+INIT_GDB_FILE (array_view_selftests)
{
selftests::register_test ("array_view",
selftests::array_view_tests::run_tests);
diff --git a/gdb/unittests/child-path-selftests.c b/gdb/unittests/child-path-selftests.c
index 4c4014d..95b2c34 100644
--- a/gdb/unittests/child-path-selftests.c
+++ b/gdb/unittests/child-path-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for child_path for GDB, the GNU debugger.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -58,9 +58,7 @@ test ()
}
}
-void _initialize_child_path_selftests ();
-void
-_initialize_child_path_selftests ()
+INIT_GDB_FILE (child_path_selftests)
{
selftests::register_test ("child_path",
selftests::child_path::test);
diff --git a/gdb/unittests/cli-utils-selftests.c b/gdb/unittests/cli-utils-selftests.c
index 6ade3af..1382ca6 100644
--- a/gdb/unittests/cli-utils-selftests.c
+++ b/gdb/unittests/cli-utils-selftests.c
@@ -1,6 +1,6 @@
/* Unit tests for the cli-utils.c file.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -109,9 +109,7 @@ test_cli_utils ()
}
}
-void _initialize_cli_utils_selftests ();
-void
-_initialize_cli_utils_selftests ()
+INIT_GDB_FILE (cli_utils_selftests)
{
selftests::register_test ("cli_utils",
selftests::cli_utils::test_cli_utils);
diff --git a/gdb/unittests/command-def-selftests.c b/gdb/unittests/command-def-selftests.c
index 1579511..095b57f 100644
--- a/gdb/unittests/command-def-selftests.c
+++ b/gdb/unittests/command-def-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for GDB command definitions for GDB, the GNU debugger.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -72,7 +72,7 @@ check_doc (struct cmd_list_element *commandlist, const char *prefix)
"first line is not terminated with a '.' character");
/* Checks the doc is not terminated with a new line. */
- if (isspace (c->doc[strlen (c->doc) - 1]))
+ if (c_isspace (c->doc[strlen (c->doc) - 1]))
broken_doc_invariant
(prefix, c->name,
"has superfluous trailing whitespace");
@@ -87,7 +87,7 @@ check_doc (struct cmd_list_element *commandlist, const char *prefix)
else
{
/* \n\n is ok, so we check that explicitly here. */
- if (isspace (nl[-1]) && nl[-1] != '\n')
+ if (c_isspace (nl[-1]) && nl[-1] != '\n')
broken_doc_invariant (prefix, c->name,
"has whitespace before a newline");
}
@@ -219,9 +219,7 @@ command_structure_invariants_tests ()
} /* namespace selftests */
-void _initialize_command_def_selftests ();
-void
-_initialize_command_def_selftests ()
+INIT_GDB_FILE (command_def_selftests)
{
selftests::register_test
("help_doc_invariants",
diff --git a/gdb/unittests/common-utils-selftests.c b/gdb/unittests/common-utils-selftests.c
index e66e380..ecc4769 100644
--- a/gdb/unittests/common-utils-selftests.c
+++ b/gdb/unittests/common-utils-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for general utility routines for GDB, the GNU debugger.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -127,9 +127,7 @@ string_vappendf_tests ()
} /* namespace selftests */
-void _initialize_common_utils_selftests ();
-void
-_initialize_common_utils_selftests ()
+INIT_GDB_FILE (common_utils_selftests)
{
selftests::register_test ("string_printf", selftests::string_printf_tests);
selftests::register_test ("string_vprintf", selftests::string_vprintf_tests);
diff --git a/gdb/unittests/copy_bitwise-selftests.c b/gdb/unittests/copy_bitwise-selftests.c
index c9f61b0..6fcdcd7 100644
--- a/gdb/unittests/copy_bitwise-selftests.c
+++ b/gdb/unittests/copy_bitwise-selftests.c
@@ -1,6 +1,6 @@
/* Self tests of the copy_bitwise routine for GDB, the GNU debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -151,9 +151,7 @@ copy_bitwise_tests (void)
} /* namespace selftests */
-void _initialize_copy_bitwise_utils_selftests ();
-void
-_initialize_copy_bitwise_utils_selftests ()
+INIT_GDB_FILE (copy_bitwise_utils_selftests)
{
selftests::register_test ("copy_bitwise", selftests::copy_bitwise_tests);
}
diff --git a/gdb/unittests/enum-flags-selftests.c b/gdb/unittests/enum-flags-selftests.c
index f192da3..3eb0f52 100644
--- a/gdb/unittests/enum-flags-selftests.c
+++ b/gdb/unittests/enum-flags-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for enum-flags for GDB, the GNU debugger.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -607,10 +607,7 @@ self_test ()
} /* namespace enum_flags_tests */
} /* namespace selftests */
-void _initialize_enum_flags_selftests ();
-
-void
-_initialize_enum_flags_selftests ()
+INIT_GDB_FILE (enum_flags_selftests)
{
selftests::register_test ("enum-flags",
selftests::enum_flags_tests::self_test);
diff --git a/gdb/unittests/environ-selftests.c b/gdb/unittests/environ-selftests.c
index 9bd7360..5ac3384 100644
--- a/gdb/unittests/environ-selftests.c
+++ b/gdb/unittests/environ-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for gdb_environ for GDB, the GNU debugger.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -297,9 +297,7 @@ run_tests ()
} /* namespace gdb_environ */
} /* namespace selftests */
-void _initialize_environ_selftests ();
-void
-_initialize_environ_selftests ()
+INIT_GDB_FILE (environ_selftests)
{
selftests::register_test ("gdb_environ",
selftests::gdb_environ_tests::run_tests);
diff --git a/gdb/unittests/filtered_iterator-selftests.c b/gdb/unittests/filtered_iterator-selftests.c
index dc76fe0..455caf2 100644
--- a/gdb/unittests/filtered_iterator-selftests.c
+++ b/gdb/unittests/filtered_iterator-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for the filtered_iterator class.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -115,9 +115,32 @@ test_filtered_iterator ()
std::vector<int> even_ints;
const std::vector<int> expected_even_ints { 4, 4, 6, 8 };
+ int_array_iterator begin (array, ARRAY_SIZE (array));
+ int_array_iterator end;
filtered_iterator<int_array_iterator, even_numbers_only>
- iter (array, ARRAY_SIZE (array));
- filtered_iterator<int_array_iterator, even_numbers_only> end;
+ filtered_iter (begin, end);
+ filtered_iterator<int_array_iterator, even_numbers_only>
+ filtered_end (end, end);
+
+ for (; filtered_iter != filtered_end; ++filtered_iter)
+ even_ints.push_back (*filtered_iter);
+
+ SELF_CHECK (even_ints == expected_even_ints);
+}
+
+/* Same as the above, but using pointers as the iterator base type. */
+
+static void
+test_filtered_iterator_ptr ()
+{
+ int array[] = { 4, 4, 5, 6, 7, 8, 9 };
+ std::vector<int> even_ints;
+ const std::vector<int> expected_even_ints { 4, 4, 6, 8 };
+
+ filtered_iterator<int *, even_numbers_only> iter
+ (array, array + ARRAY_SIZE (array));
+ filtered_iterator<int *, even_numbers_only> end
+ (array + ARRAY_SIZE (array), array + ARRAY_SIZE (array));
for (; iter != end; ++iter)
even_ints.push_back (*iter);
@@ -132,10 +155,40 @@ test_filtered_iterator_eq ()
{
int array[] = { 4, 4, 5, 6, 7, 8, 9 };
+ int_array_iterator begin (array, ARRAY_SIZE (array));
+ int_array_iterator end;
filtered_iterator<int_array_iterator, even_numbers_only>
- iter1(array, ARRAY_SIZE (array));
+ iter1 (begin, end);
filtered_iterator<int_array_iterator, even_numbers_only>
- iter2(array, ARRAY_SIZE (array));
+ iter2 (begin, end);
+
+ /* They start equal. */
+ SELF_CHECK (iter1 == iter2);
+ SELF_CHECK (!(iter1 != iter2));
+
+ /* Advance 1, now they aren't equal (despite pointing to equal values). */
+ ++iter1;
+ SELF_CHECK (!(iter1 == iter2));
+ SELF_CHECK (iter1 != iter2);
+
+ /* Advance 2, now they are equal again. */
+ ++iter2;
+ SELF_CHECK (iter1 == iter2);
+ SELF_CHECK (!(iter1 != iter2));
+}
+
+
+/* Same as the above, but using pointers as the iterator base type. */
+
+static void
+test_filtered_iterator_eq_ptr ()
+{
+ int array[] = { 4, 4, 5, 6, 7, 8, 9 };
+
+ filtered_iterator<int *, even_numbers_only> iter1
+ (array, array + ARRAY_SIZE(array));
+ filtered_iterator<int *, even_numbers_only> iter2
+ (array, array + ARRAY_SIZE(array));
/* They start equal. */
SELF_CHECK (iter1 == iter2);
@@ -154,12 +207,14 @@ test_filtered_iterator_eq ()
} /* namespace selftests */
-void _initialize_filtered_iterator_selftests ();
-void
-_initialize_filtered_iterator_selftests ()
+INIT_GDB_FILE (filtered_iterator_selftests)
{
selftests::register_test ("filtered_iterator",
selftests::test_filtered_iterator);
selftests::register_test ("filtered_iterator_eq",
selftests::test_filtered_iterator_eq);
+ selftests::register_test ("filtered_iterator_ptr",
+ selftests::test_filtered_iterator_ptr);
+ selftests::register_test ("filtered_iterator_eq_ptr",
+ selftests::test_filtered_iterator_eq_ptr);
}
diff --git a/gdb/unittests/format_pieces-selftests.c b/gdb/unittests/format_pieces-selftests.c
index a01f248..2deff0f 100644
--- a/gdb/unittests/format_pieces-selftests.c
+++ b/gdb/unittests/format_pieces-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for format_pieces for GDB, the GNU debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -29,17 +29,35 @@
namespace selftests {
namespace format_pieces {
+/* Like format_piece, but with the expected string hardcoded instead of an
+ index. */
+
+struct expected_format_piece
+{
+ std::string_view str;
+ enum argclass argclass;
+ int n_int_args;
+};
+
/* Verify that parsing STR gives pieces equal to EXPECTED_PIECES. */
static void
-check (const char *str, const std::vector<format_piece> &expected_pieces,
+check (const char *str,
+ const std::vector<expected_format_piece> &expected_pieces,
bool gdb_format = false)
{
::format_pieces pieces (&str, gdb_format);
SELF_CHECK ((pieces.end () - pieces.begin ()) == expected_pieces.size ());
- SELF_CHECK (std::equal (pieces.begin (), pieces.end (),
- expected_pieces.begin ()));
+
+ for (auto it = pieces.begin (); it != pieces.end (); ++it)
+ {
+ auto &expected = expected_pieces[it - pieces.begin ()];
+
+ SELF_CHECK (expected.str == pieces.piece_str (*it));
+ SELF_CHECK (expected.argclass == it->argclass);
+ SELF_CHECK (expected.n_int_args == it->n_int_args);
+ }
}
static void
@@ -47,7 +65,7 @@ test_escape_sequences ()
{
check ("This is an escape sequence: \\e",
{
- format_piece ("This is an escape sequence: \e", literal_piece, 0),
+ {"This is an escape sequence: \e", literal_piece, 0},
});
}
@@ -58,11 +76,11 @@ test_format_specifier ()
see a trailing empty literal piece. */
check ("Hello\\t %d%llx%%d%d", /* ARI: %ll */
{
- format_piece ("Hello\t ", literal_piece, 0),
- format_piece ("%d", int_arg, 0),
- format_piece ("%" LL "x", long_long_arg, 0),
- format_piece ("%%d", literal_piece, 0),
- format_piece ("%d", int_arg, 0),
+ {"Hello\t ", literal_piece, 0},
+ {"%d", int_arg, 0},
+ {"%" LL "x", long_long_arg, 0},
+ {"%%d", literal_piece, 0},
+ {"%d", int_arg, 0},
});
}
@@ -71,13 +89,13 @@ test_gdb_formats ()
{
check ("Hello\\t \"%p[%pF%ps%*.*d%p]\"",
{
- format_piece ("Hello\\t \"", literal_piece, 0),
- format_piece ("%p[", ptr_arg, 0),
- format_piece ("%pF", ptr_arg, 0),
- format_piece ("%ps", ptr_arg, 0),
- format_piece ("%*.*d", int_arg, 2),
- format_piece ("%p]", ptr_arg, 0),
- format_piece ("\"", literal_piece, 0),
+ {"Hello\\t \"", literal_piece, 0},
+ {"%p[", ptr_arg, 0},
+ {"%pF", ptr_arg, 0},
+ {"%ps", ptr_arg, 0},
+ {"%*.*d", int_arg, 2},
+ {"%p]", ptr_arg, 0},
+ {"\"", literal_piece, 0},
}, true);
}
@@ -89,38 +107,38 @@ test_format_int_sizes ()
{
check ("Hello\\t %hu%lu%llu%zu", /* ARI: %ll */
{
- format_piece ("Hello\t ", literal_piece, 0),
- format_piece ("%hu", int_arg, 0),
- format_piece ("%lu", long_arg, 0),
- format_piece ("%" LL "u", long_long_arg, 0),
- format_piece ("%zu", size_t_arg, 0)
+ {"Hello\t ", literal_piece, 0},
+ {"%hu", int_arg, 0},
+ {"%lu", long_arg, 0},
+ {"%" LL "u", long_long_arg, 0},
+ {"%zu", size_t_arg, 0},
});
check ("Hello\\t %hx%lx%llx%zx", /* ARI: %ll */
{
- format_piece ("Hello\t ", literal_piece, 0),
- format_piece ("%hx", int_arg, 0),
- format_piece ("%lx", long_arg, 0),
- format_piece ("%" LL "x", long_long_arg, 0),
- format_piece ("%zx", size_t_arg, 0)
+ {"Hello\t ", literal_piece, 0},
+ {"%hx", int_arg, 0},
+ {"%lx", long_arg, 0},
+ {"%" LL "x", long_long_arg, 0},
+ {"%zx", size_t_arg, 0},
});
check ("Hello\\t %ho%lo%llo%zo", /* ARI: %ll */
{
- format_piece ("Hello\t ", literal_piece, 0),
- format_piece ("%ho", int_arg, 0),
- format_piece ("%lo", long_arg, 0),
- format_piece ("%" LL "o", long_long_arg, 0),
- format_piece ("%zo", size_t_arg, 0)
+ {"Hello\t ", literal_piece, 0},
+ {"%ho", int_arg, 0},
+ {"%lo", long_arg, 0},
+ {"%" LL "o", long_long_arg, 0},
+ {"%zo", size_t_arg, 0},
});
check ("Hello\\t %hd%ld%lld%zd", /* ARI: %ll */
{
- format_piece ("Hello\t ", literal_piece, 0),
- format_piece ("%hd", int_arg, 0),
- format_piece ("%ld", long_arg, 0),
- format_piece ("%" LL "d", long_long_arg, 0),
- format_piece ("%zd", size_t_arg, 0)
+ {"Hello\t ", literal_piece, 0},
+ {"%hd", int_arg, 0},
+ {"%ld", long_arg, 0},
+ {"%" LL "d", long_long_arg, 0},
+ {"%zd", size_t_arg, 0},
});
}
@@ -129,8 +147,8 @@ test_windows_formats ()
{
check ("rc%I64d",
{
- format_piece ("rc", literal_piece, 0),
- format_piece ("%I64d", long_long_arg, 0),
+ {"rc", literal_piece, 0},
+ {"%I64d", long_long_arg, 0},
});
}
@@ -147,9 +165,7 @@ run_tests ()
} /* namespace format_pieces */
} /* namespace selftests */
-void _initialize_format_pieces_selftests ();
-void
-_initialize_format_pieces_selftests ()
+INIT_GDB_FILE (format_pieces_selftests)
{
selftests::register_test ("format_pieces",
selftests::format_pieces::run_tests);
diff --git a/gdb/unittests/frame_info_ptr-selftests.c b/gdb/unittests/frame_info_ptr-selftests.c
index ec83024..d518482 100644
--- a/gdb/unittests/frame_info_ptr-selftests.c
+++ b/gdb/unittests/frame_info_ptr-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for frame_info_ptr.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -66,9 +66,7 @@ test_user_created_frame ()
} /* namespace selftests */
-void _initialize_frame_info_ptr_selftests ();
-void
-_initialize_frame_info_ptr_selftests ()
+INIT_GDB_FILE (frame_info_ptr_selftests)
{
selftests::register_test ("frame_info_ptr_user",
selftests::test_user_created_frame);
diff --git a/gdb/unittests/function-view-selftests.c b/gdb/unittests/function-view-selftests.c
index dc1a630..21838f1 100644
--- a/gdb/unittests/function-view-selftests.c
+++ b/gdb/unittests/function-view-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for function_view for GDB, the GNU debugger.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -250,9 +250,7 @@ run_tests ()
} /* namespace function_view */
} /* namespace selftests */
-void _initialize_function_view_selftests ();
-void
-_initialize_function_view_selftests ()
+INIT_GDB_FILE (function_view_selftests)
{
selftests::register_test ("function_view",
selftests::function_view::run_tests);
diff --git a/gdb/unittests/gdb_tilde_expand-selftests.c b/gdb/unittests/gdb_tilde_expand-selftests.c
index 165885f..28c759f 100644
--- a/gdb/unittests/gdb_tilde_expand-selftests.c
+++ b/gdb/unittests/gdb_tilde_expand-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for gdb_tilde_expand
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -84,9 +84,7 @@ do_test ()
} /* namespace gdb_tilde_expand_tests */
} /* namespace selftests */
-void _initialize_gdb_tilde_expand_selftests ();
-void
-_initialize_gdb_tilde_expand_selftests ()
+INIT_GDB_FILE (gdb_tilde_expand_selftests)
{
selftests::register_test
("gdb_tilde_expand", selftests::gdb_tilde_expand_tests::do_test);
diff --git a/gdb/unittests/gmp-utils-selftests.c b/gdb/unittests/gmp-utils-selftests.c
index 699693c..9843fcb 100644
--- a/gdb/unittests/gmp-utils-selftests.c
+++ b/gdb/unittests/gmp-utils-selftests.c
@@ -1,6 +1,6 @@
/* Self tests of the gmp-utils API.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -498,10 +498,7 @@ gdb_mpq_write_fixed_point ()
}
-void _initialize_gmp_utils_selftests ();
-
-void
-_initialize_gmp_utils_selftests ()
+INIT_GDB_FILE (gmp_utils_selftests)
{
selftests::register_test ("gdb_mpz_as_integer",
selftests::gdb_mpz_as_integer);
diff --git a/gdb/unittests/intrusive_list-selftests.c b/gdb/unittests/intrusive_list-selftests.c
index 6d624e4..2dd1298 100644
--- a/gdb/unittests/intrusive_list-selftests.c
+++ b/gdb/unittests/intrusive_list-selftests.c
@@ -1,5 +1,5 @@
/* Tests for intrusive double linked list for GDB, the GNU debugger.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1648,10 +1648,7 @@ test_intrusive_list ()
test_node_is_linked ();
}
-void _initialize_intrusive_list_selftests ();
-
-void
-_initialize_intrusive_list_selftests ()
+INIT_GDB_FILE (intrusive_list_selftests)
{
selftests::register_test ("intrusive_list", test_intrusive_list);
}
diff --git a/gdb/unittests/lookup_name_info-selftests.c b/gdb/unittests/lookup_name_info-selftests.c
index fb4be21..dc0d307 100644
--- a/gdb/unittests/lookup_name_info-selftests.c
+++ b/gdb/unittests/lookup_name_info-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for lookup_name_info for GDB, the GNU debugger.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -105,9 +105,7 @@ run_tests ()
}} /* namespace selftests::lookup_name */
-void _initialize_lookup_name_info_selftests ();
-void
-_initialize_lookup_name_info_selftests ()
+INIT_GDB_FILE (lookup_name_info_selftests)
{
selftests::register_test ("lookup_name_info",
selftests::lookup_name::run_tests);
diff --git a/gdb/unittests/main-thread-selftests.c b/gdb/unittests/main-thread-selftests.c
index 1ba3505..77adf47 100644
--- a/gdb/unittests/main-thread-selftests.c
+++ b/gdb/unittests/main-thread-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for run_on_main_thread
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -73,9 +73,7 @@ run_tests ()
}
}
-void _initialize_main_thread_selftests ();
-void
-_initialize_main_thread_selftests ()
+INIT_GDB_FILE (main_thread_selftests)
{
#if CXX_STD_THREAD
selftests::register_test ("run_on_main_thread",
diff --git a/gdb/unittests/memory-map-selftests.c b/gdb/unittests/memory-map-selftests.c
index 55d66fd..c014c4d 100644
--- a/gdb/unittests/memory-map-selftests.c
+++ b/gdb/unittests/memory-map-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for memory-map for GDB, the GNU debugger.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -75,9 +75,7 @@ parse_memory_map_tests ()
#endif /* HAVE_LIBEXPAT */
-void _initialize_memory_map_selftests ();
-void
-_initialize_memory_map_selftests ()
+INIT_GDB_FILE (memory_map_selftests)
{
#if defined(HAVE_LIBEXPAT)
selftests::register_test
diff --git a/gdb/unittests/memrange-selftests.c b/gdb/unittests/memrange-selftests.c
index df02b6a..17e08e8 100644
--- a/gdb/unittests/memrange-selftests.c
+++ b/gdb/unittests/memrange-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for mem ranges for GDB, the GNU debugger.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -105,9 +105,7 @@ normalize_mem_ranges_tests ()
} /* namespace memrange_tests */
} /* namespace selftests */
-void _initialize_memrange_selftests ();
-void
-_initialize_memrange_selftests ()
+INIT_GDB_FILE (memrange_selftests)
{
selftests::register_test
("normalize_mem_ranges",
diff --git a/gdb/unittests/mkdir-recursive-selftests.c b/gdb/unittests/mkdir-recursive-selftests.c
index a96874d..b2ae383 100644
--- a/gdb/unittests/mkdir-recursive-selftests.c
+++ b/gdb/unittests/mkdir-recursive-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for scoped_fd for GDB, the GNU debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -80,9 +80,7 @@ test ()
}
}
-void _initialize_mkdir_recursive_selftests ();
-void
-_initialize_mkdir_recursive_selftests ()
+INIT_GDB_FILE (mkdir_recursive_selftests)
{
selftests::register_test ("mkdir_recursive",
selftests::mkdir_recursive::test);
diff --git a/gdb/unittests/observable-selftests.c b/gdb/unittests/observable-selftests.c
index 2640f68..0934249 100644
--- a/gdb/unittests/observable-selftests.c
+++ b/gdb/unittests/observable-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for gdb::observers, GDB notifications to observers.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -237,9 +237,7 @@ run_tests ()
} /* namespace observers */
} /* namespace selftests */
-void _initialize_observer_selftest ();
-void
-_initialize_observer_selftest ()
+INIT_GDB_FILE (observer_selftest)
{
selftests::register_test ("gdb::observers",
selftests::observers::run_tests);
diff --git a/gdb/unittests/offset-type-selftests.c b/gdb/unittests/offset-type-selftests.c
index 95cc4f8..2cba4e1 100644
--- a/gdb/unittests/offset-type-selftests.c
+++ b/gdb/unittests/offset-type-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for offset types for GDB, the GNU debugger.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -170,9 +170,7 @@ run_tests ()
} /* namespace offset_type */
} /* namespace selftests */
-void _initialize_offset_type_selftests ();
-void
-_initialize_offset_type_selftests ()
+INIT_GDB_FILE (offset_type_selftests)
{
selftests::register_test ("offset_type", selftests::offset_type::run_tests);
}
diff --git a/gdb/unittests/packed-selftests.c b/gdb/unittests/packed-selftests.c
index 060c87c..5a91b29 100644
--- a/gdb/unittests/packed-selftests.c
+++ b/gdb/unittests/packed-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for packed for GDB, the GNU debugger.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -119,9 +119,7 @@ run_tests ()
} /* namespace packed_tests */
} /* namespace selftests */
-void _initialize_packed_selftests ();
-void
-_initialize_packed_selftests ()
+INIT_GDB_FILE (packed_selftests)
{
selftests::register_test ("packed", selftests::packed_tests::run_tests);
}
diff --git a/gdb/unittests/parallel-for-selftests.c b/gdb/unittests/parallel-for-selftests.c
index 0261948..b69eed4 100644
--- a/gdb/unittests/parallel-for-selftests.c
+++ b/gdb/unittests/parallel-for-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for parallel_for_each
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,13 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-/* This file is divided in two parts:
- - FOR_EACH-undefined, and
- - FOR_EACH-defined.
- The former includes the latter, more than once, with different values for
- FOR_EACH. The FOR_EACH-defined part reads like a regular function. */
-#ifndef FOR_EACH
-
#include "gdbsupport/selftest.h"
#include "gdbsupport/parallel-for.h"
@@ -49,97 +42,129 @@ struct save_restore_n_threads
int n_threads;
};
-/* Define test_par using TEST in the FOR_EACH-defined part. */
-#define TEST test_par
-#define FOR_EACH gdb::parallel_for_each
-#include "parallel-for-selftests.c"
-#undef FOR_EACH
-#undef TEST
+using foreach_callback_t = gdb::function_view<void (iterator_range<int *> range)>;
+using do_foreach_t = gdb::function_view<void (int *first, int *last,
+ foreach_callback_t)>;
-/* Define test_seq using TEST in the FOR_EACH-defined part. */
-#define TEST test_seq
-#define FOR_EACH gdb::sequential_for_each
-#include "parallel-for-selftests.c"
-#undef FOR_EACH
-#undef TEST
+/* Run one parallel-for-each test on the range [1, UPPER_BOUND) using the
+ parallel-for-each implementation DO_FOREACH. */
static void
-test (int n_threads)
+test_one (do_foreach_t do_foreach, int upper_bound)
{
- test_par (n_threads);
- test_seq (n_threads);
-}
+ std::vector<int> input;
-static void
-test_n_threads ()
-{
- test (0);
- test (1);
- test (3);
-}
+ for (int i = 0; i < upper_bound; ++i)
+ input.emplace_back (i);
-}
-}
+ std::vector<int> output;
+ std::mutex mtx;
-#endif /* CXX_STD_THREAD */
+ /* The (unfortunate) reason why we don't use std::vector<int>::iterator as
+ the parallel-for-each iterator type is that std::atomic won't work with
+ that type when building with -D_GLIBCXX_DEBUG. */
+ do_foreach (input.data (), input.data () + input.size (),
+ [&] (iterator_range<int *> range)
+ {
+ /* We shouldn't receive empty ranges. */
+ SELF_CHECK (!range.empty ());
-void _initialize_parallel_for_selftests ();
-void
-_initialize_parallel_for_selftests ()
-{
-#ifdef CXX_STD_THREAD
- selftests::register_test ("parallel_for",
- selftests::parallel_for::test_n_threads);
-#endif /* CXX_STD_THREAD */
+ std::lock_guard lock (mtx);
+
+ for (int i : range)
+ output.emplace_back (i * 2);
+ });
+
+ /* Verify that each item was processed exactly once. */
+ SELF_CHECK (output.size () == upper_bound);
+ std::sort (output.begin (), output.end ());
+
+ for (int i = 0; i < output.size (); ++i)
+ SELF_CHECK (output[i] == i * 2);
}
-#else /* FOR_EACH */
+/* Run all tests on the parallel-for-each implementation DO_FOREACH. */
static void
-TEST (int n_threads)
+test_one_function (int n_threads, do_foreach_t do_foreach)
{
save_restore_n_threads saver;
gdb::thread_pool::g_thread_pool->set_thread_count (n_threads);
-#define NUMBER 10000
-
- std::atomic<int> counter (0);
- FOR_EACH (1, 0, NUMBER,
- [&] (int start, int end)
- {
- counter += end - start;
- });
- SELF_CHECK (counter == NUMBER);
+ /* Test with a few arbitrary number of items. */
+ test_one (do_foreach, 0);
+ test_one (do_foreach, 1);
+ test_one (do_foreach, 1000);
+}
- counter = 0;
- FOR_EACH (1, 0, 0,
- [&] (int start, int end)
+static void
+test_parallel_for_each ()
+{
+ struct test_worker
+ {
+ /* DUMMY is there to test passing multiple arguments to the worker
+ constructor. */
+ test_worker (foreach_callback_t callback, int dummy)
+ : m_callback (callback)
+ {
+ }
+
+ void operator() (iterator_range<int *> range)
+ {
+ return m_callback (range);
+ }
+
+ private:
+ foreach_callback_t m_callback;
+ };
+
+ const std::vector<do_foreach_t> for_each_functions
+ {
+ /* Test gdb::parallel_for_each. */
+ [] (int *start, int *end, foreach_callback_t callback)
+ { gdb::parallel_for_each<1, int *, test_worker> (start, end, callback, 0); },
+
+ /* Test gdb::parallel_for_each_async. */
+ [] (int *start, int *end, foreach_callback_t callback)
+ {
+ bool done_flag = false;
+ std::condition_variable cv;
+ std::mutex mtx;
+
+ gdb::parallel_for_each_async<1, int *, test_worker> (start, end,
+ [&mtx, &done_flag, &cv] ()
{
- counter += end - start;
- });
- SELF_CHECK (counter == 0);
-
-#undef NUMBER
-
- /* Check that if there are fewer tasks than threads, then we won't
- end up with a null result. */
- std::vector<std::unique_ptr<int>> intresults;
- std::atomic<bool> any_empty_tasks (false);
-
- FOR_EACH (1, 0, 1,
- [&] (int start, int end)
- {
- if (start == end)
- any_empty_tasks = true;
- return std::make_unique<int> (end - start);
- });
- SELF_CHECK (!any_empty_tasks);
- SELF_CHECK (std::all_of (intresults.begin (),
- intresults.end (),
- [] (const std::unique_ptr<int> &entry)
- {
- return entry != nullptr;
- }));
+ std::lock_guard<std::mutex> lock (mtx);
+ done_flag = true;
+ cv.notify_one();
+ }, callback, 0);
+
+ /* Wait for the async parallel-for to complete. */
+ std::unique_lock<std::mutex> lock (mtx);
+ cv.wait (lock, [&done_flag] () { return done_flag; });
+ },
+
+ /* Test gdb::sequential_for_each. */
+ [] (int *start, int *end, foreach_callback_t callback)
+ { gdb::sequential_for_each<int *, test_worker> (start, end, callback, 0); },
+ };
+
+ int default_thread_count = gdb::thread_pool::g_thread_pool->thread_count ();
+
+ for (int n_threads : { 0, 1, 3, default_thread_count })
+ for (const auto &for_each_function : for_each_functions)
+ test_one_function (n_threads, for_each_function);
}
-#endif /* FOR_EACH */
+} /* namespace parallel_for */
+} /* namespace selftests */
+
+#endif /* CXX_STD_THREAD */
+
+INIT_GDB_FILE (parallel_for_selftests)
+{
+#ifdef CXX_STD_THREAD
+ selftests::register_test ("parallel_for",
+ selftests::parallel_for::test_parallel_for_each);
+#endif /* CXX_STD_THREAD */
+}
diff --git a/gdb/unittests/parse-connection-spec-selftests.c b/gdb/unittests/parse-connection-spec-selftests.c
index 55a7c13..ce2da35 100644
--- a/gdb/unittests/parse-connection-spec-selftests.c
+++ b/gdb/unittests/parse-connection-spec-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for parsing connection specs for GDB, the GNU debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -238,9 +238,7 @@ run_tests ()
} /* namespace parse_connection_spec_tests */
} /* namespace selftests */
-void _initialize_parse_connection_spec_selftests ();
-void
-_initialize_parse_connection_spec_selftests ()
+INIT_GDB_FILE (parse_connection_spec_selftests)
{
selftests::register_test ("parse_connection_spec",
selftests::parse_connection_spec_tests::run_tests);
diff --git a/gdb/unittests/path-join-selftests.c b/gdb/unittests/path-join-selftests.c
index 08fad63..8bc5a91 100644
--- a/gdb/unittests/path-join-selftests.c
+++ b/gdb/unittests/path-join-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for path_join for GDB, the GNU debugger.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -63,9 +63,7 @@ test ()
}
}
-void _initialize_path_join_selftests ();
-void
-_initialize_path_join_selftests ()
+INIT_GDB_FILE (path_join_selftests)
{
selftests::register_test ("path_join",
selftests::path_join::test);
diff --git a/gdb/unittests/ptid-selftests.c b/gdb/unittests/ptid-selftests.c
index 6fc04c1..a9bb26b 100644
--- a/gdb/unittests/ptid-selftests.c
+++ b/gdb/unittests/ptid-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for ptid_t for GDB, the GNU debugger.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/unittests/remote-arg-selftests.c b/gdb/unittests/remote-arg-selftests.c
new file mode 100644
index 0000000..17b8d1d
--- /dev/null
+++ b/gdb/unittests/remote-arg-selftests.c
@@ -0,0 +1,163 @@
+/* Self tests for GDB's argument splitting and merging.
+
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "defs.h"
+#include "gdbsupport/selftest.h"
+#include "gdbsupport/buildargv.h"
+#include "gdbsupport/common-inferior.h"
+#include "gdbsupport/remote-args.h"
+#include "gdbsupport/gdb_argv_vec.h"
+
+namespace selftests {
+namespace remote_args_tests {
+
+/* The data needed to perform a single remote argument test. */
+struct arg_test_desc
+{
+ /* The original inferior argument string. */
+ std::string input;
+
+ /* The individual arguments once they have been split. */
+ std::vector<std::string> split;
+
+ /* The new inferior argument string, created by joining SPLIT. */
+ std::string joined;
+};
+
+/* The list of tests. */
+arg_test_desc desc[] = {
+ { "abc", { "abc" }, "abc" },
+ { "a b c", { "a", "b", "c" }, "a b c" },
+ { "\"a b\" 'c d'", { "a b", "c d" }, "a\\ b c\\ d" },
+ { "\\' \\\"", { "'", "\"" }, "\\' \\\"" },
+ { "'\\'", { "\\" }, "\\\\" },
+ { "\"\\\\\" \"\\\\\\\"\"", { "\\", "\\\"" }, "\\\\ \\\\\\\"" },
+ { "\\ \" \" ' '", { " ", " ", " "}, "\\ \\ \\ " },
+ { "\"'\"", { "'" }, "\\'" },
+ { "'\"' '\\\"'", { "\"", "\\\"" } , "\\\" \\\\\\\""},
+ { "\"first arg\" \"\" \"third-arg\" \"'\" \"\\\"\" \"\\\\\\\"\" \" \" \"\"",
+ { "first arg", "", "third-arg", "'", "\"", "\\\""," ", "" },
+ "first\\ arg '' third-arg \\' \\\" \\\\\\\" \\ ''"},
+ { "\"\\a\" \"\\&\" \"\\#\" \"\\<\" \"\\^\"",
+ { "\\a", "\\&", "\\#" , "\\<" , "\\^"},
+ "\\\\a \\\\\\& \\\\\\# \\\\\\< \\\\\\^" },
+ { "1 '\n' 3", { "1", "\n", "3" }, "1 '\n' 3" },
+};
+
+/* Run the remote argument passing self tests. */
+
+static void
+self_test ()
+{
+ int failure_count = 0;
+ for (const auto &d : desc)
+ {
+ if (run_verbose ())
+ {
+ if (&d != &desc[0])
+ debug_printf ("------------------------------\n");
+ debug_printf ("Input (%s)\n", d.input.c_str ());
+ }
+
+ /* Split argument string into individual arguments. */
+ std::vector<std::string> split_args = gdb::remote_args::split (d.input);
+
+ if (run_verbose ())
+ {
+ debug_printf ("Split:\n");
+
+ size_t len = std::max (split_args.size (), d.split.size ());
+ for (size_t i = 0; i < len; ++i)
+ {
+ const char *got = "N/A";
+ const char *expected = got;
+
+ if (i < split_args.size ())
+ got = split_args[i].c_str ();
+
+ if (i < d.split.size ())
+ expected = d.split[i].c_str ();
+
+ debug_printf (" got (%s), expected (%s)\n", got, expected);
+ }
+ }
+
+ if (split_args != d.split)
+ {
+ ++failure_count;
+ if (run_verbose ())
+ debug_printf ("FAIL\n");
+ continue;
+ }
+
+ /* Now join the arguments. */
+ gdb::argv_vec split_args_c_str;
+ for (const std::string &s : split_args)
+ split_args_c_str.push_back (xstrdup (s.c_str ()));
+ std::string joined_args
+ = gdb::remote_args::join (split_args_c_str.get ());
+
+ if (run_verbose ())
+ debug_printf ("Joined (%s), expected (%s)\n",
+ joined_args.c_str (), d.joined.c_str ());
+
+ if (joined_args != d.joined)
+ {
+ ++failure_count;
+ if (run_verbose ())
+ debug_printf ("FAIL\n");
+ continue;
+ }
+
+ /* The contents of JOINED_ARGS will not be identical to D.INPUT.
+ There are multiple ways that an argument can be escaped, and our
+ join function just picks one. However, if we split JOINED_ARGS
+ again then each individual argument should be the same as those in
+ SPLIT_ARGS. So test that next. */
+ std::vector<std::string> split_args_v2
+ = gdb::remote_args::split (joined_args);
+
+ if (split_args_v2 != split_args)
+ {
+ ++failure_count;
+ if (run_verbose ())
+ {
+ debug_printf ("Re-split:\n");
+ for (const auto &a : split_args_v2)
+ debug_printf (" got (%s)\n", a.c_str ());
+ debug_printf ("FAIL\n");
+ }
+ continue;
+ }
+
+ if (run_verbose ())
+ debug_printf ("PASS\n");
+ }
+
+ SELF_CHECK (failure_count == 0);
+}
+
+} /* namespace remote_args_tests */
+} /* namespace selftests */
+
+INIT_GDB_FILE (remote_arg_selftests)
+{
+ selftests::register_test ("remote-args",
+ selftests::remote_args_tests::self_test);
+}
diff --git a/gdb/unittests/rsp-low-selftests.c b/gdb/unittests/rsp-low-selftests.c
index 7a17871..d0002ae 100644
--- a/gdb/unittests/rsp-low-selftests.c
+++ b/gdb/unittests/rsp-low-selftests.c
@@ -1,6 +1,6 @@
/* Unit tests for the rsp-low.c file.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -51,7 +51,7 @@ static void test_hex2str ()
{
SELF_CHECK (hex2str ("666f6f") == "foo");
SELF_CHECK (hex2str ("666f6fa") == "foo");
- SELF_CHECK (hex2str ("666f6f", 2) == "fo");
+ SELF_CHECK (hex2str ("666f6f", 2) == "fo"); /* codespell:ignore */
SELF_CHECK (hex2str ("666", 2) == "f");
SELF_CHECK (hex2str ("666", 6) == "f");
SELF_CHECK (hex2str ("") == "");
@@ -60,9 +60,7 @@ static void test_hex2str ()
} /* namespace rsp_low */
} /* namespace selftests */
-void _initialize_rsp_low_selftests ();
-void
-_initialize_rsp_low_selftests ()
+INIT_GDB_FILE (rsp_low_selftests)
{
selftests::register_test ("hex2bin_byte_vector",
selftests::rsp_low::test_hex2bin_byte_vector);
diff --git a/gdb/unittests/scoped_fd-selftests.c b/gdb/unittests/scoped_fd-selftests.c
index 1413c50..da59a18 100644
--- a/gdb/unittests/scoped_fd-selftests.c
+++ b/gdb/unittests/scoped_fd-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for scoped_fd for GDB, the GNU debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -92,9 +92,7 @@ run_tests ()
} /* namespace scoped_fd */
} /* namespace selftests */
-void _initialize_scoped_fd_selftests ();
-void
-_initialize_scoped_fd_selftests ()
+INIT_GDB_FILE (scoped_fd_selftests)
{
selftests::register_test ("scoped_fd",
selftests::scoped_fd::run_tests);
diff --git a/gdb/unittests/scoped_ignore_signal-selftests.c b/gdb/unittests/scoped_ignore_signal-selftests.c
index 361928c..86c5031 100644
--- a/gdb/unittests/scoped_ignore_signal-selftests.c
+++ b/gdb/unittests/scoped_ignore_signal-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for scoped_ignored_signal for GDB, the GNU debugger.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -114,9 +114,7 @@ test_sigpipe ()
} /* namespace scoped_ignore_sig */
} /* namespace selftests */
-void _initialize_scoped_ignore_signal_selftests ();
-void
-_initialize_scoped_ignore_signal_selftests ()
+INIT_GDB_FILE (scoped_ignore_signal_selftests)
{
#ifdef SIGPIPE
selftests::register_test ("scoped_ignore_sigpipe",
diff --git a/gdb/unittests/scoped_mmap-selftests.c b/gdb/unittests/scoped_mmap-selftests.c
index 09a94ed..f752b9a 100644
--- a/gdb/unittests/scoped_mmap-selftests.c
+++ b/gdb/unittests/scoped_mmap-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for scoped_mmap for GDB, the GNU debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -41,7 +41,7 @@ test_destroy ()
errno = 0;
{
::scoped_mmap smmap (nullptr, sysconf (_SC_PAGESIZE), PROT_WRITE,
- MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
+ MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
mem = smmap.get ();
SELF_CHECK (mem != nullptr);
@@ -59,7 +59,7 @@ test_release ()
errno = 0;
{
::scoped_mmap smmap (nullptr, sysconf (_SC_PAGESIZE), PROT_WRITE,
- MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
+ MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
mem = smmap.release ();
SELF_CHECK (mem != nullptr);
@@ -135,9 +135,7 @@ run_tests ()
#endif /* !defined(HAVE_SYS_MMAN_H) */
-void _initialize_scoped_mmap_selftests ();
-void
-_initialize_scoped_mmap_selftests ()
+INIT_GDB_FILE (scoped_mmap_selftests)
{
#if defined(HAVE_SYS_MMAN_H)
selftests::register_test ("scoped_mmap",
diff --git a/gdb/unittests/scoped_restore-selftests.c b/gdb/unittests/scoped_restore-selftests.c
index 1fd5118..4396046 100644
--- a/gdb/unittests/scoped_restore-selftests.c
+++ b/gdb/unittests/scoped_restore-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for scoped_restore for GDB, the GNU debugger.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -102,9 +102,7 @@ run_tests ()
} /* namespace scoped_restore_tests */
} /* namespace selftests */
-void _initialize_scoped_restore_selftests ();
-void
-_initialize_scoped_restore_selftests ()
+INIT_GDB_FILE (scoped_restore_selftests)
{
selftests::register_test ("scoped_restore",
selftests::scoped_restore_tests::run_tests);
diff --git a/gdb/unittests/search-memory-selftests.c b/gdb/unittests/search-memory-selftests.c
index 1124633..c1942fc 100644
--- a/gdb/unittests/search-memory-selftests.c
+++ b/gdb/unittests/search-memory-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for simple_search_memory for GDB, the GNU debugger.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -89,9 +89,7 @@ run_tests ()
} /* namespace selftests */
-void _initialize_search_memory_selftests ();
-void
-_initialize_search_memory_selftests ()
+INIT_GDB_FILE (search_memory_selftests)
{
selftests::register_test ("search_memory",
selftests::search_memory_tests::run_tests);
diff --git a/gdb/unittests/style-selftests.c b/gdb/unittests/style-selftests.c
index 72bc878..7cb42a1 100644
--- a/gdb/unittests/style-selftests.c
+++ b/gdb/unittests/style-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for ui_file_style
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -38,6 +38,8 @@ run_tests ()
SELF_CHECK (style.get_foreground ().is_none ());
SELF_CHECK (style.get_background ().is_none ());
SELF_CHECK (style.get_intensity () == ui_file_style::NORMAL);
+ SELF_CHECK (!style.is_italic ());
+ SELF_CHECK (!style.is_underline ());
SELF_CHECK (!style.is_reverse ());
SELF_CHECK (style.to_ansi () == "\033[m");
@@ -47,6 +49,8 @@ run_tests ()
SELF_CHECK (style.get_foreground ().is_none ());
SELF_CHECK (style.get_background ().is_none ());
SELF_CHECK (style.get_intensity () == ui_file_style::NORMAL);
+ SELF_CHECK (!style.is_italic ());
+ SELF_CHECK (!style.is_underline ());
SELF_CHECK (!style.is_reverse ());
/* This particular case does not round-trip identically, but the
difference is unimportant. */
@@ -57,8 +61,10 @@ run_tests ()
SELF_CHECK (style.get_foreground ().is_none ());
SELF_CHECK (style.get_background ().is_none ());
SELF_CHECK (style.get_intensity () == ui_file_style::NORMAL);
+ SELF_CHECK (!style.is_italic ());
+ SELF_CHECK (!style.is_underline ());
SELF_CHECK (style.is_reverse ());
- SELF_CHECK (style.to_ansi () == "\033[39;49;22;7m");
+ SELF_CHECK (style.to_ansi () == "\033[39;49;22;23;24;7m");
style = ui_file_style ();
SELF_CHECK (style.parse ("\033[32;1m", &n_read));
@@ -67,8 +73,22 @@ run_tests ()
SELF_CHECK (style.get_foreground ().get_value () == ui_file_style::GREEN);
SELF_CHECK (style.get_background ().is_none ());
SELF_CHECK (style.get_intensity () == ui_file_style::BOLD);
+ SELF_CHECK (!style.is_italic ());
+ SELF_CHECK (!style.is_underline ());
SELF_CHECK (!style.is_reverse ());
- SELF_CHECK (style.to_ansi () == "\033[32;49;1;27m");
+ SELF_CHECK (style.to_ansi () == "\033[32;49;1;23;24;27m");
+
+ style = ui_file_style ();
+ SELF_CHECK (style.parse ("\033[32;2;3;4m", &n_read));
+ SELF_CHECK (n_read == 11);
+ SELF_CHECK (style.get_foreground ().is_basic ());
+ SELF_CHECK (style.get_foreground ().get_value () == ui_file_style::GREEN);
+ SELF_CHECK (style.get_background ().is_none ());
+ SELF_CHECK (style.get_intensity () == ui_file_style::DIM);
+ SELF_CHECK (style.is_italic ());
+ SELF_CHECK (style.is_underline ());
+ SELF_CHECK (!style.is_reverse ());
+ SELF_CHECK (style.to_ansi () == "\033[32;49;2;3;4;27m");
style = ui_file_style ();
SELF_CHECK (style.parse ("\033[38;5;112;48;5;249m", &n_read));
@@ -80,8 +100,10 @@ run_tests ()
style.get_background ().get_rgb (rgb);
CHECK_RGB (0xb2, 0xb2, 0xb2);
SELF_CHECK (style.get_intensity () == ui_file_style::NORMAL);
+ SELF_CHECK (!style.is_italic ());
+ SELF_CHECK (!style.is_underline ());
SELF_CHECK (!style.is_reverse ());
- SELF_CHECK (style.to_ansi () == "\033[38;5;112;48;5;249;22;27m");
+ SELF_CHECK (style.to_ansi () == "\033[38;5;112;48;5;249;22;23;24;27m");
style = ui_file_style ();
SELF_CHECK (style.parse ("\033[38;2;83;84;85;48;2;0;1;254;2;7m", &n_read));
@@ -93,16 +115,16 @@ run_tests ()
style.get_background ().get_rgb (rgb);
CHECK_RGB (0, 1, 254);
SELF_CHECK (style.get_intensity () == ui_file_style::DIM);
+ SELF_CHECK (!style.is_italic ());
+ SELF_CHECK (!style.is_underline ());
SELF_CHECK (style.is_reverse ());
- SELF_CHECK (style.to_ansi () == "\033[38;2;83;84;85;48;2;0;1;254;2;7m");
+ SELF_CHECK (style.to_ansi () == "\033[38;2;83;84;85;48;2;0;1;254;2;23;24;7m");
}
} /* namespace style */
} /* namespace selftests */
-void _initialize_style_selftest ();
-void
-_initialize_style_selftest ()
+INIT_GDB_FILE (style_selftest)
{
selftests::register_test ("style",
selftests::style::run_tests);
diff --git a/gdb/unittests/tracepoint-selftests.c b/gdb/unittests/tracepoint-selftests.c
index 0270028..bef51ae 100644
--- a/gdb/unittests/tracepoint-selftests.c
+++ b/gdb/unittests/tracepoint-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for tracepoint-related code for GDB, the GNU debugger.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -60,9 +60,7 @@ test_parse_static_tracepoint_marker_definition ()
} /* namespace tracepoint_tests */
} /* namespace selftests */
-void _initialize_tracepoint_selftests ();
-void
-_initialize_tracepoint_selftests ()
+INIT_GDB_FILE (tracepoint_selftests)
{
selftests::register_test
("parse_static_tracepoint_marker_definition",
diff --git a/gdb/unittests/tui-selftests.c b/gdb/unittests/tui-selftests.c
index 6847207..5235a07 100644
--- a/gdb/unittests/tui-selftests.c
+++ b/gdb/unittests/tui-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for the TUI
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -45,9 +45,7 @@ run_tests ()
#endif /* TUI */
-void _initialize_tui_selftest ();
-void
-_initialize_tui_selftest ()
+INIT_GDB_FILE (tui_selftest)
{
#ifdef TUI
selftests::register_test ("tui", selftests::tui::run_tests);
diff --git a/gdb/unittests/ui-file-selftests.c b/gdb/unittests/ui-file-selftests.c
index 589254f..d78c6b0 100644
--- a/gdb/unittests/ui-file-selftests.c
+++ b/gdb/unittests/ui-file-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for ui_file
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -53,9 +53,7 @@ run_tests ()
} /* namespace file*/
} /* namespace selftests */
-void _initialize_ui_file_selftest ();
-void
-_initialize_ui_file_selftest ()
+INIT_GDB_FILE (ui_file_selftest)
{
selftests::register_test ("ui-file",
selftests::file::run_tests);
diff --git a/gdb/unittests/unique_xmalloc_ptr_char.c b/gdb/unittests/unique_xmalloc_ptr_char.c
index b7fd5b6..7f61c06 100644
--- a/gdb/unittests/unique_xmalloc_ptr_char.c
+++ b/gdb/unittests/unique_xmalloc_ptr_char.c
@@ -1,6 +1,6 @@
/* Self tests for gdb::unique_xmalloc_ptr<char>.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -47,9 +47,7 @@ unique_xmalloc_ptr_char ()
}
}
-void _initialize_unique_xmalloc_ptr_char ();
-void
-_initialize_unique_xmalloc_ptr_char ()
+INIT_GDB_FILE (unique_xmalloc_ptr_char)
{
selftests::register_test ("unique_xmalloc_ptr_char",
selftests::unpack::unique_xmalloc_ptr_char);
diff --git a/gdb/unittests/unpack-selftests.c b/gdb/unittests/unpack-selftests.c
index 35f4eee..fccf7a2 100644
--- a/gdb/unittests/unpack-selftests.c
+++ b/gdb/unittests/unpack-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for unpack_field_as_long
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -52,9 +52,7 @@ unpack_field_as_long_tests (struct gdbarch *arch)
}
}
-void _initialize_unpack_selftests ();
-void
-_initialize_unpack_selftests ()
+INIT_GDB_FILE (unpack_selftests)
{
selftests::register_test_foreach_arch
("unpack_field_as_long", selftests::unpack::unpack_field_as_long_tests);
diff --git a/gdb/unittests/utils-selftests.c b/gdb/unittests/utils-selftests.c
deleted file mode 100644
index 6748dc2..0000000
--- a/gdb/unittests/utils-selftests.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Unit tests for the utils.c file.
-
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "utils.h"
-#include "gdbsupport/selftest.h"
-
-namespace selftests {
-namespace utils {
-
-static void
-test_substitute_path_component ()
-{
- auto test = [] (std::string s, const char *from, const char *to,
- const char *expected)
- {
- char *temp = xstrdup (s.c_str ());
- substitute_path_component (&temp, from, to);
- SELF_CHECK (strcmp (temp, expected) == 0);
- xfree (temp);
- };
-
- test ("/abc/$def/g", "abc", "xyz", "/xyz/$def/g");
- test ("abc/$def/g", "abc", "xyz", "xyz/$def/g");
- test ("/abc/$def/g", "$def", "xyz", "/abc/xyz/g");
- test ("/abc/$def/g", "g", "xyz", "/abc/$def/xyz");
- test ("/abc/$def/g", "ab", "xyz", "/abc/$def/g");
- test ("/abc/$def/g", "def", "xyz", "/abc/$def/g");
- test ("/abc/$def/g", "abc", "abc", "/abc/$def/g");
- test ("/abc/$def/g", "abc", "", "//$def/g");
- test ("/abc/$def/g", "abc/$def", "xyz", "/xyz/g");
- test ("/abc/$def/abc", "abc", "xyz", "/xyz/$def/xyz");
-}
-
-}
-}
-
-void _initialize_utils_selftests ();
-void
-_initialize_utils_selftests ()
-{
- selftests::register_test ("substitute_path_component",
- selftests::utils::test_substitute_path_component);
-}
diff --git a/gdb/unittests/vec-utils-selftests.c b/gdb/unittests/vec-utils-selftests.c
index da3bcf0..11fad31 100644
--- a/gdb/unittests/vec-utils-selftests.c
+++ b/gdb/unittests/vec-utils-selftests.c
@@ -1,6 +1,6 @@
/* Self tests for vector utility routines for GDB, the GNU debugger.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -65,9 +65,7 @@ unordered_remove_tests ()
} /* namespace vector_utils_tests */
} /* namespace selftests */
-void _initialize_vec_utils_selftests ();
-void
-_initialize_vec_utils_selftests ()
+INIT_GDB_FILE (vec_utils_selftests)
{
selftests::register_test
("unordered_remove",
diff --git a/gdb/unittests/xml-utils-selftests.c b/gdb/unittests/xml-utils-selftests.c
index 627d5d8..f4a637b 100644
--- a/gdb/unittests/xml-utils-selftests.c
+++ b/gdb/unittests/xml-utils-selftests.c
@@ -1,6 +1,6 @@
/* Unit tests for the xml-utils.c file.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -47,9 +47,7 @@ static void test_xml_escape_text_append ()
}
}
-void _initialize_xml_utils ();
-void
-_initialize_xml_utils ()
+INIT_GDB_FILE (xml_utils)
{
selftests::register_test ("xml_escape_text",
selftests::xml_utils::test_xml_escape_text);
diff --git a/gdb/unwind_stop_reasons.def b/gdb/unwind_stop_reasons.def
index 9db9f7c..432064f 100644
--- a/gdb/unwind_stop_reasons.def
+++ b/gdb/unwind_stop_reasons.def
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/user-regs.c b/gdb/user-regs.c
index 2ace46e..7170cda 100644
--- a/gdb/user-regs.c
+++ b/gdb/user-regs.c
@@ -1,6 +1,6 @@
/* User visible, per-frame registers, for GDB, the GNU debugger.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Red Hat.
@@ -237,9 +237,7 @@ maintenance_print_user_registers (const char *args, int from_tty)
}
}
-void _initialize_user_regs ();
-void
-_initialize_user_regs ()
+INIT_GDB_FILE (user_regs)
{
add_cmd ("user-registers", class_maintenance,
maintenance_print_user_registers,
diff --git a/gdb/user-regs.h b/gdb/user-regs.h
index 67a28dd..298ce3c 100644
--- a/gdb/user-regs.h
+++ b/gdb/user-regs.h
@@ -1,6 +1,6 @@
/* Per-frame user registers, for GDB, the GNU debugger.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
Contributed by Red Hat.
diff --git a/gdb/utils.c b/gdb/utils.c
index ee7cf4d..57c739e 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1,6 +1,6 @@
/* General utility routines for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include <ctype.h>
#include "gdbsupport/gdb_wait.h"
#include "gdbsupport/scoped_signal_handler.h"
#include "event-top.h"
@@ -54,7 +53,6 @@
#include "top.h"
#include "ui.h"
#include "main.h"
-#include "solist.h"
#include "inferior.h"
@@ -76,7 +74,6 @@
#include "gdbsupport/scope-exit.h"
#include "gdbarch.h"
#include "cli-out.h"
-#include "gdbsupport/gdb-safe-ctype.h"
#include "bt-utils.h"
#include "gdbsupport/buildargv.h"
#include "pager.h"
@@ -177,6 +174,7 @@ vwarning (const char *string, va_list args)
target_terminal::ours_for_output ();
}
gdb_puts (warning_pre_print, gdb_stderr);
+ print_warning_prefix (gdb_stderr);
gdb_puts (_("warning: "), gdb_stderr);
gdb_vprintf (gdb_stderr, string, args);
gdb_printf (gdb_stderr, "\n");
@@ -382,7 +380,7 @@ internal_vproblem (struct internal_problem *problem,
#endif
/* Create a string containing the full error/warning message. Need
- to call query with this full string, as otherwize the reason
+ to call query with this full string, as otherwise the reason
(error/warning) and question become separated. Format using a
style similar to a compiler error message. Include extra detail
so that the user knows that they are living on the edge. */
@@ -1008,7 +1006,7 @@ parse_escape (struct gdbarch *gdbarch, const char **string_ptr)
while (++count < 3)
{
c = (**string_ptr);
- if (ISDIGIT (c) && c != '8' && c != '9')
+ if (c_isdigit (c) && c != '8' && c != '9')
{
(*string_ptr)++;
i *= 8;
@@ -1401,24 +1399,31 @@ pager_file::emit_style_escape (const ui_file_style &style)
{
m_applied_style = style;
if (m_paging)
- m_stream->emit_style_escape (style);
+ {
+ /* Previous style changes will have been sent to m_stream via
+ escape sequences encoded in the m_wrap_buffer. As a result,
+ the m_stream->m_applied_style will not have been updated.
+
+ If we now use m_stream->emit_style_escape, then the required
+ style might not actually be emitted as the requested style
+ might happen to match the out of date value in
+ m_stream->m_applied_style.
+
+ Instead, send the style change directly using m_stream->puts.
+
+ However, we track what style is currently applied to the
+ underlying stream in m_stream_style, this is updated whenever
+ m_wrap_buffer is flushed to the underlying stream. And so, if
+ the style we are applying matches what we know is currently
+ applied to the underlying stream, then we can skip sending
+ this style to the stream. */
+ this->set_stream_style (m_applied_style);
+ }
else
m_wrap_buffer.append (style.to_ansi ());
}
}
-/* See pager.h. */
-
-void
-pager_file::reset_style ()
-{
- if (can_emit_style_escape ())
- {
- m_applied_style = ui_file_style ();
- m_wrap_buffer.append (m_applied_style.to_ansi ());
- }
-}
-
/* Wait, so the user can read what's on the screen. Prompt the user
to continue by pressing RETURN. 'q' is also provided because
telling users what to do in the prompt is more user-friendly than
@@ -1436,8 +1441,8 @@ pager_file::prompt_for_continue ()
scoped_restore save_paging = make_scoped_restore (&m_paging, true);
- /* Clear the current styling. */
- m_stream->emit_style_escape (ui_file_style ());
+ /* Clear the current styling on ourselves and the managed stream. */
+ this->emit_style_escape (ui_file_style ());
if (annotation_level > 1)
m_stream->puts (("\n\032\032pre-prompt-for-continue\n"));
@@ -1520,6 +1525,7 @@ pager_file::flush_wrap_buffer ()
if (!m_paging && !m_wrap_buffer.empty ())
{
m_stream->puts (m_wrap_buffer.c_str ());
+ m_stream_style = m_applied_style;
m_wrap_buffer.clear ();
}
}
@@ -1694,10 +1700,25 @@ pager_file::puts (const char *linebuffer)
else if (*linebuffer == '\033'
&& skip_ansi_escape (linebuffer, &skip_bytes))
{
- m_wrap_buffer.append (linebuffer, skip_bytes);
- /* Note that we don't consider this a character, so we
+ /* We don't consider escape sequences as characters, so we
don't increment chars_printed here. */
- linebuffer += skip_bytes;
+
+ size_t style_len;
+ ui_file_style style;
+ if (style.parse (linebuffer, &style_len)
+ && style_len <= skip_bytes)
+ {
+ this->emit_style_escape (style);
+
+ linebuffer += style_len;
+ skip_bytes -= style_len;
+ }
+
+ if (skip_bytes > 0)
+ {
+ m_wrap_buffer.append (linebuffer, skip_bytes);
+ linebuffer += skip_bytes;
+ }
}
else if (*linebuffer == '\r')
{
@@ -1736,7 +1757,8 @@ pager_file::puts (const char *linebuffer)
current applied style to how it was at the WRAP_COLUMN
location. */
m_applied_style = m_wrap_style;
- m_stream->emit_style_escape (ui_file_style ());
+ this->set_stream_style (ui_file_style ());
+
/* If we aren't actually wrapping, don't output
newline -- if chars_per_line is right, we
probably just overflowed anyway; if it's wrong,
@@ -1764,7 +1786,7 @@ pager_file::puts (const char *linebuffer)
/* Having finished inserting the wrapping we should
restore the style as it was at the WRAP_COLUMN. */
- m_stream->emit_style_escape (m_wrap_style);
+ this->set_stream_style (m_wrap_style);
/* The WRAP_BUFFER will still contain content, and that
content might set some alternative style. Restore
@@ -1779,7 +1801,7 @@ pager_file::puts (const char *linebuffer)
m_wrap_column = 0; /* And disable fancy wrap */
}
else if (did_paginate)
- m_stream->emit_style_escape (save_style);
+ this->emit_style_escape (save_style);
}
}
@@ -1800,7 +1822,7 @@ void
pager_file::write (const char *buf, long length_buf)
{
/* We have to make a string here because the pager uses
- skip_ansi_escape, which requires NUL-termination. */
+ examine_ansi_escape, which requires NUL-termination. */
std::string str (buf, length_buf);
this->puts (str.c_str ());
}
@@ -2044,7 +2066,7 @@ fprintf_symbol (struct ui_file *stream, const char *name,
static bool
valid_identifier_name_char (int ch)
{
- return (ISALNUM (ch) || ch == '_');
+ return (c_isalnum (ch) || ch == '_');
}
/* Skip to end of token, or to END, whatever comes first. Input is
@@ -2054,7 +2076,7 @@ static const char *
cp_skip_operator_token (const char *token, const char *end)
{
const char *p = token;
- while (p != end && !ISSPACE (*p) && *p != '(')
+ while (p != end && !c_isspace (*p) && *p != '(')
{
if (valid_identifier_name_char (*p))
{
@@ -2108,9 +2130,9 @@ cp_skip_operator_token (const char *token, const char *end)
static void
skip_ws (const char *&string1, const char *&string2, const char *end_str2)
{
- while (ISSPACE (*string1))
+ while (c_isspace (*string1))
string1++;
- while (string2 < end_str2 && ISSPACE (*string2))
+ while (string2 < end_str2 && c_isspace (*string2))
string2++;
}
@@ -2174,7 +2196,7 @@ skip_template_parameter_list (const char **name)
/* Skip any whitespace that might occur after the closing of the
parameter list, but only if it is the end of parameter list. */
const char *q = p;
- while (ISSPACE (*q))
+ while (c_isspace (*q))
++q;
if (*q == '>')
p = q;
@@ -2206,8 +2228,8 @@ strncmp_iw_with_mode (const char *string1, const char *string2,
while (1)
{
if (skip_spaces
- || ((ISSPACE (*string1) && !valid_identifier_name_char (*string2))
- || (ISSPACE (*string2) && !valid_identifier_name_char (*string1))))
+ || ((c_isspace (*string1) && !valid_identifier_name_char (*string2))
+ || (c_isspace (*string2) && !valid_identifier_name_char (*string1))))
{
skip_ws (string1, string2, end_str2);
skip_spaces = false;
@@ -2240,7 +2262,7 @@ strncmp_iw_with_mode (const char *string1, const char *string2,
if (match_for_lcd != NULL && abi_start != string1)
match_for_lcd->mark_ignored_range (abi_start, string1);
- while (ISSPACE (*string1))
+ while (c_isspace (*string1))
string1++;
}
@@ -2307,9 +2329,9 @@ strncmp_iw_with_mode (const char *string1, const char *string2,
string1++;
string2++;
- while (ISSPACE (*string1))
+ while (c_isspace (*string1))
string1++;
- while (string2 < end_str2 && ISSPACE (*string2))
+ while (string2 < end_str2 && c_isspace (*string2))
string2++;
continue;
}
@@ -2409,14 +2431,13 @@ strncmp_iw_with_mode (const char *string1, const char *string2,
if (case_sensitivity == case_sensitive_on && *string1 != *string2)
break;
if (case_sensitivity == case_sensitive_off
- && (TOLOWER ((unsigned char) *string1)
- != TOLOWER ((unsigned char) *string2)))
+ && c_tolower (*string1) != c_tolower (*string2))
break;
/* If we see any non-whitespace, non-identifier-name character
(any of "()<>*&" etc.), then skip spaces the next time
around. */
- if (!ISSPACE (*string1) && !valid_identifier_name_char (*string1))
+ if (!c_isspace (*string1) && !valid_identifier_name_char (*string1))
skip_spaces = true;
string1++;
@@ -3129,16 +3150,16 @@ strcmp_iw_ordered (const char *string1, const char *string2)
while (*string1 != '\0' && *string2 != '\0')
{
- while (ISSPACE (*string1))
+ while (c_isspace (*string1))
string1++;
- while (ISSPACE (*string2))
+ while (c_isspace (*string2))
string2++;
switch (case_pass)
{
case case_sensitive_off:
- c1 = TOLOWER ((unsigned char) *string1);
- c2 = TOLOWER ((unsigned char) *string2);
+ c1 = c_tolower (*string1);
+ c2 = c_tolower (*string2);
break;
case case_sensitive_on:
c1 = *string1;
@@ -3247,17 +3268,17 @@ string_to_core_addr (const char *my_string)
{
CORE_ADDR addr = 0;
- if (my_string[0] == '0' && TOLOWER (my_string[1]) == 'x')
+ if (my_string[0] == '0' && c_tolower (my_string[1]) == 'x')
{
/* Assume that it is in hex. */
int i;
for (i = 2; my_string[i] != '\0'; i++)
{
- if (ISDIGIT (my_string[i]))
+ if (c_isdigit (my_string[i]))
addr = (my_string[i] - '0') + (addr * 16);
- else if (ISXDIGIT (my_string[i]))
- addr = (TOLOWER (my_string[i]) - 'a' + 0xa) + (addr * 16);
+ else if (c_isxdigit (my_string[i]))
+ addr = (c_tolower (my_string[i]) - 'a' + 0xa) + (addr * 16);
else
error (_("invalid hex \"%s\""), my_string);
}
@@ -3269,7 +3290,7 @@ string_to_core_addr (const char *my_string)
for (i = 0; my_string[i] != '\0'; i++)
{
- if (ISDIGIT (my_string[i]))
+ if (c_isdigit (my_string[i]))
addr = (my_string[i] - '0') + (addr * 10);
else
error (_("invalid decimal \"%s\""), my_string);
@@ -3344,7 +3365,7 @@ gdb_argv_as_array_view_test ()
argument. */
std::string
-ldirname (const char *filename)
+gdb_ldirname (const char *filename)
{
std::string dirname;
const char *base = lbasename (filename);
@@ -3386,51 +3407,6 @@ parse_pid_to_attach (const char *args)
return pid;
}
-/* Substitute all occurrences of string FROM by string TO in *STRINGP. *STRINGP
- must come from xrealloc-compatible allocator and it may be updated. FROM
- needs to be delimited by IS_DIR_SEPARATOR or DIRNAME_SEPARATOR (or be
- located at the start or end of *STRINGP. */
-
-void
-substitute_path_component (char **stringp, const char *from, const char *to)
-{
- char *string = *stringp, *s;
- const size_t from_len = strlen (from);
- const size_t to_len = strlen (to);
-
- for (s = string;;)
- {
- s = strstr (s, from);
- if (s == NULL)
- break;
-
- if ((s == string || IS_DIR_SEPARATOR (s[-1])
- || s[-1] == DIRNAME_SEPARATOR)
- && (s[from_len] == '\0' || IS_DIR_SEPARATOR (s[from_len])
- || s[from_len] == DIRNAME_SEPARATOR))
- {
- char *string_new;
-
- string_new
- = (char *) xrealloc (string, (strlen (string) + to_len + 1));
-
- /* Relocate the current S pointer. */
- s = s - string + string_new;
- string = string_new;
-
- /* Replace from by to. */
- memmove (&s[to_len], &s[from_len], strlen (&s[from_len]) + 1);
- memcpy (s, to, to_len);
-
- s += to_len;
- }
- else
- s++;
- }
-
- *stringp = string;
-}
-
#ifdef HAVE_WAITPID
#ifdef SIGALRM
@@ -3752,9 +3728,7 @@ test_assign_set_return_if_changed ()
}
#endif
-void _initialize_utils ();
-void
-_initialize_utils ()
+INIT_GDB_FILE (utils)
{
add_setshow_uinteger_cmd ("width", class_support, &chars_per_line, _("\
Set number of characters where GDB should wrap lines of its output."), _("\
diff --git a/gdb/utils.h b/gdb/utils.h
index b9044e6..b37e8f7 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -1,5 +1,5 @@
/* I/O, string, cleanup, and other random utilities for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -133,10 +133,7 @@ private:
extern int gdb_filename_fnmatch (const char *pattern, const char *string,
int flags);
-extern void substitute_path_component (char **stringp, const char *from,
- const char *to);
-
-std::string ldirname (const char *filename);
+std::string gdb_ldirname (const char *filename);
extern int count_path_elements (const char *path);
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 59a2930..d592344 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the NEC V850 for GDB, the GNU debugger.
- Copyright (C) 1996-2024 Free Software Foundation, Inc.
+ Copyright (C) 1996-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1461,9 +1461,7 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-void _initialize_v850_tdep ();
-void
-_initialize_v850_tdep ()
+INIT_GDB_FILE (v850_tdep)
{
gdbarch_register (bfd_arch_v850, v850_gdbarch_init);
gdbarch_register (bfd_arch_v850_rh850, v850_gdbarch_init);
diff --git a/gdb/valarith.c b/gdb/valarith.c
index a95d108..582fe6c 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -1,6 +1,6 @@
/* Perform arithmetic and other operations on values, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/valops.c b/gdb/valops.c
index 88a42d3..fa87546 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1,6 +1,6 @@
/* Perform non-arithmetic operations on values, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -45,9 +45,6 @@
/* Local functions. */
-static int typecmp (bool staticp, bool varargs, int nargs,
- struct field t1[], const gdb::array_view<value *> t2);
-
static struct value *search_struct_field (const char *, struct value *,
struct type *, int);
@@ -1695,6 +1692,9 @@ value_array (int lowbound, gdb::array_view<struct value *> elemvec)
/* Validate that the bounds are reasonable and that each of the
elements have the same size. */
+ if (elemvec.empty ())
+ error (_("size of the array element must not be zero"));
+
typelength = type_length_units (elemvec[0]->enclosing_type ());
for (struct value *other : elemvec.slice (1))
{
@@ -1763,7 +1763,7 @@ value_string (const gdb_byte *ptr, ssize_t count, struct type *char_type)
/* See if we can pass arguments in T2 to a function which takes arguments
- of types T1. T1 is a list of NARGS arguments, and T2 is an array_view
+ of types T1. T1 is an array_view of arguments, and T2 is an array_view
of the values we're trying to pass. If some arguments need coercion of
some sort, then the coerced values are written into T2. Return value is
0 if the arguments could be matched, or the position at which they
@@ -1780,8 +1780,8 @@ value_string (const gdb_byte *ptr, ssize_t count, struct type *char_type)
requested operation is type secure, shouldn't we? FIXME. */
static int
-typecmp (bool staticp, bool varargs, int nargs,
- struct field t1[], gdb::array_view<value *> t2)
+typecmp (bool staticp, bool varargs,
+ gdb::array_view<struct field> t1, gdb::array_view<value *> t2)
{
int i;
@@ -1791,7 +1791,7 @@ typecmp (bool staticp, bool varargs, int nargs,
t2 = t2.slice (1);
for (i = 0;
- (i < nargs) && t1[i].type ()->code () != TYPE_CODE_VOID;
+ (i < t1.size ()) && t1[i].type ()->code () != TYPE_CODE_VOID;
i++)
{
struct type *tt1, *tt2;
@@ -2224,7 +2224,6 @@ search_struct_method (const char *name, struct value **arg1p,
gdb_assert (args.has_value ());
if (!typecmp (TYPE_FN_FIELD_STATIC_P (f, j),
TYPE_FN_FIELD_TYPE (f, j)->has_varargs (),
- TYPE_FN_FIELD_TYPE (f, j)->num_fields (),
TYPE_FN_FIELD_ARGS (f, j), *args))
{
if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
@@ -2417,47 +2416,42 @@ value_struct_elt (struct value **argp,
return v;
}
-/* Given *ARGP, a value of type structure or union, or a pointer/reference
+/* Given VAL, a value of type structure or union, or a pointer/reference
to a structure or union, extract and return its component (field) of
type FTYPE at the specified BITPOS.
Throw an exception on error. */
struct value *
-value_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype,
- const char *err)
+value_struct_elt_bitpos (struct value *val, int bitpos, struct type *ftype)
{
struct type *t;
int i;
- *argp = coerce_array (*argp);
+ val = coerce_array (val);
- t = check_typedef ((*argp)->type ());
+ t = check_typedef (val->type ());
while (t->is_pointer_or_reference ())
{
- *argp = value_ind (*argp);
- if (check_typedef ((*argp)->type ())->code () != TYPE_CODE_FUNC)
- *argp = coerce_array (*argp);
- t = check_typedef ((*argp)->type ());
+ val = value_ind (val);
+ if (check_typedef (val->type ())->code () != TYPE_CODE_FUNC)
+ val = coerce_array (val);
+ t = check_typedef (val->type ());
}
if (t->code () != TYPE_CODE_STRUCT
&& t->code () != TYPE_CODE_UNION)
- error (_("Attempt to extract a component of a value that is not a %s."),
- err);
+ error (_("Attempt to extract a component of non-aggregate value."));
for (i = TYPE_N_BASECLASSES (t); i < t->num_fields (); i++)
{
if (!t->field (i).is_static ()
&& bitpos == t->field (i).loc_bitpos ()
&& types_equal (ftype, t->field (i).type ()))
- return (*argp)->primitive_field (0, i, t);
+ return val->primitive_field (0, i, t);
}
error (_("No field with matching bitpos and type."));
-
- /* Never hit. */
- return NULL;
}
/* Search through the methods of an object (and its bases) to find a
@@ -3828,7 +3822,7 @@ value_maybe_namespace_elt (const struct type *curtype,
if (sym.symbol == NULL)
return NULL;
else if ((noside == EVAL_AVOID_SIDE_EFFECTS)
- && (sym.symbol->aclass () == LOC_TYPEDEF))
+ && (sym.symbol->loc_class () == LOC_TYPEDEF))
result = value::allocate (sym.symbol->type ());
else
result = value_of_variable (sym.symbol, sym.block);
@@ -4026,7 +4020,7 @@ value_of_this_silent (const struct language_defn *lang)
bound as the original ARRAY. */
struct value *
-value_slice (struct value *array, int lowbound, int length)
+value_slice (struct value *array, LONGEST lowbound, LONGEST length)
{
struct type *slice_range_type, *slice_type, *range_type;
LONGEST lowerbound, upperbound;
@@ -4164,9 +4158,7 @@ cast_into_complex (struct type *type, struct value *val)
error (_("cannot cast non-number to complex"));
}
-void _initialize_valops ();
-void
-_initialize_valops ()
+INIT_GDB_FILE (valops)
{
add_setshow_boolean_cmd ("overload-resolution", class_support,
&overload_resolution, _("\
diff --git a/gdb/valprint.c b/gdb/valprint.c
index ce1ac75..b8c1c06 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1,6 +1,6 @@
/* Print values for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -34,7 +34,6 @@
#include "gdbsupport/gdb_obstack.h"
#include "charset.h"
#include "typeprint.h"
-#include <ctype.h>
#include <algorithm>
#include "gdbsupport/byte-vector.h"
#include "cli/cli-option.h"
@@ -3194,9 +3193,7 @@ test_print_flags (gdbarch *arch)
#endif
-void _initialize_valprint ();
-void
-_initialize_valprint ()
+INIT_GDB_FILE (valprint)
{
#if GDB_SELF_TEST
selftests::register_test_foreach_arch ("print-flags", test_print_flags);
diff --git a/gdb/valprint.h b/gdb/valprint.h
index 834e9d9..dd35586 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -1,6 +1,6 @@
/* Declarations for value printing routines for GDB, the GNU debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/value.c b/gdb/value.c
index ddc0959..c78bb98 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1,6 +1,6 @@
/* Low level packing and unpacking of values for GDB, the GNU Debugger.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -35,7 +35,6 @@
#include "valprint.h"
#include "cli/cli-decode.h"
#include "extension.h"
-#include <ctype.h>
#include "tracepoint.h"
#include "cp-abi.h"
#include "user-regs.h"
@@ -45,6 +44,7 @@
#include <utility>
#include <vector>
#include "completer.h"
+#include "gdbsupport/cleanups.h"
#include "gdbsupport/selftest.h"
#include "gdbsupport/array-view.h"
#include "cli/cli-style.h"
@@ -107,7 +107,7 @@ ranges_contain (const std::vector<range> &ranges, LONGEST offset,
range, we can do a binary search for the position the given range
would be inserted if we only considered the starting OFFSET of
ranges. We call that position I. Since we also have LENGTH to
- care for (this is a range afterall), we need to check if the
+ care for (this is a range after all), we need to check if the
_previous_ range overlaps the I range. E.g.,
R
@@ -267,7 +267,7 @@ insert_into_bit_range_vector (std::vector<range> *vectorp,
/* Do a binary search for the position the given range would be
inserted if we only considered the starting OFFSET of ranges.
Call that position I. Since we also have LENGTH to care for
- (this is a range afterall), we need to check if the _previous_
+ (this is a range after all), we need to check if the _previous_
range overlaps the I range. E.g., calling R the new range:
#1 - overlaps with previous
@@ -2833,7 +2833,7 @@ value_as_address (struct value *val)
#endif
}
-/* Unpack raw data (copied from debugee, target byte order) at VALADDR
+/* Unpack raw data (copied from debuggee, target byte order) at VALADDR
as a long, or as a double, assuming the raw data is described
by type TYPE. Knows how to convert different sizes of values
and can convert between fixed and floating point. We don't assume
@@ -2924,7 +2924,7 @@ unpack_long (struct type *type, const gdb_byte *valaddr)
}
}
-/* Unpack raw data (copied from debugee, target byte order) at VALADDR
+/* Unpack raw data (copied from debuggee, target byte order) at VALADDR
as a CORE_ADDR, assuming the raw data is described by type TYPE.
We don't assume any alignment for the raw data. Return value is in
host byte order.
@@ -3266,6 +3266,9 @@ unpack_bits_as_long (struct type *field_type, const gdb_byte *valaddr,
}
}
+ if (field_type->code () == TYPE_CODE_RANGE)
+ val += field_type->bounds ()->bias;
+
return val;
}
@@ -3296,21 +3299,28 @@ unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr,
return 1;
}
-/* Unpack a field FIELDNO of the specified TYPE, from the anonymous
- object at VALADDR. See unpack_bits_as_long for more details. */
+/* See value.h. */
LONGEST
-unpack_field_as_long (struct type *type, const gdb_byte *valaddr, int fieldno)
+unpack_field_as_long (const gdb_byte *valaddr, struct field *field)
{
- int bitpos = type->field (fieldno).loc_bitpos ();
- int bitsize = type->field (fieldno).bitsize ();
- struct type *field_type = type->field (fieldno).type ();
+ int bitpos = field->loc_bitpos ();
+ int bitsize = field->bitsize ();
+ struct type *field_type = field->type ();
return unpack_bits_as_long (field_type, valaddr, bitpos, bitsize);
}
/* See value.h. */
+LONGEST
+unpack_field_as_long (struct type *type, const gdb_byte *valaddr, int fieldno)
+{
+ return unpack_field_as_long (valaddr, &type->field (fieldno));
+}
+
+/* See value.h. */
+
void
value::unpack_bitfield (struct value *dest_val,
LONGEST bitpos, LONGEST bitsize,
@@ -3712,11 +3722,11 @@ value_from_history_ref (const char *h, const char **endp)
len = 2;
/* Find length of numeral string. */
- for (; isdigit (h[len]); len++)
+ for (; c_isdigit (h[len]); len++)
;
/* Make sure numeral string is not part of an identifier. */
- if (h[len] == '_' || isalpha (h[len]))
+ if (h[len] == '_' || c_isalpha (h[len]))
return NULL;
/* Now collect the index value. */
@@ -4486,9 +4496,7 @@ test_value_copy ()
} /* namespace selftests */
#endif /* GDB_SELF_TEST */
-void _initialize_values ();
-void
-_initialize_values ()
+INIT_GDB_FILE (values)
{
cmd_list_element *show_convenience_cmd
= add_cmd ("convenience", no_class, show_convenience, _("\
diff --git a/gdb/value.h b/gdb/value.h
index 8e5fd54..b9d2809 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -1,6 +1,6 @@
/* Definitions for values of C expressions, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -961,7 +961,7 @@ struct lval_funcs
This may simply return the same closure, if VALUE's is
reference-counted or statically allocated.
- This may be NULL, in which case VALUE's closure is re-used in the
+ This may be NULL, in which case VALUE's closure is reused in the
new value. */
void *(*copy_closure) (const struct value *v);
@@ -1058,10 +1058,19 @@ extern gdb_mpz value_as_mpz (struct value *val);
extern LONGEST unpack_long (struct type *type, const gdb_byte *valaddr);
extern CORE_ADDR unpack_pointer (struct type *type, const gdb_byte *valaddr);
+/* Unpack a field FIELDNO of the specified TYPE, from the anonymous
+ object at VALADDR. See unpack_bits_as_long for more details. */
+
extern LONGEST unpack_field_as_long (struct type *type,
const gdb_byte *valaddr,
int fieldno);
+/* Unpack a field, FIELD, from the anonymous object at VALADDR. See
+ unpack_bits_as_long for more details. */
+
+extern LONGEST unpack_field_as_long (const gdb_byte *valaddr,
+ struct field *field);
+
/* Unpack a bitfield of the specified FIELD_TYPE, from the object at
VALADDR, and store the result in *RESULT.
The bitfield starts at BITPOS bits and contains BITSIZE bits; if
@@ -1147,9 +1156,12 @@ extern struct value *address_of_variable (struct symbol *var,
extern value *value_of_register (int regnum, const frame_info_ptr &next_frame);
-/* Same as the above, but the value is not fetched. */
+/* Same as the above, but the value is not fetched. If TYPE is
+ non-nullptr, use it as the value type. Otherwise, 'register_type'
+ will be used to obtain the type. */
-extern value *value_of_register_lazy (const frame_info_ptr &next_frame, int regnum);
+extern value *value_of_register_lazy (const frame_info_ptr &next_frame,
+ int regnum, struct type *type = nullptr);
/* Return the symbol's reading requirement. */
@@ -1297,10 +1309,9 @@ extern struct value *value_struct_elt (struct value **argp,
const char *name, int *static_memfuncp,
const char *err);
-extern struct value *value_struct_elt_bitpos (struct value **argp,
+extern struct value *value_struct_elt_bitpos (struct value *val,
int bitpos,
- struct type *field_type,
- const char *err);
+ struct type *field_type);
extern struct value *value_aggregate_elt (struct type *curtype,
const char *name,
@@ -1578,7 +1589,7 @@ extern struct value *make_cv_value (int, int, struct value *);
extern struct value *varying_to_slice (struct value *);
-extern struct value *value_slice (struct value *, int, int);
+extern struct value *value_slice (struct value *, LONGEST, LONGEST);
/* Create a complex number. The type is the complex type; the values
are cast to the underlying scalar type before the complex number is
diff --git a/gdb/varobj-iter.h b/gdb/varobj-iter.h
index 46e25e7..f19ebda 100644
--- a/gdb/varobj-iter.h
+++ b/gdb/varobj-iter.h
@@ -1,5 +1,5 @@
/* Iterator of varobj.
- Copyright (C) 2013-2024 Free Software Foundation, Inc.
+ Copyright (C) 2013-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/varobj.c b/gdb/varobj.c
index dcadce1..4dc986a 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -1,6 +1,6 @@
/* Implementation of the GDB variable objects API.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1309,7 +1309,7 @@ install_new_value (struct varobj *var, struct value *value, bool initial)
{
/* For values that are not changeable, we don't compare the values.
However, we want to notice if a value was not NULL and now is NULL,
- or vise versa, so that we report when top-level varobjs come in scope
+ or vice versa, so that we report when top-level varobjs come in scope
and leave the scope. */
changed = (var->value != NULL) != (value != NULL);
}
@@ -2424,9 +2424,7 @@ eq_varobj_and_string (const void *a, const void *b)
return obj->obj_name == name;
}
-void _initialize_varobj ();
-void
-_initialize_varobj ()
+INIT_GDB_FILE (varobj)
{
varobj_table = htab_create_alloc (5, hash_varobj, eq_varobj_and_string,
nullptr, xcalloc, xfree);
diff --git a/gdb/varobj.h b/gdb/varobj.h
index 9d19f53..00e776f 100644
--- a/gdb/varobj.h
+++ b/gdb/varobj.h
@@ -1,5 +1,5 @@
/* GDB variable objects API.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gdb/vax-bsd-nat.c b/gdb/vax-bsd-nat.c
index 2a4db3a..717314e 100644
--- a/gdb/vax-bsd-nat.c
+++ b/gdb/vax-bsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for modern VAX BSD's.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -136,9 +136,7 @@ vaxbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
return 1;
}
-void _initialize_vaxbsd_nat ();
-void
-_initialize_vaxbsd_nat ()
+INIT_GDB_FILE (vaxbsd_nat)
{
add_inf_child_target (&the_vax_bsd_nat_target);
diff --git a/gdb/vax-netbsd-tdep.c b/gdb/vax-netbsd-tdep.c
index fa528ae..7781264 100644
--- a/gdb/vax-netbsd-tdep.c
+++ b/gdb/vax-netbsd-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for NetBSD/vax.
- Copyright (C) 2004-2024 Free Software Foundation, Inc.
+ Copyright (C) 2004-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -32,13 +32,10 @@ vaxnbsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
nbsd_init_abi (info, gdbarch);
/* NetBSD ELF uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
}
-void _initialize_vaxnbsd_tdep ();
-void
-_initialize_vaxnbsd_tdep ()
+INIT_GDB_FILE (vaxnbsd_tdep)
{
gdbarch_register_osabi (bfd_arch_vax, 0, GDB_OSABI_NETBSD,
vaxnbsd_elf_init_abi);
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index 4660979..0a83f4f 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the VAX.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -438,7 +438,7 @@ vax_frame_num_args (const frame_info_ptr &frame)
-/* Initialize the current architecture based on INFO. If possible, re-use an
+/* Initialize the current architecture based on INFO. If possible, reuse an
architecture from ARCHES, which is a list of architectures already created
during this debugging session.
@@ -506,9 +506,7 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return (gdbarch);
}
-void _initialize_vax_tdep ();
-void
-_initialize_vax_tdep ()
+INIT_GDB_FILE (vax_tdep)
{
gdbarch_register (bfd_arch_vax, vax_gdbarch_init, NULL);
}
diff --git a/gdb/vax-tdep.h b/gdb/vax-tdep.h
index fbc35d9..dadad62 100644
--- a/gdb/vax-tdep.h
+++ b/gdb/vax-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for the VAX.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/version.in b/gdb/version.in
index 75e06a8..85ad8ec 100644
--- a/gdb/version.in
+++ b/gdb/version.in
@@ -1 +1 @@
-17.0.50.DATE-git \ No newline at end of file
+18.0.50.DATE-git \ No newline at end of file
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index e73a275..f74ea0c 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1,6 +1,6 @@
/* Target-vector operations for controlling windows child processes, for GDB.
- Copyright (C) 1995-2024 Free Software Foundation, Inc.
+ Copyright (C) 1995-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions, A Red Hat Company.
@@ -56,7 +56,6 @@
#include "cli/cli-style.h"
#include <unistd.h>
#include "exec.h"
-#include "solist.h"
#include "solib.h"
#include "xml-support.h"
#include "inttypes.h"
@@ -433,7 +432,12 @@ wait_for_single (HANDLE handle, DWORD howlong)
{
while (true)
{
- DWORD r = WaitForSingleObject (handle, howlong);
+ /* Using an INFINITE argument to WaitForSingleObject may cause a system
+ deadlock. Avoid it by waiting for a bit in a loop instead. */
+ DWORD milliseconds = howlong == INFINITE ? 100 : howlong;
+ DWORD r = WaitForSingleObject (handle, milliseconds);
+ if (howlong == INFINITE && r == WAIT_TIMEOUT)
+ continue;
if (r == WAIT_OBJECT_0)
return;
if (r == WAIT_FAILED)
@@ -2422,7 +2426,7 @@ redir_set_redirection (const char *s, int *inp, int *out, int *err)
/* cmd.exe recognizes "&N" only immediately after the redirection symbol. */
if (*s != '&')
{
- while (isspace (*s)) /* skip whitespace before file name */
+ while (c_isspace (*s)) /* skip whitespace before file name */
s++;
*d++ = ' '; /* separate file name with a single space */
}
@@ -2449,7 +2453,7 @@ redir_set_redirection (const char *s, int *inp, int *out, int *err)
s++;
*d++ = *s++;
}
- else if (isspace (*s) && !quote)
+ else if (c_isspace (*s) && !quote)
break;
else
*d++ = *s++;
@@ -2485,7 +2489,7 @@ redirect_inferior_handles (const char *cmd_orig, char *cmd,
int quote = 0;
bool retval = false;
- while (isspace (*s))
+ while (c_isspace (*s))
*d++ = *s++;
while (*s)
@@ -3089,9 +3093,7 @@ windows_nat_target::thread_name (struct thread_info *thr)
}
-void _initialize_windows_nat ();
-void
-_initialize_windows_nat ()
+INIT_GDB_FILE (windows_nat)
{
x86_dr_low.set_control = cygwin_set_dr7;
x86_dr_low.set_addr = cygwin_set_dr;
@@ -3265,9 +3267,7 @@ windows_nat_target::thread_alive (ptid_t ptid)
return WaitForSingleObject (th->h, 0) != WAIT_OBJECT_0;
}
-void _initialize_check_for_gdb_ini ();
-void
-_initialize_check_for_gdb_ini ()
+INIT_GDB_FILE (check_for_gdb_ini)
{
char *homedir;
if (inhibit_gdbinit)
diff --git a/gdb/windows-nat.h b/gdb/windows-nat.h
index b36e7f4..ef86f3b 100644
--- a/gdb/windows-nat.h
+++ b/gdb/windows-nat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -25,14 +25,14 @@ typedef int (segment_register_p_ftype) (int regnum);
/* segment_register_p_ftype implementation for x86. */
int i386_windows_segment_register_p (int regnum);
-/* context register offests for x86. */
+/* context register offsets for x86. */
extern const int i386_mappings[];
#ifdef __x86_64__
/* segment_register_p_ftype implementation for amd64. */
int amd64_windows_segment_register_p (int regnum);
-/* context register offests for amd64. */
+/* context register offsets for amd64. */
extern const int amd64_mappings[];
#endif
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index 1302b25..e6571c7 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -36,7 +36,6 @@
#include "gdbcore.h"
#include "coff/internal.h"
#include "libcoff.h"
-#include "solist.h"
#define CYGWIN_DLL_NAME "cygwin1.dll"
@@ -551,43 +550,6 @@ windows_xfer_shared_library (const char* so_name, CORE_ADDR load_addr,
xml += "\"/></library>";
}
-/* Implement the "iterate_over_objfiles_in_search_order" gdbarch
- method. It searches all objfiles, starting with CURRENT_OBJFILE
- first (if not NULL).
-
- On Windows, the system behaves a little differently when two
- objfiles each define a global symbol using the same name, compared
- to other platforms such as GNU/Linux for instance. On GNU/Linux,
- all instances of the symbol effectively get merged into a single
- one, but on Windows, they remain distinct.
-
- As a result, it usually makes sense to start global symbol searches
- with the current objfile before expanding it to all other objfiles.
- This helps for instance when a user debugs some code in a DLL that
- refers to a global variable defined inside that DLL. When trying
- to print the value of that global variable, it would be unhelpful
- to print the value of another global variable defined with the same
- name, but in a different DLL. */
-
-static void
-windows_iterate_over_objfiles_in_search_order
- (gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
- objfile *current_objfile)
-{
- if (current_objfile)
- {
- if (cb (current_objfile))
- return;
- }
-
- for (objfile *objfile : current_program_space->objfiles ())
- if (objfile != current_objfile)
- {
- if (cb (objfile))
- return;
- }
-}
-
static void
show_maint_show_all_tib (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
@@ -863,10 +825,30 @@ windows_get_siginfo_type (struct gdbarch *gdbarch)
return siginfo_type;
}
+/* solib_ops for Windows systems. */
+
+struct windows_solib_ops : target_solib_ops
+{
+ using target_solib_ops::target_solib_ops;
+
+ void create_inferior_hook (int from_tty) const override;
+ void iterate_over_objfiles_in_search_order
+ (iterate_over_objfiles_in_search_order_cb_ftype cb,
+ objfile *current_objfile) const override;
+};
+
+/* Return a new solib_ops for Windows systems. */
+
+static solib_ops_up
+make_windows_solib_ops (program_space *pspace)
+{
+ return std::make_unique<windows_solib_ops> (pspace);
+}
+
/* Implement the "solib_create_inferior_hook" solib_ops method. */
-static void
-windows_solib_create_inferior_hook (int from_tty)
+void
+windows_solib_ops::create_inferior_hook (int from_tty) const
{
CORE_ADDR exec_base = 0;
@@ -911,7 +893,42 @@ windows_solib_create_inferior_hook (int from_tty)
}
}
-static solib_ops windows_so_ops;
+/* Implement the "iterate_over_objfiles_in_search_order" gdbarch
+ method. It searches all objfiles, starting with CURRENT_OBJFILE
+ first (if not NULL).
+
+ On Windows, the system behaves a little differently when two
+ objfiles each define a global symbol using the same name, compared
+ to other platforms such as GNU/Linux for instance. On GNU/Linux,
+ all instances of the symbol effectively get merged into a single
+ one, but on Windows, they remain distinct.
+
+ As a result, it usually makes sense to start global symbol searches
+ with the current objfile before expanding it to all other objfiles.
+ This helps for instance when a user debugs some code in a DLL that
+ refers to a global variable defined inside that DLL. When trying
+ to print the value of that global variable, it would be unhelpful
+ to print the value of another global variable defined with the same
+ name, but in a different DLL. */
+
+void
+windows_solib_ops::iterate_over_objfiles_in_search_order
+ (iterate_over_objfiles_in_search_order_cb_ftype cb,
+ objfile *current_objfile) const
+{
+ if (current_objfile)
+ {
+ if (cb (current_objfile))
+ return;
+ }
+
+ for (objfile &objfile : m_pspace->objfiles ())
+ if (&objfile != current_objfile)
+ {
+ if (cb (&objfile))
+ return;
+ }
+}
/* Common parts for gdbarch initialization for the Windows and Cygwin OS
ABIs. */
@@ -926,13 +943,7 @@ windows_init_abi_common (struct gdbarch_info info, struct gdbarch *gdbarch)
`c:\Program Files\Foo App\mydll.dll', for example. */
set_gdbarch_has_dos_based_file_system (gdbarch, 1);
- set_gdbarch_iterate_over_objfiles_in_search_order
- (gdbarch, windows_iterate_over_objfiles_in_search_order);
-
- windows_so_ops = solib_target_so_ops;
- windows_so_ops.solib_create_inferior_hook
- = windows_solib_create_inferior_hook;
- set_gdbarch_so_ops (gdbarch, &windows_so_ops);
+ set_gdbarch_make_solib_ops (gdbarch, make_windows_solib_ops);
set_gdbarch_get_siginfo_type (gdbarch, windows_get_siginfo_type);
}
@@ -1151,13 +1162,11 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj)
ULONGEST
windows_core_xfer_shared_libraries (struct gdbarch *gdbarch,
- gdb_byte *readbuf,
+ struct bfd &cbfd, gdb_byte *readbuf,
ULONGEST offset, ULONGEST len)
{
cpms_data data { gdbarch, "<library-list>\n", 0 };
- bfd_map_over_sections (current_program_space->core_bfd (),
- core_process_module_section,
- &data);
+ bfd_map_over_sections (&cbfd, core_process_module_section, &data);
data.xml += "</library-list>\n";
ULONGEST len_avail = data.xml.length ();
@@ -1183,9 +1192,7 @@ windows_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
return normal_pid_to_str (ptid);
}
-void _initialize_windows_tdep ();
-void
-_initialize_windows_tdep ()
+INIT_GDB_FILE (windows_tdep)
{
init_w32_command_list ();
cmd_list_element *info_w32_thread_information_block_cmd
diff --git a/gdb/windows-tdep.h b/gdb/windows-tdep.h
index 4427b25..4d8e6bc 100644
--- a/gdb/windows-tdep.h
+++ b/gdb/windows-tdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -33,6 +33,7 @@ extern void windows_xfer_shared_library (const char* so_name,
std::string &xml);
extern ULONGEST windows_core_xfer_shared_libraries (struct gdbarch *gdbarch,
+ struct bfd &cbfd,
gdb_byte *readbuf,
ULONGEST offset,
ULONGEST len);
diff --git a/gdb/x86-bsd-nat.c b/gdb/x86-bsd-nat.c
index 2bdd385..94fb98f 100644
--- a/gdb/x86-bsd-nat.c
+++ b/gdb/x86-bsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for X86 BSD's.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -86,9 +86,9 @@ x86bsd_dr_set (ptid_t ptid, int regnum, unsigned long value)
DBREG_DRX ((&dbregs), regnum) = value;
- for (thread_info *thread : current_inferior ()->non_exited_threads ())
+ for (thread_info &thread : current_inferior ()->non_exited_threads ())
{
- if (gdb_ptrace (PT_SETDBREGS, thread->ptid,
+ if (gdb_ptrace (PT_SETDBREGS, thread.ptid,
(PTRACE_TYPE_ARG3) &dbregs) == -1)
perror_with_name (_("Couldn't write debug registers"));
}
@@ -128,9 +128,7 @@ x86bsd_dr_get_control (void)
#endif /* PT_GETDBREGS */
-void _initialize_x86_bsd_nat ();
-void
-_initialize_x86_bsd_nat ()
+INIT_GDB_FILE (x86_bsd_nat)
{
#ifdef HAVE_PT_GETDBREGS
x86_dr_low.set_control = x86bsd_dr_set_control;
diff --git a/gdb/x86-bsd-nat.h b/gdb/x86-bsd-nat.h
index b174544..95ae46c 100644
--- a/gdb/x86-bsd-nat.h
+++ b/gdb/x86-bsd-nat.h
@@ -1,6 +1,6 @@
/* Native-dependent code for x86 BSD's.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/x86-fbsd-nat.c b/gdb/x86-fbsd-nat.c
index bfd15bf..99a1be4 100644
--- a/gdb/x86-fbsd-nat.c
+++ b/gdb/x86-fbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for FreeBSD x86.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/x86-fbsd-nat.h b/gdb/x86-fbsd-nat.h
index 66f2b2f..9dee8b8 100644
--- a/gdb/x86-fbsd-nat.h
+++ b/gdb/x86-fbsd-nat.h
@@ -1,6 +1,6 @@
/* Native-dependent code for FreeBSD x86.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/x86-gnu-nat.c b/gdb/x86-gnu-nat.c
index da3b7e9..e088189 100644
--- a/gdb/x86-gnu-nat.c
+++ b/gdb/x86-gnu-nat.c
@@ -1,6 +1,6 @@
/* Low level interface to i386 running the GNU Hurd.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -491,9 +491,7 @@ x86_gnu_dr_get_control (void)
}
#endif /* i386_DEBUG_STATE */
-void _initialize_x86_gnu_nat ();
-void
-_initialize_x86_gnu_nat ()
+INIT_GDB_FILE (x86_gnu_nat)
{
#ifdef i386_DEBUG_STATE
x86_dr_low.set_control = x86_gnu_dr_set_control;
diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c
index 2afa04f..660a906 100644
--- a/gdb/x86-linux-nat.c
+++ b/gdb/x86-linux-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux x86 (i386 and x86-64).
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -41,6 +41,7 @@
#include "nat/x86-linux.h"
#include "nat/x86-linux-dregs.h"
#include "nat/linux-ptrace.h"
+#include "x86-tdep.h"
#include "nat/x86-linux-tdesc.h"
/* linux_nat_target::low_new_fork implementation. */
@@ -97,15 +98,19 @@ const struct target_desc *
x86_linux_nat_target::read_description ()
{
/* The x86_linux_tdesc_for_tid call only reads xcr0 the first time it is
- called, the xcr0 value is stored here and reused on subsequent calls. */
- static uint64_t xcr0_storage;
+ called. Also it checks the enablement state of features which are
+ not configured in xcr0, such as CET shadow stack. Once the supported
+ features are identified, the XSTATE_BV_STORAGE value is configured
+ accordingly and preserved for subsequent calls of this function. */
+ static uint64_t xstate_bv_storage;
if (inferior_ptid == null_ptid)
return this->beneath ()->read_description ();
int tid = inferior_ptid.pid ();
- return x86_linux_tdesc_for_tid (tid, &xcr0_storage, &this->m_xsave_layout);
+ return x86_linux_tdesc_for_tid (tid, &xstate_bv_storage,
+ &this->m_xsave_layout);
}
@@ -210,9 +215,46 @@ x86_linux_get_thread_area (pid_t pid, void *addr, unsigned int *base_addr)
}
-void _initialize_x86_linux_nat ();
+/* See x86-linux-nat.h. */
+
void
-_initialize_x86_linux_nat ()
+x86_linux_fetch_ssp (regcache *regcache, const int tid)
+{
+ uint64_t ssp = 0x0;
+ iovec iov {&ssp, sizeof (ssp)};
+
+ /* The shadow stack may be enabled and disabled at runtime. Reading the
+ ssp might fail as shadow stack was not activated for the current
+ thread. We don't want to show a warning but silently return. The
+ register will be shown as unavailable for the user. */
+ if (ptrace (PTRACE_GETREGSET, tid, NT_X86_SHSTK, &iov) != 0)
+ return;
+
+ x86_supply_ssp (regcache, ssp);
+}
+
+/* See x86-linux-nat.h. */
+
+void
+x86_linux_store_ssp (const regcache *regcache, const int tid)
+{
+ uint64_t ssp = 0x0;
+ iovec iov {&ssp, sizeof (ssp)};
+ x86_collect_ssp (regcache, ssp);
+
+ /* Dependent on the target the ssp register can be unavailable or
+ nullptr when shadow stack is supported by HW and the Linux kernel but
+ not enabled for the current thread. In case of nullptr, GDB tries to
+ restore the shadow stack pointer after an inferior call. The ptrace
+ call with PTRACE_SETREGSET will fail here with errno ENODEV. We
+ don't want to throw an error in this case but silently continue. */
+ errno = 0;
+ if ((ptrace (PTRACE_SETREGSET, tid, NT_X86_SHSTK, &iov) != 0)
+ && (errno != ENODEV))
+ perror_with_name (_("Failed to write pl3_ssp register"));
+}
+
+INIT_GDB_FILE (x86_linux_nat)
{
/* Initialize the debug register function vectors. */
x86_dr_low.set_control = x86_linux_dr_set_control;
diff --git a/gdb/x86-linux-nat.h b/gdb/x86-linux-nat.h
index 3c2241b..c455653 100644
--- a/gdb/x86-linux-nat.h
+++ b/gdb/x86-linux-nat.h
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux x86 (i386 and x86-64).
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -92,4 +92,15 @@ private:
extern ps_err_e x86_linux_get_thread_area (pid_t pid, void *addr,
unsigned int *base_addr);
+/* Fetch the value of the shadow stack pointer register from process/thread
+ TID and store it to GDB's register cache. */
+
+extern void x86_linux_fetch_ssp (regcache *regcache, const int tid);
+
+/* Read the value of the shadow stack pointer from GDB's register cache
+ and store it in the shadow stack pointer register of process/thread TID.
+ Throw an error in case of failure. */
+
+extern void x86_linux_store_ssp (const regcache *regcache, const int tid);
+
#endif /* GDB_X86_LINUX_NAT_H */
diff --git a/gdb/x86-nat.c b/gdb/x86-nat.c
index 84c835f..eb44dd5 100644
--- a/gdb/x86-nat.c
+++ b/gdb/x86-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for x86 (i386 and x86-64).
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/x86-nat.h b/gdb/x86-nat.h
index 1b8fdd3..6197218 100644
--- a/gdb/x86-nat.h
+++ b/gdb/x86-nat.h
@@ -3,7 +3,7 @@
Low level functions to implement Operating System specific
code to manipulate x86 debug registers.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/x86-tdep.c b/gdb/x86-tdep.c
index e50b5fb..ea5226f 100644
--- a/gdb/x86-tdep.c
+++ b/gdb/x86-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for X86-based targets.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,10 +17,31 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "i386-tdep.h"
#include "x86-tdep.h"
#include "symtab.h"
+/* See x86-tdep.h. */
+
+void
+x86_supply_ssp (regcache *regcache, const uint64_t ssp)
+{
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (regcache->arch ());
+ gdb_assert (tdep != nullptr && tdep->ssp_regnum != -1);
+ regcache->raw_supply (tdep->ssp_regnum, &ssp);
+}
+
+/* See x86-tdep.h. */
+
+void
+x86_collect_ssp (const regcache *regcache, uint64_t &ssp)
+{
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (regcache->arch ());
+ gdb_assert (tdep != nullptr && tdep->ssp_regnum != -1);
+ regcache->raw_collect (tdep->ssp_regnum, &ssp);
+}
+
/* Check whether NAME is included in NAMES[LO] (inclusive) to NAMES[HI]
(exclusive). */
diff --git a/gdb/x86-tdep.h b/gdb/x86-tdep.h
index 2b5853a..855d04b 100644
--- a/gdb/x86-tdep.h
+++ b/gdb/x86-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for X86-based targets.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,6 +20,15 @@
#ifndef GDB_X86_TDEP_H
#define GDB_X86_TDEP_H
+/* Fill SSP to the shadow stack pointer in GDB's REGCACHE. */
+
+extern void x86_supply_ssp (regcache *regcache, const uint64_t ssp);
+
+/* Collect the value of the shadow stack pointer in GDB's REGCACHE and
+ write it to SSP. */
+
+extern void x86_collect_ssp (const regcache *regcache, uint64_t &ssp);
+
/* Checks whether PC lies in an indirect branch thunk using registers
REGISTER_NAMES[LO] (inclusive) to REGISTER_NAMES[HI] (exclusive). */
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 2ff9d4a..d8b99a0 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1,5 +1,5 @@
/* Read AIX xcoff symbol tables and convert to internal format, for GDB.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
Derived from coffread.c, dbxread.c, and a lot of hacking.
Contributed by IBM Corporation.
@@ -23,7 +23,6 @@
#include <sys/types.h>
#include <fcntl.h>
-#include <ctype.h>
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
#endif
@@ -970,7 +969,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
while (symnum < max_symnum)
{
- QUIT; /* make this command interruptable. */
+ QUIT; /* make this command interruptible. */
/* READ_ONE_SYMBOL (symbol, cs, symname_alloced); */
/* read one symbol into `cs' structure. After processing the
@@ -1371,7 +1370,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
case C_BINCL:
/* beginning of include file */
/* In xlc output, C_BINCL/C_EINCL pair doesn't show up in sorted
- order. Thus, when wee see them, we might not know enough info
+ order. Thus, when we see them, we might not know enough info
to process them. Thus, we'll be saving them into a table
(inclTable) and postpone their processing. */
@@ -1491,7 +1490,7 @@ process_xcoff_symbol (struct xcoff_symbol *cs, struct objfile *objfile)
sym->set_type (builtin_type (objfile)->nodebug_text_symbol);
sym->set_domain (FUNCTION_DOMAIN);
- sym->set_aclass_index (LOC_BLOCK);
+ sym->set_loc_class_index (LOC_BLOCK);
sym2 = new (&objfile->objfile_obstack) symbol (*sym);
if (cs->c_sclass == C_EXT || C_WEAKEXT)
@@ -2999,9 +2998,7 @@ xcoff_get_n_import_files (bfd *abfd)
return l_nimpid - 1;
}
-void _initialize_xcoffread ();
-void
-_initialize_xcoffread ()
+INIT_GDB_FILE (xcoffread)
{
add_symtab_fns (bfd_target_xcoff_flavour, &xcoff_sym_fns);
}
diff --git a/gdb/xcoffread.h b/gdb/xcoffread.h
index 7528dec..41cceaf 100644
--- a/gdb/xcoffread.h
+++ b/gdb/xcoffread.h
@@ -1,5 +1,5 @@
/* Read AIX xcoff symbol tables and convert to internal format, for GDB.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/xml-builtin.h b/gdb/xml-builtin.h
index 463e0fb..d78b686 100644
--- a/gdb/xml-builtin.h
+++ b/gdb/xml-builtin.h
@@ -1,6 +1,6 @@
/* Header file for builtin XML files.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/xml-support.c b/gdb/xml-support.c
index 33c8e41..ebf6ea6 100644
--- a/gdb/xml-support.c
+++ b/gdb/xml-support.c
@@ -1,6 +1,6 @@
/* Helper routines for parsing XML using Expat.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,7 +21,6 @@
#include "xml-builtin.h"
#include "xml-support.h"
#include "gdbsupport/filestuff.h"
-#include "gdbsupport/gdb-safe-ctype.h"
#include <vector>
#include <string>
@@ -430,10 +429,10 @@ gdb_xml_parser::end_element (const XML_Char *name)
body = scope->body.c_str ();
/* Strip leading and trailing whitespace. */
- while (length > 0 && ISSPACE (body[length - 1]))
+ while (length > 0 && c_isspace (body[length - 1]))
length--;
scope->body.erase (length);
- while (*body && ISSPACE (*body))
+ while (*body && c_isspace (*body))
body++;
}
@@ -999,10 +998,7 @@ xml_fetch_content_from_file (const char *filename, const char *dirname)
return text;
}
-void _initialize_xml_support ();
-void _initialize_xml_support ();
-void
-_initialize_xml_support ()
+INIT_GDB_FILE (xml_support)
{
add_setshow_boolean_cmd ("xml", class_maintenance, &debug_xml,
_("Set XML parser debugging."),
diff --git a/gdb/xml-support.h b/gdb/xml-support.h
index f467d7f..f699269 100644
--- a/gdb/xml-support.h
+++ b/gdb/xml-support.h
@@ -1,6 +1,6 @@
/* Helper routines for parsing XML using Expat.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c
index 2373d0f..b58fe5d0 100644
--- a/gdb/xml-syscall.c
+++ b/gdb/xml-syscall.c
@@ -1,7 +1,7 @@
/* Functions that provide the mechanism to parse a syscall XML file
and get its values.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -319,7 +319,7 @@ xml_init_syscalls_info (const char *filename)
if (!full_file)
return NULL;
- const std::string dirname = ldirname (filename);
+ const std::string dirname = gdb_ldirname (filename);
auto fetch_another = [&dirname] (const char *name)
{
return xml_fetch_content_from_file (name, dirname.c_str ());
diff --git a/gdb/xml-syscall.h b/gdb/xml-syscall.h
index 579805d..77ff928 100644
--- a/gdb/xml-syscall.h
+++ b/gdb/xml-syscall.h
@@ -1,7 +1,7 @@
/* Functions that provide the mechanism to parse a syscall XML file
and get its values.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/xml-tdesc.c b/gdb/xml-tdesc.c
index f2db429..2f213dc 100644
--- a/gdb/xml-tdesc.c
+++ b/gdb/xml-tdesc.c
@@ -1,6 +1,6 @@
/* XML target description support for GDB.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
Contributed by CodeSourcery.
@@ -670,7 +670,7 @@ file_read_description_xml (const char *filename)
return NULL;
}
- const std::string dirname = ldirname (filename);
+ const std::string dirname = gdb_ldirname (filename);
auto fetch_another = [&dirname] (const char *name)
{
return xml_fetch_content_from_file (name, dirname.c_str ());
diff --git a/gdb/xml-tdesc.h b/gdb/xml-tdesc.h
index ec71c68..75c6e02 100644
--- a/gdb/xml-tdesc.h
+++ b/gdb/xml-tdesc.h
@@ -1,6 +1,6 @@
/* XML target description support for GDB.
- Copyright (C) 2006-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006-2025 Free Software Foundation, Inc.
Contributed by CodeSourcery.
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index e7f4e6f..b63dfa0 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the Sanyo Xstormy16a (LC590000) processor.
- Copyright (C) 2001-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -435,7 +435,7 @@ xstormy16_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
return sal.end;
}
}
- /* No useable line symbol. Use result of prologue parsing method. */
+ /* No usable line symbol. Use result of prologue parsing method. */
return plg_end;
}
@@ -546,14 +546,14 @@ xstormy16_find_jmp_table_entry (struct gdbarch *gdbarch, CORE_ADDR faddr)
if (!strcmp (faddr_sect->the_bfd_section->name, ".plt"))
return faddr;
- for (obj_section *osect : faddr_sect->objfile->sections ())
+ for (obj_section &osect : faddr_sect->objfile->sections ())
{
- if (!strcmp (osect->the_bfd_section->name, ".plt"))
+ if (!strcmp (osect.the_bfd_section->name, ".plt"))
{
CORE_ADDR addr, endaddr;
- addr = osect->addr ();
- endaddr = osect->endaddr ();
+ addr = osect.addr ();
+ endaddr = osect.endaddr ();
for (; addr < endaddr; addr += 2 * xstormy16_inst_size)
{
@@ -828,9 +828,7 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
Initializer function for the Sanyo Xstormy16a module.
Called by gdb at start-up. */
-void _initialize_xstormy16_tdep ();
-void
-_initialize_xstormy16_tdep ()
+INIT_GDB_FILE (xstormy16_tdep)
{
gdbarch_register (bfd_arch_xstormy16, xstormy16_gdbarch_init);
}
diff --git a/gdb/xtensa-config.c b/gdb/xtensa-config.c
index 77eb922..b9d388b 100644
--- a/gdb/xtensa-config.c
+++ b/gdb/xtensa-config.c
@@ -1,6 +1,6 @@
/* Configuration for the Xtensa architecture for GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
index f8509b0..4a50f38 100644
--- a/gdb/xtensa-linux-nat.c
+++ b/gdb/xtensa-linux-nat.c
@@ -1,6 +1,6 @@
/* Xtensa GNU/Linux native support.
- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+ Copyright (C) 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -327,9 +327,7 @@ ps_get_thread_area (struct ps_prochandle *ph,
return PS_OK;
}
-void _initialize_xtensa_linux_nat ();
-void
-_initialize_xtensa_linux_nat ()
+INIT_GDB_FILE (xtensa_linux_nat)
{
const xtensa_regtable_t *ptr;
diff --git a/gdb/xtensa-linux-tdep.c b/gdb/xtensa-linux-tdep.c
index 7c215e3..7792408 100644
--- a/gdb/xtensa-linux-tdep.c
+++ b/gdb/xtensa-linux-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux on Xtensa processors.
- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+ Copyright (C) 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,6 +20,7 @@
#include "xtensa-tdep.h"
#include "osabi.h"
#include "linux-tdep.h"
+#include "solib-svr4-linux.h"
#include "solib-svr4.h"
#include "symtab.h"
#include "gdbarch.h"
@@ -111,8 +112,7 @@ xtensa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
linux_init_abi (info, gdbarch, 0);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_linux_ilp32_svr4_solib_ops);
set_gdbarch_gdb_signal_from_target (gdbarch,
xtensa_linux_gdb_signal_from_target);
@@ -124,9 +124,7 @@ xtensa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
svr4_fetch_objfile_link_map);
}
-void _initialize_xtensa_linux_tdep ();
-void
-_initialize_xtensa_linux_tdep ()
+INIT_GDB_FILE (xtensa_linux_tdep)
{
gdbarch_register_osabi (bfd_arch_xtensa, bfd_mach_xtensa, GDB_OSABI_LINUX,
xtensa_linux_init_abi);
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index c87940c..8a2f129 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the Xtensa port of GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1767,7 +1767,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
arg_type = builtin_type (gdbarch)->builtin_long;
arg = value_cast (arg_type, arg);
}
- /* Aligment is equal to the type length for the basic types. */
+ /* Alignment is equal to the type length for the basic types. */
info->align = arg_type->length ();
break;
@@ -3238,8 +3238,7 @@ xtensa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_iterate_over_regset_sections
(gdbarch, xtensa_iterate_over_regset_sections);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_ops (gdbarch, make_svr4_ilp32_solib_ops);
/* Hook in the ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
@@ -3253,9 +3252,7 @@ xtensa_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
error (_("xtensa_dump_tdep(): not implemented"));
}
-void _initialize_xtensa_tdep ();
-void
-_initialize_xtensa_tdep ()
+INIT_GDB_FILE (xtensa_tdep)
{
gdbarch_register (bfd_arch_xtensa, xtensa_gdbarch_init, xtensa_dump_tdep);
xtensa_init_reggroups ();
diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h
index 832b4fb..2e7e19b 100644
--- a/gdb/xtensa-tdep.h
+++ b/gdb/xtensa-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for the Xtensa port of GDB, the GNU debugger.
- Copyright (C) 2003-2024 Free Software Foundation, Inc.
+ Copyright (C) 2003-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/xtensa-xtregs.c b/gdb/xtensa-xtregs.c
index bd2c1a3..d86b5fd 100644
--- a/gdb/xtensa-xtregs.c
+++ b/gdb/xtensa-xtregs.c
@@ -1,5 +1,5 @@
/* Table mapping between kernel xtregset and GDB register cache.
- Copyright (C) 2007-2024 Free Software Foundation, Inc.
+ Copyright (C) 2007-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/yy-remap.h b/gdb/yy-remap.h
index af74961..bb6cef0 100644
--- a/gdb/yy-remap.h
+++ b/gdb/yy-remap.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1986-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c
index c75b6ff..9ae8b7a 100644
--- a/gdb/z80-tdep.c
+++ b/gdb/z80-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for the Z80.
- Copyright (C) 1986-2024 Free Software Foundation, Inc.
+ Copyright (C) 1986-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -961,12 +961,12 @@ z80_overlay_update_1 (struct obj_section *osect)
i = 0;
/* we have interest for sections with same VMA */
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section *sect : objfile->sections ())
- if (section_is_overlay (sect))
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &sect : objfile.sections ())
+ if (section_is_overlay (&sect))
{
- sect->ovly_mapped = (lma == bfd_section_lma (sect->the_bfd_section));
- i |= sect->ovly_mapped; /* true, if at least one section is mapped */
+ sect.ovly_mapped = (lma == bfd_section_lma (sect.the_bfd_section));
+ i |= sect.ovly_mapped; /* true, if at least one section is mapped */
}
return i;
}
@@ -984,19 +984,19 @@ z80_overlay_update (struct obj_section *osect)
return;
/* Update all sections, even if only one was requested. */
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section *sect : objfile->sections ())
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &sect : objfile.sections ())
{
- if (!section_is_overlay (sect))
+ if (!section_is_overlay (&sect))
continue;
- asection *bsect = sect->the_bfd_section;
+ asection *bsect = sect.the_bfd_section;
bfd_vma lma = bfd_section_lma (bsect);
bfd_vma vma = bfd_section_vma (bsect);
for (int i = 0; i < cache_novly_regions; ++i)
if (cache_ovly_region_table[i][Z80_VMA] == vma)
- sect->ovly_mapped =
+ sect.ovly_mapped =
(cache_ovly_region_table[i][Z80_MAPPED_TO_LMA] == lma);
}
}
@@ -1173,7 +1173,7 @@ z80_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_skip_prologue (gdbarch, z80_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan); // falling stack
- set_gdbarch_software_single_step (gdbarch, z80_software_single_step);
+ set_gdbarch_get_next_pcs (gdbarch, z80_software_single_step);
set_gdbarch_breakpoint_kind_from_pc (gdbarch, z80_breakpoint_kind_from_pc);
set_gdbarch_sw_breakpoint_from_kind (gdbarch, z80_sw_breakpoint_from_kind);
set_gdbarch_insn_is_call (gdbarch, z80_insn_is_call);
@@ -1331,14 +1331,14 @@ ez80_ddfd_insn_table[] =
{ 0007, 0307, 2, insn_default }, //"ld rr,(ii+d)"
{ 0061, 0377, 2, insn_default }, //"ld ii,(ii+d)"
/* common instructions */
- { 0011, 0367, 2, insn_default }, //"add ii,rr"
+ { 0011, 0317, 1, insn_default }, //"add ii,rr"
{ 0041, 0377, 3, insn_default }, //"ld ii,nn"
{ 0042, 0367, 3, insn_default }, //"ld (nn),ii", "ld ii,(nn)"
{ 0043, 0367, 1, insn_default }, //"inc ii", "dec ii"
{ 0044, 0366, 1, insn_default }, //"inc/dec iih/iil"
{ 0046, 0367, 2, insn_default }, //"ld iih,n", "ld iil,n"
{ 0064, 0376, 2, insn_default }, //"inc (ii+d)", "dec (ii+d)"
- { 0066, 0377, 2, insn_default }, //"ld (ii+d),n"
+ { 0066, 0377, 3, insn_default }, //"ld (ii+d),n"
{ 0166, 0377, 0, insn_default }, //not an instruction
{ 0160, 0370, 2, insn_default }, //"ld (ii+d),r"
{ 0104, 0306, 1, insn_default }, //"ld r,iih", "ld r,iil"
@@ -1360,7 +1360,7 @@ ez80_adl_ddfd_insn_table[] =
{
{ 0007, 0307, 2, insn_default }, //"ld rr,(ii+d)"
{ 0061, 0377, 2, insn_default }, //"ld ii,(ii+d)"
- { 0011, 0367, 1, insn_default }, //"add ii,rr"
+ { 0011, 0317, 1, insn_default }, //"add ii,rr"
{ 0041, 0377, 4, insn_default }, //"ld ii,nn"
{ 0042, 0367, 4, insn_default }, //"ld (nn),ii", "ld ii,(nn)"
{ 0043, 0367, 1, insn_default }, //"inc ii", "dec ii"
@@ -1455,10 +1455,7 @@ z80_get_insn_info (struct gdbarch *gdbarch, const gdb_byte *buf, int *size)
while (1);
}
-extern initialize_file_ftype _initialize_z80_tdep;
-
-void
-_initialize_z80_tdep ()
+INIT_GDB_FILE (z80_tdep)
{
gdbarch_register (bfd_arch_z80, z80_gdbarch_init);
initialize_tdesc_z80 ();
diff --git a/gdb/z80-tdep.h b/gdb/z80-tdep.h
index 19a7d04..b893fa7 100644
--- a/gdb/z80-tdep.h
+++ b/gdb/z80-tdep.h
@@ -1,6 +1,6 @@
/* Target-dependent code for the Z80.
- Copyright (C) 2002-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002-2025 Free Software Foundation, Inc.
This file is part of GDB.